[PATCH RFC v7 7/7] iommu/arm-smmu-v3: Wire up shared-SID STE ordering and feature gating

Nicolin Chen nicolinc at nvidia.com
Mon Nov 2 10:49:20 PST 2026


On Fri, Oct 30, 2026 at 08:09:39PM +0800, Peng Fan (OSS) wrote:
> From: Peng Fan <peng.fan at nxp.com>
> 
> 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
> stall 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 release or blocked attach must not abort a shared STE while other
> sharers remain, otherwise it would break their ongoing DMA. Skip those
> writes while the SID is shared; the last master (no longer shared) still
> tears the STE down. This also means removing one device from a shared
> group no longer leaves the survivors aborted.
> 
> Fault events on shared SIDs cannot be attributed to a specific master,
> so arm_smmu_find_master() returns NULL when the stream's shared_masters
> list is non-empty.
> 
> 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 has stall enabled,
> or if the existing master has PASID or ATS enabled.
> 
> Introduce arm_smmu_master_stall_enabled() to describe the policy actually
> programmed into the hardware: a master stalls only if it asked for it and
> its StreamID is not shared.

Why do we need this? A stall_enabled master shouldn't share its
SID in the first place.

> Add arm_smmu_is_shared_sid() as an inline helper in arm-smmu-v3.h so that

Use arm_smmu_master_shares_sid or arm_smmu_master_has_shared_sid.

> 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 at nxp.com>

Please check sashiko findings; all seems valid.

https://sashiko.dev/#/patchset/20261030-smmu-shared-sid-ver7-2026-10-26-v7-0-961726ebd6ab%40Example.Com

Nicolin



More information about the linux-arm-kernel mailing list