linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/5] Exynos Performance Monitoring Counters enhancements
       [not found] <CGME20190605091301eucas1p278a554a15879a1b6fbc3d2bb5168f8cb@eucas1p2.samsung.com>
@ 2019-06-05  9:12 ` Lukasz Luba
       [not found]   ` <CGME20190605091301eucas1p2f360a867c8df8ba542942d425289f355@eucas1p2.samsung.com>
                     ` (4 more replies)
  0 siblings, 5 replies; 16+ messages in thread
From: Lukasz Luba @ 2019-06-05  9:12 UTC (permalink / raw)
  To: devicetree, linux-kernel, linux-pm, linux-samsung-soc, linux-arm-kernel
  Cc: b.zolnierkie, krzk, robh+dt, mark.rutland, cw00.choi,
	kyungmin.park, m.szyprowski, s.nawrocki, myungjoo.ham, kgene,
	l.luba, willy.mh.wolff.ml

Hi all,

This patch set extends PPMU on Samsung Exynos by choosing type of data
which shell be counter in the PPMU registers.
It is possible to count e.g. read or write requests, read or write data
or latency.
A new field has been added in the DT 'event' node called 'event-data-type'.
It is them used during the setup of the counter. In the prevoius
implementation there was always one option used: count read+write data.
Sometimes we need more precised information and this patch set tries to
address it.

Changes:
v4:
- changed the way how 'ops' are matched according to Chanwoo's sugestions
  in his example code (added his Signed-off-by to patch 2)
- changed documentation description accoriding to Chanwoo's sugestions
  (added his Signed-off-by to patch 4)
- collected ACKs for patch 1 from Rob and from Chanwoo for patch 2 and
  'Reviewed-by' for patch 1
- patch set is now based on v5.2-rc3 and tested on Odroid u3 
v3 [1]:
- fixed wrong interpretation of ret value during DT parsing, which caused
  alwasy taking default value.
v2 [2]:
 - removed new entry in MAINTAINERS file as suggested by Bartek Zolnierkiewicz
   and added new file to existing list for devfreq events
 - added in the dt-bindings/pmu/exynos_ppmu.h 2 new entries for RO and WO for
   counters in Exynos5433
 - changed initialization with default values when data_type is not provided
   in DT (as sugessted by Chanwoo)
 - added 4th patch which adds 'event-data-type' to 'event' node for Exynos4412
   PPMU events (asked by Chanwoo)

Regards,
Lukasz Luba

[1] https://lkml.org/lkml/2019/4/19/158
[2] https://lkml.org/lkml/2019/4/18/453

Lukasz Luba (5):
  include: dt-bindings: add Performance Monitoring Unit for Exynos
  drivers: devfreq: events: change matching code during probe
  drivers: devfreq: events: extend events by type of counted data
  Documentation: devicetree: add PPMU events description
  DT: arm: exynos4412: add event data type which is monitored

 .../bindings/devfreq/event/exynos-ppmu.txt    | 26 ++++-
 MAINTAINERS                                   |  1 +
 arch/arm/boot/dts/exynos4412-ppmu-common.dtsi | 10 ++
 drivers/devfreq/event/exynos-ppmu.c           | 98 +++++++++++++------
 include/dt-bindings/pmu/exynos_ppmu.h         | 25 +++++
 include/linux/devfreq-event.h                 |  6 ++
 6 files changed, 132 insertions(+), 34 deletions(-)
 create mode 100644 include/dt-bindings/pmu/exynos_ppmu.h

-- 
2.17.1


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

* [PATCH v4 1/5] include: dt-bindings: add Performance Monitoring Unit for Exynos
       [not found]   ` <CGME20190605091301eucas1p2f360a867c8df8ba542942d425289f355@eucas1p2.samsung.com>
@ 2019-06-05  9:12     ` Lukasz Luba
  0 siblings, 0 replies; 16+ messages in thread
From: Lukasz Luba @ 2019-06-05  9:12 UTC (permalink / raw)
  To: devicetree, linux-kernel, linux-pm, linux-samsung-soc, linux-arm-kernel
  Cc: b.zolnierkie, krzk, robh+dt, mark.rutland, cw00.choi,
	kyungmin.park, m.szyprowski, s.nawrocki, myungjoo.ham, kgene,
	l.luba, willy.mh.wolff.ml

This patch add support of a new feature which can be used in DT:
Performance Monitoring Unit with defined event data type.
In this patch the event data types are defined for Exynos PPMU.
The patch also updates the MAINTAINERS file accordingly and
adds the header file to devfreq event subsystem.

Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Lukasz Luba <l.luba@partner.samsung.com>
---
 MAINTAINERS                           |  1 +
 include/dt-bindings/pmu/exynos_ppmu.h | 25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+)
 create mode 100644 include/dt-bindings/pmu/exynos_ppmu.h

diff --git a/MAINTAINERS b/MAINTAINERS
index a6954776a37e..4c1bab87ff4f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4653,6 +4653,7 @@ T:	git git://git.kernel.org/pub/scm/linux/kernel/git/mzx/devfreq.git
 S:	Supported
 F:	drivers/devfreq/event/
 F:	drivers/devfreq/devfreq-event.c
+F:	include/dt-bindings/pmu/exynos_ppmu.h
 F:	include/linux/devfreq-event.h
 F:	Documentation/devicetree/bindings/devfreq/event/
 
diff --git a/include/dt-bindings/pmu/exynos_ppmu.h b/include/dt-bindings/pmu/exynos_ppmu.h
new file mode 100644
index 000000000000..8724abe130f3
--- /dev/null
+++ b/include/dt-bindings/pmu/exynos_ppmu.h
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Samsung Exynos PPMU event types for counting in regs
+ *
+ * Copyright (c) 2019, Samsung Electronics
+ * Author: Lukasz Luba <l.luba@partner.samsung.com>
+ */
+
+#ifndef __DT_BINDINGS_PMU_EXYNOS_PPMU_H
+#define __DT_BINDINGS_PMU_EXYNOS_PPMU_H
+
+#define PPMU_RO_BUSY_CYCLE_CNT		0x0
+#define PPMU_WO_BUSY_CYCLE_CNT		0x1
+#define PPMU_RW_BUSY_CYCLE_CNT		0x2
+#define PPMU_RO_REQUEST_CNT		0x3
+#define PPMU_WO_REQUEST_CNT		0x4
+#define PPMU_RO_DATA_CNT		0x5
+#define PPMU_WO_DATA_CNT		0x6
+#define PPMU_RO_LATENCY			0x12
+#define PPMU_WO_LATENCY			0x16
+#define PPMU_V2_RO_DATA_CNT		0x4
+#define PPMU_V2_WO_DATA_CNT		0x5
+#define PPMU_V2_EVT3_RW_DATA_CNT	0x22
+
+#endif
-- 
2.17.1


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

* [PATCH v4 2/5] drivers: devfreq: events: change matching code during probe
       [not found]   ` <CGME20190605091302eucas1p2b2a959c0889666e95bd727381bceab24@eucas1p2.samsung.com>
@ 2019-06-05  9:12     ` Lukasz Luba
  0 siblings, 0 replies; 16+ messages in thread
From: Lukasz Luba @ 2019-06-05  9:12 UTC (permalink / raw)
  To: devicetree, linux-kernel, linux-pm, linux-samsung-soc, linux-arm-kernel
  Cc: b.zolnierkie, krzk, robh+dt, mark.rutland, cw00.choi,
	kyungmin.park, m.szyprowski, s.nawrocki, myungjoo.ham, kgene,
	l.luba, willy.mh.wolff.ml

The patch changes the way how the 'ops' gets populated for different
device versions. The matching function now uses 'of_device_id' in order
to identify the device type.

Signed-off-by: Lukasz Luba <l.luba@partner.samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
---
 drivers/devfreq/event/exynos-ppmu.c | 38 +++++++++++++++++++----------
 1 file changed, 25 insertions(+), 13 deletions(-)

diff --git a/drivers/devfreq/event/exynos-ppmu.c b/drivers/devfreq/event/exynos-ppmu.c
index c2ea94957501..17f3c86a6f00 100644
--- a/drivers/devfreq/event/exynos-ppmu.c
+++ b/drivers/devfreq/event/exynos-ppmu.c
@@ -16,6 +16,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/of_address.h>
+#include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/regmap.h>
 #include <linux/suspend.h>
@@ -23,6 +24,11 @@
 
 #include "exynos-ppmu.h"
 
+enum exynos_ppmu_type {
+	EXYNOS_TYPE_PPMU,
+	EXYNOS_TYPE_PPMU_V2,
+};
+
 struct exynos_ppmu_data {
 	struct clk *clk;
 };
@@ -36,6 +42,7 @@ struct exynos_ppmu {
 	struct regmap *regmap;
 
 	struct exynos_ppmu_data ppmu;
+	enum exynos_ppmu_type ppmu_type;
 };
 
 #define PPMU_EVENT(name)			\
@@ -483,31 +490,23 @@ static const struct devfreq_event_ops exynos_ppmu_v2_ops = {
 static const struct of_device_id exynos_ppmu_id_match[] = {
 	{
 		.compatible = "samsung,exynos-ppmu",
-		.data = (void *)&exynos_ppmu_ops,
+		.data = (void *)EXYNOS_TYPE_PPMU,
 	}, {
 		.compatible = "samsung,exynos-ppmu-v2",
-		.data = (void *)&exynos_ppmu_v2_ops,
+		.data = (void *)EXYNOS_TYPE_PPMU_V2,
 	},
 	{ /* sentinel */ },
 };
 MODULE_DEVICE_TABLE(of, exynos_ppmu_id_match);
 
-static struct devfreq_event_ops *exynos_bus_get_ops(struct device_node *np)
-{
-	const struct of_device_id *match;
-
-	match = of_match_node(exynos_ppmu_id_match, np);
-	return (struct devfreq_event_ops *)match->data;
-}
-
 static int of_get_devfreq_events(struct device_node *np,
 				 struct exynos_ppmu *info)
 {
 	struct devfreq_event_desc *desc;
-	struct devfreq_event_ops *event_ops;
 	struct device *dev = info->dev;
 	struct device_node *events_np, *node;
 	int i, j, count;
+	const struct of_device_id *of_id;
 
 	events_np = of_get_child_by_name(np, "events");
 	if (!events_np) {
@@ -515,7 +514,6 @@ static int of_get_devfreq_events(struct device_node *np,
 			"failed to get child node of devfreq-event devices\n");
 		return -EINVAL;
 	}
-	event_ops = exynos_bus_get_ops(np);
 
 	count = of_get_child_count(events_np);
 	desc = devm_kcalloc(dev, count, sizeof(*desc), GFP_KERNEL);
@@ -523,6 +521,12 @@ static int of_get_devfreq_events(struct device_node *np,
 		return -ENOMEM;
 	info->num_events = count;
 
+	of_id = of_match_device(exynos_ppmu_id_match, dev);
+	if (of_id)
+		info->ppmu_type = (enum exynos_ppmu_type)of_id->data;
+	else
+		return -EINVAL;
+
 	j = 0;
 	for_each_child_of_node(events_np, node) {
 		for (i = 0; i < ARRAY_SIZE(ppmu_events); i++) {
@@ -540,7 +544,15 @@ static int of_get_devfreq_events(struct device_node *np,
 			continue;
 		}
 
-		desc[j].ops = event_ops;
+		switch (info->ppmu_type) {
+		case EXYNOS_TYPE_PPMU:
+			desc[j].ops = &exynos_ppmu_ops;
+			break;
+		case EXYNOS_TYPE_PPMU_V2:
+			desc[j].ops = &exynos_ppmu_v2_ops;
+			break;
+		}
+
 		desc[j].driver_data = info;
 
 		of_property_read_string(node, "event-name", &desc[j].name);
-- 
2.17.1


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

* [PATCH v4 3/5] drivers: devfreq: events: extend events by type of counted data
       [not found]   ` <CGME20190605091303eucas1p27177d349e0f2bd37bf582dbd7266321a@eucas1p2.samsung.com>
@ 2019-06-05  9:12     ` Lukasz Luba
  2019-07-24 10:15       ` Lukasz Luba
  0 siblings, 1 reply; 16+ messages in thread
From: Lukasz Luba @ 2019-06-05  9:12 UTC (permalink / raw)
  To: devicetree, linux-kernel, linux-pm, linux-samsung-soc, linux-arm-kernel
  Cc: b.zolnierkie, krzk, robh+dt, mark.rutland, cw00.choi,
	kyungmin.park, m.szyprowski, s.nawrocki, myungjoo.ham, kgene,
	l.luba, willy.mh.wolff.ml

This patch adds posibility to choose what type of data should be counted
by the PPMU counter. Now the type comes from DT where the event has been
defined. When there is no 'event-data-type' the default value is used,
which is 'read+write data in bytes'.
It is needed when you want to know not only read+write data bytes but
i.e. only write data in byte, or number of read requests, etc.

Signed-off-by: Lukasz Luba <l.luba@partner.samsung.com>
---
 drivers/devfreq/event/exynos-ppmu.c | 60 ++++++++++++++++++++---------
 include/linux/devfreq-event.h       |  6 +++
 2 files changed, 47 insertions(+), 19 deletions(-)

diff --git a/drivers/devfreq/event/exynos-ppmu.c b/drivers/devfreq/event/exynos-ppmu.c
index 17f3c86a6f00..12f637320e9e 100644
--- a/drivers/devfreq/event/exynos-ppmu.c
+++ b/drivers/devfreq/event/exynos-ppmu.c
@@ -161,9 +161,9 @@ static int exynos_ppmu_set_event(struct devfreq_event_dev *edev)
 	if (ret < 0)
 		return ret;
 
-	/* Set the event of Read/Write data count  */
+	/* Set the event of proper data type monitoring */
 	ret = regmap_write(info->regmap, PPMU_BEVTxSEL(id),
-				PPMU_RO_DATA_CNT | PPMU_WO_DATA_CNT);
+			   edev->desc->data_type);
 	if (ret < 0)
 		return ret;
 
@@ -375,23 +375,11 @@ static int exynos_ppmu_v2_set_event(struct devfreq_event_dev *edev)
 	if (ret < 0)
 		return ret;
 
-	/* Set the event of Read/Write data count  */
-	switch (id) {
-	case PPMU_PMNCNT0:
-	case PPMU_PMNCNT1:
-	case PPMU_PMNCNT2:
-		ret = regmap_write(info->regmap, PPMU_V2_CH_EVx_TYPE(id),
-				PPMU_V2_RO_DATA_CNT | PPMU_V2_WO_DATA_CNT);
-		if (ret < 0)
-			return ret;
-		break;
-	case PPMU_PMNCNT3:
-		ret = regmap_write(info->regmap, PPMU_V2_CH_EVx_TYPE(id),
-				PPMU_V2_EVT3_RW_DATA_CNT);
-		if (ret < 0)
-			return ret;
-		break;
-	}
+	/* Set the event of proper data type monitoring */
+	ret = regmap_write(info->regmap, PPMU_V2_CH_EVx_TYPE(id),
+			   edev->desc->data_type);
+	if (ret < 0)
+		return ret;
 
 	/* Reset cycle counter/performance counter and enable PPMU */
 	ret = regmap_read(info->regmap, PPMU_V2_PMNC, &pmnc);
@@ -507,6 +495,7 @@ static int of_get_devfreq_events(struct device_node *np,
 	struct device_node *events_np, *node;
 	int i, j, count;
 	const struct of_device_id *of_id;
+	int ret;
 
 	events_np = of_get_child_by_name(np, "events");
 	if (!events_np) {
@@ -556,6 +545,39 @@ static int of_get_devfreq_events(struct device_node *np,
 		desc[j].driver_data = info;
 
 		of_property_read_string(node, "event-name", &desc[j].name);
+		ret = of_property_read_u32(node, "event-data-type",
+					   &desc[j].data_type);
+		if (ret) {
+			/* Set the event of proper data type counting.
+			 * Check if the data type has been defined in DT,
+			 * use default if not.
+			 */
+			if (info->ppmu_type == EXYNOS_TYPE_PPMU_V2) {
+				struct devfreq_event_dev edev;
+				int id;
+				/* Not all registers take the same value for
+				 * read+write data count.
+				 */
+				edev.desc = &desc[j];
+				id = exynos_ppmu_find_ppmu_id(&edev);
+
+				switch (id) {
+				case PPMU_PMNCNT0:
+				case PPMU_PMNCNT1:
+				case PPMU_PMNCNT2:
+					desc[j].data_type = PPMU_V2_RO_DATA_CNT
+						| PPMU_V2_WO_DATA_CNT;
+					break;
+				case PPMU_PMNCNT3:
+					desc[j].data_type =
+						PPMU_V2_EVT3_RW_DATA_CNT;
+					break;
+				}
+			} else {
+				desc[j].data_type = PPMU_RO_DATA_CNT |
+					PPMU_WO_DATA_CNT;
+			}
+		}
 
 		j++;
 	}
diff --git a/include/linux/devfreq-event.h b/include/linux/devfreq-event.h
index 4db00b02ca3f..cc160b1274c0 100644
--- a/include/linux/devfreq-event.h
+++ b/include/linux/devfreq-event.h
@@ -81,14 +81,20 @@ struct devfreq_event_ops {
  * struct devfreq_event_desc - the descriptor of devfreq-event device
  *
  * @name	: the name of devfreq-event device.
+ * @data_type	: the data type which is going to be counted in the register.
  * @driver_data	: the private data for devfreq-event driver.
  * @ops		: the operation to control devfreq-event device.
  *
  * Each devfreq-event device is described with a this structure.
  * This structure contains the various data for devfreq-event device.
+ * The data_type describes what is going to be counted in the register.
+ * It might choose to count e.g. read requests, write data in bytes, etc.
+ * The full supported list of types is present in specyfic header in:
+ * include/dt-bindings/pmu/.
  */
 struct devfreq_event_desc {
 	const char *name;
+	u32 data_type;
 	void *driver_data;
 
 	const struct devfreq_event_ops *ops;
-- 
2.17.1


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

* [PATCH v4 4/5] Documentation: devicetree: add PPMU events description
       [not found]   ` <CGME20190605091304eucas1p21e0717cafa17a14de569f1773cc7abe5@eucas1p2.samsung.com>
@ 2019-06-05  9:12     ` Lukasz Luba
       [not found]       ` <CAGTfZH2kTNWtx=Jp1UJaLN50Qxbq+Q9ThV4vhQ240QbOy1TRMQ@mail.gmail.com>
  0 siblings, 1 reply; 16+ messages in thread
From: Lukasz Luba @ 2019-06-05  9:12 UTC (permalink / raw)
  To: devicetree, linux-kernel, linux-pm, linux-samsung-soc, linux-arm-kernel
  Cc: b.zolnierkie, krzk, robh+dt, mark.rutland, cw00.choi,
	kyungmin.park, m.szyprowski, s.nawrocki, myungjoo.ham, kgene,
	l.luba, willy.mh.wolff.ml

Extend the documenation by events description with new 'event-data-type'
field. Add example how the event might be defined in DT.

Signed-off-by: Lukasz Luba <l.luba@partner.samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
---
 .../bindings/devfreq/event/exynos-ppmu.txt    | 26 +++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/devfreq/event/exynos-ppmu.txt b/Documentation/devicetree/bindings/devfreq/event/exynos-ppmu.txt
index 3e36c1d11386..fb46b491791c 100644
--- a/Documentation/devicetree/bindings/devfreq/event/exynos-ppmu.txt
+++ b/Documentation/devicetree/bindings/devfreq/event/exynos-ppmu.txt
@@ -10,14 +10,23 @@ The Exynos PPMU driver uses the devfreq-event class to provide event data
 to various devfreq devices. The devfreq devices would use the event data when
 derterming the current state of each IP.
 
-Required properties:
+Required properties for PPMU device:
 - compatible: Should be "samsung,exynos-ppmu" or "samsung,exynos-ppmu-v2.
 - reg: physical base address of each PPMU and length of memory mapped region.
 
-Optional properties:
+Optional properties for PPMU device:
 - clock-names : the name of clock used by the PPMU, "ppmu"
 - clocks : phandles for clock specified in "clock-names" property
 
+Required properties for 'events' child node of PPMU device:
+- event-name : the unique event name among PPMU device
+Optional properties for 'events' child node of PPMU device:
+- event-data-type : Define the type of data which shell be counted
+by the counter. You can check include/dt-bindings/pmu/exynos_ppmu.h for
+all possible type, i.e. count read requests, count write data in bytes,
+etc. This field is optional and when it is missing, the driver code
+will use default data type.
+
 Example1 : PPMUv1 nodes in exynos3250.dtsi are listed below.
 
 		ppmu_dmc0: ppmu_dmc0@106a0000 {
@@ -145,3 +154,16 @@ Example3 : PPMUv2 nodes in exynos5433.dtsi are listed below.
 			reg = <0x104d0000 0x2000>;
 			status = "disabled";
 		};
+
+Example4 : 'event-data-type' in exynos4412-ppmu-common.dtsi are listed below.
+
+	&ppmu_dmc0 {
+		status = "okay";
+		events {
+			ppmu_dmc0_3: ppmu-event3-dmc0 {
+			event-name = "ppmu-event3-dmc0";
+			event-data-type = <(PPMU_RO_DATA_CNT |
+					PPMU_WO_DATA_CNT)>;
+			};
+		};
+	};
-- 
2.17.1


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

* [PATCH v4 5/5] DT: arm: exynos4412: add event data type which is monitored
       [not found]   ` <CGME20190605091305eucas1p136332cc3d1a299d90617bddcb365bee0@eucas1p1.samsung.com>
@ 2019-06-05  9:12     ` Lukasz Luba
  2019-07-23 17:58       ` Krzysztof Kozlowski
  0 siblings, 1 reply; 16+ messages in thread
From: Lukasz Luba @ 2019-06-05  9:12 UTC (permalink / raw)
  To: devicetree, linux-kernel, linux-pm, linux-samsung-soc, linux-arm-kernel
  Cc: b.zolnierkie, krzk, robh+dt, mark.rutland, cw00.choi,
	kyungmin.park, m.szyprowski, s.nawrocki, myungjoo.ham, kgene,
	l.luba, willy.mh.wolff.ml

The patch adds new field in the PPMU event which shows explicitly
what kind of data the event is monitoring. It is possible to change it
using defined values in exynos_ppmu.h file.

Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Lukasz Luba <l.luba@partner.samsung.com>
---
 arch/arm/boot/dts/exynos4412-ppmu-common.dtsi | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm/boot/dts/exynos4412-ppmu-common.dtsi b/arch/arm/boot/dts/exynos4412-ppmu-common.dtsi
index 3a3b2fafefdd..549faba85a7a 100644
--- a/arch/arm/boot/dts/exynos4412-ppmu-common.dtsi
+++ b/arch/arm/boot/dts/exynos4412-ppmu-common.dtsi
@@ -6,12 +6,16 @@
  * Author: Chanwoo Choi <cw00.choi@samsung.com>
  */
 
+#include <dt-bindings/pmu/exynos_ppmu.h>
+
 &ppmu_dmc0 {
        status = "okay";
 
        events {
 	       ppmu_dmc0_3: ppmu-event3-dmc0 {
 		       event-name = "ppmu-event3-dmc0";
+		       event-data-type = <(PPMU_RO_DATA_CNT |
+					   PPMU_WO_DATA_CNT)>;
 	       };
        };
 };
@@ -22,6 +26,8 @@
        events {
 	       ppmu_dmc1_3: ppmu-event3-dmc1 {
 		       event-name = "ppmu-event3-dmc1";
+		       event-data-type = <(PPMU_RO_DATA_CNT |
+					   PPMU_WO_DATA_CNT)>;
 	       };
        };
 };
@@ -32,6 +38,8 @@
        events {
 	       ppmu_leftbus_3: ppmu-event3-leftbus {
 		       event-name = "ppmu-event3-leftbus";
+		       event-data-type = <(PPMU_RO_DATA_CNT |
+					   PPMU_WO_DATA_CNT)>;
 	       };
        };
 };
@@ -42,6 +50,8 @@
        events {
 	       ppmu_rightbus_3: ppmu-event3-rightbus {
 		       event-name = "ppmu-event3-rightbus";
+		       event-data-type = <(PPMU_RO_DATA_CNT |
+					   PPMU_WO_DATA_CNT)>;
 	       };
        };
 };
-- 
2.17.1


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

* Re: [PATCH v4 4/5] Documentation: devicetree: add PPMU events description
       [not found]       ` <CAGTfZH2kTNWtx=Jp1UJaLN50Qxbq+Q9ThV4vhQ240QbOy1TRMQ@mail.gmail.com>
@ 2019-06-26 13:58         ` Lukasz Luba
  2019-06-26 14:03           ` Krzysztof Kozlowski
  0 siblings, 1 reply; 16+ messages in thread
From: Lukasz Luba @ 2019-06-26 13:58 UTC (permalink / raw)
  To: cwchoi00
  Cc: devicetree, linux-kernel, linux-pm, linux-samsung-soc,
	linux-arm-kernel, b.zolnierkie, krzk, robh+dt, mark.rutland,
	cw00.choi, kyungmin.park, m.szyprowski, s.nawrocki, myungjoo.ham,
	kgene, willy.mh.wolff.ml

Hi Chanwoo,

On 6/26/19 10:23 AM, Chanwoo Choi wrote:
> Hi Lukasz,
> 
> 2019년 6월 5일 (수) 18:14, Lukasz Luba <l.luba@partner.samsung.com 
> <mailto:l.luba@partner.samsung.com>>님이 작성:
> 
>     Extend the documenation by events description with new 'event-data-type'
>     field. Add example how the event might be defined in DT.
> 
>     Signed-off-by: Lukasz Luba <l.luba@partner.samsung.com
>     <mailto:l.luba@partner.samsung.com>>
>     Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com
>     <mailto:cw00.choi@samsung.com>>
>     ---
>       .../bindings/devfreq/event/exynos-ppmu.txt    | 26 +++++++++++++++++--
>       1 file changed, 24 insertions(+), 2 deletions(-)
> 
> 
> 
> Acked-by: Chanwoo Choi <cw00.choi@samsung.com 

Thank you for the ACKs for this a 2/5 patch.
Do you think the v4 could be merged now?

Regards,
Lukasz

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

* Re: [PATCH v4 4/5] Documentation: devicetree: add PPMU events description
  2019-06-26 13:58         ` Lukasz Luba
@ 2019-06-26 14:03           ` Krzysztof Kozlowski
  2019-06-26 14:17             ` Lukasz Luba
  0 siblings, 1 reply; 16+ messages in thread
From: Krzysztof Kozlowski @ 2019-06-26 14:03 UTC (permalink / raw)
  To: Lukasz Luba
  Cc: cwchoi00, devicetree, linux-kernel, linux-pm, linux-samsung-soc,
	linux-arm-kernel, Bartłomiej Żołnierkiewicz,
	robh+dt, mark.rutland, Chanwoo Choi, kyungmin.park,
	Marek Szyprowski, s.nawrocki, myungjoo.ham, kgene,
	willy.mh.wolff.ml

On Wed, 26 Jun 2019 at 15:58, Lukasz Luba <l.luba@partner.samsung.com> wrote:
>
> Hi Chanwoo,
>
> On 6/26/19 10:23 AM, Chanwoo Choi wrote:
> > Hi Lukasz,
> >
> > 2019년 6월 5일 (수) 18:14, Lukasz Luba <l.luba@partner.samsung.com
> > <mailto:l.luba@partner.samsung.com>>님이 작성:
> >
> >     Extend the documenation by events description with new 'event-data-type'
> >     field. Add example how the event might be defined in DT.
> >
> >     Signed-off-by: Lukasz Luba <l.luba@partner.samsung.com
> >     <mailto:l.luba@partner.samsung.com>>
> >     Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com
> >     <mailto:cw00.choi@samsung.com>>
> >     ---
> >       .../bindings/devfreq/event/exynos-ppmu.txt    | 26 +++++++++++++++++--
> >       1 file changed, 24 insertions(+), 2 deletions(-)
> >
> >
> >
> > Acked-by: Chanwoo Choi <cw00.choi@samsung.com
>
> Thank you for the ACKs for this a 2/5 patch.
> Do you think the v4 could be merged now?

I think you have all necessary acks. I can take the DTS patch (5/5)
although probably for next merge window as I just sent one.

Best regards,
Krzysztof

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

* Re: [PATCH v4 4/5] Documentation: devicetree: add PPMU events description
  2019-06-26 14:03           ` Krzysztof Kozlowski
@ 2019-06-26 14:17             ` Lukasz Luba
  2019-06-27  1:11               ` Chanwoo Choi
  0 siblings, 1 reply; 16+ messages in thread
From: Lukasz Luba @ 2019-06-26 14:17 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: cwchoi00, devicetree, linux-kernel, linux-pm, linux-samsung-soc,
	linux-arm-kernel, Bartłomiej Żołnierkiewicz,
	robh+dt, mark.rutland, Chanwoo Choi, kyungmin.park,
	Marek Szyprowski, s.nawrocki, myungjoo.ham, kgene,
	willy.mh.wolff.ml

Hi Krzysztof,

On 6/26/19 4:03 PM, Krzysztof Kozlowski wrote:
> On Wed, 26 Jun 2019 at 15:58, Lukasz Luba <l.luba@partner.samsung.com> wrote:
>>
>> Hi Chanwoo,
>>
>> On 6/26/19 10:23 AM, Chanwoo Choi wrote:
>>> Hi Lukasz,
>>>
>>> 2019년 6월 5일 (수) 18:14, Lukasz Luba <l.luba@partner.samsung.com
>>> <mailto:l.luba@partner.samsung.com>>님이 작성:
>>>
>>>      Extend the documenation by events description with new 'event-data-type'
>>>      field. Add example how the event might be defined in DT.
>>>
>>>      Signed-off-by: Lukasz Luba <l.luba@partner.samsung.com
>>>      <mailto:l.luba@partner.samsung.com>>
>>>      Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com
>>>      <mailto:cw00.choi@samsung.com>>
>>>      ---
>>>        .../bindings/devfreq/event/exynos-ppmu.txt    | 26 +++++++++++++++++--
>>>        1 file changed, 24 insertions(+), 2 deletions(-)
>>>
>>>
>>>
>>> Acked-by: Chanwoo Choi <cw00.choi@samsung.com
>>
>> Thank you for the ACKs for this a 2/5 patch.
>> Do you think the v4 could be merged now?
> 
> I think you have all necessary acks. I can take the DTS patch (5/5)
> although probably for next merge window as I just sent one.
There was one patch 3/5
https://lkml.org/lkml/2019/6/5/215
which was waiting ACK or I missed the email somehow.

Regards,
Lukasz

> 
> Best regards,
> Krzysztof
> 
> 

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

* Re: [PATCH v4 4/5] Documentation: devicetree: add PPMU events description
  2019-06-26 14:17             ` Lukasz Luba
@ 2019-06-27  1:11               ` Chanwoo Choi
  2019-06-27 10:31                 ` Lukasz Luba
  0 siblings, 1 reply; 16+ messages in thread
From: Chanwoo Choi @ 2019-06-27  1:11 UTC (permalink / raw)
  To: Lukasz Luba, Krzysztof Kozlowski
  Cc: cwchoi00, devicetree, linux-kernel, linux-pm, linux-samsung-soc,
	linux-arm-kernel, Bartłomiej Żołnierkiewicz,
	robh+dt, mark.rutland, kyungmin.park, Marek Szyprowski,
	s.nawrocki, myungjoo.ham, kgene, willy.mh.wolff.ml

Hi Lukasz,

On 19. 6. 26. 오후 11:17, Lukasz Luba wrote:
> Hi Krzysztof,
> 
> On 6/26/19 4:03 PM, Krzysztof Kozlowski wrote:
>> On Wed, 26 Jun 2019 at 15:58, Lukasz Luba <l.luba@partner.samsung.com> wrote:
>>>
>>> Hi Chanwoo,
>>>
>>> On 6/26/19 10:23 AM, Chanwoo Choi wrote:
>>>> Hi Lukasz,
>>>>
>>>> 2019년 6월 5일 (수) 18:14, Lukasz Luba <l.luba@partner.samsung.com
>>>> <mailto:l.luba@partner.samsung.com>>님이 작성:
>>>>
>>>>      Extend the documenation by events description with new 'event-data-type'
>>>>      field. Add example how the event might be defined in DT.
>>>>
>>>>      Signed-off-by: Lukasz Luba <l.luba@partner.samsung.com
>>>>      <mailto:l.luba@partner.samsung.com>>
>>>>      Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com
>>>>      <mailto:cw00.choi@samsung.com>>
>>>>      ---
>>>>        .../bindings/devfreq/event/exynos-ppmu.txt    | 26 +++++++++++++++++--
>>>>        1 file changed, 24 insertions(+), 2 deletions(-)
>>>>
>>>>
>>>>
>>>> Acked-by: Chanwoo Choi <cw00.choi@samsung.com
>>>
>>> Thank you for the ACKs for this a 2/5 patch.
>>> Do you think the v4 could be merged now?
>>
>> I think you have all necessary acks. I can take the DTS patch (5/5)
>> although probably for next merge window as I just sent one.
> There was one patch 3/5
> https://protect2.fireeye.com/url?k=82dd0d0cbe2abd04.82dc8643-d13ecd7e5f989b8d&u=https://lkml.org/lkml/2019/6/5/215
> which was waiting ACK or I missed the email somehow.

When I was in vacation, your patches are removed on my email account
because of the email expiration. So, I replied with my Ack through
gmail account on mobile phone. But, there are some problem. My reply
didn't arrive the mailing list.

I have no any way to reply about this at company. After leaving one's
office, I'll reply with Ack again at home.

> 
> Regards,
> Lukasz
> 
>>
>> Best regards,
>> Krzysztof
>>
>>
> 
> 


-- 
Best Regards,
Chanwoo Choi
Samsung Electronics

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

* Re: [PATCH v4 4/5] Documentation: devicetree: add PPMU events description
  2019-06-27  1:11               ` Chanwoo Choi
@ 2019-06-27 10:31                 ` Lukasz Luba
  0 siblings, 0 replies; 16+ messages in thread
From: Lukasz Luba @ 2019-06-27 10:31 UTC (permalink / raw)
  To: Chanwoo Choi, Krzysztof Kozlowski, cwchoi00
  Cc: devicetree, linux-kernel, linux-pm, linux-samsung-soc,
	linux-arm-kernel, Bartłomiej Żołnierkiewicz,
	robh+dt, mark.rutland, kyungmin.park, Marek Szyprowski,
	s.nawrocki, myungjoo.ham, kgene, willy.mh.wolff.ml

Hi Chanwoo,

On 6/27/19 3:11 AM, Chanwoo Choi wrote:
> Hi Lukasz,
> 
> On 19. 6. 26. 오후 11:17, Lukasz Luba wrote:
>> Hi Krzysztof,
>>
>> On 6/26/19 4:03 PM, Krzysztof Kozlowski wrote:
>>> On Wed, 26 Jun 2019 at 15:58, Lukasz Luba <l.luba@partner.samsung.com> wrote:
>>>>
>>>> Hi Chanwoo,
>>>>
>>>> On 6/26/19 10:23 AM, Chanwoo Choi wrote:
>>>>> Hi Lukasz,
>>>>>
>>>>> 2019년 6월 5일 (수) 18:14, Lukasz Luba <l.luba@partner.samsung.com
>>>>> <mailto:l.luba@partner.samsung.com>>님이 작성:
>>>>>
>>>>>       Extend the documenation by events description with new 'event-data-type'
>>>>>       field. Add example how the event might be defined in DT.
>>>>>
>>>>>       Signed-off-by: Lukasz Luba <l.luba@partner.samsung.com
>>>>>       <mailto:l.luba@partner.samsung.com>>
>>>>>       Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com
>>>>>       <mailto:cw00.choi@samsung.com>>
>>>>>       ---
>>>>>         .../bindings/devfreq/event/exynos-ppmu.txt    | 26 +++++++++++++++++--
>>>>>         1 file changed, 24 insertions(+), 2 deletions(-)
>>>>>
>>>>>
>>>>>
>>>>> Acked-by: Chanwoo Choi <cw00.choi@samsung.com
>>>>
>>>> Thank you for the ACKs for this a 2/5 patch.
>>>> Do you think the v4 could be merged now?
>>>
>>> I think you have all necessary acks. I can take the DTS patch (5/5)
>>> although probably for next merge window as I just sent one.
>> There was one patch 3/5
>> https://protect2.fireeye.com/url?k=82dd0d0cbe2abd04.82dc8643-d13ecd7e5f989b8d&u=https://lkml.org/lkml/2019/6/5/215
>> which was waiting ACK or I missed the email somehow.
> 
> When I was in vacation, your patches are removed on my email account
> because of the email expiration. So, I replied with my Ack through
> gmail account on mobile phone. But, there are some problem. My reply
> didn't arrive the mailing list.
> 
> I have no any way to reply about this at company. After leaving one's
> office, I'll reply with Ack again at home.
> 
OK, no worries, it is not an emergency issue.
Regards,
Lukasz

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

* Re: [PATCH v4 5/5] DT: arm: exynos4412: add event data type which is monitored
  2019-06-05  9:12     ` [PATCH v4 5/5] DT: arm: exynos4412: add event data type which is monitored Lukasz Luba
@ 2019-07-23 17:58       ` Krzysztof Kozlowski
  2019-07-24 10:09         ` Lukasz Luba
  0 siblings, 1 reply; 16+ messages in thread
From: Krzysztof Kozlowski @ 2019-07-23 17:58 UTC (permalink / raw)
  To: Lukasz Luba
  Cc: devicetree, linux-kernel, linux-pm, linux-samsung-soc,
	linux-arm-kernel, b.zolnierkie, robh+dt, mark.rutland, cw00.choi,
	kyungmin.park, m.szyprowski, s.nawrocki, myungjoo.ham, kgene,
	willy.mh.wolff.ml

On Wed, Jun 05, 2019 at 11:12:36AM +0200, Lukasz Luba wrote:
> The patch adds new field in the PPMU event which shows explicitly
> what kind of data the event is monitoring. It is possible to change it
> using defined values in exynos_ppmu.h file.
> 
> Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
> Signed-off-by: Lukasz Luba <l.luba@partner.samsung.com>
> ---
>  arch/arm/boot/dts/exynos4412-ppmu-common.dtsi | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 

I tried to apply this... but prerequisites were not merged into
v5.3-rc1. This one will have to wait then till next release.

Best regards,
Krzysztof


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

* Re: [PATCH v4 5/5] DT: arm: exynos4412: add event data type which is monitored
  2019-07-23 17:58       ` Krzysztof Kozlowski
@ 2019-07-24 10:09         ` Lukasz Luba
  0 siblings, 0 replies; 16+ messages in thread
From: Lukasz Luba @ 2019-07-24 10:09 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: devicetree, linux-kernel, linux-pm, linux-samsung-soc,
	linux-arm-kernel, b.zolnierkie, robh+dt, mark.rutland, cw00.choi,
	kyungmin.park, m.szyprowski, s.nawrocki, myungjoo.ham, kgene,
	willy.mh.wolff.ml

Hi Krzysztof,

On 7/23/19 7:58 PM, Krzysztof Kozlowski wrote:
> On Wed, Jun 05, 2019 at 11:12:36AM +0200, Lukasz Luba wrote:
>> The patch adds new field in the PPMU event which shows explicitly
>> what kind of data the event is monitoring. It is possible to change it
>> using defined values in exynos_ppmu.h file.
>>
>> Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
>> Signed-off-by: Lukasz Luba <l.luba@partner.samsung.com>
>> ---
>>   arch/arm/boot/dts/exynos4412-ppmu-common.dtsi | 10 ++++++++++
>>   1 file changed, 10 insertions(+)
>>
> 
> I tried to apply this... but prerequisites were not merged into
> v5.3-rc1. This one will have to wait then till next release.
Indeed, I will ask Chanwoo for ack for patch 4/5.

Regards,
Lukasz
> 
> Best regards,
> Krzysztof
> 
> 
> 

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

* Re: [PATCH v4 3/5] drivers: devfreq: events: extend events by type of counted data
  2019-06-05  9:12     ` [PATCH v4 3/5] drivers: devfreq: events: extend events by type of counted data Lukasz Luba
@ 2019-07-24 10:15       ` Lukasz Luba
  2019-07-24 10:24         ` Chanwoo Choi
  0 siblings, 1 reply; 16+ messages in thread
From: Lukasz Luba @ 2019-07-24 10:15 UTC (permalink / raw)
  To: devicetree, linux-kernel, linux-pm, linux-samsung-soc,
	linux-arm-kernel, cw00.choi
  Cc: b.zolnierkie, krzk, robh+dt, mark.rutland, kyungmin.park,
	m.szyprowski, s.nawrocki, myungjoo.ham, kgene, willy.mh.wolff.ml

Hi Chanwoo,

Could you have a look a this patch, please?
This patch has been rewritten accorifing to your suggestion.
Krzysztof tried to apply 5/5 DT patch on his current branch,
but it is missing earlier stuff.
The other patches have needed ACKs so could go through devfreq tree
probably, but this one left.

Regards,
Lukasz

On 6/5/19 11:12 AM, Lukasz Luba wrote:
> This patch adds posibility to choose what type of data should be counted
> by the PPMU counter. Now the type comes from DT where the event has been
> defined. When there is no 'event-data-type' the default value is used,
> which is 'read+write data in bytes'.
> It is needed when you want to know not only read+write data bytes but
> i.e. only write data in byte, or number of read requests, etc.
> 
> Signed-off-by: Lukasz Luba <l.luba@partner.samsung.com>
> ---
>   drivers/devfreq/event/exynos-ppmu.c | 60 ++++++++++++++++++++---------
>   include/linux/devfreq-event.h       |  6 +++
>   2 files changed, 47 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/devfreq/event/exynos-ppmu.c b/drivers/devfreq/event/exynos-ppmu.c
> index 17f3c86a6f00..12f637320e9e 100644
> --- a/drivers/devfreq/event/exynos-ppmu.c
> +++ b/drivers/devfreq/event/exynos-ppmu.c
> @@ -161,9 +161,9 @@ static int exynos_ppmu_set_event(struct devfreq_event_dev *edev)
>   	if (ret < 0)
>   		return ret;
>   
> -	/* Set the event of Read/Write data count  */
> +	/* Set the event of proper data type monitoring */
>   	ret = regmap_write(info->regmap, PPMU_BEVTxSEL(id),
> -				PPMU_RO_DATA_CNT | PPMU_WO_DATA_CNT);
> +			   edev->desc->data_type);
>   	if (ret < 0)
>   		return ret;
>   
> @@ -375,23 +375,11 @@ static int exynos_ppmu_v2_set_event(struct devfreq_event_dev *edev)
>   	if (ret < 0)
>   		return ret;
>   
> -	/* Set the event of Read/Write data count  */
> -	switch (id) {
> -	case PPMU_PMNCNT0:
> -	case PPMU_PMNCNT1:
> -	case PPMU_PMNCNT2:
> -		ret = regmap_write(info->regmap, PPMU_V2_CH_EVx_TYPE(id),
> -				PPMU_V2_RO_DATA_CNT | PPMU_V2_WO_DATA_CNT);
> -		if (ret < 0)
> -			return ret;
> -		break;
> -	case PPMU_PMNCNT3:
> -		ret = regmap_write(info->regmap, PPMU_V2_CH_EVx_TYPE(id),
> -				PPMU_V2_EVT3_RW_DATA_CNT);
> -		if (ret < 0)
> -			return ret;
> -		break;
> -	}
> +	/* Set the event of proper data type monitoring */
> +	ret = regmap_write(info->regmap, PPMU_V2_CH_EVx_TYPE(id),
> +			   edev->desc->data_type);
> +	if (ret < 0)
> +		return ret;
>   
>   	/* Reset cycle counter/performance counter and enable PPMU */
>   	ret = regmap_read(info->regmap, PPMU_V2_PMNC, &pmnc);
> @@ -507,6 +495,7 @@ static int of_get_devfreq_events(struct device_node *np,
>   	struct device_node *events_np, *node;
>   	int i, j, count;
>   	const struct of_device_id *of_id;
> +	int ret;
>   
>   	events_np = of_get_child_by_name(np, "events");
>   	if (!events_np) {
> @@ -556,6 +545,39 @@ static int of_get_devfreq_events(struct device_node *np,
>   		desc[j].driver_data = info;
>   
>   		of_property_read_string(node, "event-name", &desc[j].name);
> +		ret = of_property_read_u32(node, "event-data-type",
> +					   &desc[j].data_type);
> +		if (ret) {
> +			/* Set the event of proper data type counting.
> +			 * Check if the data type has been defined in DT,
> +			 * use default if not.
> +			 */
> +			if (info->ppmu_type == EXYNOS_TYPE_PPMU_V2) {
> +				struct devfreq_event_dev edev;
> +				int id;
> +				/* Not all registers take the same value for
> +				 * read+write data count.
> +				 */
> +				edev.desc = &desc[j];
> +				id = exynos_ppmu_find_ppmu_id(&edev);
> +
> +				switch (id) {
> +				case PPMU_PMNCNT0:
> +				case PPMU_PMNCNT1:
> +				case PPMU_PMNCNT2:
> +					desc[j].data_type = PPMU_V2_RO_DATA_CNT
> +						| PPMU_V2_WO_DATA_CNT;
> +					break;
> +				case PPMU_PMNCNT3:
> +					desc[j].data_type =
> +						PPMU_V2_EVT3_RW_DATA_CNT;
> +					break;
> +				}
> +			} else {
> +				desc[j].data_type = PPMU_RO_DATA_CNT |
> +					PPMU_WO_DATA_CNT;
> +			}
> +		}
>   
>   		j++;
>   	}
> diff --git a/include/linux/devfreq-event.h b/include/linux/devfreq-event.h
> index 4db00b02ca3f..cc160b1274c0 100644
> --- a/include/linux/devfreq-event.h
> +++ b/include/linux/devfreq-event.h
> @@ -81,14 +81,20 @@ struct devfreq_event_ops {
>    * struct devfreq_event_desc - the descriptor of devfreq-event device
>    *
>    * @name	: the name of devfreq-event device.
> + * @data_type	: the data type which is going to be counted in the register.
>    * @driver_data	: the private data for devfreq-event driver.
>    * @ops		: the operation to control devfreq-event device.
>    *
>    * Each devfreq-event device is described with a this structure.
>    * This structure contains the various data for devfreq-event device.
> + * The data_type describes what is going to be counted in the register.
> + * It might choose to count e.g. read requests, write data in bytes, etc.
> + * The full supported list of types is present in specyfic header in:
> + * include/dt-bindings/pmu/.
>    */
>   struct devfreq_event_desc {
>   	const char *name;
> +	u32 data_type;
>   	void *driver_data;
>   
>   	const struct devfreq_event_ops *ops;
> 

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

* Re: [PATCH v4 3/5] drivers: devfreq: events: extend events by type of counted data
  2019-07-24 10:15       ` Lukasz Luba
@ 2019-07-24 10:24         ` Chanwoo Choi
  2019-07-25 16:23           ` Lukasz Luba
  0 siblings, 1 reply; 16+ messages in thread
From: Chanwoo Choi @ 2019-07-24 10:24 UTC (permalink / raw)
  To: Lukasz Luba, devicetree, linux-kernel, linux-pm,
	linux-samsung-soc, linux-arm-kernel
  Cc: b.zolnierkie, krzk, robh+dt, mark.rutland, kyungmin.park,
	m.szyprowski, s.nawrocki, myungjoo.ham, kgene, willy.mh.wolff.ml

Hi Lukasz,

On 19. 7. 24. 오후 7:15, Lukasz Luba wrote:
> Hi Chanwoo,
> 
> Could you have a look a this patch, please?
> This patch has been rewritten accorifing to your suggestion.
> Krzysztof tried to apply 5/5 DT patch on his current branch,
> but it is missing earlier stuff.
> The other patches have needed ACKs so could go through devfreq tree
> probably, but this one left.

Sorry for the late reply. It looks good to me.

Acked-by: Chanwoo Choi <cw00.choi@samsung.com>

> 
> Regards,
> Lukasz
> 
> On 6/5/19 11:12 AM, Lukasz Luba wrote:
>> This patch adds posibility to choose what type of data should be counted
>> by the PPMU counter. Now the type comes from DT where the event has been
>> defined. When there is no 'event-data-type' the default value is used,
>> which is 'read+write data in bytes'.
>> It is needed when you want to know not only read+write data bytes but
>> i.e. only write data in byte, or number of read requests, etc.
>>
>> Signed-off-by: Lukasz Luba <l.luba@partner.samsung.com>
>> ---
>>   drivers/devfreq/event/exynos-ppmu.c | 60 ++++++++++++++++++++---------
>>   include/linux/devfreq-event.h       |  6 +++
>>   2 files changed, 47 insertions(+), 19 deletions(-)
>>
>> diff --git a/drivers/devfreq/event/exynos-ppmu.c b/drivers/devfreq/event/exynos-ppmu.c
>> index 17f3c86a6f00..12f637320e9e 100644
>> --- a/drivers/devfreq/event/exynos-ppmu.c
>> +++ b/drivers/devfreq/event/exynos-ppmu.c
>> @@ -161,9 +161,9 @@ static int exynos_ppmu_set_event(struct devfreq_event_dev *edev)
>>   	if (ret < 0)
>>   		return ret;
>>   
>> -	/* Set the event of Read/Write data count  */
>> +	/* Set the event of proper data type monitoring */
>>   	ret = regmap_write(info->regmap, PPMU_BEVTxSEL(id),
>> -				PPMU_RO_DATA_CNT | PPMU_WO_DATA_CNT);
>> +			   edev->desc->data_type);
>>   	if (ret < 0)
>>   		return ret;
>>   
>> @@ -375,23 +375,11 @@ static int exynos_ppmu_v2_set_event(struct devfreq_event_dev *edev)
>>   	if (ret < 0)
>>   		return ret;
>>   
>> -	/* Set the event of Read/Write data count  */
>> -	switch (id) {
>> -	case PPMU_PMNCNT0:
>> -	case PPMU_PMNCNT1:
>> -	case PPMU_PMNCNT2:
>> -		ret = regmap_write(info->regmap, PPMU_V2_CH_EVx_TYPE(id),
>> -				PPMU_V2_RO_DATA_CNT | PPMU_V2_WO_DATA_CNT);
>> -		if (ret < 0)
>> -			return ret;
>> -		break;
>> -	case PPMU_PMNCNT3:
>> -		ret = regmap_write(info->regmap, PPMU_V2_CH_EVx_TYPE(id),
>> -				PPMU_V2_EVT3_RW_DATA_CNT);
>> -		if (ret < 0)
>> -			return ret;
>> -		break;
>> -	}
>> +	/* Set the event of proper data type monitoring */
>> +	ret = regmap_write(info->regmap, PPMU_V2_CH_EVx_TYPE(id),
>> +			   edev->desc->data_type);
>> +	if (ret < 0)
>> +		return ret;
>>   
>>   	/* Reset cycle counter/performance counter and enable PPMU */
>>   	ret = regmap_read(info->regmap, PPMU_V2_PMNC, &pmnc);
>> @@ -507,6 +495,7 @@ static int of_get_devfreq_events(struct device_node *np,
>>   	struct device_node *events_np, *node;
>>   	int i, j, count;
>>   	const struct of_device_id *of_id;
>> +	int ret;
>>   
>>   	events_np = of_get_child_by_name(np, "events");
>>   	if (!events_np) {
>> @@ -556,6 +545,39 @@ static int of_get_devfreq_events(struct device_node *np,
>>   		desc[j].driver_data = info;
>>   
>>   		of_property_read_string(node, "event-name", &desc[j].name);
>> +		ret = of_property_read_u32(node, "event-data-type",
>> +					   &desc[j].data_type);
>> +		if (ret) {
>> +			/* Set the event of proper data type counting.
>> +			 * Check if the data type has been defined in DT,
>> +			 * use default if not.
>> +			 */
>> +			if (info->ppmu_type == EXYNOS_TYPE_PPMU_V2) {
>> +				struct devfreq_event_dev edev;
>> +				int id;
>> +				/* Not all registers take the same value for
>> +				 * read+write data count.
>> +				 */
>> +				edev.desc = &desc[j];
>> +				id = exynos_ppmu_find_ppmu_id(&edev);
>> +
>> +				switch (id) {
>> +				case PPMU_PMNCNT0:
>> +				case PPMU_PMNCNT1:
>> +				case PPMU_PMNCNT2:
>> +					desc[j].data_type = PPMU_V2_RO_DATA_CNT
>> +						| PPMU_V2_WO_DATA_CNT;
>> +					break;
>> +				case PPMU_PMNCNT3:
>> +					desc[j].data_type =
>> +						PPMU_V2_EVT3_RW_DATA_CNT;
>> +					break;
>> +				}
>> +			} else {
>> +				desc[j].data_type = PPMU_RO_DATA_CNT |
>> +					PPMU_WO_DATA_CNT;
>> +			}
>> +		}
>>   
>>   		j++;
>>   	}
>> diff --git a/include/linux/devfreq-event.h b/include/linux/devfreq-event.h
>> index 4db00b02ca3f..cc160b1274c0 100644
>> --- a/include/linux/devfreq-event.h
>> +++ b/include/linux/devfreq-event.h
>> @@ -81,14 +81,20 @@ struct devfreq_event_ops {
>>    * struct devfreq_event_desc - the descriptor of devfreq-event device
>>    *
>>    * @name	: the name of devfreq-event device.
>> + * @data_type	: the data type which is going to be counted in the register.
>>    * @driver_data	: the private data for devfreq-event driver.
>>    * @ops		: the operation to control devfreq-event device.
>>    *
>>    * Each devfreq-event device is described with a this structure.
>>    * This structure contains the various data for devfreq-event device.
>> + * The data_type describes what is going to be counted in the register.
>> + * It might choose to count e.g. read requests, write data in bytes, etc.
>> + * The full supported list of types is present in specyfic header in:
>> + * include/dt-bindings/pmu/.
>>    */
>>   struct devfreq_event_desc {
>>   	const char *name;
>> +	u32 data_type;
>>   	void *driver_data;
>>   
>>   	const struct devfreq_event_ops *ops;
>>
> 
> 


-- 
Best Regards,
Chanwoo Choi
Samsung Electronics

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

* Re: [PATCH v4 3/5] drivers: devfreq: events: extend events by type of counted data
  2019-07-24 10:24         ` Chanwoo Choi
@ 2019-07-25 16:23           ` Lukasz Luba
  0 siblings, 0 replies; 16+ messages in thread
From: Lukasz Luba @ 2019-07-25 16:23 UTC (permalink / raw)
  To: Chanwoo Choi, devicetree, linux-kernel, linux-pm,
	linux-samsung-soc, linux-arm-kernel, myungjoo.ham
  Cc: b.zolnierkie, krzk, robh+dt, mark.rutland, kyungmin.park,
	m.szyprowski, s.nawrocki, kgene, willy.mh.wolff.ml

Hi Chanwoo,

On 7/24/19 12:24 PM, Chanwoo Choi wrote:
> Hi Lukasz,
> 
> On 19. 7. 24. 오후 7:15, Lukasz Luba wrote:
>> Hi Chanwoo,
>>
>> Could you have a look a this patch, please?
>> This patch has been rewritten accorifing to your suggestion.
>> Krzysztof tried to apply 5/5 DT patch on his current branch,
>> but it is missing earlier stuff.
>> The other patches have needed ACKs so could go through devfreq tree
>> probably, but this one left.
> 
> Sorry for the late reply. It looks good to me.
> 
> Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Thank you for the ACK.

MyungJoo could you take the patches (apart from 5/5 which will be in
Krzysztof's tree probably) through devfreq tree, please?

Regards,
Lukasz

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

end of thread, other threads:[~2019-07-25 16:23 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20190605091301eucas1p278a554a15879a1b6fbc3d2bb5168f8cb@eucas1p2.samsung.com>
2019-06-05  9:12 ` [PATCH v4 0/5] Exynos Performance Monitoring Counters enhancements Lukasz Luba
     [not found]   ` <CGME20190605091301eucas1p2f360a867c8df8ba542942d425289f355@eucas1p2.samsung.com>
2019-06-05  9:12     ` [PATCH v4 1/5] include: dt-bindings: add Performance Monitoring Unit for Exynos Lukasz Luba
     [not found]   ` <CGME20190605091302eucas1p2b2a959c0889666e95bd727381bceab24@eucas1p2.samsung.com>
2019-06-05  9:12     ` [PATCH v4 2/5] drivers: devfreq: events: change matching code during probe Lukasz Luba
     [not found]   ` <CGME20190605091303eucas1p27177d349e0f2bd37bf582dbd7266321a@eucas1p2.samsung.com>
2019-06-05  9:12     ` [PATCH v4 3/5] drivers: devfreq: events: extend events by type of counted data Lukasz Luba
2019-07-24 10:15       ` Lukasz Luba
2019-07-24 10:24         ` Chanwoo Choi
2019-07-25 16:23           ` Lukasz Luba
     [not found]   ` <CGME20190605091304eucas1p21e0717cafa17a14de569f1773cc7abe5@eucas1p2.samsung.com>
2019-06-05  9:12     ` [PATCH v4 4/5] Documentation: devicetree: add PPMU events description Lukasz Luba
     [not found]       ` <CAGTfZH2kTNWtx=Jp1UJaLN50Qxbq+Q9ThV4vhQ240QbOy1TRMQ@mail.gmail.com>
2019-06-26 13:58         ` Lukasz Luba
2019-06-26 14:03           ` Krzysztof Kozlowski
2019-06-26 14:17             ` Lukasz Luba
2019-06-27  1:11               ` Chanwoo Choi
2019-06-27 10:31                 ` Lukasz Luba
     [not found]   ` <CGME20190605091305eucas1p136332cc3d1a299d90617bddcb365bee0@eucas1p1.samsung.com>
2019-06-05  9:12     ` [PATCH v4 5/5] DT: arm: exynos4412: add event data type which is monitored Lukasz Luba
2019-07-23 17:58       ` Krzysztof Kozlowski
2019-07-24 10:09         ` Lukasz Luba

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