lkml.org 
[lkml]   [2019]   [Oct]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [RFC PATCH 1/3] dma-mapping: introduce a new dma api dma_addr_to_phys_addr()
Date
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@nxp.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
\
 
 \ /
  Last update: 2019-10-23 13:54    [W:0.119 / U:0.580 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site