Re: [PATCH] irqchip: Select downstream irqchip drivers for LoongArch CPU

From: Huacai Chen
Date: Mon Aug 08 2022 - 07:07:08 EST


Hi, Marc,

On Mon, Aug 8, 2022 at 6:05 PM Marc Zyngier <maz@xxxxxxxxxx> wrote:
>
> On Mon, 08 Aug 2022 09:53:19 +0100,
> Huacai Chen <chenhuacai@xxxxxxxxxxx> wrote:
> >
> > LoongArch irqchips have a fixed hierarchy which currently can't be
> > described by ACPI tables, so upstream irqchip drivers call downstream
> > irqchip drivers' initialization directly. As a result, the top level
> > (CPU-level) irqchip driver should explicitly select downstream drivers
> > to avoid build errors.
> >
> > Reported-by: kernel test robot <lkp@xxxxxxxxx>
> > Signed-off-by: Huacai Chen <chenhuacai@xxxxxxxxxxx>
> > ---
> > drivers/irqchip/Kconfig | 5 +++++
> > 1 file changed, 5 insertions(+)
> >
> > diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
> > index 66b9fa408bf2..2549daa859d6 100644
> > --- a/drivers/irqchip/Kconfig
> > +++ b/drivers/irqchip/Kconfig
> > @@ -561,6 +561,11 @@ config IRQ_LOONGARCH_CPU
> > select GENERIC_IRQ_CHIP
> > select IRQ_DOMAIN
> > select GENERIC_IRQ_EFFECTIVE_AFF_MASK
> > + select LOONGSON_LIOINTC
> > + select LOONGSON_EIOINTC
> > + select LOONGSON_PCH_PIC
> > + select LOONGSON_PCH_MSI
> > + select LOONGSON_PCH_LPC
>
> This triggers tons of pretty bad compilation and configuration issues,
> as PCI still isn't selectable, even in Linus' tree (see below). I'm
> guessing you still have local patches that hide this issue.
>
> Please test your patches on an upstream tree in the future.
I'm very sorry for that. I think this patch should be delayed after
5.20-rc1, then PCI code will have been merged.

Huacai
>
> M.
>
> <log>
> $ make ARCH=loongarch CROSS_COMPILE=loongarch64-linux- -j 20 vmlinux
> SYNC include/config/auto.conf.cmd
>
> WARNING: unmet direct dependencies detected for LOONGSON_PCH_MSI
> Depends on [n]: MACH_LOONGSON64 [=y] && PCI [=n]
> Selected by [y]:
> - IRQ_LOONGARCH_CPU [=y]
>
> WARNING: unmet direct dependencies detected for LOONGSON_PCH_MSI
> Depends on [n]: MACH_LOONGSON64 [=y] && PCI [=n]
> Selected by [y]:
> - IRQ_LOONGARCH_CPU [=y]
>
> WARNING: unmet direct dependencies detected for LOONGSON_PCH_MSI
> Depends on [n]: MACH_LOONGSON64 [=y] && PCI [=n]
> Selected by [y]:
> [...]
> drivers/irqchip/irq-loongson-pch-msi.c:88:15: error: variable 'pch_msi_domain_info' has initializer but incomplete type
> 88 | static struct msi_domain_info pch_msi_domain_info = {
> | ^~~~~~~~~~~~~~~
> drivers/irqchip/irq-loongson-pch-msi.c:89:10: error: 'struct msi_domain_info' has no member named 'flags'
> 89 | .flags = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
> | ^~~~~
> CC mm/page-writeback.o
> CC io_uring/advise.o
> drivers/irqchip/irq-loongson-pch-msi.c:89:19: error: 'MSI_FLAG_USE_DEF_DOM_OPS' undeclared here (not in a function)
> 89 | .flags = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
> | ^~~~~~~~~~~~~~~~~~~~~~~~
> CC fs/char_dev.o
> CC fs/stat.o
> drivers/irqchip/irq-loongson-pch-msi.c:89:46: error: 'MSI_FLAG_USE_DEF_CHIP_OPS' undeclared here (not in a function)
> 89 | .flags = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
> | ^~~~~~~~~~~~~~~~~~~~~~~~~
> CC security/security.o
> AS arch/loongarch/kernel/switch.o
> CC kernel/softirq.o
> drivers/irqchip/irq-loongson-pch-msi.c:90:19: error: 'MSI_FLAG_MULTI_PCI_MSI' undeclared here (not in a function)
> 90 | MSI_FLAG_MULTI_PCI_MSI | MSI_FLAG_PCI_MSIX,
> | ^~~~~~~~~~~~~~~~~~~~~~
> CC crypto/dh_helper.o
> CC arch/loongarch/kernel/elf.o
> drivers/irqchip/irq-loongson-pch-msi.c:90:44: error: 'MSI_FLAG_PCI_MSIX' undeclared here (not in a function)
> 90 | MSI_FLAG_MULTI_PCI_MSI | MSI_FLAG_PCI_MSIX,
> | ^~~~~~~~~~~~~~~~~
> drivers/irqchip/irq-loongson-pch-msi.c:89:19: warning: excess elements in struct initializer
> 89 | .flags = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
> | ^~~~~~~~~~~~~~~~~~~~~~~~
> drivers/irqchip/irq-loongson-pch-msi.c:89:19: note: (near initialization for 'pch_msi_domain_info')
> drivers/irqchip/irq-loongson-pch-msi.c:91:10: error: 'struct msi_domain_info' has no member named 'chip'
> 91 | .chip = &pch_msi_irq_chip,
> | ^~~~
> drivers/irqchip/irq-loongson-pch-msi.c:91:19: warning: excess elements in struct initializer
> 91 | .chip = &pch_msi_irq_chip,
> | ^
> drivers/irqchip/irq-loongson-pch-msi.c:91:19: note: (near initialization for 'pch_msi_domain_info')
> CC sound/core/device.o
> CC drivers/gpio/gpiolib-sysfs.o
> CC io_uring/filetable.o
> drivers/irqchip/irq-loongson-pch-msi.c: In function 'pch_msi_init_domains':
> drivers/irqchip/irq-loongson-pch-msi.c:178:22: error: implicit declaration of function 'pci_msi_create_irq_domain'; did you mean 'pci_msi_get_device_domain'? [-Werror=implicit-function-declaration]
> 178 | msi_domain = pci_msi_create_irq_domain(domain_handle,
> | ^~~~~~~~~~~~~~~~~~~~~~~~~
> | pci_msi_get_device_domain
> drivers/irqchip/irq-loongson-pch-msi.c:178:20: warning: assignment to 'struct irq_domain *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
> 178 | msi_domain = pci_msi_create_irq_domain(domain_handle,
> | ^
> drivers/irqchip/irq-loongson-pch-msi.c: At top level:
> drivers/irqchip/irq-loongson-pch-msi.c:88:31: error: storage size of 'pch_msi_domain_info' isn't known
> 88 | static struct msi_domain_info pch_msi_domain_info = {
> | ^~~~~~~~~~~~~~~~~~~
> </log>
>
> --
> Without deviation from the norm, progress is not possible.