linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/4] perf drivers: Add sysfs identifier file
@ 2020-10-08  9:26 John Garry
  2020-10-08  9:26 ` [PATCH v2 1/4] drivers/perf: hisi: Add identifier sysfs file John Garry
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: John Garry @ 2020-10-08  9:26 UTC (permalink / raw)
  To: Frank.li, will, mark.rutland, robh+dt, zhangshaokun, qiangqing.zhang
  Cc: linuxarm, devicetree, linux-kernel, linux-arm-kernel, acme,
	jolsa, irogers, John Garry

To allow perf tool to identify a specific implementation of a PMU for
event alias matching and metric support, expose a per-PMU identifier file.

There is no standard format for the identifier string. It just should be
unique per HW implementation.

Typical methods to retrieve the information for the identifier string
can include:
- Hardcoding in the driver, matched via DT bindings compat string,
  ACPI HID, or similar
- Directly from DT bindings property
- Read from some HW identification register

In this series, for the SMMUv3 PMU and HiSi uncore drivers, a HW ID
register is read for the identifier. For the imx8 ddr driver, the
identifier is hardcoded, matched via DT compat string.

Joakim Zhang (2):
  bindings/perf/imx-ddr: update compatible string
  perf/imx_ddr: Add system PMU identifier for userspace

John Garry (2):
  drivers/perf: hisi: Add identifier sysfs file
  perf/smmuv3: Support sysfs identifier file

 .../devicetree/bindings/perf/fsl-imx-ddr.txt  |  3 ++
 drivers/perf/arm_smmuv3_pmu.c                 | 39 ++++++++++++++++
 drivers/perf/fsl_imx8_ddr_perf.c              | 45 +++++++++++++++++--
 drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c | 16 +++++++
 drivers/perf/hisilicon/hisi_uncore_hha_pmu.c  | 16 +++++++
 drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c  | 16 +++++++
 drivers/perf/hisilicon/hisi_uncore_pmu.c      | 10 +++++
 drivers/perf/hisilicon/hisi_uncore_pmu.h      |  7 +++
 8 files changed, 149 insertions(+), 3 deletions(-)

-- 
2.26.2


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v2 1/4] drivers/perf: hisi: Add identifier sysfs file
  2020-10-08  9:26 [PATCH v2 0/4] perf drivers: Add sysfs identifier file John Garry
@ 2020-10-08  9:26 ` John Garry
  2020-10-08  9:26 ` [PATCH v2 2/4] bindings/perf/imx-ddr: update compatible string John Garry
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: John Garry @ 2020-10-08  9:26 UTC (permalink / raw)
  To: Frank.li, will, mark.rutland, robh+dt, zhangshaokun, qiangqing.zhang
  Cc: linuxarm, devicetree, linux-kernel, linux-arm-kernel, acme,
	jolsa, irogers, John Garry

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>
---
 drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c | 16 ++++++++++++++++
 drivers/perf/hisilicon/hisi_uncore_hha_pmu.c  | 16 ++++++++++++++++
 drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c  | 16 ++++++++++++++++
 drivers/perf/hisilicon/hisi_uncore_pmu.c      | 10 ++++++++++
 drivers/perf/hisilicon/hisi_uncore_pmu.h      |  7 +++++++
 5 files changed, 65 insertions(+)

diff --git a/drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c b/drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c
index 5e3645c96443..5ac6c9113767 100644
--- a/drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c
+++ b/drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c
@@ -33,6 +33,7 @@
 #define DDRC_INT_MASK		0x6c8
 #define DDRC_INT_STATUS		0x6cc
 #define DDRC_INT_CLEAR		0x6d0
+#define DDRC_VERSION		0x710
 
 /* DDRC has 8-counters */
 #define DDRC_NR_COUNTERS	0x8
@@ -267,6 +268,8 @@ static int hisi_ddrc_pmu_init_data(struct platform_device *pdev,
 		return PTR_ERR(ddrc_pmu->base);
 	}
 
+	ddrc_pmu->identifier = readl(ddrc_pmu->base + DDRC_VERSION);
+
 	return 0;
 }
 
@@ -308,10 +311,23 @@ static const struct attribute_group hisi_ddrc_pmu_cpumask_attr_group = {
 	.attrs = hisi_ddrc_pmu_cpumask_attrs,
 };
 
+static struct device_attribute hisi_ddrc_pmu_identifier_attr =
+	__ATTR(identifier, 0444, hisi_uncore_pmu_identifier_attr_show, NULL);
+
+static struct attribute *hisi_ddrc_pmu_identifier_attrs[] = {
+	&hisi_ddrc_pmu_identifier_attr.attr,
+	NULL
+};
+
+static struct attribute_group hisi_ddrc_pmu_identifier_group = {
+	.attrs = hisi_ddrc_pmu_identifier_attrs,
+};
+
 static const struct attribute_group *hisi_ddrc_pmu_attr_groups[] = {
 	&hisi_ddrc_pmu_format_group,
 	&hisi_ddrc_pmu_events_group,
 	&hisi_ddrc_pmu_cpumask_attr_group,
+	&hisi_ddrc_pmu_identifier_group,
 	NULL,
 };
 
diff --git a/drivers/perf/hisilicon/hisi_uncore_hha_pmu.c b/drivers/perf/hisilicon/hisi_uncore_hha_pmu.c
index 5eb8168029c0..41b2dceb5f26 100644
--- a/drivers/perf/hisilicon/hisi_uncore_hha_pmu.c
+++ b/drivers/perf/hisilicon/hisi_uncore_hha_pmu.c
@@ -23,6 +23,7 @@
 #define HHA_INT_MASK		0x0804
 #define HHA_INT_STATUS		0x0808
 #define HHA_INT_CLEAR		0x080C
+#define HHA_VERSION		0x1cf0
 #define HHA_PERF_CTRL		0x1E00
 #define HHA_EVENT_CTRL		0x1E04
 #define HHA_EVENT_TYPE0		0x1E80
@@ -261,6 +262,8 @@ static int hisi_hha_pmu_init_data(struct platform_device *pdev,
 		return PTR_ERR(hha_pmu->base);
 	}
 
+	hha_pmu->identifier = readl(hha_pmu->base + HHA_VERSION);
+
 	return 0;
 }
 
@@ -320,10 +323,23 @@ static const struct attribute_group hisi_hha_pmu_cpumask_attr_group = {
 	.attrs = hisi_hha_pmu_cpumask_attrs,
 };
 
+static struct device_attribute hisi_hha_pmu_identifier_attr =
+	__ATTR(identifier, 0444, hisi_uncore_pmu_identifier_attr_show, NULL);
+
+static struct attribute *hisi_hha_pmu_identifier_attrs[] = {
+	&hisi_hha_pmu_identifier_attr.attr,
+	NULL
+};
+
+static struct attribute_group hisi_hha_pmu_identifier_group = {
+	.attrs = hisi_hha_pmu_identifier_attrs,
+};
+
 static const struct attribute_group *hisi_hha_pmu_attr_groups[] = {
 	&hisi_hha_pmu_format_group,
 	&hisi_hha_pmu_events_group,
 	&hisi_hha_pmu_cpumask_attr_group,
+	&hisi_hha_pmu_identifier_group,
 	NULL,
 };
 
diff --git a/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c b/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c
index 3e8b5eab5514..705501d18d03 100644
--- a/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c
+++ b/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c
@@ -25,6 +25,7 @@
 #define L3C_INT_STATUS		0x0808
 #define L3C_INT_CLEAR		0x080c
 #define L3C_EVENT_CTRL	        0x1c00
+#define L3C_VERSION		0x1cf0
 #define L3C_EVENT_TYPE0		0x1d00
 /*
  * Each counter is 48-bits and [48:63] are reserved
@@ -264,6 +265,8 @@ static int hisi_l3c_pmu_init_data(struct platform_device *pdev,
 		return PTR_ERR(l3c_pmu->base);
 	}
 
+	l3c_pmu->identifier = readl(l3c_pmu->base + L3C_VERSION);
+
 	return 0;
 }
 
@@ -310,10 +313,23 @@ static const struct attribute_group hisi_l3c_pmu_cpumask_attr_group = {
 	.attrs = hisi_l3c_pmu_cpumask_attrs,
 };
 
+static struct device_attribute hisi_l3c_pmu_identifier_attr =
+	__ATTR(identifier, 0444, hisi_uncore_pmu_identifier_attr_show, NULL);
+
+static struct attribute *hisi_l3c_pmu_identifier_attrs[] = {
+	&hisi_l3c_pmu_identifier_attr.attr,
+	NULL
+};
+
+static struct attribute_group hisi_l3c_pmu_identifier_group = {
+	.attrs = hisi_l3c_pmu_identifier_attrs,
+};
+
 static const struct attribute_group *hisi_l3c_pmu_attr_groups[] = {
 	&hisi_l3c_pmu_format_group,
 	&hisi_l3c_pmu_events_group,
 	&hisi_l3c_pmu_cpumask_attr_group,
+	&hisi_l3c_pmu_identifier_group,
 	NULL,
 };
 
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)) {
diff --git a/drivers/perf/hisilicon/hisi_uncore_pmu.h b/drivers/perf/hisilicon/hisi_uncore_pmu.h
index 25b0c97b3eb0..14ecaf763153 100644
--- a/drivers/perf/hisilicon/hisi_uncore_pmu.h
+++ b/drivers/perf/hisilicon/hisi_uncore_pmu.h
@@ -74,6 +74,7 @@ struct hisi_pmu {
 	int counter_bits;
 	/* check event code range */
 	int check_event;
+	u32 identifier;
 };
 
 int hisi_uncore_pmu_counter_valid(struct hisi_pmu *hisi_pmu, int idx);
@@ -96,4 +97,10 @@ ssize_t hisi_cpumask_sysfs_show(struct device *dev,
 				struct device_attribute *attr, char *buf);
 int hisi_uncore_pmu_online_cpu(unsigned int cpu, struct hlist_node *node);
 int hisi_uncore_pmu_offline_cpu(unsigned int cpu, struct hlist_node *node);
+
+ssize_t hisi_uncore_pmu_identifier_attr_show(struct device *dev,
+					     struct device_attribute *attr,
+					     char *page);
+
+
 #endif /* __HISI_UNCORE_PMU_H__ */
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v2 2/4] bindings/perf/imx-ddr: update compatible string
  2020-10-08  9:26 [PATCH v2 0/4] perf drivers: Add sysfs identifier file John Garry
  2020-10-08  9:26 ` [PATCH v2 1/4] drivers/perf: hisi: Add identifier sysfs file John Garry
@ 2020-10-08  9:26 ` John Garry
  2020-10-12  9:58   ` Joakim Zhang
  2020-10-08  9:26 ` [PATCH v2 3/4] perf/imx_ddr: Add system PMU identifier for userspace John Garry
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: John Garry @ 2020-10-08  9:26 UTC (permalink / raw)
  To: Frank.li, will, mark.rutland, robh+dt, zhangshaokun, qiangqing.zhang
  Cc: linuxarm, devicetree, linux-kernel, linux-arm-kernel, acme,
	jolsa, irogers, John Garry

From: Joakim Zhang <qiangqing.zhang@nxp.com>

Update compatible string according to driver change.

[jpg: keep "fsl,imx8m-ddr-pmu", which was being removed]

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Signed-off-by: John Garry <john.garry@huawei.com>
---
 Documentation/devicetree/bindings/perf/fsl-imx-ddr.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/perf/fsl-imx-ddr.txt b/Documentation/devicetree/bindings/perf/fsl-imx-ddr.txt
index 7822a806ea0a..cc38c7fd7049 100644
--- a/Documentation/devicetree/bindings/perf/fsl-imx-ddr.txt
+++ b/Documentation/devicetree/bindings/perf/fsl-imx-ddr.txt
@@ -5,6 +5,9 @@ Required properties:
 - compatible: should be one of:
 	"fsl,imx8-ddr-pmu"
 	"fsl,imx8m-ddr-pmu"
+	"fsl,imx8mq-ddr-pmu"
+	"fsl,imx8mm-ddr-pmu"
+	"fsl,imx8mn-ddr-pmu"
 	"fsl,imx8mp-ddr-pmu"
 
 - reg: physical address and size
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v2 3/4] perf/imx_ddr: Add system PMU identifier for userspace
  2020-10-08  9:26 [PATCH v2 0/4] perf drivers: Add sysfs identifier file John Garry
  2020-10-08  9:26 ` [PATCH v2 1/4] drivers/perf: hisi: Add identifier sysfs file John Garry
  2020-10-08  9:26 ` [PATCH v2 2/4] bindings/perf/imx-ddr: update compatible string John Garry
@ 2020-10-08  9:26 ` John Garry
  2020-10-08  9:26 ` [PATCH v2 4/4] perf/smmuv3: Support sysfs identifier file John Garry
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: John Garry @ 2020-10-08  9:26 UTC (permalink / raw)
  To: Frank.li, will, mark.rutland, robh+dt, zhangshaokun, qiangqing.zhang
  Cc: linuxarm, devicetree, linux-kernel, linux-arm-kernel, acme,
	jolsa, irogers, John Garry

From: Joakim Zhang <qiangqing.zhang@nxp.com>

The DDR Perf for i.MX8 is a system PMU whose AXI ID would different from
SoC to SoC. Need expose system PMU identifier for userspace which refer
to /sys/bus/event_source/devices/<PMU DEVICE>/identifier.

Reviewed-by: John Garry <john.garry@huawei.com>
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Signed-off-by: John Garry <john.garry@huawei.com>
---
 drivers/perf/fsl_imx8_ddr_perf.c | 45 +++++++++++++++++++++++++++++---
 1 file changed, 42 insertions(+), 3 deletions(-)

diff --git a/drivers/perf/fsl_imx8_ddr_perf.c b/drivers/perf/fsl_imx8_ddr_perf.c
index 397540a4b799..c537cd9b8142 100644
--- a/drivers/perf/fsl_imx8_ddr_perf.c
+++ b/drivers/perf/fsl_imx8_ddr_perf.c
@@ -50,21 +50,38 @@ static DEFINE_IDA(ddr_ida);
 
 struct fsl_ddr_devtype_data {
 	unsigned int quirks;    /* quirks needed for different DDR Perf core */
+	const char *identifier;	/* system PMU identifier for userspace */
 };
 
-static const struct fsl_ddr_devtype_data imx8_devtype_data;
+static const struct fsl_ddr_devtype_data imx8_devtype_data = {
+	.identifier = "i.MX8",
+};
+
+static const struct fsl_ddr_devtype_data imx8mq_devtype_data = {
+	.quirks = DDR_CAP_AXI_ID_FILTER,
+	.identifier = "i.MX8MQ",
+};
+
+static const struct fsl_ddr_devtype_data imx8mm_devtype_data = {
+	.quirks = DDR_CAP_AXI_ID_FILTER,
+	.identifier = "i.MX8MM",
+};
 
-static const struct fsl_ddr_devtype_data imx8m_devtype_data = {
+static const struct fsl_ddr_devtype_data imx8mn_devtype_data = {
 	.quirks = DDR_CAP_AXI_ID_FILTER,
+	.identifier = "i.MX8MN",
 };
 
 static const struct fsl_ddr_devtype_data imx8mp_devtype_data = {
 	.quirks = DDR_CAP_AXI_ID_FILTER_ENHANCED,
+	.identifier = "i.MX8MP",
 };
 
 static const struct of_device_id imx_ddr_pmu_dt_ids[] = {
 	{ .compatible = "fsl,imx8-ddr-pmu", .data = &imx8_devtype_data},
-	{ .compatible = "fsl,imx8m-ddr-pmu", .data = &imx8m_devtype_data},
+	{ .compatible = "fsl,imx8mq-ddr-pmu", .data = &imx8mq_devtype_data},
+	{ .compatible = "fsl,imx8mm-ddr-pmu", .data = &imx8mm_devtype_data},
+	{ .compatible = "fsl,imx8mn-ddr-pmu", .data = &imx8mn_devtype_data},
 	{ .compatible = "fsl,imx8mp-ddr-pmu", .data = &imx8mp_devtype_data},
 	{ /* sentinel */ }
 };
@@ -84,6 +101,27 @@ struct ddr_pmu {
 	int id;
 };
 
+static ssize_t ddr_perf_identifier_show(struct device *dev,
+					struct device_attribute *attr,
+					char *page)
+{
+	struct ddr_pmu *pmu = dev_get_drvdata(dev);
+
+	return sprintf(page, "%s\n", pmu->devtype_data->identifier);
+}
+
+static struct device_attribute ddr_perf_identifier_attr =
+	__ATTR(identifier, 0444, ddr_perf_identifier_show, NULL);
+
+static struct attribute *ddr_perf_identifier_attrs[] = {
+	&ddr_perf_identifier_attr.attr,
+	NULL,
+};
+
+static struct attribute_group ddr_perf_identifier_attr_group = {
+	.attrs = ddr_perf_identifier_attrs,
+};
+
 enum ddr_perf_filter_capabilities {
 	PERF_CAP_AXI_ID_FILTER = 0,
 	PERF_CAP_AXI_ID_FILTER_ENHANCED,
@@ -237,6 +275,7 @@ static const struct attribute_group *attr_groups[] = {
 	&ddr_perf_format_attr_group,
 	&ddr_perf_cpumask_attr_group,
 	&ddr_perf_filter_cap_attr_group,
+	&ddr_perf_identifier_attr_group,
 	NULL,
 };
 
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v2 4/4] perf/smmuv3: Support sysfs identifier file
  2020-10-08  9:26 [PATCH v2 0/4] perf drivers: Add sysfs identifier file John Garry
                   ` (2 preceding siblings ...)
  2020-10-08  9:26 ` [PATCH v2 3/4] perf/imx_ddr: Add system PMU identifier for userspace John Garry
@ 2020-10-08  9:26 ` John Garry
  2020-11-06 13:36 ` [PATCH v2 0/4] perf drivers: Add " John Garry
  2020-11-25 15:44 ` Will Deacon
  5 siblings, 0 replies; 11+ messages in thread
From: John Garry @ 2020-10-08  9:26 UTC (permalink / raw)
  To: Frank.li, will, mark.rutland, robh+dt, zhangshaokun, qiangqing.zhang
  Cc: linuxarm, devicetree, linux-kernel, linux-arm-kernel, acme,
	jolsa, irogers, John Garry

SMMU_PMCG_IIDR was added in the SMMUv3.3 spec.

For the perf tool to know the specific HW implementation, expose the
PMCG_IIDR contents only when set.

Signed-off-by: John Garry <john.garry@huawei.com>
---
 drivers/perf/arm_smmuv3_pmu.c | 39 +++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/drivers/perf/arm_smmuv3_pmu.c b/drivers/perf/arm_smmuv3_pmu.c
index 5274f7fe359e..74474bb322c3 100644
--- a/drivers/perf/arm_smmuv3_pmu.c
+++ b/drivers/perf/arm_smmuv3_pmu.c
@@ -74,6 +74,7 @@
 #define SMMU_PMCG_CFGR_NCTR             GENMASK(5, 0)
 #define SMMU_PMCG_CR                    0xE04
 #define SMMU_PMCG_CR_ENABLE             BIT(0)
+#define SMMU_PMCG_IIDR                  0xE08
 #define SMMU_PMCG_CEID0                 0xE20
 #define SMMU_PMCG_CEID1                 0xE28
 #define SMMU_PMCG_IRQ_CTRL              0xE50
@@ -112,6 +113,7 @@ struct smmu_pmu {
 	void __iomem *reloc_base;
 	u64 counter_mask;
 	u32 options;
+	u32 iidr;
 	bool global_filter;
 };
 
@@ -552,6 +554,40 @@ 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 snprintf(page, PAGE_SIZE, "0x%08x\n", smmu_pmu->iidr);
+}
+
+static umode_t smmu_pmu_identifier_attr_visible(struct kobject *kobj,
+						struct attribute *attr,
+						int n)
+{
+	struct device *dev = kobj_to_dev(kobj);
+	struct smmu_pmu *smmu_pmu = to_smmu_pmu(dev_get_drvdata(dev));
+
+	if (!smmu_pmu->iidr)
+		return 0;
+	return attr->mode;
+}
+
+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,
+	.is_visible = smmu_pmu_identifier_attr_visible,
+};
+
 /* Formats */
 PMU_FORMAT_ATTR(event,		   "config:0-15");
 PMU_FORMAT_ATTR(filter_stream_id,  "config1:0-31");
@@ -575,6 +611,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
 };
 
@@ -795,6 +832,8 @@ static int smmu_pmu_probe(struct platform_device *pdev)
 		return err;
 	}
 
+	smmu_pmu->iidr = readl_relaxed(smmu_pmu->reg_base + SMMU_PMCG_IIDR);
+
 	name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "smmuv3_pmcg_%llx",
 			      (res_0->start) >> SMMU_PMCG_PA_SHIFT);
 	if (!name) {
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* RE: [PATCH v2 2/4] bindings/perf/imx-ddr: update compatible string
  2020-10-08  9:26 ` [PATCH v2 2/4] bindings/perf/imx-ddr: update compatible string John Garry
@ 2020-10-12  9:58   ` Joakim Zhang
  0 siblings, 0 replies; 11+ messages in thread
From: Joakim Zhang @ 2020-10-12  9:58 UTC (permalink / raw)
  To: John Garry, Frank Li, will, mark.rutland, robh+dt, zhangshaokun
  Cc: linuxarm, devicetree, linux-kernel, linux-arm-kernel, acme,
	jolsa, irogers


Hi John,

I saw this binding file has changed to yaml format, this patch seems not need any more.
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/Documentation/devicetree/bindings/perf/fsl-imx-ddr.yaml?h=next-20201009

Best Regards,
Joakim Zhang

> -----Original Message-----
> From: John Garry <john.garry@huawei.com>
> Sent: 2020年10月8日 17:26
> To: Frank Li <frank.li@nxp.com>; will@kernel.org; mark.rutland@arm.com;
> robh+dt@kernel.org; zhangshaokun@hisilicon.com; Joakim Zhang
> <qiangqing.zhang@nxp.com>
> Cc: linuxarm@huawei.com; devicetree@vger.kernel.org;
> linux-kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
> acme@kernel.org; jolsa@redhat.com; irogers@google.com; John Garry
> <john.garry@huawei.com>
> Subject: [PATCH v2 2/4] bindings/perf/imx-ddr: update compatible string
> 
> From: Joakim Zhang <qiangqing.zhang@nxp.com>
> 
> Update compatible string according to driver change.
> 
> [jpg: keep "fsl,imx8m-ddr-pmu", which was being removed]
> 
> Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
> Signed-off-by: John Garry <john.garry@huawei.com>
> ---
>  Documentation/devicetree/bindings/perf/fsl-imx-ddr.txt | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/perf/fsl-imx-ddr.txt
> b/Documentation/devicetree/bindings/perf/fsl-imx-ddr.txt
> index 7822a806ea0a..cc38c7fd7049 100644
> --- a/Documentation/devicetree/bindings/perf/fsl-imx-ddr.txt
> +++ b/Documentation/devicetree/bindings/perf/fsl-imx-ddr.txt
> @@ -5,6 +5,9 @@ Required properties:
>  - compatible: should be one of:
>  	"fsl,imx8-ddr-pmu"
>  	"fsl,imx8m-ddr-pmu"
> +	"fsl,imx8mq-ddr-pmu"
> +	"fsl,imx8mm-ddr-pmu"
> +	"fsl,imx8mn-ddr-pmu"
>  	"fsl,imx8mp-ddr-pmu"
> 
>  - reg: physical address and size
> --
> 2.26.2


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 0/4] perf drivers: Add sysfs identifier file
  2020-10-08  9:26 [PATCH v2 0/4] perf drivers: Add sysfs identifier file John Garry
                   ` (3 preceding siblings ...)
  2020-10-08  9:26 ` [PATCH v2 4/4] perf/smmuv3: Support sysfs identifier file John Garry
@ 2020-11-06 13:36 ` John Garry
  2020-11-25 15:44 ` Will Deacon
  5 siblings, 0 replies; 11+ messages in thread
From: John Garry @ 2020-11-06 13:36 UTC (permalink / raw)
  To: Frank.li, will, mark.rutland, robh+dt, zhangshaokun, qiangqing.zhang
  Cc: linuxarm, devicetree, linux-kernel, linux-arm-kernel, acme,
	jolsa, irogers

On 08/10/2020 10:26, John Garry wrote:

Hi Will, Mark,

Can you have a look at this series please?

You were cc'ed on the v5 rebase of the userspace part which I sent out a 
little while ago.

Cheers,
John

> To allow perf tool to identify a specific implementation of a PMU for
> event alias matching and metric support, expose a per-PMU identifier file.
> 
> There is no standard format for the identifier string. It just should be
> unique per HW implementation.
> 
> Typical methods to retrieve the information for the identifier string
> can include:
> - Hardcoding in the driver, matched via DT bindings compat string,
>    ACPI HID, or similar
> - Directly from DT bindings property
> - Read from some HW identification register
> 
> In this series, for the SMMUv3 PMU and HiSi uncore drivers, a HW ID
> register is read for the identifier. For the imx8 ddr driver, the
> identifier is hardcoded, matched via DT compat string.
> 
> Joakim Zhang (2):
>    bindings/perf/imx-ddr: update compatible string
>    perf/imx_ddr: Add system PMU identifier for userspace
> 
> John Garry (2):
>    drivers/perf: hisi: Add identifier sysfs file
>    perf/smmuv3: Support sysfs identifier file
> 
>   .../devicetree/bindings/perf/fsl-imx-ddr.txt  |  3 ++
>   drivers/perf/arm_smmuv3_pmu.c                 | 39 ++++++++++++++++
>   drivers/perf/fsl_imx8_ddr_perf.c              | 45 +++++++++++++++++--
>   drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c | 16 +++++++
>   drivers/perf/hisilicon/hisi_uncore_hha_pmu.c  | 16 +++++++
>   drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c  | 16 +++++++
>   drivers/perf/hisilicon/hisi_uncore_pmu.c      | 10 +++++
>   drivers/perf/hisilicon/hisi_uncore_pmu.h      |  7 +++
>   8 files changed, 149 insertions(+), 3 deletions(-)
> 


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 0/4] perf drivers: Add sysfs identifier file
  2020-10-08  9:26 [PATCH v2 0/4] perf drivers: Add sysfs identifier file John Garry
                   ` (4 preceding siblings ...)
  2020-11-06 13:36 ` [PATCH v2 0/4] perf drivers: Add " John Garry
@ 2020-11-25 15:44 ` Will Deacon
  2020-11-25 16:00   ` John Garry
  5 siblings, 1 reply; 11+ messages in thread
From: Will Deacon @ 2020-11-25 15:44 UTC (permalink / raw)
  To: qiangqing.zhang, zhangshaokun, mark.rutland, Frank.li,
	John Garry, robh+dt
  Cc: catalin.marinas, kernel-team, Will Deacon, acme, linux-kernel,
	linux-arm-kernel, irogers, jolsa, devicetree, linuxarm

On Thu, 8 Oct 2020 17:26:17 +0800, John Garry wrote:
> To allow perf tool to identify a specific implementation of a PMU for
> event alias matching and metric support, expose a per-PMU identifier file.
> 
> There is no standard format for the identifier string. It just should be
> unique per HW implementation.
> 
> Typical methods to retrieve the information for the identifier string
> can include:
> - Hardcoding in the driver, matched via DT bindings compat string,
>   ACPI HID, or similar
> - Directly from DT bindings property
> - Read from some HW identification register
> 
> [...]

Applied the hisi and smmu parts to will (for-next/perf), thanks!

[1/4] drivers/perf: hisi: Add identifier sysfs file
      https://git.kernel.org/will/c/ac4511c9364c
[...]
[4/4] perf/smmuv3: Support sysfs identifier file
      https://git.kernel.org/will/c/2c255223362e

I've completely lost track of the imx ddr PMU, so I dropped those parts
(patch 3/4 seemed to remove a compatible string from the driver?).

Cheers,
-- 
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 0/4] perf drivers: Add sysfs identifier file
  2020-11-25 15:44 ` Will Deacon
@ 2020-11-25 16:00   ` John Garry
  2020-11-26  1:35     ` Joakim Zhang
  0 siblings, 1 reply; 11+ messages in thread
From: John Garry @ 2020-11-25 16:00 UTC (permalink / raw)
  To: Will Deacon, qiangqing.zhang, zhangshaokun, mark.rutland,
	Frank.li, robh+dt
  Cc: catalin.marinas, kernel-team, acme, linux-kernel,
	linux-arm-kernel, irogers, jolsa, devicetree, linuxarm

On 25/11/2020 15:44, Will Deacon wrote:
> Applied the hisi and smmu parts to will (for-next/perf), thanks!
> 
> [1/4] drivers/perf: hisi: Add identifier sysfs file
>        https://git.kernel.org/will/c/ac4511c9364c
> [...]
> [4/4] perf/smmuv3: Support sysfs identifier file
>        https://git.kernel.org/will/c/2c255223362e
> 

Thanks.

> I've completely lost track of the imx ddr PMU, so I dropped those parts
> (patch 3/4 seemed to remove a compatible string from the driver?).
> 

2/4 needed to be dropped anyway.

@Joakim, can you resend 3/4? And I think that we should keep the 
explicit support for "fsl,imx8m-ddr-pmu" as a good practice in 
imx_ddr_pmu_dt_ids[], while also adding the soc-specific sub compat 
string support

John


^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: [PATCH v2 0/4] perf drivers: Add sysfs identifier file
  2020-11-25 16:00   ` John Garry
@ 2020-11-26  1:35     ` Joakim Zhang
  2020-11-26 11:35       ` John Garry
  0 siblings, 1 reply; 11+ messages in thread
From: Joakim Zhang @ 2020-11-26  1:35 UTC (permalink / raw)
  To: John Garry, Will Deacon, zhangshaokun, mark.rutland, Frank Li, robh+dt
  Cc: catalin.marinas, kernel-team, acme, linux-kernel,
	linux-arm-kernel, irogers, jolsa, devicetree, linuxarm


> -----Original Message-----
> From: John Garry <john.garry@huawei.com>
> Sent: 2020年11月26日 0:00
> To: Will Deacon <will@kernel.org>; Joakim Zhang
> <qiangqing.zhang@nxp.com>; zhangshaokun@hisilicon.com;
> mark.rutland@arm.com; Frank Li <frank.li@nxp.com>; robh+dt@kernel.org
> Cc: catalin.marinas@arm.com; kernel-team@android.com; acme@kernel.org;
> linux-kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
> irogers@google.com; jolsa@redhat.com; devicetree@vger.kernel.org;
> linuxarm@huawei.com
> Subject: Re: [PATCH v2 0/4] perf drivers: Add sysfs identifier file
> 
> On 25/11/2020 15:44, Will Deacon wrote:
> > Applied the hisi and smmu parts to will (for-next/perf), thanks!
> >
> > [1/4] drivers/perf: hisi: Add identifier sysfs file
> >
> > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.
> >
> kernel.org%2Fwill%2Fc%2Fac4511c9364c&amp;data=04%7C01%7Cqiangqing.z
> han
> >
> g%40nxp.com%7Cbc2c0da5b8c04caccd1708d8915b44fd%7C686ea1d3bc2b4c6
> fa92cd
> >
> 99c5c301635%7C0%7C0%7C637419168472681071%7CUnknown%7CTWFpbGZ
> sb3d8eyJWI
> >
> joiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1
> 000&a
> >
> mp;sdata=W2ZFzaMWJgpQncG4HF2x8EaWc0FkYJ69E8rVaFikJEQ%3D&amp;re
> served=0
> > [...]
> > [4/4] perf/smmuv3: Support sysfs identifier file
> >
> > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.
> >
> kernel.org%2Fwill%2Fc%2F2c255223362e&amp;data=04%7C01%7Cqiangqing.
> zhan
> >
> g%40nxp.com%7Cbc2c0da5b8c04caccd1708d8915b44fd%7C686ea1d3bc2b4c6
> fa92cd
> >
> 99c5c301635%7C0%7C0%7C637419168472681071%7CUnknown%7CTWFpbGZ
> sb3d8eyJWI
> >
> joiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1
> 000&a
> >
> mp;sdata=lfmEr2GO9iySRp24zWTObHkWAXEo3an6TxA%2BzXpDlvk%3D&amp;
> reserved
> > =0
> >
> 
> Thanks.
> 
> > I've completely lost track of the imx ddr PMU, so I dropped those
> > parts (patch 3/4 seemed to remove a compatible string from the driver?).
> >
> 
> 2/4 needed to be dropped anyway.
> 
> @Joakim, can you resend 3/4? And I think that we should keep the explicit
> support for "fsl,imx8m-ddr-pmu" as a good practice in imx_ddr_pmu_dt_ids[],
> while also adding the soc-specific sub compat string support

Yes, thanks John. I will follow up.

Best Regards,
Joakim Zhang
> John


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v2 0/4] perf drivers: Add sysfs identifier file
  2020-11-26  1:35     ` Joakim Zhang
@ 2020-11-26 11:35       ` John Garry
  0 siblings, 0 replies; 11+ messages in thread
From: John Garry @ 2020-11-26 11:35 UTC (permalink / raw)
  To: Joakim Zhang, Will Deacon, zhangshaokun, mark.rutland, Frank Li, robh+dt
  Cc: catalin.marinas, kernel-team, acme, linux-kernel,
	linux-arm-kernel, irogers, jolsa, devicetree, linuxarm

On 26/11/2020 01:35, Joakim Zhang wrote:
>> @Joakim, can you resend 3/4? And I think that we should keep the explicit
>> support for "fsl,imx8m-ddr-pmu" as a good practice in imx_ddr_pmu_dt_ids[],
>> while also adding the soc-specific sub compat string support
> Yes, thanks John. I will follow up.
> 

OK, and I can look to advance the perf tool part now.

thanks,
John

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-11-26 11:36 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-08  9:26 [PATCH v2 0/4] perf drivers: Add sysfs identifier file John Garry
2020-10-08  9:26 ` [PATCH v2 1/4] drivers/perf: hisi: Add identifier sysfs file John Garry
2020-10-08  9:26 ` [PATCH v2 2/4] bindings/perf/imx-ddr: update compatible string John Garry
2020-10-12  9:58   ` Joakim Zhang
2020-10-08  9:26 ` [PATCH v2 3/4] perf/imx_ddr: Add system PMU identifier for userspace John Garry
2020-10-08  9:26 ` [PATCH v2 4/4] perf/smmuv3: Support sysfs identifier file John Garry
2020-11-06 13:36 ` [PATCH v2 0/4] perf drivers: Add " John Garry
2020-11-25 15:44 ` Will Deacon
2020-11-25 16:00   ` John Garry
2020-11-26  1:35     ` Joakim Zhang
2020-11-26 11:35       ` John Garry

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).