From patchwork Tue Feb 27 17:34:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sibi Sankar X-Patchwork-Id: 207370 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2875244dyb; Tue, 27 Feb 2024 10:11:57 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUlLWl9bsgtvbG2I3SJtu3vt761mr8NL2LoFUwiSykq6Y/8MxCmM5P502G9GaT5+x+qV+UGpjB46+87/heU+sxR4QHJUw== X-Google-Smtp-Source: AGHT+IG3PAwMKRehn0dWdLZLpamqY2MwMrrM3ah6PECMn8sVyiqgu7W27XpSwjbCXobRxZknRNRB X-Received: by 2002:a05:6a21:3986:b0:1a0:f5e6:111e with SMTP id ad6-20020a056a21398600b001a0f5e6111emr123322pzc.27.1709057517492; Tue, 27 Feb 2024 10:11:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709057517; cv=pass; d=google.com; s=arc-20160816; b=TIhzNAhPkHtAanYnuEDjnigoyf4Dbv0Knyxx2Gbb8JMPZLEh5r7PbiEce0hvk4vod0 6g/LZEO85pHV8EWMM7bB0wHEsoCdgTM0Yvlvn2eA0wvlnUnnX2PAgXP5MvBC2OFz/Ygy 2zjfXy3F4Ma/6pMAlK5xRzDM6XjaiiA5sJPO7dRKjoNc+tonYuJMmzUEoJyOmHKKNAkE TDBJx3IyHc9hUVrJ0GIWt9jRVEhWTLex6bJ6goYxyGQe9NjRXroWyexiT6tDlqI6hl1R B+VF2ThrUFqLTplhXHVLFW6wqZaQgMl56GOfcFJHPmKgPQEK0mimWWy4pomPKxnDAq3K lr2g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=3DVviJxlVwNwJ3tgr3xc9D3SdLGkFfeDO3OWztz/lP0=; fh=JXeAHL/pEiwIRpJuFmm5HWdAyyckOo6ArR8j/crYxoY=; b=klJ1zWEEqE4nrhZPj1zLhAVojg6vWV/I3JifSSrGV+rN5PTM+VW6USJT3US058b9OI CHcCkSkbb8yZVepDnSnEvS/M6uspkfsKS4KV/afzHI4YOuPKXTrwOH0iJ3hKzo0v2USE eI8C9xuK0EbnOhy/SLTisJq5bOtbwEFCv9CooXcllgqfvLLZTcGwEbnjTgkhEkUYJDkS KMbS9n3+wsqMUzap4rWnN2/Ph6CKF51cduRR5AHu7+4PU4sSABNkNtqblvJYCHSzrNwu CsQ5MDOhlQk1gzGvJIhngZpY48CNe7tDDv97OGBFJ5rl06UlFRWKE7cy4qVbM8DQ4G2O DZ5Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b="MhnvY/Iw"; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-83739-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83739-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id h22-20020a633856000000b005dc0b3095b3si5667487pgn.283.2024.02.27.10.11.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 10:11:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-83739-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b="MhnvY/Iw"; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-83739-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-83739-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id DA3CBB33D73 for ; Tue, 27 Feb 2024 17:37:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B406614AD28; Tue, 27 Feb 2024 17:35:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="MhnvY/Iw" Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A6DD5149DF2; Tue, 27 Feb 2024 17:35:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709055324; cv=none; b=ArYT5oi+LHbTMyFVyH2WSUsPU76Wx4woLWhd9cjUmF7/zdrWSt6HutgTDdrvIuyf6ImgPjGkktrjGY5Qdu45Ajfzq1clt4IbYLqhnLh6u5nJemWBJUfO198OZUZkScUr9Mcc1TgLUImaSq2h4drDI7dW2fktqA9Yxawo62IP1S8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709055324; c=relaxed/simple; bh=Z5k2hix+Fr7+hFF9XlR19tkcXSwIfZLoKyOcbeHHkBE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=f+k6u/Bcz7u9AFtndU1FDJq7P0HYFTF0Laf85X39v93cQSXGVkobsMw3UVagFAygBCR0hLdYBYK2+MNPTgMlqwCwN634t3QlC8ChVyYMjLmTSUatTD7bnFnAtSQZpWFsKTRO9eSem0x2dF6yyfDC8fUTCG3GTKj7ixKESmLtMto= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=MhnvY/Iw; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41R9YUO1007412; Tue, 27 Feb 2024 17:35:13 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=3DVviJxlVwNwJ3tgr3xc9D3SdLGkFfeDO3OWztz/lP0=; b=Mh nvY/Iw1tO+NOxDIQYGcO+52fRBjG8UGGCk+Dv8XTgqvDGwt0VUcXcMKvLWVu8v17 oFawAwPNgZhpLlsP7srAagog3NF+/KLqS1IzWp5kWR9GMOvQiXd5Ykv8fIh6xyD9 Nn13axSbm5R+Uw8oY3xU0LDmR9xCWbgsCyYf8yU18S55QPzyW4mBND92XsgUf4jq 7uidfan8d24LDYFVtTkTcLmg58+XzkBmIUuDNl8rTCV4JVcqql3uCSviLULswgrw nPlm44rL7btjL3/z/FwpCRn4Ng7Ih7+h20P5ehBlrbF9S9DeDBuNyyCcjt9LZ3zj or7FyS5fhK97rhHEyr2A== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3wh8auhtj7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Feb 2024 17:35:12 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 41RHZC95029837 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 27 Feb 2024 17:35:12 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; Tue, 27 Feb 2024 09:35:07 -0800 From: Sibi Sankar To: , , , , , , , CC: , , , , , , Sibi Sankar Subject: [PATCH V2 2/3] firmware: arm_scmi: Add support for marking certain frequencies as boost Date: Tue, 27 Feb 2024 23:04:33 +0530 Message-ID: <20240227173434.650334-3-quic_sibis@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240227173434.650334-1-quic_sibis@quicinc.com> References: <20240227173434.650334-1-quic_sibis@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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-ORIG-GUID: 9dE-JkPRBvVKzooJpGHXh_vlnrL04KbW X-Proofpoint-GUID: 9dE-JkPRBvVKzooJpGHXh_vlnrL04KbW 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-02-27_03,2024-02-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 bulkscore=0 suspectscore=0 phishscore=0 malwarescore=0 mlxscore=0 lowpriorityscore=0 adultscore=0 mlxlogscore=999 clxscore=1015 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2402270135 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792076695155330959 X-GMAIL-MSGID: 1792076695155330959 All opps above the sustained level/frequency are treated as boost, so mark them accordingly. Suggested-by: Sudeep Holla Signed-off-by: Sibi Sankar --- v2: * Remove sustained_freq check. [Pierre] * simplify sustained_freq_khz calculation. [Sudeep] 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 981e327e63e3..caf6191df300 100644 --- a/drivers/firmware/arm_scmi/perf.c +++ b/drivers/firmware/arm_scmi/perf.c @@ -850,7 +850,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; @@ -858,12 +858,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;