Skip to content

Commit 2cb6880

Browse files
kvaneeshgregkh
authored andcommitted
powerpc/book3s64/pkeys: Use PVR check instead of cpu feature
[ Upstream commit d79e7a5 ] We are wrongly using CPU_FTRS_POWER8 to check for P8 support. Instead, we should use PVR value. Now considering we are using CPU_FTRS_POWER8, that implies we returned true for P9 with older firmware. Keep the same behavior by checking for P9 PVR value. Fixes: cf43d3b ("powerpc: Enable pkey subsystem") Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20200709032946.881753-2-aneesh.kumar@linux.ibm.com Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 35903b8 commit 2cb6880

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

arch/powerpc/mm/pkeys.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,17 @@ int pkey_initialize(void)
8181
scan_pkey_feature();
8282

8383
/*
84-
* Let's assume 32 pkeys on P8 bare metal, if its not defined by device
85-
* tree. We make this exception since skiboot forgot to expose this
86-
* property on power8.
84+
* Let's assume 32 pkeys on P8/P9 bare metal, if its not defined by device
85+
* tree. We make this exception since some version of skiboot forgot to
86+
* expose this property on power8/9.
8787
*/
88-
if (!pkeys_devtree_defined && !firmware_has_feature(FW_FEATURE_LPAR) &&
89-
cpu_has_feature(CPU_FTRS_POWER8))
90-
pkeys_total = 32;
88+
if (!pkeys_devtree_defined && !firmware_has_feature(FW_FEATURE_LPAR)) {
89+
unsigned long pvr = mfspr(SPRN_PVR);
90+
91+
if (PVR_VER(pvr) == PVR_POWER8 || PVR_VER(pvr) == PVR_POWER8E ||
92+
PVR_VER(pvr) == PVR_POWER8NVL || PVR_VER(pvr) == PVR_POWER9)
93+
pkeys_total = 32;
94+
}
9195

9296
/*
9397
* Adjust the upper limit, based on the number of bits supported by

0 commit comments

Comments
 (0)