WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 30/31] Add pci_frontend_[enable|disable]_[msi|msix] f

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 30/31] Add pci_frontend_[enable|disable]_[msi|msix] function decleration and EXPORT_SYMBOL_GPL.
From: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Date: Thu, 5 Nov 2009 16:33:38 -0500
Cc: Jeremy Fitzhardinge <jeremy@xxxxxxxx>, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Delivery-date: Thu, 05 Nov 2009 13:57:32 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1257456819-782-30-git-send-email-konrad.wilk@xxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <1257456819-782-1-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-2-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-3-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-4-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-5-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-6-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-7-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-8-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-9-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-10-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-11-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-12-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-13-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-14-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-15-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-16-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-17-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-18-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-19-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-20-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-21-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-22-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-23-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-24-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-25-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-26-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-27-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-28-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-29-git-send-email-konrad.wilk@xxxxxxxxxx> <1257456819-782-30-git-send-email-konrad.wilk@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Non-privileged domains can enable/disable MSI devices via the
pci_frontend_* functions. Those functions in turn make calls to
the pciback (on the privileged domain) which in turn calls the
appropiate pci_[enable|disable]_[msi|misx] function.

Actual usage to follow.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
---
 arch/x86/include/asm/xen/pci.h |   18 +++++++++++++++++-
 drivers/pci/xen-pcifront.c     |    9 +++++++--
 2 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/arch/x86/include/asm/xen/pci.h b/arch/x86/include/asm/xen/pci.h
index cb84abe..cb37499 100644
--- a/arch/x86/include/asm/xen/pci.h
+++ b/arch/x86/include/asm/xen/pci.h
@@ -33,5 +33,21 @@ static inline int xen_setup_msi_irqs(struct pci_dev *dev, 
int nvec, int type)
        return -1;
 }
 #endif
-
+#if defined(CONFIG_PCI_MSI) && defined(CONFIG_XEN_PCIDEV_FRONTEND)
+/* Defined in drivers/pci/xen-pcifront.c */
+int pci_frontend_enable_msi(struct pci_dev *dev, int *pirq);
+void pci_frontend_disable_msi(struct pci_dev *dev);
+int pci_frontend_enable_msix(struct pci_dev *dev,
+                            struct msix_entry *entries, int nvec);
+void pci_frontend_disable_msix(struct pci_dev *dev);
+#else
+static inline int pci_frontend_enable_msi(struct pci_dev *dev) { return -1; }
+static void pci_frontend_disable_msi(struct pci_dev *dev) { }
+static int pci_frontend_enable_msix(struct pci_dev *dev,
+                            struct msix_entry *entries, int nvec)
+{
+       return -1;
+}
+static void pci_frontend_disable_msix(struct pci_dev *dev) { }
+#endif
 #endif /* _ASM_X86_XEN_PCI_H */
diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
index 768df28..adef0c3 100644
--- a/drivers/pci/xen-pcifront.c
+++ b/drivers/pci/xen-pcifront.c
@@ -298,6 +298,7 @@ int pci_frontend_enable_msix(struct pci_dev *dev,
                return err;
        }
 }
+EXPORT_SYMBOL_GPL(pci_frontend_enable_msix);
 
 void pci_frontend_disable_msix(struct pci_dev *dev)
 {
@@ -317,8 +318,9 @@ void pci_frontend_disable_msix(struct pci_dev *dev)
        if (err)
                printk(KERN_ERR "pci_disable_msix get err %x\n", err);
 }
+EXPORT_SYMBOL_GPL(pci_frontend_disable_msix);
 
-int pci_frontend_enable_msi(struct pci_dev *dev)
+int pci_frontend_enable_msi(struct pci_dev *dev, int *pirq)
 {
        int err;
        struct xen_pci_op op = {
@@ -330,9 +332,10 @@ int pci_frontend_enable_msi(struct pci_dev *dev)
        struct pcifront_sd *sd = dev->bus->sysdata;
        struct pcifront_device *pdev = pcifront_get_pdev(sd);
 
+       *pirq = -1;
        err = do_pci_op(pdev, &op);
        if (likely(!err)) {
-               dev->irq = op.value;
+               *pirq = op.value;
        } else {
                printk(KERN_ERR "pci frontend enable msi failed for dev %x:%x 
\n",
                                op.bus, op.devfn);
@@ -340,6 +343,7 @@ int pci_frontend_enable_msi(struct pci_dev *dev)
        }
        return err;
 }
+EXPORT_SYMBOL(pci_frontend_enable_msi);
 
 void pci_frontend_disable_msi(struct pci_dev *dev)
 {
@@ -365,6 +369,7 @@ void pci_frontend_disable_msi(struct pci_dev *dev)
                /* how can pciback notify us fail? */
                printk(KERN_DEBUG "get fake response frombackend \n");
 }
+EXPORT_SYMBOL_GPL(pci_frontend_disable_msi);
 #endif /* CONFIG_PCI_MSI */
 
 /* Claim resources for the PCI frontend as-is, backend won't allow changes */
-- 
1.6.2.5


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

<Prev in Thread] Current Thread [Next in Thread>