From patchwork Tue Feb 28 13:43:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 657922 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 BB891C7EE2E for ; Tue, 28 Feb 2023 13:44:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229613AbjB1Noa (ORCPT ); Tue, 28 Feb 2023 08:44:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229470AbjB1No2 (ORCPT ); Tue, 28 Feb 2023 08:44:28 -0500 Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76D041B579 for ; Tue, 28 Feb 2023 05:44:26 -0800 (PST) Received: by mail-lj1-x22c.google.com with SMTP id y14so10281502ljq.4 for ; Tue, 28 Feb 2023 05:44:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677591865; 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=Ym8bk2djHTFvMcICEA5unUHh3z2W5J7DD0DkD41HCss=; b=yssCFdpsLgyjb2tkqo3BjA8G+KiKKYIylSMDQZ80Af9WxH5saFLpuzegkR0G6tO3UD bPnk08MPwstL9cfBE0zoklO+uNZCzWNrrAdCVTVkOcz1Hg6NfcJqR4VlUX0xBryrVX4X 9MD5jbg0ahMnfRC6QeLogjkaZHovmjV2QRN3JmxMBi6BfbMD0KxOkVm1oX0SlLpWQvnJ KGf24QSFy90vp8r+PweJc6XysOfko10URZQaROkroXSMqxDMkX0bhkXwBuX4NLntV4Vs wi6jg8TV/ZEVo5XZniR5d8BFSeuM5fXiHZv3cuPIztxQ5ewrOvJ8TEB5wT6UeQnxXMOr VqyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677591865; 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=Ym8bk2djHTFvMcICEA5unUHh3z2W5J7DD0DkD41HCss=; b=s6MDq96f7rT1vHJ+W62AD69f3KDf/EQNiIkWDrxgvlAEPaltvSs33a0dfm8TUnQOg3 pUmHZR69q+nrVUuQMEJRi+kcqQwiiUkXtmi9a3C2f1QDBFA/6l45nS47v0lroll/EBes pAg3UkO/aGMxpWhHQLocB0qucWxWDQlLTH23hG5svajeFM9q/zsifA1C79KdWy0y+Q/U yHaRC+BWTR3HCreMT66LViVWFcOovaoZtRzmX6duL2ks66x2/I+at+DytsFuuKVUlU+B M3Y3ZK1Xk1N+xNw+i9G8FwK91PO06ZIoescrDThWt5hM8PzH73ddW0fSbyHups0Ai73h 6Enw== X-Gm-Message-State: AO0yUKWIRWCWMnOg6fE9EPgaOkqo+mBHU8NcIUYsUhbZpZMQdNN43P4P ZMFMFN4fRaRuzoiEoa+0OHFiNw== X-Google-Smtp-Source: AK7set/PgzJ80pdegYRmYQh3SLh0C8P27Gqp/NaaGXh1EBZ2AmEattSd6HRthdpcobRhkx4yLOBLGA== X-Received: by 2002:a2e:3807:0:b0:293:4b62:a763 with SMTP id f7-20020a2e3807000000b002934b62a763mr671454lja.25.1677591864749; Tue, 28 Feb 2023 05:44:24 -0800 (PST) Received: from [192.168.1.101] (abym99.neoplus.adsl.tpnet.pl. [83.9.32.99]) by smtp.gmail.com with ESMTPSA id j20-20020a2e3c14000000b00295a583a20bsm1203975lja.74.2023.02.28.05.44.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 05:44:24 -0800 (PST) From: Konrad Dybcio Date: Tue, 28 Feb 2023 14:43:59 +0100 Subject: [PATCH v6 2/9] interconnect: qcom: rpm: Add support for specifying channel num MIME-Version: 1.0 Message-Id: <20230228-topic-qos-v6-2-3c37a349656f@linaro.org> References: <20230228-topic-qos-v6-0-3c37a349656f@linaro.org> In-Reply-To: <20230228-topic-qos-v6-0-3c37a349656f@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=1677591861; l=2390; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=kQApzOtp5XG97FXu8eGnUnr0dwRtenzwoSY2YN1AJto=; b=dL+SU7TK7JpouJMAVZmIKPd5sVj0XEMsFR3zzjO4P0ucnyOJrqVbdeNqCraHKKVyFAgSkETy0TNl n5LZn4qrCNaunz97U8qioBs/Chv1/n4vkqUWnYZASsFJYarncO2e 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 --- 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 ffbeeca8c2b0..6bd20f62f8ed 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -317,6 +317,7 @@ static void qcom_icc_bus_aggregate(struct icc_provider *provider, { struct icc_node *node; struct qcom_icc_node *qn; + u64 sum_avg[QCOM_ICC_NUM_BUCKETS]; int i; /* Initialise aggregate values */ @@ -334,7 +335,11 @@ static void qcom_icc_bus_aggregate(struct icc_provider *provider, list_for_each_entry(node, &provider->nodes, node_list) { qn = node->data; for (i = 0; i < QCOM_ICC_NUM_BUCKETS; i++) { - agg_avg[i] += qn->sum_avg[i]; + if (qn->channels) + sum_avg[i] = div_u64(qn->sum_avg[i], qn->channels); + else + sum_avg[i] = qn->sum_avg[i]; + agg_avg[i] += sum_avg[i]; agg_peak[i] = max_t(u64, agg_peak[i], qn->max_peak[i]); } } diff --git a/drivers/interconnect/qcom/icc-rpm.h b/drivers/interconnect/qcom/icc-rpm.h index 8ba1918d7997..8aed5400afda 100644 --- a/drivers/interconnect/qcom/icc-rpm.h +++ b/drivers/interconnect/qcom/icc-rpm.h @@ -66,6 +66,7 @@ struct qcom_icc_qos { * @id: a unique node identifier * @links: an array of nodes where we can go next while traversing * @num_links: the total number of @links + * @channels: number of channels at this node (e.g. DDR channels) * @buswidth: width of the interconnect between a node and the bus (bytes) * @sum_avg: current sum aggregate value of all avg bw requests * @max_peak: current max aggregate value of all peak bw requests @@ -78,6 +79,7 @@ struct qcom_icc_node { u16 id; const u16 *links; u16 num_links; + u16 channels; u16 buswidth; u64 sum_avg[QCOM_ICC_NUM_BUCKETS]; u64 max_peak[QCOM_ICC_NUM_BUCKETS]; From patchwork Tue Feb 28 13:44:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 657921 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 DC6DEC64ED6 for ; Tue, 28 Feb 2023 13:44:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229649AbjB1Noe (ORCPT ); Tue, 28 Feb 2023 08:44:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229470AbjB1Noa (ORCPT ); Tue, 28 Feb 2023 08:44:30 -0500 Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEE2D2D161 for ; Tue, 28 Feb 2023 05:44:28 -0800 (PST) Received: by mail-lj1-x236.google.com with SMTP id a4so6976640ljr.9 for ; Tue, 28 Feb 2023 05:44:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677591867; 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=trqKxHVgto91KGpmwfFi50FtfxdBe4Har0LKdE1pjhM=; b=i2sizqKBVvwGwnEBvXN3ga0Mls2xAfOLp9J2H2VC82PEPBGHFG4fxDKvi7A47sWG0B Iz/jMvOe2SNl1Tw1flVxjp21m+JShdEBHBTXdjM19i6y2U0JbLDbfmKy9vka9ha28rbl Nr06bqKxswjopY+oc/++7+wwNfo7kEOwx4qccufFUe6uU/THqlBXBAYhrLVB3mpKgiDK xLTHqe2tM5Vucq9IA6MGhJE40HOwws3br2y/5ahWU0PE7JsSIujxN3yQ43VfiGWzy8iU MfhPdVO+Hfg+QOhiWMoFLbMMrP1gdhMnIOnXHhHcGUvlnZqUbS48dF9pVKinST52gV7c Hc4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677591867; 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=trqKxHVgto91KGpmwfFi50FtfxdBe4Har0LKdE1pjhM=; b=Mk5f9FCm8+DOnV8cF5MjFsdcod8eH8PQ+rLuY/X/COvafNGiGvji2RaBg+t8ytxb9S QtRSBCee4XMW6e5VagYZscMCu14z02J02P9ytvja3bBYDxYoknri2WzSf17DxUgi9KT/ ihDrVnivMvM9SBpOOfuGZD5HjyLIpTnXx8D4uCX0CDG17TBPljON/pZhu3wwDBGsSyWh T4mOPRjJ59/QVZXam19wBgscXiClfH6leErJFKLSZTkDSIDCDaNpttYnBHsIeHKcJfMA /RnILb/Xv+MBCNe+hgr7nSp5vjMq7vboDGtHHw0jhrJIM+6oXuo2S/r1QhqNGuoRonXs QvZQ== X-Gm-Message-State: AO0yUKWpfUn1hy0FNgL++uUqb1jmIu1cKm0djUbOxw/NXhbjC4bhQ6TH G/Kqn3Vc6rYWW5ncNf0915a2vA== X-Google-Smtp-Source: AK7set+MWJZNBx86ZLvLB9pWlgctAiTaOLv1n4UL4eWDJq3JWRIaGXPCKR7FvHRwpieNVK4qAP+kaw== X-Received: by 2002:a2e:1418:0:b0:295:b1af:d269 with SMTP id u24-20020a2e1418000000b00295b1afd269mr929134ljd.43.1677591867201; Tue, 28 Feb 2023 05:44:27 -0800 (PST) Received: from [192.168.1.101] (abym99.neoplus.adsl.tpnet.pl. [83.9.32.99]) by smtp.gmail.com with ESMTPSA id j20-20020a2e3c14000000b00295a583a20bsm1203975lja.74.2023.02.28.05.44.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 05:44:26 -0800 (PST) From: Konrad Dybcio Date: Tue, 28 Feb 2023 14:44:01 +0100 Subject: [PATCH v6 4/9] interconnect: qcom: rpm: Rename icc desc clocks to bus_blocks MIME-Version: 1.0 Message-Id: <20230228-topic-qos-v6-4-3c37a349656f@linaro.org> References: <20230228-topic-qos-v6-0-3c37a349656f@linaro.org> In-Reply-To: <20230228-topic-qos-v6-0-3c37a349656f@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=1677591861; l=4029; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=TiHJ8feqrM/9/cy6G2m/OVSUoFJuDJvEz8WPJBFfHhE=; b=HwIC6HIHf6kcFSIifEsBPqXB+mPKzOtTqJVlZVN/Xw+ptMGS7rVE9RnNmlKKEi6ErlHIgicrmZP7 /jQzDgUiAKtMa8pHoDPpSBpvWMXcQdmZm8W3I9B8AL3/H/I7o/sB 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 6bd20f62f8ed..7a54fe4ccadd 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -441,9 +441,9 @@ int qnoc_probe(struct platform_device *pdev) qnodes = desc->nodes; num_nodes = desc->num_nodes; - if (desc->num_clocks) { - cds = desc->clocks; - cd_num = desc->num_clocks; + if (desc->num_bus_clocks) { + cds = desc->bus_clocks; + cd_num = desc->num_bus_clocks; } else { cds = bus_clocks; cd_num = ARRAY_SIZE(bus_clocks); diff --git a/drivers/interconnect/qcom/icc-rpm.h b/drivers/interconnect/qcom/icc-rpm.h index 21f440beda86..d6b4c56bf02c 100644 --- a/drivers/interconnect/qcom/icc-rpm.h +++ b/drivers/interconnect/qcom/icc-rpm.h @@ -91,8 +91,8 @@ struct qcom_icc_node { struct qcom_icc_desc { struct qcom_icc_node * const *nodes; size_t num_nodes; - const char * const *clocks; - size_t num_clocks; + const char * const *bus_clocks; + size_t num_bus_clocks; bool has_bus_pd; enum qcom_icc_type type; const struct regmap_config *regmap_cfg; diff --git a/drivers/interconnect/qcom/msm8996.c b/drivers/interconnect/qcom/msm8996.c index 25a1a32bc611..69fc50a6fa5c 100644 --- a/drivers/interconnect/qcom/msm8996.c +++ b/drivers/interconnect/qcom/msm8996.c @@ -1821,8 +1821,8 @@ static const struct qcom_icc_desc msm8996_a0noc = { .type = QCOM_ICC_NOC, .nodes = a0noc_nodes, .num_nodes = ARRAY_SIZE(a0noc_nodes), - .clocks = bus_a0noc_clocks, - .num_clocks = ARRAY_SIZE(bus_a0noc_clocks), + .bus_clocks = bus_a0noc_clocks, + .num_bus_clocks = ARRAY_SIZE(bus_a0noc_clocks), .has_bus_pd = true, .regmap_cfg = &msm8996_a0noc_regmap_config }; @@ -1866,8 +1866,8 @@ static const struct qcom_icc_desc msm8996_a2noc = { .type = QCOM_ICC_NOC, .nodes = a2noc_nodes, .num_nodes = ARRAY_SIZE(a2noc_nodes), - .clocks = bus_a2noc_clocks, - .num_clocks = ARRAY_SIZE(bus_a2noc_clocks), + .bus_clocks = bus_a2noc_clocks, + .num_bus_clocks = ARRAY_SIZE(bus_a2noc_clocks), .regmap_cfg = &msm8996_a2noc_regmap_config }; @@ -2005,8 +2005,8 @@ static const struct qcom_icc_desc msm8996_mnoc = { .type = QCOM_ICC_NOC, .nodes = mnoc_nodes, .num_nodes = ARRAY_SIZE(mnoc_nodes), - .clocks = bus_mm_clocks, - .num_clocks = ARRAY_SIZE(bus_mm_clocks), + .bus_clocks = bus_mm_clocks, + .num_bus_clocks = ARRAY_SIZE(bus_mm_clocks), .regmap_cfg = &msm8996_mnoc_regmap_config }; diff --git a/drivers/interconnect/qcom/sdm660.c b/drivers/interconnect/qcom/sdm660.c index 8d879b0bcabc..a22ba821efbf 100644 --- a/drivers/interconnect/qcom/sdm660.c +++ b/drivers/interconnect/qcom/sdm660.c @@ -1516,8 +1516,8 @@ static const struct qcom_icc_desc sdm660_a2noc = { .type = QCOM_ICC_NOC, .nodes = sdm660_a2noc_nodes, .num_nodes = ARRAY_SIZE(sdm660_a2noc_nodes), - .clocks = bus_a2noc_clocks, - .num_clocks = ARRAY_SIZE(bus_a2noc_clocks), + .bus_clocks = bus_a2noc_clocks, + .num_bus_clocks = ARRAY_SIZE(bus_a2noc_clocks), .regmap_cfg = &sdm660_a2noc_regmap_config, }; @@ -1659,8 +1659,8 @@ static const struct qcom_icc_desc sdm660_mnoc = { .type = QCOM_ICC_NOC, .nodes = sdm660_mnoc_nodes, .num_nodes = ARRAY_SIZE(sdm660_mnoc_nodes), - .clocks = bus_mm_clocks, - .num_clocks = ARRAY_SIZE(bus_mm_clocks), + .bus_clocks = bus_mm_clocks, + .num_bus_clocks = ARRAY_SIZE(bus_mm_clocks), .regmap_cfg = &sdm660_mnoc_regmap_config, }; From patchwork Tue Feb 28 13:44:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 657920 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 65B0EC7EE33 for ; Tue, 28 Feb 2023 13:44:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229620AbjB1Nou (ORCPT ); Tue, 28 Feb 2023 08:44:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229661AbjB1Nom (ORCPT ); Tue, 28 Feb 2023 08:44:42 -0500 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D03C2CFD5 for ; Tue, 28 Feb 2023 05:44:32 -0800 (PST) Received: by mail-lf1-x131.google.com with SMTP id bi9so13279156lfb.2 for ; Tue, 28 Feb 2023 05:44:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677591870; 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=pd9x+d7515sKxUNxCoW/Rv03ypHAqgqe3FjxGAthHkQ=; b=xmyiSwoB6ksw76lPWURTXa1OtcQ8deSc8qxFSCEF9jwdGGulPCdimgisoZGjo4kmP3 1SH1w1Vm1qGWSGwbmQ8iCQep48NwTpNQw0DWA2rAL9EcBvoM81hlXyM08rD1LHwLGMen F3Tdiu/GrNShQU/fICjKpEfZSv7+LK1ScriUGYAeujsJ++IcikkW7PYYmnKMgx8N3NPh KOPKXDF/3VMHUkgMYIH/L1uVWbeU3bH1RHBOFS8dgNTj/0PZVnioFCs5oGJ/yKxJAXm3 iOVX3uT+yosNI/s37hTjkvywAoubm5WiFOECBA7XYbjibGos+DmAeaNh+kYc5y5q1aKP P7iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677591870; 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=pd9x+d7515sKxUNxCoW/Rv03ypHAqgqe3FjxGAthHkQ=; b=zUSWbJPQyYyui0Sj6mX1Lq1MXcVy+KdIUGPfCUI+QCoDr/Brl0pJ3B9uk0lC2oU+uB 6QmYzEALNGuMvXnL0n8NlQ2inyG876VCMkRYA+i7i4OcWlRVOYHGvnzQ0pPDRt1+7/LP rXZOAbr1p4ZtSsep3dQ2kncWX5SMunE4TcIxPon1s6vhkCZm4mGZjkSXlMu4mynjdAjN qlO4k9kpWoR/fMy3a4ew7z1DVKp1KqyVw+xiwKFHl2jJb3Ep3hr9Gtwv9J34S54z9tvl yTpNLlkg/Qib7FrBbtLkCYBPuI+yUUzChIIltXuYbhD7Y5YhkfiabvifYZi1jxZ8xLg0 yBFg== X-Gm-Message-State: AO0yUKVN+Of7PANdT2dWT7ctoltpB9lKpmLW3zE/1QYZd6rwFnD1nGMf csIBGhUH6oRKVEMdOzEcTlpnlw== X-Google-Smtp-Source: AK7set/jiIvRGelGf9ZhVzkFhcmmf0fs+TUEGSTAhJQkhN2w2udFHyHQ4k0pct4UBKWpo9oFgYrO+w== X-Received: by 2002:ac2:5451:0:b0:4de:3f1e:cdc4 with SMTP id d17-20020ac25451000000b004de3f1ecdc4mr585207lfn.13.1677591870562; Tue, 28 Feb 2023 05:44:30 -0800 (PST) Received: from [192.168.1.101] (abym99.neoplus.adsl.tpnet.pl. [83.9.32.99]) by smtp.gmail.com with ESMTPSA id j20-20020a2e3c14000000b00295a583a20bsm1203975lja.74.2023.02.28.05.44.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 05:44:30 -0800 (PST) From: Konrad Dybcio Date: Tue, 28 Feb 2023 14:44:04 +0100 Subject: [PATCH v6 7/9] interconnect: qcom: icc-rpm: Enforce 2 or 0 bus clocks MIME-Version: 1.0 Message-Id: <20230228-topic-qos-v6-7-3c37a349656f@linaro.org> References: <20230228-topic-qos-v6-0-3c37a349656f@linaro.org> In-Reply-To: <20230228-topic-qos-v6-0-3c37a349656f@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=1677591861; l=3956; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=j9XF4WxaLfGj9Ej6rkDHnjJlz9ADRRyGeXxkSRrXYCQ=; b=M35JcJbA4z7xVPt78oyUt8q1B96IPmZiN7M3R/pvpsHCHr4+uzvAmsdDhA2yk+jvIkg71yk3//ph jUAuZfHqABAngnnLpshAN45cGAeUqMNWoq/wICZzASvAitTUv4fD 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 446f6df9bc98..48eb4394b84e 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 Tue Feb 28 13:44:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 657919 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 6BE6DC7EE37 for ; Tue, 28 Feb 2023 13:44:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229675AbjB1Now (ORCPT ); Tue, 28 Feb 2023 08:44:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229671AbjB1Nop (ORCPT ); Tue, 28 Feb 2023 08:44:45 -0500 Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 553022ED41 for ; Tue, 28 Feb 2023 05:44:33 -0800 (PST) Received: by mail-lj1-x22e.google.com with SMTP id z42so10241964ljq.13 for ; Tue, 28 Feb 2023 05:44:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1677591871; 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=uIPKe9kvABQ+Ey2gP511WJDAmlrhCcezY7A3+lbIVq4=; b=mmnuvUb7ShBT7sGOwNvaIXYzsFxwbz68OC33QDMbahsMtSJGVkhyiUUsbDgagUsJKz BMD1L4VstyjnjnSfRdFKdT8kQJYhS9cX8QhIj0tLgNM7o+1f4ax8eVQYf2TWfUvYxd+L QZG7etTt1Kwz16Yzi5Z4I8NvqgsjJqV552a08gCQNa+EYkuuzMuFM4jScmbzuNJwPzJ4 lANXLfOH/LNuTBoL2+b5btLZrbo46ZM0+oVeiUYpSFbyRYQ5VhhP807mATciJSGKoN7x IoyizFp4FEmS61QfGVovQ5NJ/zVg7Dxk8aYaFp9fhKNWOdXvyP3oCvupea8aepDBcRQd eb7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677591871; 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=uIPKe9kvABQ+Ey2gP511WJDAmlrhCcezY7A3+lbIVq4=; b=Q9ZvBDIl9FnGe8f+aEhqxG7w735QGEf6bLD5BmGGMv/Dz581D5cyV8ocHCDeKBkQ5p 4syDoSSIipeYI0qMOA+bOtfcOuprYEWpxTTZIVWcg/aKo2xZ1lJVFr98X5KT1K4GeHEN IQfB7mr9IBdDCfZro57kgbrk9Y3i7cb26QL4RQxhOGP7/EFv/sdKymQrISTjxiLqBM+T lcFg4zdcExOQak3i4PJg4Lrf9qRt+o3UnR7S80kZJo3l+quPFM9C4vrc4b2KkvxWA88r X0QSKXXWP9iliw2BIWeuInxy4Eo2KIlsShNQpGx+NjVMCre90M9bnv0XHT4Rq/h2ED54 Oi/A== X-Gm-Message-State: AO0yUKVQMcCqokXFlE0C/gQ0zL5IRjCwWWX3Emw82x+N2qRfnnUn8jF6 VP90n2VkfKg6gce3d3qjTBoV2w== X-Google-Smtp-Source: AK7set+BvqiV7jllMe4KwbyP9oV2coNbPAYhufCWbM6e3cX6HVZMHJRfvFevs4ulS22fNmlk9H8akw== X-Received: by 2002:a2e:978e:0:b0:293:480c:884 with SMTP id y14-20020a2e978e000000b00293480c0884mr988418lji.37.1677591871659; Tue, 28 Feb 2023 05:44:31 -0800 (PST) Received: from [192.168.1.101] (abym99.neoplus.adsl.tpnet.pl. [83.9.32.99]) by smtp.gmail.com with ESMTPSA id j20-20020a2e3c14000000b00295a583a20bsm1203975lja.74.2023.02.28.05.44.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Feb 2023 05:44:31 -0800 (PST) From: Konrad Dybcio Date: Tue, 28 Feb 2023 14:44:05 +0100 Subject: [PATCH v6 8/9] interconnect: qcom: rpm: Don't use clk_get_optional for bus clocks anymore MIME-Version: 1.0 Message-Id: <20230228-topic-qos-v6-8-3c37a349656f@linaro.org> References: <20230228-topic-qos-v6-0-3c37a349656f@linaro.org> In-Reply-To: <20230228-topic-qos-v6-0-3c37a349656f@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=1677591861; l=1105; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=Trwtp2UuhUI4fi7Cq6Zwq0fwVJM3gAyEwBU7IiWKQN0=; b=vT4iRKkPmPZTOxukV1H7aZoMisskXyxQ5Umd/5Gwko7beejzqOY3tg7ko07CqrbGLPx9NUWWuRUr KC9l5pcJDKn5QubaimNr6SkAqeopFK3yme5C+lflb0Yg3GjT1tc4 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 48eb4394b84e..77346a2ab82b 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;