aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBhupesh Sharma <bhupesh.sharma@linaro.org>2022-08-04 00:42:36 +0530
committerBhupesh Sharma <bhupesh.sharma@linaro.org>2022-08-12 11:42:10 +0530
commit1bf9aa9996f30ea068be74794070209aaff0e6eb (patch)
tree7a2864a4e687024a88c65d041f5dc45ee1a30776
parentb9d96b77c2d9c6fe8bea06725c399280d9d7c152 (diff)
FROMLIST: coresight: etm4x: Fix crash observed on Qcom ETM parts with 'Low power override'
Some Qualcomm ETM implementations require skipping powering up the trace unit, as the ETMs are in the same power domain as their CPU cores. Via commit 5214b563588e ("coresight: etm4x: Add support for sysreg only devices"), the setting of 'skip_power_up' flag was moved after the 'etm4_init_arch_data' function is called, whereas the flag value is itself used inside the function. This causes a crash when ETM mode 'Low-power state behavior override' is set on some Qualcomm parts. Fix the same. Fixes: 5214b563588e ("coresight: etm4x: Add support for sysreg only devices") Cc: Mike Leach <mike.leach@linaro.org> Cc: Suzuki K Poulose <suzuki.poulose@arm.com> Cc: Mathieu Poirier <mathieu.poirier@linaro.org> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Bhupesh Sharma <bhupesh.sharma@linaro.org> (am from https://lore.kernel.org/linux-arm-kernel/20220803191236.3037591-1-bhupesh.sharma@linaro.org/) Signed-off-by: Bhupesh Sharma <bhupesh.sharma@linaro.org>
-rw-r--r--drivers/hwtracing/coresight/coresight-etm4x-core.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c
index e24252eaf8e4..46d010cc96f4 100644
--- a/drivers/hwtracing/coresight/coresight-etm4x-core.c
+++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c
@@ -1912,6 +1912,16 @@ static int etm4_probe(struct device *dev, void __iomem *base, u32 etm_pid)
init_arg.csa = &desc.access;
init_arg.pid = etm_pid;
+ /*
+ * Some Qualcomm implementations require skipping powering up the trace unit,
+ * as the ETMs are in the same power domain as their CPU cores.
+ *
+ * Since the 'skip_power_up' flag is used inside 'etm4_init_arch_data' function,
+ * initialize it before the function is called.
+ */
+ if (fwnode_property_present(dev_fwnode(dev), "qcom,skip-power-up"))
+ drvdata->skip_power_up = true;
+
if (smp_call_function_single(drvdata->cpu,
etm4_init_arch_data, &init_arg, 1))
dev_err(dev, "ETM arch init failed\n");
@@ -1920,8 +1930,7 @@ static int etm4_probe(struct device *dev, void __iomem *base, u32 etm_pid)
return -EINVAL;
/* TRCPDCR is not accessible with system instructions. */
- if (!desc.access.io_mem ||
- fwnode_property_present(dev_fwnode(dev), "qcom,skip-power-up"))
+ if (!desc.access.io_mem)
drvdata->skip_power_up = true;
major = ETM_ARCH_MAJOR_VERSION(drvdata->arch);