|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] PCI: bring pci_get_real_pdev() in line with pci_get_pdev()
commit f5234f36335618c31963df260704524366f9bb95
Author: Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Fri Aug 12 08:37:50 2022 +0200
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Fri Aug 12 08:37:50 2022 +0200
PCI: bring pci_get_real_pdev() in line with pci_get_pdev()
Fold the three parameters into a single pci_sbdf_t one.
No functional change intended, despite the "(8 - stride)" ->
"stride" replacement (not really sure why it was written the more
complicated way originally).
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Reviewed-by: Rahul Singh <rahul.singh@xxxxxxx>
Tested-by: Rahul Singh <rahul.singh@xxxxxxx>
---
xen/drivers/passthrough/amd/iommu_init.c | 3 +--
xen/drivers/passthrough/pci.c | 14 ++++++--------
xen/include/xen/pci.h | 2 +-
3 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/xen/drivers/passthrough/amd/iommu_init.c
b/xen/drivers/passthrough/amd/iommu_init.c
index 14f8af7ea8..1f14aaf49e 100644
--- a/xen/drivers/passthrough/amd/iommu_init.c
+++ b/xen/drivers/passthrough/amd/iommu_init.c
@@ -639,8 +639,7 @@ static void cf_check parse_ppr_log_entry(struct amd_iommu
*iommu, u32 entry[])
struct pci_dev *pdev;
pcidevs_lock();
- pdev = pci_get_real_pdev(iommu->seg, PCI_BUS(device_id),
- PCI_DEVFN(device_id));
+ pdev = pci_get_real_pdev(PCI_SBDF(iommu->seg, device_id));
pcidevs_unlock();
if ( pdev )
diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index 0722f8d571..cdaf5c247f 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -576,20 +576,18 @@ int __init pci_ro_device(int seg, int bus, int devfn)
return 0;
}
-struct pci_dev *pci_get_real_pdev(int seg, int bus, int devfn)
+struct pci_dev *pci_get_real_pdev(pci_sbdf_t sbdf)
{
struct pci_dev *pdev;
int stride;
- if ( seg < 0 || bus < 0 || devfn < 0 )
- return NULL;
-
- for ( pdev = pci_get_pdev(NULL, PCI_SBDF(seg, bus, devfn)), stride = 4;
+ for ( pdev = pci_get_pdev(NULL, sbdf), stride = 4;
!pdev && stride; stride >>= 1 )
{
- if ( !(devfn & (8 - stride)) )
+ if ( !(sbdf.devfn & stride) )
continue;
- pdev = pci_get_pdev(NULL, PCI_SBDF(seg, bus, devfn & ~(8 - stride)));
+ sbdf.devfn &= ~stride;
+ pdev = pci_get_pdev(NULL, sbdf);
if ( pdev && stride != pdev->phantom_stride )
pdev = NULL;
}
@@ -1074,7 +1072,7 @@ void pci_check_disable_device(u16 seg, u8 bus, u8 devfn)
u16 cword;
pcidevs_lock();
- pdev = pci_get_real_pdev(seg, bus, devfn);
+ pdev = pci_get_real_pdev(PCI_SBDF(seg, bus, devfn));
if ( pdev )
{
if ( now < pdev->fault.time ||
diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h
index 30fead8f7e..5975ca2f30 100644
--- a/xen/include/xen/pci.h
+++ b/xen/include/xen/pci.h
@@ -178,7 +178,7 @@ int pci_remove_device(u16 seg, u8 bus, u8 devfn);
int pci_ro_device(int seg, int bus, int devfn);
int pci_hide_device(unsigned int seg, unsigned int bus, unsigned int devfn);
struct pci_dev *pci_get_pdev(const struct domain *d, pci_sbdf_t sbdf);
-struct pci_dev *pci_get_real_pdev(int seg, int bus, int devfn);
+struct pci_dev *pci_get_real_pdev(pci_sbdf_t sbdf);
void pci_check_disable_device(u16 seg, u8 bus, u8 devfn);
uint8_t pci_conf_read8(pci_sbdf_t sbdf, unsigned int reg);
--
generated by git-patchbot for /home/xen/git/xen.git#master
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |