All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] tools: Fix PVH dom0 passthrough with legacy irq
@ 2025-03-08  0:17 Jason Andryuk
  2025-03-08  0:17 ` [PATCH v2 1/2] tools/ctrl: Silence missing GSI in xc_pcidev_get_gsi() Jason Andryuk
  2025-03-08  0:17 ` [PATCH v2 2/2] tools/libxl: Skip missing PCI GSIs Jason Andryuk
  0 siblings, 2 replies; 7+ messages in thread
From: Jason Andryuk @ 2025-03-08  0:17 UTC (permalink / raw)
  To: xen-devel
  Cc: Roger Pau Monné, Jason Andryuk, Anthony PERARD,
	Juergen Gross

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/20250226200134.29759-1-jason.andryuk@amd.com/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(-)

-- 
2.34.1



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2 1/2] tools/ctrl: Silence missing GSI in xc_pcidev_get_gsi()
  2025-03-08  0:17 [PATCH v2 0/2] tools: Fix PVH dom0 passthrough with legacy irq Jason Andryuk
@ 2025-03-08  0:17 ` Jason Andryuk
  2025-03-12 15:54   ` Anthony PERARD
  2025-03-12 15:56   ` Andrew Cooper
  2025-03-08  0:17 ` [PATCH v2 2/2] tools/libxl: Skip missing PCI GSIs Jason Andryuk
  1 sibling, 2 replies; 7+ messages in thread
From: Jason Andryuk @ 2025-03-08  0:17 UTC (permalink / raw)
  To: xen-devel
  Cc: Roger Pau Monné, Jason Andryuk, Anthony PERARD,
	Juergen Gross

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.

Fixes: b93e5981d258 ("tools: Add new function to get gsi from dev")
Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
---
v2:
Use Xen code style
Print sbdf
---
 tools/libs/ctrl/xc_linux.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/tools/libs/ctrl/xc_linux.c b/tools/libs/ctrl/xc_linux.c
index 92591e49a1..2b2d7b3196 100644
--- a/tools/libs/ctrl/xc_linux.c
+++ b/tools/libs/ctrl/xc_linux.c
@@ -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;
     }
 
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 2/2] tools/libxl: Skip missing PCI GSIs
  2025-03-08  0:17 [PATCH v2 0/2] tools: Fix PVH dom0 passthrough with legacy irq Jason Andryuk
  2025-03-08  0:17 ` [PATCH v2 1/2] tools/ctrl: Silence missing GSI in xc_pcidev_get_gsi() Jason Andryuk
@ 2025-03-08  0:17 ` Jason Andryuk
  2025-03-12 15:57   ` Anthony PERARD
  1 sibling, 1 reply; 7+ messages in thread
From: Jason Andryuk @ 2025-03-08  0:17 UTC (permalink / raw)
  To: xen-devel
  Cc: Roger Pau Monné, Jason Andryuk, Anthony PERARD,
	Juergen Gross

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() and
libxl__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 <jason.andryuk@amd.com>
---
v2:
Use gsi < 0 - Jan
---
 tools/libs/light/libxl_x86.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/tools/libs/light/libxl_x86.c b/tools/libs/light/libxl_x86.c
index a3164a3077..0a7f64ad46 100644
--- a/tools/libs/light/libxl_x86.c
+++ b/tools/libs/light/libxl_x86.c
@@ -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;
     }
 
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 1/2] tools/ctrl: Silence missing GSI in xc_pcidev_get_gsi()
  2025-03-08  0:17 ` [PATCH v2 1/2] tools/ctrl: Silence missing GSI in xc_pcidev_get_gsi() Jason Andryuk
@ 2025-03-12 15:54   ` Anthony PERARD
  2025-03-12 15:56   ` Andrew Cooper
  1 sibling, 0 replies; 7+ messages in thread
From: Anthony PERARD @ 2025-03-12 15:54 UTC (permalink / raw)
  To: Jason Andryuk; +Cc: xen-devel, Roger Pau Monné, Juergen Gross

On Fri, Mar 07, 2025 at 07:17:10PM -0500, Jason Andryuk wrote:
> 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.
> 
> Fixes: b93e5981d258 ("tools: Add new function to get gsi from dev")
> Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>

Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>

Thanks,

-- 

Anthony Perard | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 1/2] tools/ctrl: Silence missing GSI in xc_pcidev_get_gsi()
  2025-03-08  0:17 ` [PATCH v2 1/2] tools/ctrl: Silence missing GSI in xc_pcidev_get_gsi() Jason Andryuk
  2025-03-12 15:54   ` Anthony PERARD
@ 2025-03-12 15:56   ` Andrew Cooper
  2025-03-12 17:09     ` Jason Andryuk
  1 sibling, 1 reply; 7+ messages in thread
From: Andrew Cooper @ 2025-03-12 15:56 UTC (permalink / raw)
  To: Jason Andryuk, xen-devel
  Cc: Roger Pau Monné, Anthony PERARD, Juergen Gross

On 08/03/2025 12:17 am, Jason Andryuk wrote:
> 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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 2/2] tools/libxl: Skip missing PCI GSIs
  2025-03-08  0:17 ` [PATCH v2 2/2] tools/libxl: Skip missing PCI GSIs Jason Andryuk
@ 2025-03-12 15:57   ` Anthony PERARD
  0 siblings, 0 replies; 7+ messages in thread
From: Anthony PERARD @ 2025-03-12 15:57 UTC (permalink / raw)
  To: Jason Andryuk; +Cc: xen-devel, Roger Pau Monné, Juergen Gross

On Fri, Mar 07, 2025 at 07:17:11PM -0500, Jason Andryuk wrote:
> 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() and
> libxl__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 <jason.andryuk@amd.com>

Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>

Thanks

-- 

Anthony Perard | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 1/2] tools/ctrl: Silence missing GSI in xc_pcidev_get_gsi()
  2025-03-12 15:56   ` Andrew Cooper
@ 2025-03-12 17:09     ` Jason Andryuk
  0 siblings, 0 replies; 7+ messages in thread
From: Jason Andryuk @ 2025-03-12 17:09 UTC (permalink / raw)
  To: Andrew Cooper, xen-devel
  Cc: Roger Pau Monné, Anthony PERARD, Juergen Gross

On 2025-03-12 11:56, Andrew Cooper wrote:
> On 08/03/2025 12:17 am, Jason Andryuk wrote:
>> 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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-03-12 17:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-08  0:17 [PATCH v2 0/2] tools: Fix PVH dom0 passthrough with legacy irq Jason Andryuk
2025-03-08  0:17 ` [PATCH v2 1/2] tools/ctrl: Silence missing GSI in xc_pcidev_get_gsi() Jason Andryuk
2025-03-12 15:54   ` Anthony PERARD
2025-03-12 15:56   ` Andrew Cooper
2025-03-12 17:09     ` Jason Andryuk
2025-03-08  0:17 ` [PATCH v2 2/2] tools/libxl: Skip missing PCI GSIs Jason Andryuk
2025-03-12 15:57   ` Anthony PERARD

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.