tools: Fix PVH dom0 passthrough with legacy irq
v2 cover tools: Fix PVH dom0 passthrough with legacy irq
A PCI device may not have a legacy IRQ assigned. This series allows passthrough of such a device to a guest.
It relies on a Linux change to xen-pciback to also handle missing legacy IRQs:
https://lore.kernel.org/xen-devel/[email protected]/T/#u
Jason Andryuk (2):
tools/ctrl: Silence missing GSI in xc_pcidev_get_gsi() tools/libxl: Skip missing PCI GSIs
tools/libs/ctrl/xc_linux.c | 11 ++++++++--- tools/libs/light/libxl_x86.c | 10 ++++++++-- 2 files changed, 16 insertions(+), 5 deletions(-)
Signature · 1 line
2.34.1
PATCH v2 1/2 tools/ctrl: Silence missing GSI in xc_pcidev_get_gsi()
It is valid for a PCI device to not have a legacy IRQ. In that case, do not print an error to keep the lgs clean.
This relies on pciback being updated to return -ENOENT for a missing GSI.
---
v2:
Use Xen code style
Print sbdf
--- tools/libs/ctrl/xc_linux.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
tools/libs/ctrl/xc_linux.c +8 -3
@@ -77,9 +77,14 @@ int xc_pcidev_get_gsi(xc_interface *xch, uint32_t sbdf) ret =ioctl (xencall_fd (xch->xcall),IOCTL_PRIVCMD_PCIDEV_GET_GSI , &dev_gsi); -if (ret <0 ) { -PERROR ("Failed to get gsi from dev" ); - }else { +if ( ret <0 ) + { +if ( errno !=ENOENT ) +PERROR ("Failed to get gsi for dev %04x:%02x:%02x.%u" , + sbdf >>16 , (sbdf >>8 ) &0xff , sbdf >>3 &0x1f , sbdf &0x7 ); + } +else + { ret = dev_gsi.gsi; }
Signature · 1 line
2.34.1
Re: [PATCH v2 1/2] tools/ctrl: Silence missing GSI in xc_pcidev_get_gsi()
Quoted 8 lines · Jason Andryuk
It is valid for a PCI device to not have a legacy IRQ. In that case, do not print an error to keep the lgs clean.
This relies on pciback being updated to return
-ENOENTfor a missing GSI.Fixes b93e5981d258 ("tools: Add new function to get gsi from dev")Signed-off-by Jason Andryuk <[email protected]>
Thanks,
Signature · 5 lines
Anthony Perard | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech
Re: [PATCH v2 1/2] tools/ctrl: Silence missing GSI in xc_pcidev_get_gsi()
In reply to Jason AndryukQuoted 2 lines · Jason Andryuk
It is valid for a PCI device to not have a legacy IRQ. In that case, do not print an error to keep the lgs clean.
This logs looks a little too clean of o's.
~Andrew
Re: [PATCH v2 1/2] tools/ctrl: Silence missing GSI in xc_pcidev_get_gsi()
Quoted 5 lines · Andrew Cooper
Quoted 2 lines · Jason Andryuk
It is valid for a PCI device to not have a legacy IRQ. In that case, do not print an error to keep the lgs clean.
This logs looks a little too clean of o's.
Oops. Can this be fixed on commit, please?
Thanks,
Jason
PATCH v2 2/2 tools/libxl: Skip missing PCI GSIs
In reply to Jason AndryukA PCI device may not have a legacy IRQ. In that case, we don't need to do anything, so don't fail in libxl__arch_hvm_map_gsi() and libxl__arch_hvm_unmap_gsi().
Requires an updated pciback to return -ENOENT.
---
v2:
Use gsi < 0 - Jan
--- tools/libs/light/libxl_x86.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
tools/libs/light/libxl_x86.c +8 -2
@@ -901,7 +901,10 @@ int libxl__arch_hvm_map_gsi(libxl__gc *gc, uint32_t sbdf, uint32_t domid)int pirq =-1 , gsi, r; gsi =xc_pcidev_get_gsi (CTX ->xch, sbdf); -if (gsi <0 ) { +if (gsi <0 && errno ==ENOENT ) { +LOGD (DEBUG , domid,"xc_pcidev_get_gsi no gsi" ); +return 0 ; + }else if (gsi <0 ) {return ERROR_FAIL ; }
@@ -925,7 +928,10 @@ int libxl__arch_hvm_unmap_gsi(libxl__gc *gc, uint32_t sbdf, uint32_t domid)int pirq =-1 , gsi, r; gsi =xc_pcidev_get_gsi (CTX ->xch, sbdf); -if (gsi <0 ) { +if (gsi <0 && errno ==ENOENT ) { +LOGD (DEBUG , domid,"xc_pcidev_get_gsi no gsi" ); +return 0 ; + }else if (gsi <0 ) {return ERROR_FAIL ; }
Signature · 1 line
2.34.1
Re: [PATCH v2 2/2] tools/libxl: Skip missing PCI GSIs
Quoted 8 lines · Jason Andryuk
A PCI device may not have a legacy IRQ. In that case, we don't need to do anything, so don't fail in
libxl__arch_hvm_map_gsi()andlibxl__arch_hvm_unmap_gsi().Requires an updated pciback to return
-ENOENT.Fixes f97f885c7198 ("tools: Add new function to do PIRQ (un)map on PVH dom0")Signed-off-by Jason Andryuk <[email protected]>
Thanks
Signature · 5 lines
Anthony Perard | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech