[1/2] irqchip: loongarch-cpu: add DT support

Message ID 20221107023404.26730-1-liupeibao@loongson.cn
State New
Headers
Series [1/2] irqchip: loongarch-cpu: add DT support |

Commit Message

Liu Peibao Nov. 7, 2022, 2:34 a.m. UTC
  LoongArch is coming to support booting with FDT, so DT
support of this driver is desired.

Signed-off-by: Liu Peibao <liupeibao@loongson.cn>
---
 drivers/irqchip/irq-loongarch-cpu.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
  

Comments

kernel test robot Nov. 7, 2022, 7:04 a.m. UTC | #1
Hi Liu,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on tip/irq/core]
[also build test WARNING on robh/for-next linus/master v6.1-rc4 next-20221104]
[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/Liu-Peibao/irqchip-loongarch-cpu-add-DT-support/20221107-103606
patch link:    https://lore.kernel.org/r/20221107023404.26730-1-liupeibao%40loongson.cn
patch subject: [PATCH 1/2] irqchip: loongarch-cpu: add DT support
config: loongarch-allyesconfig
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/10a355fa4bf4ae52f3889b1d4bec5be1143dd4e2
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Liu-Peibao/irqchip-loongarch-cpu-add-DT-support/20221107-103606
        git checkout 10a355fa4bf4ae52f3889b1d4bec5be1143dd4e2
        # 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/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/irqchip/irq-loongarch-cpu.c:96:12: warning: no previous prototype for 'loongarch_cpu_irq_of_init' [-Wmissing-prototypes]
      96 | int __init loongarch_cpu_irq_of_init(struct device_node *of_node,
         |            ^~~~~~~~~~~~~~~~~~~~~~~~~


vim +/loongarch_cpu_irq_of_init +96 drivers/irqchip/irq-loongarch-cpu.c

    94	
    95	#ifdef CONFIG_OF
  > 96	int __init loongarch_cpu_irq_of_init(struct device_node *of_node,
    97					struct device_node *parent)
    98	{
    99		cpuintc_handle = of_node_to_fwnode(of_node);
   100	
   101		irq_domain = irq_domain_create_linear(cpuintc_handle, EXCCODE_INT_NUM,
   102					&loongarch_cpu_intc_irq_domain_ops, NULL);
   103		if (!irq_domain)
   104			panic("Failed to add irqdomain for loongarch CPU");
   105	
   106		set_handle_irq(&handle_cpu_irq);
   107	
   108		return 0;
   109	}
   110	IRQCHIP_DECLARE(cpu_intc, "loongson,cpu-interrupt-controller",
   111						loongarch_cpu_irq_of_init);
   112	#endif
   113
  

Patch

diff --git a/drivers/irqchip/irq-loongarch-cpu.c b/drivers/irqchip/irq-loongarch-cpu.c
index 741612ba6a52..a28b7c549654 100644
--- a/drivers/irqchip/irq-loongarch-cpu.c
+++ b/drivers/irqchip/irq-loongarch-cpu.c
@@ -92,6 +92,25 @@  static const struct irq_domain_ops loongarch_cpu_intc_irq_domain_ops = {
 	.xlate = irq_domain_xlate_onecell,
 };
 
+#ifdef CONFIG_OF
+int __init loongarch_cpu_irq_of_init(struct device_node *of_node,
+				struct device_node *parent)
+{
+	cpuintc_handle = of_node_to_fwnode(of_node);
+
+	irq_domain = irq_domain_create_linear(cpuintc_handle, EXCCODE_INT_NUM,
+				&loongarch_cpu_intc_irq_domain_ops, NULL);
+	if (!irq_domain)
+		panic("Failed to add irqdomain for loongarch CPU");
+
+	set_handle_irq(&handle_cpu_irq);
+
+	return 0;
+}
+IRQCHIP_DECLARE(cpu_intc, "loongson,cpu-interrupt-controller",
+					loongarch_cpu_irq_of_init);
+#endif
+
 static int __init
 liointc_parse_madt(union acpi_subtable_headers *header,
 		       const unsigned long end)