mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
[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@amd.com> Signed-off-by: Wei Huang <wei.huang2@amd.com> Signed-off-by: Tom Woller <thomas.woller@amd.com>
This commit is contained in:
1 parent
b83b1b4104
commit
0f10e394bc
3 files changed
+13
-13
No files matched your search
+10
-12
@@ -62,7 +62,7 @@ static inline int svm_inject_extint(struct vcpu *v, int trap)
|
||||
// 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,11 +81,18 @@ 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;
|
||||
}
|
||||
|
||||
/*
|
||||
* create a 'fake' virtual interrupt on to intercept as soon
|
||||
* as the guest _can_ take interrupts
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -194,6 +194,7 @@ static inline void svm_inject_exception(struct vcpu *v, int trap,
|
||||
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(struct cpu_user_regs *regs)
|
||||
save_svm_cpu_user_regs(v, regs);
|
||||
|
||||
vmcb->tlb_control = 1;
|
||||
|
||||
v->arch.hvm_svm.inject_event = 0;
|
||||
|
||||
if (exit_reason == VMEXIT_INVALID)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||