* [U-Boot] [PATCH] arm: qemu: fix failure in flash initialization if booting from TF-A
@ 2019-06-27 1:09 AKASHI Takahiro
2019-06-27 4:50 ` Heinrich Schuchardt
2019-06-27 8:10 ` Masahiro Yamada
0 siblings, 2 replies; 6+ messages in thread
From: AKASHI Takahiro @ 2019-06-27 1:09 UTC (permalink / raw)
To: u-boot
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
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
---
include/configs/qemu-arm.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/include/configs/qemu-arm.h b/include/configs/qemu-arm.h
index 65fdb1e92981..35e3c5ad7a8d 100644
--- a/include/configs/qemu-arm.h
+++ b/include/configs/qemu-arm.h
@@ -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 */
--
2.21.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] arm: qemu: fix failure in flash initialization if booting from TF-A
2019-06-27 1:09 [U-Boot] [PATCH] arm: qemu: fix failure in flash initialization if booting from TF-A AKASHI Takahiro
@ 2019-06-27 4:50 ` Heinrich Schuchardt
2019-06-27 5:25 ` AKASHI Takahiro
2019-06-27 8:10 ` Masahiro Yamada
1 sibling, 1 reply; 6+ messages in thread
From: Heinrich Schuchardt @ 2019-06-27 4:50 UTC (permalink / raw)
To: u-boot
On 6/27/19 3:09 AM, AKASHI Takahiro wrote:
> 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
>
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
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.
Tested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
> include/configs/qemu-arm.h | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/include/configs/qemu-arm.h b/include/configs/qemu-arm.h
> index 65fdb1e92981..35e3c5ad7a8d 100644
> --- a/include/configs/qemu-arm.h
> +++ b/include/configs/qemu-arm.h
> @@ -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 */
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] arm: qemu: fix failure in flash initialization if booting from TF-A
2019-06-27 4:50 ` Heinrich Schuchardt
@ 2019-06-27 5:25 ` AKASHI Takahiro
0 siblings, 0 replies; 6+ messages in thread
From: AKASHI Takahiro @ 2019-06-27 5:25 UTC (permalink / raw)
To: u-boot
On Thu, Jun 27, 2019 at 06:50:55AM +0200, Heinrich Schuchardt wrote:
> On 6/27/19 3:09 AM, AKASHI Takahiro wrote:
> >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
> >
> >Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
>
> 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.
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
> Tested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
>
> >---
> > include/configs/qemu-arm.h | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> >diff --git a/include/configs/qemu-arm.h b/include/configs/qemu-arm.h
> >index 65fdb1e92981..35e3c5ad7a8d 100644
> >--- a/include/configs/qemu-arm.h
> >+++ b/include/configs/qemu-arm.h
> >@@ -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 */
> >
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] arm: qemu: fix failure in flash initialization if booting from TF-A
2019-06-27 1:09 [U-Boot] [PATCH] arm: qemu: fix failure in flash initialization if booting from TF-A AKASHI Takahiro
2019-06-27 4:50 ` Heinrich Schuchardt
@ 2019-06-27 8:10 ` Masahiro Yamada
2019-06-27 8:40 ` AKASHI Takahiro
1 sibling, 1 reply; 6+ messages in thread
From: Masahiro Yamada @ 2019-06-27 8:10 UTC (permalink / raw)
To: u-boot
AKASHI-san,
On Thu, Jun 27, 2019 at 10:08 AM AKASHI Takahiro
<takahiro.akashi@linaro.org> wrote:
>
> 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
No. My patch is unrelated.
You are talking about CONFIG_POSITION_INDEPENDENT,
and you can enable it irrespective of my work.
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] arm: qemu: fix failure in flash initialization if booting from TF-A
2019-06-27 8:10 ` Masahiro Yamada
@ 2019-06-27 8:40 ` AKASHI Takahiro
2019-06-28 5:56 ` Heinrich Schuchardt
0 siblings, 1 reply; 6+ messages in thread
From: AKASHI Takahiro @ 2019-06-27 8:40 UTC (permalink / raw)
To: u-boot
Yamada-san,
On Thu, Jun 27, 2019 at 05:10:37PM +0900, Masahiro Yamada wrote:
> AKASHI-san,
>
> On Thu, Jun 27, 2019 at 10:08 AM AKASHI Takahiro
> <takahiro.akashi@linaro.org> wrote:
> >
> > 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
>
> 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
>
> --
> Best Regards
> Masahiro Yamada
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] arm: qemu: fix failure in flash initialization if booting from TF-A
2019-06-27 8:40 ` AKASHI Takahiro
@ 2019-06-28 5:56 ` Heinrich Schuchardt
0 siblings, 0 replies; 6+ messages in thread
From: Heinrich Schuchardt @ 2019-06-28 5:56 UTC (permalink / raw)
To: u-boot
On 6/27/19 10:40 AM, AKASHI Takahiro wrote:
> Yamada-san,
>
> On Thu, Jun 27, 2019 at 05:10:37PM +0900, Masahiro Yamada wrote:
>> AKASHI-san,
>>
>> On Thu, Jun 27, 2019 at 10:08 AM AKASHI Takahiro
>> <takahiro.akashi@linaro.org> wrote:
>>>
>>> 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
>>
>> 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=0x00000000
CONFIG_POSITION_INDEPENDENT=y
CONFIG_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
>
> 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
>
>>
>> --
>> Best Regards
>> Masahiro Yamada
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-06-28 5:56 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-27 1:09 [U-Boot] [PATCH] arm: qemu: fix failure in flash initialization if booting from TF-A AKASHI Takahiro
2019-06-27 4:50 ` Heinrich Schuchardt
2019-06-27 5:25 ` AKASHI Takahiro
2019-06-27 8:10 ` Masahiro Yamada
2019-06-27 8:40 ` AKASHI Takahiro
2019-06-28 5:56 ` Heinrich Schuchardt
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.