From nobody Mon Dec 11 14:16:35 2023 X-Original-To: dev-commits-src-main@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 4SpkM81vLmz53f4X; Mon, 11 Dec 2023 14:16:36 +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 4SpkM75X1zz3YX4; Mon, 11 Dec 2023 14:16:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1702304195; 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=wwGjN03YBYB0FcDCawv8YyxGT4Z+cI04fNn56+rVtVw=; b=gT7/24EwDepsdrUIjPtZIQaj/uRapXu8/l+NjQIGZOJAp5jktzDiRpV0WdcohAdLg0UTgn Rf68v7te8NE9pP2jkbBMb0r1PdIwggyt3JUah0Pt/dxfPOKwVZRrMQk0UKwQ+Zu7C37FOS 3FRZ8oGKstkvhYORLWGp7S1bjwoLjMaIOanoeI1nU7hbUGKVJXT9O3UgqUB67rXl15QHl7 u793KyLrNiC3Y896YSSe8yju55xDK4tuNSHK0R3PyppWTY4xxI3Yi7VFSXMlqn5/hifqvG 4p7sKHLNFJBQ7yY26fLyF2SEyFhV9xpzyO9NkPlbrXxEcSCbZoXgOq5braYLPg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1702304195; a=rsa-sha256; cv=none; b=jlVEf6t9sAB+lTM8ShhdC5pjzRpQ9W8kz8rbNB0cEjWmLYnFzOjL+6KBAvWn7Kzi+qNPmo jRjrynpTGKSjS/eOYIHIz1Zotd81iCZnJZrJ8pS06/IPqOi3l3NNOUfslUlEGbWhHbT5WN w8HEyR41aYmt35drR5YEArX9k6PYH+5SmW9CWEbKTUxEm4HmCxEjXHp37omDneQ87kp5SY 5IB94TJi1n/s0ebjq59ZpUM2LPOrmE/c7AcfOVpvjzWvlFIb5S/m7RismyYWssSU1PazR2 jh8PPCPcx6NGuJheR8rNlUdc7i2ERPRSHPl135lccHEkl+u6g2eksNw7gAAzZQ== 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=1702304195; 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=wwGjN03YBYB0FcDCawv8YyxGT4Z+cI04fNn56+rVtVw=; b=XEvklOC1fTtfrCxhpbiP6caKlqAKRSAn68J5z18w8t2gCQX4LGMJISXM71GabgETvKEdLe Cld4JmUqX2czTE50YDTnsvOPhx/gPLzDsECqpbW782/Mdy2V3lLtoBr3dCF4VvosLzfM9f +Mik0/8RF+tiUTvAD63eVBszTgcRg9KUazCq16zokYIY/ZGxACov5WOETQcQxdRUEEF1T4 /4jsGcpnSK1HriXfnSDuPd7ub3iFRLx5WhZY4KoOOD6RPtNvtVRQ8vRNtWS5SIiKYkY58r 6jw9vyEawL83tAPHUKdmYUHFcVLnHtUe3tHUJ1Av5MLxtPrZUb8f3Z9jhQPEiA== 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 4SpkM74cFRzZhS; Mon, 11 Dec 2023 14:16:35 +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 3BBEGZMl071925; Mon, 11 Dec 2023 14:16:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BBEGZ10071922; Mon, 11 Dec 2023 14:16:35 GMT (envelope-from git) Date: Mon, 11 Dec 2023 14:16:35 GMT Message-Id: <202312111416.3BBEGZ10071922@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: a6a481eaa2e0 - main - arm: Add fpu_kern_alloc_ctx() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a6a481eaa2e0f02e24b874f1a08bb494a68972c0 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a6a481eaa2e0f02e24b874f1a08bb494a68972c0 commit a6a481eaa2e0f02e24b874f1a08bb494a68972c0 Author: Mark Johnston AuthorDate: 2023-12-11 14:07:55 +0000 Commit: Mark Johnston CommitDate: 2023-12-11 14:07:55 +0000 arm: Add fpu_kern_alloc_ctx() This enables the use of some out-of-tree crypto libraries on arm. No functional change intended, there are no callers of this function in the tree currently. Reviewed by: andrew MFC after: 1 week Sponsored by: Klara, Inc. Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D42969 --- sys/arm/arm/vfp.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/sys/arm/arm/vfp.c b/sys/arm/arm/vfp.c index a4be235e1e01..f2979d4a2b27 100644 --- a/sys/arm/arm/vfp.c +++ b/sys/arm/arm/vfp.c @@ -30,10 +30,10 @@ #include #include +#include #include +#include #include -#include -#include #include #include @@ -52,6 +52,9 @@ static struct undefined_handler vfp10_uh, vfp11_uh; /* If true the VFP unit has 32 double registers, otherwise it has 16 */ static int is_d32; +static MALLOC_DEFINE(M_FPUKERN_CTX, "fpukern_ctx", + "Kernel contexts for VFP state"); + struct fpu_kern_ctx { struct vfp_state *prev; #define FPU_KERN_CTX_DUMMY 0x01 /* avoided save for the kern thread */ @@ -407,6 +410,21 @@ vfp_save_state(struct thread *td, struct pcb *pcb) critical_exit(); } +struct fpu_kern_ctx * +fpu_kern_alloc_ctx(u_int flags) +{ + return (malloc(sizeof(struct fpu_kern_ctx), M_FPUKERN_CTX, + ((flags & FPU_KERN_NOWAIT) ? M_NOWAIT : M_WAITOK) | M_ZERO)); +} + +void +fpu_kern_free_ctx(struct fpu_kern_ctx *ctx) +{ + KASSERT((ctx->flags & FPU_KERN_CTX_INUSE) == 0, ("freeing in-use ctx")); + + free(ctx, M_FPUKERN_CTX); +} + void fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx, u_int flags) {