2018-05-10 02:06:04 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
|
2014-11-04 02:07:35 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _CORESIGHT_PRIV_H
|
|
|
|
#define _CORESIGHT_PRIV_H
|
|
|
|
|
ARM: 8838/1: drivers: amba: Updates to component identification for driver matching.
The CoreSight specification (ARM IHI 0029E), updates the ID register
requirements for components on an AMBA bus, to cover both traditional
ARM Primecell type devices, and newer CoreSight and other components.
The Peripheral ID (PID) / Component ID (CID) pair is extended in certain
cases to uniquely identify components. CoreSight components related to
a single function can share Peripheral ID values, and must be further
identified using a Unique Component Identifier (UCI). e.g. the ETM, CTI,
PMU and Debug hardware of the A35 all share the same PID.
Bits 15:12 of the CID are defined to be the device class.
Class 0xF remains for PrimeCell and legacy components.
Class 0x9 defines the component as CoreSight (CORESIGHT_CID above)
Class 0x0, 0x1, 0xB, 0xE define components that do not have driver support
at present.
Class 0x2-0x8,0xA and 0xD-0xD are presently reserved.
The specification futher defines which classes of device use the standard
CID/PID pair, and when additional ID registers are required.
This patch introduces the amba_cs_uci_id structure which will be used in
all coresight drivers for indentification via the private data pointer in
the amba_id structure.
Existing drivers that currently use the amba_id->data pointer for private
data are updated to use the amba_cs_uci_id->data pointer. Macros and
inline functions are added to simplify this code.
Signed-off-by: Mike Leach <mike.leach@linaro.org>
Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Tested-by: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
2019-02-13 21:41:49 +08:00
|
|
|
#include <linux/amba/bus.h>
|
2014-11-04 02:07:35 +08:00
|
|
|
#include <linux/bitops.h>
|
|
|
|
#include <linux/io.h>
|
|
|
|
#include <linux/coresight.h>
|
2016-08-26 05:19:02 +08:00
|
|
|
#include <linux/pm_runtime.h>
|
2014-11-04 02:07:35 +08:00
|
|
|
|
2024-01-29 23:40:37 +08:00
|
|
|
extern struct mutex coresight_mutex;
|
|
|
|
extern struct device_type coresight_dev_type[];
|
|
|
|
|
2014-11-04 02:07:35 +08:00
|
|
|
/*
|
|
|
|
* Coresight management registers (0xf00-0xfcc)
|
|
|
|
* 0xfa0 - 0xfa4: Management registers in PFTv1.0
|
|
|
|
* Trace registers in PFTv1.1
|
|
|
|
*/
|
|
|
|
#define CORESIGHT_ITCTRL 0xf00
|
|
|
|
#define CORESIGHT_CLAIMSET 0xfa0
|
|
|
|
#define CORESIGHT_CLAIMCLR 0xfa4
|
|
|
|
#define CORESIGHT_LAR 0xfb0
|
|
|
|
#define CORESIGHT_LSR 0xfb4
|
2020-03-21 00:52:53 +08:00
|
|
|
#define CORESIGHT_DEVARCH 0xfbc
|
2014-11-04 02:07:35 +08:00
|
|
|
#define CORESIGHT_AUTHSTATUS 0xfb8
|
|
|
|
#define CORESIGHT_DEVID 0xfc8
|
|
|
|
#define CORESIGHT_DEVTYPE 0xfcc
|
|
|
|
|
2018-09-21 03:18:11 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Coresight device CLAIM protocol.
|
|
|
|
* See PSCI - ARM DEN 0022D, Section: 6.8.1 Debug and Trace save and restore.
|
|
|
|
*/
|
|
|
|
#define CORESIGHT_CLAIM_SELF_HOSTED BIT(1)
|
|
|
|
|
2014-11-04 02:07:35 +08:00
|
|
|
#define TIMEOUT_US 100
|
|
|
|
#define BMVAL(val, lsb, msb) ((val & GENMASK(msb, lsb)) >> lsb)
|
|
|
|
|
2016-02-18 08:51:56 +08:00
|
|
|
#define ETM_MODE_EXCL_KERN BIT(30)
|
|
|
|
#define ETM_MODE_EXCL_USER BIT(31)
|
2022-08-31 01:26:11 +08:00
|
|
|
struct cs_pair_attribute {
|
|
|
|
struct device_attribute attr;
|
2022-08-31 01:26:13 +08:00
|
|
|
u32 lo_off;
|
|
|
|
u32 hi_off;
|
2022-08-31 01:26:11 +08:00
|
|
|
};
|
|
|
|
|
2022-08-31 01:26:12 +08:00
|
|
|
struct cs_off_attribute {
|
|
|
|
struct device_attribute attr;
|
|
|
|
u32 off;
|
|
|
|
};
|
|
|
|
|
2022-08-31 01:26:13 +08:00
|
|
|
extern ssize_t coresight_simple_show32(struct device *_dev,
|
|
|
|
struct device_attribute *attr, char *buf);
|
|
|
|
extern ssize_t coresight_simple_show_pair(struct device *_dev,
|
2022-08-31 01:26:11 +08:00
|
|
|
struct device_attribute *attr, char *buf);
|
2016-02-18 08:51:56 +08:00
|
|
|
|
2022-08-31 01:26:11 +08:00
|
|
|
#define coresight_simple_reg32(name, offset) \
|
2022-08-31 01:26:13 +08:00
|
|
|
(&((struct cs_off_attribute[]) { \
|
2022-08-31 01:26:11 +08:00
|
|
|
{ \
|
2022-08-31 01:26:13 +08:00
|
|
|
__ATTR(name, 0444, coresight_simple_show32, NULL), \
|
|
|
|
offset \
|
2022-08-31 01:26:11 +08:00
|
|
|
} \
|
|
|
|
})[0].attr.attr)
|
2016-04-06 01:53:50 +08:00
|
|
|
|
2022-08-31 01:26:11 +08:00
|
|
|
#define coresight_simple_reg64(name, lo_off, hi_off) \
|
|
|
|
(&((struct cs_pair_attribute[]) { \
|
|
|
|
{ \
|
2022-08-31 01:26:13 +08:00
|
|
|
__ATTR(name, 0444, coresight_simple_show_pair, NULL), \
|
2022-08-31 01:26:11 +08:00
|
|
|
lo_off, hi_off \
|
|
|
|
} \
|
|
|
|
})[0].attr.attr)
|
2017-08-03 00:22:05 +08:00
|
|
|
|
2020-09-29 00:34:52 +08:00
|
|
|
extern const u32 coresight_barrier_pkt[4];
|
|
|
|
#define CORESIGHT_BARRIER_PKT_SIZE (sizeof(coresight_barrier_pkt))
|
2017-08-03 00:21:57 +08:00
|
|
|
|
2016-08-26 05:19:11 +08:00
|
|
|
enum etm_addr_type {
|
|
|
|
ETM_ADDR_TYPE_NONE,
|
|
|
|
ETM_ADDR_TYPE_SINGLE,
|
|
|
|
ETM_ADDR_TYPE_RANGE,
|
|
|
|
ETM_ADDR_TYPE_START,
|
|
|
|
ETM_ADDR_TYPE_STOP,
|
|
|
|
};
|
|
|
|
|
2016-05-04 01:33:58 +08:00
|
|
|
/**
|
|
|
|
* struct cs_buffer - keep track of a recording session' specifics
|
|
|
|
* @cur: index of the current buffer
|
|
|
|
* @nr_pages: max number of pages granted to us
|
coresight: tmc-etf: Fix NULL ptr dereference in tmc_enable_etf_sink_perf()
There was a report of NULL pointer dereference in ETF enable
path for perf CS mode with PID monitoring. It is almost 100%
reproducible when the process to monitor is something very
active such as chrome and with ETF as the sink and not ETR.
Currently in a bid to find the pid, the owner is dereferenced
via task_pid_nr() call in tmc_enable_etf_sink_perf() and with
owner being NULL, we get a NULL pointer dereference.
Looking at the ETR and other places in the kernel, ETF and the
ETB are the only places trying to dereference the task(owner)
in tmc_enable_etf_sink_perf() which is also called from the
sched_in path as in the call trace. Owner(task) is NULL even
in the case of ETR in tmc_enable_etr_sink_perf(), but since we
cache the PID in alloc_buffer() callback and it is done as part
of etm_setup_aux() when allocating buffer for ETR sink, we never
dereference this NULL pointer and we are safe. So lets do the
same thing with ETF and cache the PID to which the cs_buffer
belongs in tmc_alloc_etf_buffer() as done for ETR. This will
also remove the unnecessary function calls(task_pid_nr()) since
we are caching the PID.
Easily reproducible running below:
perf record -e cs_etm/@tmc_etf0/ -N -p <pid>
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000548
Mem abort info:
ESR = 0x96000006
EC = 0x25: DABT (current EL), IL = 32 bits
SET = 0, FnV = 0
EA = 0, S1PTW = 0
Data abort info:
ISV = 0, ISS = 0x00000006
CM = 0, WnR = 0
<snip>...
Call trace:
tmc_enable_etf_sink+0xe4/0x280
coresight_enable_path+0x168/0x1fc
etm_event_start+0x8c/0xf8
etm_event_add+0x38/0x54
event_sched_in+0x194/0x2ac
group_sched_in+0x54/0x12c
flexible_sched_in+0xd8/0x120
visit_groups_merge+0x100/0x16c
ctx_flexible_sched_in+0x50/0x74
ctx_sched_in+0xa4/0xa8
perf_event_sched_in+0x60/0x6c
perf_event_context_sched_in+0x98/0xe0
__perf_event_task_sched_in+0x5c/0xd8
finish_task_switch+0x184/0x1cc
schedule_tail+0x20/0xec
ret_from_fork+0x4/0x18
Fixes: 880af782c6e8 ("coresight: tmc-etf: Add support for CPU-wide trace scenarios")
Cc: stable@vger.kernel.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/20201127175256.1092685-10-mathieu.poirier@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-11-28 01:52:50 +08:00
|
|
|
* @pid: PID this cs_buffer belongs to
|
2016-05-04 01:33:58 +08:00
|
|
|
* @offset: offset within the current buffer
|
|
|
|
* @data_size: how much we collected in this run
|
|
|
|
* @snapshot: is this run in snapshot mode
|
|
|
|
* @data_pages: a handle the ring buffer
|
|
|
|
*/
|
|
|
|
struct cs_buffers {
|
|
|
|
unsigned int cur;
|
|
|
|
unsigned int nr_pages;
|
coresight: tmc-etf: Fix NULL ptr dereference in tmc_enable_etf_sink_perf()
There was a report of NULL pointer dereference in ETF enable
path for perf CS mode with PID monitoring. It is almost 100%
reproducible when the process to monitor is something very
active such as chrome and with ETF as the sink and not ETR.
Currently in a bid to find the pid, the owner is dereferenced
via task_pid_nr() call in tmc_enable_etf_sink_perf() and with
owner being NULL, we get a NULL pointer dereference.
Looking at the ETR and other places in the kernel, ETF and the
ETB are the only places trying to dereference the task(owner)
in tmc_enable_etf_sink_perf() which is also called from the
sched_in path as in the call trace. Owner(task) is NULL even
in the case of ETR in tmc_enable_etr_sink_perf(), but since we
cache the PID in alloc_buffer() callback and it is done as part
of etm_setup_aux() when allocating buffer for ETR sink, we never
dereference this NULL pointer and we are safe. So lets do the
same thing with ETF and cache the PID to which the cs_buffer
belongs in tmc_alloc_etf_buffer() as done for ETR. This will
also remove the unnecessary function calls(task_pid_nr()) since
we are caching the PID.
Easily reproducible running below:
perf record -e cs_etm/@tmc_etf0/ -N -p <pid>
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000548
Mem abort info:
ESR = 0x96000006
EC = 0x25: DABT (current EL), IL = 32 bits
SET = 0, FnV = 0
EA = 0, S1PTW = 0
Data abort info:
ISV = 0, ISS = 0x00000006
CM = 0, WnR = 0
<snip>...
Call trace:
tmc_enable_etf_sink+0xe4/0x280
coresight_enable_path+0x168/0x1fc
etm_event_start+0x8c/0xf8
etm_event_add+0x38/0x54
event_sched_in+0x194/0x2ac
group_sched_in+0x54/0x12c
flexible_sched_in+0xd8/0x120
visit_groups_merge+0x100/0x16c
ctx_flexible_sched_in+0x50/0x74
ctx_sched_in+0xa4/0xa8
perf_event_sched_in+0x60/0x6c
perf_event_context_sched_in+0x98/0xe0
__perf_event_task_sched_in+0x5c/0xd8
finish_task_switch+0x184/0x1cc
schedule_tail+0x20/0xec
ret_from_fork+0x4/0x18
Fixes: 880af782c6e8 ("coresight: tmc-etf: Add support for CPU-wide trace scenarios")
Cc: stable@vger.kernel.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/20201127175256.1092685-10-mathieu.poirier@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-11-28 01:52:50 +08:00
|
|
|
pid_t pid;
|
2016-05-04 01:33:58 +08:00
|
|
|
unsigned long offset;
|
|
|
|
local_t data_size;
|
|
|
|
bool snapshot;
|
|
|
|
void **data_pages;
|
|
|
|
};
|
|
|
|
|
2018-07-12 03:40:18 +08:00
|
|
|
static inline void coresight_insert_barrier_packet(void *buf)
|
|
|
|
{
|
|
|
|
if (buf)
|
2020-09-29 00:34:52 +08:00
|
|
|
memcpy(buf, coresight_barrier_pkt, CORESIGHT_BARRIER_PKT_SIZE);
|
2018-07-12 03:40:18 +08:00
|
|
|
}
|
|
|
|
|
2014-11-04 02:07:35 +08:00
|
|
|
static inline void CS_LOCK(void __iomem *addr)
|
|
|
|
{
|
|
|
|
do {
|
|
|
|
/* Wait for things to settle */
|
|
|
|
mb();
|
|
|
|
writel_relaxed(0x0, addr + CORESIGHT_LAR);
|
|
|
|
} while (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void CS_UNLOCK(void __iomem *addr)
|
|
|
|
{
|
|
|
|
do {
|
|
|
|
writel_relaxed(CORESIGHT_UNLOCK, addr + CORESIGHT_LAR);
|
2014-11-13 16:42:47 +08:00
|
|
|
/* Make sure everyone has seen this */
|
2014-11-04 02:07:35 +08:00
|
|
|
mb();
|
|
|
|
} while (0);
|
|
|
|
}
|
|
|
|
|
2016-02-18 08:51:45 +08:00
|
|
|
void coresight_disable_path(struct list_head *path);
|
2023-04-25 22:35:29 +08:00
|
|
|
int coresight_enable_path(struct list_head *path, enum cs_mode mode,
|
|
|
|
void *sink_data);
|
2016-02-18 08:51:46 +08:00
|
|
|
struct coresight_device *coresight_get_sink(struct list_head *path);
|
2019-02-01 02:47:10 +08:00
|
|
|
struct coresight_device *coresight_get_sink_by_id(u32 id);
|
2020-07-17 01:57:43 +08:00
|
|
|
struct coresight_device *
|
|
|
|
coresight_find_default_sink(struct coresight_device *csdev);
|
2016-11-30 00:47:14 +08:00
|
|
|
struct list_head *coresight_build_path(struct coresight_device *csdev,
|
|
|
|
struct coresight_device *sink);
|
2016-02-18 08:51:45 +08:00
|
|
|
void coresight_release_path(struct list_head *path);
|
2020-05-19 02:02:22 +08:00
|
|
|
int coresight_add_sysfs_link(struct coresight_sysfs_link *info);
|
|
|
|
void coresight_remove_sysfs_link(struct coresight_sysfs_link *info);
|
|
|
|
int coresight_create_conns_sysfs_group(struct coresight_device *csdev);
|
|
|
|
void coresight_remove_conns_sysfs_group(struct coresight_device *csdev);
|
2020-05-19 02:02:23 +08:00
|
|
|
int coresight_make_links(struct coresight_device *orig,
|
|
|
|
struct coresight_connection *conn,
|
|
|
|
struct coresight_device *target);
|
|
|
|
void coresight_remove_links(struct coresight_device *orig,
|
|
|
|
struct coresight_connection *conn);
|
2016-02-18 08:51:45 +08:00
|
|
|
|
2020-09-29 00:34:51 +08:00
|
|
|
#if IS_ENABLED(CONFIG_CORESIGHT_SOURCE_ETM3X)
|
2014-11-04 02:07:35 +08:00
|
|
|
extern int etm_readl_cp14(u32 off, unsigned int *val);
|
|
|
|
extern int etm_writel_cp14(u32 off, u32 val);
|
|
|
|
#else
|
|
|
|
static inline int etm_readl_cp14(u32 off, unsigned int *val) { return 0; }
|
2015-01-27 00:22:25 +08:00
|
|
|
static inline int etm_writel_cp14(u32 off, u32 val) { return 0; }
|
2014-11-04 02:07:35 +08:00
|
|
|
#endif
|
|
|
|
|
2020-09-29 00:35:04 +08:00
|
|
|
struct cti_assoc_op {
|
|
|
|
void (*add)(struct coresight_device *csdev);
|
|
|
|
void (*remove)(struct coresight_device *csdev);
|
|
|
|
};
|
2020-03-21 00:52:59 +08:00
|
|
|
|
2020-09-29 00:35:04 +08:00
|
|
|
extern void coresight_set_cti_ops(const struct cti_assoc_op *cti_op);
|
|
|
|
extern void coresight_remove_cti_ops(void);
|
2020-03-21 00:52:59 +08:00
|
|
|
|
ARM: 8838/1: drivers: amba: Updates to component identification for driver matching.
The CoreSight specification (ARM IHI 0029E), updates the ID register
requirements for components on an AMBA bus, to cover both traditional
ARM Primecell type devices, and newer CoreSight and other components.
The Peripheral ID (PID) / Component ID (CID) pair is extended in certain
cases to uniquely identify components. CoreSight components related to
a single function can share Peripheral ID values, and must be further
identified using a Unique Component Identifier (UCI). e.g. the ETM, CTI,
PMU and Debug hardware of the A35 all share the same PID.
Bits 15:12 of the CID are defined to be the device class.
Class 0xF remains for PrimeCell and legacy components.
Class 0x9 defines the component as CoreSight (CORESIGHT_CID above)
Class 0x0, 0x1, 0xB, 0xE define components that do not have driver support
at present.
Class 0x2-0x8,0xA and 0xD-0xD are presently reserved.
The specification futher defines which classes of device use the standard
CID/PID pair, and when additional ID registers are required.
This patch introduces the amba_cs_uci_id structure which will be used in
all coresight drivers for indentification via the private data pointer in
the amba_id structure.
Existing drivers that currently use the amba_id->data pointer for private
data are updated to use the amba_cs_uci_id->data pointer. Macros and
inline functions are added to simplify this code.
Signed-off-by: Mike Leach <mike.leach@linaro.org>
Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Tested-by: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
2019-02-13 21:41:49 +08:00
|
|
|
/*
|
|
|
|
* Macros and inline functions to handle CoreSight UCI data and driver
|
|
|
|
* private data in AMBA ID table entries, and extract data values.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* coresight AMBA ID, no UCI, no driver data: id table entry */
|
|
|
|
#define CS_AMBA_ID(pid) \
|
|
|
|
{ \
|
|
|
|
.id = pid, \
|
|
|
|
.mask = 0x000fffff, \
|
|
|
|
}
|
|
|
|
|
|
|
|
/* coresight AMBA ID, UCI with driver data only: id table entry. */
|
|
|
|
#define CS_AMBA_ID_DATA(pid, dval) \
|
|
|
|
{ \
|
|
|
|
.id = pid, \
|
|
|
|
.mask = 0x000fffff, \
|
|
|
|
.data = (void *)&(struct amba_cs_uci_id) \
|
|
|
|
{ \
|
|
|
|
.data = (void *)dval, \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
2019-02-13 21:41:51 +08:00
|
|
|
/* coresight AMBA ID, full UCI structure: id table entry. */
|
2023-06-05 21:30:30 +08:00
|
|
|
#define __CS_AMBA_UCI_ID(pid, m, uci_ptr) \
|
2019-08-30 04:28:28 +08:00
|
|
|
{ \
|
|
|
|
.id = pid, \
|
2023-06-05 21:30:30 +08:00
|
|
|
.mask = m, \
|
2019-08-30 04:28:28 +08:00
|
|
|
.data = (void *)uci_ptr \
|
2019-02-13 21:41:51 +08:00
|
|
|
}
|
2023-06-05 21:30:30 +08:00
|
|
|
#define CS_AMBA_UCI_ID(pid, uci) __CS_AMBA_UCI_ID(pid, 0x000fffff, uci)
|
|
|
|
/*
|
|
|
|
* PIDR2[JEDEC], BIT(3) must be 1 (Read As One) to indicate that rest of the
|
|
|
|
* PIDR1, PIDR2 DES_* fields follow JEDEC encoding for the designer. Use that
|
|
|
|
* as a match value for blanket matching all devices in the given CoreSight
|
|
|
|
* device type and architecture.
|
|
|
|
*/
|
|
|
|
#define PIDR2_JEDEC BIT(3)
|
|
|
|
#define PID_PIDR2_JEDEC (PIDR2_JEDEC << 16)
|
|
|
|
/*
|
|
|
|
* Match all PIDs in a given CoreSight device type and architecture, defined
|
|
|
|
* by the uci.
|
|
|
|
*/
|
|
|
|
#define CS_AMBA_MATCH_ALL_UCI(uci) \
|
|
|
|
__CS_AMBA_UCI_ID(PID_PIDR2_JEDEC, PID_PIDR2_JEDEC, uci)
|
2019-02-13 21:41:51 +08:00
|
|
|
|
ARM: 8838/1: drivers: amba: Updates to component identification for driver matching.
The CoreSight specification (ARM IHI 0029E), updates the ID register
requirements for components on an AMBA bus, to cover both traditional
ARM Primecell type devices, and newer CoreSight and other components.
The Peripheral ID (PID) / Component ID (CID) pair is extended in certain
cases to uniquely identify components. CoreSight components related to
a single function can share Peripheral ID values, and must be further
identified using a Unique Component Identifier (UCI). e.g. the ETM, CTI,
PMU and Debug hardware of the A35 all share the same PID.
Bits 15:12 of the CID are defined to be the device class.
Class 0xF remains for PrimeCell and legacy components.
Class 0x9 defines the component as CoreSight (CORESIGHT_CID above)
Class 0x0, 0x1, 0xB, 0xE define components that do not have driver support
at present.
Class 0x2-0x8,0xA and 0xD-0xD are presently reserved.
The specification futher defines which classes of device use the standard
CID/PID pair, and when additional ID registers are required.
This patch introduces the amba_cs_uci_id structure which will be used in
all coresight drivers for indentification via the private data pointer in
the amba_id structure.
Existing drivers that currently use the amba_id->data pointer for private
data are updated to use the amba_cs_uci_id->data pointer. Macros and
inline functions are added to simplify this code.
Signed-off-by: Mike Leach <mike.leach@linaro.org>
Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Tested-by: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
2019-02-13 21:41:49 +08:00
|
|
|
/* extract the data value from a UCI structure given amba_id pointer. */
|
|
|
|
static inline void *coresight_get_uci_data(const struct amba_id *id)
|
|
|
|
{
|
2020-05-19 02:02:39 +08:00
|
|
|
struct amba_cs_uci_id *uci_id = id->data;
|
|
|
|
|
|
|
|
if (!uci_id)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return uci_id->data;
|
ARM: 8838/1: drivers: amba: Updates to component identification for driver matching.
The CoreSight specification (ARM IHI 0029E), updates the ID register
requirements for components on an AMBA bus, to cover both traditional
ARM Primecell type devices, and newer CoreSight and other components.
The Peripheral ID (PID) / Component ID (CID) pair is extended in certain
cases to uniquely identify components. CoreSight components related to
a single function can share Peripheral ID values, and must be further
identified using a Unique Component Identifier (UCI). e.g. the ETM, CTI,
PMU and Debug hardware of the A35 all share the same PID.
Bits 15:12 of the CID are defined to be the device class.
Class 0xF remains for PrimeCell and legacy components.
Class 0x9 defines the component as CoreSight (CORESIGHT_CID above)
Class 0x0, 0x1, 0xB, 0xE define components that do not have driver support
at present.
Class 0x2-0x8,0xA and 0xD-0xD are presently reserved.
The specification futher defines which classes of device use the standard
CID/PID pair, and when additional ID registers are required.
This patch introduces the amba_cs_uci_id structure which will be used in
all coresight drivers for indentification via the private data pointer in
the amba_id structure.
Existing drivers that currently use the amba_id->data pointer for private
data are updated to use the amba_cs_uci_id->data pointer. Macros and
inline functions are added to simplify this code.
Signed-off-by: Mike Leach <mike.leach@linaro.org>
Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Tested-by: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
2019-02-13 21:41:49 +08:00
|
|
|
}
|
|
|
|
|
2020-05-19 02:02:20 +08:00
|
|
|
void coresight_release_platform_data(struct coresight_device *csdev,
|
2023-04-25 22:35:34 +08:00
|
|
|
struct device *dev,
|
2020-05-19 02:02:20 +08:00
|
|
|
struct coresight_platform_data *pdata);
|
2020-03-21 00:52:57 +08:00
|
|
|
struct coresight_device *
|
|
|
|
coresight_find_csdev_by_fwnode(struct fwnode_handle *r_fwnode);
|
2023-04-25 22:35:40 +08:00
|
|
|
void coresight_add_helper(struct coresight_device *csdev,
|
|
|
|
struct coresight_device *helper);
|
2019-06-20 03:53:03 +08:00
|
|
|
|
2021-04-06 00:43:03 +08:00
|
|
|
void coresight_set_percpu_sink(int cpu, struct coresight_device *csdev);
|
|
|
|
struct coresight_device *coresight_get_percpu_sink(int cpu);
|
2024-01-29 23:40:32 +08:00
|
|
|
void coresight_disable_source(struct coresight_device *csdev, void *data);
|
2021-04-06 00:43:03 +08:00
|
|
|
|
2014-11-04 02:07:35 +08:00
|
|
|
#endif
|