From patchwork Wed Mar 8 21:40:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 13166462 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC5DBC678D5 for ; Wed, 8 Mar 2023 21:41:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229621AbjCHVlR (ORCPT ); Wed, 8 Mar 2023 16:41:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229605AbjCHVlP (ORCPT ); Wed, 8 Mar 2023 16:41:15 -0500 Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7F77D13DB for ; Wed, 8 Mar 2023 13:40:45 -0800 (PST) Received: by mail-lj1-x235.google.com with SMTP id z5so18042862ljc.8 for ; Wed, 08 Mar 2023 13:40:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678311612; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=oxGQmrbmKZnzoGW/Ytl5lAqej/buXyMdlfBaOCC/0jg=; b=jyVpLRSOYHYSJg5LcwjygKcYSq55/TMbyEOvrTMe23OT0NoPeVlzPTgrddgSOA9spC s46eOU7dGqBgZJ56JA1uvEMzZP4Y2wXZj+FA6/fi2hKIveHwRR0LlYK+mdOVTWo/IJjk KJCYNlzp4KB+jUa23io2VoYYpR6tadlC2cjlWizZiCKXgpYdHSxxyBUJUiNCvnldvYCV 4Vh1mRCU65gTlleSuam54Prk9L/jWs1jggmFgouUpRl/yOtdxYJdIQ73FvWBfZqg9++m sfGZj81tTnSeNB4gDmgDjqSrF7CCRROTodg/QXBVUWVUEvBEpnk2wNRhHuI8Lq4di2Ir Wj/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678311612; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oxGQmrbmKZnzoGW/Ytl5lAqej/buXyMdlfBaOCC/0jg=; b=6ZHUJWWNh8yyznnafU196BpV13htNMRV0E2fC+JlcUxFqkF9Zpd4hc6XIMixJyorix Ha/mJOykD/mGyQ0DZ5gC8/PfgK6F31buRRiaZqidQ2rROxaDKpftKCXzA3+Y3CUPlddz otVnvQnkp/0kQr+SEMgkQq1/6c/k1zm4FWmaH8R2wlkPkfOapZeh33CFucJndotq6ChD 84P/0Ao/uItScROgl23tOwLrlK6xi6X8Wx0VQ99rdK32VhyiyIH8Zrcirgy4G2/bM7fW rF0iPzKWxf5hv4m3u3yOpFaKydrtBlUgDR4YIHpTXZPkkVpG3ccmZn+gyczFSZ6VzB0F wPRA== X-Gm-Message-State: AO0yUKVMIA7IO8FtEhAVnTlyzX/diK67t5pkVbBG6LtliAt00vUf53sq rMBVVIyhjopAyBY8iWLhKitz6g== X-Google-Smtp-Source: AK7set9FXHSxMQ857o6klpDSMN/vTFqmg7+O42zTmUOz/vHX4pkbjQiI51SJAJ+cV1245VdB3W49sQ== X-Received: by 2002:a2e:b5b8:0:b0:295:b1af:d269 with SMTP id f24-20020a2eb5b8000000b00295b1afd269mr5073057ljn.43.1678311612289; Wed, 08 Mar 2023 13:40:12 -0800 (PST) Received: from [192.168.1.101] (abyj16.neoplus.adsl.tpnet.pl. [83.9.29.16]) by smtp.gmail.com with ESMTPSA id a6-20020a2e8606000000b00295a2a608e9sm2688844lji.111.2023.03.08.13.40.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 13:40:11 -0800 (PST) From: Konrad Dybcio Date: Wed, 08 Mar 2023 22:40:07 +0100 Subject: [PATCH v7 1/9] interconnect: qcom: rpm: make QoS INVALID default MIME-Version: 1.0 Message-Id: <20230228-topic-qos-v7-1-815606092fff@linaro.org> References: <20230228-topic-qos-v7-0-815606092fff@linaro.org> In-Reply-To: <20230228-topic-qos-v7-0-815606092fff@linaro.org> To: Andy Gross , Bjorn Andersson , Georgi Djakov , Dmitry Baryshkov Cc: Bryan O'Donoghue , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1678311609; l=3885; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=LVE+/4VEPlESfpraQPOmUutEh9JBL8Wa+LXrVkmoSRk=; b=gJMwz8piyTMvm2V36mHRd1dkdTSh+p4qkELYhIGdbDREHPK7I6YqfPxrqS/NhkZp/dmG8Wb4cqXM bZkKQiAPDqYbOwiy1yMXt4nmmqvHVaquYbkEmYNc/TMAk3w6d2LG X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Currently NOC_QOS_MODE_FIXED is defined as 0x0 which makes it the default option (partial struct initialization). The default option however should be NOC_QOS_MODE_INVALID. That results in bogus QoS configurations being sent for port 0 (which is used for the DRAM endpoint on BIMC, for example) coming from all nodes with .qos.ap_owned = true and uninitialized .qos.qos_mode. It's also an issue for newer SoCs where all nodes are treated as if they were ap_owned, but not all of them have QoS configuration. The NOC_QOS_MODEs are defined as preprocessor constants and are not used anywhere outside qcom_icc_set_noc_qos(), which is easily worked around. Separate the desc->type values from the values sent to msmbus in the aforementioned function. Make the former an enum for better mainainability. Signed-off-by: Konrad Dybcio Reviewed-by: Dmitry Baryshkov --- drivers/interconnect/qcom/icc-rpm.c | 24 +++++++++++++----------- drivers/interconnect/qcom/icc-rpm.h | 10 ++++++---- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c index 4d0997b210f7..35fd75ae70e3 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, @@ -244,7 +246,7 @@ static int __qcom_icc_set(struct icc_node *n, struct qcom_icc_node *qn, ret = qcom_icc_rpm_set(qn->mas_rpm_id, qn->slv_rpm_id, sum_bw); if (ret) return ret; - } else if (qn->qos.qos_mode != -1) { + } else if (qn->qos.qos_mode != NOC_QOS_MODE_INVALID) { /* set bandwidth directly from the AP */ ret = qcom_icc_qos_set(n, sum_bw); if (ret) 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 Wed Mar 8 21:40:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 13166463 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77C88C64EC4 for ; Wed, 8 Mar 2023 21:41:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229702AbjCHVlS (ORCPT ); Wed, 8 Mar 2023 16:41:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229492AbjCHVlQ (ORCPT ); Wed, 8 Mar 2023 16:41:16 -0500 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2A8059436 for ; Wed, 8 Mar 2023 13:40:47 -0800 (PST) Received: by mail-lj1-x232.google.com with SMTP id t14so18038786ljd.5 for ; Wed, 08 Mar 2023 13:40:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678311613; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=ZWvxJATtCZZKMC5qHkete+t4P5fdMAJTPULnzyt/6uA=; b=W9PP/8O9SYqsWLA6zBO6fbbCJiFwk6mzgCSowoIN17jpLCCBd+KKmvM8lF8EZVS2zJ 2oSBmB4NLqCh8D3cyfe0sc7Ei0oQZp88NajFo7m1BvPYdgu2FxOAIJtBhP+pGzH/wEoA k+7ChYSIhPF71D2nx2V8RmuyX6Ji/5Q6t4I9RJqVC2wCtwREC1njlJFV/w/c9QKDMVgb JtSWPSZEQeVia9h/hJYyVbQnIfVtwhjhfDrWRaS8LJhYSqIsOViSO0GDBzCjm/O0ZyXV r5fqWmfdDnSZiSbPDRWt9S0+UyiH9ck2lJwZeevtJDiMUzCrAXCm9pJh8BCz2g2ONCSd D1cA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678311613; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZWvxJATtCZZKMC5qHkete+t4P5fdMAJTPULnzyt/6uA=; b=7NOI2THXsJDZsOrQbLDNMPCCMGgqoK845tXHCVS0RMwFY7y5MZoAdXcMvGOc5LyOs4 bIXnyahngxY3lsOaNiFCx43l0T/ggNWokEUjTXZn8y/zT/RcBcyUnwH7oILO1qIVLMkJ ko/I5QxdLHb5qgVP+5lvsZfcX1vhbpeLFyw/SWuGAwai449w6OFkxYUByK2f0NmY5S0p ASVbq9A35rQDCCRmhlJsjCj77s9+zVxjWHC0yATeyYwA8k9VEfq/vUq8S0i37MlC6dT9 K4JH09wcF4tA7mZfxHziy5u6iXxhMWKTd2yKN7jwh49Tcll8pMamOQ+uPzFDA8dfmEZo 4j0g== X-Gm-Message-State: AO0yUKX9Bc3Goi6wWyTn6850yJTTexgG0SK1asZ1Fchc2m64MkctNPj7 t3ELGNgOEfsSZVbBBSW/CpbCHg== X-Google-Smtp-Source: AK7set/xtt3kHV/tvNHmhuo5ey16iaIcSx3JnWxjtw9uC/sB+v3Tw9K7YzAriSrIMepeyf9GFVC4/A== X-Received: by 2002:a05:651c:104a:b0:294:716d:8d5 with SMTP id x10-20020a05651c104a00b00294716d08d5mr6254374ljm.1.1678311613729; Wed, 08 Mar 2023 13:40:13 -0800 (PST) Received: from [192.168.1.101] (abyj16.neoplus.adsl.tpnet.pl. [83.9.29.16]) by smtp.gmail.com with ESMTPSA id a6-20020a2e8606000000b00295a2a608e9sm2688844lji.111.2023.03.08.13.40.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 13:40:13 -0800 (PST) From: Konrad Dybcio Date: Wed, 08 Mar 2023 22:40:08 +0100 Subject: [PATCH v7 2/9] interconnect: qcom: rpm: Add support for specifying channel num MIME-Version: 1.0 Message-Id: <20230228-topic-qos-v7-2-815606092fff@linaro.org> References: <20230228-topic-qos-v7-0-815606092fff@linaro.org> In-Reply-To: <20230228-topic-qos-v7-0-815606092fff@linaro.org> To: Andy Gross , Bjorn Andersson , Georgi Djakov , Dmitry Baryshkov Cc: Bryan O'Donoghue , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1678311609; l=2390; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=mgGX39iPtIfm1zsmEzmtm3Z/menbT73VBLNzExJPqt4=; b=lQrFaeMU78TFU1DAP//yDiIt4f1Jg5NB7EcRVWfLHFISeAPTGj7MD3IOj8B9GG7Fx/5Vn21g1NTm D3VP+W1eATugu0NF9GHr9lF59gigQKAexO/bHDQyT8vS/P4MBSGv X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Some nodes, like EBI0 (DDR) or L3/LLCC, may be connected over more than one channel. This should be taken into account in bandwidth calcualtion, as we're supposed to feed msmbus with the per-channel bandwidth. Add support for specifying that and use it during bandwidth aggregation. Reviewed-by: Bryan O'Donoghue Signed-off-by: Konrad Dybcio Reviewed-by: Dmitry Baryshkov --- 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 35fd75ae70e3..27c4c6497994 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 Wed Mar 8 21:40: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: 13166464 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4963C6FD19 for ; Wed, 8 Mar 2023 21:41:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229941AbjCHVl0 (ORCPT ); Wed, 8 Mar 2023 16:41:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229605AbjCHVlT (ORCPT ); Wed, 8 Mar 2023 16:41:19 -0500 Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61DA761527 for ; Wed, 8 Mar 2023 13:40:51 -0800 (PST) Received: by mail-lj1-x22d.google.com with SMTP id a32so18019481ljr.9 for ; Wed, 08 Mar 2023 13:40:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678311615; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=rV1fhlo3d+5jqHbCH3aEpZYk1ZijM8P8h8hsb2YwO9c=; b=ezT8WuYyjFDM6IgaPlJ57M6E7KscASp9bjgGSDCh/IxrnVM46DG5lR/QLqf3bt9q34 F758u7JCt5/Y07+we4LWhdoA5uaDN+2P7JruTe4xd+kiIaFn04u2voejMq3V3LsP4z6E Smfn6NHWKEPKUMXAscwpMDkG9O8Hn8QjVh5yAmSFqeLUgsKZpcEIMt+zuF/FLGVoLfvm N2FVqDPFHz/6pfM2OK+coOHDQBT/24yytu7caQwqu+weXv8mMGSj4sKW2vRyy6oatw/7 mKSd7NoxpAFLIPjVVjuAXrTcTUytoAnoJvVRFWDouUgw1XclWLZLqpFuzz9VtJyFNAJV z33g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678311615; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rV1fhlo3d+5jqHbCH3aEpZYk1ZijM8P8h8hsb2YwO9c=; b=jv3m1wrXDXiH/BE00y2kZAyPKlYIvoMpnv+GOBsdtoteXcdldDb/SpUgm5NFHzW8Q+ Ub91fscNdBGfQhkgFchyTXCPYQho3xEckxsJQjb6Op0HXvl7uplSRyVQnkgzME8qAiTl 9B2Z65GnRg7Ia3ZGMMNKzwRwmgmhSUVCxfvm1zhwC3qbG4zmtW+JKg/c+aflMOv1ADHg 5UB7eMlKKuIRhocW34Vge/w6KvT6uPwzL/FQFHiGbtyb5roOlFIfwJ3kkescIuZF+lKI sE4IpYrZ7swM6TbPcr7ugtG2WOi+TrP1I9ql6gdM/OgwgD1qKcSK9cIwAcpRVXXiG2Ux xXow== X-Gm-Message-State: AO0yUKWbYWMtayLVxx9Jv5+5x8QTSsNnW+aEsI/AXpIrsfBb0DeB6DIx ZRjZrc3fr68+s9s0uKN1tPjn8Q== X-Google-Smtp-Source: AK7set8eEugLCh/YVNJZoVh4tUPtoQ5e3lgIl55BTFsdd/f8+eioSVbiftSXWXMis83HK5wDk1Xtbg== X-Received: by 2002:a2e:a986:0:b0:298:6a97:5985 with SMTP id x6-20020a2ea986000000b002986a975985mr1544278ljq.43.1678311615573; Wed, 08 Mar 2023 13:40:15 -0800 (PST) Received: from [192.168.1.101] (abyj16.neoplus.adsl.tpnet.pl. [83.9.29.16]) by smtp.gmail.com with ESMTPSA id a6-20020a2e8606000000b00295a2a608e9sm2688844lji.111.2023.03.08.13.40.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 13:40:14 -0800 (PST) From: Konrad Dybcio Date: Wed, 08 Mar 2023 22:40:09 +0100 Subject: [PATCH v7 3/9] interconnect: qcom: Sort kerneldoc entries MIME-Version: 1.0 Message-Id: <20230228-topic-qos-v7-3-815606092fff@linaro.org> References: <20230228-topic-qos-v7-0-815606092fff@linaro.org> In-Reply-To: <20230228-topic-qos-v7-0-815606092fff@linaro.org> To: Andy Gross , Bjorn Andersson , Georgi Djakov , Dmitry Baryshkov Cc: Bryan O'Donoghue , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1678311609; l=1082; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=5QScrGeiOGfZL7HfpuChoBRhoWNcpAGpYtvwcTxAXqc=; b=8YaabyUpY76DRFWI/hb829IEV7eM30lU2LLVvazFJy/4Jbi0WR4PEew4wI1B26fDSLS7ClRpywku L3uoNSLdCrznee8bX727SuLzB98jw1NmSqUGWiXAIa+3g3CQq2xr X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Sort the kerneldoc entries the same way the struct members are sorted. Signed-off-by: Konrad Dybcio Reviewed-by: Dmitry Baryshkov --- 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 Wed Mar 8 21:40: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: 13166465 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0B96C74A44 for ; Wed, 8 Mar 2023 21:41:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229959AbjCHVl3 (ORCPT ); Wed, 8 Mar 2023 16:41:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229492AbjCHVlY (ORCPT ); Wed, 8 Mar 2023 16:41:24 -0500 Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0781B99D65 for ; Wed, 8 Mar 2023 13:40:59 -0800 (PST) Received: by mail-lj1-x22d.google.com with SMTP id b10so18093965ljr.0 for ; Wed, 08 Mar 2023 13:40:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678311628; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=H5GHYEIjbrYKh7epw0Tc9uZ+ildQxs6YuaDANyPv2Xw=; b=te6pIPbupbskqjD7YxJUdDNYrA5uWUd11NatPw2LMPmcVWEL5O5EGrxUFqx25eDQpC 2cwSgNtFrGNVgbUrXaceLLl2Mx4/ZnLP1RIACe04AAQcRFeF6kSoXqu3dyd6iWUgxKUO 2mBQVxwpyAjwfKzeA0bK6AkFFTjo2jrb2SaKV04xhzW03a1G07YJeNXhp/yN+Lyq4FjU u7l3CD4DrzzUbnA/DkPaf5kPeh7xDHvRVFRB69CqP1ng7fvYJgjC5LotJyXnpJ/Cpvux 6yu1WOJ5l1O0iG9YeI3TnBgvXY4tD19FnvuigQtAMwxS0O9EZ6TAZBoOVQ6cDGgRyELA iA5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678311628; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=H5GHYEIjbrYKh7epw0Tc9uZ+ildQxs6YuaDANyPv2Xw=; b=niauUsDuUlXcW6wDJka8NvZZSdF8QRsGhgFsIru99rkRUZVPu8V1MDDmph3rFAFIv9 pj49dwhbI9A4ahhFPBavjHttSmoj+D4KoKGIZqdBxVsiGIUfeNCPKvqvfaS+D3mQrNfG TzxCsDa+KpiK2aIFD0Fof14VVgCB0C4hrZWt5nk27WnKq6y7fK8Szemfs698evQoKbHE yMaxbUO2t9X2a0F9S3E11YCvC5lYuOZLU4jVABsTspvoVeiLZ2LMC9iEaZM+/2CQhNAu FWajVMOigw/R+aniW9/nsgwhs5P9fpk7Fv7AsLKJKcgEDAD+xQ0z71wfxGJz4Y4M7Of3 WxYg== X-Gm-Message-State: AO0yUKVP0DhWEqscR/Lawo2WVjg5TEeTMfl+ezsWFUyJg8PIhJ42tiRf zOh3XxeVVTYgYmjoMzOgXWtOvQ== X-Google-Smtp-Source: AK7set9KZo60Bjmv4fvHwuYNdkISVuQLPwEsFjF/ns/4yYgcsXNhIyFGnzdXUaJ4jjgebImiugE6QQ== X-Received: by 2002:a2e:9845:0:b0:294:6977:7b34 with SMTP id e5-20020a2e9845000000b0029469777b34mr5203904ljj.50.1678311628188; Wed, 08 Mar 2023 13:40:28 -0800 (PST) Received: from [192.168.1.101] (abyj16.neoplus.adsl.tpnet.pl. [83.9.29.16]) by smtp.gmail.com with ESMTPSA id a6-20020a2e8606000000b00295a2a608e9sm2688844lji.111.2023.03.08.13.40.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 13:40:16 -0800 (PST) From: Konrad Dybcio Date: Wed, 08 Mar 2023 22:40:10 +0100 Subject: [PATCH v7 4/9] interconnect: qcom: rpm: Rename icc desc clocks to bus_blocks MIME-Version: 1.0 Message-Id: <20230228-topic-qos-v7-4-815606092fff@linaro.org> References: <20230228-topic-qos-v7-0-815606092fff@linaro.org> In-Reply-To: <20230228-topic-qos-v7-0-815606092fff@linaro.org> To: Andy Gross , Bjorn Andersson , Georgi Djakov , Dmitry Baryshkov Cc: Bryan O'Donoghue , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1678311609; l=4029; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=RNV6KgXNPCBz86BXWRqH9BOu/RV7oznRcNML/Qwy+fw=; b=waSFnWD/jVNkapAVGoVS+voXZyU+mcBxYGGg6JCvbqm0jnmy/CWpsAbfKPtZShB+oFRbTXhgqSAQ 70/kQa/GBDSvEvq18szdU+zwvxDXLlD63azArMPcMniKciOOPGGM X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Rename the "clocks" (and _names) fields of qcom_icc_desc to "bus_clocks" in preparation for introducing handling of clocks that need to be enabled but not voted on with aggregate frequency. Signed-off-by: Konrad Dybcio --- drivers/interconnect/qcom/icc-rpm.c | 6 +++--- drivers/interconnect/qcom/icc-rpm.h | 4 ++-- drivers/interconnect/qcom/msm8996.c | 12 ++++++------ drivers/interconnect/qcom/sdm660.c | 8 ++++---- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c index 27c4c6497994..62c48fb13fbf 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 Wed Mar 8 21:40: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: 13166466 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 307A5C64EC4 for ; Wed, 8 Mar 2023 21:41:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229973AbjCHVlc (ORCPT ); Wed, 8 Mar 2023 16:41:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229937AbjCHVl0 (ORCPT ); Wed, 8 Mar 2023 16:41:26 -0500 Received: from mail-lj1-x233.google.com (mail-lj1-x233.google.com [IPv6:2a00:1450:4864:20::233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C82C1449D for ; Wed, 8 Mar 2023 13:41:00 -0800 (PST) Received: by mail-lj1-x233.google.com with SMTP id t14so18039474ljd.5 for ; Wed, 08 Mar 2023 13:41:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678311631; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=8t1kfcvXJ4zvGFbuICYe+GECxTy8J8Qmh6KG/NORR+I=; b=mdCjvrrrohBvEGbTqSJDdL9299cbtLlZ53lCF5RyXLjCFRwg46KSCIxOqT/oTDC5KX 3xcixlDNLdrq6SYy6jAdoI1kc59rcpPKce+fWNi2oTEAs73gmwdRxBlvO4/DTMPopqlp BVcfppNdDuFSdi1LhKks3dEkJ44p06ECWNgojLwRm9qLIiHOQquiuTiTo72blq8NhMmI sO7M6Ru8O1bf8kVF4XZXvbbeWKQzz64Ay6M1nUbn3N8Sn8W1E3Y/U6jK4u55NGkdamvX Q7V6HTaVKiGT6oawOKKSye91E+XtwveWcllDdhBX+4NXeoIipjjzpJESEa6enzmNIvxn NKjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678311631; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8t1kfcvXJ4zvGFbuICYe+GECxTy8J8Qmh6KG/NORR+I=; b=5cTvV8xygYU1XmEoppGxPZtMLhjAY43/3o0w0aRxShOpQ9hSF6L/JA8DgligKesHEc Zy1RPCWkCgNTeqNgUnRkm4UtYhvq+p6334mvJqkmo2VOUI5WgJCL00yEvJEw56eavadj yPWljvNcX39mDfI+wHWl+SodKlA8Vc4jwtxR2Q92sTy3NqAS42GNMhwBYgQlm8dYosJq ZO9FLvQ7v8MCObpK5TzX4Uzn/iAt8Nil+ps7pklx6OcChEIYjw2rkkMqpTnp8cp2/YHn mKpMSrcK8RsJ6scqG4qhRB7ndd8Q1vn8qHDW48Lf2RN/uKFuqnskuKZzW2qPdvyCx0tn Eq8Q== X-Gm-Message-State: AO0yUKVXi+PeE8KOWDtx8xj5/57istWx/cMjoErGXnmcnnWPXtsTMub9 5wpq3LTqVUgZZ3/Qfisab3W1vQ== X-Google-Smtp-Source: AK7set8wDKBGSI5V1+fdpFoaHTTqzWP/ohyL6w1yp1yjTx6vmvknaIBSHjpI+6uMO65otVhVm6RU+w== X-Received: by 2002:a2e:8091:0:b0:293:2ef5:9434 with SMTP id i17-20020a2e8091000000b002932ef59434mr5344078ljg.2.1678311630823; Wed, 08 Mar 2023 13:40:30 -0800 (PST) Received: from [192.168.1.101] (abyj16.neoplus.adsl.tpnet.pl. [83.9.29.16]) by smtp.gmail.com with ESMTPSA id a6-20020a2e8606000000b00295a2a608e9sm2688844lji.111.2023.03.08.13.40.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 13:40:29 -0800 (PST) From: Konrad Dybcio Date: Wed, 08 Mar 2023 22:40:11 +0100 Subject: [PATCH v7 5/9] interconnect: qcom: rpm: Rename icc provider num_clocks to num_bus_clocks MIME-Version: 1.0 Message-Id: <20230228-topic-qos-v7-5-815606092fff@linaro.org> References: <20230228-topic-qos-v7-0-815606092fff@linaro.org> In-Reply-To: <20230228-topic-qos-v7-0-815606092fff@linaro.org> To: Andy Gross , Bjorn Andersson , Georgi Djakov , Dmitry Baryshkov Cc: Bryan O'Donoghue , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1678311609; l=3046; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=PzS93QUtZWZrTNDO3Fwk1Lsu/LMOgfbQTOZsMendxfs=; b=++Ge49gGRG0A2V4Md9NFW09tXmZAdsbP6qY0yPTPPRZ9ktAZweO1wv/wafbiEpZnH56yVKx/OLCa yx81tNjqDs3wPjy4maTnxs7XO0czV2ldVvMTfOwv8l9WodlduZkl X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org In preparation for handling non-scaling clocks that we still have to enable, rename num_clocks to more descriptive num_bus_clocks. Signed-off-by: Konrad Dybcio --- drivers/interconnect/qcom/icc-rpm.c | 12 ++++++------ drivers/interconnect/qcom/icc-rpm.h | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c index 62c48fb13fbf..b52f788d8f3d 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; @@ -558,7 +558,7 @@ int qnoc_probe(struct platform_device *pdev) err_remove_nodes: icc_nodes_remove(provider); err_disable_clks: - clk_bulk_disable_unprepare(qp->num_clks, qp->bus_clks); + clk_bulk_disable_unprepare(qp->num_bus_clks, qp->bus_clks); return ret; } @@ -570,7 +570,7 @@ int qnoc_remove(struct platform_device *pdev) icc_provider_deregister(&qp->provider); 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); 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 Wed Mar 8 21:40: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: 13166467 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89E62C64EC4 for ; Wed, 8 Mar 2023 21:41:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230113AbjCHVlr (ORCPT ); Wed, 8 Mar 2023 16:41:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229956AbjCHVl3 (ORCPT ); Wed, 8 Mar 2023 16:41:29 -0500 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F34EE9EDF for ; Wed, 8 Mar 2023 13:41:02 -0800 (PST) Received: by mail-lj1-x229.google.com with SMTP id i20so17948533lja.11 for ; Wed, 08 Mar 2023 13:41:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678311633; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=zAhLMOlOq8f0+6Y4C/vkVQURcQ846rkCvSSk/ic0CAg=; b=jL/mRilnQ9nv8751BSDNu2kFNMErSUfny2/2iqo0F1pGYomUWK0shx2uILI4zc3LVt vIjLymxwCnx4vUSAs+yTkzZePGfPV3VmKkvDCacFcBJoMO5XdeSm1CnaF49JAeeWuk1S yYm0dV+UBUusQ5D7Xlj2b05skOrMWNM8b3PO2Wp+CWsOzKziD06T14TdWW5EpS3DZnUw H8d7JdmsLBDAMJX+6tebKerKL7JnVHlDBLBKcEdUSeCcjCsOn4c3GpW9XNnvYzvagVxa 8Oo17X7M4l7ptEgHVpsTOHL2+rUD7WKKIs4orjAvNXV6bS0FJo/cdmPJzULEuBR3mTyl qhWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678311633; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zAhLMOlOq8f0+6Y4C/vkVQURcQ846rkCvSSk/ic0CAg=; b=hzL+2pXNigPIpR7NCrsHskf+4K6GHg7OdgSwj2OPQ+aI5IAJIbCynQRU+AIW77zU14 BHikU4vMcQfu252ScQCPTMKzEc3RHhW+a2nl7AH7LmqOmc1AIGXzVtcOxraGWSe2N+BK 9pGaeRFBffWS1BVlxBCkAluZ8ujgKOMrYvBIEhoRKcFRqa6qK205bnoWcDDu32FJ27cm 78HYeJf4eeOSeCexsK0PAUpbS7Yl0nzkTA4dKaYYYRUZZIK7uu0lsjV/IfpdyZshQOMY oQXm9Q4Z9rs11Q3xowHuuEUZMwYUefL5VUz4/c5x2pxcCwZL8cE6wai0a++sCrRco9ST xQBg== X-Gm-Message-State: AO0yUKVLkwc+ipztxCT5zUopM5zUPTSfJs8bDYci2Eb7eZmYolL/UM7Y QEVmWuSdw1utLxTuEQK6hLjhow== X-Google-Smtp-Source: AK7set9B0VQ2MJtkj5oqVSETdtCb4lQiH9K7x8lFn4qjDv4wxwnd0vY8025p1wwb7ZmSwEsuhW0aDg== X-Received: by 2002:a2e:b014:0:b0:295:ab17:c98e with SMTP id y20-20020a2eb014000000b00295ab17c98emr5756631ljk.20.1678311632848; Wed, 08 Mar 2023 13:40:32 -0800 (PST) Received: from [192.168.1.101] (abyj16.neoplus.adsl.tpnet.pl. [83.9.29.16]) by smtp.gmail.com with ESMTPSA id a6-20020a2e8606000000b00295a2a608e9sm2688844lji.111.2023.03.08.13.40.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 13:40:32 -0800 (PST) From: Konrad Dybcio Date: Wed, 08 Mar 2023 22:40:12 +0100 Subject: [PATCH v7 6/9] interconnect: qcom: rpm: Handle interface clocks MIME-Version: 1.0 Message-Id: <20230228-topic-qos-v7-6-815606092fff@linaro.org> References: <20230228-topic-qos-v7-0-815606092fff@linaro.org> In-Reply-To: <20230228-topic-qos-v7-0-815606092fff@linaro.org> To: Andy Gross , Bjorn Andersson , Georgi Djakov , Dmitry Baryshkov Cc: Bryan O'Donoghue , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1678311609; l=8939; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=zxoyRaDjRCEGCD17MC1LW/4OmB7mruBwQv24D0PVHh0=; b=j9B0Ya0yuP6y3htkWsWdiIW21nuhIgBqFbFetRb1sh37wKwgJmnooiCqm2QoH1ZMKFv2I9AqLMpR kpeMkiZYDHrgZ1ZqYApiPh+tjgqXPHTrHmGkDUUIQd2yxQmTLJhO X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Some (but not all) providers (or their specific nodes) require specific clocks to be turned on before they can be accessed. Failure to ensure that results in a seemingly random system crash (which would usually happen at boot with the interconnect driver built-in), resulting in the platform not booting up properly. Limit the number of bus_clocks to 2 (which is the maximum that SMD RPM interconnect supports anyway) and handle non-scaling clocks separately. Update MSM8996 and SDM660 drivers to make sure they do not regress with this change. This unfortunately has to be done in one patch to prevent either compile errors or broken bisect. Signed-off-by: Konrad Dybcio --- drivers/interconnect/qcom/icc-rpm.c | 52 ++++++++++++++++++++++++++++++------- drivers/interconnect/qcom/icc-rpm.h | 14 ++++++++-- drivers/interconnect/qcom/msm8996.c | 22 +++++++--------- drivers/interconnect/qcom/sdm660.c | 16 +++++------- 4 files changed, 70 insertions(+), 34 deletions(-) diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c index b52f788d8f3d..ca932ed720fb 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -369,6 +369,17 @@ static int qcom_icc_set(struct icc_node *src, struct icc_node *dst) qcom_icc_bus_aggregate(provider, agg_avg, agg_peak, &max_agg_avg); + /* If we're powering on the bus, ensure the necessary clocks are on */ + if (unlikely(!qp->is_on)) { + if (agg_peak[0] || agg_peak[1] || max_agg_avg) { + /* If this fails, bus accesses will crash the platform! */ + ret = clk_bulk_prepare_enable(qp->num_intf_clks, qp->intf_clks); + if (ret) + return ret; + qp->is_on = true; + } + } + sum_bw = icc_units_to_bps(max_agg_avg); ret = __qcom_icc_set(src, src_qn, sum_bw); @@ -409,6 +420,14 @@ static int qcom_icc_set(struct icc_node *src, struct icc_node *dst) qp->bus_clk_rate[i] = rate; } + /* Turn off the interface clocks if the bus was shut down so as not to leak power */ + if (!qp->bus_clk_rate[0] && !qp->bus_clk_rate[1]) { + if (!agg_peak[0] && !agg_peak[1] && !max_agg_avg) { + clk_bulk_disable_unprepare(qp->num_intf_clks, qp->intf_clks); + qp->is_on = false; + } + } + return 0; } @@ -441,21 +460,20 @@ 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, sizeof(*qp), 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) + qp->intf_clks = devm_kzalloc(dev, sizeof(qp->intf_clks), GFP_KERNEL); + if (!qp->intf_clks) return -ENOMEM; data = devm_kzalloc(dev, struct_size(data, nodes, num_nodes), @@ -463,6 +481,18 @@ int qnoc_probe(struct platform_device *pdev) if (!data) return -ENOMEM; + qp->num_intf_clks = cd_num; + for (i = 0; i < cd_num; i++) + qp->intf_clks[i].id = cds[i]; + + 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); + } + for (i = 0; i < cd_num; i++) qp->bus_clks[i].id = cds[i]; qp->num_bus_clks = cd_num; @@ -503,6 +533,10 @@ 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; + if (desc->has_bus_pd) { ret = dev_pm_domain_attach(dev, true); goto err_disable_clks; diff --git a/drivers/interconnect/qcom/icc-rpm.h b/drivers/interconnect/qcom/icc-rpm.h index d4401f35f6d2..a4ef45b4a9e0 100644 --- a/drivers/interconnect/qcom/icc-rpm.h +++ b/drivers/interconnect/qcom/icc-rpm.h @@ -20,24 +20,32 @@ enum qcom_icc_type { QCOM_ICC_QNOC, }; +#define NUM_BUS_CLKS 2 + /** * 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: a clk_bulk_data array of interface clocks + * @is_on: whether the bus is powered on */ 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[NUM_BUS_CLKS]; + struct clk_bulk_data bus_clks[NUM_BUS_CLKS]; + struct clk_bulk_data *intf_clks; + bool is_on; }; /** @@ -93,6 +101,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 Wed Mar 8 21:40: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: 13166468 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DAF03C74A4B for ; Wed, 8 Mar 2023 21:41:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229808AbjCHVlt (ORCPT ); Wed, 8 Mar 2023 16:41:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229930AbjCHVlb (ORCPT ); Wed, 8 Mar 2023 16:41:31 -0500 Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0AC9E40F0 for ; Wed, 8 Mar 2023 13:41:06 -0800 (PST) Received: by mail-lj1-x234.google.com with SMTP id h9so18052450ljq.2 for ; Wed, 08 Mar 2023 13:41:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678311634; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=unt+dPLwzkgBjPSkzsrVRAW1HisvFWN9XweBb7CWlcc=; b=iYUBgB6I/XNDs7MZcPLs9Pg6hHIj6L63f2DFpjEofHbJ1uJ8y480C1ua+vBa0tUJPF d6VEAVJqTe8OdyOcbPYBAbatOr25CHX8/lfaQnyaD5BNwnBLBT4YXwK5HZZunwO1R1FX ktdCIGwLdEwMjZ5LhdBXYe2z+u5YR4uCe0MXmABP0DyN3x5jAD/FnFK0ED6SRv1BgHff Op2REMJcU9grd0GcyGWSkoYNuc4sAzyqzi+/pA+g1kbg4zHVtAHZ+S8bmAAOGsVFC7HD rgQKPXbemTWfEmpuTkVqfc6Kpm3A3vkBRbXemG1La81uzYeKiYdZG7pG8QwmtRC8oxvP gIhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678311634; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=unt+dPLwzkgBjPSkzsrVRAW1HisvFWN9XweBb7CWlcc=; b=u+IWcrfPHuNYJody+aY4IuxCo7v379D3lUq1hYqrHT0XJwEho/wZfG7hbnQCCWnW5l FE7b6ECCVLFZGckKWyapkjHzUQPxZuGm6DTTPwIO2i8ojMirC6DMcSSmWas89xRFGbGn Dwfxn3TBScnxkExX8iKSyX7iz9SqB1A5k7ZkRVMwtXtGRWgyvr3k5jxa5l1bAc/cRyvV ZZe6eoxe06r+FvNQkeZXekWO7AeLoIIB0xk8sI2AdgJkQIXjd1iHUeZi8W9UbDCHsigc xc5nlTUngL1aBfvo7Pf9+XSh9miy/eeDRfCoVBdYePmqCX4Koghl4RFuqM8lYOUB6qhi BQ5Q== X-Gm-Message-State: AO0yUKXejfHgFN5+Ji+zWjBYzMvM5ZHiDzyfJl/jCilq9cjzXQDKlXp8 0l/BlYNqeGL3ODehwtzsPXWilw== X-Google-Smtp-Source: AK7set/SyoVD86AitSzXcVLVxn5MQd+pC1FxWR6jvTCiFvt79bFw612YamJyx8eYCg47FXPJrGR91g== X-Received: by 2002:a05:651c:543:b0:295:a3f6:43b5 with SMTP id q3-20020a05651c054300b00295a3f643b5mr9959326ljp.39.1678311634349; Wed, 08 Mar 2023 13:40:34 -0800 (PST) Received: from [192.168.1.101] (abyj16.neoplus.adsl.tpnet.pl. [83.9.29.16]) by smtp.gmail.com with ESMTPSA id a6-20020a2e8606000000b00295a2a608e9sm2688844lji.111.2023.03.08.13.40.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 13:40:33 -0800 (PST) From: Konrad Dybcio Date: Wed, 08 Mar 2023 22:40:13 +0100 Subject: [PATCH v7 7/9] interconnect: qcom: icc-rpm: Enforce 2 or 0 bus clocks MIME-Version: 1.0 Message-Id: <20230228-topic-qos-v7-7-815606092fff@linaro.org> References: <20230228-topic-qos-v7-0-815606092fff@linaro.org> In-Reply-To: <20230228-topic-qos-v7-0-815606092fff@linaro.org> To: Andy Gross , Bjorn Andersson , Georgi Djakov , Dmitry Baryshkov Cc: Bryan O'Donoghue , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1678311609; l=3956; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=nj1ikMGVO7EgZAVkHUb/GU8vQaA6emWCF0oysxBXbt0=; b=eSJQ+LMTzaVG8udxqxqS8GpeeEcSj1itclMCXe3BxIfDOdo90YFfck3aG2FUrisriVEHbEL4b2zN 4UP//YJpBzpK8qK+nk0mSg4QkqtxpaWBph2rf2dtVgXnbUE4RD3t X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org For SMD RPM bus scaling to work, we need a pair of sleep-wake clocks. The variable number of them we previously supported was only a hack to keep the clocks required for QoS register access, but now that these are separated, we can leave bus_clks to the actual bus clocks. In cases where there is no actual bus scaling (such as A0NoC on MSM8996 and GNoC on SDM660 where the HLOS is only supposed to program the QoS registers and the bus is either static or controlled remotely), allow for no clock scaling with a boolean property. Remove all the code related to allowing an arbitrary number of bus_clks, replace the number by BUS_CLK_MAX (= 2) and guard the bus clock paths to ensure they are not taken on non-scaling buses. Signed-off-by: Konrad Dybcio --- drivers/interconnect/qcom/icc-rpm.c | 14 +++----------- drivers/interconnect/qcom/icc-rpm.h | 4 ++-- drivers/interconnect/qcom/msm8996.c | 1 + drivers/interconnect/qcom/sdm660.c | 1 + 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c index ca932ed720fb..31d069433343 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -485,17 +485,9 @@ int qnoc_probe(struct platform_device *pdev) for (i = 0; i < cd_num; i++) qp->intf_clks[i].id = cds[i]; - 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); - } - - for (i = 0; i < cd_num; i++) - qp->bus_clks[i].id = cds[i]; - qp->num_bus_clks = cd_num; + qp->num_bus_clks = desc->no_clk_scaling ? 0 : NUM_BUS_CLKS; + for (i = 0; i < qp->num_bus_clks; i++) + qp->bus_clks[i].id = bus_clocks[i]; 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 a4ef45b4a9e0..3cddff44b4ef 100644 --- a/drivers/interconnect/qcom/icc-rpm.h +++ b/drivers/interconnect/qcom/icc-rpm.h @@ -25,7 +25,7 @@ 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_bus_clks: the total number of bus_clks clk_bulk_data entries (0 or 2) * @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 @@ -100,10 +100,10 @@ struct qcom_icc_desc { struct qcom_icc_node * const *nodes; 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; + bool no_clk_scaling; enum qcom_icc_type type; const struct regmap_config *regmap_cfg; unsigned int qos_offset; diff --git a/drivers/interconnect/qcom/msm8996.c b/drivers/interconnect/qcom/msm8996.c index 1a5e0ad36cc4..347fe59ec293 100644 --- a/drivers/interconnect/qcom/msm8996.c +++ b/drivers/interconnect/qcom/msm8996.c @@ -1820,6 +1820,7 @@ static const struct qcom_icc_desc msm8996_a0noc = { .intf_clocks = a0noc_intf_clocks, .num_intf_clocks = ARRAY_SIZE(a0noc_intf_clocks), .has_bus_pd = true, + .no_clk_scaling = true, .regmap_cfg = &msm8996_a0noc_regmap_config }; diff --git a/drivers/interconnect/qcom/sdm660.c b/drivers/interconnect/qcom/sdm660.c index 0e8a96f4ce90..7ffaf70d62d3 100644 --- a/drivers/interconnect/qcom/sdm660.c +++ b/drivers/interconnect/qcom/sdm660.c @@ -1616,6 +1616,7 @@ static const struct qcom_icc_desc sdm660_gnoc = { .nodes = sdm660_gnoc_nodes, .num_nodes = ARRAY_SIZE(sdm660_gnoc_nodes), .regmap_cfg = &sdm660_gnoc_regmap_config, + .no_clk_scaling = true, }; static struct qcom_icc_node * const sdm660_mnoc_nodes[] = { From patchwork Wed Mar 8 21:40: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: 13166469 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D38AAC64EC4 for ; Wed, 8 Mar 2023 21:41:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229930AbjCHVlu (ORCPT ); Wed, 8 Mar 2023 16:41:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229972AbjCHVlb (ORCPT ); Wed, 8 Mar 2023 16:41:31 -0500 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DBB015895 for ; Wed, 8 Mar 2023 13:41:06 -0800 (PST) Received: by mail-lf1-x130.google.com with SMTP id r27so23105521lfe.10 for ; Wed, 08 Mar 2023 13:41:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678311635; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=N+0l9w3j86TvfIl4Ozy94cjTNyYvl1DohyAW75aJMRQ=; b=PfQ9mpStKIDHEzLVFXHNNDTNw3fcw3/xsXjM9ed47kqn1PH4IJFCVf9N+E47RLWIzM XSY+9d/LZWz6h4L+dXwOi6cEHsmy/7xGvOciZbhv/GCY5e9Qd2tmUwxaOct4daheHbP8 bov+HMGBECRPtzxheE1+s14NV1Nhds8fNKKysMmJhTJBxliIPHsByR4ZBmsp+7gJKeMh /X0HM/eVgF/fwz93kKpIKyqG/yz1nHPi9JPyIg4oi6Ab2vfvnJF9tRLFxWLwulceFViD kOSecZT5+iex461tdmhTrffONTtuC6ytgSWJkjLKC/IS0GVP7NIvpeIgd62w3udLqCJD dFrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678311635; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=N+0l9w3j86TvfIl4Ozy94cjTNyYvl1DohyAW75aJMRQ=; b=tYGqe+dLJvdrc+jgAYqbcLWJ/sxahvgkqDoK/R0DnB/OhpXQ5Zfn6D8aFgZpF2n8wu 6qttBAt6GKaNuWzOkzLgyNYksLFbw/GZ4oo58YQLfQVw5Ky4LqxVxRA+cX8whA78znFS sNO3S5/O4vSE+mOV7sCg3j+VV4hwhq4V2WQrSksQI93q7Y8M0uHb9BjIre69X+1Nd9cB IQ76DZZVtQIRf82CkSD1RHXP5QBaAck081XlgejA9kUuKLrx6B4UgCSDfvEdNt6CWYy1 JgQnbvF4lF4ZXWHK1pE4kQwDseJTzQ8fBDR666fnXHFu6RGlQikCNTu6/LxlKwlhYGEx Gzmw== X-Gm-Message-State: AO0yUKXjtPn1hXxjnt+RqhioOtgnmlZfJdU59JUa3oGJCDd/Hq8H6mtl bryhxhFM0mnCGyUjff2vcvZgxA== X-Google-Smtp-Source: AK7set892RPNUTtNQadqUSUAExW0pHWvLV1nEouKSGEv/93gX767qt/zLH/IqBZL5pTlI6au3vTnjQ== X-Received: by 2002:a05:6512:3d90:b0:4db:25bb:ff0b with SMTP id k16-20020a0565123d9000b004db25bbff0bmr6147627lfv.2.1678311635647; Wed, 08 Mar 2023 13:40:35 -0800 (PST) Received: from [192.168.1.101] (abyj16.neoplus.adsl.tpnet.pl. [83.9.29.16]) by smtp.gmail.com with ESMTPSA id a6-20020a2e8606000000b00295a2a608e9sm2688844lji.111.2023.03.08.13.40.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 13:40:35 -0800 (PST) From: Konrad Dybcio Date: Wed, 08 Mar 2023 22:40:14 +0100 Subject: [PATCH v7 8/9] interconnect: qcom: rpm: Don't use clk_get_optional for bus clocks anymore MIME-Version: 1.0 Message-Id: <20230228-topic-qos-v7-8-815606092fff@linaro.org> References: <20230228-topic-qos-v7-0-815606092fff@linaro.org> In-Reply-To: <20230228-topic-qos-v7-0-815606092fff@linaro.org> To: Andy Gross , Bjorn Andersson , Georgi Djakov , Dmitry Baryshkov Cc: Bryan O'Donoghue , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1678311609; l=1105; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=OSAfkyJvvvDXJf5AHSbe23m5GiOxqbkKHaYbUhLD+NM=; b=WcebsguplvEedMiICVRR6tw9G2J6b6JAwcRKpsP4b34niNN0zXH9BVKa/397gk1X23wuzK2glT2l VdbLkx8IDYVGrujDys55r/L6UPn7hO/t8shQhzvNMx60x2tjXSve X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Commit dd42ec8ea5b9 ("interconnect: qcom: rpm: Use _optional func for provider clocks") relaxed the requirements around probing bus clocks. This was a decent solution for making sure MSM8996 would still boot with old DTs, but now that there's a proper fix in place that both old and new DTs will be happy about, revert back to the safer variant of the function. Fixes: dd42ec8ea5b9 ("interconnect: qcom: rpm: Use _optional func for provider clocks") Signed-off-by: Konrad Dybcio --- drivers/interconnect/qcom/icc-rpm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c index 31d069433343..554fb27de4be 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -517,7 +517,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 Wed Mar 8 21:40: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: 13166470 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0BB1C74A5B for ; Wed, 8 Mar 2023 21:41:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230184AbjCHVlw (ORCPT ); Wed, 8 Mar 2023 16:41:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229999AbjCHVld (ORCPT ); Wed, 8 Mar 2023 16:41:33 -0500 Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 208D6C4E9F for ; Wed, 8 Mar 2023 13:41:08 -0800 (PST) Received: by mail-lj1-x22a.google.com with SMTP id by8so18036413ljb.7 for ; Wed, 08 Mar 2023 13:41:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678311637; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=vveGd9sf9fGz7xfjIX4ynPRPTvQaFdGwhHtakqOTRYg=; b=MDAy6R+jjctd0vx9CWrQXaXsEMkgKA/ZE6LE8uRw86hdQoO9sa3Q/9/chs5qLDJccG rNTN/514pGvz9ibGNcPpdTSm1gyKyXCLqS82bHUk5rhi1jQv16Hidf90VLLI678+qNCh Vk7/QAFl7cKP6IZWezjF4730IJVbEGaHbwsJFfQsUbF9IYp4ApjG9/PVR+loQyMeCk4H LW2yWvgpwDJtw7fuEpK1Hq4cVpft2f/Ss1lkaj39Dx/Ei0C/kevGyefEznjdROje9YLK LU1vHYgO4loidMf5EOI/tV1KT28QxAAlMPkTALUPRwHIAvFswlDmSPWVZPMCyBVReHya 2Okg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678311637; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vveGd9sf9fGz7xfjIX4ynPRPTvQaFdGwhHtakqOTRYg=; b=UZr7NWGJrEpbwNYMKd2n69M7yGgoUotb5K1n43b7g6YFZTdr99/NualVykugNLEJTk F95CbNdDt0Uy9krbE8oyA8/KwKOFPJFecT+gNNtGf2TqqHNRk0PCwpPifozbnQjIPuiA 2R9aP5t4wVdF185pOvZIQR4kwDI/Y9OYL5NJOiDDu5X1P4lc91/RagwOsIKXF5OP7TBT cpf3t3EVuz5gyUWh9zdSdrxA5MyA6qci/0dBgtZHLTyTGypB9HWnGcwjrG+TKuAoeEn7 c5bKme2zFfFpQnKarW+3T61XpSWO78GEhRzmfCU7zCJMNSzaSU+snspUGY/hmCEdKeIy wVWA== X-Gm-Message-State: AO0yUKXySkbOjxcutUQ+FGGoLBrxd+T6MjG29iCJOxO6tXkhRWbsP8Fn 9l6/URewx9zhVNvopvnE+fEEyA== X-Google-Smtp-Source: AK7set8JeXNHn4TnkWOhL+wkhYu2gkjGes9+4TTQV1KtujPgQcUC0f+IFVgsBNsru/W0JaARFY+M4Q== X-Received: by 2002:a2e:7e10:0:b0:295:9d05:4a56 with SMTP id z16-20020a2e7e10000000b002959d054a56mr4824962ljc.9.1678311637409; Wed, 08 Mar 2023 13:40:37 -0800 (PST) Received: from [192.168.1.101] (abyj16.neoplus.adsl.tpnet.pl. [83.9.29.16]) by smtp.gmail.com with ESMTPSA id a6-20020a2e8606000000b00295a2a608e9sm2688844lji.111.2023.03.08.13.40.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 13:40:36 -0800 (PST) From: Konrad Dybcio Date: Wed, 08 Mar 2023 22:40:15 +0100 Subject: [PATCH v7 9/9] interconnect: qcom: msm8996: Promote to core_initcall MIME-Version: 1.0 Message-Id: <20230228-topic-qos-v7-9-815606092fff@linaro.org> References: <20230228-topic-qos-v7-0-815606092fff@linaro.org> In-Reply-To: <20230228-topic-qos-v7-0-815606092fff@linaro.org> To: Andy Gross , Bjorn Andersson , Georgi Djakov , Dmitry Baryshkov Cc: Bryan O'Donoghue , linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1678311609; l=1279; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=5H1KJ2r/pG170nOV3v3bsq3JNwWcNEZN04iD5DDB2kw=; b=mA+CUaUze95pv7UwCHyxJG284m7hyf7mpYPzfRrzl/yoikhuSf999ZWFXM2KiHMv5jr/d5NJq0Lb GnYlQwesD62E+SECS98WGgXTUqKbxD8cKwtBkI2a+l3MTLs+7Q4u X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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 347fe59ec293..1eb51ed18b0b 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");