From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Mon, 09 Dec 2024 18:54:12 +0100 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tKhxU-0063fL-03 for lore@lore.pengutronix.de; Mon, 09 Dec 2024 18:54:12 +0100 Received: from localhost ([127.0.0.1] helo=metis.whiteo.stw.pengutronix.de) by metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1tKhxT-0003YS-T3; Mon, 09 Dec 2024 18:54:11 +0100 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tKhxP-0003OS-8p; Mon, 09 Dec 2024 18:54:07 +0100 Received: from dude05.red.stw.pengutronix.de ([2a0a:edc0:0:1101:1d::54]) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tKhxO-002YNm-0t; Mon, 09 Dec 2024 18:54:07 +0100 Received: from localhost ([::1] helo=dude05.red.stw.pengutronix.de) by dude05.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1tKhxO-00AWsj-37; Mon, 09 Dec 2024 18:54:07 +0100 From: Ahmad Fatoum To: distrokit@pengutronix.de Date: Mon, 9 Dec 2024 18:53:58 +0100 Message-Id: <20241209175405.2217481-2-a.fatoum@pengutronix.de> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241209175405.2217481-1-a.fatoum@pengutronix.de> References: <20241209175405.2217481-1-a.fatoum@pengutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [DistroKit] [PATCH 1/8] v8a: tf-a: update v2.10 -> v2.12 X-BeenThere: distrokit@pengutronix.de X-Mailman-Version: 2.1.29 Precedence: list List-Id: DistroKit Mailinglist List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ahmad Fatoum Sender: "DistroKit" X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: distrokit-bounces@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false Let's update to the TF-A v2.12, the most recent release, which was tagged three weeks ago. Unfortunately, this release broke i.MX8MQ build, but there's already patches to address this breakage, which are imported here from: https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/33413 Signed-off-by: Ahmad Fatoum --- ...mq-fix-imx8mq-build-break-due-to-hab.patch | 83 +++++++++++++++++ ...002-fix-imx8m-fix-imx8mq-build-break.patch | 93 +++++++++++++++++++ .../platform-v8a/patches/tf-a-v2.12/series | 2 + configs/platform-v8a/platformconfig | 4 +- 4 files changed, 180 insertions(+), 2 deletions(-) create mode 100644 configs/platform-v8a/patches/tf-a-v2.12/0001-fix-imx8mq-fix-imx8mq-build-break-due-to-hab.patch create mode 100644 configs/platform-v8a/patches/tf-a-v2.12/0002-fix-imx8m-fix-imx8mq-build-break.patch create mode 100644 configs/platform-v8a/patches/tf-a-v2.12/series diff --git a/configs/platform-v8a/patches/tf-a-v2.12/0001-fix-imx8mq-fix-imx8mq-build-break-due-to-hab.patch b/configs/platform-v8a/patches/tf-a-v2.12/0001-fix-imx8mq-fix-imx8mq-build-break-due-to-hab.patch new file mode 100644 index 000000000000..1c538180f8b2 --- /dev/null +++ b/configs/platform-v8a/patches/tf-a-v2.12/0001-fix-imx8mq-fix-imx8mq-build-break-due-to-hab.patch @@ -0,0 +1,83 @@ +From 3a36f70ba02e88ed20083c1278a739c6c870aae0 Mon Sep 17 00:00:00 2001 +From: Jacky Bai +Date: Tue, 14 Jan 2020 16:05:59 +0800 +Subject: [PATCH 1/2] fix(imx8mq): fix imx8mq build break due to hab + +Add the HAB secure boot support for the i.MX8MQ to +fix the build break. + +Signed-off-by: Jacky Bai +Change-Id: I806de2dc42806e008355cc185065e774570362f0 +--- + plat/imx/common/include/imx_sip_svc.h | 2 ++ + plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c | 2 ++ + plat/imx/imx8m/imx8mq/include/platform_def.h | 7 +++++-- + plat/imx/imx8m/imx8mq/platform.mk | 1 + + 4 files changed, 10 insertions(+), 2 deletions(-) + +diff --git a/plat/imx/common/include/imx_sip_svc.h b/plat/imx/common/include/imx_sip_svc.h +index 404a8295938e..ecb43c3673c5 100644 +--- a/plat/imx/common/include/imx_sip_svc.h ++++ b/plat/imx/common/include/imx_sip_svc.h +@@ -72,6 +72,8 @@ static inline int dram_dvfs_handler(uint32_t smc_fid, void *handle, + SMC_RET1(handle, SMC_UNK); + } + #endif ++int imx_hab_handler(uint32_t smc_fid, u_register_t x1, ++ u_register_t x2, u_register_t x3, u_register_t x4); + #endif + #if defined(PLAT_imx8mm) || defined(PLAT_imx8mn) || defined(PLAT_imx8mp) + int dram_dvfs_handler(uint32_t smc_fid, void *handle, +diff --git a/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c b/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c +index 70c2def7d18b..735f5dba4fac 100644 +--- a/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c ++++ b/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c +@@ -52,6 +52,8 @@ static const mmap_region_t imx_mmap[] = { + MAP_REGION_FLAT(IMX_GIC_BASE, IMX_GIC_SIZE, MT_DEVICE | MT_RW), /* GIC map */ + MAP_REGION_FLAT(IMX_DDRPHY_BASE, IMX_DDR_IPS_SIZE, MT_DEVICE | MT_RW), /* DDRMIX map */ + MAP_REGION_FLAT(IMX_DRAM_BASE, IMX_DRAM_SIZE, MT_MEMORY | MT_RW | MT_NS), ++ MAP_REGION_FLAT(IMX_CAAM_RAM_BASE, IMX_CAAM_RAM_SIZE, MT_MEMORY | MT_RW), /* CAMM RAM */ ++ MAP_REGION_FLAT(IMX_NS_OCRAM_BASE, IMX_NS_OCRAM_SIZE, MT_MEMORY | MT_RW), /* NS OCRAM */ + {0}, + }; + +diff --git a/plat/imx/imx8m/imx8mq/include/platform_def.h b/plat/imx/imx8m/imx8mq/include/platform_def.h +index 61c0e8e46e5e..c8289894b804 100644 +--- a/plat/imx/imx8m/imx8mq/include/platform_def.h ++++ b/plat/imx/imx8m/imx8mq/include/platform_def.h +@@ -10,7 +10,7 @@ + #define PLATFORM_LINKER_FORMAT "elf64-littleaarch64" + #define PLATFORM_LINKER_ARCH aarch64 + +-#define PLATFORM_STACK_SIZE 0x800 ++#define PLATFORM_STACK_SIZE 0xb00 + #define CACHE_WRITEBACK_GRANULE 64 + + #define PLAT_PRIMARY_CPU U(0x0) +@@ -93,7 +93,10 @@ + #define IMX_DDR_IPS_SIZE U(0x1800000) + #define IMX_DRAM_BASE U(0x40000000) + #define IMX_DRAM_SIZE U(0xc0000000) +- ++#define IMX_NS_OCRAM_BASE U(0x900000) ++#define IMX_NS_OCRAM_SIZE U(0x20000) ++#define IMX_CAAM_RAM_BASE U(0x100000) ++#define IMX_CAAM_RAM_SIZE U(0x10000) + #define IMX_ROM_BASE U(0x00000000) + #define IMX_ROM_SIZE U(0x20000) + +diff --git a/plat/imx/imx8m/imx8mq/platform.mk b/plat/imx/imx8m/imx8mq/platform.mk +index 73179dd0c13e..d3d213268ce1 100644 +--- a/plat/imx/imx8m/imx8mq/platform.mk ++++ b/plat/imx/imx8m/imx8mq/platform.mk +@@ -29,6 +29,7 @@ BL31_SOURCES += plat/imx/common/imx8_helpers.S \ + plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c \ + plat/imx/imx8m/imx8mq/imx8mq_psci.c \ + plat/imx/imx8m/gpc_common.c \ ++ plat/imx/imx8m/imx_hab.c \ + plat/imx/imx8m/imx_aipstz.c \ + plat/imx/imx8m/imx8m_caam.c \ + plat/imx/imx8m/imx8m_ccm.c \ +-- +2.39.5 + diff --git a/configs/platform-v8a/patches/tf-a-v2.12/0002-fix-imx8m-fix-imx8mq-build-break.patch b/configs/platform-v8a/patches/tf-a-v2.12/0002-fix-imx8m-fix-imx8mq-build-break.patch new file mode 100644 index 000000000000..8cf78cd2e17d --- /dev/null +++ b/configs/platform-v8a/patches/tf-a-v2.12/0002-fix-imx8m-fix-imx8mq-build-break.patch @@ -0,0 +1,93 @@ +From 1b65be5943fc4f6a0382d03a4ed7393b383e56a4 Mon Sep 17 00:00:00 2001 +From: Jacky Bai +Date: Thu, 17 Oct 2024 17:56:41 +0800 +Subject: [PATCH 2/2] fix(imx8m): fix imx8mq build break + +Fix the build break for i.MX8MQ to make it boot +with basic function enabled. + +Signed-off-by: Jacky Bai +Change-Id: I2ff7976e3fb7960d6876d26fe0b4a78e51219ae2 +--- + plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c | 6 ++++++ + plat/imx/imx8m/imx8mq/include/platform_def.h | 12 +++++++----- + plat/imx/imx8m/imx8mq/platform.mk | 2 ++ + 3 files changed, 15 insertions(+), 5 deletions(-) + +diff --git a/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c b/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c +index 735f5dba4fac..fdaf9fd22e88 100644 +--- a/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c ++++ b/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c +@@ -209,13 +209,19 @@ void bl31_plat_arch_setup(void) + MT_MEMORY | MT_RW | MT_SECURE), + MAP_REGION_FLAT(BL_CODE_BASE, BL_CODE_END - BL_CODE_BASE, + MT_MEMORY | MT_RO | MT_SECURE), ++#if SEPARATE_NOBITS_REGION ++ MAP_REGION_FLAT(BL_NOBITS_BASE, BL_NOBITS_END - BL_NOBITS_BASE, ++ MT_RW_DATA | MT_SECURE), ++#endif + #if USE_COHERENT_MEM + MAP_REGION_FLAT(BL_COHERENT_RAM_BASE, + BL_COHERENT_RAM_END - BL_COHERENT_RAM_BASE, + MT_DEVICE | MT_RW | MT_SECURE), + #endif ++#if defined(SPD_opteed) || defined(SPD_trusty) + /* Map TEE memory */ + MAP_REGION_FLAT(BL32_BASE, BL32_SIZE, MT_MEMORY | MT_RW), ++#endif + {0}, + }; + +diff --git a/plat/imx/imx8m/imx8mq/include/platform_def.h b/plat/imx/imx8m/imx8mq/include/platform_def.h +index c8289894b804..34bd77e87e60 100644 +--- a/plat/imx/imx8m/imx8mq/include/platform_def.h ++++ b/plat/imx/imx8m/imx8mq/include/platform_def.h +@@ -37,6 +37,12 @@ + #define BL31_SIZE SZ_64K + #define BL31_LIMIT (BL31_BASE + BL31_SIZE) + ++#define OCRAM_S_BASE U(0x180000) ++#define OCRAM_S_SIZE SZ_32K ++#define OCRAM_S_LIMIT (OCRAM_S_BASE + OCRAM_S_SIZE) ++#define BL31_NOBITS_BASE OCRAM_S_BASE ++#define BL31_NOBITS_LIMIT (BL31_NOBITS_BASE + SZ_32K) ++ + /* non-secure uboot base */ + #ifndef PLAT_NS_IMAGE_OFFSET + #define PLAT_NS_IMAGE_OFFSET U(0x40200000) +@@ -54,7 +60,7 @@ + #define MAX_XLAT_TABLES 5 + #define MAX_MMAP_REGIONS 15 + #else +-#define MAX_XLAT_TABLES 4 ++#define MAX_XLAT_TABLES 3 + #define MAX_MMAP_REGIONS 14 + #endif + +@@ -144,10 +150,6 @@ + #define GPR_TZASC_EN BIT(0) + #define GPR_TZASC_EN_LOCK BIT(16) + +-#define OCRAM_S_BASE U(0x00180000) +-#define OCRAM_S_SIZE U(0x8000) +-#define OCRAM_S_LIMIT (OCRAM_S_BASE + OCRAM_S_SIZE) +- + #define COUNTER_FREQUENCY 8333333 /* 25MHz / 3 */ + + #define IMX_WDOG_B_RESET +diff --git a/plat/imx/imx8m/imx8mq/platform.mk b/plat/imx/imx8m/imx8mq/platform.mk +index d3d213268ce1..76fc07107057 100644 +--- a/plat/imx/imx8m/imx8mq/platform.mk ++++ b/plat/imx/imx8m/imx8mq/platform.mk +@@ -64,6 +64,8 @@ ifeq (${IMX_DRAM_RETENTION},1) + BL31_SOURCES += ${IMX_DRAM_SOURCES} + endif + ++SEPARATE_NOBITS_REGION := 1 ++ + ifneq (${PRELOADED_BL33_BASE},) + $(eval $(call add_define_val,PLAT_NS_IMAGE_OFFSET,${PRELOADED_BL33_BASE})) + endif +-- +2.39.5 + diff --git a/configs/platform-v8a/patches/tf-a-v2.12/series b/configs/platform-v8a/patches/tf-a-v2.12/series new file mode 100644 index 000000000000..e9a737739bc2 --- /dev/null +++ b/configs/platform-v8a/patches/tf-a-v2.12/series @@ -0,0 +1,2 @@ +0001-fix-imx8mq-fix-imx8mq-build-break-due-to-hab.patch +0002-fix-imx8m-fix-imx8mq-build-break.patch diff --git a/configs/platform-v8a/platformconfig b/configs/platform-v8a/platformconfig index ee395b075eac..44750400790b 100644 --- a/configs/platform-v8a/platformconfig +++ b/configs/platform-v8a/platformconfig @@ -206,8 +206,8 @@ PTXCONF_BOOTLOADER=y # PTXCONF_HOST_MXS_UTILS is not set PTXCONF_TF_A=y PTXCONF_TF_A_URL="https://github.com/ARM-software/arm-trusted-firmware/archive/refs/tags" -PTXCONF_TF_A_VERSION="v2.10" -PTXCONF_TF_A_MD5="641f42080967e05d687ef2fa9f8f3bc3 179042745d57dc03cb44063d43dc5301" +PTXCONF_TF_A_VERSION="v2.12" +PTXCONF_TF_A_MD5="dea016f3707117c7935a8a26433a1e46" PTXCONF_TF_A_ARCH_STRING="aarch64" PTXCONF_TF_A_ARM_ARCH_MAJOR_8=y PTXCONF_TF_A_ARM_ARCH_MAJOR=8 -- 2.39.5