[Skiboot] [PATCH 1/2] phb4: Don't try to access non-existent PEST entries

Benjamin Herrenschmidt benh at kernel.crashing.org
Tue Aug 21 14:27:14 AEST 2018


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 <benh at kernel.crashing.org>
---
 hw/phb4.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/phb4.c b/hw/phb4.c
index c329e5a2..8b8668cf 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",
-- 
2.17.1



More information about the Skiboot mailing list