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

[PATCH v3 09/18] amd/iommu: Parse into pci_sbdf_t directly



Signed-off-by: Teddy Astie <teddy.astie@xxxxxxxxxx>
---
 xen/drivers/passthrough/amd/iommu_acpi.c | 26 ++++++++++++------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/xen/drivers/passthrough/amd/iommu_acpi.c 
b/xen/drivers/passthrough/amd/iommu_acpi.c
index 39ae637959..33c2c78bdd 100644
--- a/xen/drivers/passthrough/amd/iommu_acpi.c
+++ b/xen/drivers/passthrough/amd/iommu_acpi.c
@@ -682,8 +682,8 @@ static int __init cf_check parse_ivrs_ioapic(const char 
*str)
 {
     const char *s = str;
     unsigned long id;
-    unsigned int seg, bus, dev, func;
     unsigned int idx;
+    pci_sbdf_t sbdf;
 
     if ( *s != '[' )
         return -EINVAL;
@@ -692,7 +692,7 @@ static int __init cf_check parse_ivrs_ioapic(const char 
*str)
     if ( *s != ']' || *++s != '=' )
         return -EINVAL;
 
-    s = parse_pci(s + 1, &seg, &bus, &dev, &func);
+    s = parse_pci(s + 1, &sbdf);
     if ( !s || *s )
         return -EINVAL;
 
@@ -707,7 +707,7 @@ static int __init cf_check parse_ivrs_ioapic(const char 
*str)
         }
     }
 
-    ioapic_sbdf[idx].sbdf = PCI_SBDF(seg, bus, dev, func);
+    ioapic_sbdf[idx].sbdf = sbdf;
     ioapic_sbdf[idx].id = id;
     ioapic_sbdf[idx].cmdline = true;
 
@@ -719,7 +719,7 @@ static int __init cf_check parse_ivrs_hpet(const char *str)
 {
     const char *s = str;
     unsigned long id;
-    unsigned int seg, bus, dev, func;
+    pci_sbdf_t sbdf;
 
     if ( *s != '[' )
         return -EINVAL;
@@ -728,12 +728,12 @@ static int __init cf_check parse_ivrs_hpet(const char 
*str)
     if ( id != (typeof(hpet_sbdf.id))id || *s != ']' || *++s != '=' )
         return -EINVAL;
 
-    s = parse_pci(s + 1, &seg, &bus, &dev, &func);
+    s = parse_pci(s + 1, &sbdf);
     if ( !s || *s )
         return -EINVAL;
 
     hpet_sbdf.id = id;
-    hpet_sbdf.sbdf = PCI_SBDF(seg, bus, dev, func);
+    hpet_sbdf.sbdf = sbdf;
     hpet_sbdf.init = HPET_CMDL;
 
     return 0;
@@ -1399,13 +1399,13 @@ static int __init cf_check parse_ivmd_param(const char 
*s)
         }
 
         do {
-            unsigned int seg, bus, dev, func;
+            pci_sbdf_t sbdf;
 
             if ( nr_ivmd >= ARRAY_SIZE(user_ivmds) )
                 return -E2BIG;
 
-            s = parse_pci(s + 1, &seg, &bus, &dev, &func);
-            if ( !s || seg )
+            s = parse_pci(s + 1, &sbdf);
+            if ( !s || sbdf.seg )
                 return -EINVAL;
 
             user_ivmds[nr_ivmd].start_address = start << PAGE_SHIFT;
@@ -1413,16 +1413,16 @@ static int __init cf_check parse_ivmd_param(const char 
*s)
             user_ivmds[nr_ivmd].header.flags = ACPI_IVMD_UNITY |
                                                ACPI_IVMD_READ | 
ACPI_IVMD_WRITE;
             user_ivmds[nr_ivmd].header.length = sizeof(*user_ivmds);
-            user_ivmds[nr_ivmd].header.device_id = PCI_BDF(bus, dev, func);
+            user_ivmds[nr_ivmd].header.device_id = sbdf.bdf;
             user_ivmds[nr_ivmd].header.type = ACPI_IVRS_TYPE_MEMORY_ONE;
 
             if ( *s == '-' )
             {
-                s = parse_pci(s + 1, &seg, &bus, &dev, &func);
-                if ( !s || seg )
+                s = parse_pci(s + 1, &sbdf);
+                if ( !s || sbdf.seg )
                     return -EINVAL;
 
-                user_ivmds[nr_ivmd].aux_data = PCI_BDF(bus, dev, func);
+                user_ivmds[nr_ivmd].aux_data = sbdf.bdf;
                 if ( user_ivmds[nr_ivmd].aux_data <
                      user_ivmds[nr_ivmd].header.device_id )
                     return -EINVAL;
-- 
2.54.0



--
Teddy Astie | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech

 


Rackspace

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