Re: [PATCH 5.10 75/91] net: fec: limit register access on i.MX6UL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

> Using 'ethtool -d […]' on an i.MX6UL leads to a kernel crash:
> 
>    Unhandled fault: external abort on non-linefetch (0x1008) at […]
> 
> due to this SoC has less registers in its FEC implementation compared to other
> i.MX6 variants. Thus, a run-time decision is required to avoid access to
> non-existing registers.

Ok, but the code is rather creative:

> @@ -2275,7 +2300,24 @@ static void fec_enet_get_regs(struct net_device *ndev,
>  	u32 *buf = (u32 *)regbuf;
>  	u32 i, off;
>  	int ret;
> +#if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) || \
> +	defined(CONFIG_M520x) || defined(CONFIG_M532x) || defined(CONFIG_ARM) || \
> +	defined(CONFIG_ARM64) || defined(CONFIG_COMPILE_TEST)
> +	u32 *reg_list;
> +	u32 reg_cnt;
>  
> +	if (!of_machine_is_compatible("fsl,imx6ul")) {
> +		reg_list = fec_enet_register_offset;
> +		reg_cnt = ARRAY_SIZE(fec_enet_register_offset);
> +	} else {
> +		reg_list = fec_enet_register_offset_6ul;
> +		reg_cnt = ARRAY_SIZE(fec_enet_register_offset_6ul);
> +	}
> +#else
> +	/* coldfire */
> +	static u32 *reg_list = fec_enet_register_offset;
> +	static const u32 reg_cnt = ARRAY_SIZE(fec_enet_register_offset);
> +#endif

First, COMPILE_TEST now changes behaviour of the code, which is
unexpected. I guess coldfire machine with
of_machine_is_compatible("fsl,imx6ul") == true is not probable, but
still.

Second reg_list is static, which is quite confusing. I guess that was
attempt to enable compiler optimalizations, but I don't think compiler
needs this much help.

Best regards,
								Pavel
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux