From bbd606538aefc762fe76930ebfe6cf38e3d48df7 Mon Sep 17 00:00:00 2001 From: Daniel Pouzzner Date: Thu, 31 Jul 2025 10:37:39 -0500 Subject: [PATCH] linuxkm/linuxkm_wc_port.h, linuxkm/x86_vector_register_glue.c, linuxkm/Kbuild: * rename can_save_vector_registers_x86(), save_vector_registers_x86(), and restore_vector_registers_x86(), with wc_ prefix, and properly export them; * move setup for WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS outside BUILDING_WOLFSSL gate; * fix !BUILDING_WOLFSSL bindings for DISABLE_VECTOR_REGISTERS() to properly fall through to no-ops in !WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS configs, and properly #error if WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS but !CONFIG_X86; .github/workflows/linuxkm.yml: --enable-linuxkm-benchmarks for additional coverage. --- .github/workflows/linuxkm.yml | 4 +- linuxkm/Kbuild | 4 +- linuxkm/linuxkm_wc_port.h | 117 ++++++++++++++--------------- linuxkm/module_hooks.c | 6 +- linuxkm/x86_vector_register_glue.c | 24 +++--- 5 files changed, 76 insertions(+), 79 deletions(-) diff --git a/.github/workflows/linuxkm.yml b/.github/workflows/linuxkm.yml index 931e2d4c7..334fd7a1a 100644 --- a/.github/workflows/linuxkm.yml +++ b/.github/workflows/linuxkm.yml @@ -17,8 +17,8 @@ jobs: strategy: matrix: config: [ - 'EXTRA_CPPFLAGS=-Werror --enable-option-checking=fatal --enable-linuxkm --enable-linuxkm-lkcapi-register=all --enable-all --enable-kyber=yes,original --enable-lms --enable-xmss --enable-dilithium --enable-experimental --enable-dual-alg-certs --disable-qt --disable-quic --with-sys-crypto-policy=no --disable-opensslextra --disable-testcert --enable-intelasm --enable-sp-asm --enable-crypttests CFLAGS="-DWOLFSSL_LINUXKM_VERBOSE_DEBUG -Wframe-larger-than=2048 -Wstack-usage=4096" --with-max-rsa-bits=16384', - 'EXTRA_CPPFLAGS=-Werror --enable-option-checking=fatal --enable-linuxkm --enable-linuxkm-pie --enable-reproducible-build --enable-linuxkm-lkcapi-register=all --enable-all-crypto --enable-cryptonly --enable-kyber=yes,original --enable-lms --enable-xmss --enable-dilithium --enable-experimental --disable-qt --disable-quic --with-sys-crypto-policy=no --disable-opensslextra --disable-testcert --enable-intelasm --enable-sp-asm --enable-crypttests CFLAGS="-DWOLFSSL_LINUXKM_VERBOSE_DEBUG -Wframe-larger-than=2048 -Wstack-usage=4096" --with-max-rsa-bits=16384' + 'EXTRA_CPPFLAGS=-Werror --enable-option-checking=fatal --enable-linuxkm --enable-linuxkm-lkcapi-register=all --enable-all --enable-kyber=yes,original --enable-lms --enable-xmss --enable-dilithium --enable-experimental --enable-dual-alg-certs --disable-qt --disable-quic --with-sys-crypto-policy=no --disable-opensslextra --disable-testcert --enable-intelasm --disable-sp-asm --enable-crypttests --enable-linuxkm-benchmarks CFLAGS="-DWOLFSSL_LINUXKM_VERBOSE_DEBUG -Wframe-larger-than=2048 -Wstack-usage=4096 -DBENCH_EMBEDDED -DBENCH_MIN_RUNTIME_SEC=0.01 -DBENCH_NTIMES=1 -DBENCH_AGREETIMES=1" --with-max-rsa-bits=16384', + 'EXTRA_CPPFLAGS=-Werror --enable-option-checking=fatal --enable-linuxkm --enable-linuxkm-pie --enable-reproducible-build --enable-linuxkm-lkcapi-register=all --enable-all-crypto --enable-cryptonly --enable-kyber=yes,original --enable-lms --enable-xmss --enable-dilithium --enable-experimental --disable-qt --disable-quic --with-sys-crypto-policy=no --disable-opensslextra --disable-testcert --enable-intelasm --disable-sp-asm --enable-crypttests --enable-linuxkm-benchmarks CFLAGS="-DWOLFSSL_LINUXKM_VERBOSE_DEBUG -Wframe-larger-than=2048 -Wstack-usage=4096 -DBENCH_EMBEDDED -DBENCH_MIN_RUNTIME_SEC=0.01 -DBENCH_NTIMES=1 -DBENCH_AGREETIMES=1" --with-max-rsa-bits=16384' ] name: build module if: github.repository_owner == 'wolfssl' diff --git a/linuxkm/Kbuild b/linuxkm/Kbuild index 93c332fe9..9a94b471e 100644 --- a/linuxkm/Kbuild +++ b/linuxkm/Kbuild @@ -304,7 +304,7 @@ endif # auto-generate the exported symbol list, leveraging the WOLFSSL_API visibility tags. # exclude symbols that don't match wc_* or wolf*. -$(obj)/linuxkm/module_exports.c: $(src)/module_exports.c.template $(WOLFSSL_OBJ_TARGETS) +$(obj)/linuxkm/module_exports.c: $(src)/module_exports.c.template $(WOLFSSL_OBJ_TARGETS) $(obj)/linuxkm/module_hooks.o @cp $< $@ || exit $$? if [[ "$${VERSION}" -gt 6 || ("$${VERSION}" -eq 6 && "$${PATCHLEVEL}" -ge 13) ]]; then # use ASCII octal escape to avoid syntax disruption in the awk script. @@ -312,7 +312,7 @@ $(obj)/linuxkm/module_exports.c: $(src)/module_exports.c.template $(WOLFSSL_OBJ_ else ns='WOLFSSL' fi - $(READELF) --symbols --wide $(WOLFSSL_OBJ_TARGETS) | + $(READELF) --symbols --wide $(filter %.o,$^) | $(AWK) '/^ *[0-9]+: / { if ($$8 !~ /^(wc_|wolf|WOLF|TLSX_)/){next;} if (($$4 == "FUNC") && ($$5 == "GLOBAL") && ($$6 == "DEFAULT")) { diff --git a/linuxkm/linuxkm_wc_port.h b/linuxkm/linuxkm_wc_port.h index f70b63103..dcc445883 100644 --- a/linuxkm/linuxkm_wc_port.h +++ b/linuxkm/linuxkm_wc_port.h @@ -139,6 +139,33 @@ WC_SVR_FLAG_INHIBIT = 1, }; + #if defined(WOLFSSL_AESNI) || defined(USE_INTEL_SPEEDUP) || \ + defined(WOLFSSL_SP_X86_64_ASM) + #ifndef CONFIG_X86 + #error X86 SIMD extensions requested, but CONFIG_X86 is not set. + #endif + #define WOLFSSL_LINUXKM_SIMD + #define WOLFSSL_LINUXKM_SIMD_X86 + #ifndef WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS + #define WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS + #endif + #elif defined(WOLFSSL_ARMASM) || defined(WOLFSSL_SP_ARM32_ASM) || \ + defined(WOLFSSL_SP_ARM64_ASM) || defined(WOLFSSL_SP_ARM_THUMB_ASM) ||\ + defined(WOLFSSL_SP_ARM_CORTEX_M_ASM) + #if !defined(CONFIG_ARM) && !defined(CONFIG_ARM64) + #error ARM SIMD extensions requested, but CONFIG_ARM* is not set. + #endif + #define WOLFSSL_LINUXKM_SIMD + #define WOLFSSL_LINUXKM_SIMD_ARM + #ifndef WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS + #define WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS + #endif + #else + #ifndef WOLFSSL_NO_ASM + #define WOLFSSL_NO_ASM + #endif + #endif + #ifdef BUILDING_WOLFSSL #if ((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0)) || \ @@ -412,33 +439,6 @@ #endif /* !__PIE__ */ #endif /* LINUXKM_LKCAPI_REGISTER */ - #if defined(WOLFSSL_AESNI) || defined(USE_INTEL_SPEEDUP) || \ - defined(WOLFSSL_SP_X86_64_ASM) - #ifndef CONFIG_X86 - #error X86 SIMD extensions requested, but CONFIG_X86 is not set. - #endif - #define WOLFSSL_LINUXKM_SIMD - #define WOLFSSL_LINUXKM_SIMD_X86 - #ifndef WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS - #define WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS - #endif - #elif defined(WOLFSSL_ARMASM) || defined(WOLFSSL_SP_ARM32_ASM) || \ - defined(WOLFSSL_SP_ARM64_ASM) || defined(WOLFSSL_SP_ARM_THUMB_ASM) ||\ - defined(WOLFSSL_SP_ARM_CORTEX_M_ASM) - #if !defined(CONFIG_ARM) && !defined(CONFIG_ARM64) - #error ARM SIMD extensions requested, but CONFIG_ARM* is not set. - #endif - #define WOLFSSL_LINUXKM_SIMD - #define WOLFSSL_LINUXKM_SIMD_ARM - #ifndef WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS - #define WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS - #endif - #else - #ifndef WOLFSSL_NO_ASM - #define WOLFSSL_NO_ASM - #endif - #endif - #ifndef WC_CHECK_FOR_INTR_SIGNALS #define WC_CHECK_FOR_INTR_SIGNALS() wc_linuxkm_check_for_intr_signals() #endif @@ -459,9 +459,9 @@ extern __must_check int allocate_wolfcrypt_linuxkm_fpu_states(void); extern void free_wolfcrypt_linuxkm_fpu_states(void); - extern __must_check int can_save_vector_registers_x86(void); - extern __must_check int save_vector_registers_x86(enum wc_svr_flags flags); - extern void restore_vector_registers_x86(void); + WOLFSSL_API __must_check int wc_can_save_vector_registers_x86(void); + WOLFSSL_API __must_check int wc_save_vector_registers_x86(enum wc_svr_flags flags); + WOLFSSL_API void wc_restore_vector_registers_x86(void); #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0) #include @@ -471,14 +471,14 @@ #endif #ifndef CAN_SAVE_VECTOR_REGISTERS #ifdef DEBUG_VECTOR_REGISTER_ACCESS_FUZZING - #define CAN_SAVE_VECTOR_REGISTERS() (can_save_vector_registers_x86() && (SAVE_VECTOR_REGISTERS2_fuzzer() == 0)) + #define CAN_SAVE_VECTOR_REGISTERS() (wc_can_save_vector_registers_x86() && (SAVE_VECTOR_REGISTERS2_fuzzer() == 0)) #else - #define CAN_SAVE_VECTOR_REGISTERS() can_save_vector_registers_x86() + #define CAN_SAVE_VECTOR_REGISTERS() wc_can_save_vector_registers_x86() #endif #endif #ifndef SAVE_VECTOR_REGISTERS #define SAVE_VECTOR_REGISTERS(fail_clause) { \ - int _svr_ret = save_vector_registers_x86(0); \ + int _svr_ret = wc_save_vector_registers_x86(0); \ if (_svr_ret != 0) { \ fail_clause \ } \ @@ -489,22 +489,22 @@ #define SAVE_VECTOR_REGISTERS2() ({ \ int _fuzzer_ret = SAVE_VECTOR_REGISTERS2_fuzzer(); \ (_fuzzer_ret == 0) ? \ - save_vector_registers_x86(0) : \ + wc_save_vector_registers_x86(0) : \ _fuzzer_ret; \ }) #else - #define SAVE_VECTOR_REGISTERS2() save_vector_registers_x86(0) + #define SAVE_VECTOR_REGISTERS2() wc_save_vector_registers_x86(0) #endif #endif #ifndef RESTORE_VECTOR_REGISTERS - #define RESTORE_VECTOR_REGISTERS() restore_vector_registers_x86() + #define RESTORE_VECTOR_REGISTERS() wc_restore_vector_registers_x86() #endif #ifndef DISABLE_VECTOR_REGISTERS - #define DISABLE_VECTOR_REGISTERS() save_vector_registers_x86(WC_SVR_FLAG_INHIBIT) + #define DISABLE_VECTOR_REGISTERS() wc_save_vector_registers_x86(WC_SVR_FLAG_INHIBIT) #endif #ifndef REENABLE_VECTOR_REGISTERS - #define REENABLE_VECTOR_REGISTERS() restore_vector_registers_x86() + #define REENABLE_VECTOR_REGISTERS() wc_restore_vector_registers_x86() #endif #elif defined(WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS) && (defined(CONFIG_ARM) || defined(CONFIG_ARM64)) @@ -544,7 +544,7 @@ #endif #elif defined(WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS) - #error WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS is set for an unsupported architecture. + #error WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS is set for an unimplemented architecture. #endif /* WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS */ _Pragma("GCC diagnostic pop"); @@ -765,12 +765,12 @@ #ifdef CONFIG_X86 typeof(allocate_wolfcrypt_linuxkm_fpu_states) *allocate_wolfcrypt_linuxkm_fpu_states; - typeof(can_save_vector_registers_x86) *can_save_vector_registers_x86; + typeof(wc_can_save_vector_registers_x86) *wc_can_save_vector_registers_x86; typeof(free_wolfcrypt_linuxkm_fpu_states) *free_wolfcrypt_linuxkm_fpu_states; - typeof(restore_vector_registers_x86) *restore_vector_registers_x86; - typeof(save_vector_registers_x86) *save_vector_registers_x86; + typeof(wc_restore_vector_registers_x86) *wc_restore_vector_registers_x86; + typeof(wc_save_vector_registers_x86) *wc_save_vector_registers_x86; #else /* !CONFIG_X86 */ - #error WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS is set for an unsupported architecture. + #error WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS is set for an unimplemented architecture. #endif /* arch */ #endif /* WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS */ @@ -1046,12 +1046,12 @@ #if defined(WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS) && defined(CONFIG_X86) #define allocate_wolfcrypt_linuxkm_fpu_states WC_LKM_INDIRECT_SYM(allocate_wolfcrypt_linuxkm_fpu_states) - #define can_save_vector_registers_x86 WC_LKM_INDIRECT_SYM(can_save_vector_registers_x86) + #define wc_can_save_vector_registers_x86 WC_LKM_INDIRECT_SYM(wc_can_save_vector_registers_x86) #define free_wolfcrypt_linuxkm_fpu_states WC_LKM_INDIRECT_SYM(free_wolfcrypt_linuxkm_fpu_states) - #define restore_vector_registers_x86 WC_LKM_INDIRECT_SYM(restore_vector_registers_x86) - #define save_vector_registers_x86 WC_LKM_INDIRECT_SYM(save_vector_registers_x86) + #define wc_restore_vector_registers_x86 WC_LKM_INDIRECT_SYM(wc_restore_vector_registers_x86) + #define wc_save_vector_registers_x86 WC_LKM_INDIRECT_SYM(wc_save_vector_registers_x86) #elif defined(WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS) - #error WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS is set for an unsupported architecture. + #error WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS is set for an unimplemented architecture. #endif /* WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS */ #define __mutex_init WC_LKM_INDIRECT_SYM(__mutex_init) @@ -1182,23 +1182,20 @@ #if !defined(BUILDING_WOLFSSL) /* some caller code needs these. */ #if defined(WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS) - #ifdef CONFIG_X86 - extern __must_check int save_vector_registers_x86(enum wc_svr_flags flags); + #if defined(CONFIG_X86) + WOLFSSL_API __must_check int wc_can_save_vector_registers_x86(void); + WOLFSSL_API __must_check int wc_save_vector_registers_x86(enum wc_svr_flags flags); + WOLFSSL_API void wc_restore_vector_registers_x86(void); #ifndef DISABLE_VECTOR_REGISTERS - #define DISABLE_VECTOR_REGISTERS() save_vector_registers_x86(WC_SVR_FLAG_INHIBIT) + #define DISABLE_VECTOR_REGISTERS() wc_save_vector_registers_x86(WC_SVR_FLAG_INHIBIT) #endif #ifndef REENABLE_VECTOR_REGISTERS - #define REENABLE_VECTOR_REGISTERS() restore_vector_registers_x86() + #define REENABLE_VECTOR_REGISTERS() wc_restore_vector_registers_x86() #endif - #endif /* CONFIG_X86 */ - #else /* !WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS */ - #ifndef DISABLE_VECTOR_REGISTERS - #define DISABLE_VECTOR_REGISTERS() NOT_COMPILED_IN - #endif - #ifndef REENABLE_VECTOR_REGISTERS - #define REENABLE_VECTOR_REGISTERS() WC_DO_NOTHING - #endif - #endif + #else /* !CONFIG_X86 */ + #error WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS is set for an unimplemented architecture. + #endif /* !CONFIG_X86 */ + #endif /* WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS */ #endif /* !BUILDING_WOLFSSL */ /* Copied from wc_port.h: For FIPS keep the function names the same */ diff --git a/linuxkm/module_hooks.c b/linuxkm/module_hooks.c index e0674868a..c9ceb2bb9 100644 --- a/linuxkm/module_hooks.c +++ b/linuxkm/module_hooks.c @@ -672,10 +672,10 @@ static int set_up_wolfssl_linuxkm_pie_redirect_table(void) { #if defined(WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS) && defined(CONFIG_X86) wolfssl_linuxkm_pie_redirect_table.allocate_wolfcrypt_linuxkm_fpu_states = allocate_wolfcrypt_linuxkm_fpu_states; - wolfssl_linuxkm_pie_redirect_table.can_save_vector_registers_x86 = can_save_vector_registers_x86; + wolfssl_linuxkm_pie_redirect_table.wc_can_save_vector_registers_x86 = wc_can_save_vector_registers_x86; wolfssl_linuxkm_pie_redirect_table.free_wolfcrypt_linuxkm_fpu_states = free_wolfcrypt_linuxkm_fpu_states; - wolfssl_linuxkm_pie_redirect_table.restore_vector_registers_x86 = restore_vector_registers_x86; - wolfssl_linuxkm_pie_redirect_table.save_vector_registers_x86 = save_vector_registers_x86; + wolfssl_linuxkm_pie_redirect_table.wc_restore_vector_registers_x86 = wc_restore_vector_registers_x86; + wolfssl_linuxkm_pie_redirect_table.wc_save_vector_registers_x86 = wc_save_vector_registers_x86; #elif defined(WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS) #error WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS is set for an unsupported architecture. #endif /* WOLFSSL_LINUXKM_USE_SAVE_VECTOR_REGISTERS */ diff --git a/linuxkm/x86_vector_register_glue.c b/linuxkm/x86_vector_register_glue.c index 68a0e230d..159162cd1 100644 --- a/linuxkm/x86_vector_register_glue.c +++ b/linuxkm/x86_vector_register_glue.c @@ -233,7 +233,7 @@ static inline struct wc_thread_fpu_count_ent *wc_linuxkm_fpu_state_assoc( if (unlikely(wc_linuxkm_fpu_states == NULL)) { if (! assume_fpu_began) { /* this was just a quick check for whether we're in a recursive - * save_vector_registers_x86(). we're not. + * wc_save_vector_registers_x86(). we're not. */ return NULL; } @@ -253,7 +253,7 @@ static inline struct wc_thread_fpu_count_ent *wc_linuxkm_fpu_state_assoc( } if (! assume_fpu_began) { /* this was just a quick check for whether we're in a recursive - * save_vector_registers_x86(). we're not. + * wc_save_vector_registers_x86(). we're not. * * if we're in a softirq context, we'll always wind up here, because * processes with entries in wc_linuxkm_fpu_states[] always have @@ -296,7 +296,7 @@ static inline void wc_linuxkm_fpu_state_release( __atomic_store_n(&ent->pid, 0, __ATOMIC_RELEASE); } -WARN_UNUSED_RESULT int can_save_vector_registers_x86(void) +WARN_UNUSED_RESULT int wc_can_save_vector_registers_x86(void) { struct wc_thread_fpu_count_ent *pstate; @@ -329,7 +329,7 @@ WARN_UNUSED_RESULT int can_save_vector_registers_x86(void) return 0; } -WARN_UNUSED_RESULT int save_vector_registers_x86(enum wc_svr_flags flags) +WARN_UNUSED_RESULT int wc_save_vector_registers_x86(enum wc_svr_flags flags) { struct wc_thread_fpu_count_ent *pstate; @@ -338,7 +338,7 @@ WARN_UNUSED_RESULT int save_vector_registers_x86(enum wc_svr_flags flags) * a second look at preempt_count(). */ if (((preempt_count() & (NMI_MASK | HARDIRQ_MASK)) != 0) || (task_pid_nr(current) == 0)) { - VRG_PR_WARN_X("WARNING: save_vector_registers_x86 called with preempt_count 0x%x and pid %d on CPU %d.\n", preempt_count(), task_pid_nr(current), raw_smp_processor_id()); + VRG_PR_WARN_X("WARNING: wc_save_vector_registers_x86 called with preempt_count 0x%x and pid %d on CPU %d.\n", preempt_count(), task_pid_nr(current), raw_smp_processor_id()); return WC_ACCEL_INHIBIT_E; } @@ -362,7 +362,7 @@ WARN_UNUSED_RESULT int save_vector_registers_x86(enum wc_svr_flags flags) if (unlikely((pstate->fpu_state & WC_FPU_COUNT_MASK) == WC_FPU_COUNT_MASK)) { - pr_err("ERROR: save_vector_registers_x86 recursion register overflow for " + pr_err("ERROR: wc_save_vector_registers_x86 recursion register overflow for " "pid %d on CPU %d.\n", pstate->pid, raw_smp_processor_id()); return BAD_STATE_E; } else { @@ -396,7 +396,7 @@ WARN_UNUSED_RESULT int save_vector_registers_x86(enum wc_svr_flags flags) local_bh_disable(); if (preempt_count() == 0) { - VRG_PR_ERR_X("BUG: save_vector_registers_x86(): zero preempt_count after local_bh_disable() on CPU %d.\n", + VRG_PR_ERR_X("BUG: wc_save_vector_registers_x86(): zero preempt_count after local_bh_disable() on CPU %d.\n", raw_smp_processor_id()); #if defined(CONFIG_SMP) && !defined(CONFIG_PREEMPT_COUNT) && \ (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 7, 0)) @@ -459,13 +459,13 @@ WARN_UNUSED_RESULT int save_vector_registers_x86(enum wc_svr_flags flags) pstate->fpu_state = 1U; if (preempt_count() == 0) { - VRG_PR_ERR_X("BUG: save_vector_registers_x86(): zero preempt_count after kernel_fpu_begin() on CPU %d.\n", + VRG_PR_ERR_X("BUG: wc_save_vector_registers_x86(): zero preempt_count after kernel_fpu_begin() on CPU %d.\n", raw_smp_processor_id()); } return 0; } else { - VRG_PR_WARN_X("WARNING: save_vector_registers_x86 called with no saved state and nonzero preempt_count 0x%x on CPU %d.\n", preempt_count(), raw_smp_processor_id()); + VRG_PR_WARN_X("WARNING: wc_save_vector_registers_x86 called with no saved state and nonzero preempt_count 0x%x on CPU %d.\n", preempt_count(), raw_smp_processor_id()); #ifdef WOLFSSL_LINUXKM_VERBOSE_DEBUG dump_stack(); #endif @@ -475,19 +475,19 @@ WARN_UNUSED_RESULT int save_vector_registers_x86(enum wc_svr_flags flags) __builtin_unreachable(); } -void restore_vector_registers_x86(void) +void wc_restore_vector_registers_x86(void) { struct wc_thread_fpu_count_ent *pstate; if (((preempt_count() & (NMI_MASK | HARDIRQ_MASK)) != 0) || (task_pid_nr(current) == 0)) { - VRG_PR_WARN_X("BUG: restore_vector_registers_x86() called from interrupt handler on CPU %d.\n", + VRG_PR_WARN_X("BUG: wc_restore_vector_registers_x86() called from interrupt handler on CPU %d.\n", raw_smp_processor_id()); return; } pstate = wc_linuxkm_fpu_state_assoc(0, 1); if (unlikely(pstate == NULL)) { - VRG_PR_WARN_X("BUG: restore_vector_registers_x86() called by pid %d on CPU %d " + VRG_PR_WARN_X("BUG: wc_restore_vector_registers_x86() called by pid %d on CPU %d " "with no saved state.\n", task_pid_nr(current), raw_smp_processor_id()); return;