lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d7ba2ed2-88b6-417a-a9ea-f0238980a2d6@infradead.org>
Date:   Wed, 11 Oct 2023 12:18:19 -0700
From:   Randy Dunlap <rdunlap@...radead.org>
To:     Lu Yao <yaolu@...inos.cn>, tglx@...utronix.de, mingo@...hat.com,
        bp@...en8.de, dave.hansen@...ux.intel.com, x86@...nel.org
Cc:     hpa@...or.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] x86/msi: Fix compile error caused by GENERIC_MSI_IRQ
 and X86_LOCAL_APIC



On 10/10/23 22:57, Lu Yao wrote:
> 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. So use
> 'X86_LOCAL_APIC' to expose these code rather than 'GENERIC_MSI_IRQ'.
> 
> Signed-off-by: Lu Yao <yaolu@...inos.cn>


Acked-by: Randy Dunlap <rdunlap@...radead.org>
Tested-by: Randy Dunlap <rdunlap@...radead.org> # build-tested

Thanks.

> ---
> Change from v1:
>  * Fix arch/x86/kernel/hpet.c compiled error
> Thanks to Randy for the feedback.
> v1: https://lore.kernel.org/lkml/20231008082827.279154-1-yaolu@kylinos.cn/
> 
> ---
>  arch/x86/include/asm/hw_irq.h | 6 +++---
>  arch/x86/kernel/hpet.c        | 4 ++--
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/x86/include/asm/hw_irq.h b/arch/x86/include/asm/hw_irq.h
> index 551829884734..b02c3cd3c0f6 100644
> --- a/arch/x86/include/asm/hw_irq.h
> +++ b/arch/x86/include/asm/hw_irq.h
> @@ -28,7 +28,7 @@
>  #include <asm/irq.h>
>  #include <asm/sections.h>
>  
> -#ifdef	CONFIG_X86_LOCAL_APIC
> +#ifdef	CONFIG_IRQ_DOMAIN_HIERARCHY
>  struct irq_data;
>  struct pci_dev;
>  struct msi_desc;
> @@ -105,10 +105,10 @@ static inline void irq_complete_move(struct irq_cfg *c) { }
>  #endif
>  
>  extern void apic_ack_edge(struct irq_data *data);
> -#else	/*  CONFIG_X86_LOCAL_APIC */
> +#else	/*  CONFIG_IRQ_DOMAIN_HIERARCHY */
>  static inline void lock_vector_lock(void) {}
>  static inline void unlock_vector_lock(void) {}
> -#endif	/* CONFIG_X86_LOCAL_APIC */
> +#endif	/* CONFIG_IRQ_DOMAIN_HIERARCHY */
>  
>  /* Statistics */
>  extern atomic_t irq_err_count;
> diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
> index 1648aa0204d9..9904c0d46eba 100644
> --- a/arch/x86/kernel/hpet.c
> +++ b/arch/x86/kernel/hpet.c
> @@ -52,7 +52,7 @@ unsigned long				hpet_address;
>  u8					hpet_blockid; /* OS timer block num */
>  bool					hpet_msi_disable;
>  
> -#ifdef CONFIG_GENERIC_MSI_IRQ
> +#ifdef CONFIG_X86_LOCAL_APIC
>  static DEFINE_PER_CPU(struct hpet_channel *, cpu_hpet_channel);
>  static struct irq_domain		*hpet_domain;
>  #endif
> @@ -469,7 +469,7 @@ static void __init hpet_legacy_clockevent_register(struct hpet_channel *hc)
>  /*
>   * HPET MSI Support
>   */
> -#ifdef CONFIG_GENERIC_MSI_IRQ
> +#ifdef CONFIG_X86_LOCAL_APIC
>  static void hpet_msi_unmask(struct irq_data *data)
>  {
>  	struct hpet_channel *hc = irq_data_get_irq_handler_data(data);

-- 
~Randy

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ