diff mbox series

[21/22] firmware: arm_scmi: Add SCMI v3.1 Perf power-cost in microwatts

Message ID 20220330150551.2573938-22-cristian.marussi@arm.com (mailing list archive)
State New, archived
Headers show
Series SCMIv3.1 Miscellaneous changes | expand

Commit Message

Cristian Marussi March 30, 2022, 3:05 p.m. UTC
Add SCMIv3.1 internal support for parsing message attributes reporting
the capability of a performance domain to report power-cost in microwatts.

Cc: Lukasz Luba <lukasz.luba@arm.com>
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
---
 drivers/firmware/arm_scmi/perf.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Lukasz Luba March 30, 2022, 4:46 p.m. UTC | #1
On 3/30/22 16:05, Cristian Marussi wrote:
> Add SCMIv3.1 internal support for parsing message attributes reporting
> the capability of a performance domain to report power-cost in microwatts.
> 
> Cc: Lukasz Luba <lukasz.luba@arm.com>
> Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
> ---
>   drivers/firmware/arm_scmi/perf.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c
> index e1aa0ed67971..65ffda5495d6 100644
> --- a/drivers/firmware/arm_scmi/perf.c
> +++ b/drivers/firmware/arm_scmi/perf.c
> @@ -45,6 +45,7 @@ struct scmi_msg_resp_perf_attributes {
>   	__le16 num_domains;
>   	__le16 flags;
>   #define POWER_SCALE_IN_MILLIWATT(x)	((x) & BIT(0))
> +#define POWER_SCALE_IN_MICROWATT(x)	((x) & BIT(1))
>   	__le32 stats_addr_low;
>   	__le32 stats_addr_high;
>   	__le32 stats_size;
> @@ -170,6 +171,7 @@ struct scmi_perf_info {
>   	u32 version;
>   	int num_domains;
>   	bool power_scale_mw;
> +	bool power_scale_uw;
>   	u64 stats_addr;
>   	u32 stats_size;
>   	struct perf_dom_info *dom_info;
> @@ -200,6 +202,8 @@ static int scmi_perf_attributes_get(const struct scmi_protocol_handle *ph,
>   
>   		pi->num_domains = le16_to_cpu(attr->num_domains);
>   		pi->power_scale_mw = POWER_SCALE_IN_MILLIWATT(flags);
> +		if (PROTOCOL_REV_MAJOR(pi->version) >= 0x3)
> +			pi->power_scale_uw = POWER_SCALE_IN_MICROWATT(flags);
>   		pi->stats_addr = le32_to_cpu(attr->stats_addr_low) |
>   				(u64)le32_to_cpu(attr->stats_addr_high) << 32;
>   		pi->stats_size = le32_to_cpu(attr->stats_size);

LGTM,

Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>

I'll send a follow-up patch which is using this information when this
patch gets into linux-next.
diff mbox series

Patch

diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c
index e1aa0ed67971..65ffda5495d6 100644
--- a/drivers/firmware/arm_scmi/perf.c
+++ b/drivers/firmware/arm_scmi/perf.c
@@ -45,6 +45,7 @@  struct scmi_msg_resp_perf_attributes {
 	__le16 num_domains;
 	__le16 flags;
 #define POWER_SCALE_IN_MILLIWATT(x)	((x) & BIT(0))
+#define POWER_SCALE_IN_MICROWATT(x)	((x) & BIT(1))
 	__le32 stats_addr_low;
 	__le32 stats_addr_high;
 	__le32 stats_size;
@@ -170,6 +171,7 @@  struct scmi_perf_info {
 	u32 version;
 	int num_domains;
 	bool power_scale_mw;
+	bool power_scale_uw;
 	u64 stats_addr;
 	u32 stats_size;
 	struct perf_dom_info *dom_info;
@@ -200,6 +202,8 @@  static int scmi_perf_attributes_get(const struct scmi_protocol_handle *ph,
 
 		pi->num_domains = le16_to_cpu(attr->num_domains);
 		pi->power_scale_mw = POWER_SCALE_IN_MILLIWATT(flags);
+		if (PROTOCOL_REV_MAJOR(pi->version) >= 0x3)
+			pi->power_scale_uw = POWER_SCALE_IN_MICROWATT(flags);
 		pi->stats_addr = le32_to_cpu(attr->stats_addr_low) |
 				(u64)le32_to_cpu(attr->stats_addr_high) << 32;
 		pi->stats_size = le32_to_cpu(attr->stats_size);