git: 5407f767db14 - main - linuxkpi: Compile `x86_match_cpu()` on amd64 and i386 only

From: Jean-Sébastien Pédron <dumbbell_at_FreeBSD.org>
Date: Tue, 15 Sep 2026 07:57:20 UTC
The branch main has been updated by dumbbell:

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

commit 5407f767db14a76bb63b5a8b3f77da6085d149c5
Author:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2026-09-14 20:37:55 +0000
Commit:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
CommitDate: 2026-09-15 07:55:35 +0000

    linuxkpi: Compile `x86_match_cpu()` on amd64 and i386 only
    
    This fixes the build on other architectures where `struct x86_cpu_id` is
    unavailable.
    
    Sponsored by:   The FreeBSD Foundation
---
 sys/compat/linuxkpi/common/include/asm/cpu_device_id.h | 2 ++
 sys/compat/linuxkpi/common/src/linux_compat.c          | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/asm/cpu_device_id.h b/sys/compat/linuxkpi/common/include/asm/cpu_device_id.h
index 5741cddd52b1..890038ba742a 100644
--- a/sys/compat/linuxkpi/common/include/asm/cpu_device_id.h
+++ b/sys/compat/linuxkpi/common/include/asm/cpu_device_id.h
@@ -52,7 +52,9 @@
 	X86_STEPPING_ANY,						\
 	X86_FEATURE_ANY)
 
+#if defined(__i386__) || defined(__amd64__)
 const struct x86_cpu_id *linuxkpi_x86_match_cpu(const struct x86_cpu_id *match_array);
 #define	x86_match_cpu(match_array) linuxkpi_x86_match_cpu(match_array)
+#endif
 
 #endif /* _LINUXKPI_ASM_CPU_DEVICE_ID_H_ */
diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c
index 3cdeb8e2d297..84f95b3ec317 100644
--- a/sys/compat/linuxkpi/common/src/linux_compat.c
+++ b/sys/compat/linuxkpi/common/src/linux_compat.c
@@ -3087,6 +3087,7 @@ linux_compat_uninit(void *arg)
 }
 SYSUNINIT(linux_compat, SI_SUB_DRIVERS, SI_ORDER_SECOND, linux_compat_uninit, NULL);
 
+#if defined(__i386__) || defined(__amd64__)
 const struct x86_cpu_id *
 linuxkpi_x86_match_cpu(const struct x86_cpu_id *match_array)
 {
@@ -3120,6 +3121,7 @@ linuxkpi_x86_match_cpu(const struct x86_cpu_id *match_array)
 
 	return (NULL);
 }
+#endif
 
 /*
  * NOTE: Linux frequently uses "unsigned long" for pointer to integer