]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
feat(versal): get the handoff params using IPI
authorVenkatesh Yadav Abbarapu <venkatesh.abbarapu@xilinx.com>
Tue, 12 Jul 2022 03:49:03 +0000 (09:19 +0530)
committerVenkatesh Yadav Abbarapu <venkatesh.abbarapu@xilinx.com>
Tue, 12 Jul 2022 03:52:50 +0000 (09:22 +0530)
Use the IPI command GET_HANDOFF_PARAM to get the TF-A handoff
params, rather than using the PLM's PPU RAM area. With this
approach this resolves the issue when XPPU is enabled.

Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@xilinx.com>
Reviewed-by: Michal Simek <michal.simek@amd.com>
Change-Id: I6828c391ad696d2d36e994684aa21b023711ba2d

plat/xilinx/common/include/plat_startup.h
plat/xilinx/common/plat_startup.c
plat/xilinx/versal/bl31_versal_setup.c
plat/xilinx/versal/pm_service/pm_defs.h

index 1e7ea544936c229c18f49882a4d49acc093ec06e..5ccb774f96737be448a0ea23b6a02644e82ea7e8 100644 (file)
@@ -30,6 +30,8 @@ struct xfsbl_atf_handoff_params {
        struct xfsbl_partition partition[FSBL_MAX_PARTITIONS];
 };
 
+#define ATF_HANDOFF_PARAMS_MAX_SIZE    sizeof(struct xfsbl_atf_handoff_params)
+
 enum fsbl_handoff fsbl_atf_handover(entry_point_info_t *bl32,
                                        entry_point_info_t *bl33,
                                        uint64_t atf_handoff_addr);
index 512126ef26f276af7b04383c50366e2637b13ea1..de9cf4d0166f18f16ea54a28ddbc66d2a9a2274f 100644 (file)
@@ -146,8 +146,6 @@ enum fsbl_handoff fsbl_atf_handover(entry_point_info_t *bl32,
                                        uint64_t atf_handoff_addr)
 {
        const struct xfsbl_atf_handoff_params *ATFHandoffParams;
-       assert((atf_handoff_addr < BL31_BASE) ||
-              (atf_handoff_addr > (uint64_t)&__BL31_END__));
        if (!atf_handoff_addr) {
                WARN("BL31: No ATF handoff structure passed\n");
                return FSBL_HANDOFF_NO_STRUCT;
index 0d0d598def2b3b0ec9924ccaf8d2bec423d1a80d..593cdc48401ea18d86a5df0b88598cfd917cdb8e 100644 (file)
@@ -20,6 +20,9 @@
 #include <versal_def.h>
 #include <plat_private.h>
 #include <plat_startup.h>
+#include <pm_ipi.h>
+#include "pm_client.h"
+#include "pm_api_sys.h"
 
 static entry_point_info_t bl32_image_ep_info;
 static entry_point_info_t bl33_image_ep_info;
@@ -63,6 +66,9 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
                                u_register_t arg2, u_register_t arg3)
 {
        uint64_t atf_handoff_addr;
+       uint32_t payload[PAYLOAD_ARG_CNT], max_size = ATF_HANDOFF_PARAMS_MAX_SIZE;
+       enum pm_ret_status ret_status;
+       uint64_t addr[ATF_HANDOFF_PARAMS_MAX_SIZE];
 
        if (VERSAL_CONSOLE_IS(pl011) || (VERSAL_CONSOLE_IS(pl011_1))) {
                static console_t versal_runtime_console;
@@ -106,7 +112,17 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
        SET_PARAM_HEAD(&bl33_image_ep_info, PARAM_EP, VERSION_1, 0);
        SET_SECURITY_STATE(bl33_image_ep_info.h.attr, NON_SECURE);
 
-       atf_handoff_addr = mmio_read_32(PMC_GLOBAL_GLOB_GEN_STORAGE4);
+       PM_PACK_PAYLOAD4(payload, LOADER_MODULE_ID, 1, PM_LOAD_GET_HANDOFF_PARAMS,
+                       (uintptr_t)addr >> 32U, (uintptr_t)addr, max_size);
+       ret_status = pm_ipi_send_sync(primary_proc, payload, NULL, 0);
+       if (ret_status == PM_RET_SUCCESS) {
+               INFO("BL31: GET_HANDOFF_PARAMS call success=%d\n", ret_status);
+               atf_handoff_addr = (uintptr_t)&addr;
+       } else {
+               ERROR("BL31: GET_HANDOFF_PARAMS Failed, read atf_handoff_addr from reg\n");
+               atf_handoff_addr = mmio_read_32(PMC_GLOBAL_GLOB_GEN_STORAGE4);
+       }
+
        enum fsbl_handoff ret = fsbl_atf_handover(&bl32_image_ep_info,
                                                  &bl33_image_ep_info,
                                                  atf_handoff_addr);
index 92061208b9bf48192c90bc6d5cbcbebc7b4a1e25..549155527ff15851f5e3ec5d8ecde80f4644b63c 100644 (file)
@@ -62,6 +62,7 @@
 
 /* Loader API ids */
 #define PM_LOAD_PDI                    0x701U
+#define PM_LOAD_GET_HANDOFF_PARAMS     0x70BU
 
 /* IOCTL IDs for clock driver */
 #define IOCTL_SET_PLL_FRAC_MODE                8U