summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Currey <ruscur@russell.cc>2023-02-22 13:17:08 +1100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-08-03 08:49:53 +0200
commit59063578071aebdf21047461a906980adcc5999d (patch)
tree2fc8c37d935ebf12295001bda2a64a13db0c6e1b
parentdd2c5576c65d2f7c38f31b6533dbe2c0847725f7 (diff)
powerpc/pseries: Avoid hcall in plpks_is_available() on non-pseries
commit f82cdc37c4bd4ba905bf99ade9782a639b5c12e9 upstream. plpks_is_available() can be called on any platform via kexec but calls _plpks_get_config() which makes a hcall, which will only work on pseries. Fix this by returning early in plpks_is_available() if hcalls aren't possible. Fixes: 119da30d037d ("powerpc/pseries: Expose PLPKS config values, support additional fields") Reported-by: Murphy Zhou <jencce.kernel@gmail.com> Signed-off-by: Russell Currey <ruscur@russell.cc> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20230222021708.146257-1-ruscur@russell.cc Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--arch/powerpc/platforms/pseries/plpks.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/pseries/plpks.c b/arch/powerpc/platforms/pseries/plpks.c
index eea251105e39..d1eb6f0433fe 100644
--- a/arch/powerpc/platforms/pseries/plpks.c
+++ b/arch/powerpc/platforms/pseries/plpks.c
@@ -19,6 +19,7 @@
#include <asm/hvcall.h>
#include <asm/machdep.h>
#include <asm/plpks.h>
+#include <asm/firmware.h>
static u8 *ospassword;
static u16 ospasswordlength;
@@ -357,6 +358,9 @@ bool plpks_is_available(void)
{
int rc;
+ if (!firmware_has_feature(FW_FEATURE_LPAR))
+ return false;
+
rc = _plpks_get_config();
if (rc)
return false;