Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp375700lqo; Fri, 10 May 2024 02:35:32 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU/YHMpXJcGAotTdn/ZVNRGU9M/NGoALMz0RLHoCdpWj2X06p0PvldzwkpBm0HhRPbFzaytMr6kRPMzpMwHUagb9igBk2m9uSvboVuPQw== X-Google-Smtp-Source: AGHT+IEEsdcSszVN+OKMClOeIBWZlsC8wV1J2eEFmivS5ysIaMGyALpABnc7It19DUgivgFOsnkk X-Received: by 2002:a17:903:1109:b0:1eb:101d:bf53 with SMTP id d9443c01a7336-1eef9f346demr81469435ad.1.1715333732307; Fri, 10 May 2024 02:35:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715333732; cv=pass; d=google.com; s=arc-20160816; b=ONU77Xci/badxMBruoG5b1DQ59G1kNrxRAP5kt+CGI6CqFm1KX41QtzZs0Ujbq9mMM O7s1QDU+3hREtgkTSqlrSZ4lw8Sn01B52o+J78fnMHV2y8jnzvq5Bdg9GIS1EfZiKfnr UXAOomBQ7Io09iliVSnFX0Gl9bOyEFV+Fcz8AKlIfx9/NRF3qAe2UlV1J0bziFRvGoxr txC1oSYKYkj35vFGQbH1GQbldVi7VMeVsJERx3t9crUCRpEwReHfR3eEThRzD9rlsvpM avq+ZahO+VmnC0D4kQCNxoswRuCnbJAE/GDShRiCQfvudhBiR/h5cpPCuTrKMX55eE2a rNGA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=ddAlHrV+azsymE+SBA7AG/w8GBAmFQuP9eNGcQBlcU4=; fh=NYLVeDOn3W9YSS7ShpIj0/9WhZ+ze8tvSxX6qveXtzs=; b=A3oFtA8UJ3f8VUJXMNVlOrcb6MmOgHAXFP64JHMYMJGoH09mSByquJtb0g6PWer8Kl SpiG5rCYqFmjFnUGxVcW+eEExwxKbUccEfN5W5NwVcRuDknHK5sO8J5Lg7Q5A3GVs5Od jJWOITtXTYo/X8rdu5VuR6i/FZEwd6OD+H3IeH+KMqTlWr2uk2964flO9ChelnvQU+gB 6cFd1BVP6yV5J6b6ipFy4i826xGGj24TRpgQ0KIjTAblY5EHizh5BaKxUWbk4cJBN5zh P5FsoCtq7F0PINBV97tmCXnXG6E0LCHg8uQ63BZVxHT1gfBtLC3ouXHx2SSp8lrHU0LB Lktw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dfo5KVau; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-175537-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-175537-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d9443c01a7336-1ef0c03b6f6si33926455ad.428.2024.05.10.02.35.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 May 2024 02:35:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-175537-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dfo5KVau; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-175537-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-175537-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id AF377281ABE for ; Fri, 10 May 2024 09:35:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3D8D316191A; Fri, 10 May 2024 09:35:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="dfo5KVau" Received: from mail-yb1-f178.google.com (mail-yb1-f178.google.com [209.85.219.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A7F72161330 for ; Fri, 10 May 2024 09:35:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715333725; cv=none; b=Kzl/kbrfo1sz2QSdXJKEDSg58T2MxEe1tU3XdVMsJCPdFQaCrt7/1eP71zW+6P64nCZaVOiqew4wN3rFmYMRoStcb2Vg1FNFRGdiMAuqdNve0MkHyHNHHEGV+U7IJ53Up7UwDm/yA3xbf14GQy/DoDjMTFuaKPlJrZh7ki342mY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715333725; c=relaxed/simple; bh=74mWvHLl9kkJWCjJ9c/58+OLihHsC5x2Bv4lj2v1YJw=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=uWopl1xVo+uDEBmTD7dUoXjHqVPfGBrNiN8g+dJZxKwx4MAGBlSuV0kIBOfKh//tGy1QSU8y45gyuVqFjHYcVtQZ/jlt+b9Qbq7G890RtIqYcOdjTSL6z1dl9XhnsD0lxW53xyOyfilT8QOZK1XmL+E7cwiGcwF8ia4yg8E0HV8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=dfo5KVau; arc=none smtp.client-ip=209.85.219.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-yb1-f178.google.com with SMTP id 3f1490d57ef6-dcc6fc978ddso1541192276.0 for ; Fri, 10 May 2024 02:35:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715333722; x=1715938522; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=ddAlHrV+azsymE+SBA7AG/w8GBAmFQuP9eNGcQBlcU4=; b=dfo5KVaubq5BNK8KxOFO6OpXSqVEzSSNKPTtJJv3fFzCERqmY76eqwz9L3BfWmebDr I9iy13RfJq8ACb+U2WT6fN9L4cyoBKYeRZnjZlYwlYWNlYWt0oDFbedAbT0xu/Tbvh78 lBuIEgnodFKPijQ+YjNWqFAOeB69WeV8hgy/2BE8JDqDNkkUaX+NDsu5F/mkdcsotnKb 3izG1hFNFy/e0HtBgMYX+leWCAtNzXyqGDUXXzimBQBvzXXhbyD7TqCtCpApXqdyyp9n IWFTu936lXj7BHTlQZBCIvhemrRyNEonNoidkA0YBsOijVetEOoa0cjRleqvRsLeXb35 EM/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715333722; x=1715938522; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ddAlHrV+azsymE+SBA7AG/w8GBAmFQuP9eNGcQBlcU4=; b=DPDZJDJy2bPvui6RK4ZBThmOiWZPaeO6I0tV3tPJY0GRoomohBLH4fD3EGRixye7l1 Xq1yt+c56zQPoUUx7CsIDtD/9GKgPXrJxuiT4fJU8xPDqoUlGc6+nA1fW//doJ8Q2JKM 0sqU0HQ5S+37WukZMye9CygrBfBFQG1LzFT3Wv44M2kQaelG0V5VjxFrRzlsjGdYFAI0 xBQq+2ZiMT9Ivp2p8PwuX53urM9queLI1IepFaZPq31DmMKMWDwNdyx7zrsFS53zG52c 5pihbXKV4TCnbrzeqqgnZmqxrNHFQSUMCJ4blMD/fjpCdkMiwMo08YF8M+U1grS6H4f2 hePQ== X-Forwarded-Encrypted: i=1; AJvYcCW+eoBM7pQzKzgbOuK76Vj4xAlIB1VHBL1NTYs0iVDCtGRbeydG9ljTE8B2ohO59ervACVCOFEWtxJvJPY+rOn0ZbgaLN0ejlq3tTwu X-Gm-Message-State: AOJu0Yy3I4T3CkLUUujVYQ5j0MHEIreY2GGPsN/xzDiGqQxlyR3W+nKY SeIBHt2vq2X8u1dFxIZdQGoz49SQSMhPl7AQOM9jld4puZv6NZW9i4ls9ECVK0JElPkQAwCKJ3h WQ8oaJdrpXVaxszR/JgfOZYSeDzZQp9snI1MLXg== X-Received: by 2002:a5b:2d1:0:b0:de5:bc2e:467e with SMTP id 3f1490d57ef6-debcfb4e0b0mr3992499276.3.1715333722592; Fri, 10 May 2024 02:35:22 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240418155151.355133-1-ivitro@gmail.com> In-Reply-To: <20240418155151.355133-1-ivitro@gmail.com> From: Ulf Hansson Date: Fri, 10 May 2024 11:34:46 +0200 Message-ID: Subject: Re: [PATCH v1] pmdomain: imx8m-blk-ctrl: fix suspend/resume order To: Vitor Soares , Lucas Stach Cc: Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , 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 Content-Type: text/plain; charset="UTF-8" On Thu, 18 Apr 2024 at 17:52, Vitor Soares wrote: > > From: Vitor Soares > > 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. > > As a consequence, the system hangs when resuming the VPU due to the > power domain dependency. > > 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. Before discussing $subject patch, would you mind explaining to me why imx8m-blk-ctrl needs to use the ->suspend() callback at all? Looking closer at that code (imx8m_blk_ctrl_suspend()), it calls pm_runtime_get_sync() for devices to power on "everything". Why isn't that managed by the consumer drivers (on a case by case basis) that are managing the devices that are attached to the genpds instead? Kind regards Uffe > > Cc: > Closes: https://lore.kernel.org/all/fccbb040330a706a4f7b34875db1d896a0bf81c8.camel@gmail.com/ > Link: https://lore.kernel.org/all/20240409085802.290439-1-ivitro@gmail.com/ > Fixes: 2684ac05a8c4 ("soc: imx: add i.MX8M blk-ctrl driver") > Suggested-by: Lucas Stach > Signed-off-by: Vitor Soares > --- > > This is a new patch, but is a follow-up of: > https://lore.kernel.org/all/20240409085802.290439-1-ivitro@gmail.com/ > > As suggested by Lucas, we are addressing this PM issue in the imx8m-blk-ctrl > driver instead of in the imx8mm.dtsi. > > drivers/pmdomain/imx/imx8m-blk-ctrl.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > 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_device *pdev) > goto cleanup_pds; > } > > + /* > + * 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 = -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_device *pdev) > of_genpd_del_provider(dev->of_node); > cleanup_pds: > for (i--; i >= 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_device *pdev) > for (i = 0; bc->onecell_data.num_domains; i++) { > struct imx8m_blk_ctrl_domain *domain = &bc->domains[i]; > > + device_link_remove(&pdev->dev, domain->power_dev); > pm_genpd_remove(&domain->genpd); > dev_pm_domain_detach(domain->power_dev, true); > } > -- > 2.34.1 >