Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp443279ybi; Fri, 26 Jul 2019 12:26:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqysUchiCU02y53rUdncEfA+50wo5Ka55o6XMz9WwKhL9TvVSbZqdy/AUsjg+JwKal0/iKZ9 X-Received: by 2002:a63:dd0b:: with SMTP id t11mr52551326pgg.410.1564169186431; Fri, 26 Jul 2019 12:26:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564169186; cv=none; d=google.com; s=arc-20160816; b=mqyVou6oAOtzNzw4CKDcMv9yZBIyaBXXZtQl7arTutNKBX9qHBrl48S1DHuGzexXrX Q0Ss4kPs1G753qUPzLg5F6W2J+VDgh3FADNLaKu1U28pvzMljGBhEV9B/W6XeSYlN8gu nEVXWezavR+8kTSO52eibtlFFUJQ/wjMftH5xGw/fXkFArKgXdbpQiln3KZDeiTtzw80 Kb8eOJ1X+Wsix2IlJ8egDCiFVnz5GqSs0Eoie8w2XIi3HNuRHajj0CpIrMyW1oxlfEKk Xgu4iOBEybZXnMlFIu/yUuej3gQR/ii0ZQCpVkYLfIr5yio3bft85wtpIiIM2S3qwQ+F vN7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:date:message-id:autocrypt :openpgp:from:references:cc:to:subject:dkim-signature; bh=jJr+mv+3Bku2kcxf6e7N0HYCTZd2RY5/zWLci9WVBdY=; b=cy92JNlEItn2ExJlazwQlRObsbf7MrFhAQ5yNNpcHhkcSC72J1ni5ehU9ThA+QVVVM XXbx3A22aWlhBUX8bdOpMCzYK/cze1NrpldrIITYJh4smbvQjnRt+JnW1RRVOIj4zV4n 0YDANy+HDBYHXA2Rk114u1UJLH4mVSwkQs4pfZj3HV8WJn7wFlyZ1GA3vqIwHhoXsV6I Caz1FueESmTkbpn0tNj7FD4UqLgSvBJxwD/SERmP5oT753XFmjZrsbMVjLhzr+HSQLHZ LO3puqEGmXljLM9Uiwzyqw0rSdHa2w54LSZc72+b3orDssj2BzXS1QZOjQ7B0fFCYqlt nhCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FMr7HUFn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z24si21532017plo.159.2019.07.26.12.26.11; Fri, 26 Jul 2019 12:26:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FMr7HUFn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728678AbfGZQZN (ORCPT + 99 others); Fri, 26 Jul 2019 12:25:13 -0400 Received: from mail-lf1-f68.google.com ([209.85.167.68]:44137 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728340AbfGZQZM (ORCPT ); Fri, 26 Jul 2019 12:25:12 -0400 Received: by mail-lf1-f68.google.com with SMTP id r15so20477217lfm.11 for ; Fri, 26 Jul 2019 09:25:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:openpgp:autocrypt:message-id:date :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=jJr+mv+3Bku2kcxf6e7N0HYCTZd2RY5/zWLci9WVBdY=; b=FMr7HUFndh/+mlDCOhrYAubF+h/5Wh04nOfHpjDKkgiz7k+J82TnFn/DYzZJooHjQK Y8GOVxxSt61fAe4fGOSexE7oS3DDozGg7r/3YxG7QVqtlBf/sm3FvNbtHQjcYN0ioi+P seUeVr3PsyvcFU1IhqG0dGtpx2L9/lRkU/jFJuVaCNADmPB5PUjTd0uyfpwxCjR9c2XB R/CP2v9+fC8b9yK7DsRN0K1omvxBnipsLsaQhu5YN1Zvxn4aDM593UxnLhMrIruCn2gu MS722OBFU+z0BwbnCK+ab8XxDLFLBZm1mPLtC0pH/aZxci26KUfkNxFqDPfpOAJR2SU3 KnRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:autocrypt :message-id:date:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=jJr+mv+3Bku2kcxf6e7N0HYCTZd2RY5/zWLci9WVBdY=; b=uYFZLV9BqgRmBk8ZTGEhMq38d0IkN3gmHuoL81DgDinXU5UFIgmGdQZwCaz7bAt+ZH TwGY7CjDd2nMtO24U41hJT9cb0WtAOCw0LWe2PGFxwXhADDIHrlbyyas3TSmxTkiDZ/r xR5T7X142ePtpfFHJbcCgC5jI5gMa4HGwVvg9T6T8mEsXpCPn/fAUcJ52MUV5E6NbNp9 k4nJq1fzqslm2cjcKBsBmyotYG8TfdSM408wm7a04zdbsbTfGwAm789A6LvH2rhET/g5 H3LYJruqpYxeaDe6xIVzcXF97ygB0FCW8dz1P2DIL4KVcrblhONhsUUH21BkAD1hLVI/ MmQw== X-Gm-Message-State: APjAAAW/lqMMG6+Di8UQ6lNMIPedWT+818Z3cBEl+7Jgka+5dsNBRq9+ 1SxBki3yTjb0WSbzhIblcP/mJtnzwcM= X-Received: by 2002:a19:c1cc:: with SMTP id r195mr43881045lff.95.1564158309555; Fri, 26 Jul 2019 09:25:09 -0700 (PDT) Received: from [10.44.66.8] ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id i9sm8563026lfl.10.2019.07.26.09.25.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Jul 2019 09:25:09 -0700 (PDT) Subject: Re: [PATCH v3 6/6] interconnect: Add OPP table support for interconnects To: Saravana Kannan , Rob Herring , Mark Rutland , Viresh Kumar , Nishanth Menon , Stephen Boyd , "Rafael J. Wysocki" Cc: vincent.guittot@linaro.org, seansw@qti.qualcomm.com, daidavid1@codeaurora.org, Rajendra Nayak , sibis@codeaurora.org, bjorn.andersson@linaro.org, evgreen@chromium.org, kernel-team@android.com, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org References: <20190703011020.151615-1-saravanak@google.com> <20190703011020.151615-7-saravanak@google.com> From: Georgi Djakov Openpgp: preference=signencrypt Autocrypt: addr=georgi.djakov@linaro.org; prefer-encrypt=mutual; keydata= mQINBFjTuRcBEACyAOVzghvyN19Sa/Nit4LPBWkICi5W20p6bwiZvdjhtuh50H5q4ktyxJtp 1+s8dMSa/j58hAWhrc2SNL3fttOCo+MM1bQWwe8uMBQJP4swgXf5ZUYkSssQlXxGKqBSbWLB uFHOOBTzaQBaNgsdXo+mQ1h8UCgM0zQOmbs2ort8aHnH2i65oLs5/Xgv/Qivde/FcFtvEFaL 0TZ7odM67u+M32VetH5nBVPESmnEDjRBPw/DOPhFBPXtal53ZFiiRr6Bm1qKVu3dOEYXHHDt nF13gB+vBZ6x5pjl02NUEucSHQiuCc2Aaavo6xnuBc3lnd4z/xk6GLBqFP3P/eJ56eJv4d0B 0LLgQ7c1T3fU4/5NDRRCnyk6HJ5+HSxD4KVuluj0jnXW4CKzFkKaTxOp7jE6ZD/9Sh74DM8v etN8uwDjtYsM07I3Szlh/I+iThxe/4zVtUQsvgXjwuoOOBWWc4m4KKg+W4zm8bSCqrd1DUgL f67WiEZgvN7tPXEzi84zT1PiUOM98dOnmREIamSpKOKFereIrKX2IcnZn8jyyc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0vdphTnsdA7h01MliZLQ2lLL2Mt5lsqU+6sup Tfql1omgEpjnFsPsyFebzcKGbdEr6vySGa3Cof+miX06hQXKe99a5+eHNhtZJcMAIO89wZmj 7ayYJIXFqjl/X0KBcCbiAl4vbdBw1bqFnO4zd1lMXKVoa29UHqby4MPbQhjWNVv9kqp8A39+ E9xw890l1xdERkjVKX6IEJu2hf7X3MMl9tOjBK6MvdOUxvh1bNNmXh7OlBL1MpJYY/ydIm3B KEmKjLDvB0pePJkdTw== Message-ID: Date: Fri, 26 Jul 2019 19:25:06 +0300 MIME-Version: 1.0 In-Reply-To: <20190703011020.151615-7-saravanak@google.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Saravana, On 7/3/19 04:10, Saravana Kannan wrote: > Interconnect paths can have different performance points. Now that OPP > framework supports bandwidth OPP tables, add OPP table support for > interconnects. > > Devices can use the interconnect-opp-table DT property to specify OPP > tables for interconnect paths. And the driver can obtain the OPP table for > an interconnect path by calling icc_get_opp_table(). > > Signed-off-by: Saravana Kannan > --- > drivers/interconnect/core.c | 27 ++++++++++++++++++++++++++- > include/linux/interconnect.h | 7 +++++++ > 2 files changed, 33 insertions(+), 1 deletion(-) > > diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c > index 871eb4bc4efc..881bac80bc1e 100644 > --- a/drivers/interconnect/core.c > +++ b/drivers/interconnect/core.c > @@ -47,6 +47,7 @@ struct icc_req { > */ > struct icc_path { > size_t num_nodes; > + struct opp_table *opp_table; I am a bit worried that these tables might be abused and size of the DT will grow with many OPP tables of all existing paths. > struct icc_req reqs[]; > }; > > @@ -313,7 +314,7 @@ struct icc_path *of_icc_get(struct device *dev, const char *name) > { > struct icc_path *path = ERR_PTR(-EPROBE_DEFER); > struct icc_node *src_node, *dst_node; > - struct device_node *np = NULL; > + struct device_node *np = NULL, *opp_node; > struct of_phandle_args src_args, dst_args; > int idx = 0; > int ret; > @@ -381,10 +382,34 @@ struct icc_path *of_icc_get(struct device *dev, const char *name) > dev_err(dev, "%s: invalid path=%ld\n", __func__, PTR_ERR(path)); > mutex_unlock(&icc_lock); > > + opp_node = of_parse_phandle(np, "interconnect-opp-table", idx); Can't we figure out if the device OPP table contains bandwidth even without this property? Thanks, Georgi > + if (opp_node) { > + path->opp_table = dev_pm_opp_of_find_table_from_node(opp_node); > + of_node_put(opp_node); > + } > + > + > return path; > } > EXPORT_SYMBOL_GPL(of_icc_get); > > +/** > + * icc_get_opp_table() - Get the OPP table that corresponds to a path > + * @path: reference to the path returned by icc_get() > + * > + * This function will return the OPP table that corresponds to a path handle. > + * If the interconnect API is disabled, NULL is returned and the consumer > + * drivers will still build. Drivers are free to handle this specifically, but > + * they don't have to. > + * > + * Return: opp_table pointer on success. NULL is returned when the API is > + * disabled or the OPP table is missing. > + */ > +struct opp_table *icc_get_opp_table(struct icc_path *path) > +{ > + return path->opp_table; > +} > + > /** > * icc_set_bw() - set bandwidth constraints on an interconnect path > * @path: reference to the path returned by icc_get() > diff --git a/include/linux/interconnect.h b/include/linux/interconnect.h > index dc25864755ba..0c0bc55f0e89 100644 > --- a/include/linux/interconnect.h > +++ b/include/linux/interconnect.h > @@ -9,6 +9,7 @@ > > #include > #include > +#include > > /* macros for converting to icc units */ > #define Bps_to_icc(x) ((x) / 1000) > @@ -28,6 +29,7 @@ struct device; > struct icc_path *icc_get(struct device *dev, const int src_id, > const int dst_id); > struct icc_path *of_icc_get(struct device *dev, const char *name); > +struct opp_table *icc_get_opp_table(struct icc_path *path); > void icc_put(struct icc_path *path); > int icc_set_bw(struct icc_path *path, u32 avg_bw, u32 peak_bw); > > @@ -49,6 +51,11 @@ static inline void icc_put(struct icc_path *path) > { > } > > +static inline struct opp_table *icc_get_opp_table(struct icc_path *path) > +{ > + return NULL; > +} > + > static inline int icc_set_bw(struct icc_path *path, u32 avg_bw, u32 peak_bw) > { > return 0; >