Skip to contentSkip to conversation

arm: qemu: fix failure if booting from TF-A

PATCH Superseded AKASHI Takahiro 2 participants 6 messages Jul 3, 2019 – Jul 18, 2019 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

v2 cover arm: qemu: fix failure if booting from TF-A

With this patch, hang-up of U-Boot, as described in patch#2, will be fixed if it is loaded and started from TF-A.

Changes in v2 (July 3, 2019)
* add patch#1 (preparatory patch)
* remove a reference to unnecessary patch in the commit message

AKASHI Takahiro (2):
arm: move CONFIG_TFABOOT to generic Kconfig
arm: qemu: fix failure in flash initialization if booting from TF-A

 arch/arm/Kconfig                          | 29 +++++++++++++++++++++++
 arch/arm/cpu/armv8/fsl-layerscape/Kconfig |  7 ------
 include/configs/qemu-arm.h                |  5 ++++
 3 files changed, 34 insertions(+), 7 deletions(-)
Signature · 1 line
2.21.0
#1 lore raw

PATCH v2 1/2 arm: move CONFIG_TFABOOT to generic Kconfig

Currently, CONFIG_TFABOOT is located in armv8/fsl-layerscape Kconfig, but it will be also useful for other targets if some additional configuration are necessary.
So move it to arch/arm/Kconfig.

Please note that CONFIG_TFABOOT still depends on CONFIG_ARCH_SUPPORT_TFABOOT and so the menu won't come up if any target doesn't need its own customization for TF-A boot. This will maintain the compatibility.

Cc Rajesh Bhagat <[email protected]>
Cc York Sun <[email protected]>
Cc Prabhakar Kushwaha <[email protected]>
Cc Priyanka Jain <[email protected]>
Cc Sriram Dash <[email protected]>
Cc Hou Zhiqiang <[email protected]>
Cc Peng Ma <[email protected]>
Cc Yuantian Tang <[email protected]>
Cc Pankit Garg <[email protected]>
---
 arch/arm/Kconfig                          | 28 +++++++++++++++++++++++
 arch/arm/cpu/armv8/fsl-layerscape/Kconfig |  7 ------
 2 files changed, 28 insertions(+), 7 deletions(-)
arch/arm/Kconfig +28 -0
index 01ff57cf1bec..fe174d02d75a 100644
@@ -1089,6 +1089,7 @@ config TARGET_LS1088AQDS
 	select ARCH_MISC_INIT
 	select ARM64
 	select ARMV8_MULTIENTRY
+	select ARCH_SUPPORT_TFABOOT
 	select BOARD_LATE_INIT
 	select SUPPORT_SPL
 	select FSL_DDR_INTERACTIVE if !SD_BOOT
@@ -1104,6 +1105,7 @@ config TARGET_LS2080AQDS
 	select ARCH_MISC_INIT
 	select ARM64
 	select ARMV8_MULTIENTRY
+	select ARCH_SUPPORT_TFABOOT
 	select BOARD_LATE_INIT
 	select SUPPORT_SPL
 	imply SCSI
@@ -1122,6 +1124,7 @@ config TARGET_LS2080ARDB
 	select ARCH_MISC_INIT
 	select ARM64
 	select ARMV8_MULTIENTRY
+	select ARCH_SUPPORT_TFABOOT
 	select BOARD_LATE_INIT
 	select SUPPORT_SPL
 	select FSL_DDR_BIST
@@ -1154,6 +1157,7 @@ config TARGET_LX2160ARDB
 	select ARCH_MISC_INIT
 	select ARM64
 	select ARMV8_MULTIENTRY
+	select ARCH_SUPPORT_TFABOOT
 	select BOARD_LATE_INIT
 	help
 	  Support for NXP LX2160ARDB platform.
@@ -1167,6 +1171,7 @@ config TARGET_LX2160AQDS
 	select ARCH_MISC_INIT
 	select ARM64
 	select ARMV8_MULTIENTRY
+	select ARCH_SUPPORT_TFABOOT
 	select BOARD_LATE_INIT
 	help
 	  Support for NXP LX2160AQDS platform.
@@ -1207,6 +1212,7 @@ config TARGET_LS1012AQDS
 	bool "Support ls1012aqds"
 	select ARCH_LS1012A
 	select ARM64
+	select ARCH_SUPPORT_TFABOOT
 	select BOARD_LATE_INIT
 	help
 	  Support for Freescale LS1012AQDS platform.
@@ -1218,6 +1224,7 @@ config TARGET_LS1012ARDB
 	bool "Support ls1012ardb"
 	select ARCH_LS1012A
 	select ARM64
+	select ARCH_SUPPORT_TFABOOT
 	select BOARD_LATE_INIT
 	imply SCSI
 	imply SCSI_AHCI
@@ -1231,6 +1238,7 @@ config TARGET_LS1012A2G5RDB
 	bool "Support ls1012a2g5rdb"
 	select ARCH_LS1012A
 	select ARM64
+	select ARCH_SUPPORT_TFABOOT
 	select BOARD_LATE_INIT
 	imply SCSI
 	help
@@ -1243,6 +1251,7 @@ config TARGET_LS1012AFRWY
 	bool "Support ls1012afrwy"
 	select ARCH_LS1012A
 	select ARM64
+	select ARCH_SUPPORT_TFABOOT
 	select BOARD_LATE_INIT
 	imply SCSI
 	imply SCSI_AHCI
@@ -1256,6 +1265,7 @@ config TARGET_LS1012AFRDM
 	bool "Support ls1012afrdm"
 	select ARCH_LS1012A
 	select ARM64
+	select ARCH_SUPPORT_TFABOOT
 	help
 	  Support for Freescale LS1012AFRDM platform.
 	  The LS1012A Freedom  board (FRDM) is a high-performance
@@ -1267,6 +1277,7 @@ config TARGET_LS1028AQDS
 	select ARCH_LS1028A
 	select ARM64
 	select ARMV8_MULTIENTRY
+	select ARCH_SUPPORT_TFABOOT
 	help
 	  Support for Freescale LS1028AQDS platform
 	  The LS1028A Development System (QDS) is a high-performance
@@ -1278,6 +1289,7 @@ config TARGET_LS1028ARDB
 	select ARCH_LS1028A
 	select ARM64
 	select ARMV8_MULTIENTRY
+	select ARCH_SUPPORT_TFABOOT
 	help
 	  Support for Freescale LS1028ARDB platform
 	  The LS1028A Development System (RDB) is a high-performance
@@ -1290,6 +1302,7 @@ config TARGET_LS1088ARDB
 	select ARCH_MISC_INIT
 	select ARM64
 	select ARMV8_MULTIENTRY
+	select ARCH_SUPPORT_TFABOOT
 	select BOARD_LATE_INIT
 	select SUPPORT_SPL
 	select FSL_DDR_INTERACTIVE if !SD_BOOT
@@ -1348,6 +1361,7 @@ config TARGET_LS1043AQDS
 	select ARCH_LS1043A
 	select ARM64
 	select ARMV8_MULTIENTRY
+	select ARCH_SUPPORT_TFABOOT
 	select BOARD_EARLY_INIT_F
 	select BOARD_LATE_INIT
 	select SUPPORT_SPL
@@ -1362,6 +1376,7 @@ config TARGET_LS1043ARDB
 	select ARCH_LS1043A
 	select ARM64
 	select ARMV8_MULTIENTRY
+	select ARCH_SUPPORT_TFABOOT
 	select BOARD_EARLY_INIT_F
 	select BOARD_LATE_INIT
 	select SUPPORT_SPL
@@ -1373,6 +1388,7 @@ config TARGET_LS1046AQDS
 	select ARCH_LS1046A
 	select ARM64
 	select ARMV8_MULTIENTRY
+	select ARCH_SUPPORT_TFABOOT
 	select BOARD_EARLY_INIT_F
 	select BOARD_LATE_INIT
 	select DM_SPI_FLASH if DM_SPI
@@ -1392,6 +1408,7 @@ config TARGET_LS1046ARDB
 	select ARCH_LS1046A
 	select ARM64
 	select ARMV8_MULTIENTRY
+	select ARCH_SUPPORT_TFABOOT
 	select BOARD_EARLY_INIT_F
 	select BOARD_LATE_INIT
 	select DM_SPI_FLASH if DM_SPI
@@ -1543,6 +1560,17 @@ config ARCH_ASPEED
 
 endchoice
 
+config ARCH_SUPPORT_TFABOOT
+	bool
+
+config TFABOOT
+	bool "Support for booting from TF-A"
+	depends on ARCH_SUPPORT_TFABOOT
+	default n
+	help
+	  Enabling this will make a U-Boot binary that is capable of being
+	  booted via TF-A.
+
 config TI_SECURE_DEVICE
 	bool "HS Device Type Support"
 	depends on ARCH_KEYSTONE || ARCH_OMAP2PLUS || ARCH_K3
arch/arm/cpu/armv8/fsl-layerscape/Kconfig +0 -7
index a843c1eb6515..83e6340f161b 100644
@@ -622,10 +622,3 @@ config HAS_FSL_XHCI_USB
 	help
 	  For some SoC(such as LS1043A and LS1046A), USB and QE-HDLC multiplex use
 	  pins, select it when the pins are assigned to USB.
-
-config TFABOOT
-       bool "Support for booting from TFA"
-       default n
-       help
-         Enabling this will make a U-Boot binary that is capable of being
-         booted via TFA.
Signature · 1 line
2.21.0
#2 lore raw

PATCH v2 1/2 arm: move CONFIG_TFABOOT to generic Kconfig

Quoted 10 lines · AKASHI Takahiro

Currently, CONFIG_TFABOOT is located in armv8/fsl-layerscape Kconfig, but it will be also useful for other targets if some additional configuration are necessary.
So move it to arch/arm/Kconfig.

Please note that CONFIG_TFABOOT still depends on CONFIG_ARCH_SUPPORT_TFABOOT and so the menu won't come up if any target doesn't need its own customization for TF-A boot. This will maintain the compatibility.

Quoted 10 lines
Cc Rajesh Bhagat <[email protected]>
Cc York Sun <[email protected]>
Cc Prabhakar Kushwaha <[email protected]>
Cc Priyanka Jain <[email protected]>
Cc Sriram Dash <[email protected]>
Cc Hou Zhiqiang <[email protected]>
Cc Peng Ma <[email protected]>
Cc Yuantian Tang <[email protected]>
Cc Pankit Garg <[email protected]>

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190718/f0538d02/attachment.sig>
#3 lore raw

PATCH v2 2/2 arm: qemu: fix failure in flash initialization if booting from TF-A

In reply to AKASHI Takahiro

If U-Boot is loaded and started from TF-A (you need to change SYS_TEXT_BASE to 0x60000000), it will hang up at flash initialization.

If secure mode is off (default, or -machine virt,secure=off) at qemu, it will provide dtb with two flash memory banks:

	flash at 0 {
		bank-width = <0x4>;
		reg = <0x0 0x0 0x0 0x4000000 0x0 0x4000000 0x0 0x4000000>;
		compatible = "cfi-flash";
	};
If secure mode is on, on the other hand, qemu provides dtb with 1 bank:
	flash at 0 {
		bank-width = <0x4>;
		reg = <0x0 0x4000000 0x0 0x4000000>;
		compatible = "cfi-flash";
	};

As a result, flash_init()/flash_get_size() will eventually fail. With this patch applied, relevant CONFIG values are modified.

---
 arch/arm/Kconfig           | 1 +
 include/configs/qemu-arm.h | 5 +++++
 2 files changed, 6 insertions(+)
arch/arm/Kconfig +1 -0
index fe174d02d75a..64552ac5607e 100644
@@ -830,6 +830,7 @@ config ARCH_OWL
 
 config ARCH_QEMU
 	bool "QEMU Virtual Platform"
+	select ARCH_SUPPORT_TFABOOT
 	select DM
 	select DM_SERIAL
 	select OF_CONTROL
include/configs/qemu-arm.h +5 -0
index 65fdb1e92981..35e3c5ad7a8d 100644
@@ -46,8 +46,13 @@
 #define CONFIG_SYS_CBSIZE 512
 
 #define CONFIG_SYS_MONITOR_BASE		CONFIG_SYS_TEXT_BASE
+#ifdef CONFIG_TFABOOT
+#define CONFIG_SYS_FLASH_BASE		0x4000000
+#define CONFIG_SYS_MAX_FLASH_BANKS	1
+#else
 #define CONFIG_SYS_FLASH_BASE		0x0
 #define CONFIG_SYS_MAX_FLASH_BANKS	2
+#endif
 #define CONFIG_SYS_MAX_FLASH_SECT	256 /* Sector: 256K, Bank: 64M */
 
 #endif /* __CONFIG_H */
Signature · 1 line
2.21.0
#4 lore raw

PATCH v2 2/2 arm: qemu: fix failure in flash initialization if booting from TF-A

Quoted 17 lines · AKASHI Takahiro

If U-Boot is loaded and started from TF-A (you need to change SYS_TEXT_BASE to 0x60000000), it will hang up at flash initialization.

If secure mode is off (default, or -machine virt,secure=off) at qemu, it will provide dtb with two flash memory banks:

	flash at 0 {
		bank-width = <0x4>;
		reg = <0x0 0x0 0x0 0x4000000 0x0 0x4000000 0x0 0x4000000>;
		compatible = "cfi-flash";
	};
If secure mode is on, on the other hand, qemu provides dtb with 1 bank:
	flash at 0 {
		bank-width = <0x4>;
		reg = <0x0 0x4000000 0x0 0x4000000>;
		compatible = "cfi-flash";
	};
Quoted 5 lines

As a result, flash_init()/flash_get_size() will eventually fail. With this patch applied, relevant CONFIG values are modified.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190718/4a70447f/attachment.sig>
#5 lore raw

v2 cover arm: qemu: fix failure if booting from TF-A

In reply to AKASHI Takahiro

Hi Albert, Tuomas,

Ping. Can you review this patch, please?

-Takahiro Akashi

Quoted 19 lines · AKASHI Takahiro

With this patch, hang-up of U-Boot, as described in patch#2, will be fixed if it is loaded and started from TF-A.

Changes in v2 (July 3, 2019)
* add patch#1 (preparatory patch)
* remove a reference to unnecessary patch in the commit message

AKASHI Takahiro (2):
arm: move CONFIG_TFABOOT to generic Kconfig
arm: qemu: fix failure in flash initialization if booting from TF-A

 arch/arm/Kconfig                          | 29 +++++++++++++++++++++++
 arch/arm/cpu/armv8/fsl-layerscape/Kconfig |  7 ------
 include/configs/qemu-arm.h                |  5 ++++
 3 files changed, 34 insertions(+), 7 deletions(-)
Signature · 1 line
2.21.0