irqchip/mvebu-gicp: Clear pending interrupts on init

When a kexec'ed kernel boots up, there might be stale unhandled interrupts
pending in the interrupt controller. These are delivered as spurious
interrupts once the boot CPU enables interrupts.

Clear all pending interrupts when the driver is initialized to prevent
these spurious interrupts from locking the CPU in an endless loop.

Signed-off-by: Elad Nachman <enachman@marvell.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20250803102548.669682-2-enachman@marvell.com

authored by Elad Nachman and committed by Thomas Gleixner 3c3d7dba 02cbf8e0

+10
+10
drivers/irqchip/irq-mvebu-gicp.c
··· 177 .ops = &gicp_domain_ops, 178 }; 179 struct mvebu_gicp *gicp; 180 int ret, i; 181 182 gicp = devm_kzalloc(&pdev->dev, sizeof(*gicp), GFP_KERNEL); ··· 235 if (!info.parent) { 236 dev_err(&pdev->dev, "failed to find parent IRQ domain\n"); 237 return -ENODEV; 238 } 239 240 return msi_create_parent_irq_domain(&info, &gicp_msi_parent_ops) ? 0 : -ENOMEM;
··· 177 .ops = &gicp_domain_ops, 178 }; 179 struct mvebu_gicp *gicp; 180 + void __iomem *base; 181 int ret, i; 182 183 gicp = devm_kzalloc(&pdev->dev, sizeof(*gicp), GFP_KERNEL); ··· 234 if (!info.parent) { 235 dev_err(&pdev->dev, "failed to find parent IRQ domain\n"); 236 return -ENODEV; 237 + } 238 + 239 + base = ioremap(gicp->res->start, gicp->res->end - gicp->res->start); 240 + if (IS_ERR(base)) { 241 + dev_err(&pdev->dev, "ioremap() failed. Unable to clear pending interrupts.\n"); 242 + } else { 243 + for (i = 0; i < 64; i++) 244 + writel(i, base + GICP_CLRSPI_NSR_OFFSET); 245 + iounmap(base); 246 } 247 248 return msi_create_parent_irq_domain(&info, &gicp_msi_parent_ops) ? 0 : -ENOMEM;