From patchwork Mon Nov 27 11:45:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 170103 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp3033581vqx; Mon, 27 Nov 2023 03:46:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IEpZ3eyEd62w7EVQaWYMeomfQ548iCuq+RQ318aGClpTO4LSm+RkLp1cOxE82tAAYBVa36/ X-Received: by 2002:a17:902:e88f:b0:1cf:6832:46c with SMTP id w15-20020a170902e88f00b001cf6832046cmr14303258plg.6.1701085570895; Mon, 27 Nov 2023 03:46:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701085570; cv=none; d=google.com; s=arc-20160816; b=sQnoR8x1xosJwl8jUEABmsPIhkq+tPd0iBkj/Z0i4hhKHK0ay9iyzIsj9Xj9+WkBbV xnPtfAQRQmh/Qitm7wHRagD9Hy6HNVXf+T9hL4+OtlFcR1tkIu8ObQp24UMgBaMcSGqe k3KDwCzF6SWh5b+KpFLwDKA92R5RUiadSvQknTQvvEovYkz++AF1Xn0JA4qFdF/eUPdj IFZ9dFigCRsWXLP25lwV4jGXoyBNLil2VmZFMiknsJbvhssclyvIAuyDA1mudiulPODg c9imIdjWKmviJeo/iRhWH8O2RFJfAQMKXtD8TZEfwBDakyEh0mDNAhS2p72sIXpQYkau YZGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=oRY0uPUXZl/1dufH8VvC12TzBKS1/wQwqXyd/VwE3Jo=; fh=YYEHUlcSQzkYfT+2Kthvhj23bmXe8oTYdKq+ddJMfdQ=; b=0kPaxwnFx0W6x6Hhlm/njAVnb1WMbxq7y4vkGehpiaDhK4y0fKWzCRlplZ301lF/Vy tjWOcIQxzYBluQ6fXEhRWhgTEGbFWbbu3XnyZd2Iv126wM0yFLtflm6SyYJmtWAL+kbn p1woHtrZgaXFK/+YuChZ3lmB9/lTH8VRjD0gauDY89BTIBItHmg7ytQio6M8+Ysr2kUO vI+IOhXBjWtbxay/1WrjGuEgboHH7S7oGUMCr30PT/o8AOo3+WyxfTwDz9Pol1FH2Owp VAgZSIPoFXDa6eyZJXXH9Z/noCPMzyHDYTXnUx0HYa2JflkcwXaVmikWFYMzB/eViqD/ 49kQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UeV3OYey; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id b11-20020a170902b60b00b001cfb5505bddsi4687040pls.564.2023.11.27.03.46.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 03:46:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UeV3OYey; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id CD9E38041C2B; Mon, 27 Nov 2023 03:46:03 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233309AbjK0Lpy (ORCPT + 99 others); Mon, 27 Nov 2023 06:45:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233304AbjK0Lpx (ORCPT ); Mon, 27 Nov 2023 06:45:53 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A8A1B8 for ; Mon, 27 Nov 2023 03:45:58 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22067C433C8; Mon, 27 Nov 2023 11:45:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701085558; bh=/SPiK+nM81I2NeYQHSsmaqOtUX9qlKShEsdKW1Xgo54=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UeV3OYeyFIr9Ll7fbpmmGpyz3uKF6e8h1RE9Ih3UtcFmzDu0xe7stOLB1kFa45cHP 7W8ETpegQt1J09gK3AsGsrDpQkD7B+S6Ay/ql3oI3xwDpgkq4ytSAZ097Hf2mPStFA O/r00GFVG3GFyOip9cnRuvAVkRI2s8sazdq8BN7xqAE4zcRQ6JGxm7rcG/MmyB+/B3 galFOVHPSFyvL5PB+8HKkS3gc9Knb59lyOum3+FCZRrTu30n97RVYwvMKZvLP9u2YR QTsrz80hpMJwNYudGnXE1aYUctgC4m7yEFwRhJN3wmx2sfTPMWnsuKTaLy0U+TKwwH 71Bmx6gOs7bNw== From: djakov@kernel.org To: linux@roeck-us.net, sam@gentoo.org, gregkh@linuxfoundation.org Cc: akpm@linux-foundation.org, allen.lkml@gmail.com, conor@kernel.org, f.fainelli@gmail.com, jonathanh@nvidia.com, linux-kernel@vger.kernel.org, lkft-triage@lists.linaro.org, patches@kernelci.org, patches@lists.linux.dev, pavel@denx.de, rwarsow@gmx.de, shuah@kernel.org, srw@sladewatkins.net, stable@vger.kernel.org, sudipm.mukherjee@gmail.com, torvalds@linux-foundation.org, djakov@kernel.org Subject: [PATCH 5.10] interconnect: qcom: Add support for mask-based BCMs Date: Mon, 27 Nov 2023 13:45:51 +0200 Message-Id: <20231127114551.1043891-1-djakov@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <05678c48-bac1-4f17-99f8-21b566c17a6e@roeck-us.net> References: <05678c48-bac1-4f17-99f8-21b566c17a6e@roeck-us.net> MIME-Version: 1.0 X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Mon, 27 Nov 2023 03:46:04 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783717503611970148 X-GMAIL-MSGID: 1783717503611970148 From: Georgi Djakov From: Mike Tipton [ Upstream commit d8630f050d3fd2079f8617dd6c00c6509109c755 ] Some BCMs aren't directly associated with the data path (i.e. ACV) and therefore don't communicate using BW. Instead, they are simply enabled/disabled with a simple bit mask. Add support for these. Origin commit retrieved from: https://git.codelinaro.org/clo/la/kernel/msm-5.15/-/commit/2d1573e0206998151b342e6b52a4c0f7234d7e36 Signed-off-by: Mike Tipton [narmstrong: removed copyright change from original commit] Signed-off-by: Neil Armstrong Reviewed-by: Konrad Dybcio Link: https://lore.kernel.org/r/20230619-topic-sm8550-upstream-interconnect-mask-vote-v2-1-709474b151cc@linaro.org Fixes: fafc114a468e ("interconnect: qcom: Add SM8450 interconnect provider driver") Fixes: 2d1f95ab9feb ("interconnect: qcom: Add SC7180 interconnect provider driver") Signed-off-by: Georgi Djakov --- There is a build error reported in the 5.10.201 stable tree (arm64 allmodconfig), which is caused by a patch that has a dependency we missed to backport. This is the missing patch that we need to get into 5.10.202 to fix the build failure. Thanks to Guenter and Sam for reporting that! drivers/interconnect/qcom/bcm-voter.c | 5 +++++ drivers/interconnect/qcom/icc-rpmh.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/drivers/interconnect/qcom/bcm-voter.c b/drivers/interconnect/qcom/bcm-voter.c index 3c0809095a31..320e418cf753 100644 --- a/drivers/interconnect/qcom/bcm-voter.c +++ b/drivers/interconnect/qcom/bcm-voter.c @@ -90,6 +90,11 @@ static void bcm_aggregate(struct qcom_icc_bcm *bcm) temp = agg_peak[bucket] * bcm->vote_scale; bcm->vote_y[bucket] = bcm_div(temp, bcm->aux_data.unit); + + if (bcm->enable_mask && (bcm->vote_x[bucket] || bcm->vote_y[bucket])) { + bcm->vote_x[bucket] = 0; + bcm->vote_y[bucket] = bcm->enable_mask; + } } if (bcm->keepalive && bcm->vote_x[QCOM_ICC_BUCKET_AMC] == 0 && diff --git a/drivers/interconnect/qcom/icc-rpmh.h b/drivers/interconnect/qcom/icc-rpmh.h index e5f61ab989e7..029a350c2884 100644 --- a/drivers/interconnect/qcom/icc-rpmh.h +++ b/drivers/interconnect/qcom/icc-rpmh.h @@ -81,6 +81,7 @@ struct qcom_icc_node { * @vote_x: aggregated threshold values, represents sum_bw when @type is bw bcm * @vote_y: aggregated threshold values, represents peak_bw when @type is bw bcm * @vote_scale: scaling factor for vote_x and vote_y + * @enable_mask: optional mask to send as vote instead of vote_x/vote_y * @dirty: flag used to indicate whether the bcm needs to be committed * @keepalive: flag used to indicate whether a keepalive is required * @aux_data: auxiliary data used when calculating threshold values and @@ -97,6 +98,7 @@ struct qcom_icc_bcm { u64 vote_x[QCOM_ICC_NUM_BUCKETS]; u64 vote_y[QCOM_ICC_NUM_BUCKETS]; u64 vote_scale; + u32 enable_mask; bool dirty; bool keepalive; struct bcm_db aux_data;