LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: Robin Murphy <robin.murphy@arm.com>,
	will.deacon@arm.com, bjorn.andersson@linaro.org
Cc: joro@8bytes.org, ohad@wizery.com,
	linux-arm-kernel@lists.infradead.org,
	iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org,
	linux-remoteproc@vger.kernel.org
Subject: Re: [PATCH 2/3] rpmsg: core: make rpmsg bus DMA capable
Date: Fri, 2 Mar 2018 16:40:53 +0000	[thread overview]
Message-ID: <469cfe2c-d4d0-6050-339d-430f893e7775@linaro.org> (raw)
In-Reply-To: <07503032-b08b-10ea-9d34-ddf85c682a9d@arm.com>

Thanks for your time,

On 02/03/18 16:14, Robin Murphy wrote:
> On 02/03/18 14:55, srinivas.kandagatla@linaro.org wrote:
>> From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
>>
>> Many of the rpmsg clients like audio drivers need to allocate
>> dma memory. Make this bus DMA capable so that the child devices
>> can use dma apis.
> 
> AFAICS after 15 minutes in the docs and code, the rpmsg "bus" is a 
> virtual one based around shared-memory mailbox communication, so I don't 
> really see how DMA exists in that context - I think maybe that 
> abstraction needs looking at.
> 
> However, from grepping through the DTs it seems at first glance like the 
> non-trivial things under the "qcom,smd" bus mostly map to actual 
> platform devices via the "qcom,smd-edge" property - if those platform 
> devices are the physical DMA masters, they should be the ones used for 
> DMA API operations.

Currently there are very limited rpmsg devices in the mainline that use 
dma. Only one I can think of is wcnss WIFI driver which models up itself 
into another layer of platform device. Not sure if the DMA was the 
reason to do that.

However am working on audio drivers [1] which I modeled up as children 
of the rpmsg bus, so the problem started. There is an IOMMU in between 
APPs and DSP which provides audio services.
There are also other projects like FastRPC which have used similar 
driver model which ended up with same issues.

It all depends on how you model your driver. Audio case we have a rpmsg 
channel which exposes audio functionality. so If we want to use the 
iommu/dma operations we have to add another layer of platform device.
Which also means that rpmsg channel notifications have to be passed to 
these platform devices in some way.

Am not 100% sure if this correct way to fix the issue.

> 
>> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
>> ---
>>   drivers/rpmsg/rpmsg_core.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/rpmsg/rpmsg_core.c b/drivers/rpmsg/rpmsg_core.c
>> index e84c71f8d6ab..540a3f3567b8 100644
>> --- a/drivers/rpmsg/rpmsg_core.c
>> +++ b/drivers/rpmsg/rpmsg_core.c
>> @@ -472,6 +472,7 @@ struct bus_type rpmsg_bus = {
>>       .uevent        = rpmsg_uevent,
>>       .probe        = rpmsg_dev_probe,
>>       .remove        = rpmsg_dev_remove,
>> +    .force_dma    = true,
> 
> Regardless of the above, would you really need to use this brute force 
> hack instead of just fixing the DTs? I'm struggling to find which 
> drivers might currently be relying on this :/

This is one of the two issues. dma-ranges might work in this case, but 
we still have iommu case.

> 
> Robin.
> 
>>   };
>>   EXPORT_SYMBOL(rpmsg_bus);
>>

thanks,
srini
[1]: https://lkml.org/lkml/2018/2/13/719

  reply	other threads:[~2018-03-02 16:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-02 14:55 [PATCH 0/3] drivers: rpmsg: " srinivas.kandagatla
2018-03-02 14:55 ` [PATCH 1/3] rpmsg: core: export rpmsg bus type srinivas.kandagatla
2018-03-02 15:25   ` Robin Murphy
2018-03-02 14:55 ` [PATCH 2/3] rpmsg: core: make rpmsg bus DMA capable srinivas.kandagatla
2018-03-02 16:14   ` Robin Murphy
2018-03-02 16:40     ` Srinivas Kandagatla [this message]
2018-03-18 22:47     ` Bjorn Andersson
2018-03-02 14:55 ` [PATCH 3/3] iommu: armsmmu: set iommu ops for rpmsg bus srinivas.kandagatla
2018-03-02 16:59   ` Robin Murphy
2018-05-07 19:28     ` Bjorn Andersson
2018-05-11 18:24       ` Robin Murphy

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=469cfe2c-d4d0-6050-339d-430f893e7775@linaro.org \
    --to=srinivas.kandagatla@linaro.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=ohad@wizery.com \
    --cc=robin.murphy@arm.com \
    --cc=will.deacon@arm.com \
    --subject='Re: [PATCH 2/3] rpmsg: core: make rpmsg bus DMA capable' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).