git: a509f71358b7 - stable/13 - linuxkpi: Define `boot_cpu_data.x86_max_cores`

From: Emmanuel Vadot <manu_at_FreeBSD.org>
Date: Tue, 24 Jan 2023 08:54:16 UTC
The branch stable/13 has been updated by manu:

URL: https://cgit.FreeBSD.org/src/commit/?id=a509f71358b7ceb9a3846e77cb411ce7bf720791

commit a509f71358b7ceb9a3846e77cb411ce7bf720791
Author:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2022-11-11 17:43:07 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2023-01-24 09:08:01 +0000

    linuxkpi: Define `boot_cpu_data.x86_max_cores`
    
    Reviewed by:    manu
    Approved by:    manu
    Differential Revision:  https://reviews.freebsd.org/D36971
    
    (cherry picked from commit 58cf3a69a5590a159b6271b0cb74bbec72245f26)
---
 sys/compat/linuxkpi/common/include/asm/processor.h | 1 +
 sys/compat/linuxkpi/common/src/linux_compat.c      | 1 +
 2 files changed, 2 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/asm/processor.h b/sys/compat/linuxkpi/common/include/asm/processor.h
index 450192750612..ee2f48b50b44 100644
--- a/sys/compat/linuxkpi/common/include/asm/processor.h
+++ b/sys/compat/linuxkpi/common/include/asm/processor.h
@@ -36,6 +36,7 @@
 struct cpuinfo_x86 {
 	uint8_t		x86;
 	uint16_t	x86_clflush_size;
+	uint16_t	x86_max_cores;
 };
 
 #define	cpu_relax()	cpu_spinwait()
diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c
index 082219721de1..0714106ca418 100644
--- a/sys/compat/linuxkpi/common/src/linux_compat.c
+++ b/sys/compat/linuxkpi/common/src/linux_compat.c
@@ -2768,6 +2768,7 @@ linux_compat_init(void *arg)
 #if defined(__i386__) || defined(__amd64__)
 	linux_cpu_has_clflush = (cpu_feature & CPUID_CLFSH);
 	boot_cpu_data.x86_clflush_size = cpu_clflush_line_size;
+	boot_cpu_data.x86_max_cores = mp_ncpus;
 	boot_cpu_data.x86 = ((cpu_id & 0xf0000) >> 12) | ((cpu_id & 0xf0) >> 4);
 #endif
 	rw_init(&linux_vma_lock, "lkpi-vma-lock");