Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp812773rdd; Tue, 9 Jan 2024 23:29:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IHAJFQhCHW/+4NPMukvPXQKSek8NQ0DsW/mlvmOieiNc+R0L6nuCZcspwSUXOQw7jfKCfK+ X-Received: by 2002:a17:906:6812:b0:a28:4bf8:a16f with SMTP id k18-20020a170906681200b00a284bf8a16fmr317743ejr.136.1704871760706; Tue, 09 Jan 2024 23:29:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704871760; cv=none; d=google.com; s=arc-20160816; b=zDvowl/YHcOcpBnkxhI0eOF8qHSIztctTfAD1Ynnv879RrRbRTSeDPx9OOMToCinOu z/44L9RNrCtXbXJIEY8azJaP53XmTbpofpsET5b4pgQ2m8cU4w18jMjIM06ofp3Mv/rB QOqNrTXL2UmQ/C1/by2HQ1ve1TBOT8WXSRLkMTeNTFFbdic9ScRFVNaeraS4uHsP/p/P uvwxL6cT4/auD67EJ6SjiQCbT/vj3nkGmMgTkc69BDzLwqqeShbtC7mXRSSZ5JImjJWd Fjd4QQjl9YTjoW89y0k9Tz5lx20KtTpaJ2Pa4CJX1MZwgefgyqRV+BW1wsgQro0QGhWl zdjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Wo2ow3R5rRd9qIwMEMsgAnkS6j0WPS9tTieV0e+8cjc=; fh=MqwdJWPsukY6ql1oTH57lBJL4aAmYoDC+3+aRZpc4Lo=; b=n0ZONubt5zmCle4fViXRCMd4vrmxV4Zf2d3X0G5UQ+ibZi6MCAkuInjpMYQDNfToK9 rP+w0Hft2N9th2o0x2+FQXdkBmHsrmWiRXyDewsQIRVsw6TQzcoQgTqVtzS9YYnfUoOU fj222q6uIMTI43bNB8I6DGLv9nFcTwqw8deAXEQmrt+7PeK4MvWNJ1o42YevThYUoQKF emSP6bV5XZooV404tog2TbYHExAtpNOFBfwj9/mMlTftGwN+zSvgK7muPVVTc1+NLUSV vjlELixELiQfCWvTpAUFjM3QYiUpwj5aG5BHgbmjVfK/12TfvPiSCBuZ8B13BCQD2ncw t2wA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ak4OHJZG; spf=pass (google.com: domain of linux-kernel+bounces-21790-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-21790-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id n8-20020a170906840800b00a1c5b249545si1464037ejx.284.2024.01.09.23.29.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 23:29:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-21790-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ak4OHJZG; spf=pass (google.com: domain of linux-kernel+bounces-21790-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-21790-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 4C55F1F261F2 for ; Wed, 10 Jan 2024 07:29:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 437FD39FDE; Wed, 10 Jan 2024 07:29:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ak4OHJZG" Received: from mail-oo1-f43.google.com (mail-oo1-f43.google.com [209.85.161.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B1E039AF4 for ; Wed, 10 Jan 2024 07:29:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-oo1-f43.google.com with SMTP id 006d021491bc7-59879109c33so907762eaf.2 for ; Tue, 09 Jan 2024 23:29:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704871749; x=1705476549; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Wo2ow3R5rRd9qIwMEMsgAnkS6j0WPS9tTieV0e+8cjc=; b=ak4OHJZG0U+Gm+9znDg742WwHTekzoLHC0hUsY3HWxdn4+Z++frQkXK7d4OfDy7Kdx CUs47DfLOXf3obL/l8UKgjzY9Dg51fQO8bwacOjZELK4LsAAJ8DhW04ZLltkz8xKJlKL sfXITp1nIc6vy6bvRhtDHw4tcB9tYAFYBZrgIi1lH3vFpjOycmsa6oHFqkBj9sD8udFt StATYFxZAGppFhtCm5J/KiVTBdynp7ulCm9RoG6vEpmqHm4vowt7VoCMH3y7z0rMVdP7 dxU0wGyfjNpcesUXCeELSzgqAy4gXA7zNzBcfQSD9miyW2JiaFaBhRs8uXsSd6uvo7m5 An9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704871749; x=1705476549; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Wo2ow3R5rRd9qIwMEMsgAnkS6j0WPS9tTieV0e+8cjc=; b=NS6HeZXt7OljIeVFqQwHIBUX3vEMT+t0Hsp2M+m8U/ITM6LXhYHsvoz7SwRZhUnzLD uqel3u76Ho0LK9Kb6udga1YhF+yg178v4C8SAvnTGU03ExSg5J9J85TL39tDD68WMonb Nimlc8fn8w5XQqyTt2MbMsxNkW+l+3c+mwjo1XJLFj28LefBGasMdYAOf0PDlzf2auzw KFFhbhBjtNJiedf65p2DKNRialIQSIcxqmB5oMCmKrGcpe5aH5XIlhjRH2gw2SLeNj2w vEEM3WuidH6hN37+owzIp0ojBODqaEcmtkqT0P5xIiJBJxe8Q1nUtlRsHSG19s3N12iB yntg== X-Gm-Message-State: AOJu0YzDPnbgqaVjK5pZ4a6MIViJ0S1w9FVIjROYQozyZt+UCzwTMw+K gsVW5Cp/Mqqgc3q/J3vZZeNt973tbx4SGA== X-Received: by 2002:a05:6358:e4a3:b0:175:61e3:4ca8 with SMTP id by35-20020a056358e4a300b0017561e34ca8mr550444rwb.44.1704871748972; Tue, 09 Jan 2024 23:29:08 -0800 (PST) Received: from localhost ([122.172.81.83]) by smtp.gmail.com with ESMTPSA id fh12-20020a056a00390c00b006d0d90edd2csm2842919pfb.42.2024.01.09.23.29.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 23:29:08 -0800 (PST) Date: Wed, 10 Jan 2024 12:59:06 +0530 From: Viresh Kumar To: Sibi Sankar Cc: sudeep.holla@arm.com, cristian.marussi@arm.com, rafael@kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, quic_mdtipton@quicinc.com, linux-arm-msm@vger.kernel.org Subject: Re: [PATCH 2/3] firmware: arm_scmi: Add perf_opp_xlate interface Message-ID: <20240110072906.7vnqykkcw3rkhoxa@vireshk-i7> References: <20240108140118.1596-1-quic_sibis@quicinc.com> <20240108140118.1596-3-quic_sibis@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240108140118.1596-3-quic_sibis@quicinc.com> On 08-01-24, 19:31, Sibi Sankar wrote: > Add a new perf_opp_xlate interface to the existing perf_ops to translate > a given perf index to frequency. > > This can be used by the cpufreq driver and framework to determine the > throttled frequency from a given perf index and apply HW pressure > accordingly. > > Signed-off-by: Sibi Sankar > --- > drivers/firmware/arm_scmi/perf.c | 21 +++++++++++++++++++++ > include/linux/scmi_protocol.h | 3 +++ > 2 files changed, 24 insertions(+) > > diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c > index c167bb5e3607..f26390924e1c 100644 > --- a/drivers/firmware/arm_scmi/perf.c > +++ b/drivers/firmware/arm_scmi/perf.c > @@ -964,6 +964,26 @@ static int scmi_notify_support(const struct scmi_protocol_handle *ph, u32 domain > return 0; > } > > +static int scmi_perf_opp_xlate(const struct scmi_protocol_handle *ph, u32 domain, > + int idx, unsigned long *freq) > +{ > + struct perf_dom_info *dom; > + > + dom = scmi_perf_domain_lookup(ph, domain); > + if (IS_ERR(dom)) > + return PTR_ERR(dom); > + > + if (idx >= dom->opp_count) > + return -ERANGE; > + > + if (!dom->level_indexing_mode) > + *freq = dom->opp[idx].perf * dom->mult_factor; > + else > + *freq = dom->opp[idx].indicative_freq * dom->mult_factor; > + > + return 0; > +} > + > static const struct scmi_perf_proto_ops perf_proto_ops = { > .num_domains_get = scmi_perf_num_domains_get, > .info_get = scmi_perf_info_get, > @@ -979,6 +999,7 @@ static const struct scmi_perf_proto_ops perf_proto_ops = { > .fast_switch_possible = scmi_fast_switch_possible, > .power_scale_get = scmi_power_scale_get, > .perf_notify_support = scmi_notify_support, > + .perf_opp_xlate = scmi_perf_opp_xlate, The use of "opp" here is a bit confusing as this doesn't have anything to do with the OPP framework and you are only getting the frequency out of it after all. -- viresh