Skip to content

Commit 07f7c21

Browse files
Tao ZhangSuzuki K Poulose
authored andcommitted
coresight-tpdm: Add support to select lane
TPDM MCMB subunits supports up to 8 lanes CMB. For MCMB configurations, the field "XTRIG_LNSEL" in CMB_CR register selects which lane participates in the output pattern mach cross trigger mechanism governed by the M_CMB_DXPR and M_CMB_XPMR regisers. 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 ee39dbe commit 07f7c21

File tree

3 files changed

+62
-0
lines changed

3 files changed

+62
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,3 +257,11 @@ Contact: Jinlong Mao (QUIC) <[email protected]>, Tao Zhang (QUIC) <quic_t
257257
Description:
258258
(RW) Set/Get the MSR(mux select register) for the CMB subunit
259259
TPDM.
260+
261+
What: /sys/bus/coresight/devices/<tpdm-name>/mcmb_trig_lane
262+
Date: Feb 2025
263+
KernelVersion 6.15
264+
Contact: Jinlong Mao (QUIC) <[email protected]>, Tao Zhang (QUIC) <[email protected]>
265+
Description:
266+
(RW) Set/Get which lane participates in the output pattern
267+
match cross trigger mechanism for the MCMB subunit TPDM.

drivers/hwtracing/coresight/coresight-tpdm.c

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,18 @@ static umode_t tpdm_cmb_msr_is_visible(struct kobject *kobj,
252252
return 0;
253253
}
254254

255+
static umode_t tpdm_mcmb_is_visible(struct kobject *kobj,
256+
struct attribute *attr, int n)
257+
{
258+
struct device *dev = kobj_to_dev(kobj);
259+
struct tpdm_drvdata *drvdata = dev_get_drvdata(dev->parent);
260+
261+
if (drvdata && tpdm_has_mcmb_dataset(drvdata))
262+
return attr->mode;
263+
264+
return 0;
265+
}
266+
255267
static void tpdm_reset_datasets(struct tpdm_drvdata *drvdata)
256268
{
257269
if (tpdm_has_dsb_dataset(drvdata)) {
@@ -1020,6 +1032,34 @@ static ssize_t cmb_trig_ts_store(struct device *dev,
10201032
}
10211033
static DEVICE_ATTR_RW(cmb_trig_ts);
10221034

1035+
static ssize_t mcmb_trig_lane_show(struct device *dev,
1036+
struct device_attribute *attr,
1037+
char *buf)
1038+
{
1039+
struct tpdm_drvdata *drvdata = dev_get_drvdata(dev->parent);
1040+
1041+
return sysfs_emit(buf, "%u\n",
1042+
(unsigned int)drvdata->cmb->mcmb.trig_lane);
1043+
}
1044+
1045+
static ssize_t mcmb_trig_lane_store(struct device *dev,
1046+
struct device_attribute *attr,
1047+
const char *buf,
1048+
size_t size)
1049+
{
1050+
struct tpdm_drvdata *drvdata = dev_get_drvdata(dev->parent);
1051+
unsigned long val;
1052+
1053+
if ((kstrtoul(buf, 0, &val)) || (val >= TPDM_MCMB_MAX_LANES))
1054+
return -EINVAL;
1055+
1056+
guard(spinlock)(&drvdata->spinlock);
1057+
drvdata->cmb->mcmb.trig_lane = val;
1058+
1059+
return size;
1060+
}
1061+
static DEVICE_ATTR_RW(mcmb_trig_lane);
1062+
10231063
static struct attribute *tpdm_dsb_edge_attrs[] = {
10241064
&dev_attr_ctrl_idx.attr,
10251065
&dev_attr_ctrl_val.attr,
@@ -1182,6 +1222,11 @@ static struct attribute *tpdm_cmb_msr_attrs[] = {
11821222
NULL,
11831223
};
11841224

1225+
static struct attribute *tpdm_mcmb_attrs[] = {
1226+
&dev_attr_mcmb_trig_lane.attr,
1227+
NULL,
1228+
};
1229+
11851230
static struct attribute *tpdm_dsb_attrs[] = {
11861231
&dev_attr_dsb_mode.attr,
11871232
&dev_attr_dsb_trig_ts.attr,
@@ -1248,6 +1293,11 @@ static struct attribute_group tpdm_cmb_msr_grp = {
12481293
.name = "cmb_msr",
12491294
};
12501295

1296+
static struct attribute_group tpdm_mcmb_attr_grp = {
1297+
.attrs = tpdm_mcmb_attrs,
1298+
.is_visible = tpdm_mcmb_is_visible,
1299+
};
1300+
12511301
static const struct attribute_group *tpdm_attr_grps[] = {
12521302
&tpdm_attr_grp,
12531303
&tpdm_dsb_attr_grp,
@@ -1259,6 +1309,7 @@ static const struct attribute_group *tpdm_attr_grps[] = {
12591309
&tpdm_cmb_trig_patt_grp,
12601310
&tpdm_cmb_patt_grp,
12611311
&tpdm_cmb_msr_grp,
1312+
&tpdm_mcmb_attr_grp,
12621313
NULL,
12631314
};
12641315

drivers/hwtracing/coresight/coresight-tpdm.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@
4545
/* MAX number of DSB MSR */
4646
#define TPDM_CMB_MAX_MSR 32
4747

48+
/* MAX lanes in the output pattern for MCMB configurations*/
49+
#define TPDM_MCMB_MAX_LANES 8
50+
4851
/* DSB Subunit Registers */
4952
#define TPDM_DSB_CR (0x780)
5053
#define TPDM_DSB_TIER (0x784)

0 commit comments

Comments
 (0)