Skip to contentSkip to conversation

perf/imx_ddr: speed up overflow frequency of cycle counter

PATCH Superseded Xu Yang 3 participants 10 messages Jul 13, 2023 – Jul 29, 2023

Subsystems (3)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Xu Yang

author maintainer
#0 lore raw

PATCH v2 1/3 perf/imx_ddr: speed up overflow frequency of cycle counter

For i.MX8MP, we cannot ensure that cycle counter overflow occurs at least 4 times as often as other events. Due to byte counters will count for any event configured, it will overflow more often. And if byte counters overflow that related counters would stop since they share the COUNTER_CNTL We can speed up cycle counter overflow frequency by setting counter parameter (CP) field of cycle counter. In this way, we can avoid stop counting byte counters when interrupt didn't come and the byte counters can be fetched or updated from each cycle counter overflow interrupt.

---
Changes in v2:
- improve if condition

---
 drivers/perf/fsl_imx8_ddr_perf.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/perf/fsl_imx8_ddr_perf.c +15 -0
index 5222ba1e79d0..039069756bbc 100644
@@ -28,6 +28,8 @@
 #define CNTL_CLEAR_MASK		0xFFFFFFFD
 #define CNTL_OVER_MASK		0xFFFFFFFE
 
+#define CNTL_CP_SHIFT		16
+#define CNTL_CP_MASK		(0xFF << CNTL_CP_SHIFT)
 #define CNTL_CSV_SHIFT		24
 #define CNTL_CSV_MASK		(0xFFU << CNTL_CSV_SHIFT)
 
@@ -427,6 +429,19 @@ static void ddr_perf_counter_enable(struct ddr_pmu *pmu, int config,
 		writel(0, pmu->base + reg);
 		val = CNTL_EN | CNTL_CLEAR;
 		val |= FIELD_PREP(CNTL_CSV_MASK, config);
+
+		/*
+		 * Workaround for i.MX8MP:
+		 * Common counters and byte counters share the same COUNTER_CNTL,
+		 * and byte counters could overflow before cycle counter. Need set
+		 * counter parameter(CP) of cycle counter to give it initial value
+		 * which can speed up cycle counter overflow frequency.
+		 */
+		if (pmu->devtype_data->quirks & DDR_CAP_AXI_ID_FILTER_ENHANCED) {
+			if (counter == EVENT_CYCLES_COUNTER)
+				val |= FIELD_PREP(CNTL_CP_MASK, 0xf0);
+		}
+
 		writel(val, pmu->base + reg);
 	} else {
 		/* Disable counter */
Signature · 7 lines
2.34.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author maintainer
#1 lore raw

PATCH v2 2/3 perf/imx_ddr: adjust counter result after read cycle counter

Because we initialize CP filed to shorten counter0 overflow time, the cycle counter will start couting from a fixed/base value each time. We need to remove the base from the result too. Therefore, we could get precise result from cycle counter.

---
Changes in v2:
- improve if condition

---
 drivers/perf/fsl_imx8_ddr_perf.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/perf/fsl_imx8_ddr_perf.c +6 -0
index 039069756bbc..d65200d4e96e 100644
@@ -481,6 +481,12 @@ static void ddr_perf_event_update(struct perf_event *event)
 	int ret;
 
 	new_raw_count = ddr_perf_read_counter(pmu, counter);
+	/* Workaround for i.MX8MP */
+	if (pmu->devtype_data->quirks & DDR_CAP_AXI_ID_FILTER_ENHANCED) {
+		if (counter == EVENT_CYCLES_COUNTER)
+			new_raw_count -= 0xF0000000;
+	}
+
 	local64_add(new_raw_count, &event->count);
 
 	/*
Signature · 7 lines
2.34.1


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

RE: [PATCH v2 2/3] perf/imx_ddr: adjust counter result after read cycle counter

Quoted 32 lines

-----Original Message-----
From: Xu Yang <[email protected]>
Sent: Thursday, July 13, 2023 5:38 AM
To: Frank Li <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; dl-linux-imx <linux- [email protected]>; [email protected]
Subject: [PATCH v2 2/3] perf/imx_ddr: adjust counter result after read cycle counter

Because we initialize CP filed to shorten counter0 overflow time, the cycle counter will start couting from a fixed/base value each time. We need to remove the base from the result too. Therefore, we could get precise result from cycle counter.

---
Changes in v2:
- improve if condition

---
 drivers/perf/fsl_imx8_ddr_perf.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/perf/fsl_imx8_ddr_perf.c +0 -0
index 039069756bbc..d65200d4e96e 100644

drivers/perf/fsl_imx8_ddr_perf.c static void ddr_perf_event_update(struct · line 489

Quoted 9 lines
drivers/perf/fsl_imx8_ddr_perf.c +4 -0
@@ -481,6 +481,12 @@ static void ddr_perf_event_update(struct
 perf_event *event)
 	int ret;
 
 	new_raw_count = ddr_perf_read_counter(pmu, counter);
+	/* Workaround for i.MX8MP */
+	if (pmu->devtype_data->quirks &
 DDR_CAP_AXI_ID_FILTER_ENHANCED) {
+		if (counter == EVENT_CYCLES_COUNTER)
+			new_raw_count -= 0xF0000000;

[Frank Li] Do you means

	new_raw_count &= 0x0FFFFFFF? to mask bit 24..31?
Quoted 7 lines
drivers/perf/fsl_imx8_ddr_perf.c +2 -0
+	}
+
 	local64_add(new_raw_count, &event->count);

/*
--
2.34.1

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

author maintainer
#3 lore raw

RE: [PATCH v2 2/3] perf/imx_ddr: adjust counter result after read cycle counter

-----Original Message-----

Quoted 21 lines

Because we initialize CP filed to shorten counter0 overflow time, the cycle counter will start couting from a fixed/base value each time. We need to remove the base from the result too. Therefore, we could get precise result from cycle counter.

---
Changes in v2:
- improve if condition

---
 drivers/perf/fsl_imx8_ddr_perf.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/perf/fsl_imx8_ddr_perf.c +0 -0
index 039069756bbc..d65200d4e96e 100644

drivers/perf/fsl_imx8_ddr_perf.c static void ddr_perf_event_update(struct · line 489

Quoted 9 lines
drivers/perf/fsl_imx8_ddr_perf.c +4 -0
@@ -481,6 +481,12 @@ static void ddr_perf_event_update(struct
 perf_event *event)
 	int ret;
 
 	new_raw_count = ddr_perf_read_counter(pmu, counter);
+	/* Workaround for i.MX8MP */
+	if (pmu->devtype_data->quirks &
 DDR_CAP_AXI_ID_FILTER_ENHANCED) {
+		if (counter == EVENT_CYCLES_COUNTER)
+			new_raw_count -= 0xF0000000;

[Frank Li] Do you means

	new_raw_count &= 0x0FFFFFFF? to mask bit 24..31?

Yes, it can be this way too. Do I need change it in v3?

Thanks,
Xu Yang

Quoted 7 lines
drivers/perf/fsl_imx8_ddr_perf.c +2 -0
+	}
+
 	local64_add(new_raw_count, &event->count);

/*
--
2.34.1

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

maintainer
#4 lore raw

Re: [PATCH v2 2/3] perf/imx_ddr: adjust counter result after read cycle counter

In reply to Xu Yang
Quoted 4 lines · Xu Yang

Because we initialize CP filed to shorten counter0 overflow time, the cycle counter will start couting from a fixed/base value each time. We need to remove the base from the result too. Therefore, we could get precise result from cycle counter.

This means that patch 1 is incomplete; please fold this into patch 1.

Quoted 15 lines

---
Changes in v2:
- improve if condition

---
 drivers/perf/fsl_imx8_ddr_perf.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/perf/fsl_imx8_ddr_perf.c +0 -0
index 039069756bbc..d65200d4e96e 100644

drivers/perf/fsl_imx8_ddr_perf.c static void ddr_perf_event_update(struct perf_event *event) · line 488

Quoted 8 lines
drivers/perf/fsl_imx8_ddr_perf.c +5 -0
@@ -481,6 +481,12 @@ static void ddr_perf_event_update(struct perf_event *event)
 	int ret;
 
 	new_raw_count = ddr_perf_read_counter(pmu, counter);
+	/* Workaround for i.MX8MP */
+	if (pmu->devtype_data->quirks & DDR_CAP_AXI_ID_FILTER_ENHANCED) {
+		if (counter == EVENT_CYCLES_COUNTER)
+			new_raw_count -= 0xF0000000;
+	}

I think as Frank suggested, it would be clearer to have a mask, and I think this should have a comment:

	/*
	 * Remove the bias applied in ddr_perf_counter_enable().
	 */
	if (pmu->devtype_data->quirks & DDR_CAP_AXI_ID_FILTER_ENHANCED) {
		if (counter == EVENT_CYCLES_COUNTER)
			new_raw_count &= 0x0fffffff;
	}

Thanks,
Mark.

Quoted 7 lines
drivers/perf/fsl_imx8_ddr_perf.c +1 -0
+
 	local64_add(new_raw_count, &event->count);
 
 	/*
Signature · 1 line
2.34.1

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

author maintainer
#5 lore raw

RE: [EXT] Re: [PATCH v2 2/3] perf/imx_ddr: adjust counter result after read cycle counter

Hi Mark,

Quoted 7 lines · Xu Yang
Quoted 4 lines

Because we initialize CP filed to shorten counter0 overflow time, the cycle counter will start couting from a fixed/base value each time. We need to remove the base from the result too. Therefore, we could get precise result from cycle counter.

This means that patch 1 is incomplete; please fold this into patch 1.

Okay.

Quoted 18 lines
Quoted 18 lines

---
Changes in v2:
- improve if condition

---
 drivers/perf/fsl_imx8_ddr_perf.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/perf/fsl_imx8_ddr_perf.c +0 -0
index 039069756bbc..d65200d4e96e 100644
@@ -481,6 +481,12 @@ static void ddr_perf_event_update(struct perf_event *event)
      int ret;
 
Quoted 9 lines

drivers/perf/fsl_imx8_ddr_perf.c static void ddr_perf_event_update(struct perf_event *event) · line 488

Quoted 6 lines
drivers/perf/fsl_imx8_ddr_perf.c +5 -0
      new_raw_count = ddr_perf_read_counter(pmu, counter);
+     /* Workaround for i.MX8MP */
+     if (pmu->devtype_data->quirks & DDR_CAP_AXI_ID_FILTER_ENHANCED) {
+             if (counter == EVENT_CYCLES_COUNTER)
+                     new_raw_count -= 0xF0000000;
+     }

I think as Frank suggested, it would be clearer to have a mask, and I think this should have a comment:

Agree, I'm going to update the code as following too.

Thanks,
Xu Yang

Quoted 9 lines
        /*
         * Remove the bias applied in ddr_perf_counter_enable().
         */
        if (pmu->devtype_data->quirks & DDR_CAP_AXI_ID_FILTER_ENHANCED) {
                if (counter == EVENT_CYCLES_COUNTER)
                        new_raw_count &= 0x0fffffff;
        }
Quoted 10 lines

Thanks,
Mark.

Quoted 7 lines
drivers/perf/fsl_imx8_ddr_perf.c +1 -1
+
      local64_add(new_raw_count, &event->count);
 
      /*
--

2.34.1

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

author maintainer
#6 lore raw

PATCH v2 3/3 perf/imx_ddr: don't enable counter0 if none of 4 counters are used

In reply to Xu Yang

In current driver, counter0 will be enabled after ddr_perf_pmu_enable() is called even though none of the 4 counters are used. This will cause counter0 continue to count until ddr_perf_pmu_disabled() is called. If pmu is not disabled all the time, the pmu interrupt will be asserted from time to time due to counter0 will overflow and irq handler will clear it. It's not an expected behavior. This patch will not enable counter0 if none of 4 counters are used.

Fixes 9a66d36cc7ac ("drivers/perf: imx_ddr: Add DDR performance counter support to perf")

---
Changes in v2:
- add active events count as suggested from Frank

---
 drivers/perf/fsl_imx8_ddr_perf.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/perf/fsl_imx8_ddr_perf.c +11 -2
index d65200d4e96e..761e45f21092 100644
@@ -103,6 +103,7 @@ struct ddr_pmu {
 	const struct fsl_ddr_devtype_data *devtype_data;
 	int irq;
 	int id;
+	int active_count;
 };
 
 static ssize_t ddr_perf_identifier_show(struct device *dev,
@@ -516,6 +517,9 @@ static void ddr_perf_event_start(struct perf_event *event, int flags)
 
 	ddr_perf_counter_enable(pmu, event->attr.config, counter, true);
 
+	if (counter != EVENT_CYCLES_COUNTER)
+		pmu->active_count++;
+
 	hwc->state = 0;
 }
 
@@ -569,6 +573,9 @@ static void ddr_perf_event_stop(struct perf_event *event, int flags)
 	ddr_perf_counter_enable(pmu, event->attr.config, counter, false);
 	ddr_perf_event_update(event);
 
+	if (counter != EVENT_CYCLES_COUNTER)
+		pmu->active_count--;
+
 	hwc->state |= PERF_HES_STOPPED;
 }
 
@@ -589,7 +596,8 @@ static void ddr_perf_pmu_enable(struct pmu *pmu)
 	struct ddr_pmu *ddr_pmu = to_ddr_pmu(pmu);
 
 	/* enable cycle counter if cycle is not active event list */
-	if (ddr_pmu->events[EVENT_CYCLES_COUNTER] == NULL)
+	if ((ddr_pmu->events[EVENT_CYCLES_COUNTER] == NULL)
+		&& ddr_pmu->active_count > 0)
 		ddr_perf_counter_enable(ddr_pmu,
 				      EVENT_CYCLES_ID,
 				      EVENT_CYCLES_COUNTER,
@@ -600,7 +608,8 @@ static void ddr_perf_pmu_disable(struct pmu *pmu)
 {
 	struct ddr_pmu *ddr_pmu = to_ddr_pmu(pmu);
 
-	if (ddr_pmu->events[EVENT_CYCLES_COUNTER] == NULL)
+	if ((ddr_pmu->events[EVENT_CYCLES_COUNTER] == NULL)
+		&& ddr_pmu->active_count > 0)
 		ddr_perf_counter_enable(ddr_pmu,
 				      EVENT_CYCLES_ID,
 				      EVENT_CYCLES_COUNTER,
Signature · 7 lines
2.34.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
maintainer Acked-by on v2 3/3
#7 lore raw

Re: [PATCH v2 3/3] perf/imx_ddr: don't enable counter0 if none of 4 counters are used

Quoted 10 lines · Xu Yang

In current driver, counter0 will be enabled after ddr_perf_pmu_enable() is called even though none of the 4 counters are used. This will cause counter0 continue to count until ddr_perf_pmu_disabled() is called. If pmu is not disabled all the time, the pmu interrupt will be asserted from time to time due to counter0 will overflow and irq handler will clear it. It's not an expected behavior. This patch will not enable counter0 if none of 4 counters are used.

Fixes 9a66d36cc7ac ("drivers/perf: imx_ddr: Add DDR performance counter support to perf")

I assume that you'll send this as part of a v3 given the comments on patches 1 and 2.

Thanks,
Mark.

Quoted 63 lines

---
Changes in v2:
- add active events count as suggested from Frank

---
 drivers/perf/fsl_imx8_ddr_perf.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/perf/fsl_imx8_ddr_perf.c +11 -2
index d65200d4e96e..761e45f21092 100644
@@ -103,6 +103,7 @@ struct ddr_pmu {
 	const struct fsl_ddr_devtype_data *devtype_data;
 	int irq;
 	int id;
+	int active_count;
 };
 
 static ssize_t ddr_perf_identifier_show(struct device *dev,
@@ -516,6 +517,9 @@ static void ddr_perf_event_start(struct perf_event *event, int flags)
 
 	ddr_perf_counter_enable(pmu, event->attr.config, counter, true);
 
+	if (counter != EVENT_CYCLES_COUNTER)
+		pmu->active_count++;
+
 	hwc->state = 0;
 }
 
@@ -569,6 +573,9 @@ static void ddr_perf_event_stop(struct perf_event *event, int flags)
 	ddr_perf_counter_enable(pmu, event->attr.config, counter, false);
 	ddr_perf_event_update(event);
 
+	if (counter != EVENT_CYCLES_COUNTER)
+		pmu->active_count--;
+
 	hwc->state |= PERF_HES_STOPPED;
 }
 
@@ -589,7 +596,8 @@ static void ddr_perf_pmu_enable(struct pmu *pmu)
 	struct ddr_pmu *ddr_pmu = to_ddr_pmu(pmu);
 
 	/* enable cycle counter if cycle is not active event list */
-	if (ddr_pmu->events[EVENT_CYCLES_COUNTER] == NULL)
+	if ((ddr_pmu->events[EVENT_CYCLES_COUNTER] == NULL)
+		&& ddr_pmu->active_count > 0)
 		ddr_perf_counter_enable(ddr_pmu,
 				      EVENT_CYCLES_ID,
 				      EVENT_CYCLES_COUNTER,
@@ -600,7 +608,8 @@ static void ddr_perf_pmu_disable(struct pmu *pmu)
 {
 	struct ddr_pmu *ddr_pmu = to_ddr_pmu(pmu);
 
-	if (ddr_pmu->events[EVENT_CYCLES_COUNTER] == NULL)
+	if ((ddr_pmu->events[EVENT_CYCLES_COUNTER] == NULL)
+		&& ddr_pmu->active_count > 0)
 		ddr_perf_counter_enable(ddr_pmu,
 				      EVENT_CYCLES_ID,
 				      EVENT_CYCLES_COUNTER,
Signature · 1 line
2.34.1

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

maintainer
#8 lore raw
In reply to Xu Yang
Quoted 33 lines · Xu Yang

For i.MX8MP, we cannot ensure that cycle counter overflow occurs at least 4 times as often as other events. Due to byte counters will count for any event configured, it will overflow more often. And if byte counters overflow that related counters would stop since they share the COUNTER_CNTL We can speed up cycle counter overflow frequency by setting counter parameter (CP) field of cycle counter. In this way, we can avoid stop counting byte counters when interrupt didn't come and the byte counters can be fetched or updated from each cycle counter overflow interrupt.

---
Changes in v2:
- improve if condition

---
 drivers/perf/fsl_imx8_ddr_perf.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/perf/fsl_imx8_ddr_perf.c +2 -0
index 5222ba1e79d0..039069756bbc 100644
@@ -28,6 +28,8 @@
 #define CNTL_CLEAR_MASK		0xFFFFFFFD
 #define CNTL_OVER_MASK		0xFFFFFFFE
 
+#define CNTL_CP_SHIFT		16
+#define CNTL_CP_MASK		(0xFF << CNTL_CP_SHIFT)
 #define CNTL_CSV_SHIFT		24
 #define CNTL_CSV_MASK		(0xFFU << CNTL_CSV_SHIFT)
 
@@ -427,6 +429,19 @@ static void ddr_perf_counter_enable(struct ddr_pmu *pmu, int config,
 		writel(0, pmu->base + reg);

drivers/perf/fsl_imx8_ddr_perf.c static void ddr_perf_counter_enable(struct ddr_pmu *pmu, int config, · line 439

Quoted 10 lines
drivers/perf/fsl_imx8_ddr_perf.c +8 -0
 		val = CNTL_EN | CNTL_CLEAR;
 		val |= FIELD_PREP(CNTL_CSV_MASK, config);
+
+		/*
+		 * Workaround for i.MX8MP:
+		 * Common counters and byte counters share the same COUNTER_CNTL,
+		 * and byte counters could overflow before cycle counter. Need set
+		 * counter parameter(CP) of cycle counter to give it initial value
+		 * which can speed up cycle counter overflow frequency.
+		 */

From the comments on path 2, it sounds like this "counter parameter" sets bits [31..28] of the counter value, is that correct?

Assuming so, could we please update this comment to say:

/*
* On i.MX8MP we need to bias the cycle counter to overflow more often.
* We do this by initializing bits [31:28] of the counter value via the
* COUNTER_CTRL Counter Parameter (CP) field.
*
* See ddr_perf_counter_enable() for more details.
*/

Thanks,
Mark.

Quoted 11 lines
drivers/perf/fsl_imx8_ddr_perf.c +5 -0
+		if (pmu->devtype_data->quirks & DDR_CAP_AXI_ID_FILTER_ENHANCED) {
+			if (counter == EVENT_CYCLES_COUNTER)
+				val |= FIELD_PREP(CNTL_CP_MASK, 0xf0);
+		}
+
 		writel(val, pmu->base + reg);
 	} else {
 		/* Disable counter */
Signature · 1 line
2.34.1

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

author maintainer
#9 lore raw

Hi Mark,

Quoted 32 lines · Xu Yang
Quoted 31 lines

For i.MX8MP, we cannot ensure that cycle counter overflow occurs at least 4 times as often as other events. Due to byte counters will count for any event configured, it will overflow more often. And if byte counters overflow that related counters would stop since they share the COUNTER_CNTL We can speed up cycle counter overflow frequency by setting counter parameter (CP) field of cycle counter. In this way, we can avoid stop counting byte counters when interrupt didn't come and the byte counters can be fetched or updated from each cycle counter overflow interrupt.

---
Changes in v2:
- improve if condition

---
 drivers/perf/fsl_imx8_ddr_perf.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/perf/fsl_imx8_ddr_perf.c +2 -0
index 5222ba1e79d0..039069756bbc 100644
@@ -28,6 +28,8 @@
 #define CNTL_CLEAR_MASK              0xFFFFFFFD
 #define CNTL_OVER_MASK               0xFFFFFFFE
 
+#define CNTL_CP_SHIFT                16
+#define CNTL_CP_MASK         (0xFF << CNTL_CP_SHIFT)
 #define CNTL_CSV_SHIFT               24
 #define CNTL_CSV_MASK                (0xFFU << CNTL_CSV_SHIFT)
 
Quoted 15 lines

drivers/perf/fsl_imx8_ddr_perf.c static void ddr_perf_counter_enable(struct ddr_pmu *pmu, int config, · line 439

Quoted 12 lines
drivers/perf/fsl_imx8_ddr_perf.c +8 -0
@@ -427,6 +429,19 @@ static void ddr_perf_counter_enable(struct ddr_pmu *pmu, int config,
              writel(0, pmu->base + reg);
              val = CNTL_EN | CNTL_CLEAR;
              val |= FIELD_PREP(CNTL_CSV_MASK, config);
+
+             /*
+              * Workaround for i.MX8MP:
+              * Common counters and byte counters share the same COUNTER_CNTL,
+              * and byte counters could overflow before cycle counter. Need set
+              * counter parameter(CP) of cycle counter to give it initial value
+              * which can speed up cycle counter overflow frequency.
+              */

From the comments on path 2, it sounds like this "counter parameter" sets bits [31..28] of the counter value, is that correct?

Correct.

Quoted 10 lines

Assuming so, could we please update this comment to say:

/*
* On i.MX8MP we need to bias the cycle counter to overflow more often.
* We do this by initializing bits [31:28] of the counter value via the
* COUNTER_CTRL Counter Parameter (CP) field.
*
* See ddr_perf_counter_enable() for more details.
*/

Sure, I will update the comment like this.

Thanks,
Xu Yang

Quoted 15 lines

Thanks,
Mark.

Quoted 11 lines
drivers/perf/fsl_imx8_ddr_perf.c +5 -1
+             if (pmu->devtype_data->quirks & DDR_CAP_AXI_ID_FILTER_ENHANCED) {
+                     if (counter == EVENT_CYCLES_COUNTER)
+                             val |= FIELD_PREP(CNTL_CP_MASK, 0xf0);
+             }
+
              writel(val, pmu->base + reg);
      } else {
              /* Disable counter */
--

2.34.1

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