Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1683347

Re: [PATCH v2 1/2] drivers: dma-coherent: Fix dev->cma_area vs dev->dma_mem breakage

From Robin Murphy <robin.murphy@arm.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 1/2] drivers: dma-coherent: Fix dev->cma_area vs dev->dma_mem breakage
Date 2017-07-07 20:00 +0200
Message-ID <u0FHP-7jP-9@gated-at.bofh.it> (permalink)
References (1 earlier) <u0Bux-4As-5@gated-at.bofh.it> <u0CqC-5eN-1@gated-at.bofh.it> <u0DG2-5Yg-13@gated-at.bofh.it> <u0E94-6rS-5@gated-at.bofh.it> <u0EC7-6Et-29@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 07/07/17 17:44, Vladimir Murzin wrote:
> On 07/07/17 17:06, Robin Murphy wrote:
>> On 07/07/17 16:40, Vladimir Murzin wrote:
>>> Christoph,
>>>
>>> On 07/07/17 15:27, Christoph Hellwig wrote:
>>>> Vladimir,
>>>>
>>>> this is why I really didn't like overloading the current
>>>> dma coherent infrastructure with the global pool.
>>>>
>>>> And this new patch seems like piling hacks over hacks.  I think we
>>>> should go back and make sure allocations from the global coherent
>>>> pool are done by the dma ops implementation, and not before calling
>>>> into them - preferably still reusing the common code for it.
>>>>
>>>> Vladimir or Vitaly - can you look into that?
>>>>
>>>
>>> It is really sad that Vitaly and George did not join to discussions earlier,
>>> so we could avoid being in situation like this.
>>>
>>> Likely I'm missing something, but what should happen if device relies on
>>> dma_contiguous_default_area?
>>>
>>> Originally, intention behind dma-default was to simplify things, so instead of 
>>>
>>>        reserved-memory {
>>>                 #address-cells = <1>;
>>>                 #size-cells = <1>;
>>>                 ranges;
>>>
>>>                 coherent_dma: linux,dma {
>>>                         compatible = "shared-dma-pool";
>>>                         no-map;
>>>                         reg = <0x78000000 0x800000>;
>>>                 };
>>>         };
>>>
>>>   
>>>         dev0: dev@12300000 {
>>>                 memory-region = <&coherent_dma>;
>>>                 /* ... */
>>>         };
>>>
>>>         dev1: dev@12500000 {
>>>                 memory-region = <&coherent_dma>;
>>>                 /* ... */
>>>         };
>>>
>>>         dev2: dev@12600000 {
>>>                 memory-region = <&coherent_dma>;
>>>                 /* ... */
>>>         };
>>>
>>> in device tree we could simply have
>>>
>>>        reserved-memory {
>>>                 #address-cells = <1>;
>>>                 #size-cells = <1>;
>>>                 ranges;
>>>
>>>                 coherent_dma: linux,dma {
>>>                         compatible = "shared-dma-pool";
>>>                         no-map;
>>>                         reg = <0x78000000 0x800000>;
>>>                         linux,dma-default;
>>>                 };
>>>         };
>>>
>>> and that just work in my (NOMMU) case because there is no CMA there...
>>>
>>> However, given that dma-default is being overloaded and there are no device
>>> tree users merged yet, I would not object stepping back, reverting "drivers:
>>> dma-coherent: Introduce default DMA pool" and cooperatively rethinking
>>> design/implementation, so every party gets happy.
>>
>> I don't think we need to go that far, I reckon it would be clear enough
>> to just split the per-device vs. global pool interfaces, something like
>> I've sketched out below (such that the ops->alloc implementation calls
>> dma_alloc_from_global_coherent() if dma_alloc_from_contiguous() fails).
> 
> Would not we need also release and mmap variants?

Sure, that was just bashed out in 2 minutes and diffed into an email on
the assumption that code would help illustrate the general idea I had in
mind more clearly than prose alone. I'm certain it won't even compile
as-is ;)

Robin.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 1/2] drivers: dma-coherent: Fix dev->cma_area vs dev->dma_mem breakage Vitaly Kuzmichev <vitaly_kuzmichev@mentor.com> - 2017-07-07 15:30 +0200
  Re: [PATCH v2 1/2] drivers: dma-coherent: Fix dev->cma_area vs         dev->dma_mem breakage Christoph Hellwig <hch@lst.de> - 2017-07-07 16:30 +0200
    Re: [PATCH v2 1/2] drivers: dma-coherent: Fix dev->cma_area vs  dev->dma_mem breakage Vladimir Murzin <vladimir.murzin@arm.com> - 2017-07-07 17:50 +0200
      Re: [PATCH v2 1/2] drivers: dma-coherent: Fix dev->cma_area vs  dev->dma_mem breakage Robin Murphy <robin.murphy@arm.com> - 2017-07-07 18:20 +0200
        Re: [PATCH v2 1/2] drivers: dma-coherent: Fix dev->cma_area vs  dev->dma_mem breakage Vladimir Murzin <vladimir.murzin@arm.com> - 2017-07-07 18:50 +0200
          Re: [PATCH v2 1/2] drivers: dma-coherent: Fix dev->cma_area vs  dev->dma_mem breakage Robin Murphy <robin.murphy@arm.com> - 2017-07-07 20:00 +0200
            Re: [PATCH v2 1/2] drivers: dma-coherent: Fix dev->cma_area vs  dev->dma_mem breakage Vladimir Murzin <vladimir.murzin@arm.com> - 2017-07-10 15:50 +0200
        Re: [PATCH v2 1/2] drivers: dma-coherent: Fix dev->cma_area vs         dev->dma_mem breakage Christoph Hellwig <hch@lst.de> - 2017-07-11 16:20 +0200

csiph-web