]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
firmware: psci: Fix bind_smccc_features psci check
authorWeizhao Ouyang <o451686892@gmail.com>
Mon, 4 Mar 2024 14:42:40 +0000 (14:42 +0000)
committerTom Rini <trini@konsulko.com>
Wed, 13 Mar 2024 16:40:43 +0000 (12:40 -0400)
According to PSCI specification DEN0022F, PSCI_FEATURES is used to check
whether the SMCCC is implemented by discovering SMCCC_VERSION.

Signed-off-by: Weizhao Ouyang <o451686892@gmail.com>
drivers/firmware/psci.c
include/linux/arm-smccc.h

index c6b9efab41cd5bf4e866490a1630cacda5e1f8c0..03544d76ed4ad3980b3ce1b6a47ac1d72120d316 100644 (file)
@@ -135,10 +135,13 @@ static int bind_smccc_features(struct udevice *dev, int psci_method)
            PSCI_VERSION_MAJOR(psci_0_2_get_version()) == 0)
                return 0;
 
-       if (request_psci_features(ARM_SMCCC_ARCH_FEATURES) ==
+       if (request_psci_features(ARM_SMCCC_VERSION) ==
            PSCI_RET_NOT_SUPPORTED)
                return 0;
 
+       if (invoke_psci_fn(ARM_SMCCC_VERSION, 0, 0, 0) < ARM_SMCCC_VERSION_1_1)
+               return 0;
+
        if (psci_method == PSCI_METHOD_HVC)
                pdata->invoke_fn = smccc_invoke_hvc;
        else
index f44e9e8f930da6ba4110fc4a5b0ce4ed9f984a21..da3d29aabee6d6bb3053dde91af4aa20738fadda 100644 (file)
 #define ARM_SMCCC_QUIRK_NONE           0
 #define ARM_SMCCC_QUIRK_QCOM_A6                1 /* Save/restore register a6 */
 
+#define ARM_SMCCC_VERSION              0x80000000
 #define ARM_SMCCC_ARCH_FEATURES                0x80000001
 
+#define ARM_SMCCC_VERSION_1_0          0x10000
+#define ARM_SMCCC_VERSION_1_1          0x10001
+#define ARM_SMCCC_VERSION_1_2          0x10002
+#define ARM_SMCCC_VERSION_1_3          0x10003
+
 #define ARM_SMCCC_RET_NOT_SUPPORTED    ((unsigned long)-1)
 
 #ifndef __ASSEMBLY__