Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7219752rdb; Wed, 3 Jan 2024 08:19:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IGOI8ocoIHfLctTikPStc+f4RH61zkGtgm0bhdQI6NJQbthJlxOdfL82b1L8t+XAWN+gKHK X-Received: by 2002:a05:6512:281b:b0:50e:699b:55f with SMTP id cf27-20020a056512281b00b0050e699b055fmr11103821lfb.66.1704298771907; Wed, 03 Jan 2024 08:19:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704298771; cv=none; d=google.com; s=arc-20160816; b=Fp3RTUcmqS4K5iybAT7Ttkc35oYkzPcAZOG0PIwzfSi1ZXNrQ2F6GCkIGE26CX64MX /ql6h5pG0R6Xj8TSEV2DuJSOSVqKf0D71JncE3Rm6byGRu+yTBRM8yUtAcj5ncK9V7kM 4qSExEx/0BAr2z5fgyIzkpqHmwhBQJZ/AH5EByqkFUbyjMn80jD/nc9EiZd3tNM2NXxN +oIZTq//s8T3gsvTAd7P9fgf8OAiGy9AcQ3MI8SG35ndUDzbfkb7Lmzz+/zoDpNTm0/F 9V+LZYYqlgSotU5W0+oDOzb9c/gXUzbhfqVO+2No5yqfnrpqe53Yfdjz6ZWWMqxXku6q MAGQ== ARC-Message-Signature: i=1; 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=selIPiTBkoS5l1OMM3i9w0HzBJej2N34COzM6/N+NXw=; fh=svKNWFYJxh2u6ZkK+RnMI40U+f7zS4sXpFU4I/ek8Cw=; b=GOZsTxF6M6JXsGHUdAfKjpHdPXrBotaHvP9dJFDiME7KtW7b2hMy6ly0Fq/jKN7a3j Gk2E6TjbXjJUXjdJPD1AqUl2vh0mWOnSJhkIBzwvXBk1Jr+KuOxdun7HEhLG9jQePocb vY5AvzBkrsPq6XIAPiw2lO16bP9e7cLJCQJfY36zyPapbpI5XmoIcKPiirgnIsGZHnya WRDgSjMVU5mr60WAwk68ExtmGbx+8vMQujpdhMw2jWThK9xXoGJ1xzmbLx0ht/Gq+m2B bbrDTt7KFYGmrdvHgpTzzaKZAZM758tbDabDrzGv/AnyTx8skY2mscEZ3G3Xcsc9PuOL Va8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="R/kL4X0T"; spf=pass (google.com: domain of linux-kernel+bounces-15739-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15739-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id p11-20020a1709060dcb00b00a2335c87e40si11598355eji.696.2024.01.03.08.19.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 08:19:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-15739-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="R/kL4X0T"; spf=pass (google.com: domain of linux-kernel+bounces-15739-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15739-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 77DE71F21C98 for ; Wed, 3 Jan 2024 16:19:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 935BD1BDC5; Wed, 3 Jan 2024 16:19:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="R/kL4X0T" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (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 368751B297 for ; Wed, 3 Jan 2024 16:19:21 +0000 (UTC) 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-wr1-f52.google.com with SMTP id ffacd0b85a97d-3374eb61cbcso577478f8f.0 for ; Wed, 03 Jan 2024 08:19:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704298759; x=1704903559; 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=selIPiTBkoS5l1OMM3i9w0HzBJej2N34COzM6/N+NXw=; b=R/kL4X0TuZViqbCth7s4OVAa3mr2h0jHTHDMHYgWkquq6pbl3f1nU5D3JQ450UxFLf xhfNez88fb2TgyA0Yr6PKPQF+t81IuNuHYT107+2pD3PLNAFHqJeS0SnMgY0ed79yExL lNVBT++TDjCYA3WOUlqfFcc2s7GP94jzpEV0xOJNvjGbP0a8eqYSUJQtet57oVgeNdJC KJ0OXHfPkFVGzn06aoPzutMMt66xGNuEY2zrehR+RgQ0xMRK9fzMSaRuYE+J1rS/QLff 7927CNvu11Ses4Pa1/G9XVQBPBqNRT0A8yIchldWXGPxEC2cMMAUKJstUuKdtdoZXcWO 8wAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704298759; x=1704903559; 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=selIPiTBkoS5l1OMM3i9w0HzBJej2N34COzM6/N+NXw=; b=gfWwYFGJ1F1UDzChcqRidzvt5MQqUWzwJbnsBzEe/JvElbkd74xM5cVs67eyAVaXQg CTuoy/yVff56lwxWvXYbkNf/gSn1QYRUP/2JE3Xwl/DRmR3cevYKkY0UBZblgOoEchaa p/l45t8jsoQIVQOgrYErm8aHMdLo0Gr7lBTKdHyzkynYHT9QDo4jAoyDYfVswTSS1fH+ +xmIydyJeVAje/z0aQN81ir3KAormboKCA6l71EVfjvJx4EWw1+5JdfvxVc1v2Z8ZNct FyD28PS9IzFH71rgDLOqzefNo7AMwJOE0rGpnMEhyu8L5wYPezMO9qM6T4A7/BInej84 MLZg== X-Gm-Message-State: AOJu0YwUKuSl7ETkh4vHlcqWhiCzUcb+K0mWy/KIhs3U7+R4130zpcNW fgRB3k+3BZzQhTxsctKFLcbrDJ+ymkFliDJNpikrBDCW7XDsyA== X-Received: by 2002:a5d:4cc8:0:b0:336:95d2:c64a with SMTP id c8-20020a5d4cc8000000b0033695d2c64amr9871256wrt.130.1704298759433; Wed, 03 Jan 2024 08:19:19 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231228114157.104822-1-ulf.hansson@linaro.org> <20231228114157.104822-4-ulf.hansson@linaro.org> In-Reply-To: From: Mathieu Poirier Date: Wed, 3 Jan 2024 09:19:08 -0700 Message-ID: Subject: Re: [PATCH 3/5] remoteproc: imx_rproc: Convert to dev_pm_domain_attach|detach_list() To: Ulf Hansson Cc: "Rafael J . Wysocki" , Greg Kroah-Hartman , Viresh Kumar , linux-pm@vger.kernel.org, Sudeep Holla , Kevin Hilman , Konrad Dybcio , Bjorn Andersson , Nikunj Kela , Prasad Sodagudi , Stephan Gerhold , Ben Horgan , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-remoteproc@vger.kernel.org, linux-media@vger.kernel.org, Shawn Guo , Sascha Hauer Content-Type: text/plain; charset="UTF-8" On Wed, 3 Jan 2024 at 03:11, Ulf Hansson wrote: > > On Tue, 2 Jan 2024 at 19:41, Mathieu Poirier wrote: > > > > Hi Ulf, > > > > I'm in agreement with the modifications done to imx_rproc.c and imx_dsp_rproc.c. > > There is one thing I am ambivalent on, please see below. > > > > On Thu, Dec 28, 2023 at 12:41:55PM +0100, Ulf Hansson wrote: > > > Let's avoid the boilerplate code to manage the multiple PM domain case, by > > > converting into using dev_pm_domain_attach|detach_list(). > > > > > > Cc: Mathieu Poirier > > > Cc: Bjorn Andersson > > > Cc: Shawn Guo > > > Cc: Sascha Hauer > > > Cc: > > > Signed-off-by: Ulf Hansson > > > --- > > > drivers/remoteproc/imx_rproc.c | 73 +++++----------------------------- > > > 1 file changed, 9 insertions(+), 64 deletions(-) > > > > > > diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c > > > index 8bb293b9f327..3161f14442bc 100644 > > > --- a/drivers/remoteproc/imx_rproc.c > > > +++ b/drivers/remoteproc/imx_rproc.c > > > @@ -92,7 +92,6 @@ struct imx_rproc_mem { > > > > > > static int imx_rproc_xtr_mbox_init(struct rproc *rproc); > > > static void imx_rproc_free_mbox(struct rproc *rproc); > > > -static int imx_rproc_detach_pd(struct rproc *rproc); > > > > > > struct imx_rproc { > > > struct device *dev; > > > @@ -113,10 +112,8 @@ struct imx_rproc { > > > u32 rproc_pt; /* partition id */ > > > u32 rsrc_id; /* resource id */ > > > u32 entry; /* cpu start address */ > > > - int num_pd; > > > u32 core_index; > > > - struct device **pd_dev; > > > - struct device_link **pd_dev_link; > > > + struct dev_pm_domain_list *pd_list; > > > }; > > > > > > static const struct imx_rproc_att imx_rproc_att_imx93[] = { > > > @@ -853,7 +850,7 @@ static void imx_rproc_put_scu(struct rproc *rproc) > > > return; > > > > > > if (imx_sc_rm_is_resource_owned(priv->ipc_handle, priv->rsrc_id)) { > > > - imx_rproc_detach_pd(rproc); > > > + dev_pm_domain_detach_list(priv->pd_list); > > > return; > > > } > > > > > > @@ -880,72 +877,20 @@ static int imx_rproc_partition_notify(struct notifier_block *nb, > > > static int imx_rproc_attach_pd(struct imx_rproc *priv) > > > { > > > struct device *dev = priv->dev; > > > - int ret, i; > > > - > > > - /* > > > - * If there is only one power-domain entry, the platform driver framework > > > - * will handle it, no need handle it in this driver. > > > - */ > > > - priv->num_pd = of_count_phandle_with_args(dev->of_node, "power-domains", > > > - "#power-domain-cells"); > > > - if (priv->num_pd <= 1) > > > - return 0; > > > > In function dev_pm_domain_attach_list(), this condition is "<= 0" rather than > > "<= 1". As such the association between the device and power domain will be > > done twice when there is a single power domain, i.e once by the core and once in > > dev_pm_domain_attach_list(). > > > > I am assuming the runtime PM subsystem is smart enough to deal with this kind of > > situation but would like a confirmation. > > Thanks for reviewing! > > To cover the the single PM domain case, imx_rproc_attach_pd() is > returning 0 when dev->pm_domain has been assigned. Moreover, > dev_pm_domain_attach_list() doesn't allow attaching in the single PM > domain case, as it returns -EEXIST if "dev->pm_domain" is already > assigned. > > Did that make sense to you? > Ah yes! The correlation between dev->pm_domain and the magic done by the core framework was lost on me. Once you respin to address Nikunj's comment I will ask the NXP team in Romania to test this set. With the holiday season still floating in the air it may take a little while for them to get to it. > [...] > > Kind regards > Uffe