From nobody Mon Oct 21 15:05:07 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 4XXJWm0qL5z5ZNbt; Mon, 21 Oct 2024 15:05:08 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XXJWl63vbz4f91; Mon, 21 Oct 2024 15:05:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729523107; 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=2T8dlAweCNDHoCWxRMl3Dmo2Uj/QzjqWnYhfyDteZgE=; b=SIHJOX922BpAPbqRFIG89Aufa1oFdS4OGiPUtnEeyd9z0lKAAx5fLq6UkXN54ArrvUy6fC fHZPlYOb4T5WbvlIGizXCbek0Ls48+qlMYjJYuCpG6gO1cDz+SlqZQfJ+LZYORlL3DxbPa P04KUhUg9XGg3GshMgdhPwA53nLzsb2QmQLak6GKdc/Krw4REq/EOU2MxbD7DIVfhc5Gix nuoRATNe7YZq0LFrzF0kTdsjXZ1VTp2ZaGXiEpK5rH9mSkwEU4w9Bot9fhiiUDQx6D2eV2 J+hY++e0SzhbrweD4G4pLpWtXSkRZH6J6HOGDdWsTX1KF0/+l+uGLImnVVqMBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729523107; 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=2T8dlAweCNDHoCWxRMl3Dmo2Uj/QzjqWnYhfyDteZgE=; b=BWO9UpdvXJCKBkkmv0mdHw0EmJzTsBwF8rRRxQQW42cx2UvOGm7bEaoir8lJYjJLE/Rxbf KvnHkpn3dzBTYrZyErPbM99SuNz1bVwt/+PWT/k74evAMNxyRBtqroyqQLiA/HavKIN2uA K9ItcUjBQZKr6OCgaJuMYIMrA2ymnHoCKgWRXm5C6YrnbEUH7rNosuYJg3bYmD1wCFm72w twM5aNlK97sqy/tHsbi2dRLd/vIbuKgLIBSGG60B35++LdxiY5xVkXbJGxUKGSI5zi2OQ8 wRA7PMuniVvwxkyBjIuSc1X0OmOzVYPIVOuyGxo2c6ZgVhS8eQzt5EzDnu3WdA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1729523107; a=rsa-sha256; cv=none; b=u0MEJci55fr5IfIUqRSqTLOhrGYn5x5vsVzieNM3gGPV3IsE5dYO1LTNpQ3WZ7zsZKHd+W eyWz06125cvjFkXCkGx5mMTxiC/poQFgdppz4pkMWHEa5SeIQHQLMm4bu1zvNja3y06P+g yaxcKecqWui6qurWF/hCrMy75H9PnMLZTv/Hbc8rn1e7XJ0NhCZoLouDS9vhpyCVpe+3tI O/g8YgZEp9pLG6ltMBVu5IInFZWmETVezZhy6Fe5v02P06OfrS2nqQu+EKc2OOnxMCG+a7 KeKJhECMrBT5JaoyVPbB0MUCdmDw4svyhSWzqSTN81on+3FSLmHkos+MzrLQkQ== 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 4XXJWl5d02zbNl; Mon, 21 Oct 2024 15:05:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49LF57Fg046813; Mon, 21 Oct 2024 15:05:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49LF57Mn046810; Mon, 21 Oct 2024 15:05:07 GMT (envelope-from git) Date: Mon, 21 Oct 2024 15:05:07 GMT Message-Id: <202410211505.49LF57Mn046810@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andrew Turner Subject: git: e005eea2c977 - stable/14 - arm64: Split out a savectx version of vfp_save_state 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: e005eea2c977f8637071ee2b97501e21ce8f0de5 Auto-Submitted: auto-generated The branch stable/14 has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=e005eea2c977f8637071ee2b97501e21ce8f0de5 commit e005eea2c977f8637071ee2b97501e21ce8f0de5 Author: Andrew Turner AuthorDate: 2024-01-03 17:41:42 +0000 Commit: Andrew Turner CommitDate: 2024-10-21 15:03:26 +0000 arm64: Split out a savectx version of vfp_save_state Rather than try to detect when vfp_save_state is called by savectx use a separate function that sets up the pcb as needed. Reviewed by: imp Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D43304 (cherry picked from commit 12257233e8fd94ab24e1a84ad87126af2a7be33b) --- sys/arm64/arm64/swtch.S | 4 +--- sys/arm64/arm64/vfp.c | 42 ++++++++++++++++++++++++++---------------- sys/arm64/include/vfp.h | 1 + 3 files changed, 28 insertions(+), 19 deletions(-) diff --git a/sys/arm64/arm64/swtch.S b/sys/arm64/arm64/swtch.S index 4c9851da3dc6..9c43de3a9eae 100644 --- a/sys/arm64/arm64/swtch.S +++ b/sys/arm64/arm64/swtch.S @@ -270,9 +270,7 @@ ENTRY(savectx) /* Store the VFP registers */ #ifdef VFP mov x28, lr - mov x1, x0 /* move pcb to the correct register */ - mov x0, xzr /* td = NULL */ - bl vfp_save_state + bl vfp_save_state_savectx mov lr, x28 #endif diff --git a/sys/arm64/arm64/vfp.c b/sys/arm64/arm64/vfp.c index be98af945b0a..f35cd960702b 100644 --- a/sys/arm64/arm64/vfp.c +++ b/sys/arm64/arm64/vfp.c @@ -170,25 +170,11 @@ vfp_restore(struct vfpstate *state) : : "r"(fpcr), "r"(fpsr), "r"(vfp_state)); } -void -vfp_save_state(struct thread *td, struct pcb *pcb) +static void +vfp_save_state_common(struct thread *td, struct pcb *pcb) { uint32_t cpacr; - KASSERT(pcb != NULL, ("NULL vfp pcb")); - KASSERT(td == NULL || td->td_pcb == pcb, ("Invalid vfp pcb")); - - /* - * savectx() will be called on panic with dumppcb as an argument, - * dumppcb doesn't have pcb_fpusaved set, so set it to save - * the VFP registers. - */ - if (pcb->pcb_fpusaved == NULL) - pcb->pcb_fpusaved = &pcb->pcb_fpustate; - - if (td == NULL) - td = curthread; - critical_enter(); /* * Only store the registers if the VFP is enabled, @@ -206,6 +192,30 @@ vfp_save_state(struct thread *td, struct pcb *pcb) critical_exit(); } +void +vfp_save_state(struct thread *td, struct pcb *pcb) +{ + KASSERT(td != NULL, ("NULL vfp thread")); + KASSERT(pcb != NULL, ("NULL vfp pcb")); + KASSERT(td->td_pcb == pcb, ("Invalid vfp pcb")); + + vfp_save_state_common(td, pcb); +} + +void +vfp_save_state_savectx(struct pcb *pcb) +{ + /* + * savectx() will be called on panic with dumppcb as an argument, + * dumppcb doesn't have pcb_fpusaved set, so set it to save + * the VFP registers. + */ + MPASS(pcb->pcb_fpusaved == NULL); + pcb->pcb_fpusaved = &pcb->pcb_fpustate; + + vfp_save_state_common(curthread, pcb); +} + /* * Update the VFP state for a forked process or new thread. The PCB will * have been copied from the old thread. diff --git a/sys/arm64/include/vfp.h b/sys/arm64/include/vfp.h index 8c3d56918822..7f4c86e7737d 100644 --- a/sys/arm64/include/vfp.h +++ b/sys/arm64/include/vfp.h @@ -78,6 +78,7 @@ void vfp_new_thread(struct thread *, struct thread *, bool); void vfp_reset_state(struct thread *, struct pcb *); void vfp_restore_state(void); void vfp_save_state(struct thread *, struct pcb *); +void vfp_save_state_savectx(struct pcb *); struct fpu_kern_ctx;