]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
PCI: replace stray uses of PCI_{DEVFN,BDF}2()
authorJan Beulich <jbeulich@suse.com>
Thu, 28 Apr 2022 14:13:23 +0000 (16:13 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 28 Apr 2022 14:13:23 +0000 (16:13 +0200)
There's no good reason to use these when we already have a pci_sbdf_t
type object available. This extends to the use of PCI_BUS() in
pci_ecam_map_bus() as well.

No change to generated code (with gcc11 at least, and I have to admit
that I didn't expect compilers to necessarily be able to spot the
optimization potential on the original code).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Paul Durrant <paul@xen.org>
Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
xen/arch/arm/pci/ecam.c
xen/arch/x86/msi.c
xen/drivers/passthrough/vtd/qinval.c

index 6aeea12a68bffc5425c1a09f30c56c57ae67705d..3987f96b01783e0d96b5c2b729bbea72bae0c57e 100644 (file)
@@ -28,8 +28,7 @@ void __iomem *pci_ecam_map_bus(struct pci_host_bridge *bridge,
         container_of(bridge->ops, const struct pci_ecam_ops, pci_ops);
     unsigned int devfn_shift = ops->bus_shift - 8;
     void __iomem *base;
-
-    unsigned int busn = PCI_BUS(sbdf.bdf);
+    unsigned int busn = sbdf.bus;
 
     if ( busn < cfg->busn_start || busn > cfg->busn_end )
         return NULL;
@@ -37,7 +36,7 @@ void __iomem *pci_ecam_map_bus(struct pci_host_bridge *bridge,
     busn -= cfg->busn_start;
     base = cfg->win + (busn << ops->bus_shift);
 
-    return base + (PCI_DEVFN2(sbdf.bdf) << devfn_shift) + where;
+    return base + (sbdf.devfn << devfn_shift) + where;
 }
 
 bool __init pci_ecam_need_p2m_hwdom_mapping(struct domain *d,
index b32b1378f84ea42e052f342e4ba55c2a6a93a58c..6be81e6c3b4772829e11aefe8681219e00dcbd07 100644 (file)
@@ -839,7 +839,7 @@ static int msix_capability_init(struct pci_dev *dev,
             pbus = dev->info.physfn.bus;
             pslot = PCI_SLOT(dev->info.physfn.devfn);
             pfunc = PCI_FUNC(dev->info.physfn.devfn);
-            vf = PCI_BDF2(dev->bus, dev->devfn);
+            vf = dev->sbdf.bdf;
         }
 
         table_paddr = read_pci_mem_bar(seg, pbus, pslot, pfunc, bir, vf);
index 6a1c6bd7a9779cc362c5835da062d715e1f34003..4f9ad136b9c50ec2ea86cd698879d7beb5444133 100644 (file)
@@ -267,7 +267,7 @@ int qinval_device_iotlb_sync(struct vtd_iommu *iommu, struct pci_dev *pdev,
     qinval_entry->q.dev_iotlb_inv_dsc.lo.res_1 = 0;
     qinval_entry->q.dev_iotlb_inv_dsc.lo.max_invs_pend = pdev->ats.queue_depth;
     qinval_entry->q.dev_iotlb_inv_dsc.lo.res_2 = 0;
-    qinval_entry->q.dev_iotlb_inv_dsc.lo.sid = PCI_BDF2(pdev->bus, pdev->devfn);
+    qinval_entry->q.dev_iotlb_inv_dsc.lo.sid = pdev->sbdf.bdf;
     qinval_entry->q.dev_iotlb_inv_dsc.lo.res_3 = 0;
 
     qinval_entry->q.dev_iotlb_inv_dsc.hi.size = size;