Re: [PATCH 10/10] arm64: use the generic swiotlb_dma_ops

From: Christoph Hellwig
Date: Fri Oct 26 2018 - 08:44:59 EST


On Mon, Oct 22, 2018 at 06:52:51PM +0100, Robin Murphy wrote:
>> scatterlist *sgl,
>> - int nelems, enum dma_data_direction dir,
>> - unsigned long attrs)
>> +long arch_dma_coherent_to_pfn(struct device *dev, void *cpu_addr,
>
> I realise I'm spotting this a bit late, but does this interface really need
> somewhat-atypical signed PFNs?

It has been a while since I wrote this code, and I can't remember the
reason for it except that I'm pretty sure I copy and pasted it from
existing code somewhere.

Switching it to unsigned long should be fine, and patches are welcome.

>> +static int __swiotlb_get_sgtable_page(struct sg_table *sgt,
>> + struct page *page, size_t size)
>
> If __iommu_get_sgtable() is now the only user, I'd say just inline these
> remnants there (or let that case call dma_common_sgtable() if that's what
> swiotlb_dma_ops are now relying on). Either way the "__swiotlb" is now a
> complete misnomer.

It is. But we hopefully kill both the only user and this helper in
the 4.21 merge window when moving the iommu dma api wrappers to common
code.