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
|