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

[Xen-devel] [PATCH] linux: remove xen specific member from pci_dev


  • To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • From: "He, Qing" <qing.he@xxxxxxxxx>
  • Date: Wed, 4 Feb 2009 17:32:30 +0800
  • Accept-language: en-US
  • Delivery-date: Wed, 04 Feb 2009 01:32:50 -0800
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

Move msi related variable irq_old out of struct pci_dev. This is
logically more consistent and has the additional benefit that xen
kernel and vanilla kernel now have the same pci_dev layout

Signed-off-by: Qing He <qing.he@xxxxxxxxx>

---
diff -r 618fc299e2f1 drivers/pci/msi-xen.c
--- a/drivers/pci/msi-xen.c     Thu Dec 18 11:51:36 2008 +0000
+++ b/drivers/pci/msi-xen.c     Tue Feb 03 15:11:14 2009 +0800
@@ -44,6 +44,8 @@ struct msi_dev_list {
        struct list_head pirq_list_head;
        /* Used for saving/restoring MSI-X tables */
        void __iomem *mask_base;
+       /* Store default pre-assigned irq */
+       unsigned int default_irq;
 };
 
 struct msi_pirq_entry {
@@ -589,6 +591,7 @@ int pci_enable_msi(struct pci_dev* dev)
 {
        struct pci_bus *bus;
        int pos, temp, status = -EINVAL;
+       struct msi_dev_list *msi_dev_entry = get_msi_dev_pirq_list(dev);
 
        if (!pci_msi_enable || !dev)
                return status;
@@ -615,7 +618,7 @@ int pci_enable_msi(struct pci_dev* dev)
                        return ret;
 
                dev->irq = evtchn_map_pirq(-1, dev->irq);
-               dev->irq_old = temp;
+               msi_dev_entry->default_irq = temp;
 
                return ret;
        }
@@ -638,8 +641,8 @@ int pci_enable_msi(struct pci_dev* dev)
 
        status = msi_capability_init(dev);
        if ( !status )
-               dev->irq_old = temp;
-    else
+               msi_dev_entry->default_irq = temp;
+       else
                dev->irq = temp;
 
        return status;
@@ -650,6 +653,7 @@ void pci_disable_msi(struct pci_dev* dev
 {
        int pos;
        int pirq;
+       struct msi_dev_list *msi_dev_entry = get_msi_dev_pirq_list(dev);
 
        if (!pci_msi_enable)
                return;
@@ -660,7 +664,7 @@ void pci_disable_msi(struct pci_dev* dev
        if (!is_initial_xendomain()) {
                evtchn_map_pirq(dev->irq, 0);
                pci_frontend_disable_msi(dev);
-               dev->irq = dev->irq_old;
+               dev->irq = msi_dev_entry->default_irq;
                return;
        }
 #endif
@@ -671,7 +675,7 @@ void pci_disable_msi(struct pci_dev* dev
 
        pirq = dev->irq;
        /* Restore dev->irq to its default pin-assertion vector */
-       dev->irq = dev->irq_old;
+       dev->irq = msi_dev_entry->default_irq;
        msi_unmap_pirq(dev, pirq);
 
        /* Disable MSI mode */
@@ -701,6 +705,7 @@ int pci_enable_msix(struct pci_dev* dev,
        int status, pos, nr_entries;
        int i, j, temp;
        u16 control;
+       struct msi_dev_list *msi_dev_entry = get_msi_dev_pirq_list(dev);
 
        if (!pci_msi_enable || !dev || !entries)
                return -EINVAL;
@@ -718,11 +723,13 @@ int pci_enable_msix(struct pci_dev* dev,
                struct msi_pirq_entry *pirq_entry;
                int ret, irq;
 
+               temp = dev->irq;
                ret = pci_frontend_enable_msix(dev, entries, nvec);
                if (ret) {
                        printk("get %x from pci_frontend_enable_msix\n", ret);
                        return ret;
                }
+               msi_dev_entry->default_irq = temp;
 
                msi_dev_entry = get_msi_dev_pirq_list(dev);
                for (i = 0; i < nvec; i++) {
@@ -783,7 +790,7 @@ int pci_enable_msix(struct pci_dev* dev,
        status = msix_capability_init(dev, entries, nvec);
 
        if ( !status )
-               dev->irq_old = temp;
+               msi_dev_entry->default_irq = temp;
        else
                dev->irq = temp;
 
@@ -795,6 +802,7 @@ void pci_disable_msix(struct pci_dev* de
 {
        int pos;
        u16 control;
+       struct msi_dev_list *msi_dev_entry = get_msi_dev_pirq_list(dev);
 
 
        if (!pci_msi_enable)
@@ -817,7 +825,7 @@ void pci_disable_msix(struct pci_dev* de
                        kfree(pirq_entry);
                }
 
-               dev->irq = dev->irq_old;
+               dev->irq = msi_dev_entry->default_irq;
                return;
        }
 #endif
@@ -867,7 +875,7 @@ void msi_remove_pci_irq_vectors(struct p
        spin_unlock_irqrestore(&msi_dev_entry->pirq_list_lock, flags);
        iounmap(msi_dev_entry->mask_base);
        msi_dev_entry->mask_base = NULL;
-       dev->irq = dev->irq_old;
+       dev->irq = msi_dev_entry->default_irq;
 }
 
 void pci_no_msi(void)
diff -r 618fc299e2f1 include/linux/pci.h
--- a/include/linux/pci.h       Thu Dec 18 11:51:36 2008 +0000
+++ b/include/linux/pci.h       Tue Feb 03 15:11:14 2009 +0800
@@ -152,9 +152,6 @@ struct pci_dev {
         * directly, use the values stored here. They might be different!
         */
        unsigned int    irq;
-#ifdef CONFIG_XEN
-       unsigned int    irq_old;
-#endif
        struct resource resource[DEVICE_COUNT_RESOURCE]; /* I/O and memory 
regions + expansion ROMs */
 
        /* These fields are used by common fixups */




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


 


Rackspace

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