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

Nicolin Chen
2025-05-30T17:31:11Z

On Fri, May 30, 2025 at 02:10:52PM -0300, Jason Gunthorpe wrote:
> 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.

OK. It would not be needed either once the core passes in type
phys_addr_t as you suggested in the other patch.

Thanks
Nicolin