From 29eacfa4d9e0588f3df4476414f429f7c9b21ffa Mon Sep 17 00:00:00 2001 From: Liao Xuan Date: Tue, 27 Jan 2026 16:51:57 +0800 Subject: [PATCH] perf/x86/uncore: Add DF PMU support for Hygon family 18h model 18h commit dbab1265fda0034466e3d7b1d7c4e1877fbf84d2 anolis. ANBZ: #30150 Adjust the DF PMU event and umask for Hygon family 18h model 18h processor. Hygon-SIG: commit none hygon anolis: perf/x86/uncore: Add DF PMU support for Hygon family 18h model 18h Hygon-SIG: commit dbab1265fda0 anolis anolis: perf/x86/uncore: Add DF PMU support for Hygon family 18h model 18h Backport from anolis to support Hygon family 18h model 18h Signed-off-by: Liao Xuan Reviewed-by Guixin Liu Link: https://gitee.com/anolis/cloud-kernel/pulls/6464 [ YuntongJin: amend commit log, add support in amd_uncore_event_init ] Signed-off-by: YuntongJin --- arch/x86/events/amd/uncore.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/arch/x86/events/amd/uncore.c b/arch/x86/events/amd/uncore.c index 2d7840ea0743..7804fade31c2 100644 --- a/arch/x86/events/amd/uncore.c +++ b/arch/x86/events/amd/uncore.c @@ -242,10 +242,8 @@ static int amd_uncore_event_init(struct perf_event *event) if (boot_cpu_data.x86_model == 0x4 || boot_cpu_data.x86_model == 0x5) event_mask = HYGON_F18H_M4H_RAW_EVENT_MASK_NB; - if (boot_cpu_data.x86_model == 0x6 || - boot_cpu_data.x86_model == 0x7 || - boot_cpu_data.x86_model == 0x8 || - boot_cpu_data.x86_model == 0x10) + if (boot_cpu_data.x86_model >= 0x6 && + boot_cpu_data.x86_model <= 0x18) event_mask = HYGON_F18H_M6H_RAW_EVENT_MASK_NB; } if (pmu_version >= 2 && is_nb_event(event)) @@ -742,10 +740,8 @@ static int __init amd_uncore_init(void) if (boot_cpu_data.x86_model == 0x4 || boot_cpu_data.x86_model == 0x5) *df_attr++ = &format_attr_umask10f18h.attr; - else if (boot_cpu_data.x86_model == 0x6 || - boot_cpu_data.x86_model == 0x7 || - boot_cpu_data.x86_model == 0x8 || - boot_cpu_data.x86_model == 0x10) + else if (boot_cpu_data.x86_model >= 0x6 && + boot_cpu_data.x86_model <= 0x18) *df_attr++ = &format_attr_umask12f18h.attr; } -- Gitee