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. Co-developed-by: Lina Iyer <ilina@codeaurora.org> Signed-off-by: Lina Iyer <ilina@codeaurora.org> Signed-off-by: Abel Vesa <abel.vesa@linaro.org> Signed-off-by: Bjorn Andersson <andersson@kernel.org> Link: https://lore.kernel.org/r/20221116112246.2640648-2-abel.vesa@linaro.org
This commit is contained in:
parent
40482e4f73
commit
323dc2dcdb
|
@ -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__ */
|
||||
|
|
|
@ -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 @@ skip:
|
|||
spin_unlock(&drv->lock);
|
||||
wake_up(&drv->tcs_wait);
|
||||
if (req)
|
||||
rpmh_tx_done(req, err);
|
||||
rpmh_tx_done(req);
|
||||
}
|
||||
|
||||
return IRQ_HANDLED;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue