[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <50a42575-02b2-c558-0609-90e2ad3f515b@nxp.com>
Date: Wed, 23 Oct 2019 11:53:41 +0000
From: Laurentiu Tudor <laurentiu.tudor@....com>
To: Robin Murphy <robin.murphy@....com>, "hch@....de" <hch@....de>,
"joro@...tes.org" <joro@...tes.org>,
Ioana Ciocoi Radulescu <ruxandra.radulescu@....com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"iommu@...ts.linux-foundation.org" <iommu@...ts.linux-foundation.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Ioana Ciornei <ioana.ciornei@....com>
CC: Leo Li <leoyang.li@....com>,
Diana Madalina Craciun <diana.craciun@....com>,
"davem@...emloft.net" <davem@...emloft.net>,
Madalin-cristian Bucur <madalin.bucur@....com>
Subject: Re: [RFC PATCH 1/3] dma-mapping: introduce a new dma api
dma_addr_to_phys_addr()
Hi Robin,
On 22.10.2019 16:25, Robin Murphy wrote:
> On 22/10/2019 13:55, Laurentiu Tudor wrote:
>> From: Laurentiu Tudor <laurentiu.tudor@....com>
>>
>> Introduce a new dma map op called dma_addr_to_phys_addr() that converts
>> a dma address to the physical address backing it up and add wrapper for
>> it.
>
> I'd really love it if there was a name which could encapsulate that this
> is *only* for extreme special cases of constrained descriptors/pagetable
> entries/etc. where there's simply no practical way to keep track of a
> CPU address alongside the DMA address, and the only option is this
> potentially-arbitrarily-complex operation (I mean, on some systems it
> may end up taking locks and poking hardware).
>
> Either way it's tricky - much as I don't like adding an interface which
> is ripe for drivers to misuse, I also really don't want hacks like
> bdf95923086f shoved into other APIs to compensate, so on balance I'd
> probably consider this proposal ever so slightly the lesser evil.
We had an internal discussion over these points you are raising and
Madalin (cc-ed) came up with another idea: instead of adding this prone
to misuse api how about experimenting with a new dma unmap and dma sync
variants that would return the physical address by calling the newly
introduced dma map op. Something along these lines:
* phys_addr_t dma_unmap_page_ret_phys(...)
* phys_addr_t dma_unmap_single_ret_phys(...)
* phys_addr_t dma_sync_single_for_cpu_ret_phys(...)
I'm thinking that this proposal should reduce the risks opened by the
initial variant.
Please let me know what you think.
---
Thanks & Best Regards, Laurentiu
Powered by blists - more mailing lists