linux/drivers/hwtracing/coresight
Sai Prakash Ranjan 347adb0d63 coresight: tmc: Fix TMC mode read in tmc_read_prepare_etb()
On some QCOM platforms like SC7180, SDM845 and SM8150,
reading TMC mode register without proper coresight power
management can lead to async exceptions like the one in
the call trace below in tmc_read_prepare_etb(). This can
happen if the user tries to read the TMC etf data via
device node without setting up source and the sink first.
Fix this by having a check for coresight sysfs mode
before reading TMC mode management register.

 Kernel panic - not syncing: Asynchronous SError Interrupt
 CPU: 7 PID: 2605 Comm: hexdump Tainted: G S                5.4.30 #122
 Call trace:
  dump_backtrace+0x0/0x188
  show_stack+0x20/0x2c
  dump_stack+0xdc/0x144
  panic+0x168/0x36c
  panic+0x0/0x36c
  arm64_serror_panic+0x78/0x84
  do_serror+0x130/0x138
  el1_error+0x84/0xf8
  tmc_read_prepare_etb+0x88/0xb8
  tmc_open+0x40/0xd8
  misc_open+0x120/0x158
  chrdev_open+0xb8/0x1a4
  do_dentry_open+0x268/0x3a0
  vfs_open+0x34/0x40
  path_openat+0x39c/0xdf4
  do_filp_open+0x90/0x10c
  do_sys_open+0x150/0x3e8
  __arm64_compat_sys_openat+0x28/0x34
  el0_svc_common+0xa8/0x160
  el0_svc_compat_handler+0x2c/0x38
  el0_svc_compat+0x8/0x10

Fixes: 4525412a50 ("coresight: tmc: making prepare/unprepare functions generic")
Reported-by: Stephen Boyd <swboyd@chromium.org>
Suggested-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Link: https://lore.kernel.org/r/20200518180242.7916-14-mathieu.poirier@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-19 16:31:17 +02:00
..
coresight-catu.c coresight: Use platform agnostic names 2019-06-20 07:56:13 +02:00
coresight-catu.h coresight: catu: Cleanup device specific data 2019-06-19 20:29:14 +02:00
coresight-cpu-debug.c coresight: cpu-debug: Add support for Qualcomm Kryo 2019-09-03 22:01:15 +02:00
coresight-cti-platform.c coresight: cti: Add device tree support for custom CTI 2020-03-21 11:32:20 +01:00
coresight-cti-sysfs.c coresight: cti: Add connection information to sysfs 2020-03-21 11:32:20 +01:00
coresight-cti.c coresight: cti: Make some symbols static 2020-05-19 16:31:16 +02:00
coresight-cti.h coresight: cti: Add connection information to sysfs 2020-03-21 11:32:20 +01:00
coresight-etb10.c coresight: etb10: Make coresight_etb_groups static 2020-05-19 16:31:16 +02:00
coresight-etm3x-sysfs.c coresight: etm: Clean up device specific data 2019-06-19 20:29:14 +02:00
coresight-etm3x.c coresight: Do not default to CPU0 for missing CPU phandle 2019-07-04 12:23:26 +02:00
coresight-etm4x-sysfs.c coresight: etm4x: Fix BMVAL misuse 2019-11-04 21:57:58 +01:00
coresight-etm4x.c coresight: etm4x: Replace ETM PIDs with UCI IDs for Kryo385 2020-05-19 16:31:16 +02:00
coresight-etm4x.h coresight: etm4x: Add missing single-shot control API to sysfs 2019-11-04 21:57:56 +01:00
coresight-etm-cp14.c coresight: Moving framework and drivers to SPDX identifier 2018-05-14 16:19:59 +02:00
coresight-etm-perf.c coresight: Fix DEBUG_LOCKS_WARN_ON for uninitialized attribute 2019-08-01 20:51:34 +02:00
coresight-etm-perf.h coresight: perf: Add "sinks" group to PMU directory 2019-02-08 12:27:36 +01:00
coresight-etm.h coresight: etm: Clean up device specific data 2019-06-19 20:29:14 +02:00
coresight-funnel.c coresight: funnel: Fix missing spin_lock_init() 2019-11-19 19:18:15 +01:00
coresight-platform.c coresight: Fix support for sparsely populated ports 2020-05-19 16:31:16 +02:00
coresight-priv.h coresight: Expose device connections via sysfs 2020-05-19 16:31:15 +02:00
coresight-replicator.c coresight: replicator: Fix missing spin_lock_init() 2019-11-19 19:18:15 +01:00
coresight-stm.c coresight: stm: ACPI support for parsing stimulus base 2019-06-20 07:56:14 +02:00
coresight-sysfs.c coresight: Expose device connections via sysfs 2020-05-19 16:31:15 +02:00
coresight-tmc-etf.c coresight: tmc: Fix TMC mode read in tmc_read_prepare_etb() 2020-05-19 16:31:17 +02:00
coresight-tmc-etr.c coresight: tmc-etr: Add barrier packets when moving offset forward 2019-09-03 22:01:18 +02:00
coresight-tmc.c coresight: tmc: Make memory width mask computation into a function 2019-09-03 22:01:18 +02:00
coresight-tmc.h coresight: tmc: Make memory width mask computation into a function 2019-09-03 22:01:18 +02:00
coresight-tpiu.c coresight: Use platform agnostic names 2019-06-20 07:56:13 +02:00
coresight.c coresight: Fix support for sparsely populated ports 2020-05-19 16:31:16 +02:00
Kconfig coresight: cti: Add sysfs access to program function registers 2020-03-21 11:32:18 +01:00
Makefile coresight: Add generic sysfs link creation functions 2020-05-19 16:31:15 +02:00