From cb1b20dc8eef87e10207b6277b2992668e551fda Mon Sep 17 00:00:00 2001 From: Daniel Pouzzner Date: Mon, 26 Dec 2022 21:03:04 -0600 Subject: [PATCH] linuxkm/: accomodate refactoring in kernel 6.2+ of `cpu_number` to be an element of the `pcpu_hot``structure. --- linuxkm/linuxkm_wc_port.h | 12 ++++++++++-- linuxkm/module_hooks.c | 6 +++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/linuxkm/linuxkm_wc_port.h b/linuxkm/linuxkm_wc_port.h index 49e17325f..0a5b4f4ec 100644 --- a/linuxkm/linuxkm_wc_port.h +++ b/linuxkm/linuxkm_wc_port.h @@ -322,7 +322,11 @@ */ #endif #endif - typeof(cpu_number) *cpu_number; + #if LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0) + typeof(cpu_number) *cpu_number; + #else + typeof(pcpu_hot) *pcpu_hot; + #endif typeof(nr_cpu_ids) *nr_cpu_ids; #endif /* WOLFSSL_LINUXKM_SIMD_X86 */ @@ -459,7 +463,11 @@ */ #endif #endif - #define cpu_number (*(wolfssl_linuxkm_get_pie_redirect_table()->cpu_number)) + #if LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0) + #define cpu_number (*(wolfssl_linuxkm_get_pie_redirect_table()->cpu_number)) + #else + #define pcpu_hot (*(wolfssl_linuxkm_get_pie_redirect_table()->pcpu_hot)) + #endif #define nr_cpu_ids (*(wolfssl_linuxkm_get_pie_redirect_table()->nr_cpu_ids)) #endif diff --git a/linuxkm/module_hooks.c b/linuxkm/module_hooks.c index 608d34611..a91710cca 100644 --- a/linuxkm/module_hooks.c +++ b/linuxkm/module_hooks.c @@ -445,7 +445,11 @@ static int set_up_wolfssl_linuxkm_pie_redirect_table(void) { */ #endif #endif - wolfssl_linuxkm_pie_redirect_table.cpu_number = &cpu_number; + #if LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0) + wolfssl_linuxkm_pie_redirect_table.cpu_number = &cpu_number; + #else + wolfssl_linuxkm_pie_redirect_table.pcpu_hot = &pcpu_hot; + #endif wolfssl_linuxkm_pie_redirect_table.nr_cpu_ids = &nr_cpu_ids; #endif