Received: by 2002:a25:1104:0:0:0:0:0 with SMTP id 4csp443457ybr; Fri, 22 May 2020 10:13:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZtKBAPtvhv4QPT3cZBS10QGV2ZQycZItYTj7+ADkKS2yNkKD7bjPfpCKofUPQwZpWaEzH X-Received: by 2002:a17:906:f84b:: with SMTP id ks11mr9331738ejb.114.1590167604379; Fri, 22 May 2020 10:13:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590167604; cv=none; d=google.com; s=arc-20160816; b=Ru+2uRmeCkpDaXFrJBUzbZdSp1ywwqcog8aXfNrlQpOQHQxKeXIFT4SGVrKMvzYZir aJY0xd/HMIYDAOWByKnIkEsKEcc75PJfG4F5aIuqv049nhUgfBhcf07IGo5/Oe7vQcoz w+PQD44I+UMWWwOwX8k12/tYd7M45rr/Y5OXWhAG3eu7RfIVIpq7rSp64gMS+wyrXmta m7lpGKOy4w+X7jZydKpyUVi1h1qLkdKDOdHmDIbGqEGrOXoeqPE+w+yZk40i2XT14dnL 4SyKeM1qJnUDeUUhzjNgDf4tNR9sW/sxsRjYZYqvE36zjFVQUlo2xr/FfyQoXQWc4lH8 hC5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:cc:to:subject:from:date :dkim-signature; bh=Gq9F8lTkEQt8HCBJpWq1zgbA3UBCjpb+tJXX07K3abw=; b=gqepS3L5SGX0hdsu9l+VLNTVVi0gCQR2Yu4ixDDXy5pYh6iClN9lvQq6eBINikjf4+ A2YeB+U/sVWrn6N2CYQNP7yCeGeo6Rc1rSU0Bz7jbvdtHfv+hgjztlQTXkN563TlzryK myDFEjQ7grqgZaWSqv0xfiIlEAhRlf1/9KUHuvOciRViUSrfMGwX5ojNbgmFzMcrQyrz KbGMdsTRcqt/FIdkGZl6RvreSZ9ABqeWaEvEjsYYfjPyrUEPPlynfYxNPgV+pAvUAG3m zsaDEcIE1hkDxYm8ItvLaP/rxUR3BdYZDJ9ThBRwdhgaZirjz6zRBNTNaHQwBAKjS5Dr fZCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@crapouillou.net header.s=mail header.b=uH1Nu4HK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id si3si4991565ejb.5.2020.05.22.10.13.01; Fri, 22 May 2020 10:13:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@crapouillou.net header.s=mail header.b=uH1Nu4HK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730787AbgEVRL1 (ORCPT + 99 others); Fri, 22 May 2020 13:11:27 -0400 Received: from outils.crapouillou.net ([89.234.176.41]:35740 "EHLO crapouillou.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726862AbgEVRL1 (ORCPT ); Fri, 22 May 2020 13:11:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1590167484; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Gq9F8lTkEQt8HCBJpWq1zgbA3UBCjpb+tJXX07K3abw=; b=uH1Nu4HKVUV+dQbqHI0J7ym58RSoZ7n9YQVSBw/B7bhKwwY0kLpT6qtzuvmi3oYIr16caq 8/hwvnUA8TuV921HAfmb82AWCBP2+/AfAughZNLK4EG80nkbndH/3SBgL6r5Md5xFt+KrP 28UPaHN1haC7FwP4u29+AfqnavXO17s= Date: Fri, 22 May 2020 19:11:13 +0200 From: Paul Cercueil Subject: Re: [PATCH v7 3/5] remoteproc: Add support for runtime PM To: Suman Anna Cc: Bjorn Andersson , Ohad Ben-Cohen , Arnaud Pouliquen , od@zcrc.me, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Tero Kristo Message-Id: In-Reply-To: <035bf8ad-3ef0-8314-ae5c-a94a24c230c8@ti.com> References: <20200515104340.10473-1-paul@crapouillou.net> <20200515104340.10473-3-paul@crapouillou.net> <035bf8ad-3ef0-8314-ae5c-a94a24c230c8@ti.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Suman, Le ven. 22 mai 2020 =E0 11:47, Suman Anna a =E9crit : > Hi Paul, >=20 > On 5/15/20 5:43 AM, Paul Cercueil wrote: >> Call pm_runtime_get_sync() before the firmware is loaded, and >> pm_runtime_put() after the remote processor has been stopped. >>=20 >> Even though the remoteproc device has no PM callbacks, this allows=20 >> the >> parent device's PM callbacks to be properly called. >=20 > I see this patch staged now for 5.8, and the latest -next branch has=20 > broken the pm-runtime autosuspend feature we have in the OMAP=20 > remoteproc driver. See commit 5f31b232c674 ("remoteproc/omap: Add=20 > support for runtime auto-suspend/resume"). >=20 > What was the original purpose of this patch, because there can be=20 > differing backends across different SoCs. Did you try pm_suspend_ignore_children()? It looks like it was made for=20 your use-case. Cheers, -Paul >=20 > regards > Suman >=20 >>=20 >> Signed-off-by: Paul Cercueil >> --- >>=20 >> Notes: >> v2-v4: No change >> v5: Move calls to prepare/unprepare to=20 >> rproc_fw_boot/rproc_shutdown >> v6: Instead of prepare/unprepare callbacks, use PM runtime=20 >> callbacks >> v7: Check return value of pm_runtime_get_sync() >>=20 >> drivers/remoteproc/remoteproc_core.c | 17 ++++++++++++++++- >> 1 file changed, 16 insertions(+), 1 deletion(-) >>=20 >> diff --git a/drivers/remoteproc/remoteproc_core.c=20 >> b/drivers/remoteproc/remoteproc_core.c >> index a7f96bc98406..e33d1ef27981 100644 >> --- a/drivers/remoteproc/remoteproc_core.c >> +++ b/drivers/remoteproc/remoteproc_core.c >> @@ -29,6 +29,7 @@ >> #include >> #include >> #include >> +#include >> #include >> #include >> #include >> @@ -1382,6 +1383,12 @@ static int rproc_fw_boot(struct rproc *rproc,=20 >> const struct firmware *fw) >> if (ret) >> return ret; >> =7F+ ret =3D pm_runtime_get_sync(dev); >> + if (ret < 0) { >> + dev_err(dev, "pm_runtime_get_sync failed: %d\n", ret); >> + return ret; >> + } >> + >> dev_info(dev, "Booting fw image %s, size %zd\n", name, fw->size); >> =7F /* >> @@ -1391,7 +1398,7 @@ static int rproc_fw_boot(struct rproc *rproc,=20 >> const struct firmware *fw) >> ret =3D rproc_enable_iommu(rproc); >> if (ret) { >> dev_err(dev, "can't enable iommu: %d\n", ret); >> - return ret; >> + goto put_pm_runtime; >> } >> =7F rproc->bootaddr =3D rproc_get_boot_addr(rproc, fw); >> @@ -1435,6 +1442,8 @@ static int rproc_fw_boot(struct rproc *rproc,=20 >> const struct firmware *fw) >> rproc->table_ptr =3D NULL; >> disable_iommu: >> rproc_disable_iommu(rproc); >> +put_pm_runtime: >> + pm_runtime_put(dev); >> return ret; >> } >> =7F@@ -1840,6 +1849,8 @@ void rproc_shutdown(struct rproc *rproc) >> =7F rproc_disable_iommu(rproc); >> =7F+ pm_runtime_put(dev); >> + >> /* Free the copy of the resource table */ >> kfree(rproc->cached_table); >> rproc->cached_table =3D NULL; >> @@ -2118,6 +2129,9 @@ struct rproc *rproc_alloc(struct device *dev,=20 >> const char *name, >> =7F rproc->state =3D RPROC_OFFLINE; >> =7F+ pm_runtime_no_callbacks(&rproc->dev); >> + pm_runtime_enable(&rproc->dev); >> + >> return rproc; >> } >> EXPORT_SYMBOL(rproc_alloc); >> @@ -2133,6 +2147,7 @@ EXPORT_SYMBOL(rproc_alloc); >> */ >> void rproc_free(struct rproc *rproc) >> { >> + pm_runtime_disable(&rproc->dev); >> put_device(&rproc->dev); >> } >> EXPORT_SYMBOL(rproc_free); >>=20 >=20