Suzuki K Poulose
80624263fa
coresight: cti: Initialize dynamic sysfs attributes
...
With LOCKDEP enabled, CTI driver triggers the following splat due
to uninitialized lock class for dynamically allocated attribute
objects.
[ 5.372901] coresight etm0: CPU0: ETM v4.0 initialized
[ 5.376694] coresight etm1: CPU1: ETM v4.0 initialized
[ 5.380785] coresight etm2: CPU2: ETM v4.0 initialized
[ 5.385851] coresight etm3: CPU3: ETM v4.0 initialized
[ 5.389808] BUG: key ffff00000564a798 has not been registered!
[ 5.392456] ------------[ cut here ]------------
[ 5.398195] DEBUG_LOCKS_WARN_ON(1)
[ 5.398233] WARNING: CPU: 1 PID: 32 at kernel/locking/lockdep.c:4623 lockdep_init_map_waits+0x14c/0x260
[ 5.406149] Modules linked in:
[ 5.415411] CPU: 1 PID: 32 Comm: kworker/1:1 Not tainted 5.9.0-12034-gbbe85027ce80 #51
[ 5.418553] Hardware name: Qualcomm Technologies, Inc. APQ 8016 SBC (DT)
[ 5.426453] Workqueue: events amba_deferred_retry_func
[ 5.433299] pstate: 40000005 (nZcv daif -PAN -UAO -TCO BTYPE=--)
[ 5.438252] pc : lockdep_init_map_waits+0x14c/0x260
[ 5.444410] lr : lockdep_init_map_waits+0x14c/0x260
[ 5.449007] sp : ffff800012bbb720
...
[ 5.531561] Call trace:
[ 5.536847] lockdep_init_map_waits+0x14c/0x260
[ 5.539027] __kernfs_create_file+0xa8/0x1c8
[ 5.543539] sysfs_add_file_mode_ns+0xd0/0x208
[ 5.548054] internal_create_group+0x118/0x3c8
[ 5.552307] internal_create_groups+0x58/0xb8
[ 5.556733] sysfs_create_groups+0x2c/0x38
[ 5.561160] device_add+0x2d8/0x768
[ 5.565148] device_register+0x28/0x38
[ 5.568537] coresight_register+0xf8/0x320
[ 5.572358] cti_probe+0x1b0/0x3f0
...
Fix this by initializing the attributes when they are allocated.
Fixes: 3c5597e398 ("coresight: cti: Add connection information to sysfs")
Reported-by: Leo Yan <leo.yan@linaro.org >
Tested-by: Leo Yan <leo.yan@linaro.org >
Cc: Mike Leach <mike.leach@linaro.org >
Cc: Mathieu Poirier <mathieu.poirier@linaro.org >
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com >
Cc: stable <stable@vger.kernel.org >
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org >
Link: https://lore.kernel.org/r/20201029164559.1268531-2-mathieu.poirier@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-10-29 20:10:25 +01:00
Stephen Boyd
298754c56c
coresight: Include required headers in C files
...
We should include headers that C files use in the C files that use them
and avoid relying on implicit includes as much as possible. This helps
avoid compiler errors in the future about missing declarations when
header files change includes in the future.
Cc: Douglas Anderson <dianders@chromium.org >
Cc: Suzuki K Poulose <suzuki.poulose@arm.com >
Cc: Mike Leach <mike.leach@linaro.org >
Signed-off-by: Stephen Boyd <swboyd@chromium.org >
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org >
Link: https://lore.kernel.org/r/20200518180242.7916-20-mathieu.poirier@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-05-19 16:31:18 +02:00
Stephen Boyd
0e34dc7618
coresight: Don't initialize variables unnecessarily
...
These variables are assigned again before they're used. Leave them
unassigned at first so that the compiler can detect problems in the
future with use before initialization.
Cc: Suzuki K Poulose <suzuki.poulose@arm.com >
Cc: Mike Leach <mike.leach@linaro.org >
Signed-off-by: Stephen Boyd <swboyd@chromium.org >
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org >
Link: https://lore.kernel.org/r/20200518180242.7916-18-mathieu.poirier@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-05-19 16:31:17 +02:00
Stephen Boyd
e54d9c77d2
coresight: Mark some functions static
...
These functions aren't used outside the file they're in. Mark them
static to indicate as such and silence tools like sparse.
Cc: Suzuki K Poulose <suzuki.poulose@arm.com >
Cc: Mike Leach <mike.leach@linaro.org >
Signed-off-by: Stephen Boyd <swboyd@chromium.org >
[Dropped changes in coresight-cti.c and coresight-etb10.c]
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org >
Link: https://lore.kernel.org/r/20200518180242.7916-17-mathieu.poirier@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-05-19 16:31:17 +02:00
Mike Leach
3c5597e398
coresight: cti: Add connection information to sysfs
...
Dynamically adds sysfs attributes for all connections defined in the CTI.
Each connection has a triggers<N> sub-directory with name, in_signals,
in_types, out_signals and out_types as read-only parameters in the
directory. in_ or out_ parameters may be omitted if there are no in or
out signals for the connection.
Additionally each device has a nr_cons in the connections sub-directory.
This allows clients to explore the connection and trigger signal details
without needing to refer to device tree or specification of the device.
Standardised type information is provided for certain common functions -
e.g. snk_full for a trigger from a sink indicating full. Otherwise type
defaults to genio.
Signed-off-by: Mike Leach <mike.leach@linaro.org >
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com >
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org >
Link: https://lore.kernel.org/r/20200320165303.13681-10-mathieu.poirier@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-03-21 11:32:20 +01:00
Mike Leach
a5614770ab
coresight: cti: Add device tree support for custom CTI
...
Adds support for CTIs whose connections are implementation defined at
hardware design time, and not constrained by v8 architecture.
These CTIs have no standard connection setup, all the settings have to
be defined in the device tree files. The patch creates a set of connections
and trigger signals based on the information provided.
Signed-off-by: Mike Leach <mike.leach@linaro.org >
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com >
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org >
Link: https://lore.kernel.org/r/20200320165303.13681-8-mathieu.poirier@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-03-21 11:32:20 +01:00
Mike Leach
1bf82857b4
coresight: cti: Add sysfs trigger / channel programming API
...
Adds a user API to allow programming of CTI by trigger ID and
channel number. This will take the channel and trigger ID supplied
by the user and program the appropriate register values.
Signed-off-by: Mike Leach <mike.leach@linaro.org >
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com >
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org >
Link: https://lore.kernel.org/r/20200320165303.13681-5-mathieu.poirier@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-03-21 11:32:19 +01:00
Mike Leach
b5213376c2
coresight: cti: Add sysfs access to program function registers
...
Adds in sysfs programming support for the CTI function register sets.
Allows direct manipulation of channel / trigger association registers.
Signed-off-by: Mike Leach <mike.leach@linaro.org >
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com >
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org >
Link: https://lore.kernel.org/r/20200320165303.13681-4-mathieu.poirier@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-03-21 11:32:18 +01:00
Mike Leach
1a556ca6cc
coresight: cti: Add sysfs coresight mgmt register access
...
Adds sysfs access to the coresight management registers.
Signed-off-by: Mike Leach <mike.leach@linaro.org >
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com >
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org >
Link: https://lore.kernel.org/r/20200320165303.13681-3-mathieu.poirier@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-03-21 11:32:18 +01:00
Mike Leach
835d722ba1
coresight: cti: Initial CoreSight CTI Driver
...
This introduces a baseline CTI driver and associated configuration files.
Uses the platform agnostic naming standard for CoreSight devices, along
with a generic platform probing method that currently supports device
tree descriptions, but allows for the ACPI bindings to be added once these
have been defined for the CTI devices.
Driver will probe for the device on the AMBA bus, and load the CTI driver
on CoreSight ID match to CTI IDs in tables.
Initial sysfs support for enable / disable provided.
Default CTI interconnection data is generated based on hardware
register signal counts, with no additional connection information.
Signed-off-by: Mike Leach <mike.leach@linaro.org >
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com >
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org >
Link: https://lore.kernel.org/r/20200320165303.13681-2-mathieu.poirier@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2020-03-21 11:32:18 +01:00