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

Jason Andryuk posted 2 patches 1 day, 22 hours ago
[PATCH v2 1/2] tools/ctrl: Silence missing GSI in xc_pcidev_get_gsi()
Posted by Jason Andryuk 1 day, 22 hours ago
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