ia64/xen-unstable

changeset 11915:c436ab500c99

[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>
author kfraser@localhost.localdomain
date Fri Oct 20 10:10:36 2006 +0100 (2006-10-20)
parents 2fbf11ad58f3
children 899836e04387
files xen/arch/x86/hvm/svm/intr.c xen/arch/x86/hvm/svm/svm.c xen/include/asm-x86/hvm/svm/vmcb.h
line diff
     1.1 --- a/xen/arch/x86/hvm/svm/intr.c	Fri Oct 20 10:09:55 2006 +0100
     1.2 +++ b/xen/arch/x86/hvm/svm/intr.c	Fri Oct 20 10:10:36 2006 +0100
     1.3 @@ -62,7 +62,7 @@ static inline int svm_inject_extint(stru
     1.4  //  printf( "IRQ = %d\n", trap );
     1.5      return 0;
     1.6  }
     1.7 -
     1.8 +    
     1.9  asmlinkage void svm_intr_assist(void) 
    1.10  {
    1.11      struct vcpu *v = current;
    1.12 @@ -74,7 +74,6 @@ asmlinkage void svm_intr_assist(void)
    1.13      int intr_type = APIC_DM_EXTINT;
    1.14      int intr_vector = -1;
    1.15      int re_injecting = 0;
    1.16 -    unsigned long rflags;
    1.17  
    1.18      ASSERT(vmcb);
    1.19  
    1.20 @@ -82,12 +81,19 @@ asmlinkage void svm_intr_assist(void)
    1.21      /* Previous Interrupt delivery caused this Intercept? */
    1.22      if (vmcb->exitintinfo.fields.v && (vmcb->exitintinfo.fields.type == 0)) {
    1.23          v->arch.hvm_svm.saved_irq_vector = vmcb->exitintinfo.fields.vector;
    1.24 -//           printk("Injecting PF#: saving IRQ from ExitInfo\n");
    1.25          vmcb->exitintinfo.bytes = 0;
    1.26          re_injecting = 1;
    1.27      }
    1.28  
    1.29      /*
    1.30 +     * If event requires injecting then do not inject int.
    1.31 +     */
    1.32 +    if (unlikely(v->arch.hvm_svm.inject_event)) {
    1.33 +        v->arch.hvm_svm.inject_event = 0;
    1.34 +        return;
    1.35 +    }
    1.36 +
    1.37 +    /*
    1.38       * create a 'fake' virtual interrupt on to intercept as soon
    1.39       * as the guest _can_ take interrupts
    1.40       */
    1.41 @@ -97,14 +103,6 @@ asmlinkage void svm_intr_assist(void)
    1.42          return;
    1.43      }
    1.44  
    1.45 -    /* Guest's interrputs masked? */
    1.46 -    rflags = vmcb->rflags;
    1.47 -    if (irq_masked(rflags)) {
    1.48 -        HVM_DBG_LOG(DBG_LEVEL_1, "Guest IRQs masked: rflags: %lx", rflags);
    1.49 -        /* bail out, we won't be injecting an interrupt this time */
    1.50 -        return;
    1.51 -    }
    1.52 -    
    1.53      /* Previous interrupt still pending? */
    1.54      if (vmcb->vintr.fields.irq) {
    1.55  //        printk("Re-injecting IRQ from Vintr\n");
    1.56 @@ -157,7 +155,6 @@ asmlinkage void svm_intr_assist(void)
    1.57              /* let's inject this interrupt */
    1.58              TRACE_3D(TRC_VMX_INTR, v->domain->domain_id, intr_vector, 0);
    1.59              svm_inject_extint(v, intr_vector);
    1.60 -            hvm_interrupt_post(v, intr_vector, intr_type);
    1.61              break;
    1.62          case APIC_DM_SMI:
    1.63          case APIC_DM_NMI:
    1.64 @@ -168,6 +165,7 @@ asmlinkage void svm_intr_assist(void)
    1.65              BUG();
    1.66              break;
    1.67          }
    1.68 +        hvm_interrupt_post(v, intr_vector, intr_type);
    1.69      }
    1.70  }
    1.71  
     2.1 --- a/xen/arch/x86/hvm/svm/svm.c	Fri Oct 20 10:09:55 2006 +0100
     2.2 +++ b/xen/arch/x86/hvm/svm/svm.c	Fri Oct 20 10:10:36 2006 +0100
     2.3 @@ -194,6 +194,7 @@ static inline void svm_inject_exception(
     2.4      ASSERT(vmcb->eventinj.fields.v == 0);
     2.5      
     2.6      vmcb->eventinj = event;
     2.7 +    v->arch.hvm_svm.inject_event=1;
     2.8  }
     2.9  
    2.10  static void stop_svm(void)
    2.11 @@ -2598,7 +2599,7 @@ asmlinkage void svm_vmexit_handler(struc
    2.12      save_svm_cpu_user_regs(v, regs);
    2.13  
    2.14      vmcb->tlb_control = 1;
    2.15 -
    2.16 +    v->arch.hvm_svm.inject_event = 0;
    2.17  
    2.18      if (exit_reason == VMEXIT_INVALID)
    2.19      {
     3.1 --- a/xen/include/asm-x86/hvm/svm/vmcb.h	Fri Oct 20 10:09:55 2006 +0100
     3.2 +++ b/xen/include/asm-x86/hvm/svm/vmcb.h	Fri Oct 20 10:10:36 2006 +0100
     3.3 @@ -484,6 +484,7 @@ struct arch_svm_struct {
     3.4      u32                 *msrpm;
     3.5      u64                 vmexit_tsc; /* tsc read at #VMEXIT. for TSC_OFFSET */
     3.6      int                 saved_irq_vector;
     3.7 +    u32                 inject_event;
     3.8      u32                 launch_core;
     3.9      u32                 asid_core;
    3.10