xen/passthrough: use gsi to map pirq when dom0 is PVH

In PVH dom0, when passthrough a device to domU, QEMU code
xen_pt_realize->xc_physdev_map_pirq wants to use gsi, but in current codes
the gsi number is got from file /sys/bus/pci/devices/<sbdf>/irq, that is
wrong, because irq is not equal with gsi, they are in different spaces, so
pirq mapping fails.

To solve above problem, use new interface of Xen, xc_pcidev_get_gsi to get
gsi and use xc_physdev_map_pirq_gsi to map pirq when dom0 is PVH.

Signed-off-by: Jiqian Chen <Jiqian.Chen@amd.com>
Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Jiqian Chen <Jiqian.Chen@amd.com>
Acked-by: Anthony PERARD <anthony@xenproject.org>
Reviewed-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
Message-Id: <20241106061418.3655304-1-Jiqian.Chen@amd.com>
Signed-off-by: Anthony PERARD <anthony.perard@vates.tech>
This commit is contained in:
Jiqian Chen 2024-11-06 14:14:18 +08:00 committed by Anthony PERARD
parent 5136598e26
commit cfcacbab38
2 changed files with 64 additions and 0 deletions

View file

@ -23,6 +23,10 @@ extern bool pci_available;
#define PCI_SLOT_MAX 32
#define PCI_FUNC_MAX 8
#define PCI_SBDF(seg, bus, dev, func) \
((((uint32_t)(seg)) << 16) | \
(PCI_BUILD_BDF(bus, PCI_DEVFN(dev, func))))
/* Class, Vendor and Device IDs from Linux's pci_ids.h */
#include "hw/pci/pci_ids.h"