public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Cristian Marussi <cristian.marussi@arm.com>,
	Florian Fainelli <florian.fainelli@broadcom.com>,
	Sudeep Holla <sudeep.holla@arm.com>,
	Sasha Levin <sashal@kernel.org>,
	arm-scmi@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: [PATCH AUTOSEL 6.6 02/15] firmware: arm_scmi: Reject clear channel request on A2P
Date: Tue, 12 Nov 2024 05:36:23 -0500	[thread overview]
Message-ID: <20241112103643.1653381-2-sashal@kernel.org> (raw)
In-Reply-To: <20241112103643.1653381-1-sashal@kernel.org>

From: Cristian Marussi <cristian.marussi@arm.com>

[ Upstream commit a0a18e91eb3a6ef75a6de69dc00f206b913e3848 ]

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>
Message-Id: <20241021171544.2579551-1-cristian.marussi@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 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 00b165d1f502d..039f686f4580d 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 3962683e2af9d..efa9698c876a0 100644
--- a/drivers/firmware/arm_scmi/driver.c
+++ b/drivers/firmware/arm_scmi/driver.c
@@ -855,6 +855,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);
 }
@@ -2319,6 +2324,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.43.0


  reply	other threads:[~2024-11-12 10:36 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-12 10:36 [PATCH AUTOSEL 6.6 01/15] soc: qcom: Add check devm_kasprintf() returned value Sasha Levin
2024-11-12 10:36 ` Sasha Levin [this message]
2024-11-12 10:36 ` [PATCH AUTOSEL 6.6 03/15] regulator: rk808: Add apply_bit for BUCK3 on RK809 Sasha Levin
2024-11-12 10:36 ` [PATCH AUTOSEL 6.6 04/15] platform/x86: dell-smbios-base: Extends support to Alienware products Sasha Levin
2024-11-12 10:36 ` [PATCH AUTOSEL 6.6 05/15] platform/x86: dell-wmi-base: Handle META key Lock/Unlock events Sasha Levin
2024-11-12 10:36 ` [PATCH AUTOSEL 6.6 06/15] ASoC: tas2781: Add new driver version for tas2563 & tas2781 qfn chip Sasha Levin
2024-11-12 10:36 ` [PATCH AUTOSEL 6.6 07/15] tools/lib/thermal: Remove the thermal.h soft link when doing make clean Sasha Levin
2024-11-12 10:36 ` [PATCH AUTOSEL 6.6 08/15] can: j1939: fix error in J1939 documentation Sasha Levin
2024-11-12 10:36 ` [PATCH AUTOSEL 6.6 09/15] platform/x86: thinkpad_acpi: Fix for ThinkPad's with ECFW showing incorrect fan speed Sasha Levin
2024-11-12 10:36 ` [PATCH AUTOSEL 6.6 10/15] ASoC: amd: yc: fix internal mic on Xiaomi Book Pro 14 2022 Sasha Levin
2024-11-12 10:36 ` [PATCH AUTOSEL 6.6 11/15] ASoC: amd: yc: Support dmic on another model of Lenovo Thinkpad E14 Gen 6 Sasha Levin
2024-11-12 10:36 ` [PATCH AUTOSEL 6.6 12/15] ASoC: stm: Prevent potential division by zero in stm32_sai_mclk_round_rate() Sasha Levin
2024-11-12 10:36 ` [PATCH AUTOSEL 6.6 13/15] ASoC: stm: Prevent potential division by zero in stm32_sai_get_clk_div() Sasha Levin
2024-11-12 10:36 ` [PATCH AUTOSEL 6.6 14/15] drm: panel-orientation-quirks: Make Lenovo Yoga Tab 3 X90F DMI match less strict Sasha Levin
2024-11-12 10:36 ` [PATCH AUTOSEL 6.6 15/15] proc/softirqs: replace seq_printf with seq_put_decimal_ull_width Sasha Levin

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=20241112103643.1653381-2-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=arm-scmi@vger.kernel.org \
    --cc=cristian.marussi@arm.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=sudeep.holla@arm.com \
    /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