linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] firmware: arm_scmi: Refrain set operations of perf
@ 2023-11-02  7:58 xinglong.yang
  2023-11-02  9:54 ` Fwd: " sean yang
  2023-11-02 11:20 ` Sudeep Holla
  0 siblings, 2 replies; 4+ messages in thread
From: xinglong.yang @ 2023-11-02  7:58 UTC (permalink / raw)
  To: xinglong.yang, sudeep.holla, cristian.marussi; +Cc: linux-arm-kernel

Refrain from trying to take the SET operation where the set_* operations
are not supported, because: (1.) avoid unneeded SCMI exchanges, (2.)
avoids to trust the FW reply blindly.

Signed-off-by: xinglong.yang <xinglong.yang@cixtech.com>
---
 drivers/firmware/arm_scmi/perf.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c
index 431bda9165c3..3bcdef91ed5c 100644
--- a/drivers/firmware/arm_scmi/perf.c
+++ b/drivers/firmware/arm_scmi/perf.c
@@ -377,6 +377,9 @@ static int scmi_perf_limits_set(const struct scmi_protocol_handle *ph,
 	if (IS_ERR(dom))
 		return PTR_ERR(dom);
 
+	if (!dom->set_limits)
+		return -EOPNOTSUPP;
+
 	if (PROTOCOL_REV_MAJOR(pi->version) >= 0x3 && !max_perf && !min_perf)
 		return -EINVAL;
 
@@ -473,6 +476,9 @@ static int scmi_perf_level_set(const struct scmi_protocol_handle *ph,
 	if (IS_ERR(dom))
 		return PTR_ERR(dom);
 
+	if (!dom->set_perf)
+		return -EOPNOTSUPP;
+
 	if (dom->fc_info && dom->fc_info[PERF_FC_LEVEL].set_addr) {
 		struct scmi_fc_info *fci = &dom->fc_info[PERF_FC_LEVEL];
 
-- 
2.42.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Fwd: [PATCH v2] firmware: arm_scmi: Refrain set operations of perf
  2023-11-02  7:58 [PATCH v2] firmware: arm_scmi: Refrain set operations of perf xinglong.yang
@ 2023-11-02  9:54 ` sean yang
  2023-11-02 11:06   ` Sudeep Holla
  2023-11-02 11:20 ` Sudeep Holla
  1 sibling, 1 reply; 4+ messages in thread
From: sean yang @ 2023-11-02  9:54 UTC (permalink / raw)
  Cc: linux-arm-kernel, linux-kernel

---------- Forwarded message ---------
发件人: xinglong.yang <seanyang230@gmail.com>
Date: 2023年11月2日周四 15:59
Subject: [PATCH v2] firmware: arm_scmi: Refrain set operations of perf
To: <xinglong.yang@cixtech.com>, <sudeep.holla@arm.com>,
<cristian.marussi@arm.com>
Cc: <linux-arm-kernel@lists.infradead.org>


Refrain from trying to take the SET operation where the set_* operations
are not supported, because: (1.) avoid unneeded SCMI exchanges, (2.)
avoids to trust the FW reply blindly.

Signed-off-by: xinglong.yang <xinglong.yang@cixtech.com>
---
 drivers/firmware/arm_scmi/perf.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/firmware/arm_scmi/perf.c b/drivers/firmware/arm_scmi/perf.c
index 431bda9165c3..3bcdef91ed5c 100644
--- a/drivers/firmware/arm_scmi/perf.c
+++ b/drivers/firmware/arm_scmi/perf.c
@@ -377,6 +377,9 @@ static int scmi_perf_limits_set(const struct
scmi_protocol_handle *ph,
        if (IS_ERR(dom))
                return PTR_ERR(dom);

+       if (!dom->set_limits)
+               return -EOPNOTSUPP;
+
        if (PROTOCOL_REV_MAJOR(pi->version) >= 0x3 && !max_perf && !min_perf)
                return -EINVAL;

@@ -473,6 +476,9 @@ static int scmi_perf_level_set(const struct
scmi_protocol_handle *ph,
        if (IS_ERR(dom))
                return PTR_ERR(dom);

+       if (!dom->set_perf)
+               return -EOPNOTSUPP;
+
        if (dom->fc_info && dom->fc_info[PERF_FC_LEVEL].set_addr) {
                struct scmi_fc_info *fci = &dom->fc_info[PERF_FC_LEVEL];

--
2.42.0

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: Fwd: [PATCH v2] firmware: arm_scmi: Refrain set operations of perf
  2023-11-02  9:54 ` Fwd: " sean yang
@ 2023-11-02 11:06   ` Sudeep Holla
  0 siblings, 0 replies; 4+ messages in thread
From: Sudeep Holla @ 2023-11-02 11:06 UTC (permalink / raw)
  To: sean yang
  Cc: linux-arm-kernel, linux-kernel@vger.kernel.org Sudeep Holla,
	cristian.marussi

On Thu, Nov 02, 2023 at 05:54:37PM +0800, sean yang wrote:
> ---------- Forwarded message ---------
> 发件人: xinglong.yang <seanyang230@gmail.com>
> Date: 2023年11月2日周四 15:59
> Subject: [PATCH v2] firmware: arm_scmi: Refrain set operations of perf
> To: <xinglong.yang@cixtech.com>, <sudeep.holla@arm.com>,
> <cristian.marussi@arm.com>
> Cc: <linux-arm-kernel@lists.infradead.org>
>

Why are you forwarding the message multiple times on the list. It is
useless. Also please allow a day or 2 if you suspect some mails are
not delivered. I have 3 copies of this forwarded message in my inbox now.

-- 
Regards,
Sudeep

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] firmware: arm_scmi: Refrain set operations of perf
  2023-11-02  7:58 [PATCH v2] firmware: arm_scmi: Refrain set operations of perf xinglong.yang
  2023-11-02  9:54 ` Fwd: " sean yang
@ 2023-11-02 11:20 ` Sudeep Holla
  1 sibling, 0 replies; 4+ messages in thread
From: Sudeep Holla @ 2023-11-02 11:20 UTC (permalink / raw)
  To: xinglong.yang
  Cc: xinglong.yang, cristian.marussi, Sudeep Holla, linux-arm-kernel

On Thu, Nov 02, 2023 at 03:58:53PM +0800, xinglong.yang wrote:
> Refrain from trying to take the SET operation where the set_* operations
> are not supported, because: (1.) avoid unneeded SCMI exchanges, (2.)
> avoids to trust the FW reply blindly.
>

This looks OK, but this is not based on the upstream tree(not even v6.6).
set_perf is now move to another structure, so needs rebasing. I will take
care of it and repost this patch and the other one[1] next week or at the
end of current merge window. You need not repost anything for now.

--
Regards,
Sudeep

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-11-02 11:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-02  7:58 [PATCH v2] firmware: arm_scmi: Refrain set operations of perf xinglong.yang
2023-11-02  9:54 ` Fwd: " sean yang
2023-11-02 11:06   ` Sudeep Holla
2023-11-02 11:20 ` Sudeep Holla

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).