Devicetree
 help / color / mirror / Atom feed
* [PATCH 0/2] Apple M2 PMU support
@ 2023-02-14 10:38 Janne Grunau
  2023-02-14 10:38 ` [PATCH 1/2] dt-bindings: arm-pmu: Add PMU compatible strings for Apple M2 cores Janne Grunau
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Janne Grunau @ 2023-02-14 10:38 UTC (permalink / raw)
  To: Will Deacon, Mark Rutland, Rob Herring, Krzysztof Kozlowski
  Cc: asahi, linux-arm-kernel, devicetree, linux-kernel

This small series adds support for the PMU in Apple M2 cores. The PMU
itself appears to work in the same way as om M1. We still want to add
CPU type specific compatible strings so that we can distinguish counters
in the case they count (slightly) different things on different CPU
uarchs.

Signed-off-by: Janne Grunau <j@jannau.net>
---
Janne Grunau (2):
      dt-bindings: arm-pmu: Add PMU compatible strings for Apple M2 cores
      drivers/perf: apple_m1: Add Apple M2 support

 Documentation/devicetree/bindings/arm/pmu.yaml |  2 ++
 drivers/perf/apple_m1_cpu_pmu.c                | 14 ++++++++++++++
 2 files changed, 16 insertions(+)
---
base-commit: 1b929c02afd37871d5afb9d498426f83432e71c2
change-id: 20230214-apple_m2_pmu-175b75c74d4e

Best regards,
-- 
Janne Grunau <j@jannau.net>


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

* [PATCH 1/2] dt-bindings: arm-pmu: Add PMU compatible strings for Apple M2 cores
  2023-02-14 10:38 [PATCH 0/2] Apple M2 PMU support Janne Grunau
@ 2023-02-14 10:38 ` Janne Grunau
  2023-02-15 20:46   ` Rob Herring
  2023-02-14 10:38 ` [PATCH 2/2] drivers/perf: apple_m1: Add Apple M2 support Janne Grunau
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Janne Grunau @ 2023-02-14 10:38 UTC (permalink / raw)
  To: Will Deacon, Mark Rutland, Rob Herring, Krzysztof Kozlowski
  Cc: asahi, linux-arm-kernel, devicetree, linux-kernel

The PMUs on the Apple M2 cores avalanche and blizzard CPU are compatible
with M1 ones. As on M1 we don't know exactly what the counters count so
use a distinct compatible for each micro-architecture.
Apple's PMU counter description omits a counter for M2 so there
is some variation on the interpretation of the counters.

Signed-off-by: Janne Grunau <j@jannau.net>
---
 Documentation/devicetree/bindings/arm/pmu.yaml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/arm/pmu.yaml b/Documentation/devicetree/bindings/arm/pmu.yaml
index dbb6f3dc5ae5..e14358bf0b9c 100644
--- a/Documentation/devicetree/bindings/arm/pmu.yaml
+++ b/Documentation/devicetree/bindings/arm/pmu.yaml
@@ -20,6 +20,8 @@ properties:
     items:
       - enum:
           - apm,potenza-pmu
+          - apple,avalanche-pmu
+          - apple,blizzard-pmu
           - apple,firestorm-pmu
           - apple,icestorm-pmu
           - arm,armv8-pmuv3 # Only for s/w models

-- 
2.39.1


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

* [PATCH 2/2] drivers/perf: apple_m1: Add Apple M2 support
  2023-02-14 10:38 [PATCH 0/2] Apple M2 PMU support Janne Grunau
  2023-02-14 10:38 ` [PATCH 1/2] dt-bindings: arm-pmu: Add PMU compatible strings for Apple M2 cores Janne Grunau
@ 2023-02-14 10:38 ` Janne Grunau
  2023-03-24 14:00   ` Mark Rutland
  2023-02-14 10:44 ` [PATCH 0/2] Apple M2 PMU support Hector Martin
  2023-03-27 15:01 ` Will Deacon
  3 siblings, 1 reply; 7+ messages in thread
From: Janne Grunau @ 2023-02-14 10:38 UTC (permalink / raw)
  To: Will Deacon, Mark Rutland, Rob Herring, Krzysztof Kozlowski
  Cc: asahi, linux-arm-kernel, devicetree, linux-kernel

The PMU itself is compatible with the one found on M1. We still know
next to nothing about the counters so keep using CPU uarch specific
compatibles/PMU names.

Signed-off-by: Janne Grunau <j@jannau.net>
---
 drivers/perf/apple_m1_cpu_pmu.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/perf/apple_m1_cpu_pmu.c b/drivers/perf/apple_m1_cpu_pmu.c
index 979a7c2b4f56..83b74c7fe63f 100644
--- a/drivers/perf/apple_m1_cpu_pmu.c
+++ b/drivers/perf/apple_m1_cpu_pmu.c
@@ -559,7 +559,21 @@ static int m1_pmu_fire_init(struct arm_pmu *cpu_pmu)
 	return m1_pmu_init(cpu_pmu);
 }
 
+static int m2_pmu_avalanche_init(struct arm_pmu *cpu_pmu)
+{
+	cpu_pmu->name = "apple_avalanche_pmu";
+	return m1_pmu_init(cpu_pmu);
+}
+
+static int m2_pmu_blizzard_init(struct arm_pmu *cpu_pmu)
+{
+	cpu_pmu->name = "apple_blizzard_pmu";
+	return m1_pmu_init(cpu_pmu);
+}
+
 static const struct of_device_id m1_pmu_of_device_ids[] = {
+	{ .compatible = "apple,avalanche-pmu",	.data = m2_pmu_avalanche_init, },
+	{ .compatible = "apple,blizzard-pmu",	.data = m2_pmu_blizzard_init, },
 	{ .compatible = "apple,icestorm-pmu",	.data = m1_pmu_ice_init, },
 	{ .compatible = "apple,firestorm-pmu",	.data = m1_pmu_fire_init, },
 	{ },

-- 
2.39.1


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

* Re: [PATCH 0/2] Apple M2 PMU support
  2023-02-14 10:38 [PATCH 0/2] Apple M2 PMU support Janne Grunau
  2023-02-14 10:38 ` [PATCH 1/2] dt-bindings: arm-pmu: Add PMU compatible strings for Apple M2 cores Janne Grunau
  2023-02-14 10:38 ` [PATCH 2/2] drivers/perf: apple_m1: Add Apple M2 support Janne Grunau
@ 2023-02-14 10:44 ` Hector Martin
  2023-03-27 15:01 ` Will Deacon
  3 siblings, 0 replies; 7+ messages in thread
From: Hector Martin @ 2023-02-14 10:44 UTC (permalink / raw)
  To: Janne Grunau, Will Deacon, Mark Rutland, Rob Herring,
	Krzysztof Kozlowski
  Cc: asahi, linux-arm-kernel, devicetree, linux-kernel

On 14/02/2023 19.38, Janne Grunau wrote:
> This small series adds support for the PMU in Apple M2 cores. The PMU
> itself appears to work in the same way as om M1. We still want to add
> CPU type specific compatible strings so that we can distinguish counters
> in the case they count (slightly) different things on different CPU
> uarchs.
> 
> Signed-off-by: Janne Grunau <j@jannau.net>
> ---
> Janne Grunau (2):
>       dt-bindings: arm-pmu: Add PMU compatible strings for Apple M2 cores
>       drivers/perf: apple_m1: Add Apple M2 support
> 
>  Documentation/devicetree/bindings/arm/pmu.yaml |  2 ++
>  drivers/perf/apple_m1_cpu_pmu.c                | 14 ++++++++++++++
>  2 files changed, 16 insertions(+)
> ---
> base-commit: 1b929c02afd37871d5afb9d498426f83432e71c2
> change-id: 20230214-apple_m2_pmu-175b75c74d4e

For the series,

Reviewed-by: Hector Martin <marcan@marcan.st>

- Hector

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

* Re: [PATCH 1/2] dt-bindings: arm-pmu: Add PMU compatible strings for Apple M2 cores
  2023-02-14 10:38 ` [PATCH 1/2] dt-bindings: arm-pmu: Add PMU compatible strings for Apple M2 cores Janne Grunau
@ 2023-02-15 20:46   ` Rob Herring
  0 siblings, 0 replies; 7+ messages in thread
From: Rob Herring @ 2023-02-15 20:46 UTC (permalink / raw)
  To: Janne Grunau
  Cc: devicetree, Rob Herring, Krzysztof Kozlowski, Mark Rutland,
	linux-kernel, linux-arm-kernel, asahi, Will Deacon


On Tue, 14 Feb 2023 11:38:01 +0100, Janne Grunau wrote:
> The PMUs on the Apple M2 cores avalanche and blizzard CPU are compatible
> with M1 ones. As on M1 we don't know exactly what the counters count so
> use a distinct compatible for each micro-architecture.
> Apple's PMU counter description omits a counter for M2 so there
> is some variation on the interpretation of the counters.
> 
> Signed-off-by: Janne Grunau <j@jannau.net>
> ---
>  Documentation/devicetree/bindings/arm/pmu.yaml | 2 ++
>  1 file changed, 2 insertions(+)
> 

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


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

* Re: [PATCH 2/2] drivers/perf: apple_m1: Add Apple M2 support
  2023-02-14 10:38 ` [PATCH 2/2] drivers/perf: apple_m1: Add Apple M2 support Janne Grunau
@ 2023-03-24 14:00   ` Mark Rutland
  0 siblings, 0 replies; 7+ messages in thread
From: Mark Rutland @ 2023-03-24 14:00 UTC (permalink / raw)
  To: Janne Grunau, Will Deacon
  Cc: Rob Herring, Krzysztof Kozlowski, asahi, linux-arm-kernel,
	devicetree, linux-kernel

On Tue, Feb 14, 2023 at 11:38:02AM +0100, Janne Grunau wrote:
> The PMU itself is compatible with the one found on M1. We still know
> next to nothing about the counters so keep using CPU uarch specific
> compatibles/PMU names.
> 
> Signed-off-by: Janne Grunau <j@jannau.net>

Acked-by: Mark Rutland <mark.rutland@arm.com.

Will, I assume that you'll pick this up.

> ---
>  drivers/perf/apple_m1_cpu_pmu.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/drivers/perf/apple_m1_cpu_pmu.c b/drivers/perf/apple_m1_cpu_pmu.c
> index 979a7c2b4f56..83b74c7fe63f 100644
> --- a/drivers/perf/apple_m1_cpu_pmu.c
> +++ b/drivers/perf/apple_m1_cpu_pmu.c
> @@ -559,7 +559,21 @@ static int m1_pmu_fire_init(struct arm_pmu *cpu_pmu)
>  	return m1_pmu_init(cpu_pmu);
>  }
>  
> +static int m2_pmu_avalanche_init(struct arm_pmu *cpu_pmu)
> +{
> +	cpu_pmu->name = "apple_avalanche_pmu";
> +	return m1_pmu_init(cpu_pmu);
> +}
> +
> +static int m2_pmu_blizzard_init(struct arm_pmu *cpu_pmu)
> +{
> +	cpu_pmu->name = "apple_blizzard_pmu";
> +	return m1_pmu_init(cpu_pmu);
> +}
> +
>  static const struct of_device_id m1_pmu_of_device_ids[] = {
> +	{ .compatible = "apple,avalanche-pmu",	.data = m2_pmu_avalanche_init, },
> +	{ .compatible = "apple,blizzard-pmu",	.data = m2_pmu_blizzard_init, },
>  	{ .compatible = "apple,icestorm-pmu",	.data = m1_pmu_ice_init, },
>  	{ .compatible = "apple,firestorm-pmu",	.data = m1_pmu_fire_init, },
>  	{ },
> 
> -- 
> 2.39.1
> 

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

* Re: [PATCH 0/2] Apple M2 PMU support
  2023-02-14 10:38 [PATCH 0/2] Apple M2 PMU support Janne Grunau
                   ` (2 preceding siblings ...)
  2023-02-14 10:44 ` [PATCH 0/2] Apple M2 PMU support Hector Martin
@ 2023-03-27 15:01 ` Will Deacon
  3 siblings, 0 replies; 7+ messages in thread
From: Will Deacon @ 2023-03-27 15:01 UTC (permalink / raw)
  To: Mark Rutland, Rob Herring, Janne Grunau, Krzysztof Kozlowski
  Cc: catalin.marinas, kernel-team, Will Deacon, devicetree,
	linux-kernel, asahi, linux-arm-kernel

On Tue, 14 Feb 2023 11:38:00 +0100, Janne Grunau wrote:
> This small series adds support for the PMU in Apple M2 cores. The PMU
> itself appears to work in the same way as om M1. We still want to add
> CPU type specific compatible strings so that we can distinguish counters
> in the case they count (slightly) different things on different CPU
> uarchs.
> 
> 
> [...]

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

[1/2] dt-bindings: arm-pmu: Add PMU compatible strings for Apple M2 cores
      https://git.kernel.org/will/c/640a3b7a3d13
[2/2] drivers/perf: apple_m1: Add Apple M2 support
      https://git.kernel.org/will/c/7d0bfb7c9977

Cheers,
-- 
Will

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

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

end of thread, other threads:[~2023-03-27 15:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-14 10:38 [PATCH 0/2] Apple M2 PMU support Janne Grunau
2023-02-14 10:38 ` [PATCH 1/2] dt-bindings: arm-pmu: Add PMU compatible strings for Apple M2 cores Janne Grunau
2023-02-15 20:46   ` Rob Herring
2023-02-14 10:38 ` [PATCH 2/2] drivers/perf: apple_m1: Add Apple M2 support Janne Grunau
2023-03-24 14:00   ` Mark Rutland
2023-02-14 10:44 ` [PATCH 0/2] Apple M2 PMU support Hector Martin
2023-03-27 15:01 ` Will Deacon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox