Skip to content

Commit 608c0d8

Browse files
bglympe
authored andcommitted
PCI/IOV: Add pci_vf_drivers_autoprobe() interface
Add a pci_vf_drivers_autoprobe() interface. Setting autoprobe to false on the PF prevents drivers from binding to VFs when they are enabled. Signed-off-by: Bryant G. Ly <[email protected]> Signed-off-by: Juan J. Alvarez <[email protected]> Acked-by: Bjorn Helgaas <[email protected]> Acked-by: Russell Currey <[email protected]> Reviewed-by: Alexey Kardashevskiy <[email protected]> Signed-off-by: Michael Ellerman <[email protected]>
1 parent dae7253 commit 608c0d8

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

arch/powerpc/platforms/pseries/pci.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,15 @@ int pseries_pcibios_sriov_enable(struct pci_dev *pdev, u16 num_vfs)
6363
{
6464
/* Allocate PCI data */
6565
add_dev_pci_data(pdev);
66+
pci_vf_drivers_autoprobe(pdev, false);
6667
return 0;
6768
}
6869

6970
int pseries_pcibios_sriov_disable(struct pci_dev *pdev)
7071
{
7172
/* Release PCI data */
7273
remove_dev_pci_data(pdev);
74+
pci_vf_drivers_autoprobe(pdev, true);
7375
return 0;
7476
}
7577
#endif

drivers/pci/iov.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,17 @@ void pci_restore_iov_state(struct pci_dev *dev)
635635
sriov_restore_state(dev);
636636
}
637637

638+
/**
639+
* pci_vf_drivers_autoprobe - set PF property drivers_autoprobe for VFs
640+
* @dev: the PCI device
641+
* @auto_probe: set VF drivers auto probe flag
642+
*/
643+
void pci_vf_drivers_autoprobe(struct pci_dev *dev, bool auto_probe)
644+
{
645+
if (dev->is_physfn)
646+
dev->sriov->drivers_autoprobe = auto_probe;
647+
}
648+
638649
/**
639650
* pci_iov_bus_range - find bus range used by Virtual Function
640651
* @bus: the PCI bus

include/linux/pci.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1961,6 +1961,7 @@ int pci_vfs_assigned(struct pci_dev *dev);
19611961
int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs);
19621962
int pci_sriov_get_totalvfs(struct pci_dev *dev);
19631963
resource_size_t pci_iov_resource_size(struct pci_dev *dev, int resno);
1964+
void pci_vf_drivers_autoprobe(struct pci_dev *dev, bool probe);
19641965
#else
19651966
static inline int pci_iov_virtfn_bus(struct pci_dev *dev, int id)
19661967
{
@@ -1988,6 +1989,7 @@ static inline int pci_sriov_get_totalvfs(struct pci_dev *dev)
19881989
{ return 0; }
19891990
static inline resource_size_t pci_iov_resource_size(struct pci_dev *dev, int resno)
19901991
{ return 0; }
1992+
static inline void pci_vf_drivers_autoprobe(struct pci_dev *dev, bool probe) { }
19911993
#endif
19921994

19931995
#if defined(CONFIG_HOTPLUG_PCI) || defined(CONFIG_HOTPLUG_PCI_MODULE)

0 commit comments

Comments
 (0)