Re: [PATCH v5 28/29] iommu/tegra241-cmdqv: Add user-space use support

Jason Gunthorpe
2025-05-30T17:22:27Z

On Sat, May 17, 2025 at 08:21:45PM -0700, Nicolin Chen wrote:
> +static inline phys_addr_t
> +arm_smmu_domain_ipa_to_pa(struct arm_smmu_domain *smmu_domain, u64 ipa)
> +{
> + if (WARN_ON_ONCE(smmu_domain->stage != ARM_SMMU_DOMAIN_S2))
> + return 0;
> + return iommu_iova_to_phys(&smmu_domain->domain, ipa);
> +}

It is not allowed to call this function unless you are holding a range
lock on the IOAS that covers ipa, and this path does not.

This is why it has to go through an access to get the physical as that
has the right locking.

Jason