]> Git Repo - linux.git/commitdiff
powerpc/pseries: Avoid hcall in plpks_is_available() on non-pseries
authorRussell Currey <[email protected]>
Wed, 22 Feb 2023 02:17:08 +0000 (13:17 +1100)
committerMichael Ellerman <[email protected]>
Wed, 22 Feb 2023 06:01:46 +0000 (17:01 +1100)
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 <[email protected]>
Signed-off-by: Russell Currey <[email protected]>
Signed-off-by: Michael Ellerman <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
arch/powerpc/platforms/pseries/plpks.c

index cdf09e5bd74121d1ea09ce02f34e12fda203789c..6f7bf3fc3aea46fe475af765d2e21abb989be86c 100644 (file)
@@ -22,6 +22,7 @@
 #include <asm/hvcall.h>
 #include <asm/machdep.h>
 #include <asm/plpks.h>
+#include <asm/firmware.h>
 
 static u8 *ospassword;
 static u16 ospasswordlength;
@@ -377,6 +378,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;
This page took 0.063169 seconds and 4 git commands to generate.