From cfecc3960c00ea9a9871c2358d8710c5d2c6539b Mon Sep 17 00:00:00 2001 From: Benjamin Herrenschmidt Date: Tue, 21 Aug 2018 14:27:14 +1000 Subject: phb4: Don't try to access non-existent PEST entries In a POWER9 chip, some PHB4s have 256 PEs, some have 512. Currently, the diagnostics code retrieves 512 unconditionally, which is wrong and causes us to incorrectly report bogus values for the "high" PEs on the small PHBs. Use the actual number of implemented PEs instead Signed-off-by: Benjamin Herrenschmidt Signed-off-by: Stewart Smith --- hw/phb4.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'hw/phb4.c') diff --git a/hw/phb4.c b/hw/phb4.c index d1245dce..01efd14a 100644 --- a/hw/phb4.c +++ b/hw/phb4.c @@ -1921,13 +1921,13 @@ static void phb4_read_phb_status(struct phb4 *p, */ pPEST = (uint64_t *)p->tbl_pest; phb4_ioda_sel(p, IODA3_TBL_PESTA, 0, true); - for (i = 0; i < OPAL_PHB4_NUM_PEST_REGS; i++) { + for (i = 0; i < p->max_num_pes; i++) { stat->pestA[i] = phb4_read_reg_asb(p, PHB_IODA_DATA0); stat->pestA[i] |= pPEST[2 * i]; } phb4_ioda_sel(p, IODA3_TBL_PESTB, 0, true); - for (i = 0; i < OPAL_PHB4_NUM_PEST_REGS; i++) { + for (i = 0; i < p->max_num_pes; i++) { stat->pestB[i] = phb4_read_reg_asb(p, PHB_IODA_DATA0); stat->pestB[i] |= pPEST[2 * i + 1]; } @@ -2141,7 +2141,7 @@ static void phb4_eeh_dump_regs(struct phb4 *p) PHBERR(p, " phbRegbErrorLog0 = %016llx\n", s->phbRegbErrorLog0); PHBERR(p, " phbRegbErrorLog1 = %016llx\n", s->phbRegbErrorLog1); - for (i = 0; i < OPAL_PHB4_NUM_PEST_REGS; i++) { + for (i = 0; i < p->max_num_pes; i++) { if (!s->pestA[i] && !s->pestB[i]) continue; PHBERR(p, " PEST[%03x] = %016llx %016llx\n", -- cgit v1.2.1