powerpc/eeh: Move vf_index out of pci_dn and into eeh_dev
Drivers that do not support the PCI error handling callbacks are handled by tearing down the device and re-probing them. If the device being removed is a virtual function then we need to know the VF index so it can be removed using the pci_iov_{add|remove}_virtfn() API. Currently this is handled by looking up the pci_dn, and using the vf_index that was stashed there when the pci_dn for the VF was created in pcibios_sriov_enable(). We would like to eliminate the use of pci_dn outside of pseries though so we need to provide the generic EEH code with some other way to find the vf_index. The easiest thing to do here is move the vf_index field out of pci_dn and into eeh_dev. Currently pci_dn and eeh_dev are allocated and initialized together so this is a fairly minimal change in preparation for splitting pci_dn and eeh_dev in the future. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20200725081231.39076-3-oohall@gmail.com
This commit is contained in:

committed by
Michael Ellerman

parent
d74ee8e9d1
commit
dffa91539e
@@ -146,7 +146,6 @@ static struct eeh_dev *eeh_dev_init(struct pci_dn *pdn)
|
||||
|
||||
#ifdef CONFIG_PCI_IOV
|
||||
static struct pci_dn *add_one_sriov_vf_pdn(struct pci_dn *parent,
|
||||
int vf_index,
|
||||
int busno, int devfn)
|
||||
{
|
||||
struct pci_dn *pdn;
|
||||
@@ -163,7 +162,6 @@ static struct pci_dn *add_one_sriov_vf_pdn(struct pci_dn *parent,
|
||||
pdn->parent = parent;
|
||||
pdn->busno = busno;
|
||||
pdn->devfn = devfn;
|
||||
pdn->vf_index = vf_index;
|
||||
pdn->pe_number = IODA_INVALID_PE;
|
||||
INIT_LIST_HEAD(&pdn->child_list);
|
||||
INIT_LIST_HEAD(&pdn->list);
|
||||
@@ -194,7 +192,7 @@ struct pci_dn *add_sriov_vf_pdns(struct pci_dev *pdev)
|
||||
for (i = 0; i < pci_sriov_get_totalvfs(pdev); i++) {
|
||||
struct eeh_dev *edev __maybe_unused;
|
||||
|
||||
pdn = add_one_sriov_vf_pdn(parent, i,
|
||||
pdn = add_one_sriov_vf_pdn(parent,
|
||||
pci_iov_virtfn_bus(pdev, i),
|
||||
pci_iov_virtfn_devfn(pdev, i));
|
||||
if (!pdn) {
|
||||
@@ -207,7 +205,10 @@ struct pci_dn *add_sriov_vf_pdns(struct pci_dev *pdev)
|
||||
/* Create the EEH device for the VF */
|
||||
edev = eeh_dev_init(pdn);
|
||||
BUG_ON(!edev);
|
||||
|
||||
/* FIXME: these should probably be populated by the EEH probe */
|
||||
edev->physfn = pdev;
|
||||
edev->vf_index = i;
|
||||
#endif /* CONFIG_EEH */
|
||||
}
|
||||
return pci_get_pdn(pdev);
|
||||
|
Reference in New Issue
Block a user