[irqchip: irq/irqchip-next] irqchip/armada-370-xp: Do not allow mapping IRQ 0 and 1

From: irqchip-bot for Pali Rohár
Date: Fri May 06 2022 - 07:25:20 EST


The following commit has been merged into the irq/irqchip-next branch of irqchip:

Commit-ID: baf78c1078b474aed18864796a8161784dd81fc2
Gitweb: https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/baf78c1078b474aed18864796a8161784dd81fc2
Author: Pali Rohár <pali@xxxxxxxxxx>
AuthorDate: Mon, 25 Apr 2022 13:37:06 +02:00
Committer: Marc Zyngier <maz@xxxxxxxxxx>
CommitterDate: Fri, 06 May 2022 12:20:27 +01:00

irqchip/armada-370-xp: Do not allow mapping IRQ 0 and 1

IRQs 0 and 1 cannot be mapped, they are handled internally by this driver
and this driver does not call generic_handle_domain_irq() for these IRQs.
So do not allow mapping these IRQs and correctly propagate error from the
.irq_map callback.

Signed-off-by: Pali Rohár <pali@xxxxxxxxxx>
Signed-off-by: Marc Zyngier <maz@xxxxxxxxxx>
Link: https://lore.kernel.org/r/20220425113706.29310-2-pali@xxxxxxxxxx
---
drivers/irqchip/irq-armada-370-xp.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index ee18eb3..ab02b44 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -567,6 +567,10 @@ static struct irq_chip armada_370_xp_irq_chip = {
static int armada_370_xp_mpic_irq_map(struct irq_domain *h,
unsigned int virq, irq_hw_number_t hw)
{
+ /* IRQs 0 and 1 cannot be mapped, they are handled internally */
+ if (hw <= 1)
+ return -EINVAL;
+
armada_370_xp_irq_mask(irq_get_irq_data(virq));
if (!is_percpu_irq(hw))
writel(hw, per_cpu_int_base +