Re: [PATCH 0/5] iommu: Some IOVA code reorganisation

From: John Garry
Date: Mon Oct 04 2021 - 09:54:38 EST


On 04/10/2021 12:44, Will Deacon wrote:



On Fri, Sep 24, 2021 at 06:01:52PM +0800, John Garry wrote:
The IOVA domain structure is a bit overloaded, holding:
- IOVA tree management
- FQ control
- IOVA rcache memories

Indeed only a couple of IOVA users use the rcache, and only dma-iommu.c
uses the FQ feature.

This series separates out that structure. In addition, it moves the FQ
code into dma-iommu.c . This is not strictly necessary, but it does make
it easier for the FQ domain lookup the rcache domain.

The rcache code stays where it is, as it may be reworked in future, so
there is not much point in relocating and then discarding.

This topic was initially discussed and suggested (I think) by Robin here:
https://lore.kernel.org/linux-iommu/1d06eda1-9961-d023-f5e7-fe87e768f067@xxxxxxx/


Hi Will,

It would be useful to have Robin's Ack on patches 2-4. The implementation
looks straightforward to me, but the thread above isn't very clear about
what is being suggested.

Sure, I intentionally didn't add names to patches so avoid possible incorrect attribution.


To play devil's advocate: there aren't many direct users of the iovad code:
either they'll die out entirely (and everybody will use the dma-iommu code)
and it's fine having the flush queue code where it is, or we'll get more
users and the likelihood of somebody else wanting flush queues increases.


I make it 5x direct users (including vdpa).

Anyway, as I mentioned, I'm not totally determined to relocate the FQ code. It's just that dma-iommu is the only user today and co-locating makes the iova rcache domain info lookup easier from the FQ code.

Thanks,
John