From patchwork Tue Jan 3 17:30:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 639962 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D996C3DA7D for ; Tue, 3 Jan 2023 17:31:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237897AbjACRbL (ORCPT ); Tue, 3 Jan 2023 12:31:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233639AbjACRbK (ORCPT ); Tue, 3 Jan 2023 12:31:10 -0500 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0144DDE for ; Tue, 3 Jan 2023 09:31:08 -0800 (PST) Received: by mail-lf1-x132.google.com with SMTP id cf42so46593516lfb.1 for ; Tue, 03 Jan 2023 09:31:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=sO6SUqVw2xTFajMx+hD52rACWsikx2Bdie3aQKKgmBc=; b=sKT+ErZCG/vn8T8T/vb65Fv0rvNz2/3BkseTSV4iep6x/XE5PHNAgjU624UL7ldCeV G4MggSBTBA4AXVD8rQNQGoVxaOUhmXC40r3hKoNAJ1E8Qr3lFDqUSWUBMmw2XeUJKgKD viiRbda3KxDvIPIHRBmjkflp0adm5ZUqZzxFYLLPY9oD7pZ5ywVKbozmbtuKTOwh0Cej 9iF67YNTnNc2wWdDU8bQsDt7w4+LtK1nrq4Cnoh7Qmuri7Chy+ZAYB90P/neW5wCNSLD 7xMX7mrOquJD7gMkG6j5MX/JRVhzLr2P/QDItCAw6fQLbXVWuqZCqKwTIgB96zLyCUNJ 2t5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=sO6SUqVw2xTFajMx+hD52rACWsikx2Bdie3aQKKgmBc=; b=m5BMyVSQFoZduwAULqqL+SzcUZuBQNlH3Xk+Uc5ClD7u9iJq7DkT3Lfb9ZKLGq+5Ke 0eLqPbKDHhjboi2eq9CUqMsUfoMnLuWgVF80xms2jD8eb/qJDX1UFWTb5NoDFq7h50KK Bm2VnR1P5RWnE/JLleeGTTLPE5fvvwJIya2RfCDiMSl+kfzdwud492JU2G3OWp8eT+f+ cviwQp8Z6xc5A+yIT3hRRH30xyl2J7+ql8keN+1lWrOX8DKrqczN2h7JYgYikPQq+RcH nino7P637xvecATWYAjuZcsaVxR5dPf0MleWyx0nyvNA5623SkGc4GCF5oqvhGpTXTFF G8Cg== X-Gm-Message-State: AFqh2krQTgRZG0/q6gEek1MhqlIbxO7My9dcK2TiicSIjNm6zryGT8Oh 8WpDIBLME0ClZ+Xlkx02399jUg== X-Google-Smtp-Source: AMrXdXtRuHRrMeMcw8VJe8kq/FI3A09Nu2cAUW98IOvRcpS0jNxsQfZwpT2zd01GWgyHI9hfNPA5WA== X-Received: by 2002:a05:6512:b23:b0:4cb:d3:3b99 with SMTP id w35-20020a0565120b2300b004cb00d33b99mr10295016lfu.36.1672767067289; Tue, 03 Jan 2023 09:31:07 -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.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Jan 2023 09:31:06 -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 1/4] interconnect: qcom: rpm: Don't set QoS params before non-zero bw is requested Date: Tue, 3 Jan 2023 18:30:56 +0100 Message-Id: <20230103173059.265856-1-konrad.dybcio@linaro.org> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Until now, the icc-rpm driver unconditionally set QoS params, even on empty requests. This is superfluous and the downstream counterpart does not do it. Follow it by doing the same. Signed-off-by: Konrad Dybcio --- drivers/interconnect/qcom/icc-rpm.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c index 43b9ce0dcb6a..06e0fee547ab 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -193,6 +193,12 @@ static int qcom_icc_qos_set(struct icc_node *node, u64 sum_bw) struct qcom_icc_provider *qp = to_qcom_provider(node->provider); struct qcom_icc_node *qn = node->data; + /* Defer setting QoS until the first non-zero bandwidth request. */ + if (!(node->avg_bw || node->peak_bw)) { + dev_dbg(node->provider->dev, "NOT Setting QoS for %s\n", qn->name); + return 0; + } + dev_dbg(node->provider->dev, "Setting QoS for %s\n", qn->name); switch (qp->type) { From patchwork Tue Jan 3 17:30:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 638978 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18573C54EBD for ; Tue, 3 Jan 2023 17:31:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237815AbjACRbM (ORCPT ); Tue, 3 Jan 2023 12:31:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237767AbjACRbL (ORCPT ); Tue, 3 Jan 2023 12:31:11 -0500 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47502DED5 for ; Tue, 3 Jan 2023 09:31:10 -0800 (PST) Received: by mail-lf1-x134.google.com with SMTP id j17so37119044lfr.3 for ; Tue, 03 Jan 2023 09:31:10 -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=g9TS4SJ+83/pLOhWHZLdZeC8hyETp6X/nWYIPMtmOR4=; b=IkOm6cg4jYOgHWBc6tW60dORhiFerv+60CiD0QP/aXBp99xSxeTJHP0DPza2wff06c XDPftLeO6i+f7+0gyK8yjpHzFjfciBPgG9498Xek8cgUWHvmkU0OuaDCFGUPNdVsh1M7 quk++8SC5kADnH8sBQsWNwc5kDAX796QHWHRr8mg230oSJDQSraYuZutC+63wPPkdi/c V1a7dQ7L431jGAN8ch4PWDTB3gM39H3Fz9E9pTfMmk2f88u2KoTf0NBE7ZKykHMv6ZDh 2FGehtczs1D8bUjJnuO2fAQK6lGE5TGxnBRZiuU17k3DMZWqBR/l+Qet7xxZ5Qdai+wP ctMA== 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=g9TS4SJ+83/pLOhWHZLdZeC8hyETp6X/nWYIPMtmOR4=; b=hUtGXhXMZ6pHw6Y9F7mUV8d7s18di/8LC4ViayN3QGoGrah15FWYzVaqd/MQxXzkZP CtHtS1UpRMJbg33wacXn5FX4basJMnFbL0Y/44gFi1cnzWc2sxX8ZbISZkFlhkRQDQU0 ELV//XuN96RMcstKEyO182RdiQrAWlfFs+QlIG2hIzcX8CR6j9j9qygqcYUJdjbFWvyG gUemd4oZ7nVsjye/6jIV/6dPepacbzBOy3WSQU8fWeIHr/ZnPxHoKdnL9NCK+KGeHxZf 6mEus2RiWK6BO8VgUMg2Wy2qLcprnlUj/O15z4gCYEExfXmic9LImJEeqF6+qIhQfdP6 OkUw== X-Gm-Message-State: AFqh2kopBXGttyT7PtVd0TJTwOoxMDiRtYkxvcT2DHIDlIOu8YUjYMea 3KAr0MSCoal5yflQ+OeVca0lyg== X-Google-Smtp-Source: AMrXdXt367wMkHjBacvL6ur8ofzFOfUBAbSzaFqGrtSVWxM8KYV780i42p9akKybBdRKF8fTQyA0zw== X-Received: by 2002:ac2:498f:0:b0:4a4:86ff:9562 with SMTP id f15-20020ac2498f000000b004a486ff9562mr13562225lfl.38.1672767068622; Tue, 03 Jan 2023 09:31:08 -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.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Jan 2023 09:31:08 -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, AngeloGioacchino Del Regno Subject: [PATCH 2/4] interconnect: qcom: rpm: Set QoS parameters regardless of RPM bw setting Date: Tue, 3 Jan 2023 18:30:57 +0100 Message-Id: <20230103173059.265856-2-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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org QoS parameters and RPM bandwidth requests are wholly separate. Setting one should only depend on the description of the interconnect node and not whether the other is present. If we vote through RPM, QoS parameters should be set so that the bus controller can make better decisions. If we don't vote through RPM, QoS parameters should be set regardless, as we're requesting additional bandwidth by setting the interconnect clock rates. The Fixes tag references the commit in which this logic was added, it has since been shuffled around to a different file, but it's the one where it originates from. Fixes: f80a1d414328 ("interconnect: qcom: Add SDM660 interconnect provider driver") Signed-off-by: Konrad Dybcio --- drivers/interconnect/qcom/icc-rpm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c index 06e0fee547ab..a190a0a839c8 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -252,8 +252,10 @@ static int __qcom_icc_set(struct icc_node *n, struct qcom_icc_node *qn, ret = qcom_icc_rpm_set(qn->mas_rpm_id, qn->slv_rpm_id, sum_bw); if (ret) return ret; - } else if (qn->qos.qos_mode != -1) { - /* set bandwidth directly from the AP */ + } + + if (qn->qos.qos_mode != NOC_QOS_MODE_INVALID) { + /* Set QoS params from the AP */ ret = qcom_icc_qos_set(n, sum_bw); if (ret) return ret; From patchwork Tue Jan 3 17:30:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 639961 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66FEDC46467 for ; Tue, 3 Jan 2023 17:31:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237884AbjACRbP (ORCPT ); Tue, 3 Jan 2023 12:31:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237767AbjACRbN (ORCPT ); Tue, 3 Jan 2023 12:31:13 -0500 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C327DD4B for ; Tue, 3 Jan 2023 09:31:11 -0800 (PST) Received: by mail-lf1-x12b.google.com with SMTP id b3so46615516lfv.2 for ; Tue, 03 Jan 2023 09:31:11 -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=+3KZjymVYGNEKzZ19NRMYsypVKZnaHDoA/SNQSoa8Wc=; b=X9bIaEsxX3GIUmLjf7DQIcOA/N6q5yqI33odD2sZZGiUWAru2F16e6lhmODeJe8WL5 qRZ/4nAMF5jcsjaOO9iEwJMSUqiMXygEGlqiuMXHrM6IALMBqTCVIxIDsBDVPtI8Wu08 +9Wt7arlEesfukoZqfsuosSZiMLTIqo9LcgBUgaZSnH7bXc5MaA6v5/RKtaYndmcCBMe U0oP5SOEuVln9ifeyuq1vhTcvptL1fY839ZSERkmmFAX16DCFDc/JXxrBk9ynwN7nZFM RBXRcxZSUrijpLVlU1+aTQEMqbrCUl4ivOYbM90c1qRf+/hjMkFKWuVS13Kqe9ukb3Vg O3Dw== 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=+3KZjymVYGNEKzZ19NRMYsypVKZnaHDoA/SNQSoa8Wc=; b=sHeGoQFzfHEzw6waXWu1cOTCZ1VckduHaaNNPXMlKb3sCFXBsUN1LC9zZqc68ACh5V U1mNnAliApFGquY+Ssg4lzDfjqhJZoX/94a9Q1Bqc3dxy0ElQL6TyYRIm6V7ZfIlvcgi igMe5Eg+cVSqL+opxFY9d51HEA8uueCWkQhLWXfo6ysnVqH6kdRrjtCSEojhA3TRenx8 Mi5ChqjJZQtlite3wQtcbM24QOUO7KlydQCU5ic0iIhW2VRo2l96F8XbBkT+UAbsktz6 DK03I4zm+f38fwCxwPFkzbArLfpDT9sadKuF/WNbd5+UQT2mHRQ6gBEIEMQpPKzB4mzC Rz5g== X-Gm-Message-State: AFqh2kpZd8AgmdCD50IkDKtGI7d5cN6voimpi83KH4oX2LpGNJYSvrmL qfHOFRQTUOwH+IEFcaq2qzlYgA== X-Google-Smtp-Source: AMrXdXuIBGFoSO7Q/Shu0eNSOZ4yVIcx6NAOU0gKlhjEmh01fBRZ+0dsKy738mqRHeWvdml+bvEqFQ== X-Received: by 2002:a05:6512:1043:b0:4cb:d3:b81b with SMTP id c3-20020a056512104300b004cb00d3b81bmr15212735lfb.44.1672767070191; Tue, 03 Jan 2023 09:31:10 -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.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Jan 2023 09:31:09 -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, Evan Green , Jun Nie , Greg Kroah-Hartman , Brian Masney , Dmitry Baryshkov , Yassine Oudjana Subject: [PATCH 3/4] interconnect: qcom: rpm: make QoS INVALID default, separate out driver data Date: Tue, 3 Jan 2023 18:30:58 +0100 Message-Id: <20230103173059.265856-3-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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Currently, NOC_QOS_MODE_FIXED is defined as 0x0, which makes it the "default" option (as that's what uninitialized members of partially initialized structs are set to), which should really have been NOC_QOS_MODE_INVALID, and that's what people (wrongly) assumed was the case when .qos.qos_mode was not defined and what really makes the most sense.. That resulted in {port 0, prio 0, areq_prio 0, urg_fwd = false, rpm-voted} QoS being always voted for, because the code flow assumed "hey, it's fixed QoS, so let's just roll with whatever parameters are set" [again, set by partial struct initialization, as these fields were left unfilled by the developers]. That is of course incorrect, and on many of these platforms port 0 is MAS_APPS_PROC, which 9/10 times is supposed to be handled by the ap_owned path, not to mention the rest of the parameters may differ. Arguably, the APPS node is the most important one, next to EBI0.. The modes are defined as preprocessor constants. They are not used anywhere outside the driver or sent to any remote processor outside qcom_icc_set_noc_qos(), which is easily worked around. Separate the type specified in driver data from the value sent to msmbus. Make the former an enum for better mainainability. This is an implicit fix for every SMD RPM ICC driver that didn't explicitly specify NOC_QOS_MODE_INVALID on non-AP_owned nodes that don't have QoS settings. Fixes: 30c8fa3ec61a ("interconnect: qcom: Add MSM8916 interconnect provider driver") Fixes: 6c6fe5d3dc5e ("interconnect: qcom: Add MSM8939 interconnect provider driver") Fixes: 4e60a9568dc6 ("interconnect: qcom: add msm8974 driver") Fixes: 7add937f5222 ("interconnect: qcom: Add MSM8996 interconnect provider driver") Signed-off-by: Konrad Dybcio --- drivers/interconnect/qcom/icc-rpm.c | 23 +++++++++++++---------- drivers/interconnect/qcom/icc-rpm.h | 10 ++++++---- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c index a190a0a839c8..8ec1ca17816a 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -48,6 +48,10 @@ #define NOC_QOS_MODEn_ADDR(n) (0xc + (n * 0x1000)) #define NOC_QOS_MODEn_MASK 0x3 +#define NOC_QOS_MODE_INVALID_VAL -1 +#define NOC_QOS_MODE_FIXED_VAL 0x0 +#define NOC_QOS_MODE_BYPASS_VAL 0x2 + static int qcom_icc_set_qnoc_qos(struct icc_node *src, u64 max_bw) { struct icc_provider *provider = src->provider; @@ -155,7 +159,7 @@ static int qcom_icc_set_noc_qos(struct icc_node *src, u64 max_bw) struct qcom_icc_provider *qp; struct qcom_icc_node *qn; struct icc_provider *provider; - u32 mode = NOC_QOS_MODE_BYPASS; + u32 mode = NOC_QOS_MODE_BYPASS_VAL; int rc = 0; qn = src->data; @@ -169,18 +173,17 @@ static int qcom_icc_set_noc_qos(struct icc_node *src, u64 max_bw) return 0; } - if (qn->qos.qos_mode != NOC_QOS_MODE_INVALID) - mode = qn->qos.qos_mode; - - if (mode == NOC_QOS_MODE_FIXED) { - dev_dbg(src->provider->dev, "NoC QoS: %s: Set Fixed mode\n", - qn->name); + if (qn->qos.qos_mode == NOC_QOS_MODE_FIXED) { + dev_dbg(src->provider->dev, "NoC QoS: %s: Set Fixed mode\n", qn->name); + mode = NOC_QOS_MODE_FIXED_VAL; rc = qcom_icc_noc_set_qos_priority(qp, &qn->qos); if (rc) return rc; - } else if (mode == NOC_QOS_MODE_BYPASS) { - dev_dbg(src->provider->dev, "NoC QoS: %s: Set Bypass mode\n", - qn->name); + } else if (qn->qos.qos_mode == NOC_QOS_MODE_BYPASS) { + dev_dbg(src->provider->dev, "NoC QoS: %s: Set Bypass mode\n", qn->name); + mode = NOC_QOS_MODE_BYPASS_VAL; + } else { + /* How did we get here? */ } return regmap_update_bits(qp->regmap, diff --git a/drivers/interconnect/qcom/icc-rpm.h b/drivers/interconnect/qcom/icc-rpm.h index a49af844ab13..8ba1918d7997 100644 --- a/drivers/interconnect/qcom/icc-rpm.h +++ b/drivers/interconnect/qcom/icc-rpm.h @@ -97,10 +97,12 @@ struct qcom_icc_desc { unsigned int qos_offset; }; -/* Valid for both NoC and BIMC */ -#define NOC_QOS_MODE_INVALID -1 -#define NOC_QOS_MODE_FIXED 0x0 -#define NOC_QOS_MODE_BYPASS 0x2 +/* Valid for all bus types */ +enum qos_mode { + NOC_QOS_MODE_INVALID = 0, + NOC_QOS_MODE_FIXED, + NOC_QOS_MODE_BYPASS, +}; int qnoc_probe(struct platform_device *pdev); int qnoc_remove(struct platform_device *pdev); From patchwork Tue Jan 3 17:30:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 638977 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4826BC53210 for ; Tue, 3 Jan 2023 17:31:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238179AbjACRbT (ORCPT ); Tue, 3 Jan 2023 12:31:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238166AbjACRbO (ORCPT ); Tue, 3 Jan 2023 12:31:14 -0500 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 452EFA443 for ; Tue, 3 Jan 2023 09:31:13 -0800 (PST) Received: by mail-lf1-x12b.google.com with SMTP id 1so46586400lfz.4 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=wIJ+QKy1gD2SfTc1kSdrVi+mF5m/A1DjgSxuE1s2FTx2wfL5It6LLbhR4qSXNhk8c8 T/ExfIepia9echZuBoKnIJo8Dgz3BjwZ3+L2sSivsE5gvPkK08Un+uGOcXrVyu8b8CO4 /tXQdCUjQH9dfZAKKgFRjr/xQe9CKZsdJZnISA+KnVv2be6Ip873irxBvNvIYL/JIPmS hpQ5p0FPqBXbpGrLc3hxBr2yC2PJR4JRbYFcr330a0J/zFTpN9fxnaLGeN5SixOPrgU0 JIbqIfsAZRp+aZj5+LLLHQGZnqf17rfsxTuDzHx9yBTF1iQE2cR5G7EhmrecTke1uBm4 8pDA== X-Gm-Message-State: AFqh2kpSBjbpdrJLjcQFgFgTpBl7WlZVou78xb3hcJl5AJEwecUz2+uI Iv6y57hAMjDJFguo647ipyw4EQ== X-Google-Smtp-Source: AMrXdXuk7EWv52SdG4bHxuow0TiS3P1sIt6t7Gulg1PYNBcGdWIs8EkXD8f0fC0lidu1hmp2netW7g== 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 Precedence: bulk List-ID: X-Mailing-List: linux-pm@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];