[lkml]   [2019]   [Jan]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 2/3] dma: Introduce dma_max_mapping_size()
On Tue, Jan 15, 2019 at 05:23:22PM +0100, Joerg Roedel wrote:
> Right, I thought about that too, but didn't find a generic way to check
> for all the cases. There are various checks that could be done:
> 1) Check if SWIOTLB is initialized at all, if not, return
> SIZE_MAX as the limit. This can't be checked from dma-direct
> code right now, but could be easily implemented.

Yes, this is the low hanging fruit.

> 2) Check for swiotlb=force needs to be done.
> 3) Check whether the device can access all of available RAM. I
> have no idea how to check that in an architecture independent
> way. It also has to take memory hotplug into account as well
> as the DMA mask of the device.
> An easy approximation could be to omit the limit if the
> dma-mask covers all of the physical address bits available
> on the platform. It would require to pass the dma-mask as an
> additional parameter like it is done in dma_supported().
> Any better ideas for how to implement 3)?

And yeah, this is hard. So I'd just go for the low hanging fruit
for now and only implement 1) with a comment mentioning that
we are a little pessimistic.

 \ /
  Last update: 2019-01-15 18:55    [W:0.958 / U:0.996 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site