[PATCH v10] mfd: loongson-se: Add multi-node support

From: Qunqin Zhao

Date: Mon Nov 16 2026 - 04:53:55 EST


From: Qunqin Zhao <zhaoqunqin@xxxxxxxxxxx>

On the Loongson platform, each node is equipped with a security engine
device. However, due to a hardware flaw, only the device on node 0 can
trigger interrupts. Therefore, interrupts from other nodes are forwarded
by node 0. We need to check in the interrupt handler of node 0 whether
this interrupt is intended for other nodes, this can be accomplished via
shared interrupt handling.

Signed-off-by: Qunqin Zhao <zhaoqunqin@xxxxxxxxxxx>
Reviewed-by: Huacai Chen <chenhuacai@xxxxxxxxxxx>
---
v10: Rebase onto latest for-mfd-next
v9: Keep checks immediately after allocation calls
v6-v8: no changes
v5: Clear pending interrupts with S2LINT_CL before requesting IRQs,
and move S2LINT_EN to after all interrupt handlers are registered.
v4: Safely handling shared interrupt handler returns.
v3: Using shared interrupts (IRQF_SHARED) instead of manually
iterating through all devices to check for interrupts.

drivers/mfd/loongson-se.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/mfd/loongson-se.c b/drivers/mfd/loongson-se.c
index 23af05d38..0c6274aa0 100644
--- a/drivers/mfd/loongson-se.c
+++ b/drivers/mfd/loongson-se.c
@@ -152,6 +152,10 @@ static irqreturn_t se_irq_handler(int irq, void *dev_id)
spin_lock(&se->dev_lock);

int_status = readl(se->base + SE_S2LINT_STAT);
+ if (int_status == 0) {
+ spin_unlock(&se->dev_lock);
+ return IRQ_NONE;
+ }

/* For controller */
if (int_status & SE_INT_CONTROLLER) {
@@ -278,7 +282,7 @@ static int loongson_se_probe(struct platform_device *pdev)
if (irq < 0)
return irq;

- err = devm_request_irq(dev, irq, se_irq_handler, 0, "loongson-se", se);
+ err = devm_request_irq(dev, irq, se_irq_handler, IRQF_SHARED, "loongson-se", se);
if (err)
return dev_err_probe(dev, err, "Failed to request IRQ: %d\n", irq);
}
@@ -293,7 +297,7 @@ static int loongson_se_probe(struct platform_device *pdev)
if (err)
return err;

- return devm_mfd_add_devices(dev, PLATFORM_DEVID_NONE, engines,
+ return devm_mfd_add_devices(dev, PLATFORM_DEVID_AUTO, engines,
ARRAY_SIZE(engines), NULL, 0, NULL);
}


base-commit: c92739a23a80f5f0a7c6f3c10aa792102d252ac4
--
2.47.2