From patchwork Mon Jan 16 13:21:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 643357 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 7D790C54EBE for ; Mon, 16 Jan 2023 13:22:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229762AbjAPNWD (ORCPT ); Mon, 16 Jan 2023 08:22:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229707AbjAPNWD (ORCPT ); Mon, 16 Jan 2023 08:22:03 -0500 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAB4B166F4 for ; Mon, 16 Jan 2023 05:22:01 -0800 (PST) Received: by mail-lf1-x130.google.com with SMTP id j17so42727836lfr.3 for ; Mon, 16 Jan 2023 05:22:01 -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=HL6ky7ln9z3Ny11Hz0y0oGyiLhESeJRVbwJhDtGdLow=; b=baQMKjZ2KalTi8UpSKroWPRUEPOt1v9ORTOvw5DPvLkThdM94gMFWW16eRTldi4Ity 4AE6AD4apFOzxQr6Y5Qp9NqDVI+HpJAX4/4Pjsjy5/AdbtXmKIscElQdC5CJK2JsvBPM z5hCX7FIhwtqGdbjA7IYDZT/HqaKPtyTDTtvb9g4XAgzRT8ZWTQwnv8dqT+eWpAubJhT Y0bmV4GCNOiFftVJ7kMoTuihMzEioCfJEks1n8msvx8UVtHpd0eb9rgh6RCBEdmpZumr wdbGL5dj9rJGpAdMasukCvmYli5djWjZmOfvPOJ8T2zTftcUWMRoV5WbITywVwSlDrFo Kw0Q== 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=HL6ky7ln9z3Ny11Hz0y0oGyiLhESeJRVbwJhDtGdLow=; b=X3oEgU+zgpEFtA6xpAG+MXc5bal7zyN6yczHIImYOWxwBdn5qaIT5u50nwdmqRGJBB rwCUkZVL499+k9LiqeKzeQsbry5rEmhjczrmQh63pG5aecUm3Nh5Ac4N7qGqpflbNp+y ihFIoYBnY3JCTn5l7dEH1irD+TCpmyN8L9AMIpfurlfjYhZFVlDUyZGMYuSOJWaP32VR G7WP9hYxYxyjwr1EZQz8hY1p2WqV3Z/1xmu2R6yGkgD3WzS/0n3qDyPrbkzDA7PdOLCF 5Ddvkm/KDCFJ2YbxMBP8qjWCzw981sLaFF/AhpF6CwHPT9OKLksRm7o3IkAQqTpzt7pB nmSQ== X-Gm-Message-State: AFqh2kpXCgAG05einfigP4ndOXA0YuYoGocAPvXk/Fc87nFtgOZmGjJm 4ikva8D6+QKMrmTn9zZ6RItmZw== X-Google-Smtp-Source: AMrXdXuPD0SV3TJa9h1X/Y3lOd0DUV4CrD+Z7j05mTpnnrWhcx5h49rJxU5939VVinUHq1R507ameA== X-Received: by 2002:ac2:43a4:0:b0:4cb:3a60:65cc with SMTP id t4-20020ac243a4000000b004cb3a6065ccmr12933367lfl.5.1673875320156; Mon, 16 Jan 2023 05:22:00 -0800 (PST) Received: from localhost.localdomain (abym53.neoplus.adsl.tpnet.pl. [83.9.32.53]) by smtp.gmail.com with ESMTPSA id p9-20020a05651212c900b004cc58b91177sm5016653lfg.239.2023.01.16.05.21.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Jan 2023 05:21:59 -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, bryan.odonoghue@linaro.org, Konrad Dybcio , Georgi Djakov , Evan Green , Jun Nie , Greg Kroah-Hartman , Brian Masney , Yassine Oudjana , Dmitry Baryshkov , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 1/9] interconnect: qcom: rpm: make QoS INVALID default, separate out driver data Date: Mon, 16 Jan 2023 14:21:44 +0100 Message-Id: <20230116132152.405535-2-konrad.dybcio@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230116132152.405535-1-konrad.dybcio@linaro.org> References: <20230116132152.405535-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 | 22 ++++++++++++---------- drivers/interconnect/qcom/icc-rpm.h | 10 ++++++---- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c index df3196f72536..385a67c20956 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -48,6 +48,9 @@ #define NOC_QOS_MODEn_ADDR(n) (0xc + (n * 0x1000)) #define NOC_QOS_MODEn_MASK 0x3 +#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; @@ -153,7 +156,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; @@ -167,18 +170,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 Mon Jan 16 13:21:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 645379 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 C41CBC677F1 for ; Mon, 16 Jan 2023 13:22:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229494AbjAPNWF (ORCPT ); Mon, 16 Jan 2023 08:22:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229606AbjAPNWE (ORCPT ); Mon, 16 Jan 2023 08:22:04 -0500 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41489166ED for ; Mon, 16 Jan 2023 05:22:03 -0800 (PST) Received: by mail-lf1-x12f.google.com with SMTP id d30so37779387lfv.8 for ; Mon, 16 Jan 2023 05:22:03 -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=Swk5jur/LJSLYDdR06/yq1lTWOWMtwrPemJuvlpFTyc=; b=R9n/1F+1Mujr/flg0UOHoTB2j9mreP9lx9d23ApBhQbRRsx7qUMQWmpaxj8baKI5LU fgR7s3i3sgDQJnVyI2l1xYpJS0KGgqf0UffPwVx38JgOIqcg+rIHGkchxtjTw8P7kQ6E 29oz6zeKfGgD2qt7At14f87S+/84ZqkgKGJUWBAzWXkM1rIuRLSSH5yuCsgdzzHAlwUu OKUK/V39h0OEMwkyQ6cbA9OXX4pdRIxjpoyGSZlCMdE9PBh+u9qGJBPQF5jqHmyy1Bo+ tW6XlHgKop0l/lVJ4/tCfVnJiLirN3n78ZZrA8a+eGQZ9yrR7JkC3LWr6Aa68NC5Lg7b 1DXQ== 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=Swk5jur/LJSLYDdR06/yq1lTWOWMtwrPemJuvlpFTyc=; b=DCIyg9YaHPYS5U7smLhBLgScuX2oQgtrI4xXV/DlaE7TtciE6dJEgHfJZ7rRtm9nS9 PX5FFH74hwNcmA260NUyK3lUQ+ry6VMXBXfah8uH0HlWT5wvEi/4wCiBGn/tThZLJ8H+ 9/rEOnR7OvOT8qyLt2uINuFqgtwKPzpB2ipFHyr8TtuoUZ36KTwztM1V/q2nx+u6b4Oz OPt+4/5v9WCltSEpaniEbmQ70vdUY0DnpGlhEN0wpqnHCMCnUt/XP9xvTlUgAX6GbjOV xQeXFqMzvUFsa+/3v7r9YI1IMgwMAdM/XMCki0fFuq8m9iLsZQd5o+AasX8kNcwS/vzw 9BTw== X-Gm-Message-State: AFqh2kpkQxmmsGaFqIml0srnQV2UmP14tzcq2vSGgN4KptDmhoMMIa5S thz5HvnZGXfavQiJSv0/Fq2wHg== X-Google-Smtp-Source: AMrXdXszSUd/FJlVyli8K5bPrdpUNeOiT9v9t8V09lXx33j5o1opkJlWym/M4tprQCJNw/8XofcIZQ== X-Received: by 2002:a05:6512:2348:b0:4b5:1e6c:785c with SMTP id p8-20020a056512234800b004b51e6c785cmr31553528lfu.34.1673875321640; Mon, 16 Jan 2023 05:22:01 -0800 (PST) Received: from localhost.localdomain (abym53.neoplus.adsl.tpnet.pl. [83.9.32.53]) by smtp.gmail.com with ESMTPSA id p9-20020a05651212c900b004cc58b91177sm5016653lfg.239.2023.01.16.05.22.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Jan 2023 05:22:01 -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, bryan.odonoghue@linaro.org, Konrad Dybcio , Georgi Djakov , AngeloGioacchino Del Regno , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 2/9] interconnect: qcom: rpm: Always set QoS params on QNoC Date: Mon, 16 Jan 2023 14:21:45 +0100 Message-Id: <20230116132152.405535-3-konrad.dybcio@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230116132152.405535-1-konrad.dybcio@linaro.org> References: <20230116132152.405535-1-konrad.dybcio@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org On newer SoCs, 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 don't vote through RPM, QoS parameters should be set regardless, as we're requesting additional bandwidth by setting the interconnect clock rates. With NoC (the old-SoC bus type), this is not the case and they are mutually exclusive (so, the current upstream logic is correct). For BIMC however, newer SoCs expect QoS params to be always set (like QNoC) whereas older ones (like MSM8998) hang up completely when doing so, hence this will be addressed in the next commit. 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") Reviewed-by: Bryan O'Donoghue Signed-off-by: Konrad Dybcio --- drivers/interconnect/qcom/icc-rpm.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c index 385a67c20956..b1337f90c975 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -239,15 +239,27 @@ static int qcom_icc_rpm_set(int mas_rpm_id, int slv_rpm_id, u64 sum_bw) static int __qcom_icc_set(struct icc_node *n, struct qcom_icc_node *qn, u64 sum_bw) { + struct qcom_icc_provider *qp = to_qcom_provider(n->provider); + bool vote_ap, vote_rpm; int ret; - if (!qn->qos.ap_owned) { - /* send bandwidth request message to the RPM processor */ + if (qp->type == QCOM_ICC_QNOC) { + vote_ap = true; + vote_rpm = true; + } else { + vote_ap = qn->qos.ap_owned; + vote_rpm = !vote_ap; + } + + if (vote_rpm) { + /* Send bandwidth request message to the RPM processor */ 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 (vote_ap && 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 Mon Jan 16 13:21:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 643356 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 EFC76C54EBE for ; Mon, 16 Jan 2023 13:22:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229701AbjAPNWI (ORCPT ); Mon, 16 Jan 2023 08:22:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229846AbjAPNWF (ORCPT ); Mon, 16 Jan 2023 08:22:05 -0500 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 923A544B9 for ; Mon, 16 Jan 2023 05:22:04 -0800 (PST) Received: by mail-lf1-x131.google.com with SMTP id x40so8624010lfu.12 for ; Mon, 16 Jan 2023 05:22:04 -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=hCjth92iDA0+CEUYPpg2kXGSHQ36Fyihe/QHRf50rDs=; b=aYathcyuoUy7oj9IYCkQT0LIpFsJ46/2P5MRwrf5u1JDioTfkleVJyRSV/OkcFhMiu dJbIDlON0QKMoJ/ygkL9GnmAUE7YRB/HeA2G+BCDGBKU7K07GJbwnMUYA+9jRE+Y/KGU 8kNFgcbd/b2KZiJxRUPd0WmJg8rWD1LMT8dQKIYLg7ISSf7M/BxlsbwmBBdcQ4/kAqr1 92iMEsoxDYzQmRJ0AXG3tF/38xngjrrnNFkIcjDr96xYoXYhWXoCPTXvhQiEroy6pRlA cC8rOG+PuzhrbEHppu1UVLJUXwLXTaXnYxS3xsQtTeyqPuWlluyXV+1hfMp706genGyn zTSQ== 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=hCjth92iDA0+CEUYPpg2kXGSHQ36Fyihe/QHRf50rDs=; b=cm8NqLMKpE4I7k5tnnIWXc9rif26aY26+1uy8M28aI02FBYKOhhP4VsCvBYT1gZNLG QPsLKzpg9Na24iOpOXreXdpWrng5GMHU6C9/NgdLH2SOdorYXqKQkIseg/dHLlwcorb0 gF8s472k3q8t6KiMOKlEvu7mD2aicQNM7C6am1bTwy97bYIzHPB5sqYE5d/xYhtVhH+2 2C/ZhYvOGpeH0yncRgG+qtKTkrBCRPUjebw6ZNdEtS4aSm6PrM9R8CrJT09C8tbleXXN r7F9CC/Gq3gs+ICXJv5bk9fMrEYx+kqLy/voQPWk4fWdDGx6WvwNTOlMHoFVnQTF9OQI PiiQ== X-Gm-Message-State: AFqh2kr2/hBWuh+5AVFwr7Q/l+IuSdqRHTGkVZhpDcTGtNZHbIfF2brF CC2SEwN93/QpLHQpV9qRyqyosQ== X-Google-Smtp-Source: AMrXdXtdozWwbcCzV7ZqSlygOcghacwBpKAtl9SxI6IVUKnsLjSpcoykbnpjVU92pqzsHvQbexcXvw== X-Received: by 2002:a05:6512:238c:b0:4b5:2cf4:cc1d with SMTP id c12-20020a056512238c00b004b52cf4cc1dmr29364284lfv.68.1673875323011; Mon, 16 Jan 2023 05:22:03 -0800 (PST) Received: from localhost.localdomain (abym53.neoplus.adsl.tpnet.pl. [83.9.32.53]) by smtp.gmail.com with ESMTPSA id p9-20020a05651212c900b004cc58b91177sm5016653lfg.239.2023.01.16.05.22.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Jan 2023 05:22:02 -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, bryan.odonoghue@linaro.org, Konrad Dybcio , Georgi Djakov , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 3/9] interconnect: qcom: rpm: Add support for specifying channel num Date: Mon, 16 Jan 2023 14:21:46 +0100 Message-Id: <20230116132152.405535-4-konrad.dybcio@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230116132152.405535-1-konrad.dybcio@linaro.org> References: <20230116132152.405535-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. 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 b1337f90c975..41a6dd40c38a 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -329,6 +329,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 */ @@ -346,7 +347,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]; From patchwork Mon Jan 16 13:21:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 645378 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 15F09C46467 for ; Mon, 16 Jan 2023 13:22:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229476AbjAPNWK (ORCPT ); Mon, 16 Jan 2023 08:22:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230013AbjAPNWG (ORCPT ); Mon, 16 Jan 2023 08:22:06 -0500 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0437E1969A for ; Mon, 16 Jan 2023 05:22:06 -0800 (PST) Received: by mail-lf1-x131.google.com with SMTP id g13so42703715lfv.7 for ; Mon, 16 Jan 2023 05:22:05 -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=H2CA3XKJhGIFwYtcjl55qc0rkyBeiiGFyKWG5lDr9yU=; b=Zg9f6FuQNN+YMaEOqz4bwO1bAc0JeWaotuTB62rR5Q08caAonlDaFZYmlWB7B7cFaM k4QdkVtFIxqZlmvu5aUItkwmSI1V5YYVeT52ctIR+8IukL858upwV34pxaHSuc556jrE LQfO79CehGGPEzXctZS51AQ8bTabjAiUBBpvrCUr7lt3qO3qvBX6jIHX/29u4SqtMzx/ 0hueMepetojahUvCV/ZTJYTTzm9YF2Hl7fb5/4L0V0C8IF/u8LB9t2KAs5p5KPn6ltRe Y5A0FaSRmvtDDKaJfvDannAzE0HYQ4JPdXs5dsz7gbHW+Pnegh8y21hQL46XzCst9O2Y kbuw== 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=H2CA3XKJhGIFwYtcjl55qc0rkyBeiiGFyKWG5lDr9yU=; b=DdcB8X/w/OaJSGQ/bR0QVEpNmuPzdA7WCFG4M9Cxw6YCmDROEQbgXUQK+OoQjIbzTo jttfS7l0KhCjEB+oyd8+MQrfegdG1GkwYBN+uTbezBZA1UgOyh6f7oyi8W0bbUrTZqe7 eWB1RjyOAuj4xGI9dwshLygUtINqwCR6c78BF74AtmX8/HivLsZseDl3yyMZnTQCoHfi XcXD83rl23PNZ9nKcPv+HQ1D7JE2Irpcd2GlirW9wBPO2Y79pAnLRO9kLm8gxWwD7szw OxqjngMV2AT+fis3zKh+hQ8/3nzWJfUFR1LaaP+uhdwgt03nVpWhyXDvzS9oLfkKe2p6 t6bA== X-Gm-Message-State: AFqh2kpnbKKj1TOkmVRq3eIcMuBbcRtuLAKrQeqZYDu0g3/+WH7p9xTt ra8ljoo10D7bYhHtyO/prgjZ1GNuDu9YGR30 X-Google-Smtp-Source: AMrXdXtA6YxsaOLMlv2vK4pPp8n/rcrHdhcDgba7HYSGrrBUrK+6zzQojxbsSKxHPNEQO6Pco/xEuQ== X-Received: by 2002:ac2:538d:0:b0:4bb:d287:1147 with SMTP id g13-20020ac2538d000000b004bbd2871147mr3313598lfh.15.1673875324405; Mon, 16 Jan 2023 05:22:04 -0800 (PST) Received: from localhost.localdomain (abym53.neoplus.adsl.tpnet.pl. [83.9.32.53]) by smtp.gmail.com with ESMTPSA id p9-20020a05651212c900b004cc58b91177sm5016653lfg.239.2023.01.16.05.22.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Jan 2023 05:22:04 -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, bryan.odonoghue@linaro.org, Konrad Dybcio , Georgi Djakov , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 4/9] interconnect: qcom: Sort kerneldoc entries Date: Mon, 16 Jan 2023 14:21:47 +0100 Message-Id: <20230116132152.405535-5-konrad.dybcio@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230116132152.405535-1-konrad.dybcio@linaro.org> References: <20230116132152.405535-1-konrad.dybcio@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Sort the kerneldoc entries the same way the struct members are sorted. Signed-off-by: Konrad Dybcio --- drivers/interconnect/qcom/icc-rpm.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/interconnect/qcom/icc-rpm.h b/drivers/interconnect/qcom/icc-rpm.h index 8aed5400afda..21f440beda86 100644 --- a/drivers/interconnect/qcom/icc-rpm.h +++ b/drivers/interconnect/qcom/icc-rpm.h @@ -23,12 +23,12 @@ enum qcom_icc_type { /** * struct qcom_icc_provider - Qualcomm specific interconnect provider * @provider: generic interconnect provider - * @bus_clks: the clk_bulk_data table of bus clocks * @num_clks: the total number of clk_bulk_data entries * @type: the ICC provider type - * @qos_offset: offset to QoS registers * @regmap: regmap for QoS registers read/write access + * @qos_offset: offset to QoS registers * @bus_clk_rate: bus clock rate in Hz + * @bus_clks: the clk_bulk_data table of bus clocks */ struct qcom_icc_provider { struct icc_provider provider; From patchwork Mon Jan 16 13:21:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 643355 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 09A53C63797 for ; Mon, 16 Jan 2023 13:22:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229846AbjAPNWX (ORCPT ); Mon, 16 Jan 2023 08:22:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230254AbjAPNWJ (ORCPT ); Mon, 16 Jan 2023 08:22:09 -0500 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6771D44B9 for ; Mon, 16 Jan 2023 05:22:06 -0800 (PST) Received: by mail-lf1-x12f.google.com with SMTP id d30so37779666lfv.8 for ; Mon, 16 Jan 2023 05:22:06 -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=lFmuh1gUjOvZU3qpD6HzJrVwkb4FSDGIJE7ZVuwfaYA=; b=A/xx6C+e9OZduI2YFglEwXrr1Ujbx0ZdaJGUVgE9WEOyICiET2dsb3nl73vynaavlb jbXVeFQa4FSTx+rs31Ud+y4oAKvdqPH0xWsi4A636xVJY8NkUOZrFV6W0l0quae+DVBC o8TQffx5hZ/jy8gMQvJtwYxpaW0CTHgsXojor/SXpfpZjqSA0p4q6OYoBFmC5O88Rey3 EnzsRMZBeSuv7c3lDg1YTbJo0qZkycVFx3cGKbaRkFIQS8vGe6qR5UOB7bJgpleiDn15 VQzTPXaix4tE1Ou23hrx0v5QNNS3SsepKaHYnvy0VxX8/YQIm9h/OCj3I5/habDRPc1b Rv3g== 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=lFmuh1gUjOvZU3qpD6HzJrVwkb4FSDGIJE7ZVuwfaYA=; b=oNw49KuYmR1/iHIJLNWMmYM3vmNJbw5MMkoTxWip+77fePo50une63C/qJ6MsF38si VUIdLHaIpCyJwcB7BEXOM/5YpRpHjs6AJawEzVzddV41xIcQ43v1E5vPdSVvXJfmp+sY NV1qB81M8qXTT3pojZwj8kZqqaputMP4y8FG59Cu1yEOkbJIjIlAh7IgT7Szczi5YgOF 8r1twGI/v0jMh4mfAhBi8MjmD87PDOkyy/f1Sis06/F5aS/+QEFVq8rskfGVXGEzOsRN T+ihChQc+BUYKjJ4S0KNN6vda6xSAP8GnzwkK6uPpRV3WDP+EScvW16PPwtnvhvEKktx s8Ww== X-Gm-Message-State: AFqh2kpH+R4O2+c/ozZQCz+f6eucHltUd/qkEoF+zDpPE6srIiumJ2zp Nxmgc7rhNaeVsu9EuU7THHuNs2SDIP9UtDlw X-Google-Smtp-Source: AMrXdXsJ0MBwAOoWMPU55b7FoJZexNBxyPF34p+jyn9BedXKfgvvExaqqhzv90hP3RQl1xfSdCFrag== X-Received: by 2002:ac2:5687:0:b0:4cf:e09b:855c with SMTP id 7-20020ac25687000000b004cfe09b855cmr2599724lfr.10.1673875325914; Mon, 16 Jan 2023 05:22:05 -0800 (PST) Received: from localhost.localdomain (abym53.neoplus.adsl.tpnet.pl. [83.9.32.53]) by smtp.gmail.com with ESMTPSA id p9-20020a05651212c900b004cc58b91177sm5016653lfg.239.2023.01.16.05.22.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Jan 2023 05:22:05 -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, bryan.odonoghue@linaro.org, Konrad Dybcio , Georgi Djakov , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 5/9] interconnect: qcom: rpm: Rename icc desc clocks to bus_blocks Date: Mon, 16 Jan 2023 14:21:48 +0100 Message-Id: <20230116132152.405535-6-konrad.dybcio@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230116132152.405535-1-konrad.dybcio@linaro.org> References: <20230116132152.405535-1-konrad.dybcio@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Rename the "clocks" (and _names) fields of qcom_icc_desc to "bus_clocks" in preparation for introducing handling of clocks that need to be enabled but not voted on with aggregate frequency. Signed-off-by: Konrad Dybcio --- drivers/interconnect/qcom/icc-rpm.c | 6 +++--- drivers/interconnect/qcom/icc-rpm.h | 4 ++-- drivers/interconnect/qcom/msm8996.c | 12 ++++++------ drivers/interconnect/qcom/sdm660.c | 8 ++++---- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c index 41a6dd40c38a..31f6f09da4ae 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -453,9 +453,9 @@ int qnoc_probe(struct platform_device *pdev) qnodes = desc->nodes; num_nodes = desc->num_nodes; - if (desc->num_clocks) { - cds = desc->clocks; - cd_num = desc->num_clocks; + if (desc->num_bus_clocks) { + cds = desc->bus_clocks; + cd_num = desc->num_bus_clocks; } else { cds = bus_clocks; cd_num = ARRAY_SIZE(bus_clocks); diff --git a/drivers/interconnect/qcom/icc-rpm.h b/drivers/interconnect/qcom/icc-rpm.h index 21f440beda86..d6b4c56bf02c 100644 --- a/drivers/interconnect/qcom/icc-rpm.h +++ b/drivers/interconnect/qcom/icc-rpm.h @@ -91,8 +91,8 @@ struct qcom_icc_node { struct qcom_icc_desc { struct qcom_icc_node * const *nodes; size_t num_nodes; - const char * const *clocks; - size_t num_clocks; + const char * const *bus_clocks; + size_t num_bus_clocks; bool has_bus_pd; enum qcom_icc_type type; const struct regmap_config *regmap_cfg; diff --git a/drivers/interconnect/qcom/msm8996.c b/drivers/interconnect/qcom/msm8996.c index 25a1a32bc611..69fc50a6fa5c 100644 --- a/drivers/interconnect/qcom/msm8996.c +++ b/drivers/interconnect/qcom/msm8996.c @@ -1821,8 +1821,8 @@ static const struct qcom_icc_desc msm8996_a0noc = { .type = QCOM_ICC_NOC, .nodes = a0noc_nodes, .num_nodes = ARRAY_SIZE(a0noc_nodes), - .clocks = bus_a0noc_clocks, - .num_clocks = ARRAY_SIZE(bus_a0noc_clocks), + .bus_clocks = bus_a0noc_clocks, + .num_bus_clocks = ARRAY_SIZE(bus_a0noc_clocks), .has_bus_pd = true, .regmap_cfg = &msm8996_a0noc_regmap_config }; @@ -1866,8 +1866,8 @@ static const struct qcom_icc_desc msm8996_a2noc = { .type = QCOM_ICC_NOC, .nodes = a2noc_nodes, .num_nodes = ARRAY_SIZE(a2noc_nodes), - .clocks = bus_a2noc_clocks, - .num_clocks = ARRAY_SIZE(bus_a2noc_clocks), + .bus_clocks = bus_a2noc_clocks, + .num_bus_clocks = ARRAY_SIZE(bus_a2noc_clocks), .regmap_cfg = &msm8996_a2noc_regmap_config }; @@ -2005,8 +2005,8 @@ static const struct qcom_icc_desc msm8996_mnoc = { .type = QCOM_ICC_NOC, .nodes = mnoc_nodes, .num_nodes = ARRAY_SIZE(mnoc_nodes), - .clocks = bus_mm_clocks, - .num_clocks = ARRAY_SIZE(bus_mm_clocks), + .bus_clocks = bus_mm_clocks, + .num_bus_clocks = ARRAY_SIZE(bus_mm_clocks), .regmap_cfg = &msm8996_mnoc_regmap_config }; diff --git a/drivers/interconnect/qcom/sdm660.c b/drivers/interconnect/qcom/sdm660.c index 8d879b0bcabc..a22ba821efbf 100644 --- a/drivers/interconnect/qcom/sdm660.c +++ b/drivers/interconnect/qcom/sdm660.c @@ -1516,8 +1516,8 @@ static const struct qcom_icc_desc sdm660_a2noc = { .type = QCOM_ICC_NOC, .nodes = sdm660_a2noc_nodes, .num_nodes = ARRAY_SIZE(sdm660_a2noc_nodes), - .clocks = bus_a2noc_clocks, - .num_clocks = ARRAY_SIZE(bus_a2noc_clocks), + .bus_clocks = bus_a2noc_clocks, + .num_bus_clocks = ARRAY_SIZE(bus_a2noc_clocks), .regmap_cfg = &sdm660_a2noc_regmap_config, }; @@ -1659,8 +1659,8 @@ static const struct qcom_icc_desc sdm660_mnoc = { .type = QCOM_ICC_NOC, .nodes = sdm660_mnoc_nodes, .num_nodes = ARRAY_SIZE(sdm660_mnoc_nodes), - .clocks = bus_mm_clocks, - .num_clocks = ARRAY_SIZE(bus_mm_clocks), + .bus_clocks = bus_mm_clocks, + .num_bus_clocks = ARRAY_SIZE(bus_mm_clocks), .regmap_cfg = &sdm660_mnoc_regmap_config, }; From patchwork Mon Jan 16 13:21:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 645377 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 EDF1FC54EBE for ; Mon, 16 Jan 2023 13:22:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230465AbjAPNW0 (ORCPT ); Mon, 16 Jan 2023 08:22:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230300AbjAPNWJ (ORCPT ); Mon, 16 Jan 2023 08:22:09 -0500 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA6111A4AF for ; Mon, 16 Jan 2023 05:22:07 -0800 (PST) Received: by mail-lf1-x130.google.com with SMTP id j17so42728311lfr.3 for ; Mon, 16 Jan 2023 05:22:07 -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=OozpeIfKZUe2RNntDDmLbGsXIgqGkWGMpzQghUMFV4A=; b=SfWliU+hovruEsUKhOCTMCOp8YVB776IQ3eNYGZ3boVrFKk8zqjsmO/gSs3M/n+V+X 6AtbmgwZVH3sp+0KeATrkiwR7kLvc7PJfeVK3n3ftDdGH7YHdVrJ8cRP+Dh6yKdjIKa+ dq3ngFCB/m9RWiQLjXDyWPkJKo5KAVtq8DJyODedUiuAhhnVvyGYhWXGA8/qu5sEZ/+Q ClqMB+52pxICmeQ7zRmRA1PFAwyJJrraM+cK1F+rCu58HMwwQ/cNAWwwuzLbB5WgCVYT JWBlRWtAwluObgsqYSibXLnRx3yS+nEpDkudom6Pt88psqFhMWpDXBxZ9DFx71SdOGsO E2yw== 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=OozpeIfKZUe2RNntDDmLbGsXIgqGkWGMpzQghUMFV4A=; b=T6H2WP6gP/NaJBPS+VRvMeT5goBApwV6Xwgl292Z9PeWYUoUtorhUjRb6ISER3HTAj FjuUbotA5gvDjr1TC+l5rZo7oPFpR25LELxw0mr5LbnLqgl/ZRJ5q+gPT192KHOhD0CS uUm0Rc7fAKjJ+/+p2j2pwbEVzv1kvkOTZrgm6meaEjMHhUoiQC4q+n9MadgndNhbVthG ZiFsfljNp6tSQ4NXesCcSWojMOPqlScExHlJJ/4dQ0HO4L0weuA6Epa4bS99R8imBD3J kpCo0etfauEBAiEnr0//z+uZxcIQzSHxnWFtPcc9aUr91DDU39Vab0lSkntbOZnFnIym gjQg== X-Gm-Message-State: AFqh2kqI/KPvem6/kF3obAKjfZsktaYHQiKFuQLJnkIK3VSpllH26jHI 5ZV26CG4S/B63DH6FqIRQcjCwg== X-Google-Smtp-Source: AMrXdXtru/iuqO5bV0jvFb2fF+kIxQTmJxtE3KjzwlmUcFqA7pIhH4a13/i0GHvIfUwgrKzdzgGkxA== X-Received: by 2002:a05:6512:2085:b0:4d4:ea0f:a784 with SMTP id t5-20020a056512208500b004d4ea0fa784mr1943314lfr.19.1673875327310; Mon, 16 Jan 2023 05:22:07 -0800 (PST) Received: from localhost.localdomain (abym53.neoplus.adsl.tpnet.pl. [83.9.32.53]) by smtp.gmail.com with ESMTPSA id p9-20020a05651212c900b004cc58b91177sm5016653lfg.239.2023.01.16.05.22.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Jan 2023 05:22: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, bryan.odonoghue@linaro.org, Konrad Dybcio , Georgi Djakov , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 6/9] interconnect: qcom: rpm: Rename icc provider num_clocks to num_bus_clocks Date: Mon, 16 Jan 2023 14:21:49 +0100 Message-Id: <20230116132152.405535-7-konrad.dybcio@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230116132152.405535-1-konrad.dybcio@linaro.org> References: <20230116132152.405535-1-konrad.dybcio@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org In preparation for handling non-scaling clocks that we still have to enable, rename num_clocks to more descriptive num_bus_clocks. Signed-off-by: Konrad Dybcio --- drivers/interconnect/qcom/icc-rpm.c | 14 +++++++------- drivers/interconnect/qcom/icc-rpm.h | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c index 31f6f09da4ae..5888241c0477 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -392,7 +392,7 @@ static int qcom_icc_set(struct icc_node *src, struct icc_node *dst) return ret; } - for (i = 0; i < qp->num_clks; i++) { + for (i = 0; i < qp->num_bus_clks; i++) { /* * Use WAKE bucket for active clock, otherwise, use SLEEP bucket * for other clocks. If a platform doesn't set interconnect @@ -477,7 +477,7 @@ int qnoc_probe(struct platform_device *pdev) for (i = 0; i < cd_num; i++) qp->bus_clks[i].id = cds[i]; - qp->num_clks = cd_num; + qp->num_bus_clks = cd_num; qp->type = desc->type; qp->qos_offset = desc->qos_offset; @@ -507,11 +507,11 @@ int qnoc_probe(struct platform_device *pdev) } regmap_done: - ret = devm_clk_bulk_get_optional(dev, qp->num_clks, qp->bus_clks); + ret = devm_clk_bulk_get_optional(dev, qp->num_bus_clks, qp->bus_clks); if (ret) return ret; - ret = clk_bulk_prepare_enable(qp->num_clks, qp->bus_clks); + ret = clk_bulk_prepare_enable(qp->num_bus_clks, qp->bus_clks); if (ret) return ret; @@ -533,7 +533,7 @@ int qnoc_probe(struct platform_device *pdev) ret = icc_provider_add(provider); if (ret) { dev_err(dev, "error adding interconnect provider: %d\n", ret); - clk_bulk_disable_unprepare(qp->num_clks, qp->bus_clks); + clk_bulk_disable_unprepare(qp->num_bus_clks, qp->bus_clks); return ret; } @@ -566,7 +566,7 @@ int qnoc_probe(struct platform_device *pdev) return 0; err: icc_nodes_remove(provider); - clk_bulk_disable_unprepare(qp->num_clks, qp->bus_clks); + clk_bulk_disable_unprepare(qp->num_bus_clks, qp->bus_clks); icc_provider_del(provider); return ret; @@ -578,7 +578,7 @@ int qnoc_remove(struct platform_device *pdev) struct qcom_icc_provider *qp = platform_get_drvdata(pdev); icc_nodes_remove(&qp->provider); - clk_bulk_disable_unprepare(qp->num_clks, qp->bus_clks); + clk_bulk_disable_unprepare(qp->num_bus_clks, qp->bus_clks); icc_provider_del(&qp->provider); return 0; diff --git a/drivers/interconnect/qcom/icc-rpm.h b/drivers/interconnect/qcom/icc-rpm.h index d6b4c56bf02c..d4401f35f6d2 100644 --- a/drivers/interconnect/qcom/icc-rpm.h +++ b/drivers/interconnect/qcom/icc-rpm.h @@ -23,7 +23,7 @@ enum qcom_icc_type { /** * struct qcom_icc_provider - Qualcomm specific interconnect provider * @provider: generic interconnect provider - * @num_clks: the total number of clk_bulk_data entries + * @num_bus_clks: the total number of bus_clks clk_bulk_data entries * @type: the ICC provider type * @regmap: regmap for QoS registers read/write access * @qos_offset: offset to QoS registers @@ -32,7 +32,7 @@ enum qcom_icc_type { */ struct qcom_icc_provider { struct icc_provider provider; - int num_clks; + int num_bus_clks; enum qcom_icc_type type; struct regmap *regmap; unsigned int qos_offset; From patchwork Mon Jan 16 13:21:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 645376 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 5F035C677F1 for ; Mon, 16 Jan 2023 13:22:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229883AbjAPNWc (ORCPT ); Mon, 16 Jan 2023 08:22:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229691AbjAPNWX (ORCPT ); Mon, 16 Jan 2023 08:22:23 -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 8254E1CAF7 for ; Mon, 16 Jan 2023 05:22:10 -0800 (PST) Received: by mail-lf1-x132.google.com with SMTP id f34so42674629lfv.10 for ; Mon, 16 Jan 2023 05:22: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=uEgLdu9MBr5gHEyywHfCPlxu1SSAFMcXzGeB6TYQjOY=; b=sv/MiCcegjMVGmNJoieYkPeFvcWeYPUEoO5o5MeA92zqwe3jay2mboEWMrBtL8A1s4 BoYIFDdxSPoX1QOxp9AAo8fZ0oYgk6v0V/fSmSvGWCgq2/0Vys7fIO5Spn0r18jr98ES 0ZayDKMNd/uaR2hy3ZeSssSjisjpxrQ4Oj4nVMIH76b83+QnvFxJTFUFR/Xq8Q8qU0C6 CGu9fgs9SV7P61AepFqq+YvO7gWvfi4QHK9sgSrHLkIjsAShHnoGfSLWuKdsH6yjMF2K BGfXcqX2bvBil2icX3rfzKn1cR8ob614j13VF2nbxs7YBJ+Fs+PTIHMqwIoYOMuibFBI 205g== 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=uEgLdu9MBr5gHEyywHfCPlxu1SSAFMcXzGeB6TYQjOY=; b=Mcgq9HAiLNAIgA2QeoCQcD2bhk3W99pa2WGYSr1X2XVfwMrrWcgJaTq7z11WIQlB93 TtR4NIuYyYlzNnB6D63z8TIPmGeTrJc25wghJ61+FQggsh+AK1P6e8UsCSyVnE8x1A9l dQZCs9u0ySIOOMHbDpnlu5Fn9BoSRSR9xObOpDZB6qWlHaKYkcDgANB0UdQQhHQSBEXP txkzq4u8AN6mu0JHOxEz1f1vvUoj74mI1pupJdF1Jc7nmt5ehYnBhbxxWa469KJwcQt7 5wwSqwodgAbq/cCgkhS6oYZa+ViDSb0x2KDXZ5xZ+D/VjJj4uXWrNaGltE1IWHS3RBbF s2cw== X-Gm-Message-State: AFqh2koyqKNNNJfr8n6yj6h6i/bUiCDgwNEbNK9ulIxQGETPYSMKXmmi 5Jimb0ANMpwrqGBaQyIflhyuKw== X-Google-Smtp-Source: AMrXdXuSzfyp3y4Ri1oExdUC2zPF7pJRuDiIL9FmFjR6sfQAD0oQaxVKPbUFI/g7vzo/HwWXSVF8bw== X-Received: by 2002:a05:6512:3b99:b0:4a4:68b9:608c with SMTP id g25-20020a0565123b9900b004a468b9608cmr32382673lfv.23.1673875328874; Mon, 16 Jan 2023 05:22:08 -0800 (PST) Received: from localhost.localdomain (abym53.neoplus.adsl.tpnet.pl. [83.9.32.53]) by smtp.gmail.com with ESMTPSA id p9-20020a05651212c900b004cc58b91177sm5016653lfg.239.2023.01.16.05.22.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Jan 2023 05:22: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, bryan.odonoghue@linaro.org, Konrad Dybcio , Georgi Djakov , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 7/9] interconnect: qcom: rpm: Handle interface clocks Date: Mon, 16 Jan 2023 14:21:50 +0100 Message-Id: <20230116132152.405535-8-konrad.dybcio@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230116132152.405535-1-konrad.dybcio@linaro.org> References: <20230116132152.405535-1-konrad.dybcio@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Some (but not all) providers (or their specific nodes) require specific clocks to be turned on before they can be accessed. Failure to ensure that results in a seemingly random system crash (which would usually happen at boot with the interconnect driver built-in), resulting in the platform not booting up properly. Limit the number of bus_clocks to 2 (which is the maximum that SMD RPM interconnect supports anyway) and handle non-scaling clocks separately. Update MSM8996 and SDM660 drivers to make sure they do not regress with this change. This unfortunately has to be done in one patch to prevent either compile errors or broken bisect. Signed-off-by: Konrad Dybcio --- drivers/interconnect/qcom/icc-rpm.c | 48 ++++++++++++++++++++++------- drivers/interconnect/qcom/icc-rpm.h | 10 ++++-- drivers/interconnect/qcom/msm8996.c | 22 ++++++------- drivers/interconnect/qcom/sdm660.c | 16 ++++------ 4 files changed, 60 insertions(+), 36 deletions(-) diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c index 5888241c0477..509cadf398e9 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -453,28 +453,43 @@ int qnoc_probe(struct platform_device *pdev) qnodes = desc->nodes; num_nodes = desc->num_nodes; - if (desc->num_bus_clocks) { - cds = desc->bus_clocks; - cd_num = desc->num_bus_clocks; + if (desc->num_intf_clocks) { + cds = desc->intf_clocks; + cd_num = desc->num_intf_clocks; } else { - cds = bus_clocks; - cd_num = ARRAY_SIZE(bus_clocks); + /* 0 intf clocks is perfectly fine */ + cd_num = 0; } - qp = devm_kzalloc(dev, struct_size(qp, bus_clks, cd_num), GFP_KERNEL); + qp = devm_kzalloc(dev, struct_size(qp, intf_clks, cd_num), GFP_KERNEL); if (!qp) return -ENOMEM; - qp->bus_clk_rate = devm_kcalloc(dev, cd_num, sizeof(*qp->bus_clk_rate), - GFP_KERNEL); - if (!qp->bus_clk_rate) - return -ENOMEM; - data = devm_kzalloc(dev, struct_size(data, nodes, num_nodes), GFP_KERNEL); if (!data) return -ENOMEM; + for (i = 0; i < cd_num; i++) + qp->intf_clks[i].id = cds[i]; + qp->num_intf_clks = cd_num; + + if (desc->num_bus_clocks) { + cds = desc->bus_clocks; + cd_num = desc->num_bus_clocks; + } else { + cds = bus_clocks; + cd_num = ARRAY_SIZE(bus_clocks); + } + + /* + * This is not realistic, scaling is only possible with an + * always-active and an active-only clock, or at least one + * of them in some very bizzare cases. + */ + if (WARN_ON(cd_num > 2)) + cd_num = 2; + for (i = 0; i < cd_num; i++) qp->bus_clks[i].id = cds[i]; qp->num_bus_clks = cd_num; @@ -515,6 +530,14 @@ int qnoc_probe(struct platform_device *pdev) if (ret) return ret; + ret = devm_clk_bulk_get(dev, qp->num_intf_clks, qp->intf_clks); + if (ret) + return ret; + + ret = clk_bulk_prepare_enable(qp->num_intf_clks, qp->intf_clks); + if (ret) + return ret; + if (desc->has_bus_pd) { ret = dev_pm_domain_attach(dev, true); if (ret) @@ -533,6 +556,7 @@ int qnoc_probe(struct platform_device *pdev) ret = icc_provider_add(provider); if (ret) { dev_err(dev, "error adding interconnect provider: %d\n", ret); + clk_bulk_disable_unprepare(qp->num_intf_clks, qp->intf_clks); clk_bulk_disable_unprepare(qp->num_bus_clks, qp->bus_clks); return ret; } @@ -566,6 +590,7 @@ int qnoc_probe(struct platform_device *pdev) return 0; err: icc_nodes_remove(provider); + clk_bulk_disable_unprepare(qp->num_intf_clks, qp->intf_clks); clk_bulk_disable_unprepare(qp->num_bus_clks, qp->bus_clks); icc_provider_del(provider); @@ -578,6 +603,7 @@ int qnoc_remove(struct platform_device *pdev) struct qcom_icc_provider *qp = platform_get_drvdata(pdev); icc_nodes_remove(&qp->provider); + clk_bulk_disable_unprepare(qp->num_intf_clks, qp->intf_clks); clk_bulk_disable_unprepare(qp->num_bus_clks, qp->bus_clks); icc_provider_del(&qp->provider); diff --git a/drivers/interconnect/qcom/icc-rpm.h b/drivers/interconnect/qcom/icc-rpm.h index d4401f35f6d2..729573f0d9fe 100644 --- a/drivers/interconnect/qcom/icc-rpm.h +++ b/drivers/interconnect/qcom/icc-rpm.h @@ -24,20 +24,24 @@ enum qcom_icc_type { * struct qcom_icc_provider - Qualcomm specific interconnect provider * @provider: generic interconnect provider * @num_bus_clks: the total number of bus_clks clk_bulk_data entries + * @num_intf_clks: the total number of intf_clks clk_bulk_data entries * @type: the ICC provider type * @regmap: regmap for QoS registers read/write access * @qos_offset: offset to QoS registers * @bus_clk_rate: bus clock rate in Hz * @bus_clks: the clk_bulk_data table of bus clocks + * @intf_clks: the clk_bulk_data table of interface clocks */ struct qcom_icc_provider { struct icc_provider provider; int num_bus_clks; + int num_intf_clks; enum qcom_icc_type type; struct regmap *regmap; unsigned int qos_offset; - u64 *bus_clk_rate; - struct clk_bulk_data bus_clks[]; + u64 bus_clk_rate[2]; + struct clk_bulk_data bus_clks[2]; + struct clk_bulk_data intf_clks[]; }; /** @@ -93,6 +97,8 @@ struct qcom_icc_desc { size_t num_nodes; const char * const *bus_clocks; size_t num_bus_clocks; + const char * const *intf_clocks; + size_t num_intf_clocks; bool has_bus_pd; enum qcom_icc_type type; const struct regmap_config *regmap_cfg; diff --git a/drivers/interconnect/qcom/msm8996.c b/drivers/interconnect/qcom/msm8996.c index 69fc50a6fa5c..1a5e0ad36cc4 100644 --- a/drivers/interconnect/qcom/msm8996.c +++ b/drivers/interconnect/qcom/msm8996.c @@ -21,21 +21,17 @@ #include "smd-rpm.h" #include "msm8996.h" -static const char * const bus_mm_clocks[] = { - "bus", - "bus_a", +static const char * const mm_intf_clocks[] = { "iface" }; -static const char * const bus_a0noc_clocks[] = { +static const char * const a0noc_intf_clocks[] = { "aggre0_snoc_axi", "aggre0_cnoc_ahb", "aggre0_noc_mpu_cfg" }; -static const char * const bus_a2noc_clocks[] = { - "bus", - "bus_a", +static const char * const a2noc_intf_clocks[] = { "aggre2_ufs_axi", "ufs_axi" }; @@ -1821,8 +1817,8 @@ static const struct qcom_icc_desc msm8996_a0noc = { .type = QCOM_ICC_NOC, .nodes = a0noc_nodes, .num_nodes = ARRAY_SIZE(a0noc_nodes), - .bus_clocks = bus_a0noc_clocks, - .num_bus_clocks = ARRAY_SIZE(bus_a0noc_clocks), + .intf_clocks = a0noc_intf_clocks, + .num_intf_clocks = ARRAY_SIZE(a0noc_intf_clocks), .has_bus_pd = true, .regmap_cfg = &msm8996_a0noc_regmap_config }; @@ -1866,8 +1862,8 @@ static const struct qcom_icc_desc msm8996_a2noc = { .type = QCOM_ICC_NOC, .nodes = a2noc_nodes, .num_nodes = ARRAY_SIZE(a2noc_nodes), - .bus_clocks = bus_a2noc_clocks, - .num_bus_clocks = ARRAY_SIZE(bus_a2noc_clocks), + .intf_clocks = a2noc_intf_clocks, + .num_intf_clocks = ARRAY_SIZE(a2noc_intf_clocks), .regmap_cfg = &msm8996_a2noc_regmap_config }; @@ -2005,8 +2001,8 @@ static const struct qcom_icc_desc msm8996_mnoc = { .type = QCOM_ICC_NOC, .nodes = mnoc_nodes, .num_nodes = ARRAY_SIZE(mnoc_nodes), - .bus_clocks = bus_mm_clocks, - .num_bus_clocks = ARRAY_SIZE(bus_mm_clocks), + .intf_clocks = mm_intf_clocks, + .num_intf_clocks = ARRAY_SIZE(mm_intf_clocks), .regmap_cfg = &msm8996_mnoc_regmap_config }; diff --git a/drivers/interconnect/qcom/sdm660.c b/drivers/interconnect/qcom/sdm660.c index a22ba821efbf..0e8a96f4ce90 100644 --- a/drivers/interconnect/qcom/sdm660.c +++ b/drivers/interconnect/qcom/sdm660.c @@ -127,15 +127,11 @@ enum { SDM660_SNOC, }; -static const char * const bus_mm_clocks[] = { - "bus", - "bus_a", +static const char * const mm_intf_clocks[] = { "iface", }; -static const char * const bus_a2noc_clocks[] = { - "bus", - "bus_a", +static const char * const a2noc_intf_clocks[] = { "ipa", "ufs_axi", "aggre2_ufs_axi", @@ -1516,8 +1512,8 @@ static const struct qcom_icc_desc sdm660_a2noc = { .type = QCOM_ICC_NOC, .nodes = sdm660_a2noc_nodes, .num_nodes = ARRAY_SIZE(sdm660_a2noc_nodes), - .bus_clocks = bus_a2noc_clocks, - .num_bus_clocks = ARRAY_SIZE(bus_a2noc_clocks), + .intf_clocks = a2noc_intf_clocks, + .num_intf_clocks = ARRAY_SIZE(a2noc_intf_clocks), .regmap_cfg = &sdm660_a2noc_regmap_config, }; @@ -1659,8 +1655,8 @@ static const struct qcom_icc_desc sdm660_mnoc = { .type = QCOM_ICC_NOC, .nodes = sdm660_mnoc_nodes, .num_nodes = ARRAY_SIZE(sdm660_mnoc_nodes), - .bus_clocks = bus_mm_clocks, - .num_bus_clocks = ARRAY_SIZE(bus_mm_clocks), + .intf_clocks = mm_intf_clocks, + .num_intf_clocks = ARRAY_SIZE(mm_intf_clocks), .regmap_cfg = &sdm660_mnoc_regmap_config, }; From patchwork Mon Jan 16 13:21:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 643354 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 9C12BC46467 for ; Mon, 16 Jan 2023 13:22:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230295AbjAPNWb (ORCPT ); Mon, 16 Jan 2023 08:22:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230426AbjAPNWW (ORCPT ); Mon, 16 Jan 2023 08:22:22 -0500 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B24CD1CAFD for ; Mon, 16 Jan 2023 05:22:10 -0800 (PST) Received: by mail-lf1-x131.google.com with SMTP id o20so10731716lfk.5 for ; Mon, 16 Jan 2023 05:22: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=DdsB/Dtp2SmoDR4CMEbLw4wpi1c6sbrU8O+sGAR6VMk=; b=TsMPh4NWK3l+1qtViZlV7Cj03vv9URHxALw6ifrSvpJc2eET/CaQMQij5ybzGmEdNR LVZUJKjJWMSCRi6WrGkRVO+Wg0YqR/ZXTFsi/oKwue/Kst9alfkZUZOYTmlqkcscecQ+ xCP2rUraBO53/8h80bVH2iTvMsbaopOwsV53dqnXCWqRV1Nw0bDwXWggJmi9F49BZ9iK gSII8r6yXGVhzcFJnYUbhkxWLpA+DQzq7f0E2QgT6Iwogm5LIc0iZhHBQCqlOJNJ80zy Y4tjWJkoU2hMUcCkUR0sLhvlvx7jyBFiETn6Rbxt+WZzeM0Z3CsbzEsblVR/Fx/UVlyv asBA== 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=DdsB/Dtp2SmoDR4CMEbLw4wpi1c6sbrU8O+sGAR6VMk=; b=6AIPVpWlkL2YPeHuGoHBxI0UMXqQHyB8aNpCn/0W6uzuERR3/TfvETcNxW/nBDMqmm g07X3DirtBIj8E4jBnpwHzjp9eSRg7dIM9xqESAjIm0P6Jwx7Ktgw5FykB/j/PzcHSWG 2LBS303NWujsueUIC7NFIV0Xd2oGChcrw8vYEY9uRK6+10ep1vxiu2gcQq4bHYMQl0TY al5YAVD8cmxbQSkmzEvLTrJsNGFFagKvLp3ShRBko5rZ4HfJXP3I+rYEKyXjGEAOX8Ko Fcz2nZ5ic2IB0n3SMJkznT6Hr/s1IS9GND4faNcFcXAwkwgyqAnWJLOulhQ9Tb76lx2H 0u9w== X-Gm-Message-State: AFqh2kqAghWHugDJKRsKzxD8Qhlb5yLH0zPj+1JuZrkTSHSpOvwCvlFb iiSWk8Ttkr5AmCAYfUvKjrxDQQ== X-Google-Smtp-Source: AMrXdXt5e51/ix/1tHSNe+Eo6bw/lo4TXuvqYHbRtUJs1whIyXtN3Fmq1Kff98Omb6euKvV+K28kIw== X-Received: by 2002:a05:6512:46b:b0:4c5:a0b4:336b with SMTP id x11-20020a056512046b00b004c5a0b4336bmr3223793lfd.1.1673875330273; Mon, 16 Jan 2023 05:22:10 -0800 (PST) Received: from localhost.localdomain (abym53.neoplus.adsl.tpnet.pl. [83.9.32.53]) by smtp.gmail.com with ESMTPSA id p9-20020a05651212c900b004cc58b91177sm5016653lfg.239.2023.01.16.05.22.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Jan 2023 05:22: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, bryan.odonoghue@linaro.org, Konrad Dybcio , Georgi Djakov , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 8/9] interconnect: qcom: rpm: Add a way to always set QoS registers Date: Mon, 16 Jan 2023 14:21:51 +0100 Message-Id: <20230116132152.405535-9-konrad.dybcio@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230116132152.405535-1-konrad.dybcio@linaro.org> References: <20230116132152.405535-1-konrad.dybcio@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org On newer SoCs (there's no clear boundary, but probably "new enough" means every interconnect provider is either BIMC or QNoC and there are no old-style NoC hosts) we're expected to set QoS registers regardless of the ap_owned param. Add a bool in the qcom_icc_provider and make the logic assume it's okay to set the registers when it's set. Signed-off-by: Konrad Dybcio --- drivers/interconnect/qcom/icc-rpm.c | 2 +- drivers/interconnect/qcom/icc-rpm.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c index 509cadf398e9..343e6021a93a 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -243,7 +243,7 @@ static int __qcom_icc_set(struct icc_node *n, struct qcom_icc_node *qn, bool vote_ap, vote_rpm; int ret; - if (qp->type == QCOM_ICC_QNOC) { + if (qp->type == QCOM_ICC_QNOC || qp->always_set_qos) { vote_ap = true; vote_rpm = true; } else { diff --git a/drivers/interconnect/qcom/icc-rpm.h b/drivers/interconnect/qcom/icc-rpm.h index 729573f0d9fe..3c8888482a39 100644 --- a/drivers/interconnect/qcom/icc-rpm.h +++ b/drivers/interconnect/qcom/icc-rpm.h @@ -28,6 +28,7 @@ enum qcom_icc_type { * @type: the ICC provider type * @regmap: regmap for QoS registers read/write access * @qos_offset: offset to QoS registers + * @always_set_qos: whether to always set QoS registers regardless of bus type * @bus_clk_rate: bus clock rate in Hz * @bus_clks: the clk_bulk_data table of bus clocks * @intf_clks: the clk_bulk_data table of interface clocks @@ -39,6 +40,7 @@ struct qcom_icc_provider { enum qcom_icc_type type; struct regmap *regmap; unsigned int qos_offset; + bool always_set_qos; u64 bus_clk_rate[2]; struct clk_bulk_data bus_clks[2]; struct clk_bulk_data intf_clks[]; From patchwork Mon Jan 16 13:21:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 643353 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 05D1BC46467 for ; Mon, 16 Jan 2023 13:22:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230411AbjAPNWj (ORCPT ); Mon, 16 Jan 2023 08:22:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230253AbjAPNWZ (ORCPT ); Mon, 16 Jan 2023 08:22:25 -0500 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DFC61CF70 for ; Mon, 16 Jan 2023 05:22:12 -0800 (PST) Received: by mail-lf1-x129.google.com with SMTP id o20so10731817lfk.5 for ; Mon, 16 Jan 2023 05:22:12 -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=t6b0TwGgzkpcqXdb/NMeqpUwn36E7G6fTsEYVsv4xJ4=; b=qdJwWxPcd0u+wekOpipC4vGGjkJSdRnwl7C0Nl3y/tT81k9opLLsYd+Aej4asu8BDp 8T7pq+pnjp97vfhVumc1TgJSnN4G2Xx1bUfgbjcKzfxaTgrxaLqnD8sshewFadWjZOXu TrJ32YbOv0L/t+MM3HvI6uROKmi3GFv4iD6Qv8wIKMqOOBOq/hHKf/mD8kY5qaKpIn0D uU6oOOkgLW7XqGUKyBuOBGuGuGlYix8ecJ4aeQKLFRHtrPuOE8j+F+DneLu9qluZmqLb fbacTbfOPReHBQkJ+8eyYo1bQsxJednSqVSKdrFwjlbYNJTXSR0nfTyev3BvD5g9pH1N 6nwA== 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=t6b0TwGgzkpcqXdb/NMeqpUwn36E7G6fTsEYVsv4xJ4=; b=7q0ez/AixkPPrjfVhMP680YMtsprKaF9hBWh2M9bb3qZYnh/7s8Fw9xQVd9Ehqz+QR 9uRdWtE+bsNM360514GRbIYv1hWUlAyvNXpmEhL6NZA3rAL1NI/I9REmlpOEh+HJOnI2 39ksuTNaRg4iire++6SQLtVjCG86bDoBaFSyuytfjdVOIj57zkeVU4NQPoYv5iGANSpl 5oMH2Z1BAQn/em+aF5K44dWUiQPAd2X8SLuYghy0wKh0xisYVDF2Mh4MFN5JV2YwP47+ BclS2cBXmjdKd5KebA6cMs+WKCcHdqccPFfJXIooWPoAHNvJoCr/qlVqEBSqTstYMElV OBjQ== X-Gm-Message-State: AFqh2kokNVLafWqapQcSFKTHKm/nfye+Pzqsv2CBuSU75hYcgmSgxEBx IQYZRnKemeyNukvebiDT+DDJKA== X-Google-Smtp-Source: AMrXdXt0B1JhS8wmN3eSrHIp72RTHYzZVdVGNRTRSzck9D6zF7N+W6eN+EqYbaHFgDajziYzd1U9LA== X-Received: by 2002:a05:6512:1111:b0:4cc:7e0e:8d5c with SMTP id l17-20020a056512111100b004cc7e0e8d5cmr11874928lfg.37.1673875331697; Mon, 16 Jan 2023 05:22:11 -0800 (PST) Received: from localhost.localdomain (abym53.neoplus.adsl.tpnet.pl. [83.9.32.53]) by smtp.gmail.com with ESMTPSA id p9-20020a05651212c900b004cc58b91177sm5016653lfg.239.2023.01.16.05.22.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Jan 2023 05:22: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, bryan.odonoghue@linaro.org, Konrad Dybcio , Georgi Djakov , Dmitry Baryshkov , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 9/9] interconnect: qcom: rpm: Don't use clk_get_optional for bus clocks anymore Date: Mon, 16 Jan 2023 14:21:52 +0100 Message-Id: <20230116132152.405535-10-konrad.dybcio@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230116132152.405535-1-konrad.dybcio@linaro.org> References: <20230116132152.405535-1-konrad.dybcio@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Commit dd42ec8ea5b9 ("interconnect: qcom: rpm: Use _optional func for provider clocks") relaxed the requirements around probing bus clocks. This was a decent solution for making sure MSM8996 would still boot with old DTs, but now that there's a proper fix in place that both old and new DTs will be happy about, revert back to the safer variant of the function. Fixes: dd42ec8ea5b9 ("interconnect: qcom: rpm: Use _optional func for provider clocks") Signed-off-by: Konrad Dybcio --- drivers/interconnect/qcom/icc-rpm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c index 343e6021a93a..8cff724661f2 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -522,7 +522,7 @@ int qnoc_probe(struct platform_device *pdev) } regmap_done: - ret = devm_clk_bulk_get_optional(dev, qp->num_bus_clks, qp->bus_clks); + ret = devm_clk_bulk_get(dev, qp->num_bus_clks, qp->bus_clks); if (ret) return ret;