[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240228120523.GA15054@willie-the-truck>
Date: Wed, 28 Feb 2024 12:05:23 +0000
From: Will Deacon <will@...nel.org>
To: Robin Murphy <robin.murphy@....com>
Cc: Christoph Hellwig <hch@...radead.org>, linux-kernel@...r.kernel.org,
kernel-team@...roid.com, iommu@...ts.linux.dev,
Christoph Hellwig <hch@....de>,
Marek Szyprowski <m.szyprowski@...sung.com>,
Petr Tesarik <petr.tesarik1@...wei-partners.com>,
Dexuan Cui <decui@...rosoft.com>,
Nicolin Chen <nicolinc@...dia.com>,
Michael Kelley <mhklinux@...look.com>
Subject: Re: [PATCH v4 5/5] iommu/dma: Force swiotlb_max_mapping_size on an
untrusted device
On Tue, Feb 27, 2024 at 03:53:05PM +0000, Robin Murphy wrote:
> On 27/02/2024 3:40 pm, Christoph Hellwig wrote:
> > On Wed, Feb 21, 2024 at 11:35:04AM +0000, Will Deacon wrote:
> > > +static size_t iommu_dma_max_mapping_size(struct device *dev)
> > > +{
> > > + if (is_swiotlb_active(dev) && dev_is_untrusted(dev))
> > > + return swiotlb_max_mapping_size(dev);
> >
> > Curious: do we really need both checks here? If swiotlb is active
> > for a device (for whatever reason), aren't we then always bound
> > by the max size? If not please add a comment explaining it.
> >
>
> Oh, good point - if we have an untrusted device but SWIOTLB isn't
> initialised for whatever reason, then it doesn't matter what
> max_mapping_size returns because iommu_dma_map_page() is going to bail out
> regardless.
Makes sense. Since this is all internal to the IOMMU DMA code, I can just
drop the first part of the check.
I'll get a v5 out shortly.
Will
Powered by blists - more mailing lists