Skip to content

Commit d2cfbcd

Browse files
Gavin Shanmpe
authored andcommitted
powerpc/powernv: Drop config requests in EEH accessors
It's bad idea to access the PCI config registers of the adapters, which is experiencing reset. It leads to recursive EEH error without exception. The patch drops PCI config requests in EEH accessors if the PE has been marked to accept PCI config requests, for example during PE reseet time. Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
1 parent 8a6b371 commit d2cfbcd

1 file changed

Lines changed: 35 additions & 2 deletions

File tree

‎arch/powerpc/platforms/powernv/eeh-powernv.c‎

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,39 @@ static int powernv_eeh_err_inject(struct eeh_pe *pe, int type, int func,
383383
return ret;
384384
}
385385

386+
static inline bool powernv_eeh_cfg_blocked(struct device_node *dn)
387+
{
388+
struct eeh_dev *edev = of_node_to_eeh_dev(dn);
389+
390+
if (!edev || !edev->pe)
391+
return false;
392+
393+
if (edev->pe->state & EEH_PE_CFG_BLOCKED)
394+
return true;
395+
396+
return false;
397+
}
398+
399+
static int powernv_eeh_read_config(struct device_node *dn,
400+
int where, int size, u32 *val)
401+
{
402+
if (powernv_eeh_cfg_blocked(dn)) {
403+
*val = 0xFFFFFFFF;
404+
return PCIBIOS_SET_FAILED;
405+
}
406+
407+
return pnv_pci_cfg_read(dn, where, size, val);
408+
}
409+
410+
static int powernv_eeh_write_config(struct device_node *dn,
411+
int where, int size, u32 val)
412+
{
413+
if (powernv_eeh_cfg_blocked(dn))
414+
return PCIBIOS_SET_FAILED;
415+
416+
return pnv_pci_cfg_write(dn, where, size, val);
417+
}
418+
386419
/**
387420
* powernv_eeh_next_error - Retrieve next EEH error to handle
388421
* @pe: Affected PE
@@ -440,8 +473,8 @@ static struct eeh_ops powernv_eeh_ops = {
440473
.get_log = powernv_eeh_get_log,
441474
.configure_bridge = powernv_eeh_configure_bridge,
442475
.err_inject = powernv_eeh_err_inject,
443-
.read_config = pnv_pci_cfg_read,
444-
.write_config = pnv_pci_cfg_write,
476+
.read_config = powernv_eeh_read_config,
477+
.write_config = powernv_eeh_write_config,
445478
.next_error = powernv_eeh_next_error,
446479
.restore_config = powernv_eeh_restore_config
447480
};

0 commit comments

Comments
 (0)