Skip to content

Commit 441ccc3

Browse files
Lu YaoIngo Molnar
authored andcommitted
x86/msi: Fix compile error caused by CONFIG_GENERIC_MSI_IRQ=y && !CONFIG_X86_LOCAL_APIC
When compiling the x86 kernel, if X86_LOCAL_APIC is not enabled but GENERIC_MSI_IRQ is selected in '.config', the following compilation error will occur: include/linux/gpio/driver.h:38:19: error: field 'msiinfo' has incomplete type kernel/irq/msi.c:752:5: error: invalid use of incomplete typedef 'msi_alloc_info_t' {aka 'struct irq_alloc_info'} kernel/irq/msi.c:740:1: error: control reaches end of non-void function This is because file such as 'kernel/irq/msi.c' only depends on 'GENERIC_MSI_IRQ', and uses 'struct msi_alloc_info_t'. However, this struct depends on 'X86_LOCAL_APIC'. When enable 'GENERIC_MSI_IRQ' or 'X86_LOCAL_APIC' will select 'IRQ_DOMAIN_HIERARCHY', so exposing this struct using 'IRQ_DOMAIN_HIERARCHY' rather than 'X86_LOCAL_APIC'. Under the above conditions, if 'HPET_TIMER' is selected, the following compilation error will occur: arch/x86/kernel/hpet.c:550:13: error: ‘x86_vector_domain’ undeclared arch/x86/kernel/hpet.c:600:9: error: implicit declaration of function ‘init_irq_alloc_info’ This is because 'x86_vector_domain' is defined in 'kernel/apic/vector.c' which is compiled only when 'X86_LOCAL_APIC' is enabled. Besides, function 'msi_domain_set_affinity' is defined in 'include/linux/msi.h' which depends on 'GENERIC_MSI_IRQ'. So use 'X86_LOCAL_APIC' and 'GENERIC_MSI_IRQ' to expose these code. Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Lu Yao <yaolu@kylinos.cn> Signed-off-by: Ingo Molnar <mingo@kernel.org> Acked-by: Randy Dunlap <rdunlap@infradead.org> Tested-by: Randy Dunlap <rdunlap@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20231012032659.323251-1-yaolu@kylinos.cn
1 parent 57baabe commit 441ccc3

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

arch/x86/include/asm/hw_irq.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#include <asm/irq.h>
2929
#include <asm/sections.h>
3030

31-
#ifdef CONFIG_X86_LOCAL_APIC
31+
#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
3232
struct irq_data;
3333
struct pci_dev;
3434
struct msi_desc;
@@ -105,10 +105,10 @@ static inline void irq_complete_move(struct irq_cfg *c) { }
105105
#endif
106106

107107
extern void apic_ack_edge(struct irq_data *data);
108-
#else /* CONFIG_X86_LOCAL_APIC */
108+
#else /* CONFIG_IRQ_DOMAIN_HIERARCHY */
109109
static inline void lock_vector_lock(void) {}
110110
static inline void unlock_vector_lock(void) {}
111-
#endif /* CONFIG_X86_LOCAL_APIC */
111+
#endif /* CONFIG_IRQ_DOMAIN_HIERARCHY */
112112

113113
/* Statistics */
114114
extern atomic_t irq_err_count;

arch/x86/kernel/hpet.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ unsigned long hpet_address;
5252
u8 hpet_blockid; /* OS timer block num */
5353
bool hpet_msi_disable;
5454

55-
#ifdef CONFIG_GENERIC_MSI_IRQ
55+
#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_GENERIC_MSI_IRQ)
5656
static DEFINE_PER_CPU(struct hpet_channel *, cpu_hpet_channel);
5757
static struct irq_domain *hpet_domain;
5858
#endif
@@ -469,7 +469,7 @@ static void __init hpet_legacy_clockevent_register(struct hpet_channel *hc)
469469
/*
470470
* HPET MSI Support
471471
*/
472-
#ifdef CONFIG_GENERIC_MSI_IRQ
472+
#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_GENERIC_MSI_IRQ)
473473
static void hpet_msi_unmask(struct irq_data *data)
474474
{
475475
struct hpet_channel *hc = irq_data_get_irq_handler_data(data);

0 commit comments

Comments
 (0)