Page MenuHomeFreeBSD

D5254.id13640.diff
No OneTemporary

D5254.id13640.diff

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
@@ -356,82 +356,9 @@
return (BUS_PROBE_DEFAULT);
}
-#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);
-#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.
*
* Here, we
@@ -466,23 +393,18 @@
/*
* 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) {
- if(bootverbose)
- printf("Error VMBUS: Cannot find free IDT slot for "
- "vmbus callback!\n");
- goto cleanup;
- }
-
- if(bootverbose)
- printf("VMBUS: vmbus callback vector %d\n",
- hv_vmbus_g_context.hv_cb_vector);
+#ifdef __i386__
+ setidt(IDT_EVTCHN, IDTVEC(hv_vmbus_callback), SDT_SYS386IGT,
+ SEL_KPL, GSEL(GCODE_SEL, SEL_KPL));
+#else
+ setidt(IDT_EVTCHN, IDTVEC(hv_vmbus_callback), SDT_SYSIGT,
+ SEL_KPL, 0);
+#endif
/*
* Notify the hypervisor of our vector.
*/
- setup_args.vector = hv_vmbus_g_context.hv_cb_vector;
+ setup_args.vector = IDT_EVTCHN;
CPU_FOREACH(j) {
hv_vmbus_g_context.hv_msg_intr_event[j] = NULL;
@@ -583,9 +505,8 @@
hv_vmbus_g_context.hv_msg_intr_event[j] = NULL;
}
- vmbus_vector_free(hv_vmbus_g_context.hv_cb_vector);
+ setidt(IDT_EVTCHN, IDTVEC(rsvd), SDT_SYSIGT, SEL_KPL, 0);
- cleanup:
hv_vmbus_cleanup();
return (ret);
@@ -652,7 +573,7 @@
hv_vmbus_g_context.hv_msg_intr_event[i] = NULL;
}
- vmbus_vector_free(hv_vmbus_g_context.hv_cb_vector);
+ setidt(IDT_EVTCHN, IDTVEC(rsvd), SDT_SYSIGT, SEL_KPL, 0);
return;
}
Index: sys/dev/hyperv/vmbus/hv_vmbus_priv.h
===================================================================
--- sys/dev/hyperv/vmbus/hv_vmbus_priv.h
+++ sys/dev/hyperv/vmbus/hv_vmbus_priv.h
@@ -205,11 +205,6 @@
struct taskqueue *hv_event_queue[MAXCPU];
struct intr_event *hv_msg_intr_event[MAXCPU];
void *msg_swintr[MAXCPU];
- /*
- * Host use this vector to intrrupt guest for vmbus channel
- * event and msg.
- */
- unsigned int hv_cb_vector;
} hv_vmbus_context;
/*
Index: sys/x86/x86/local_apic.c
===================================================================
--- sys/x86/x86/local_apic.c
+++ sys/x86/x86/local_apic.c
@@ -522,7 +522,7 @@
lapics[apic_id].la_ioint_irqs[IDT_DTRACE_RET - APIC_IO_INTS] =
IRQ_DTRACE_RET;
#endif
-#ifdef XENHVM
+#if defined(XENHVM) || defined(HYPERV)
lapics[apic_id].la_ioint_irqs[IDT_EVTCHN - APIC_IO_INTS] = IRQ_EVTCHN;
#endif

File Metadata

Mime Type
text/plain
Expires
Fri, Jul 31, 9:14 AM (1 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35778899
Default Alt Text
D5254.id13640.diff (4 KB)

Event Timeline