Skip to contentSkip to conversation

ARM: stm32: Fix TAMP_SMCR BKP..PROT fields on STM32MP15xx

PATCH In review Marek Vasut 3 participants 6 messages Jun 18, 2024 – Sep 25, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: stm32: Fix TAMP_SMCR BKP..PROT fields on STM32MP15xx

Update the TAMP_SMCR BKP..PROT fields to put first 10 registers into protection zone 1 and next 5 into zone 2. This fixes use of boot counter which is often in zone 3 and has to be updated from Linux, which runs in NS.

Fixes 73f7fc944cf6 ("ARM: stm32: Initialize TAMP_SMCR BKP..PROT fields on STM32MP15xx")

---
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c +2 -2
index f096fe538d8..ca202bec8ee 100644
@@ -148,8 +148,8 @@ static void security_init(void)
 	 */
 	clrsetbits_le32(TAMP_SMCR,
 			TAMP_SMCR_BKPRWDPROT | TAMP_SMCR_BKPWDPROT,
-			FIELD_PREP(TAMP_SMCR_BKPRWDPROT, 0x20) |
-			FIELD_PREP(TAMP_SMCR_BKPWDPROT, 0x20));
+			FIELD_PREP(TAMP_SMCR_BKPRWDPROT, 0x0A) |
+			FIELD_PREP(TAMP_SMCR_BKPWDPROT, 0x0F));
 
 	/* GPIOZ: deactivate the security */
 	writel(BIT(0), RCC_MP_AHB5ENSETR);
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 22 lines · Marek Vasut

Update the TAMP_SMCR BKP..PROT fields to put first 10 registers into protection zone 1 and next 5 into zone 2. This fixes use of boot counter which is often in zone 3 and has to be updated from Linux, which runs in NS.

Fixes 73f7fc944cf6 ("ARM: stm32: Initialize TAMP_SMCR BKP..PROT fields on STM32MP15xx")

---
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c +0 -0
index f096fe538d8..ca202bec8ee 100644

arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c static void security_init(void) · line 155

Quoted 10 lines
arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c +2 -2
@@ -148,8 +148,8 @@ static void security_init(void)
 	 */
 	clrsetbits_le32(TAMP_SMCR,
 			TAMP_SMCR_BKPRWDPROT | TAMP_SMCR_BKPWDPROT,
-			FIELD_PREP(TAMP_SMCR_BKPRWDPROT, 0x20) |
-			FIELD_PREP(TAMP_SMCR_BKPWDPROT, 0x20));
+			FIELD_PREP(TAMP_SMCR_BKPRWDPROT, 0x0A) |
+			FIELD_PREP(TAMP_SMCR_BKPWDPROT, 0x0F));
 
 	/* GPIOZ: deactivate the security */
 	writel(BIT(0), RCC_MP_AHB5ENSETR);

Thanks
Patrice

#2 lore raw
Quoted 33 lines · Patrice CHOTARD
Quoted 30 lines · Marek Vasut

Update the TAMP_SMCR BKP..PROT fields to put first 10 registers into protection zone 1 and next 5 into zone 2. This fixes use of boot counter which is often in zone 3 and has to be updated from Linux, which runs in NS.

Fixes 73f7fc944cf6 ("ARM: stm32: Initialize TAMP_SMCR BKP..PROT fields on STM32MP15xx")

---
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
  arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c +2 -2
index f096fe538d8..ca202bec8ee 100644
@@ -148,8 +148,8 @@ static void security_init(void)
  	 */
  	clrsetbits_le32(TAMP_SMCR,
  			TAMP_SMCR_BKPRWDPROT | TAMP_SMCR_BKPWDPROT,
-			FIELD_PREP(TAMP_SMCR_BKPRWDPROT, 0x20) |
-			FIELD_PREP(TAMP_SMCR_BKPWDPROT, 0x20));
+			FIELD_PREP(TAMP_SMCR_BKPRWDPROT, 0x0A) |
+			FIELD_PREP(TAMP_SMCR_BKPWDPROT, 0x0F));
 
Quoted 4 lines

arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c static void security_init(void) · line 155

Quoted 2 lines
arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c +0 -0
  	/* GPIOZ: deactivate the security */
  	writel(BIT(0), RCC_MP_AHB5ENSETR);

I hope this bugfix will make it into 2024.10 , can you prepare a bugfix PR for 2024.10 ?

#3 lore raw

Hi Marek,

Quoted 38 lines · Marek Vasut
Quoted 20 lines · Patrice CHOTARD
Quoted 17 lines · Marek Vasut

Update the TAMP_SMCR BKP..PROT fields to put first 10 registers into protection zone 1 and next 5 into zone 2. This fixes use of boot counter which is often in zone 3 and has to be updated from Linux, which runs in NS.

Fixes 73f7fc944cf6 ("ARM: stm32: Initialize TAMP_SMCR BKP..PROT fields on STM32MP15xx")

---
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
  arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c | 4 ++--

  1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 16 lines
Quoted 5 lines
arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c +0 -0
index f096fe538d8..ca202bec8ee 100644

arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c static void security_init(void) · line 154

Quoted 9 lines
arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c +2 -2
@@ -148,8 +148,8 @@ static void security_init(void)
        */
       clrsetbits_le32(TAMP_SMCR,
               TAMP_SMCR_BKPRWDPROT | TAMP_SMCR_BKPWDPROT,
-            FIELD_PREP(TAMP_SMCR_BKPRWDPROT, 0x20) |
-            FIELD_PREP(TAMP_SMCR_BKPWDPROT, 0x20));
+            FIELD_PREP(TAMP_SMCR_BKPRWDPROT, 0x0A) |
+            FIELD_PREP(TAMP_SMCR_BKPWDPROT, 0x0F));
         /* GPIOZ: deactivate the security */
       writel(BIT(0), RCC_MP_AHB5ENSETR);
Quoted 1 line

I hope this bugfix will make it into 2024.10 , can you prepare a bugfix PR for 2024.10 ?

Thanks for reminder, I miss it.

And sorry for the delay, because a pull request was planned by Patrice after with summer holiday.... but unfortunately it can't do it now (he is out of the office for a few weeks after a small incident)

so I will push a PR this week with your 2 bugfix patches.

Regards

Patrick

#4 lore raw
Quoted 1 line · Patrick DELAUNAY

Hi Marek,

Hi,

Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
Quoted 5 lines
arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c +0 -0
index f096fe538d8..ca202bec8ee 100644

arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c static void security_init(void) · line 154

Quoted 9 lines
arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c +2 -2
@@ -148,8 +148,8 @@ static void security_init(void)
        */
       clrsetbits_le32(TAMP_SMCR,
               TAMP_SMCR_BKPRWDPROT | TAMP_SMCR_BKPWDPROT,
-            FIELD_PREP(TAMP_SMCR_BKPRWDPROT, 0x20) |
-            FIELD_PREP(TAMP_SMCR_BKPWDPROT, 0x20));
+            FIELD_PREP(TAMP_SMCR_BKPRWDPROT, 0x0A) |
+            FIELD_PREP(TAMP_SMCR_BKPWDPROT, 0x0F));
         /* GPIOZ: deactivate the security */
       writel(BIT(0), RCC_MP_AHB5ENSETR);
Quoted 7 lines
Quoted 1 line

I hope this bugfix will make it into 2024.10 , can you prepare a bugfix PR for 2024.10 ?

Thanks for reminder, I miss it.

And sorry for the delay, because a pull request was planned by Patrice after with summer holiday.... but unfortunately it can't do it now (he is out of the office for a few weeks after a small incident)

I hope you had a good relaxing time ?

Quoted 1 line

so I will push a PR this week with your 2 bugfix patches.

Thank you !

#5 lore raw
In reply to Patrice CHOTARD

Hi,

Quoted 32 lines · Patrice CHOTARD
Quoted 30 lines · Marek Vasut

Update the TAMP_SMCR BKP..PROT fields to put first 10 registers into protection zone 1 and next 5 into zone 2. This fixes use of boot counter which is often in zone 3 and has to be updated from Linux, which runs in NS.

Fixes 73f7fc944cf6 ("ARM: stm32: Initialize TAMP_SMCR BKP..PROT fields on STM32MP15xx")

---
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
  arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c +2 -2
index f096fe538d8..ca202bec8ee 100644
@@ -148,8 +148,8 @@ static void security_init(void)
  	 */
  	clrsetbits_le32(TAMP_SMCR,
  			TAMP_SMCR_BKPRWDPROT | TAMP_SMCR_BKPWDPROT,
-			FIELD_PREP(TAMP_SMCR_BKPRWDPROT, 0x20) |
-			FIELD_PREP(TAMP_SMCR_BKPWDPROT, 0x20));
+			FIELD_PREP(TAMP_SMCR_BKPRWDPROT, 0x0A) |
+			FIELD_PREP(TAMP_SMCR_BKPWDPROT, 0x0F));
 
Quoted 6 lines

arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c static void security_init(void) · line 155

Quoted 2 lines
arch/arm/mach-stm32mp/stm32mp1/stm32mp15x.c +0 -0
  	/* GPIOZ: deactivate the security */
  	writel(BIT(0), RCC_MP_AHB5ENSETR);

Thanks
Patrice

Applied to u-boot-stm/master, thanks!

Regards
Patrick