soc: qcom: rpmh-rsc: Add support for RSC v3 register offsets
Subsystems (2)
PATCH 1/2 soc: qcom: rpmh-rsc: Add support for RSC v3 register offsets
The SM8550 RSC has a new set of register offsets due to its version bump. So read the version from HW and use the proper register offsets based on that.
--- drivers/soc/qcom/rpmh-internal.h | 7 ++ drivers/soc/qcom/rpmh-rsc.c | 161 ++++++++++++++++++++----------- 2 files changed, 110 insertions(+), 58 deletions(-)
drivers/soc/qcom/rpmh-internal.h +7 -0
@@ -86,6 +86,11 @@ struct rpmh_ctrlr {struct list_head batch_cache; }; +struct rsc_ver { +u32 major; +u32 minor; +}; +/** * struct rsc_drv: the Direct Resource Voter (DRV) of the * Resource State Coordinator controller (RSC)
@@ -129,6 +134,8 @@ struct rsc_drv {wait_queue_head_t tcs_wait;struct rpmh_ctrlr client;struct device *dev; +struct rsc_ver ver; +u32 *regs; };int rpmh_rsc_send_data (struct rsc_drv *drv,const struct tcs_request *msg);
drivers/soc/qcom/rpmh-rsc.c +103 -58
300 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH 2/2 soc: qcom: rpmh-rsc: Avoid unnecessary checks on irq-done response
The RSC interrupt is issued only after the request is complete. For fire-n-forget requests, the irq-done interrupt is sent after issuing the RPMH request and for response-required request, the interrupt is triggered only after all the requests are complete.
These unnecessary checks in the interrupt handler issues AHB reads from a critical path. Lets remove them and clean up error handling in rpmh_request data structures.
--- drivers/soc/qcom/rpmh-internal.h | 4 +--- drivers/soc/qcom/rpmh-rsc.c | 22 +++------------------- drivers/soc/qcom/rpmh.c | 10 ++-------- drivers/soc/qcom/trace-rpmh.h | 11 ++++------- 4 files changed, 10 insertions(+), 37 deletions(-)
drivers/soc/qcom/rpmh-internal.h +1 -3
@@ -59,7 +59,6 @@ struct tcs_group {* @cmd: the payload that will be part of the @msg * @completion: triggered when request is done * @dev: the device making the request -* @err: err return from the controller * @needs_free: check to free dynamically allocated request object */ struct rpmh_request {
@@ -67,7 +66,6 @@ struct rpmh_request {struct tcs_cmd cmd[MAX_RPMH_PAYLOAD ];struct completion *completion;const struct device *dev; -int err;bool needs_free; };
@@ -144,7 +142,7 @@ int rpmh_rsc_write_ctrl_data(struct rsc_drv *drv,void rpmh_rsc_invalidate (struct rsc_drv *drv);void rpmh_rsc_write_next_wakeup (struct rsc_drv *drv); -void rpmh_tx_done (const struct tcs_request *msg,int r); +void rpmh_tx_done (const struct tcs_request *msg);int rpmh_flush (struct rpmh_ctrlr *ctrlr);#endif /* __RPM_INTERNAL_H__ */
drivers/soc/qcom/rpmh-rsc.c +3 -19
@@ -439,10 +439,9 @@ static void enable_tcs_irq(struct rsc_drv *drv, int tcs_id, bool enable)static irqreturn_t tcs_tx_done (int irq,void *p) {struct rsc_drv *drv = p; -int i, j, err =0 ; +int i;unsigned long irq_status;const struct tcs_request *req; -struct tcs_cmd *cmd; irq_status =readl_relaxed (drv->tcs_base + drv->regs[RSC_DRV_IRQ_STATUS ]);
@@ -451,22 +450,7 @@ static irqreturn_t tcs_tx_done(int irq, void *p)if (WARN_ON (!req)) goto skip; - err =0 ; -for (j =0 ; j < req->num_cmds; j++) { -u32 sts; - - cmd = &req->cmds[j]; - sts =read_tcs_cmd (drv, drv->regs[RSC_DRV_CMD_STATUS ], i, j); -if (!(sts &CMD_STATUS_ISSUED ) || - ((req->wait_for_compl || cmd->wait) && - !(sts &CMD_STATUS_COMPL ))) { -pr_err ("Incomplete request: %s: addr=%#x data=%#x" , - drv->name, cmd->addr, cmd->data); - err = -EIO ; - } - } - -trace_rpmh_tx_done (drv, i, req, err); +trace_rpmh_tx_done (drv, i, req);/* * If wake tcs was re-purposed for sending active
@@ -491,7 +475,7 @@ static irqreturn_t tcs_tx_done(int irq, void *p)spin_unlock (&drv->lock);wake_up (&drv->tcs_wait);if (req) -rpmh_tx_done (req, err); +rpmh_tx_done (req); }return IRQ_HANDLED ;
drivers/soc/qcom/rpmh.c +2 -8
@@ -76,19 +76,13 @@ static struct rpmh_ctrlr *get_rpmh_ctrlr(const struct device *dev)return &drv->client; } -void rpmh_tx_done (const struct tcs_request *msg,int r) +void rpmh_tx_done (const struct tcs_request *msg) { struct rpmh_request *rpm_msg = container_of(msg, struct rpmh_request, msg);struct completion *compl = rpm_msg->completion;bool free = rpm_msg->needs_free; - rpm_msg->err = r; - -if (r) -dev_err (rpm_msg->dev,"RPMH TX fail in msg addr=%#x, err=%d\n" , - rpm_msg->msg.cmds[0 ].addr, r); -if (!compl) goto exit;
@@ -194,7 +188,7 @@ static int __rpmh_write(const struct device *dev, enum rpmh_state state, }else {/* Clean up our call by spoofing tx_done */ ret =0 ; -rpmh_tx_done (&rpm_msg->msg, ret); +rpmh_tx_done (&rpm_msg->msg); }return ret;
drivers/soc/qcom/trace-rpmh.h +4 -7
@@ -14,16 +14,15 @@ TRACE_EVENT(rpmh_tx_done, - TP_PROTO(struct rsc_drv *d, int m, const struct tcs_request *r, int e), + TP_PROTO(struct rsc_drv *d, int m, const struct tcs_request *r), - TP_ARGS(d, m, r, e), + TP_ARGS(d, m, r), TP_STRUCT__entry( __string(name, d->name) __field(int, m) __field(u32, addr) __field(u32, data) - __field(int, err) ), TP_fast_assign(
@@ -31,12 +30,10 @@ TRACE_EVENT(rpmh_tx_done, __entry->m = m; __entry->addr = r->cmds[0 ].addr; __entry->data = r->cmds[0 ].data; - __entry->err = e; ), -TP_printk ("%s: ack: tcs-m: %d addr: %#x data: %#x errno: %d" , -__get_str (name), __entry->m, __entry->addr, __entry->data, - __entry->err) +TP_printk ("%s: ack: tcs-m: %d addr: %#x data: %#x" , +__get_str (name), __entry->m, __entry->addr, __entry->data) ); TRACE_EVENT(rpmh_send_msg,
Signature · 1 line
2.34.1
Re: (subset) [PATCH 1/2] soc: qcom: rpmh-rsc: Add support for RSC v3 register offsets
In reply to Abel VesaQuoted 5 lines · Abel Vesa
The SM8550 RSC has a new set of register offsets due to its version bump. So read the version from HW and use the proper register offsets based on that.
Applied, thanks!
[1/2] soc: qcom: rpmh-rsc: Add support for RSC v3 register offsets
commit: 40482e4f73640dcf7bebcb503f034828b998c39c
[2/2] soc: qcom: rpmh-rsc: Avoid unnecessary checks on irq-done response
commit: 323dc2dcdb503323097855174908b52d84477760Best regards,
Signature · 1 line
Bjorn Andersson <[email protected]>