提交 608c0d88 编写于 作者: B Bryant G. Ly 提交者: Michael Ellerman

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: NBryant G. Ly <bryantly@linux.vnet.ibm.com>
Signed-off-by: NJuan J. Alvarez <jjalvare@linux.vnet.ibm.com>
Acked-by: NBjorn Helgaas <bhelgaas@google.com>
Acked-by: NRussell Currey <ruscur@russell.cc>
Reviewed-by: NAlexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
上级 dae7253f
...@@ -63,6 +63,7 @@ int pseries_pcibios_sriov_enable(struct pci_dev *pdev, u16 num_vfs) ...@@ -63,6 +63,7 @@ int pseries_pcibios_sriov_enable(struct pci_dev *pdev, u16 num_vfs)
{ {
/* Allocate PCI data */ /* Allocate PCI data */
add_dev_pci_data(pdev); add_dev_pci_data(pdev);
pci_vf_drivers_autoprobe(pdev, false);
return 0; return 0;
} }
...@@ -70,6 +71,7 @@ int pseries_pcibios_sriov_disable(struct pci_dev *pdev) ...@@ -70,6 +71,7 @@ int pseries_pcibios_sriov_disable(struct pci_dev *pdev)
{ {
/* Release PCI data */ /* Release PCI data */
remove_dev_pci_data(pdev); remove_dev_pci_data(pdev);
pci_vf_drivers_autoprobe(pdev, true);
return 0; return 0;
} }
#endif #endif
......
...@@ -635,6 +635,17 @@ void pci_restore_iov_state(struct pci_dev *dev) ...@@ -635,6 +635,17 @@ void pci_restore_iov_state(struct pci_dev *dev)
sriov_restore_state(dev); sriov_restore_state(dev);
} }
/**
* pci_vf_drivers_autoprobe - set PF property drivers_autoprobe for VFs
* @dev: the PCI device
* @auto_probe: set VF drivers auto probe flag
*/
void pci_vf_drivers_autoprobe(struct pci_dev *dev, bool auto_probe)
{
if (dev->is_physfn)
dev->sriov->drivers_autoprobe = auto_probe;
}
/** /**
* pci_iov_bus_range - find bus range used by Virtual Function * pci_iov_bus_range - find bus range used by Virtual Function
* @bus: the PCI bus * @bus: the PCI bus
......
...@@ -1961,6 +1961,7 @@ int pci_vfs_assigned(struct pci_dev *dev); ...@@ -1961,6 +1961,7 @@ int pci_vfs_assigned(struct pci_dev *dev);
int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs); int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs);
int pci_sriov_get_totalvfs(struct pci_dev *dev); int pci_sriov_get_totalvfs(struct pci_dev *dev);
resource_size_t pci_iov_resource_size(struct pci_dev *dev, int resno); resource_size_t pci_iov_resource_size(struct pci_dev *dev, int resno);
void pci_vf_drivers_autoprobe(struct pci_dev *dev, bool probe);
#else #else
static inline int pci_iov_virtfn_bus(struct pci_dev *dev, int id) static inline int pci_iov_virtfn_bus(struct pci_dev *dev, int id)
{ {
...@@ -1988,6 +1989,7 @@ static inline int pci_sriov_get_totalvfs(struct pci_dev *dev) ...@@ -1988,6 +1989,7 @@ static inline int pci_sriov_get_totalvfs(struct pci_dev *dev)
{ return 0; } { return 0; }
static inline resource_size_t pci_iov_resource_size(struct pci_dev *dev, int resno) static inline resource_size_t pci_iov_resource_size(struct pci_dev *dev, int resno)
{ return 0; } { return 0; }
static inline void pci_vf_drivers_autoprobe(struct pci_dev *dev, bool probe) { }
#endif #endif
#if defined(CONFIG_HOTPLUG_PCI) || defined(CONFIG_HOTPLUG_PCI_MODULE) #if defined(CONFIG_HOTPLUG_PCI) || defined(CONFIG_HOTPLUG_PCI_MODULE)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册