linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/msi: Fix compile error "incomplete typedef 'msi_alloc_info_t'"
@ 2023-10-08  8:28 yaolu
  2023-10-10 15:59 ` Randy Dunlap
  2023-10-11  5:57 ` [PATCH v2] x86/msi: Fix compile error caused by GENERIC_MSI_IRQ and X86_LOCAL_APIC Lu Yao
  0 siblings, 2 replies; 10+ messages in thread
From: yaolu @ 2023-10-08  8:28 UTC (permalink / raw)
  To: tglx, mingo, bp, dave.hansen; +Cc: x86, hpa, linux-kernel, yaolu

When compiling the x86 kernel, if X86_64 || SMP || X86_32_NON_STANDARD ||
X86_UP_APIC || PCI_MSI is not enabled in '.config' and GENERIC_MSI_IRQ is
selected, 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 'X86_LOCAL_APIC' is not defined, but file such as
'kernel/irq/msi.c' only depends on 'GENERIC_MSI_IRQ', and uses
'struct msi_alloc_info_t'. When enable 'GENERIC_MSI_IRQ' will select
'IRQ_DOMAIN_HIERARCHY', so exposing this struct using
'IRQ_DOMAIN_HIERARCHY' rather than 'X86_LOCAL_APIC'.

Signed-off-by: yaolu <yaolu@kylinos.cn>
---
 arch/x86/include/asm/hw_irq.h | 6 +++---
 1 file changed, 3 insertions(+), 3 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;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] x86/msi: Fix compile error "incomplete typedef 'msi_alloc_info_t'"
  2023-10-08  8:28 [PATCH] x86/msi: Fix compile error "incomplete typedef 'msi_alloc_info_t'" yaolu
@ 2023-10-10 15:59 ` Randy Dunlap
  2023-10-11  5:57 ` [PATCH v2] x86/msi: Fix compile error caused by GENERIC_MSI_IRQ and X86_LOCAL_APIC Lu Yao
  1 sibling, 0 replies; 10+ messages in thread
From: Randy Dunlap @ 2023-10-10 15:59 UTC (permalink / raw)
  To: yaolu, tglx, mingo, bp, dave.hansen; +Cc: x86, hpa, linux-kernel

Hi,

On 10/8/23 01:28, yaolu wrote:
> When compiling the x86 kernel, if X86_64 || SMP || X86_32_NON_STANDARD ||
> X86_UP_APIC || PCI_MSI is not enabled in '.config' and GENERIC_MSI_IRQ is
> selected, 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 'X86_LOCAL_APIC' is not defined, but file such as
> 'kernel/irq/msi.c' only depends on 'GENERIC_MSI_IRQ', and uses
> 'struct msi_alloc_info_t'. When enable 'GENERIC_MSI_IRQ' will select
> 'IRQ_DOMAIN_HIERARCHY', so exposing this struct using
> 'IRQ_DOMAIN_HIERARCHY' rather than 'X86_LOCAL_APIC'.
> 
> Signed-off-by: yaolu <yaolu@kylinos.cn>

Thank for the patch. This reduces the build error count from around 190 down to
two remaining problems for me:

../arch/x86/kernel/hpet.c: In function ‘hpet_create_irq_domain’:
../arch/x86/kernel/hpet.c:550:13: error: ‘x86_vector_domain’ undeclared (first use in this function)
  550 |         if (x86_vector_domain == NULL)
      |             ^~~~~~~~~~~~~~~~~
../arch/x86/kernel/hpet.c:550:13: note: each undeclared identifier is reported only once for each function it appears in
../arch/x86/kernel/hpet.c: In function ‘hpet_assign_irq’:
../arch/x86/kernel/hpet.c:600:9: error: implicit declaration of function ‘init_irq_alloc_info’ [-Werror=implicit-function-declaration]
  600 |         init_irq_alloc_info(&info, NULL);
      |         ^~~~~~~~~~~~~~~~~~~


I haven't looked into how to fix this yet...

> ---
>  arch/x86/include/asm/hw_irq.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 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;

-- 
~Randy

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v2] x86/msi: Fix compile error caused by GENERIC_MSI_IRQ and X86_LOCAL_APIC
  2023-10-08  8:28 [PATCH] x86/msi: Fix compile error "incomplete typedef 'msi_alloc_info_t'" yaolu
  2023-10-10 15:59 ` Randy Dunlap
@ 2023-10-11  5:57 ` Lu Yao
  2023-10-11 19:18   ` Randy Dunlap
                     ` (4 more replies)
  1 sibling, 5 replies; 10+ messages in thread
From: Lu Yao @ 2023-10-11  5:57 UTC (permalink / raw)
  To: tglx, mingo, bp, dave.hansen, x86, rdunlap; +Cc: hpa, linux-kernel, Lu Yao

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@kylinos.cn>
---
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);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] x86/msi: Fix compile error caused by GENERIC_MSI_IRQ and X86_LOCAL_APIC
  2023-10-11  5:57 ` [PATCH v2] x86/msi: Fix compile error caused by GENERIC_MSI_IRQ and X86_LOCAL_APIC Lu Yao
@ 2023-10-11 19:18   ` Randy Dunlap
  2023-10-12  0:35   ` kernel test robot
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Randy Dunlap @ 2023-10-11 19:18 UTC (permalink / raw)
  To: Lu Yao, tglx, mingo, bp, dave.hansen, x86; +Cc: hpa, linux-kernel



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@kylinos.cn>


Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] x86/msi: Fix compile error caused by GENERIC_MSI_IRQ and X86_LOCAL_APIC
  2023-10-11  5:57 ` [PATCH v2] x86/msi: Fix compile error caused by GENERIC_MSI_IRQ and X86_LOCAL_APIC Lu Yao
  2023-10-11 19:18   ` Randy Dunlap
@ 2023-10-12  0:35   ` kernel test robot
  2023-10-12  3:26   ` [PATCH v3] " Lu Yao
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2023-10-12  0:35 UTC (permalink / raw)
  To: Lu Yao, tglx, mingo, bp, dave.hansen, x86, rdunlap
  Cc: oe-kbuild-all, hpa, linux-kernel, Lu Yao

Hi Lu,

kernel test robot noticed the following build warnings:

[auto build test WARNING on tip/master]
[also build test WARNING on tip/x86/core tip/auto-latest linus/master v6.6-rc5 next-20231011]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Lu-Yao/x86-msi-Fix-compile-error-caused-by-GENERIC_MSI_IRQ-and-X86_LOCAL_APIC/20231011-135941
base:   tip/master
patch link:    https://lore.kernel.org/r/20231011055749.98840-1-yaolu%40kylinos.cn
patch subject: [PATCH v2] x86/msi: Fix compile error caused by GENERIC_MSI_IRQ and X86_LOCAL_APIC
config: i386-buildonly-randconfig-001-20231012 (https://download.01.org/0day-ci/archive/20231012/202310120849.zrfrI44Z-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-12) 11.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231012/202310120849.zrfrI44Z-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202310120849.zrfrI44Z-lkp@intel.com/

All warnings (new ones prefixed by >>):

   arch/x86/kernel/hpet.c:509:29: error: 'msi_domain_set_affinity' undeclared here (not in a function); did you mean 'irq_can_set_affinity'?
     509 |         .irq_set_affinity = msi_domain_set_affinity,
         |                             ^~~~~~~~~~~~~~~~~~~~~~~
         |                             irq_can_set_affinity
>> arch/x86/kernel/hpet.c:516:33: warning: 'struct msi_domain_info' declared inside parameter list will not be visible outside of this definition or declaration
     516 |                          struct msi_domain_info *info, unsigned int virq,
         |                                 ^~~~~~~~~~~~~~~
   arch/x86/kernel/hpet.c: In function 'hpet_msi_init':
   arch/x86/kernel/hpet.c:520:59: error: invalid use of undefined type 'struct msi_domain_info'
     520 |         irq_domain_set_info(domain, virq, arg->hwirq, info->chip, NULL,
         |                                                           ^~
   arch/x86/kernel/hpet.c: At top level:
   arch/x86/kernel/hpet.c:527:34: warning: 'struct msi_domain_info' declared inside parameter list will not be visible outside of this definition or declaration
     527 |                           struct msi_domain_info *info, unsigned int virq)
         |                                  ^~~~~~~~~~~~~~~
   arch/x86/kernel/hpet.c:532:15: error: variable 'hpet_msi_domain_ops' has initializer but incomplete type
     532 | static struct msi_domain_ops hpet_msi_domain_ops = {
         |               ^~~~~~~~~~~~~~
   arch/x86/kernel/hpet.c:533:10: error: 'struct msi_domain_ops' has no member named 'msi_init'
     533 |         .msi_init       = hpet_msi_init,
         |          ^~~~~~~~
>> arch/x86/kernel/hpet.c:533:27: warning: excess elements in struct initializer
     533 |         .msi_init       = hpet_msi_init,
         |                           ^~~~~~~~~~~~~
   arch/x86/kernel/hpet.c:533:27: note: (near initialization for 'hpet_msi_domain_ops')
   arch/x86/kernel/hpet.c:534:10: error: 'struct msi_domain_ops' has no member named 'msi_free'
     534 |         .msi_free       = hpet_msi_free,
         |          ^~~~~~~~
   arch/x86/kernel/hpet.c:534:27: warning: excess elements in struct initializer
     534 |         .msi_free       = hpet_msi_free,
         |                           ^~~~~~~~~~~~~
   arch/x86/kernel/hpet.c:534:27: note: (near initialization for 'hpet_msi_domain_ops')
   arch/x86/kernel/hpet.c:537:15: error: variable 'hpet_msi_domain_info' has initializer but incomplete type
     537 | static struct msi_domain_info hpet_msi_domain_info = {
         |               ^~~~~~~~~~~~~~~
   arch/x86/kernel/hpet.c:538:10: error: 'struct msi_domain_info' has no member named 'ops'
     538 |         .ops            = &hpet_msi_domain_ops,
         |          ^~~
   arch/x86/kernel/hpet.c:538:27: warning: excess elements in struct initializer
     538 |         .ops            = &hpet_msi_domain_ops,
         |                           ^
   arch/x86/kernel/hpet.c:538:27: note: (near initialization for 'hpet_msi_domain_info')
   arch/x86/kernel/hpet.c:539:10: error: 'struct msi_domain_info' has no member named 'chip'
     539 |         .chip           = &hpet_msi_controller,
         |          ^~~~
   arch/x86/kernel/hpet.c:539:27: warning: excess elements in struct initializer
     539 |         .chip           = &hpet_msi_controller,
         |                           ^
   arch/x86/kernel/hpet.c:539:27: note: (near initialization for 'hpet_msi_domain_info')
   arch/x86/kernel/hpet.c:540:10: error: 'struct msi_domain_info' has no member named 'flags'
     540 |         .flags          = MSI_FLAG_USE_DEF_DOM_OPS,
         |          ^~~~~
   arch/x86/kernel/hpet.c:540:27: error: 'MSI_FLAG_USE_DEF_DOM_OPS' undeclared here (not in a function)
     540 |         .flags          = MSI_FLAG_USE_DEF_DOM_OPS,
         |                           ^~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kernel/hpet.c:540:27: warning: excess elements in struct initializer
   arch/x86/kernel/hpet.c:540:27: note: (near initialization for 'hpet_msi_domain_info')
   arch/x86/kernel/hpet.c: In function 'hpet_create_irq_domain':
   arch/x86/kernel/hpet.c:553:37: error: invalid application of 'sizeof' to incomplete type 'struct msi_domain_info'
     553 |         domain_info = kzalloc(sizeof(*domain_info), GFP_KERNEL);
         |                                     ^
   arch/x86/kernel/hpet.c:557:24: error: 'hpet_msi_domain_info' has an incomplete type 'struct msi_domain_info'
     557 |         *domain_info = hpet_msi_domain_info;
         |                        ^~~~~~~~~~~~~~~~~~~~
   arch/x86/kernel/hpet.c:557:22: error: invalid use of undefined type 'struct msi_domain_info'
     557 |         *domain_info = hpet_msi_domain_info;
         |                      ^
   arch/x86/kernel/hpet.c:558:20: error: invalid use of undefined type 'struct msi_domain_info'
     558 |         domain_info->data = (void *)(long)hpet_id;
         |                    ^~
   arch/x86/kernel/hpet.c:580:13: error: implicit declaration of function 'msi_create_irq_domain'; did you mean 'hpet_create_irq_domain'? [-Werror=implicit-function-declaration]
     580 |         d = msi_create_irq_domain(fn, domain_info, parent);
         |             ^~~~~~~~~~~~~~~~~~~~~
         |             hpet_create_irq_domain
>> arch/x86/kernel/hpet.c:580:11: warning: assignment to 'struct irq_domain *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     580 |         d = msi_create_irq_domain(fn, domain_info, parent);
         |           ^
   arch/x86/kernel/hpet.c: In function 'hpet_dev_id':
   arch/x86/kernel/hpet.c:590:40: error: implicit declaration of function 'msi_get_domain_info' [-Werror=implicit-function-declaration]
     590 |         struct msi_domain_info *info = msi_get_domain_info(domain);
         |                                        ^~~~~~~~~~~~~~~~~~~
>> arch/x86/kernel/hpet.c:590:40: warning: initialization of 'struct msi_domain_info *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
   arch/x86/kernel/hpet.c:592:31: error: invalid use of undefined type 'struct msi_domain_info'
     592 |         return (int)(long)info->data;
         |                               ^~
   arch/x86/kernel/hpet.c: At top level:
   arch/x86/kernel/hpet.c:532:30: error: storage size of 'hpet_msi_domain_ops' isn't known
     532 | static struct msi_domain_ops hpet_msi_domain_ops = {
         |                              ^~~~~~~~~~~~~~~~~~~
   arch/x86/kernel/hpet.c:537:31: error: storage size of 'hpet_msi_domain_info' isn't known
     537 | static struct msi_domain_info hpet_msi_domain_info = {
         |                               ^~~~~~~~~~~~~~~~~~~~
   arch/x86/kernel/hpet.c: In function 'hpet_dev_id':
   arch/x86/kernel/hpet.c:593:1: error: control reaches end of non-void function [-Werror=return-type]
     593 | }
         | ^
   cc1: some warnings being treated as errors


vim +516 arch/x86/kernel/hpet.c

3d7295eb3003ae David Woodhouse 2020-10-24  514  
3d7295eb3003ae David Woodhouse 2020-10-24  515  static int hpet_msi_init(struct irq_domain *domain,
3d7295eb3003ae David Woodhouse 2020-10-24 @516  			 struct msi_domain_info *info, unsigned int virq,
3d7295eb3003ae David Woodhouse 2020-10-24  517  			 irq_hw_number_t hwirq, msi_alloc_info_t *arg)
3d7295eb3003ae David Woodhouse 2020-10-24  518  {
3d7295eb3003ae David Woodhouse 2020-10-24  519  	irq_set_status_flags(virq, IRQ_MOVE_PCNTXT);
3d7295eb3003ae David Woodhouse 2020-10-24  520  	irq_domain_set_info(domain, virq, arg->hwirq, info->chip, NULL,
3d7295eb3003ae David Woodhouse 2020-10-24  521  			    handle_edge_irq, arg->data, "edge");
3d7295eb3003ae David Woodhouse 2020-10-24  522  
3d7295eb3003ae David Woodhouse 2020-10-24  523  	return 0;
3d7295eb3003ae David Woodhouse 2020-10-24  524  }
3d7295eb3003ae David Woodhouse 2020-10-24  525  
3d7295eb3003ae David Woodhouse 2020-10-24  526  static void hpet_msi_free(struct irq_domain *domain,
3d7295eb3003ae David Woodhouse 2020-10-24  527  			  struct msi_domain_info *info, unsigned int virq)
3d7295eb3003ae David Woodhouse 2020-10-24  528  {
3d7295eb3003ae David Woodhouse 2020-10-24  529  	irq_clear_status_flags(virq, IRQ_MOVE_PCNTXT);
3d7295eb3003ae David Woodhouse 2020-10-24  530  }
3d7295eb3003ae David Woodhouse 2020-10-24  531  
3d7295eb3003ae David Woodhouse 2020-10-24  532  static struct msi_domain_ops hpet_msi_domain_ops = {
3d7295eb3003ae David Woodhouse 2020-10-24 @533  	.msi_init	= hpet_msi_init,
3d7295eb3003ae David Woodhouse 2020-10-24  534  	.msi_free	= hpet_msi_free,
3d7295eb3003ae David Woodhouse 2020-10-24  535  };
3d7295eb3003ae David Woodhouse 2020-10-24  536  
3d7295eb3003ae David Woodhouse 2020-10-24  537  static struct msi_domain_info hpet_msi_domain_info = {
3d7295eb3003ae David Woodhouse 2020-10-24  538  	.ops		= &hpet_msi_domain_ops,
3d7295eb3003ae David Woodhouse 2020-10-24  539  	.chip		= &hpet_msi_controller,
3d7295eb3003ae David Woodhouse 2020-10-24  540  	.flags		= MSI_FLAG_USE_DEF_DOM_OPS,
3d7295eb3003ae David Woodhouse 2020-10-24  541  };
3d7295eb3003ae David Woodhouse 2020-10-24  542  
3d7295eb3003ae David Woodhouse 2020-10-24  543  static struct irq_domain *hpet_create_irq_domain(int hpet_id)
3d7295eb3003ae David Woodhouse 2020-10-24  544  {
3d7295eb3003ae David Woodhouse 2020-10-24  545  	struct msi_domain_info *domain_info;
3d7295eb3003ae David Woodhouse 2020-10-24  546  	struct irq_domain *parent, *d;
3d7295eb3003ae David Woodhouse 2020-10-24  547  	struct fwnode_handle *fn;
c2a5881c28e5bb David Woodhouse 2020-10-24  548  	struct irq_fwspec fwspec;
3d7295eb3003ae David Woodhouse 2020-10-24  549  
3d7295eb3003ae David Woodhouse 2020-10-24  550  	if (x86_vector_domain == NULL)
3d7295eb3003ae David Woodhouse 2020-10-24  551  		return NULL;
3d7295eb3003ae David Woodhouse 2020-10-24  552  
3d7295eb3003ae David Woodhouse 2020-10-24  553  	domain_info = kzalloc(sizeof(*domain_info), GFP_KERNEL);
3d7295eb3003ae David Woodhouse 2020-10-24  554  	if (!domain_info)
3d7295eb3003ae David Woodhouse 2020-10-24  555  		return NULL;
3d7295eb3003ae David Woodhouse 2020-10-24  556  
3d7295eb3003ae David Woodhouse 2020-10-24  557  	*domain_info = hpet_msi_domain_info;
3d7295eb3003ae David Woodhouse 2020-10-24  558  	domain_info->data = (void *)(long)hpet_id;
3d7295eb3003ae David Woodhouse 2020-10-24  559  
3d7295eb3003ae David Woodhouse 2020-10-24  560  	fn = irq_domain_alloc_named_id_fwnode(hpet_msi_controller.name,
3d7295eb3003ae David Woodhouse 2020-10-24  561  					      hpet_id);
3d7295eb3003ae David Woodhouse 2020-10-24  562  	if (!fn) {
3d7295eb3003ae David Woodhouse 2020-10-24  563  		kfree(domain_info);
3d7295eb3003ae David Woodhouse 2020-10-24  564  		return NULL;
3d7295eb3003ae David Woodhouse 2020-10-24  565  	}
3d7295eb3003ae David Woodhouse 2020-10-24  566  
c2a5881c28e5bb David Woodhouse 2020-10-24  567  	fwspec.fwnode = fn;
c2a5881c28e5bb David Woodhouse 2020-10-24  568  	fwspec.param_count = 1;
c2a5881c28e5bb David Woodhouse 2020-10-24  569  	fwspec.param[0] = hpet_id;
c2a5881c28e5bb David Woodhouse 2020-10-24  570  
c2a5881c28e5bb David Woodhouse 2020-10-24  571  	parent = irq_find_matching_fwspec(&fwspec, DOMAIN_BUS_ANY);
c2a5881c28e5bb David Woodhouse 2020-10-24  572  	if (!parent) {
c2a5881c28e5bb David Woodhouse 2020-10-24  573  		irq_domain_free_fwnode(fn);
c2a5881c28e5bb David Woodhouse 2020-10-24  574  		kfree(domain_info);
c2a5881c28e5bb David Woodhouse 2020-10-24  575  		return NULL;
c2a5881c28e5bb David Woodhouse 2020-10-24  576  	}
c2a5881c28e5bb David Woodhouse 2020-10-24  577  	if (parent != x86_vector_domain)
c2a5881c28e5bb David Woodhouse 2020-10-24  578  		hpet_msi_controller.name = "IR-HPET-MSI";
c2a5881c28e5bb David Woodhouse 2020-10-24  579  
3d7295eb3003ae David Woodhouse 2020-10-24 @580  	d = msi_create_irq_domain(fn, domain_info, parent);
3d7295eb3003ae David Woodhouse 2020-10-24  581  	if (!d) {
3d7295eb3003ae David Woodhouse 2020-10-24  582  		irq_domain_free_fwnode(fn);
3d7295eb3003ae David Woodhouse 2020-10-24  583  		kfree(domain_info);
3d7295eb3003ae David Woodhouse 2020-10-24  584  	}
3d7295eb3003ae David Woodhouse 2020-10-24  585  	return d;
3d7295eb3003ae David Woodhouse 2020-10-24  586  }
3d7295eb3003ae David Woodhouse 2020-10-24  587  
3d7295eb3003ae David Woodhouse 2020-10-24  588  static inline int hpet_dev_id(struct irq_domain *domain)
3d7295eb3003ae David Woodhouse 2020-10-24  589  {
3d7295eb3003ae David Woodhouse 2020-10-24 @590  	struct msi_domain_info *info = msi_get_domain_info(domain);
3d7295eb3003ae David Woodhouse 2020-10-24  591  
3d7295eb3003ae David Woodhouse 2020-10-24  592  	return (int)(long)info->data;
3d7295eb3003ae David Woodhouse 2020-10-24  593  }
3d7295eb3003ae David Woodhouse 2020-10-24  594  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v3] x86/msi: Fix compile error caused by GENERIC_MSI_IRQ and X86_LOCAL_APIC
  2023-10-11  5:57 ` [PATCH v2] x86/msi: Fix compile error caused by GENERIC_MSI_IRQ and X86_LOCAL_APIC Lu Yao
  2023-10-11 19:18   ` Randy Dunlap
  2023-10-12  0:35   ` kernel test robot
@ 2023-10-12  3:26   ` Lu Yao
  2023-10-12  6:25     ` [tip: x86/apic] x86/msi: Fix compile error caused by CONFIG_GENERIC_MSI_IRQ=y && !CONFIG_X86_LOCAL_APIC tip-bot2 for Lu Yao
  2023-10-12 10:59   ` [PATCH v2] x86/msi: Fix compile error caused by GENERIC_MSI_IRQ and X86_LOCAL_APIC kernel test robot
  2023-10-12 11:30   ` kernel test robot
  4 siblings, 1 reply; 10+ messages in thread
From: Lu Yao @ 2023-10-12  3:26 UTC (permalink / raw)
  To: tglx, mingo, bp, dave.hansen, x86; +Cc: hpa, linux-kernel, rdunlap, lkp, Lu Yao

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.

Tested-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Lu Yao <yaolu@kylinos.cn>
---
Change from v2:
 * Fix arch/x86/kernel/hpet.c compiled error when enable 'X86_LOCAL_APIC'
   'HPET_TIMER' but disable 'GENERIC_MSI_IRQ'.
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202310120849.zrfrI44Z-lkp@intel.com/
v2: https://patchew.org/linux/20231011055749.98840-1-yaolu@kylinos.cn/

Change from v1:
 * Fix arch/x86/kernel/hpet.c compiled error when enable 'X86_LOCAL_APIC'
   'GENERIC_MSI_IRQ' 'HPET_TIMER'
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..41eecf180b7f 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
+#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_GENERIC_MSI_IRQ)
 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
+#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_GENERIC_MSI_IRQ)
 static void hpet_msi_unmask(struct irq_data *data)
 {
 	struct hpet_channel *hc = irq_data_get_irq_handler_data(data);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [tip: x86/apic] x86/msi: Fix compile error caused by CONFIG_GENERIC_MSI_IRQ=y && !CONFIG_X86_LOCAL_APIC
  2023-10-12  3:26   ` [PATCH v3] " Lu Yao
@ 2023-10-12  6:25     ` tip-bot2 for Lu Yao
  0 siblings, 0 replies; 10+ messages in thread
From: tip-bot2 for Lu Yao @ 2023-10-12  6:25 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: kernel test robot, Lu Yao, Ingo Molnar, Randy Dunlap,
	Thomas Gleixner, x86, linux-kernel

The following commit has been merged into the x86/apic branch of tip:

Commit-ID:     441ccc351256533b6381e86a5648dbfe04b74286
Gitweb:        https://git.kernel.org/tip/441ccc351256533b6381e86a5648dbfe04b74286
Author:        Lu Yao <yaolu@kylinos.cn>
AuthorDate:    Thu, 12 Oct 2023 11:26:59 +08:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Thu, 12 Oct 2023 08:13:27 +02:00

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
---
 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 5518298..b02c3cd 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 1648aa0..41eecf1 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
+#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_GENERIC_MSI_IRQ)
 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
+#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_GENERIC_MSI_IRQ)
 static void hpet_msi_unmask(struct irq_data *data)
 {
 	struct hpet_channel *hc = irq_data_get_irq_handler_data(data);

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] x86/msi: Fix compile error caused by GENERIC_MSI_IRQ and X86_LOCAL_APIC
  2023-10-11  5:57 ` [PATCH v2] x86/msi: Fix compile error caused by GENERIC_MSI_IRQ and X86_LOCAL_APIC Lu Yao
                     ` (2 preceding siblings ...)
  2023-10-12  3:26   ` [PATCH v3] " Lu Yao
@ 2023-10-12 10:59   ` kernel test robot
  2023-10-12 11:30   ` kernel test robot
  4 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2023-10-12 10:59 UTC (permalink / raw)
  To: Lu Yao, tglx, mingo, bp, dave.hansen, x86, rdunlap
  Cc: oe-kbuild-all, hpa, linux-kernel, Lu Yao

Hi Lu,

kernel test robot noticed the following build errors:

[auto build test ERROR on tip/master]
[also build test ERROR on tip/x86/core tip/auto-latest linus/master v6.6-rc5 next-20231012]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Lu-Yao/x86-msi-Fix-compile-error-caused-by-GENERIC_MSI_IRQ-and-X86_LOCAL_APIC/20231011-135941
base:   tip/master
patch link:    https://lore.kernel.org/r/20231011055749.98840-1-yaolu%40kylinos.cn
patch subject: [PATCH v2] x86/msi: Fix compile error caused by GENERIC_MSI_IRQ and X86_LOCAL_APIC
config: x86_64-buildonly-randconfig-006-20231012 (https://download.01.org/0day-ci/archive/20231012/202310121805.SVZD3j7K-lkp@intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231012/202310121805.SVZD3j7K-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202310121805.SVZD3j7K-lkp@intel.com/

All errors (new ones prefixed by >>):

   arch/x86/kernel/hpet.c:509:22: error: 'msi_domain_set_affinity' undeclared here (not in a function); did you mean 'irq_can_set_affinity'?
     509 |  .irq_set_affinity = msi_domain_set_affinity,
         |                      ^~~~~~~~~~~~~~~~~~~~~~~
         |                      irq_can_set_affinity
   arch/x86/kernel/hpet.c:516:12: warning: 'struct msi_domain_info' declared inside parameter list will not be visible outside of this definition or declaration
     516 |     struct msi_domain_info *info, unsigned int virq,
         |            ^~~~~~~~~~~~~~~
   arch/x86/kernel/hpet.c: In function 'hpet_msi_init':
>> arch/x86/kernel/hpet.c:520:52: error: dereferencing pointer to incomplete type 'struct msi_domain_info'
     520 |  irq_domain_set_info(domain, virq, arg->hwirq, info->chip, NULL,
         |                                                    ^~
   arch/x86/kernel/hpet.c: At top level:
   arch/x86/kernel/hpet.c:527:13: warning: 'struct msi_domain_info' declared inside parameter list will not be visible outside of this definition or declaration
     527 |      struct msi_domain_info *info, unsigned int virq)
         |             ^~~~~~~~~~~~~~~
   arch/x86/kernel/hpet.c:532:15: error: variable 'hpet_msi_domain_ops' has initializer but incomplete type
     532 | static struct msi_domain_ops hpet_msi_domain_ops = {
         |               ^~~~~~~~~~~~~~
   arch/x86/kernel/hpet.c:533:3: error: 'struct msi_domain_ops' has no member named 'msi_init'
     533 |  .msi_init = hpet_msi_init,
         |   ^~~~~~~~
   arch/x86/kernel/hpet.c:533:14: warning: excess elements in struct initializer
     533 |  .msi_init = hpet_msi_init,
         |              ^~~~~~~~~~~~~
   arch/x86/kernel/hpet.c:533:14: note: (near initialization for 'hpet_msi_domain_ops')
   arch/x86/kernel/hpet.c:534:3: error: 'struct msi_domain_ops' has no member named 'msi_free'
     534 |  .msi_free = hpet_msi_free,
         |   ^~~~~~~~
   arch/x86/kernel/hpet.c:534:14: warning: excess elements in struct initializer
     534 |  .msi_free = hpet_msi_free,
         |              ^~~~~~~~~~~~~
   arch/x86/kernel/hpet.c:534:14: note: (near initialization for 'hpet_msi_domain_ops')
   arch/x86/kernel/hpet.c:537:15: error: variable 'hpet_msi_domain_info' has initializer but incomplete type
     537 | static struct msi_domain_info hpet_msi_domain_info = {
         |               ^~~~~~~~~~~~~~~
   arch/x86/kernel/hpet.c:538:3: error: 'struct msi_domain_info' has no member named 'ops'
     538 |  .ops  = &hpet_msi_domain_ops,
         |   ^~~
   arch/x86/kernel/hpet.c:538:10: warning: excess elements in struct initializer
     538 |  .ops  = &hpet_msi_domain_ops,
         |          ^
   arch/x86/kernel/hpet.c:538:10: note: (near initialization for 'hpet_msi_domain_info')
   arch/x86/kernel/hpet.c:539:3: error: 'struct msi_domain_info' has no member named 'chip'
     539 |  .chip  = &hpet_msi_controller,
         |   ^~~~
   arch/x86/kernel/hpet.c:539:11: warning: excess elements in struct initializer
     539 |  .chip  = &hpet_msi_controller,
         |           ^
   arch/x86/kernel/hpet.c:539:11: note: (near initialization for 'hpet_msi_domain_info')
   arch/x86/kernel/hpet.c:540:3: error: 'struct msi_domain_info' has no member named 'flags'
     540 |  .flags  = MSI_FLAG_USE_DEF_DOM_OPS,
         |   ^~~~~
   arch/x86/kernel/hpet.c:540:12: error: 'MSI_FLAG_USE_DEF_DOM_OPS' undeclared here (not in a function)
     540 |  .flags  = MSI_FLAG_USE_DEF_DOM_OPS,
         |            ^~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kernel/hpet.c:540:12: warning: excess elements in struct initializer
   arch/x86/kernel/hpet.c:540:12: note: (near initialization for 'hpet_msi_domain_info')
   arch/x86/kernel/hpet.c: In function 'hpet_create_irq_domain':
   arch/x86/kernel/hpet.c:553:31: error: dereferencing pointer to incomplete type 'struct msi_domain_info'
     553 |  domain_info = kzalloc(sizeof(*domain_info), GFP_KERNEL);
         |                               ^~~~~~~~~~~~
   arch/x86/kernel/hpet.c:580:6: error: implicit declaration of function 'msi_create_irq_domain'; did you mean 'hpet_create_irq_domain'? [-Werror=implicit-function-declaration]
     580 |  d = msi_create_irq_domain(fn, domain_info, parent);
         |      ^~~~~~~~~~~~~~~~~~~~~
         |      hpet_create_irq_domain
   arch/x86/kernel/hpet.c:580:4: warning: assignment to 'struct irq_domain *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     580 |  d = msi_create_irq_domain(fn, domain_info, parent);
         |    ^
   arch/x86/kernel/hpet.c: In function 'hpet_dev_id':
   arch/x86/kernel/hpet.c:590:33: error: implicit declaration of function 'msi_get_domain_info' [-Werror=implicit-function-declaration]
     590 |  struct msi_domain_info *info = msi_get_domain_info(domain);
         |                                 ^~~~~~~~~~~~~~~~~~~
   arch/x86/kernel/hpet.c:590:33: warning: initialization of 'struct msi_domain_info *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
   arch/x86/kernel/hpet.c: At top level:
   arch/x86/kernel/hpet.c:532:30: error: storage size of 'hpet_msi_domain_ops' isn't known
     532 | static struct msi_domain_ops hpet_msi_domain_ops = {
         |                              ^~~~~~~~~~~~~~~~~~~
   arch/x86/kernel/hpet.c:537:31: error: storage size of 'hpet_msi_domain_info' isn't known
     537 | static struct msi_domain_info hpet_msi_domain_info = {
         |                               ^~~~~~~~~~~~~~~~~~~~
   arch/x86/kernel/hpet.c: In function 'hpet_dev_id':
   arch/x86/kernel/hpet.c:593:1: error: control reaches end of non-void function [-Werror=return-type]
     593 | }
         | ^
   cc1: some warnings being treated as errors


vim +520 arch/x86/kernel/hpet.c

3d7295eb3003ae David Woodhouse 2020-10-24  503  
3d7295eb3003ae David Woodhouse 2020-10-24  504  static struct irq_chip hpet_msi_controller __ro_after_init = {
3d7295eb3003ae David Woodhouse 2020-10-24  505  	.name = "HPET-MSI",
3d7295eb3003ae David Woodhouse 2020-10-24  506  	.irq_unmask = hpet_msi_unmask,
3d7295eb3003ae David Woodhouse 2020-10-24  507  	.irq_mask = hpet_msi_mask,
3d7295eb3003ae David Woodhouse 2020-10-24  508  	.irq_ack = irq_chip_ack_parent,
3d7295eb3003ae David Woodhouse 2020-10-24 @509  	.irq_set_affinity = msi_domain_set_affinity,
3d7295eb3003ae David Woodhouse 2020-10-24  510  	.irq_retrigger = irq_chip_retrigger_hierarchy,
3d7295eb3003ae David Woodhouse 2020-10-24  511  	.irq_write_msi_msg = hpet_msi_write_msg,
ff363f480e5997 Thomas Gleixner 2021-07-29  512  	.flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_AFFINITY_PRE_STARTUP,
3d7295eb3003ae David Woodhouse 2020-10-24  513  };
3d7295eb3003ae David Woodhouse 2020-10-24  514  
3d7295eb3003ae David Woodhouse 2020-10-24  515  static int hpet_msi_init(struct irq_domain *domain,
3d7295eb3003ae David Woodhouse 2020-10-24  516  			 struct msi_domain_info *info, unsigned int virq,
3d7295eb3003ae David Woodhouse 2020-10-24  517  			 irq_hw_number_t hwirq, msi_alloc_info_t *arg)
3d7295eb3003ae David Woodhouse 2020-10-24  518  {
3d7295eb3003ae David Woodhouse 2020-10-24  519  	irq_set_status_flags(virq, IRQ_MOVE_PCNTXT);
3d7295eb3003ae David Woodhouse 2020-10-24 @520  	irq_domain_set_info(domain, virq, arg->hwirq, info->chip, NULL,
3d7295eb3003ae David Woodhouse 2020-10-24  521  			    handle_edge_irq, arg->data, "edge");
3d7295eb3003ae David Woodhouse 2020-10-24  522  
3d7295eb3003ae David Woodhouse 2020-10-24  523  	return 0;
3d7295eb3003ae David Woodhouse 2020-10-24  524  }
3d7295eb3003ae David Woodhouse 2020-10-24  525  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v2] x86/msi: Fix compile error caused by GENERIC_MSI_IRQ and X86_LOCAL_APIC
  2023-10-11  5:57 ` [PATCH v2] x86/msi: Fix compile error caused by GENERIC_MSI_IRQ and X86_LOCAL_APIC Lu Yao
                     ` (3 preceding siblings ...)
  2023-10-12 10:59   ` [PATCH v2] x86/msi: Fix compile error caused by GENERIC_MSI_IRQ and X86_LOCAL_APIC kernel test robot
@ 2023-10-12 11:30   ` kernel test robot
  4 siblings, 0 replies; 10+ messages in thread
From: kernel test robot @ 2023-10-12 11:30 UTC (permalink / raw)
  To: Lu Yao, tglx, mingo, bp, dave.hansen, x86, rdunlap
  Cc: oe-kbuild-all, hpa, linux-kernel, Lu Yao

Hi Lu,

kernel test robot noticed the following build warnings:

[auto build test WARNING on tip/master]
[also build test WARNING on tip/x86/core tip/auto-latest linus/master v6.6-rc5 next-20231012]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Lu-Yao/x86-msi-Fix-compile-error-caused-by-GENERIC_MSI_IRQ-and-X86_LOCAL_APIC/20231011-135941
base:   tip/master
patch link:    https://lore.kernel.org/r/20231011055749.98840-1-yaolu%40kylinos.cn
patch subject: [PATCH v2] x86/msi: Fix compile error caused by GENERIC_MSI_IRQ and X86_LOCAL_APIC
config: x86_64-randconfig-076-20231012 (https://download.01.org/0day-ci/archive/20231012/202310121953.G7zdSGxU-lkp@intel.com/config)
compiler: gcc-7 (Ubuntu 7.5.0-6ubuntu2) 7.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231012/202310121953.G7zdSGxU-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202310121953.G7zdSGxU-lkp@intel.com/

All warnings (new ones prefixed by >>):

   arch/x86/kernel/hpet.c:509:22: error: 'msi_domain_set_affinity' undeclared here (not in a function); did you mean 'irq_can_set_affinity'?
     .irq_set_affinity = msi_domain_set_affinity,
                         ^~~~~~~~~~~~~~~~~~~~~~~
                         irq_can_set_affinity
   arch/x86/kernel/hpet.c:516:12: warning: 'struct msi_domain_info' declared inside parameter list will not be visible outside of this definition or declaration
        struct msi_domain_info *info, unsigned int virq,
               ^~~~~~~~~~~~~~~
   arch/x86/kernel/hpet.c: In function 'hpet_msi_init':
   arch/x86/kernel/hpet.c:520:52: error: dereferencing pointer to incomplete type 'struct msi_domain_info'
     irq_domain_set_info(domain, virq, arg->hwirq, info->chip, NULL,
                                                       ^~
   arch/x86/kernel/hpet.c: At top level:
   arch/x86/kernel/hpet.c:527:13: warning: 'struct msi_domain_info' declared inside parameter list will not be visible outside of this definition or declaration
         struct msi_domain_info *info, unsigned int virq)
                ^~~~~~~~~~~~~~~
   arch/x86/kernel/hpet.c:532:15: error: variable 'hpet_msi_domain_ops' has initializer but incomplete type
    static struct msi_domain_ops hpet_msi_domain_ops = {
                  ^~~~~~~~~~~~~~
   arch/x86/kernel/hpet.c:533:3: error: 'struct msi_domain_ops' has no member named 'msi_init'
     .msi_init = hpet_msi_init,
      ^~~~~~~~
   arch/x86/kernel/hpet.c:533:14: warning: excess elements in struct initializer
     .msi_init = hpet_msi_init,
                 ^~~~~~~~~~~~~
   arch/x86/kernel/hpet.c:533:14: note: (near initialization for 'hpet_msi_domain_ops')
   arch/x86/kernel/hpet.c:534:3: error: 'struct msi_domain_ops' has no member named 'msi_free'
     .msi_free = hpet_msi_free,
      ^~~~~~~~
   arch/x86/kernel/hpet.c:534:14: warning: excess elements in struct initializer
     .msi_free = hpet_msi_free,
                 ^~~~~~~~~~~~~
   arch/x86/kernel/hpet.c:534:14: note: (near initialization for 'hpet_msi_domain_ops')
   arch/x86/kernel/hpet.c:537:15: error: variable 'hpet_msi_domain_info' has initializer but incomplete type
    static struct msi_domain_info hpet_msi_domain_info = {
                  ^~~~~~~~~~~~~~~
   arch/x86/kernel/hpet.c:538:3: error: 'struct msi_domain_info' has no member named 'ops'
     .ops  = &hpet_msi_domain_ops,
      ^~~
   arch/x86/kernel/hpet.c:538:10: warning: excess elements in struct initializer
     .ops  = &hpet_msi_domain_ops,
             ^
   arch/x86/kernel/hpet.c:538:10: note: (near initialization for 'hpet_msi_domain_info')
   arch/x86/kernel/hpet.c:539:3: error: 'struct msi_domain_info' has no member named 'chip'
     .chip  = &hpet_msi_controller,
      ^~~~
   arch/x86/kernel/hpet.c:539:11: warning: excess elements in struct initializer
     .chip  = &hpet_msi_controller,
              ^
   arch/x86/kernel/hpet.c:539:11: note: (near initialization for 'hpet_msi_domain_info')
   arch/x86/kernel/hpet.c:540:3: error: 'struct msi_domain_info' has no member named 'flags'
     .flags  = MSI_FLAG_USE_DEF_DOM_OPS,
      ^~~~~
   arch/x86/kernel/hpet.c:540:12: error: 'MSI_FLAG_USE_DEF_DOM_OPS' undeclared here (not in a function); did you mean 'SIMPLE_DEV_PM_OPS'?
     .flags  = MSI_FLAG_USE_DEF_DOM_OPS,
               ^~~~~~~~~~~~~~~~~~~~~~~~
               SIMPLE_DEV_PM_OPS
   arch/x86/kernel/hpet.c:540:12: warning: excess elements in struct initializer
   arch/x86/kernel/hpet.c:540:12: note: (near initialization for 'hpet_msi_domain_info')
   arch/x86/kernel/hpet.c: In function 'hpet_create_irq_domain':
   arch/x86/kernel/hpet.c:553:31: error: dereferencing pointer to incomplete type 'struct msi_domain_info'
     domain_info = kzalloc(sizeof(*domain_info), GFP_KERNEL);
                                  ^~~~~~~~~~~~
   arch/x86/kernel/hpet.c:580:6: error: implicit declaration of function 'msi_create_irq_domain'; did you mean 'hpet_create_irq_domain'? [-Werror=implicit-function-declaration]
     d = msi_create_irq_domain(fn, domain_info, parent);
         ^~~~~~~~~~~~~~~~~~~~~
         hpet_create_irq_domain
>> arch/x86/kernel/hpet.c:580:4: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     d = msi_create_irq_domain(fn, domain_info, parent);
       ^
   arch/x86/kernel/hpet.c: In function 'hpet_dev_id':
   arch/x86/kernel/hpet.c:590:33: error: implicit declaration of function 'msi_get_domain_info'; did you mean 'sched_domain_span'? [-Werror=implicit-function-declaration]
     struct msi_domain_info *info = msi_get_domain_info(domain);
                                    ^~~~~~~~~~~~~~~~~~~
                                    sched_domain_span
>> arch/x86/kernel/hpet.c:590:33: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
   arch/x86/kernel/hpet.c: At top level:
   arch/x86/kernel/hpet.c:532:30: error: storage size of 'hpet_msi_domain_ops' isn't known
    static struct msi_domain_ops hpet_msi_domain_ops = {
                                 ^~~~~~~~~~~~~~~~~~~
   arch/x86/kernel/hpet.c:537:31: error: storage size of 'hpet_msi_domain_info' isn't known
    static struct msi_domain_info hpet_msi_domain_info = {
                                  ^~~~~~~~~~~~~~~~~~~~
   arch/x86/kernel/hpet.c: In function 'hpet_dev_id':
   arch/x86/kernel/hpet.c:593:1: error: control reaches end of non-void function [-Werror=return-type]
    }
    ^
   cc1: some warnings being treated as errors


vim +580 arch/x86/kernel/hpet.c

3d7295eb3003ae David Woodhouse 2020-10-24  536  
3d7295eb3003ae David Woodhouse 2020-10-24  537  static struct msi_domain_info hpet_msi_domain_info = {
3d7295eb3003ae David Woodhouse 2020-10-24  538  	.ops		= &hpet_msi_domain_ops,
3d7295eb3003ae David Woodhouse 2020-10-24  539  	.chip		= &hpet_msi_controller,
3d7295eb3003ae David Woodhouse 2020-10-24 @540  	.flags		= MSI_FLAG_USE_DEF_DOM_OPS,
3d7295eb3003ae David Woodhouse 2020-10-24  541  };
3d7295eb3003ae David Woodhouse 2020-10-24  542  
3d7295eb3003ae David Woodhouse 2020-10-24  543  static struct irq_domain *hpet_create_irq_domain(int hpet_id)
3d7295eb3003ae David Woodhouse 2020-10-24  544  {
3d7295eb3003ae David Woodhouse 2020-10-24  545  	struct msi_domain_info *domain_info;
3d7295eb3003ae David Woodhouse 2020-10-24  546  	struct irq_domain *parent, *d;
3d7295eb3003ae David Woodhouse 2020-10-24  547  	struct fwnode_handle *fn;
c2a5881c28e5bb David Woodhouse 2020-10-24  548  	struct irq_fwspec fwspec;
3d7295eb3003ae David Woodhouse 2020-10-24  549  
3d7295eb3003ae David Woodhouse 2020-10-24  550  	if (x86_vector_domain == NULL)
3d7295eb3003ae David Woodhouse 2020-10-24  551  		return NULL;
3d7295eb3003ae David Woodhouse 2020-10-24  552  
3d7295eb3003ae David Woodhouse 2020-10-24  553  	domain_info = kzalloc(sizeof(*domain_info), GFP_KERNEL);
3d7295eb3003ae David Woodhouse 2020-10-24  554  	if (!domain_info)
3d7295eb3003ae David Woodhouse 2020-10-24  555  		return NULL;
3d7295eb3003ae David Woodhouse 2020-10-24  556  
3d7295eb3003ae David Woodhouse 2020-10-24  557  	*domain_info = hpet_msi_domain_info;
3d7295eb3003ae David Woodhouse 2020-10-24  558  	domain_info->data = (void *)(long)hpet_id;
3d7295eb3003ae David Woodhouse 2020-10-24  559  
3d7295eb3003ae David Woodhouse 2020-10-24  560  	fn = irq_domain_alloc_named_id_fwnode(hpet_msi_controller.name,
3d7295eb3003ae David Woodhouse 2020-10-24  561  					      hpet_id);
3d7295eb3003ae David Woodhouse 2020-10-24  562  	if (!fn) {
3d7295eb3003ae David Woodhouse 2020-10-24  563  		kfree(domain_info);
3d7295eb3003ae David Woodhouse 2020-10-24  564  		return NULL;
3d7295eb3003ae David Woodhouse 2020-10-24  565  	}
3d7295eb3003ae David Woodhouse 2020-10-24  566  
c2a5881c28e5bb David Woodhouse 2020-10-24  567  	fwspec.fwnode = fn;
c2a5881c28e5bb David Woodhouse 2020-10-24  568  	fwspec.param_count = 1;
c2a5881c28e5bb David Woodhouse 2020-10-24  569  	fwspec.param[0] = hpet_id;
c2a5881c28e5bb David Woodhouse 2020-10-24  570  
c2a5881c28e5bb David Woodhouse 2020-10-24  571  	parent = irq_find_matching_fwspec(&fwspec, DOMAIN_BUS_ANY);
c2a5881c28e5bb David Woodhouse 2020-10-24  572  	if (!parent) {
c2a5881c28e5bb David Woodhouse 2020-10-24  573  		irq_domain_free_fwnode(fn);
c2a5881c28e5bb David Woodhouse 2020-10-24  574  		kfree(domain_info);
c2a5881c28e5bb David Woodhouse 2020-10-24  575  		return NULL;
c2a5881c28e5bb David Woodhouse 2020-10-24  576  	}
c2a5881c28e5bb David Woodhouse 2020-10-24  577  	if (parent != x86_vector_domain)
c2a5881c28e5bb David Woodhouse 2020-10-24  578  		hpet_msi_controller.name = "IR-HPET-MSI";
c2a5881c28e5bb David Woodhouse 2020-10-24  579  
3d7295eb3003ae David Woodhouse 2020-10-24 @580  	d = msi_create_irq_domain(fn, domain_info, parent);
3d7295eb3003ae David Woodhouse 2020-10-24  581  	if (!d) {
3d7295eb3003ae David Woodhouse 2020-10-24  582  		irq_domain_free_fwnode(fn);
3d7295eb3003ae David Woodhouse 2020-10-24  583  		kfree(domain_info);
3d7295eb3003ae David Woodhouse 2020-10-24  584  	}
3d7295eb3003ae David Woodhouse 2020-10-24  585  	return d;
3d7295eb3003ae David Woodhouse 2020-10-24  586  }
3d7295eb3003ae David Woodhouse 2020-10-24  587  
3d7295eb3003ae David Woodhouse 2020-10-24  588  static inline int hpet_dev_id(struct irq_domain *domain)
3d7295eb3003ae David Woodhouse 2020-10-24  589  {
3d7295eb3003ae David Woodhouse 2020-10-24 @590  	struct msi_domain_info *info = msi_get_domain_info(domain);
3d7295eb3003ae David Woodhouse 2020-10-24  591  
3d7295eb3003ae David Woodhouse 2020-10-24  592  	return (int)(long)info->data;
3d7295eb3003ae David Woodhouse 2020-10-24  593  }
3d7295eb3003ae David Woodhouse 2020-10-24  594  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v2] x86/msi: Fix compile error caused by GENERIC_MSI_IRQ and X86_LOCAL_APIC
@ 2023-10-11  2:41 Lu Yao
  0 siblings, 0 replies; 10+ messages in thread
From: Lu Yao @ 2023-10-11  2:41 UTC (permalink / raw)
  To: tglx, mingo, bp, dave.hansen, x86, rdunlap; +Cc: hpa, linux-kernel, Lu Yao

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@kylinos.cn>
---
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);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-10-12 11:30 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-08  8:28 [PATCH] x86/msi: Fix compile error "incomplete typedef 'msi_alloc_info_t'" yaolu
2023-10-10 15:59 ` Randy Dunlap
2023-10-11  5:57 ` [PATCH v2] x86/msi: Fix compile error caused by GENERIC_MSI_IRQ and X86_LOCAL_APIC Lu Yao
2023-10-11 19:18   ` Randy Dunlap
2023-10-12  0:35   ` kernel test robot
2023-10-12  3:26   ` [PATCH v3] " Lu Yao
2023-10-12  6:25     ` [tip: x86/apic] x86/msi: Fix compile error caused by CONFIG_GENERIC_MSI_IRQ=y && !CONFIG_X86_LOCAL_APIC tip-bot2 for Lu Yao
2023-10-12 10:59   ` [PATCH v2] x86/msi: Fix compile error caused by GENERIC_MSI_IRQ and X86_LOCAL_APIC kernel test robot
2023-10-12 11:30   ` kernel test robot
2023-10-11  2:41 Lu Yao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).