[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v2 3/3] 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> --- v2: New. --- 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 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 ) --- a/xen/drivers/passthrough/pci.c +++ b/xen/drivers/passthrough/pci.c @@ -576,20 +576,18 @@ int __init pci_ro_device(int seg, int bu 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, u 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 || --- a/xen/include/xen/pci.h +++ b/xen/include/xen/pci.h @@ -178,7 +178,7 @@ int pci_remove_device(u16 seg, u8 bus, u 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);
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |