From patchwork Fri Aug 9 12:13:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 170909 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp9918731ile; Fri, 9 Aug 2019 05:13:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqyrH9ltqn09x5VLm8tRxltv9w/iHdsZuP8QWhK2N5sGJUWHLr70DPxSR6y+2BvkTmOd/2xa X-Received: by 2002:a17:902:b909:: with SMTP id bf9mr18549802plb.309.1565352816956; Fri, 09 Aug 2019 05:13:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565352816; cv=none; d=google.com; s=arc-20160816; b=WC7oAeEOx4g9/caSqY/v9P7C64jSPL/pBq5zImt8hvIIy5B0uM7bUiDmDJHbzim3bY /gV7O9614NKK36u5PSpTqRD8rWjwVBJT/av6vOX2D+Iigz9lEe5s+wInPYmMnTekNEBF n/iMyZROpchHNugpsMFO2spy2Kh2n6mr1ccJWT//6LMpnvsEKw7vboqxQBZsxrpIKDik TSyeuigojlWOm7j9TTzyMGf7jvgUkE+VOwrHsqL+Z46XmEvYma9v1rIwKkbS59Seindg Q2I/DrJwmCdWyrDRfjRYiBV7tTkJNGDAMzpc5z03WlunxzvAqrt1UoJ1PLbs4pGdHO08 j7cg== 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=9/m5+Lvxb2TAhFuurt0ORxYfrBK3bQPTy/lNoBXYuYY=; b=BOlXmdI+Q/xX1ni/ISKNJSr5PQiCwfgHB95xpAUEiNMBnIi+jLoZCDb17Cq0mnnNSX P8WYdXLUT36CzbghtSdc6ECFILphBMThBtNxFxkgWr1JLVGyYLTygFVzyT1hbr897eqD dSs8y4MsIizkRlk4EN/cs3JzIlBvbkAxejg4wQiHUrfEr7pfcIRtx9JuKLxI1mHI4J9i /DV93Z5r5taKzBJV2JChGkQS/wT7uJZexAQJlHwY87d9oAsv3GYanVmNdt3oE/4lCcZ0 cw3FZieGQ6ukD1zIpeYuIhhwBOr+zEEiuaOxqjlFbAM5VuuaYl4/XX3xOkZC1hHjLnV/ ceVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qp403boU; 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 u9si43306951pgr.196.2019.08.09.05.13.36; Fri, 09 Aug 2019 05:13:36 -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=qp403boU; 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 S2406754AbfHIMNf (ORCPT + 28 others); Fri, 9 Aug 2019 08:13:35 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:33926 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406730AbfHIMNd (ORCPT ); Fri, 9 Aug 2019 08:13:33 -0400 Received: by mail-lj1-f196.google.com with SMTP id p17so91922521ljg.1 for ; Fri, 09 Aug 2019 05:13:31 -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=9/m5+Lvxb2TAhFuurt0ORxYfrBK3bQPTy/lNoBXYuYY=; b=qp403boUGXWedc1L9So92iR1TKVoaZ+Li/QQNx+ELKQjcc7ccXWhNnr1RE881sB3PW c/ETqcZin8+fdJmg0gruZsRWFZqhTTfgUx/b6tKTTWUluB6i28C2tZdNIWNu+m1IwYD/ W+4iVYtCZBkj8JXjIQZIyNZpB+ZK3xqHoABOjN2BWe5VlLdqFWLyAv0OhH/XIqtUjOFo HMYPqLdCTvyhxT2p5S2ZOr/tqttaWIFcVq+KD6VZb6jKjNXFk/xN2OuxjgqjuSrGv7fX 3Bqj3WF3I93zF606ljMXz7Z3rfN6GWY6VvHVi+v1I37pu4msuMWZTIExnq4mzSZ4mfDx m7rg== 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=9/m5+Lvxb2TAhFuurt0ORxYfrBK3bQPTy/lNoBXYuYY=; b=qBWZmedqUvA5vYB2Z5TN9HSBMXOR9rviOLNK+ncbO0NVVm/uipv8B+Fx8e82VOo4O8 aau6jtiEbed0q9Kvflv92n0rkmGoIenrdPPDX0eCchtFnLnt9UHIcARabnthEfGzs67Y 1YS2GtzoXCDfJuArKOMxdI6RUAuLoZCXgqZRpWAIB4UUGhsvI8XrEBaUd8qSso/xucQE bLjFmBhfe7AAKVDPTc4B0A/zk4aUEi9B52gdvXh35+GYKf28sKryA+YC2/dJ0V/RwbYr XjJiZncVY+jtYtxEZCqtrRkKfLmtUacx1F52d2C7vhDkr+HwPIODxknDyP+1NCMK/paD 17Gg== X-Gm-Message-State: APjAAAVwWvB8JTHvbdag9Pjs/Yrd2AWGfXbbEeiNfe6O6vZqPcGjUa6T 6oKwAxQA+eJFcDcDl8rPLQm5nA== X-Received: by 2002:a2e:55db:: with SMTP id g88mr2449978lje.27.1565352811117; Fri, 09 Aug 2019 05:13:31 -0700 (PDT) Received: from localhost.localdomain ([37.157.136.206]) by smtp.googlemail.com with ESMTPSA id f23sm1083425lfc.25.2019.08.09.05.13.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Aug 2019 05:13:30 -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 v3 2/3] interconnect: Add pre_aggregate() callback Date: Fri, 9 Aug 2019 15:13:24 +0300 Message-Id: <20190809121325.8138-3-georgi.djakov@linaro.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190809121325.8138-1-georgi.djakov@linaro.org> References: <20190809121325.8138-1-georgi.djakov@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 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;