From nobody Mon Dec 18 02:11:42 2023 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 4StjxV4vXVz54dZR; Mon, 18 Dec 2023 02:11:42 +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 4StjxV2tr0z3Krm; Mon, 18 Dec 2023 02:11:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1702865502; 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=AtR2su/R3xyoBLGP8o0vTPKWB2OJAp1GJw820v/sl8w=; b=CiHdnUDO1XO4Tsjpd9y4EVZgswpU9b2dtCfW1JZQSdqx+llbkB7cn4VNazeC6IGmyuinT+ soU0dxg6GTrw8r+8J6EOmiZs+Sed93ScbmOQCjM7wWmI5yK+CEMCJMdM6NwR/hvNXZEQAc +g0PR4LmfSddnpUfdUQYKTFrhITlNY7oORqiJ4DDrkkv98Xm9/kSHjUCqQnW3Hn4ELPkT0 +YnpOxHeQg6kU4/tbLiWuBqVmsli57zvrTGMtPyOoNcx8ThnTFus0d91RF5Y0x1O34uyb0 Qd748yO3/ic5uBFTuZCTG75M/LO8KQEDzFA8nYi8B46dy/6XxVHmRMKXUY3+eQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1702865502; a=rsa-sha256; cv=none; b=vsQoILQ02v6yfbEYYXjOpQnjBeSgLRSR9gsXP7rMlT9O9ShS/ex8CMWJCsagM3cYo0KBJl HMIC1BDrmNVzSEkQ2Z1X9FyidOHOMi8q1VRlJrHZgei8gDSBSK7BnC/EUnFlAD9amiGREw 99532fcONnkQaOTCl2kZgd/7gKCnssvVWdW4Jav6z8F4OdrLtaRF+Etr5bzP7hBhFXoalN D5aZUH39qi7E6Pv+SCsuiaYB3CF1Aeka7qNMNicL6xkWUU7EC14kPQtkKLY36/CgY5ngui sVTxxL7cza9qAEXDUaJ1YOfkYSH1+RUtHY9mwn62J3diNnGwTrbmEwKUAWpAWg== 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=1702865502; 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=AtR2su/R3xyoBLGP8o0vTPKWB2OJAp1GJw820v/sl8w=; b=T8bNw3MCvgADRyLDONuwBMrfBXuEv8rXHpvOmaVZULslC/pALz2PJCnDiGtR20qcCpHOR7 Zfv8M16VNgbqVriVLPC2G2C3/ENLpjGBvBMyZ3RX3LHOBNZ7D67dPc5dAIvgIaJlMUAV86 WzYP4O+iSzXkNt4cl3G3yACzn6kY9IYyVrJ+xi+wlTUyOWisV0/TGrsLKhu8l5xopHIx1a PW/3eoETQh0PLe+lcDfe2gEXpOHrFvahr8Z2wrKhDfrHG/R9ylfeZpyODSjChK8YmapVhr U7kXq52KH5q+uxdC7wLca7qo8mmhk6zSIVQ9cAh3Jf4wQeqFGb6UcHPdD4YBIQ== 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 4StjxV1hXlz11wC; Mon, 18 Dec 2023 02:11:42 +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 3BI2BgAs074576; Mon, 18 Dec 2023 02:11:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BI2Bgi3074573; Mon, 18 Dec 2023 02:11:42 GMT (envelope-from git) Date: Mon, 18 Dec 2023 02:11:42 GMT Message-Id: <202312180211.3BI2Bgi3074573@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 1126dcdf4055 - stable/14 - arm: Add fpu_kern_alloc_ctx() 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 1126dcdf40555464faddddd67e827637c21bac89 Auto-Submitted: auto-generated The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=1126dcdf40555464faddddd67e827637c21bac89 commit 1126dcdf40555464faddddd67e827637c21bac89 Author: Mark Johnston AuthorDate: 2023-12-11 14:07:55 +0000 Commit: Mark Johnston CommitDate: 2023-12-18 02:07:47 +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 (cherry picked from commit a6a481eaa2e0f02e24b874f1a08bb494a68972c0) --- 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) {