Skip to content

Commit ab5ca62

Browse files
author
Suzuki K Poulose
committed
coresight: etm4x: Match all ETM4 instances based on DEVARCH and DEVTYPE
Instead of adding the PIDs forever to the list for the new CPUs, let us detect a component to be ETMv4 based on the CoreSight CID, DEVTYPE=PE_TRACE and DEVARCH=ETMv4. This is already done for some of the ETMs. We can extend the PID matching to match the PIDR2:JEDEC, BIT[3], which must be 1 (RAO) always. Link: https://lkml.kernel.org/r/20230317030501.1811905-1-anshuman.khandual@arm.com Cc: Anshuman Khandual <anshuman.khandual@arm.com> Cc: Rob Herring <robh+dt@kernel.org> Cc: frowand.list@gmail.com Cc: linux@armlinux.org.uk Cc: Mike Leach <mike.leach@linaro.org> Reviewed-by: Mike Leach <mike.leach@linaro.org> [ Fixed typo in the description RA0 => RAO ] Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> Link: https://lore.kernel.org/r/20230605133031.1827626-1-suzuki.poulose@arm.com
1 parent c5f231f commit ab5ca62

2 files changed

Lines changed: 22 additions & 2 deletions

File tree

drivers/hwtracing/coresight/coresight-etm4x-core.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2257,6 +2257,11 @@ static const struct amba_id etm4_ids[] = {
22572257
CS_AMBA_UCI_ID(0x000cc0af, uci_id_etm4),/* Marvell ThunderX2 */
22582258
CS_AMBA_UCI_ID(0x000b6d01, uci_id_etm4),/* HiSilicon-Hip08 */
22592259
CS_AMBA_UCI_ID(0x000b6d02, uci_id_etm4),/* HiSilicon-Hip09 */
2260+
/*
2261+
* Match all PIDs with ETM4 DEVARCH. No need for adding any of the new
2262+
* CPUs to the list here.
2263+
*/
2264+
CS_AMBA_MATCH_ALL_UCI(uci_id_etm4),
22602265
{},
22612266
};
22622267

drivers/hwtracing/coresight/coresight-priv.h

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,27 @@ extern void coresight_remove_cti_ops(void);
188188
}
189189

190190
/* coresight AMBA ID, full UCI structure: id table entry. */
191-
#define CS_AMBA_UCI_ID(pid, uci_ptr) \
191+
#define __CS_AMBA_UCI_ID(pid, m, uci_ptr) \
192192
{ \
193193
.id = pid, \
194-
.mask = 0x000fffff, \
194+
.mask = m, \
195195
.data = (void *)uci_ptr \
196196
}
197+
#define CS_AMBA_UCI_ID(pid, uci) __CS_AMBA_UCI_ID(pid, 0x000fffff, uci)
198+
/*
199+
* PIDR2[JEDEC], BIT(3) must be 1 (Read As One) to indicate that rest of the
200+
* PIDR1, PIDR2 DES_* fields follow JEDEC encoding for the designer. Use that
201+
* as a match value for blanket matching all devices in the given CoreSight
202+
* device type and architecture.
203+
*/
204+
#define PIDR2_JEDEC BIT(3)
205+
#define PID_PIDR2_JEDEC (PIDR2_JEDEC << 16)
206+
/*
207+
* Match all PIDs in a given CoreSight device type and architecture, defined
208+
* by the uci.
209+
*/
210+
#define CS_AMBA_MATCH_ALL_UCI(uci) \
211+
__CS_AMBA_UCI_ID(PID_PIDR2_JEDEC, PID_PIDR2_JEDEC, uci)
197212

198213
/* extract the data value from a UCI structure given amba_id pointer. */
199214
static inline void *coresight_get_uci_data(const struct amba_id *id)

0 commit comments

Comments
 (0)