Posting IRQs is a lot like poking a core, especially when you try and think about it in an architecture independent manner. I_POKE_CORE is normally a way to make sure a core isn't halted. For VMs, it's now also a way to poke the VMX hardware to inject an IRQ if necessary.
Note that if we want to post an IRQ and send an I_POKE_CORE, but the VM exits before the IRQ gets there, we just run the regular POKE_ handler, which does nothing. This also makes our life a little easier, in that handle_vmexit_ext_irq() doesn't need to think about getting an I_POKE. Poke's aren't full-up IRQs (requiring a registered handler) regardless of whether they are sent to a core running a VM or a 'regular' core. Signed-off-by: Barret Rhoden <[email protected]> --- kern/arch/x86/trap.h | 1 - kern/arch/x86/trapentry64.S | 2 +- kern/arch/x86/vmm/intel/vmx.c | 4 ++-- kern/arch/x86/vmm/vmm.c | 12 ------------ 4 files changed, 3 insertions(+), 16 deletions(-) diff --git a/kern/arch/x86/trap.h b/kern/arch/x86/trap.h index c7107be044a7..c121744b28be 100644 --- a/kern/arch/x86/trap.h +++ b/kern/arch/x86/trap.h @@ -61,7 +61,6 @@ #define I_SMP_CALL3 (I_SMP_CALL0 + 3) #define I_SMP_CALL4 (I_SMP_CALL0 + 4) #define I_SMP_CALL_LAST I_SMP_CALL4 -#define I_VMMCP_POSTED (I_SMP_CALL_LAST + 1) #define I_TESTING 237 /* Testing IPI (used in testing.c) */ #define I_POKE_CORE 238 #define I_KERNEL_MSG 239 diff --git a/kern/arch/x86/trapentry64.S b/kern/arch/x86/trapentry64.S index 47233142cec6..5cda65580555 100644 --- a/kern/arch/x86/trapentry64.S +++ b/kern/arch/x86/trapentry64.S @@ -312,7 +312,7 @@ IRQ_HANDLER(IRQ193, I_SMP_CALL1) IRQ_HANDLER(IRQ194, I_SMP_CALL2) IRQ_HANDLER(IRQ195, I_SMP_CALL3) IRQ_HANDLER(IRQ196, I_SMP_CALL4) -IRQ_HANDLER(IRQ197, I_VMMCP_POSTED) +IRQ_HANDLER(IRQ197, 229) IRQ_HANDLER(IRQ198, 230) IRQ_HANDLER(IRQ199, 231) IRQ_HANDLER(IRQ200, 232) diff --git a/kern/arch/x86/vmm/intel/vmx.c b/kern/arch/x86/vmm/intel/vmx.c index efa6892e650c..132bb166e5a2 100644 --- a/kern/arch/x86/vmm/intel/vmx.c +++ b/kern/arch/x86/vmm/intel/vmx.c @@ -929,7 +929,7 @@ static int vmx_setup_initial_guest_state(struct proc *p, vmcs_write32(VM_ENTRY_INTR_INFO_FIELD, 0); /* 22.2.1 */ /* Initialize posted interrupt notification vector */ - vmcs_write16(POSTED_NOTIFICATION_VEC, I_VMMCP_POSTED); + vmcs_write16(POSTED_NOTIFICATION_VEC, I_POKE_CORE); /* Clear the EOI exit bitmap */ vmcs_writel(EOI_EXIT_BITMAP0, 0); @@ -1160,7 +1160,7 @@ int vmx_interrupt_notify(struct vmctl *v) /* Assume we want to IPI guest pcore 0 (which vmctl controlled). */ int vm_core = current->vmm.guest_pcores[0]->cpu; - send_ipi(vm_core, I_VMMCP_POSTED); + send_ipi(vm_core, I_POKE_CORE); return 0; } diff --git a/kern/arch/x86/vmm/vmm.c b/kern/arch/x86/vmm/vmm.c index 128fc68521a6..6d183aab0a08 100644 --- a/kern/arch/x86/vmm/vmm.c +++ b/kern/arch/x86/vmm/vmm.c @@ -23,8 +23,6 @@ /* TODO: have better cpuid info storage and checks */ bool x86_supports_vmx = FALSE; -static void vmmcp_posted_handler(struct hw_trapframe *hw_tf, void *data); - /* Figure out what kind of CPU we are on, and if it supports any reasonable * virtualization. For now, if we're not some sort of newer intel, don't * bother. This does all cores. Again, note, we make these decisions at runtime, @@ -39,11 +37,6 @@ void vmm_init(void) */ ret = intel_vmm_init(); if (! ret) { - printd("intel_vmm_init worked\n"); - - //Register I_VMMCP_POSTED IRQ - //register_irq(I_VMMCP_POSTED, vmmcp_posted_handler, NULL, - // MKBUS(BusLAPIC, 0, 0, 0)); x86_supports_vmx = TRUE; return; } @@ -53,11 +46,6 @@ void vmm_init(void) return; } -static void vmmcp_posted_handler(struct hw_trapframe *hw_tf, void *data) -{ - printk("%s\n", __func__); -} - void vmm_pcpu_init(void) { struct per_cpu_info *pcpui = &per_cpu_info[core_id()]; -- 2.7.0.rc3.207.g0ac5344 -- You received this message because you are subscribed to the Google Groups "Akaros" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. For more options, visit https://groups.google.com/d/optout.
