From nobody Fri Apr 05 21:37:30 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VBBfL41xbz5HFMR; Fri, 5 Apr 2024 21:37:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VBBfL3HSGz54gj; Fri, 5 Apr 2024 21:37:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1712353050; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nK22jheWYjzExo3hZHGDquzH/3WtwphiWwzJVjYkVBI=; b=Ql/8iQDyho/ZUGbnpu6XrauxXCcstEB3OujqFABdIUGm0QL5exdGH7nOc/RaO9qvQ26v9c WX3vacjEM0uzIKytg72Qr641yEZeviPHfuBKW3IF1tAfbjAhDrmFxXD2DUsBCN+LVkcW9s 1Uu7fLiqe9mmt/UkA54TjFz6C2WByEOhgLa7qOUpu2CjnwBuPJopJrLhevmYkNk9jD6eJ2 52N6i6Nw7/m/MaxuQfnA4kR/zCrljEC6fI0IeRDO2N7oiBJSyAm8b1YTRanHTYjQSyGRyB WyM4FsXrgwlBEFAmwcsOJOnvh5WKPodjfrCECMs3vIp9HqhPkxEbwL0r4IheBA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1712353050; a=rsa-sha256; cv=none; b=udzoX/OiFTHkwjjYVbSDgGxvYIB0bsTjF8p8Ou+bmg/YvJRP2fJoIQb/xXc0wGgB+FwN6J DrC1Q3UpujoIu/FtdoEpoofKb5FIJWA4aK96dLhPyVOkEy5RHDsPKL5I9c3OLcd8yX+81G BmCjAT7ZnHub1/xkxpFuDki9BdBRFeIJASArBwJF3++YLEmgy8+H5lm1gu0KjYKeTzYc57 7bH1CsCzFx9Yk4kNOcfAcB8bbc1Iw40t0tRkByyCpQmY/XWvWKJgnS442vemj9TmKdWZOP stsnSl4MCCZ+msDD1DrIONFkUiR3JNsrpPfQo9yTDB2cm7HiS7C8NSc4LhnWqg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1712353050; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nK22jheWYjzExo3hZHGDquzH/3WtwphiWwzJVjYkVBI=; b=f2mWXrTDrSq+UNs+g7vYfmORK9+9tsMPSiqTwWKyOK2nqaKn76WsyDNWaylgiwJi/M+Kk+ qqe/4+HU03Fe/vz1UlTu18vdNi9yAKzE3TLl8BcR/kif/nGgUYUD4TKMRXcftpuLiMoFTt uk+IvjBFWDUi5X/0AT8vOF2poQLi5QG1fnuqpah3WawdgCAy2GMb+xzLndGjwNpZugInHO Y3JH/S/+WhIK42qlVHRtfKP4z0QBB7z9tL7nI/CeFKYWy/gQMMFOzUwhmS7CuUjlsCAdqr AZ8AS0lUtuWT8jkqs1cyFVmDeSFZEJ7bXtihLERpEPx8yXa1+hfjJuaeUF4LYw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VBBfL2tjHzGgs; Fri, 5 Apr 2024 21:37:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 435LbUcm024056; Fri, 5 Apr 2024 21:37:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 435LbUPn024053; Fri, 5 Apr 2024 21:37:30 GMT (envelope-from git) Date: Fri, 5 Apr 2024 21:37:30 GMT Message-Id: <202404052137.435LbUPn024053@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Stephen J. Kiernan" Subject: git: 3bbe8ed1a7dc - main - arm64: Add a CPU reset hook instead of expecting PSCI List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: stevek X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3bbe8ed1a7dce6943ce0fbf4946d2b1d435de0ec Auto-Submitted: auto-generated The branch main has been updated by stevek: URL: https://cgit.FreeBSD.org/src/commit/?id=3bbe8ed1a7dce6943ce0fbf4946d2b1d435de0ec commit 3bbe8ed1a7dce6943ce0fbf4946d2b1d435de0ec Author: Stephen J. Kiernan AuthorDate: 2024-04-05 21:37:15 +0000 Commit: Stephen J. Kiernan 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 +/* + * 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);