Skip to content

Commit 0c0b6c0

Browse files
Tao ZhangSuzuki K Poulose
authored andcommitted
coresight-tpdm: Add support to enable the lane for MCMB TPDM
Add the sysfs file to set/get the enablement of the lane. For MCMB configurations, the field "E_LN" in CMB_CR register is the individual lane enables. MCMB lane N is enabled for trace generation when M_CMB_CR.E=1 and M_CMB_CR.E_LN[N]=1. For lanes that are not implemented on a given MCMB configuration, the corresponding bits of this field read as 0 and ignore writes. Signed-off-by: Tao Zhang <[email protected]> Signed-off-by: Mao Jinlong <[email protected]> Signed-off-by: Suzuki K Poulose <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 07f7c21 commit 0c0b6c0

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

Documentation/ABI/testing/sysfs-bus-coresight-devices-tpdm

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,3 +265,10 @@ Contact: Jinlong Mao (QUIC) <[email protected]>, Tao Zhang (QUIC) <quic_t
265265
Description:
266266
(RW) Set/Get which lane participates in the output pattern
267267
match cross trigger mechanism for the MCMB subunit TPDM.
268+
269+
What: /sys/bus/coresight/devices/<tpdm-name>/mcmb_lanes_select
270+
Date: Feb 2025
271+
KernelVersion 6.15
272+
Contact: Jinlong Mao (QUIC) <[email protected]>, Tao Zhang (QUIC) <[email protected]>
273+
Description:
274+
(RW) Set/Get the enablement of the individual lane.

drivers/hwtracing/coresight/coresight-tpdm.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,6 +1060,34 @@ static ssize_t mcmb_trig_lane_store(struct device *dev,
10601060
}
10611061
static DEVICE_ATTR_RW(mcmb_trig_lane);
10621062

1063+
static ssize_t mcmb_lanes_select_show(struct device *dev,
1064+
struct device_attribute *attr,
1065+
char *buf)
1066+
{
1067+
struct tpdm_drvdata *drvdata = dev_get_drvdata(dev->parent);
1068+
1069+
return sysfs_emit(buf, "%u\n",
1070+
(unsigned int)drvdata->cmb->mcmb.lane_select);
1071+
}
1072+
1073+
static ssize_t mcmb_lanes_select_store(struct device *dev,
1074+
struct device_attribute *attr,
1075+
const char *buf,
1076+
size_t size)
1077+
{
1078+
struct tpdm_drvdata *drvdata = dev_get_drvdata(dev->parent);
1079+
unsigned long val;
1080+
1081+
if (kstrtoul(buf, 0, &val) || (val & ~TPDM_MCMB_E_LN_MASK))
1082+
return -EINVAL;
1083+
1084+
guard(spinlock)(&drvdata->spinlock);
1085+
drvdata->cmb->mcmb.lane_select = val & TPDM_MCMB_E_LN_MASK;
1086+
1087+
return size;
1088+
}
1089+
static DEVICE_ATTR_RW(mcmb_lanes_select);
1090+
10631091
static struct attribute *tpdm_dsb_edge_attrs[] = {
10641092
&dev_attr_ctrl_idx.attr,
10651093
&dev_attr_ctrl_val.attr,
@@ -1224,6 +1252,7 @@ static struct attribute *tpdm_cmb_msr_attrs[] = {
12241252

12251253
static struct attribute *tpdm_mcmb_attrs[] = {
12261254
&dev_attr_mcmb_trig_lane.attr,
1255+
&dev_attr_mcmb_lanes_select.attr,
12271256
NULL,
12281257
};
12291258

drivers/hwtracing/coresight/coresight-tpdm.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@
4848
/* MAX lanes in the output pattern for MCMB configurations*/
4949
#define TPDM_MCMB_MAX_LANES 8
5050

51+
/* Filter bit 0~7 from the value for CR_E_LN */
52+
#define TPDM_MCMB_E_LN_MASK GENMASK(7, 0)
53+
5154
/* DSB Subunit Registers */
5255
#define TPDM_DSB_CR (0x780)
5356
#define TPDM_DSB_TIER (0x784)

0 commit comments

Comments
 (0)