[PATCH v6 0/2] mfd: loongson-se: Add multi-node support and fix miscellaneous issues
From: Qunqin Zhao <hidden>
Date: 2026-09-07 02:38:57
Also in:
lkml, loongarch
From: Qunqin Zhao <zhaoqunqin@loongson.cn>
- Patch 1 introduces the multi-node platform support.
v6: 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.
- Patch 2 focuses on structural and error-path hardening for the
pre-existing baseline code. This includes resolving critical issues
discovered by the Sashiko Automation system such as: completion
race conditions, missing engine completion initialization, spinlock
held with interrupts disabled for up to 10 ms, EPROBE_DEFER
handling, DMA buffer overflow validation, interrupt cleanup on
probe failure, and device removal ordering.
v6:
- Still use init_completion() in loongson_se_init_engine.
- Serialize command submission with a new poll_lock spinlock
- Mask the target interrupt, clear pending status, and
reinitialize the completion under dev_lock before issuing a
command, re-enabling the interrupt after triggering new cmd
- Keep the original engine_init_lock scope instead of the
broader cmd_lock mutex.
- Reuse loongson_se_send_controller_cmd() in the STOP path and
register the stop handler before loongson_se_init()
- Correct the dmam_size validation formula
v5: Fix all issues reported by Sashiko analysis:
- Initialize engine completions in probe to avoid NULL deref
- Use cmd_lock mutex for command serialization, drop spin_lock_irq
- Add reinit_completion to controller and engine command paths
- Fix EPROBE_DEFER handling in platform_irq_count()
- Validate dmam_size against minimum required size
- Disable IRQs in probe error path after init failure
- Add loongson_se_stop() devres cleanup with proper ordering
- Use non-interruptible wait for STOP command
v4: new patch
Qunqin Zhao (2):
mfd: loongson-se: Add multi-node support
mfd: loongson-se: Fix miscellaneous issues
drivers/mfd/loongson-se.c | 105 ++++++++++++++++++++++++++++----
include/linux/mfd/loongson-se.h | 1 +
2 files changed, 93 insertions(+), 13 deletions(-)
base-commit: cee9395acd8043be0644b25c34bfa86623f2b935
--
2.47.2