diff options
author | Michael Neuling <mikey@neuling.org> | 2017-06-20 19:50:26 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2017-06-21 17:07:20 +1000 |
commit | 23d759f80925d65fd59c16552467c85cc2c5090f (patch) | |
tree | c397cc9db4e5b7ec4df861036dc4238f6d99f1cd /hw | |
parent | c5549e5b397a6805bcb68f2dc58862867b932b69 (diff) | |
download | skiboot-23d759f80925d65fd59c16552467c85cc2c5090f.zip skiboot-23d759f80925d65fd59c16552467c85cc2c5090f.tar.gz skiboot-23d759f80925d65fd59c16552467c85cc2c5090f.tar.bz2 |
phb4: Harden init with bad PHBs
Currently if we read all 1's from the EEH or IRQ capabilities, we end
up train wrecking on some other random code (eg. an assert() in xive).
This hardens the PHB4 code to look for these bad reads and more
gracefully fails the init for that PHB alone. This allows the rest of
the system to boot and ignore those bad PHBs.
Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/phb4.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -3563,6 +3563,10 @@ static bool phb4_read_capabilities(struct phb4 *p) /* Read EEH capabilities */ val = in_be64(p->regs + PHB_PHB4_EEH_CAP); + if (val == 0xffffffffffffffff) { + PHBERR(p, "Failed to read EEH cap, PHB appears broken\n"); + return false; + } p->max_num_pes = val >> 52; if (p->max_num_pes >= 512) { p->mrt_size = 16; @@ -3575,6 +3579,10 @@ static bool phb4_read_capabilities(struct phb4 *p) } val = in_be64(p->regs + PHB_PHB4_IRQ_CAP); + if (val == 0xffffffffffffffff) { + PHBERR(p, "Failed to read IRQ cap, PHB appears broken\n"); + return false; + } p->num_irqs = val & 0xffff; /* This works for 512 PEs. FIXME calculate for any hardware |