[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] hvm: passthrough MSI-X: fix ia64 link and MSI-X clean up



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1236080812 0
# Node ID 9c5b4efc934d7ce0f5750670b73e20a98a6ca5b0
# Parent  ae58b4403caea7f7e687f34165a23828be7afa75
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@xxxxxxxxxxxxx>
---
 xen/arch/ia64/vmx/vmx_interrupt.c |   11 +++++++++++
 xen/arch/x86/hvm/vmsi.c           |   15 ++++++++++-----
 xen/drivers/passthrough/io.c      |   16 ++++++----------
 xen/include/xen/pci.h             |    3 +++
 4 files changed, 30 insertions(+), 15 deletions(-)

diff -r ae58b4403cae -r 9c5b4efc934d xen/arch/ia64/vmx/vmx_interrupt.c
--- a/xen/arch/ia64/vmx/vmx_interrupt.c Tue Mar 03 11:41:15 2009 +0000
+++ b/xen/arch/ia64/vmx/vmx_interrupt.c Tue Mar 03 11:46:52 2009 +0000
@@ -154,3 +154,14 @@ void hvm_isa_irq_deassert(struct domain 
 {
     /* dummy */
 }
+
+int msixtbl_pt_register(struct domain *d, int pirq, uint64_t gtable)
+{
+    /* dummy */
+    return -ENOSYS;
+}
+
+void msixtbl_pt_unregister(struct domain *d, int pirq)
+{
+    /* dummy */
+}
diff -r ae58b4403cae -r 9c5b4efc934d xen/arch/x86/hvm/vmsi.c
--- a/xen/arch/x86/hvm/vmsi.c   Tue Mar 03 11:41:15 2009 +0000
+++ b/xen/arch/x86/hvm/vmsi.c   Tue Mar 03 11:46:52 2009 +0000
@@ -378,14 +378,16 @@ static void del_msixtbl_entry(struct msi
     call_rcu(&entry->rcu, free_msixtbl_entry);
 }
 
-void msixtbl_pt_register(struct domain *d, int pirq, uint64_t gtable)
+int msixtbl_pt_register(struct domain *d, int pirq, uint64_t gtable)
 {
     irq_desc_t *irq_desc;
     struct msi_desc *msi_desc;
     struct pci_dev *pdev;
     struct msixtbl_entry *entry;
-
-    /* pcidevs_lock already held */
+    int r = -EINVAL;
+
+    ASSERT(spin_is_locked(&pcidevs_lock));
+
     irq_desc = domain_spin_lock_irq_desc(d, pirq, NULL);
 
     if ( irq_desc->handler != &pci_msi_type )
@@ -412,11 +414,13 @@ void msixtbl_pt_register(struct domain *
 
 found:
     atomic_inc(&entry->refcnt);
-
     spin_unlock(&d->arch.hvm_domain.msixtbl_list_lock);
+    r = 0;
 
 out:
     spin_unlock_irq(&irq_desc->lock);
+    return r;
+
 }
 
 void msixtbl_pt_unregister(struct domain *d, int pirq)
@@ -426,7 +430,8 @@ void msixtbl_pt_unregister(struct domain
     struct pci_dev *pdev;
     struct msixtbl_entry *entry;
 
-    /* pcidevs_lock already held */
+    ASSERT(spin_is_locked(&pcidevs_lock));
+
     irq_desc = domain_spin_lock_irq_desc(d, pirq, NULL);
 
     if ( irq_desc->handler != &pci_msi_type )
diff -r ae58b4403cae -r 9c5b4efc934d xen/drivers/passthrough/io.c
--- a/xen/drivers/passthrough/io.c      Tue Mar 03 11:41:15 2009 +0000
+++ b/xen/drivers/passthrough/io.c      Tue Mar 03 11:46:52 2009 +0000
@@ -58,14 +58,6 @@ static void pt_irq_time_out(void *data)
     pirq_guest_eoi(irq_map->dom, machine_gsi);
 }
 
-#ifdef CONFIG_X86
-extern void msixtbl_pt_register(struct domain *d, int pirq, uint64_t gtable);
-extern void msixtbl_pt_unregister(struct domain *d, int pirq);
-#else
-#define msixtbl_pt_register(d, p, g) ((void)0)
-#define msixtbl_pt_unregister(d, p)  ((void)0)
-#endif
-
 int pt_irq_create_bind_vtd(
     struct domain *d, xen_domctl_bind_pt_irq_t *pt_irq_bind)
 {
@@ -113,6 +105,12 @@ int pt_irq_create_bind_vtd(
             hvm_irq_dpci->msi_gvec_pirq[pt_irq_bind->u.msi.gvec] = pirq;
             /* bind after hvm_irq_dpci is setup to avoid race with irq 
handler*/
             rc = pirq_guest_bind(d->vcpu[0], pirq, 0);
+            if ( rc == 0 && pt_irq_bind->u.msi.gtable )
+            {
+                rc = msixtbl_pt_register(d, pirq, pt_irq_bind->u.msi.gtable);
+                if ( unlikely(rc) )
+                    pirq_guest_unbind(d, pirq);
+            }
             if ( unlikely(rc) )
             {
                 hvm_irq_dpci->msi_gvec_pirq[pt_irq_bind->u.msi.gvec] = 0;
@@ -123,8 +121,6 @@ int pt_irq_create_bind_vtd(
                 spin_unlock(&d->event_lock);
                 return rc;
             }
-            if ( pt_irq_bind->u.msi.gtable )
-                msixtbl_pt_register(d, pirq, pt_irq_bind->u.msi.gtable);
         }
         else if (hvm_irq_dpci->mirq[pirq].gmsi.gvec != pt_irq_bind->u.msi.gvec
                 ||hvm_irq_dpci->msi_gvec_pirq[pt_irq_bind->u.msi.gvec] != pirq)
diff -r ae58b4403cae -r 9c5b4efc934d xen/include/xen/pci.h
--- a/xen/include/xen/pci.h     Tue Mar 03 11:41:15 2009 +0000
+++ b/xen/include/xen/pci.h     Tue Mar 03 11:46:52 2009 +0000
@@ -85,4 +85,7 @@ int pci_find_cap_offset(u8 bus, u8 dev, 
 int pci_find_cap_offset(u8 bus, u8 dev, u8 func, u8 cap);
 int pci_find_next_cap(u8 bus, unsigned int devfn, u8 pos, int cap);
 
+int msixtbl_pt_register(struct domain *d, int pirq, uint64_t gtable);
+void msixtbl_pt_unregister(struct domain *d, int pirq);
+
 #endif /* __XEN_PCI_H__ */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.