Skip to content

Commit a1c45d3

Browse files
rmurphy-armwilldeacon
authored andcommitted
perf/arm-cmn: Add sysfs identifier
Expose a sysfs identifier encapsulating the CMN part number and revision so that jevents can narrow down a fundamental set of possible events for calculating metrics. Configuration-dependent aspects - such as whether a given node type is present, and/or a given node ID is valid - are still not covered, and in general it's hard to see how userspace could handle them, so we won't be removing any data or validation logic from the driver any time soon, but at least it's a step in a useful direction. Signed-off-by: Robin Murphy <[email protected]> Reviewed-and-tested-by: Ilkka Koskinen <[email protected]> Tested-by: Jing Zhang <[email protected]> Link: https://lore.kernel.org/r/b8a14c14fcdf028939ebf57849863e8ae01743de.1686588640.git.robin.murphy@arm.com Signed-off-by: Will Deacon <[email protected]>
1 parent 7819e05 commit a1c45d3

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

drivers/perf/arm-cmn.c

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,19 +1199,31 @@ static ssize_t arm_cmn_cpumask_show(struct device *dev,
11991199
static struct device_attribute arm_cmn_cpumask_attr =
12001200
__ATTR(cpumask, 0444, arm_cmn_cpumask_show, NULL);
12011201

1202-
static struct attribute *arm_cmn_cpumask_attrs[] = {
1202+
static ssize_t arm_cmn_identifier_show(struct device *dev,
1203+
struct device_attribute *attr, char *buf)
1204+
{
1205+
struct arm_cmn *cmn = to_cmn(dev_get_drvdata(dev));
1206+
1207+
return sysfs_emit(buf, "%03x%02x\n", cmn->part, cmn->rev);
1208+
}
1209+
1210+
static struct device_attribute arm_cmn_identifier_attr =
1211+
__ATTR(identifier, 0444, arm_cmn_identifier_show, NULL);
1212+
1213+
static struct attribute *arm_cmn_other_attrs[] = {
12031214
&arm_cmn_cpumask_attr.attr,
1215+
&arm_cmn_identifier_attr.attr,
12041216
NULL,
12051217
};
12061218

1207-
static const struct attribute_group arm_cmn_cpumask_attr_group = {
1208-
.attrs = arm_cmn_cpumask_attrs,
1219+
static const struct attribute_group arm_cmn_other_attrs_group = {
1220+
.attrs = arm_cmn_other_attrs,
12091221
};
12101222

12111223
static const struct attribute_group *arm_cmn_attr_groups[] = {
12121224
&arm_cmn_event_attrs_group,
12131225
&arm_cmn_format_attrs_group,
1214-
&arm_cmn_cpumask_attr_group,
1226+
&arm_cmn_other_attrs_group,
12151227
NULL
12161228
};
12171229

0 commit comments

Comments
 (0)