From: Hector Martin marcan@marcan.st
[ Upstream commit ecf6508923f87e4597228f70cc838af3d37f6662 ]
These registers exist and at least on the t602x variant the IRQ only clears when theses are cleared.
Signed-off-by: Hector Martin marcan@marcan.st Signed-off-by: Janne Grunau j@jannau.net Reviewed-by: Sven Peter sven@kernel.org Reviewed-by: Neal Gompa neal@gompa.dev Link: https://lore.kernel.org/r/20250826-dart-t8110-stream-error-v1-1-e33395112014... Signed-off-by: Joerg Roedel joerg.roedel@amd.com Signed-off-by: Sasha Levin sashal@kernel.org ---
LLM Generated explanations, may be completely bogus:
YES
- Fixes a real bug: On T8110-class DARTs, the interrupt only deasserts when per‑stream error indicator bits are cleared. Without clearing them, the IRQ can remain asserted, causing repeated interrupts and potential system instability. - Minimal, contained change: Adds one register define and a short clear loop in the T8110 IRQ handler only. - Adds `DART_T8110_ERROR_STREAMS` at `0x1c0` (drivers/iommu/apple- dart.c:125). - In `apple_dart_t8110_irq`, after acknowledging the error status (`writel(error, ...)`), clears all stream error indicator words: `for (int i = 0; i < BITS_TO_U32(dart->num_streams); i++) writel(U32_MAX, dart->regs + DART_T8110_ERROR_STREAMS + 4 * i);` (drivers/iommu/apple-dart.c:1093, drivers/iommu/apple-dart.c:1094, drivers/iommu/apple-dart.c:1095). - Scoped to T8110 only: The handler is registered only for the T8110 hardware variant (drivers/iommu/apple-dart.c:1298), so it does not affect other Apple DART generations. - Safe by design: - `num_streams` is read from hardware (`DART_T8110_PARAMS4_NUM_SIDS`) and bounded by `DART_MAX_STREAMS` (drivers/iommu/apple-dart.c:1152, drivers/iommu/apple-dart.c:1153, drivers/iommu/apple-dart.c:1156, drivers/iommu/apple-dart.c:1161). - `BITS_TO_U32(...)` ensures the correct number of 32‑bit words are cleared. - The driver already uses the same write‑all‑ones bitmap pattern for stream operations (e.g., enabling all streams) showing these registers are W1C bitmaps and that this access pattern is established and safe (drivers/iommu/apple-dart.c:485, drivers/iommu/apple-dart.c:486). - No architectural changes or API/ABI effects: This is a straightforward IRQ acknowledgment fix limited to the Apple DART IOMMU driver. - User impact: Prevents stuck/level interrupts and interrupt floods on affected Apple SoCs (e.g., t602x using T8110 DART), improving stability and correctness.
Given it is a clear bug fix, small and localized, with low regression risk and meaningful user impact, it is a strong candidate for backporting to stable kernels that include the T8110 DART support.
drivers/iommu/apple-dart.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c index 190f28d766151..8b1272b7bb44a 100644 --- a/drivers/iommu/apple-dart.c +++ b/drivers/iommu/apple-dart.c @@ -122,6 +122,8 @@ #define DART_T8110_ERROR_ADDR_LO 0x170 #define DART_T8110_ERROR_ADDR_HI 0x174
+#define DART_T8110_ERROR_STREAMS 0x1c0 + #define DART_T8110_PROTECT 0x200 #define DART_T8110_UNPROTECT 0x204 #define DART_T8110_PROTECT_LOCK 0x208 @@ -1077,6 +1079,9 @@ static irqreturn_t apple_dart_t8110_irq(int irq, void *dev) error, stream_idx, error_code, fault_name, addr);
writel(error, dart->regs + DART_T8110_ERROR); + for (int i = 0; i < BITS_TO_U32(dart->num_streams); i++) + writel(U32_MAX, dart->regs + DART_T8110_ERROR_STREAMS + 4 * i); + return IRQ_HANDLED; }