[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1587120634-19666-1-git-send-email-john.garry@huawei.com>
Date: Fri, 17 Apr 2020 18:50:34 +0800
From: John Garry <john.garry@...wei.com>
To: <will@...nel.org>, <mark.rutland@....com>
CC: <linux-kernel@...r.kernel.org>, <qiangqing.zhang@....com>,
<jolsa@...hat.com>, <robin.murphy@....com>,
<linux-arm-kernel@...ts.infradead.org>,
<shameerali.kolothum.thodi@...wei.com>,
John Garry <john.garry@...wei.com>
Subject: [RFC PATCH] perf/smmuv3: Support sysfs identifier file
For the perf tool to know the specific HW implementation, expose a HW
identifier file for the PMU device.
For now, we just support HiSilicon "hip08" through pre-existing ACPI
options quirk framework. A minimalistic approach is used, based on the
hope that a proper identification method will be available in a future
SMMUv3 spec.
Signed-off-by: John Garry <john.garry@...wei.com>
diff --git a/drivers/perf/arm_smmuv3_pmu.c b/drivers/perf/arm_smmuv3_pmu.c
index f01a57e5a5f3..0ed358cff4a7 100644
--- a/drivers/perf/arm_smmuv3_pmu.c
+++ b/drivers/perf/arm_smmuv3_pmu.c
@@ -113,6 +113,7 @@ struct smmu_pmu {
u64 counter_mask;
u32 options;
bool global_filter;
+ const char *identifier;
};
#define to_smmu_pmu(p) (container_of(p, struct smmu_pmu, pmu))
@@ -552,6 +553,27 @@ static struct attribute_group smmu_pmu_events_group = {
.is_visible = smmu_pmu_event_is_visible,
};
+static ssize_t smmu_pmu_identifier_attr_show(struct device *dev,
+ struct device_attribute *attr,
+ char *page)
+{
+ struct smmu_pmu *smmu_pmu = to_smmu_pmu(dev_get_drvdata(dev));
+
+ return sprintf(page, "%s\n", smmu_pmu->identifier);
+}
+
+static struct device_attribute smmu_pmu_identifier_attr =
+ __ATTR(identifier, 0444, smmu_pmu_identifier_attr_show, NULL);
+
+static struct attribute *smmu_pmu_identifier_attrs[] = {
+ &smmu_pmu_identifier_attr.attr,
+ NULL
+};
+
+static struct attribute_group smmu_pmu_identifier_group = {
+ .attrs = smmu_pmu_identifier_attrs,
+};
+
/* Formats */
PMU_FORMAT_ATTR(event, "config:0-15");
PMU_FORMAT_ATTR(filter_stream_id, "config1:0-31");
@@ -575,6 +597,7 @@ static const struct attribute_group *smmu_pmu_attr_grps[] = {
&smmu_pmu_cpumask_group,
&smmu_pmu_events_group,
&smmu_pmu_format_group,
+ &smmu_pmu_identifier_group,
NULL
};
@@ -718,7 +741,10 @@ static void smmu_pmu_get_acpi_options(struct smmu_pmu *smmu_pmu)
case IORT_SMMU_V3_PMCG_HISI_HIP08:
/* HiSilicon Erratum 162001800 */
smmu_pmu->options |= SMMU_PMCG_EVCNTR_RDONLY;
+ smmu_pmu->identifier = "hip08";
break;
+ default:
+ smmu_pmu->identifier = "none";
}
dev_notice(smmu_pmu->dev, "option mask 0x%x\n", smmu_pmu->options);
--
2.16.4
Powered by blists - more mailing lists