[PATCH v4 3/7] platforms/pseries: Set eeh_pe of EEH_PE_VF type
To correctly use EEH code one has to make sure that the EEH_PE_VF is set for dynamic created VFs. Therefore this patch allocates an eeh_pe of eeh type EEH_PE_VF and associates PE with parent. Signed-off-by: Bryant G. Ly Signed-off-by: Juan J. Alvarez --- arch/powerpc/include/asm/pci-bridge.h| 5 - arch/powerpc/platforms/pseries/eeh_pseries.c | 17 + 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h index 9f66ddebb799..16d70740a76f 100644 --- a/arch/powerpc/include/asm/pci-bridge.h +++ b/arch/powerpc/include/asm/pci-bridge.h @@ -211,7 +211,10 @@ struct pci_dn { unsigned int *pe_num_map; /* PE# for the first VF PE or array */ boolm64_single_mode;/* Use M64 BAR in Single Mode */ #define IODA_INVALID_M64(-1) - int (*m64_map)[PCI_SRIOV_NUM_BARS]; + union { + int (*m64_map)[PCI_SRIOV_NUM_BARS]; /*Only used in powernv */ + int last_allow_rc; /* Only used in pSeries */ + }; #endif /* CONFIG_PCI_IOV */ int mps;/* Maximum Payload Size */ struct list_head child_list; diff --git a/arch/powerpc/platforms/pseries/eeh_pseries.c b/arch/powerpc/platforms/pseries/eeh_pseries.c index a671ef4f57f5..ca6bbfd83701 100644 --- a/arch/powerpc/platforms/pseries/eeh_pseries.c +++ b/arch/powerpc/platforms/pseries/eeh_pseries.c @@ -55,9 +55,12 @@ static int ibm_get_config_addr_info; static int ibm_get_config_addr_info2; static int ibm_configure_pe; +#ifdef CONFIG_PCI_IOV void pseries_pcibios_bus_add_device(struct pci_dev *pdev) { struct pci_dn *pdn = pci_get_pdn(pdev); + struct pci_dn *physfn_pdn; + struct eeh_dev *edev; if (!pdev->is_virtfn) return; @@ -65,6 +68,14 @@ void pseries_pcibios_bus_add_device(struct pci_dev *pdev) pdn->device_id = pdev->device; pdn->vendor_id = pdev->vendor; pdn->class_code = pdev->class; + /* Last allow unfreeze return code used for retrieval +* by user space in eeh-sysfs to show the last command +* 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]; + edev = pdn_to_eeh_dev(pdn); /* * The following operations will fail if VF's sysfs files @@ -72,9 +83,13 @@ void pseries_pcibios_bus_add_device(struct pci_dev *pdev) */ eeh_add_device_early(pdn); eeh_add_device_late(pdev); + edev->pe_config_addr = (pdn->busno << 16) | (pdn->devfn << 8); + eeh_rmv_from_parent_pe(edev); /* Remove as it is adding to bus pe */ + eeh_add_to_parent_pe(edev); /* Add as VF PE type */ eeh_sysfs_add_device(pdev); } +#endif /* * Buffer for reporting slot-error-detail rtas calls. Its here @@ -141,8 +156,10 @@ static int pseries_eeh_init(void) /* Set EEH probe mode */ eeh_add_flag(EEH_PROBE_MODE_DEVTREE | EEH_ENABLE_IO_FOR_LOG); +#ifdef CONFIG_PCI_IOV /* Set EEH machine dependent code */ ppc_md.pcibios_bus_add_device = pseries_pcibios_bus_add_device; +#endif return 0; } -- 2.14.3 (Apple Git-98)
Re: [PATCH v4 3/7] platforms/pseries: Set eeh_pe of EEH_PE_VF type
"Bryant G. Ly" writes: > To correctly use EEH code one has to make > sure that the EEH_PE_VF is set for dynamic created > VFs. Therefore this patch allocates an eeh_pe of > eeh type EEH_PE_VF and associates PE with parent. > > Signed-off-by: Bryant G. Ly > Signed-off-by: Juan J. Alvarez > --- > arch/powerpc/include/asm/pci-bridge.h| 5 - > arch/powerpc/platforms/pseries/eeh_pseries.c | 17 + > 2 files changed, 21 insertions(+), 1 deletion(-) > > diff --git a/arch/powerpc/include/asm/pci-bridge.h > b/arch/powerpc/include/asm/pci-bridge.h > index 9f66ddebb799..16d70740a76f 100644 > --- a/arch/powerpc/include/asm/pci-bridge.h > +++ b/arch/powerpc/include/asm/pci-bridge.h > @@ -211,7 +211,10 @@ struct pci_dn { > unsigned int *pe_num_map; /* PE# for the first VF PE or array */ > boolm64_single_mode;/* Use M64 BAR in Single Mode */ > #define IODA_INVALID_M64(-1) > - int (*m64_map)[PCI_SRIOV_NUM_BARS]; > + union { > + int (*m64_map)[PCI_SRIOV_NUM_BARS]; /*Only used in powernv > */ > + int last_allow_rc; /* Only used in pSeries */ > + }; > #endif /* CONFIG_PCI_IOV */ > int mps;/* Maximum Payload Size */ > struct list_head child_list; I don't see the point of using a union to save 4 bytes. And if you look at the current layout of the struct there's actually a 4 byte hole after mps, so it doesn't actually save any space at all. I can remove it before applying, unless there's some compelling reason for it I'm not seeing. cheers
Re: [PATCH v4 3/7] platforms/pseries: Set eeh_pe of EEH_PE_VF type
On 1/23/18 7:14 PM, Michael Ellerman wrote: > "Bryant G. Ly" writes: > >> To correctly use EEH code one has to make >> sure that the EEH_PE_VF is set for dynamic created >> VFs. Therefore this patch allocates an eeh_pe of >> eeh type EEH_PE_VF and associates PE with parent. >> >> Signed-off-by: Bryant G. Ly >> Signed-off-by: Juan J. Alvarez >> --- >> arch/powerpc/include/asm/pci-bridge.h| 5 - >> arch/powerpc/platforms/pseries/eeh_pseries.c | 17 + >> 2 files changed, 21 insertions(+), 1 deletion(-) >> >> diff --git a/arch/powerpc/include/asm/pci-bridge.h >> b/arch/powerpc/include/asm/pci-bridge.h >> index 9f66ddebb799..16d70740a76f 100644 >> --- a/arch/powerpc/include/asm/pci-bridge.h >> +++ b/arch/powerpc/include/asm/pci-bridge.h >> @@ -211,7 +211,10 @@ struct pci_dn { >> unsigned int *pe_num_map; /* PE# for the first VF PE or array */ >> boolm64_single_mode;/* Use M64 BAR in Single Mode */ >> #define IODA_INVALID_M64(-1) >> -int (*m64_map)[PCI_SRIOV_NUM_BARS]; >> +union { >> +int (*m64_map)[PCI_SRIOV_NUM_BARS]; /*Only used in powernv >> */ >> +int last_allow_rc; /* Only used in pSeries */ >> +}; >> #endif /* CONFIG_PCI_IOV */ >> int mps;/* Maximum Payload Size */ >> struct list_head child_list; > I don't see the point of using a union to save 4 bytes. > > And if you look at the current layout of the struct there's actually a 4 > byte hole after mps, so it doesn't actually save any space at all. > > I can remove it before applying, unless there's some compelling reason > for it I'm not seeing. > > cheers No specific reason for the union, you can go ahead and remove it before applying. Thanks! Bryant