powerpc/eeh: Disable automatically blocked PCI config
Subsystems (2)
PATCH 1/1 powerpc/eeh: Disable automatically blocked PCI config
pcibios_set_pcie_reset_state() could be called to complete reset request when passing through PCI device, flag EEH_PE_ISOLATED is set before saving the PCI config sapce. On some Broadcom adapters, EEH_PE_CFG_BLOCKED is automatically set when the flag EEH_PE_ISOLATED is marked. It caused bogus data saved from the PCI config space, which will be restored to the PCI adapter after the reset. Eventually, the hardware can't work with corrupted data in PCI config space.
The patch fixes the issue with eeh_pe_state_mark_no_cfg(), which doesn't set EEH_PE_CFG_BLOCKED when seeing EEH_PE_ISOLATED on the PE, in order to avoid the bogus data saved and restored to the PCI config space.
--- arch/powerpc/include/asm/ppc-pci.h | 1 + arch/powerpc/kernel/eeh.c | 4 ++-- arch/powerpc/kernel/eeh_pe.c | 22 ++++++++++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-)
arch/powerpc/include/asm/ppc-pci.h +1 -0
@@ -61,6 +61,7 @@ int rtas_write_config(struct pci_dn *, int where, int size, u32 val);int rtas_read_config (struct pci_dn *,int where,int size,u32 *val);void eeh_pe_state_mark (struct eeh_pe *pe,int state);void eeh_pe_state_clear (struct eeh_pe *pe,int state); +void eeh_pe_state_mark_with_cfg (struct eeh_pe *pe,int state);void eeh_pe_dev_mode_mark (struct eeh_pe *pe,int mode);void eeh_sysfs_add_device (struct pci_dev *pdev);
arch/powerpc/kernel/eeh.c +2 -2
@@ -750,14 +750,14 @@ int pcibios_set_pcie_reset_state(struct pci_dev *dev, enum pcie_reset_state stateeh_pe_state_clear (pe,EEH_PE_ISOLATED );break ;case pcie_hot_reset: -eeh_pe_state_mark (pe,EEH_PE_ISOLATED ); +eeh_pe_state_mark_with_cfg (pe,EEH_PE_ISOLATED ); eeh_ops->set_option (pe,EEH_OPT_FREEZE_PE );eeh_pe_dev_traverse (pe, eeh_disable_and_save_dev_state, dev);eeh_pe_state_mark (pe,EEH_PE_CFG_BLOCKED ); eeh_ops->reset (pe,EEH_RESET_HOT );break ;case pcie_warm_reset: -eeh_pe_state_mark (pe,EEH_PE_ISOLATED ); +eeh_pe_state_mark_with_cfg (pe,EEH_PE_ISOLATED ); eeh_ops->set_option (pe,EEH_OPT_FREEZE_PE );eeh_pe_dev_traverse (pe, eeh_disable_and_save_dev_state, dev);eeh_pe_state_mark (pe,EEH_PE_CFG_BLOCKED );
arch/powerpc/kernel/eeh_pe.c +22 -0
@@ -657,6 +657,28 @@ void eeh_pe_state_clear(struct eeh_pe *pe, int state)eeh_pe_traverse (pe, __eeh_pe_state_clear, &state); } +/** +* eeh_pe_state_mark_with_cfg - Mark PE state with unblocked config space +* @pe: PE +* @state: PE state to be set +* +* Set specified flag to PE and its child PEs. The PCI config space +* of some PEs is blocked automatically when EEH_PE_ISOLATED is set, +* which isn't needed in some situations. The function allows to set +* the specified flag to indicated PEs without blocking their PCI +* config space. +*/ +void eeh_pe_state_mark_with_cfg (struct eeh_pe *pe,int state) +{ +eeh_pe_traverse (pe, __eeh_pe_state_mark, &state); +if (!(state &EEH_PE_ISOLATED )) +return ; + +/* Clear EEH_PE_CFG_BLOCKED, which might be set just now */ + state =EEH_PE_CFG_BLOCKED ; +eeh_pe_traverse (pe, __eeh_pe_state_clear, &state); +} +/* * Some PCI bridges (e.g. PLX bridges) have primary/secondary * buses assigned explicitly by firmware, and we probably have
Signature · 1 line
2.1.0
Quoted 9 lines · Gavin Shan
pcibios_set_pcie_reset_state()could be called to complete reset request when passing through PCI device, flagEEH_PE_ISOLATEDis set before saving the PCI config sapce. On some Broadcom adapters,EEH_PE_CFG_BLOCKEDis automatically set when the flagEEH_PE_ISOLATEDis marked. It caused bogus data saved from the PCI config space, which will be restored to the PCI adapter after the reset. Eventually, the hardware can't work with corrupted data in PCI config space.
Quoted 7 lines
The patch fixes the issue with
eeh_pe_state_mark_no_cfg(), which doesn't setEEH_PE_CFG_BLOCKEDwhen seeingEEH_PE_ISOLATEDon the PE, in order to avoid the bogus data saved and restored to the PCI config space.Reported-by Rajanikanth H. Adaveeshaiah <[email protected]>Signed-off-by Gavin Shan <[email protected]>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/39bfd715b4837433a86c
cheers