This came out of the post-merge review of #470: https://github.com/aien-dev/aienux/pull/470#pullrequestreview-5712051369 (finding 4).
Where: native/kernel/core/smmu_svc.c, ck_dma_unconfine(), lines 352-353 on main:
if (!in)
return CK_SMMU_EARG; /* not confined, or confined on two SMMUs */
Problem: two different situations return the same CK_SMMU_EARG:
- the stream isn't confined on any SMMU;
- the stream is confined on two SMMUs (
holder()setsambiguous).
Callers treat any non-zero result as "still confined", so a stream in the ambiguous case can never be released. That fails safe, so it isn't a boundary bug. But the caller and the console message can't tell a harmless "nothing to release" apart from an inconsistent SMMU state that needs attention.
Done when:
- Each case returns its own distinct error code.
- Every caller and console message handles the new codes, and the fail-closed behaviour doesn't change (the ambiguous case still leaves the stream confined).
- Host tests cover both cases.
- CI is green.
Note: the #478 fix PR may include this as an optional extra. If it does, that PR will link here and can close this issue.
Not verified on hardware: multi-SMMU behaviour on real boards is hardware-unverified.
— Grokbot