Fix imx6ull/6ulz boot crash
Subsystems (3)
cover Fix imx6ull/6ulz boot crash
These chips currently crash on boot while attempting to read SOC serial number. Fix in two stages:
* Fix ocotp lookup crash on failure
* Fix ocotp lookup failure
Leonard Crestez (2):
ARM: imx: Fix boot crash if ocotp is not found
ARM: imx: Fix ocotp_compat for 6ull/6ulz
arch/arm/mach-imx/cpu.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
Signature · 7 lines
2.17.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 1/2 ARM: imx: Fix boot crash if ocotp is not found
The imx_soc_device_init functions tries to fetch the ocotp regmap in order to soc serial number. If regmap fetch fails then a message is printed but regmap_read is called anyway and the system crashes.
Failing to lookup ocotp regmap shouldn't be a fatal boot error so check that the pointer is valid.
Only side-effect of ocotp lookup failure now is that serial number will be reported as all-zeros which is acceptable.
--- arch/arm/mach-imx/cpu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/mach-imx/cpu.c +3 -1
@@ -87,11 +87,11 @@ struct device * __init imx_soc_device_init(void) {struct soc_device_attribute *soc_dev_attr;const char *ocotp_compat =NULL ;struct soc_device *soc_dev;struct device_node *root; -struct regmap *ocotp; +struct regmap *ocotp =NULL ;const char *soc_id;u64 soc_uid =0 ;u32 val;int ret;
@@ -179,11 +179,13 @@ struct device * __init imx_soc_device_init(void)if (ocotp_compat) { ocotp =syscon_regmap_lookup_by_compatible (ocotp_compat);if (IS_ERR (ocotp))pr_err ("%s: failed to find %s regmap!\n" , __func__, ocotp_compat); + } +if (!IS_ERR_OR_NULL (ocotp)) {if (__mxc_cpu_type ==MXC_CPU_IMX7ULP ) {regmap_read (ocotp,OCOTP_ULP_UID_4 , &val); soc_uid = val &0xffff ;regmap_read (ocotp,OCOTP_ULP_UID_3 , &val); soc_uid <<=16 ;
Signature · 7 lines
2.17.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH 1/2] ARM: imx: Fix boot crash if ocotp is not found
From: Leonard Crestez <[email protected]>
Sent: Tuesday, December 10, 2019 10:49 PM
Quoted 39 lines
The
imx_soc_device_initfunctions tries to fetch the ocotp regmap in order to soc serial number. If regmap fetch fails then a message is printed butregmap_readis called anyway and the system crashes.Failing to lookup ocotp regmap shouldn't be a fatal boot error so check that the pointer is valid.
Only side-effect of ocotp lookup failure now is that serial number will be reported as all-zeros which is acceptable.
Fixes 8267ff89b713 ("ARM: imx: Add serial number support for i.MX6/7 SoCs")Signed-off-by Leonard Crestez <[email protected]>--- arch/arm/mach-imx/cpu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)arch/arm/mach-imx/cpu.c +1
-1@@ -87,11 +87,11 @@ struct device * __init imx_soc_device_init(void) {struct soc_device_attribute *soc_dev_attr;const char *ocotp_compat =NULL ;struct soc_device *soc_dev;struct device_node *root; -struct regmap *ocotp; +struct regmap *ocotp =NULL ;const char *soc_id;u64 soc_uid =0 ;u32 val;int ret;@@ -179,11 +179,13 @@ struct device * __init imx_soc_device_init(void)if (ocotp_compat) { ocotp =syscon_regmap_lookup_by_compatible (ocotp_compat);
arch/arm/mach-imx/cpu.c struct device * __init imx_soc_device_init(void) · line 191
Quoted 10 lines
arch/arm/mach-imx/cpu.c +2
-0if (IS_ERR (ocotp))pr_err ("%s: failed to find %s regmap!\n" , __func__, ocotp_compat); + } +if (!IS_ERR_OR_NULL (ocotp)) {if (__mxc_cpu_type ==MXC_CPU_IMX7ULP ) {regmap_read (ocotp,OCOTP_ULP_UID_4 , &val); soc_uid = val &0xffff ;regmap_read (ocotp,OCOTP_ULP_UID_3 , &val); soc_uid <<=16 ;
Best regards,
Christoph
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH 1/2] ARM: imx: Fix boot crash if ocotp is not found
In reply to Leonard CrestezQuoted 7 lines · Leonard Crestez
The
imx_soc_device_initfunctions tries to fetch the ocotp regmap in order to soc serial number. If regmap fetch fails then a message is printed butregmap_readis called anyway and the system crashes.Failing to lookup ocotp regmap shouldn't be a fatal boot error so check that the pointer is valid.
Quoted 6 lines
Only side-effect of ocotp lookup failure now is that serial number will be reported as all-zeros which is acceptable.
Fixes 8267ff89b713 ("ARM: imx: Add serial number support for i.MX6/7 SoCs")Signed-off-by Leonard Crestez <[email protected]>
As this is a fix we want it in 5.5-rc, it should be generated against 5.5-rc1 rather than -next. I rebased it and applied, thanks.
Shawn
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 2/2 ARM: imx: Fix ocotp_compat for 6ull/6ulz
In reply to Leonard CrestezThe ocotp compatible string on imx6ull and imx6ulz is currently "fsl,imx6ull-ocotp" but the imx_soc_device_init function attempts to lookup for "fsl,imx6ul-ocotp" (single L).
Fix the constant and make cat /sys/devices/soc0/serial_number print useful information instead of all-zeros.
--- arch/arm/mach-imx/cpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-imx/cpu.c +2 -2
@@ -151,15 +151,15 @@ struct device * __init imx_soc_device_init(void)case MXC_CPU_IMX6UL : ocotp_compat ="fsl,imx6ul-ocotp" ; soc_id ="i.MX6UL" ;break ;case MXC_CPU_IMX6ULL : - ocotp_compat ="fsl,imx6ul-ocotp" ; + ocotp_compat ="fsl,imx6ull-ocotp" ; soc_id ="i.MX6ULL" ;break ;case MXC_CPU_IMX6ULZ : - ocotp_compat ="fsl,imx6ul-ocotp" ; + ocotp_compat ="fsl,imx6ull-ocotp" ; soc_id ="i.MX6ULZ" ;break ;case MXC_CPU_IMX6SLL : ocotp_compat ="fsl,imx6sll-ocotp" ; soc_id ="i.MX6SLL" ;
Signature · 7 lines
2.17.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Fabio Estevam
reviewerRe: [PATCH 2/2] ARM: imx: Fix ocotp_compat for 6ull/6ulz
Quoted 10 lines · Leonard Crestez
The ocotp compatible string on imx6ull and imx6ulz is currently "fsl,imx6ull-ocotp" but the
imx_soc_device_initfunction attempts to lookup for "fsl,imx6ul-ocotp" (single L).Fix the constant and make cat
/sys/devices/soc0/serial_numberprint useful information instead of all-zeros.Fixes 8267ff89b713 ("ARM: imx: Add serial number support for i.MX6/7 SoCs")Signed-off-by Leonard Crestez <[email protected]>
This fix has already been submitted by Christoph:
http://lists.infradead.org/pipermail/linux-arm-kernel/2019-December/697761.html
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH 2/2] ARM: imx: Fix ocotp_compat for 6ull/6ulz
Quoted 6 lines · Fabio Estevam
Quoted 5 lines · Leonard Crestez
The ocotp compatible string on imx6ull and imx6ulz is currently "fsl,imx6ull-ocotp" but the
imx_soc_device_initfunction attempts to lookup for "fsl,imx6ul-ocotp" (single L).
Quoted 7 lines
Quoted 5 lines
Fix the constant and make cat
/sys/devices/soc0/serial_numberprint useful information instead of all-zeros.Fixes 8267ff89b713 ("ARM: imx: Add serial number support for i.MX6/7 SoCs")Signed-off-by Leonard Crestez <[email protected]>This fix has already been submitted by Christoph:
Sorry, didn't notice.
My [PATCH 1/2] is still relevant though: for example the kernel could run against a very old DTB or maybe there's some other scenario where ocotp regmap lookup could fail.
--
Regards,
Leonard
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
RE: [PATCH 2/2] ARM: imx: Fix ocotp_compat for 6ull/6ulz
In reply to Leonard CrestezFrom: Leonard Crestez <[email protected]>
Sent: Tuesday, December 10, 2019 10:49 PM
Quoted 26 lines
The ocotp compatible string on imx6ull and imx6ulz is currently "fsl,imx6ull-ocotp" but the
imx_soc_device_initfunction attempts to lookup for "fsl,imx6ul-ocotp" (single L).Fix the constant and make cat
/sys/devices/soc0/serial_numberprint useful information instead of all-zeros.Fixes 8267ff89b713 ("ARM: imx: Add serial number support for i.MX6/7 SoCs")Signed-off-by Leonard Crestez <[email protected]>--- arch/arm/mach-imx/cpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)arch/arm/mach-imx/cpu.c +1
-1@@ -151,15 +151,15 @@ struct device * __init imx_soc_device_init(void)case MXC_CPU_IMX6UL : ocotp_compat ="fsl,imx6ul-ocotp" ; soc_id ="i.MX6UL" ;break ;case MXC_CPU_IMX6ULL : - ocotp_compat ="fsl,imx6ul-ocotp" ; + ocotp_compat ="fsl,imx6ull-ocotp" ;
arch/arm/mach-imx/cpu.c struct device * __init imx_soc_device_init(void) · line 165
Quoted 10 lines
arch/arm/mach-imx/cpu.c +1
-1soc_id ="i.MX6ULL" ;break ;case MXC_CPU_IMX6ULZ : - ocotp_compat ="fsl,imx6ul-ocotp" ; + ocotp_compat ="fsl,imx6ull-ocotp" ; soc_id ="i.MX6ULZ" ;break ;case MXC_CPU_IMX6SLL : ocotp_compat ="fsl,imx6sll-ocotp" ; soc_id ="i.MX6SLL" ;
I also had this problem and therefore already submitted a patch ("ARM: imx: Correct ocotp id for serial number support of i.MX6ULL/ULZ SoCs"). I hope this isn't a problem.
Best regards,
Christoph
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH 2/2] ARM: imx: Fix ocotp_compat for 6ull/6ulz
Quoted 34 lines · Christoph Niedermaier
From: Leonard Crestez <[email protected]>
Sent: Tuesday, December 10, 2019 10:49 PMQuoted 32 lines
The ocotp compatible string on imx6ull and imx6ulz is currently "fsl,imx6ull-ocotp" but the
imx_soc_device_initfunction attempts to lookup for "fsl,imx6ul-ocotp" (single L).Fix the constant and make cat
/sys/devices/soc0/serial_numberprint useful information instead of all-zeros.Fixes 8267ff89b713 ("ARM: imx: Add serial number support for i.MX6/7 SoCs")Signed-off-by Leonard Crestez <[email protected]>--- arch/arm/mach-imx/cpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)arch/arm/mach-imx/cpu.c +2
-2@@ -151,15 +151,15 @@ struct device * __init imx_soc_device_init(void)case MXC_CPU_IMX6UL : ocotp_compat ="fsl,imx6ul-ocotp" ; soc_id ="i.MX6UL" ;break ;case MXC_CPU_IMX6ULL : - ocotp_compat ="fsl,imx6ul-ocotp" ; + ocotp_compat ="fsl,imx6ull-ocotp" ; soc_id ="i.MX6ULL" ;break ;case MXC_CPU_IMX6ULZ : - ocotp_compat ="fsl,imx6ul-ocotp" ; + ocotp_compat ="fsl,imx6ull-ocotp" ; soc_id ="i.MX6ULZ" ;break ;
Quoted 8 lines
arch/arm/mach-imx/cpu.c struct device * __init imx_soc_device_init(void) · line 165
Quoted 4 lines
arch/arm/mach-imx/cpu.c +0
-0case MXC_CPU_IMX6SLL : ocotp_compat ="fsl,imx6sll-ocotp" ; soc_id ="i.MX6SLL" ;I also had this problem and therefore already submitted a patch ("ARM: imx: Correct ocotp id for serial number support of i.MX6ULL/ULZ SoCs"). I hope this isn't a problem.
No problem; I should have noticed your patch.
--
Regards,
Leonard
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel