From nobody Fri Aug 25 19:34:43 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 4RXVX349szz4qgYb; Fri, 25 Aug 2023 19:34:43 +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 4RXVX33VH7z3SpR; Fri, 25 Aug 2023 19:34:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1692992083; 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=vSTv9JrdPj0NSkd4kT3dl/KTBL6xBhqoRgWcyZK2dBU=; b=PLrQQhy3po78oHsBeFxoVEtsl6bK0dP5QGIxymVzb5EyNVyLRY1AjooYNibjhhdQKKyBOY Np+iCGBGx9XUptX+WQySZrWZQZBzcOJX4mYS23nIvuZDTA3JlA/BCKRCnWK6S99WSyOQWo 4Y+zdMHHj5ImiO8oNGKgvZF3bFcO2p07yBkhcmdHS8fVRgUgdtAQNhpPcESMWzwv1WFeCF M+VbaRF7gp2YbkJguXcMPhTvIHm2GKpp3upJnAsGdaeunCBCYF0D84vfod3v4ME+s9Sj15 yqyVL/Dir07yhAILinFF7Oxzzd9RYTyCdb0JZu8bx67i+LM1ynEvhwYfiQJMoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1692992083; 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=vSTv9JrdPj0NSkd4kT3dl/KTBL6xBhqoRgWcyZK2dBU=; b=j5ffAVzyEE9UIROcNRLI+4WQg/LcaO/G9lIC9kk+K3m/JmmqZdb3ua85d/BYj+JHKBYuWe dyfQ/8vKFPQHJDRhYsgKNHtS5Hijd3BoYFaCvFWpeZnugY93el4mWvSUxEihGGBSinm3D0 ry4FAJvlw4Ikmn/Ei/C0xEhUyt0uZ6UVB0BkczFc4JEhXrhaYxLt4H2euWPjdngG56Unes 3hMa1B/Pzcul9k6qA8i3Zr6Z1BpRO/2VSsN+A1VZyVcSM3KkaedDoi5dj0dxjMZrbfqZPf /e2W2SEQy5Be6REqI/jshbuPAJWcUmaL/h35V/7ly6p/gmr9PiTavTLOgG9NKA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1692992083; a=rsa-sha256; cv=none; b=W/BqVh2Q6DA8qW8c6E/wqawqkwkFeb7R8pe4Adugj4wQRiG5WaEM+P7sE+851WJ22xDkgF nxZbO1c4/80zmuvf1St4DTXV4z5XAqno4jNkSPROMnhV+JV3CkiPygpiNaG7G1j9MGvRDR Y5wrjstghPxS7WfNYkoUhd1WSY/v3UEkldreDLNjVUTKwTK7qvUJdmz56hmK9WnJg1gtYR QlnW0eUPU5UabC/d1DkyWdKE8JtUerjTZsb6XTJXFKZv72NxTSIGWtIZOAbvypR6OsmVQh tNeUiQPenSpVpyfdj6XR+QQsHIBWJBd4ssE4/mJzjsEnGbw9C2+P2EkHS0ExpA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4RXVX32Wkbz1KtZ; Fri, 25 Aug 2023 19:34:43 +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 37PJYhR6099569; Fri, 25 Aug 2023 19:34:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 37PJYh3I099566; Fri, 25 Aug 2023 19:34:43 GMT (envelope-from git) Date: Fri, 25 Aug 2023 19:34:43 GMT Message-Id: <202308251934.37PJYh3I099566@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 3b0e353fe642 - main - padlock: Switch to using FPU_KERN_NOCTX 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3b0e353fe64221b6fbb335348b4a54d12de95243 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=3b0e353fe64221b6fbb335348b4a54d12de95243 commit 3b0e353fe64221b6fbb335348b4a54d12de95243 Author: John Baldwin AuthorDate: 2023-08-25 19:34:05 +0000 Commit: John Baldwin CommitDate: 2023-08-25 19:34:05 +0000 padlock: Switch to using FPU_KERN_NOCTX Reviewed by: kib, markj Differential Revision: https://reviews.freebsd.org/D41582 --- sys/crypto/via/padlock.c | 23 +++++++++-------------- sys/crypto/via/padlock.h | 3 --- sys/crypto/via/padlock_cipher.c | 5 +++-- sys/crypto/via/padlock_hash.c | 5 +++-- 4 files changed, 15 insertions(+), 21 deletions(-) diff --git a/sys/crypto/via/padlock.c b/sys/crypto/via/padlock.c index 314beffbe2f5..b8dae256dbf4 100644 --- a/sys/crypto/via/padlock.c +++ b/sys/crypto/via/padlock.c @@ -36,6 +36,7 @@ #if defined(__amd64__) || defined(__i386__) #include #include +#include #include #include #endif @@ -62,8 +63,7 @@ static int padlock_probesession(device_t, const struct crypto_session_params *); static int padlock_newsession(device_t, crypto_session_t cses, const struct crypto_session_params *); static void padlock_freesession(device_t, crypto_session_t cses); -static void padlock_freesession_one(struct padlock_softc *sc, - struct padlock_session *ses); +static void padlock_freesession_one(struct padlock_session *ses); static int padlock_process(device_t, struct cryptop *crp, int hint __unused); MALLOC_DEFINE(M_PADLOCK, "padlock_data", "PadLock Data"); @@ -177,28 +177,25 @@ static int padlock_newsession(device_t dev, crypto_session_t cses, const struct crypto_session_params *csp) { - struct padlock_softc *sc = device_get_softc(dev); - struct padlock_session *ses = NULL; + struct padlock_session *ses; struct thread *td; int error; ses = crypto_get_driver_session(cses); - ses->ses_fpu_ctx = fpu_kern_alloc_ctx(FPU_KERN_NORMAL); error = padlock_cipher_setup(ses, csp); if (error != 0) { - padlock_freesession_one(sc, ses); + padlock_freesession_one(ses); return (error); } if (csp->csp_mode == CSP_MODE_ETA) { td = curthread; - fpu_kern_enter(td, ses->ses_fpu_ctx, FPU_KERN_NORMAL | - FPU_KERN_KTHR); + fpu_kern_enter(td, NULL, FPU_KERN_NORMAL | FPU_KERN_NOCTX); error = padlock_hash_setup(ses, csp); - fpu_kern_leave(td, ses->ses_fpu_ctx); + fpu_kern_leave(td, NULL); if (error != 0) { - padlock_freesession_one(sc, ses); + padlock_freesession_one(ses); return (error); } } @@ -207,21 +204,19 @@ padlock_newsession(device_t dev, crypto_session_t cses, } static void -padlock_freesession_one(struct padlock_softc *sc, struct padlock_session *ses) +padlock_freesession_one(struct padlock_session *ses) { padlock_hash_free(ses); - fpu_kern_free_ctx(ses->ses_fpu_ctx); } static void padlock_freesession(device_t dev, crypto_session_t cses) { - struct padlock_softc *sc = device_get_softc(dev); struct padlock_session *ses; ses = crypto_get_driver_session(cses); - padlock_freesession_one(sc, ses); + padlock_freesession_one(ses); } static int diff --git a/sys/crypto/via/padlock.h b/sys/crypto/via/padlock.h index 93ee9ab9c8b3..162d281506e2 100644 --- a/sys/crypto/via/padlock.h +++ b/sys/crypto/via/padlock.h @@ -30,8 +30,6 @@ #include #include -#include - union padlock_cw { uint64_t raw; struct { @@ -66,7 +64,6 @@ struct padlock_session { uint8_t *ses_ictx; uint8_t *ses_octx; int ses_mlen; - struct fpu_kern_ctx *ses_fpu_ctx; }; #define PADLOCK_ALIGN(p) (void *)(roundup2((uintptr_t)(p), 16)) diff --git a/sys/crypto/via/padlock_cipher.c b/sys/crypto/via/padlock_cipher.c index 253a84875626..136954870ae3 100644 --- a/sys/crypto/via/padlock_cipher.c +++ b/sys/crypto/via/padlock_cipher.c @@ -53,6 +53,7 @@ #include #include #include +#include #include #include @@ -221,10 +222,10 @@ padlock_cipher_process(struct padlock_session *ses, struct cryptop *crp, } td = curthread; - fpu_kern_enter(td, ses->ses_fpu_ctx, FPU_KERN_NORMAL | FPU_KERN_KTHR); + fpu_kern_enter(td, NULL, FPU_KERN_NORMAL | FPU_KERN_NOCTX); padlock_cbc(abuf, abuf, crp->crp_payload_length / AES_BLOCK_LEN, key, cw, iv); - fpu_kern_leave(td, ses->ses_fpu_ctx); + fpu_kern_leave(td, NULL); if (allocated) { crypto_copyback(crp, crp->crp_payload_start, diff --git a/sys/crypto/via/padlock_hash.c b/sys/crypto/via/padlock_hash.c index 706452c45a3e..d3cf46e10c5f 100644 --- a/sys/crypto/via/padlock_hash.c +++ b/sys/crypto/via/padlock_hash.c @@ -36,6 +36,7 @@ #if defined(__amd64__) || defined(__i386__) #include #include +#include #include #include #endif @@ -392,13 +393,13 @@ padlock_hash_process(struct padlock_session *ses, struct cryptop *crp, int error; td = curthread; - fpu_kern_enter(td, ses->ses_fpu_ctx, FPU_KERN_NORMAL | FPU_KERN_KTHR); + fpu_kern_enter(td, NULL, FPU_KERN_NORMAL | FPU_KERN_NOCTX); if (crp->crp_auth_key != NULL) padlock_hash_key_setup(ses, crp->crp_auth_key, csp->csp_auth_klen); error = padlock_authcompute(ses, crp); - fpu_kern_leave(td, ses->ses_fpu_ctx); + fpu_kern_leave(td, NULL); return (error); }