Re: [PATCH] rpmsg: core: add support to power domains for devices

From: Suman Anna
Date: Tue Sep 25 2018 - 13:21:09 EST


Hi Srini,

On 09/25/2018 03:29 AM, Srinivas Kandagatla wrote:
> Hi Suman,
>
> On 25/09/18 01:25, Suman Anna wrote:
>> Hi Srinivas,
>>
>> On 06/15/2018 04:59 AM, Srinivas Kandagatla wrote:
>>> Some of the rpmsg devices need to switch on power domains to communicate
>>> with remote processor. For example on Qualcomm DB820c platform LPASS
>>> power domain needs to switched on for any kind of audio services.
>>> This patch adds the missing power domain support in rpmsg core.
>>>
>>> Without this patch attempting to play audio via QDSP on DB820c would
>>> reboot the system.
>>>
>>> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@xxxxxxxxxx>
>>> ---
>>> Â drivers/rpmsg/rpmsg_core.c | 7 +++++++
>>> Â 1 file changed, 7 insertions(+)
>>>
>>> diff --git a/drivers/rpmsg/rpmsg_core.c b/drivers/rpmsg/rpmsg_core.c
>>> index b714a543a91d..8122807db380 100644
>>> --- a/drivers/rpmsg/rpmsg_core.c
>>> +++ b/drivers/rpmsg/rpmsg_core.c
>>> @@ -15,6 +15,7 @@
>>> Â #include <linux/module.h>
>>> Â #include <linux/rpmsg.h>
>>> Â #include <linux/of_device.h>
>>> +#include <linux/pm_domain.h>
>>> Â #include <linux/slab.h>
>>> Â Â #include "rpmsg_internal.h"
>>> @@ -449,6 +450,10 @@ static int rpmsg_dev_probe(struct device *dev)
>>> ÂÂÂÂÂ struct rpmsg_endpoint *ept = NULL;
>>> ÂÂÂÂÂ int err;
>>> Â +ÂÂÂ err = dev_pm_domain_attach(dev, true);
>>> +ÂÂÂ if (err)
>>> +ÂÂÂÂÂÂÂ goto out;
>>
>> This patch has broken the virtio-rpmsg stack based rpmsg devices. These
>> devices are non-DT and the rpmsg_dev_probe() is now failing with -19
>> (-ENODEV) error code.
>>
>
> There seems to be some dependency on this patch (
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?h=v4.19-rc5&id=919b7308fcc452cd4e282bab389c33384a9f3790
> ) which seems to rework the return values from acpi_dev_pm_attach() and
> genpd_dev_pm_attach()
>

OK, I see that dependent commit is part of the 4.18 Linux kernel. So
mainline kernel has no issues, but this patch was picked up in 4.14.71
(don't know why) as commit 1ed3a9307230, so 4.14 stable is broken. So,
how do we proceed here - don't think we can pick all those dependent
patches against stable.

regards
Suman

>
>
> --srini
>
>
>> Loic, Arnaud,
>> Can one of you double-confirm this behavior on ST platforms as well?
>> The patch came through 4.14.71 stable release and broke our downstream
>> kernels.
>>
>> regards
>> Suman
>>
>>> +
>>> ÂÂÂÂÂ if (rpdrv->callback) {
>>> ÂÂÂÂÂÂÂÂÂ strncpy(chinfo.name, rpdev->id.name, RPMSG_NAME_SIZE);
>>> ÂÂÂÂÂÂÂÂÂ chinfo.src = rpdev->src;
>>> @@ -490,6 +495,8 @@ static int rpmsg_dev_remove(struct device *dev)
>>> Â ÂÂÂÂÂ rpdrv->remove(rpdev);
>>> Â +ÂÂÂ dev_pm_domain_detach(dev, true);
>>> +
>>> ÂÂÂÂÂ if (rpdev->ept)
>>> ÂÂÂÂÂÂÂÂÂ rpmsg_destroy_ept(rpdev->ept);
>>> Â
>>