From 8ff0d62cc3f151fdd2b8ef1e5aa673191c4d5fea Mon Sep 17 00:00:00 2001 From: Maulik Shah Date: Mon, 9 May 2022 13:12:40 +0530 Subject: [PATCH] soc: qcom: rpmh-rsc: Add fast-path TCS to debug dump When we crash the system and display the TCS controller state, let's also dump the fast-path TCS information if there was an active transaction going on at that time. Change-Id: Iabc7b8af22dd148fca617e571f1392ba3d9a93ab Signed-off-by: Maulik Shah --- drivers/soc/qcom/rpmh-rsc.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/soc/qcom/rpmh-rsc.c b/drivers/soc/qcom/rpmh-rsc.c index bc54853e4b4b..cbcfcb0ed4c9 100644 --- a/drivers/soc/qcom/rpmh-rsc.c +++ b/drivers/soc/qcom/rpmh-rsc.c @@ -760,14 +760,14 @@ static void print_tcs_info(struct rsc_drv *drv, int tcs_id, unsigned long *accl, bool in_use = test_bit(tcs_id, drv->tcs_in_use); int i; - if (!tcs_grp || !req) - return; - sts = read_tcs_reg(drv, RSC_DRV_STATUS, tcs_id); cmds_enabled = read_tcs_reg(drv, RSC_DRV_CMD_ENABLE, tcs_id); if (!cmds_enabled) return; + if (!tcs_grp || !req) + goto print_tcs_data; + data = read_tcs_reg(drv, RSC_DRV_CONTROL, tcs_id); irq_sts = readl_relaxed(drv->tcs_base + RSC_DRV_IRQ_STATUS); pr_warn("Request: tcs-in-use:%s active_tcs=%s(%d) state=%d wait_for_compl=%u]\n", @@ -780,6 +780,7 @@ static void print_tcs_info(struct rsc_drv *drv, int tcs_id, unsigned long *accl, *aoss_irq_sts = (irq_sts & BIT(tcs_id)) ? true : false; +print_tcs_data: for_each_set_bit(i, &cmds_enabled, MAX_CMDS_PER_TCS) { addr = read_tcs_cmd(drv, RSC_DRV_CMD_ADDR, tcs_id, i); data = read_tcs_cmd(drv, RSC_DRV_CMD_DATA, tcs_id, i); @@ -834,6 +835,17 @@ void rpmh_rsc_debug(struct rsc_drv *drv, struct completion *compl) else if (gic_irq_sts) pr_warn("ERROR:Possible lockup in Linux\n"); + /* Show fast path status, if the TCS is busy */ + if (drv->tcs[FAST_PATH_TCS].num_tcs) { + int tcs_id = drv->tcs[FAST_PATH_TCS].offset; + bool sts = read_tcs_reg(drv, RSC_DRV_STATUS, tcs_id); + + if (!sts) { + pr_err("Fast-path TCS information:\n"); + print_tcs_info(drv, tcs_id, &accl, &aoss_irq_sts); + } + } + /* * The TCS(s) are busy waiting, we have no way to recover from this. * If this debug function is called, we assume it's because timeout