git: 0609ca2f19d4 - stable/14 - padlock: Switch to using FPU_KERN_NOCTX
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 29 Dec 2023 23:08:52 UTC
The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=0609ca2f19d48d95005fc6b3b71422cce708c372 commit 0609ca2f19d48d95005fc6b3b71422cce708c372 Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2023-08-25 19:34:05 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2023-12-29 21:49:41 +0000 padlock: Switch to using FPU_KERN_NOCTX Reviewed by: kib, markj Differential Revision: https://reviews.freebsd.org/D41582 (cherry picked from commit 3b0e353fe64221b6fbb335348b4a54d12de95243) --- 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 <machine/cpufunc.h> #include <machine/cputypes.h> +#include <machine/fpu.h> #include <machine/md_var.h> #include <machine/specialreg.h> #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 <opencrypto/cryptodev.h> #include <crypto/rijndael/rijndael.h> -#include <machine/fpu.h> - 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 <sys/libkern.h> #include <sys/pcpu.h> #include <sys/uio.h> +#include <machine/fpu.h> #include <opencrypto/cryptodev.h> #include <crypto/rijndael/rijndael.h> @@ -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 <machine/cpufunc.h> #include <machine/cputypes.h> +#include <machine/fpu.h> #include <machine/md_var.h> #include <machine/specialreg.h> #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); }