Re: [PATCH v4 1/2] powerpc/pseries/iommu: Share the per-cpu TCE page with the hypervisor.

From: Christoph Hellwig
Date: Thu Dec 05 2019 - 03:28:46 EST


On Wed, Dec 04, 2019 at 12:42:32PM -0800, Ram Pai wrote:
> > The other approach we could use for that - which would still allow
> > H_PUT_TCE_INDIRECT, would be to allocate the TCE buffer page from the
> > same pool that we use for the bounce buffers. I assume there must
> > already be some sort of allocator for that?
>
> The allocator for swiotlb is buried deep in the swiotlb code. It is
> not exposed to the outside-swiotlb world. Will have to do major surgery
> to expose it.

I don't think it would require all that much changes, but I'd really
hate the layering of calling into it directly. Do we have a struct
device associated with the iommu that doesn't get iommu translations
themselves? If we do a dma_alloc_coherent on that you'll get the
memory pool for free.