# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID c436ab500c9988f3a295f66b690ad7a98c16b54f
# Parent 2fbf11ad58f37313350e71f98f2eadb8ac37a8e4
[HVM][SVM] Fix 2/2 to nterrupt delivery logic.
Add flag to indicate that an exception event needs injecting, and to
delay the ext interrupt injection.
Remove unnecessary check of RFLAGS.IF for ExtInt injection.
Signed-off-by: Travis Betak <travis.betak@xxxxxxx>
Signed-off-by: Wei Huang <wei.huang2@xxxxxxx>
Signed-off-by: Tom Woller <thomas.woller@xxxxxxx>
---
xen/arch/x86/hvm/svm/intr.c | 22 ++++++++++------------
xen/arch/x86/hvm/svm/svm.c | 3 ++-
xen/include/asm-x86/hvm/svm/vmcb.h | 1 +
3 files changed, 13 insertions(+), 13 deletions(-)
diff -r 2fbf11ad58f3 -r c436ab500c99 xen/arch/x86/hvm/svm/intr.c
--- a/xen/arch/x86/hvm/svm/intr.c Fri Oct 20 10:09:55 2006 +0100
+++ b/xen/arch/x86/hvm/svm/intr.c Fri Oct 20 10:10:36 2006 +0100
@@ -62,7 +62,7 @@ static inline int svm_inject_extint(stru
// printf( "IRQ = %d\n", trap );
return 0;
}
-
+
asmlinkage void svm_intr_assist(void)
{
struct vcpu *v = current;
@@ -74,7 +74,6 @@ asmlinkage void svm_intr_assist(void)
int intr_type = APIC_DM_EXTINT;
int intr_vector = -1;
int re_injecting = 0;
- unsigned long rflags;
ASSERT(vmcb);
@@ -82,9 +81,16 @@ asmlinkage void svm_intr_assist(void)
/* Previous Interrupt delivery caused this Intercept? */
if (vmcb->exitintinfo.fields.v && (vmcb->exitintinfo.fields.type == 0)) {
v->arch.hvm_svm.saved_irq_vector = vmcb->exitintinfo.fields.vector;
-// printk("Injecting PF#: saving IRQ from ExitInfo\n");
vmcb->exitintinfo.bytes = 0;
re_injecting = 1;
+ }
+
+ /*
+ * If event requires injecting then do not inject int.
+ */
+ if (unlikely(v->arch.hvm_svm.inject_event)) {
+ v->arch.hvm_svm.inject_event = 0;
+ return;
}
/*
@@ -97,14 +103,6 @@ asmlinkage void svm_intr_assist(void)
return;
}
- /* Guest's interrputs masked? */
- rflags = vmcb->rflags;
- if (irq_masked(rflags)) {
- HVM_DBG_LOG(DBG_LEVEL_1, "Guest IRQs masked: rflags: %lx", rflags);
- /* bail out, we won't be injecting an interrupt this time */
- return;
- }
-
/* Previous interrupt still pending? */
if (vmcb->vintr.fields.irq) {
// printk("Re-injecting IRQ from Vintr\n");
@@ -157,7 +155,6 @@ asmlinkage void svm_intr_assist(void)
/* let's inject this interrupt */
TRACE_3D(TRC_VMX_INTR, v->domain->domain_id, intr_vector, 0);
svm_inject_extint(v, intr_vector);
- hvm_interrupt_post(v, intr_vector, intr_type);
break;
case APIC_DM_SMI:
case APIC_DM_NMI:
@@ -168,6 +165,7 @@ asmlinkage void svm_intr_assist(void)
BUG();
break;
}
+ hvm_interrupt_post(v, intr_vector, intr_type);
}
}
diff -r 2fbf11ad58f3 -r c436ab500c99 xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c Fri Oct 20 10:09:55 2006 +0100
+++ b/xen/arch/x86/hvm/svm/svm.c Fri Oct 20 10:10:36 2006 +0100
@@ -194,6 +194,7 @@ static inline void svm_inject_exception(
ASSERT(vmcb->eventinj.fields.v == 0);
vmcb->eventinj = event;
+ v->arch.hvm_svm.inject_event=1;
}
static void stop_svm(void)
@@ -2598,7 +2599,7 @@ asmlinkage void svm_vmexit_handler(struc
save_svm_cpu_user_regs(v, regs);
vmcb->tlb_control = 1;
-
+ v->arch.hvm_svm.inject_event = 0;
if (exit_reason == VMEXIT_INVALID)
{
diff -r 2fbf11ad58f3 -r c436ab500c99 xen/include/asm-x86/hvm/svm/vmcb.h
--- a/xen/include/asm-x86/hvm/svm/vmcb.h Fri Oct 20 10:09:55 2006 +0100
+++ b/xen/include/asm-x86/hvm/svm/vmcb.h Fri Oct 20 10:10:36 2006 +0100
@@ -484,6 +484,7 @@ struct arch_svm_struct {
u32 *msrpm;
u64 vmexit_tsc; /* tsc read at #VMEXIT. for TSC_OFFSET */
int saved_irq_vector;
+ u32 inject_event;
u32 launch_core;
u32 asid_core;
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|