lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aNsjFm56D8pnAKDp@google.com>
Date: Tue, 30 Sep 2025 00:23:50 +0000
From: Pranjal Shrivastava <praan@...gle.com>
To: Jason Gunthorpe <jgg@...dia.com>
Cc: Mostafa Saleh <smostafa@...gle.com>,
	Daniel Mentz <danielmentz@...gle.com>, iommu@...ts.linux.dev,
	linux-kernel@...r.kernel.org, Will Deacon <will@...nel.org>,
	Liviu Dudau <liviu.dudau@....com>,
	Rob Clark <robin.clark@....qualcomm.com>
Subject: Re: [PATCH 2/2] drivers/arm-smmu-v3: Implement .iotlb_sync_map
 callback

On Mon, Sep 29, 2025 at 09:47:19AM -0300, Jason Gunthorpe wrote:
> On Mon, Sep 29, 2025 at 12:24:28PM +0000, Mostafa Saleh wrote:
> > On Mon, Sep 29, 2025 at 08:58:03AM -0300, Jason Gunthorpe wrote:
> > > On Sat, Sep 27, 2025 at 10:39:53PM +0000, Daniel Mentz wrote:
> > > > @@ -3700,6 +3713,7 @@ static const struct iommu_ops arm_smmu_ops = {
> > > >  		.map_pages		= arm_smmu_map_pages,
> > > >  		.unmap_pages		= arm_smmu_unmap_pages,
> > > >  		.flush_iotlb_all	= arm_smmu_flush_iotlb_all,
> > > > +		.iotlb_sync_map		= arm_smmu_iotlb_sync_map,
> > > 
> > > Shouldn't this avoid defining the op on coherent systems?
> > 
> > Does that mean we need to have 2 iommu_ops, one for
> > coherent/non-coherent SMMUs, as both can be mixed in the same system.
> 
> Yes, I think you'd have to do it with two ops..
> 
> It just seems wrong to penalize the normal fast case for these
> systems.
> 

I see we plan to set defer_sync_pte = true always. What if we invoke the
ops->iotlb_sync_map() only for incoherent IOMMUs? Maybe something like:

static int arm_smmu_iotlb_sync_map(struct iommu_domain *domain,
				    unsigned long iova, size_t size)
{
	struct io_pgtable_ops *ops = to_smmu_domain(domain)->pgtbl_ops;
	struct arm_smmu_device *smmu = to_smmu_domain(domain)->smmu;
	bool is_coherent = smmu->features & ARM_SMMU_FEAT_COHERENCY;


	if (!ops || !ops->iotlb_sync_map || is_coherent)
		return 0;

	ops->iotlb_sync_map(ops, iova, size);
	return 0;
}

If needed we can push the coherency check to the io-pgtable op
iotlb_sync_map() as well. Just an idea..

> Jason

Thanks,
Praan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ