Skip to contentSkip to conversation

perf/smmuv3: Support sysfs identifier file

RFC PATCH New John Garry 1 participant 1 message Apr 17, 2020 Arm PMU profiling and debugging

lore
Share & tools
lore

John Garry

author
#0 lore raw

RFC PATCH 1/1 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.

drivers/perf/arm_smmuv3_pmu.c +26 -0
index f01a57e5a5f3..0ed358cff4a7 100644
@@ -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);
Signature · 7 lines
2.16.4


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel