devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2 0/2] perf/imx_ddr: Add sysfs identifier file
@ 2020-11-30 11:42 Joakim Zhang
  2020-11-30 11:42 ` [PATCH V2 1/2] bindings: perf: imx-ddr: add compatible string Joakim Zhang
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Joakim Zhang @ 2020-11-30 11:42 UTC (permalink / raw)
  To: will, john.garry, robh+dt; +Cc: devicetree, linux-imx, frank.li

Add sysfs identifier file for imx ddr perf.

ChangeLogs:
V1->V2:
	* don't show identifier file if not set.

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

 .../devicetree/bindings/perf/fsl-imx-ddr.yaml |  3 +
 drivers/perf/fsl_imx8_ddr_perf.c              | 55 +++++++++++++++++++
 2 files changed, 58 insertions(+)

-- 
2.17.1


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

* [PATCH V2 1/2] bindings: perf: imx-ddr: add compatible string
  2020-11-30 11:42 [PATCH V2 0/2] perf/imx_ddr: Add sysfs identifier file Joakim Zhang
@ 2020-11-30 11:42 ` Joakim Zhang
  2020-12-09 13:37   ` Rob Herring
  2020-11-30 11:42 ` [PATCH V2 2/2] perf/imx_ddr: Add system PMU identifier for userspace Joakim Zhang
  2020-12-09 14:25 ` [PATCH V2 0/2] perf/imx_ddr: Add sysfs identifier file Will Deacon
  2 siblings, 1 reply; 6+ messages in thread
From: Joakim Zhang @ 2020-11-30 11:42 UTC (permalink / raw)
  To: will, john.garry, robh+dt; +Cc: devicetree, linux-imx, frank.li

Add extra compabile string to support driver.

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

diff --git a/Documentation/devicetree/bindings/perf/fsl-imx-ddr.yaml b/Documentation/devicetree/bindings/perf/fsl-imx-ddr.yaml
index 5aad9f4e0b2a..80a92385367e 100644
--- a/Documentation/devicetree/bindings/perf/fsl-imx-ddr.yaml
+++ b/Documentation/devicetree/bindings/perf/fsl-imx-ddr.yaml
@@ -15,6 +15,9 @@ properties:
       - enum:
           - fsl,imx8-ddr-pmu
           - fsl,imx8m-ddr-pmu
+          - fsl,imx8mq-ddr-pmu
+          - fsl,imx8mm-ddr-pmu
+          - fsl,imx8mn-ddr-pmu
           - fsl,imx8mp-ddr-pmu
       - items:
           - enum:
-- 
2.17.1


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

* [PATCH V2 2/2] perf/imx_ddr: Add system PMU identifier for userspace
  2020-11-30 11:42 [PATCH V2 0/2] perf/imx_ddr: Add sysfs identifier file Joakim Zhang
  2020-11-30 11:42 ` [PATCH V2 1/2] bindings: perf: imx-ddr: add compatible string Joakim Zhang
@ 2020-11-30 11:42 ` Joakim Zhang
  2020-11-30 11:46   ` John Garry
  2020-12-09 14:25 ` [PATCH V2 0/2] perf/imx_ddr: Add sysfs identifier file Will Deacon
  2 siblings, 1 reply; 6+ messages in thread
From: Joakim Zhang @ 2020-11-30 11:42 UTC (permalink / raw)
  To: will, john.garry, robh+dt; +Cc: devicetree, linux-imx, frank.li

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.

Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
---
 drivers/perf/fsl_imx8_ddr_perf.c | 55 ++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)

diff --git a/drivers/perf/fsl_imx8_ddr_perf.c b/drivers/perf/fsl_imx8_ddr_perf.c
index 4f063fb1c6b4..a11bfd8a0823 100644
--- a/drivers/perf/fsl_imx8_ddr_perf.c
+++ b/drivers/perf/fsl_imx8_ddr_perf.c
@@ -50,6 +50,7 @@ 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;
@@ -58,13 +59,32 @@ static const struct fsl_ddr_devtype_data imx8m_devtype_data = {
 	.quirks = DDR_CAP_AXI_ID_FILTER,
 };
 
+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 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 +104,40 @@ 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 umode_t ddr_perf_identifier_attr_visible(struct kobject *kobj,
+						struct attribute *attr,
+						int n)
+{
+	struct device *dev = kobj_to_dev(kobj);
+	struct ddr_pmu *pmu = dev_get_drvdata(dev);
+
+	if (!pmu->devtype_data->identifier)
+		return 0;
+	return attr->mode;
+};
+
+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,
+	.is_visible = ddr_perf_identifier_attr_visible,
+};
+
 enum ddr_perf_filter_capabilities {
 	PERF_CAP_AXI_ID_FILTER = 0,
 	PERF_CAP_AXI_ID_FILTER_ENHANCED,
@@ -237,6 +291,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.17.1


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

* Re: [PATCH V2 2/2] perf/imx_ddr: Add system PMU identifier for userspace
  2020-11-30 11:42 ` [PATCH V2 2/2] perf/imx_ddr: Add system PMU identifier for userspace Joakim Zhang
@ 2020-11-30 11:46   ` John Garry
  0 siblings, 0 replies; 6+ messages in thread
From: John Garry @ 2020-11-30 11:46 UTC (permalink / raw)
  To: Joakim Zhang, will, robh+dt; +Cc: devicetree, linux-imx, frank.li

On 30/11/2020 11:42, Joakim Zhang wrote:
> 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.
> 
> Signed-off-by: Joakim Zhang<qiangqing.zhang@nxp.com>

Reviewed-by: John Garry <john.garry@huawei.com>

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

* Re: [PATCH V2 1/2] bindings: perf: imx-ddr: add compatible string
  2020-11-30 11:42 ` [PATCH V2 1/2] bindings: perf: imx-ddr: add compatible string Joakim Zhang
@ 2020-12-09 13:37   ` Rob Herring
  0 siblings, 0 replies; 6+ messages in thread
From: Rob Herring @ 2020-12-09 13:37 UTC (permalink / raw)
  To: Joakim Zhang; +Cc: frank.li, linux-imx, will, devicetree, robh+dt, john.garry

On Mon, 30 Nov 2020 19:42:01 +0800, Joakim Zhang wrote:
> Add extra compabile string to support driver.
> 
> Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
> ---
>  Documentation/devicetree/bindings/perf/fsl-imx-ddr.yaml | 3 +++
>  1 file changed, 3 insertions(+)
> 

Acked-by: Rob Herring <robh@kernel.org>

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

* Re: [PATCH V2 0/2] perf/imx_ddr: Add sysfs identifier file
  2020-11-30 11:42 [PATCH V2 0/2] perf/imx_ddr: Add sysfs identifier file Joakim Zhang
  2020-11-30 11:42 ` [PATCH V2 1/2] bindings: perf: imx-ddr: add compatible string Joakim Zhang
  2020-11-30 11:42 ` [PATCH V2 2/2] perf/imx_ddr: Add system PMU identifier for userspace Joakim Zhang
@ 2020-12-09 14:25 ` Will Deacon
  2 siblings, 0 replies; 6+ messages in thread
From: Will Deacon @ 2020-12-09 14:25 UTC (permalink / raw)
  To: Joakim Zhang, john.garry, robh+dt
  Cc: catalin.marinas, kernel-team, Will Deacon, frank.li, devicetree,
	linux-imx

On Mon, 30 Nov 2020 19:42:00 +0800, Joakim Zhang wrote:
> Add sysfs identifier file for imx ddr perf.
> 
> ChangeLogs:
> V1->V2:
> 	* don't show identifier file if not set.
> 
> Joakim Zhang (2):
>   bindings: perf: imx-ddr: add compatible string
>   perf/imx_ddr: Add system PMU identifier for userspace
> 
> [...]

Applied to will (for-next/perf), thanks!

[1/2] bindings: perf: imx-ddr: add compatible string
      https://git.kernel.org/will/c/d0c00977a16a
[2/2] perf/imx_ddr: Add system PMU identifier for userspace
      https://git.kernel.org/will/c/881b0520504a

Cheers,
-- 
Will

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

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

end of thread, other threads:[~2020-12-09 14:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-30 11:42 [PATCH V2 0/2] perf/imx_ddr: Add sysfs identifier file Joakim Zhang
2020-11-30 11:42 ` [PATCH V2 1/2] bindings: perf: imx-ddr: add compatible string Joakim Zhang
2020-12-09 13:37   ` Rob Herring
2020-11-30 11:42 ` [PATCH V2 2/2] perf/imx_ddr: Add system PMU identifier for userspace Joakim Zhang
2020-11-30 11:46   ` John Garry
2020-12-09 14:25 ` [PATCH V2 0/2] perf/imx_ddr: Add sysfs identifier file Will Deacon

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).