From patchwork Fri Mar 9 21:09:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 131249 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp1455503lja; Fri, 9 Mar 2018 13:10:12 -0800 (PST) X-Google-Smtp-Source: AG47ELvNL0fk34kh84HKUfvDDJjpdc1HQSBhaAAx0x2Pjz1OkDuE6vU3T98QBgGaMZuG7cIOTe1a X-Received: by 2002:a17:902:e65:: with SMTP id 92-v6mr28993143plw.268.1520629812722; Fri, 09 Mar 2018 13:10:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520629812; cv=none; d=google.com; s=arc-20160816; b=lCYSyvX6yaZ5AW0ox+fhmoKDdesQq4hGciR2XVDlt7hCa+bvaQT2DJRSHuvlTEJeq/ BuWIq/nTSJFBnoOsQ1xa5eAsakD6UjT2gEC9DA85NqE7PtzXATJ8y1YO7RoB/pE25m9y wtTONQ0vYnR8yozXrsb1jl1wFzX9wccqB8dMToYvR1CCzTFBE0fi/DZ2L8z4KSVB8Wjr Js4ugcpO7eRpEb+qhNxX25oQBjPNKWQdRD+ksNHZuxHPA5n5jfkm1sFIITRGc/cGzzoE 7QHdbvGo0faIUF9GhYljDDkW4AJQtfYHASzLACHr5ZSueY2p0wXbTwe8BXEROrFYrWEb h6hQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=FjToud1To/Jn0KBnNNWoitZU5JVa+yb/E9xgoENcX2I=; b=Wv+Y/3HoE0Zt6vXW/+MZWWEnS5IX3A7tP5MdIqH+NYJ/4tT5JZDHsdUv0xxW8WHBrp 0bvDqfgTlxczEIKj8TNnPvX4FKU5P9f2pFvnHcQTbVDh4GQLe9RgZ/CmoD5l+oqUCX9l QJdvB0rgeSYZ4lkpe58Lb+WT1hvE2OUP7frzhOoZ1SPNLtP/8GDHbqcf0POD73pmmb2H Oef1VziG2cb2x257ekYa3bzVifxuquWu5esYhMB50e8fgNC87tFpgNt6GhpROYDb0vzr SN0pLmrKSLOIRd2i68wEkT2sjedMIe0BCxonqDENYwrz2DC1pWpXL7C3heTBROaoBCVu 3+8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ByBvWMEv; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (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 b7si1249058pgv.425.2018.03.09.13.10.12; Fri, 09 Mar 2018 13:10:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ByBvWMEv; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932320AbeCIVKJ (ORCPT + 10 others); Fri, 9 Mar 2018 16:10:09 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:38232 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932580AbeCIVKH (ORCPT ); Fri, 9 Mar 2018 16:10:07 -0500 Received: by mail-wm0-f65.google.com with SMTP id z9so6158283wmb.3 for ; Fri, 09 Mar 2018 13:10:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7dJ61Js48E3Ds72/6TrlMw7o9MrSnzRN7XqpAPjyplI=; b=ByBvWMEv6jkBaLBDCmQsqMpse+XK3F3FWzkpacS/p3TAg9YB38+NNKpojKHX/sQKwW GvC+KwEwGPLDwvkY88hmdghsZEI2wm1qKhhWpsNVnvPcjphFlwYjcReOnkPHz0za/JUT 2XboQ5s9IyP/CFSYM9KlkNaYWA5OLa+ep9VAs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7dJ61Js48E3Ds72/6TrlMw7o9MrSnzRN7XqpAPjyplI=; b=YrJhU1KP1EzEmLv2FHJGsIUuRQqBZIWy5/D9OMAN7C1+x4C8bdwaKEEF4HdRJCoDv8 XrmVircoIWmYpPEaBHFYzZWZfdhxmnFggsFGgJTwFFniJjtMl6iabtXIDryNIFPcGbPD y0RL3NIRGcgVk7CZmw7iueaJam6uHhsukThdzws+JRoMMEqhECfRktrA2Cps1po+Jr8f ZgWRjJlG02O/LiI1+qhYysci/FH6m/MHUlac12jlj9z0ybftrlqpbz1RN/8RPhneXt5F GfjRt0IUsNFnjRmH5zK0515AnGHKzgVBQ+aaNFv0fL9Abrp6TAgCv8Mzcyzzy2MBJM9y axqg== X-Gm-Message-State: AElRT7E2VBbbg4tdEls07YXMc6MCiZwDpsTyxEqGBqPfgbmae7ZlTWpY bXToTK3p2SGxWFvZ8CngV5S41Q== X-Received: by 10.28.109.78 with SMTP id i75mr179107wmc.61.1520629806021; Fri, 09 Mar 2018 13:10:06 -0800 (PST) Received: from mms-0441.qualcomm.mm-sol.com ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id g7sm1853118wrb.78.2018.03.09.13.10.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Mar 2018 13:10:05 -0800 (PST) From: Georgi Djakov To: linux-pm@vger.kernel.org, gregkh@linuxfoundation.org Cc: rjw@rjwysocki.net, robh+dt@kernel.org, mturquette@baylibre.com, khilman@baylibre.com, vincent.guittot@linaro.org, skannan@codeaurora.org, bjorn.andersson@linaro.org, amit.kucheria@linaro.org, seansw@qti.qualcomm.com, davidai@quicinc.com, mark.rutland@arm.com, lorenzo.pieralisi@arm.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, georgi.djakov@linaro.org Subject: [PATCH v4 3/7] interconnect: Add debugfs support Date: Fri, 9 Mar 2018 23:09:54 +0200 Message-Id: <20180309210958.16672-4-georgi.djakov@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180309210958.16672-1-georgi.djakov@linaro.org> References: <20180309210958.16672-1-georgi.djakov@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Add a functionality to provide information about the current constraints per each node and provider. Signed-off-by: Georgi Djakov --- drivers/interconnect/core.c | 70 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c index 6306e258b9b9..a06f752a6aaa 100644 --- a/drivers/interconnect/core.c +++ b/drivers/interconnect/core.c @@ -6,6 +6,7 @@ * Author: Georgi Djakov */ +#include #include #include #include @@ -15,11 +16,13 @@ #include #include #include +#include static DEFINE_IDR(icc_idr); static LIST_HEAD(icc_provider_list); static DEFINE_MUTEX(icc_provider_list_mutex); static DEFINE_MUTEX(icc_path_mutex); +static struct dentry *icc_debugfs_dir; /** * struct icc_req - constraints that are attached to each node @@ -46,6 +49,73 @@ struct icc_path { struct icc_req reqs[0]; }; +#ifdef CONFIG_DEBUG_FS + +static void icc_summary_show_one(struct seq_file *s, struct icc_node *n) +{ + if (!n) + return; + + seq_printf(s, "%-30s %12d %12d\n", + n->name, n->avg_bw, n->peak_bw); +} + +static int icc_summary_show(struct seq_file *s, void *data) +{ + struct icc_provider *provider; + + seq_puts(s, " node avg peak\n"); + seq_puts(s, "--------------------------------------------------------\n"); + + mutex_lock(&icc_provider_list_mutex); + + list_for_each_entry(provider, &icc_provider_list, provider_list) { + struct icc_node *n; + + mutex_lock(&provider->lock); + list_for_each_entry(n, &provider->nodes, node_list) { + icc_summary_show_one(s, n); + } + mutex_unlock(&provider->lock); + } + + mutex_unlock(&icc_provider_list_mutex); + + return 0; +} + +static int icc_summary_open(struct inode *inode, struct file *file) +{ + return single_open(file, icc_summary_show, inode->i_private); +} + +static const struct file_operations icc_summary_fops = { + .open = icc_summary_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + +static int __init icc_debugfs_init(void) +{ + struct dentry *file; + + icc_debugfs_dir = debugfs_create_dir("interconnect", NULL); + if (!icc_debugfs_dir) { + pr_err("interconnect: error creating debugfs directory\n"); + return -ENODEV; + } + + file = debugfs_create_file("interconnect_summary", 0444, + icc_debugfs_dir, NULL, &icc_summary_fops); + if (!file) + return -ENODEV; + + return 0; +} +late_initcall(icc_debugfs_init); +#endif + static struct icc_node *node_find(const int id) { struct icc_node *node; From patchwork Fri Mar 9 21:09:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 131253 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp1455715lja; Fri, 9 Mar 2018 13:10:23 -0800 (PST) X-Google-Smtp-Source: AG47ELvCUsEGPtvIAvzziH8KaIKvOtt7StR8tdMDRlzBsZgbngjPmyjezS7VgK9+1XuRSxW6n3QV X-Received: by 2002:a17:902:7290:: with SMTP id d16-v6mr28963893pll.31.1520629823791; Fri, 09 Mar 2018 13:10:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520629823; cv=none; d=google.com; s=arc-20160816; b=xgGCvf0/eYLqmyV0RX8fL/eEZd5RvowGl55coBLR/K3Vuf+Pj1v2273vlbqiM7SlQN bzEJtKmsTMo/C/eWO0hTkQDizlOZlOs0w68Lmaq0cIK4fZqCNgHXyWFgfJnLJq3b4hCF MTgb419BlAUSw8Sma/Tl/XaAhhhY7QTVamiTHl5SmA9w9eVQfKg+sLqfTgLbCO9XC+NK 7K0UvwNriSOFavjIUjDPLe34l+V+BmEuZHkMNYRnaCFzbqjucJgyxDwoInoMQF3x5pFx ZbOZPCC4Us2YivRQ5ov+xXSQ0BCBY/KGLJyQpJl3PiVdfIv29gztRT6PAmYh945CCpT1 Bf2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=PfprGdt6P4uSbpgw4t5pyaAwr2IR7Kg0L9cn3W82/QU=; b=NC37zcZUbC/++qUImvLfQfeUs3qYflgzxHslwrs22Op76ORiLyFjZ231Fojo71KWNN m96YV+jevoWLPBlv/Dz6l7GnwSv7DcvA2vhfp2viTd7m7epg1UcQkpA3fkJ+3V88Qr6Z X+r7jN7vyG9db3p5EtbERmVp3t/AhKc6hBFJy4yqrjTUI6YcyV/tgIQtplyqSAeLgGP3 //JDe+S5FXWBXdpqcHr2Ni4tN4WCYIEt+PT1k75+7CRx6W6AnxuVL8dwDi4hX1xiTMil 8t+WITc0P4LAuu7zaXrZoI8S0S+AI+RdHj6RImFiIvhqeIQMMMv6jy9Vlikbvasjghcz 1ytg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Z6QAARZo; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (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 g21si1450961pfh.379.2018.03.09.13.10.23; Fri, 09 Mar 2018 13:10:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Z6QAARZo; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932728AbeCIVKV (ORCPT + 10 others); Fri, 9 Mar 2018 16:10:21 -0500 Received: from mail-wr0-f196.google.com ([209.85.128.196]:39544 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932717AbeCIVKS (ORCPT ); Fri, 9 Mar 2018 16:10:18 -0500 Received: by mail-wr0-f196.google.com with SMTP id r66so2660927wrb.6 for ; Fri, 09 Mar 2018 13:10:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ubl75YrZdeVmEqG+voml2HeBoZ7TZ2oNfWbg7nL2iU8=; b=Z6QAARZoXws/5YhbWX9ngI4A6rh8acAMr+swwM37Jaibjz+iaxCgJ9cf00GYemvqpo sL9z0WVb3shp1kPOng1vBvJlt1Uyd607OTa9zYqj+BHYKOdcoVCvH/uFseNOBPaXXXvr GeBJzSeMWMfC+qgbaWamFLViBK3l4WTnEBLh8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ubl75YrZdeVmEqG+voml2HeBoZ7TZ2oNfWbg7nL2iU8=; b=FBeGduTtRZh+VZFX5v1LQ0CYLrGYt3MzTbEStuhRRYUgwHmKhor883K018WC/tYjt1 T05uFKX9sFWqPgssu8E75G+prrhMZ7i81cnK28vqJNfXFEYqMva85XnwKHmoZ7HXwq7E jjpMppvJEaV8mqKCWfY/rD0hbd9F1jZ8v6G28kAEaachbWiTHkqeajYiNBSqNpVDIUTI eONaD9OM4UEvwpwQxeSTtabxHuDRrMrZj8EKcNBhZFeLSaJrmB+p2dRZLfohpa6f4x1E 3GrKaXXzKBB2js8cHH55gxH5j1H9Fit6Mn0ag9gm/y1uEVLj3klynMfg94A1dpsZEXYb M9BQ== X-Gm-Message-State: APf1xPCJ14G66JlpOFgbXICQ01hjPIHcsW1IoA5sLN+6lW1eEB8OQAkp /Qlv7bj25rHtD/cGps3PGOS51A== X-Received: by 10.223.186.66 with SMTP id t2mr29517993wrg.155.1520629817051; Fri, 09 Mar 2018 13:10:17 -0800 (PST) Received: from mms-0441.qualcomm.mm-sol.com ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id g7sm1853118wrb.78.2018.03.09.13.10.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Mar 2018 13:10:16 -0800 (PST) From: Georgi Djakov To: linux-pm@vger.kernel.org, gregkh@linuxfoundation.org Cc: rjw@rjwysocki.net, robh+dt@kernel.org, mturquette@baylibre.com, khilman@baylibre.com, vincent.guittot@linaro.org, skannan@codeaurora.org, bjorn.andersson@linaro.org, amit.kucheria@linaro.org, seansw@qti.qualcomm.com, davidai@quicinc.com, mark.rutland@arm.com, lorenzo.pieralisi@arm.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, georgi.djakov@linaro.org Subject: [PATCH v4 7/7] interconnect: Allow endpoints translation via DT Date: Fri, 9 Mar 2018 23:09:58 +0200 Message-Id: <20180309210958.16672-8-georgi.djakov@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180309210958.16672-1-georgi.djakov@linaro.org> References: <20180309210958.16672-1-georgi.djakov@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Currently we support only platform data for specifying the interconnect endpoints. As now the endpoints are hard-coded into the consumer driver this may leed to complications when a single driver is used by multiple SoCs, which may have different interconnect topology. To avoid cluttering the consumer drivers, introduce a translation function to help us get the board specific interconnect data from device-tree. Signed-off-by: Georgi Djakov --- drivers/interconnect/core.c | 38 ++++++++++++++++++++++++++++++++++++++ include/linux/interconnect.h | 6 ++++++ 2 files changed, 44 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c index a06f752a6aaa..014993473763 100644 --- a/drivers/interconnect/core.c +++ b/drivers/interconnect/core.c @@ -16,6 +16,7 @@ #include #include #include +#include #include static DEFINE_IDR(icc_idr); @@ -297,6 +298,43 @@ static int constraints_apply(struct icc_path *path) return 0; } +struct icc_path *of_icc_get(struct device *dev, const char *name) +{ + struct device_node *np; + u32 src_id, dst_id; + int index, ret; + + if (!dev || !name) + return NULL; + + np = dev->of_node; + + index = of_property_match_string(np, "interconnect-names", name); + if (index < 0) + return ERR_PTR(index); + + /* + * We use a combination of phandle and specifier for endpoint. For now + * lets support only global ids and extend this is the future if needed + * without breaking DT compatibility. + */ + ret = of_property_read_u32_index(np, "interconnects", index * 2 + 1, + &src_id); + if (ret) { + dev_err(dev, "interconnect src port is invalid (%d)\n", ret); + return ERR_PTR(ret); + } + ret = of_property_read_u32_index(np, "interconnects", index * 2 + 3, + &dst_id); + if (ret) { + dev_err(dev, "interconnect dst port is invalid (%d)\n", ret); + return ERR_PTR(ret); + } + + return icc_get(src_id, dst_id); +} +EXPORT_SYMBOL_GPL(of_icc_get); + /** * icc_set() - set constraints on an interconnect path between two endpoints * @path: reference to the path returned by icc_get() diff --git a/include/linux/interconnect.h b/include/linux/interconnect.h index 5a7cf72b76a5..996c48ea67d5 100644 --- a/include/linux/interconnect.h +++ b/include/linux/interconnect.h @@ -16,6 +16,7 @@ struct device; #if IS_ENABLED(CONFIG_INTERCONNECT) struct icc_path *icc_get(const int src_id, const int dst_id); +struct icc_path *of_icc_get(struct device *dev, const char *name); void icc_put(struct icc_path *path); int icc_set(struct icc_path *path, u32 avg_bw, u32 peak_bw); @@ -26,6 +27,11 @@ static inline struct icc_path *icc_get(const int src_id, const int dst_id) return NULL; } +static inline struct icc_path *of_icc_get(struct device *dev, const char *name) +{ + return NULL; +} + static inline void icc_put(struct icc_path *path) { }