firmware: arm_scmi: Populate fastchannel info only if set operations are allowed
PATCH 1/1 firmware: arm_scmi: Populate fastchannel info only if set operations are allowed
Certain SCMI performance domains may have restrictions on the set level and/or limits operation. If the SCMI domain supports fastchannel and the set operations are not allowed, then any attempts to fetch the fastchannel information for set level and/or limits operation will result in the SCMI platform returning SCMI_ERR_SUPPORT. However, since this information about the domain is already known to the agent(OSPM here) obtained via PERF_DOMAIN_ATTRIBUTES, the agent(OSPM) can avoid calls to the firmware trying to fetch the fastchannel information for the same.
Add those checks and skip querying the fastchannel information from the firmware based on the information collected during the domain enumeration stage.
--- drivers/firmware/arm_scmi/perf.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-)
drivers/firmware/arm_scmi/perf.c +17 -10
@@ -762,29 +762,36 @@ static void scmi_perf_domain_init_fc(const struct scmi_protocol_handle *ph, u32 domain, struct scmi_fc_info **p_fc) { struct scmi_fc_info *fc; +struct perf_dom_info *dom; + + dom =scmi_perf_domain_lookup (ph, domain); +if (IS_ERR (dom)) +return ; fc =devm_kcalloc (ph->dev,PERF_FC_MAX ,sizeof (*fc),GFP_KERNEL );if (!fc)return ; - ph->hops->fastchannel_init (ph,PERF_DESCRIBE_FASTCHANNEL , -PERF_LEVEL_SET ,4 , domain, - &fc[PERF_FC_LEVEL ].set_addr, - &fc[PERF_FC_LEVEL ].set_db); - ph->hops->fastchannel_init (ph,PERF_DESCRIBE_FASTCHANNEL ,PERF_LEVEL_GET ,4 , domain, &fc[PERF_FC_LEVEL ].get_addr,NULL ); - ph->hops->fastchannel_init (ph,PERF_DESCRIBE_FASTCHANNEL , -PERF_LIMITS_SET ,8 , domain, - &fc[PERF_FC_LIMIT ].set_addr, - &fc[PERF_FC_LIMIT ].set_db); - ph->hops->fastchannel_init (ph,PERF_DESCRIBE_FASTCHANNEL ,PERF_LIMITS_GET ,8 , domain, &fc[PERF_FC_LIMIT ].get_addr,NULL ); +if (dom->info.set_perf) + ph->hops->fastchannel_init (ph,PERF_DESCRIBE_FASTCHANNEL , +PERF_LEVEL_SET ,4 , domain, + &fc[PERF_FC_LEVEL ].set_addr, + &fc[PERF_FC_LEVEL ].set_db); + +if (dom->set_limits) + ph->hops->fastchannel_init (ph,PERF_DESCRIBE_FASTCHANNEL , +PERF_LIMITS_SET ,8 , domain, + &fc[PERF_FC_LIMIT ].set_addr, + &fc[PERF_FC_LIMIT ].set_db); + *p_fc = fc; }
Signature · 7 lines
2.42.0 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 9 lines · Sudeep Holla
Certain SCMI performance domains may have restrictions on the set level and/or limits operation. If the SCMI domain supports fastchannel and the set operations are not allowed, then any attempts to fetch the fastchannel information for set level and/or limits operation will result in the SCMI platform returning
SCMI_ERR_SUPPORT. However, since this information about the domain is already known to the agent(OSPM here) obtained viaPERF_DOMAIN_ATTRIBUTES, the agent(OSPM) can avoid calls to the firmware trying to fetch the fastchannel information for the same.
Quoted 4 lines
Add those checks and skip querying the fastchannel information from the firmware based on the information collected during the domain enumeration stage.
LGTM.
Thanks,
Cristian
Quoted 59 lines
Signed-off-by Sudeep Holla <[email protected]>--- drivers/firmware/arm_scmi/perf.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-)drivers/firmware/arm_scmi/perf.c +17
-10@@ -762,29 +762,36 @@ static void scmi_perf_domain_init_fc(const struct scmi_protocol_handle *ph, u32 domain, struct scmi_fc_info **p_fc) { struct scmi_fc_info *fc; +struct perf_dom_info *dom; + + dom =scmi_perf_domain_lookup (ph, domain); +if (IS_ERR (dom)) +return ; fc =devm_kcalloc (ph->dev,PERF_FC_MAX ,sizeof (*fc),GFP_KERNEL );if (!fc)return ; - ph->hops->fastchannel_init (ph,PERF_DESCRIBE_FASTCHANNEL , -PERF_LEVEL_SET ,4 , domain, - &fc[PERF_FC_LEVEL ].set_addr, - &fc[PERF_FC_LEVEL ].set_db); - ph->hops->fastchannel_init (ph,PERF_DESCRIBE_FASTCHANNEL ,PERF_LEVEL_GET ,4 , domain, &fc[PERF_FC_LEVEL ].get_addr,NULL ); - ph->hops->fastchannel_init (ph,PERF_DESCRIBE_FASTCHANNEL , -PERF_LIMITS_SET ,8 , domain, - &fc[PERF_FC_LIMIT ].set_addr, - &fc[PERF_FC_LIMIT ].set_db); - ph->hops->fastchannel_init (ph,PERF_DESCRIBE_FASTCHANNEL ,PERF_LIMITS_GET ,8 , domain, &fc[PERF_FC_LIMIT ].get_addr,NULL ); +if (dom->info.set_perf) + ph->hops->fastchannel_init (ph,PERF_DESCRIBE_FASTCHANNEL , +PERF_LEVEL_SET ,4 , domain, + &fc[PERF_FC_LEVEL ].set_addr, + &fc[PERF_FC_LEVEL ].set_db); + +if (dom->set_limits) + ph->hops->fastchannel_init (ph,PERF_DESCRIBE_FASTCHANNEL , +PERF_LIMITS_SET ,8 , domain, + &fc[PERF_FC_LIMIT ].set_addr, + &fc[PERF_FC_LIMIT ].set_db); + *p_fc = fc; }Signature · 1 line
2.42.0
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sudeep Holla
AppliedQuoted 10 lines · Sudeep Holla
Certain SCMI performance domains may have restrictions on the set level and/or limits operation. If the SCMI domain supports fastchannel and the set operations are not allowed, then any attempts to fetch the fastchannel information for set level and/or limits operation will result in the SCMI platform returning
SCMI_ERR_SUPPORT. However, since this information about the domain is already known to the agent(OSPM here) obtained viaPERF_DOMAIN_ATTRIBUTES, the agent(OSPM) can avoid calls to the firmware trying to fetch the fastchannel information for the same.[...]
Applied to sudeep.holla/linux (for-next/scmi/updates), thanks!
[1/1] firmware: arm_scmi: Populate fastchannel info only if set operations are allowed
https://git.kernel.org/sudeep.holla/c/619bc6e034f3
--
Regards,
Sudeep
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel