diff options
author | Manish V Badarkhe <manish.badarkhe@arm.com> | 2023-09-15 08:44:42 +0200 |
---|---|---|
committer | TrustedFirmware Code Review <review@review.trustedfirmware.org> | 2023-09-15 08:44:42 +0200 |
commit | 44a267b59e3c2055ccd7c5b6da07c511648264e5 (patch) | |
tree | b86e0c6f6d3d4e1d40c1722f35ce15b45a882333 | |
parent | d4635e9998a22847ff4722aa3a7ffe8f5dd33c5b (diff) | |
parent | 93ed138006dc09e5b09222cabae8952dd5363ad2 (diff) |
Merge changes from topic "xlnx_mmap_dynamic_dtb" into integration
* changes:
fix(xilinx): dcache flush for dtb region
fix(xilinx): dynamic mmap region for dtb
-rw-r--r-- | plat/xilinx/common/plat_fdt.c | 24 | ||||
-rw-r--r-- | plat/xilinx/versal/bl31_versal_setup.c | 3 | ||||
-rw-r--r-- | plat/xilinx/versal/platform.mk | 5 |
3 files changed, 30 insertions, 2 deletions
diff --git a/plat/xilinx/common/plat_fdt.c b/plat/xilinx/common/plat_fdt.c index 012aaa676..911f66487 100644 --- a/plat/xilinx/common/plat_fdt.c +++ b/plat/xilinx/common/plat_fdt.c @@ -8,6 +8,7 @@ #include <common/fdt_fixup.h> #include <common/fdt_wrappers.h> #include <libfdt.h> +#include <lib/xlat_tables/xlat_tables_v2.h> #include <plat_fdt.h> #include <platform_def.h> @@ -24,6 +25,17 @@ void prepare_dtb(void) if (IS_TFA_IN_OCM(BL31_BASE)) return; +#if defined(PLAT_XLAT_TABLES_DYNAMIC) + ret = mmap_add_dynamic_region((unsigned long long)dtb, + (uintptr_t)dtb, + XILINX_OF_BOARD_DTB_MAX_SIZE, + MT_MEMORY | MT_RW | MT_NS); + if (ret != 0) { + WARN("Failed to add dynamic region for dtb: error %d\n", ret); + return; + } +#endif + /* Return if no device tree is detected */ if (fdt_check_header(dtb) != 0) { NOTICE("Can't read DT at %p\n", dtb); @@ -48,6 +60,16 @@ void prepare_dtb(void) return; } - clean_dcache_range((uintptr_t)dtb, fdt_blob_size(dtb)); + flush_dcache_range((uintptr_t)dtb, fdt_blob_size(dtb)); + +#if defined(PLAT_XLAT_TABLES_DYNAMIC) + ret = mmap_remove_dynamic_region((uintptr_t)dtb, + XILINX_OF_BOARD_DTB_MAX_SIZE); + if (ret != 0) { + WARN("Failed to remove dynamic region for dtb: error %d\n", ret); + return; + } +#endif + INFO("Changed device tree to advertise PSCI and reserved memories.\n"); } diff --git a/plat/xilinx/versal/bl31_versal_setup.c b/plat/xilinx/versal/bl31_versal_setup.c index 6cb529b3a..c50f06f65 100644 --- a/plat/xilinx/versal/bl31_versal_setup.c +++ b/plat/xilinx/versal/bl31_versal_setup.c @@ -224,7 +224,8 @@ void bl31_plat_arch_setup(void) plat_arm_interconnect_enter_coherency(); const mmap_region_t bl_regions[] = { -#if (defined(XILINX_OF_BOARD_DTB_ADDR) && !IS_TFA_IN_OCM(BL31_BASE)) +#if (defined(XILINX_OF_BOARD_DTB_ADDR) && !IS_TFA_IN_OCM(BL31_BASE) && \ + (!defined(PLAT_XLAT_TABLES_DYNAMIC))) MAP_REGION_FLAT(XILINX_OF_BOARD_DTB_ADDR, XILINX_OF_BOARD_DTB_MAX_SIZE, MT_MEMORY | MT_RW | MT_NS), #endif diff --git a/plat/xilinx/versal/platform.mk b/plat/xilinx/versal/platform.mk index c936220e2..a0527134f 100644 --- a/plat/xilinx/versal/platform.mk +++ b/plat/xilinx/versal/platform.mk @@ -49,6 +49,11 @@ ifdef XILINX_OF_BOARD_DTB_ADDR $(eval $(call add_define,XILINX_OF_BOARD_DTB_ADDR)) endif +PLAT_XLAT_TABLES_DYNAMIC := 0 +ifeq (${PLAT_XLAT_TABLES_DYNAMIC},1) +$(eval $(call add_define,PLAT_XLAT_TABLES_DYNAMIC)) +endif + PLAT_INCLUDES := -Iinclude/plat/arm/common/ \ -Iplat/xilinx/common/include/ \ -Iplat/xilinx/common/ipi_mailbox_service/ \ |