From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F171613048C for ; Wed, 8 May 2024 17:46:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715190376; cv=none; b=EG7sULVSbrU7U7EJJFK9QK0Cau5wQ41Z9v1yfFLd+h8m057CTR1yePvRtTAOKJhUpETSUgS7KrULwIJzyHjigA/OxXVovLTzTWjq63h/nBm9yvHPOZtBr85faTJ1cSsyyo+TuYmVXNS0vt3sHCh+RmQf6IDzbNdvdezn9tY22a0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715190376; c=relaxed/simple; bh=f8PbXGqF82lXHQlKyIX8tEfHkeLPJzChVRHjKD0oLGg=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=iVYuk0A6gsgqAPrqoSuO3/qt+zfBchGxtoltw8p5n98HqqKE0VBVwsIwMReJ/hUf7ZY6lTkcR3yIAXavNbvGNnEfpXtqhw/elrHwmxXsClM/ACSTHmXBSiILcfcRIt36VZdvN9SS5SQUeA2xIqKTGWdW3PzJiwIPk0DvvTmgyuM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from ptz.office.stw.pengutronix.de ([2a0a:edc0:0:900:1d::77] helo=[IPv6:::1]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1s4lMg-0007oy-75; Wed, 08 May 2024 19:46:02 +0200 Message-ID: Subject: Re: [PATCH v1] pmdomain: imx8m-blk-ctrl: fix suspend/resume order From: Lucas Stach To: Vitor Soares , Ulf Hansson , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam Cc: Vitor Soares , linux-pm@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Date: Wed, 08 May 2024 19:46:01 +0200 In-Reply-To: <20240418155151.355133-1-ivitro@gmail.com> References: <20240418155151.355133-1-ivitro@gmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.4 (3.48.4-1.fc38) Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:900:1d::77 X-SA-Exim-Mail-From: l.stach@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: stable@vger.kernel.org Am Donnerstag, dem 18.04.2024 um 16:51 +0100 schrieb Vitor Soares: > From: Vitor Soares >=20 > During the probe, the genpd power_dev is added to the dpm_list after > blk_ctrl due to its parent/child relationship. Making the blk_ctrl > suspend after and resume before the genpd power_dev. >=20 > As a consequence, the system hangs when resuming the VPU due to the > power domain dependency. >=20 > To ensure the proper suspend/resume order, add a device link betweem > blk_ctrl and genpd power_dev. It guarantees genpd power_dev is suspended > after and resumed before blk-ctrl. >=20 > Cc: > Closes: https://lore.kernel.org/all/fccbb040330a706a4f7b34875db1d896a0bf8= 1c8.camel@gmail.com/ > Link: https://lore.kernel.org/all/20240409085802.290439-1-ivitro@gmail.co= m/ > Fixes: 2684ac05a8c4 ("soc: imx: add i.MX8M blk-ctrl driver") > Suggested-by: Lucas Stach > Signed-off-by: Vitor Soares Reviewed-by: Lucas Stach > --- >=20 > This is a new patch, but is a follow-up of: > https://lore.kernel.org/all/20240409085802.290439-1-ivitro@gmail.com/ >=20 > As suggested by Lucas, we are addressing this PM issue in the imx8m-blk-c= trl > driver instead of in the imx8mm.dtsi. >=20 > drivers/pmdomain/imx/imx8m-blk-ctrl.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) >=20 > diff --git a/drivers/pmdomain/imx/imx8m-blk-ctrl.c b/drivers/pmdomain/imx= /imx8m-blk-ctrl.c > index ca942d7929c2..cd0d2296080d 100644 > --- a/drivers/pmdomain/imx/imx8m-blk-ctrl.c > +++ b/drivers/pmdomain/imx/imx8m-blk-ctrl.c > @@ -283,6 +283,20 @@ static int imx8m_blk_ctrl_probe(struct platform_devi= ce *pdev) > goto cleanup_pds; > } > =20 > + /* > + * Enforce suspend/resume ordering by making genpd power_dev a > + * provider of blk-ctrl. Genpd power_dev is suspended after and > + * resumed before blk-ctrl. > + */ > + if (!device_link_add(dev, domain->power_dev, DL_FLAG_STATELESS)) { > + ret =3D -EINVAL; > + dev_err_probe(dev, ret, > + "failed to link to %s\n", data->name); > + pm_genpd_remove(&domain->genpd); > + dev_pm_domain_detach(domain->power_dev, true); > + goto cleanup_pds; > + } > + > /* > * We use runtime PM to trigger power on/off of the upstream GPC > * domain, as a strict hierarchical parent/child power domain > @@ -324,6 +338,7 @@ static int imx8m_blk_ctrl_probe(struct platform_devic= e *pdev) > of_genpd_del_provider(dev->of_node); > cleanup_pds: > for (i--; i >=3D 0; i--) { > + device_link_remove(dev, bc->domains[i].power_dev); > pm_genpd_remove(&bc->domains[i].genpd); > dev_pm_domain_detach(bc->domains[i].power_dev, true); > } > @@ -343,6 +358,7 @@ static void imx8m_blk_ctrl_remove(struct platform_dev= ice *pdev) > for (i =3D 0; bc->onecell_data.num_domains; i++) { > struct imx8m_blk_ctrl_domain *domain =3D &bc->domains[i]; > =20 > + device_link_remove(&pdev->dev, domain->power_dev); > pm_genpd_remove(&domain->genpd); > dev_pm_domain_detach(domain->power_dev, true); > }