The 'xen_teardown_msi_dev' will call pci_frontend_disable_[msi|msix] when
running in non-privileged PV mode. In all other cases it is effectively a NOP.
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
---
arch/x86/include/asm/xen/pci.h | 2 ++
arch/x86/kernel/apic/io_apic.c | 5 +++++
arch/x86/xen/pci.c | 16 ++++++++++++++++
3 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/arch/x86/include/asm/xen/pci.h b/arch/x86/include/asm/xen/pci.h
index 8adb33a..6c022c8 100644
--- a/arch/x86/include/asm/xen/pci.h
+++ b/arch/x86/include/asm/xen/pci.h
@@ -7,6 +7,7 @@ int xen_create_msi_irq(struct pci_dev *dev,
struct msi_desc *msidesc,
int type, int pirq_override);
int xen_destroy_irq(int irq);
+void xen_teardown_msi_dev(struct pci_dev *dev);
#else
static inline int xen_register_gsi(u32 gsi, int triggering, int polarity)
{
@@ -23,6 +24,7 @@ static inline int xen_destroy_irq(int irq)
{
return -1;
}
+static inline void xen_teardown_msi_dev(struct pci_dev *dev) { }
#endif
#if defined(CONFIG_PCI_MSI) && defined(CONFIG_XEN_DOM0_PCI)
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 0cc2dde..b9a0e67 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -3576,6 +3576,11 @@ void arch_teardown_msi_irqs(struct pci_dev *dev)
{
struct msi_desc *entry;
+ /* If we are non-privileged PV domain, we have to
+ * to call xen_teardown_msi_dev first. */
+ if (xen_domain())
+ xen_teardown_msi_dev(dev);
+
list_for_each_entry(entry, &dev->msi_list, list) {
int i, nvec;
if (entry->irq == 0)
diff --git a/arch/x86/xen/pci.c b/arch/x86/xen/pci.c
index dc02241..b572f26 100644
--- a/arch/x86/xen/pci.c
+++ b/arch/x86/xen/pci.c
@@ -125,4 +125,20 @@ error:
kfree(v);
return ret;
}
+
+void xen_teardown_msi_dev(struct pci_dev *dev)
+{
+ /* Only do this when were are in non-privileged mode.*/
+ if (!xen_initial_domain()) {
+ struct msi_desc *msidesc;
+
+ msidesc = list_entry(dev->msi_list.next, struct msi_desc, list);
+ if (msidesc->msi_attrib.is_msix)
+ pci_frontend_disable_msix(dev);
+ else
+ pci_frontend_disable_msi(dev);
+ }
+
+}
+
#endif
--
1.6.2.5
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|