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: 660874 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 7E17FC64EC4 for ; Wed, 8 Mar 2023 21:41:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229603AbjCHVlP (ORCPT ); Wed, 8 Mar 2023 16:41:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229605AbjCHVlO (ORCPT ); Wed, 8 Mar 2023 16:41:14 -0500 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B25DD53280 for ; Wed, 8 Mar 2023 13:40:45 -0800 (PST) Received: by mail-lj1-x22f.google.com with SMTP id t14so18038739ljd.5 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=VQY/BAzvJC+inaQsJPlRug5//HisQtN4dEdNhpLOS7E07eDWm+UDtZ4gpKzX7JuzN3 ksdDzrzqvBy37ebPh+oYaZXPX4TmgMVCevkLVW3pVfS9GKYOBU+eHHcBueTvkXuwEf88 2FLC5aLOdoyRFtOtHdpzBXopAlQaqnHfJJGZgecPhNUiVxxaLSLxW+7/kdB6tr/9Ud5V gLdLNNmFWxFeNRvITtoSs8NJt1P04zEpN3Yu0rQg09+7AMf9dCm4Z+J3O2VTmjrBPNwG 2KL78swJxU0EuUDVUB2fgLO480Z0MVswMyaXmINaIJAztUcT7KxkObU/3J2JIIMITvMP MrGw== X-Gm-Message-State: AO0yUKXXqWjJ9k96SO6Pt9Bfcv5EjxhafNt45fmQ/CAyaY4I47m9gRFm mZPzuV5yRWFV+IAIw6oGl0HBpg== 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-pm@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: 661425 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 6C748C678D5 for ; Wed, 8 Mar 2023 21:41:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229614AbjCHVlU (ORCPT ); Wed, 8 Mar 2023 16:41:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229610AbjCHVlS (ORCPT ); Wed, 8 Mar 2023 16:41:18 -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 D5DADD461D for ; Wed, 8 Mar 2023 13:40:47 -0800 (PST) Received: by mail-lj1-x22a.google.com with SMTP id z5so18042907ljc.8 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=yws7C/OftyXQBV1n9x9f1ly4IRM1denYq/WNEMEOr4Yy2bJlXJWtn4iBwodEo/DemX uokv2ScZVjlSiLtun4kS0OX5E7hdwyqmjLtf0GhNkI9W6u1LgtOV0M/64QGE8tr07v9+ 28GGSm9h9FBw7H8uSqo8FoPcHSa3rv0gFcZKCVfORVGTM5S4GU+PMHQqynDEDNDtuObn yMsc0buEWBGTJOPIAyvrikrrO+3k4F8toKToDt24tJWYbB0k8j9SsG7yPYeFO5tAO58M 36bulwvSSOmmFVkDFHUS+Yh0beX/9oNAZp/TBzpuOWW5khehLU+35iCBoBEbPk5+k4UP 3AUQ== X-Gm-Message-State: AO0yUKWLp3V3nBoavStk5Mi2gfRVnAS+zhi279n/sYUG5y5vQI+mOi9q eIdPOP6CaqrZ5dylnhO6O1zlMA== 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-pm@vger.kernel.org Some nodes, like EBI0 (DDR) or L3/LLCC, may be connected over more than one channel. This should be taken into account in bandwidth calcualtion, as we're supposed to feed msmbus with the per-channel bandwidth. Add support for specifying that and use it during bandwidth aggregation. Reviewed-by: Bryan O'Donoghue Signed-off-by: Konrad Dybcio --- drivers/interconnect/qcom/icc-rpm.c | 7 ++++++- drivers/interconnect/qcom/icc-rpm.h | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c index 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: 660873 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 811FBC64EC4 for ; Wed, 8 Mar 2023 21:41:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229923AbjCHVlY (ORCPT ); Wed, 8 Mar 2023 16:41:24 -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 S229613AbjCHVlT (ORCPT ); Wed, 8 Mar 2023 16:41:19 -0500 Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C905D5A18C for ; Wed, 8 Mar 2023 13:40:50 -0800 (PST) Received: by mail-lj1-x22b.google.com with SMTP id h3so18006020lja.12 for ; Wed, 08 Mar 2023 13:40:50 -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=FOz2s1ydU1rNJqAkhFHaPcg5NiBTzjOCKlCEu7cY2BTWklPitfn6Hxh8qzdvUJaail zMAFvP0TaUT04a8lpuHHjtlcJDIIg5OdCTyK8hY5wzAilCTT6Qww4ZxS+AnRTIvhQip2 JIuGm/Pf1lOC2DH4BKGrTknJO2cGCQUTa06Bt1jsmchAVHZ1cRkkmWK5XhYwkwk7gvpR cBd9wc0SXz+WgmVFNNB85KfxWu9Z4eWbw91lYwnC1/wplAysmU+NHWZlHtl3J7mnHvYa Eb7SJpllSY8nJOfeNmB1nc7jQRvnHjhMJ1/XL2MmmlwJeRuiUuWVyIvSAonibJzgniGV xRsg== X-Gm-Message-State: AO0yUKWUPUU3YNI+yHk9ht8hVyC80gyfIBO7jRHkIS1ymXK87F1RWWpf vrrTQW0FvTefd2Y7i/qDT7s5+Q== 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-pm@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: 661424 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 E0796C678D5 for ; Wed, 8 Mar 2023 21:41:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229887AbjCHVl2 (ORCPT ); Wed, 8 Mar 2023 16:41:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229910AbjCHVlY (ORCPT ); Wed, 8 Mar 2023 16:41:24 -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 47BC8B53FC for ; Wed, 8 Mar 2023 13:40:58 -0800 (PST) Received: by mail-lj1-x233.google.com with SMTP id a32so4074382ljq.1 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=0D58UzHWOmT5qvxXrqbrmxBB4NKNBVonMUl4CuE9f+6JyqQKQhrkuld3R5/Ar1/Z8J U68WpHWqTNi6pwJE4oCjz5BycJOFBZOVB7rCXwtQFuVAexadWGQ7jriJYt+U02yEu+9T g+b+grni84dxDh7jk8+oxthdx0C0SxGq3ZEW1OjKvJ7uZH3oYufHzvfc4F5ZG/2FeQvX yonPOODza5Adtwu41TcM0yWZlXaqEM+H9j2JUFLDCJLswqu3+TgFCfsr9XZNiAfGMa7r XPXZHVncqU2QdirHtPnTDFS4F8jAdp88liGVusSPtDrTRtsTZ6B/99i/x+QoGoK5Qd3V FHyw== X-Gm-Message-State: AO0yUKXz4IFO6YKHJCA1mdGj3brV76TEY674/MwHki3C8RML8bOefmCf 7TIQ9kxsdt+1US/K9m/BNy0rSg== 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-pm@vger.kernel.org Rename the "clocks" (and _names) fields of qcom_icc_desc to "bus_clocks" in preparation for introducing handling of clocks that need to be enabled but not voted on with aggregate frequency. Signed-off-by: Konrad Dybcio --- drivers/interconnect/qcom/icc-rpm.c | 6 +++--- drivers/interconnect/qcom/icc-rpm.h | 4 ++-- drivers/interconnect/qcom/msm8996.c | 12 ++++++------ drivers/interconnect/qcom/sdm660.c | 8 ++++---- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c index 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: 660872 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 45A4BC742A7 for ; Wed, 8 Mar 2023 21:41:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229991AbjCHVlc (ORCPT ); Wed, 8 Mar 2023 16:41:32 -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 S229940AbjCHVl0 (ORCPT ); Wed, 8 Mar 2023 16:41:26 -0500 Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CAEDB56DA for ; Wed, 8 Mar 2023 13:41:00 -0800 (PST) Received: by mail-lj1-x22b.google.com with SMTP id a32so4074475ljq.1 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=YtQ8H4MFu1qyEawV7OWhIIOEAJAwgin66e0CbvU8PbD6WNxaevC5z5u+ZCHQSL6nIM yfgdl2qT92KFjFqPUp9m4GkaFFP5zuBqee95a7V3KZDHjggEG76qpmU2hju5iL6pcXsj 0dmPrKZ3N3/rDyVvneP8T1NjaskJKJwLQ8LOEWwCeqQFb42b1ISvrK1a18F6PDWZosm4 rid1Q87It4Y92CD+mjd8oYl6P483jMt2Bau+A0kqAv2Bm17zzVEIK0NeNJY17oLf5eqY 8j0v0uatJyS6UW/aNWIVR2BwxmkpDAt094a68Aqobx7CL7PTuiklgJCCjaQ/ZHeIVt9d YyFA== X-Gm-Message-State: AO0yUKXgxwHaPQwE3aEo/W2WX3mQMsFSZcQ9C+eFS5aAtT7aLLdBvS5w UEiX6IEj1PPN2dk1w6bZtYrqqg== 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-pm@vger.kernel.org In preparation for handling non-scaling clocks that we still have to enable, rename num_clocks to more descriptive num_bus_clocks. Signed-off-by: Konrad Dybcio --- drivers/interconnect/qcom/icc-rpm.c | 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: 661422 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 F30F9C74A44 for ; Wed, 8 Mar 2023 21:41:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230173AbjCHVlv (ORCPT ); Wed, 8 Mar 2023 16:41:51 -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 S229963AbjCHVla (ORCPT ); Wed, 8 Mar 2023 16:41:30 -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 86444192 for ; Wed, 8 Mar 2023 13:41:03 -0800 (PST) Received: by mail-lj1-x234.google.com with SMTP id z42so17988994ljq.13 for ; Wed, 08 Mar 2023 13:41:03 -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=eZQAHCe++FuxKmJvDSGx1us1tsOjAC/yVeolD+v3iV0xWupirykg/qhJYxoItoHwVt bKWu4Yn7Z7/P1vAN9YgDbjH+e857Hhq+j4X1H06l1MR7dY9E570XU6DASFNM+L7U8jy2 8u7A0i2mR92NdW2Nqy+XdQYXI3jcJj88VFysHXwwrqLEg9owl7QmttX+M8iLLpwrYxE6 eZ2nngBChtZj84vAS1cq/qF74d0iQFxzMHVWGBzLS5Z+z62XDH/YYFczR9DikpSnCVBl eQv0l6x1i4MmMtvJ0udWioiQazNk9nyCSkdcxZWwb04gtXAHkLhGCvpg+DMtazFOkYkO ymtA== X-Gm-Message-State: AO0yUKV1n2Cy+HE8cs/YDAr+ig7kb1j6rtmJNvzbeoWG1uSfB30HxyB8 i52/fAJRBAHDA1AKCK/vxvF48g== 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-pm@vger.kernel.org Some (but not all) providers (or their specific nodes) require specific clocks to be turned on before they can be accessed. Failure to ensure that results in a seemingly random system crash (which would usually happen at boot with the interconnect driver built-in), resulting in the platform not booting up properly. Limit the number of bus_clocks to 2 (which is the maximum that SMD RPM interconnect supports anyway) and handle non-scaling clocks separately. Update MSM8996 and SDM660 drivers to make sure they do not regress with this change. This unfortunately has to be done in one patch to prevent either compile errors or broken bisect. Signed-off-by: Konrad Dybcio --- drivers/interconnect/qcom/icc-rpm.c | 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: 661423 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 A58F6C6FD19 for ; Wed, 8 Mar 2023 21:41:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230139AbjCHVls (ORCPT ); Wed, 8 Mar 2023 16:41:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229967AbjCHVla (ORCPT ); Wed, 8 Mar 2023 16:41:30 -0500 Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0DC552F55 for ; Wed, 8 Mar 2023 13:41:04 -0800 (PST) Received: by mail-lj1-x230.google.com with SMTP id g18so18063280ljl.3 for ; Wed, 08 Mar 2023 13:41:04 -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=u2ej1B2uVh+R5TVdJoJUwfeTKXTuh1W1d1+r9P+ZJPoPh7hZsRL/hJa1YBGKYA7Urx O5HjToKMMcUG2UyOMOhz7BDmvTchebZB8cAZGXZVZfYST9ZGM+QBoxisWAhcyJZGiHmv +OfZmEMYRonvn1/RM5NYsnJjJA16kfpP4P7NmLs5xUYW7XDeNbpQmWmUGp+h3GF/DsdR Y5MqW77sWKT0yh3W/TrJOt+2uqOn6u8po+JB6wkDVVamlF9aZUtFu8P2jA+7m2jJshLu KElypXAZtlrwx4UKm+UaA3IxlijmWTDVt863AkwjvWfjfeA2hh8wkQA5EWc14Bo8YeeX GuBg== X-Gm-Message-State: AO0yUKXLqAJJUrctDSZPEccq7oFdNch0Adp3dts8DyBasmta6+3wttX4 PIk5nfWviV9YrSRC6++H8zfIHA== 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-pm@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: 660871 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 CB0B6C742A7 for ; Wed, 8 Mar 2023 21:41:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230166AbjCHVlu (ORCPT ); Wed, 8 Mar 2023 16:41:50 -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 S229746AbjCHVlb (ORCPT ); Wed, 8 Mar 2023 16:41:31 -0500 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 328EED08D1 for ; Wed, 8 Mar 2023 13:41:06 -0800 (PST) Received: by mail-lf1-x133.google.com with SMTP id t11so23146570lfr.1 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=F/WjgKQzLhqDINP905Yc/50zE73dUARNMDweuSoURCJ971JxOGTMJqjZf3B9uaP4Yr WDq+W3gMWsgKr0sDeuY2OO5XdFP8EvdTObAhZWrSpapJ8Y35JN9NwLbq7lFa9B87vmug HIHAizf7f+WNmP/r6DsP7ld8rry671zBtkzOHVwrorPIrECm0qqKxxyAYIn3TTyPOv/1 Vf2mHUMQ11uyal89Geabrv6TdCNQgPG3rMHKvlhy0p/ZH5b0AQp6yLALxA47pQwsflro bJZ89IlUBmMECmO9dvjp99Ufb6Sd1GMXEYdFUCevk9PJ+8pcAWLFTInvt7J4vpmaPQDL GEmQ== X-Gm-Message-State: AO0yUKX5aUlV1V+ZV5v+GTpT4nct2FSAb/5DDFVLXa/4ZAKqgA9XS5qT 1AAivUTxH4sXHRDHCWcqzsRVvg== 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-pm@vger.kernel.org Commit dd42ec8ea5b9 ("interconnect: qcom: rpm: Use _optional func for provider clocks") relaxed the requirements around probing bus clocks. This was a decent solution for making sure MSM8996 would still boot with old DTs, but now that there's a proper fix in place that both old and new DTs will be happy about, revert back to the safer variant of the function. Fixes: dd42ec8ea5b9 ("interconnect: qcom: rpm: Use _optional func for provider clocks") Signed-off-by: Konrad Dybcio --- drivers/interconnect/qcom/icc-rpm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c index 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: 660870 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 180C3C76186 for ; Wed, 8 Mar 2023 21:41:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229994AbjCHVlw (ORCPT ); Wed, 8 Mar 2023 16:41:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229940AbjCHVld (ORCPT ); Wed, 8 Mar 2023 16:41:33 -0500 Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13624168A2 for ; Wed, 8 Mar 2023 13:41:08 -0800 (PST) Received: by mail-lj1-x22b.google.com with SMTP id z5so18043836ljc.8 for ; Wed, 08 Mar 2023 13:41:07 -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=b0kUjjwwXlQE9P57MPznlGixiAG08tj55LXybgHc3h+uwNx6UV5JCXI7d0DtINPVfH 7oP7+JjfeKzeZjMcY+E4+rLy6Evj1saeD1i/1MUcF6ZPgUSAWV2JZ6Uu8ehjrcYabL9U DSWbrRNyZQMje301ojwi7+0cKf/buG2HC/jNHrl+eFg8jz1sQgAafbYQqmv+NzJNdYwO qRPNeis4z6ywNbDnpPJnC9kQ2U+gowCSsYgeSNYnj30O/PAe37As/aMorZ9d6HgtizFe WjdsXxBPn6ONanJOiZk7YasghEm8wbVH+qVJ4WXGyhF2NyrkLMHacxhnOsu6LLAKjioj 2eqA== X-Gm-Message-State: AO0yUKUHgLOFuponCgO6VFRCilMaATL+7BrX2lzaxQCM8+MgEP3J2Psl Zy46qfkA+E7Wn5U+pXqvhImUOw== 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-pm@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");