ia64/xen-unstable

changeset 18680:3b99705155c1

Use hvm_dirq_assist() to replace {vmx,svm}_dirq_assist().
Do not compile some IA64 MSI-related parts.

Signed-off-by: Anthony Xu <anthony.xu@intel.com>
Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Oct 21 11:44:39 2008 +0100 (2008-10-21)
parents 4b5823f292ea
children de6af72f7b5c
files xen/arch/x86/hvm/svm/intr.c xen/arch/x86/hvm/vmx/intr.c xen/drivers/passthrough/io.c xen/include/xen/hvm/irq.h
line diff
     1.1 --- a/xen/arch/x86/hvm/svm/intr.c	Tue Oct 21 11:43:21 2008 +0100
     1.2 +++ b/xen/arch/x86/hvm/svm/intr.c	Tue Oct 21 11:44:39 2008 +0100
     1.3 @@ -100,61 +100,6 @@ static void enable_intr_window(struct vc
     1.4      vmcb->general1_intercepts |= GENERAL1_INTERCEPT_VINTR;
     1.5  }
     1.6  
     1.7 -extern int vmsi_deliver(struct domain *d, int pirq);
     1.8 -static int hvm_pci_msi_assert(struct domain *d, int pirq)
     1.9 -{
    1.10 -    return vmsi_deliver(d, pirq);
    1.11 -}
    1.12 -
    1.13 -static void svm_dirq_assist(struct vcpu *v)
    1.14 -{
    1.15 -    unsigned int irq;
    1.16 -    uint32_t device, intx;
    1.17 -    struct domain *d = v->domain;
    1.18 -    struct hvm_irq_dpci *hvm_irq_dpci = d->arch.hvm_domain.irq.dpci;
    1.19 -    struct dev_intx_gsi_link *digl;
    1.20 -
    1.21 -    if ( !iommu_enabled || (v->vcpu_id != 0) || (hvm_irq_dpci == NULL) )
    1.22 -        return;
    1.23 -
    1.24 -    for ( irq = find_first_bit(hvm_irq_dpci->dirq_mask, NR_IRQS);
    1.25 -          irq < NR_IRQS;
    1.26 -          irq = find_next_bit(hvm_irq_dpci->dirq_mask, NR_IRQS, irq + 1) )
    1.27 -    {
    1.28 -        if ( !test_and_clear_bit(irq, &hvm_irq_dpci->dirq_mask) )
    1.29 -            continue;
    1.30 -
    1.31 -        spin_lock(&d->event_lock);
    1.32 -        if ( test_bit(_HVM_IRQ_DPCI_MSI, &hvm_irq_dpci->mirq[irq].flags) )
    1.33 -        {
    1.34 -            hvm_pci_msi_assert(d, irq);
    1.35 -            spin_unlock(&d->event_lock);
    1.36 -            continue;
    1.37 -        }
    1.38 -
    1.39 -        stop_timer(&hvm_irq_dpci->hvm_timer[domain_irq_to_vector(d, irq)]);
    1.40 -
    1.41 -        list_for_each_entry ( digl, &hvm_irq_dpci->mirq[irq].digl_list, list )
    1.42 -        {
    1.43 -            device = digl->device;
    1.44 -            intx = digl->intx;
    1.45 -            hvm_pci_intx_assert(d, device, intx);
    1.46 -            hvm_irq_dpci->mirq[irq].pending++;
    1.47 -        }
    1.48 -
    1.49 -        /*
    1.50 -         * Set a timer to see if the guest can finish the interrupt or not. For
    1.51 -         * example, the guest OS may unmask the PIC during boot, before the
    1.52 -         * guest driver is loaded. hvm_pci_intx_assert() may succeed, but the
    1.53 -         * guest will never deal with the irq, then the physical interrupt line
    1.54 -         * will never be deasserted.
    1.55 -         */
    1.56 -        set_timer(&hvm_irq_dpci->hvm_timer[domain_irq_to_vector(d, irq)],
    1.57 -                  NOW() + PT_IRQ_TIME_OUT);
    1.58 -        spin_unlock(&d->event_lock);
    1.59 -    }
    1.60 -}
    1.61 -
    1.62  asmlinkage void svm_intr_assist(void) 
    1.63  {
    1.64      struct vcpu *v = current;
    1.65 @@ -163,7 +108,7 @@ asmlinkage void svm_intr_assist(void)
    1.66  
    1.67      /* Crank the handle on interrupt state. */
    1.68      pt_update_irq(v);
    1.69 -    svm_dirq_assist(v);
    1.70 +    hvm_dirq_assist(v);
    1.71  
    1.72      do {
    1.73          intack = hvm_vcpu_has_pending_irq(v);
     2.1 --- a/xen/arch/x86/hvm/vmx/intr.c	Tue Oct 21 11:43:21 2008 +0100
     2.2 +++ b/xen/arch/x86/hvm/vmx/intr.c	Tue Oct 21 11:44:39 2008 +0100
     2.3 @@ -103,61 +103,6 @@ static void enable_intr_window(struct vc
     2.4      }
     2.5  }
     2.6  
     2.7 -extern int vmsi_deliver(struct domain *d, int pirq);
     2.8 -static int hvm_pci_msi_assert(struct domain *d, int pirq)
     2.9 -{
    2.10 -    return vmsi_deliver(d, pirq);
    2.11 -}
    2.12 -
    2.13 -static void vmx_dirq_assist(struct vcpu *v)
    2.14 -{
    2.15 -    unsigned int irq;
    2.16 -    uint32_t device, intx;
    2.17 -    struct domain *d = v->domain;
    2.18 -    struct hvm_irq_dpci *hvm_irq_dpci = d->arch.hvm_domain.irq.dpci;
    2.19 -    struct dev_intx_gsi_link *digl;
    2.20 -
    2.21 -    if ( !iommu_enabled || (v->vcpu_id != 0) || (hvm_irq_dpci == NULL) )
    2.22 -        return;
    2.23 -
    2.24 -    for ( irq = find_first_bit(hvm_irq_dpci->dirq_mask, NR_IRQS);
    2.25 -          irq < NR_IRQS;
    2.26 -          irq = find_next_bit(hvm_irq_dpci->dirq_mask, NR_IRQS, irq + 1) )
    2.27 -    {
    2.28 -        if ( !test_and_clear_bit(irq, &hvm_irq_dpci->dirq_mask) )
    2.29 -            continue;
    2.30 -
    2.31 -        spin_lock(&d->event_lock);
    2.32 -        if ( test_bit(_HVM_IRQ_DPCI_MSI, &hvm_irq_dpci->mirq[irq].flags) )
    2.33 -        {
    2.34 -            hvm_pci_msi_assert(d, irq);
    2.35 -            spin_unlock(&d->event_lock);
    2.36 -            continue;
    2.37 -        }
    2.38 -
    2.39 -        stop_timer(&hvm_irq_dpci->hvm_timer[domain_irq_to_vector(d, irq)]);
    2.40 -
    2.41 -        list_for_each_entry ( digl, &hvm_irq_dpci->mirq[irq].digl_list, list )
    2.42 -        {
    2.43 -            device = digl->device;
    2.44 -            intx = digl->intx;
    2.45 -            hvm_pci_intx_assert(d, device, intx);
    2.46 -            hvm_irq_dpci->mirq[irq].pending++;
    2.47 -        }
    2.48 -
    2.49 -        /*
    2.50 -         * Set a timer to see if the guest can finish the interrupt or not. For
    2.51 -         * example, the guest OS may unmask the PIC during boot, before the
    2.52 -         * guest driver is loaded. hvm_pci_intx_assert() may succeed, but the
    2.53 -         * guest will never deal with the irq, then the physical interrupt line
    2.54 -         * will never be deasserted.
    2.55 -         */
    2.56 -        set_timer(&hvm_irq_dpci->hvm_timer[domain_irq_to_vector(d, irq)],
    2.57 -                  NOW() + PT_IRQ_TIME_OUT);
    2.58 -        spin_unlock(&d->event_lock);
    2.59 -    }
    2.60 -}
    2.61 -
    2.62  asmlinkage void vmx_intr_assist(void)
    2.63  {
    2.64      struct hvm_intack intack;
    2.65 @@ -167,7 +112,7 @@ asmlinkage void vmx_intr_assist(void)
    2.66  
    2.67      /* Crank the handle on interrupt state. */
    2.68      pt_update_irq(v);
    2.69 -    vmx_dirq_assist(v);
    2.70 +    hvm_dirq_assist(v);
    2.71  
    2.72      do {
    2.73          intack = hvm_vcpu_has_pending_irq(v);
     3.1 --- a/xen/drivers/passthrough/io.c	Tue Oct 21 11:43:21 2008 +0100
     3.2 +++ b/xen/drivers/passthrough/io.c	Tue Oct 21 11:44:39 2008 +0100
     3.3 @@ -281,8 +281,64 @@ void hvm_dpci_msi_eoi(struct domain *d, 
     3.4  
     3.5      spin_unlock(&d->event_lock);
     3.6  }
     3.7 +
     3.8 +extern int vmsi_deliver(struct domain *d, int pirq);
     3.9 +static int hvm_pci_msi_assert(struct domain *d, int pirq)
    3.10 +{
    3.11 +    return vmsi_deliver(d, pirq);
    3.12 +}
    3.13  #endif
    3.14  
    3.15 +void hvm_dirq_assist(struct vcpu *v)
    3.16 +{
    3.17 +    unsigned int irq;
    3.18 +    uint32_t device, intx;
    3.19 +    struct domain *d = v->domain;
    3.20 +    struct hvm_irq_dpci *hvm_irq_dpci = d->arch.hvm_domain.irq.dpci;
    3.21 +    struct dev_intx_gsi_link *digl;
    3.22 +
    3.23 +    if ( !iommu_enabled || (v->vcpu_id != 0) || (hvm_irq_dpci == NULL) )
    3.24 +        return;
    3.25 +
    3.26 +    for ( irq = find_first_bit(hvm_irq_dpci->dirq_mask, NR_IRQS);
    3.27 +          irq < NR_IRQS;
    3.28 +          irq = find_next_bit(hvm_irq_dpci->dirq_mask, NR_IRQS, irq + 1) )
    3.29 +    {
    3.30 +        if ( !test_and_clear_bit(irq, &hvm_irq_dpci->dirq_mask) )
    3.31 +            continue;
    3.32 +
    3.33 +        spin_lock(&d->event_lock);
    3.34 +#ifdef SUPPORT_MSI_REMAPPING
    3.35 +        if ( test_bit(_HVM_IRQ_DPCI_MSI, &hvm_irq_dpci->mirq[irq].flags) )
    3.36 +        {
    3.37 +            hvm_pci_msi_assert(d, irq);
    3.38 +            spin_unlock(&d->event_lock);
    3.39 +            continue;
    3.40 +        }
    3.41 +#endif
    3.42 +        stop_timer(&hvm_irq_dpci->hvm_timer[domain_irq_to_vector(d, irq)]);
    3.43 +
    3.44 +        list_for_each_entry ( digl, &hvm_irq_dpci->mirq[irq].digl_list, list )
    3.45 +        {
    3.46 +            device = digl->device;
    3.47 +            intx = digl->intx;
    3.48 +            hvm_pci_intx_assert(d, device, intx);
    3.49 +            hvm_irq_dpci->mirq[irq].pending++;
    3.50 +        }
    3.51 +
    3.52 +        /*
    3.53 +         * Set a timer to see if the guest can finish the interrupt or not. For
    3.54 +         * example, the guest OS may unmask the PIC during boot, before the
    3.55 +         * guest driver is loaded. hvm_pci_intx_assert() may succeed, but the
    3.56 +         * guest will never deal with the irq, then the physical interrupt line
    3.57 +         * will never be deasserted.
    3.58 +         */
    3.59 +        set_timer(&hvm_irq_dpci->hvm_timer[domain_irq_to_vector(d, irq)],
    3.60 +                  NOW() + PT_IRQ_TIME_OUT);
    3.61 +        spin_unlock(&d->event_lock);
    3.62 +    }
    3.63 +}
    3.64 +
    3.65  void hvm_dpci_eoi(struct domain *d, unsigned int guest_gsi,
    3.66                    union vioapic_redir_entry *ent)
    3.67  {
     4.1 --- a/xen/include/xen/hvm/irq.h	Tue Oct 21 11:43:21 2008 +0100
     4.2 +++ b/xen/include/xen/hvm/irq.h	Tue Oct 21 11:44:39 2008 +0100
     4.3 @@ -94,5 +94,6 @@ void hvm_maybe_deassert_evtchn_irq(void)
     4.4  void hvm_assert_evtchn_irq(struct vcpu *v);
     4.5  void hvm_set_callback_via(struct domain *d, uint64_t via);
     4.6  
     4.7 +void hvm_dirq_assist(struct vcpu *v);
     4.8  
     4.9  #endif /* __XEN_HVM_IRQ_H__ */