2023-06-14 11:17:55

by 吕建民

[permalink] [raw]
Subject: [PATCH V1 0/4] irqchip/loongson: Fix some loongson irqchip drivers

The patch series provide some fixes for loongson-liointc and loongson-pch-pic driver.

Jianmin Lv (2):
irqchip/loongson-pch-pic: Fix initialization of HT vector register
irqchip/loongson-liointc: Fix IRQ trigger polarity

Liu Peibao (1):
irqchip/loongson-pch-pic: Fix potential incorrect hwirq assignment

Yinbo Zhu (1):
irqchip/loongson-liointc: Add IRQCHIP_SKIP_SET_WAKE flag

drivers/irqchip/irq-loongson-liointc.c | 9 +++++----
drivers/irqchip/irq-loongson-pch-pic.c | 10 ++++------
2 files changed, 9 insertions(+), 10 deletions(-)

--
2.31.1



2023-06-14 11:17:55

by 吕建民

[permalink] [raw]
Subject: [PATCH V1 2/4] irqchip/loongson-pch-pic: Fix potential incorrect hwirq assignment

From: Liu Peibao <[email protected]>

In DeviceTree path, when ht_vec_base is not zero, the hwirq of PCH PIC will
be assigned incorrectly. Because when pch_pic_domain_translate() adds the
ht_vec_base to hwirq, the hwirq dose not subtract the ht_vec_base when
calling irq_domain_set_info().

The ht_vec_base is designed for the parent irq chip/domain of the PCH PIC.
It seems not proper to deal this in callbacks of the PCH PIC domain and
let's put this back like the initial commit ef8c01eb64ca ("irqchip: Add
Loongson PCH PIC controller").

Fixes: bcdd75c596c8 ("irqchip/loongson-pch-pic: Add ACPI init support")
Cc: [email protected]
Signed-off-by: Liu Peibao <[email protected]>
Signed-off-by: Jianmin Lv <[email protected]>
---
drivers/irqchip/irq-loongson-pch-pic.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/irqchip/irq-loongson-pch-pic.c b/drivers/irqchip/irq-loongson-pch-pic.c
index 921c5c0190d1..93a71f66efeb 100644
--- a/drivers/irqchip/irq-loongson-pch-pic.c
+++ b/drivers/irqchip/irq-loongson-pch-pic.c
@@ -164,7 +164,7 @@ static int pch_pic_domain_translate(struct irq_domain *d,
if (fwspec->param_count < 2)
return -EINVAL;

- *hwirq = fwspec->param[0] + priv->ht_vec_base;
+ *hwirq = fwspec->param[0];
*type = fwspec->param[1] & IRQ_TYPE_SENSE_MASK;
} else {
if (fwspec->param_count < 1)
@@ -196,7 +196,7 @@ static int pch_pic_alloc(struct irq_domain *domain, unsigned int virq,

parent_fwspec.fwnode = domain->parent->fwnode;
parent_fwspec.param_count = 1;
- parent_fwspec.param[0] = hwirq;
+ parent_fwspec.param[0] = hwirq + priv->ht_vec_base;

err = irq_domain_alloc_irqs_parent(domain, virq, 1, &parent_fwspec);
if (err)
--
2.31.1


2023-06-14 11:26:55

by 吕建民

[permalink] [raw]
Subject: [PATCH V1 4/4] irqchip/loongson-liointc: Add IRQCHIP_SKIP_SET_WAKE flag

From: Yinbo Zhu <[email protected]>

Liointc doesn't require specific logic to work with wakeup IRQs,
and no irq_set_wake callback is needed. To allow registered IRQs
from liointc to be used as a wakeup-source, and ensure irq_set_irq_wake()
works well, the flag IRQCHIP_SKIP_SET_WAKE should be added.

Signed-off-by: Yinbo Zhu <[email protected]>
Signed-off-by: Jianmin Lv <[email protected]>
---
drivers/irqchip/irq-loongson-liointc.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/irqchip/irq-loongson-liointc.c b/drivers/irqchip/irq-loongson-liointc.c
index 9a9c2bf048a3..dbd1ccce0fb2 100644
--- a/drivers/irqchip/irq-loongson-liointc.c
+++ b/drivers/irqchip/irq-loongson-liointc.c
@@ -291,6 +291,7 @@ static int liointc_init(phys_addr_t addr, unsigned long size, int revision,
ct->chip.irq_mask = irq_gc_mask_disable_reg;
ct->chip.irq_mask_ack = irq_gc_mask_disable_reg;
ct->chip.irq_set_type = liointc_set_type;
+ ct->chip.flags = IRQCHIP_SKIP_SET_WAKE;

gc->mask_cache = 0;
priv->gc = gc;
--
2.31.1


2023-06-14 11:27:46

by 吕建民

[permalink] [raw]
Subject: [PATCH V1 1/4] irqchip/loongson-pch-pic: Fix initialization of HT vector register

In a dual-bridge system based ACPI, the IRQ on PCH PIC of
each bridge sent to CPU is always a zero-based number, which
means that the IRQ on PCH PIC of each bridge is mapped into
vector range from 0 to 63 of upstream irqchip(e.g. EIOINTC).

EIOINTC N: [0 ... 63 | 64 ... 255]
-------- ----------
^ ^
| |
PCH PIC N |
PCH MSI N

For example, the IRQ vector number of sata controller on
PCH PIC of each bridge is 16, which is sent to upstream
irqchip of EIOINTC when an interrupt occurs, which will set
bit 16 of EIOINTC. Since hwirq of 16 on EIOINTC has been
mapped to a irq_desc for sata controller during hierarchy
irq allocation, the related mapped IRQ will be found through
irq_resolve_mapping() in the IRQ domain of EIOINTC.

So, the IRQ number set in HT vector register should be fixed
to be a zero-based number.

Cc: [email protected]
Signed-off-by: Jianmin Lv <[email protected]>
Signed-off-by: liuyun <[email protected]>
---
drivers/irqchip/irq-loongson-pch-pic.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/irqchip/irq-loongson-pch-pic.c b/drivers/irqchip/irq-loongson-pch-pic.c
index e5fe4d50be05..921c5c0190d1 100644
--- a/drivers/irqchip/irq-loongson-pch-pic.c
+++ b/drivers/irqchip/irq-loongson-pch-pic.c
@@ -401,14 +401,12 @@ static int __init acpi_cascade_irqdomain_init(void)
int __init pch_pic_acpi_init(struct irq_domain *parent,
struct acpi_madt_bio_pic *acpi_pchpic)
{
- int ret, vec_base;
+ int ret;
struct fwnode_handle *domain_handle;

if (find_pch_pic(acpi_pchpic->gsi_base) >= 0)
return 0;

- vec_base = acpi_pchpic->gsi_base - GSI_MIN_PCH_IRQ;
-
domain_handle = irq_domain_alloc_fwnode(&acpi_pchpic->address);
if (!domain_handle) {
pr_err("Unable to allocate domain handle\n");
@@ -416,7 +414,7 @@ int __init pch_pic_acpi_init(struct irq_domain *parent,
}

ret = pch_pic_init(acpi_pchpic->address, acpi_pchpic->size,
- vec_base, parent, domain_handle, acpi_pchpic->gsi_base);
+ 0, parent, domain_handle, acpi_pchpic->gsi_base);

if (ret < 0) {
irq_domain_free_fwnode(domain_handle);
--
2.31.1


2023-06-14 12:13:18

by 吕建民

[permalink] [raw]
Subject: Re: [PATCH V1 0/4] irqchip/loongson: Fix some loongson irqchip drivers

Hi, all

So sorry for this wrong series which is old, please skip them.

Thanks.
Jianmin

On 2023/6/14 下午7:14, Jianmin Lv wrote:
> The patch series provide some fixes for loongson-liointc and loongson-pch-pic driver.
>
> Jianmin Lv (2):
> irqchip/loongson-pch-pic: Fix initialization of HT vector register
> irqchip/loongson-liointc: Fix IRQ trigger polarity
>
> Liu Peibao (1):
> irqchip/loongson-pch-pic: Fix potential incorrect hwirq assignment
>
> Yinbo Zhu (1):
> irqchip/loongson-liointc: Add IRQCHIP_SKIP_SET_WAKE flag
>
> drivers/irqchip/irq-loongson-liointc.c | 9 +++++----
> drivers/irqchip/irq-loongson-pch-pic.c | 10 ++++------
> 2 files changed, 9 insertions(+), 10 deletions(-)
>