From patchwork Tue May 30 10:20:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 100748 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2087400vqr; Tue, 30 May 2023 03:52:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5hcU30Kit1IceNFZFBvMdDkIEgOueY3/vkp/J/q30rAk9Vn/5ti3eC3J+n2W1lpEEsyYuf X-Received: by 2002:a17:90a:55c1:b0:252:27d9:7ef0 with SMTP id o1-20020a17090a55c100b0025227d97ef0mr1861939pjm.27.1685443959699; Tue, 30 May 2023 03:52:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685443959; cv=none; d=google.com; s=arc-20160816; b=KQkHcQGHtfSihMVs51h8ukKZZMwK5M7tMxdmWIWvnM74+Oj6h88AJMiKAMir1ewlkZ R4FECZNLh/qwAv6cW8prxQyFrK2gI7JUmRrYPBq34CtfB0t4HpUVF5AH+g2IVnLjnMOr cD6JdpZ/o3AwN9JycPk+GZFqOnnTMp4d1Qj8uo25SVBZoeE2YN9nNRWSeKqXOY6Jx7sr zP3YMc9pDIzAYGVjNjpucBSLn1pSXS3p8AbV5ER1RyUjXlcf77b0gKA52/xWY+ZktWor jHiSt1SU4MAhiPet2U7Cb5GS79g0q4DzYIWMfXQVv5AA8T7Xwzdh0JeQArKzu7y6P30R jiPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=QjqIG4URIoua+lHLQfg11PY6ELEnwMa1moxb2TKDOn4=; b=v0/xWaBsCuN8KajJHEOHmMKXUPX/IiZQr3C0cYy/TFsFzxzhDenUeSoJGqdsHQO2gp 4ncBjgsunmXPtf6z4QL0ucdWbHCIbA2vYqAq1PihavfbBSDO/0auOUkyRREUFAy26jf/ 1AJCKm1PkY3cj4kyx0QstOdPw4sqrCsCa1/0qCIedDRi7fQ/SkUSclmlbNJ3aXZGKIrF 0mMqQH4GM835Ry5XwN61hPR7uQLO7bqoJXYaqssNoPyWQStC9zH9mY+liR+a3vm2Iv8A jfzDnyfEdvYaDu0ZfTuHj7YyBWOhKjeoVr8hOoBugYK9EROamErX8zXNdDxV/b/mGfb2 GpsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SVLmXkEI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v17-20020a63b951000000b0053f527e381csi7452129pgo.609.2023.05.30.03.52.25; Tue, 30 May 2023 03:52:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SVLmXkEI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231578AbjE3KW1 (ORCPT + 99 others); Tue, 30 May 2023 06:22:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231362AbjE3KVY (ORCPT ); Tue, 30 May 2023 06:21:24 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98ECCE65 for ; Tue, 30 May 2023 03:20:29 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-4f4c264f6c6so4838895e87.3 for ; Tue, 30 May 2023 03:20:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1685442027; x=1688034027; 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=QjqIG4URIoua+lHLQfg11PY6ELEnwMa1moxb2TKDOn4=; b=SVLmXkEIhAzbbxnFrfcvBdoNri6Czv4hbdGCXaZDze+EzoDfp+6K4+XB/XfVXr+qma KhC+3f+kxEBlaKe+jNVTakeGgWwfcmp2inWBE5P3+PaGV0bfkkmJTUQmbBV3eSWwSswy JR9CUR+ffpS/tQbdRHfSrhklBjz0d113vkMAkRNgJNmO934qD+lmCZ9nZbs+av0hXblP 6/oHzjSCY9gKZG75bHPDTFfL0iuJmznjszDMXxseMm7/xiU5WsRu394IZmeQAWRPtlmh uNhf5O+dorlMtBi9NWstMPzVPpnyk2tGmSK6OJLTjJNSeMfMREZI1OB9/12QdGvOb0OL gd5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685442027; x=1688034027; 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=QjqIG4URIoua+lHLQfg11PY6ELEnwMa1moxb2TKDOn4=; b=NmwStWBZWAwUZ2cLsqSzfkSu8MrdiYJcIfxFAdFWgFibijRA6M+zOX2owDbJMigd1c PAU1/a/qOXFtMOg/naqyBf7r23Rx1XAKHHOUBZmOwS2Em32h8gs6AQQa1uDxxzALszph n8RDF/Hu20uOV1xKaiDXAZFRXMncayrUHJ+6P6ujUjvAe1STgJGbm/eNznnMgZ1qHusu Ejt3azDK0WZTG95HIwU9rwT7I8Y6qHBTga/JFM04tVgEq/ywE2+m+0pPqzKzTNTtSPmy mnhux09Cy4Z2Il7dv9H6AFJCLqsgZr5SSPRXO93AjERO3ylmstZP7tj0pf2jYwXsSl7O GqSg== X-Gm-Message-State: AC+VfDzirRgKMdzikdWFL1+hWIVy7Iffg1zucd/tPYFv5c6rdbesJYOz 94a5eBunuGtgW0z4vYLqmdg8YA== X-Received: by 2002:a05:6512:11c6:b0:4dd:9ddc:4463 with SMTP id h6-20020a05651211c600b004dd9ddc4463mr464627lfr.5.1685442027590; Tue, 30 May 2023 03:20:27 -0700 (PDT) Received: from [192.168.1.101] (abyj77.neoplus.adsl.tpnet.pl. [83.9.29.77]) by smtp.gmail.com with ESMTPSA id c25-20020ac24159000000b004cc8196a308sm290902lfi.98.2023.05.30.03.20.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 May 2023 03:20:27 -0700 (PDT) From: Konrad Dybcio Date: Tue, 30 May 2023 12:20:17 +0200 Subject: [PATCH 18/20] interconnect: qcom: icc-rpm: Fix bucket number MIME-Version: 1.0 Message-Id: <20230526-topic-smd_icc-v1-18-1bf8e6663c4e@linaro.org> References: <20230526-topic-smd_icc-v1-0-1bf8e6663c4e@linaro.org> In-Reply-To: <20230526-topic-smd_icc-v1-0-1bf8e6663c4e@linaro.org> To: Andy Gross , Bjorn Andersson , Michael Turquette , Stephen Boyd , Georgi Djakov , Leo Yan , Evan Green Cc: Marijn Suijten , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-pm@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1685442001; l=2704; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=WF7ldM/Iz77YHgJ7F9fOqcoIKTA2NJmusrp1SsEdUMk=; b=jpkYdzXFWDoKVAz6AYnYdeSgan0HtBADUGl0JQy3WSI4gTlBsf42eR6LIDlTuIhwdOUjc1Dib V0akIqRTNZFBmAj8ZwpWux0ulUXBCBoU3tCV0eSyHE+Y7H6ENAf+5YH X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767316085436675087?= X-GMAIL-MSGID: =?utf-8?q?1767316085436675087?= SMD RPM only provides two buckets, one each for the active-only and active-sleep RPM contexts. Use the correct constant to allocate and operate on them. Fixes: dcbce7b0a79c ("interconnect: qcom: icc-rpm: Support multiple buckets") Signed-off-by: Konrad Dybcio Reviewed-by: Dmitry Baryshkov --- drivers/interconnect/qcom/icc-rpm.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c index d08eefd963f4..db84bf56bde3 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -249,7 +249,7 @@ static void qcom_icc_pre_bw_aggregate(struct icc_node *node) size_t i; qn = node->data; - for (i = 0; i < QCOM_ICC_NUM_BUCKETS; i++) { + for (i = 0; i < QCOM_SMD_RPM_STATE_NUM; i++) { qn->sum_avg[i] = 0; qn->max_peak[i] = 0; } @@ -275,7 +275,7 @@ static int qcom_icc_bw_aggregate(struct icc_node *node, u32 tag, u32 avg_bw, if (!tag) tag = QCOM_ICC_TAG_ALWAYS; - for (i = 0; i < QCOM_ICC_NUM_BUCKETS; i++) { + for (i = 0; i < QCOM_SMD_RPM_STATE_NUM; i++) { if (tag & BIT(i)) { qn->sum_avg[i] += avg_bw; qn->max_peak[i] = max_t(u32, qn->max_peak[i], peak_bw); @@ -300,11 +300,11 @@ 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]; + u64 sum_avg[QCOM_SMD_RPM_STATE_NUM]; int i; /* Initialise aggregate values */ - for (i = 0; i < QCOM_ICC_NUM_BUCKETS; i++) { + for (i = 0; i < QCOM_SMD_RPM_STATE_NUM; i++) { agg_avg[i] = 0; agg_peak[i] = 0; } @@ -317,7 +317,7 @@ 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++) { + for (i = 0; i < QCOM_SMD_RPM_STATE_NUM; i++) { if (qn->channels) sum_avg[i] = div_u64(qn->sum_avg[i], qn->channels); else @@ -328,7 +328,7 @@ static void qcom_icc_bus_aggregate(struct icc_provider *provider, } /* Find maximum values across all buckets */ - for (i = 0; i < QCOM_ICC_NUM_BUCKETS; i++) + for (i = 0; i < QCOM_SMD_RPM_STATE_NUM; i++) *max_agg_avg = max_t(u64, *max_agg_avg, agg_avg[i]); } @@ -339,7 +339,7 @@ static int qcom_icc_set(struct icc_node *src, struct icc_node *dst) struct icc_provider *provider; u64 sum_bw; u64 active_rate, sleep_rate; - u64 agg_avg[QCOM_ICC_NUM_BUCKETS], agg_peak[QCOM_ICC_NUM_BUCKETS]; + u64 agg_avg[QCOM_SMD_RPM_STATE_NUM], agg_peak[QCOM_SMD_RPM_STATE_NUM]; u64 max_agg_avg; int ret;