Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F106143011
D5850.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
D5850.diff
View Options
Index: head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
===================================================================
--- head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
+++ head/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
@@ -391,80 +391,9 @@
}
#ifdef HYPERV
-extern inthand_t IDTVEC(rsvd), IDTVEC(hv_vmbus_callback);
-
-/**
- * @brief Find a free IDT slot and setup the interrupt handler.
- */
-static int
-vmbus_vector_alloc(void)
-{
- int vector;
- uintptr_t func;
- struct gate_descriptor *ip;
-
- /*
- * Search backwards form the highest IDT vector available for use
- * as vmbus channel callback vector. We install 'hv_vmbus_callback'
- * handler at that vector and use it to interrupt vcpus.
- */
- vector = APIC_SPURIOUS_INT;
- while (--vector >= APIC_IPI_INTS) {
- ip = &idt[vector];
- func = ((long)ip->gd_hioffset << 16 | ip->gd_looffset);
- if (func == (uintptr_t)&IDTVEC(rsvd)) {
-#ifdef __i386__
- setidt(vector , IDTVEC(hv_vmbus_callback), SDT_SYS386IGT,
- SEL_KPL, GSEL(GCODE_SEL, SEL_KPL));
-#else
- setidt(vector , IDTVEC(hv_vmbus_callback), SDT_SYSIGT,
- SEL_KPL, 0);
+extern inthand_t IDTVEC(hv_vmbus_callback);
#endif
- return (vector);
- }
- }
- return (0);
-}
-
-/**
- * @brief Restore the IDT slot to rsvd.
- */
-static void
-vmbus_vector_free(int vector)
-{
- uintptr_t func;
- struct gate_descriptor *ip;
-
- if (vector == 0)
- return;
-
- KASSERT(vector >= APIC_IPI_INTS && vector < APIC_SPURIOUS_INT,
- ("invalid vector %d", vector));
-
- ip = &idt[vector];
- func = ((long)ip->gd_hioffset << 16 | ip->gd_looffset);
- KASSERT(func == (uintptr_t)&IDTVEC(hv_vmbus_callback),
- ("invalid vector %d", vector));
-
- setidt(vector, IDTVEC(rsvd), SDT_SYSIGT, SEL_KPL, 0);
-}
-
-#else /* HYPERV */
-
-static int
-vmbus_vector_alloc(void)
-{
- return(0);
-}
-
-static void
-vmbus_vector_free(int vector)
-{
-}
-
-#endif /* HYPERV */
-
/**
* @brief Main vmbus driver initialization routine.
*
@@ -497,12 +426,15 @@
return (ret);
}
+#ifdef HYPERV
/*
* Find a free IDT slot for vmbus callback.
*/
- hv_vmbus_g_context.hv_cb_vector = vmbus_vector_alloc();
-
- if (hv_vmbus_g_context.hv_cb_vector == 0) {
+ hv_vmbus_g_context.hv_cb_vector = lapic_ipi_alloc(IDTVEC(hv_vmbus_callback));
+#else
+ hv_vmbus_g_context.hv_cb_vector = -1;
+#endif
+ if (hv_vmbus_g_context.hv_cb_vector < 0) {
if(bootverbose)
printf("Error VMBUS: Cannot find free IDT slot for "
"vmbus callback!\n");
@@ -595,7 +527,7 @@
}
}
- vmbus_vector_free(hv_vmbus_g_context.hv_cb_vector);
+ lapic_ipi_free(hv_vmbus_g_context.hv_cb_vector);
cleanup:
hv_vmbus_cleanup();
@@ -663,7 +595,7 @@
}
}
- vmbus_vector_free(hv_vmbus_g_context.hv_cb_vector);
+ lapic_ipi_free(hv_vmbus_g_context.hv_cb_vector);
return;
}
Index: head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h
===================================================================
--- head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h
+++ head/sys/dev/hyperv/vmbus/hv_vmbus_priv.h
@@ -208,10 +208,10 @@
struct taskqueue *hv_msg_tq[MAXCPU];
struct task hv_msg_task[MAXCPU];
/*
- * Host use this vector to intrrupt guest for vmbus channel
+ * Host use this vector to interrupt guest for vmbus channel
* event and msg.
*/
- unsigned int hv_cb_vector;
+ int hv_cb_vector;
} hv_vmbus_context;
/*
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Dec 27, 2:48 AM (11 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15610411
Default Alt Text
D5850.diff (3 KB)
Attached To
Mode
D5850: hyperv: Use lapic_{alloc,free}_ipi to allocate private interrupt vector
Attached
Detach File
Event Timeline
Log In to Comment