direct-io.hg

changeset 11409:329ad7bbc7ec

More hvm common-code cleanups.

Signed-off-by: Steven Hand <steven@xensource.com>
author Steven Hand <steven@xensource.com>
date Fri Sep 01 13:52:04 2006 +0100 (2006-09-01)
parents c682ae7a1722
children 3e6325b73474
files xen/arch/x86/hvm/svm/intr.c xen/arch/x86/hvm/vlapic.c xen/arch/x86/hvm/vmx/io.c
line diff
     1.1 --- a/xen/arch/x86/hvm/svm/intr.c	Fri Sep 01 12:16:21 2006 +0100
     1.2 +++ b/xen/arch/x86/hvm/svm/intr.c	Fri Sep 01 13:52:04 2006 +0100
     1.3 @@ -79,22 +79,22 @@ asmlinkage void svm_intr_assist(void)
     1.4      ASSERT(vmcb);
     1.5  
     1.6      /* Check if an Injection is active */
     1.7 -       /* Previous Interrupt delivery caused this Intercept? */
     1.8 -       if (vmcb->exitintinfo.fields.v && (vmcb->exitintinfo.fields.type == 0)) {
     1.9 -           v->arch.hvm_svm.saved_irq_vector = vmcb->exitintinfo.fields.vector;
    1.10 +    /* Previous Interrupt delivery caused this Intercept? */
    1.11 +    if (vmcb->exitintinfo.fields.v && (vmcb->exitintinfo.fields.type == 0)) {
    1.12 +        v->arch.hvm_svm.saved_irq_vector = vmcb->exitintinfo.fields.vector;
    1.13  //           printk("Injecting PF#: saving IRQ from ExitInfo\n");
    1.14 -           vmcb->exitintinfo.bytes = 0;
    1.15 -           re_injecting = 1;
    1.16 -       }
    1.17 +        vmcb->exitintinfo.bytes = 0;
    1.18 +        re_injecting = 1;
    1.19 +    }
    1.20  
    1.21      /* Guest's interrputs masked? */
    1.22      rflags = vmcb->rflags;
    1.23      if (irq_masked(rflags)) {
    1.24          HVM_DBG_LOG(DBG_LEVEL_1, "Guest IRQs masked: rflags: %lx", rflags);
    1.25 -       /* bail out, we won't be injecting an interrupt this time */
    1.26 -       return;
    1.27 +        /* bail out, we won't be injecting an interrupt this time */
    1.28 +        return;
    1.29      }
    1.30 -  
    1.31 +    
    1.32      /* Previous interrupt still pending? */
    1.33      if (vmcb->vintr.fields.irq) {
    1.34  //        printk("Re-injecting IRQ from Vintr\n");
    1.35 @@ -115,27 +115,24 @@ asmlinkage void svm_intr_assist(void)
    1.36        if ( v->vcpu_id == 0 )
    1.37           hvm_pic_assist(v);
    1.38  
    1.39 -      callback_irq = v->domain->arch.hvm_domain.params[HVM_PARAM_CALLBACK_IRQ];
    1.40  
    1.41 -      /* Before we deal with PIT interrupts, let's check for
    1.42 -         interrupts set by the device model or paravirtualised event
    1.43 -         channel interrupts.
    1.44 -      */
    1.45 -      if ( cpu_has_pending_irq(v) ) {
    1.46 -           intr_vector = cpu_get_interrupt(v, &intr_type);
    1.47 +      if ( (v->vcpu_id == 0) && pt->enabled && pt->pending_intr_nr ) {
    1.48 +          pic_set_irq(pic, pt->irq, 0);
    1.49 +          pic_set_irq(pic, pt->irq, 1);
    1.50        }
    1.51 -      else  if ( callback_irq != 0 && local_events_need_delivery() ) {
    1.52 +
    1.53 +      callback_irq = v->domain->arch.hvm_domain.params[HVM_PARAM_CALLBACK_IRQ];
    1.54 +      if ( callback_irq != 0 &&
    1.55 +           local_events_need_delivery() ) {
    1.56            /*inject para-device call back irq*/
    1.57            v->vcpu_info->evtchn_upcall_mask = 1;
    1.58            pic_set_irq(pic, callback_irq, 0);
    1.59            pic_set_irq(pic, callback_irq, 1);
    1.60 -          intr_vector = callback_irq;
    1.61        }
    1.62 -      else  if ( (v->vcpu_id == 0) && pt->enabled && pt->pending_intr_nr ) {
    1.63 -          pic_set_irq(pic, pt->irq, 0);
    1.64 -          pic_set_irq(pic, pt->irq, 1);
    1.65 +
    1.66 +      if ( cpu_has_pending_irq(v) )
    1.67            intr_vector = cpu_get_interrupt(v, &intr_type);
    1.68 -      }
    1.69 +
    1.70      }
    1.71  
    1.72      /* have we got an interrupt to inject? */
     2.1 --- a/xen/arch/x86/hvm/vlapic.c	Fri Sep 01 12:16:21 2006 +0100
     2.2 +++ b/xen/arch/x86/hvm/vlapic.c	Fri Sep 01 13:52:04 2006 +0100
     2.3 @@ -919,6 +919,20 @@ int cpu_has_apic_interrupt(struct vcpu* 
     2.4      return 0;
     2.5  }
     2.6  
     2.7 +/* check to see if there is pending interrupt  */
     2.8 +int cpu_has_pending_irq(struct vcpu *v)
     2.9 +{
    2.10 +    struct hvm_domain *plat = &v->domain->arch.hvm_domain;
    2.11 +
    2.12 +    /* APIC */
    2.13 +    if ( cpu_has_apic_interrupt(v) ) return 1;
    2.14 +    
    2.15 +    /* PIC */
    2.16 +    if ( !vlapic_accept_pic_intr(v) ) return 0;
    2.17 +
    2.18 +    return plat->interrupt_request;
    2.19 +}
    2.20 +
    2.21  void vlapic_post_injection(struct vcpu *v, int vector, int deliver_mode)
    2.22  {
    2.23      struct vlapic *vlapic = VLAPIC(v);
     3.1 --- a/xen/arch/x86/hvm/vmx/io.c	Fri Sep 01 12:16:21 2006 +0100
     3.2 +++ b/xen/arch/x86/hvm/vmx/io.c	Fri Sep 01 13:52:04 2006 +0100
     3.3 @@ -68,19 +68,6 @@ static inline int is_interruptibility_st
     3.4      return interruptibility;
     3.5  }
     3.6  
     3.7 -/* check to see if there is pending interrupt  */
     3.8 -int cpu_has_pending_irq(struct vcpu *v)
     3.9 -{
    3.10 -    struct hvm_domain *plat = &v->domain->arch.hvm_domain;
    3.11 -
    3.12 -    /* APIC */
    3.13 -    if ( cpu_has_apic_interrupt(v) ) return 1;
    3.14 -    
    3.15 -    /* PIC */
    3.16 -    if ( !vlapic_accept_pic_intr(v) ) return 0;
    3.17 -
    3.18 -    return plat->interrupt_request;
    3.19 -}
    3.20  
    3.21  asmlinkage void vmx_intr_assist(void)
    3.22  {