Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp662844lqo; Wed, 8 May 2024 10:48:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVta4icPiO+YzVtAfKFNcAl56Qe1ppZrcsFTZCS2RHKeCAOTZdIULWzLuXHjspi81RWVOOaRgzD6Pz6WzvoKLc3uEXVW3QO6tMF8/4opw== X-Google-Smtp-Source: AGHT+IG/489Nlc02qg87r23G9pyeLMP7cT1rhxNwM7j8ld2nml976FYOVMmdGusu5sy+lerpBNoL X-Received: by 2002:a05:620a:1790:b0:790:c1ad:d075 with SMTP id af79cd13be357-792bbdc537bmr76211185a.3.1715190503573; Wed, 08 May 2024 10:48:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715190503; cv=pass; d=google.com; s=arc-20160816; b=K5UPLiXbSGleZgAN/J0MskN8OlO/oWJOE+Iyu3lVPSRvPrDvZkCkO/ufvOIsO+BfLD NK2ZYPmnF4c4dFITj46WpFXSP/8DVKStmT6bE5lcU914kCd/MUVUROYSzMw4JyaC5nsI caVRkjKMqC454uxJg0nLKk17pDZ3YeMAvC+u1G9IPIeMTTAgkeiczK2lYv7DNUWTYMHD 9rp4HHVT9kr6YhFb9IRTVAXq6jUUi607h2jW25OWlthBff/w2eiCwifOr75ya8JWEFmD CEb0brz46mLA02FNUgvLTlyslMtRyqPNKuLfOJbCA+95+7fBvmHqVsLPtkKf/YC/NJjv 2WAA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:content-transfer-encoding:references:in-reply-to:date:cc :to:from:subject:message-id; bh=4iiZSYFt04/R8ds3DaIKneobpMkbTuqwZlaWB/R/E3M=; fh=4xrbM9aAjscdaA2dP1OcZQr7s8XOCU18wikoBPOAJQI=; b=kXyFpcObSax5b54ZB64URDV3hRP3H0ccWD2XduIb/Zju8apXQ0lsbOLg3yOLhsKdme DWrZAsi9NC2x3oP0w0lx43gSZeNMbpfngyevbOOJWDQg0+5odgwRKoMlB0V1lYr5sCF/ RkgHJKlODwjA89qbeUrjEydwbV5G6Nz/Mo7rtzziUs9mYVp3kLs0jdepesyRUY6Vmb9U NdA6anHOaaava0nEyjm1YJJm/Aq/aZ8SJ7tZTMsHGcjCTajkLM+QWbBinmwp33eYhvKp Oz1Qp2i6Kr33La+IqY0cRKiQhiI+d2KhW1YpzNL0ENQfHclSldDn6vZZ/bjS0hW8S2uo modQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-173663-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-173663-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id p20-20020a05620a113400b007929f4a98d7si5734031qkk.592.2024.05.08.10.48.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 May 2024 10:48:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-173663-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-173663-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-173663-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 4AB511C227AB for ; Wed, 8 May 2024 17:47:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 92DFE12FF71; Wed, 8 May 2024 17:46:13 +0000 (UTC) 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 9D69812F5B3 for ; Wed, 8 May 2024 17:46:11 +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=1715190373; cv=none; b=PDZcby6tRrjVwpROBjvqtFJJzJuGC+8WQASE1BZKITBW9kXg9d9Xl3EyiJ4r332ayLcrk9TzfDh1wDN5bWYAc0oTOdY2ks0eJls6XAGKjZqlqTcDo/J7EMy/wj8xpY+8jzcNaGUj17L2i6a+n7vZuYC+dXiujjAYLkn6fx74eOw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715190373; c=relaxed/simple; bh=f8PbXGqF82lXHQlKyIX8tEfHkeLPJzChVRHjKD0oLGg=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=A7/HbwM3Xib3L4WuWmJ9whNwvroPuzQ8sqnjW0vdww8+Vg28oEiolu6snKpseYqE30WnDeUPKza9jLbyrn/yJmH5kGltctz5JxhS6gASQCj2zouyyF3Kc8wNurLrSkOimUrUdlBw0r9/LWH69q6PQ6VQFy5jt8SslTmNc8xB/Pw= 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: linux-kernel@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: linux-kernel@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); > }