* [PATCH V1 0/2] irqchip: Support to set irq type for ACPI path
@ 2022-08-16 2:01 Jianmin Lv
2022-08-16 2:01 ` [PATCH V1 1/2] irqchip/loongson-pch-pic: " Jianmin Lv
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Jianmin Lv @ 2022-08-16 2:01 UTC (permalink / raw)
To: Thomas Gleixner, Marc Zyngier
Cc: linux-kernel, loongarch, Jiaxun Yang, Huacai Chen
For ACPI path of pch-pic and liointc driver, setting irq
type is not supported yet, so the patch series add code
to implement it.
Jianmin Lv (2):
irqchip/loongson-pch-pic: Support to set irq type for ACPI path
LoongArch: Support to set irq type for liointc
drivers/acpi/pci_irq.c | 3 ++-
drivers/irqchip/irq-loongson-liointc.c | 7 ++++++-
drivers/irqchip/irq-loongson-pch-pic.c | 10 ++++++----
3 files changed, 14 insertions(+), 6 deletions(-)
--
1.8.3.1
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH V1 1/2] irqchip/loongson-pch-pic: Support to set irq type for ACPI path 2022-08-16 2:01 [PATCH V1 0/2] irqchip: Support to set irq type for ACPI path Jianmin Lv @ 2022-08-16 2:01 ` Jianmin Lv 2022-09-28 14:49 ` Marc Zyngier 2022-08-16 2:01 ` [PATCH V1 2/2] irqchip/loongson-liointc: " Jianmin Lv 2022-09-05 3:01 ` [PATCH V1 0/2] irqchip: " Jianmin Lv 2 siblings, 1 reply; 8+ messages in thread From: Jianmin Lv @ 2022-08-16 2:01 UTC (permalink / raw) To: Thomas Gleixner, Marc Zyngier Cc: linux-kernel, loongarch, Jiaxun Yang, Huacai Chen For ACPI path, the translate callback used IRQ_TYPE_NONE and ignored the irq type in fwspec->param[1]. For supporting to set type for irqs of the irqdomain, fwspec->param[1] should be used to get irq type. On Loongson platform, the irq trigger type of PCI devices is high level, so high level triggered type is inputed to acpi_register_gsi when create irq mapping for PCI devices. Signed-off-by: Jianmin Lv <lvjianmin@loongson.cn> --- drivers/acpi/pci_irq.c | 3 ++- drivers/irqchip/irq-loongson-pch-pic.c | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index 08e1577..34483b3 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c @@ -393,7 +393,8 @@ int acpi_pci_irq_enable(struct pci_dev *dev) * controller and must therefore be considered active high * as default. */ - int polarity = acpi_irq_model == ACPI_IRQ_MODEL_GIC ? + int polarity = acpi_irq_model == ACPI_IRQ_MODEL_GIC || + acpi_irq_model == ACPI_IRQ_MODEL_LPIC ? ACPI_ACTIVE_HIGH : ACPI_ACTIVE_LOW; char *link = NULL; char link_desc[16]; diff --git a/drivers/irqchip/irq-loongson-pch-pic.c b/drivers/irqchip/irq-loongson-pch-pic.c index b6f1392..5067010 100644 --- a/drivers/irqchip/irq-loongson-pch-pic.c +++ b/drivers/irqchip/irq-loongson-pch-pic.c @@ -177,13 +177,15 @@ static int pch_pic_domain_translate(struct irq_domain *d, if (fwspec->param_count < 1) return -EINVAL; - if (of_node) { + if (of_node) *hwirq = fwspec->param[0] + priv->ht_vec_base; - *type = fwspec->param[1] & IRQ_TYPE_SENSE_MASK; - } else { + else *hwirq = fwspec->param[0] - priv->gsi_base; + + if (fwspec->param_count > 1) + *type = fwspec->param[1] & IRQ_TYPE_SENSE_MASK; + else *type = IRQ_TYPE_NONE; - } return 0; } -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH V1 1/2] irqchip/loongson-pch-pic: Support to set irq type for ACPI path 2022-08-16 2:01 ` [PATCH V1 1/2] irqchip/loongson-pch-pic: " Jianmin Lv @ 2022-09-28 14:49 ` Marc Zyngier 2022-09-29 2:35 ` Jianmin Lv 0 siblings, 1 reply; 8+ messages in thread From: Marc Zyngier @ 2022-09-28 14:49 UTC (permalink / raw) To: Jianmin Lv Cc: Thomas Gleixner, linux-kernel, loongarch, Jiaxun Yang, Huacai Chen On Mon, 15 Aug 2022 22:01:30 -0400, Jianmin Lv <lvjianmin@loongson.cn> wrote: > > For ACPI path, the translate callback used IRQ_TYPE_NONE and ignored > the irq type in fwspec->param[1]. For supporting to set type for > irqs of the irqdomain, fwspec->param[1] should be used to get irq > type. > > On Loongson platform, the irq trigger type of PCI devices is > high level, so high level triggered type is inputed to acpi_register_gsi > when create irq mapping for PCI devices. > > Signed-off-by: Jianmin Lv <lvjianmin@loongson.cn> > --- > drivers/acpi/pci_irq.c | 3 ++- > drivers/irqchip/irq-loongson-pch-pic.c | 10 ++++++---- > 2 files changed, 8 insertions(+), 5 deletions(-) $ ./scripts/get_maintainer.pl drivers/acpi/pci_irq.c Bjorn Helgaas <bhelgaas@google.com> (supporter:PCI SUBSYSTEM) "Rafael J. Wysocki" <rafael@kernel.org> (supporter:ACPI) Len Brown <lenb@kernel.org> (reviewer:ACPI) linux-pci@vger.kernel.org (open list:PCI SUBSYSTEM) linux-acpi@vger.kernel.org (open list:ACPI) linux-kernel@vger.kernel.org (open list) How about you start Cc-ing some of the relevant people? > > diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c > index 08e1577..34483b3 100644 > --- a/drivers/acpi/pci_irq.c > +++ b/drivers/acpi/pci_irq.c > @@ -393,7 +393,8 @@ int acpi_pci_irq_enable(struct pci_dev *dev) > * controller and must therefore be considered active high > * as default. > */ > - int polarity = acpi_irq_model == ACPI_IRQ_MODEL_GIC ? > + int polarity = acpi_irq_model == ACPI_IRQ_MODEL_GIC || > + acpi_irq_model == ACPI_IRQ_MODEL_LPIC ? > ACPI_ACTIVE_HIGH : ACPI_ACTIVE_LOW; The comment just above this only talks about ARM. Should it be updated? Is this a limitation of the underlying interrupt controller? > char *link = NULL; > char link_desc[16]; > diff --git a/drivers/irqchip/irq-loongson-pch-pic.c b/drivers/irqchip/irq-loongson-pch-pic.c > index b6f1392..5067010 100644 > --- a/drivers/irqchip/irq-loongson-pch-pic.c > +++ b/drivers/irqchip/irq-loongson-pch-pic.c > @@ -177,13 +177,15 @@ static int pch_pic_domain_translate(struct irq_domain *d, > if (fwspec->param_count < 1) > return -EINVAL; > > - if (of_node) { > + if (of_node) > *hwirq = fwspec->param[0] + priv->ht_vec_base; > - *type = fwspec->param[1] & IRQ_TYPE_SENSE_MASK; > - } else { > + else > *hwirq = fwspec->param[0] - priv->gsi_base; > + > + if (fwspec->param_count > 1) > + *type = fwspec->param[1] & IRQ_TYPE_SENSE_MASK; > + else > *type = IRQ_TYPE_NONE; Isn't that a change in behaviour if of_node is non-NULL and param_count==1? > - } > > return 0; > } This irqchip change should probably be a separate patch. M. -- Without deviation from the norm, progress is not possible. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH V1 1/2] irqchip/loongson-pch-pic: Support to set irq type for ACPI path 2022-09-28 14:49 ` Marc Zyngier @ 2022-09-29 2:35 ` Jianmin Lv 2022-09-29 9:44 ` Marc Zyngier 0 siblings, 1 reply; 8+ messages in thread From: Jianmin Lv @ 2022-09-29 2:35 UTC (permalink / raw) To: Marc Zyngier Cc: Thomas Gleixner, linux-kernel, loongarch, Jiaxun Yang, Huacai Chen, Bjorn Helgaas, Rafael J. Wysocki, Len Brown, linux-pci, linux-acpi On 2022/9/28 下午10:49, Marc Zyngier wrote: > On Mon, 15 Aug 2022 22:01:30 -0400, > Jianmin Lv <lvjianmin@loongson.cn> wrote: >> >> For ACPI path, the translate callback used IRQ_TYPE_NONE and ignored >> the irq type in fwspec->param[1]. For supporting to set type for >> irqs of the irqdomain, fwspec->param[1] should be used to get irq >> type. >> >> On Loongson platform, the irq trigger type of PCI devices is >> high level, so high level triggered type is inputed to acpi_register_gsi >> when create irq mapping for PCI devices. >> >> Signed-off-by: Jianmin Lv <lvjianmin@loongson.cn> >> --- >> drivers/acpi/pci_irq.c | 3 ++- >> drivers/irqchip/irq-loongson-pch-pic.c | 10 ++++++---- >> 2 files changed, 8 insertions(+), 5 deletions(-) > > $ ./scripts/get_maintainer.pl drivers/acpi/pci_irq.c > Bjorn Helgaas <bhelgaas@google.com> (supporter:PCI SUBSYSTEM) > "Rafael J. Wysocki" <rafael@kernel.org> (supporter:ACPI) > Len Brown <lenb@kernel.org> (reviewer:ACPI) > linux-pci@vger.kernel.org (open list:PCI SUBSYSTEM) > linux-acpi@vger.kernel.org (open list:ACPI) > linux-kernel@vger.kernel.org (open list) > > How about you start Cc-ing some of the relevant people? > Ok, thanks, I'll cc relevant people list here. >> >> diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c >> index 08e1577..34483b3 100644 >> --- a/drivers/acpi/pci_irq.c >> +++ b/drivers/acpi/pci_irq.c >> @@ -393,7 +393,8 @@ int acpi_pci_irq_enable(struct pci_dev *dev) >> * controller and must therefore be considered active high >> * as default. >> */ >> - int polarity = acpi_irq_model == ACPI_IRQ_MODEL_GIC ? >> + int polarity = acpi_irq_model == ACPI_IRQ_MODEL_GIC || >> + acpi_irq_model == ACPI_IRQ_MODEL_LPIC ? >> ACPI_ACTIVE_HIGH : ACPI_ACTIVE_LOW; > > The comment just above this only talks about ARM. Should it be > updated? Ok, I'll update the comment. Is this a limitation of the underlying interrupt controller? > It's the limitation that pci interrupt source of LoongArch only sends high level trigger signal to interrupt controller(though, pci spec requires asserted low). >> char *link = NULL; >> char link_desc[16]; >> diff --git a/drivers/irqchip/irq-loongson-pch-pic.c b/drivers/irqchip/irq-loongson-pch-pic.c >> index b6f1392..5067010 100644 >> --- a/drivers/irqchip/irq-loongson-pch-pic.c >> +++ b/drivers/irqchip/irq-loongson-pch-pic.c >> @@ -177,13 +177,15 @@ static int pch_pic_domain_translate(struct irq_domain *d, >> if (fwspec->param_count < 1) >> return -EINVAL; >> >> - if (of_node) { >> + if (of_node) >> *hwirq = fwspec->param[0] + priv->ht_vec_base; >> - *type = fwspec->param[1] & IRQ_TYPE_SENSE_MASK; >> - } else { >> + else >> *hwirq = fwspec->param[0] - priv->gsi_base; >> + >> + if (fwspec->param_count > 1) >> + *type = fwspec->param[1] & IRQ_TYPE_SENSE_MASK; >> + else >> *type = IRQ_TYPE_NONE; > > Isn't that a change in behaviour if of_node is non-NULL and > param_count==1? > It seems that current code here has bug that if fwspec->param_count==1 and of_node is non-null, fwspec->param[1] will be accessed, which is introduced from previous patch(irqchip/loongson-pch-pic: Add ACPI init support). Before the patch, for non-null of_node, translate callback(use irq_domain_translate_twocell) will return -EINVAL if fwspec->param_count < 2. For ACPI path, fwspec->param_count can be 1 or 2. So in this patch, I'll fix the bug and change the code as following: if (fwspec->param_count < 1) return -EINVAL; if (of_node) { if (fwspec->param_count < 2) return -EINVAL; *hwirq = fwspec->param[0] + priv->ht_vec_base; *type = fwspec->param[1] & IRQ_TYPE_SENSE_MASK; } else { *hwirq = fwspec->param[0] - priv->gsi_base; if (fwspec->param_count > 1) *type = fwspec->param[1] & IRQ_TYPE_SENSE_MASK; else *type = IRQ_TYPE_NONE; } >> - } >> >> return 0; >> } > > This irqchip change should probably be a separate patch. > As a separate patch, the input trigger type of pci devices will be low level because of lacking of workaround to acpi_pci_irq_enable, which will cause kernel hang, unless the patch of workaround to acpi_pci_irq_enable is in front of this separated patch. > M. > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH V1 1/2] irqchip/loongson-pch-pic: Support to set irq type for ACPI path 2022-09-29 2:35 ` Jianmin Lv @ 2022-09-29 9:44 ` Marc Zyngier 2022-09-29 13:34 ` Jianmin Lv 0 siblings, 1 reply; 8+ messages in thread From: Marc Zyngier @ 2022-09-29 9:44 UTC (permalink / raw) To: Jianmin Lv Cc: Thomas Gleixner, linux-kernel, loongarch, Jiaxun Yang, Huacai Chen, Bjorn Helgaas, Rafael J. Wysocki, Len Brown, linux-pci, linux-acpi On Wed, 28 Sep 2022 22:35:17 -0400, Jianmin Lv <lvjianmin@loongson.cn> wrote: > > On 2022/9/28 下午10:49, Marc Zyngier wrote: > > On Mon, 15 Aug 2022 22:01:30 -0400, > > Jianmin Lv <lvjianmin@loongson.cn> wrote: > >> > >> For ACPI path, the translate callback used IRQ_TYPE_NONE and ignored > >> the irq type in fwspec->param[1]. For supporting to set type for > >> irqs of the irqdomain, fwspec->param[1] should be used to get irq > >> type. > >> > >> On Loongson platform, the irq trigger type of PCI devices is > >> high level, so high level triggered type is inputed to acpi_register_gsi > >> when create irq mapping for PCI devices. > >> > >> Signed-off-by: Jianmin Lv <lvjianmin@loongson.cn> > >> --- > >> drivers/acpi/pci_irq.c | 3 ++- > >> drivers/irqchip/irq-loongson-pch-pic.c | 10 ++++++---- > >> 2 files changed, 8 insertions(+), 5 deletions(-) > > > > $ ./scripts/get_maintainer.pl drivers/acpi/pci_irq.c > > Bjorn Helgaas <bhelgaas@google.com> (supporter:PCI SUBSYSTEM) > > "Rafael J. Wysocki" <rafael@kernel.org> (supporter:ACPI) > > Len Brown <lenb@kernel.org> (reviewer:ACPI) > > linux-pci@vger.kernel.org (open list:PCI SUBSYSTEM) > > linux-acpi@vger.kernel.org (open list:ACPI) > > linux-kernel@vger.kernel.org (open list) > > > > How about you start Cc-ing some of the relevant people? > > > Ok, thanks, I'll cc relevant people list here. > > >> > >> diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c > >> index 08e1577..34483b3 100644 > >> --- a/drivers/acpi/pci_irq.c > >> +++ b/drivers/acpi/pci_irq.c > >> @@ -393,7 +393,8 @@ int acpi_pci_irq_enable(struct pci_dev *dev) > >> * controller and must therefore be considered active high > >> * as default. > >> */ > >> - int polarity = acpi_irq_model == ACPI_IRQ_MODEL_GIC ? > >> + int polarity = acpi_irq_model == ACPI_IRQ_MODEL_GIC || > >> + acpi_irq_model == ACPI_IRQ_MODEL_LPIC ? > >> ACPI_ACTIVE_HIGH : ACPI_ACTIVE_LOW; > > > > The comment just above this only talks about ARM. Should it be > > updated? > > Ok, I'll update the comment. > > > > Is this a limitation of the underlying interrupt controller? > > > It's the limitation that pci interrupt source of LoongArch only sends > high level trigger signal to interrupt controller(though, pci spec > requires asserted low). Right, so this is the opposite problem ARM has. But is it *always* intended to be built like this? Or is it a one-off for this generation of Loongarch systems, to be fixed at a later time? > > > >> char *link = NULL; > >> char link_desc[16]; > >> diff --git a/drivers/irqchip/irq-loongson-pch-pic.c b/drivers/irqchip/irq-loongson-pch-pic.c > >> index b6f1392..5067010 100644 > >> --- a/drivers/irqchip/irq-loongson-pch-pic.c > >> +++ b/drivers/irqchip/irq-loongson-pch-pic.c > >> @@ -177,13 +177,15 @@ static int pch_pic_domain_translate(struct irq_domain *d, > >> if (fwspec->param_count < 1) > >> return -EINVAL; > >> - if (of_node) { > >> + if (of_node) > >> *hwirq = fwspec->param[0] + priv->ht_vec_base; > >> - *type = fwspec->param[1] & IRQ_TYPE_SENSE_MASK; > >> - } else { > >> + else > >> *hwirq = fwspec->param[0] - priv->gsi_base; > >> + > >> + if (fwspec->param_count > 1) > >> + *type = fwspec->param[1] & IRQ_TYPE_SENSE_MASK; > >> + else > >> *type = IRQ_TYPE_NONE; > > > > Isn't that a change in behaviour if of_node is non-NULL and > > param_count==1? > > > > It seems that current code here has bug that if fwspec->param_count==1 > and of_node is non-null, fwspec->param[1] will be accessed, which is > introduced from previous patch(irqchip/loongson-pch-pic: Add ACPI init > support). Before the patch, for non-null of_node, translate > callback(use irq_domain_translate_twocell) will return -EINVAL if > fwspec->param_count < 2. > > For ACPI path, fwspec->param_count can be 1 or 2. > > So in this patch, I'll fix the bug and change the code as following: > > if (fwspec->param_count < 1) > return -EINVAL; > > if (of_node) { > if (fwspec->param_count < 2) > return -EINVAL; > > *hwirq = fwspec->param[0] + priv->ht_vec_base; > *type = fwspec->param[1] & IRQ_TYPE_SENSE_MASK; > } else { > *hwirq = fwspec->param[0] - priv->gsi_base; > > if (fwspec->param_count > 1) > *type = fwspec->param[1] & IRQ_TYPE_SENSE_MASK; > else > *type = IRQ_TYPE_NONE; > } > > > >> - } > >> return 0; > >> } > > > > This irqchip change should probably be a separate patch. > > > > As a separate patch, the input trigger type of pci devices will be low > level because of lacking of workaround to acpi_pci_irq_enable, which > will cause kernel hang, unless the patch of workaround to > acpi_pci_irq_enable is in front of this separated patch. That seems like a sensible requirement, but I really want to understand whether PCI Loongarch will *always* generate INTx as ACTIVE_HIGH or not. Because if that is ever going to change, we will need a different way to inform the irqchip about the polarity inversion. M. -- Without deviation from the norm, progress is not possible. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH V1 1/2] irqchip/loongson-pch-pic: Support to set irq type for ACPI path 2022-09-29 9:44 ` Marc Zyngier @ 2022-09-29 13:34 ` Jianmin Lv 0 siblings, 0 replies; 8+ messages in thread From: Jianmin Lv @ 2022-09-29 13:34 UTC (permalink / raw) To: Marc Zyngier Cc: Thomas Gleixner, linux-kernel, loongarch, Jiaxun Yang, Huacai Chen, Bjorn Helgaas, Rafael J. Wysocki, Len Brown, linux-pci, linux-acpi On 2022/9/29 下午5:44, Marc Zyngier wrote: > On Wed, 28 Sep 2022 22:35:17 -0400, > Jianmin Lv <lvjianmin@loongson.cn> wrote: >> >> On 2022/9/28 下午10:49, Marc Zyngier wrote: >>> On Mon, 15 Aug 2022 22:01:30 -0400, >>> Jianmin Lv <lvjianmin@loongson.cn> wrote: >>>> >>>> For ACPI path, the translate callback used IRQ_TYPE_NONE and ignored >>>> the irq type in fwspec->param[1]. For supporting to set type for >>>> irqs of the irqdomain, fwspec->param[1] should be used to get irq >>>> type. >>>> >>>> On Loongson platform, the irq trigger type of PCI devices is >>>> high level, so high level triggered type is inputed to acpi_register_gsi >>>> when create irq mapping for PCI devices. >>>> >>>> Signed-off-by: Jianmin Lv <lvjianmin@loongson.cn> >>>> --- >>>> drivers/acpi/pci_irq.c | 3 ++- >>>> drivers/irqchip/irq-loongson-pch-pic.c | 10 ++++++---- >>>> 2 files changed, 8 insertions(+), 5 deletions(-) >>> >>> $ ./scripts/get_maintainer.pl drivers/acpi/pci_irq.c >>> Bjorn Helgaas <bhelgaas@google.com> (supporter:PCI SUBSYSTEM) >>> "Rafael J. Wysocki" <rafael@kernel.org> (supporter:ACPI) >>> Len Brown <lenb@kernel.org> (reviewer:ACPI) >>> linux-pci@vger.kernel.org (open list:PCI SUBSYSTEM) >>> linux-acpi@vger.kernel.org (open list:ACPI) >>> linux-kernel@vger.kernel.org (open list) >>> >>> How about you start Cc-ing some of the relevant people? >>> >> Ok, thanks, I'll cc relevant people list here. >> >>>> >>>> diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c >>>> index 08e1577..34483b3 100644 >>>> --- a/drivers/acpi/pci_irq.c >>>> +++ b/drivers/acpi/pci_irq.c >>>> @@ -393,7 +393,8 @@ int acpi_pci_irq_enable(struct pci_dev *dev) >>>> * controller and must therefore be considered active high >>>> * as default. >>>> */ >>>> - int polarity = acpi_irq_model == ACPI_IRQ_MODEL_GIC ? >>>> + int polarity = acpi_irq_model == ACPI_IRQ_MODEL_GIC || >>>> + acpi_irq_model == ACPI_IRQ_MODEL_LPIC ? >>>> ACPI_ACTIVE_HIGH : ACPI_ACTIVE_LOW; >>> >>> The comment just above this only talks about ARM. Should it be >>> updated? >> >> Ok, I'll update the comment. >> >> >>> Is this a limitation of the underlying interrupt controller? >>> >> It's the limitation that pci interrupt source of LoongArch only sends >> high level trigger signal to interrupt controller(though, pci spec >> requires asserted low). > > Right, so this is the opposite problem ARM has. > > But is it *always* intended to be built like this? Or is it a one-off > for this generation of Loongarch systems, to be fixed at a later time? > Yes, new generations will always keep this unchanged. >> >> >>>> char *link = NULL; >>>> char link_desc[16]; >>>> diff --git a/drivers/irqchip/irq-loongson-pch-pic.c b/drivers/irqchip/irq-loongson-pch-pic.c >>>> index b6f1392..5067010 100644 >>>> --- a/drivers/irqchip/irq-loongson-pch-pic.c >>>> +++ b/drivers/irqchip/irq-loongson-pch-pic.c >>>> @@ -177,13 +177,15 @@ static int pch_pic_domain_translate(struct irq_domain *d, >>>> if (fwspec->param_count < 1) >>>> return -EINVAL; >>>> - if (of_node) { >>>> + if (of_node) >>>> *hwirq = fwspec->param[0] + priv->ht_vec_base; >>>> - *type = fwspec->param[1] & IRQ_TYPE_SENSE_MASK; >>>> - } else { >>>> + else >>>> *hwirq = fwspec->param[0] - priv->gsi_base; >>>> + >>>> + if (fwspec->param_count > 1) >>>> + *type = fwspec->param[1] & IRQ_TYPE_SENSE_MASK; >>>> + else >>>> *type = IRQ_TYPE_NONE; >>> >>> Isn't that a change in behaviour if of_node is non-NULL and >>> param_count==1? >>> >> >> It seems that current code here has bug that if fwspec->param_count==1 >> and of_node is non-null, fwspec->param[1] will be accessed, which is >> introduced from previous patch(irqchip/loongson-pch-pic: Add ACPI init >> support). Before the patch, for non-null of_node, translate >> callback(use irq_domain_translate_twocell) will return -EINVAL if >> fwspec->param_count < 2. >> >> For ACPI path, fwspec->param_count can be 1 or 2. >> >> So in this patch, I'll fix the bug and change the code as following: >> >> if (fwspec->param_count < 1) >> return -EINVAL; >> >> if (of_node) { >> if (fwspec->param_count < 2) >> return -EINVAL; >> >> *hwirq = fwspec->param[0] + priv->ht_vec_base; >> *type = fwspec->param[1] & IRQ_TYPE_SENSE_MASK; >> } else { >> *hwirq = fwspec->param[0] - priv->gsi_base; >> >> if (fwspec->param_count > 1) >> *type = fwspec->param[1] & IRQ_TYPE_SENSE_MASK; >> else >> *type = IRQ_TYPE_NONE; >> } >> >> >>>> - } >>>> return 0; >>>> } >>> >>> This irqchip change should probably be a separate patch. >>> >> >> As a separate patch, the input trigger type of pci devices will be low >> level because of lacking of workaround to acpi_pci_irq_enable, which >> will cause kernel hang, unless the patch of workaround to >> acpi_pci_irq_enable is in front of this separated patch. > > That seems like a sensible requirement, but I really want to > understand whether PCI Loongarch will *always* generate INTx as > ACTIVE_HIGH or not. Because if that is ever going to change, we will > need a different way to inform the irqchip about the polarity > inversion. > Above same. And in future, in case some generation use ACTIVE_LOW, I think we can use use *Source*(means link) with triggering and polarity property in pci route table of DSDT as following code to override ACTIVE_HIGH, rather than *Source index*(gsi). if (entry->link) gsi = acpi_pci_link_allocate_irq(entry->link, entry->index, &triggering, &polarity, &link); Because of a lot of machines outside have been shipped with firmware using *Source index*, for compatibility with such firmware, the workaround to acpi_pci_irq_enable is required. > M. > ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH V1 2/2] irqchip/loongson-liointc: Support to set irq type for ACPI path 2022-08-16 2:01 [PATCH V1 0/2] irqchip: Support to set irq type for ACPI path Jianmin Lv 2022-08-16 2:01 ` [PATCH V1 1/2] irqchip/loongson-pch-pic: " Jianmin Lv @ 2022-08-16 2:01 ` Jianmin Lv 2022-09-05 3:01 ` [PATCH V1 0/2] irqchip: " Jianmin Lv 2 siblings, 0 replies; 8+ messages in thread From: Jianmin Lv @ 2022-08-16 2:01 UTC (permalink / raw) To: Thomas Gleixner, Marc Zyngier Cc: linux-kernel, loongarch, Jiaxun Yang, Huacai Chen For ACPI path, the xlate callback used IRQ_TYPE_NONE and ignored the irq type in intspec[1]. For supporting to set type for irqs of the irqdomain, intspec[1] should be used to get irq type. Signed-off-by: Jianmin Lv <lvjianmin@loongson.cn> --- drivers/irqchip/irq-loongson-liointc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-loongson-liointc.c b/drivers/irqchip/irq-loongson-liointc.c index c4f3c886a..24755537 100644 --- a/drivers/irqchip/irq-loongson-liointc.c +++ b/drivers/irqchip/irq-loongson-liointc.c @@ -167,7 +167,12 @@ static int liointc_domain_xlate(struct irq_domain *d, struct device_node *ctrlr, if (WARN_ON(intsize < 1)) return -EINVAL; *out_hwirq = intspec[0] - GSI_MIN_CPU_IRQ; - *out_type = IRQ_TYPE_NONE; + + if (intsize > 1) + *out_type = intspec[1] & IRQ_TYPE_SENSE_MASK; + else + *out_type = IRQ_TYPE_NONE; + return 0; } -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH V1 0/2] irqchip: Support to set irq type for ACPI path 2022-08-16 2:01 [PATCH V1 0/2] irqchip: Support to set irq type for ACPI path Jianmin Lv 2022-08-16 2:01 ` [PATCH V1 1/2] irqchip/loongson-pch-pic: " Jianmin Lv 2022-08-16 2:01 ` [PATCH V1 2/2] irqchip/loongson-liointc: " Jianmin Lv @ 2022-09-05 3:01 ` Jianmin Lv 2 siblings, 0 replies; 8+ messages in thread From: Jianmin Lv @ 2022-09-05 3:01 UTC (permalink / raw) To: Thomas Gleixner, Marc Zyngier Cc: linux-kernel, loongarch, Jiaxun Yang, Huacai Chen Hi, Marc, Is there anything in this patch series that needs to be changed? Thanks. Jianmin. On 2022/8/16 上午10:01, Jianmin Lv wrote: > For ACPI path of pch-pic and liointc driver, setting irq > type is not supported yet, so the patch series add code > to implement it. > > Jianmin Lv (2): > irqchip/loongson-pch-pic: Support to set irq type for ACPI path > LoongArch: Support to set irq type for liointc > > drivers/acpi/pci_irq.c | 3 ++- > drivers/irqchip/irq-loongson-liointc.c | 7 ++++++- > drivers/irqchip/irq-loongson-pch-pic.c | 10 ++++++---- > 3 files changed, 14 insertions(+), 6 deletions(-) > ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2022-09-29 13:35 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-08-16 2:01 [PATCH V1 0/2] irqchip: Support to set irq type for ACPI path Jianmin Lv 2022-08-16 2:01 ` [PATCH V1 1/2] irqchip/loongson-pch-pic: " Jianmin Lv 2022-09-28 14:49 ` Marc Zyngier 2022-09-29 2:35 ` Jianmin Lv 2022-09-29 9:44 ` Marc Zyngier 2022-09-29 13:34 ` Jianmin Lv 2022-08-16 2:01 ` [PATCH V1 2/2] irqchip/loongson-liointc: " Jianmin Lv 2022-09-05 3:01 ` [PATCH V1 0/2] irqchip: " Jianmin Lv
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox