]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
LoongArch: Refine the init_hw_perf_events() function
authorTiezhu Yang <yangtiezhu@loongson.cn>
Sun, 9 Nov 2025 08:02:01 +0000 (16:02 +0800)
committerHuacai Chen <chenhuacai@loongson.cn>
Mon, 10 Nov 2025 00:37:06 +0000 (08:37 +0800)
commit4c8a7c9827726f6e987b7a04af8ef58f1c7fe8d3
tree8d5a30b8fcc4f225c1a187f15d841ad51fa06c01
parent17f838512ae50203ae2e3ce9b9f2689cc67beaa3
LoongArch: Refine the init_hw_perf_events() function

(1) Use the existing CPUCFG6_PMNUM_SHIFT macro definition instead of
the magic value 4 to get the PMU number.

(2) Detect the value of PMU bits via CPUCFG instruction according to
the ISA manual instead of hard-coded as 64, because the value may be
different for various micro-architectures.

Link: https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html#_cpucfg
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
arch/loongarch/include/asm/loongarch.h
arch/loongarch/kernel/perf_event.c