This further compacts all remaining PMU init procedures requiring specific
map_event functions via a new macro PMUV3_INIT_MAP_EVENT(). While here, it
also changes generated init function names to match to those generated via
the other macro PMUV3_INIT_SIMPLE(). This does not cause functional change.
Cc: Will Deacon <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Anshuman Khandual <[email protected]>
---
This applies on v6.6-rc6 with dependent patch applied, and also on
will/for-next/perf without it.
Changes in V2:
- Updated the commit message
- Rebased the patch after the following change
https://lore.kernel.org/all/[email protected]/
Changes in V1:
https://lore.kernel.org/all/[email protected]/
drivers/perf/arm_pmuv3.c | 61 +++++++++++++---------------------------
1 file changed, 20 insertions(+), 41 deletions(-)
diff --git a/drivers/perf/arm_pmuv3.c b/drivers/perf/arm_pmuv3.c
index 4f6923ad4589..92fefc1bc7f6 100644
--- a/drivers/perf/arm_pmuv3.c
+++ b/drivers/perf/arm_pmuv3.c
@@ -1222,6 +1222,12 @@ static int name##_pmu_init(struct arm_pmu *cpu_pmu) \
return armv8_pmu_init(cpu_pmu, #name, armv8_pmuv3_map_event); \
}
+#define PMUV3_INIT_MAP_EVENT(name, map_event) \
+static int name##_pmu_init(struct arm_pmu *cpu_pmu) \
+{ \
+ return armv8_pmu_init(cpu_pmu, #name, map_event); \
+}
+
PMUV3_INIT_SIMPLE(armv8_pmuv3)
PMUV3_INIT_SIMPLE(armv8_cortex_a34)
@@ -1248,51 +1254,24 @@ PMUV3_INIT_SIMPLE(armv8_neoverse_v1)
PMUV3_INIT_SIMPLE(armv8_nvidia_carmel)
PMUV3_INIT_SIMPLE(armv8_nvidia_denver)
-static int armv8_a35_pmu_init(struct arm_pmu *cpu_pmu)
-{
- return armv8_pmu_init(cpu_pmu, "armv8_cortex_a35", armv8_a53_map_event);
-}
-
-static int armv8_a53_pmu_init(struct arm_pmu *cpu_pmu)
-{
- return armv8_pmu_init(cpu_pmu, "armv8_cortex_a53", armv8_a53_map_event);
-}
-
-static int armv8_a57_pmu_init(struct arm_pmu *cpu_pmu)
-{
- return armv8_pmu_init(cpu_pmu, "armv8_cortex_a57", armv8_a57_map_event);
-}
-
-static int armv8_a72_pmu_init(struct arm_pmu *cpu_pmu)
-{
- return armv8_pmu_init(cpu_pmu, "armv8_cortex_a72", armv8_a57_map_event);
-}
-
-static int armv8_a73_pmu_init(struct arm_pmu *cpu_pmu)
-{
- return armv8_pmu_init(cpu_pmu, "armv8_cortex_a73", armv8_a73_map_event);
-}
-
-static int armv8_thunder_pmu_init(struct arm_pmu *cpu_pmu)
-{
- return armv8_pmu_init(cpu_pmu, "armv8_cavium_thunder", armv8_thunder_map_event);
-}
-
-static int armv8_vulcan_pmu_init(struct arm_pmu *cpu_pmu)
-{
- return armv8_pmu_init(cpu_pmu, "armv8_brcm_vulcan", armv8_vulcan_map_event);
-}
+PMUV3_INIT_MAP_EVENT(armv8_cortex_a35, armv8_a53_map_event)
+PMUV3_INIT_MAP_EVENT(armv8_cortex_a53, armv8_a53_map_event)
+PMUV3_INIT_MAP_EVENT(armv8_cortex_a57, armv8_a57_map_event)
+PMUV3_INIT_MAP_EVENT(armv8_cortex_a72, armv8_a57_map_event)
+PMUV3_INIT_MAP_EVENT(armv8_cortex_a73, armv8_a73_map_event)
+PMUV3_INIT_MAP_EVENT(armv8_cavium_thunder, armv8_thunder_map_event)
+PMUV3_INIT_MAP_EVENT(armv8_brcm_vulcan, armv8_vulcan_map_event)
static const struct of_device_id armv8_pmu_of_device_ids[] = {
{.compatible = "arm,armv8-pmuv3", .data = armv8_pmuv3_pmu_init},
{.compatible = "arm,cortex-a34-pmu", .data = armv8_cortex_a34_pmu_init},
- {.compatible = "arm,cortex-a35-pmu", .data = armv8_a35_pmu_init},
- {.compatible = "arm,cortex-a53-pmu", .data = armv8_a53_pmu_init},
+ {.compatible = "arm,cortex-a35-pmu", .data = armv8_cortex_a35_pmu_init},
+ {.compatible = "arm,cortex-a53-pmu", .data = armv8_cortex_a53_pmu_init},
{.compatible = "arm,cortex-a55-pmu", .data = armv8_cortex_a55_pmu_init},
- {.compatible = "arm,cortex-a57-pmu", .data = armv8_a57_pmu_init},
+ {.compatible = "arm,cortex-a57-pmu", .data = armv8_cortex_a57_pmu_init},
{.compatible = "arm,cortex-a65-pmu", .data = armv8_cortex_a65_pmu_init},
- {.compatible = "arm,cortex-a72-pmu", .data = armv8_a72_pmu_init},
- {.compatible = "arm,cortex-a73-pmu", .data = armv8_a73_pmu_init},
+ {.compatible = "arm,cortex-a72-pmu", .data = armv8_cortex_a72_pmu_init},
+ {.compatible = "arm,cortex-a73-pmu", .data = armv8_cortex_a73_pmu_init},
{.compatible = "arm,cortex-a75-pmu", .data = armv8_cortex_a75_pmu_init},
{.compatible = "arm,cortex-a76-pmu", .data = armv8_cortex_a76_pmu_init},
{.compatible = "arm,cortex-a77-pmu", .data = armv8_cortex_a77_pmu_init},
@@ -1310,8 +1289,8 @@ static const struct of_device_id armv8_pmu_of_device_ids[] = {
{.compatible = "arm,neoverse-n1-pmu", .data = armv8_neoverse_n1_pmu_init},
{.compatible = "arm,neoverse-n2-pmu", .data = armv9_neoverse_n2_pmu_init},
{.compatible = "arm,neoverse-v1-pmu", .data = armv8_neoverse_v1_pmu_init},
- {.compatible = "cavium,thunder-pmu", .data = armv8_thunder_pmu_init},
- {.compatible = "brcm,vulcan-pmu", .data = armv8_vulcan_pmu_init},
+ {.compatible = "cavium,thunder-pmu", .data = armv8_cavium_thunder_pmu_init},
+ {.compatible = "brcm,vulcan-pmu", .data = armv8_brcm_vulcan_pmu_init},
{.compatible = "nvidia,carmel-pmu", .data = armv8_nvidia_carmel_pmu_init},
{.compatible = "nvidia,denver-pmu", .data = armv8_nvidia_denver_pmu_init},
{},
--
2.25.1
On 20/10/2023 06:15, Anshuman Khandual wrote:
> This further compacts all remaining PMU init procedures requiring specific
> map_event functions via a new macro PMUV3_INIT_MAP_EVENT(). While here, it
> also changes generated init function names to match to those generated via
> the other macro PMUV3_INIT_SIMPLE(). This does not cause functional change.
>
> Cc: Will Deacon <[email protected]>
> Cc: Mark Rutland <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Signed-off-by: Anshuman Khandual <[email protected]>
> ---
> This applies on v6.6-rc6 with dependent patch applied, and also on
> will/for-next/perf without it.
Just in case anyone is wondering, I think the dependent patch is:
https://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git/commit/?h=for-next/perf&id=3b9a22d345ff89232227b2449a311bf3f910f5f2
Otherwise, looks ok:
Reviewed-by: James Clark <[email protected]>
>
> Changes in V2:
>
> - Updated the commit message
> - Rebased the patch after the following change
> https://lore.kernel.org/all/[email protected]/
>
> Changes in V1:
>
> https://lore.kernel.org/all/[email protected]/
>
> drivers/perf/arm_pmuv3.c | 61 +++++++++++++---------------------------
> 1 file changed, 20 insertions(+), 41 deletions(-)
>
> diff --git a/drivers/perf/arm_pmuv3.c b/drivers/perf/arm_pmuv3.c
> index 4f6923ad4589..92fefc1bc7f6 100644
> --- a/drivers/perf/arm_pmuv3.c
> +++ b/drivers/perf/arm_pmuv3.c
> @@ -1222,6 +1222,12 @@ static int name##_pmu_init(struct arm_pmu *cpu_pmu) \
> return armv8_pmu_init(cpu_pmu, #name, armv8_pmuv3_map_event); \
> }
>
> +#define PMUV3_INIT_MAP_EVENT(name, map_event) \
> +static int name##_pmu_init(struct arm_pmu *cpu_pmu) \
> +{ \
> + return armv8_pmu_init(cpu_pmu, #name, map_event); \
> +}
> +
> PMUV3_INIT_SIMPLE(armv8_pmuv3)
>
> PMUV3_INIT_SIMPLE(armv8_cortex_a34)
> @@ -1248,51 +1254,24 @@ PMUV3_INIT_SIMPLE(armv8_neoverse_v1)
> PMUV3_INIT_SIMPLE(armv8_nvidia_carmel)
> PMUV3_INIT_SIMPLE(armv8_nvidia_denver)
>
> -static int armv8_a35_pmu_init(struct arm_pmu *cpu_pmu)
> -{
> - return armv8_pmu_init(cpu_pmu, "armv8_cortex_a35", armv8_a53_map_event);
> -}
> -
> -static int armv8_a53_pmu_init(struct arm_pmu *cpu_pmu)
> -{
> - return armv8_pmu_init(cpu_pmu, "armv8_cortex_a53", armv8_a53_map_event);
> -}
> -
> -static int armv8_a57_pmu_init(struct arm_pmu *cpu_pmu)
> -{
> - return armv8_pmu_init(cpu_pmu, "armv8_cortex_a57", armv8_a57_map_event);
> -}
> -
> -static int armv8_a72_pmu_init(struct arm_pmu *cpu_pmu)
> -{
> - return armv8_pmu_init(cpu_pmu, "armv8_cortex_a72", armv8_a57_map_event);
> -}
> -
> -static int armv8_a73_pmu_init(struct arm_pmu *cpu_pmu)
> -{
> - return armv8_pmu_init(cpu_pmu, "armv8_cortex_a73", armv8_a73_map_event);
> -}
> -
> -static int armv8_thunder_pmu_init(struct arm_pmu *cpu_pmu)
> -{
> - return armv8_pmu_init(cpu_pmu, "armv8_cavium_thunder", armv8_thunder_map_event);
> -}
> -
> -static int armv8_vulcan_pmu_init(struct arm_pmu *cpu_pmu)
> -{
> - return armv8_pmu_init(cpu_pmu, "armv8_brcm_vulcan", armv8_vulcan_map_event);
> -}
> +PMUV3_INIT_MAP_EVENT(armv8_cortex_a35, armv8_a53_map_event)
> +PMUV3_INIT_MAP_EVENT(armv8_cortex_a53, armv8_a53_map_event)
> +PMUV3_INIT_MAP_EVENT(armv8_cortex_a57, armv8_a57_map_event)
> +PMUV3_INIT_MAP_EVENT(armv8_cortex_a72, armv8_a57_map_event)
> +PMUV3_INIT_MAP_EVENT(armv8_cortex_a73, armv8_a73_map_event)
> +PMUV3_INIT_MAP_EVENT(armv8_cavium_thunder, armv8_thunder_map_event)
> +PMUV3_INIT_MAP_EVENT(armv8_brcm_vulcan, armv8_vulcan_map_event)
>
> static const struct of_device_id armv8_pmu_of_device_ids[] = {
> {.compatible = "arm,armv8-pmuv3", .data = armv8_pmuv3_pmu_init},
> {.compatible = "arm,cortex-a34-pmu", .data = armv8_cortex_a34_pmu_init},
> - {.compatible = "arm,cortex-a35-pmu", .data = armv8_a35_pmu_init},
> - {.compatible = "arm,cortex-a53-pmu", .data = armv8_a53_pmu_init},
> + {.compatible = "arm,cortex-a35-pmu", .data = armv8_cortex_a35_pmu_init},
> + {.compatible = "arm,cortex-a53-pmu", .data = armv8_cortex_a53_pmu_init},
> {.compatible = "arm,cortex-a55-pmu", .data = armv8_cortex_a55_pmu_init},
> - {.compatible = "arm,cortex-a57-pmu", .data = armv8_a57_pmu_init},
> + {.compatible = "arm,cortex-a57-pmu", .data = armv8_cortex_a57_pmu_init},
> {.compatible = "arm,cortex-a65-pmu", .data = armv8_cortex_a65_pmu_init},
> - {.compatible = "arm,cortex-a72-pmu", .data = armv8_a72_pmu_init},
> - {.compatible = "arm,cortex-a73-pmu", .data = armv8_a73_pmu_init},
> + {.compatible = "arm,cortex-a72-pmu", .data = armv8_cortex_a72_pmu_init},
> + {.compatible = "arm,cortex-a73-pmu", .data = armv8_cortex_a73_pmu_init},
> {.compatible = "arm,cortex-a75-pmu", .data = armv8_cortex_a75_pmu_init},
> {.compatible = "arm,cortex-a76-pmu", .data = armv8_cortex_a76_pmu_init},
> {.compatible = "arm,cortex-a77-pmu", .data = armv8_cortex_a77_pmu_init},
> @@ -1310,8 +1289,8 @@ static const struct of_device_id armv8_pmu_of_device_ids[] = {
> {.compatible = "arm,neoverse-n1-pmu", .data = armv8_neoverse_n1_pmu_init},
> {.compatible = "arm,neoverse-n2-pmu", .data = armv9_neoverse_n2_pmu_init},
> {.compatible = "arm,neoverse-v1-pmu", .data = armv8_neoverse_v1_pmu_init},
> - {.compatible = "cavium,thunder-pmu", .data = armv8_thunder_pmu_init},
> - {.compatible = "brcm,vulcan-pmu", .data = armv8_vulcan_pmu_init},
> + {.compatible = "cavium,thunder-pmu", .data = armv8_cavium_thunder_pmu_init},
> + {.compatible = "brcm,vulcan-pmu", .data = armv8_brcm_vulcan_pmu_init},
> {.compatible = "nvidia,carmel-pmu", .data = armv8_nvidia_carmel_pmu_init},
> {.compatible = "nvidia,denver-pmu", .data = armv8_nvidia_denver_pmu_init},
> {},