[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen master] VT-d: have set_msi_source_id() return a success indicator



commit 07d2320427a8ccfe51fe7a95556c80148a5803f7
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Fri Mar 14 10:18:34 2025 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Fri Mar 14 10:18:34 2025 +0100

    VT-d: have set_msi_source_id() return a success indicator
    
    Handling possible internal errors by just emitting a (debug-build-only)
    log message can't be quite enough. Return error codes in those cases,
    and have the caller propagate those up.
    
    Drop a pointless return path, rather than "inventing" an error code for
    it.
    
    While touching the function declarator anyway also constify its first
    parameter.
    
    Fixes: 476bbccc811c ("VT-d: fix MSI source-id of interrupt remapping")
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 xen/drivers/passthrough/vtd/intremap.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/xen/drivers/passthrough/vtd/intremap.c 
b/xen/drivers/passthrough/vtd/intremap.c
index b2f5b4a65a..81394ef452 100644
--- a/xen/drivers/passthrough/vtd/intremap.c
+++ b/xen/drivers/passthrough/vtd/intremap.c
@@ -436,15 +436,13 @@ void cf_check io_apic_write_remap_rte(
     __ioapic_write_entry(apic, pin, true, old_rte);
 }
 
-static void set_msi_source_id(struct pci_dev *pdev, struct iremap_entry *ire)
+static int set_msi_source_id(const struct pci_dev *pdev,
+                             struct iremap_entry *ire)
 {
     u16 seg;
     u8 bus, devfn, secbus;
     int ret;
 
-    if ( !pdev || !ire )
-        return;
-
     seg = pdev->seg;
     bus = pdev->bus;
     devfn = pdev->devfn;
@@ -485,16 +483,21 @@ static void set_msi_source_id(struct pci_dev *pdev, 
struct iremap_entry *ire)
                             PCI_BDF(bus, devfn));
         }
         else
+        {
             dprintk(XENLOG_WARNING VTDPREFIX,
                     "d%d: no upstream bridge for %pp\n",
                     pdev->domain->domain_id, &pdev->sbdf);
+            return -ENXIO;
+        }
         break;
 
     default:
         dprintk(XENLOG_WARNING VTDPREFIX, "d%d: unknown(%u): %pp\n",
                 pdev->domain->domain_id, pdev->type, &pdev->sbdf);
-        break;
-   }
+        return -EOPNOTSUPP;
+    }
+
+    return 0;
 }
 
 static int msi_msg_to_remap_entry(
@@ -509,7 +512,12 @@ static int msi_msg_to_remap_entry(
     bool alloc = false;
 
     if ( pdev )
-        set_msi_source_id(pdev, &new_ire);
+    {
+        int rc = set_msi_source_id(pdev, &new_ire);
+
+        if ( rc )
+            return rc;
+    }
     else
         set_hpet_source_id(msi_desc->hpet_id, &new_ire);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.