linux-stable/drivers/hwtracing/coresight
James Clark a77616f5a3 coresight: Fix loss of connection info when a module is unloaded
[ Upstream commit c45b2835e7 ]

child_fwnode should be a read only property based on the DT or ACPI. If
it's cleared on the parent device when a child is unloaded, then when
the child is loaded again the connection won't be remade.

child_dev should be cleared instead which signifies that the connection
should be remade when the child_fwnode registers a new coresight_device.

Similarly the reference count shouldn't be decremented as long as the
parent device exists. The correct place to drop the reference is in
coresight_release_platform_data() which is already done.

Reproducible on Juno with the following steps:

  # load all coresight modules.
  $ cd /sys/bus/coresight/devices/
  $ echo 1 > tmc_etr0/enable_sink
  $ echo 1 > etm0/enable_source
  # Works fine ^

  $ echo 0 > etm0/enable_source
  $ rmmod coresight-funnel
  $ modprobe coresight-funnel
  $ echo 1 > etm0/enable_source
  -bash: echo: write error: Invalid argument

Fixes: 37ea1ffddf ("coresight: Use fwnode handle instead of device names")
Fixes: 2af89ebacf ("coresight: Clear the connection field properly")
Tested-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Reviewed-by: Mike Leach <mike.leach@linaro.org>
Signed-off-by: James Clark <james.clark@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20230425143542.2305069-2-james.clark@arm.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-07-23 13:47:23 +02:00
..
coresight-catu.c
coresight-catu.h
coresight-cfg-afdo.c
coresight-cfg-preload.c
coresight-cfg-preload.h
coresight-config.c
coresight-config.h
coresight-core.c coresight: Fix loss of connection info when a module is unloaded 2023-07-23 13:47:23 +02:00
coresight-cpu-debug.c
coresight-cti-core.c coresight: cti: Prevent negative values of enable count 2023-03-10 09:39:36 +01:00
coresight-cti-platform.c
coresight-cti-sysfs.c coresight: cti: Add PM runtime call in enable_store 2023-03-10 09:39:36 +01:00
coresight-cti.h
coresight-etb10.c
coresight-etm-cp14.c
coresight-etm-perf.c coresight: etm_pmu: Set the module field 2023-05-11 23:00:33 +09:00
coresight-etm-perf.h
coresight-etm.h
coresight-etm3x-core.c
coresight-etm3x-sysfs.c
coresight-etm4x-cfg.c
coresight-etm4x-cfg.h
coresight-etm4x-core.c coresight-etm4: Fix for() loop drvdata->nr_addr_cmp range bug 2023-04-13 16:48:23 +02:00
coresight-etm4x-sysfs.c
coresight-etm4x.h coresight: etm4x: Do not access TRCIDR1 for identification 2023-04-13 16:48:23 +02:00
coresight-funnel.c
coresight-platform.c
coresight-priv.h
coresight-replicator.c
coresight-stm.c
coresight-syscfg-configfs.c
coresight-syscfg-configfs.h
coresight-syscfg.c
coresight-syscfg.h
coresight-sysfs.c
coresight-tmc-core.c
coresight-tmc-etf.c
coresight-tmc-etr.c coresight: Fix signedness bug in tmc_etr_buf_insert_barrier_packet() 2023-05-30 13:55:32 +01:00
coresight-tmc.h
coresight-tpiu.c
coresight-trbe.c coresight: trbe: remove cpuhp instance node before remove cpuhp state 2022-12-31 13:14:30 +01:00
coresight-trbe.h
Kconfig
Makefile