From patchwork Tue Feb 14 14:37:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 57055 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3011754wrn; Tue, 14 Feb 2023 06:39:19 -0800 (PST) X-Google-Smtp-Source: AK7set/u9s6EZsvazR8bzTzi8Cn5jDWzshY7V+CU94UyIg6PqHvqLZmSOLsjmXr5ZNSSct1wUDUd X-Received: by 2002:a17:90b:4b84:b0:233:c301:32ac with SMTP id lr4-20020a17090b4b8400b00233c30132acmr2871494pjb.31.1676385559199; Tue, 14 Feb 2023 06:39:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676385559; cv=none; d=google.com; s=arc-20160816; b=gfYwfYpdeXKxh6jchLi+VvDNowDsSPrY5GKHhQQO+bulro5u5fHan7jf1AHfDYIR/9 yeUl7vIiw5Vpe/RCC45ZHzMXhxA6CFD10ATDqzgT1zbEaK95dnGFVE7DI1LcczPkijBK exczJC6AnqXgtxkJ8D3zqUPeK2d2g61R3x7jbXUAv9saTiMUFf0KicIEYs97BVmnOZKn zEkdu9Pmht7ltQ4kaRTqWzNBaRKUD/PO1NbiOqdPbFigo4cSwvgwtwY9Vv6YTsbpSmvJ dPW0bk8UxI2D9+uMDCNvDxBdXzO1w563umaufNIzB5qF5EFY/a2jbqjHEgpMh4wGnGa/ oh1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=M85Txp3qLBn12UcZyAcNozii0oizm6RueYAIHWFw6cU=; b=PC5e2GTYgBM3fVEekDeO9B4rx3VM5jP6vRDrVInT7a4yc7EhKo51KUwMOE3lZhj0PC gF5KmlcOxEsmVugFXj209YmQOmvyTDjUNtRwag+/6zK0UnzTHY/iW0XaQ4Blf/OMtd6k K3z7t3KyGb8nRKqQnHM8mXx+U6h8q7ZbUIEniKbSuVNYkyIkg/kytXf8R8xwKPGrl1fV zWeUujyCi9gQHs5ZyjvOo34kXHef8IHDua6BA11Xt92QKzRtTP5KEvlYoMnpTxE/eG5f ZUd875uDC+tczdzkcmmMSIztR/9UhVNOoSim9EO+AvrQNhHA5AxAuIZkr6RS25x1TOc+ pypA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qd0o44Kb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 145-20020a630097000000b004fb149738c0si14492156pga.81.2023.02.14.06.39.06; Tue, 14 Feb 2023 06:39:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qd0o44Kb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233122AbjBNOiH (ORCPT + 99 others); Tue, 14 Feb 2023 09:38:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230182AbjBNOiE (ORCPT ); Tue, 14 Feb 2023 09:38:04 -0500 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08A16BDF4 for ; Tue, 14 Feb 2023 06:38:03 -0800 (PST) Received: by mail-ed1-x535.google.com with SMTP id w3so10688394edc.2 for ; Tue, 14 Feb 2023 06:38:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=M85Txp3qLBn12UcZyAcNozii0oizm6RueYAIHWFw6cU=; b=qd0o44Kbx1EkTg2qCbYQ88IqKD2XXI8v0ZJsoaIdotgP0HkxnI4I19WQ24tTPfMAOW lFpmnCRzr5pw1XHh7wzWefbw7qtNFHCqecYZrxwfMNsunLnZSMueBJzXoD9OPx0/W/en QKB71ok8wQMLINpM8ANzhnK0SlwfdC+1SiPyhjIF3VmnQ7/VM4wlIygaptS/be0heIpN S05FwmHSI7OHkWFwJfyZ51z2/cz6zQ+CQnfcbjqg08f6lCb+3xXhYGxHffyLA9Dhahxl tI7ekiocb7FlKLETfreIF5bZv+FJXV6KdIzknhKtY4ogObFbAJgEGQ/jVXmvbD2ToUdo RBZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=M85Txp3qLBn12UcZyAcNozii0oizm6RueYAIHWFw6cU=; b=3P3R1Ksy9zwMtmk5cGqBlO1Ke1Ab4FRgcCR7t2HA+7ZrQBdkZsQVH6PCIHYjuFpmzS IAYhcZU4dl7fFDwNtMedMt1Wdu0x5E13DIlSP1Uz0ZMW/n6yyW7h+RRFmVR9Nriq8JdC qiW6XZzAANwXGPqUiajtXOY9WmL3z8wUUKdxSBF+JQbVUtZ7VRinmuot0uTBJ0Sh8evH Qc5LFFbfkxRUuwEc93T646aT1Ah21iQBln6GqSvH/LuhWZ1u3G8p5vIS9FHZf53zH0fO zmzYl6S/z22aPlo02FUK+mb5E7HRpZyoPi+LyOcpUFQ+gOKMROSNA8//S/UJdcYFwrDo HRPA== X-Gm-Message-State: AO0yUKWMg+xMW8sbuzq8stfY5xrihQH/Ny2BBW1nAbtHNEov2gn9s7HN Host15E9AGb77xU5umb8QYmTXg== X-Received: by 2002:a50:bace:0:b0:4ab:4cf0:4ab3 with SMTP id x72-20020a50bace000000b004ab4cf04ab3mr2741589ede.38.1676385481563; Tue, 14 Feb 2023 06:38:01 -0800 (PST) Received: from localhost.localdomain (abxh117.neoplus.adsl.tpnet.pl. [83.9.1.117]) by smtp.gmail.com with ESMTPSA id eg21-20020a056402289500b004acb6189693sm5378052edb.83.2023.02.14.06.38.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 06:38:01 -0800 (PST) From: Konrad Dybcio To: linux-arm-msm@vger.kernel.org, andersson@kernel.org, agross@kernel.org Cc: marijn.suijten@somainline.org, Konrad Dybcio , Bryan O'Donoghue , Georgi Djakov , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 02/12] interconnect: qcom: rpm: Add support for specifying channel num Date: Tue, 14 Feb 2023 15:37:10 +0100 Message-Id: <20230214143720.2416762-3-konrad.dybcio@linaro.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230214143720.2416762-1-konrad.dybcio@linaro.org> References: <20230214143720.2416762-1-konrad.dybcio@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757817664368185753?= X-GMAIL-MSGID: =?utf-8?q?1757817664368185753?= Some nodes, like EBI0 (DDR) or L3/LLCC, may be connected over more than one channel. This should be taken into account in bandwidth calcualtion, as we're supposed to feed msmbus with the per-channel bandwidth. Add support for specifying that and use it during bandwidth aggregation. Reviewed-by: Bryan O'Donoghue Signed-off-by: Konrad Dybcio --- drivers/interconnect/qcom/icc-rpm.c | 7 ++++++- drivers/interconnect/qcom/icc-rpm.h | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c index 385a67c20956..7fcc2d86117b 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -317,6 +317,7 @@ static void qcom_icc_bus_aggregate(struct icc_provider *provider, { struct icc_node *node; struct qcom_icc_node *qn; + u64 sum_avg[QCOM_ICC_NUM_BUCKETS]; int i; /* Initialise aggregate values */ @@ -334,7 +335,11 @@ static void qcom_icc_bus_aggregate(struct icc_provider *provider, list_for_each_entry(node, &provider->nodes, node_list) { qn = node->data; for (i = 0; i < QCOM_ICC_NUM_BUCKETS; i++) { - agg_avg[i] += qn->sum_avg[i]; + if (qn->channels) + sum_avg[i] = div_u64(qn->sum_avg[i], qn->channels); + else + sum_avg[i] = qn->sum_avg[i]; + agg_avg[i] += sum_avg[i]; agg_peak[i] = max_t(u64, agg_peak[i], qn->max_peak[i]); } } diff --git a/drivers/interconnect/qcom/icc-rpm.h b/drivers/interconnect/qcom/icc-rpm.h index 8ba1918d7997..8aed5400afda 100644 --- a/drivers/interconnect/qcom/icc-rpm.h +++ b/drivers/interconnect/qcom/icc-rpm.h @@ -66,6 +66,7 @@ struct qcom_icc_qos { * @id: a unique node identifier * @links: an array of nodes where we can go next while traversing * @num_links: the total number of @links + * @channels: number of channels at this node (e.g. DDR channels) * @buswidth: width of the interconnect between a node and the bus (bytes) * @sum_avg: current sum aggregate value of all avg bw requests * @max_peak: current max aggregate value of all peak bw requests @@ -78,6 +79,7 @@ struct qcom_icc_node { u16 id; const u16 *links; u16 num_links; + u16 channels; u16 buswidth; u64 sum_avg[QCOM_ICC_NUM_BUCKETS]; u64 max_peak[QCOM_ICC_NUM_BUCKETS];