Skip to content

Commit f65be26

Browse files
roygerjfvogel
authored andcommitted
PCI: vmd: Disable MSI remapping bypass under Xen
[ Upstream commit 6c4d5aadf5df31ea0ac025980670eee9beaf466b ] MSI remapping bypass (directly configuring MSI entries for devices on the VMD bus) won't work under Xen, as Xen is not aware of devices in such bus, and hence cannot configure the entries using the pIRQ interface in the PV case, and in the PVH case traps won't be setup for MSI entries for such devices. Until Xen is aware of devices in the VMD bus prevent the VMD_FEAT_CAN_BYPASS_MSI_REMAP capability from being used when running as any kind of Xen guest. The MSI remapping bypass is an optional feature of VMD bridges, and hence when running under Xen it will be masked and devices will be forced to redirect its interrupts from the VMD bridge. That mode of operation must always be supported by VMD bridges and works when Xen is not aware of devices behind the VMD bridge. Signed-off-by: Roger Pau Monné <[email protected]> Acked-by: Bjorn Helgaas <[email protected]> Message-ID: <[email protected]> Signed-off-by: Juergen Gross <[email protected]> Signed-off-by: Sasha Levin <[email protected]> (cherry picked from commit 2a8bedeb963f04d13b782e099c7db3d2f62a056e) Signed-off-by: Jack Vogel <[email protected]>
1 parent e530974 commit f65be26

File tree

1 file changed

+20
-0
lines changed
  • drivers/pci/controller

1 file changed

+20
-0
lines changed

drivers/pci/controller/vmd.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#include <linux/rculist.h>
1818
#include <linux/rcupdate.h>
1919

20+
#include <xen/xen.h>
21+
2022
#include <asm/irqdomain.h>
2123

2224
#define VMD_CFGBAR 0
@@ -970,6 +972,24 @@ static int vmd_probe(struct pci_dev *dev, const struct pci_device_id *id)
970972
struct vmd_dev *vmd;
971973
int err;
972974

975+
if (xen_domain()) {
976+
/*
977+
* Xen doesn't have knowledge about devices in the VMD bus
978+
* because the config space of devices behind the VMD bridge is
979+
* not known to Xen, and hence Xen cannot discover or configure
980+
* them in any way.
981+
*
982+
* Bypass of MSI remapping won't work in that case as direct
983+
* write by Linux to the MSI entries won't result in functional
984+
* interrupts, as Xen is the entity that manages the host
985+
* interrupt controller and must configure interrupts. However
986+
* multiplexing of interrupts by the VMD bridge will work under
987+
* Xen, so force the usage of that mode which must always be
988+
* supported by VMD bridges.
989+
*/
990+
features &= ~VMD_FEAT_CAN_BYPASS_MSI_REMAP;
991+
}
992+
973993
if (resource_size(&dev->resource[VMD_CFGBAR]) < (1 << 20))
974994
return -ENOMEM;
975995

0 commit comments

Comments
 (0)