Message ID | 20221207014555.22465-1-zhuyinbo@loongson.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3156632wrr; Tue, 6 Dec 2022 17:51:12 -0800 (PST) X-Google-Smtp-Source: AA0mqf59hKuBAj0dNJFT82UR23/6wI8IfAaP8Aa5Y+OcWxA3IViqLaV3inMGh48VTY1LSPhNxdb8 X-Received: by 2002:a17:906:2785:b0:78d:98a7:2e7 with SMTP id j5-20020a170906278500b0078d98a702e7mr56056650ejc.535.1670377872270; Tue, 06 Dec 2022 17:51:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670377872; cv=none; d=google.com; s=arc-20160816; b=r8D4u5xZr1+zOWyT1/u3pCR+9/HTYdBsY65MRIQo76YhrZ760ttkUTS6XtXpubpQur yxtryLfH4bw0eQK7xFPdbYTsLmcr1Mljd4d/sxjQ5QbaKOvM0lL7wI8Yyu/olvt0n8bw cw9NSTmSt61USPDWaCAxAl2u0seTHjxzABW9hlSNM5isi8TjgvctO97TW4S5fzyip0YZ nljoPyL4FtWBApmdJkWE1o9WS1l29Nkh2SD9CzLlItPYFYK8Ja/xNGb1As1Num/KK2h7 dFX5A8ZbCMDWQ2oMLoFXY9SsZaiXWP40dpdcG2vJyTWxdH3aLLuontR3AKG2I/iJKJOD DvRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=4MKKNmD6aoVJLxGJG7ArYj+kCYCLQdK9rWn5VwdiKp8=; b=N9xpy/w4+2R2DAQ0sRwg8fBZbGcB5+qSg79DsL2jONQR0NONpB5zW+UhOA07UDLB9u 0pIat9VtoK6ps4pQKUOvr9WB47zpagQ9XF6YfKx1BrbUw1/R4QPYjLwh3QXNO0xX8TeM X3TBh3Evw8k/iRuTxFxIBd+bTLo4IBzNtjZg0gQkAKwop/WGZtIXKD5ZxaNY6z+oUvvX xf0HK8+oyaCfy74hEbexUiFfqm9s4BnIiBN+yJjOruUN/px2ZPnTxspEo8iuJaSReXOn mkLTE2BeDaK6jHHsAXHV5srwhbi863NIdn/pxs9LDPCeHCygNGRqclFsg3KTVCLhsFu+ Brww== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jg36-20020a170907972400b00787b9cd2fe3si15179509ejc.844.2022.12.06.17.50.49; Tue, 06 Dec 2022 17:51:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229573AbiLGBqK (ORCPT <rfc822;b08248@gmail.com> + 99 others); Tue, 6 Dec 2022 20:46:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229669AbiLGBqH (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 6 Dec 2022 20:46:07 -0500 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4112F4D5F6; Tue, 6 Dec 2022 17:46:02 -0800 (PST) Received: from loongson.cn (unknown [10.180.13.64]) by gateway (Coremail) with SMTP id _____8CxZPBZ8I9jybQDAA--.8534S3; Wed, 07 Dec 2022 09:46:01 +0800 (CST) Received: from localhost.localdomain (unknown [10.180.13.64]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Dx_eFU8I9jo_omAA--.30148S2; Wed, 07 Dec 2022 09:46:00 +0800 (CST) From: Yinbo Zhu <zhuyinbo@loongson.cn> To: Huacai Chen <chenhuacai@kernel.org>, Jiaxun Yang <jiaxun.yang@flygoat.com>, Thomas Gleixner <tglx@linutronix.de>, Marc Zyngier <maz@kernel.org>, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Yinbo Zhu <zhuyinbo@loongson.cn> Subject: [PATCH v1] irqchip: loongson-liointc: add hierarchy irq support Date: Wed, 7 Dec 2022 09:45:55 +0800 Message-Id: <20221207014555.22465-1-zhuyinbo@loongson.cn> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQAAf8Dx_eFU8I9jo_omAA--.30148S2 X-CM-SenderInfo: 52kx5xhqerqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBjvJXoW7WF43GF43GrW7Xr47Ar1UJrb_yoW8tryfpF 4rAwnFvr45Jw42gw43CF1DX34akFWFqrZFyayfKF9rZFs8J3s5CF1ruFnF9r4akr1UG3WU ZFn7XFWruF45JaDanT9S1TB71UUUUUDqnTZGkaVYY2UrUUUUj1kv1TuYvTs0mT0YCTnIWj qI5I8CrVACY4xI64kE6c02F40Ex7xfYxn0WfASr-VFAUDa7-sFnT9fnUUIcSsGvfJTRUUU b78Fc2x0x2IEx4CE42xK8VAvwI8IcIk0rVWrJVCq3wAFIxvE14AKwVWUXVWUAwA2ocxC64 kIII0Yj41l84x0c7CEw4AK67xGY2AK021l84ACjcxK6xIIjxv20xvE14v26ryj6F1UM28E F7xvwVC0I7IYx2IY6xkF7I0E14v26r4j6F4UM28EF7xvwVC2z280aVAFwI0_Gr1j6F4UJw A2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gr1j6F4UJwAS0I0E0xvYzxvE52x082IY62kv0487 Mc804VCY07AIYIkI8VC2zVCFFI0UMc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2 IY67AKxVWUXVWUAwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0 Y48IcxkI7VAKI48JMxAIw28IcxkI7VAKI48JMxAIw28IcVCjz48v1sIEY20_WwCFx2IqxV CFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r10 6r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxV WUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF04k26cxKx2IYs7xG 6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Jr0_Gr UvcSsGvfC2KfnxnUUI43ZEXa7IU1tl1PUUUUU== X-Spam-Status: No, score=1.4 required=5.0 tests=BAYES_00,RCVD_IN_SBL_CSS, SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751518147406584057?= X-GMAIL-MSGID: =?utf-8?q?1751518147406584057?= |
Series |
[v1] irqchip: loongson-liointc: add hierarchy irq support
|
|
Commit Message
Yinbo Zhu
Dec. 7, 2022, 1:45 a.m. UTC
When the irq of hierarchical interrupt chip was routed to liointc
that asked liointc driver to support hierarchy irq and this patch
was to add such support.
In addition, this patch only consider dts, and acpi hierarchy irq
support will be added later as required.
Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
---
drivers/irqchip/irq-loongson-liointc.c | 31 ++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
Comments
On Wed, 07 Dec 2022 01:45:55 +0000, Yinbo Zhu <zhuyinbo@loongson.cn> wrote: > > When the irq of hierarchical interrupt chip was routed to liointc > that asked liointc driver to support hierarchy irq and this patch > was to add such support. > > In addition, this patch only consider dts, and acpi hierarchy irq > support will be added later as required. > > Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn> > --- > drivers/irqchip/irq-loongson-liointc.c | 31 ++++++++++++++++++++++++++ > 1 file changed, 31 insertions(+) > > diff --git a/drivers/irqchip/irq-loongson-liointc.c b/drivers/irqchip/irq-loongson-liointc.c > index 0da8716f8f24..58e43a2cd02e 100644 > --- a/drivers/irqchip/irq-loongson-liointc.c > +++ b/drivers/irqchip/irq-loongson-liointc.c > @@ -177,6 +177,32 @@ static const struct irq_domain_ops acpi_irq_gc_ops = { > .xlate = liointc_domain_xlate, > }; > > +#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY > +static int liointc_domain_alloc(struct irq_domain *domain, unsigned int virq, > + unsigned int nr_irqs, void *arg) > +{ > + int i, ret; > + irq_hw_number_t hwirq; > + unsigned int type = IRQ_TYPE_NONE; > + struct irq_fwspec *fwspec = arg; > + > + ret = irq_domain_translate_twocell(domain, fwspec, &hwirq, &type); > + if (ret) > + return ret; > + > + for (i = 0; i < nr_irqs; i++) > + irq_map_generic_chip(domain, virq + i, hwirq + i); > + > + return 0; > +} > + > +static const struct irq_domain_ops of_irq_gc_ops = { > + .translate = irq_domain_translate_twocell, > + .alloc = liointc_domain_alloc, > + .free = irq_domain_free_irqs_top, > +}; > +#endif > + > static int liointc_init(phys_addr_t addr, unsigned long size, int revision, > struct fwnode_handle *domain_handle, struct device_node *node) > { > @@ -218,8 +244,13 @@ static int liointc_init(phys_addr_t addr, unsigned long size, int revision, > domain = irq_domain_create_linear(domain_handle, LIOINTC_CHIP_IRQ, > &acpi_irq_gc_ops, priv); > else > +#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY > + domain = irq_domain_create_linear(domain_handle, LIOINTC_CHIP_IRQ, > + &of_irq_gc_ops, priv); > +#else > domain = irq_domain_create_linear(domain_handle, LIOINTC_CHIP_IRQ, > &irq_generic_chip_ops, priv); > +#endif Two things: - Why do we need three calls to create the same domains depending on what firmware is used and kernel configuration? - who is going to decide whether to select the CONFIG_IRQ_DOMAIN_HIERARCHY option? I'd really like to see a statement from the Loongson folks about what this whole DT stuff is all about. AFAICT, the core ACPICA stuff isn't even fully merged (i.e. we still rely on arch-specific hacks). Can you *please* finish what you've started before adding another layer of quality stuff on top? M.
在 2022/12/7 16:08, Marc Zyngier 写道: > On Wed, 07 Dec 2022 01:45:55 +0000, > Yinbo Zhu <zhuyinbo@loongson.cn> wrote: >> When the irq of hierarchical interrupt chip was routed to liointc >> that asked liointc driver to support hierarchy irq and this patch >> was to add such support. >> >> In addition, this patch only consider dts, and acpi hierarchy irq >> support will be added later as required. >> >> Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn> >> --- >> drivers/irqchip/irq-loongson-liointc.c | 31 ++++++++++++++++++++++++++ >> 1 file changed, 31 insertions(+) >> >> diff --git a/drivers/irqchip/irq-loongson-liointc.c b/drivers/irqchip/irq-loongson-liointc.c >> index 0da8716f8f24..58e43a2cd02e 100644 >> --- a/drivers/irqchip/irq-loongson-liointc.c >> +++ b/drivers/irqchip/irq-loongson-liointc.c >> @@ -177,6 +177,32 @@ static const struct irq_domain_ops acpi_irq_gc_ops = { >> .xlate = liointc_domain_xlate, >> }; >> >> +#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY >> +static int liointc_domain_alloc(struct irq_domain *domain, unsigned int virq, >> + unsigned int nr_irqs, void *arg) >> +{ >> + int i, ret; >> + irq_hw_number_t hwirq; >> + unsigned int type = IRQ_TYPE_NONE; >> + struct irq_fwspec *fwspec = arg; >> + >> + ret = irq_domain_translate_twocell(domain, fwspec, &hwirq, &type); >> + if (ret) >> + return ret; >> + >> + for (i = 0; i < nr_irqs; i++) >> + irq_map_generic_chip(domain, virq + i, hwirq + i); >> + >> + return 0; >> +} >> + >> +static const struct irq_domain_ops of_irq_gc_ops = { >> + .translate = irq_domain_translate_twocell, >> + .alloc = liointc_domain_alloc, >> + .free = irq_domain_free_irqs_top, >> +}; >> +#endif >> + >> static int liointc_init(phys_addr_t addr, unsigned long size, int revision, >> struct fwnode_handle *domain_handle, struct device_node *node) >> { >> @@ -218,8 +244,13 @@ static int liointc_init(phys_addr_t addr, unsigned long size, int revision, >> domain = irq_domain_create_linear(domain_handle, LIOINTC_CHIP_IRQ, >> &acpi_irq_gc_ops, priv); >> else >> +#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY >> + domain = irq_domain_create_linear(domain_handle, LIOINTC_CHIP_IRQ, >> + &of_irq_gc_ops, priv); >> +#else >> domain = irq_domain_create_linear(domain_handle, LIOINTC_CHIP_IRQ, >> &irq_generic_chip_ops, priv); >> +#endif > Two things: > > - Why do we need three calls to create the same domains depending on > what firmware is used and kernel configuration? yes, It depend on firmeware and kernel configuration. > > - who is going to decide whether to select the > CONFIG_IRQ_DOMAIN_HIERARCHY option? The latest gpio driver will select CONFIG_IRQ_DOMAIN_HIERARCHY > > I'd really like to see a statement from the Loongson folks about what > this whole DT stuff is all about. AFAICT, the core ACPICA stuff isn't > even fully merged (i.e. we still rely on arch-specific hacks). The support of dts is mainly for Loongson embedded chips, such as LoongArch Loongson-2 series SoC. and it use dts to descripte device and don't support acpi. > > Can you *please* finish what you've started before adding another > layer of quality stuff on top? > > M. >
On Wed, 07 Dec 2022 10:50:56 +0000, Yinbo Zhu <zhuyinbo@loongson.cn> wrote: > > > 在 2022/12/7 16:08, Marc Zyngier 写道: > > On Wed, 07 Dec 2022 01:45:55 +0000, > > Yinbo Zhu <zhuyinbo@loongson.cn> wrote: > >> When the irq of hierarchical interrupt chip was routed to liointc > >> that asked liointc driver to support hierarchy irq and this patch > >> was to add such support. > >> > >> In addition, this patch only consider dts, and acpi hierarchy irq > >> support will be added later as required. > >> > >> Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn> > >> --- > >> drivers/irqchip/irq-loongson-liointc.c | 31 ++++++++++++++++++++++++++ > >> 1 file changed, 31 insertions(+) > >> > >> diff --git a/drivers/irqchip/irq-loongson-liointc.c b/drivers/irqchip/irq-loongson-liointc.c > >> index 0da8716f8f24..58e43a2cd02e 100644 > >> --- a/drivers/irqchip/irq-loongson-liointc.c > >> +++ b/drivers/irqchip/irq-loongson-liointc.c > >> @@ -177,6 +177,32 @@ static const struct irq_domain_ops acpi_irq_gc_ops = { > >> .xlate = liointc_domain_xlate, > >> }; > >> +#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY > >> +static int liointc_domain_alloc(struct irq_domain *domain, unsigned int virq, > >> + unsigned int nr_irqs, void *arg) > >> +{ > >> + int i, ret; > >> + irq_hw_number_t hwirq; > >> + unsigned int type = IRQ_TYPE_NONE; > >> + struct irq_fwspec *fwspec = arg; > >> + > >> + ret = irq_domain_translate_twocell(domain, fwspec, &hwirq, &type); > >> + if (ret) > >> + return ret; > >> + > >> + for (i = 0; i < nr_irqs; i++) > >> + irq_map_generic_chip(domain, virq + i, hwirq + i); > >> + > >> + return 0; > >> +} > >> + > >> +static const struct irq_domain_ops of_irq_gc_ops = { > >> + .translate = irq_domain_translate_twocell, > >> + .alloc = liointc_domain_alloc, > >> + .free = irq_domain_free_irqs_top, > >> +}; > >> +#endif > >> + > >> static int liointc_init(phys_addr_t addr, unsigned long size, int revision, > >> struct fwnode_handle *domain_handle, struct device_node *node) > >> { > >> @@ -218,8 +244,13 @@ static int liointc_init(phys_addr_t addr, unsigned long size, int revision, > >> domain = irq_domain_create_linear(domain_handle, LIOINTC_CHIP_IRQ, > >> &acpi_irq_gc_ops, priv); > >> else > >> +#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY > >> + domain = irq_domain_create_linear(domain_handle, LIOINTC_CHIP_IRQ, > >> + &of_irq_gc_ops, priv); > >> +#else > >> domain = irq_domain_create_linear(domain_handle, LIOINTC_CHIP_IRQ, > >> &irq_generic_chip_ops, priv); > >> +#endif > > Two things: > > > > - Why do we need three calls to create the same domains depending on > > what firmware is used and kernel configuration? > yes, It depend on firmeware and kernel configuration. Read again: why do we need 3 different calls to irq_domain_create_linear when you can *indirect* them with a pointer to the correct structure? > > > > - who is going to decide whether to select the > > CONFIG_IRQ_DOMAIN_HIERARCHY option? > The latest gpio driver will select CONFIG_IRQ_DOMAIN_HIERARCHY Then why do we need two different behaviours? The same kernel should run everywhere. > > > > I'd really like to see a statement from the Loongson folks about what > > this whole DT stuff is all about. AFAICT, the core ACPICA stuff isn't > > even fully merged (i.e. we still rely on arch-specific hacks). > > The support of dts is mainly for Loongson embedded chips, such as > LoongArch Loongson-2 series SoC. and it use dts to descripte device > and don't support acpi. That doesn't answer my question. Please have a *consistent* approach to your interrupt handling, and work with your ACPI colleagues. M.
在 2022/12/7 19:07, Marc Zyngier 写道: > On Wed, 07 Dec 2022 10:50:56 +0000, > Yinbo Zhu <zhuyinbo@loongson.cn> wrote: >> >> 在 2022/12/7 16:08, Marc Zyngier 写道: >>> On Wed, 07 Dec 2022 01:45:55 +0000, >>> Yinbo Zhu <zhuyinbo@loongson.cn> wrote: >>>> When the irq of hierarchical interrupt chip was routed to liointc >>>> that asked liointc driver to support hierarchy irq and this patch >>>> was to add such support. >>>> >>>> In addition, this patch only consider dts, and acpi hierarchy irq >>>> support will be added later as required. >>>> >>>> Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn> >>>> --- >>>> drivers/irqchip/irq-loongson-liointc.c | 31 ++++++++++++++++++++++++++ >>>> 1 file changed, 31 insertions(+) >>>> >>>> diff --git a/drivers/irqchip/irq-loongson-liointc.c b/drivers/irqchip/irq-loongson-liointc.c >>>> index 0da8716f8f24..58e43a2cd02e 100644 >>>> --- a/drivers/irqchip/irq-loongson-liointc.c >>>> +++ b/drivers/irqchip/irq-loongson-liointc.c >>>> @@ -177,6 +177,32 @@ static const struct irq_domain_ops acpi_irq_gc_ops = { >>>> .xlate = liointc_domain_xlate, >>>> }; >>>> +#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY >>>> +static int liointc_domain_alloc(struct irq_domain *domain, unsigned int virq, >>>> + unsigned int nr_irqs, void *arg) >>>> +{ >>>> + int i, ret; >>>> + irq_hw_number_t hwirq; >>>> + unsigned int type = IRQ_TYPE_NONE; >>>> + struct irq_fwspec *fwspec = arg; >>>> + >>>> + ret = irq_domain_translate_twocell(domain, fwspec, &hwirq, &type); >>>> + if (ret) >>>> + return ret; >>>> + >>>> + for (i = 0; i < nr_irqs; i++) >>>> + irq_map_generic_chip(domain, virq + i, hwirq + i); >>>> + >>>> + return 0; >>>> +} >>>> + >>>> +static const struct irq_domain_ops of_irq_gc_ops = { >>>> + .translate = irq_domain_translate_twocell, >>>> + .alloc = liointc_domain_alloc, >>>> + .free = irq_domain_free_irqs_top, >>>> +}; >>>> +#endif >>>> + >>>> static int liointc_init(phys_addr_t addr, unsigned long size, int revision, >>>> struct fwnode_handle *domain_handle, struct device_node *node) >>>> { >>>> @@ -218,8 +244,13 @@ static int liointc_init(phys_addr_t addr, unsigned long size, int revision, >>>> domain = irq_domain_create_linear(domain_handle, LIOINTC_CHIP_IRQ, >>>> &acpi_irq_gc_ops, priv); >>>> else >>>> +#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY >>>> + domain = irq_domain_create_linear(domain_handle, LIOINTC_CHIP_IRQ, >>>> + &of_irq_gc_ops, priv); >>>> +#else >>>> domain = irq_domain_create_linear(domain_handle, LIOINTC_CHIP_IRQ, >>>> &irq_generic_chip_ops, priv); >>>> +#endif >>> Two things: >>> >>> - Why do we need three calls to create the same domains depending on >>> what firmware is used and kernel configuration? >> yes, It depend on firmeware and kernel configuration. > Read again: > > why do we need 3 different calls to irq_domain_create_linear when you > can *indirect* them with a pointer to the correct structure? It was not considered comprehensively before, one call is enough. > >>> - who is going to decide whether to select the >>> CONFIG_IRQ_DOMAIN_HIERARCHY option? >> The latest gpio driver will select CONFIG_IRQ_DOMAIN_HIERARCHY > Then why do we need two different behaviours? The same kernel should > run everywhere. in fact, A behaviours can handle it, and I will add proper change in v2. > >>> I'd really like to see a statement from the Loongson folks about what >>> this whole DT stuff is all about. AFAICT, the core ACPICA stuff isn't >>> even fully merged (i.e. we still rely on arch-specific hacks). >> The support of dts is mainly for Loongson embedded chips, such as >> LoongArch Loongson-2 series SoC. and it use dts to descripte device >> and don't support acpi. > That doesn't answer my question. Please have a *consistent* approach > to your interrupt handling, and work with your ACPI colleagues. I have a talk with ACPI colleagues that the dts and acpi can keep consistent approach and I will add it in v2. > > M. >
diff --git a/drivers/irqchip/irq-loongson-liointc.c b/drivers/irqchip/irq-loongson-liointc.c index 0da8716f8f24..58e43a2cd02e 100644 --- a/drivers/irqchip/irq-loongson-liointc.c +++ b/drivers/irqchip/irq-loongson-liointc.c @@ -177,6 +177,32 @@ static const struct irq_domain_ops acpi_irq_gc_ops = { .xlate = liointc_domain_xlate, }; +#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY +static int liointc_domain_alloc(struct irq_domain *domain, unsigned int virq, + unsigned int nr_irqs, void *arg) +{ + int i, ret; + irq_hw_number_t hwirq; + unsigned int type = IRQ_TYPE_NONE; + struct irq_fwspec *fwspec = arg; + + ret = irq_domain_translate_twocell(domain, fwspec, &hwirq, &type); + if (ret) + return ret; + + for (i = 0; i < nr_irqs; i++) + irq_map_generic_chip(domain, virq + i, hwirq + i); + + return 0; +} + +static const struct irq_domain_ops of_irq_gc_ops = { + .translate = irq_domain_translate_twocell, + .alloc = liointc_domain_alloc, + .free = irq_domain_free_irqs_top, +}; +#endif + static int liointc_init(phys_addr_t addr, unsigned long size, int revision, struct fwnode_handle *domain_handle, struct device_node *node) { @@ -218,8 +244,13 @@ static int liointc_init(phys_addr_t addr, unsigned long size, int revision, domain = irq_domain_create_linear(domain_handle, LIOINTC_CHIP_IRQ, &acpi_irq_gc_ops, priv); else +#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY + domain = irq_domain_create_linear(domain_handle, LIOINTC_CHIP_IRQ, + &of_irq_gc_ops, priv); +#else domain = irq_domain_create_linear(domain_handle, LIOINTC_CHIP_IRQ, &irq_generic_chip_ops, priv); +#endif if (!domain) { pr_err("loongson-liointc: cannot add IRQ domain\n"); goto out_iounmap;