Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/perf: Properly detect mpc7450 family

Unlike PVR_POWER8, etc ...., PVR_7450 represents a full PVR
value and not a family value.

To avoid confusion, do like E500 family and define the relevant
PVR_VER_xxxx values for the 7450 family:
0x8000 ==> 7450
0x8001 ==> 7455
0x8002 ==> 7447
0x8003 ==> 7447A
0x8004 ==> 7448

And use them to detect 7450 family for perf events.

Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <error27@gmail.com>
Link: https://lore.kernel.org/r/202302260657.7dM9Uwev-lkp@intel.com/
Fixes: ec3eb9d941a9 ("powerpc/perf: Use PVR rather than oprofile field to determine CPU version")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/99ca1da2e5a6cf82a8abf4bc034918e500e31781.1677513277.git.christophe.leroy@csgroup.eu

authored by

Christophe Leroy and committed by
Michael Ellerman
e7299f96 d3cf1662

+8 -3
+5
arch/powerpc/include/asm/reg.h
··· 1310 1310 #define PVR_VER_E500MC 0x8023 1311 1311 #define PVR_VER_E5500 0x8024 1312 1312 #define PVR_VER_E6500 0x8040 1313 + #define PVR_VER_7450 0x8000 1314 + #define PVR_VER_7455 0x8001 1315 + #define PVR_VER_7447 0x8002 1316 + #define PVR_VER_7447A 0x8003 1317 + #define PVR_VER_7448 0x8004 1313 1318 1314 1319 /* 1315 1320 * For the 8xx processors, all of them report the same PVR family for
+3 -3
arch/powerpc/perf/mpc7450-pmu.c
··· 417 417 418 418 static int __init init_mpc7450_pmu(void) 419 419 { 420 - unsigned int pvr = mfspr(SPRN_PVR); 421 - 422 - if (PVR_VER(pvr) != PVR_7450) 420 + if (!pvr_version_is(PVR_VER_7450) && !pvr_version_is(PVR_VER_7455) && 421 + !pvr_version_is(PVR_VER_7447) && !pvr_version_is(PVR_VER_7447A) && 422 + !pvr_version_is(PVR_VER_7448)) 423 423 return -ENODEV; 424 424 425 425 return register_power_pmu(&mpc7450_pmu);