svn commit: r302111 - stable/10/sys/dev/hyperv/vmbus
Sepherosa Ziehau
sephe at FreeBSD.org
Thu Jun 23 02:53:25 UTC 2016
Author: sephe
Date: Thu Jun 23 02:53:24 2016
New Revision: 302111
URL: https://svnweb.freebsd.org/changeset/base/302111
Log:
MFC 300108,300111,300112,300120,300121
300108
hyperv/vmbus: Minor white space and style cleanup
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6407
300111
hyperv/vmbus: Utilize curcpu
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6408
300112
hyperv/vmbus: Function renaming vmbus_msg_swintr -> vmbus_msg_task
It is not an SWI handler for a long time.
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6409
300120
hyperv/vmbus: Remove useless modevent handler
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6410
300121
hyperv/vmbus: Nuke unnecessary function indirection
MFC after: 1 week
Sponsored by: Microsoft OSTC
Differential Revision: https://reviews.freebsd.org/D6411
Modified:
stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
==============================================================================
--- stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Thu Jun 23 02:53:00 2016 (r302110)
+++ stable/10/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c Thu Jun 23 02:53:24 2016 (r302111)
@@ -74,28 +74,18 @@ static hv_setup_args setup_args; /* only
static char *vmbus_ids[] = { "VMBUS", NULL };
-/**
- * @brief Software interrupt thread routine to handle channel messages from
- * the hypervisor.
- */
static void
-vmbus_msg_swintr(void *arg, int pending __unused)
+vmbus_msg_task(void *arg __unused, int pending __unused)
{
- int cpu;
- void* page_addr;
- hv_vmbus_channel_msg_header *hdr;
- hv_vmbus_channel_msg_table_entry *entry;
- hv_vmbus_channel_msg_type msg_type;
- hv_vmbus_message* msg;
-
- cpu = (int)(long)arg;
- KASSERT(cpu <= mp_maxid, ("VMBUS: vmbus_msg_swintr: "
- "cpu out of range!"));
-
- page_addr = hv_vmbus_g_context.syn_ic_msg_page[cpu];
- msg = (hv_vmbus_message*) page_addr + HV_VMBUS_MESSAGE_SINT;
+ hv_vmbus_message *msg;
+ msg = ((hv_vmbus_message *)hv_vmbus_g_context.syn_ic_msg_page[curcpu]) +
+ HV_VMBUS_MESSAGE_SINT;
for (;;) {
+ const hv_vmbus_channel_msg_table_entry *entry;
+ hv_vmbus_channel_msg_header *hdr;
+ hv_vmbus_channel_msg_type msg_type;
+
if (msg->header.message_type == HV_MESSAGE_TYPE_NONE)
break; /* no message */
@@ -108,32 +98,29 @@ vmbus_msg_swintr(void *arg, int pending
}
entry = &g_channel_message_table[msg_type];
-
if (entry->messageHandler)
entry->messageHandler(hdr);
handled:
- msg->header.message_type = HV_MESSAGE_TYPE_NONE;
-
- /*
- * Make sure the write to message_type (ie set to
- * HV_MESSAGE_TYPE_NONE) happens before we read the
- * message_pending and EOMing. Otherwise, the EOMing will
- * not deliver any more messages
- * since there is no empty slot
- *
- * NOTE:
- * mb() is used here, since atomic_thread_fence_seq_cst()
- * will become compiler fence on UP kernel.
- */
- mb();
-
- if (msg->header.message_flags.u.message_pending) {
+ msg->header.message_type = HV_MESSAGE_TYPE_NONE;
+ /*
+ * Make sure the write to message_type (ie set to
+ * HV_MESSAGE_TYPE_NONE) happens before we read the
+ * message_pending and EOMing. Otherwise, the EOMing will
+ * not deliver any more messages
+ * since there is no empty slot
+ *
+ * NOTE:
+ * mb() is used here, since atomic_thread_fence_seq_cst()
+ * will become compiler fence on UP kernel.
+ */
+ mb();
+ if (msg->header.message_flags.u.message_pending) {
/*
* This will cause message queue rescan to possibly
* deliver another msg from the hypervisor
*/
wrmsr(HV_X64_MSR_EOM, 0);
- }
+ }
}
}
@@ -147,11 +134,9 @@ static inline int
hv_vmbus_isr(struct trapframe *frame)
{
struct vmbus_softc *sc = vmbus_get_softc();
- int cpu;
- hv_vmbus_message* msg;
- void* page_addr;
-
- cpu = PCPU_GET(cpuid);
+ int cpu = curcpu;
+ hv_vmbus_message *msg;
+ void *page_addr;
/*
* The Windows team has advised that we check for events
@@ -162,7 +147,7 @@ hv_vmbus_isr(struct trapframe *frame)
/* Check if there are actual msgs to be process */
page_addr = hv_vmbus_g_context.syn_ic_msg_page[cpu];
- msg = (hv_vmbus_message*) page_addr + HV_VMBUS_TIMER_SINT;
+ msg = ((hv_vmbus_message *)page_addr) + HV_VMBUS_TIMER_SINT;
/* we call eventtimer process the message */
if (msg->header.message_type == HV_MESSAGE_TIMER_EXPIRED) {
@@ -193,7 +178,7 @@ hv_vmbus_isr(struct trapframe *frame)
}
}
- msg = (hv_vmbus_message*) page_addr + HV_VMBUS_MESSAGE_SINT;
+ msg = ((hv_vmbus_message *)page_addr) + HV_VMBUS_MESSAGE_SINT;
if (msg->header.message_type != HV_MESSAGE_TYPE_NONE) {
taskqueue_enqueue(hv_vmbus_g_context.hv_msg_tq[cpu],
&hv_vmbus_g_context.hv_msg_task[cpu]);
@@ -534,7 +519,7 @@ vmbus_bus_init(void)
taskqueue_start_threads(&hv_vmbus_g_context.hv_msg_tq[j], 1, PI_NET,
"hvmsg%d", j);
TASK_INIT(&hv_vmbus_g_context.hv_msg_task[j], 0,
- vmbus_msg_swintr, (void *)(long)j);
+ vmbus_msg_task, NULL);
CPU_SETOF(j, &cpu_mask);
TASK_INIT(&cpuset_task, 0, vmbus_cpuset_setthread_task, &cpu_mask);
@@ -654,8 +639,8 @@ vmbus_init(void)
vmbus_bus_init();
}
-static void
-vmbus_bus_exit(void)
+static int
+vmbus_detach(device_t dev)
{
int i;
@@ -681,49 +666,6 @@ vmbus_bus_exit(void)
vmbus_vector_free(hv_vmbus_g_context.hv_cb_vector);
- return;
-}
-
-static void
-vmbus_exit(void)
-{
- vmbus_bus_exit();
-}
-
-static int
-vmbus_detach(device_t dev)
-{
- vmbus_exit();
- return (0);
-}
-
-static void
-vmbus_mod_load(void)
-{
- if(bootverbose)
- printf("VMBUS: load\n");
-}
-
-static void
-vmbus_mod_unload(void)
-{
- if(bootverbose)
- printf("VMBUS: unload\n");
-}
-
-static int
-vmbus_modevent(module_t mod, int what, void *arg)
-{
- switch (what) {
-
- case MOD_LOAD:
- vmbus_mod_load();
- break;
- case MOD_UNLOAD:
- vmbus_mod_unload();
- break;
- }
-
return (0);
}
@@ -753,7 +695,7 @@ static driver_t vmbus_driver = {
devclass_t vmbus_devclass;
-DRIVER_MODULE(vmbus, acpi, vmbus_driver, vmbus_devclass, vmbus_modevent, 0);
+DRIVER_MODULE(vmbus, acpi, vmbus_driver, vmbus_devclass, NULL, NULL);
MODULE_DEPEND(vmbus, acpi, 1, 1, 1);
MODULE_VERSION(vmbus, 1);
More information about the svn-src-stable-10
mailing list