powerpc/pseries: Stop using pdn->pe_number
authorOliver O'Halloran <oohall@gmail.com>
Sat, 25 Jul 2020 08:12:21 +0000 (18:12 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Sun, 26 Jul 2020 13:34:20 +0000 (23:34 +1000)
The pci_dn->pe_number field is mainly used to track the IODA PE number of a
device on PowerNV. At some point it grew a user in the pseries SR-IOV
support which muddies the waters a bit, so remove it.

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-4-oohall@gmail.com
arch/powerpc/platforms/pseries/eeh_pseries.c

index 47760fb..a82057b 100644 (file)
@@ -53,8 +53,6 @@ void pseries_pcibios_bus_add_device(struct pci_dev *pdev)
        dev_dbg(&pdev->dev, "EEH: Setting up device\n");
 #ifdef CONFIG_PCI_IOV
        if (pdev->is_virtfn) {
-               struct pci_dn *physfn_pdn;
-
                pdn->device_id  =  pdev->device;
                pdn->vendor_id  =  pdev->vendor;
                pdn->class_code =  pdev->class;
@@ -64,8 +62,6 @@ void pseries_pcibios_bus_add_device(struct pci_dev *pdev)
                 * completion from platform.
                 */
                pdn->last_allow_rc =  0;
-               physfn_pdn      =  pci_get_pdn(pdev->physfn);
-               pdn->pe_number  =  physfn_pdn->pe_num_map[pdn->vf_index];
        }
 #endif
        pseries_eeh_init_edev(pdn);
@@ -878,8 +874,8 @@ int pseries_send_allow_unfreeze(struct pci_dn *pdn,
 
 static int pseries_call_allow_unfreeze(struct eeh_dev *edev)
 {
+       int cur_vfs = 0, rc = 0, vf_index, bus, devfn, vf_pe_num;
        struct pci_dn *pdn, *tmp, *parent, *physfn_pdn;
-       int cur_vfs = 0, rc = 0, vf_index, bus, devfn;
        u16 *vf_pe_array;
 
        vf_pe_array = kzalloc(RTAS_DATA_BUF_SIZE, GFP_KERNEL);
@@ -912,8 +908,10 @@ static int pseries_call_allow_unfreeze(struct eeh_dev *edev)
                        }
                } else {
                        pdn = pci_get_pdn(edev->pdev);
-                       vf_pe_array[0] = cpu_to_be16(pdn->pe_number);
                        physfn_pdn = pci_get_pdn(edev->physfn);
+
+                       vf_pe_num = physfn_pdn->pe_num_map[edev->vf_index];
+                       vf_pe_array[0] = cpu_to_be16(vf_pe_num);
                        rc = pseries_send_allow_unfreeze(physfn_pdn,
                                                         vf_pe_array, 1);
                        pdn->last_allow_rc = rc;