* [PATCH] firmware: arm_scmi: Reject clear channel request on A2P
@ 2024-10-21 17:15 Cristian Marussi
2024-10-21 17:25 ` Florian Fainelli
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Cristian Marussi @ 2024-10-21 17:15 UTC (permalink / raw)
To: linux-kernel, linux-arm-kernel, arm-scmi; +Cc: sudeep.holla, cristian.marussi
The clear channel transport operation is supposed to be called exclusively
on the P2A channel from the agent, since it relinquishes the ownership of
the channel to the platform, after this latter has initiated some sort of
P2A communication.
Make sure that, if it is ever called on a A2P, is logged and ignored.
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
---
drivers/firmware/arm_scmi/common.h | 2 ++
drivers/firmware/arm_scmi/driver.c | 6 ++++++
2 files changed, 8 insertions(+)
diff --git a/drivers/firmware/arm_scmi/common.h b/drivers/firmware/arm_scmi/common.h
index f9a4514421ee..6c2032d4f767 100644
--- a/drivers/firmware/arm_scmi/common.h
+++ b/drivers/firmware/arm_scmi/common.h
@@ -163,6 +163,7 @@ void scmi_protocol_release(const struct scmi_handle *handle, u8 protocol_id);
* used to initialize this channel
* @dev: Reference to device in the SCMI hierarchy corresponding to this
* channel
+ * @is_p2a: A flag to identify a channel as P2A (RX)
* @rx_timeout_ms: The configured RX timeout in milliseconds.
* @handle: Pointer to SCMI entity handle
* @no_completion_irq: Flag to indicate that this channel has no completion
@@ -174,6 +175,7 @@ void scmi_protocol_release(const struct scmi_handle *handle, u8 protocol_id);
struct scmi_chan_info {
int id;
struct device *dev;
+ bool is_p2a;
unsigned int rx_timeout_ms;
struct scmi_handle *handle;
bool no_completion_irq;
diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
index a477b5ade38d..5bd4cc68a3e3 100644
--- a/drivers/firmware/arm_scmi/driver.c
+++ b/drivers/firmware/arm_scmi/driver.c
@@ -1048,6 +1048,11 @@ static inline void scmi_xfer_command_release(struct scmi_info *info,
static inline void scmi_clear_channel(struct scmi_info *info,
struct scmi_chan_info *cinfo)
{
+ if (!cinfo->is_p2a) {
+ dev_warn(cinfo->dev, "Invalid clear on A2P channel !\n");
+ return;
+ }
+
if (info->desc->ops->clear_channel)
info->desc->ops->clear_channel(cinfo);
}
@@ -2638,6 +2643,7 @@ static int scmi_chan_setup(struct scmi_info *info, struct device_node *of_node,
if (!cinfo)
return -ENOMEM;
+ cinfo->is_p2a = !tx;
cinfo->rx_timeout_ms = info->desc->max_rx_timeout_ms;
/* Create a unique name for this transport device */
--
2.46.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] firmware: arm_scmi: Reject clear channel request on A2P
2024-10-21 17:15 [PATCH] firmware: arm_scmi: Reject clear channel request on A2P Cristian Marussi
@ 2024-10-21 17:25 ` Florian Fainelli
2024-10-28 15:01 ` Sudeep Holla
2024-10-31 17:16 ` Sudeep Holla
2 siblings, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2024-10-21 17:25 UTC (permalink / raw)
To: Cristian Marussi, linux-kernel, linux-arm-kernel, arm-scmi; +Cc: sudeep.holla
On 10/21/24 10:15, Cristian Marussi wrote:
> The clear channel transport operation is supposed to be called exclusively
> on the P2A channel from the agent, since it relinquishes the ownership of
> the channel to the platform, after this latter has initiated some sort of
> P2A communication.
>
> Make sure that, if it is ever called on a A2P, is logged and ignored.
>
> Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
--
Florian
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] firmware: arm_scmi: Reject clear channel request on A2P
2024-10-21 17:15 [PATCH] firmware: arm_scmi: Reject clear channel request on A2P Cristian Marussi
2024-10-21 17:25 ` Florian Fainelli
@ 2024-10-28 15:01 ` Sudeep Holla
2024-10-31 17:16 ` Sudeep Holla
2 siblings, 0 replies; 4+ messages in thread
From: Sudeep Holla @ 2024-10-28 15:01 UTC (permalink / raw)
To: linux-kernel, linux-arm-kernel, arm-scmi, Cristian Marussi; +Cc: Sudeep Holla
On Mon, 21 Oct 2024 18:15:44 +0100, Cristian Marussi wrote:
> The clear channel transport operation is supposed to be called exclusively
> on the P2A channel from the agent, since it relinquishes the ownership of
> the channel to the platform, after this latter has initiated some sort of
> P2A communication.
>
> Make sure that, if it is ever called on a A2P, is logged and ignored.
>
> [...]
Applied to sudeep.holla/linux (for-next/scmi/fixes), thanks!
[1/1] firmware: arm_scmi: Reject clear channel request on A2P
https://git.kernel.org/sudeep.holla/c/a0a18e91eb3a
--
Regards,
Sudeep
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] firmware: arm_scmi: Reject clear channel request on A2P
2024-10-21 17:15 [PATCH] firmware: arm_scmi: Reject clear channel request on A2P Cristian Marussi
2024-10-21 17:25 ` Florian Fainelli
2024-10-28 15:01 ` Sudeep Holla
@ 2024-10-31 17:16 ` Sudeep Holla
2 siblings, 0 replies; 4+ messages in thread
From: Sudeep Holla @ 2024-10-31 17:16 UTC (permalink / raw)
To: linux-kernel, linux-arm-kernel, arm-scmi, Cristian Marussi; +Cc: Sudeep Holla
On Mon, 21 Oct 2024 18:15:44 +0100, Cristian Marussi wrote:
> The clear channel transport operation is supposed to be called exclusively
> on the P2A channel from the agent, since it relinquishes the ownership of
> the channel to the platform, after this latter has initiated some sort of
> P2A communication.
>
> Make sure that, if it is ever called on a A2P, is logged and ignored.
>
> [...]
Applied to sudeep.holla/linux (for-next/scmi/fixes), thanks!
[1/1] firmware: arm_scmi: Reject clear channel request on A2P
https://git.kernel.org/sudeep.holla/c/a0a18e91eb3a
--
Regards,
Sudeep
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-10-31 17:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-21 17:15 [PATCH] firmware: arm_scmi: Reject clear channel request on A2P Cristian Marussi
2024-10-21 17:25 ` Florian Fainelli
2024-10-28 15:01 ` Sudeep Holla
2024-10-31 17:16 ` Sudeep Holla
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®