git: 3bbe8ed1a7dc - main - arm64: Add a CPU reset hook instead of expecting PSCI
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 05 Apr 2024 21:37:30 UTC
The branch main has been updated by stevek:
URL: https://cgit.FreeBSD.org/src/commit/?id=3bbe8ed1a7dce6943ce0fbf4946d2b1d435de0ec
commit 3bbe8ed1a7dce6943ce0fbf4946d2b1d435de0ec
Author: Stephen J. Kiernan <stevek@FreeBSD.org>
AuthorDate: 2024-04-05 21:37:15 +0000
Commit: Stephen J. Kiernan <stevek@FreeBSD.org>
CommitDate: 2024-04-05 21:37:15 +0000
arm64: Add a CPU reset hook instead of expecting PSCI
Some SoCs do not include a PSCI for power management and defer it to
something else instead. Add a CPU reset hook to account for this, and
use it in the psci driver.
Reviewed by: andrew
Obtained from: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D44535
---
sys/arm64/arm64/vm_machdep.c | 9 ++++++++-
sys/arm64/include/cpu.h | 3 +++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/sys/arm64/arm64/vm_machdep.c b/sys/arm64/arm64/vm_machdep.c
index 385bec00ada5..457157e34a6f 100644
--- a/sys/arm64/arm64/vm_machdep.c
+++ b/sys/arm64/arm64/vm_machdep.c
@@ -54,6 +54,13 @@
#include <dev/psci/psci.h>
+/*
+ * psci.c is "default" in ARM64 kernel config files
+ * psci_reset will do nothing until/unless the psci device probes/attaches.
+ * Therefore, it is safe to default the cpu_reset_hook to psci_reset.
+ */
+cpu_reset_hook_t cpu_reset_hook = psci_reset;
+
/*
* Finish a fork operation, with process p2 nearly set up.
* Copy and update the pcb, set up the stack so that the child
@@ -123,7 +130,7 @@ void
cpu_reset(void)
{
- psci_reset();
+ cpu_reset_hook();
printf("cpu_reset failed");
while(1)
diff --git a/sys/arm64/include/cpu.h b/sys/arm64/include/cpu.h
index 995be1c96d77..8f5a9e3dbd3c 100644
--- a/sys/arm64/include/cpu.h
+++ b/sys/arm64/include/cpu.h
@@ -206,6 +206,9 @@ extern uint64_t __cpu_affinity[];
struct arm64_addr_mask;
extern struct arm64_addr_mask elf64_addr_mask;
+typedef void (*cpu_reset_hook_t)(void);
+extern cpu_reset_hook_t cpu_reset_hook;
+
void cpu_halt(void) __dead2;
void cpu_reset(void) __dead2;
void fork_trampoline(void);