* [PATCH 0/2] tools: Fix PVH dom0 passthrough with legacy irq
@ 2025-02-26 20:10 Jason Andryuk
2025-02-26 20:10 ` [PATCH 1/2] tools/ctrl: Silence missing GSI in xc_pcidev_get_gsi() Jason Andryuk
2025-02-26 20:10 ` [PATCH 2/2] tools/libxl: Skip missing PCI GSIs Jason Andryuk
0 siblings, 2 replies; 7+ messages in thread
From: Jason Andryuk @ 2025-02-26 20:10 UTC (permalink / raw)
To: xen-devel
Cc: Jiqian Chen, Huang Rui, 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 | 3 ++-
tools/libs/light/libxl_x86.c | 10 ++++++++--
2 files changed, 10 insertions(+), 3 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] tools/ctrl: Silence missing GSI in xc_pcidev_get_gsi()
2025-02-26 20:10 [PATCH 0/2] tools: Fix PVH dom0 passthrough with legacy irq Jason Andryuk
@ 2025-02-26 20:10 ` Jason Andryuk
2025-02-28 13:59 ` Roger Pau Monné
2025-02-28 14:02 ` Roger Pau Monné
2025-02-26 20:10 ` [PATCH 2/2] tools/libxl: Skip missing PCI GSIs Jason Andryuk
1 sibling, 2 replies; 7+ messages in thread
From: Jason Andryuk @ 2025-02-26 20:10 UTC (permalink / raw)
To: xen-devel
Cc: Jiqian Chen, Huang Rui, 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>
---
tools/libs/ctrl/xc_linux.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/libs/ctrl/xc_linux.c b/tools/libs/ctrl/xc_linux.c
index 92591e49a1..c18f09392f 100644
--- a/tools/libs/ctrl/xc_linux.c
+++ b/tools/libs/ctrl/xc_linux.c
@@ -78,7 +78,8 @@ int xc_pcidev_get_gsi(xc_interface *xch, uint32_t sbdf)
IOCTL_PRIVCMD_PCIDEV_GET_GSI, &dev_gsi);
if (ret < 0) {
- PERROR("Failed to get gsi from dev");
+ if (errno != ENOENT)
+ PERROR("Failed to get gsi from dev");
} else {
ret = dev_gsi.gsi;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] tools/libxl: Skip missing PCI GSIs
2025-02-26 20:10 [PATCH 0/2] tools: Fix PVH dom0 passthrough with legacy irq Jason Andryuk
2025-02-26 20:10 ` [PATCH 1/2] tools/ctrl: Silence missing GSI in xc_pcidev_get_gsi() Jason Andryuk
@ 2025-02-26 20:10 ` Jason Andryuk
2025-02-27 8:25 ` Jan Beulich
1 sibling, 1 reply; 7+ messages in thread
From: Jason Andryuk @ 2025-02-26 20:10 UTC (permalink / raw)
To: xen-devel
Cc: Jiqian Chen, Huang Rui, 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>
---
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..63208362af 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 == -1 && 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 == -1 && 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 2/2] tools/libxl: Skip missing PCI GSIs
2025-02-26 20:10 ` [PATCH 2/2] tools/libxl: Skip missing PCI GSIs Jason Andryuk
@ 2025-02-27 8:25 ` Jan Beulich
2025-02-27 15:24 ` Jason Andryuk
0 siblings, 1 reply; 7+ messages in thread
From: Jan Beulich @ 2025-02-27 8:25 UTC (permalink / raw)
To: Jason Andryuk
Cc: Jiqian Chen, Huang Rui, Anthony PERARD, Juergen Gross, xen-devel
On 26.02.2025 21:10, Jason Andryuk wrote:
> --- 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 == -1 && 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 == -1 && errno == ENOENT) {
> + LOGD(DEBUG, domid, "xc_pcidev_get_gsi no gsi");
> + return 0;
> + } else if (gsi < 0) {
> return ERROR_FAIL;
> }
>
Why the special-casing of the value -1?
Jan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] tools/libxl: Skip missing PCI GSIs
2025-02-27 8:25 ` Jan Beulich
@ 2025-02-27 15:24 ` Jason Andryuk
0 siblings, 0 replies; 7+ messages in thread
From: Jason Andryuk @ 2025-02-27 15:24 UTC (permalink / raw)
To: Jan Beulich
Cc: Jiqian Chen, Huang Rui, Anthony PERARD, Juergen Gross, xen-devel
On 2025-02-27 03:25, Jan Beulich wrote:
> On 26.02.2025 21:10, Jason Andryuk wrote:
>> --- a/tools/libs/light/libxl_x86.c
>> +++ b/tools/libs/light/libxl_x86.c
>> @@ -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 == -1 && errno == ENOENT) {
>> + LOGD(DEBUG, domid, "xc_pcidev_get_gsi no gsi");
>> + return 0;
>> + } else if (gsi < 0) {
>> return ERROR_FAIL;
>> }
>>
>
> Why the special-casing of the value -1?
No good reason. I'll restore it to < 0. I originally thought
xc_pcidev_get_gsi() was returning -errno in gsi. That was not the case.
Regards,
Jason
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] tools/ctrl: Silence missing GSI in xc_pcidev_get_gsi()
2025-02-26 20:10 ` [PATCH 1/2] tools/ctrl: Silence missing GSI in xc_pcidev_get_gsi() Jason Andryuk
@ 2025-02-28 13:59 ` Roger Pau Monné
2025-02-28 14:02 ` Roger Pau Monné
1 sibling, 0 replies; 7+ messages in thread
From: Roger Pau Monné @ 2025-02-28 13:59 UTC (permalink / raw)
To: Jason Andryuk
Cc: xen-devel, Jiqian Chen, Huang Rui, Anthony PERARD, Juergen Gross
On Wed, Feb 26, 2025 at 03:10:21PM -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.
^ logs?
>
> 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>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
> ---
> tools/libs/ctrl/xc_linux.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tools/libs/ctrl/xc_linux.c b/tools/libs/ctrl/xc_linux.c
> index 92591e49a1..c18f09392f 100644
> --- a/tools/libs/ctrl/xc_linux.c
> +++ b/tools/libs/ctrl/xc_linux.c
> @@ -78,7 +78,8 @@ int xc_pcidev_get_gsi(xc_interface *xch, uint32_t sbdf)
> IOCTL_PRIVCMD_PCIDEV_GET_GSI, &dev_gsi);
>
> if (ret < 0) {
> - PERROR("Failed to get gsi from dev");
> + if (errno != ENOENT)
> + PERROR("Failed to get gsi from dev");
Nit: isn't the style of xc_pcidev_get_gsi() wrong? From what I see in
this same file and all other files in libs/ctrl it should use the
hypervisor coding style.
Thanks, Roger.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] tools/ctrl: Silence missing GSI in xc_pcidev_get_gsi()
2025-02-26 20:10 ` [PATCH 1/2] tools/ctrl: Silence missing GSI in xc_pcidev_get_gsi() Jason Andryuk
2025-02-28 13:59 ` Roger Pau Monné
@ 2025-02-28 14:02 ` Roger Pau Monné
1 sibling, 0 replies; 7+ messages in thread
From: Roger Pau Monné @ 2025-02-28 14:02 UTC (permalink / raw)
To: Jason Andryuk
Cc: xen-devel, Jiqian Chen, Huang Rui, Anthony PERARD, Juergen Gross
On Wed, Feb 26, 2025 at 03:10:21PM -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>
> ---
> tools/libs/ctrl/xc_linux.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tools/libs/ctrl/xc_linux.c b/tools/libs/ctrl/xc_linux.c
> index 92591e49a1..c18f09392f 100644
> --- a/tools/libs/ctrl/xc_linux.c
> +++ b/tools/libs/ctrl/xc_linux.c
> @@ -78,7 +78,8 @@ int xc_pcidev_get_gsi(xc_interface *xch, uint32_t sbdf)
> IOCTL_PRIVCMD_PCIDEV_GET_GSI, &dev_gsi);
>
> if (ret < 0) {
> - PERROR("Failed to get gsi from dev");
> + if (errno != ENOENT)
> + PERROR("Failed to get gsi from dev");
While here, could you maybe print the S:B:D:F as part of the error
message? (seeing as it's a function parameter).
Thanks, Roger.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-02-28 14:02 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-26 20:10 [PATCH 0/2] tools: Fix PVH dom0 passthrough with legacy irq Jason Andryuk
2025-02-26 20:10 ` [PATCH 1/2] tools/ctrl: Silence missing GSI in xc_pcidev_get_gsi() Jason Andryuk
2025-02-28 13:59 ` Roger Pau Monné
2025-02-28 14:02 ` Roger Pau Monné
2025-02-26 20:10 ` [PATCH 2/2] tools/libxl: Skip missing PCI GSIs Jason Andryuk
2025-02-27 8:25 ` Jan Beulich
2025-02-27 15:24 ` Jason Andryuk
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.