On Sun, Mar 12, 2023 at 03:54:55PM +0800, Huang Rui wrote: > From: Chen Jiqian <jiqian.c...@amd.com> > > Use new xc_physdev_gsi_from_irq to get the GSI number > > Signed-off-by: Chen Jiqian <jiqian.c...@amd.com> > Signed-off-by: Huang Rui <ray.hu...@amd.com> > --- > tools/libs/light/libxl_pci.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/tools/libs/light/libxl_pci.c b/tools/libs/light/libxl_pci.c > index f4c4f17545..47cf2799bf 100644 > --- a/tools/libs/light/libxl_pci.c > +++ b/tools/libs/light/libxl_pci.c > @@ -1486,6 +1486,7 @@ static void pci_add_dm_done(libxl__egc *egc, > goto out_no_irq; > } > if ((fscanf(f, "%u", &irq) == 1) && irq) { > + irq = xc_physdev_gsi_from_irq(ctx->xch, irq);
This is just a shot in the dark, because I don't really have enough context to understand what's going on here, but see below. I've taken a look at this on my box, and it seems like on dom0 the value returned by /sys/bus/pci/devices/SBDF/irq is not very consistent. If devices are in use by a driver the irq sysfs node reports either the GSI irq or the MSI IRQ (in case a single MSI interrupt is setup). It seems like pciback in Linux does something to report the correct value: root@lcy2-dt107:~# cat /sys/bus/pci/devices/0000\:00\:14.0/irq 74 root@lcy2-dt107:~# xl pci-assignable-add 00:14.0 root@lcy2-dt107:~# cat /sys/bus/pci/devices/0000\:00\:14.0/irq 16 As you can see, making the device assignable changed the value reported by the irq node to be the GSI instead of the MSI IRQ, I would think you are missing something similar in the PVH setup (some pciback magic)? Albeit I have no idea why you would need to translate from IRQ to GSI in the way you do in this and related patches, because I'm missing the context. Regards, Roger.