git: fdc1894795ef - main - linuxkpi: on i386 only use first_msi_irq if apic is in kernel config

From: Tijl Coosemans <tijl_at_FreeBSD.org>
Date: Thu, 01 Sep 2022 12:10:52 UTC
The branch main has been updated by tijl:

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

commit fdc1894795efb5c9d97044a724c01d149c569440
Author:     Tijl Coosemans <tijl@FreeBSD.org>
AuthorDate: 2021-05-01 16:01:22 +0000
Commit:     Tijl Coosemans <tijl@FreeBSD.org>
CommitDate: 2022-09-01 12:08:15 +0000

    linuxkpi: on i386 only use first_msi_irq if apic is in kernel config
---
 sys/compat/linuxkpi/common/src/linux_current.c | 10 ++++++++--
 sys/modules/linuxkpi/Makefile                  |  4 ++++
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/sys/compat/linuxkpi/common/src/linux_current.c b/sys/compat/linuxkpi/common/src/linux_current.c
index 925d96770cc2..bfebbcb81d90 100644
--- a/sys/compat/linuxkpi/common/src/linux_current.c
+++ b/sys/compat/linuxkpi/common/src/linux_current.c
@@ -27,6 +27,12 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
+#ifdef __amd64__
+#define	DEV_APIC
+#elif defined(__i386__)
+#include "opt_apic.h"
+#endif
+
 #include <linux/compat.h>
 #include <linux/completion.h>
 #include <linux/mm.h>
@@ -39,7 +45,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/sysctl.h>
 #include <vm/uma.h>
 
-#if defined(__i386__) || defined(__amd64__)
+#ifdef DEV_APIC
 extern u_int first_msi_irq, num_msi_irqs;
 #endif
 
@@ -274,7 +280,7 @@ linux_current_init(void *arg __unused)
 	TUNABLE_INT_FETCH("compat.linuxkpi.task_struct_reserve",
 	    &lkpi_task_resrv);
 	if (lkpi_task_resrv == 0) {
-#if defined(__i386__) || defined(__amd64__)
+#ifdef DEV_APIC
 		/*
 		 * Number of interrupt threads plus per-cpu callout
 		 * SWI threads.
diff --git a/sys/modules/linuxkpi/Makefile b/sys/modules/linuxkpi/Makefile
index 935584e39376..21663a078027 100644
--- a/sys/modules/linuxkpi/Makefile
+++ b/sys/modules/linuxkpi/Makefile
@@ -38,6 +38,10 @@ SRCS=	linux_compat.c \
 SRCS+=	opt_acpi.h acpi_if.h linux_acpi.c
 .endif
 
+.if ${MACHINE_CPUARCH} == "i386"
+SRCS+=	opt_apic.h
+.endif
+
 SRCS+=	opt_ddb.h
 SRCS+=	${LINUXKPI_GENSRCS}