Re: [PATCH v2] x86/msi: Fix compile error caused by GENERIC_MSI_IRQ and X86_LOCAL_APIC

From: kernel test robot
Date: Thu Oct 12 2023 - 07:30:56 EST


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@xxxxxxxxx/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@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202310121953.G7zdSGxU-lkp@xxxxxxxxx/

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