Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F153262860
D6519.id16766.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D6519.id16766.diff
View Options
Index: sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
===================================================================
--- sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
+++ sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
@@ -377,34 +377,17 @@
{
int cpu;
- /*
- * Find a free IDT vector for vmbus messages/events.
- */
- sc->vmbus_idtvec = lapic_ipi_alloc(IDTVEC(hv_vmbus_callback));
- if (sc->vmbus_idtvec < 0) {
- device_printf(sc->vmbus_dev, "cannot find free IDT vector\n");
- return ENXIO;
- }
- if(bootverbose) {
- device_printf(sc->vmbus_dev, "vmbus IDT vector %d\n",
- sc->vmbus_idtvec);
- }
-
CPU_FOREACH(cpu) {
char buf[MAXCOMLEN + 1];
+ cpuset_t cpu_mask;
+ /* Allocate an interrupt counter for Hyper-V interrupt */
snprintf(buf, sizeof(buf), "cpu%d:hyperv", cpu);
intrcnt_add(buf, VMBUS_PCPU_PTR(sc, intr_cnt, cpu));
- }
-
- /*
- * Per cpu setup.
- */
- CPU_FOREACH(cpu) {
- cpuset_t cpu_mask;
/*
- * Setup taskqueue to handle events
+ * Setup taskqueue to handle events. Task will be per-
+ * channel.
*/
hv_vmbus_g_context.hv_event_queue[cpu] =
taskqueue_create_fast("hyperv event", M_WAITOK,
@@ -416,7 +399,7 @@
&cpu_mask, "hvevent%d", cpu);
/*
- * Setup per-cpu tasks and taskqueues to handle msg.
+ * Setup tasks and taskqueues to handle messages.
*/
hv_vmbus_g_context.hv_msg_tq[cpu] = taskqueue_create_fast(
"hyperv msg", M_WAITOK, taskqueue_thread_enqueue,
@@ -428,6 +411,20 @@
TASK_INIT(&hv_vmbus_g_context.hv_msg_task[cpu], 0,
vmbus_msg_task, sc);
}
+
+ /*
+ * All Hyper-V ISR required resources are setup, now let's find a
+ * free IDT vector for Hyper-V ISR and set it up.
+ */
+ sc->vmbus_idtvec = lapic_ipi_alloc(IDTVEC(hv_vmbus_callback));
+ if (sc->vmbus_idtvec < 0) {
+ device_printf(sc->vmbus_dev, "cannot find free IDT vector\n");
+ return ENXIO;
+ }
+ if(bootverbose) {
+ device_printf(sc->vmbus_dev, "vmbus IDT vector %d\n",
+ sc->vmbus_idtvec);
+ }
return 0;
}
@@ -436,6 +433,11 @@
{
int cpu;
+ if (sc->vmbus_idtvec >= 0) {
+ lapic_ipi_free(sc->vmbus_idtvec);
+ sc->vmbus_idtvec = -1;
+ }
+
CPU_FOREACH(cpu) {
if (hv_vmbus_g_context.hv_event_queue[cpu] != NULL) {
taskqueue_free(hv_vmbus_g_context.hv_event_queue[cpu]);
@@ -448,10 +450,6 @@
hv_vmbus_g_context.hv_msg_tq[cpu] = NULL;
}
}
- if (sc->vmbus_idtvec >= 0) {
- lapic_ipi_free(sc->vmbus_idtvec);
- sc->vmbus_idtvec = -1;
- }
}
static int
@@ -623,16 +621,16 @@
sc = vmbus_get_softc();
/*
- * Setup interrupt.
+ * Allocate DMA stuffs.
*/
- ret = vmbus_intr_setup(sc);
+ ret = vmbus_dma_alloc(sc);
if (ret != 0)
goto cleanup;
/*
- * Allocate DMA stuffs.
+ * Setup interrupt.
*/
- ret = vmbus_dma_alloc(sc);
+ ret = vmbus_intr_setup(sc);
if (ret != 0)
goto cleanup;
@@ -664,8 +662,8 @@
return (ret);
cleanup:
- vmbus_dma_free(sc);
vmbus_intr_teardown(sc);
+ vmbus_dma_free(sc);
return (ret);
}
@@ -728,8 +726,8 @@
smp_rendezvous(NULL, vmbus_synic_teardown, NULL, NULL);
- vmbus_dma_free(sc);
vmbus_intr_teardown(sc);
+ vmbus_dma_free(sc);
return (0);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Apr 21, 3:19 AM (21 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31884297
Default Alt Text
D6519.id16766.diff (3 KB)
Attached To
Mode
D6519: hyperv/vmbus: Allocate/setup IDT vector after all ISR resources are ready
Attached
Detach File
Event Timeline
Log In to Comment