Skip to content

Commit

Permalink
powerpc/perf: Properly detect mpc7450 family
Browse files Browse the repository at this point in the history
[ Upstream commit e7299f9 ]

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: ec3eb9d ("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
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
chleroy authored and gregkh committed May 11, 2023
1 parent f7d2f1e commit b3e2cc7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions arch/powerpc/include/asm/reg.h
Original file line number Diff line number Diff line change
Expand Up @@ -1310,6 +1310,11 @@
#define PVR_VER_E500MC 0x8023
#define PVR_VER_E5500 0x8024
#define PVR_VER_E6500 0x8040
#define PVR_VER_7450 0x8000
#define PVR_VER_7455 0x8001
#define PVR_VER_7447 0x8002
#define PVR_VER_7447A 0x8003
#define PVR_VER_7448 0x8004

/*
* For the 8xx processors, all of them report the same PVR family for
Expand Down
6 changes: 3 additions & 3 deletions arch/powerpc/perf/mpc7450-pmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,9 +417,9 @@ struct power_pmu mpc7450_pmu = {

static int __init init_mpc7450_pmu(void)
{
unsigned int pvr = mfspr(SPRN_PVR);

if (PVR_VER(pvr) != PVR_7450)
if (!pvr_version_is(PVR_VER_7450) && !pvr_version_is(PVR_VER_7455) &&
!pvr_version_is(PVR_VER_7447) && !pvr_version_is(PVR_VER_7447A) &&
!pvr_version_is(PVR_VER_7448))
return -ENODEV;

return register_power_pmu(&mpc7450_pmu);
Expand Down

0 comments on commit b3e2cc7

Please sign in to comment.