Re: [PATCH 5/7] iommu/dma: Make limit checks self-contained

From: Jason Gunthorpe
Date: Wed Nov 29 2023 - 15:43:23 EST


On Wed, Nov 29, 2023 at 05:43:02PM +0000, Robin Murphy wrote:
> It's now easy to retrieve the device's DMA limits if we want to check
> them against the domain aperture, so do that ourselves instead of
> relying on them being passed through the callchain.
>
> Signed-off-by: Robin Murphy <robin.murphy@xxxxxxx>
> ---
> drivers/iommu/dma-iommu.c | 18 ++++++++----------
> 1 file changed, 8 insertions(+), 10 deletions(-)

When I spent some time noodling on this a few weeks ago I was looking
at putting the dma_range_map_min() effectively as a new reserved
region in the common reserved region code so it naturally flows out to
all the right places.

But this is no worse in that regard than what we have right now:

Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx>

> /* Check the domain allows at least some access to the device... */
> - if (domain->geometry.force_aperture) {
> + if (map) {

Oh, I've been sitting on a patch to delete force_aperture now too..

Jason