Skip to content

Commit c35ae17

Browse files
shangwozbenh
authored andcommitted
powerpc/eeh: Don't collect PCI-CFG data on PHB
When the PHB is fenced or dead, it's pointless to collect the data from PCI config space of subordinate PCI devices since it should return 0xFF's. The patch also fixes overwritten buffer while getting PCI config data. Signed-off-by: Gavin Shan <[email protected]> Signed-off-by: Benjamin Herrenschmidt <[email protected]>
1 parent 090b928 commit c35ae17

File tree

1 file changed

+23
-9
lines changed

1 file changed

+23
-9
lines changed

arch/powerpc/kernel/eeh.c

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -232,16 +232,30 @@ void eeh_slot_error_detail(struct eeh_pe *pe, int severity)
232232
{
233233
size_t loglen = 0;
234234
struct eeh_dev *edev;
235+
bool valid_cfg_log = true;
235236

236-
eeh_pci_enable(pe, EEH_OPT_THAW_MMIO);
237-
eeh_ops->configure_bridge(pe);
238-
eeh_pe_restore_bars(pe);
239-
240-
pci_regs_buf[0] = 0;
241-
eeh_pe_for_each_dev(pe, edev) {
242-
loglen += eeh_gather_pci_data(edev, pci_regs_buf,
243-
EEH_PCI_REGS_LOG_LEN);
244-
}
237+
/*
238+
* When the PHB is fenced or dead, it's pointless to collect
239+
* the data from PCI config space because it should return
240+
* 0xFF's. For ER, we still retrieve the data from the PCI
241+
* config space.
242+
*/
243+
if (eeh_probe_mode_dev() &&
244+
(pe->type & EEH_PE_PHB) &&
245+
(pe->state & (EEH_PE_ISOLATED | EEH_PE_PHB_DEAD)))
246+
valid_cfg_log = false;
247+
248+
if (valid_cfg_log) {
249+
eeh_pci_enable(pe, EEH_OPT_THAW_MMIO);
250+
eeh_ops->configure_bridge(pe);
251+
eeh_pe_restore_bars(pe);
252+
253+
pci_regs_buf[0] = 0;
254+
eeh_pe_for_each_dev(pe, edev) {
255+
loglen += eeh_gather_pci_data(edev, pci_regs_buf + loglen,
256+
EEH_PCI_REGS_LOG_LEN - loglen);
257+
}
258+
}
245259

246260
eeh_ops->get_log(pe, severity, pci_regs_buf, loglen);
247261
}

0 commit comments

Comments
 (0)