Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F111015089
D5254.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
6 KB
Referenced Files
None
Subscribers
None
D5254.diff
View Options
Index: sys/amd64/amd64/machdep.c
===================================================================
--- sys/amd64/amd64/machdep.c
+++ sys/amd64/amd64/machdep.c
@@ -1610,7 +1610,7 @@
setidt(IDT_DTRACE_RET, &IDTVEC(dtrace_ret), SDT_SYSIGT, SEL_UPL, 0);
#endif
#ifdef XENHVM
- setidt(IDT_EVTCHN, &IDTVEC(xen_intr_upcall), SDT_SYSIGT, SEL_UPL, 0);
+ setidt(IDT_HYPERVISOR, &IDTVEC(xen_intr_upcall), SDT_SYSIGT, SEL_UPL, 0);
#endif
r_idt.rd_limit = sizeof(idt0) - 1;
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_HYPERVISOR, IDTVEC(hv_vmbus_callback), SDT_SYS386IGT,
+ SEL_KPL, GSEL(GCODE_SEL, SEL_KPL));
+#else
+ setidt(IDT_HYPERVISOR, 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_HYPERVISOR;
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_HYPERVISOR, 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_HYPERVISOR, 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/include/segments.h
===================================================================
--- sys/x86/include/segments.h
+++ sys/x86/include/segments.h
@@ -213,7 +213,7 @@
#define IDT_IO_INTS NRSVIDT /* Base of IDT entries for I/O interrupts. */
#define IDT_SYSCALL 0x80 /* System Call Interrupt Vector */
#define IDT_DTRACE_RET 0x92 /* DTrace pid provider Interrupt Vector */
-#define IDT_EVTCHN 0x93 /* Xen HVM Event Channel Interrupt Vector */
+#define IDT_HYPERVISOR 0x93 /* Hypervisor deliver events Interrupt Vector*/
#if defined(__i386__)
/*
Index: sys/x86/x86/local_apic.c
===================================================================
--- sys/x86/x86/local_apic.c
+++ sys/x86/x86/local_apic.c
@@ -92,7 +92,7 @@
#define IRQ_TIMER (NUM_IO_INTS + 1)
#define IRQ_SYSCALL (NUM_IO_INTS + 2)
#define IRQ_DTRACE_RET (NUM_IO_INTS + 3)
-#define IRQ_EVTCHN (NUM_IO_INTS + 4)
+#define IRQ_HYPERVISOR (NUM_IO_INTS + 4)
/*
* Support for local APICs. Local APICs manage interrupts on each
@@ -522,8 +522,8 @@
lapics[apic_id].la_ioint_irqs[IDT_DTRACE_RET - APIC_IO_INTS] =
IRQ_DTRACE_RET;
#endif
-#ifdef XENHVM
- lapics[apic_id].la_ioint_irqs[IDT_EVTCHN - APIC_IO_INTS] = IRQ_EVTCHN;
+#if defined(XENHVM) || defined(HYPERV)
+ lapics[apic_id].la_ioint_irqs[IDT_HYPERVISOR - APIC_IO_INTS] = IRQ_HYPERVISOR;
#endif
@@ -1381,8 +1381,8 @@
if (irq == IRQ_DTRACE_RET)
continue;
#endif
-#ifdef XENHVM
- if (irq == IRQ_EVTCHN)
+#if defined(XENHVM) || defined(HYPERV)
+ if (irq == IRQ_HYPERVISOR)
continue;
#endif
db_printf("vec 0x%2x -> ", i + APIC_IO_INTS);
Index: sys/x86/xen/hvm.c
===================================================================
--- sys/x86/xen/hvm.c
+++ sys/x86/xen/hvm.c
@@ -194,7 +194,7 @@
if (xen_feature(XENFEAT_hvm_callback_vector) != 0) {
int error;
- xhp.value = HVM_CALLBACK_VECTOR(IDT_EVTCHN);
+ xhp.value = HVM_CALLBACK_VECTOR(IDT_HYPERVISOR);
error = HYPERVISOR_hvm_op(HVMOP_set_param, &xhp);
if (error == 0) {
xen_vector_callback_enabled = 1;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Feb 27, 5:59 AM (16 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16862455
Default Alt Text
D5254.diff (6 KB)
Attached To
Mode
D5254: hyperv/vmbus: static assign IDT vector for hv
Attached
Detach File
Event Timeline
Log In to Comment