Skip to contentSkip to conversation

mach-k3: Defer CTRL_MMR access until after TIFS version response

PATCH In review Udit Kumar 3 participants 6 messages Feb 25 – Mar 2

Subsystems (2)
lore
Share & tools
lore

Udit Kumar

author
#0 lore raw

PATCH v2 1/1 mach-k3: Defer CTRL_MMR access until after TIFS version response

The CTRL_MMR registers are firewalled at boot time, and TIFS unlock them as part of the system firmware initialization sequence.

Current code assumes the CTRL_MMR space can be accessible at early stage of board_init_f execution by unlocking them.

But on HS-SE devices, TIFS takes more time to complete initialization, and CTRL_MMR registers remains firewalled and not getting unlocked. Which results in any write to these registers are ignored.

So, move the CTRL_MMR unlock to a point after the TIFS version message is received, ensuring that the firmware initialization has progressed and CTRL_MMR can be unlocked successfully.

Fixes 5e291ee34fd4 ("arch: mach-k3: Introduce basic files to support J722S SoC family")

---
Changelog:
Changes in v2:
- Moved control mmr after tifs version
- updated commit msg
link
v1: https://lore.kernel.org/all/[email protected]/

Test logs of v2:
HS-FS: https://gist.github.com/uditkumarti/c66ecbe800b4b3549fec3e505fe26dbf#file-hs_fs
HS-SE: https://gist.github.com/uditkumarti/c66ecbe800b4b3549fec3e505fe26dbf#file-hs_se

 arch/arm/mach-k3/j722s/j722s_init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-k3/j722s/j722s_init.c +2 -2
index 1180c75f551..32a3eed40d4 100644
@@ -84,8 +84,6 @@ static void k3_spl_init(void)
 	 */
 	store_boot_info_from_rom();
 
-	ctrl_mmr_unlock();
-
 	/* Init DM early */
 	ret = spl_early_init();
 	if (ret)
@@ -151,6 +149,8 @@ static void k3_spl_init(void)
 	/* Output System Firmware version info */
 	k3_sysfw_print_ver();
 
+	ctrl_mmr_unlock();
+
 	/* Output DM Firmware version info */
 	if (IS_ENABLED(CONFIG_ARM64))
 		k3_dm_print_ver();
Signature · 1 line
2.34.1
#1 lore raw
Quoted 9 lines · Udit Kumar

The CTRL_MMR registers are firewalled at boot time, and TIFS unlock them as part of the system firmware initialization sequence.

Current code assumes the CTRL_MMR space can be accessible at early stage of board_init_f execution by unlocking them.

But on HS-SE devices, TIFS takes more time to complete initialization, and CTRL_MMR registers remains firewalled and not getting unlocked. Which results in any write to these registers are ignored.

Hmm, this looks like something that can happen on other K3 SoCs too. Should we update all the other SoCs to follow the same logic?

Quoted 45 lines

So, move the CTRL_MMR unlock to a point after the TIFS version message is received, ensuring that the firmware initialization has progressed and CTRL_MMR can be unlocked successfully.

Fixes 5e291ee34fd4 ("arch: mach-k3: Introduce basic files to support J722S SoC family")

---
Changelog:
Changes in v2:
- Moved control mmr after tifs version
- updated commit msg
link
v1: https://lore.kernel.org/all/[email protected]/

Test logs of v2:
HS-FS: https://gist.github.com/uditkumarti/c66ecbe800b4b3549fec3e505fe26dbf#file-hs_fs
HS-SE: https://gist.github.com/uditkumarti/c66ecbe800b4b3549fec3e505fe26dbf#file-hs_se

 arch/arm/mach-k3/j722s/j722s_init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-k3/j722s/j722s_init.c +2 -2
index 1180c75f551..32a3eed40d4 100644
@@ -84,8 +84,6 @@ static void k3_spl_init(void)
 	 */
 	store_boot_info_from_rom();
 
-	ctrl_mmr_unlock();
-
 	/* Init DM early */
 	ret = spl_early_init();
 	if (ret)
@@ -151,6 +149,8 @@ static void k3_spl_init(void)
 	/* Output System Firmware version info */
 	k3_sysfw_print_ver();
 
+	ctrl_mmr_unlock();
+
 	/* Output DM Firmware version info */
 	if (IS_ENABLED(CONFIG_ARM64))
 		k3_dm_print_ver();
Signature · 3 lines
Regards
Vignesh
https://ti.com/opensource
#2 lore raw
Quoted 9 lines · Vignesh Raghavendra
Quoted 6 lines · Udit Kumar

The CTRL_MMR registers are firewalled at boot time, and TIFS unlock them as part of the system firmware initialization sequence.

Current code assumes the CTRL_MMR space can be accessible at early stage of board_init_f execution by unlocking them.

Quoted 6 lines
Quoted 3 lines

But on HS-SE devices, TIFS takes more time to complete initialization, and CTRL_MMR registers remains firewalled and not getting unlocked. Which results in any write to these registers are ignored.

Hmm, this looks like something that can happen on other K3 SoCs too. Should we update all the other SoCs to follow the same logic?

Yes, we need to update all SOCs,
As Bryan pointed out, this issue is seen on other SOC as well[0].

I will post for other SOCs as different series.

[0] https://lore.kernel.org/all/[email protected]/

Quoted 46 lines
Quoted 45 lines

So, move the CTRL_MMR unlock to a point after the TIFS version message is received, ensuring that the firmware initialization has progressed and CTRL_MMR can be unlocked successfully.

Fixes 5e291ee34fd4 ("arch: mach-k3: Introduce basic files to support J722S SoC family")

---
Changelog:
Changes in v2:
- Moved control mmr after tifs version
- updated commit msg
link
v1: https://lore.kernel.org/all/[email protected]/

Test logs of v2:
HS-FS: https://gist.github.com/uditkumarti/c66ecbe800b4b3549fec3e505fe26dbf#file-hs_fs
HS-SE: https://gist.github.com/uditkumarti/c66ecbe800b4b3549fec3e505fe26dbf#file-hs_se

 arch/arm/mach-k3/j722s/j722s_init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-k3/j722s/j722s_init.c +2 -2
index 1180c75f551..32a3eed40d4 100644
@@ -84,8 +84,6 @@ static void k3_spl_init(void)
 	 */
 	store_boot_info_from_rom();
 
-	ctrl_mmr_unlock();
-
 	/* Init DM early */
 	ret = spl_early_init();
 	if (ret)
@@ -151,6 +149,8 @@ static void k3_spl_init(void)
 	/* Output System Firmware version info */
 	k3_sysfw_print_ver();
 
+	ctrl_mmr_unlock();
+
 	/* Output DM Firmware version info */
 	if (IS_ENABLED(CONFIG_ARM64))
 		k3_dm_print_ver();
#3 lore raw
Quoted 16 lines · Udit
Quoted 13 lines · Vignesh Raghavendra
Quoted 9 lines · Udit Kumar

The CTRL_MMR registers are firewalled at boot time, and TIFS unlock them as part of the system firmware initialization sequence.

Current code assumes the CTRL_MMR space can be accessible at early stage of board_init_f execution by unlocking them.

But on HS-SE devices, TIFS takes more time to complete initialization, and CTRL_MMR registers remains firewalled and not getting unlocked. Which results in any write to these registers are ignored.

Quoted 7 lines
Quoted 2 lines

Hmm, this looks like something that can happen on other K3 SoCs too. Should we update all the other SoCs to follow the same logic?

Yes, we need to update all SOCs,
As Bryan pointed out, this issue is seen on other SOC as well[0].

I will post for other SOCs as different series.

Do you mean another iteration of this, as a series that addresses all of the SoCs? I'd prefer that (and cover letter explaining the situation) if possible and reasonable, thanks.

Signature · 1 line
Tom
#4 lore raw
Quoted 20 lines · Tom Rini
Quoted 19 lines · Udit
Quoted 15 lines · Vignesh Raghavendra
Quoted 9 lines · Udit Kumar

The CTRL_MMR registers are firewalled at boot time, and TIFS unlock them as part of the system firmware initialization sequence.

Current code assumes the CTRL_MMR space can be accessible at early stage of board_init_f execution by unlocking them.

But on HS-SE devices, TIFS takes more time to complete initialization, and CTRL_MMR registers remains firewalled and not getting unlocked. Which results in any write to these registers are ignored.

Hmm, this looks like something that can happen on other K3 SoCs too. Should we update all the other SoCs to follow the same logic?

Quoted 9 lines
Quoted 4 lines

Yes, we need to update all SOCs,
As Bryan pointed out, this issue is seen on other SOC as well[0].

I will post for other SOCs as different series.

Do you mean another iteration of this, as a series that addresses all of the SoCs? I'd prefer that (and cover letter explaining the situation) if possible and reasonable, thanks.

Sorry I meant another series to cover rest of SOCs.

Thanks for advice, i will do v3 covering all SOCs.

#5 lore raw
In reply to Tom Rini
Quoted 20 lines · Tom Rini
Quoted 19 lines · Udit
Quoted 15 lines · Vignesh Raghavendra
Quoted 9 lines · Udit Kumar

The CTRL_MMR registers are firewalled at boot time, and TIFS unlock them as part of the system firmware initialization sequence.

Current code assumes the CTRL_MMR space can be accessible at early stage of board_init_f execution by unlocking them.

But on HS-SE devices, TIFS takes more time to complete initialization, and CTRL_MMR registers remains firewalled and not getting unlocked. Which results in any write to these registers are ignored.

Hmm, this looks like something that can happen on other K3 SoCs too. Should we update all the other SoCs to follow the same logic?

Quoted 8 lines
Quoted 4 lines

Yes, we need to update all SOCs,
As Bryan pointed out, this issue is seen on other SOC as well[0].

I will post for other SOCs as different series.

Do you mean another iteration of this, as a series that addresses all of the SoCs? I'd prefer that (and cover letter explaining the situation) if possible and reasonable, thanks.

Looks in general mmr-unlock can not be moved on all SOCs after FW print version. I am seeing boot failure on other SOCs, need to debug more on this different behavior.