Skip to contentSkip to conversation

soc: qcom: rpmh-rsc: Update CMD_MSGID_LEN to 4 bytes for read request

PATCH Applied Maulik Shah 5 participants 5 messages Oct 7 – Oct 13

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 soc: qcom: rpmh-rsc: Update CMD_MSGID_LEN to 4 bytes for read request

Newer SoC like hawi with RSC version v4.5 support 4 byte message read request instead of default 8 byte on older SoCs. The write request continues to be 8 bytes.

The CMD_MSGID_LEN field is [3:0] bits. Describe the length bits as a GENMASK() and use FIELD_PREP() when programming 4-byte or 8-byte message length.

---
Changes in v3:
- Drop patch-2 as it may wait for a while to get more comments.
- No changes to patch-1.
- Drop cover letter for single change
- Link to v2: https://patch.msgid.link/[email protected]

Changes in v2:
- Define CMD_MSGID_LEN as a field and use FIELD_PREP() for lengths.
- Keep the read length selection explicit for RSC v4.5 and newer.
- Keep Tested-by for patch-1.
- No changes to patch-2.
- Link to v1: https://patch.msgid.link/[email protected]

To: Bjorn Andersson <[email protected]>
To: Konrad Dybcio <[email protected]>
To: Maulik Shah <[email protected]>
To: Dmitry Baryshkov <[email protected]>
To: Mark Brown <[email protected]>
To: Kamal Wadhwa <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: Konrad Dybcio <[email protected]>

---
 drivers/soc/qcom/rpmh-rsc.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/soc/qcom/rpmh-rsc.c +11 -3
index c4542318eac4..c5ed9874bb67 100644
@@ -7,6 +7,7 @@
 #define pr_fmt(fmt) "%s " fmt, KBUILD_MODNAME
 
 #include <linux/atomic.h>
+#include <linux/bitfield.h>
 #include <linux/cpu_pm.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
@@ -86,7 +87,7 @@ enum {
 #define TCS_AMC_MODE_TRIGGER		BIT(24)
 
 /* TCS CMD register bit mask */
-#define CMD_MSGID_LEN			8
+#define CMD_MSGID_LEN			GENMASK(3, 0)
 #define CMD_MSGID_RESP_REQ		BIT(8)
 #define CMD_MSGID_WRITE			BIT(16)
 #define CMD_STATUS_ISSUED		BIT(8)
@@ -499,13 +500,20 @@ static void __tcs_buffer_write(struct rsc_drv *drv, int tcs_id, int cmd_id,
 			       const struct tcs_request *msg)
 {
 	u32 msgid;
-	u32 cmd_msgid = CMD_MSGID_LEN;
+	u32 cmd_msgid;
 	u32 cmd_enable = 0;
 	struct tcs_cmd *cmd;
 	int i, j;
 
 	/* Convert all commands to RR when the request has wait_for_compl set */
-	cmd_msgid |= msg->wait_for_compl ? CMD_MSGID_RESP_REQ : 0;
+	cmd_msgid = msg->wait_for_compl ? CMD_MSGID_RESP_REQ : 0;
+
+	if (msg->is_read && (drv->ver.major > 4 ||
+	     (drv->ver.major == 4 && drv->ver.minor >= 5)))
+		cmd_msgid |= FIELD_PREP(CMD_MSGID_LEN, 4);
+	else
+		cmd_msgid |= FIELD_PREP(CMD_MSGID_LEN, 8);
+
 	if (!msg->is_read)
 		cmd_msgid |= CMD_MSGID_WRITE;
 

---
base-commit: c68a982815dcce5464e3bf2a31ac94f5146c04ca
change-id: 20260910-rsc_read-27d689e37cb5

Best regards,

Signature · 1 line
Maulik Shah <[email protected]>
#1 lore raw
Quoted 10 lines · Maulik Shah

Newer SoC like hawi with RSC version v4.5 support 4 byte message read request instead of default 8 byte on older SoCs. The write request continues to be 8 bytes.

The CMD_MSGID_LEN field is [3:0] bits. Describe the length bits as a GENMASK() and use FIELD_PREP() when programming 4-byte or 8-byte message length.

I am not sure if we are still picking patches for 7.4. If there is a chance, please pick this as without this Hawi SoC would not boot with upstream kernel.

Signature · 1 line
-Mukesh Ojha
Reviewed-by on v3 1/1
#2 lore raw
In reply to Maulik Shah
Quoted 11 lines · Maulik Shah

Newer SoC like hawi with RSC version v4.5 support 4 byte message read request instead of default 8 byte on older SoCs. The write request continues to be 8 bytes.

The CMD_MSGID_LEN field is [3:0] bits. Describe the length bits as a GENMASK() and use FIELD_PREP() when programming 4-byte or 8-byte message length.

---

Konrad

Reviewed-by on v3 1/1
#3 lore raw
In reply to Maulik Shah
Quoted 10 lines · Maulik Shah

Newer SoC like hawi with RSC version v4.5 support 4 byte message read request instead of default 8 byte on older SoCs. The write request continues to be 8 bytes.

The CMD_MSGID_LEN field is [3:0] bits. Describe the length bits as a GENMASK() and use FIELD_PREP() when programming 4-byte or 8-byte message length.

maintainer Applied
#4 lore raw
In reply to Maulik Shah
Quoted 9 lines · Maulik Shah

Newer SoC like hawi with RSC version v4.5 support 4 byte message read request instead of default 8 byte on older SoCs. The write request continues to be 8 bytes.

The CMD_MSGID_LEN field is [3:0] bits. Describe the length bits as a GENMASK() and use FIELD_PREP() when programming 4-byte or 8-byte message length.

[...]

Applied, thanks!

[1/1] soc: qcom: rpmh-rsc: Update CMD_MSGID_LEN to 4 bytes for read request

      commit: e284de4dfc0132764ef0e051a7024932b130c5e7

Please run checkpatch --strict in the future.

Best regards,

Signature · 1 line
Bjorn Andersson <[email protected]>