Skip to contentSkip to conversation

ARM: imx: Get rid of only i.MX8M SMCCC arch call

PATCH Superseded Marek Vasut 2 participants 2 messages Mar 31, 2022 – Apr 7, 2022

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: imx: Get rid of only i.MX8M SMCCC arch call

This is the only place where i.MX8M code does SMCCC call, remove it. The output has little value as it prints some part of commit ID, and worse, if there is no SMC handler installed, the code outright hangs or crashes the system.

By removing this one instance of SMCCC call, U-Boot no longer depends on SMC handlers and can boot without hanging in any case. If there is a need to dump this commit ID, use CMD_SMC instead and do 'smc' call from U-Boot shell or scripts instead of hard-coding SMCCC dependency into architecture code. This particular code can be replaced by:
=> smc 0xc2000003 0 0 0 0 0 0

Cc Fabio Estevam <[email protected]>
Cc Peng Fan <[email protected]>
Cc Stefano Babic <[email protected]>

---
NOTE: This could also be hidden behind ARM_PSCI_FW , but I would rather
just remove this hard dependency, it makes U-Boot porting easier.

---
 arch/arm/mach-imx/imx8m/soc.c | 20 --------------------
 1 file changed, 20 deletions(-)
arch/arm/mach-imx/imx8m/soc.c +0 -20
index 1a5a391443d..45c5476bbc7 100644
@@ -27,7 +27,6 @@
 #include <fdt_support.h>
 #include <fsl_wdog.h>
 #include <imx_sip.h>
-#include <linux/arm-smccc.h>
 #include <linux/bitops.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -1191,27 +1190,8 @@ void reset_cpu(void)
 #endif
 
 #if defined(CONFIG_ARCH_MISC_INIT)
-static void acquire_buildinfo(void)
-{
-	u64 atf_commit = 0;
-	struct arm_smccc_res res;
-
-	/* Get ARM Trusted Firmware commit id */
-	arm_smccc_smc(IMX_SIP_BUILDINFO, IMX_SIP_BUILDINFO_GET_COMMITHASH,
-		      0, 0, 0, 0, 0, 0, &res);
-	atf_commit = res.a0;
-	if (atf_commit == 0xffffffff) {
-		debug("ATF does not support build info\n");
-		atf_commit = 0x30; /* Display 0, 0 ascii is 0x30 */
-	}
-
-	printf("\n BuildInfo:\n  - ATF %s\n\n", (char *)&atf_commit);
-}
-
 int arch_misc_init(void)
 {
-	acquire_buildinfo();
-
 	return 0;
 }
 #endif
Signature · 1 line
2.35.1
Reviewed-by Peng Fan on v1 1/1
#1 lore raw
Quoted 12 lines · Marek Vasut

This is the only place where i.MX8M code does SMCCC call, remove it. The output has little value as it prints some part of commit ID, and worse, if there is no SMC handler installed, the code outright hangs or crashes the system.

By removing this one instance of SMCCC call, U-Boot no longer depends on SMC handlers and can boot without hanging in any case. If there is a need to dump this commit ID, use CMD_SMC instead and do 'smc' call from U-Boot shell or scripts instead of hard-coding SMCCC dependency into architecture code. This particular code can be replaced by:
=> smc 0xc2000003 0 0 0 0 0 0

Quoted 4 lines
Cc Fabio Estevam <[email protected]>
Cc Peng Fan <[email protected]>
Cc Stefano Babic <[email protected]>

This should be ok, since ATF could print out log itself during boot.

Quoted 48 lines

---
NOTE: This could also be hidden behind ARM_PSCI_FW , but I would rather
just remove this hard dependency, it makes U-Boot porting easier.

---
  arch/arm/mach-imx/imx8m/soc.c | 20 --------------------
  1 file changed, 20 deletions(-)
arch/arm/mach-imx/imx8m/soc.c +0 -20
index 1a5a391443d..45c5476bbc7 100644
@@ -27,7 +27,6 @@
  #include <fdt_support.h>
  #include <fsl_wdog.h>
  #include <imx_sip.h>
-#include <linux/arm-smccc.h>
  #include <linux/bitops.h>
 
  DECLARE_GLOBAL_DATA_PTR;
@@ -1191,27 +1190,8 @@ void reset_cpu(void)
  #endif
 
  #if defined(CONFIG_ARCH_MISC_INIT)
-static void acquire_buildinfo(void)
-{
-	u64 atf_commit = 0;
-	struct arm_smccc_res res;
-
-	/* Get ARM Trusted Firmware commit id */
-	arm_smccc_smc(IMX_SIP_BUILDINFO, IMX_SIP_BUILDINFO_GET_COMMITHASH,
-		      0, 0, 0, 0, 0, 0, &res);
-	atf_commit = res.a0;
-	if (atf_commit == 0xffffffff) {
-		debug("ATF does not support build info\n");
-		atf_commit = 0x30; /* Display 0, 0 ascii is 0x30 */
-	}
-
-	printf("\n BuildInfo:\n  - ATF %s\n\n", (char *)&atf_commit);
-}
-
  int arch_misc_init(void)
  {
-	acquire_buildinfo();
-
  	return 0;
  }
  #endif