diff options
author | Stefano Stabellini <stefano.stabellini@eu.citrix.com> | 2010-12-01 09:51:44 -0500 |
---|---|---|
committer | Stefano Stabellini <stefano.stabellini@eu.citrix.com> | 2010-12-02 09:34:25 -0500 |
commit | af42b8d12f8adec6711cb824549a0edac6a4ae8f (patch) | |
tree | e922110d01d85688a03f9ae5d7e31c9f73f2b001 /include/xen/events.h | |
parent | e5fc7345412d5e4758fcef55a74354c5cbefd61e (diff) |
xen: fix MSI setup and teardown for PV on HVM guests
When remapping MSIs into pirqs for PV on HVM guests, qemu is responsible
for doing the actual mapping and unmapping.
We only give qemu the desired pirq number when we ask to do the mapping
the first time, after that we should be reading back the pirq number
from qemu every time we want to re-enable the MSI.
This fixes a bug in xen_hvm_setup_msi_irqs that manifests itself when
trying to enable the same MSI for the second time: the old MSI to pirq
mapping is still valid at this point but xen_hvm_setup_msi_irqs would
try to assign a new pirq anyway.
A simple way to reproduce this bug is to assign an MSI capable network
card to a PV on HVM guest, if the user brings down the corresponding
ethernet interface and up again, Linux would fail to enable MSIs on the
device.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Diffstat (limited to 'include/xen/events.h')
-rw-r--r-- | include/xen/events.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/include/xen/events.h b/include/xen/events.h index 646dd17d3aa4..00f53ddcc062 100644 --- a/include/xen/events.h +++ b/include/xen/events.h | |||
@@ -76,7 +76,9 @@ int xen_map_pirq_gsi(unsigned pirq, unsigned gsi, int shareable, char *name); | |||
76 | 76 | ||
77 | #ifdef CONFIG_PCI_MSI | 77 | #ifdef CONFIG_PCI_MSI |
78 | /* Allocate an irq and a pirq to be used with MSIs. */ | 78 | /* Allocate an irq and a pirq to be used with MSIs. */ |
79 | void xen_allocate_pirq_msi(char *name, int *irq, int *pirq); | 79 | #define XEN_ALLOC_PIRQ (1 << 0) |
80 | #define XEN_ALLOC_IRQ (1 << 1) | ||
81 | void xen_allocate_pirq_msi(char *name, int *irq, int *pirq, int alloc_mask); | ||
80 | int xen_create_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int type); | 82 | int xen_create_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int type); |
81 | #endif | 83 | #endif |
82 | 84 | ||
@@ -89,4 +91,7 @@ int xen_vector_from_irq(unsigned pirq); | |||
89 | /* Return gsi allocated to pirq */ | 91 | /* Return gsi allocated to pirq */ |
90 | int xen_gsi_from_irq(unsigned pirq); | 92 | int xen_gsi_from_irq(unsigned pirq); |
91 | 93 | ||
94 | /* Return irq from pirq */ | ||
95 | int xen_irq_from_pirq(unsigned pirq); | ||
96 | |||
92 | #endif /* _XEN_EVENTS_H */ | 97 | #endif /* _XEN_EVENTS_H */ |