From: Ulf Hansson <ulf.hansson@linaro.org>
To: Sudeep Holla <sudeep.holla@arm.com>,
Cristian Marussi <cristian.marussi@arm.com>,
Viresh Kumar <vireshk@kernel.org>, Nishanth Menon <nm@ti.com>,
Stephen Boyd <sboyd@kernel.org>
Cc: Nikunj Kela <nkela@quicinc.com>,
Prasad Sodagudi <psodagud@quicinc.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Ulf Hansson <ulf.hansson@linaro.org>,
linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: [PATCH v2 02/11] firmware: arm_scmi: Extend perf protocol ops to get information of a domain
Date: Thu, 13 Jul 2023 16:17:29 +0200 [thread overview]
Message-ID: <20230713141738.23970-3-ulf.hansson@linaro.org> (raw)
In-Reply-To: <20230713141738.23970-1-ulf.hansson@linaro.org>
Similar to other protocol ops, it's useful for an scmi module driver to get
some generic information of a performance domain. Therefore, let's add a
new callback to provide this information. The information is currently
limited to the name of the performance domain and whether the set-level
operation is supported, although this can easily be extended if we find the
need for it.
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
Changes in v2:
- New patch (replacing two earlier patches).
---
drivers/firmware/arm_scmi/perf.c | 21 ++++++++++++++++-----
include/linux/scmi_protocol.h | 8 ++++++++
2 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c
index cf7f0de4d6db..f3ea96dd845c 100644
--- a/drivers/firmware/arm_scmi/perf.c
+++ b/drivers/firmware/arm_scmi/perf.c
@@ -124,7 +124,6 @@ struct scmi_msg_resp_perf_describe_levels {
struct perf_dom_info {
bool set_limits;
- bool set_perf;
bool perf_limit_notify;
bool perf_level_notify;
bool perf_fastchannels;
@@ -132,7 +131,7 @@ struct perf_dom_info {
u32 sustained_freq_khz;
u32 sustained_perf_level;
u32 mult_factor;
- char name[SCMI_MAX_STR_SIZE];
+ struct scmi_perf_domain_info info;
struct scmi_opp opp[MAX_OPPS];
struct scmi_fc_info *fc_info;
};
@@ -209,7 +208,7 @@ scmi_perf_domain_attributes_get(const struct scmi_protocol_handle *ph,
flags = le32_to_cpu(attr->flags);
dom_info->set_limits = SUPPORTS_SET_LIMITS(flags);
- dom_info->set_perf = SUPPORTS_SET_PERF_LVL(flags);
+ dom_info->info.set_perf = SUPPORTS_SET_PERF_LVL(flags);
dom_info->perf_limit_notify = SUPPORTS_PERF_LIMIT_NOTIFY(flags);
dom_info->perf_level_notify = SUPPORTS_PERF_LEVEL_NOTIFY(flags);
dom_info->perf_fastchannels = SUPPORTS_PERF_FASTCHANNELS(flags);
@@ -225,7 +224,8 @@ scmi_perf_domain_attributes_get(const struct scmi_protocol_handle *ph,
dom_info->mult_factor =
(dom_info->sustained_freq_khz * 1000) /
dom_info->sustained_perf_level;
- strscpy(dom_info->name, attr->name, SCMI_SHORT_NAME_MAX_SIZE);
+ strscpy(dom_info->info.name, attr->name,
+ SCMI_SHORT_NAME_MAX_SIZE);
}
ph->xops->xfer_put(ph, t);
@@ -237,7 +237,8 @@ scmi_perf_domain_attributes_get(const struct scmi_protocol_handle *ph,
if (!ret && PROTOCOL_REV_MAJOR(version) >= 0x3 &&
SUPPORTS_EXTENDED_NAMES(flags))
ph->hops->extended_name_get(ph, PERF_DOMAIN_NAME_GET, domain,
- dom_info->name, SCMI_MAX_STR_SIZE);
+ dom_info->info.name,
+ SCMI_MAX_STR_SIZE);
return ret;
}
@@ -340,6 +341,15 @@ static int scmi_perf_num_domains_get(const struct scmi_protocol_handle *ph)
return pi->num_domains;
}
+static const struct scmi_perf_domain_info *
+scmi_perf_domain_info_get(const struct scmi_protocol_handle *ph, u32 domain)
+{
+ struct scmi_perf_info *pi = ph->get_priv(ph);
+ struct perf_dom_info *dom = pi->dom_info + domain;
+
+ return &dom->info;
+}
+
static int scmi_perf_mb_limits_set(const struct scmi_protocol_handle *ph,
u32 domain, u32 max_perf, u32 min_perf)
{
@@ -695,6 +705,7 @@ scmi_power_scale_get(const struct scmi_protocol_handle *ph)
static const struct scmi_perf_proto_ops perf_proto_ops = {
.num_domains_get = scmi_perf_num_domains_get,
+ .domain_info_get = scmi_perf_domain_info_get,
.limits_set = scmi_perf_limits_set,
.limits_get = scmi_perf_limits_get,
.level_set = scmi_perf_level_set,
diff --git a/include/linux/scmi_protocol.h b/include/linux/scmi_protocol.h
index 71b39cbbdace..ed032fe83c28 100644
--- a/include/linux/scmi_protocol.h
+++ b/include/linux/scmi_protocol.h
@@ -97,11 +97,17 @@ struct scmi_clk_proto_ops {
u32 clk_id);
};
+struct scmi_perf_domain_info {
+ char name[SCMI_MAX_STR_SIZE];
+ bool set_perf;
+};
+
/**
* struct scmi_perf_proto_ops - represents the various operations provided
* by SCMI Performance Protocol
*
* @num_domains_get: gets the number of supported performance domains
+ * @domain_info_get: get the information of a performance domain
* @limits_set: sets limits on the performance level of a domain
* @limits_get: gets limits on the performance level of a domain
* @level_set: sets the performance level of a domain
@@ -122,6 +128,8 @@ struct scmi_clk_proto_ops {
*/
struct scmi_perf_proto_ops {
int (*num_domains_get)(const struct scmi_protocol_handle *ph);
+ const struct scmi_perf_domain_info __must_check *(*domain_info_get)
+ (const struct scmi_protocol_handle *ph, u32 domain);
int (*limits_set)(const struct scmi_protocol_handle *ph, u32 domain,
u32 max_perf, u32 min_perf);
int (*limits_get)(const struct scmi_protocol_handle *ph, u32 domain,
--
2.34.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-07-13 14:18 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-13 14:17 [PATCH v2 00/11] arm_scmi/cpufreq: Add generic performance scaling support Ulf Hansson
2023-07-13 14:17 ` [PATCH v2 01/11] firmware: arm_scmi: Extend perf protocol ops to get number of domains Ulf Hansson
2023-07-13 14:17 ` Ulf Hansson [this message]
2023-07-13 14:17 ` [PATCH v2 03/11] cpufreq: scmi: Prepare to move OF parsing of domain-id to cpufreq Ulf Hansson
2023-07-13 14:17 ` [PATCH v2 04/11] firmware: arm_scmi: Align perf ops to use domain-id as in-parameter Ulf Hansson
2023-07-13 14:17 ` [PATCH v2 05/11] firmware: arm_scmi: Drop redundant ->device_domain_id() from perf ops Ulf Hansson
2023-07-13 14:17 ` [PATCH v2 06/11] cpufreq: scmi: Avoid one OF parsing in scmi_get_sharing_cpus() Ulf Hansson
2023-07-13 14:17 ` [PATCH v2 07/11] PM: domains: Allow genpd providers to manage OPP tables directly by its FW Ulf Hansson
2023-07-13 14:17 ` [PATCH v2 08/11] dt-bindings: firmware: arm,scmi: Extend bindings for protocol@13 Ulf Hansson
2023-07-19 15:17 ` Sudeep Holla
2023-07-21 11:42 ` Ulf Hansson
2023-07-21 11:55 ` Sudeep Holla
2023-07-21 14:33 ` Rob Herring
2023-07-21 18:38 ` Sudeep Holla
[not found] ` <CAPDyKFqsaz=hruktv+sPQz-ttOtWa9O_Jvp2iLnpxQqX2r7yBQ@mail.gmail.com>
2023-08-21 14:32 ` Ulf Hansson
2023-07-13 14:17 ` [PATCH v2 09/11] cpufreq: scmi: Add support to parse domain-id using #power-domain-cells Ulf Hansson
2023-07-19 15:24 ` Sudeep Holla
2023-07-21 11:52 ` Ulf Hansson
2023-07-21 11:59 ` Sudeep Holla
2023-07-21 14:37 ` Rob Herring
[not found] ` <CAPDyKFr9V6iPJhXXrv5RxgAE-YvXDboN5GP8E=q2VHnjs8cL5w@mail.gmail.com>
2023-08-21 14:23 ` Ulf Hansson
2023-07-13 14:17 ` [PATCH v2 10/11] firmware: arm_scmi: Add the SCMI performance domain Ulf Hansson
2023-07-19 14:51 ` Cristian Marussi
2023-07-19 15:59 ` Sudeep Holla
2023-07-21 15:19 ` Ulf Hansson
[not found] ` <ZME4MQpYd7kJmFzF@e120937-lin>
2023-07-27 11:37 ` Ulf Hansson
2023-07-13 14:17 ` [PATCH v2 11/11] cpufreq: scmi: Drop redundant ifdef in scmi_cpufreq_probe() Ulf Hansson
2023-07-19 15:32 ` Sudeep Holla
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230713141738.23970-3-ulf.hansson@linaro.org \
--to=ulf.hansson@linaro.org \
--cc=alexandre.torgue@foss.st.com \
--cc=cristian.marussi@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=nkela@quicinc.com \
--cc=nm@ti.com \
--cc=psodagud@quicinc.com \
--cc=sboyd@kernel.org \
--cc=sudeep.holla@arm.com \
--cc=vireshk@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).