On 2023/12/11 23:33, Roger Pau Monné wrote: > On Mon, Dec 11, 2023 at 12:52:40AM +0800, Jiqian Chen wrote: >> 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 <ray.hu...@amd.com> >> Signed-off-by: Jiqian Chen <jiqian.c...@amd.com> >> --- >> 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); > > Don't you need to fallthrough to use the irq number on failure? > Otherwise passthrough won't work on older Linux versions that don't > expose the gsi node. You are right, I will use the irq if there isn't a gsi sysfs, in next version. Thank you.
> > Thanks, Roger. -- Best regards, Jiqian Chen.