Re: [PATCH RFC v8 7/9] iommu/arm-smmu-v3: Wire up shared-SID STE ordering and feature gating
From: Nicolin Chen
Date: Fri Nov 13 2026 - 16:10:52 EST
On Fri, Nov 13, 2026 at 09:27:19PM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan@xxxxxxx>
>
> With the per-domain CD table, every non-PASID sharer of a SID builds the
> same normal-domain STE: same S1ContextPtr, S1DSS and S1CDMAX. Disable
> PASID and ATS for shared SIDs as well, so the remaining STE fields are
> common too, and let any sharer program the STE. This also handles the
> case where one device's driver attaches before the stream owner's driver:
> the first attach now installs a valid STE instead of leaving the boot or
> firmware STE in place.
>
> A per-device release must not abort a shared STE while other sharers
> remain, otherwise it would break their ongoing DMA. Use a dedicated
> release domain instead of inferring release from the STE contents:
> group-wide BLOCKED attaches still program the abort STE, while the
> release domain skips writes until the last master no longer shares the
> SID.
>
> Disable SVA, PASID, vSMMU nesting, ATS and IOPF/stall for shared-SID
> masters since all of them require an unambiguous SID-to-device mapping.
> Reject sharing at insert_master() time if either master wants stalling,
> if the incoming master requires ATS, if the existing master has PASID,
> ATS or vSMMU state enabled, or if a PCI and a non-PCI master would share
> the SID. Other ATS-capable shared devices have their ATS capability
> prepared, but ATS is not enabled while the SID is shared.
>
> Resolve stall_enabled before insert_master(), and use master->stall_enabled
> directly for CD.S, STE.S1STALLD and STE.S2S. A shared master can never
> have stalling enabled.
>
> Add arm_smmu_master_shares_sid() as an inline helper in arm-smmu-v3.h so
> that arm-smmu-v3-sva.c and arm-smmu-v3-iommufd.c can use it without
> repeating the list_empty() pattern.
>
> Signed-off-by: Peng Fan <peng.fan@xxxxxxx>
I am asking a bigger question in PATCH-4 for Robin to confirm,
yet Sashiko gave a few scary findings against patch 7-9.
Would you please run Sashiko locally and address them as much
as possible, before sending a new version?
Nicolin