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

From: kernel test robot
Date: Wed Oct 11 2023 - 20:35:55 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-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@xxxxxxxxx/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@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/202310120849.zrfrI44Z-lkp@xxxxxxxxx/

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