2022-08-08 08:54:46

by Huacai Chen

[permalink] [raw]
Subject: [PATCH] irqchip: Select downstream irqchip drivers for LoongArch CPU

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 <[email protected]>
Signed-off-by: Huacai Chen <[email protected]>
---
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
help
Support for the LoongArch CPU Interrupt Controller. For details of
irq chip hierarchy on LoongArch platforms please read the document
--
2.31.1


2022-08-08 10:30:14

by Marc Zyngier

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

On Mon, 08 Aug 2022 09:53:19 +0100,
Huacai Chen <[email protected]> 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 <[email protected]>
> Signed-off-by: Huacai Chen <[email protected]>
> ---
> 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.

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.

2022-08-08 11:16:18

by Huacai Chen

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

Hi, Marc,

On Mon, Aug 8, 2022 at 6:05 PM Marc Zyngier <[email protected]> wrote:
>
> On Mon, 08 Aug 2022 09:53:19 +0100,
> Huacai Chen <[email protected]> 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 <[email protected]>
> > Signed-off-by: Huacai Chen <[email protected]>
> > ---
> > 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.

2022-08-08 11:50:46

by Marc Zyngier

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

On Mon, 08 Aug 2022 12:06:23 +0100,
Huacai Chen <[email protected]> wrote:
>
> Hi, Marc,
>
> On Mon, Aug 8, 2022 at 6:05 PM Marc Zyngier <[email protected]> wrote:
> >
> > On Mon, 08 Aug 2022 09:53:19 +0100,
> > Huacai Chen <[email protected]> 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 <[email protected]>
> > > Signed-off-by: Huacai Chen <[email protected]>
> > > ---
> > > 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.

Sure, I'm fine with that. However, I have seen the PCI pull request
going in without any mention of the LoongArch support. Is it going via
another tree?

Thanks,

M.

--
Without deviation from the norm, progress is not possible.

2022-08-08 11:51:25

by Huacai Chen

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

Hi, Marc,

On Mon, Aug 8, 2022 at 7:16 PM Marc Zyngier <[email protected]> wrote:
>
> On Mon, 08 Aug 2022 12:06:23 +0100,
> Huacai Chen <[email protected]> wrote:
> >
> > Hi, Marc,
> >
> > On Mon, Aug 8, 2022 at 6:05 PM Marc Zyngier <[email protected]> wrote:
> > >
> > > On Mon, 08 Aug 2022 09:53:19 +0100,
> > > Huacai Chen <[email protected]> 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 <[email protected]>
> > > > Signed-off-by: Huacai Chen <[email protected]>
> > > > ---
> > > > 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.
>
> Sure, I'm fine with that. However, I have seen the PCI pull request
> going in without any mention of the LoongArch support. Is it going via
> another tree?
PCI drivers have merged, and PCI enablement will go via loongarch
tree. Once I wanted to send PR to Linus today, but Steven said that
the loongarch-next branch breaks some build so I should fix that
first.

Huacai
>
> Thanks,
>
> M.
>
> --
> Without deviation from the norm, progress is not possible.

2022-08-09 02:15:16

by Chen, Rong A

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

Hi Huacai,

I love your patch! Perhaps something to improve:

[auto build test WARNING on tip/irq/core]
[also build test WARNING on linus/master next-20220808]
[cannot apply to v5.19]
[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/Huacai-Chen/irqchip-Select-downstream-irqchip-drivers-for-LoongArch-CPU/20220808-165519
base: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 779fda86bdeb86bad6daa4f0ecf37788dfc26f6c
config: loongarch-randconfig-r022-20220807 (https://download.01.org/0day-ci/archive/20220808/[email protected]/config)
compiler: loongarch64-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/72710986a76f9fec9c8c467de4960ccd8320a33e
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Huacai-Chen/irqchip-Select-downstream-irqchip-drivers-for-LoongArch-CPU/20220808-165519
git checkout 72710986a76f9fec9c8c467de4960ccd8320a33e
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=loongarch SHELL=/bin/bash drivers/irqchip/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

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 |
| ^~~~~
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 |
| ^~~~~~~~~~~~~~~~~~~~~~~~
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 |
| ^~~~~~~~~~~~~~~~~~~~~~~~~
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,
| ^~~~~~~~~~~~~~~~~~~~~~
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')
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 = {
| ^~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors

Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for LOONGSON_PCH_MSI
Depends on [n]: MACH_LOONGSON64 [=y] && PCI [=n]
Selected by [y]:
- IRQ_LOONGARCH_CPU [=y]


vim +89 drivers/irqchip/irq-loongson-pch-msi.c

632dcc2c75ef6d Jiaxun Yang 2020-05-28 87
632dcc2c75ef6d Jiaxun Yang 2020-05-28 88 static struct msi_domain_info pch_msi_domain_info = {
632dcc2c75ef6d Jiaxun Yang 2020-05-28 @89 .flags = MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
632dcc2c75ef6d Jiaxun Yang 2020-05-28 90 MSI_FLAG_MULTI_PCI_MSI | MSI_FLAG_PCI_MSIX,
632dcc2c75ef6d Jiaxun Yang 2020-05-28 91 .chip = &pch_msi_irq_chip,
632dcc2c75ef6d Jiaxun Yang 2020-05-28 92 };
632dcc2c75ef6d Jiaxun Yang 2020-05-28 93
632dcc2c75ef6d Jiaxun Yang 2020-05-28 94 static struct irq_chip middle_irq_chip = {
632dcc2c75ef6d Jiaxun Yang 2020-05-28 95 .name = "PCH MSI",
632dcc2c75ef6d Jiaxun Yang 2020-05-28 96 .irq_mask = irq_chip_mask_parent,
632dcc2c75ef6d Jiaxun Yang 2020-05-28 97 .irq_unmask = irq_chip_unmask_parent,
632dcc2c75ef6d Jiaxun Yang 2020-05-28 98 .irq_ack = irq_chip_ack_parent,
632dcc2c75ef6d Jiaxun Yang 2020-05-28 99 .irq_set_affinity = irq_chip_set_affinity_parent,
632dcc2c75ef6d Jiaxun Yang 2020-05-28 100 .irq_compose_msi_msg = pch_msi_compose_msi_msg,
632dcc2c75ef6d Jiaxun Yang 2020-05-28 101 };
632dcc2c75ef6d Jiaxun Yang 2020-05-28 102
632dcc2c75ef6d Jiaxun Yang 2020-05-28 103 static int pch_msi_parent_domain_alloc(struct irq_domain *domain,
632dcc2c75ef6d Jiaxun Yang 2020-05-28 104 unsigned int virq, int hwirq)
632dcc2c75ef6d Jiaxun Yang 2020-05-28 105 {
632dcc2c75ef6d Jiaxun Yang 2020-05-28 106 struct irq_fwspec fwspec;
632dcc2c75ef6d Jiaxun Yang 2020-05-28 107
632dcc2c75ef6d Jiaxun Yang 2020-05-28 108 fwspec.fwnode = domain->parent->fwnode;
632dcc2c75ef6d Jiaxun Yang 2020-05-28 109 fwspec.param_count = 1;
632dcc2c75ef6d Jiaxun Yang 2020-05-28 110 fwspec.param[0] = hwirq;
632dcc2c75ef6d Jiaxun Yang 2020-05-28 111
b10cbca8f03dd1 Tiezhu Yang 2020-07-07 112 return irq_domain_alloc_irqs_parent(domain, virq, 1, &fwspec);
632dcc2c75ef6d Jiaxun Yang 2020-05-28 113 }
632dcc2c75ef6d Jiaxun Yang 2020-05-28 114
632dcc2c75ef6d Jiaxun Yang 2020-05-28 115 static int pch_msi_middle_domain_alloc(struct irq_domain *domain,
632dcc2c75ef6d Jiaxun Yang 2020-05-28 116 unsigned int virq,
632dcc2c75ef6d Jiaxun Yang 2020-05-28 117 unsigned int nr_irqs, void *args)
632dcc2c75ef6d Jiaxun Yang 2020-05-28 118 {
632dcc2c75ef6d Jiaxun Yang 2020-05-28 119 struct pch_msi_data *priv = domain->host_data;
632dcc2c75ef6d Jiaxun Yang 2020-05-28 120 int hwirq, err, i;
632dcc2c75ef6d Jiaxun Yang 2020-05-28 121
632dcc2c75ef6d Jiaxun Yang 2020-05-28 122 hwirq = pch_msi_allocate_hwirq(priv, nr_irqs);
632dcc2c75ef6d Jiaxun Yang 2020-05-28 123 if (hwirq < 0)
632dcc2c75ef6d Jiaxun Yang 2020-05-28 124 return hwirq;
632dcc2c75ef6d Jiaxun Yang 2020-05-28 125
632dcc2c75ef6d Jiaxun Yang 2020-05-28 126 for (i = 0; i < nr_irqs; i++) {
632dcc2c75ef6d Jiaxun Yang 2020-05-28 127 err = pch_msi_parent_domain_alloc(domain, virq + i, hwirq + i);
632dcc2c75ef6d Jiaxun Yang 2020-05-28 128 if (err)
632dcc2c75ef6d Jiaxun Yang 2020-05-28 129 goto err_hwirq;
632dcc2c75ef6d Jiaxun Yang 2020-05-28 130
632dcc2c75ef6d Jiaxun Yang 2020-05-28 131 irq_domain_set_hwirq_and_chip(domain, virq + i, hwirq + i,
632dcc2c75ef6d Jiaxun Yang 2020-05-28 132 &middle_irq_chip, priv);
632dcc2c75ef6d Jiaxun Yang 2020-05-28 133 }
632dcc2c75ef6d Jiaxun Yang 2020-05-28 134
632dcc2c75ef6d Jiaxun Yang 2020-05-28 135 return 0;
632dcc2c75ef6d Jiaxun Yang 2020-05-28 136
632dcc2c75ef6d Jiaxun Yang 2020-05-28 137 err_hwirq:
632dcc2c75ef6d Jiaxun Yang 2020-05-28 138 pch_msi_free_hwirq(priv, hwirq, nr_irqs);
632dcc2c75ef6d Jiaxun Yang 2020-05-28 139 irq_domain_free_irqs_parent(domain, virq, i - 1);
632dcc2c75ef6d Jiaxun Yang 2020-05-28 140
632dcc2c75ef6d Jiaxun Yang 2020-05-28 141 return err;
632dcc2c75ef6d Jiaxun Yang 2020-05-28 142 }
632dcc2c75ef6d Jiaxun Yang 2020-05-28 143
632dcc2c75ef6d Jiaxun Yang 2020-05-28 144 static void pch_msi_middle_domain_free(struct irq_domain *domain,
632dcc2c75ef6d Jiaxun Yang 2020-05-28 145 unsigned int virq,
632dcc2c75ef6d Jiaxun Yang 2020-05-28 146 unsigned int nr_irqs)
632dcc2c75ef6d Jiaxun Yang 2020-05-28 147 {
632dcc2c75ef6d Jiaxun Yang 2020-05-28 148 struct irq_data *d = irq_domain_get_irq_data(domain, virq);
632dcc2c75ef6d Jiaxun Yang 2020-05-28 149 struct pch_msi_data *priv = irq_data_get_irq_chip_data(d);
632dcc2c75ef6d Jiaxun Yang 2020-05-28 150
632dcc2c75ef6d Jiaxun Yang 2020-05-28 151 irq_domain_free_irqs_parent(domain, virq, nr_irqs);
632dcc2c75ef6d Jiaxun Yang 2020-05-28 152 pch_msi_free_hwirq(priv, d->hwirq, nr_irqs);
632dcc2c75ef6d Jiaxun Yang 2020-05-28 153 }
632dcc2c75ef6d Jiaxun Yang 2020-05-28 154
632dcc2c75ef6d Jiaxun Yang 2020-05-28 155 static const struct irq_domain_ops pch_msi_middle_domain_ops = {
632dcc2c75ef6d Jiaxun Yang 2020-05-28 156 .alloc = pch_msi_middle_domain_alloc,
632dcc2c75ef6d Jiaxun Yang 2020-05-28 157 .free = pch_msi_middle_domain_free,
632dcc2c75ef6d Jiaxun Yang 2020-05-28 158 };
632dcc2c75ef6d Jiaxun Yang 2020-05-28 159
632dcc2c75ef6d Jiaxun Yang 2020-05-28 160 static int pch_msi_init_domains(struct pch_msi_data *priv,
023087324000ae Huacai Chen 2022-07-20 161 struct irq_domain *parent,
023087324000ae Huacai Chen 2022-07-20 162 struct fwnode_handle *domain_handle)
632dcc2c75ef6d Jiaxun Yang 2020-05-28 163 {
632dcc2c75ef6d Jiaxun Yang 2020-05-28 164 struct irq_domain *middle_domain, *msi_domain;
632dcc2c75ef6d Jiaxun Yang 2020-05-28 165
023087324000ae Huacai Chen 2022-07-20 166 middle_domain = irq_domain_create_linear(domain_handle,
632dcc2c75ef6d Jiaxun Yang 2020-05-28 167 priv->num_irqs,
632dcc2c75ef6d Jiaxun Yang 2020-05-28 168 &pch_msi_middle_domain_ops,
632dcc2c75ef6d Jiaxun Yang 2020-05-28 169 priv);
632dcc2c75ef6d Jiaxun Yang 2020-05-28 170 if (!middle_domain) {
632dcc2c75ef6d Jiaxun Yang 2020-05-28 171 pr_err("Failed to create the MSI middle domain\n");
632dcc2c75ef6d Jiaxun Yang 2020-05-28 172 return -ENOMEM;
632dcc2c75ef6d Jiaxun Yang 2020-05-28 173 }
632dcc2c75ef6d Jiaxun Yang 2020-05-28 174
632dcc2c75ef6d Jiaxun Yang 2020-05-28 175 middle_domain->parent = parent;
632dcc2c75ef6d Jiaxun Yang 2020-05-28 176 irq_domain_update_bus_token(middle_domain, DOMAIN_BUS_NEXUS);
632dcc2c75ef6d Jiaxun Yang 2020-05-28 177
023087324000ae Huacai Chen 2022-07-20 @178 msi_domain = pci_msi_create_irq_domain(domain_handle,
632dcc2c75ef6d Jiaxun Yang 2020-05-28 179 &pch_msi_domain_info,
632dcc2c75ef6d Jiaxun Yang 2020-05-28 180 middle_domain);
632dcc2c75ef6d Jiaxun Yang 2020-05-28 181 if (!msi_domain) {
632dcc2c75ef6d Jiaxun Yang 2020-05-28 182 pr_err("Failed to create PCI MSI domain\n");
632dcc2c75ef6d Jiaxun Yang 2020-05-28 183 irq_domain_remove(middle_domain);
632dcc2c75ef6d Jiaxun Yang 2020-05-28 184 return -ENOMEM;
632dcc2c75ef6d Jiaxun Yang 2020-05-28 185 }
632dcc2c75ef6d Jiaxun Yang 2020-05-28 186
632dcc2c75ef6d Jiaxun Yang 2020-05-28 187 return 0;
632dcc2c75ef6d Jiaxun Yang 2020-05-28 188 }
632dcc2c75ef6d Jiaxun Yang 2020-05-28 189

--
0-DAY CI Kernel Test Service
https://01.org/lkp

2022-09-13 13:50:29

by tip-bot2 for Jacob Pan

[permalink] [raw]
Subject: [irqchip: irq/irqchip-fixes] irqchip: Select downstream irqchip drivers for LoongArch CPU

The following commit has been merged into the irq/irqchip-fixes branch of irqchip:

Commit-ID: 8d5356f9820dc48578fc50077f5a34905386e47f
Gitweb: https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/8d5356f9820dc48578fc50077f5a34905386e47f
Author: Huacai Chen <[email protected]>
AuthorDate: Mon, 08 Aug 2022 16:53:19 +08:00
Committer: Marc Zyngier <[email protected]>
CommitterDate: Mon, 12 Sep 2022 16:50:55 +01:00

irqchip: Select downstream irqchip drivers for LoongArch CPU

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 <[email protected]>
Signed-off-by: Huacai Chen <[email protected]>
Signed-off-by: Marc Zyngier <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
---
drivers/irqchip/Kconfig | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
index 66b9fa4..2549daa 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
help
Support for the LoongArch CPU Interrupt Controller. For details of
irq chip hierarchy on LoongArch platforms please read the document