From: Robin Murphy <robin.murphy@arm•com>
To: Vladimir Murzin <vladimir.murzin@arm•com>,
Christoph Hellwig <hch@lst•de>,
Vitaly Kuzmichev <vitaly_kuzmichev@mentor•com>
Cc: gregkh@linuxfoundation•org, m.szyprowski@samsung•com,
linux-kernel@vger•kernel.org, linux-next@vger•kernel.org,
"George G. Davis" <george_davis@mentor•com>
Subject: Re: [PATCH v2 1/2] drivers: dma-coherent: Fix dev->cma_area vs dev->dma_mem breakage
Date: Fri, 7 Jul 2017 18:55:16 +0100 [thread overview]
Message-ID: <fb080997-5f7b-7f85-7a4a-f68f689dff55@arm.com> (raw)
In-Reply-To: <451e9f50-3e47-1554-ae62-be5244cc1869@arm.com>
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.
next prev parent reply other threads:[~2017-07-07 17:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1499093475-29859-1-git-send-email-vitaly_kuzmichev@mentor.com>
2017-07-07 13:22 ` [PATCH v2 0/2] Additions to default DMA coherent pool Vitaly Kuzmichev
2017-07-07 13:22 ` [PATCH v2 1/2] drivers: dma-coherent: Fix dev->cma_area vs dev->dma_mem breakage Vitaly Kuzmichev
2017-07-07 14:27 ` Christoph Hellwig
2017-07-07 15:40 ` Vladimir Murzin
2017-07-07 16:06 ` Robin Murphy
2017-07-07 16:44 ` Vladimir Murzin
2017-07-07 17:55 ` Robin Murphy [this message]
2017-07-10 13:42 ` Vladimir Murzin
2017-07-11 14:19 ` Christoph Hellwig
2017-07-07 13:23 ` [PATCH v2 2/2] drivers: dma-coherent: show per-device DMA region utilization via procfs Vitaly Kuzmichev
2017-07-07 14:28 ` Christoph Hellwig
2017-07-07 13:55 ` [PATCH v2 0/2] Additions to default DMA coherent pool Stephen Rothwell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fb080997-5f7b-7f85-7a4a-f68f689dff55@arm.com \
--to=robin.murphy@arm$(echo .)com \
--cc=george_davis@mentor$(echo .)com \
--cc=gregkh@linuxfoundation$(echo .)org \
--cc=hch@lst$(echo .)de \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linux-next@vger$(echo .)kernel.org \
--cc=m.szyprowski@samsung$(echo .)com \
--cc=vitaly_kuzmichev@mentor$(echo .)com \
--cc=vladimir.murzin@arm$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox