diff mbox series

[1/2] tools/ctrl: Silence missing GSI in xc_pcidev_get_gsi()

Message ID 20250226201022.42447-2-jason.andryuk@amd.com (mailing list archive)
State New
Headers show
Series tools: Fix PVH dom0 passthrough with legacy irq | expand

Commit Message

Jason Andryuk Feb. 26, 2025, 8:10 p.m. UTC
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(-)

Comments

Roger Pau Monné Feb. 28, 2025, 1:59 p.m. UTC | #1
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.
Roger Pau Monné Feb. 28, 2025, 2:02 p.m. UTC | #2
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.
diff mbox series

Patch

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;
     }