summaryrefslogtreecommitdiffstats
path: root/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
diff options
context:
space:
mode:
authorgrehan <grehan@FreeBSD.org>2013-09-09 08:07:46 +0000
committergrehan <grehan@FreeBSD.org>2013-09-09 08:07:46 +0000
commit182a56e295b4378df6a37e1b8422fb6eec08613a (patch)
treef5547d3cd15ee1a4dc5d59529652353928079365 /sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
parent9394ef331eb7d0ba7f22583970cc84b62ad9f19a (diff)
downloadFreeBSD-src-182a56e295b4378df6a37e1b8422fb6eec08613a.zip
FreeBSD-src-182a56e295b4378df6a37e1b8422fb6eec08613a.tar.gz
Latest update from Microsoft.
Obtained from: Microsoft Hyper-v dev team
Diffstat (limited to 'sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c')
-rw-r--r--sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c33
1 files changed, 26 insertions, 7 deletions
diff --git a/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c b/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
index e010308..08c6112 100644
--- a/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
+++ b/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
@@ -68,6 +68,7 @@ static int vmbus_rid;
struct resource *intr_res;
static int vmbus_irq = VMBUS_IRQ;
static int vmbus_inited;
+static hv_setup_args setup_args; /* only CPU 0 supported at this time */
/**
* @brief Software interrupt thread routine to handle channel messages from
@@ -117,7 +118,7 @@ vmbus_msg_swintr(void *dummy)
* This will cause message queue rescan to possibly
* deliver another msg from the hypervisor
*/
- hv_vmbus_write_msr(HV_X64_MSR_EOM, 0);
+ wrmsr(HV_X64_MSR_EOM, 0);
}
}
}
@@ -339,8 +340,7 @@ vmbus_bus_init(void)
int io_bus:4;
uint32_t io_lowreg;
};
-
- int ret;
+ int i, ret;
unsigned int vector = 0;
struct intsrc *isrc;
struct ioapic_intsrc *intpin;
@@ -418,15 +418,28 @@ vmbus_bus_init(void)
/**
* Notify the hypervisor of our irq.
*/
+ setup_args.vector = vector;
+ for(i = 0; i < 2; i++) {
+ setup_args.page_buffers[i] =
+ malloc(PAGE_SIZE, M_DEVBUF, M_NOWAIT | M_ZERO);
+ if (setup_args.page_buffers[i] == NULL) {
+ KASSERT(setup_args.page_buffers[i] != NULL,
+ ("Error VMBUS: malloc failed!"));
+ if (i > 0)
+ free(setup_args.page_buffers[0], M_DEVBUF);
+ goto cleanup4;
+ }
+ }
- smp_rendezvous(NULL, hv_vmbus_synic_init, NULL, &vector);
+ /* only CPU #0 supported at this time */
+ smp_rendezvous(NULL, hv_vmbus_synic_init, NULL, &setup_args);
- /**
+ /*
* Connect to VMBus in the root partition
*/
ret = hv_vmbus_connect();
- if (ret)
+ if (ret != 0)
goto cleanup4;
hv_vmbus_request_channel_offers();
@@ -440,7 +453,6 @@ vmbus_bus_init(void)
bus_teardown_intr(vmbus_devp, intr_res, vmbus_cookiep);
cleanup3:
-
bus_release_resource(vmbus_devp, SYS_RES_IRQ, vmbus_rid, intr_res);
cleanup2:
@@ -490,11 +502,18 @@ vmbus_init(void)
static void
vmbus_bus_exit(void)
{
+ int i;
+
hv_vmbus_release_unattached_channels();
hv_vmbus_disconnect();
smp_rendezvous(NULL, hv_vmbus_synic_cleanup, NULL, NULL);
+ for(i = 0; i < 2; i++) {
+ if (setup_args.page_buffers[i] != 0)
+ free(setup_args.page_buffers[i], M_DEVBUF);
+ }
+
hv_vmbus_cleanup();
/* remove swi, bus and intr resource */
OpenPOWER on IntegriCloud