summaryrefslogtreecommitdiffstats
path: root/drivers/perf/hisilicon/hisi_uncore_pmu.c
diff options
context:
space:
mode:
authorJohn Garry <john.garry@huawei.com>2020-10-08 17:26:18 +0800
committerWill Deacon <will@kernel.org>2020-11-25 15:10:35 +0000
commitac4511c9364c9a6390e8585cdd4596103bca16eb (patch)
tree288b061966dadaf444755689696905684e4c4620 /drivers/perf/hisilicon/hisi_uncore_pmu.c
parent6c8cfbf5db42bc300372d893a140ea0879fb0772 (diff)
downloadlinux-ac4511c9364c9a6390e8585cdd4596103bca16eb.tar.bz2
drivers/perf: hisi: Add identifier sysfs file
To allow userspace to identify the specific implementation of the device, add an "identifier" sysfs file. Encoding is as follows (same for all uncore drivers): hi1620: 0x0 hi1630: 0x30 Signed-off-by: John Garry <john.garry@huawei.com> Link: https://lore.kernel.org/r/1602149181-237415-2-git-send-email-john.garry@huawei.com Signed-off-by: Will Deacon <will@kernel.org>
Diffstat (limited to 'drivers/perf/hisilicon/hisi_uncore_pmu.c')
-rw-r--r--drivers/perf/hisilicon/hisi_uncore_pmu.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/perf/hisilicon/hisi_uncore_pmu.c b/drivers/perf/hisilicon/hisi_uncore_pmu.c
index 97aff877a4e7..9dbdc3fc3bb4 100644
--- a/drivers/perf/hisilicon/hisi_uncore_pmu.c
+++ b/drivers/perf/hisilicon/hisi_uncore_pmu.c
@@ -119,6 +119,16 @@ int hisi_uncore_pmu_get_event_idx(struct perf_event *event)
}
EXPORT_SYMBOL_GPL(hisi_uncore_pmu_get_event_idx);
+ssize_t hisi_uncore_pmu_identifier_attr_show(struct device *dev,
+ struct device_attribute *attr,
+ char *page)
+{
+ struct hisi_pmu *hisi_pmu = to_hisi_pmu(dev_get_drvdata(dev));
+
+ return snprintf(page, PAGE_SIZE, "0x%08x\n", hisi_pmu->identifier);
+}
+EXPORT_SYMBOL_GPL(hisi_uncore_pmu_identifier_attr_show);
+
static void hisi_uncore_pmu_clear_event_idx(struct hisi_pmu *hisi_pmu, int idx)
{
if (!hisi_uncore_pmu_counter_valid(hisi_pmu, idx)) {