From patchwork Fri Mar 8 10:44:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sibi Sankar X-Patchwork-Id: 13586657 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7B313C54E4A for ; Fri, 8 Mar 2024 10:44:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=H+OJ+M7yfI3KCR3WIFhtVyGWUMhm3vtpJVwnP3tMaA4=; b=jGB6f9HYO5bDNa r1BzEYCZsS3iqIOqaIYdXea8yb8Xu35B+E2azIJLQMsRhfuLg0gXeBJyTx9RLpZgrMVR5F4uQmkxu eFa05ebDvk3suQ3Fyd3Xfrjmi+dPxBXjlYDf2HajLb6SvbVU5UtoGQZg1NU5z/GO8a0h5KP8h+cM4 FwTfmixvO7qEQsI2jgJhHwIxtOGqc/FExGY74YZEOBrU6ZDKLf9GtH1eDSbL+NbpLB/4WQWw1OA0e ixoTTXkkepcwxJSzKtisuf3CIQPv3VZdRUzvJBpx021ZwwBW4x+qlkfbmNHaLopbJ8dPI7Qx0+rhe H2viBgwlC/6/K/FIbVhw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1riXiW-00000008pVd-3B26; Fri, 08 Mar 2024 10:44:44 +0000 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1riXiS-00000008pTB-1gno for linux-arm-kernel@lists.infradead.org; Fri, 08 Mar 2024 10:44:41 +0000 Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 4289GHoH005419; Fri, 8 Mar 2024 10:44:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= qcppdkim1; bh=d344LokFw21DJ9Lbpn/kI0fNPTZBlloPOPgr9EjnZR0=; b=Yx CGjH+iGEWyxtSHNsqC5tO978sChNgfTYifJRitUHIQkEUPIOmQDNhKm8zZp/UIqO 9/r+Xn/hgDDklqIixriV8+1U9OJ/RGWV4T+8otbeX6wSehUi5+LGLGS+Lrq1PeqY 1f15xwQeTNslsfgRX3mt10sxvsu5IndaIUyOtujZsvJOpm94tdmeCWok8vYW+TH5 Kof5WTZVnndxNBmBZyxzLfhnsQUirCtUJqrF8sf5tDR76FR04zARmenwXMwzxShe 8C8yoIP/vmEEmRtp0MrRKXLWfXj5l1UwSIPhtrV/fZQr1TojMYZtvYHqUGjQYTEO HYn4wXzxnv+EC4wZbcBA== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3wqn8m1gqy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 08 Mar 2024 10:44:34 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 428AiXCi016061 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 8 Mar 2024 10:44:33 GMT Received: from hu-sibis-blr.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Fri, 8 Mar 2024 02:44:29 -0800 From: Sibi Sankar To: , , , , , , , CC: , , , , , , Sibi Sankar Subject: [PATCH V3 1/2] firmware: arm_scmi: Add support for marking certain frequencies as boost Date: Fri, 8 Mar 2024 16:14:09 +0530 Message-ID: <20240308104410.385631-2-quic_sibis@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240308104410.385631-1-quic_sibis@quicinc.com> References: <20240308104410.385631-1-quic_sibis@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: NGfTKoolwkDAB1FLJfho2DJcLiAlbU7x X-Proofpoint-ORIG-GUID: NGfTKoolwkDAB1FLJfho2DJcLiAlbU7x X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-08_08,2024-03-06_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 clxscore=1015 malwarescore=0 lowpriorityscore=0 phishscore=0 spamscore=0 priorityscore=1501 mlxscore=0 mlxlogscore=999 impostorscore=0 bulkscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2403080085 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240308_024440_486328_390FD699 X-CRM114-Status: GOOD ( 13.65 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org All opps above the sustained level/frequency are treated as boost, so mark them accordingly. Suggested-by: Sudeep Holla Signed-off-by: Sibi Sankar Reviewed-by: Sudeep Holla --- drivers/firmware/arm_scmi/perf.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c index 8e832d1ad825..64d9a90bf443 100644 --- a/drivers/firmware/arm_scmi/perf.c +++ b/drivers/firmware/arm_scmi/perf.c @@ -857,7 +857,7 @@ static int scmi_dvfs_device_opps_add(const struct scmi_protocol_handle *ph, struct device *dev, u32 domain) { int idx, ret; - unsigned long freq; + unsigned long freq, sustained_freq; struct dev_pm_opp_data data = {}; struct perf_dom_info *dom; @@ -865,12 +865,18 @@ static int scmi_dvfs_device_opps_add(const struct scmi_protocol_handle *ph, if (IS_ERR(dom)) return PTR_ERR(dom); + sustained_freq = dom->sustained_freq_khz * 1000UL; + for (idx = 0; idx < dom->opp_count; idx++) { if (!dom->level_indexing_mode) freq = dom->opp[idx].perf * dom->mult_factor; else freq = dom->opp[idx].indicative_freq * dom->mult_factor; + /* All opps above the sustained level/frequency are treated as boost */ + if (freq > sustained_freq) + data.turbo = true; + data.level = dom->opp[idx].perf; data.freq = freq; From patchwork Fri Mar 8 10:44:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sibi Sankar X-Patchwork-Id: 13586658 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E155AC5475B for ; Fri, 8 Mar 2024 10:44:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=iL17hw3Fn4IF64pQQL+Dt0r6Avg1ghMZslgwr3G+cho=; b=gl5GP0Q2NSKmov yBzHAdvymylj0ibmeGEPWqCyiPxfCTTPH9bltSQuj070bln2LM+p3F34NghYEejQXyLNps0Zu03HF JUDnU9sOceuo8Y2PNt+lpM4ZgxApt1SyRsycSNeTJA+9ytIx3dsbkVSf7HjVCuLtMANNFTV0Dk/bk +ij1WBXAGDySibRrA6FwWpImQM8lircvmjkV9x4WS67zvfqqInHWpFxHzL4XCb1/9dfBFxnWpSqCi lqvXUkJDdkSBc/v1ZT0X1ma/2Sxe/jhCUcJLKBbeQsBwA/epWb+IKzS/43UG8Jqkw5ZyRJzKTRjXt P2knSDe5hOoUXQJcSB9A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1riXiZ-00000008pX4-2YWb; Fri, 08 Mar 2024 10:44:47 +0000 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1riXiW-00000008pVH-25LS for linux-arm-kernel@lists.infradead.org; Fri, 08 Mar 2024 10:44:46 +0000 Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 428A5jtr027172; Fri, 8 Mar 2024 10:44:39 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= qcppdkim1; bh=XbzGmI/H+M7jrcCmm5O2fs2KrZylOonYBZ9JNoiny3s=; b=DG V2WEJxsPWMNs5aCf53D6RIlCFveXMD2Me/1Dg5bi6YeBZjNNpVL3zcaIpE3r6yZv 1QH1hem0bZS3RcNIoc0KLMlmy5loesI8Sd++DxDQ4TTFk67ncl5oznCUIS93dS8k AQcsDbyYXock4ECmKY/m9Qb/np/j8aCf2eNYdkjf4vZ81wBtCU5AgPwjVRK4adGT GbeEeN01mCRo9dv4+LwHzoVEo2WFLH7tqmL1TpPJ9I1Fpztffj9yNP6fsQeCmgz6 UvQUibRDiKTsZL3zi4kQSMCePW+uV7YPcYUHlyp/EWvOOyO47Ru75CW9GZTjmVG5 gqIfnotd6Jna7JFRhycw== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3wqyfsr79r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 08 Mar 2024 10:44:39 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 428AicmT016118 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 8 Mar 2024 10:44:38 GMT Received: from hu-sibis-blr.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Fri, 8 Mar 2024 02:44:33 -0800 From: Sibi Sankar To: , , , , , , , CC: , , , , , , Sibi Sankar Subject: [PATCH V3 2/2] cpufreq: scmi: Enable boost support Date: Fri, 8 Mar 2024 16:14:10 +0530 Message-ID: <20240308104410.385631-3-quic_sibis@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240308104410.385631-1-quic_sibis@quicinc.com> References: <20240308104410.385631-1-quic_sibis@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: z5IqSlU8GBXzu3i9Asa1x7JbYnmalQTy X-Proofpoint-ORIG-GUID: z5IqSlU8GBXzu3i9Asa1x7JbYnmalQTy X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-08_08,2024-03-06_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 spamscore=0 malwarescore=0 mlxscore=0 lowpriorityscore=0 mlxlogscore=999 priorityscore=1501 suspectscore=0 bulkscore=0 adultscore=0 clxscore=1015 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2403080085 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240308_024444_586288_4C029D99 X-CRM114-Status: GOOD ( 15.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The X1E80100 SoC hosts a number of cpu boost frequencies, so let's enable boost support if the freq_table has any opps marked as turbo in it. Signed-off-by: Sibi Sankar Reviewed-by: --- v3: * Don't set per-policy boost flags from the cpufreq driver. [Viresh] drivers/cpufreq/scmi-cpufreq.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c index 0b483bd0d3ca..3b4f6bfb2f4c 100644 --- a/drivers/cpufreq/scmi-cpufreq.c +++ b/drivers/cpufreq/scmi-cpufreq.c @@ -30,6 +30,7 @@ struct scmi_data { static struct scmi_protocol_handle *ph; static const struct scmi_perf_proto_ops *perf_ops; +static struct cpufreq_driver scmi_cpufreq_driver; static unsigned int scmi_cpufreq_get_rate(unsigned int cpu) { @@ -167,6 +168,12 @@ scmi_get_rate_limit(u32 domain, bool has_fast_switch) return rate_limit; } +static struct freq_attr *scmi_cpufreq_hw_attr[] = { + &cpufreq_freq_attr_scaling_available_freqs, + NULL, + NULL, +}; + static int scmi_cpufreq_init(struct cpufreq_policy *policy) { int ret, nr_opp, domain; @@ -276,6 +283,17 @@ static int scmi_cpufreq_init(struct cpufreq_policy *policy) policy->transition_delay_us = scmi_get_rate_limit(domain, policy->fast_switch_possible); + if (policy_has_boost_freq(policy)) { + ret = cpufreq_enable_boost_support(); + if (ret) { + dev_warn(cpu_dev, "failed to enable boost: %d\n", ret); + goto out_free_opp; + } else { + scmi_cpufreq_hw_attr[1] = &cpufreq_freq_attr_scaling_boost_freqs; + scmi_cpufreq_driver.boost_enabled = true; + } + } + return 0; out_free_opp: @@ -334,7 +352,7 @@ static struct cpufreq_driver scmi_cpufreq_driver = { CPUFREQ_NEED_INITIAL_FREQ_CHECK | CPUFREQ_IS_COOLING_DEV, .verify = cpufreq_generic_frequency_table_verify, - .attr = cpufreq_generic_attr, + .attr = scmi_cpufreq_hw_attr, .target_index = scmi_cpufreq_set_target, .fast_switch = scmi_cpufreq_fast_switch, .get = scmi_cpufreq_get_rate,