Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

irqchip/loongson-pch-pic: Fix potential incorrect hwirq assignment

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 does not have the ht_vec_base
subtracted 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: stable@vger.kernel.org
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Liu Peibao <liupeibao@loongson.cn>
Signed-off-by: Jianmin Lv <lvjianmin@loongson.cn>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20230614115936.5950-3-lvjianmin@loongson.cn

authored by

Liu Peibao and committed by
Marc Zyngier
783422e7 f6796165

+2 -2
+2 -2
drivers/irqchip/irq-loongson-pch-pic.c
··· 164 164 if (fwspec->param_count < 2) 165 165 return -EINVAL; 166 166 167 - *hwirq = fwspec->param[0] + priv->ht_vec_base; 167 + *hwirq = fwspec->param[0]; 168 168 *type = fwspec->param[1] & IRQ_TYPE_SENSE_MASK; 169 169 } else { 170 170 if (fwspec->param_count < 1) ··· 196 196 197 197 parent_fwspec.fwnode = domain->parent->fwnode; 198 198 parent_fwspec.param_count = 1; 199 - parent_fwspec.param[0] = hwirq; 199 + parent_fwspec.param[0] = hwirq + priv->ht_vec_base; 200 200 201 201 err = irq_domain_alloc_irqs_parent(domain, virq, 1, &parent_fwspec); 202 202 if (err)