Skip to content

Commit bcfd218

Browse files
zhang-ruiIngo Molnar
authored andcommitted
perf/x86/rapl: Add support for Intel SPR platform
Intel SPR platform uses fixed 16 bit energy unit for DRAM RAPL domain, and fixed 0 bit energy unit for Psys RAPL domain. After this, on SPR platform the energy counters appear in perf list. Signed-off-by: Zhang Rui <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Reviewed-by: Kan Liang <[email protected]> Acked-by: Len Brown <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 74f41ad commit bcfd218

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

arch/x86/events/rapl.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ struct rapl_pmus {
133133
enum rapl_unit_quirk {
134134
RAPL_UNIT_QUIRK_NONE,
135135
RAPL_UNIT_QUIRK_INTEL_HSW,
136+
RAPL_UNIT_QUIRK_INTEL_SPR,
136137
};
137138

138139
struct rapl_model {
@@ -627,6 +628,14 @@ static int rapl_check_hw_unit(struct rapl_model *rm)
627628
case RAPL_UNIT_QUIRK_INTEL_HSW:
628629
rapl_hw_unit[PERF_RAPL_RAM] = 16;
629630
break;
631+
/*
632+
* SPR shares the same DRAM domain energy unit as HSW, plus it
633+
* also has a fixed energy unit for Psys domain.
634+
*/
635+
case RAPL_UNIT_QUIRK_INTEL_SPR:
636+
rapl_hw_unit[PERF_RAPL_RAM] = 16;
637+
rapl_hw_unit[PERF_RAPL_PSYS] = 0;
638+
break;
630639
default:
631640
break;
632641
}
@@ -757,6 +766,16 @@ static struct rapl_model model_skl = {
757766
.rapl_msrs = intel_rapl_msrs,
758767
};
759768

769+
static struct rapl_model model_spr = {
770+
.events = BIT(PERF_RAPL_PP0) |
771+
BIT(PERF_RAPL_PKG) |
772+
BIT(PERF_RAPL_RAM) |
773+
BIT(PERF_RAPL_PSYS),
774+
.unit_quirk = RAPL_UNIT_QUIRK_INTEL_SPR,
775+
.msr_power_unit = MSR_RAPL_POWER_UNIT,
776+
.rapl_msrs = intel_rapl_msrs,
777+
};
778+
760779
static struct rapl_model model_amd_fam17h = {
761780
.events = BIT(PERF_RAPL_PKG),
762781
.msr_power_unit = MSR_AMD_RAPL_POWER_UNIT,
@@ -793,6 +812,7 @@ static const struct x86_cpu_id rapl_model_match[] __initconst = {
793812
X86_MATCH_INTEL_FAM6_MODEL(ICELAKE_X, &model_hsx),
794813
X86_MATCH_INTEL_FAM6_MODEL(COMETLAKE_L, &model_skl),
795814
X86_MATCH_INTEL_FAM6_MODEL(COMETLAKE, &model_skl),
815+
X86_MATCH_INTEL_FAM6_MODEL(SAPPHIRERAPIDS_X, &model_spr),
796816
X86_MATCH_VENDOR_FAM(AMD, 0x17, &model_amd_fam17h),
797817
X86_MATCH_VENDOR_FAM(HYGON, 0x18, &model_amd_fam17h),
798818
{},

0 commit comments

Comments
 (0)