git: 58cf3a69a559 - main - linuxkpi: Define `boot_cpu_data.x86_max_cores`

From: Jean-Sébastien Pédron <dumbbell_at_FreeBSD.org>
Date: Fri, 11 Nov 2022 17:57:52 UTC
The branch main has been updated by dumbbell (ports committer):

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

commit 58cf3a69a5590a159b6271b0cb74bbec72245f26
Author:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2022-11-11 17:43:07 +0000
Commit:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
CommitDate: 2022-11-11 17:43:07 +0000

    linuxkpi: Define `boot_cpu_data.x86_max_cores`
    
    Reviewed by:    manu
    Approved by:    manu
    Differential Revision:  https://reviews.freebsd.org/D36971
---
 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 0b34031392ac..86d4ab9de98f 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;
 };
 
 extern struct cpuinfo_x86	boot_cpu_data;
diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c
index 26af40836c64..30cc094a5222 100644
--- a/sys/compat/linuxkpi/common/src/linux_compat.c
+++ b/sys/compat/linuxkpi/common/src/linux_compat.c
@@ -2766,6 +2766,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");