arm: qemu: fix failure in flash initialization if booting from TF-A
PATCH 1/1 arm: qemu: fix failure in flash initialization if booting from TF-A
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.
NOTE: you will not have to modify SYS_TEXT_BASE any more once Yamada-san's patch[1] is merged.
[1] https://lists.denx.de/pipermail/u-boot/2019-June/374178.html
--- include/configs/qemu-arm.h | 5 +++++ 1 file changed, 5 insertions(+)
include/configs/qemu-arm.h +5 -0
@@ -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
PATCH 1/1 arm: qemu: fix failure in flash initialization if booting from TF-A
Quoted 20 lines · AKASHI Takahiro
If U-Boot is loaded and started from TF-A (you need to change
SYS_TEXT_BASEto0x60000000), 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.
Quoted 6 lines
NOTE: you will not have to modify
SYS_TEXT_BASEany more once Yamada-san's patch[1] is merged.[1] https://lists.denx.de/pipermail/u-boot/2019-June/374178.html
Signed-off-by AKASHI Takahiro <[email protected]>
Thanks a lot for solving this problem.
CONFIG_TFABOOT is in arch/arm/cpu/armv8/fsl-layerscape/Kconfig. If the configuration option is relevant for more systems, shouldn't it be moved to arch/arm/cpu/armv8/Kconfig (in a separate patch)? In that case we could also adapt the help text and add 'ARM trusted firmware' to make it easier to understand.
Quoted 23 lines
--- include/configs/qemu-arm.h | 5 +++++ 1 file changed, 5 insertions(+)include/configs/qemu-arm.h +5
-0@@ -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 */
PATCH 1/1 arm: qemu: fix failure in flash initialization if booting from TF-A
Quoted 28 lines · Heinrich Schuchardt
Quoted 20 lines · AKASHI Takahiro
If U-Boot is loaded and started from TF-A (you need to change
SYS_TEXT_BASEto0x60000000), 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.
Quoted 6 lines
NOTE: you will not have to modify
SYS_TEXT_BASEany more once Yamada-san's patch[1] is merged.[1] https://lists.denx.de/pipermail/u-boot/2019-June/374178.html
Signed-off-by AKASHI Takahiro <[email protected]>
Quoted 7 lines
Thanks a lot for solving this problem.
CONFIG_TFABOOTis inarch/arm/cpu/armv8/fsl-layerscape/Kconfig. If the configuration option is relevant for more systems, shouldn't it be moved toarch/arm/cpu/armv8/Kconfig(in a separate patch)? In that case we could also adapt the help text and add 'ARM trusted firmware' to make it easier to understand.
Yeah, agree, but I was afraid that not all the arm platform will enable TF-A boot with this configuration. So it would be better to add one more new CONFIG:
config SUPPORT_TFABOOT
bool
config ARCH_QEMU
select SUPPORT_TFABOOT
config FSL_LAYERSCAPE
select SUPPORT_TFABOOT
config TFABOOT
depends on SUPPORT_TFABOOT
Thanks,
-Takahiro Akashi
Quoted 26 lines
Tested-by Heinrich Schuchardt <[email protected]>Quoted 23 lines
--- include/configs/qemu-arm.h | 5 +++++ 1 file changed, 5 insertions(+)include/configs/qemu-arm.h +5
-0@@ -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 */
PATCH 1/1 arm: qemu: fix failure in flash initialization if booting from TF-A
In reply to AKASHI TakahiroAKASHI-san,
Quoted 18 lines · AKASHI Takahiro
If U-Boot is loaded and started from TF-A (you need to change
SYS_TEXT_BASEto0x60000000), 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 7 lines
As a result, flash_init()/flash_get_size() will eventually fail. With this patch applied, relevant CONFIG values are modified.
NOTE: you will not have to modify
SYS_TEXT_BASEany more once Yamada-san's patch[1] is merged.[1] https://lists.denx.de/pipermail/u-boot/2019-June/374178.html
No. My patch is unrelated.
You are talking about CONFIG_POSITION_INDEPENDENT, and you can enable it irrespective of my work.
Signature · 2 lines
Best Regards Masahiro Yamada
PATCH 1/1 arm: qemu: fix failure in flash initialization if booting from TF-A
Yamada-san,
Quoted 28 lines · Masahiro Yamada
AKASHI-san,
Quoted 24 lines · AKASHI Takahiro
If U-Boot is loaded and started from TF-A (you need to change
SYS_TEXT_BASEto0x60000000), 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.
NOTE: you will not have to modify
SYS_TEXT_BASEany more once Yamada-san's patch[1] is merged.
Quoted 6 lines
Quoted 1 line
[1] https://lists.denx.de/pipermail/u-boot/2019-June/374178.html
No. My patch is unrelated.
You are talking about
CONFIG_POSITION_INDEPENDENT, and you can enable it irrespective of my work.
Yes, I confirmed this. I might have already enabled this config before I created/tested my patch.
I will drop this reference from the commit message.
Thanks,
-Takahiro Akashi
Quoted 4 lines
Signature · 3 lines
-- Best Regards Masahiro Yamada
PATCH 1/1 arm: qemu: fix failure in flash initialization if booting from TF-A
Quoted 37 lines · AKASHI Takahiro
Yamada-san,
Quoted 34 lines · Masahiro Yamada
AKASHI-san,
Quoted 18 lines · AKASHI Takahiro
If U-Boot is loaded and started from TF-A (you need to change
SYS_TEXT_BASEto0x60000000), 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 7 lines
As a result, flash_init()/flash_get_size() will eventually fail. With this patch applied, relevant CONFIG values are modified.
NOTE: you will not have to modify
SYS_TEXT_BASEany more once Yamada-san's patch[1] is merged.[1] https://lists.denx.de/pipermail/u-boot/2019-June/374178.html
No. My patch is unrelated.
You are talking about
CONFIG_POSITION_INDEPENDENT, and you can enable it irrespective of my work.
I have tested now with this patch and qemu_arm64_config and the following settingss:
CONFIG_SYS_TEXT_BASE=0x00000000CONFIG_POSITION_INDEPENDENT=yCONFIG_TFABOOT=y
and U-Boot runs fine.
Unfortunately in my TF-A build PSCI reset does not work. Do you know how to enable that?
resetting ...
INFO: PSCI Power Domain Map: INFO: Domain Node : Level 1, parent_node -1, State ON (0x0) INFO: Domain Node : Level 1, parent_node -1, State OFF (0x2) INFO: CPU Node : MPID 0x0, parent_node 0, State ON (0x0) INFO: CPU Node : MPID 0xffffffffffffffff, parent_node 0, State OFF
(0x2)
INFO: CPU Node : MPID 0xffffffffffffffff, parent_node 0, State OFF
(0x2)
INFO: CPU Node : MPID 0xffffffffffffffff, parent_node 0, State OFF
(0x2)
INFO: CPU Node : MPID 0xffffffffffffffff, parent_node 1, State OFF
(0x2)
INFO: CPU Node : MPID 0xffffffffffffffff, parent_node 1, State OFF
(0x2)
INFO: CPU Node : MPID 0xffffffffffffffff, parent_node 1, State OFF
(0x2)
INFO: CPU Node : MPID 0xffffffffffffffff, parent_node 1, State OFF
(0x2)
ERROR: QEMU System Reset: operation not handled.
BACKTRACE: START: qemu_system_reset
0: EL3: 0xe0435dc
1: EL3: 0xe04082c
2: EL3: 0xe042e78
3: EL3: 0xe0429a8
4: EL3: 0xe04104c
5: EL3: 0xe044dfc
BACKTRACE: END: qemu_system_reset
QEMU: Terminated
Best regards
Heinrich
Quoted 13 lines
Yes, I confirmed this. I might have already enabled this config before I created/tested my patch.
I will drop this reference from the commit message.Thanks,
-Takahiro AkashiQuoted 4 lines
--
Best Regards
Masahiro Yamada