Skip to content

Commit 6f7f984

Browse files
Kan LiangIngo Molnar
authored andcommitted
perf/x86/uncore: Correct the number of CHAs on EMR
Starting from SPR, the basic uncore PMON information is retrieved from the discovery table (resides in an MMIO space populated by BIOS). It is called the discovery method. The existing value of the type->num_boxes is from the discovery table. On some SPR variants, there is a firmware bug that makes the value from the discovery table incorrect. We use the value from the SPR_MSR_UNC_CBO_CONFIG MSR to replace the one from the discovery table: 38776cc ("perf/x86/uncore: Correct the number of CHAs on SPR") Unfortunately, the SPR_MSR_UNC_CBO_CONFIG isn't available for the EMR XCC (Always returns 0), but the above firmware bug doesn't impact the EMR XCC. Don't let the value from the MSR replace the existing value from the discovery table. Fixes: 38776cc ("perf/x86/uncore: Correct the number of CHAs on SPR") Reported-by: Stephane Eranian <[email protected]> Reported-by: Yunying Sun <[email protected]> Signed-off-by: Kan Liang <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Tested-by: Yunying Sun <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 4accdb9 commit 6f7f984

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

arch/x86/events/intel/uncore_snbep.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6474,8 +6474,18 @@ void spr_uncore_cpu_init(void)
64746474

64756475
type = uncore_find_type_by_id(uncore_msr_uncores, UNCORE_SPR_CHA);
64766476
if (type) {
6477+
/*
6478+
* The value from the discovery table (stored in the type->num_boxes
6479+
* of UNCORE_SPR_CHA) is incorrect on some SPR variants because of a
6480+
* firmware bug. Using the value from SPR_MSR_UNC_CBO_CONFIG to replace it.
6481+
*/
64776482
rdmsrl(SPR_MSR_UNC_CBO_CONFIG, num_cbo);
6478-
type->num_boxes = num_cbo;
6483+
/*
6484+
* The MSR doesn't work on the EMR XCC, but the firmware bug doesn't impact
6485+
* the EMR XCC. Don't let the value from the MSR replace the existing value.
6486+
*/
6487+
if (num_cbo)
6488+
type->num_boxes = num_cbo;
64796489
}
64806490
spr_uncore_iio_free_running.num_boxes = uncore_type_max_boxes(uncore_msr_uncores, UNCORE_SPR_IIO);
64816491
}

0 commit comments

Comments
 (0)