* Re: [PATCH 1/2] soc: qcom: rpmh-rsc: Update CMD_MSGID_LEN to 4 bytes for read request
2026-09-10 8:53 ` [PATCH 1/2] soc: qcom: rpmh-rsc: Update CMD_MSGID_LEN to 4 bytes for read request Maulik Shah
@ 2026-09-10 9:01 ` Konrad Dybcio
2026-09-11 4:53 ` Maulik Shah
2026-09-10 11:59 ` Mukesh Ojha
2026-09-10 13:51 ` Bjorn Andersson
2 siblings, 1 reply; 9+ messages in thread
From: Konrad Dybcio @ 2026-09-10 9:01 UTC (permalink / raw)
To: Maulik Shah, Bjorn Andersson, Konrad Dybcio, Kamal Wadhwa,
Dmitry Baryshkov, Mark Brown
Cc: linux-arm-msm, linux-kernel
On 9/10/26 10:53 AM, Maulik Shah wrote:
> 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.
>
> Update the read request message accordingly on RSC v4.5 and higher.
>
> Signed-off-by: Maulik Shah <maulik.shah@oss.qualcomm.com>
> ---
> drivers/soc/qcom/rpmh-rsc.c | 13 ++++++++++---
> 1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/soc/qcom/rpmh-rsc.c b/drivers/soc/qcom/rpmh-rsc.c
> index c4542318eac4..f84a399fa5dc 100644
> --- a/drivers/soc/qcom/rpmh-rsc.c
> +++ b/drivers/soc/qcom/rpmh-rsc.c
> @@ -86,6 +86,7 @@ enum {
> #define TCS_AMC_MODE_TRIGGER BIT(24)
>
> /* TCS CMD register bit mask */
> +#define CMD_MSGID_LEN_READ_v4_5 4
> #define CMD_MSGID_LEN 8
> #define CMD_MSGID_RESP_REQ BIT(8)
> #define CMD_MSGID_WRITE BIT(16)
> @@ -499,15 +500,21 @@ 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 = 0;
> 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;
> - if (!msg->is_read)
> - cmd_msgid |= CMD_MSGID_WRITE;
> + if (!msg->is_read) {
checking for the negative first is odd.. it's existing art, but
let's invert that for readability
> + cmd_msgid = CMD_MSGID_LEN | CMD_MSGID_WRITE;
> + } else {
> + if (drv->ver.major >= 4 && drv->ver.minor >= 5)
This check will fail for e.g. v5.0
(major == 4 && minor >= 5) || major >= 5
Konrad
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH 1/2] soc: qcom: rpmh-rsc: Update CMD_MSGID_LEN to 4 bytes for read request
2026-09-10 9:01 ` Konrad Dybcio
@ 2026-09-11 4:53 ` Maulik Shah
0 siblings, 0 replies; 9+ messages in thread
From: Maulik Shah @ 2026-09-11 4:53 UTC (permalink / raw)
To: Konrad Dybcio, Bjorn Andersson, Konrad Dybcio, Kamal Wadhwa,
Dmitry Baryshkov, Mark Brown
Cc: linux-arm-msm, linux-kernel
On 10-09-2026 14:31, Konrad Dybcio wrote:
> On 9/10/26 10:53 AM, Maulik Shah wrote:
>> 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.
>>
>> Update the read request message accordingly on RSC v4.5 and higher.
>>
>> Signed-off-by: Maulik Shah <maulik.shah@oss.qualcomm.com>
>> ---
>> drivers/soc/qcom/rpmh-rsc.c | 13 ++++++++++---
>> 1 file changed, 10 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/soc/qcom/rpmh-rsc.c b/drivers/soc/qcom/rpmh-rsc.c
>> index c4542318eac4..f84a399fa5dc 100644
>> --- a/drivers/soc/qcom/rpmh-rsc.c
>> +++ b/drivers/soc/qcom/rpmh-rsc.c
>> @@ -86,6 +86,7 @@ enum {
>> #define TCS_AMC_MODE_TRIGGER BIT(24)
>>
>> /* TCS CMD register bit mask */
>> +#define CMD_MSGID_LEN_READ_v4_5 4
>> #define CMD_MSGID_LEN 8
>> #define CMD_MSGID_RESP_REQ BIT(8)
>> #define CMD_MSGID_WRITE BIT(16)
>> @@ -499,15 +500,21 @@ 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 = 0;
>> 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;
>> - if (!msg->is_read)
>> - cmd_msgid |= CMD_MSGID_WRITE;
>> + if (!msg->is_read) {
> checking for the negative first is odd.. it's existing art, but
> let's invert that for readability
Ack. will update in v2.
>
>> + cmd_msgid = CMD_MSGID_LEN | CMD_MSGID_WRITE;
>> + } else {
>> + if (drv->ver.major >= 4 && drv->ver.minor >= 5)
> This check will fail for e.g. v5.0
>
> (major == 4 && minor >= 5) || major >= 5
>
> Konrad
Ack. will update in v2.
Thanks,
Maulik
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] soc: qcom: rpmh-rsc: Update CMD_MSGID_LEN to 4 bytes for read request
2026-09-10 8:53 ` [PATCH 1/2] soc: qcom: rpmh-rsc: Update CMD_MSGID_LEN to 4 bytes for read request Maulik Shah
2026-09-10 9:01 ` Konrad Dybcio
@ 2026-09-10 11:59 ` Mukesh Ojha
2026-09-10 13:51 ` Bjorn Andersson
2 siblings, 0 replies; 9+ messages in thread
From: Mukesh Ojha @ 2026-09-10 11:59 UTC (permalink / raw)
To: Maulik Shah
Cc: Bjorn Andersson, Konrad Dybcio, Kamal Wadhwa, Dmitry Baryshkov,
Mark Brown, linux-arm-msm, linux-kernel, Konrad Dybcio
On Thu, Sep 10, 2026 at 02:23:01PM +0530, Maulik Shah wrote:
> 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.
>
> Update the read request message accordingly on RSC v4.5 and higher.
>
> Signed-off-by: Maulik Shah <maulik.shah@oss.qualcomm.com>
> ---
> drivers/soc/qcom/rpmh-rsc.c | 13 ++++++++++---
> 1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/soc/qcom/rpmh-rsc.c b/drivers/soc/qcom/rpmh-rsc.c
> index c4542318eac4..f84a399fa5dc 100644
> --- a/drivers/soc/qcom/rpmh-rsc.c
> +++ b/drivers/soc/qcom/rpmh-rsc.c
> @@ -86,6 +86,7 @@ enum {
> #define TCS_AMC_MODE_TRIGGER BIT(24)
>
> /* TCS CMD register bit mask */
> +#define CMD_MSGID_LEN_READ_v4_5 4
> #define CMD_MSGID_LEN 8
> #define CMD_MSGID_RESP_REQ BIT(8)
> #define CMD_MSGID_WRITE BIT(16)
> @@ -499,15 +500,21 @@ 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 = 0;
> 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;
> - if (!msg->is_read)
> - cmd_msgid |= CMD_MSGID_WRITE;
> + if (!msg->is_read) {
> + cmd_msgid = CMD_MSGID_LEN | CMD_MSGID_WRITE;
> + } else {
> + if (drv->ver.major >= 4 && drv->ver.minor >= 5)
> + cmd_msgid = CMD_MSGID_LEN_READ_v4_5;
> + else
> + cmd_msgid = CMD_MSGID_LEN;
> + }
>
> for (i = 0, j = cmd_id; i < msg->num_cmds; i++, j++) {
> cmd = &msg->cmds[i];
Tested this patch on Hawi, it works; without the patch boot up was stuck.
Tested-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com> #Hawi
--
-Mukesh Ojha
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH 1/2] soc: qcom: rpmh-rsc: Update CMD_MSGID_LEN to 4 bytes for read request
2026-09-10 8:53 ` [PATCH 1/2] soc: qcom: rpmh-rsc: Update CMD_MSGID_LEN to 4 bytes for read request Maulik Shah
2026-09-10 9:01 ` Konrad Dybcio
2026-09-10 11:59 ` Mukesh Ojha
@ 2026-09-10 13:51 ` Bjorn Andersson
2026-09-11 8:14 ` Maulik Shah
2 siblings, 1 reply; 9+ messages in thread
From: Bjorn Andersson @ 2026-09-10 13:51 UTC (permalink / raw)
To: Maulik Shah
Cc: Konrad Dybcio, Kamal Wadhwa, Dmitry Baryshkov, Mark Brown,
linux-arm-msm, linux-kernel, Konrad Dybcio
On Thu, Sep 10, 2026 at 02:23:01PM +0530, Maulik Shah wrote:
> 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.
>
> Update the read request message accordingly on RSC v4.5 and higher.
>
> Signed-off-by: Maulik Shah <maulik.shah@oss.qualcomm.com>
> ---
> drivers/soc/qcom/rpmh-rsc.c | 13 ++++++++++---
> 1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/soc/qcom/rpmh-rsc.c b/drivers/soc/qcom/rpmh-rsc.c
> index c4542318eac4..f84a399fa5dc 100644
> --- a/drivers/soc/qcom/rpmh-rsc.c
> +++ b/drivers/soc/qcom/rpmh-rsc.c
> @@ -86,6 +86,7 @@ enum {
> #define TCS_AMC_MODE_TRIGGER BIT(24)
>
> /* TCS CMD register bit mask */
> +#define CMD_MSGID_LEN_READ_v4_5 4
> #define CMD_MSGID_LEN 8
> #define CMD_MSGID_RESP_REQ BIT(8)
> #define CMD_MSGID_WRITE BIT(16)
> @@ -499,15 +500,21 @@ 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 = 0;
> 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;
> - if (!msg->is_read)
> - cmd_msgid |= CMD_MSGID_WRITE;
> + if (!msg->is_read) {
> + cmd_msgid = CMD_MSGID_LEN | CMD_MSGID_WRITE;
I know this follows the current code, but CMD_MSGID_LEN doesn't seem
like a "fixed" part of this message anymore. It seems rather that
there's a few bits here which denotes the CMD_MSGID_LEN and the value
thereof is either 8 or 4.
If this is the case, I'd find it cleaner to define CMD_MSGID_LEN_MASK
and then just FIELD_PREP() to put a 4 or a 8 in the "length field" of
the command.
> + } else {
> + if (drv->ver.major >= 4 && drv->ver.minor >= 5)
> + cmd_msgid = CMD_MSGID_LEN_READ_v4_5;
If I understand your commit message, this line says "on DRV 4.5 and
higher length is 4 otherwise it's 8" - but there's no way anyone can
read this line and come to that conclusion.
In contrast, this would actually say that:
cmd_msgid |= FIELD_PREP(CMD_MSGID_LEN, 4);
Also, is this really supposed to apply to DRV versions such as 5.5, but
not 6.1?
Regards,
Bjorn
> + else
> + cmd_msgid = CMD_MSGID_LEN;
> + }
>
> for (i = 0, j = cmd_id; i < msg->num_cmds; i++, j++) {
> cmd = &msg->cmds[i];
>
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH 1/2] soc: qcom: rpmh-rsc: Update CMD_MSGID_LEN to 4 bytes for read request
2026-09-10 13:51 ` Bjorn Andersson
@ 2026-09-11 8:14 ` Maulik Shah
0 siblings, 0 replies; 9+ messages in thread
From: Maulik Shah @ 2026-09-11 8:14 UTC (permalink / raw)
To: Bjorn Andersson
Cc: Konrad Dybcio, Kamal Wadhwa, Dmitry Baryshkov, Mark Brown,
linux-arm-msm, linux-kernel, Konrad Dybcio
On 10-09-2026 19:21, Bjorn Andersson wrote:
> On Thu, Sep 10, 2026 at 02:23:01PM +0530, Maulik Shah wrote:
[...]
>
> /* Convert all commands to RR when the request has wait_for_compl set */
> cmd_msgid |= msg->wait_for_compl ? CMD_MSGID_RESP_REQ : 0;
> - if (!msg->is_read)
> - cmd_msgid |= CMD_MSGID_WRITE;
> + if (!msg->is_read) {
> + cmd_msgid = CMD_MSGID_LEN | CMD_MSGID_WRITE;
> I know this follows the current code, but CMD_MSGID_LEN doesn't seem
> like a "fixed" part of this message anymore. It seems rather that
> there's a few bits here which denotes the CMD_MSGID_LEN and the value
> thereof is either 8 or 4.
>
> If this is the case, I'd find it cleaner to define CMD_MSGID_LEN_MASK
> and then just FIELD_PREP() to put a 4 or a 8 in the "length field" of
> the command.
Yes, updating v2 to use FIELD_PREP().
>
>> + } else {
>> + if (drv->ver.major >= 4 && drv->ver.minor >= 5)
>> + cmd_msgid = CMD_MSGID_LEN_READ_v4_5;
> If I understand your commit message, this line says "on DRV 4.5 and
> higher length is 4 otherwise it's 8" - but there's no way anyone can
> read this line and come to that conclusion.
>
> In contrast, this would actually say that:
> cmd_msgid |= FIELD_PREP(CMD_MSGID_LEN, 4);
I will update to use FIELD_PREP.
>
>
> Also, is this really supposed to apply to DRV versions such as 5.5, but
> not 6.1?
I will update version check in v2.
Thanks,
Maulik
^ permalink raw reply [flat|nested] 9+ messages in thread