Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp481928ybi; Tue, 2 Jul 2019 23:46:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqwtTOOobs3QZ0iatWpLD0I5KR0/zvkw8HQ3NjCxepAG2T0OHOsiQy8D21BbUDreJTB2f1+z X-Received: by 2002:a63:7887:: with SMTP id t129mr4031059pgc.309.1562136377593; Tue, 02 Jul 2019 23:46:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562136377; cv=none; d=google.com; s=arc-20160816; b=hcObMK8kniaXTp/+Sfq64mRgsxuzy6q4ideMqUZAgdllLCMJP4xw2hdXgrb5ViM6rz H3e2UgG5t703Yid87E9W3lICuKN0Haay4xkiBVCCnqE51KUOnAGjG7ruClSsAG6pv6qM rh+ophXuqP7Mf/YaQoxCSqgZ60Q1Iq9FymhRqgMyGoV8hKB8/ESLfa/2ksxejvbXkxeu B2ve1cJPqvX9uhKqaFf7HVbKsE8OPVZYZXLeOQy++EQ3/8FcEZIzOs/6uKDDu+5xNufx 5OC+MHdGTSPQ+rrD8aXbY61vX3kuvIuiUjdE1qPefjGV7neaElvNvanz4q2xK7redTEA VQpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=ptGTicjFq+J0eTU/VpcxUsmOsp/qaZSNFW8K0GR+TOs=; b=bZMpj83/6tX3K4WB0kUf48d4Wwloe2ME/87lCde14TyYEX5rypuNEjfnD/Vxq/U7s9 yq1JUrZaV0M9XDiLHEw79vdCCIBWfikMvfv5+9fROmxke0xS17FpLXP4G83gg1YPCpwL ZVao38Pb6kE+uzLLGO5ozNJc6/D3D3Hsnb80aY/2yFNELOQQUSG/rlPogoT7J9S1XoVG Q4r8CY6cwsK1TVs9s+V9tghCoJlprU/Q5RJeAwJotUq5JzZnvWyaFJHjttR81D8VYIwr 4i7D3Rm1Liy2LaVgeFWnq2qdlN/hyNyikfhBInAMbKLzPJ/ComZQ096Ht0S5QtsYH4bR Effw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kWifykzp; 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 p13si1387153plo.33.2019.07.02.23.46.01; Tue, 02 Jul 2019 23:46:17 -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=kWifykzp; 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 S1727012AbfGCGpg (ORCPT + 99 others); Wed, 3 Jul 2019 02:45:36 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:42610 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726327AbfGCGpf (ORCPT ); Wed, 3 Jul 2019 02:45:35 -0400 Received: by mail-lj1-f195.google.com with SMTP id t28so1109937lje.9 for ; Tue, 02 Jul 2019 23:45:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ptGTicjFq+J0eTU/VpcxUsmOsp/qaZSNFW8K0GR+TOs=; b=kWifykzpZN5anpXIiQ4YGdylV33AXUn4GyrE0mtZQ50+vZthGp8hOmYzwGAaFUTju/ 5DmP+TbKSdayBm2W4adywOLUqzuZv2ldPWrpFcUc4oUr3uWIG3tC+oZTIkunY+1HI1Hl I1LQvdxcJEK8TZC4EfOOfwVqjWewrJJyUAnEEkVRYxoLxXdcpyXqjkmtbEey0c/oLSF2 jKAMFREDiyC4VRZyQ953d3IohkmgbTG+O9rdLN0dQ9j0FdaOld5pnEPn7H244FRBQqSG L+PpuwWTK0rCWmAI9TRp9eK8EdXAcfnU0FIvWnEFru9hwMQ/DxDvqRt1Ut4VJOFn6hnC hJ4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ptGTicjFq+J0eTU/VpcxUsmOsp/qaZSNFW8K0GR+TOs=; b=cLoE0HKO9me1l70eZYdju+v5x6V9mRIW4zRXRIDHG0uwY0njqWJfbP/ZqvbFa79lGX AZTIdyikTe8WYD+G7z0KoLlpM7GprzIE/56j/Hkd0Mz6+LMWkh7L6RdnNjVZeizmJpVC QTc/X5AUG/XlYbbAQpSHnBK/WbA7agUkEiuZ4uO/NhxHw15Sp2444rmeQ3yr1t9k/sbL QROdC00hpsoel+mbVvWQu8ivtdjUkZDUzO4TS3PBki/HvaxOtuVlqCQCqLGNIPbVm37v gIfDHjbxK8Ut3pyldxy9pUbbdoyAxir/0Ym5w4scL3+I9iPw3MHlEq9F6c2Fna48vW2G XUWQ== X-Gm-Message-State: APjAAAUcKe5mvjCUYqsyr6ETLgKXZfwfmgdHjS81vjHasfi2g8W2gdf7 dnFkHZ8QDzuSiASzkSZQysBFz8q1dHw1Af6Go/wNrw== X-Received: by 2002:a2e:2e18:: with SMTP id u24mr13211024lju.204.1562136332739; Tue, 02 Jul 2019 23:45:32 -0700 (PDT) MIME-Version: 1.0 References: <20190703011020.151615-1-saravanak@google.com> <20190703011020.151615-7-saravanak@google.com> In-Reply-To: <20190703011020.151615-7-saravanak@google.com> From: Vincent Guittot Date: Wed, 3 Jul 2019 08:45:21 +0200 Message-ID: Subject: Re: [PATCH v3 6/6] interconnect: Add OPP table support for interconnects To: Saravana Kannan Cc: Georgi Djakov , Rob Herring , Mark Rutland , Viresh Kumar , Nishanth Menon , Stephen Boyd , "Rafael J. Wysocki" , "Sweeney, Sean" , daidavid1@codeaurora.org, Rajendra Nayak , sibis@codeaurora.org, Bjorn Andersson , Evan Green , kernel-team@android.com, "open list:THERMAL" , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , linux-kernel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 3 Jul 2019 at 03: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(). The opp table of a path must come from the aggregation of OPP tables of the interconnect providers. So such kind of OPP table should be at provider level but not at path level. > > 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; > 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); > + 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; > -- > 2.22.0.410.gd8fdbe21b5-goog >