[U-Boot] [PATCH 09/13] serial: Remove DM_FLAG_PRE_RELOC flag in various drivers
Igor Opaniuk
igor.opaniuk at linaro.org
Mon Dec 10 17:26:23 UTC 2018
Hi Bin,
This particular commit leads to a constant Poplar board restart (git
bisect pointed to it).
U-boot is built with the default poplar_config from the latest master
(btw, is uses r), and U-boot is used as default BL33 image (setup:
vanilla ATF + vanilla OP-TEE(BL32, S-EL1 payload) + U-boot).
When BL32 (OP-TEE) tries to make a switch to non-secure bootloader, it
leads to restart (I'll compile ATF with verbose output and send you
more details if there are any):
=====================================
I/TC: OP-TEE version: 3.3.0-110-g7309438-dev #1 понеділок, 10 грудня
2018 12:53:15 +0000 aarch64
D/TC:0 0 check_ta_store:529 TA store: "early TA"
D/TC:0 0 check_ta_store:529 TA store: "Secure Storage TA"
D/TC:0 0 check_ta_store:529 TA store: "REE"
D/TC:0 0 early_ta_init:225 Early TA
023f8f1a-292a-432b-8fc4-de8471358067 size 21735 (compressed,
uncompressed 99680)
D/TC:0 0 mobj_mapped_shm_init:709 Shared memory address range: 4000000, 6000000
I/TC: Initialized
D/TC:0 0 init_primary_helper:1033 Primary CPU switching to normal world boot
Bootrom start
Boot Media: eMMC
Entry usb bootstrap
USB: Recv CC:4
Usb disk(1):
====================================
btw, for Poplar board serial_pl01x driver is used.
Could you please provide (I just started digging into your patch
series) your ideas why it can happen?
Thanks
On Wed, 24 Oct 2018 at 16:38, Bin Meng <bmeng.cn at gmail.com> wrote:
>
> When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be
> bound before relocation. However due to a bug in the DM core,
> the flag only takes effect when devices are statically declared
> via U_BOOT_DEVICE(). This bug has been fixed recently by commit
> "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in
> lists_bind_fdt()", but with the fix, it has a side effect that
> all existing drivers that declared DM_FLAG_PRE_RELOC flag will
> be bound before relocation now. This may expose potential boot
> failure on some boards due to insufficient memory during the
> pre-relocation stage.
>
> To mitigate this potential impact, the following changes are
> implemented:
>
> - Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver
> only supports configuration from device tree (OF_CONTROL)
> - Keep DM_FLAG_PRE_RELOC flag in the driver only if the device
> is statically declared via U_BOOT_DEVICE()
> - Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for
> drivers that support both statically declared devices and
> configuration from device tree
>
> Signed-off-by: Bin Meng <bmeng.cn at gmail.com>
> ---
>
> drivers/serial/altera_jtag_uart.c | 1 -
> drivers/serial/altera_uart.c | 1 -
> drivers/serial/arm_dcc.c | 1 -
> drivers/serial/atmel_usart.c | 2 ++
> drivers/serial/ns16550.c | 2 ++
> drivers/serial/serial_ar933x.c | 1 -
> drivers/serial/serial_arc.c | 1 -
> drivers/serial/serial_bcm283x_mu.c | 2 ++
> drivers/serial/serial_bcm283x_pl011.c | 2 ++
> drivers/serial/serial_bcm6345.c | 1 -
> drivers/serial/serial_efi.c | 1 -
> drivers/serial/serial_intel_mid.c | 1 -
> drivers/serial/serial_lpuart.c | 1 -
> drivers/serial/serial_meson.c | 1 -
> drivers/serial/serial_mvebu_a3700.c | 1 -
> drivers/serial/serial_mxc.c | 2 ++
> drivers/serial/serial_omap.c | 2 ++
> drivers/serial/serial_owl.c | 1 -
> drivers/serial/serial_pic32.c | 1 -
> drivers/serial/serial_pl01x.c | 2 ++
> drivers/serial/serial_s5p.c | 1 -
> drivers/serial/serial_sh.c | 2 ++
> drivers/serial/serial_sti_asc.c | 1 -
> drivers/serial/serial_stm32.c | 2 ++
> drivers/serial/serial_xuartlite.c | 1 -
> drivers/serial/serial_zynq.c | 1 -
> 26 files changed, 18 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/serial/altera_jtag_uart.c b/drivers/serial/altera_jtag_uart.c
> index 61052a9..86c3de4 100644
> --- a/drivers/serial/altera_jtag_uart.c
> +++ b/drivers/serial/altera_jtag_uart.c
> @@ -121,7 +121,6 @@ U_BOOT_DRIVER(altera_jtaguart) = {
> .platdata_auto_alloc_size = sizeof(struct altera_jtaguart_platdata),
> .probe = altera_jtaguart_probe,
> .ops = &altera_jtaguart_ops,
> - .flags = DM_FLAG_PRE_RELOC,
> };
>
> #ifdef CONFIG_DEBUG_UART_ALTERA_JTAGUART
> diff --git a/drivers/serial/altera_uart.c b/drivers/serial/altera_uart.c
> index b7b0a13..67d4719 100644
> --- a/drivers/serial/altera_uart.c
> +++ b/drivers/serial/altera_uart.c
> @@ -117,7 +117,6 @@ U_BOOT_DRIVER(altera_uart) = {
> .platdata_auto_alloc_size = sizeof(struct altera_uart_platdata),
> .probe = altera_uart_probe,
> .ops = &altera_uart_ops,
> - .flags = DM_FLAG_PRE_RELOC,
> };
>
> #ifdef CONFIG_DEBUG_UART_ALTERA_UART
> diff --git a/drivers/serial/arm_dcc.c b/drivers/serial/arm_dcc.c
> index 43e8691..dfcb6fd 100644
> --- a/drivers/serial/arm_dcc.c
> +++ b/drivers/serial/arm_dcc.c
> @@ -155,7 +155,6 @@ U_BOOT_DRIVER(serial_dcc) = {
> .id = UCLASS_SERIAL,
> .of_match = arm_dcc_ids,
> .ops = &arm_dcc_ops,
> - .flags = DM_FLAG_PRE_RELOC,
> };
>
> #ifdef CONFIG_DEBUG_UART_ARM_DCC
> diff --git a/drivers/serial/atmel_usart.c b/drivers/serial/atmel_usart.c
> index 9414f5f..aa8cdff 100644
> --- a/drivers/serial/atmel_usart.c
> +++ b/drivers/serial/atmel_usart.c
> @@ -294,7 +294,9 @@ U_BOOT_DRIVER(serial_atmel) = {
> #endif
> .probe = atmel_serial_probe,
> .ops = &atmel_serial_ops,
> +#if !CONFIG_IS_ENABLED(OF_CONTROL)
> .flags = DM_FLAG_PRE_RELOC,
> +#endif
> .priv_auto_alloc_size = sizeof(struct atmel_serial_priv),
> };
> #endif
> diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
> index f9041aa..3c8bc2b 100644
> --- a/drivers/serial/ns16550.c
> +++ b/drivers/serial/ns16550.c
> @@ -473,7 +473,9 @@ U_BOOT_DRIVER(ns16550_serial) = {
> .priv_auto_alloc_size = sizeof(struct NS16550),
> .probe = ns16550_serial_probe,
> .ops = &ns16550_serial_ops,
> +#if !CONFIG_IS_ENABLED(OF_CONTROL)
> .flags = DM_FLAG_PRE_RELOC,
> +#endif
> };
> #endif
> #endif /* SERIAL_PRESENT */
> diff --git a/drivers/serial/serial_ar933x.c b/drivers/serial/serial_ar933x.c
> index e91a5f7..5249c55 100644
> --- a/drivers/serial/serial_ar933x.c
> +++ b/drivers/serial/serial_ar933x.c
> @@ -189,7 +189,6 @@ U_BOOT_DRIVER(serial_ar933x) = {
> .priv_auto_alloc_size = sizeof(struct ar933x_serial_priv),
> .probe = ar933x_serial_probe,
> .ops = &ar933x_serial_ops,
> - .flags = DM_FLAG_PRE_RELOC,
> };
>
> #ifdef CONFIG_DEBUG_UART_AR933X
> diff --git a/drivers/serial/serial_arc.c b/drivers/serial/serial_arc.c
> index 925f0c2..980b38d 100644
> --- a/drivers/serial/serial_arc.c
> +++ b/drivers/serial/serial_arc.c
> @@ -128,7 +128,6 @@ U_BOOT_DRIVER(serial_arc) = {
> .ofdata_to_platdata = arc_serial_ofdata_to_platdata,
> .probe = arc_serial_probe,
> .ops = &arc_serial_ops,
> - .flags = DM_FLAG_PRE_RELOC,
> };
>
> #ifdef CONFIG_DEBUG_ARC_SERIAL
> diff --git a/drivers/serial/serial_bcm283x_mu.c b/drivers/serial/serial_bcm283x_mu.c
> index 1f87f0c..bd1d89e 100644
> --- a/drivers/serial/serial_bcm283x_mu.c
> +++ b/drivers/serial/serial_bcm283x_mu.c
> @@ -199,6 +199,8 @@ U_BOOT_DRIVER(serial_bcm283x_mu) = {
> .platdata_auto_alloc_size = sizeof(struct bcm283x_mu_serial_platdata),
> .probe = bcm283x_mu_serial_probe,
> .ops = &bcm283x_mu_serial_ops,
> +#if !CONFIG_IS_ENABLED(OF_CONTROL)
> .flags = DM_FLAG_PRE_RELOC,
> +#endif
> .priv_auto_alloc_size = sizeof(struct bcm283x_mu_priv),
> };
> diff --git a/drivers/serial/serial_bcm283x_pl011.c b/drivers/serial/serial_bcm283x_pl011.c
> index 54fc9b5..2527bb8 100644
> --- a/drivers/serial/serial_bcm283x_pl011.c
> +++ b/drivers/serial/serial_bcm283x_pl011.c
> @@ -90,6 +90,8 @@ U_BOOT_DRIVER(bcm283x_pl011_uart) = {
> .platdata_auto_alloc_size = sizeof(struct pl01x_serial_platdata),
> .probe = pl01x_serial_probe,
> .ops = &bcm283x_pl011_serial_ops,
> +#if !CONFIG_IS_ENABLED(OF_CONTROL)
> .flags = DM_FLAG_PRE_RELOC,
> +#endif
> .priv_auto_alloc_size = sizeof(struct pl01x_priv),
> };
> diff --git a/drivers/serial/serial_bcm6345.c b/drivers/serial/serial_bcm6345.c
> index ee5d561..a0e709a 100644
> --- a/drivers/serial/serial_bcm6345.c
> +++ b/drivers/serial/serial_bcm6345.c
> @@ -264,7 +264,6 @@ U_BOOT_DRIVER(bcm6345_serial) = {
> .probe = bcm6345_serial_probe,
> .priv_auto_alloc_size = sizeof(struct bcm6345_serial_priv),
> .ops = &bcm6345_serial_ops,
> - .flags = DM_FLAG_PRE_RELOC,
> };
>
> #ifdef CONFIG_DEBUG_UART_BCM6345
> diff --git a/drivers/serial/serial_efi.c b/drivers/serial/serial_efi.c
> index 1b54d18..dd3e511 100644
> --- a/drivers/serial/serial_efi.c
> +++ b/drivers/serial/serial_efi.c
> @@ -152,5 +152,4 @@ U_BOOT_DRIVER(serial_efi) = {
> .priv_auto_alloc_size = sizeof(struct serial_efi_priv),
> .probe = serial_efi_probe,
> .ops = &serial_efi_ops,
> - .flags = DM_FLAG_PRE_RELOC,
> };
> diff --git a/drivers/serial/serial_intel_mid.c b/drivers/serial/serial_intel_mid.c
> index bdb5adb..39bd40e 100644
> --- a/drivers/serial/serial_intel_mid.c
> +++ b/drivers/serial/serial_intel_mid.c
> @@ -64,5 +64,4 @@ U_BOOT_DRIVER(serial_intel_mid) = {
> .priv_auto_alloc_size = sizeof(struct NS16550),
> .probe = mid_serial_probe,
> .ops = &ns16550_serial_ops,
> - .flags = DM_FLAG_PRE_RELOC,
> };
> diff --git a/drivers/serial/serial_lpuart.c b/drivers/serial/serial_lpuart.c
> index 1212b72..816cedd 100644
> --- a/drivers/serial/serial_lpuart.c
> +++ b/drivers/serial/serial_lpuart.c
> @@ -455,5 +455,4 @@ U_BOOT_DRIVER(serial_lpuart) = {
> .platdata_auto_alloc_size = sizeof(struct lpuart_serial_platdata),
> .probe = lpuart_serial_probe,
> .ops = &lpuart_serial_ops,
> - .flags = DM_FLAG_PRE_RELOC,
> };
> diff --git a/drivers/serial/serial_meson.c b/drivers/serial/serial_meson.c
> index dbb8537..b3dad77 100644
> --- a/drivers/serial/serial_meson.c
> +++ b/drivers/serial/serial_meson.c
> @@ -132,7 +132,6 @@ U_BOOT_DRIVER(serial_meson) = {
> .of_match = meson_serial_ids,
> .probe = meson_serial_probe,
> .ops = &meson_serial_ops,
> - .flags = DM_FLAG_PRE_RELOC,
> .ofdata_to_platdata = meson_serial_ofdata_to_platdata,
> .platdata_auto_alloc_size = sizeof(struct meson_serial_platdata),
> };
> diff --git a/drivers/serial/serial_mvebu_a3700.c b/drivers/serial/serial_mvebu_a3700.c
> index ce26d2b..7e4cd6c 100644
> --- a/drivers/serial/serial_mvebu_a3700.c
> +++ b/drivers/serial/serial_mvebu_a3700.c
> @@ -129,7 +129,6 @@ U_BOOT_DRIVER(serial_mvebu) = {
> .platdata_auto_alloc_size = sizeof(struct mvebu_platdata),
> .probe = mvebu_serial_probe,
> .ops = &mvebu_serial_ops,
> - .flags = DM_FLAG_PRE_RELOC,
> };
>
> #ifdef CONFIG_DEBUG_MVEBU_A3700_UART
> diff --git a/drivers/serial/serial_mxc.c b/drivers/serial/serial_mxc.c
> index 4f1f822..2cc63da 100644
> --- a/drivers/serial/serial_mxc.c
> +++ b/drivers/serial/serial_mxc.c
> @@ -353,7 +353,9 @@ U_BOOT_DRIVER(serial_mxc) = {
> #endif
> .probe = mxc_serial_probe,
> .ops = &mxc_serial_ops,
> +#if !CONFIG_IS_ENABLED(OF_CONTROL)
> .flags = DM_FLAG_PRE_RELOC,
> +#endif
> };
> #endif
>
> diff --git a/drivers/serial/serial_omap.c b/drivers/serial/serial_omap.c
> index af3c755..ee6ad9c 100644
> --- a/drivers/serial/serial_omap.c
> +++ b/drivers/serial/serial_omap.c
> @@ -121,7 +121,9 @@ U_BOOT_DRIVER(omap_serial) = {
> .priv_auto_alloc_size = sizeof(struct NS16550),
> .probe = ns16550_serial_probe,
> .ops = &ns16550_serial_ops,
> +#if !CONFIG_IS_ENABLED(OF_CONTROL)
> .flags = DM_FLAG_PRE_RELOC,
> +#endif
> };
> #endif
> #endif /* DM_SERIAL */
> diff --git a/drivers/serial/serial_owl.c b/drivers/serial/serial_owl.c
> index 6fd97e2..7ead73e 100644
> --- a/drivers/serial/serial_owl.c
> +++ b/drivers/serial/serial_owl.c
> @@ -132,5 +132,4 @@ U_BOOT_DRIVER(serial_owl) = {
> .priv_auto_alloc_size = sizeof(struct owl_serial_priv),
> .probe = owl_serial_probe,
> .ops = &owl_serial_ops,
> - .flags = DM_FLAG_PRE_RELOC,
> };
> diff --git a/drivers/serial/serial_pic32.c b/drivers/serial/serial_pic32.c
> index ba73978..84600b1 100644
> --- a/drivers/serial/serial_pic32.c
> +++ b/drivers/serial/serial_pic32.c
> @@ -176,7 +176,6 @@ U_BOOT_DRIVER(pic32_serial) = {
> .of_match = pic32_uart_ids,
> .probe = pic32_uart_probe,
> .ops = &pic32_uart_ops,
> - .flags = DM_FLAG_PRE_RELOC,
> .priv_auto_alloc_size = sizeof(struct pic32_uart_priv),
> };
>
> diff --git a/drivers/serial/serial_pl01x.c b/drivers/serial/serial_pl01x.c
> index 2a5f256..12512f6 100644
> --- a/drivers/serial/serial_pl01x.c
> +++ b/drivers/serial/serial_pl01x.c
> @@ -363,7 +363,9 @@ U_BOOT_DRIVER(serial_pl01x) = {
> .platdata_auto_alloc_size = sizeof(struct pl01x_serial_platdata),
> .probe = pl01x_serial_probe,
> .ops = &pl01x_serial_ops,
> +#if !CONFIG_IS_ENABLED(OF_CONTROL)
> .flags = DM_FLAG_PRE_RELOC,
> +#endif
> .priv_auto_alloc_size = sizeof(struct pl01x_priv),
> };
>
> diff --git a/drivers/serial/serial_s5p.c b/drivers/serial/serial_s5p.c
> index faea6d4..e3160cf 100644
> --- a/drivers/serial/serial_s5p.c
> +++ b/drivers/serial/serial_s5p.c
> @@ -211,7 +211,6 @@ U_BOOT_DRIVER(serial_s5p) = {
> .platdata_auto_alloc_size = sizeof(struct s5p_serial_platdata),
> .probe = s5p_serial_probe,
> .ops = &s5p_serial_ops,
> - .flags = DM_FLAG_PRE_RELOC,
> };
> #endif
>
> diff --git a/drivers/serial/serial_sh.c b/drivers/serial/serial_sh.c
> index b153498..c934d5f 100644
> --- a/drivers/serial/serial_sh.c
> +++ b/drivers/serial/serial_sh.c
> @@ -247,7 +247,9 @@ U_BOOT_DRIVER(serial_sh) = {
> .platdata_auto_alloc_size = sizeof(struct sh_serial_platdata),
> .probe = sh_serial_probe,
> .ops = &sh_serial_ops,
> +#if !CONFIG_IS_ENABLED(OF_CONTROL)
> .flags = DM_FLAG_PRE_RELOC,
> +#endif
> .priv_auto_alloc_size = sizeof(struct uart_port),
> };
>
> diff --git a/drivers/serial/serial_sti_asc.c b/drivers/serial/serial_sti_asc.c
> index 5dfc617..c972f1e 100644
> --- a/drivers/serial/serial_sti_asc.c
> +++ b/drivers/serial/serial_sti_asc.c
> @@ -205,6 +205,5 @@ U_BOOT_DRIVER(serial_sti_asc) = {
> .ops = &sti_asc_serial_ops,
> .probe = sti_asc_serial_probe,
> .priv_auto_alloc_size = sizeof(struct sti_asc_serial),
> - .flags = DM_FLAG_PRE_RELOC,
> };
>
> diff --git a/drivers/serial/serial_stm32.c b/drivers/serial/serial_stm32.c
> index 66e02d5..31b43ee 100644
> --- a/drivers/serial/serial_stm32.c
> +++ b/drivers/serial/serial_stm32.c
> @@ -230,7 +230,9 @@ U_BOOT_DRIVER(serial_stm32) = {
> .platdata_auto_alloc_size = sizeof(struct stm32x7_serial_platdata),
> .ops = &stm32_serial_ops,
> .probe = stm32_serial_probe,
> +#if !CONFIG_IS_ENABLED(OF_CONTROL)
> .flags = DM_FLAG_PRE_RELOC,
> +#endif
> };
>
> #ifdef CONFIG_DEBUG_UART_STM32
> diff --git a/drivers/serial/serial_xuartlite.c b/drivers/serial/serial_xuartlite.c
> index cead3c6..1be777b 100644
> --- a/drivers/serial/serial_xuartlite.c
> +++ b/drivers/serial/serial_xuartlite.c
> @@ -109,7 +109,6 @@ U_BOOT_DRIVER(serial_uartlite) = {
> .platdata_auto_alloc_size = sizeof(struct uartlite_platdata),
> .probe = uartlite_serial_probe,
> .ops = &uartlite_serial_ops,
> - .flags = DM_FLAG_PRE_RELOC,
> };
>
> #ifdef CONFIG_DEBUG_UART_UARTLITE
> diff --git a/drivers/serial/serial_zynq.c b/drivers/serial/serial_zynq.c
> index f689015..7e486a6 100644
> --- a/drivers/serial/serial_zynq.c
> +++ b/drivers/serial/serial_zynq.c
> @@ -210,7 +210,6 @@ U_BOOT_DRIVER(serial_zynq) = {
> .platdata_auto_alloc_size = sizeof(struct zynq_uart_platdata),
> .probe = zynq_serial_probe,
> .ops = &zynq_serial_ops,
> - .flags = DM_FLAG_PRE_RELOC,
> };
>
> #ifdef CONFIG_DEBUG_UART_ZYNQ
> --
> 2.7.4
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot
--
Regards,
Igor Opaniuk
More information about the U-Boot
mailing list