Skip to content

Commit

Permalink
[hyperv] Add support for VMBus devices
Browse files Browse the repository at this point in the history
Add support for an abstraction of a VMBus device.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
mcb30 committed Dec 18, 2014
1 parent d77a546 commit d189497
Show file tree
Hide file tree
Showing 7 changed files with 1,905 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Makefile
Expand Up @@ -86,6 +86,7 @@ SRCDIRS += drivers/infiniband
SRCDIRS += interface/pxe interface/efi interface/smbios
SRCDIRS += interface/bofm
SRCDIRS += interface/xen
SRCDIRS += interface/hyperv
SRCDIRS += tests
SRCDIRS += crypto crypto/axtls crypto/matrixssl
SRCDIRS += hci hci/commands hci/tui
Expand Down
8 changes: 8 additions & 0 deletions src/arch/x86/drivers/hyperv/hyperv.c
Expand Up @@ -38,6 +38,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <ipxe/cpuid.h>
#include <ipxe/msr.h>
#include <ipxe/hyperv.h>
#include <ipxe/vmbus.h>
#include "hyperv.h"

/** Maximum time to wait for a message response
Expand Down Expand Up @@ -506,9 +507,15 @@ static int hv_probe ( struct root_device *rootdev ) {
if ( ( rc = hv_map_synic ( hv ) ) != 0 )
goto err_map_synic;

/* Probe Hyper-V devices */
if ( ( rc = vmbus_probe ( hv, &rootdev->dev ) ) != 0 )
goto err_vmbus_probe;

rootdev_set_drvdata ( rootdev, hv );
return 0;

vmbus_remove ( hv, &rootdev->dev );
err_vmbus_probe:
hv_unmap_synic ( hv );
err_map_synic:
hv_unmap_hypercall ( hv );
Expand All @@ -532,6 +539,7 @@ static int hv_probe ( struct root_device *rootdev ) {
static void hv_remove ( struct root_device *rootdev ) {
struct hv_hypervisor *hv = rootdev_get_drvdata ( rootdev );

vmbus_remove ( hv, &rootdev->dev );
hv_unmap_synic ( hv );
hv_unmap_hypercall ( hv );
hv_free_message ( hv );
Expand Down
3 changes: 3 additions & 0 deletions src/include/ipxe/device.h
Expand Up @@ -63,6 +63,9 @@ struct device_description {
/** Xen bus type */
#define BUS_TYPE_XEN 8

/** Hyper-V bus type */
#define BUS_TYPE_HV 9

/** A hardware device */
struct device {
/** Name */
Expand Down
1 change: 1 addition & 0 deletions src/include/ipxe/errfile.h
Expand Up @@ -309,6 +309,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
#define ERRFILE_xengrant ( ERRFILE_OTHER | 0x00440000 )
#define ERRFILE_efi_utils ( ERRFILE_OTHER | 0x00450000 )
#define ERRFILE_efi_wrap ( ERRFILE_OTHER | 0x00460000 )
#define ERRFILE_vmbus ( ERRFILE_OTHER | 0x00470000 )

/** @} */

Expand Down
2 changes: 2 additions & 0 deletions src/include/ipxe/hyperv.h
Expand Up @@ -197,6 +197,8 @@ struct hv_hypervisor {
struct hv_synic synic;
/** Message buffer */
union hv_message_buffer *message;
/** Virtual machine bus */
struct vmbus *vmbus;
};

#include <bits/hyperv.h>
Expand Down

0 comments on commit d189497

Please sign in to comment.