[PATCH master v2 1/2] ARM: psci: make PSCI method a of_psci_fixup parameter

Ahmad Fatoum ahmad at a3f.at
Sat Nov 5 05:11:53 PDT 2022


We currently assume PSCI fixups to always be of method smc, but this is
not true when barebox fixes up the node while running under QEMU.

In preparation for handling QEMU boot properly when psci-client driver
is enabled, give of_psci_fixup an extra parameter.

No functional change.

Signed-off-by: Ahmad Fatoum <ahmad at a3f.at>
---
v1 -> v2:
  - new patch
---
 arch/arm/cpu/psci-client.c     | 2 +-
 arch/arm/cpu/psci-of.c         | 5 +++--
 arch/arm/cpu/psci.c            | 2 +-
 arch/arm/include/asm/psci.h    | 3 ++-
 arch/arm/mach-layerscape/ppa.c | 2 +-
 5 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/arch/arm/cpu/psci-client.c b/arch/arm/cpu/psci-client.c
index 7d5b3768b59e..613280ad3f23 100644
--- a/arch/arm/cpu/psci-client.c
+++ b/arch/arm/cpu/psci-client.c
@@ -110,7 +110,7 @@ static u32 invoke_psci_fn_smc(ulong function, ulong arg0, ulong arg1, ulong arg2
 
 static int of_psci_do_fixup(struct device_node *root, void *context)
 {
-	return of_psci_fixup(root, *(u32 *)context);
+	return of_psci_fixup(root, *(u32 *)context, "smc");
 }
 
 static int __init psci_probe(struct device_d *dev)
diff --git a/arch/arm/cpu/psci-of.c b/arch/arm/cpu/psci-of.c
index ef83b0edee69..be16b08617ec 100644
--- a/arch/arm/cpu/psci-of.c
+++ b/arch/arm/cpu/psci-of.c
@@ -7,7 +7,8 @@
 #include <asm/psci.h>
 #include <linux/arm-smccc.h>
 
-int of_psci_fixup(struct device_node *root, unsigned long psci_version)
+int of_psci_fixup(struct device_node *root, unsigned long psci_version,
+		  const char *method)
 {
 	struct device_node *psci;
 	int ret;
@@ -46,7 +47,7 @@ int of_psci_fixup(struct device_node *root, unsigned long psci_version)
 	if (ret)
 		return ret;
 
-	ret = of_property_write_string(psci, "method", "smc");
+	ret = of_property_write_string(psci, "method", method);
 	if (ret)
 		return ret;
 
diff --git a/arch/arm/cpu/psci.c b/arch/arm/cpu/psci.c
index d1056e0659da..70c97e03a5ff 100644
--- a/arch/arm/cpu/psci.c
+++ b/arch/arm/cpu/psci.c
@@ -189,7 +189,7 @@ static int of_psci_do_fixup(struct device_node *root, void *unused)
 	if (bootm_arm_security_state() < ARM_STATE_NONSECURE)
 		return 0;
 
-	return of_psci_fixup(root, ARM_PSCI_VER_1_0);
+	return of_psci_fixup(root, ARM_PSCI_VER_1_0, "smc");
 }
 
 int psci_cpu_entry_c(void)
diff --git a/arch/arm/include/asm/psci.h b/arch/arm/include/asm/psci.h
index 3c1d046eb990..dbb9adfc3e43 100644
--- a/arch/arm/include/asm/psci.h
+++ b/arch/arm/include/asm/psci.h
@@ -144,6 +144,7 @@ static inline int psci_printf(const char *fmt, ...)
 
 int psci_get_cpu_id(void);
 
-int of_psci_fixup(struct device_node *root, unsigned long psci_version);
+int of_psci_fixup(struct device_node *root, unsigned long psci_version,
+		  const char *method);
 
 #endif /* __ARM_PSCI_H__ */
diff --git a/arch/arm/mach-layerscape/ppa.c b/arch/arm/mach-layerscape/ppa.c
index d962fba75105..144d0524754b 100644
--- a/arch/arm/mach-layerscape/ppa.c
+++ b/arch/arm/mach-layerscape/ppa.c
@@ -46,7 +46,7 @@ static int of_psci_do_fixup(struct device_node *root, void *unused)
 		break;
 	}
 
-	return of_psci_fixup(root, psci_version);
+	return of_psci_fixup(root, psci_version, "smc");
 }
 
 static int ppa_init(void *ppa, size_t ppa_size, void *sec_firmware_addr)
-- 
2.37.2




More information about the barebox mailing list