* [PATCH 0/2] soc: qcom: rpmh-rsc: Updates for RPMh read requests
@ 2026-09-10 8:53 Maulik Shah
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 8:53 ` [PATCH 2/2] soc: qcom: rpmh-rsc: Skip read requests on unsupported platforms Maulik Shah
0 siblings, 2 replies; 9+ messages in thread
From: Maulik Shah @ 2026-09-10 8:53 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Kamal Wadhwa, Dmitry Baryshkov,
Mark Brown
Cc: linux-arm-msm, linux-kernel, Konrad Dybcio, Maulik Shah
This series carries two RPMh read request updates.
RSC v4.5 and newer expect read commands to use a 4-byte message payload,
while write commands continue to use 8 bytes. Update the message length
used for read requests on those controllers.
Some platforms either do not support RPMh read requests or AOSS does not
respond to them. Issuing a read there can occupy an ACTIVE TCS indefinitely
and block subsequent write requests. Skip read commands on sm8150 and
sc8180x [1] returning a zero resource level so callers avoid error handling
for an unsupported read path.
Patch-1 do not have any dependency. Fixes tag is not required as existing
SoCs on upstream are all lower than v4.5 version. Patch-1 can be applied as
preparation for Hawi SoC support.
Patch-2 of the series carries fixes tag. I do not have sm8150 or sc8180x
to verify patch-2. If there are reports like [1] of read requests not
working on past SoC the list can be expanded within newly added
rpmh_rsc_no_rpmh_read() API.
[1] https://lore.kernel.org/linux-arm-msm/0a73bc50-71f4-43f8-9d95-14a763d63c61@oss.qualcomm.com/
Signed-off-by: Maulik Shah <maulik.shah@oss.qualcomm.com>
---
Maulik Shah (2):
soc: qcom: rpmh-rsc: Update CMD_MSGID_LEN to 4 bytes for read request
soc: qcom: rpmh-rsc: Skip read requests on unsupported platforms
drivers/soc/qcom/rpmh-internal.h | 2 ++
drivers/soc/qcom/rpmh-rsc.c | 20 +++++++++++++++++---
drivers/soc/qcom/rpmh.c | 6 ++++++
3 files changed, 25 insertions(+), 3 deletions(-)
---
base-commit: c68a982815dcce5464e3bf2a31ac94f5146c04ca
change-id: 20260910-rsc_read-27d689e37cb5
Best regards,
--
Maulik Shah <maulik.shah@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/2] soc: qcom: rpmh-rsc: Update CMD_MSGID_LEN to 4 bytes for read request
2026-09-10 8:53 [PATCH 0/2] soc: qcom: rpmh-rsc: Updates for RPMh read requests Maulik Shah
@ 2026-09-10 8:53 ` Maulik Shah
2026-09-10 9:01 ` Konrad Dybcio
` (2 more replies)
2026-09-10 8:53 ` [PATCH 2/2] soc: qcom: rpmh-rsc: Skip read requests on unsupported platforms Maulik Shah
1 sibling, 3 replies; 9+ messages in thread
From: Maulik Shah @ 2026-09-10 8:53 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Kamal Wadhwa, Dmitry Baryshkov,
Mark Brown
Cc: linux-arm-msm, linux-kernel, Konrad Dybcio, 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.
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];
--
2.43.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/2] soc: qcom: rpmh-rsc: Skip read requests on unsupported platforms
2026-09-10 8:53 [PATCH 0/2] soc: qcom: rpmh-rsc: Updates for RPMh read requests Maulik Shah
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 8:53 ` Maulik Shah
2026-09-10 9:14 ` Konrad Dybcio
1 sibling, 1 reply; 9+ messages in thread
From: Maulik Shah @ 2026-09-10 8:53 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Kamal Wadhwa, Dmitry Baryshkov,
Mark Brown
Cc: linux-arm-msm, linux-kernel, Konrad Dybcio, Maulik Shah
On some platforms AOSS do not respond to read requests. Read request in
such cases will consume the ACTIVE TCS but forever waits for a response
blocking the subsequent write requests.
Skip issuing read commands on sm8150 and sc8180x platforms. For such
platforms return success to the caller with the resource level at zero
to avoid the caller taking any action on error code.
Fixes: edbafe65eef2 ("soc: qcom: rpmh: Add support to read back resource settings")
Signed-off-by: Maulik Shah <maulik.shah@oss.qualcomm.com>
---
drivers/soc/qcom/rpmh-internal.h | 2 ++
drivers/soc/qcom/rpmh-rsc.c | 7 +++++++
drivers/soc/qcom/rpmh.c | 6 ++++++
3 files changed, 15 insertions(+)
diff --git a/drivers/soc/qcom/rpmh-internal.h b/drivers/soc/qcom/rpmh-internal.h
index 39441a25af9b..960a62f0e931 100644
--- a/drivers/soc/qcom/rpmh-internal.h
+++ b/drivers/soc/qcom/rpmh-internal.h
@@ -75,12 +75,14 @@ struct rpmh_request {
* @cache: the list of cached requests
* @cache_lock: synchronize access to the cache data
* @dirty: was the cache updated since flush
+ * @no_rpmh_read: controller does not support or respond to read commands
* @batch_cache: Cache sleep and wake requests sent as batch
*/
struct rpmh_ctrlr {
struct list_head cache;
spinlock_t cache_lock;
bool dirty;
+ bool no_rpmh_read;
struct list_head batch_cache;
};
diff --git a/drivers/soc/qcom/rpmh-rsc.c b/drivers/soc/qcom/rpmh-rsc.c
index f84a399fa5dc..7a210f924af8 100644
--- a/drivers/soc/qcom/rpmh-rsc.c
+++ b/drivers/soc/qcom/rpmh-rsc.c
@@ -986,6 +986,12 @@ static void rpmh_rsc_cpu_pm_unregister(void *data)
cpu_pm_unregister_notifier(data);
}
+static bool rpmh_rsc_no_rpmh_read(void)
+{
+ return of_machine_is_compatible("qcom,sm8150") ||
+ of_machine_is_compatible("qcom,sc8180x");
+}
+
static int rpmh_probe_tcs_config(struct platform_device *pdev, struct rsc_drv *drv)
{
struct tcs_type_config {
@@ -1155,6 +1161,7 @@ static int rpmh_rsc_probe(struct platform_device *pdev)
spin_lock_init(&drv->client.cache_lock);
INIT_LIST_HEAD(&drv->client.cache);
INIT_LIST_HEAD(&drv->client.batch_cache);
+ drv->client.no_rpmh_read = rpmh_rsc_no_rpmh_read();
dev_set_drvdata(&pdev->dev, drv);
drv->dev = &pdev->dev;
diff --git a/drivers/soc/qcom/rpmh.c b/drivers/soc/qcom/rpmh.c
index 360242a315e3..fed2ea06f490 100644
--- a/drivers/soc/qcom/rpmh.c
+++ b/drivers/soc/qcom/rpmh.c
@@ -240,12 +240,18 @@ int rpmh_read(const struct device *dev, struct tcs_cmd *cmd)
{
DECLARE_COMPLETION_ONSTACK(compl);
DEFINE_RPMH_MSG_ONSTACK(dev, RPMH_ACTIVE_ONLY_STATE, &compl, rpm_msg);
+ struct rpmh_ctrlr *ctrlr = get_rpmh_ctrlr(dev);
int ret;
ret = __fill_rpmh_msg(&rpm_msg, RPMH_ACTIVE_ONLY_STATE, cmd, 1, true);
if (ret)
return ret;
+ if (ctrlr->no_rpmh_read) {
+ cmd[0].data = 0;
+ return 0;
+ }
+
ret = __rpmh_write(dev, RPMH_ACTIVE_ONLY_STATE, &rpm_msg);
if (ret)
return ret;
--
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 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 2/2] soc: qcom: rpmh-rsc: Skip read requests on unsupported platforms
2026-09-10 8:53 ` [PATCH 2/2] soc: qcom: rpmh-rsc: Skip read requests on unsupported platforms Maulik Shah
@ 2026-09-10 9:14 ` Konrad Dybcio
0 siblings, 0 replies; 9+ messages in thread
From: Konrad Dybcio @ 2026-09-10 9:14 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:
> On some platforms AOSS do not respond to read requests. Read request in
> such cases will consume the ACTIVE TCS but forever waits for a response
> blocking the subsequent write requests.
>
> Skip issuing read commands on sm8150 and sc8180x platforms. For such
> platforms return success to the caller with the resource level at zero
> to avoid the caller taking any action on error code.
FWIW, *some* reads (e.g. RPMH_REGULATOR_REG_ENABLE) seem to work on 8180:
https://lore.kernel.org/linux-arm-msm/14bb6196-8274-4c94-922e-4ec8e2d7f2e5@oss.qualcomm.com/
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 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 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 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
end of thread, other threads:[~2026-09-11 8:14 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-10 8:53 [PATCH 0/2] soc: qcom: rpmh-rsc: Updates for RPMh read requests Maulik Shah
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
2026-09-11 8:14 ` Maulik Shah
2026-09-10 8:53 ` [PATCH 2/2] soc: qcom: rpmh-rsc: Skip read requests on unsupported platforms Maulik Shah
2026-09-10 9:14 ` Konrad Dybcio
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®