Skip to contentSkip to conversation

imx: imx8m: drop uneeded check

PATCH In review Peng Fan (OSS) 4 participants 5 messages Apr 29, 2022 – May 20, 2022

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

PATCH 1/1 imx: imx8m: drop uneeded check

From: Peng Fan <[email protected]>

All i.MX8M needs TZASC ID SWAP set and locked, no need the check to waste cpu cycles.

---
 arch/arm/mach-imx/imx8m/soc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
arch/arm/mach-imx/imx8m/soc.c +2 -4
index 8e23e6da326..5240dc11363 100644
@@ -72,15 +72,13 @@ void enable_tzc380(void)
 	 * According to TRM, TZASC_ID_SWAP_BYPASS should be set in
 	 * order to avoid AXI Bus errors when GPU is in use
 	 */
-	if (is_imx8mq() || is_imx8mm() || is_imx8mn() || is_imx8mp())
-		setbits_le32(&gpr->gpr[10], GPR_TZASC_ID_SWAP_BYPASS);
+	setbits_le32(&gpr->gpr[10], GPR_TZASC_ID_SWAP_BYPASS);
 
 	/*
 	 * imx8mn and imx8mp implements the lock bit for
 	 * TZASC_ID_SWAP_BYPASS, enable it to lock settings
 	 */
-	if (is_imx8mn() || is_imx8mp())
-		setbits_le32(&gpr->gpr[10], GPR_TZASC_ID_SWAP_BYPASS_LOCK);
+	setbits_le32(&gpr->gpr[10], GPR_TZASC_ID_SWAP_BYPASS_LOCK);
 
 	/*
 	 * set Region 0 attribute to allow secure and non-secure
Signature · 1 line
2.36.0
#1 lore raw

Hello Peng,

Quoted 22 lines

-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Peng Fan (OSS)
Sent: Friday, April 29, 2022 10:19 AM
To: [email protected]; [email protected]; NXP i.MX U-Boot Team <[email protected]>
Cc: [email protected]; Peng Fan <[email protected]>
Subject: [PATCH] imx: imx8m: drop uneeded check

From: Peng Fan <[email protected]>

All i.MX8M needs TZASC ID SWAP set and locked, no need the check to waste cpu cycles.

---
 arch/arm/mach-imx/imx8m/soc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
arch/arm/mach-imx/imx8m/soc.c +0 -0
index 8e23e6da326..5240dc11363 100644

arch/arm/mach-imx/imx8m/soc.c void enable_tzc380(void) · line 75

Quoted 6 lines
arch/arm/mach-imx/imx8m/soc.c +1 -2
@@ -72,15 +72,13 @@ void enable_tzc380(void)
 	 * According to TRM, TZASC_ID_SWAP_BYPASS should be set in
 	 * order to avoid AXI Bus errors when GPU is in use
 	 */
-	if (is_imx8mq() || is_imx8mm() || is_imx8mn() || is_imx8mp())
-		setbits_le32(&gpr->gpr[10], GPR_TZASC_ID_SWAP_BYPASS);
+	setbits_le32(&gpr->gpr[10], GPR_TZASC_ID_SWAP_BYPASS);

Since you've dropped the SoC-specific check, perhaps you can combine bits set that are done by setbits_le32 together with one below?

arch/arm/mach-imx/imx8m/soc.c void enable_tzc380(void) · line 81

Quoted 8 lines
arch/arm/mach-imx/imx8m/soc.c +1 -2
 	/*
 	 * imx8mn and imx8mp implements the lock bit for
 	 * TZASC_ID_SWAP_BYPASS, enable it to lock settings
 	 */
-	if (is_imx8mn() || is_imx8mp())
-		setbits_le32(&gpr->gpr[10], GPR_TZASC_ID_SWAP_BYPASS_LOCK);
+	setbits_le32(&gpr->gpr[10], GPR_TZASC_ID_SWAP_BYPASS_LOCK);

BYPASS_LOCK is not present in i.MX8MM TRM, but I guess you've checked that it is implemented already, right?

Quoted 5 lines
arch/arm/mach-imx/imx8m/soc.c +0 -1
 	/*
 	 * set Region 0 attribute to allow secure and non-secure
--

2.36.0

-- andrey

#2 lore raw
Quoted 26 lines

Subject: RE: [PATCH] imx: imx8m: drop uneeded check

Hello Peng,

Quoted 14 lines

-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Peng Fan (OSS)
Sent: Friday, April 29, 2022 10:19 AM
To: [email protected]; [email protected]; NXP i.MX U-Boot Team <[email protected]>
Cc: [email protected]; Peng Fan <[email protected]>
Subject: [PATCH] imx: imx8m: drop uneeded check

From: Peng Fan <[email protected]>

All i.MX8M needs TZASC ID SWAP set and locked, no need the check to waste cpu cycles.

Quoted 7 lines
---
 arch/arm/mach-imx/imx8m/soc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
(quoted diff) +0 -0

b/arch/arm/mach-imx/imx8m/soc.c index 8e23e6da326..5240dc11363

100644

Quoted 12 lines

arch/arm/mach-imx/imx8m/soc.c void enable_tzc380(void) · line 75

Quoted 9 lines
arch/arm/mach-imx/imx8m/soc.c +1 -2
@@ -72,15 +72,13 @@ void enable_tzc380(void)
 	 * According to TRM, TZASC_ID_SWAP_BYPASS should be set in
 	 * order to avoid AXI Bus errors when GPU is in use
 	 */
-	if (is_imx8mq() || is_imx8mm() || is_imx8mn() || is_imx8mp())
-		setbits_le32(&gpr->gpr[10], GPR_TZASC_ID_SWAP_BYPASS);
+	setbits_le32(&gpr->gpr[10], GPR_TZASC_ID_SWAP_BYPASS);

Since you've dropped the SoC-specific check, perhaps you can combine bits set that are done by setbits_le32 together with one below?

Let’s separate them, first set, then lock.

Quoted 9 lines

arch/arm/mach-imx/imx8m/soc.c void enable_tzc380(void)

Quoted 8 lines
arch/arm/mach-imx/imx8m/soc.c +0 -2
 	/*
 	 * imx8mn and imx8mp implements the lock bit for
 	 * TZASC_ID_SWAP_BYPASS, enable it to lock settings
 	 */
-	if (is_imx8mn() || is_imx8mp())
-		setbits_le32(&gpr->gpr[10],

GPR_TZASC_ID_SWAP_BYPASS_LOCK);

Quoted 4 lines

arch/arm/mach-imx/imx8m/soc.c void enable_tzc380(void) · line 81

Quoted 1 line
arch/arm/mach-imx/imx8m/soc.c +1 -0
+	setbits_le32(&gpr->gpr[10], GPR_TZASC_ID_SWAP_BYPASS_LOCK);

BYPASS_LOCK is not present in i.MX8MM TRM, but I guess you've checked that it is implemented already, right?

Yes. It is implemented. RM needs update.

Regards,
Peng.

Quoted 8 lines
Quoted 6 lines
arch/arm/mach-imx/imx8m/soc.c +0 -1
 	/*
 	 * set Region 0 attribute to allow secure and non-secure
--

2.36.0

-- andrey

Reviewed-by
#3 lore raw
Quoted 49 lines

-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Peng Fan
Sent: Monday, May 16, 2022 9:25 AM
To: ZHIZHIKIN Andrey <[email protected]>; Peng Fan (OSS) <[email protected]>; [email protected]; [email protected]; dl-uboot-imx <uboot- [email protected]>
Cc: [email protected]
Subject: RE: [PATCH] imx: imx8m: drop uneeded check

Quoted 26 lines

Subject: RE: [PATCH] imx: imx8m: drop uneeded check

Hello Peng,

Quoted 14 lines

-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Peng Fan (OSS)
Sent: Friday, April 29, 2022 10:19 AM
To: [email protected]; [email protected]; NXP i.MX U-Boot Team <[email protected]>
Cc: [email protected]; Peng Fan <[email protected]>
Subject: [PATCH] imx: imx8m: drop uneeded check

From: Peng Fan <[email protected]>

All i.MX8M needs TZASC ID SWAP set and locked, no need the check to waste cpu cycles.

Quoted 7 lines
---
 arch/arm/mach-imx/imx8m/soc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
(quoted diff) +0 -0

b/arch/arm/mach-imx/imx8m/soc.c index 8e23e6da326..5240dc11363

100644

Quoted 12 lines

arch/arm/mach-imx/imx8m/soc.c void enable_tzc380(void) · line 75

Quoted 9 lines
arch/arm/mach-imx/imx8m/soc.c +1 -2
@@ -72,15 +72,13 @@ void enable_tzc380(void)
 	 * According to TRM, TZASC_ID_SWAP_BYPASS should be set in
 	 * order to avoid AXI Bus errors when GPU is in use
 	 */
-	if (is_imx8mq() || is_imx8mm() || is_imx8mn() || is_imx8mp())
-		setbits_le32(&gpr->gpr[10], GPR_TZASC_ID_SWAP_BYPASS);
+	setbits_le32(&gpr->gpr[10], GPR_TZASC_ID_SWAP_BYPASS);

Since you've dropped the SoC-specific check, perhaps you can combine bits set that are done by setbits_le32 together with one below?

Quoted 1 line

Let’s separate them, first set, then lock.

OK, sounds logical.

Quoted 9 lines
Quoted 9 lines

arch/arm/mach-imx/imx8m/soc.c void enable_tzc380(void)

Quoted 8 lines
arch/arm/mach-imx/imx8m/soc.c +0 -2
 	/*
 	 * imx8mn and imx8mp implements the lock bit for
 	 * TZASC_ID_SWAP_BYPASS, enable it to lock settings
 	 */
-	if (is_imx8mn() || is_imx8mp())
-		setbits_le32(&gpr->gpr[10],

GPR_TZASC_ID_SWAP_BYPASS_LOCK);

Quoted 6 lines
Quoted 4 lines

arch/arm/mach-imx/imx8m/soc.c void enable_tzc380(void) · line 81

Quoted 1 line
arch/arm/mach-imx/imx8m/soc.c +1 -0
+	setbits_le32(&gpr->gpr[10], GPR_TZASC_ID_SWAP_BYPASS_LOCK);

BYPASS_LOCK is not present in i.MX8MM TRM, but I guess you've checked that it is implemented already, right?

Yes. It is implemented. RM needs update.

Understood, thanks for clarifications!

Quoted 12 lines

Regards,
Peng.

Quoted 8 lines
Quoted 6 lines
arch/arm/mach-imx/imx8m/soc.c +0 -1
 	/*
 	 * set Region 0 attribute to allow secure and non-secure
--

2.36.0

-- andrey

-- andrey

#4 lore raw

PATCH 1/1 imx: imx8m: drop uneeded check

In reply to Peng Fan (OSS)
Quoted 5 lines

From: Peng Fan <[email protected]>
All i.MX8M needs TZASC ID SWAP set and locked, no need the check to waste cpu cycles.

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================