ia64/xen-unstable

changeset 19265:9c5b4efc934d

hvm: passthrough MSI-X: fix ia64 link and MSI-X clean up

This patch fixes the ia64 link error and some clean up of MSI-X code.
- add ia64 dummy function to link
- fix unmatched prototype
- add error check

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Mar 03 11:46:52 2009 +0000 (2009-03-03)
parents ae58b4403cae
children 43019597f85c
files xen/arch/ia64/vmx/vmx_interrupt.c xen/arch/x86/hvm/vmsi.c xen/drivers/passthrough/io.c xen/include/xen/pci.h
line diff
     1.1 --- a/xen/arch/ia64/vmx/vmx_interrupt.c	Tue Mar 03 11:41:15 2009 +0000
     1.2 +++ b/xen/arch/ia64/vmx/vmx_interrupt.c	Tue Mar 03 11:46:52 2009 +0000
     1.3 @@ -154,3 +154,14 @@ void hvm_isa_irq_deassert(struct domain 
     1.4  {
     1.5      /* dummy */
     1.6  }
     1.7 +
     1.8 +int msixtbl_pt_register(struct domain *d, int pirq, uint64_t gtable)
     1.9 +{
    1.10 +    /* dummy */
    1.11 +    return -ENOSYS;
    1.12 +}
    1.13 +
    1.14 +void msixtbl_pt_unregister(struct domain *d, int pirq)
    1.15 +{
    1.16 +    /* dummy */
    1.17 +}
     2.1 --- a/xen/arch/x86/hvm/vmsi.c	Tue Mar 03 11:41:15 2009 +0000
     2.2 +++ b/xen/arch/x86/hvm/vmsi.c	Tue Mar 03 11:46:52 2009 +0000
     2.3 @@ -378,14 +378,16 @@ static void del_msixtbl_entry(struct msi
     2.4      call_rcu(&entry->rcu, free_msixtbl_entry);
     2.5  }
     2.6  
     2.7 -void msixtbl_pt_register(struct domain *d, int pirq, uint64_t gtable)
     2.8 +int msixtbl_pt_register(struct domain *d, int pirq, uint64_t gtable)
     2.9  {
    2.10      irq_desc_t *irq_desc;
    2.11      struct msi_desc *msi_desc;
    2.12      struct pci_dev *pdev;
    2.13      struct msixtbl_entry *entry;
    2.14 +    int r = -EINVAL;
    2.15  
    2.16 -    /* pcidevs_lock already held */
    2.17 +    ASSERT(spin_is_locked(&pcidevs_lock));
    2.18 +
    2.19      irq_desc = domain_spin_lock_irq_desc(d, pirq, NULL);
    2.20  
    2.21      if ( irq_desc->handler != &pci_msi_type )
    2.22 @@ -412,11 +414,13 @@ void msixtbl_pt_register(struct domain *
    2.23  
    2.24  found:
    2.25      atomic_inc(&entry->refcnt);
    2.26 -
    2.27      spin_unlock(&d->arch.hvm_domain.msixtbl_list_lock);
    2.28 +    r = 0;
    2.29  
    2.30  out:
    2.31      spin_unlock_irq(&irq_desc->lock);
    2.32 +    return r;
    2.33 +
    2.34  }
    2.35  
    2.36  void msixtbl_pt_unregister(struct domain *d, int pirq)
    2.37 @@ -426,7 +430,8 @@ void msixtbl_pt_unregister(struct domain
    2.38      struct pci_dev *pdev;
    2.39      struct msixtbl_entry *entry;
    2.40  
    2.41 -    /* pcidevs_lock already held */
    2.42 +    ASSERT(spin_is_locked(&pcidevs_lock));
    2.43 +
    2.44      irq_desc = domain_spin_lock_irq_desc(d, pirq, NULL);
    2.45  
    2.46      if ( irq_desc->handler != &pci_msi_type )
     3.1 --- a/xen/drivers/passthrough/io.c	Tue Mar 03 11:41:15 2009 +0000
     3.2 +++ b/xen/drivers/passthrough/io.c	Tue Mar 03 11:46:52 2009 +0000
     3.3 @@ -58,14 +58,6 @@ static void pt_irq_time_out(void *data)
     3.4      pirq_guest_eoi(irq_map->dom, machine_gsi);
     3.5  }
     3.6  
     3.7 -#ifdef CONFIG_X86
     3.8 -extern void msixtbl_pt_register(struct domain *d, int pirq, uint64_t gtable);
     3.9 -extern void msixtbl_pt_unregister(struct domain *d, int pirq);
    3.10 -#else
    3.11 -#define msixtbl_pt_register(d, p, g) ((void)0)
    3.12 -#define msixtbl_pt_unregister(d, p)  ((void)0)
    3.13 -#endif
    3.14 -
    3.15  int pt_irq_create_bind_vtd(
    3.16      struct domain *d, xen_domctl_bind_pt_irq_t *pt_irq_bind)
    3.17  {
    3.18 @@ -113,6 +105,12 @@ int pt_irq_create_bind_vtd(
    3.19              hvm_irq_dpci->msi_gvec_pirq[pt_irq_bind->u.msi.gvec] = pirq;
    3.20              /* bind after hvm_irq_dpci is setup to avoid race with irq handler*/
    3.21              rc = pirq_guest_bind(d->vcpu[0], pirq, 0);
    3.22 +            if ( rc == 0 && pt_irq_bind->u.msi.gtable )
    3.23 +            {
    3.24 +                rc = msixtbl_pt_register(d, pirq, pt_irq_bind->u.msi.gtable);
    3.25 +                if ( unlikely(rc) )
    3.26 +                    pirq_guest_unbind(d, pirq);
    3.27 +            }
    3.28              if ( unlikely(rc) )
    3.29              {
    3.30                  hvm_irq_dpci->msi_gvec_pirq[pt_irq_bind->u.msi.gvec] = 0;
    3.31 @@ -123,8 +121,6 @@ int pt_irq_create_bind_vtd(
    3.32                  spin_unlock(&d->event_lock);
    3.33                  return rc;
    3.34              }
    3.35 -            if ( pt_irq_bind->u.msi.gtable )
    3.36 -                msixtbl_pt_register(d, pirq, pt_irq_bind->u.msi.gtable);
    3.37          }
    3.38          else if (hvm_irq_dpci->mirq[pirq].gmsi.gvec != pt_irq_bind->u.msi.gvec
    3.39                  ||hvm_irq_dpci->msi_gvec_pirq[pt_irq_bind->u.msi.gvec] != pirq)
     4.1 --- a/xen/include/xen/pci.h	Tue Mar 03 11:41:15 2009 +0000
     4.2 +++ b/xen/include/xen/pci.h	Tue Mar 03 11:46:52 2009 +0000
     4.3 @@ -85,4 +85,7 @@ void pci_conf_write32(
     4.4  int pci_find_cap_offset(u8 bus, u8 dev, u8 func, u8 cap);
     4.5  int pci_find_next_cap(u8 bus, unsigned int devfn, u8 pos, int cap);
     4.6  
     4.7 +int msixtbl_pt_register(struct domain *d, int pirq, uint64_t gtable);
     4.8 +void msixtbl_pt_unregister(struct domain *d, int pirq);
     4.9 +
    4.10  #endif /* __XEN_PCI_H__ */