]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
feat(psci): update PSCI_FEATURES
authorWing Li <wingers@google.com>
Wed, 14 Sep 2022 20:18:19 +0000 (13:18 -0700)
committerWing Li <wingers@google.com>
Tue, 21 Mar 2023 05:20:35 +0000 (22:20 -0700)
This patch updates the PSCI_FEATURES handler to indicate support for
OS-initiated mode per section 5.15.2 of the PSCI spec (DEN0022D.b) based
on the value of `FF_SUPPORTS_OS_INIT_MODE`, which is conditionally
enabled by the `PSCI_OS_INIT_MODE` build option.

Change-Id: I5da8a989b53419ad2ab55b73ddeee6e882c25554
Signed-off-by: Wing Li <wingers@google.com>
include/lib/psci/psci.h
lib/psci/psci_main.c

index d4f36707179ff00586dc1ee0cac4440947fd8c34..6d27b7b61a586784248f7a7bb337c70ba85b3fa5 100644 (file)
 
 /* Features flags for CPU SUSPEND OS Initiated mode support. Bits [0:0] */
 #define FF_MODE_SUPPORT_SHIFT          U(0)
+#if PSCI_OS_INIT_MODE
 #define FF_SUPPORTS_OS_INIT_MODE       U(1)
+#else
+#define FF_SUPPORTS_OS_INIT_MODE       U(0)
+#endif
 
 /*******************************************************************************
  * PSCI version
index fe12f06baa1d7e368159c89beed37cae8d73a86e..276c3a59f9822167da2d8d48ae8f699014856086 100644 (file)
@@ -383,13 +383,9 @@ int psci_features(unsigned int psci_fid)
        /* Format the feature flags */
        if ((psci_fid == PSCI_CPU_SUSPEND_AARCH32) ||
            (psci_fid == PSCI_CPU_SUSPEND_AARCH64)) {
-               /*
-                * The trusted firmware does not support OS Initiated Mode.
-                */
                unsigned int ret = ((FF_PSTATE << FF_PSTATE_SHIFT) |
-                       (((FF_SUPPORTS_OS_INIT_MODE == 1U) ? 0U : 1U)
-                               << FF_MODE_SUPPORT_SHIFT));
-               return (int) ret;
+                       (FF_SUPPORTS_OS_INIT_MODE << FF_MODE_SUPPORT_SHIFT));
+               return (int)ret;
        }
 
        /* Return 0 for all other fid's */
@@ -571,6 +567,10 @@ u_register_t psci_smc_handler(uint32_t smc_fid,
                        ret = psci_migrate_info_up_cpu();
                        break;
 
+               case PSCI_FEATURES:
+                       ret = (u_register_t)psci_features(x1);
+                       break;
+
                case PSCI_NODE_HW_STATE_AARCH64:
                        ret = (u_register_t)psci_node_hw_state(
                                        x1, (unsigned int) x2);