Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp12196816rwl; Tue, 3 Jan 2023 10:24:29 -0800 (PST) X-Google-Smtp-Source: AMrXdXsRENkvktQA2jxCRsMgyREk75ESl0Ae/VhtgzfFGTBMYwCSZeo1JHLu46DC50fI8IXlnn7Z X-Received: by 2002:a17:907:8c81:b0:7c1:962e:cf28 with SMTP id td1-20020a1709078c8100b007c1962ecf28mr40395911ejc.23.1672770269619; Tue, 03 Jan 2023 10:24:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672770269; cv=none; d=google.com; s=arc-20160816; b=QWmUySGBg+NEN77IcmMHWV13iXP+J7hiEX0LREsBqczDQuuRiLznzvmx7RPsC1EwgP H14cNIT9XIGsJG1m7eXqK9RvIl21Ea1kK1M5edahqPhco2/a4s730QiVCy/2NGLiQ1cU OBpxnPeic0IVXnYL2Bj96zxlRoxZrSfJH2fh62Lt8MhHZvb2zkvKMf787kTzb3A4qf9C Mx94dlQ6n62Gm4UCYigGtyq+WySq3tA+RZTmuU+7umY0Pmb8CjEpW5C8pIfRH9IpOiFo 0uLn6LHa/m19A7yWpoptvo6iOXjfwCQnY4LYffvB4q/59n6b0qaiKj387KM19FOp7TcS RTrQ== 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=pKKn2ob5FVX8E1rKj4RwcuOoKO8R4a0VcIQiC+ia4Vo=; b=tCNJipyY4IkwnhoXT58RKAZgq844oDYt8Q/rdTjyw8s+NVFCnVAoToQVpcmOH7YMKT jeCSI4/nCD7tKDC4dU55NQ/re4gdyFgcob+TPGWcd+WIb/qKUUd0rn3iAjLB8eCHmzao yirci39npEEVOJPJdceOfG4W3KMujy/+bJbx1g5wDpkjqoMoruWK25ohKiIuMAIC8RZt MgX5dTrK7vGyqr2VuTCu9g7/iekC20dWRcRDeuYMpDdKqCN3Z56AWvcqznrzuNoR3GcB HfrDuzD2yAA2fmiTfAURHeabhx8vj8mboeaM6WvgUj/20pd3aFfRpq3vHFowciVlTDxP hQmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pdrf8zkV; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gs35-20020a1709072d2300b0078e15c30a6csi30599646ejc.559.2023.01.03.10.24.14; Tue, 03 Jan 2023 10:24:29 -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=pdrf8zkV; 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 S238469AbjACRbc (ORCPT + 60 others); Tue, 3 Jan 2023 12:31:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238100AbjACRbO (ORCPT ); Tue, 3 Jan 2023 12:31:14 -0500 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 350402647 for ; Tue, 3 Jan 2023 09:31:13 -0800 (PST) Received: by mail-lf1-x136.google.com with SMTP id y25so46598292lfa.9 for ; Tue, 03 Jan 2023 09:31:13 -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=pKKn2ob5FVX8E1rKj4RwcuOoKO8R4a0VcIQiC+ia4Vo=; b=pdrf8zkVnAuKKS88V/P2hnBeJ536mptQCQFvKs/0m0XX28JdGErm+2R6xDRRo8nOdO NUvH/jfxH2EJOapvv1mjbYQGFxk1iroh6ObhWuCNQv0PqFGOboeDGM388KwWEijFDJja aKORv829TVWoB6jP+Sos8OeHcNVlhQ3C3zZtvNFH58Kb3R3dtqst2xO/FONQ3t7DPiIJ 0bEbOq6WAMLPoOwC1LeY2N9TqYGjR2I0fjWZmTMnjOep2yQWA/RCRdGldUWrnCOGmHUB IlrflF8+5ukPAC+uHxMhVuqkwC5pCXdDOFjgIx7hnzMyTPlMKCzowQahXiXEKjhtPv4t WO9Q== 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=pKKn2ob5FVX8E1rKj4RwcuOoKO8R4a0VcIQiC+ia4Vo=; b=Y+Hug5DE3eKE9uAZZrPdJE7Z4+8B2QYfJjxBgC4fI9QxdxdbUflgNWY1IYZMa5RQMK dYcg9Y3e0O93Ab7Klv9NcJXmtVyn+7gjVXhC/0wrcFeJxaT2tmRVsByoB1MX/mvPrrqT /jL2W4erllSANANXAzLADpyuvq9zmWOcggMtdaTKfSpcyA1FVCvG7qqw7Kby2x9LRjEu 95a87ziQjkMtJpSpy3ZpS88hVJAkQig3mMZz0mNLy3ap5/Ofo8eAtzyukh98eiGRI4en nWQbYPVmdn0m2p3Tx6ahL1RO0WOo4+Vnw+SZFpygEd1lWnJA3JhKF4NOstYQIRitzUYs d5xA== X-Gm-Message-State: AFqh2koPWRO/hr2sSGXKJuv9NkewaMLvJL0HNGCWw95BzjrcgTBT7Jgq Ne5YoBVOiYclp7t32nfNhQm5zQ== X-Received: by 2002:a05:6512:3681:b0:4b5:83ba:11ad with SMTP id d1-20020a056512368100b004b583ba11admr10479300lfs.35.1672767071579; Tue, 03 Jan 2023 09:31:11 -0800 (PST) Received: from localhost.localdomain (abxi45.neoplus.adsl.tpnet.pl. [83.9.2.45]) by smtp.gmail.com with ESMTPSA id o9-20020ac25e29000000b004b4b5da5f80sm4916818lfg.219.2023.01.03.09.31.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Jan 2023 09:31:11 -0800 (PST) From: Konrad Dybcio To: linux-arm-msm@vger.kernel.org, andersson@kernel.org, agross@kernel.org, krzysztof.kozlowski@linaro.org Cc: marijn.suijten@somainline.org, Konrad Dybcio , Georgi Djakov , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] interconnect: qcom: rpm: Add support for specifying channel num Date: Tue, 3 Jan 2023 18:30:59 +0100 Message-Id: <20230103173059.265856-4-konrad.dybcio@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230103173059.265856-1-konrad.dybcio@linaro.org> References: <20230103173059.265856-1-konrad.dybcio@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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=ham 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 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. 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 8ec1ca17816a..04fe742c25a3 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -328,6 +328,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 */ @@ -345,7 +346,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]; -- 2.39.0