[PATCH master v2 2/2] ARM: psci: client: don't hardcode method smc in fixup

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

When barebox is booted as QEMU -kernel, PSCI will have method = "hvc",
because QEMU will act as Hypervisor. barebox handles this correctly and
will use hvc instead of smc, but of_psci_fixup() always fixes up
method = "smc" thereby breaking kernel boot.

Fix this by forwarding the method read from barebox DT into the kernel

Signed-off-by: Ahmad Fatoum <ahmad at a3f.at>
v1 -> v2:
  - instead of avoiding fixup, just do it with the method read from DT
  - Drop the other patches. There are nice to have, but can follow
 arch/arm/cpu/psci-client.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/cpu/psci-client.c b/arch/arm/cpu/psci-client.c
index 613280ad3f23..f9b1c684bfe5 100644
--- a/arch/arm/cpu/psci-client.c
+++ b/arch/arm/cpu/psci-client.c
@@ -108,9 +108,9 @@ static u32 invoke_psci_fn_smc(ulong function, ulong arg0, ulong arg1, ulong arg2
 	return res.a0;
-static int of_psci_do_fixup(struct device_node *root, void *context)
+static int of_psci_do_fixup(struct device_node *root, void *method)
-	return of_psci_fixup(root, *(u32 *)context, "smc");
+	return of_psci_fixup(root, version, (const void *)method);
 static int __init psci_probe(struct device_d *dev)
@@ -156,7 +156,7 @@ static int __init psci_probe(struct device_d *dev)
 		 version >> 16, version & 0xffff);
 	if (actual_version != of_version)
-		of_register_fixup(of_psci_do_fixup, &version);
+		of_register_fixup(of_psci_do_fixup, (void *)method);
 	ret = poweroff_handler_register_fn(psci_poweroff);
 	if (ret)

More information about the barebox mailing list