Linux 6.12-rc2: xen-privcmd cannot be loaded in domU anymore
Marek Marczykowski-Górecki
Reviewed-by Stefano StabelliniHi,
It looks like xen-privcmd now depends on xen-pciback, and the latter (expectedly) fails to load in domU with -ENODEV. But that prevents loading xen-privcmd too. And that's bad.
The dependency looks to be introduced by this commit:
commit 2fae6bb7be320270801b3c3b040189bd7daa8056
Author: Jiqian Chen <[email protected]> Date: Tue Sep 24 14:14:37 2024 +0800
xen/privcmd: Add new syscall to get gsi from dev
On PVH dom0, when passthrough a device to domU, QEMU and xl tools want to use gsi number to do pirq mapping, see QEMU code xen_pt_realize->xc_physdev_map_pirq, and xl code pci_add_dm_done->xc_physdev_map_pirq, 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.
And in current linux codes, there is no method to get gsi for userspace.
For above purpose, record gsi of pcistub devices when init pcistub and add a new syscall into privcmd to let userspace can get gsi when they have a need.
Message-ID: <[email protected]>
Signature · 3 lines
Best Regards, Marek Marczykowski-Górecki Invisible Things Lab
Quoted 5 lines · Marek Marczykowski-Górecki
Hi,
It looks like xen-privcmd now depends on xen-pciback, and the latter (expectedly) fails to load in domU with
-ENODEV. But that prevents loading xen-privcmd too. And that's bad.
Sorry for introducing that and thank you for reporting it.
Maybe that dependency can be removed.
I used it to pass the combination of compilation(CONFIG_XEN_PRIVCMD=y && CONFIG_XEN_PCIDEV_BACKEND=m). But from my patch, "IS_REACHABLE(CONFIG_XEN_PCIDEV_BACKEND)" is enough. And I have tested locally just now. Juergen and Stefano, what's your opinion?
Quoted 31 lines
The dependency looks to be introduced by this commit:
commit
2fae6bb7be320270801b3c3b040189bd7daa8056Author: Jiqian Chen <[email protected]> Date: Tue Sep 24 14:14:37 2024 +0800xen/privcmd: Add new syscall to get gsi from dev
On PVH dom0, when passthrough a device to domU, QEMU and xl tools want to use gsi number to do pirq mapping, see QEMU code
xen_pt_realize->xc_physdev_map_pirq, and xl codepci_add_dm_done->xc_physdev_map_pirq, 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.
And in current linux codes, there is no method to get gsi for userspace.For above purpose, record gsi of pcistub devices when init pcistub and add a new syscall into privcmd to let userspace can get gsi when they have a need.
Signed-off-by Jiqian Chen <[email protected]>Signed-off-by Huang Rui <[email protected]>Signed-off-by Jiqian Chen <[email protected]>Reviewed-by Stefano Stabellini <[email protected]>Message-ID: <[email protected]>
Signed-off-by Juergen Gross <[email protected]>
Signature · 2 lines
Best regards, Jiqian Chen.
Quoted 6 lines · Jiqian
Quoted 5 lines · Marek Marczykowski-Górecki
Hi,
It looks like xen-privcmd now depends on xen-pciback, and the latter (expectedly) fails to load in domU with
-ENODEV. But that prevents loading xen-privcmd too. And that's bad.
Quoted 6 lines
Sorry for introducing that and thank you for reporting it.
Maybe that dependency can be removed.
I used it to pass the combination ofcompilation(CONFIG_XEN_PRIVCMD=y && CONFIG_XEN_PCIDEV_BACKEND=m). But from my patch, "IS_REACHABLE(CONFIG_XEN_PCIDEV_BACKEND)" is enough. And I have tested locally just now. Juergen and Stefano, what's your opinion?
Please send a patch. :-)
Juergen