From patchwork Tue Feb 14 14:37:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 57049 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3011463wrn; Tue, 14 Feb 2023 06:38:41 -0800 (PST) X-Google-Smtp-Source: AK7set8UgmqwE2E6d2qPDBbtKpPnqTgFuVulBnLBxa+fTY4D0yKuMST0ex4K8UAyOd+LFHRFB3Na X-Received: by 2002:a05:6a20:4286:b0:bf:5d4e:1328 with SMTP id o6-20020a056a20428600b000bf5d4e1328mr2900100pzj.25.1676385521263; Tue, 14 Feb 2023 06:38:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676385521; cv=none; d=google.com; s=arc-20160816; b=Hqnu16ueTqqKiiOMVGNuQgswSJXMZF1BZA5zxT8NSWwEGeT3fDjLxPBqNDUBaPMCyx 78VNRIYz9otYVpY3XWOI6ZEIGzyGSsplG6nudLF9QzTTgC0RoQSBncaoZdBb956fcT4i 1tkGkgT9m+pVOYAlxlaCgl4pjGF+iGFtxPKGuj4yXiZB014vhX5y0QMtaHnOkAEe6+1N BzBflCqMojdhj0EjQz3NkRwJG3Zz0aiIZxGjutnQzXR681SqbY1AzETjJBw1vYwuomFC iTuR3bq0LmRIpO+EuVV21OysV+0aLlYToX+eaCFa46hhqClMFKNSfeGgyb24f1AYu3C8 kg2A== 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=eCg1qb28rj+gFKZAL4LyzRFUv7U0u9J7xzWR97CVfk4=; b=p39RZJS/0QmGlJRnNJ2du6FPLgFtzJ+dKLbkZa+pvxWvPJeilqjjZjIFpesjG8K/fH 7QRwV+ELY5D+gYEtFTMVgtbOiLlE6QhvSrTUGjMjfsZl2gIGgdQ4CQh/pDo9I+tzYgNH ArbHklGyr6RfstemuWf30H2Pvo1Gh+D/Hs8oblC6ATat5WLIChZ6LkY93ZtRyiS0xS/x pBeiKZwuyJUudHj7VLedLNu4wrq2IU7KwT4g27QUEoFoiMoNdurcA6YE2MD4JC9WFMm4 6j2qSsLMJu5bL+83wjb/tXOjw2H3wkxpX2/1Zg8BguiZ7zC2xljl8Cg1KDqX/Tkq6upN pniA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Z3dvwBab; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y2-20020a623202000000b0059b98e82de3si14001942pfy.314.2023.02.14.06.38.28; Tue, 14 Feb 2023 06:38:41 -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=Z3dvwBab; 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 S233035AbjBNOiE (ORCPT + 99 others); Tue, 14 Feb 2023 09:38:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229648AbjBNOiD (ORCPT ); Tue, 14 Feb 2023 09:38:03 -0500 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C06222782 for ; Tue, 14 Feb 2023 06:38:01 -0800 (PST) Received: by mail-ed1-x52a.google.com with SMTP id eq11so17681485edb.6 for ; Tue, 14 Feb 2023 06:38: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=eCg1qb28rj+gFKZAL4LyzRFUv7U0u9J7xzWR97CVfk4=; b=Z3dvwBabyJaQvCC1kbnr4v2nvDp/l7oYaIw8Wgbskb/3LrTPmcx/J90JqRdHMBWXHb lanZGKYBqLs8IrMWUUi5M7w90AXqv/iESKI/efJnvHF1og9ea/px5GQwjOXKgl2SUyBU FT0sDEbUzJMR/t/zuJMM2o+KwtyfnAVqnyegkTfNA7Rn46VO4d5bw0gQmmqAMMJ1mc3J 1bICs9a0Q4pQG4GF/ktHwpCGEyVAE7NhFfyQsvs9ewHQcoDJ42PTa5lFlGacMz2kH5qL 3smcmKyzOmAN4+S8lWorlOxCeyvv6zZrS82hzAt7YmQYiwvGpxv0Cpta29mNGyvRv7yu DHGQ== 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=eCg1qb28rj+gFKZAL4LyzRFUv7U0u9J7xzWR97CVfk4=; b=s8xnm7OboBddEZ3LsSAw+BKBL6YDo1UGnO+KAU/LCkYEbycucXgCl5tHbN6i65crPH wstHzxgKYqH8/o2UE9n7miHM1ZdCdbc5ShXJowphhE0VmrmOcc+M3/ewi5XeVyoNOv8n NgkkpPakrUtysLG+U7+Tpwgi6QNd9YkEiwQs0gsFKtG9n+NfPE8R4rwUTUXYJktS9k1L VYcbHMsjnI4POddL4cF0/ustOtJbVAGL7ynijZ/nK+TYqACPgae/z8l0jn0LnQmTrUfN Co66s+P8zbOYntqdU1zkkP+oTueFK0E+I6HML4x7rzPkYW/plhZi/k3/Wtvj6kjWDjTH tfOw== X-Gm-Message-State: AO0yUKUeu7W9U9bpd9c2o5wroDrnrIyKfixplfC5YQFRXIbzIownhcz2 FakVzF8Jj+GwSe0iYTT9kDeaGx4TVn1E5m/B X-Received: by 2002:a50:d5c2:0:b0:4ac:bdac:ce20 with SMTP id g2-20020a50d5c2000000b004acbdacce20mr2539297edj.35.1676385480174; Tue, 14 Feb 2023 06:38:00 -0800 (PST) Received: from localhost.localdomain (abxh117.neoplus.adsl.tpnet.pl. [83.9.1.117]) by smtp.gmail.com with ESMTPSA id eg21-20020a056402289500b004acb6189693sm5378052edb.83.2023.02.14.06.37.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 06:37:59 -0800 (PST) From: Konrad Dybcio To: linux-arm-msm@vger.kernel.org, andersson@kernel.org, agross@kernel.org Cc: marijn.suijten@somainline.org, Konrad Dybcio , Georgi Djakov , Evan Green , Jun Nie , Brian Masney , Greg Kroah-Hartman , Yassine Oudjana , Dmitry Baryshkov , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 01/12] interconnect: qcom: rpm: make QoS INVALID default, separate out driver data Date: Tue, 14 Feb 2023 15:37:09 +0100 Message-Id: <20230214143720.2416762-2-konrad.dybcio@linaro.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230214143720.2416762-1-konrad.dybcio@linaro.org> References: <20230214143720.2416762-1-konrad.dybcio@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757817624339254312?= X-GMAIL-MSGID: =?utf-8?q?1757817624339254312?= 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 Tue Feb 14 14:37:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 57055 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3011754wrn; Tue, 14 Feb 2023 06:39:19 -0800 (PST) X-Google-Smtp-Source: AK7set/u9s6EZsvazR8bzTzi8Cn5jDWzshY7V+CU94UyIg6PqHvqLZmSOLsjmXr5ZNSSct1wUDUd X-Received: by 2002:a17:90b:4b84:b0:233:c301:32ac with SMTP id lr4-20020a17090b4b8400b00233c30132acmr2871494pjb.31.1676385559199; Tue, 14 Feb 2023 06:39:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676385559; cv=none; d=google.com; s=arc-20160816; b=gfYwfYpdeXKxh6jchLi+VvDNowDsSPrY5GKHhQQO+bulro5u5fHan7jf1AHfDYIR/9 yeUl7vIiw5Vpe/RCC45ZHzMXhxA6CFD10ATDqzgT1zbEaK95dnGFVE7DI1LcczPkijBK exczJC6AnqXgtxkJ8D3zqUPeK2d2g61R3x7jbXUAv9saTiMUFf0KicIEYs97BVmnOZKn zEkdu9Pmht7ltQ4kaRTqWzNBaRKUD/PO1NbiOqdPbFigo4cSwvgwtwY9Vv6YTsbpSmvJ dPW0bk8UxI2D9+uMDCNvDxBdXzO1w563umaufNIzB5qF5EFY/a2jbqjHEgpMh4wGnGa/ oh1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=M85Txp3qLBn12UcZyAcNozii0oizm6RueYAIHWFw6cU=; b=PC5e2GTYgBM3fVEekDeO9B4rx3VM5jP6vRDrVInT7a4yc7EhKo51KUwMOE3lZhj0PC gF5KmlcOxEsmVugFXj209YmQOmvyTDjUNtRwag+/6zK0UnzTHY/iW0XaQ4Blf/OMtd6k K3z7t3KyGb8nRKqQnHM8mXx+U6h8q7ZbUIEniKbSuVNYkyIkg/kytXf8R8xwKPGrl1fV zWeUujyCi9gQHs5ZyjvOo34kXHef8IHDua6BA11Xt92QKzRtTP5KEvlYoMnpTxE/eG5f ZUd875uDC+tczdzkcmmMSIztR/9UhVNOoSim9EO+AvrQNhHA5AxAuIZkr6RS25x1TOc+ pypA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qd0o44Kb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 145-20020a630097000000b004fb149738c0si14492156pga.81.2023.02.14.06.39.06; Tue, 14 Feb 2023 06:39:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qd0o44Kb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233122AbjBNOiH (ORCPT + 99 others); Tue, 14 Feb 2023 09:38:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230182AbjBNOiE (ORCPT ); Tue, 14 Feb 2023 09:38:04 -0500 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08A16BDF4 for ; Tue, 14 Feb 2023 06:38:03 -0800 (PST) Received: by mail-ed1-x535.google.com with SMTP id w3so10688394edc.2 for ; Tue, 14 Feb 2023 06:38:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=M85Txp3qLBn12UcZyAcNozii0oizm6RueYAIHWFw6cU=; b=qd0o44Kbx1EkTg2qCbYQ88IqKD2XXI8v0ZJsoaIdotgP0HkxnI4I19WQ24tTPfMAOW lFpmnCRzr5pw1XHh7wzWefbw7qtNFHCqecYZrxwfMNsunLnZSMueBJzXoD9OPx0/W/en QKB71ok8wQMLINpM8ANzhnK0SlwfdC+1SiPyhjIF3VmnQ7/VM4wlIygaptS/be0heIpN S05FwmHSI7OHkWFwJfyZ51z2/cz6zQ+CQnfcbjqg08f6lCb+3xXhYGxHffyLA9Dhahxl tI7ekiocb7FlKLETfreIF5bZv+FJXV6KdIzknhKtY4ogObFbAJgEGQ/jVXmvbD2ToUdo RBZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=M85Txp3qLBn12UcZyAcNozii0oizm6RueYAIHWFw6cU=; b=3P3R1Ksy9zwMtmk5cGqBlO1Ke1Ab4FRgcCR7t2HA+7ZrQBdkZsQVH6PCIHYjuFpmzS IAYhcZU4dl7fFDwNtMedMt1Wdu0x5E13DIlSP1Uz0ZMW/n6yyW7h+RRFmVR9Nriq8JdC qiW6XZzAANwXGPqUiajtXOY9WmL3z8wUUKdxSBF+JQbVUtZ7VRinmuot0uTBJ0Sh8evH Qc5LFFbfkxRUuwEc93T646aT1Ah21iQBln6GqSvH/LuhWZ1u3G8p5vIS9FHZf53zH0fO zmzYl6S/z22aPlo02FUK+mb5E7HRpZyoPi+LyOcpUFQ+gOKMROSNA8//S/UJdcYFwrDo HRPA== X-Gm-Message-State: AO0yUKWMg+xMW8sbuzq8stfY5xrihQH/Ny2BBW1nAbtHNEov2gn9s7HN Host15E9AGb77xU5umb8QYmTXg== X-Received: by 2002:a50:bace:0:b0:4ab:4cf0:4ab3 with SMTP id x72-20020a50bace000000b004ab4cf04ab3mr2741589ede.38.1676385481563; Tue, 14 Feb 2023 06:38:01 -0800 (PST) Received: from localhost.localdomain (abxh117.neoplus.adsl.tpnet.pl. [83.9.1.117]) by smtp.gmail.com with ESMTPSA id eg21-20020a056402289500b004acb6189693sm5378052edb.83.2023.02.14.06.38.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 06:38:01 -0800 (PST) From: Konrad Dybcio To: linux-arm-msm@vger.kernel.org, andersson@kernel.org, agross@kernel.org Cc: marijn.suijten@somainline.org, Konrad Dybcio , Bryan O'Donoghue , Georgi Djakov , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 02/12] interconnect: qcom: rpm: Add support for specifying channel num Date: Tue, 14 Feb 2023 15:37:10 +0100 Message-Id: <20230214143720.2416762-3-konrad.dybcio@linaro.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230214143720.2416762-1-konrad.dybcio@linaro.org> References: <20230214143720.2416762-1-konrad.dybcio@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757817664368185753?= X-GMAIL-MSGID: =?utf-8?q?1757817664368185753?= Some nodes, like EBI0 (DDR) or L3/LLCC, may be connected over more than one channel. This should be taken into account in bandwidth calcualtion, as we're supposed to feed msmbus with the per-channel bandwidth. Add support for specifying that and use it during bandwidth aggregation. Reviewed-by: Bryan O'Donoghue Signed-off-by: Konrad Dybcio --- drivers/interconnect/qcom/icc-rpm.c | 7 ++++++- drivers/interconnect/qcom/icc-rpm.h | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c index 385a67c20956..7fcc2d86117b 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -317,6 +317,7 @@ static void qcom_icc_bus_aggregate(struct icc_provider *provider, { struct icc_node *node; struct qcom_icc_node *qn; + u64 sum_avg[QCOM_ICC_NUM_BUCKETS]; int i; /* Initialise aggregate values */ @@ -334,7 +335,11 @@ static void qcom_icc_bus_aggregate(struct icc_provider *provider, list_for_each_entry(node, &provider->nodes, node_list) { qn = node->data; for (i = 0; i < QCOM_ICC_NUM_BUCKETS; i++) { - agg_avg[i] += qn->sum_avg[i]; + if (qn->channels) + sum_avg[i] = div_u64(qn->sum_avg[i], qn->channels); + else + sum_avg[i] = qn->sum_avg[i]; + agg_avg[i] += sum_avg[i]; agg_peak[i] = max_t(u64, agg_peak[i], qn->max_peak[i]); } } diff --git a/drivers/interconnect/qcom/icc-rpm.h b/drivers/interconnect/qcom/icc-rpm.h index 8ba1918d7997..8aed5400afda 100644 --- a/drivers/interconnect/qcom/icc-rpm.h +++ b/drivers/interconnect/qcom/icc-rpm.h @@ -66,6 +66,7 @@ struct qcom_icc_qos { * @id: a unique node identifier * @links: an array of nodes where we can go next while traversing * @num_links: the total number of @links + * @channels: number of channels at this node (e.g. DDR channels) * @buswidth: width of the interconnect between a node and the bus (bytes) * @sum_avg: current sum aggregate value of all avg bw requests * @max_peak: current max aggregate value of all peak bw requests @@ -78,6 +79,7 @@ struct qcom_icc_node { u16 id; const u16 *links; u16 num_links; + u16 channels; u16 buswidth; u64 sum_avg[QCOM_ICC_NUM_BUCKETS]; u64 max_peak[QCOM_ICC_NUM_BUCKETS]; From patchwork Tue Feb 14 14:37:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 57050 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3011510wrn; Tue, 14 Feb 2023 06:38:47 -0800 (PST) X-Google-Smtp-Source: AK7set8Nv6OjOT47RHSTL7UVxLUKileu7r7+K4qcdcJQRUpB5yLc8m1WSHtHt8K+E4l7vN+hTci8 X-Received: by 2002:a17:902:d4d0:b0:19a:688c:6ad5 with SMTP id o16-20020a170902d4d000b0019a688c6ad5mr3452952plg.29.1676385527444; Tue, 14 Feb 2023 06:38:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676385527; cv=none; d=google.com; s=arc-20160816; b=xjkyI7M0ifWqJGH16NiEVkJrIYSBMS3zhCqyjwkrpwhj7jVm3aSuU+1kXBTDhOGz2f 0QVJBzMEEj/LzGmapUQ+BrU8Zmv6pUUHTKb6dxfd55OFicoK6r7pAvp6+/NsTUwGxaee uUWC2mrO55PFZjeCcAUB39YDU2fH/ij6lOMgixJoeI6q+8ZZi3U33QokMa+5E9lB+R0Z wFgVSrLtKG13nNmezZ1ym1dPv78jiuitna4Z0DpDfqguWLltOx/HV/LsmHXMEjaCSBoE 2Rbmc+dL11/GkTsI6UZr9Z/5tSNzugaK/4asV6LhlHrxmExh8hfkYRuYf3BAavdK9w5Q sQaA== 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=xya4N6V99R7wqs6ZB8AIcG0kln00FcHSqxn/UQPegiI=; b=GPDu+3HOaWxndKV8pIZEPZLiD263Zf7CJ99ut2uInis02RgTilAARBXwM5F98oT4ZD htFjXQ8gzTmLI4aQXOivi+4e+x0QrNANLQihAlkjLnBtJBwW6qsIxGDktJNiRSOeZiBi i9pNQOyPhS32R3n7dVKKYjiOdHeLhCdlmz6riCVhfs10Jl4XljGTA5xE5xVN+IdLoEqf Gcl8BxBdeUOZo6DBcZpGbUHLiMyuV9isYP4kwGx+sRdr8HktPubqnVO+Zygmnc3DER4m ISwclKFwdgG6xp+5cwEfXhPy26P6KfQ6vW/PZCPKWeUqB1vCD0EsMfYCDQKceCbVPPyi 4SZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EiKX90X5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k10-20020a170902c40a00b001926b6927fbsi15934726plk.10.2023.02.14.06.38.34; Tue, 14 Feb 2023 06:38:47 -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=EiKX90X5; 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 S233186AbjBNOiL (ORCPT + 99 others); Tue, 14 Feb 2023 09:38:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232912AbjBNOiE (ORCPT ); Tue, 14 Feb 2023 09:38:04 -0500 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A5B6C178 for ; Tue, 14 Feb 2023 06:38:03 -0800 (PST) Received: by mail-ed1-x533.google.com with SMTP id c1so13900523edt.4 for ; Tue, 14 Feb 2023 06:38: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=xya4N6V99R7wqs6ZB8AIcG0kln00FcHSqxn/UQPegiI=; b=EiKX90X5fNy6Nz388HaVIX5jCbaMOoZ3lyT6vGA9izzswRrk84eWbViJSEZRmUi3Gi 94y1It23vgAqwGQrE+SSetmPTORcz56fR2R0M9eaYQCBQvNkJhYjvTertdPnMvx8FOaF ZO3A81QM2XO3zC+fxlBsNPt4K6WbqaRBQt+rtDWhogu+HfDqY94cDCtIflO9wcBXE3AU V2QMdZhRgU9e1+B41q2dyfzla/RAWLG5Kybd+Gae3ta2qdtZ+VOKPqldXktsVgYwKPeK /38J2E28nQig1q53uIa3Ug2maU0Mt/38e2RD5wO4egr0G6kYw3X4gnroRfE2pmHogOhB 8/tw== 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=xya4N6V99R7wqs6ZB8AIcG0kln00FcHSqxn/UQPegiI=; b=PavF5/ol43wvglskQZ93ylz+DmG+Z5TNHGY5qBdcUx3RvQmlJzb3tF1AJ7jrW+jsPV rOTonRu3bPbogNyk9laMaempFQTfyTjDpBTIzqPb6Eax93xf0vUGWbsRtLjpI6I8K/gp lMB0OjrYDzsRvN2GHATRSkZvFa+5fnFdRe0YQwhSsdeTzvze+1z1/FJxI25yU3mmv3CT M/hwNgBJ91rK0bFfC08FFghwgpYLBf68c1hOKDIugxZIOhKijQBNPjDzCLWOKuZY0IXp CLPi9YeF0I95P5p7zBQMcefao2jqoCWh1fo5xlqPxAfpBKSti/nUFO+g3M0wVHqmf+zo yB7g== X-Gm-Message-State: AO0yUKUIpGrqGbCB5uB/6rKI6xDuAKRP7gClpipiU+82hI5+D/MQ1sO0 kKU8/rdpHcWsxv+1izqd/Yjz9w== X-Received: by 2002:a50:f690:0:b0:4aa:cc30:b858 with SMTP id d16-20020a50f690000000b004aacc30b858mr2817345edn.7.1676385482814; Tue, 14 Feb 2023 06:38:02 -0800 (PST) Received: from localhost.localdomain (abxh117.neoplus.adsl.tpnet.pl. [83.9.1.117]) by smtp.gmail.com with ESMTPSA id eg21-20020a056402289500b004acb6189693sm5378052edb.83.2023.02.14.06.38.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 06:38:02 -0800 (PST) From: Konrad Dybcio To: linux-arm-msm@vger.kernel.org, andersson@kernel.org, agross@kernel.org Cc: marijn.suijten@somainline.org, Konrad Dybcio , Georgi Djakov , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 03/12] interconnect: qcom: Sort kerneldoc entries Date: Tue, 14 Feb 2023 15:37:11 +0100 Message-Id: <20230214143720.2416762-4-konrad.dybcio@linaro.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230214143720.2416762-1-konrad.dybcio@linaro.org> References: <20230214143720.2416762-1-konrad.dybcio@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757817631183868059?= X-GMAIL-MSGID: =?utf-8?q?1757817631183868059?= 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 Tue Feb 14 14:37:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 57051 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3011546wrn; Tue, 14 Feb 2023 06:38:53 -0800 (PST) X-Google-Smtp-Source: AK7set8/iZHcYAfK2hHb3DMPw9nuonpLPXaUT8ESOGdieynfPDXxvvGuZP/6L2TPqk9BYjG18j+D X-Received: by 2002:a05:6a21:3283:b0:be:ffb5:e41d with SMTP id yt3-20020a056a21328300b000beffb5e41dmr3465335pzb.25.1676385532817; Tue, 14 Feb 2023 06:38:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676385532; cv=none; d=google.com; s=arc-20160816; b=hc4LqCaATBprxm7APeIZNF47h0R+lSP9xqE7C/GsGKaVomPTuxhrnxx6HPgR2WQ+TS nvzj6RMLNbMR/YWtkSBP/QCa1g1ZX+EK+/jkv+NXAPzyPyzfHNlK7n9QJoJJXIZAR2gH aHaUN2z1LDl6siiBjPNvVoB0y7sl4ePdcwWyUcH542QkmWd5l1Jrp6xiO9RBhBJVmpjK LeIoL1aLjAcDgFlbsw7QHOJcxTQOnrcU31inJT2sf9wEo0Y1Of6TY10HFst+9lvKCMwT ov+64MzDTGIi1YH04UM5TtuHj1FGLsV/bFumqYFW0B97+PY+bmfJ+tw3pJMbJsevHntS 6pFg== 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=oGJSq0Wr4uz9FI0u0GqF9NY+B8XZsAQlpMrzNgb5opk=; b=wKxagr/iveIwKzEXa6umkeaopvmUHBBdy2tzS8bD6Sh7NYdcptoyTmPhmdCsndVsix pJbbNIOOBsLArZeucgL2uV/RX8pN5ese2vrogpY6deDEM4P+8Jfl+XVpSbANkEbT++4S xZ/h58GUm+P4FbqeKx4hNQz8vWpvvzWHnVbooT5L/Dgo9m4KJwuc6naXHDc9CI3b2G3P pojN5zqr/mnL/wPK6MMIqVLO9xLg4tnd7QlW7rTIi7S+Gi/Wfm2xRRXG4GXsENaapwsE DK1R/kJIPYtjgb698H/hV+1MUETZnTUeMQx2Zvdv5YLzh5NPZfELD/V3lC4Du9XvI8MC 3e+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=x3LuLpnN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q13-20020a638c4d000000b004fbb2e0e960si5217474pgn.738.2023.02.14.06.38.39; Tue, 14 Feb 2023 06:38:52 -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=x3LuLpnN; 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 S233294AbjBNOiP (ORCPT + 99 others); Tue, 14 Feb 2023 09:38:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231775AbjBNOiF (ORCPT ); Tue, 14 Feb 2023 09:38:05 -0500 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D19AB76D for ; Tue, 14 Feb 2023 06:38:04 -0800 (PST) Received: by mail-ed1-x52a.google.com with SMTP id d40so16452458eda.8 for ; Tue, 14 Feb 2023 06:38: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=oGJSq0Wr4uz9FI0u0GqF9NY+B8XZsAQlpMrzNgb5opk=; b=x3LuLpnNBnfsU4LihWq8n2PcnDwSP+CxBmabMAGb5IarPQOFyAPYvq3Xn70Do32byu xyefB30eO+cLDPp5hpDBwsB7MdHGFlUm5gbFLgytUlff0zMlP5Ttz5Sq5zY6GWx56XYH K54KzbpOTa3DX4hxOVuouAvuo1ODmRv7dmqd2FQt0kVjW57fqH0Q7qJw2KcD2e9I8iJs HgtdWMbivg4BeifLRntY7xYv5E0Sqy8mIO3h02jqSlPhCXda0tYwdyMTWPZCAmBxuYEl is240G5X0sf2ApZ9JKcjDVxmp+ej/W3yn5hGNAQHQdwRZpkia/UvmTjHS1N3Zi9koly3 W45A== 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=oGJSq0Wr4uz9FI0u0GqF9NY+B8XZsAQlpMrzNgb5opk=; b=01AOYLb1t94w+DRj9oJgltQHNqiBj1em03CJ1yNqRLeBylqbli5igPoQHDOiD4Ex6U cNmh82qmHcujcI1rhdHql4Oau/+D/Hcr478dtANtOoe5ZFMzpXDr18ilEb+ezhVXf6og epxI+/lMNx37i/08CT8WKcIiY38GgyoeKtFa1kg+zTb27gJ5ChuzPmckAx7UlOEDP0fn r+Io36rNXE90h/OGxe/F/i1+5flXq/MKEKkluuAB92iuxju0AR7quR1kE+k9Kz8mlGF6 HzhSnw8P7d2FzirexUtnSaq9bzjjFKeqD4MrV3it17K1jRJ/tNTbgq/OQh/2LfG9s1xm tQjQ== X-Gm-Message-State: AO0yUKWtdlwwUo3CKk5ORq7uTZ1trNO2ydUUYG758b2E1yxm1KtBbdCy X3EF7ZFewR5TUkVPhe4nazHsdw== X-Received: by 2002:a50:9ea7:0:b0:4ac:bc4e:767 with SMTP id a36-20020a509ea7000000b004acbc4e0767mr2950705edf.5.1676385484127; Tue, 14 Feb 2023 06:38:04 -0800 (PST) Received: from localhost.localdomain (abxh117.neoplus.adsl.tpnet.pl. [83.9.1.117]) by smtp.gmail.com with ESMTPSA id eg21-20020a056402289500b004acb6189693sm5378052edb.83.2023.02.14.06.38.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 06:38:03 -0800 (PST) From: Konrad Dybcio To: linux-arm-msm@vger.kernel.org, andersson@kernel.org, agross@kernel.org Cc: marijn.suijten@somainline.org, Konrad Dybcio , Georgi Djakov , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 04/12] interconnect: qcom: rpm: Rename icc desc clocks to bus_blocks Date: Tue, 14 Feb 2023 15:37:12 +0100 Message-Id: <20230214143720.2416762-5-konrad.dybcio@linaro.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230214143720.2416762-1-konrad.dybcio@linaro.org> References: <20230214143720.2416762-1-konrad.dybcio@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757817636295356404?= X-GMAIL-MSGID: =?utf-8?q?1757817636295356404?= 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 7fcc2d86117b..37a299f4de6a 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -441,9 +441,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 Tue Feb 14 14:37:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 57052 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3011570wrn; Tue, 14 Feb 2023 06:38:57 -0800 (PST) X-Google-Smtp-Source: AK7set+8VXKE+Noplx7pOS7HgfCnxL2stk9BAcaiUKbJmUEJVhjlMJUW1/QEx6Xq1AbDHP1hfYEP X-Received: by 2002:a17:902:ce85:b0:19a:996c:5c33 with SMTP id f5-20020a170902ce8500b0019a996c5c33mr3447588plg.41.1676385536727; Tue, 14 Feb 2023 06:38:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676385536; cv=none; d=google.com; s=arc-20160816; b=KKqI/mzZuC3WtpmrGE7Fs5352mbFWeLRc1lHR1dm5ZZD7UMkxlDKhmRqMu6hG9LThB W30f0+rlXzSaae1yDFiFTqTcmQyk3IttlNvXJP/QShfnO3b96gTTlPgXxE1XIpsOad5e 39SGpME54c2zubRggyY8hGKYXZn4buVo80wAMGU9eAHUGr97pGPjhA7jX86Ib1j7TWDx H1yC630gfvrws3aM2/qeJYskF+aDQzbSuRkwTzKsyOSgJRLZ+TlSR/AKmJLLhPRXLbq6 j/lHOPA4Rbh1qFqs+atgtw501SsPQjVgVluDoEvFNEwSdz/fs7vH2etd2Vys3HYOeIXA X2EA== 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=AZQ+Q5LCAHKHQSgy3yl+J2ss+UfKNp2XcWG5M2noUQM=; b=RveQ7OO3qYVDjS0U9juT0+JMCk8NtHlwpUA8EuNKs+4P1KRpK8JsuTTJ/caLz1QXvu oZvKwBxgKMsbc2+JiCtpN0FOPkn6gbW+2c9q54esPf4C1fFIge03SAvR7cegg4qnVMu6 qmRHbBwSi6TG8kDDY/RucYOvKMFNf/EP9B5slhGDfS/Sx98jderj/LU/VrisN5DNVcdm gfAIDFl/HaGMHaL5hkN+mDR2guzMZ5gQqtPl6wt7I7nkcm8JX7WvTaLNcjAkMf151+we qW7PJQ8C6BAN3XYrgPb6zIpQbgC/alOZnQgx5ANhktRvt7DbIwyp6BzBcjQbAPeu+nvH CXhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=v1ohS2cM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q13-20020a170902bd8d00b001870a181f24si13861606pls.222.2023.02.14.06.38.43; Tue, 14 Feb 2023 06:38:56 -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=v1ohS2cM; 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 S233225AbjBNOiS (ORCPT + 99 others); Tue, 14 Feb 2023 09:38:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233137AbjBNOiH (ORCPT ); Tue, 14 Feb 2023 09:38:07 -0500 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C588E244A8 for ; Tue, 14 Feb 2023 06:38:05 -0800 (PST) Received: by mail-ed1-x535.google.com with SMTP id w3so10688687edc.2 for ; Tue, 14 Feb 2023 06:38: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=AZQ+Q5LCAHKHQSgy3yl+J2ss+UfKNp2XcWG5M2noUQM=; b=v1ohS2cMmusUnrYLqFzah4WLvGW1n71og7wpUyBJLys2wk2hZ37taW+GANhe+QR4za 0DOvf593h4DgFfNJ5fm1jIIB2fv2GuheHbyghXCjW8TL7/uYRyTuIw5ed8ojxLQFC2ds Wk81OqgArmoTcFLX1m/MFZFds4Rwtgm6ULpmSvJUgMWev8DWEwm7ivnjU67SRAYf3Y79 rYXfJSYr3PBWFxv0+8fWEMpgXlxIMMbJ5Ta8ghlhxCoTwFqOnkomCbdIA8luwgMt7YVi r87gSLqRIZ6497Ws8SoZHf5BB2ezK2b02FfwIyCJSe+PQZ9ypqVSVEUygfkJbxZJgfwO f1Kw== 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=AZQ+Q5LCAHKHQSgy3yl+J2ss+UfKNp2XcWG5M2noUQM=; b=iuYuhIXWKgfs5c4n0BsGTbMc5iHD25Za2UlZjPK88c/YrRCq8/H7hp0R2q68BEHTTs x8e2D0ktMqbOXlPsLLCgL6FTxpba3xSycQaqPz8vOJTvaX09gDJGk1SWrfJyFW5rNbaF mN5WXEDM7V/4N6DLXIMSirSlRxLzcJq/3FVF/nbpen9GeUczXAFV3+ENrMTHCSiKT+eo C1GegG+YPS8qwo/dBdXII1pilOmmaYGrvrCVLI5zc7nTfskXVBFbCjTsS2uHvGNACKO8 wE3qCNx4z4506pM7RRTlZCow1XQEMeXse3g37L2QrU/bmkP8wS2bKySriqthTvT99Gkh 65BQ== X-Gm-Message-State: AO0yUKUiAq71WW7/EgmmJvqYgcWxxq8oTKEAKvxz7QWQ3V6yIsQE0IBm 6tptn8svmydKuNOgdCVK8Es4fg== X-Received: by 2002:a50:9ee7:0:b0:4aa:a390:bf4a with SMTP id a94-20020a509ee7000000b004aaa390bf4amr2987011edf.20.1676385485402; Tue, 14 Feb 2023 06:38:05 -0800 (PST) Received: from localhost.localdomain (abxh117.neoplus.adsl.tpnet.pl. [83.9.1.117]) by smtp.gmail.com with ESMTPSA id eg21-20020a056402289500b004acb6189693sm5378052edb.83.2023.02.14.06.38.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 06:38:05 -0800 (PST) From: Konrad Dybcio To: linux-arm-msm@vger.kernel.org, andersson@kernel.org, agross@kernel.org Cc: marijn.suijten@somainline.org, Konrad Dybcio , Georgi Djakov , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 05/12] interconnect: qcom: rpm: Rename icc provider num_clocks to num_bus_clocks Date: Tue, 14 Feb 2023 15:37:13 +0100 Message-Id: <20230214143720.2416762-6-konrad.dybcio@linaro.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230214143720.2416762-1-konrad.dybcio@linaro.org> References: <20230214143720.2416762-1-konrad.dybcio@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757817640593614412?= X-GMAIL-MSGID: =?utf-8?q?1757817640593614412?= 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 37a299f4de6a..76e8f660b932 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -380,7 +380,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 @@ -465,7 +465,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; @@ -495,11 +495,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; @@ -521,7 +521,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; } @@ -554,7 +554,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; @@ -566,7 +566,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 Tue Feb 14 14:37:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 57053 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3011604wrn; Tue, 14 Feb 2023 06:39:01 -0800 (PST) X-Google-Smtp-Source: AK7set9wcB+xs10Bncd43lP7uzdOcVpvSi0mhjDFw8pcJygN3FekESXv1nPU4BleX/AhdfUWf+ht X-Received: by 2002:aa7:9591:0:b0:5a8:4883:4213 with SMTP id z17-20020aa79591000000b005a848834213mr2031176pfj.20.1676385540761; Tue, 14 Feb 2023 06:39:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676385540; cv=none; d=google.com; s=arc-20160816; b=gtd12rAG3CgM9+wpl03h99OfCregCGnkyfUm3lOjb1s5hWgK21q5cU/GZBX6RZYig+ j1DOe29TWOhOvqCucr1R95iJhefVz+PHnZ+3RhNRDD7/979gbduW7zEsvvcNKKzRifXv mPWzYqKzUC/xqd/bHIOdcU8j/BB1EJLa6rf1UjUu3f8j9FMrCcRFmuv+It6O3QHiKKOC RjRA/uHAYIw+1oChh/V+4JYHQCI6gZ62gmdmfDQsJ6EHG0VQl6AuIbLx4ap7aAncrqC9 QvH+U4Y6bOSExHNy2qRaG2YlKg08foIvqwjTPiKSG5TJZ0rF1JK0OIAbwx8orMOsnK74 Tquw== 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=wnoag2PDXeTodhCC/Jz33tcviOKenSJ94G9E57jsB1Y=; b=d+lxKpteNnZEoNiRnVQ1zHZHSWE+7iLWvTe2IX9EpTXsLh3vRwwyBOXjFmNHfzY4fC 0PmZov71vyTApLjlAf9pEDhPR00Rnoa9AS742I2Y73PCQvGNHaMyCHEouAJDVATLt7sO 7+sMTIpqgG/mcqV6taK4NctDdd1CTeqrUiD9KHPIW+wnCbi7KOuuuyeefVIPt46VrigL sYWXzDGFlttWDAv7vF0CAVK8SosW9R7oKlpMWG5tUg2ALPKQl4H5EWScJEfRNC50bKrl ZWoxnrtUunxYVktx1Y00QrzkdysyZNcr6R3zXdDuNEdeFmxvX/DfxeAY5DAddtnF58EE PywQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=G32qIIWs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v64-20020a622f43000000b0058dfbc405ffsi14793625pfv.197.2023.02.14.06.38.46; Tue, 14 Feb 2023 06:39:00 -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=G32qIIWs; 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 S233252AbjBNOiW (ORCPT + 99 others); Tue, 14 Feb 2023 09:38:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233196AbjBNOiL (ORCPT ); Tue, 14 Feb 2023 09:38:11 -0500 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 584462B09A for ; Tue, 14 Feb 2023 06:38:08 -0800 (PST) Received: by mail-ed1-x531.google.com with SMTP id u21so17726201edv.3 for ; Tue, 14 Feb 2023 06:38:08 -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=wnoag2PDXeTodhCC/Jz33tcviOKenSJ94G9E57jsB1Y=; b=G32qIIWsfmUdtlTrGXGRdiBZcjkQNRFtnqRKqE1rtT+7qOh1mM3z9TzsexlhcWH32T ZAp+ZTfaZZIpLgLDPHOhSfYE/2VUGMkGQIlLDr4dJ1K2WkmgfZe8RF78y/NsuKiyr84B oY3/hyFC1gCmJOLtXABf9XUs5M6QWQAWgsW/WokmH/byAjgcUWdXicfQwKInUgEe3GKO P5uRO55ylGq9+SFlyeIcS3cHkFX55Qrz2UgPxjw0FCXt8N5PCb6O2NtUwta+x5jfh8ws YoCJRNgp6fENEHUX7IenaWXEgscMPFRYw1sO7VRnCIuEOGN+yX6zJJzpDOrQ2IZl5KHg BJlw== 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=wnoag2PDXeTodhCC/Jz33tcviOKenSJ94G9E57jsB1Y=; b=FO7o98gBXO5vxGtpfOsx8NnUJRhXu6cdmtLaw4buABSEGgnJDWalCMGj865UlWty7W qEhE16ZeBgCACJ2lJAVwWqjle0/Ew1JkSeAakRDM5iEFaUBUDFEOsPS/d887m5COq+si zS8vWj9I9UOrlYC0+UTLKqJRO8pQEIPq4rBvZc04dM+xe/bMeB9oizOFS3Fv2/FVmj5T CVJLdW9IMlEkTsQOTr2+GgaXtJ9SM5ucpoZ3r8vWJH2d42eNPUN18qs2BiuUFlYXJRkK Zzni6x03gpdOKq41ep7PzEZGNMmUFt8NN2ypjV4ufqUk1qs68iisV1ubk8DkEMjKpN+k +lLw== X-Gm-Message-State: AO0yUKX9jpA7as7WltFvCFSipZ5rY51ZIGfoqQnKg3RHPio3j9/J1in0 yXnAe6cFiNIWJkAeRTBzLgUS+w== X-Received: by 2002:a50:d741:0:b0:4ac:c612:6d6 with SMTP id i1-20020a50d741000000b004acc61206d6mr2717421edj.13.1676385486848; Tue, 14 Feb 2023 06:38:06 -0800 (PST) Received: from localhost.localdomain (abxh117.neoplus.adsl.tpnet.pl. [83.9.1.117]) by smtp.gmail.com with ESMTPSA id eg21-20020a056402289500b004acb6189693sm5378052edb.83.2023.02.14.06.38.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 06:38:06 -0800 (PST) From: Konrad Dybcio To: linux-arm-msm@vger.kernel.org, andersson@kernel.org, agross@kernel.org Cc: marijn.suijten@somainline.org, Konrad Dybcio , Georgi Djakov , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 06/12] interconnect: qcom: rpm: Handle interface clocks Date: Tue, 14 Feb 2023 15:37:14 +0100 Message-Id: <20230214143720.2416762-7-konrad.dybcio@linaro.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230214143720.2416762-1-konrad.dybcio@linaro.org> References: <20230214143720.2416762-1-konrad.dybcio@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757817644850193924?= X-GMAIL-MSGID: =?utf-8?q?1757817644850193924?= 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 76e8f660b932..df907ef01d6a 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -441,28 +441,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; @@ -503,6 +518,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) @@ -521,6 +544,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; } @@ -554,6 +578,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); @@ -566,6 +591,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 Tue Feb 14 14:37:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 57056 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3011855wrn; Tue, 14 Feb 2023 06:39:34 -0800 (PST) X-Google-Smtp-Source: AK7set/buVjKiVBW5QmkEuUKxnX9bb/eCht0mZoddsJa5VwfDlBx0fABdSTRrJpPOSfgBEnznLzW X-Received: by 2002:a17:903:11d2:b0:196:8d33:f083 with SMTP id q18-20020a17090311d200b001968d33f083mr3247601plh.28.1676385573701; Tue, 14 Feb 2023 06:39:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676385573; cv=none; d=google.com; s=arc-20160816; b=KDLgXdzXV4+ducsf655dkXjjwBhAQ8fQk5E38ouvjjSNWT1xuKqNwqtD7PUPi1FTHB bnGWLe/Bh3Pskd72V7sYRhAFwz+REJKaG5A7Pgjj/zJcnu9O1ywamF6qLXnsh3Agb58L DefWdT0rsR6KWUCNjxdIbatwLS3vgaW9eJzuayj5NIkGJ2fEN4qPAbcLVJSN2Xwaujxr 7qbBUS47l9ytEY+pKoujr7prbn7NoCO4gHa7f5Ja1fbSDTeunCl2BF+4/bJd4ac6h2g6 Vqq9bS5Hrykw+uFlXmbRZ4gdUGYUthV6ge0fhyRauiK9TXobzqek5e7i12A9s8wRZiJV 4dIA== 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=LSHlBADaeK5eFrFjJgn2OtkHxC346mVqKTE4q7ml+Fw=; b=iiFUI9UjTaiXj10JRxJDGuULS6sikGG4WhR+FVGyL60+SfPndQj+CSrzsxEKC/PS0E 71aR/l/KtN/PrNbxm9wNs6KgoBHismFMrew5FDfVDB3A7NnoNj3ONyWJ2f3AG1pyEuu9 ykz2s2CrJt+LPNzHlaoAo8l6otxMxSUpwIgSOm+mE5FPo/6VskLNwmGhbqfTrYS4pjJ6 2eJe97UDyDdQ7ia4q7vfU5cHhISB4rGVRtyw7N9VBS7KDt9Au8Ae6MkjlvKJq9Ka1DWt b3HcSUkeFtopRXHdjQQat7QST5XdMB214qUtO9QAQ7FQS8ZnVOQwLkfOd5Bpu4cof8Iv d/Ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JOZ8rJWt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w23-20020a1709027b9700b001965a0fc34fsi13935261pll.139.2023.02.14.06.39.21; Tue, 14 Feb 2023 06:39:33 -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=JOZ8rJWt; 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 S233454AbjBNOi2 (ORCPT + 99 others); Tue, 14 Feb 2023 09:38:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233260AbjBNOiP (ORCPT ); Tue, 14 Feb 2023 09:38:15 -0500 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E50725B98 for ; Tue, 14 Feb 2023 06:38:09 -0800 (PST) Received: by mail-ed1-x531.google.com with SMTP id a10so17665835edu.9 for ; Tue, 14 Feb 2023 06:38:09 -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=LSHlBADaeK5eFrFjJgn2OtkHxC346mVqKTE4q7ml+Fw=; b=JOZ8rJWtYrzYeN0+rGbqI/wx8EuNL3DrY3GjN2dAlPM7z3Sb/R+cgOEkntfp6Y9Ix+ BiQDAp8wTkrzFkYjBT39wGovWXz6Rdob/U6aMFGB51hLaelvNuYW1tPz9c5MSennNG+9 STbVdcm8DctY2vEuMBi4C0Ws8CPKfzzaxGEttI/4trrjnZ9KEPRvv5v7mkP5WhIgQcSg ukU0vDm91gUQRdwujboW/Q0Gu5TTTqfPXPX4frBmtGIMfR08/H8h6LAOA4ZtP3PW5mgY se7pyyXBG9Uzr6FqUyZnBxw4NO+RdMugjo3jcZ5w1/mIabQOSKU5VMnVO+eIM4SjOMNM mRFg== 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=LSHlBADaeK5eFrFjJgn2OtkHxC346mVqKTE4q7ml+Fw=; b=7smvXAxITgTXuZXZX86GcS9DzQOyivvYCz5YNw9o1/b2VB15ZGYV6AUBD7xB0O0r/3 ZgmZp70xgAv0xqYvorBp6Tcgw4iIgIKwIyQJgIHC8YFO0iaEaSxhvFDf4vLjuspellSQ mA2tqcpHE+yTvsSiy6X0aYcj24M01425wDgGOWGVuFgALV8rtOHCFLQvDIM0AxaJMsrO vDx6pbJRN/Engx61FT06LtYxJSs+NwP7SzNpKovnpZlZ6b5FrjAySjHykAlKs1SM/Mx8 aeTmSM7zF2PcyemfL+eBuvFAeUdCUdUOhKsgiqyxS3nO5lBQVn9Zn0Jmj7ks5ti39MIY nIWw== X-Gm-Message-State: AO0yUKUalG+2SWayATBxUGVxDKs933RyB2CSlMgwvpo7HCHpu5TckMMo 4V4t2gxt6mXIpevQPnYkBbhYYg== X-Received: by 2002:a50:8e4f:0:b0:4ac:d2b3:b724 with SMTP id 15-20020a508e4f000000b004acd2b3b724mr2581423edx.27.1676385488086; Tue, 14 Feb 2023 06:38:08 -0800 (PST) Received: from localhost.localdomain (abxh117.neoplus.adsl.tpnet.pl. [83.9.1.117]) by smtp.gmail.com with ESMTPSA id eg21-20020a056402289500b004acb6189693sm5378052edb.83.2023.02.14.06.38.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 06:38:07 -0800 (PST) From: Konrad Dybcio To: linux-arm-msm@vger.kernel.org, andersson@kernel.org, agross@kernel.org Cc: marijn.suijten@somainline.org, Konrad Dybcio , Georgi Djakov , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 07/12] interconnect: qcom: icc-rpm: Allow negative num_bus_clocks Date: Tue, 14 Feb 2023 15:37:15 +0100 Message-Id: <20230214143720.2416762-8-konrad.dybcio@linaro.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230214143720.2416762-1-konrad.dybcio@linaro.org> References: <20230214143720.2416762-1-konrad.dybcio@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757817679169632453?= X-GMAIL-MSGID: =?utf-8?q?1757817679169632453?= In some rare cases, buses will not have *any* bus-scaling clocks, which is "fine", as the voting can be done through RPM provided that the necessary QoS clocks are enabled. Allow specifying a negative (-1) number of clocks to make the driver accept such cases, without having to add a lot of boilerplate to all existing ICC drivers for SoCs with SMD RPM. FWIW this value was previously being assigned to a >>signed<< integer as well. Signed-off-by: Konrad Dybcio --- drivers/interconnect/qcom/icc-rpm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/interconnect/qcom/icc-rpm.h b/drivers/interconnect/qcom/icc-rpm.h index 729573f0d9fe..9dd631964b8c 100644 --- a/drivers/interconnect/qcom/icc-rpm.h +++ b/drivers/interconnect/qcom/icc-rpm.h @@ -96,7 +96,7 @@ struct qcom_icc_desc { struct qcom_icc_node * const *nodes; size_t num_nodes; const char * const *bus_clocks; - size_t num_bus_clocks; + int num_bus_clocks; const char * const *intf_clocks; size_t num_intf_clocks; bool has_bus_pd; From patchwork Tue Feb 14 14:37:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 57057 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3012534wrn; Tue, 14 Feb 2023 06:40:44 -0800 (PST) X-Google-Smtp-Source: AK7set+XU9zhilLKzfR3BUNSyy+Sl6qXBhuWy5ghLtwHVSE0PBqSez1EwUAV9G8KhEVEUi/D4Q0P X-Received: by 2002:a05:6a20:244d:b0:bc:f665:8655 with SMTP id t13-20020a056a20244d00b000bcf6658655mr3011221pzc.53.1676385644565; Tue, 14 Feb 2023 06:40:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676385644; cv=none; d=google.com; s=arc-20160816; b=ByqhW292DG8J/98vhIkePkHykKzfzBTueg5xckBc/aR5UvWa/rJGCGI3+Pil8DrEif mtwHwi5X3btj24hH0kBf1qUG16rncM7NZHB4hzAgVAsm7zwhIKIFgU63A79YPfKnC+vO 0+OGbgplsbR6FVx3Ik/fx71s4k1ind2MnZ9aHVzWigONaowIrdqZaGWv3kLcRm//1LRP q6jFBU3Tc3VOa7WIqMmSgWrre3yBbJWGwQf+I26I4hgUk8O9230XTeTfKUzEen2mDeW+ 2zJMwEoxHe6xCnkThD+XHUz9f6U53wlgOiE6WOcfqD5QZDOWTCvSYTaw2WPD+2LdUjtV dHJw== 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=LbwaLLKNhRw2CH/nrw0ovwFrmWWG6dVokGMb/AGTKDo=; b=NxC6T1cizF++S/KaVmcEa6ck0EdAP3TtkJVyKpzU+aEV5ddzvodQE6FnTRCQ3ljWrM tqbS8qIMrBbY2MtTF6RZgpK09zldO+wDfZQwwFiI8Zf1cTR/MOXyUy5/Jgv8Q/R9pC1W zkvWRAFi6pDiDjqLlPwHhEC12E3vQNoyY1/kGyHKrqrulcWJOVGYsvWwVNjwiUUEQrLF K2MvAQvboaVw+Cw2U7ajFDZyt0pwY1Sbgl4iD6BghjyBnS2CULTNnfqxo2vw6izv8vaQ yKT3Prl+aa0prIbKoq02eFYzhrKLIyRQbi3JKcWKxxdqFXHxK3QySMVrX1zit1+fCQRX EBPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=o6FxOUAD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f19-20020aa79693000000b0059038315e75si15418215pfk.33.2023.02.14.06.40.30; Tue, 14 Feb 2023 06:40:44 -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=o6FxOUAD; 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 S233475AbjBNOib (ORCPT + 99 others); Tue, 14 Feb 2023 09:38:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233263AbjBNOiP (ORCPT ); Tue, 14 Feb 2023 09:38:15 -0500 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B117B2B297 for ; Tue, 14 Feb 2023 06:38:09 -0800 (PST) Received: by mail-ed1-x52e.google.com with SMTP id dz21so5658457edb.13 for ; Tue, 14 Feb 2023 06:38:09 -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=LbwaLLKNhRw2CH/nrw0ovwFrmWWG6dVokGMb/AGTKDo=; b=o6FxOUADkM6+jev7OF8XLBb8ulB0yBHYWW7KS/Jvjl7APKAUrY3ndxmNtf76PDwtLK myMWxT2iBgkpe1WQea46+Cn3Bvrsnijx9cCMFOKxcwUFkPwwwTCKXxH8725KdaHePQB5 8R5wP7sRng7o7FuW/VqxisACZ0tDaJIBB3aLuYgZjWCqe1P5fo95Je692oyBctZJuXG4 HqSkkdsRsOzXfuONRqHGTnzV4wk5sSfgy2p/SoyjD5MEf1FJTvMLORDv3NIeWL5no1Ph WoiEyB/88QEBnOaXCBNiJaYgsvHRoBMuv0/FBfYqD9/MMS0vp0lkbcYAOqI3DqOf3b+A uWvA== 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=LbwaLLKNhRw2CH/nrw0ovwFrmWWG6dVokGMb/AGTKDo=; b=uiq3gAQ10MABwqKNgkuXRs5D661Qes5Paqaej5r4jxqSF3ZQFfygZQht/H784WlwQp cq/8INNZgizc8iVSx7XzTTwgOkn+/LWgMLPdRhhOG1kIe5k+s4dZkX4+a7fW44p/joLN lCH/exqFdZHC+yTjpDM8GZ9gdzCcJQ3aQ+D1w0do0S6+K00aREsnAPT7h3l8ZqUSrYvM l8KqWwSiHqX0gKCL2iuxNm437T4wKinmlE7dHTHI2axRjn+VD1ZKQ6j9trLrSNq/oIbX TQIVek+YqvZD8325A3XYNg7vH/z8nCvX43KH07FDEF02kRrMJTHG0JzOieEeabVnKK8Z M8iQ== X-Gm-Message-State: AO0yUKU2uBaZY60YEDpOjuEY8cXTR4PWMl0jK3jN5v+VWomTlNT3WDNm yhbJ/IG3xTOqtadyqXzB8glcTg== X-Received: by 2002:a50:9f07:0:b0:4a2:1274:d0db with SMTP id b7-20020a509f07000000b004a21274d0dbmr2263716edf.19.1676385489285; Tue, 14 Feb 2023 06:38:09 -0800 (PST) Received: from localhost.localdomain (abxh117.neoplus.adsl.tpnet.pl. [83.9.1.117]) by smtp.gmail.com with ESMTPSA id eg21-20020a056402289500b004acb6189693sm5378052edb.83.2023.02.14.06.38.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 06:38:09 -0800 (PST) From: Konrad Dybcio To: linux-arm-msm@vger.kernel.org, andersson@kernel.org, agross@kernel.org Cc: marijn.suijten@somainline.org, Konrad Dybcio , Georgi Djakov , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 08/12] interconnect: qcom: msm8996: Specify no bus clock scaling on A0NoC Date: Tue, 14 Feb 2023 15:37:16 +0100 Message-Id: <20230214143720.2416762-9-konrad.dybcio@linaro.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230214143720.2416762-1-konrad.dybcio@linaro.org> References: <20230214143720.2416762-1-konrad.dybcio@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757817753471106393?= X-GMAIL-MSGID: =?utf-8?q?1757817753471106393?= A0NoC only does bus scaling through RPM votes and does not have any ICC clocks. Describe this. Signed-off-by: Konrad Dybcio --- drivers/interconnect/qcom/msm8996.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/interconnect/qcom/msm8996.c b/drivers/interconnect/qcom/msm8996.c index 1a5e0ad36cc4..45eb8675fb11 100644 --- a/drivers/interconnect/qcom/msm8996.c +++ b/drivers/interconnect/qcom/msm8996.c @@ -1817,6 +1817,7 @@ static const struct qcom_icc_desc msm8996_a0noc = { .type = QCOM_ICC_NOC, .nodes = a0noc_nodes, .num_nodes = ARRAY_SIZE(a0noc_nodes), + .num_bus_clocks = -1, /* No bus clock scaling */ .intf_clocks = a0noc_intf_clocks, .num_intf_clocks = ARRAY_SIZE(a0noc_intf_clocks), .has_bus_pd = true, From patchwork Tue Feb 14 14:37:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 57054 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3011665wrn; Tue, 14 Feb 2023 06:39:08 -0800 (PST) X-Google-Smtp-Source: AK7set/3WFqJNLu8zIQmoJz4C7JqnBWFul4UK3aMpp9Gw49JnHCZ4boV3qnyI60dQ3WvBTKcT4z5 X-Received: by 2002:a62:1647:0:b0:5a8:b4a5:bf98 with SMTP id 68-20020a621647000000b005a8b4a5bf98mr2283616pfw.3.1676385548333; Tue, 14 Feb 2023 06:39:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676385548; cv=none; d=google.com; s=arc-20160816; b=MfdFxSCzDtgXDzzdvmVdcnoHYkG7Iam7GfDZf+HeuwQgflF7RHchHeaMgYLrqWvQ9+ Gfaa1HNkbvpt3TrFSis2+FP+BdtPsCdCzwyawCdWReKfMA4hJVtZzOGmGTTAOuNA5lTT 7lDK18DwoqdX9zLEUB7dYkTACWq8tf26r2u3f/XpKaP2000W+QvWafL54uSO5mzIvdxf G7RYaEji7B4BG6Em9y6bT+3OY8Xd3N8HK7L5L1YGKrz0oFk+pdAMEaC+VrCAjd43a3f4 ObZjDm6lcm9EL+9nBPKHmw56noEWeoicZ54UA3MVbb2Yg/4R7rxM/zppak+VHqUlHNSz 4Ptw== 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=0uFe9M4kMsn6GMCEHF0NJYhKab6cG07IqakVpkwLnQk=; b=MHjyb5n9njPRYx3lnaolsj2E2g1lZZYLCT/eQCOvgTw54Su4Ud4xraaEW9Vbxn+JbX qaaNBTFoa8BhAruXIro89l1TeGwiW3pvY2cXPpJUjhiSL4U1ShokCt8jfgnxfQ49f6WO guNjcyFw/eXS1CAkm1YzOSI3XOsd6h7nouZHrljeu5B7mutyb3+4/hJQ7BAEYwymtc1/ pgXNUNKwYk+F5nS0iyqoQEtQQs9aHuXBj8XLr4K4mHUXfYOWPedmTPvOC9tihqZkJDMh 8uW742cYk8zmITRIxOle5wg37LYmSFI7cOPxlYP9a3GABBGUsdaa6YJ4+igJbMZZjqnZ Z48w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ky1AnQ0S; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e5-20020a056a0000c500b00574b46d3b26si2311660pfj.334.2023.02.14.06.38.55; Tue, 14 Feb 2023 06:39:08 -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=Ky1AnQ0S; 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 S233441AbjBNOiZ (ORCPT + 99 others); Tue, 14 Feb 2023 09:38:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233140AbjBNOiO (ORCPT ); Tue, 14 Feb 2023 09:38:14 -0500 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 353522A6E4 for ; Tue, 14 Feb 2023 06:38:11 -0800 (PST) Received: by mail-ed1-x531.google.com with SMTP id u21so17726519edv.3 for ; Tue, 14 Feb 2023 06:38: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=0uFe9M4kMsn6GMCEHF0NJYhKab6cG07IqakVpkwLnQk=; b=Ky1AnQ0Su3H7eZkw1IYQgEuEk+ur0WLa84qyoDIo43MqM0raRl3k4PUyr5qLdzNNXU M10Duc8jX+ghK36YwMXXARCjBvN7BkdUsLHnQAvCZOi8LurTxKksEcde1rBWpO5jAJ/b UuRzUr6IYGobscaHvHZd6z0gFFVD+rufOXBBWvGsT4vs7F79Q987cbm4bgdyWS7L4ptj VmePqMvYRItjJVTW6tayPjvcu/Ta+RVeupX0JxTEOi6dAV9weeFKg0o03Sfzm4HtvRiV LTaol+ag59KgPpCxOFZJQr8M5FoSgDU8OY1pImBUK3URxgHSWCv/xKR9i8IGCj5n7OXr syLw== 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=0uFe9M4kMsn6GMCEHF0NJYhKab6cG07IqakVpkwLnQk=; b=A+r5EkEaylY8vfG7DHaGmxVXYEqedKkC/4JEMgNULB2nOhJzehzydiNQM+bxz6tLDc n3Pkl09t3yB5oXgR1l9F7JL1GCohV224EUvT/xeACdTaGYGvlgjq+TR/ZgHFTJd1lo1i x2cadkCkykmVtNBRdKMFz4W/0XSaFsLZETtP2Zd9Ji59F+Riww7AiNmKQDPY0R/Pu3WC XpIgmLTIIFFxqJHpRRTP8zqX65vXSnlKeMD9I3jURNlRNHfWFHIwjnpLKiDirxVxyny/ Hj5ly/yZJ2MYvmgvoA3Gj6OBj2KqJ6Di3CGGAcCeCueDp6545tEGbfH84pcv104qyM1O Gn5Q== X-Gm-Message-State: AO0yUKUU9hMe1ZUuHv2DnIPfDFKAszrUWupQ+S7UYIcl6TNeFlakOnA6 GQsr13QFBJLGbMkYLgtQ0wMiTQ== X-Received: by 2002:a50:ab54:0:b0:4ac:bf55:7d61 with SMTP id t20-20020a50ab54000000b004acbf557d61mr2763935edc.9.1676385490545; Tue, 14 Feb 2023 06:38:10 -0800 (PST) Received: from localhost.localdomain (abxh117.neoplus.adsl.tpnet.pl. [83.9.1.117]) by smtp.gmail.com with ESMTPSA id eg21-20020a056402289500b004acb6189693sm5378052edb.83.2023.02.14.06.38.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 06:38:10 -0800 (PST) From: Konrad Dybcio To: linux-arm-msm@vger.kernel.org, andersson@kernel.org, agross@kernel.org Cc: marijn.suijten@somainline.org, Konrad Dybcio , Georgi Djakov , Dmitry Baryshkov , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 09/12] interconnect: qcom: rpm: Don't use clk_get_optional for bus clocks anymore Date: Tue, 14 Feb 2023 15:37:17 +0100 Message-Id: <20230214143720.2416762-10-konrad.dybcio@linaro.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230214143720.2416762-1-konrad.dybcio@linaro.org> References: <20230214143720.2416762-1-konrad.dybcio@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757817653069471526?= X-GMAIL-MSGID: =?utf-8?q?1757817653069471526?= 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 df907ef01d6a..c1954584d6f0 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -510,7 +510,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; From patchwork Tue Feb 14 14:37:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 57062 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3020741wrn; Tue, 14 Feb 2023 06:56:05 -0800 (PST) X-Google-Smtp-Source: AK7set88v7zxqZ6b9MRLq62YP5aCgu65DG51nVS/+4VUh94CQ1qVi6efWzGD6ZklQN6Wp6oHFV6z X-Received: by 2002:a17:902:e305:b0:19a:a67f:49d9 with SMTP id q5-20020a170902e30500b0019aa67f49d9mr2285262plc.48.1676386565423; Tue, 14 Feb 2023 06:56:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676386565; cv=none; d=google.com; s=arc-20160816; b=XLOJ+zJ3Z3sbEGGRtRJwcPFG3uu1xaAru5HD+JsDb8vToe1EvJiJRrW43e6e3WQ2j2 8nHW1RBquS9VxByjSmhtxLTqgGI4sNM/65qFTswJigoYoRUZ+dDLo2+yvQmgGI/d/5xY WMRCk/3lokeorBZaQLT2b3mN0rnJlriJ5sO56VInROqmztl2P41s8LvbtY6vNAXRPLHm rI+eeh00/8k5G4rVml6CkRFsqSmZ7A37GMcMiZeWoeZSLzIQ52R5/HyUNiI67td33Cmg crO2kDH6RhEDskm2kg5KJkkL60X3MOEZZaGmj231Z0laLJCiiPJYDziglVIBzj+tK9if bdjw== 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=4CEkCZ6M0V0rHXdhyITLeseCr9Rsf6DFLsvzd46ANmM=; b=ikgqobPN2yXBCWbTP+dWUm5caxuvO2j+Df8mnbzeK72RD1YEbIeszO+aVS8D+LIXVi cp0Z1Ig/aRtdDgItSrIBLaB5zs9vZS9SPdlw+KH2ugeBvNMh+NHsUUAx9KPA+7UDHO90 oK2o6DKCR3JRUzajaDPMUawUYlKTxQIzjS3gRzgab9odfqGSvOK/HK0Fw79QU0NQ2d/a zXhpTT0cvJ/aKTq/uB+5ixuh7zia1bfEgfZtfOEcG85vd4zJzY929PCoViJILZKfJ7ji XG72l75GcHcjL9s20vbpNj7I/vFqa6ThJrPX1zD7pwgfdY+CkabqKXPWlpQRe9P/evd/ AH1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=n1aeZTy4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q2-20020a170902dac200b00198e0aa6c41si3912086plx.450.2023.02.14.06.55.53; Tue, 14 Feb 2023 06:56:05 -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=n1aeZTy4; 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 S233320AbjBNOid (ORCPT + 99 others); Tue, 14 Feb 2023 09:38:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233170AbjBNOiP (ORCPT ); Tue, 14 Feb 2023 09:38:15 -0500 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94F9A2B2AD for ; Tue, 14 Feb 2023 06:38:12 -0800 (PST) Received: by mail-ed1-x52a.google.com with SMTP id d40so16453133eda.8 for ; Tue, 14 Feb 2023 06:38: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=4CEkCZ6M0V0rHXdhyITLeseCr9Rsf6DFLsvzd46ANmM=; b=n1aeZTy4RMrg+Tgm5UPefjlZ3SkYZ64uuw44avuzcjWhCTmV8yAe23ueUB4bJGFDlb Q9tUOxHYuiOil4iVbBdIMWNlj4wNPWkCOBNYLPsFeWZBHos4qN8yGb0QAbGKtqwo988g 7mXXYygMO3Od9lvS2jrVDch/qpr5JwYJ5TvVQE16bggIfDI7Q8z/+bz13TJVLpXX5zAm mtjjeAY+lFIPMDuqefLcFrIZUM9qGJcbCq5gbzzG5Ia03xzWriNuHS8Ih8hBDH8TrOqX LLJ6qPnCE9MtpZhQdWoO8q2bV6p3WJUPkowU9P/eWS089+UEaGCgwgQSX0MUt7oYJBJ8 uUyg== 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=4CEkCZ6M0V0rHXdhyITLeseCr9Rsf6DFLsvzd46ANmM=; b=r664pP2+zrM/J06/oLwGoIV1OWw03EDxP6hcfvOXe9eQxFj4WQHNsI+RjlQWzzdc34 9Im2OZywO6hi6G8dIdN3Y//vwJEdh8fZWYr/Br9iJNJXDxREHuMYssxAmO8H2/CYxoy0 BHv/MxBY38qY6hxqA3iFGIpBQ8EZon96miMVMwHOssyd3TY8nf0fHhoA4RNtwY12FXzC bIH7F/CYJGOSWEW1HcYP8pflqfJtliRkCl/FI4LkkhMNYi2B9m0fhi73nclpcpt0RlGq PmblDdlTvsVTRoWz9WSjnThJKOxlraXUauSMIBwhz6MDTO6+6yLSGqhlIhkFYQiVGki4 M/fw== X-Gm-Message-State: AO0yUKX6zU416q+4DEWITTG6LOdnQwMcFaGU5q4apMNcBeoxFMWMsiX+ HlGmguo3iEV89o+BE10xcIDjnQ== X-Received: by 2002:a50:9b03:0:b0:4aa:a9c7:4224 with SMTP id o3-20020a509b03000000b004aaa9c74224mr2981618edi.30.1676385492095; Tue, 14 Feb 2023 06:38:12 -0800 (PST) Received: from localhost.localdomain (abxh117.neoplus.adsl.tpnet.pl. [83.9.1.117]) by smtp.gmail.com with ESMTPSA id eg21-20020a056402289500b004acb6189693sm5378052edb.83.2023.02.14.06.38.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 06:38:11 -0800 (PST) From: Konrad Dybcio To: linux-arm-msm@vger.kernel.org, andersson@kernel.org, agross@kernel.org Cc: marijn.suijten@somainline.org, Konrad Dybcio , Georgi Djakov , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 10/12] interconnect: qcom: msm8996: Promote to core_initcall Date: Tue, 14 Feb 2023 15:37:18 +0100 Message-Id: <20230214143720.2416762-11-konrad.dybcio@linaro.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230214143720.2416762-1-konrad.dybcio@linaro.org> References: <20230214143720.2416762-1-konrad.dybcio@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757818719361264644?= X-GMAIL-MSGID: =?utf-8?q?1757818719361264644?= The interconnect driver is (or soon will be) vital to many other devices, as it's not a given that the bootloader will set up enough bandwidth for us or that the values we come into are reasonable. Promote the driver to core_initcall to ensure the consumers (i.e. most "meaningful" parts of the SoC) can probe without deferrals. Signed-off-by: Konrad Dybcio --- drivers/interconnect/qcom/msm8996.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/interconnect/qcom/msm8996.c b/drivers/interconnect/qcom/msm8996.c index 45eb8675fb11..0e0395328dc7 100644 --- a/drivers/interconnect/qcom/msm8996.c +++ b/drivers/interconnect/qcom/msm8996.c @@ -2109,7 +2109,17 @@ static struct platform_driver qnoc_driver = { .sync_state = icc_sync_state, } }; -module_platform_driver(qnoc_driver); +static int __init qnoc_driver_init(void) +{ + return platform_driver_register(&qnoc_driver); +} +core_initcall(qnoc_driver_init); + +static void __exit qnoc_driver_exit(void) +{ + platform_driver_unregister(&qnoc_driver); +} +module_exit(qnoc_driver_exit); MODULE_AUTHOR("Yassine Oudjana "); MODULE_DESCRIPTION("Qualcomm MSM8996 NoC driver"); From patchwork Tue Feb 14 14:37:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 57064 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3028113wrn; Tue, 14 Feb 2023 07:06:41 -0800 (PST) X-Google-Smtp-Source: AK7set/nmM3Tf/wUtSDWKQ9LzQPsRrfNcX3P69SnRTBm1ySsu5xdE8D0m+wwTVWgp1nYWm1g3WzP X-Received: by 2002:a17:90a:15:b0:229:544b:2c7c with SMTP id 21-20020a17090a001500b00229544b2c7cmr2605306pja.29.1676387200819; Tue, 14 Feb 2023 07:06:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676387200; cv=none; d=google.com; s=arc-20160816; b=SeT3BXfHONlNZYXFUHUscy739FQtHbirCEHrSDcUdDQK51RXxikQVRQ55srbsVbvQO vjA0dWW7V/M/Km62AJg5h3KXdIK58gPaCZz0wiozs6dpICi3ONzpqsj3zIXgRS41tPH6 CfTk03ECmt3FCQL63Sgom6hNaiyBSwSsM8sHXKU3Z+vzNRxTZRfp3E8qE8uiLakbDac9 AAd6Ug1iNluxj4eeO0yIXrv+sl+YSfUmQCgZg5LhyaMShubksH9J+qU+lrEv5FY+WgGQ e94YmQQ3l/N2AnxukvM2DBoCqUO8FNMBlySb5S10fizD3a8tVi+mlcOoVMaDD/PiObsx xJRw== 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=z33GhR/weoldfPdNFE3B9Pq21vIvD0pApq29v3a6yUs=; b=tW4PauP3lyatn2sn5pyQGOJsS2pbNQBSV89lPeLnMVChM3LzR/V/MAGdix/vYfsAY8 gTEYI6qsfTN82uYvJvNpk5/TMXkK5OvEYjWUabp8id1PdM+FKH7hQcGUdD99hDDJC8lN 8C/wc+8lLBC1gWGmAZ/jaasyeSr4hZ7UY5ynzHcT2FHNzioru0CPVYmSgrYR8ieLzOZ7 0GJarGsf4qtZNqYc8aE7MgPBGUQp8194DS3x0esy9VGyXVv62ZZMB91LI2GPAYVk26rP dqHLHzNE9dyJkS48qJR0n8nfYcwGnSgmm1jzpR+jmk6eyzAnd60bzRD+NeY6sZb74dIE QkeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ySmYQIam; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 138-20020a630090000000b004fabddccf93si14990635pga.778.2023.02.14.07.06.21; Tue, 14 Feb 2023 07:06:40 -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=ySmYQIam; 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 S233549AbjBNOim (ORCPT + 99 others); Tue, 14 Feb 2023 09:38:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233404AbjBNOiV (ORCPT ); Tue, 14 Feb 2023 09:38:21 -0500 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D813E233EC for ; Tue, 14 Feb 2023 06:38:13 -0800 (PST) Received: by mail-ed1-x531.google.com with SMTP id a10so17666276edu.9 for ; Tue, 14 Feb 2023 06:38: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=z33GhR/weoldfPdNFE3B9Pq21vIvD0pApq29v3a6yUs=; b=ySmYQIamqXyQQfy3KF5JJo0QF9heP7EPzSm33XZvcY0zurxbqNpafTiodrXwZJ5Un3 cTdSvwCm3Dt0QcrvvunDa6uEEGaOxHULrDexGmPLQdJZiaQmkQVrad7Y6x6ApKvhtaXm h+dXLgBx4NsrGwZTNoQPLK4YZiOHEZ6LREWIbEFgxiNVlGkwX279n5UlVuYBxt5MdA45 7YUfU8augui2eVwpzvGzVN7KlEWmogok3N3MwrETTutz9PNk5ag4PHxjKKpiaEXpyYZl 56gB8EKMPk7hbcPwxHvDTh8bveEKbORbjPAdVAeUyOi6QOglUL8dv9iLntvYL/zhon9G A5pQ== 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=z33GhR/weoldfPdNFE3B9Pq21vIvD0pApq29v3a6yUs=; b=gikK0IXIjEgFmjTP8/hXKi2j2O98FunHrVIGgdn8v/KK6ljrGNAoBhkZw73pP6lajU jSnUDcC33mBddjZaM679F7wxkGwAi99SP5U0Cj0KKUfZmG5/FLtQ3ZqgzQrtxXMKKyh8 OqHKextSMWKIkTRK+FAXWNBCoKR7/SIjqcfUNgNUzdAw9TKkHHtmDhCX+tTc9WHHuPNW 2X+JVP3DGAHR2C7QbwW7aJmi+/ndKvI2mqO4s5joqwpXMNcLDU3ij7nOIOUvczXAbqw9 jvlfU0hiRq9OZHHBjig3PQt1CcRIk3xvkSeZyWb7vwrwv7bwjwE4tv574g9KA5r996kI 2eJg== X-Gm-Message-State: AO0yUKU0zyP+ohzfBqsHUGqfUuHRKn0ieVgFx/xZ+JCm5wFE0LVySKMx YwzaSMDIf26EzwsWBf5CD0ZlBg== X-Received: by 2002:a50:9508:0:b0:4ab:4bf9:a10f with SMTP id u8-20020a509508000000b004ab4bf9a10fmr2741874eda.30.1676385493381; Tue, 14 Feb 2023 06:38:13 -0800 (PST) Received: from localhost.localdomain (abxh117.neoplus.adsl.tpnet.pl. [83.9.1.117]) by smtp.gmail.com with ESMTPSA id eg21-20020a056402289500b004acb6189693sm5378052edb.83.2023.02.14.06.38.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 06:38:13 -0800 (PST) From: Konrad Dybcio To: linux-arm-msm@vger.kernel.org, andersson@kernel.org, agross@kernel.org Cc: marijn.suijten@somainline.org, Konrad Dybcio , Georgi Djakov , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 11/12] interconnect: qcom: icc-rpm: Introduce keep_alive Date: Tue, 14 Feb 2023 15:37:19 +0100 Message-Id: <20230214143720.2416762-12-konrad.dybcio@linaro.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230214143720.2416762-1-konrad.dybcio@linaro.org> References: <20230214143720.2416762-1-konrad.dybcio@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757819385565979750?= X-GMAIL-MSGID: =?utf-8?q?1757819385565979750?= The downstream kernel employs the concept of "keeping the bus alive" by voting for the minimum (XO/19.2MHz) rate at all times on certain (well, most) buses. This is a very important thing to have, as if we either have a lackluster/wrong DT that doesn't specify a (high enough) vote on a certain bus, we may lose access to the entire bus altogether. This is very apparent when we only start introducing interconnect support on a given platform and haven't yet introduced voting on all peripherals. The same can happen if we only have a single driver casting a vote on a certain bus and that driver exits/crashes/suspends. The keepalive vote is limited to the ACTIVE bucket, as keeping a permanent vote on the SLEEP one could prevent the platform from properly entering low power mode states. Introduce the very same concept, with a slight twist: the vendor kernel checks whether the rate is zero before setting the minimum vote, but that's rather silly, as in doing so we're at the mercy of CCF. Instead, explicitly clamp the rates to always be >= 19.2 MHz for providers with keep_alive=true. Signed-off-by: Konrad Dybcio --- drivers/interconnect/qcom/icc-rpm.c | 10 ++++++++++ drivers/interconnect/qcom/icc-rpm.h | 3 +++ 2 files changed, 13 insertions(+) diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c index c1954584d6f0..88cad71688ec 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -51,6 +51,8 @@ #define NOC_QOS_MODE_FIXED_VAL 0x0 #define NOC_QOS_MODE_BYPASS_VAL 0x2 +#define ICC_BUS_CLK_MIN_RATE 19200000ULL + static int qcom_icc_set_qnoc_qos(struct icc_node *src, u64 max_bw) { struct icc_provider *provider = src->provider; @@ -397,6 +399,13 @@ static int qcom_icc_set(struct icc_node *src, struct icc_node *dst) do_div(rate, src_qn->buswidth); rate = min_t(u64, rate, LONG_MAX); + /* + * Downstream checks whether the requested rate is zero, but it makes little sense + * to vote for a value that's below the lower threshold, so let's not do so. + */ + if (bucket == QCOM_ICC_BUCKET_WAKE && qp->keep_alive) + qp->bus_clk_rate[i] = max(ICC_BUS_CLK_MIN_RATE, qp->bus_clk_rate[i]); + if (qp->bus_clk_rate[i] == rate) continue; @@ -482,6 +491,7 @@ int qnoc_probe(struct platform_device *pdev) qp->bus_clks[i].id = cds[i]; qp->num_bus_clks = cd_num; + qp->keep_alive = desc->keep_alive; qp->type = desc->type; qp->qos_offset = desc->qos_offset; diff --git a/drivers/interconnect/qcom/icc-rpm.h b/drivers/interconnect/qcom/icc-rpm.h index 9dd631964b8c..77e263b93c27 100644 --- a/drivers/interconnect/qcom/icc-rpm.h +++ b/drivers/interconnect/qcom/icc-rpm.h @@ -29,6 +29,7 @@ enum qcom_icc_type { * @regmap: regmap for QoS registers read/write access * @qos_offset: offset to QoS registers * @bus_clk_rate: bus clock rate in Hz + * @keep_alive: whether to always keep a minimum vote on the bus clocks * @bus_clks: the clk_bulk_data table of bus clocks * @intf_clks: the clk_bulk_data table of interface clocks */ @@ -40,6 +41,7 @@ struct qcom_icc_provider { struct regmap *regmap; unsigned int qos_offset; u64 bus_clk_rate[2]; + bool keep_alive; struct clk_bulk_data bus_clks[2]; struct clk_bulk_data intf_clks[]; }; @@ -100,6 +102,7 @@ struct qcom_icc_desc { const char * const *intf_clocks; size_t num_intf_clocks; bool has_bus_pd; + bool keep_alive; enum qcom_icc_type type; const struct regmap_config *regmap_cfg; unsigned int qos_offset; From patchwork Tue Feb 14 14:37:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 57058 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3014930wrn; Tue, 14 Feb 2023 06:45:14 -0800 (PST) X-Google-Smtp-Source: AK7set80XV00yrjEZvKt2pP/QAVorp3q/1lZosVbp4UWfG3D853vGVXEFgUCK7KIaTRpNWwk4QNH X-Received: by 2002:a17:902:e80d:b0:19a:906a:e052 with SMTP id u13-20020a170902e80d00b0019a906ae052mr3090820plg.64.1676385913706; Tue, 14 Feb 2023 06:45:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676385913; cv=none; d=google.com; s=arc-20160816; b=emC8MG4mydzL2WwHr2/+hU5QV8DcRx/YePf1YgCRqmXzkqjoSTmAoTHBuwQdiOeTjA 70xNrlvakhcsr59Vl65YGg8btDoU1BJ3HxCroPIz7LmwPaIMo0eVCjSjf04jkrHArciJ kXrZI/GBJwwvu8E8Mvy7Z5EqGCz/bvNZgcyVaKb1fSXCSq0YgZ1mNlQSJH33P2yf5Ke2 X5602Tw/0Wy1LYEnxaQULFs/ImLnjUvwALNiz4cfiIgIjyX492a2rZsyEdaNutAfOLlF WWhv+8jxFvl4M3bTfBA5oulopKb/4v8ErbuUFcmM7sWGGGvdUWXnw9prYAIS9hsYi9FY oK6g== 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=LJCQPkMo7WAJkj+57CfoI7qkGu8zTyPx4xks1X9yahs=; b=j8O3QO8hEgrrAHM6Nb3wHinNDBEMNjHK07MVCiwUr/0YsKN9NRpz2GvOacKh1ge8+d kuZWhiX6l0HNJDeLiCVzjLphhJbdrRc+hUAcEER1iQBNB0OKVZofKurZv7Qat1C5WplJ WCbzYz2fcIe+XVbZUu826ptdlPbz9e5qvo5kZ35nNbk7QguGIL55UJptuvXT8E97h+WF 453RtaWKGAEaOqG9MKnfnbWO6/c8qZitqUSKwAEQGoijTLNbRhZthxYXFxcq7vhm8UYe DS2e7CLp6gKpOETgHm+izYv7W0M/HvfRHIUrzBsBD89JKZBIQpNdnGdh5pyMWnZDbek5 +W4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eK1VYaDE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k9-20020a170902c40900b001866341b823si9870963plk.322.2023.02.14.06.44.59; Tue, 14 Feb 2023 06:45:13 -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=eK1VYaDE; 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 S233512AbjBNOip (ORCPT + 99 others); Tue, 14 Feb 2023 09:38:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233464AbjBNOia (ORCPT ); Tue, 14 Feb 2023 09:38:30 -0500 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20DEA2B2A3 for ; Tue, 14 Feb 2023 06:38:15 -0800 (PST) Received: by mail-ed1-x533.google.com with SMTP id bt8so11880598edb.12 for ; Tue, 14 Feb 2023 06:38:14 -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=LJCQPkMo7WAJkj+57CfoI7qkGu8zTyPx4xks1X9yahs=; b=eK1VYaDEis0UR1gAg3Ptuend7jTW3UObknUnXxOM6nz0hNjmg8mttlhnhzenS9CBjV p2WLDq1lqWo7SRzrJJ7an9OQSLAEfcYu5aHpb1L3yGecDDR7jzaq/OSBi4bLeeW/jC63 Ae17BuCkT/vIhgPKq7Gn1uiaszE/bgZsyl3pYmpnJCkjaDLI47o22h9l/gifH5JpbzWU zvnQaW6Vl3VP7wHxb6tE2nG/K3NMxG4vKBlS5IAMqJeSCtTbVoznpd3E8T9fJOHOAMdf CR+TdZTqQ0pfv7PHa4w/JY+PRRtHirSHrPLQlQNxpmVcySeX4lA28EqbWG/v2rUgk0FF DpBA== 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=LJCQPkMo7WAJkj+57CfoI7qkGu8zTyPx4xks1X9yahs=; b=MIs/f8ajEvwBw5pktx29HFjMd71Ol/g0aCV20O7ZjuDoVATsjQ6hk/RcV8xl/nVRwC k7FQEYEyv2nWxb1LYKPKGYonCWEwtKj4yKN2Eg+Kv2oomlG9TKWPJ84F0VoUEQoXDwjT baphtMlU2ALtAPrHMdPjlq85xMeKp2bPO/qWtgdB240agDWQmC89jJnrgvdd/onN9ToU cSNr/cIN/+fLVr/IcU7+TqjU+CQRKyodYSH1fZMWl1hw/VshzGJBuyQKO3H1x+RQzv5G vehTsQUIpVnOzdhgArKQqZQU3BzxLWAhzBvX31ygG+xpK9/JDDpyH2k1uAvYN4HV5Ido 2OcQ== X-Gm-Message-State: AO0yUKWk+KHYefGjoHE0upZ32G8NBg/irFs21b48PloMCS3gLh+/Ih5s FSPdJ8HfRutokQXcysAIwZ5x3g== X-Received: by 2002:a50:8ade:0:b0:4ab:4d69:f9e3 with SMTP id k30-20020a508ade000000b004ab4d69f9e3mr2829455edk.20.1676385494659; Tue, 14 Feb 2023 06:38:14 -0800 (PST) Received: from localhost.localdomain (abxh117.neoplus.adsl.tpnet.pl. [83.9.1.117]) by smtp.gmail.com with ESMTPSA id eg21-20020a056402289500b004acb6189693sm5378052edb.83.2023.02.14.06.38.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 06:38:14 -0800 (PST) From: Konrad Dybcio To: linux-arm-msm@vger.kernel.org, andersson@kernel.org, agross@kernel.org Cc: marijn.suijten@somainline.org, Konrad Dybcio , Georgi Djakov , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 12/12] interconnect: qcom: icc-rpm: Allow negative QoS offset Date: Tue, 14 Feb 2023 15:37:20 +0100 Message-Id: <20230214143720.2416762-13-konrad.dybcio@linaro.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230214143720.2416762-1-konrad.dybcio@linaro.org> References: <20230214143720.2416762-1-konrad.dybcio@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757818035614003371?= X-GMAIL-MSGID: =?utf-8?q?1757818035614003371?= In some very very very very unfortunate cases, the correct offset of the QoS registers will be.. negative. One such case is MSM8998, where The DDR BWMON occupies what-would-be-the-BIMC-base which we usually take into account with the register calculation, making the actual BIMC node start at what-would-be-the-BIMC-base+0x300. In order to keep the calculation code sane, the simplest - however ugly it may be - solution is to allow the offset to be negative. 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 77e263b93c27..5e4215f25c2e 100644 --- a/drivers/interconnect/qcom/icc-rpm.h +++ b/drivers/interconnect/qcom/icc-rpm.h @@ -39,7 +39,7 @@ struct qcom_icc_provider { int num_intf_clks; enum qcom_icc_type type; struct regmap *regmap; - unsigned int qos_offset; + int qos_offset; u64 bus_clk_rate[2]; bool keep_alive; struct clk_bulk_data bus_clks[2]; @@ -105,7 +105,7 @@ struct qcom_icc_desc { bool keep_alive; enum qcom_icc_type type; const struct regmap_config *regmap_cfg; - unsigned int qos_offset; + int qos_offset; }; /* Valid for all bus types */