2018-05-10 02:06:04 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2012, The Linux Foundation. All rights reserved.
|
2014-11-04 02:07:35 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _LINUX_CORESIGHT_H
|
|
|
|
#define _LINUX_CORESIGHT_H
|
|
|
|
|
|
|
|
#include <linux/device.h>
|
2016-02-18 08:51:57 +08:00
|
|
|
#include <linux/perf_event.h>
|
2015-07-31 23:37:30 +08:00
|
|
|
#include <linux/sched.h>
|
2014-11-04 02:07:35 +08:00
|
|
|
|
|
|
|
/* Peripheral id registers (0xFD0-0xFEC) */
|
|
|
|
#define CORESIGHT_PERIPHIDR4 0xfd0
|
|
|
|
#define CORESIGHT_PERIPHIDR5 0xfd4
|
|
|
|
#define CORESIGHT_PERIPHIDR6 0xfd8
|
|
|
|
#define CORESIGHT_PERIPHIDR7 0xfdC
|
|
|
|
#define CORESIGHT_PERIPHIDR0 0xfe0
|
|
|
|
#define CORESIGHT_PERIPHIDR1 0xfe4
|
|
|
|
#define CORESIGHT_PERIPHIDR2 0xfe8
|
|
|
|
#define CORESIGHT_PERIPHIDR3 0xfeC
|
|
|
|
/* Component id registers (0xFF0-0xFFC) */
|
|
|
|
#define CORESIGHT_COMPIDR0 0xff0
|
|
|
|
#define CORESIGHT_COMPIDR1 0xff4
|
|
|
|
#define CORESIGHT_COMPIDR2 0xff8
|
|
|
|
#define CORESIGHT_COMPIDR3 0xffC
|
|
|
|
|
|
|
|
#define ETM_ARCH_V3_3 0x23
|
|
|
|
#define ETM_ARCH_V3_5 0x25
|
|
|
|
#define PFT_ARCH_V1_0 0x30
|
|
|
|
#define PFT_ARCH_V1_1 0x31
|
|
|
|
|
|
|
|
#define CORESIGHT_UNLOCK 0xc5acce55
|
|
|
|
|
|
|
|
extern struct bus_type coresight_bustype;
|
|
|
|
|
|
|
|
enum coresight_dev_type {
|
|
|
|
CORESIGHT_DEV_TYPE_NONE,
|
|
|
|
CORESIGHT_DEV_TYPE_SINK,
|
|
|
|
CORESIGHT_DEV_TYPE_LINK,
|
|
|
|
CORESIGHT_DEV_TYPE_LINKSINK,
|
|
|
|
CORESIGHT_DEV_TYPE_SOURCE,
|
coresight: Add helper device type
Add a new coresight device type, which do not belong to any
of the existing types, i.e, source, sink, link etc. A helper
device could be connected to a coresight device, which could
augment the functionality of the coresight device.
This is intended to cover Coresight Address Translation Unit (CATU)
devices, which provide improved Scatter Gather mechanism for TMC
ETR. The idea is that the helper device could be controlled by
the driver of the device it is attached to (in this case ETR),
transparent to the generic coresight driver (and paths).
The operations include enable(), disable(), both of which could
accept a device specific "data" which the driving device and
the helper device could share. Since they don't appear in the
coresight "path" tracked by software, we have to ensure that
they are powered up/down whenever the master device is turned
on.
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-12 03:40:30 +08:00
|
|
|
CORESIGHT_DEV_TYPE_HELPER,
|
2020-03-21 00:52:52 +08:00
|
|
|
CORESIGHT_DEV_TYPE_ECT,
|
2014-11-04 02:07:35 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
enum coresight_dev_subtype_sink {
|
|
|
|
CORESIGHT_DEV_SUBTYPE_SINK_NONE,
|
|
|
|
CORESIGHT_DEV_SUBTYPE_SINK_PORT,
|
|
|
|
CORESIGHT_DEV_SUBTYPE_SINK_BUFFER,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum coresight_dev_subtype_link {
|
|
|
|
CORESIGHT_DEV_SUBTYPE_LINK_NONE,
|
|
|
|
CORESIGHT_DEV_SUBTYPE_LINK_MERG,
|
|
|
|
CORESIGHT_DEV_SUBTYPE_LINK_SPLIT,
|
|
|
|
CORESIGHT_DEV_SUBTYPE_LINK_FIFO,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum coresight_dev_subtype_source {
|
|
|
|
CORESIGHT_DEV_SUBTYPE_SOURCE_NONE,
|
|
|
|
CORESIGHT_DEV_SUBTYPE_SOURCE_PROC,
|
|
|
|
CORESIGHT_DEV_SUBTYPE_SOURCE_BUS,
|
|
|
|
CORESIGHT_DEV_SUBTYPE_SOURCE_SOFTWARE,
|
|
|
|
};
|
|
|
|
|
coresight: Add helper device type
Add a new coresight device type, which do not belong to any
of the existing types, i.e, source, sink, link etc. A helper
device could be connected to a coresight device, which could
augment the functionality of the coresight device.
This is intended to cover Coresight Address Translation Unit (CATU)
devices, which provide improved Scatter Gather mechanism for TMC
ETR. The idea is that the helper device could be controlled by
the driver of the device it is attached to (in this case ETR),
transparent to the generic coresight driver (and paths).
The operations include enable(), disable(), both of which could
accept a device specific "data" which the driving device and
the helper device could share. Since they don't appear in the
coresight "path" tracked by software, we have to ensure that
they are powered up/down whenever the master device is turned
on.
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-12 03:40:30 +08:00
|
|
|
enum coresight_dev_subtype_helper {
|
|
|
|
CORESIGHT_DEV_SUBTYPE_HELPER_NONE,
|
2018-07-12 03:40:31 +08:00
|
|
|
CORESIGHT_DEV_SUBTYPE_HELPER_CATU,
|
coresight: Add helper device type
Add a new coresight device type, which do not belong to any
of the existing types, i.e, source, sink, link etc. A helper
device could be connected to a coresight device, which could
augment the functionality of the coresight device.
This is intended to cover Coresight Address Translation Unit (CATU)
devices, which provide improved Scatter Gather mechanism for TMC
ETR. The idea is that the helper device could be controlled by
the driver of the device it is attached to (in this case ETR),
transparent to the generic coresight driver (and paths).
The operations include enable(), disable(), both of which could
accept a device specific "data" which the driving device and
the helper device could share. Since they don't appear in the
coresight "path" tracked by software, we have to ensure that
they are powered up/down whenever the master device is turned
on.
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-12 03:40:30 +08:00
|
|
|
};
|
|
|
|
|
2020-03-21 00:52:52 +08:00
|
|
|
/* Embedded Cross Trigger (ECT) sub-types */
|
|
|
|
enum coresight_dev_subtype_ect {
|
|
|
|
CORESIGHT_DEV_SUBTYPE_ECT_NONE,
|
|
|
|
CORESIGHT_DEV_SUBTYPE_ECT_CTI,
|
|
|
|
};
|
|
|
|
|
2014-11-04 02:07:35 +08:00
|
|
|
/**
|
2018-07-12 03:40:29 +08:00
|
|
|
* union coresight_dev_subtype - further characterisation of a type
|
2014-11-04 02:07:35 +08:00
|
|
|
* @sink_subtype: type of sink this component is, as defined
|
2018-07-12 03:40:29 +08:00
|
|
|
* by @coresight_dev_subtype_sink.
|
2014-11-04 02:07:35 +08:00
|
|
|
* @link_subtype: type of link this component is, as defined
|
2018-07-12 03:40:29 +08:00
|
|
|
* by @coresight_dev_subtype_link.
|
2014-11-04 02:07:35 +08:00
|
|
|
* @source_subtype: type of source this component is, as defined
|
2018-07-12 03:40:29 +08:00
|
|
|
* by @coresight_dev_subtype_source.
|
coresight: Add helper device type
Add a new coresight device type, which do not belong to any
of the existing types, i.e, source, sink, link etc. A helper
device could be connected to a coresight device, which could
augment the functionality of the coresight device.
This is intended to cover Coresight Address Translation Unit (CATU)
devices, which provide improved Scatter Gather mechanism for TMC
ETR. The idea is that the helper device could be controlled by
the driver of the device it is attached to (in this case ETR),
transparent to the generic coresight driver (and paths).
The operations include enable(), disable(), both of which could
accept a device specific "data" which the driving device and
the helper device could share. Since they don't appear in the
coresight "path" tracked by software, we have to ensure that
they are powered up/down whenever the master device is turned
on.
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-12 03:40:30 +08:00
|
|
|
* @helper_subtype: type of helper this component is, as defined
|
|
|
|
* by @coresight_dev_subtype_helper.
|
2020-03-21 00:52:52 +08:00
|
|
|
* @ect_subtype: type of cross trigger this component is, as
|
|
|
|
* defined by @coresight_dev_subtype_ect
|
2014-11-04 02:07:35 +08:00
|
|
|
*/
|
2018-07-12 03:40:29 +08:00
|
|
|
union coresight_dev_subtype {
|
|
|
|
/* We have some devices which acts as LINK and SINK */
|
|
|
|
struct {
|
|
|
|
enum coresight_dev_subtype_sink sink_subtype;
|
|
|
|
enum coresight_dev_subtype_link link_subtype;
|
|
|
|
};
|
2014-11-04 02:07:35 +08:00
|
|
|
enum coresight_dev_subtype_source source_subtype;
|
coresight: Add helper device type
Add a new coresight device type, which do not belong to any
of the existing types, i.e, source, sink, link etc. A helper
device could be connected to a coresight device, which could
augment the functionality of the coresight device.
This is intended to cover Coresight Address Translation Unit (CATU)
devices, which provide improved Scatter Gather mechanism for TMC
ETR. The idea is that the helper device could be controlled by
the driver of the device it is attached to (in this case ETR),
transparent to the generic coresight driver (and paths).
The operations include enable(), disable(), both of which could
accept a device specific "data" which the driving device and
the helper device could share. Since they don't appear in the
coresight "path" tracked by software, we have to ensure that
they are powered up/down whenever the master device is turned
on.
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-12 03:40:30 +08:00
|
|
|
enum coresight_dev_subtype_helper helper_subtype;
|
2020-03-21 00:52:52 +08:00
|
|
|
enum coresight_dev_subtype_ect ect_subtype;
|
2014-11-04 02:07:35 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
coresight: Fix support for sparsely populated ports
On some systems the firmware may not describe all the ports
connected to a component (e.g, for security reasons). This
could be especially problematic for "funnels" where we could
end up in modifying memory beyond the allocated space for
refcounts.
e.g, for a funnel with input ports listed 0, 3, 5, nr_inport = 3.
However the we could access refcnts[5] while checking for
references, like :
[ 526.110401] ==================================================================
[ 526.117988] BUG: KASAN: slab-out-of-bounds in funnel_enable+0x54/0x1b0
[ 526.124706] Read of size 4 at addr ffffff8135f9549c by task bash/1114
[ 526.131324]
[ 526.132886] CPU: 3 PID: 1114 Comm: bash Tainted: G S 5.4.25 #232
[ 526.140397] Hardware name: Qualcomm Technologies, Inc. SC7180 IDP (DT)
[ 526.147113] Call trace:
[ 526.149653] dump_backtrace+0x0/0x188
[ 526.153431] show_stack+0x20/0x2c
[ 526.156852] dump_stack+0xdc/0x144
[ 526.160370] print_address_description+0x3c/0x494
[ 526.165211] __kasan_report+0x144/0x168
[ 526.169170] kasan_report+0x10/0x18
[ 526.172769] check_memory_region+0x1a4/0x1b4
[ 526.177164] __kasan_check_read+0x18/0x24
[ 526.181292] funnel_enable+0x54/0x1b0
[ 526.185072] coresight_enable_path+0x104/0x198
[ 526.189649] coresight_enable+0x118/0x26c
...
[ 526.237782] Allocated by task 280:
[ 526.241298] __kasan_kmalloc+0xf0/0x1ac
[ 526.245249] kasan_kmalloc+0xc/0x14
[ 526.248849] __kmalloc+0x28c/0x3b4
[ 526.252361] coresight_register+0x88/0x250
[ 526.256587] funnel_probe+0x15c/0x228
[ 526.260365] dynamic_funnel_probe+0x20/0x2c
[ 526.264679] amba_probe+0xbc/0x158
[ 526.268193] really_probe+0x144/0x408
[ 526.271970] driver_probe_device+0x70/0x140
...
[ 526.316810]
[ 526.318364] Freed by task 0:
[ 526.321344] (stack is not available)
[ 526.325024]
[ 526.326580] The buggy address belongs to the object at ffffff8135f95480
[ 526.326580] which belongs to the cache kmalloc-128 of size 128
[ 526.339439] The buggy address is located 28 bytes inside of
[ 526.339439] 128-byte region [ffffff8135f95480, ffffff8135f95500)
[ 526.351399] The buggy address belongs to the page:
[ 526.356342] page:ffffffff04b7e500 refcount:1 mapcount:0 mapping:ffffff814b00c380 index:0x0 compound_mapcount: 0
[ 526.366711] flags: 0x4000000000010200(slab|head)
[ 526.371475] raw: 4000000000010200 ffffffff05034008 ffffffff0501eb08 ffffff814b00c380
[ 526.379435] raw: 0000000000000000 0000000000190019 00000001ffffffff 0000000000000000
[ 526.387393] page dumped because: kasan: bad access detected
[ 526.393128]
[ 526.394681] Memory state around the buggy address:
[ 526.399619] ffffff8135f95380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[ 526.407046] ffffff8135f95400: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[ 526.414473] >ffffff8135f95480: 04 fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[ 526.421900] ^
[ 526.426029] ffffff8135f95500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[ 526.433456] ffffff8135f95580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[ 526.440883] ==================================================================
To keep the code simple, we now track the maximum number of
possible input/output connections to/from this component
@ nr_inport and nr_outport in platform_data, respectively.
Thus the output connections could be sparse and code is
adjusted to skip the unspecified connections.
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Mike Leach <mike.leach@linaro.org>
Reported-by: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
Tested-by: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
Tested-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Link: https://lore.kernel.org/r/20200518180242.7916-13-mathieu.poirier@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-05-19 02:02:31 +08:00
|
|
|
* struct coresight_platform_data - data harvested from the firmware
|
|
|
|
* specification.
|
|
|
|
*
|
|
|
|
* @nr_inport: Number of elements for the input connections.
|
|
|
|
* @nr_outport: Number of elements for the output connections.
|
|
|
|
* @conns: Sparse array of nr_outport connections from this component.
|
2014-11-04 02:07:35 +08:00
|
|
|
*/
|
|
|
|
struct coresight_platform_data {
|
|
|
|
int nr_inport;
|
|
|
|
int nr_outport;
|
2018-09-21 03:17:42 +08:00
|
|
|
struct coresight_connection *conns;
|
2014-11-04 02:07:35 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct coresight_desc - description of a component required from drivers
|
|
|
|
* @type: as defined by @coresight_dev_type.
|
|
|
|
* @subtype: as defined by @coresight_dev_subtype.
|
|
|
|
* @ops: generic operations for this component, as defined
|
2019-06-20 03:52:57 +08:00
|
|
|
* by @coresight_ops.
|
2014-11-04 02:07:35 +08:00
|
|
|
* @pdata: platform data collected from DT.
|
|
|
|
* @dev: The device entity associated to this component.
|
2014-11-13 16:42:48 +08:00
|
|
|
* @groups: operations specific to this component. These will end up
|
2019-06-20 03:52:57 +08:00
|
|
|
* in the component's sysfs sub-directory.
|
|
|
|
* @name: name for the coresight device, also shown under sysfs.
|
2014-11-04 02:07:35 +08:00
|
|
|
*/
|
|
|
|
struct coresight_desc {
|
|
|
|
enum coresight_dev_type type;
|
2018-07-12 03:40:29 +08:00
|
|
|
union coresight_dev_subtype subtype;
|
2014-11-04 02:07:35 +08:00
|
|
|
const struct coresight_ops *ops;
|
|
|
|
struct coresight_platform_data *pdata;
|
|
|
|
struct device *dev;
|
|
|
|
const struct attribute_group **groups;
|
2019-06-20 03:52:57 +08:00
|
|
|
const char *name;
|
2014-11-04 02:07:35 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct coresight_connection - representation of a single connection
|
|
|
|
* @outport: a connection's output port number.
|
|
|
|
* @child_port: remote component's port number @output is connected to.
|
2019-06-20 03:53:03 +08:00
|
|
|
* @chid_fwnode: remote component's fwnode handle.
|
2014-11-04 02:07:35 +08:00
|
|
|
* @child_dev: a @coresight_device representation of the component
|
|
|
|
connected to @outport.
|
2020-05-19 02:02:23 +08:00
|
|
|
* @link: Representation of the connection as a sysfs link.
|
2014-11-04 02:07:35 +08:00
|
|
|
*/
|
|
|
|
struct coresight_connection {
|
|
|
|
int outport;
|
|
|
|
int child_port;
|
2019-06-20 03:53:03 +08:00
|
|
|
struct fwnode_handle *child_fwnode;
|
2014-11-04 02:07:35 +08:00
|
|
|
struct coresight_device *child_dev;
|
2020-05-19 02:02:23 +08:00
|
|
|
struct coresight_sysfs_link *link;
|
2014-11-04 02:07:35 +08:00
|
|
|
};
|
|
|
|
|
2020-05-19 02:02:22 +08:00
|
|
|
/**
|
|
|
|
* struct coresight_sysfs_link - representation of a connection in sysfs.
|
|
|
|
* @orig: Originating (master) coresight device for the link.
|
|
|
|
* @orig_name: Name to use for the link orig->target.
|
|
|
|
* @target: Target (slave) coresight device for the link.
|
|
|
|
* @target_name: Name to use for the link target->orig.
|
|
|
|
*/
|
|
|
|
struct coresight_sysfs_link {
|
|
|
|
struct coresight_device *orig;
|
|
|
|
const char *orig_name;
|
|
|
|
struct coresight_device *target;
|
|
|
|
const char *target_name;
|
|
|
|
};
|
|
|
|
|
2014-11-04 02:07:35 +08:00
|
|
|
/**
|
|
|
|
* struct coresight_device - representation of a device as used by the framework
|
2019-06-20 03:52:59 +08:00
|
|
|
* @pdata: Platform data with device connections associated to this device.
|
2014-11-04 02:07:35 +08:00
|
|
|
* @type: as defined by @coresight_dev_type.
|
|
|
|
* @subtype: as defined by @coresight_dev_subtype.
|
|
|
|
* @ops: generic operations for this component, as defined
|
|
|
|
by @coresight_ops.
|
|
|
|
* @dev: The device entity associated to this component.
|
|
|
|
* @refcnt: keep track of what is in use.
|
|
|
|
* @orphan: true if the component has connections that haven't been linked.
|
|
|
|
* @enable: 'true' if component is currently part of an active path.
|
|
|
|
* @activated: 'true' only if a _sink_ has been activated. A sink can be
|
coresight: perf: Add "sinks" group to PMU directory
Add a "sinks" directory entry so that users can see all the sinks
available in the system in a single place. Individual sink are added
as they are registered with the coresight bus.
Committer tests:
Test built on a ubuntu 18.04 container with a cross build environment to
arm64, the new field is there, need to find a machine with this feature
to do further testing in the future.
root@d15263e5734a:/git/perf# grep CORESIGHT /tmp/build/v5.0-rc2+/.config
CONFIG_CORESIGHT=y
CONFIG_CORESIGHT_LINKS_AND_SINKS=y
CONFIG_CORESIGHT_LINK_AND_SINK_TMC=y
CONFIG_CORESIGHT_CATU=y
CONFIG_CORESIGHT_SINK_TPIU=y
CONFIG_CORESIGHT_SINK_ETBV10=y
CONFIG_CORESIGHT_SOURCE_ETM4X=y
CONFIG_CORESIGHT_DYNAMIC_REPLICATOR=y
CONFIG_CORESIGHT_STM=y
CONFIG_CORESIGHT_CPU_DEBUG=m
root@d15263e5734a:/git/perf#
root@d15263e5734a:/git/perf# file /tmp/build/v5.0-rc2+/drivers/hwtracing/coresight/*.o
.../coresight/coresight-catu.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-cpu-debug.mod.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-cpu-debug.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-dynamic-replicator.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-etb10.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-etm-perf.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-etm4x-sysfs.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-etm4x.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-funnel.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-replicator.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-stm.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-tmc-etf.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-tmc-etr.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-tmc.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-tpiu.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/of_coresight.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
root@d15263e5734a:/git/perf#
root@d15263e5734a:/git/perf# pahole -C coresight_device /tmp/build/v5.0-rc2+/drivers/hwtracing/coresight/coresight.o
struct coresight_device {
struct coresight_connection * conns; /* 0 8 */
int nr_inport; /* 8 4 */
int nr_outport; /* 12 4 */
enum coresight_dev_type type; /* 16 4 */
union coresight_dev_subtype subtype; /* 20 8 */
/* XXX 4 bytes hole, try to pack */
const struct coresight_ops * ops; /* 32 8 */
struct device dev; /* 40 1408 */
/* XXX last struct has 7 bytes of padding */
/* --- cacheline 22 boundary (1408 bytes) was 40 bytes ago --- */
atomic_t * refcnt; /* 1448 8 */
bool orphan; /* 1456 1 */
bool enable; /* 1457 1 */
bool activated; /* 1458 1 */
/* XXX 5 bytes hole, try to pack */
struct dev_ext_attribute * ea; /* 1464 8 */
/* size: 1472, cachelines: 23, members: 12 */
/* sum members: 1463, holes: 2, sum holes: 9 */
/* paddings: 1, sum paddings: 7 */
};
root@d15263e5734a:/git/perf#
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Will Deacon <will.deacon@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-s390@vger.kernel.org
Link: http://lkml.kernel.org/r/20190131184714.20388-3-mathieu.poirier@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-02-01 02:47:09 +08:00
|
|
|
* activated but not yet enabled. Enabling for a _sink_
|
2020-07-17 01:57:40 +08:00
|
|
|
* happens when a source has been selected and a path is enabled
|
|
|
|
* from source to that sink.
|
coresight: perf: Add "sinks" group to PMU directory
Add a "sinks" directory entry so that users can see all the sinks
available in the system in a single place. Individual sink are added
as they are registered with the coresight bus.
Committer tests:
Test built on a ubuntu 18.04 container with a cross build environment to
arm64, the new field is there, need to find a machine with this feature
to do further testing in the future.
root@d15263e5734a:/git/perf# grep CORESIGHT /tmp/build/v5.0-rc2+/.config
CONFIG_CORESIGHT=y
CONFIG_CORESIGHT_LINKS_AND_SINKS=y
CONFIG_CORESIGHT_LINK_AND_SINK_TMC=y
CONFIG_CORESIGHT_CATU=y
CONFIG_CORESIGHT_SINK_TPIU=y
CONFIG_CORESIGHT_SINK_ETBV10=y
CONFIG_CORESIGHT_SOURCE_ETM4X=y
CONFIG_CORESIGHT_DYNAMIC_REPLICATOR=y
CONFIG_CORESIGHT_STM=y
CONFIG_CORESIGHT_CPU_DEBUG=m
root@d15263e5734a:/git/perf#
root@d15263e5734a:/git/perf# file /tmp/build/v5.0-rc2+/drivers/hwtracing/coresight/*.o
.../coresight/coresight-catu.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-cpu-debug.mod.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-cpu-debug.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-dynamic-replicator.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-etb10.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-etm-perf.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-etm4x-sysfs.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-etm4x.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-funnel.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-replicator.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-stm.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-tmc-etf.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-tmc-etr.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-tmc.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-tpiu.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/of_coresight.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
root@d15263e5734a:/git/perf#
root@d15263e5734a:/git/perf# pahole -C coresight_device /tmp/build/v5.0-rc2+/drivers/hwtracing/coresight/coresight.o
struct coresight_device {
struct coresight_connection * conns; /* 0 8 */
int nr_inport; /* 8 4 */
int nr_outport; /* 12 4 */
enum coresight_dev_type type; /* 16 4 */
union coresight_dev_subtype subtype; /* 20 8 */
/* XXX 4 bytes hole, try to pack */
const struct coresight_ops * ops; /* 32 8 */
struct device dev; /* 40 1408 */
/* XXX last struct has 7 bytes of padding */
/* --- cacheline 22 boundary (1408 bytes) was 40 bytes ago --- */
atomic_t * refcnt; /* 1448 8 */
bool orphan; /* 1456 1 */
bool enable; /* 1457 1 */
bool activated; /* 1458 1 */
/* XXX 5 bytes hole, try to pack */
struct dev_ext_attribute * ea; /* 1464 8 */
/* size: 1472, cachelines: 23, members: 12 */
/* sum members: 1463, holes: 2, sum holes: 9 */
/* paddings: 1, sum paddings: 7 */
};
root@d15263e5734a:/git/perf#
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Will Deacon <will.deacon@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-s390@vger.kernel.org
Link: http://lkml.kernel.org/r/20190131184714.20388-3-mathieu.poirier@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-02-01 02:47:09 +08:00
|
|
|
* @ea: Device attribute for sink representation under PMU directory.
|
2020-03-21 00:52:59 +08:00
|
|
|
* @ect_dev: Associated cross trigger device. Not part of the trace data
|
|
|
|
* path or connections.
|
2020-05-19 02:02:22 +08:00
|
|
|
* @nr_links: number of sysfs links created to other components from this
|
|
|
|
* device. These will appear in the "connections" group.
|
|
|
|
* @has_conns_grp: Have added a "connections" group for sysfs links.
|
2014-11-04 02:07:35 +08:00
|
|
|
*/
|
|
|
|
struct coresight_device {
|
2019-06-20 03:52:59 +08:00
|
|
|
struct coresight_platform_data *pdata;
|
2014-11-04 02:07:35 +08:00
|
|
|
enum coresight_dev_type type;
|
2018-07-12 03:40:29 +08:00
|
|
|
union coresight_dev_subtype subtype;
|
2014-11-04 02:07:35 +08:00
|
|
|
const struct coresight_ops *ops;
|
|
|
|
struct device dev;
|
|
|
|
atomic_t *refcnt;
|
|
|
|
bool orphan;
|
|
|
|
bool enable; /* true only if configured as part of a path */
|
coresight: perf: Add "sinks" group to PMU directory
Add a "sinks" directory entry so that users can see all the sinks
available in the system in a single place. Individual sink are added
as they are registered with the coresight bus.
Committer tests:
Test built on a ubuntu 18.04 container with a cross build environment to
arm64, the new field is there, need to find a machine with this feature
to do further testing in the future.
root@d15263e5734a:/git/perf# grep CORESIGHT /tmp/build/v5.0-rc2+/.config
CONFIG_CORESIGHT=y
CONFIG_CORESIGHT_LINKS_AND_SINKS=y
CONFIG_CORESIGHT_LINK_AND_SINK_TMC=y
CONFIG_CORESIGHT_CATU=y
CONFIG_CORESIGHT_SINK_TPIU=y
CONFIG_CORESIGHT_SINK_ETBV10=y
CONFIG_CORESIGHT_SOURCE_ETM4X=y
CONFIG_CORESIGHT_DYNAMIC_REPLICATOR=y
CONFIG_CORESIGHT_STM=y
CONFIG_CORESIGHT_CPU_DEBUG=m
root@d15263e5734a:/git/perf#
root@d15263e5734a:/git/perf# file /tmp/build/v5.0-rc2+/drivers/hwtracing/coresight/*.o
.../coresight/coresight-catu.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-cpu-debug.mod.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-cpu-debug.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-dynamic-replicator.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-etb10.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-etm-perf.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-etm4x-sysfs.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-etm4x.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-funnel.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-replicator.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-stm.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-tmc-etf.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-tmc-etr.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-tmc.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-tpiu.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/of_coresight.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
root@d15263e5734a:/git/perf#
root@d15263e5734a:/git/perf# pahole -C coresight_device /tmp/build/v5.0-rc2+/drivers/hwtracing/coresight/coresight.o
struct coresight_device {
struct coresight_connection * conns; /* 0 8 */
int nr_inport; /* 8 4 */
int nr_outport; /* 12 4 */
enum coresight_dev_type type; /* 16 4 */
union coresight_dev_subtype subtype; /* 20 8 */
/* XXX 4 bytes hole, try to pack */
const struct coresight_ops * ops; /* 32 8 */
struct device dev; /* 40 1408 */
/* XXX last struct has 7 bytes of padding */
/* --- cacheline 22 boundary (1408 bytes) was 40 bytes ago --- */
atomic_t * refcnt; /* 1448 8 */
bool orphan; /* 1456 1 */
bool enable; /* 1457 1 */
bool activated; /* 1458 1 */
/* XXX 5 bytes hole, try to pack */
struct dev_ext_attribute * ea; /* 1464 8 */
/* size: 1472, cachelines: 23, members: 12 */
/* sum members: 1463, holes: 2, sum holes: 9 */
/* paddings: 1, sum paddings: 7 */
};
root@d15263e5734a:/git/perf#
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Will Deacon <will.deacon@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-s390@vger.kernel.org
Link: http://lkml.kernel.org/r/20190131184714.20388-3-mathieu.poirier@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-02-01 02:47:09 +08:00
|
|
|
/* sink specific fields */
|
2014-11-04 02:07:35 +08:00
|
|
|
bool activated; /* true only if a sink is part of a path */
|
coresight: perf: Add "sinks" group to PMU directory
Add a "sinks" directory entry so that users can see all the sinks
available in the system in a single place. Individual sink are added
as they are registered with the coresight bus.
Committer tests:
Test built on a ubuntu 18.04 container with a cross build environment to
arm64, the new field is there, need to find a machine with this feature
to do further testing in the future.
root@d15263e5734a:/git/perf# grep CORESIGHT /tmp/build/v5.0-rc2+/.config
CONFIG_CORESIGHT=y
CONFIG_CORESIGHT_LINKS_AND_SINKS=y
CONFIG_CORESIGHT_LINK_AND_SINK_TMC=y
CONFIG_CORESIGHT_CATU=y
CONFIG_CORESIGHT_SINK_TPIU=y
CONFIG_CORESIGHT_SINK_ETBV10=y
CONFIG_CORESIGHT_SOURCE_ETM4X=y
CONFIG_CORESIGHT_DYNAMIC_REPLICATOR=y
CONFIG_CORESIGHT_STM=y
CONFIG_CORESIGHT_CPU_DEBUG=m
root@d15263e5734a:/git/perf#
root@d15263e5734a:/git/perf# file /tmp/build/v5.0-rc2+/drivers/hwtracing/coresight/*.o
.../coresight/coresight-catu.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-cpu-debug.mod.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-cpu-debug.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-dynamic-replicator.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-etb10.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-etm-perf.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-etm4x-sysfs.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-etm4x.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-funnel.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-replicator.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-stm.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-tmc-etf.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-tmc-etr.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-tmc.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight-tpiu.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/coresight.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
.../coresight/of_coresight.o: ELF 64-bit MSB relocatable, ARM aarch64, version 1 (SYSV), not stripped
root@d15263e5734a:/git/perf#
root@d15263e5734a:/git/perf# pahole -C coresight_device /tmp/build/v5.0-rc2+/drivers/hwtracing/coresight/coresight.o
struct coresight_device {
struct coresight_connection * conns; /* 0 8 */
int nr_inport; /* 8 4 */
int nr_outport; /* 12 4 */
enum coresight_dev_type type; /* 16 4 */
union coresight_dev_subtype subtype; /* 20 8 */
/* XXX 4 bytes hole, try to pack */
const struct coresight_ops * ops; /* 32 8 */
struct device dev; /* 40 1408 */
/* XXX last struct has 7 bytes of padding */
/* --- cacheline 22 boundary (1408 bytes) was 40 bytes ago --- */
atomic_t * refcnt; /* 1448 8 */
bool orphan; /* 1456 1 */
bool enable; /* 1457 1 */
bool activated; /* 1458 1 */
/* XXX 5 bytes hole, try to pack */
struct dev_ext_attribute * ea; /* 1464 8 */
/* size: 1472, cachelines: 23, members: 12 */
/* sum members: 1463, holes: 2, sum holes: 9 */
/* paddings: 1, sum paddings: 7 */
};
root@d15263e5734a:/git/perf#
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Will Deacon <will.deacon@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-s390@vger.kernel.org
Link: http://lkml.kernel.org/r/20190131184714.20388-3-mathieu.poirier@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-02-01 02:47:09 +08:00
|
|
|
struct dev_ext_attribute *ea;
|
2020-03-21 00:52:59 +08:00
|
|
|
/* cross trigger handling */
|
|
|
|
struct coresight_device *ect_dev;
|
2020-05-19 02:02:22 +08:00
|
|
|
/* sysfs links between components */
|
|
|
|
int nr_links;
|
|
|
|
bool has_conns_grp;
|
2014-11-04 02:07:35 +08:00
|
|
|
};
|
|
|
|
|
2019-06-20 03:53:04 +08:00
|
|
|
/*
|
|
|
|
* coresight_dev_list - Mapping for devices to "name" index for device
|
|
|
|
* names.
|
|
|
|
*
|
|
|
|
* @nr_idx: Number of entries already allocated.
|
|
|
|
* @pfx: Prefix pattern for device name.
|
|
|
|
* @fwnode_list: Array of fwnode_handles associated with each allocated
|
|
|
|
* index, upto nr_idx entries.
|
|
|
|
*/
|
|
|
|
struct coresight_dev_list {
|
|
|
|
int nr_idx;
|
|
|
|
const char *pfx;
|
|
|
|
struct fwnode_handle **fwnode_list;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define DEFINE_CORESIGHT_DEVLIST(var, dev_pfx) \
|
|
|
|
static struct coresight_dev_list (var) = { \
|
|
|
|
.pfx = dev_pfx, \
|
|
|
|
.nr_idx = 0, \
|
|
|
|
.fwnode_list = NULL, \
|
|
|
|
}
|
|
|
|
|
2014-11-04 02:07:35 +08:00
|
|
|
#define to_coresight_device(d) container_of(d, struct coresight_device, dev)
|
|
|
|
|
|
|
|
#define source_ops(csdev) csdev->ops->source_ops
|
|
|
|
#define sink_ops(csdev) csdev->ops->sink_ops
|
|
|
|
#define link_ops(csdev) csdev->ops->link_ops
|
coresight: Add helper device type
Add a new coresight device type, which do not belong to any
of the existing types, i.e, source, sink, link etc. A helper
device could be connected to a coresight device, which could
augment the functionality of the coresight device.
This is intended to cover Coresight Address Translation Unit (CATU)
devices, which provide improved Scatter Gather mechanism for TMC
ETR. The idea is that the helper device could be controlled by
the driver of the device it is attached to (in this case ETR),
transparent to the generic coresight driver (and paths).
The operations include enable(), disable(), both of which could
accept a device specific "data" which the driving device and
the helper device could share. Since they don't appear in the
coresight "path" tracked by software, we have to ensure that
they are powered up/down whenever the master device is turned
on.
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-12 03:40:30 +08:00
|
|
|
#define helper_ops(csdev) csdev->ops->helper_ops
|
2020-03-21 00:52:52 +08:00
|
|
|
#define ect_ops(csdev) csdev->ops->ect_ops
|
2014-11-04 02:07:35 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* struct coresight_ops_sink - basic operations for a sink
|
|
|
|
* Operations available for sinks
|
2016-02-18 08:52:00 +08:00
|
|
|
* @enable: enables the sink.
|
|
|
|
* @disable: disables the sink.
|
|
|
|
* @alloc_buffer: initialises perf's ring buffer for trace collection.
|
|
|
|
* @free_buffer: release memory allocated in @get_config.
|
|
|
|
* @update_buffer: update buffer pointers after a trace session.
|
2014-11-04 02:07:35 +08:00
|
|
|
*/
|
|
|
|
struct coresight_ops_sink {
|
2018-09-21 03:17:56 +08:00
|
|
|
int (*enable)(struct coresight_device *csdev, u32 mode, void *data);
|
2019-04-26 03:52:55 +08:00
|
|
|
int (*disable)(struct coresight_device *csdev);
|
2019-04-26 03:53:01 +08:00
|
|
|
void *(*alloc_buffer)(struct coresight_device *csdev,
|
|
|
|
struct perf_event *event, void **pages,
|
|
|
|
int nr_pages, bool overwrite);
|
2016-02-18 08:52:00 +08:00
|
|
|
void (*free_buffer)(void *config);
|
2018-09-21 03:17:54 +08:00
|
|
|
unsigned long (*update_buffer)(struct coresight_device *csdev,
|
2016-02-18 08:52:00 +08:00
|
|
|
struct perf_output_handle *handle,
|
|
|
|
void *sink_config);
|
2014-11-04 02:07:35 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct coresight_ops_link - basic operations for a link
|
|
|
|
* Operations available for links.
|
|
|
|
* @enable: enables flow between iport and oport.
|
|
|
|
* @disable: disables flow between iport and oport.
|
|
|
|
*/
|
|
|
|
struct coresight_ops_link {
|
|
|
|
int (*enable)(struct coresight_device *csdev, int iport, int oport);
|
|
|
|
void (*disable)(struct coresight_device *csdev, int iport, int oport);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct coresight_ops_source - basic operations for a source
|
|
|
|
* Operations available for sources.
|
2016-02-03 05:14:01 +08:00
|
|
|
* @cpu_id: returns the value of the CPU number this component
|
|
|
|
* is associated to.
|
2014-11-04 02:07:35 +08:00
|
|
|
* @trace_id: returns the value of the component's trace ID as known
|
2016-02-18 08:51:57 +08:00
|
|
|
* to the HW.
|
2015-10-07 23:26:39 +08:00
|
|
|
* @enable: enables tracing for a source.
|
2014-11-04 02:07:35 +08:00
|
|
|
* @disable: disables tracing for a source.
|
|
|
|
*/
|
|
|
|
struct coresight_ops_source {
|
2016-02-03 05:14:01 +08:00
|
|
|
int (*cpu_id)(struct coresight_device *csdev);
|
2014-11-04 02:07:35 +08:00
|
|
|
int (*trace_id)(struct coresight_device *csdev);
|
2016-02-18 08:51:57 +08:00
|
|
|
int (*enable)(struct coresight_device *csdev,
|
2016-08-26 05:19:10 +08:00
|
|
|
struct perf_event *event, u32 mode);
|
|
|
|
void (*disable)(struct coresight_device *csdev,
|
|
|
|
struct perf_event *event);
|
2014-11-04 02:07:35 +08:00
|
|
|
};
|
|
|
|
|
coresight: Add helper device type
Add a new coresight device type, which do not belong to any
of the existing types, i.e, source, sink, link etc. A helper
device could be connected to a coresight device, which could
augment the functionality of the coresight device.
This is intended to cover Coresight Address Translation Unit (CATU)
devices, which provide improved Scatter Gather mechanism for TMC
ETR. The idea is that the helper device could be controlled by
the driver of the device it is attached to (in this case ETR),
transparent to the generic coresight driver (and paths).
The operations include enable(), disable(), both of which could
accept a device specific "data" which the driving device and
the helper device could share. Since they don't appear in the
coresight "path" tracked by software, we have to ensure that
they are powered up/down whenever the master device is turned
on.
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-12 03:40:30 +08:00
|
|
|
/**
|
|
|
|
* struct coresight_ops_helper - Operations for a helper device.
|
|
|
|
*
|
|
|
|
* All operations could pass in a device specific data, which could
|
|
|
|
* help the helper device to determine what to do.
|
|
|
|
*
|
|
|
|
* @enable : Enable the device
|
|
|
|
* @disable : Disable the device
|
|
|
|
*/
|
|
|
|
struct coresight_ops_helper {
|
|
|
|
int (*enable)(struct coresight_device *csdev, void *data);
|
|
|
|
int (*disable)(struct coresight_device *csdev, void *data);
|
|
|
|
};
|
|
|
|
|
2020-03-21 00:52:52 +08:00
|
|
|
/**
|
|
|
|
* struct coresight_ops_ect - Ops for an embedded cross trigger device
|
|
|
|
*
|
|
|
|
* @enable : Enable the device
|
|
|
|
* @disable : Disable the device
|
|
|
|
*/
|
|
|
|
struct coresight_ops_ect {
|
|
|
|
int (*enable)(struct coresight_device *csdev);
|
|
|
|
int (*disable)(struct coresight_device *csdev);
|
|
|
|
};
|
|
|
|
|
2014-11-04 02:07:35 +08:00
|
|
|
struct coresight_ops {
|
|
|
|
const struct coresight_ops_sink *sink_ops;
|
|
|
|
const struct coresight_ops_link *link_ops;
|
|
|
|
const struct coresight_ops_source *source_ops;
|
coresight: Add helper device type
Add a new coresight device type, which do not belong to any
of the existing types, i.e, source, sink, link etc. A helper
device could be connected to a coresight device, which could
augment the functionality of the coresight device.
This is intended to cover Coresight Address Translation Unit (CATU)
devices, which provide improved Scatter Gather mechanism for TMC
ETR. The idea is that the helper device could be controlled by
the driver of the device it is attached to (in this case ETR),
transparent to the generic coresight driver (and paths).
The operations include enable(), disable(), both of which could
accept a device specific "data" which the driving device and
the helper device could share. Since they don't appear in the
coresight "path" tracked by software, we have to ensure that
they are powered up/down whenever the master device is turned
on.
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-12 03:40:30 +08:00
|
|
|
const struct coresight_ops_helper *helper_ops;
|
2020-03-21 00:52:52 +08:00
|
|
|
const struct coresight_ops_ect *ect_ops;
|
2014-11-04 02:07:35 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef CONFIG_CORESIGHT
|
|
|
|
extern struct coresight_device *
|
|
|
|
coresight_register(struct coresight_desc *desc);
|
|
|
|
extern void coresight_unregister(struct coresight_device *csdev);
|
|
|
|
extern int coresight_enable(struct coresight_device *csdev);
|
|
|
|
extern void coresight_disable(struct coresight_device *csdev);
|
|
|
|
extern int coresight_timeout(void __iomem *addr, u32 offset,
|
|
|
|
int position, int value);
|
2018-09-21 03:18:11 +08:00
|
|
|
|
|
|
|
extern int coresight_claim_device(void __iomem *base);
|
|
|
|
extern int coresight_claim_device_unlocked(void __iomem *base);
|
|
|
|
|
|
|
|
extern void coresight_disclaim_device(void __iomem *base);
|
|
|
|
extern void coresight_disclaim_device_unlocked(void __iomem *base);
|
2019-06-20 03:53:04 +08:00
|
|
|
extern char *coresight_alloc_device_name(struct coresight_dev_list *devs,
|
|
|
|
struct device *dev);
|
2019-11-05 02:12:38 +08:00
|
|
|
|
|
|
|
extern bool coresight_loses_context_with_cpu(struct device *dev);
|
2014-11-04 02:07:35 +08:00
|
|
|
#else
|
|
|
|
static inline struct coresight_device *
|
|
|
|
coresight_register(struct coresight_desc *desc) { return NULL; }
|
|
|
|
static inline void coresight_unregister(struct coresight_device *csdev) {}
|
|
|
|
static inline int
|
|
|
|
coresight_enable(struct coresight_device *csdev) { return -ENOSYS; }
|
|
|
|
static inline void coresight_disable(struct coresight_device *csdev) {}
|
|
|
|
static inline int coresight_timeout(void __iomem *addr, u32 offset,
|
|
|
|
int position, int value) { return 1; }
|
2018-09-21 03:18:11 +08:00
|
|
|
static inline int coresight_claim_device_unlocked(void __iomem *base)
|
|
|
|
{
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int coresight_claim_device(void __iomem *base)
|
|
|
|
{
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void coresight_disclaim_device(void __iomem *base) {}
|
|
|
|
static inline void coresight_disclaim_device_unlocked(void __iomem *base) {}
|
|
|
|
|
2019-11-05 02:12:38 +08:00
|
|
|
static inline bool coresight_loses_context_with_cpu(struct device *dev)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2015-01-10 07:57:20 +08:00
|
|
|
#endif
|
|
|
|
|
2019-06-20 03:52:55 +08:00
|
|
|
extern int coresight_get_cpu(struct device *dev);
|
2014-11-04 02:07:35 +08:00
|
|
|
|
2019-06-20 03:52:54 +08:00
|
|
|
struct coresight_platform_data *coresight_get_platform_data(struct device *dev);
|
|
|
|
|
2014-11-04 02:07:35 +08:00
|
|
|
#endif
|