diff mbox series

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

Message ID 20180821042715.23587-1-benh@kernel.crashing.org
State Accepted
Headers show
Series [1/2] phb4: Don't try to access non-existent PEST entries | expand

Commit Message

Benjamin Herrenschmidt Aug. 21, 2018, 4:27 a.m. UTC
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@kernel.crashing.org>
---
 hw/phb4.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Stewart Smith Sept. 13, 2018, 8:56 a.m. UTC | #1
Benjamin Herrenschmidt <benh@kernel.crashing.org> writes:
> 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@kernel.crashing.org>
> ---
>  hw/phb4.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Series merged to master as of 0a087154ca4f6759ad1e25c0b3933a9e6caeb456
and 6.0.x as of a20833de7e2fa9a044862cbdeb48a564544a84ed
diff mbox series

Patch

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",