From: John Garry <john.garry@huawei.com>
To: <will@kernel.org>, <mark.rutland@arm.com>
Cc: <linux-kernel@vger.kernel.org>, <qiangqing.zhang@nxp.com>,
<jolsa@redhat.com>, <robin.murphy@arm.com>,
<linux-arm-kernel@lists.infradead.org>,
<shameerali.kolothum.thodi@huawei.com>,
John Garry <john.garry@huawei.com>
Subject: [RFC PATCH] perf/smmuv3: Support sysfs identifier file
Date: Fri, 17 Apr 2020 18:50:34 +0800 [thread overview]
Message-ID: <1587120634-19666-1-git-send-email-john.garry@huawei.com> (raw)
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@huawei.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
reply other threads:[~2020-04-17 10:55 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1587120634-19666-1-git-send-email-john.garry@huawei.com \
--to=john.garry@huawei.com \
--cc=jolsa@redhat.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=qiangqing.zhang@nxp.com \
--cc=robin.murphy@arm.com \
--cc=shameerali.kolothum.thodi@huawei.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®