From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Fri, 10 Feb 2023 20:36:23 +0100 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pQZC5-003QMC-25 for lore@lore.pengutronix.de; Fri, 10 Feb 2023 20:36:23 +0100 Received: from localhost ([127.0.0.1] helo=metis.ext.pengutronix.de) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1pQZC1-0006A1-Q2; Fri, 10 Feb 2023 20:36:21 +0100 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pQZBw-00062c-Nt for distrokit@pengutronix.de; Fri, 10 Feb 2023 20:36:16 +0100 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1pQZBu-0043er-Qo for distrokit@pengutronix.de; Fri, 10 Feb 2023 20:36:16 +0100 Received: from mfe by dude02.red.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pQZBu-008zkP-Cg for distrokit@pengutronix.de; Fri, 10 Feb 2023 20:36:14 +0100 From: Marco Felsch To: distrokit@pengutronix.de Date: Fri, 10 Feb 2023 20:35:59 +0100 Message-Id: <20230210193612.2143905-2-m.felsch@pengutronix.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230210193612.2143905-1-m.felsch@pengutronix.de> References: <20230210193612.2143905-1-m.felsch@pengutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [DistroKit] [PATCH 01/14] v7a: tf-a: version bump v2.7 -> 2.8/customers/pengutronix/distrokit/20230210-1 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: , 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.ext.pengutronix.de); SAEximRunCond expanded to false Do mainline version bump v2.7 -> v2.8 Drop upstreamed patch: - 0001-fix-stm32mp1-fdts-stm32mp1-align-DDR-regulators-with.patch Squash patches: - 0003-feat-build-add-support-for-new-binutils-versions.patch - 0004-makefile-link-with-z-noexecstack.patch Added patches: - i.MX8MQ PIE support - i.MX8MQ GCC-12 build fixes Finally make use of umpf [1] for the patchstack management. [1] https://github.com/pengutronix/umpf/pull/10 Signed-off-by: Marco Felsch --- configs/platform-v7a/platformconfig | 4 +- ...s-stm32mp1-align-DDR-regulators-with.patch | 105 ------------------ ...dd-support-for-new-binutils-versions.patch | 38 ------- ...004-makefile-link-with-z-noexecstack.patch | 39 ------- patches/tf-a-v2.7/series | 4 - ...add-helper-to-detect-linker-options.patch} | 8 +- ...dd-support-for-new-binutils-versions.patch | 54 +++++++++ ...-IMX_BOOT_UART_BASE-configurable-via.patch | 41 +++++++ ...remove-empty-bl31_plat_runtime_setup.patch | 30 +++++ ...03-feat-imx8mq-always-set-up-console.patch | 51 +++++++++ ...imx8mq-make-use-of-setup_page_tables.patch | 53 +++++++++ ...-refactor-imx8mq-introduce-BL31_SIZE.patch | 54 +++++++++ ...106-feat-imx8mq-add-BL31-PIE-support.patch | 55 +++++++++ ...feat-imx8mq-add-support-for-gcc-12.x.patch | 45 ++++++++ ...omers-pengutronix-distrokit-20230210.patch | 21 ++++ patches/tf-a-v2.8/series | 22 ++++ 16 files changed, 430 insertions(+), 194 deletions(-) delete mode 100644 patches/tf-a-v2.7/0001-fix-stm32mp1-fdts-stm32mp1-align-DDR-regulators-with.patch delete mode 100644 patches/tf-a-v2.7/0003-feat-build-add-support-for-new-binutils-versions.patch delete mode 100644 patches/tf-a-v2.7/0004-makefile-link-with-z-noexecstack.patch delete mode 100644 patches/tf-a-v2.7/series rename patches/{tf-a-v2.7/0002-build-makefile-add-helper-to-detect-linker-options.patch => tf-a-v2.8/0001-build-makefile-add-helper-to-detect-linker-options.patch} (85%) create mode 100644 patches/tf-a-v2.8/0002-feat-build-add-support-for-new-binutils-versions.patch create mode 100644 patches/tf-a-v2.8/0101-feat-imx8mq-make-IMX_BOOT_UART_BASE-configurable-via.patch create mode 100644 patches/tf-a-v2.8/0102-feat-imx8mq-remove-empty-bl31_plat_runtime_setup.patch create mode 100644 patches/tf-a-v2.8/0103-feat-imx8mq-always-set-up-console.patch create mode 100644 patches/tf-a-v2.8/0104-refactor-imx8mq-make-use-of-setup_page_tables.patch create mode 100644 patches/tf-a-v2.8/0105-refactor-imx8mq-introduce-BL31_SIZE.patch create mode 100644 patches/tf-a-v2.8/0106-feat-imx8mq-add-BL31-PIE-support.patch create mode 100644 patches/tf-a-v2.8/0107-feat-imx8mq-add-support-for-gcc-12.x.patch create mode 100644 patches/tf-a-v2.8/0201-Release-2.8-customers-pengutronix-distrokit-20230210.patch create mode 100644 patches/tf-a-v2.8/series diff --git a/configs/platform-v7a/platformconfig b/configs/platform-v7a/platformconfig index ac43dbf..8e90a32 100644 --- a/configs/platform-v7a/platformconfig +++ b/configs/platform-v7a/platformconfig @@ -198,8 +198,8 @@ PTXCONF_BOOTLOADER=y # PTXCONF_OPTEE is not set PTXCONF_TF_A=y PTXCONF_TF_A_URL="https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/snapshot" -PTXCONF_TF_A_VERSION="v2.7" -PTXCONF_TF_A_MD5="1d609ceb2bc01d650366118c58ca7336" +PTXCONF_TF_A_VERSION="v2.8" +PTXCONF_TF_A_MD5="784a1e94d4b1e938927372e3bc12d12e" PTXCONF_TF_A_ARCH_STRING="aarch32" PTXCONF_TF_A_ARM_ARCH_MAJOR_7=y # PTXCONF_TF_A_ARM_ARCH_MAJOR_8_32_BIT is not set diff --git a/patches/tf-a-v2.7/0001-fix-stm32mp1-fdts-stm32mp1-align-DDR-regulators-with.patch b/patches/tf-a-v2.7/0001-fix-stm32mp1-fdts-stm32mp1-align-DDR-regulators-with.patch deleted file mode 100644 index 3ee7268..0000000 --- a/patches/tf-a-v2.7/0001-fix-stm32mp1-fdts-stm32mp1-align-DDR-regulators-with.patch +++ /dev/null @@ -1,105 +0,0 @@ -From 02e0e6ae14a747031c6ba67517c9eee744f4d51d Mon Sep 17 00:00:00 2001 -From: Ahmad Fatoum -Date: Thu, 2 Jun 2022 06:28:31 +0200 -Subject: [PATCH 1/4] fix(stm32mp1): fdts: stm32mp1: align DDR regulators with - new driver - -With recent changes, TF-A now panics on LXA MC1, Avernger96 and Odyssey: - - NOTICE: CPU: STM32MP157C?? Rev.B - NOTICE: Model: Linux Automation MC-1 board - ERROR: regul ldo3: max value 750 is invalid - PANIC at PC : 0x2ffeebb7 - -as the driver takes great offense at the content of the device -tree. The parts in question were copy-pasted from ST DTs, but those -ST DTs were fixed by commit 67d95409baae -("refactor(stm32mp1-fdts): update regulator description"). - -Fix the breakage by transplanting the same changes into all STM32MP1 DTs. - -Fixes: bba9fdee589f ("feat(stm32mp1): add regulator framework compilation") -Change-Id: I143d0091625f62c313b3b71449c9ad99583d01c8 -Signed-off-by: Ahmad Fatoum -Origin: https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/15370 ---- - fdts/stm32mp157a-avenger96.dts | 4 +--- - fdts/stm32mp157c-odyssey-som.dtsi | 4 +--- - fdts/stm32mp15xx-osd32.dtsi | 4 +--- - 3 files changed, 3 insertions(+), 9 deletions(-) - -diff --git a/fdts/stm32mp157a-avenger96.dts b/fdts/stm32mp157a-avenger96.dts -index b967736e4786..6ae97c7581d1 100644 ---- a/fdts/stm32mp157a-avenger96.dts -+++ b/fdts/stm32mp157a-avenger96.dts -@@ -115,10 +115,9 @@ - - vtt_ddr: ldo3 { - regulator-name = "vtt_ddr"; -- regulator-min-microvolt = <500000>; -- regulator-max-microvolt = <750000>; - regulator-always-on; - regulator-over-current-protection; -+ st,regulator-sink-source; - }; - - vdd_usb: ldo4 { -@@ -143,7 +142,6 @@ - vref_ddr: vref_ddr { - regulator-name = "vref_ddr"; - regulator-always-on; -- regulator-over-current-protection; - }; - - bst_out: boost { -diff --git a/fdts/stm32mp157c-odyssey-som.dtsi b/fdts/stm32mp157c-odyssey-som.dtsi -index 6bed33968f73..c4e13985a3f7 100644 ---- a/fdts/stm32mp157c-odyssey-som.dtsi -+++ b/fdts/stm32mp157c-odyssey-som.dtsi -@@ -140,10 +140,9 @@ - - vtt_ddr: ldo3 { - regulator-name = "vtt_ddr"; -- regulator-min-microvolt = <500000>; -- regulator-max-microvolt = <750000>; - regulator-always-on; - regulator-over-current-protection; -+ st,regulator-sink-source; - }; - - vdd_usb: ldo4 { -@@ -170,7 +169,6 @@ - vref_ddr: vref_ddr { - regulator-name = "vref_ddr"; - regulator-always-on; -- regulator-over-current-protection; - }; - - bst_out: boost { -diff --git a/fdts/stm32mp15xx-osd32.dtsi b/fdts/stm32mp15xx-osd32.dtsi -index 76a25613a14d..ca672356293c 100644 ---- a/fdts/stm32mp15xx-osd32.dtsi -+++ b/fdts/stm32mp15xx-osd32.dtsi -@@ -81,10 +81,9 @@ - - vtt_ddr: ldo3 { - regulator-name = "vtt_ddr"; -- regulator-min-microvolt = <500000>; -- regulator-max-microvolt = <750000>; - regulator-always-on; - regulator-over-current-protection; -+ st,regulator-sink-source; - }; - - vdd_usb: ldo4 { -@@ -110,7 +109,6 @@ - vref_ddr: vref_ddr { - regulator-name = "vref_ddr"; - regulator-always-on; -- regulator-over-current-protection; - }; - - bst_out: boost { --- -2.30.2 - diff --git a/patches/tf-a-v2.7/0003-feat-build-add-support-for-new-binutils-versions.patch b/patches/tf-a-v2.7/0003-feat-build-add-support-for-new-binutils-versions.patch deleted file mode 100644 index 35b2be9..0000000 --- a/patches/tf-a-v2.7/0003-feat-build-add-support-for-new-binutils-versions.patch +++ /dev/null @@ -1,38 +0,0 @@ -From b102865225c8db6a4ef60f346aded5959acc4d1c Mon Sep 17 00:00:00 2001 -From: Marco Felsch -Date: Wed, 9 Nov 2022 12:59:09 +0100 -Subject: [PATCH 3/4] feat(build): add support for new binutils versions - -The new ld.bfd linker version has added new warnings which are enabled by -default to secure elf binaries: - - https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ba951afb99912da01a6e8434126b8fac7aa75107 - - https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=0d38576a34ec64a1b4500c9277a8e9d0f07e6774 - -Since the tf-a handles every warning as error we need to tell the linker -to not warn about this. This is required to make the bl31 target -buildable with newer toolchain versions. - -Signed-off-by: Marco Felsch -Change-Id: I9430f5fa5036ca88da46cd3b945754d62616b617 ---- - Makefile | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/Makefile b/Makefile -index 3941f869800a..af7fd1535694 100644 ---- a/Makefile -+++ b/Makefile -@@ -444,6 +444,10 @@ TF_LDFLAGS += $(TF_LDFLAGS_$(ARCH)) - endif - endif - -+# With ld.bfd version 2.29 and newer new warnings are added. Skip those since we -+# are not loaded by a elf loader. -+TF_LDFLAGS += $(call ld_option, --no-warn-rwx-segments) -+ - DTC_FLAGS += -I dts -O dtb - DTC_CPPFLAGS += -P -nostdinc -Iinclude -Ifdts -undef \ - -x assembler-with-cpp $(DEFINES) --- -2.30.2 - diff --git a/patches/tf-a-v2.7/0004-makefile-link-with-z-noexecstack.patch b/patches/tf-a-v2.7/0004-makefile-link-with-z-noexecstack.patch deleted file mode 100644 index 5c66e97..0000000 --- a/patches/tf-a-v2.7/0004-makefile-link-with-z-noexecstack.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 943df16d58ec8e31cb3e1726998ac6e4cd195284 Mon Sep 17 00:00:00 2001 -From: Robert Schwebel -Date: Wed, 23 Nov 2022 09:02:59 +0100 -Subject: [PATCH 4/4] makefile: link with -z noexecstack - -Starting with binutils 2.39+, there is a new warning: - - ld: warning: vmlinux: missing .note.GNU-stack section implies executable stack - ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker - ld: warning: vmlinux has a LOAD segment with RWX permissions - -Fix it in a similar way to what the Linux kernel does, see: -https://lore.kernel.org/all/20220810222442.2296651-1-ndesaulniers@google.com/ - -Following the reasoning there, we set "-z noexecstack" for all linkers -(although LLVM's LLD defaults to it). - -Signed-off-by: Robert Schwebel ---- - Makefile | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/Makefile b/Makefile -index af7fd1535694..e4cc77cd41ca 100644 ---- a/Makefile -+++ b/Makefile -@@ -409,6 +409,9 @@ endif - - GCC_V_OUTPUT := $(shell $(CC) -v 2>&1) - -+ -+TF_LDFLAGS += -z noexecstack -+ - # LD = armlink - ifneq ($(findstring armlink,$(notdir $(LD))),) - TF_LDFLAGS += --diag_error=warning --lto_level=O1 --- -2.30.2 - diff --git a/patches/tf-a-v2.7/series b/patches/tf-a-v2.7/series deleted file mode 100644 index 4097cf1..0000000 --- a/patches/tf-a-v2.7/series +++ /dev/null @@ -1,4 +0,0 @@ -0001-fix-stm32mp1-fdts-stm32mp1-align-DDR-regulators-with.patch -0002-build-makefile-add-helper-to-detect-linker-options.patch -0003-feat-build-add-support-for-new-binutils-versions.patch -0004-makefile-link-with-z-noexecstack.patch diff --git a/patches/tf-a-v2.7/0002-build-makefile-add-helper-to-detect-linker-options.patch b/patches/tf-a-v2.8/0001-build-makefile-add-helper-to-detect-linker-options.patch similarity index 85% rename from patches/tf-a-v2.7/0002-build-makefile-add-helper-to-detect-linker-options.patch rename to patches/tf-a-v2.8/0001-build-makefile-add-helper-to-detect-linker-options.patch index d391112..e86f31b 100644 --- a/patches/tf-a-v2.7/0002-build-makefile-add-helper-to-detect-linker-options.patch +++ b/patches/tf-a-v2.8/0001-build-makefile-add-helper-to-detect-linker-options.patch @@ -1,7 +1,6 @@ -From e4e456405177add4df5e21528caa3d873847056a Mon Sep 17 00:00:00 2001 From: Marco Felsch Date: Thu, 24 Nov 2022 11:02:05 +0100 -Subject: [PATCH 2/4] build(makefile): add helper to detect linker options +Subject: [PATCH] build(makefile): add helper to detect linker options This is a small helper to check for possible linker options. If the linker supports the requested option it is returned and if not nothing @@ -18,7 +17,7 @@ Change-Id: I236800852ece49948ff53a0b91fddba53c8f0f95 1 file changed, 6 insertions(+) diff --git a/make_helpers/build_macros.mk b/make_helpers/build_macros.mk -index a58caf565163..06caeea19787 100644 +index 426e344941d9..7d0b0a511226 100644 --- a/make_helpers/build_macros.mk +++ b/make_helpers/build_macros.mk @@ -86,6 +86,12 @@ define assert_numerics @@ -34,6 +33,3 @@ index a58caf565163..06caeea19787 100644 # CREATE_SEQ is a recursive function to create sequence of numbers from 1 to # $(2) and assign the sequence to $(1) define CREATE_SEQ --- -2.30.2 - diff --git a/patches/tf-a-v2.8/0002-feat-build-add-support-for-new-binutils-versions.patch b/patches/tf-a-v2.8/0002-feat-build-add-support-for-new-binutils-versions.patch new file mode 100644 index 0000000..b254a57 --- /dev/null +++ b/patches/tf-a-v2.8/0002-feat-build-add-support-for-new-binutils-versions.patch @@ -0,0 +1,54 @@ +From: Marco Felsch +Date: Wed, 9 Nov 2022 12:59:09 +0100 +Subject: [PATCH] feat(build): add support for new binutils versions + +Users of GNU ld (BPF) from binutils 2.39+ will observe multiple instaces +of a new warning when linking the bl*.elf in the form: + + ld.bfd: warning: stm32mp1_helper.o: missing .note.GNU-stack section implies executable stack + ld.bfd: NOTE: This behaviour is deprecated and will be removed in a future version of the linker + ld.bfd: warning: bl2.elf has a LOAD segment with RWX permissions + ld.bfd: warning: bl32.elf has a LOAD segment with RWX permissions + +These new warnings are enbaled by default to secure elf binaries: + - https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ba951afb99912da01a6e8434126b8fac7aa75107 + - https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=0d38576a34ec64a1b4500c9277a8e9d0f07e6774 + +Fix it in a similar way to what the Linux kernel does, see: +https://lore.kernel.org/all/20220810222442.2296651-1-ndesaulniers@google.com/ + +Following the reasoning there, we set "-z noexecstack" for all linkers +(although LLVM's LLD defaults to it) and optional add +--no-warn-rwx-segments since this a ld.bfd related. + +Signed-off-by: Marco Felsch +Signed-off-by: Robert Schwebel +Change-Id: I9430f5fa5036ca88da46cd3b945754d62616b617 +--- + Makefile | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/Makefile b/Makefile +index 1ddb7b84417d..1bfff716485a 100644 +--- a/Makefile ++++ b/Makefile +@@ -416,6 +416,8 @@ endif + + GCC_V_OUTPUT := $(shell $(CC) -v 2>&1) + ++TF_LDFLAGS += -z noexecstack ++ + # LD = armlink + ifneq ($(findstring armlink,$(notdir $(LD))),) + TF_LDFLAGS += --diag_error=warning --lto_level=O1 +@@ -451,6 +453,10 @@ TF_LDFLAGS += $(TF_LDFLAGS_$(ARCH)) + endif + endif + ++# With ld.bfd version 2.29 and newer new warnings are added. Skip those since we ++# are not loaded by a elf loader. ++TF_LDFLAGS += $(call ld_option, --no-warn-rwx-segments) ++ + DTC_FLAGS += -I dts -O dtb + DTC_CPPFLAGS += -P -nostdinc -Iinclude -Ifdts -undef \ + -x assembler-with-cpp $(DEFINES) diff --git a/patches/tf-a-v2.8/0101-feat-imx8mq-make-IMX_BOOT_UART_BASE-configurable-via.patch b/patches/tf-a-v2.8/0101-feat-imx8mq-make-IMX_BOOT_UART_BASE-configurable-via.patch new file mode 100644 index 0000000..958b7fd --- /dev/null +++ b/patches/tf-a-v2.8/0101-feat-imx8mq-make-IMX_BOOT_UART_BASE-configurable-via.patch @@ -0,0 +1,41 @@ +From: Lucas Stach +Date: Thu, 8 Dec 2022 15:54:26 +0100 +Subject: [PATCH] feat(imx8mq): make IMX_BOOT_UART_BASE configurable via build + parameter + +This aligns the i.MX8MQ build with the other i.MX8M platforms by allowing +to override the default IMX_BOOT_UART_BASE value via a make parameter. + +Signed-off-by: Lucas Stach +Change-Id: Iad9b844517209fc7d051c61767f71ac9fa2b55c7 +--- + plat/imx/imx8m/imx8mq/include/platform_def.h | 1 - + plat/imx/imx8m/imx8mq/platform.mk | 3 +++ + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/plat/imx/imx8m/imx8mq/include/platform_def.h b/plat/imx/imx8m/imx8mq/include/platform_def.h +index 1dd22d952305..4671cd3afa40 100644 +--- a/plat/imx/imx8m/imx8mq/include/platform_def.h ++++ b/plat/imx/imx8m/imx8mq/include/platform_def.h +@@ -54,7 +54,6 @@ + + #define HAB_RVT_BASE U(0x00000880) /* HAB_RVT for i.MX8MQ */ + +-#define IMX_BOOT_UART_BASE U(0x30860000) + #define IMX_BOOT_UART_CLK_IN_HZ 25000000 /* Select 25Mhz oscillator */ + #define PLAT_CRASH_UART_BASE IMX_BOOT_UART_BASE + #define PLAT_CRASH_UART_CLK_IN_HZ 25000000 +diff --git a/plat/imx/imx8m/imx8mq/platform.mk b/plat/imx/imx8m/imx8mq/platform.mk +index 7b6df920c924..f62d3aa5be15 100644 +--- a/plat/imx/imx8m/imx8mq/platform.mk ++++ b/plat/imx/imx8m/imx8mq/platform.mk +@@ -52,6 +52,9 @@ $(eval $(call add_define,BL32_BASE)) + BL32_SIZE ?= 0x2000000 + $(eval $(call add_define,BL32_SIZE)) + ++IMX_BOOT_UART_BASE ?= 0x30860000 ++$(eval $(call add_define,IMX_BOOT_UART_BASE)) ++ + ifeq (${SPD},trusty) + BL31_CFLAGS += -DPLAT_XLAT_TABLES_DYNAMIC=1 + endif diff --git a/patches/tf-a-v2.8/0102-feat-imx8mq-remove-empty-bl31_plat_runtime_setup.patch b/patches/tf-a-v2.8/0102-feat-imx8mq-remove-empty-bl31_plat_runtime_setup.patch new file mode 100644 index 0000000..0b1bc7e --- /dev/null +++ b/patches/tf-a-v2.8/0102-feat-imx8mq-remove-empty-bl31_plat_runtime_setup.patch @@ -0,0 +1,30 @@ +From: Lucas Stach +Date: Thu, 8 Dec 2022 17:51:17 +0100 +Subject: [PATCH] feat(imx8mq): remove empty bl31_plat_runtime_setup + +Having this empty definition is actively harmful, as it prevents the +default weak function to be used, which does a switch of the console +state. + +Signed-off-by: Lucas Stach +Change-Id: I3b78e0c524c4907714036dba573a44d8f9c48b09 +--- + plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c b/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c +index 59c3779abb7f..0feb6d7fbad2 100644 +--- a/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c ++++ b/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c +@@ -227,11 +227,6 @@ unsigned int plat_get_syscnt_freq2(void) + return COUNTER_FREQUENCY; + } + +-void bl31_plat_runtime_setup(void) +-{ +- return; +-} +- + #ifdef SPD_trusty + void plat_trusty_set_boot_args(aapcs64_params_t *args) + { diff --git a/patches/tf-a-v2.8/0103-feat-imx8mq-always-set-up-console.patch b/patches/tf-a-v2.8/0103-feat-imx8mq-always-set-up-console.patch new file mode 100644 index 0000000..3a44ae3 --- /dev/null +++ b/patches/tf-a-v2.8/0103-feat-imx8mq-always-set-up-console.patch @@ -0,0 +1,51 @@ +From: Lucas Stach +Date: Thu, 8 Dec 2022 16:00:04 +0100 +Subject: [PATCH] feat(imx8mq): always set up console + +This aligns the i.MX8MQ platform behaviour with the other i.MX8M* +platforms by always setting up the console UART. + +Signed-off-by: Lucas Stach +Change-Id: I1279d9cb4feb6e789422b9844cab711b8daae74e +--- + plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c | 7 +++---- + plat/imx/imx8m/imx8mq/include/platform_def.h | 1 - + 2 files changed, 3 insertions(+), 5 deletions(-) + +diff --git a/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c b/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c +index 0feb6d7fbad2..0972c35e9554 100644 +--- a/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c ++++ b/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c +@@ -124,6 +124,7 @@ static void bl31_tz380_setup(void) + void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1, + u_register_t arg2, u_register_t arg3) + { ++ static console_t console; + int i; + /* enable CSU NS access permission */ + for (i = 0; i < 64; i++) { +@@ -132,12 +133,10 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1, + + imx_aipstz_init(aipstz); + +-#if DEBUG_CONSOLE +- static console_t console; +- + console_imx_uart_register(IMX_BOOT_UART_BASE, IMX_BOOT_UART_CLK_IN_HZ, + IMX_CONSOLE_BAUDRATE, &console); +-#endif ++ /* This console is only used for boot stage */ ++ console_set_scope(&console, CONSOLE_FLAG_BOOT); + + imx8m_caam_init(); + +diff --git a/plat/imx/imx8m/imx8mq/include/platform_def.h b/plat/imx/imx8m/imx8mq/include/platform_def.h +index 4671cd3afa40..103f2e4087e2 100644 +--- a/plat/imx/imx8m/imx8mq/include/platform_def.h ++++ b/plat/imx/imx8m/imx8mq/include/platform_def.h +@@ -127,5 +127,4 @@ + + #define COUNTER_FREQUENCY 8333333 /* 25MHz / 3 */ + +-#define DEBUG_CONSOLE 0 + #define IMX_WDOG_B_RESET diff --git a/patches/tf-a-v2.8/0104-refactor-imx8mq-make-use-of-setup_page_tables.patch b/patches/tf-a-v2.8/0104-refactor-imx8mq-make-use-of-setup_page_tables.patch new file mode 100644 index 0000000..6cf2dc1 --- /dev/null +++ b/patches/tf-a-v2.8/0104-refactor-imx8mq-make-use-of-setup_page_tables.patch @@ -0,0 +1,53 @@ +From: Lucas Stach +Date: Thu, 8 Dec 2022 16:35:11 +0100 +Subject: [PATCH] refactor(imx8mq): make use of setup_page_tables() + +Improve code readability and align with other i.MX8M* platforms. + +Signed-off-by: Lucas Stach +Change-Id: Ifd29b74872e3a567288d208de4827403078164e9 +--- + plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c | 28 +++++++++++++--------------- + 1 file changed, 13 insertions(+), 15 deletions(-) + +diff --git a/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c b/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c +index 0972c35e9554..c7eddf430197 100644 +--- a/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c ++++ b/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c +@@ -175,23 +175,21 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1, + + void bl31_plat_arch_setup(void) + { +- mmap_add_region(BL31_BASE, BL31_BASE, (BL31_LIMIT - BL31_BASE), +- MT_MEMORY | MT_RW | MT_SECURE); +- mmap_add_region(BL_CODE_BASE, BL_CODE_BASE, (BL_CODE_END - BL_CODE_BASE), +- MT_MEMORY | MT_RO | MT_SECURE); +- +- /* Map TEE memory */ +- mmap_add_region(BL32_BASE, BL32_BASE, BL32_SIZE, MT_MEMORY | MT_RW); +- +- mmap_add(imx_mmap); +- ++ const mmap_region_t bl_regions[] = { ++ MAP_REGION_FLAT(BL31_BASE, BL31_LIMIT - BL31_BASE, ++ 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 USE_COHERENT_MEM +- mmap_add_region(BL_COHERENT_RAM_BASE, BL_COHERENT_RAM_BASE, +- BL_COHERENT_RAM_END - BL_COHERENT_RAM_BASE, +- MT_DEVICE | MT_RW | MT_SECURE); ++ MAP_REGION_FLAT(BL_COHERENT_RAM_BASE, ++ BL_COHERENT_RAM_END - BL_COHERENT_RAM_BASE, ++ MT_DEVICE | MT_RW | MT_SECURE), + #endif +- /* setup xlat table */ +- init_xlat_tables(); ++ MAP_REGION_FLAT(BL32_BASE, BL32_SIZE, MT_MEMORY | MT_RW), ++ {0}, ++ }; ++ ++ setup_page_tables(bl_regions, imx_mmap); + /* enable the MMU */ + enable_mmu_el3(0); + } diff --git a/patches/tf-a-v2.8/0105-refactor-imx8mq-introduce-BL31_SIZE.patch b/patches/tf-a-v2.8/0105-refactor-imx8mq-introduce-BL31_SIZE.patch new file mode 100644 index 0000000..960d726 --- /dev/null +++ b/patches/tf-a-v2.8/0105-refactor-imx8mq-introduce-BL31_SIZE.patch @@ -0,0 +1,54 @@ +From: Lucas Stach +Date: Thu, 8 Dec 2022 16:37:44 +0100 +Subject: [PATCH] refactor(imx8mq): introduce BL31_SIZE + +No functional change. + +Introduce BL31_SIZE define and calculate the limits based on the +BL31_BASE and the BL31_SIZE define. Also make use of SZ_64K to make it +easier to read. This is required for later BL31 PIE support since it +drops the calculation based on the BL31_LIMIT and BL31_BASE. + +Signed-off-by: Lucas Stach +Change-Id: I517074b866b5bf11841b51777f87c926b304488d +--- + plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c | 2 +- + plat/imx/imx8m/imx8mq/include/platform_def.h | 5 ++++- + 2 files changed, 5 insertions(+), 2 deletions(-) + +diff --git a/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c b/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c +index c7eddf430197..bbdb4d899a39 100644 +--- a/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c ++++ b/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c +@@ -176,7 +176,7 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1, + void bl31_plat_arch_setup(void) + { + const mmap_region_t bl_regions[] = { +- MAP_REGION_FLAT(BL31_BASE, BL31_LIMIT - BL31_BASE, ++ MAP_REGION_FLAT(BL31_BASE, BL31_SIZE, + MT_MEMORY | MT_RW | MT_SECURE), + MAP_REGION_FLAT(BL_CODE_BASE, BL_CODE_END - BL_CODE_BASE, + MT_MEMORY | MT_RO | MT_SECURE), +diff --git a/plat/imx/imx8m/imx8mq/include/platform_def.h b/plat/imx/imx8m/imx8mq/include/platform_def.h +index 103f2e4087e2..bb570748f573 100644 +--- a/plat/imx/imx8m/imx8mq/include/platform_def.h ++++ b/plat/imx/imx8m/imx8mq/include/platform_def.h +@@ -4,6 +4,8 @@ + * SPDX-License-Identifier: BSD-3-Clause + */ + ++#include ++ + #define PLATFORM_LINKER_FORMAT "elf64-littleaarch64" + #define PLATFORM_LINKER_ARCH aarch64 + +@@ -31,7 +33,8 @@ + #define PLAT_STOP_OFF_STATE U(3) + + #define BL31_BASE U(0x910000) +-#define BL31_LIMIT U(0x920000) ++#define BL31_SIZE SZ_64K ++#define BL31_LIMIT (BL31_BASE + BL31_SIZE) + + /* non-secure uboot base */ + #define PLAT_NS_IMAGE_OFFSET U(0x40200000) diff --git a/patches/tf-a-v2.8/0106-feat-imx8mq-add-BL31-PIE-support.patch b/patches/tf-a-v2.8/0106-feat-imx8mq-add-BL31-PIE-support.patch new file mode 100644 index 0000000..25d2aaa --- /dev/null +++ b/patches/tf-a-v2.8/0106-feat-imx8mq-add-BL31-PIE-support.patch @@ -0,0 +1,55 @@ +From: Lucas Stach +Date: Thu, 8 Dec 2022 16:44:00 +0100 +Subject: [PATCH] feat(imx8mq): add BL31 PIE support + +Enable PIE support so the BL31 firmware can be loaded from anywhere +within the OCRAM (SRAM). For the PIE support we only need to replace the +BL31_BASE define by the BL31_START symbol which is a relocatable and we +need to enable it by setting ENABLE_PIE := 1. + +Signed-off-by: Lucas Stach +Change-Id: Ie6a13e4ae0fdc6627a94798d7a86df7d5b310896 +--- + plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c | 2 +- + plat/imx/imx8m/imx8mq/imx8mq_psci.c | 2 +- + plat/imx/imx8m/imx8mq/platform.mk | 1 + + 3 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c b/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c +index bbdb4d899a39..3c2d223fef21 100644 +--- a/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c ++++ b/plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c +@@ -176,7 +176,7 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1, + void bl31_plat_arch_setup(void) + { + const mmap_region_t bl_regions[] = { +- MAP_REGION_FLAT(BL31_BASE, BL31_SIZE, ++ MAP_REGION_FLAT(BL31_START, BL31_SIZE, + MT_MEMORY | MT_RW | MT_SECURE), + MAP_REGION_FLAT(BL_CODE_BASE, BL_CODE_END - BL_CODE_BASE, + MT_MEMORY | MT_RO | MT_SECURE), +diff --git a/plat/imx/imx8m/imx8mq/imx8mq_psci.c b/plat/imx/imx8m/imx8mq/imx8mq_psci.c +index 662017d6fe4a..01582afe490c 100644 +--- a/plat/imx/imx8m/imx8mq/imx8mq_psci.c ++++ b/plat/imx/imx8m/imx8mq/imx8mq_psci.c +@@ -41,7 +41,7 @@ int imx_validate_power_state(unsigned int power_state, + + void imx_domain_suspend(const psci_power_state_t *target_state) + { +- uint64_t base_addr = BL31_BASE; ++ uint64_t base_addr = BL31_START; + uint64_t mpidr = read_mpidr_el1(); + unsigned int core_id = MPIDR_AFFLVL0_VAL(mpidr); + +diff --git a/plat/imx/imx8m/imx8mq/platform.mk b/plat/imx/imx8m/imx8mq/platform.mk +index f62d3aa5be15..901a974a591e 100644 +--- a/plat/imx/imx8m/imx8mq/platform.mk ++++ b/plat/imx/imx8m/imx8mq/platform.mk +@@ -38,6 +38,7 @@ BL31_SOURCES += plat/imx/common/imx8_helpers.S \ + ${XLAT_TABLES_LIB_SRCS} \ + ${IMX_GIC_SOURCES} + ++ENABLE_PIE := 1 + USE_COHERENT_MEM := 1 + RESET_TO_BL31 := 1 + A53_DISABLE_NON_TEMPORAL_HINT := 0 diff --git a/patches/tf-a-v2.8/0107-feat-imx8mq-add-support-for-gcc-12.x.patch b/patches/tf-a-v2.8/0107-feat-imx8mq-add-support-for-gcc-12.x.patch new file mode 100644 index 0000000..24a5b80 --- /dev/null +++ b/patches/tf-a-v2.8/0107-feat-imx8mq-add-support-for-gcc-12.x.patch @@ -0,0 +1,45 @@ +From: Marco Felsch +Date: Fri, 10 Feb 2023 12:14:26 +0100 +Subject: [PATCH] feat(imx8mq): add support for gcc >= 12.x + +Starting with GCC >= 12.x the -Wall option includes -Werror=array-bounds +checks. Per default GCC threads all memory accesses below 4096 as NULL, +so access to ROMAPI causes the following warning: + +In file included from plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c:20: +In function 'mmio_read_8', + inlined from 'imx8mq_soc_info_init' at plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c:70:16, + inlined from 'bl31_platform_setup' at plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c:206:2: +include/lib/mmio.h:19:16: error: array subscript 0 is outside array bounds of 'volatile uint8_t[0]' {aka 'volatile unsigned char[]'} [-Werror=array-bounds] + 19 | return *(volatile uint8_t*)addr; + | ^~~~~~~~~~~~~~~~~~~~~~~~ +In function 'mmio_read_8', + inlined from 'imx8mq_soc_info_init' at plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c:74:16, + inlined from 'bl31_platform_setup' at plat/imx/imx8m/imx8mq/imx8mq_bl31_setup.c:206:2: +include/lib/mmio.h:19:16: error: array subscript 0 is outside array bounds of 'volatile uint8_t[0]' {aka 'volatile unsigned char[]'} [-Werror=array-bounds] + 19 | return *(volatile uint8_t*)addr; + | ^~~~~~~~~~~~~~~~~~~~~~~~ +cc1: all warnings being treated as errors + +Fix this by setting the default min-pagesize to 0 instead of 4096, so +the ROMAPI access will not trigger the warning. Don't set this option +for all files since it is unkown how it affects code +generation/optimizations. + +Signed-off-by: Marco Felsch +Change-Id: Ibcca65ca69750e1a1bca3d528c80e5b445d2f90f +--- + plat/imx/imx8m/imx8mq/platform.mk | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/plat/imx/imx8m/imx8mq/platform.mk b/plat/imx/imx8m/imx8mq/platform.mk +index 901a974a591e..985be71725f7 100644 +--- a/plat/imx/imx8m/imx8mq/platform.mk ++++ b/plat/imx/imx8m/imx8mq/platform.mk +@@ -59,3 +59,6 @@ $(eval $(call add_define,IMX_BOOT_UART_BASE)) + ifeq (${SPD},trusty) + BL31_CFLAGS += -DPLAT_XLAT_TABLES_DYNAMIC=1 + endif ++ ++# Required with gcc version >= 12 ++$(BUILD_PLAT)/bl31/imx8mq_bl31_setup.o: CFLAGS += --param=min-pagesize=0 diff --git a/patches/tf-a-v2.8/0201-Release-2.8-customers-pengutronix-distrokit-20230210.patch b/patches/tf-a-v2.8/0201-Release-2.8-customers-pengutronix-distrokit-20230210.patch new file mode 100644 index 0000000..f230656 --- /dev/null +++ b/patches/tf-a-v2.8/0201-Release-2.8-customers-pengutronix-distrokit-20230210.patch @@ -0,0 +1,21 @@ +From: Marco Felsch +Date: Fri, 10 Feb 2023 12:51:49 +0100 +Subject: [PATCH] Release 2.8/customers/pengutronix/distrokit/20230210-1 + +--- + Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index 1bfff716485a..cf80e5cac8f3 100644 +--- a/Makefile ++++ b/Makefile +@@ -327,7 +327,7 @@ endif + ifeq (${BUILD_STRING},) + BUILD_STRING := $(shell git describe --always --dirty --tags 2> /dev/null) + endif +-VERSION_STRING := v${VERSION}(${BUILD_TYPE}):${BUILD_STRING} ++VERSION_STRING := v${VERSION}(${BUILD_TYPE}):${BUILD_STRING}-20230210-1 + + ifeq (${AARCH32_INSTRUCTION_SET},A32) + TF_CFLAGS_aarch32 += -marm diff --git a/patches/tf-a-v2.8/series b/patches/tf-a-v2.8/series new file mode 100644 index 0000000..a29319d --- /dev/null +++ b/patches/tf-a-v2.8/series @@ -0,0 +1,22 @@ +# umpf-base: v2.8 +# umpf-name: 2.8/customers/pengutronix/distrokit +# umpf-version: 2.8/customers/pengutronix/distrokit/20230210-1 +# umpf-topic: v2.8/topic/fix-build-warnings +# umpf-hashinfo: 4730b4b80206cf2fc27787f43cefd3169a6f8a2f +# umpf-topic-range: 9881bb93a3bc0a3ea37e9f093e09ab4b360a9e48..da1b5e74dc7c2b3e7a2d9a1adb7e23beeba079e3 +0001-build-makefile-add-helper-to-detect-linker-options.patch +0002-feat-build-add-support-for-new-binutils-versions.patch +# umpf-topic: v2.8/topic/imx8mq +# umpf-hashinfo: 651310b67fd269e8118285e9ed44e8ad6cc52941 +# umpf-topic-range: da1b5e74dc7c2b3e7a2d9a1adb7e23beeba079e3..be7bcbebf5b22958e8b88564ca0865b4591263e7 +0101-feat-imx8mq-make-IMX_BOOT_UART_BASE-configurable-via.patch +0102-feat-imx8mq-remove-empty-bl31_plat_runtime_setup.patch +0103-feat-imx8mq-always-set-up-console.patch +0104-refactor-imx8mq-make-use-of-setup_page_tables.patch +0105-refactor-imx8mq-introduce-BL31_SIZE.patch +0106-feat-imx8mq-add-BL31-PIE-support.patch +0107-feat-imx8mq-add-support-for-gcc-12.x.patch +# umpf-release: 2.8/customers/pengutronix/distrokit/20230210-1 +# umpf-topic-range: be7bcbebf5b22958e8b88564ca0865b4591263e7..827865ee983d0c7cd4bb99d85d46f972386e5ea9 +0201-Release-2.8-customers-pengutronix-distrokit-20230210.patch +# umpf-end -- 2.30.2