Re: Issue with booting multi_v5_defconfig kernel with GCC 11

From: Arnd Bergmann
Date: Thu Dec 23 2021 - 16:48:58 EST


On Thu, Dec 23, 2021 at 6:58 PM Nathan Chancellor <nathan@xxxxxxxxxx> wrote:

> da850_evm_config_emac: soc_info: c0dd7288
> da850_evm_config_emac: emac_pdata: 00000000
>
> I don't really see how that is possible, as I can see this member
> assigned in the davinci_soc_info_* variables but maybe there is some
> race during initialization or problem because the QEMU machine is not
> one of these machines?

Right, the problem is that da850_evm_config_emac() gets called
unconditionally for all machines, but davinci_soc_info only gets
populated on davinci machines.

> I think that the GCC commit just makes it so that the rmii_en member is
> read earlier, rather than at the point of use.
>
> Regardless, something like this resolves this panic for me but I have no
> idea if it is proper or not, hence just the report :)
>
> diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
> index 428012687a80..7f7f6bae21c2 100644
> --- a/arch/arm/mach-davinci/board-da850-evm.c
> +++ b/arch/arm/mach-davinci/board-da850-evm.c
> @@ -1101,11 +1101,13 @@ static int __init da850_evm_config_emac(void)
> int ret;
> u32 val;
> struct davinci_soc_info *soc_info = &davinci_soc_info;
> - u8 rmii_en = soc_info->emac_pdata->rmii_en;
> + u8 rmii_en;
>
> if (!machine_is_davinci_da850_evm())
> return 0;
>
> + rmii_en = soc_info->emac_pdata->rmii_en;
> +
> cfg_chip3_base = DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG);
>
> val = __raw_readl(cfg_chip3_base);
>

This is the correct fix.

Fixes: bae105879f2f ("davinci: DA850/OMAP-L138 EVM: implement
autodetect of RMII PHY")
Reviewed-by: Arnd Bergmann <arnd@xxxxxxxx>