Received: by 2002:a05:7412:8d09:b0:fa:4c10:6cad with SMTP id bj9csp13602rdb; Mon, 15 Jan 2024 10:14:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IG1nfB4w/Eoc3O8vCyGlROjQT2iOWWYniacPe+zWI4hNc3j0mSpetzTEbdWnQX5kuKP4Z3U X-Received: by 2002:a05:6a00:230b:b0:6d9:bd63:e3e5 with SMTP id h11-20020a056a00230b00b006d9bd63e3e5mr8394280pfh.26.1705342493921; Mon, 15 Jan 2024 10:14:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705342493; cv=none; d=google.com; s=arc-20160816; b=bsijkgOt37KrU6OENROAU8ffHYDtMNrLyB78wgFrljaFOrC40wa0rGeTxn/94xoJtN 8Y5vIJdgYn+i3EUEu7DZDlUObHWKwvR3VyCPkjTqTA4m7f7jR6hM8i5zwkq0hjsB63gu zLJJvOuWPAb4q8Le1Gn0HcX6ubtoZ+Ycku5vhem+CqrUm3k+KOSkqu6ZmPSu06KQ9afq YdZ9sYCRqhoyRt1AkSLRDNp24oxvLLDGCBsrKQ7DYCY8SKyvrofyopsDfz3b6i3Z/0ic 9L5gREb+FttWNHKmx2Ad8NiHJ1ZSMx+xc+8HAK+mpol5lCVi0bycAzi5HzIswvg+TMXl QHkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=YBn2qZQx8P3zg2r39V5+2Dh28lfRonfO6AcXOPJi0eo=; fh=17iLRIoeo90AT/bkiaoRP+xgMjHSLU/xQEk/DQ9ERVw=; b=K+8/iIn2ndvxAb96ztAsvQts6qqORVbBpUWzekB8XZSUiP/77aqsiUqIL5YBSN+LJf yPylPBOYBzNnzWIjdOjOpll/gbNt5WvqT580VxWtM/95K000YNC2qs4Z7rdr99CFO3Uv q1V8X80aTi7w6j34DnMIakDtYxEmse1LB0yDc9kdbb8VgHNc0tiRlVee3xjr/qhFOvQK oOmpZO+mBxJI2g5Rw+P3F+nLuOLGAB93Z/A4Oxn5vQfJY5Qc7mmAd5szYS+7Z88wsPVQ CwX8u8husZljdcK6r4+AlIKBoS92dJMINLwdaI8v28tad0VsiYp5u8EGE8DVdqgQrDdV 5hdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Z3xN0lJg; spf=pass (google.com: domain of linux-kernel+bounces-26354-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26354-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id h22-20020a635316000000b005cda5e4a862si9500623pgb.258.2024.01.15.10.14.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 10:14:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-26354-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Z3xN0lJg; spf=pass (google.com: domain of linux-kernel+bounces-26354-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26354-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id C58FDB21B3B for ; Mon, 15 Jan 2024 18:14:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F40E0182B5; Mon, 15 Jan 2024 18:14:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Z3xN0lJg" Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) (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 2FBFD1802F for ; Mon, 15 Jan 2024 18:14:24 +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-pf1-f171.google.com with SMTP id d2e1a72fcca58-6db0c49e93eso6192279b3a.1 for ; Mon, 15 Jan 2024 10:14:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1705342463; x=1705947263; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=YBn2qZQx8P3zg2r39V5+2Dh28lfRonfO6AcXOPJi0eo=; b=Z3xN0lJgoMpkO7ZmWQWssNERIlWY/LH1cbKdVjbqumPdwcFgGfR6CrSozF90Ub0YrZ noGdHjoPd4sUouvD9veEsjJWKeXlLJWIdTP2R8DuZWWGDKHBnTOP/67SmPCZN4xeSa+E h1gQTnzJh6o6XrHW493lsywTl3FHNd+youIwd5px/QZMH0o4ohGtD2YBUvG7wzcflSFM 9jzvGcnmpL8eplLFjgTsP8VlIGhycspNS/vH+F1RUi4MuE6/MDJqlyjbjHiZJ+DCQ9jr JdDQb81joMFiIdqhNpzAETy1lTwCamZd/G1sX8eiWLm6GpYaP40gZOGOZnH7HSRl1M8W CyHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705342463; x=1705947263; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=YBn2qZQx8P3zg2r39V5+2Dh28lfRonfO6AcXOPJi0eo=; b=UT18S2YxzkVQD2EA50LGygtz5i5aHaMXW3+S8zz2HXzReK6rH2wscAbQNhDEVklEUI S7gpcgLfLmtY76nzL63xkwLU2Ze2GpH4IdFE4e2jMJVMBoUFHfRjL16PDLN2itqF2AM5 fKGGuQX7Ff0iqexFE2xXoDa7Yt7Udx7u4+ADLhE0h/vgZ/pvQs+CGMwlRtLquOCj9knZ 1HCoFyAbZBDLfDpN2hhxn7gWpGWL9950PFbDp7FxCjqWcjZECyRoxrEmH7+fXQseCGM7 c7Fa2SGju6KuCFjxl8sg/Zg7aJuyeAPeN/JLuCTXcbmLCufP8tu8A8lbYNbY/pjkteYF Q8UA== X-Gm-Message-State: AOJu0Yw3icKgF/TyD9gj2DjCTb301c9aV8y03gm5rZrfuHokC/3tFFZA OETXNuS3cM54RuPatPsYc+HGhKMcCDnh+lVHtEyN2kcqDTs= X-Received: by 2002:a05:6a20:9c89:b0:19b:2303:88a4 with SMTP id mj9-20020a056a209c8900b0019b230388a4mr731854pzb.105.1705342463524; Mon, 15 Jan 2024 10:14:23 -0800 (PST) Received: from p14s ([2604:3d09:148c:c800::5ced]) by smtp.gmail.com with ESMTPSA id lc18-20020a056a004f5200b006d9cf4b56edsm8116673pfb.175.2024.01.15.10.14.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 10:14:23 -0800 (PST) Date: Mon, 15 Jan 2024 11:14:20 -0700 From: Mathieu Poirier To: Tanmay Shah Cc: andersson@kernel.org, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, Ben Levinsky Subject: Re: [PATCH v4 1/2] remoteproc: Make rproc_get_by_phandle() work for clusters Message-ID: References: <20240103221124.3063683-1-tanmay.shah@amd.com> <20240103221124.3063683-2-tanmay.shah@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240103221124.3063683-2-tanmay.shah@amd.com> Hi Tanmay, Thanks for the refactoring, this is in line with what Bjorn and I have talked about at Plumbers. Please see my comments below. On Wed, Jan 03, 2024 at 02:11:24PM -0800, Tanmay Shah wrote: > From: Mathieu Poirier > > Multi-cluster remoteproc designs typically have the following DT > declaration: > > remoteproc_cluster { > compatible = "soc,remoteproc-cluster"; > > core0: core0 { > compatible = "soc,remoteproc-core" > memory-region; > sram; > }; > > core1: core1 { > compatible = "soc,remoteproc-core" > memory-region; > sram; > } > }; > > A driver exists for the cluster rather than the individual cores > themselves so that operation mode and HW specific configurations > applicable to the cluster can be made. > > Because the driver exists at the cluster level and not the individual > core level, function rproc_get_by_phandle() fails to return the > remoteproc associated with the phandled it is called for. > > This patch enhances rproc_get_by_phandle() by looking for the cluster's > driver when the driver for the immediate remoteproc's parent is not > found. > > Reported-by: Ben Levinsky > Signed-off-by: Mathieu Poirier Humm... You wrote the code in this patch so you also deserve some credit. If I end up applying this set I will add myself as a co-developer, i.e Co-developed-by:, and add your SoB. If you end up re-spinning this set then simply do so for the next revision. As far as I am concerned this patchset is ready. I will wait to see if other people would like to see something adjusted. Mathieu > --- > drivers/remoteproc/remoteproc_core.c | 23 ++++++++++++++++++++++- > 1 file changed, 22 insertions(+), 1 deletion(-) > > diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c > index 695cce218e8c..0b3b34085e2f 100644 > --- a/drivers/remoteproc/remoteproc_core.c > +++ b/drivers/remoteproc/remoteproc_core.c > @@ -33,6 +33,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -2112,6 +2113,7 @@ EXPORT_SYMBOL(rproc_detach); > struct rproc *rproc_get_by_phandle(phandle phandle) > { > struct rproc *rproc = NULL, *r; > + struct device_driver *driver; > struct device_node *np; > > np = of_find_node_by_phandle(phandle); > @@ -2122,7 +2124,26 @@ struct rproc *rproc_get_by_phandle(phandle phandle) > list_for_each_entry_rcu(r, &rproc_list, node) { > if (r->dev.parent && device_match_of_node(r->dev.parent, np)) { > /* prevent underlying implementation from being removed */ > - if (!try_module_get(r->dev.parent->driver->owner)) { > + > + /* > + * If the remoteproc's parent has a driver, the > + * remoteproc is not part of a cluster and we can use > + * that driver. > + */ > + driver = r->dev.parent->driver; > + > + /* > + * If the remoteproc's parent does not have a driver, > + * look for the driver associated with the cluster. > + */ > + if (!driver) { > + if (r->dev.parent->parent) > + driver = r->dev.parent->parent->driver; > + if (!driver) > + break; > + } > + > + if (!try_module_get(driver->owner)) { > dev_err(&r->dev, "can't get owner\n"); > break; > } > -- > 2.25.1 >