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

[PATCH v2 09/15] pci: Use pci_sbdf_t in pci_remove_device()



No functional change intended.

Signed-off-by: Teddy Astie <teddy.astie@xxxxxxxxxx>
---
 xen/arch/x86/physdev.c        | 2 +-
 xen/drivers/passthrough/pci.c | 8 ++++----
 xen/drivers/pci/physdev.c     | 2 +-
 xen/include/xen/pci.h         | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/physdev.c b/xen/arch/x86/physdev.c
index 984fb99aa8..a62087b780 100644
--- a/xen/arch/x86/physdev.c
+++ b/xen/arch/x86/physdev.c
@@ -483,7 +483,7 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) 
arg)
         if ( copy_from_guest(&manage_pci, arg, 1) != 0 )
             break;
 
-        ret = pci_remove_device(0, manage_pci.bus, manage_pci.devfn);
+        ret = pci_remove_device(PCI_SBDF(0, manage_pci.bus, manage_pci.devfn));
         break;
     }
 
diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index 7c820f5edf..3be0772107 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -830,13 +830,13 @@ out:
     return ret;
 }
 
-int pci_remove_device(u16 seg, u8 bus, u8 devfn)
+int pci_remove_device(pci_sbdf_t sbdf)
 {
-    struct pci_seg *pseg = get_pseg(seg);
+    struct pci_seg *pseg = get_pseg(sbdf.seg);
     struct pci_dev *pdev;
     int ret;
 
-    ret = xsm_resource_unplug_pci(XSM_PRIV, (seg << 16) | (bus << 8) | devfn);
+    ret = xsm_resource_unplug_pci(XSM_PRIV, sbdf.sbdf);
     if ( ret )
         return ret;
 
@@ -847,7 +847,7 @@ int pci_remove_device(u16 seg, u8 bus, u8 devfn)
 
     pcidevs_lock();
     list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
-        if ( pdev->bus == bus && pdev->devfn == devfn )
+        if ( pdev->sbdf.bdf == sbdf.bdf )
         {
             if ( !pdev->info.is_virtfn && !list_empty(&pdev->vf_list) )
             {
diff --git a/xen/drivers/pci/physdev.c b/xen/drivers/pci/physdev.c
index d46501b884..3f5989dca6 100644
--- a/xen/drivers/pci/physdev.c
+++ b/xen/drivers/pci/physdev.c
@@ -64,7 +64,7 @@ ret_t pci_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) 
arg)
         if ( copy_from_guest(&dev, arg, 1) != 0 )
             break;
 
-        ret = pci_remove_device(dev.seg, dev.bus, dev.devfn);
+        ret = pci_remove_device(PCI_SBDF(dev.seg, dev.bus, dev.devfn));
         break;
     }
 
diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h
index a1b3e00e31..be8c72f055 100644
--- a/xen/include/xen/pci.h
+++ b/xen/include/xen/pci.h
@@ -231,7 +231,7 @@ int pci_add_segment(u16 seg);
 const unsigned long *pci_get_ro_map(u16 seg);
 int pci_add_device(u16 seg, u8 bus, u8 devfn,
                    const struct pci_dev_info *info, nodeid_t node);
-int pci_remove_device(u16 seg, u8 bus, u8 devfn);
+int pci_remove_device(pci_sbdf_t sbdf);
 int pci_ro_device(pci_sbdf_t sbdf);
 int pci_hide_device(pci_sbdf_t sbdf);
 struct pci_dev *pci_get_pdev(const struct domain *d, pci_sbdf_t sbdf);
-- 
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®.