Re: [RFC PATCH v2 55/58] drivers/iommu: Add deferred map_sg operations
From: Mostafa Saleh
Date: Wed Jan 08 2025 - 07:13:46 EST
On Fri, Jan 03, 2025 at 11:47:57AM -0400, Jason Gunthorpe wrote:
> On Fri, Jan 03, 2025 at 03:35:20PM +0000, Mostafa Saleh wrote:
>
> > An alternative approach as Robin suggested, is to treat all iommu_map as sg map,
> > and when the driver gets the iotlb_sync_map() call it can just issue the hypercall,
> > however this call only provides the IOVA range, which requires extra work or locking
> > as mentioned in the thread, and as Robin mentioned s390 doing something similar,
> > I was highlighting that in their driver, this call only notifies the hypervisor
> > about an IOVA and not an actual pv map as pKVM, so it much simpler in their case.
>
> Oh, that is much clearer, maybe incorporate some of that into the
> commit message.
Sure.
>
> We are going in a general direction of trying to make the fast dma
> mapping path not require sg, so adding sg specific optimizations to
> the low level driver is not good.
>
> Batching the hypercalls in the gather and then flushing to execute the
> batch seems more reasonable.
>
> You could probably work on advancing this infrastructure separately
> via virtio-iommu..
That was my impression also, I mentioned it in the commit message,
but for virtio-iommu we need a change in the standard to define this
operation, I can look into that.
Thanks,
Mostafa
>
> Jason