* [PATCH v2 0/2] soc: qcom: rpmh-rsc: Updates for RPMh read requests
@ 2026-09-11 9:08 Maulik Shah
2026-09-11 9:08 ` [PATCH v2 1/2] soc: qcom: rpmh-rsc: Update CMD_MSGID_LEN to 4 bytes for read request Maulik Shah
2026-09-11 9:08 ` [PATCH v2 2/2] soc: qcom: rpmh-rsc: Skip read requests on unsupported platforms Maulik Shah
0 siblings, 2 replies; 4+ messages in thread
From: Maulik Shah @ 2026-09-11 9:08 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Kamal Wadhwa, Dmitry Baryshkov,
Mark Brown
Cc: linux-arm-msm, linux-kernel, Konrad Dybcio, Maulik Shah, Mukesh Ojha
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 has no dependency. A Fixes tag is not required because existing
upstream SoCs use RSC versions older than v4.5. Patch 1 can be applied as
preparation for Hawi SoC support.
Patch 2 carries a Fixes tag. I do not have sm8150 or sc8180x hardware to
verify patch 2. If there are reports like [1] of read requests not working
on past SoCs, the list can be expanded in rpmh_rsc_no_rpmh_read().
[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>
---
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/20260910-rsc_read-v1-0-c9b7fa3cdde2@oss.qualcomm.com
To: Bjorn Andersson <andersson@kernel.org>
To: Konrad Dybcio <konradybcio@kernel.org>
To: Maulik Shah <maulik.shah@oss.qualcomm.com>
To: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
To: Mark Brown <broonie@kernel.org>
To: Kamal Wadhwa <kamal.wadhwa@oss.qualcomm.com>
Cc: linux-arm-msm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: Konrad Dybcio <konrad.dybcio@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 | 21 ++++++++++++++++++---
drivers/soc/qcom/rpmh.c | 6 ++++++
3 files changed, 26 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] 4+ messages in thread
* [PATCH v2 1/2] soc: qcom: rpmh-rsc: Update CMD_MSGID_LEN to 4 bytes for read request
2026-09-11 9:08 [PATCH v2 0/2] soc: qcom: rpmh-rsc: Updates for RPMh read requests Maulik Shah
@ 2026-09-11 9:08 ` Maulik Shah
2026-09-11 9:08 ` [PATCH v2 2/2] soc: qcom: rpmh-rsc: Skip read requests on unsupported platforms Maulik Shah
1 sibling, 0 replies; 4+ messages in thread
From: Maulik Shah @ 2026-09-11 9:08 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Kamal Wadhwa, Dmitry Baryshkov,
Mark Brown
Cc: linux-arm-msm, linux-kernel, Konrad Dybcio, Maulik Shah, Mukesh Ojha
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.
Tested-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com> #Hawi
Signed-off-by: Maulik Shah <maulik.shah@oss.qualcomm.com>
---
drivers/soc/qcom/rpmh-rsc.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/soc/qcom/rpmh-rsc.c b/drivers/soc/qcom/rpmh-rsc.c
index c4542318eac4..c5ed9874bb67 100644
--- a/drivers/soc/qcom/rpmh-rsc.c
+++ b/drivers/soc/qcom/rpmh-rsc.c
@@ -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;
--
2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 2/2] soc: qcom: rpmh-rsc: Skip read requests on unsupported platforms
2026-09-11 9:08 [PATCH v2 0/2] soc: qcom: rpmh-rsc: Updates for RPMh read requests Maulik Shah
2026-09-11 9:08 ` [PATCH v2 1/2] soc: qcom: rpmh-rsc: Update CMD_MSGID_LEN to 4 bytes for read request Maulik Shah
@ 2026-09-11 9:08 ` Maulik Shah
2026-09-21 14:29 ` Konrad Dybcio
1 sibling, 1 reply; 4+ messages in thread
From: Maulik Shah @ 2026-09-11 9:08 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 c5ed9874bb67..054122ccc46c 100644
--- a/drivers/soc/qcom/rpmh-rsc.c
+++ b/drivers/soc/qcom/rpmh-rsc.c
@@ -987,6 +987,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 {
@@ -1156,6 +1162,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] 4+ messages in thread
* Re: [PATCH v2 2/2] soc: qcom: rpmh-rsc: Skip read requests on unsupported platforms
2026-09-11 9:08 ` [PATCH v2 2/2] soc: qcom: rpmh-rsc: Skip read requests on unsupported platforms Maulik Shah
@ 2026-09-21 14:29 ` Konrad Dybcio
0 siblings, 0 replies; 4+ messages in thread
From: Konrad Dybcio @ 2026-09-21 14:29 UTC (permalink / raw)
To: Maulik Shah, Bjorn Andersson, Konrad Dybcio, Kamal Wadhwa,
Dmitry Baryshkov, Mark Brown
Cc: linux-arm-msm, linux-kernel
On 9/11/26 11:08 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.
>
> Fixes: edbafe65eef2 ("soc: qcom: rpmh: Add support to read back resource settings")
> Signed-off-by: Maulik Shah <maulik.shah@oss.qualcomm.com>
> ---
This works as an immediate fix, but I'd like to get some
comment on this:
https://lore.kernel.org/all/3058d570-aeb9-4f73-831c-c30626296006@oss.qualcomm.com/
[...]
> 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;
> + }
This should be -EOPNOTSUPP and consumers should handle it
appropriately
Konrad
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-09-21 14:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-11 9:08 [PATCH v2 0/2] soc: qcom: rpmh-rsc: Updates for RPMh read requests Maulik Shah
2026-09-11 9:08 ` [PATCH v2 1/2] soc: qcom: rpmh-rsc: Update CMD_MSGID_LEN to 4 bytes for read request Maulik Shah
2026-09-11 9:08 ` [PATCH v2 2/2] soc: qcom: rpmh-rsc: Skip read requests on unsupported platforms Maulik Shah
2026-09-21 14:29 ` 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®