In PVH dom0, it uses the linux local interrupt mechanism, when it allocs irq for a gsi, it is dynamic, and follow the principle of applying first, distributing first. And the irq number is alloced from small to large, but the applying gsi number is not, may gsi 38 comes before gsi 28, that causes the irq number is not equal with the gsi number. And when passthrough a device, qemu wants to use gsi to map pirq, xen_pt_realize->xc_physdev_map_pirq, but the gsi number is got from file /sys/bus/pci/devices/<sbdf>/irq in current code, so it will fail when mapping.
Use real gsi number read from gsi sysfs. Co-developed-by: Huang Rui <[email protected]> Signed-off-by: Jiqian Chen <[email protected]> --- hw/xen/xen-host-pci-device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/xen/xen-host-pci-device.c b/hw/xen/xen-host-pci-device.c index 8c6e9a1716..e270ac2631 100644 --- a/hw/xen/xen-host-pci-device.c +++ b/hw/xen/xen-host-pci-device.c @@ -364,7 +364,7 @@ void xen_host_pci_device_get(XenHostPCIDevice *d, uint16_t domain, } d->device_id = v; - xen_host_pci_get_dec_value(d, "irq", &v, errp); + xen_host_pci_get_dec_value(d, "gsi", &v, errp); if (*errp) { goto error; } -- 2.34.1
