Skip to content

Commit cbbc6fd

Browse files
Jing Zhangwilldeacon
authored andcommitted
driver/perf: Add identifier sysfs file for Yitian 710 DDR
To allow userspace to identify the specific implementation of the device, add an "identifier" sysfs file. The perf tool can match the Yitian 710 DDR metric through the identifier. Signed-off-by: Jing Zhang <renyu.zj@linux.alibaba.com> Acked-by: Ian Rogers <irogers@google.com> Reviewed-by: Shuai Xue <xueshuai@linux.alibaba.com> Link: https://lore.kernel.org/r/1687245156-61215-2-git-send-email-renyu.zj@linux.alibaba.com Signed-off-by: Will Deacon <will@kernel.org>
1 parent 6eaae19 commit cbbc6fd

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

drivers/perf/alibaba_uncore_drw_pmu.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,10 +236,37 @@ static const struct attribute_group ali_drw_pmu_cpumask_attr_group = {
236236
.attrs = ali_drw_pmu_cpumask_attrs,
237237
};
238238

239+
static ssize_t ali_drw_pmu_identifier_show(struct device *dev,
240+
struct device_attribute *attr,
241+
char *page)
242+
{
243+
return sysfs_emit(page, "%s\n", "ali_drw_pmu");
244+
}
245+
246+
static umode_t ali_drw_pmu_identifier_attr_visible(struct kobject *kobj,
247+
struct attribute *attr, int n)
248+
{
249+
return attr->mode;
250+
}
251+
252+
static struct device_attribute ali_drw_pmu_identifier_attr =
253+
__ATTR(identifier, 0444, ali_drw_pmu_identifier_show, NULL);
254+
255+
static struct attribute *ali_drw_pmu_identifier_attrs[] = {
256+
&ali_drw_pmu_identifier_attr.attr,
257+
NULL
258+
};
259+
260+
static const struct attribute_group ali_drw_pmu_identifier_attr_group = {
261+
.attrs = ali_drw_pmu_identifier_attrs,
262+
.is_visible = ali_drw_pmu_identifier_attr_visible
263+
};
264+
239265
static const struct attribute_group *ali_drw_pmu_attr_groups[] = {
240266
&ali_drw_pmu_events_attr_group,
241267
&ali_drw_pmu_cpumask_attr_group,
242268
&ali_drw_pmu_format_group,
269+
&ali_drw_pmu_identifier_attr_group,
243270
NULL,
244271
};
245272

0 commit comments

Comments
 (0)