From patchwork Tue Aug 13 14:53:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 171200 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1009636ily; Tue, 13 Aug 2019 07:53:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqyXygMKqncHWlmwHOrF5tf2Did50wofIMIinKfO1vLMdAFhywhSXlpbbthwqQj8pD4RCCLs X-Received: by 2002:a62:fb18:: with SMTP id x24mr40381254pfm.231.1565708032564; Tue, 13 Aug 2019 07:53:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565708032; cv=none; d=google.com; s=arc-20160816; b=GAJoeDpN04Zn039bUMSt/JOKjY7dqF0VVU+dvVSt+luUnkkS44aaJ8FZaFORPOENHQ iGOUNzSsbbv8S0J5j/hjNNFZJggnyuvazwH9V+Vkfx2gUqqg9BQPOQgaeLZaLXCxzPt3 MIESepbCNaOquB991JsY1rCdh4Jv7ixfN7UCZOd5dKr6lGdMXTRv3P6w064tJ7H50sS6 xBhhA1N92Fj8wlflszvMGAtsoF3lC2lq+6CMFqzxkn4F4hhU2Mbg8icqptthtyFOrizl WbCESflZs8M3nEi8uoJW4fadKz5Tn3Yo/L2sQ2IZzx/Aw74VhNcYBEp6OIJMtNONaOWo vRpQ== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=uM5KDFBP871ZVZqzWYkX79IOsRBnc0vP++SbwrF+Law=; b=ZWO9x2oWbGTTxq3WZZ8IdayS5O2SLzp1v4D9t4B35m5VO9WXsr894z7MIfpVDfqIGJ R+fFhXp1n4EDVoWLRxFjOWSMGGjQriXf3rIq7wHbV46l8sdhNcfoUu8/FEVmwD9kefpc UnonOkinMbsgiNooyn3p+5VSI+sYXsXFmBwF8TpM8oFK5K1SpLZ7HjAtMGYnyPHBKzI+ oqY2MPWWimJJjg9QRkRkUUMad2Xwa7xX3eibZMbOhX2Zc9iuBf69J4sPacB2hCa/b/Zg TgIoXc3XgtytIh/9t/535AoW11GPWiDCSkXzW/uQSB3xclh3R+iDxTEf+VABZorsusOk Mw4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lOTjuMKu; 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=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 y15si68238878pfb.28.2019.08.13.07.53.52; Tue, 13 Aug 2019 07:53:52 -0700 (PDT) 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=pass header.i=@linaro.org header.s=google header.b=lOTjuMKu; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729826AbfHMOxv (ORCPT + 16 others); Tue, 13 Aug 2019 10:53:51 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:45344 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729822AbfHMOxv (ORCPT ); Tue, 13 Aug 2019 10:53:51 -0400 Received: by mail-lj1-f194.google.com with SMTP id t3so13287847ljj.12 for ; Tue, 13 Aug 2019 07:53:50 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=uM5KDFBP871ZVZqzWYkX79IOsRBnc0vP++SbwrF+Law=; b=lOTjuMKuogK2dDNGkv6MO919RAbUY00BlTXLsyO1rzOFS+Apt+WBodqxpT+0086IYG SSlBrHz2Tj/86KNmiTs3/KU2GFFjKZ29gE3a8XQxN3QsfDsNOJt4hJvAmu59gKgIgWLR TrLphF65L+tx5db9fW1QGc+8ZK1L5gdKv6+807vMgpsbWlzp09xtOMOImOUCVhVuKsoF vmZj2Emf2Yx0CuaHO+hYT/n1uikCAMqd1Ob2U/ovXzdU2/5P/HdKm2XWDSLwSQR8J0Zb x5NEZyaSBVDmGVFLXSlTj5/DJv37gx41xseNhpFQreufCTvtq/eun22Svt7xiD2LJamY PbAg== 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:mime-version:content-transfer-encoding; bh=uM5KDFBP871ZVZqzWYkX79IOsRBnc0vP++SbwrF+Law=; b=fTr7dNUkGjno931FAnpK8jxHivxPbG0+JG4qo+rQ17x5bkPrHo1t4xb8scaT/zWDw8 u/UAzrKu4sHRRS3NVtUyTS9CbgtPuqkgjd+Cud8ndj4BuhpgNh8HyxiWufRrCk7ToN7T EDFv3V4IMcWEoc74zK6pVuQrdz+6sd4VT0cmZdP79oIYr8rJ4jQD2v9tBRLwCETNOpWQ w8W45TLyTavnFnO52H6j5N6Dxpw2w4Zib9JGO4ddX4OPixEnLbncuSxm0sVK/KQpN4Bd WRSui6k3KhmqEJ9flBonxDXEwvYB1I0vb/bH84Lk92b0ePUbzieSDp5nlvsh0nzq5xGd 8Row== X-Gm-Message-State: APjAAAXVwV83QSYpvRzJhqLauvO9av2jzlr00xuFPcSkm74PgglEY526 MVChGR9nKznyKBoIxD/ggUqeOA== X-Received: by 2002:a2e:12c8:: with SMTP id 69mr21630688ljs.189.1565708029352; Tue, 13 Aug 2019 07:53:49 -0700 (PDT) Received: from localhost.localdomain ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id r68sm19628100lff.52.2019.08.13.07.53.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 13 Aug 2019 07:53:48 -0700 (PDT) From: Georgi Djakov To: linux-pm@vger.kernel.org, evgreen@chromium.org Cc: daidavid1@codeaurora.org, vincent.guittot@linaro.org, bjorn.andersson@linaro.org, amit.kucheria@linaro.org, dianders@chromium.org, seansw@qti.qualcomm.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 2/3] interconnect: Add pre_aggregate() callback Date: Tue, 13 Aug 2019 17:53:40 +0300 Message-Id: <20190813145341.28530-3-georgi.djakov@linaro.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190813145341.28530-1-georgi.djakov@linaro.org> References: <20190813145341.28530-1-georgi.djakov@linaro.org> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Introduce an optional callback in interconnect provider drivers. It can be used for implementing actions, that need to be executed before the actual aggregation of the bandwidth requests has started. The benefit of this for now is that it will significantly simplify the code in provider drivers. Suggested-by: Evan Green Reviewed-by: Evan Green Signed-off-by: Georgi Djakov --- drivers/interconnect/core.c | 3 +++ include/linux/interconnect-provider.h | 3 +++ 2 files changed, 6 insertions(+) diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c index 251354bb7fdc..7b971228df38 100644 --- a/drivers/interconnect/core.c +++ b/drivers/interconnect/core.c @@ -205,6 +205,9 @@ static int aggregate_requests(struct icc_node *node) node->avg_bw = 0; node->peak_bw = 0; + if (p->pre_aggregate) + p->pre_aggregate(node); + hlist_for_each_entry(r, &node->req_list, req_node) p->aggregate(node, r->tag, r->avg_bw, r->peak_bw, &node->avg_bw, &node->peak_bw); diff --git a/include/linux/interconnect-provider.h b/include/linux/interconnect-provider.h index 4ee19fd41568..b16f9effa555 100644 --- a/include/linux/interconnect-provider.h +++ b/include/linux/interconnect-provider.h @@ -36,6 +36,8 @@ struct icc_node *of_icc_xlate_onecell(struct of_phandle_args *spec, * @nodes: internal list of the interconnect provider nodes * @set: pointer to device specific set operation function * @aggregate: pointer to device specific aggregate operation function + * @pre_aggregate: pointer to device specific function that is called + * before the aggregation begins (optional) * @xlate: provider-specific callback for mapping nodes from phandle arguments * @dev: the device this interconnect provider belongs to * @users: count of active users @@ -47,6 +49,7 @@ struct icc_provider { int (*set)(struct icc_node *src, struct icc_node *dst); int (*aggregate)(struct icc_node *node, u32 tag, u32 avg_bw, u32 peak_bw, u32 *agg_avg, u32 *agg_peak); + void (*pre_aggregate)(struct icc_node *node); struct icc_node* (*xlate)(struct of_phandle_args *spec, void *data); struct device *dev; int users;