Add support to enable ARM PMU for EXYNOS
v3 cover Add support to enable ARM PMU for EXYNOS
This patchset fixes irq numbers of ARM Performance Monitoring unit and enable it for Perf(Performance Counter) on the exynos 4 and 5. The exynos4 and 5 use 2 more cpu cores which has its own pmu.
The exynos uses combiner-irq type for arm-pmu. Especially, the exynos4412 has 4 extra combined irq groups. So, we need to change a max combiner number. To enable perf, we need also to implement a set_irq_affinity function about the combiner-irq. After applying this patch, we can use the perf for the exynos machine.
Changes from v2:
- Convert to dt binding of exynos5250
Changes from v1:
- Split arm-pmu init of exynos from plat-samsung
- Correct combined irqs of exynos4412
- Use soc_is_xxx function instead of CONFIG_XXX to identify dynamically
Chanho Park (4):
ARM: EXYNOS: Add set_irq_affinity function for combiner_irq
ARM: EXYNOS: Correct combined IRQs for exynos4412
ARM: EXYNOS: Enable PMUs for exynos4
ARM: EXYNOS: Add arm-pmu DT binding for exynos5250
arch/arm/boot/dts/exynos5250.dtsi | 6 ++ arch/arm/mach-exynos/common.c | 106 ++++++++++++++++++++++++++---- arch/arm/mach-exynos/include/mach/irqs.h | 10 ++- arch/arm/plat-samsung/devs.c | 2 +- 4 files changed, 109 insertions(+), 15 deletions(-)
Signature · 1 line
1.7.9.5
PATCH v3 1/4 ARM: EXYNOS: Add set_irq_affinity function for combiner_irq
This patch adds set_irq_affinity function for combiner_irq. We need this function to enable a arm-pmu because the pmu of exynos has combined type irqs.
--- arch/arm/mach-exynos/common.c | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-)
arch/arm/mach-exynos/common.c +25 -5
@@ -405,6 +405,7 @@ struct combiner_chip_data {unsigned int irq_offset;unsigned int irq_mask;void __iomem *base; +unsigned int parent_irq; };static struct irq_domain *combiner_irq_domain;
@@ -461,10 +462,28 @@ static void combiner_handle_cascade_irq(unsigned int irq, struct irq_desc *desc)chained_irq_exit (chip, desc); } +#ifdef CONFIG_SMP +static int combiner_set_affinity (struct irq_data *d, +const struct cpumask *mask_val,bool force) +{ +struct combiner_chip_data *chip_data =irq_data_get_irq_chip_data (d); +struct irq_chip *chip =irq_get_chip (chip_data->parent_irq); +struct irq_data *data =irq_get_irq_data (chip_data->parent_irq); + +if (chip && chip->irq_set_affinity) +return chip->irq_set_affinity (data, mask_val, force); +else +return -EINVAL ; +} +#endif +static struct irq_chip combiner_chip = { - .name ="COMBINER" , - .irq_mask = combiner_mask_irq, - .irq_unmask = combiner_unmask_irq, + .name ="COMBINER" , + .irq_mask = combiner_mask_irq, + .irq_unmask = combiner_unmask_irq, +#ifdef CONFIG_SMP + .irq_set_affinity = combiner_set_affinity, +#endif };static void __init combiner_cascade_irq (unsigned int combiner_nr,unsigned int irq)
@@ -484,12 +503,13 @@ static void __init combiner_cascade_irq(unsigned int combiner_nr, unsigned int i }static void __init combiner_init_one (unsigned int combiner_nr, -void __iomem *base) +void __iomem *base,unsigned int irq) { combiner_data[combiner_nr].base = base; combiner_data[combiner_nr].irq_offset =irq_find_mapping ( combiner_irq_domain, combiner_nr *MAX_IRQ_IN_COMBINER ); combiner_data[combiner_nr].irq_mask =0xff << ((combiner_nr %4 ) <<3 ); + combiner_data[combiner_nr].parent_irq = irq;/* Disable all interrupts */ __raw_writel(combiner_data[combiner_nr].irq_mask,
@@ -573,12 +593,12 @@ static void __init combiner_init(void __iomem *combiner_base, }for (i =0 ; i < max_nr; i++) { -combiner_init_one (i, combiner_base + (i >>2 ) *0x10 ); irq =IRQ_SPI (i);#ifdef CONFIG_OF if (np) irq =irq_of_parse_and_map (np, i);#endif +combiner_init_one (i, combiner_base + (i >>2 ) *0x10 , irq);combiner_cascade_irq (i, irq); } }
Signature · 1 line
1.7.9.5
PATCH v3 1/4 ARM: EXYNOS: Add set_irq_affinity function for combiner_irq
Quoted 8 lines · Chanho Park
This patch adds
set_irq_affinityfunction forcombiner_irq. We need this function to enable a arm-pmu because the pmu of exynos has combined type irqs.Signed-off-by Chanho Park <[email protected]>Signed-off-by Kyungmin Park <[email protected]>--- arch/arm/mach-exynos/common.c | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-)
Quoted 77 lines
arch/arm/mach-exynos/common.c +25
-6@@ -405,6 +405,7 @@ struct combiner_chip_data {unsigned int irq_offset;unsigned int irq_mask;void __iomem *base; +unsigned int parent_irq; };static struct irq_domain *combiner_irq_domain;@@ -461,10 +462,28 @@ static void combiner_handle_cascade_irq(unsigned int irq, struct irq_desc *desc)chained_irq_exit (chip, desc); } +#ifdef CONFIG_SMP +static int combiner_set_affinity (struct irq_data *d, +const struct cpumask *mask_val,bool force) +{ +struct combiner_chip_data *chip_data =irq_data_get_irq_chip_data (d); +struct irq_chip *chip =irq_get_chip (chip_data->parent_irq); +struct irq_data *data =irq_get_irq_data (chip_data->parent_irq); + +if (chip && chip->irq_set_affinity) +return chip->irq_set_affinity (data, mask_val, force); +else +return -EINVAL ; +} +#endif +static struct irq_chip combiner_chip = { - .name ="COMBINER" , - .irq_mask = combiner_mask_irq, - .irq_unmask = combiner_unmask_irq, + .name ="COMBINER" , + .irq_mask = combiner_mask_irq, + .irq_unmask = combiner_unmask_irq, +#ifdef CONFIG_SMP + .irq_set_affinity = combiner_set_affinity, +#endif };static void __init combiner_cascade_irq (unsigned int combiner_nr,unsigned int irq)@@ -484,12 +503,13 @@ static void __init combiner_cascade_irq(unsigned int combiner_nr, unsigned int i }static void __init combiner_init_one (unsigned int combiner_nr, -void __iomem *base) +void __iomem *base,unsigned int irq) { combiner_data[combiner_nr].base = base; combiner_data[combiner_nr].irq_offset =irq_find_mapping ( combiner_irq_domain, combiner_nr *MAX_IRQ_IN_COMBINER ); combiner_data[combiner_nr].irq_mask =0xff << ((combiner_nr %4 ) <<3 ); + combiner_data[combiner_nr].parent_irq = irq;/* Disable all interrupts */ __raw_writel(combiner_data[combiner_nr].irq_mask,@@ -573,12 +593,12 @@ static void __init combiner_init(void __iomem *combiner_base, }for (i =0 ; i < max_nr; i++) { -combiner_init_one (i, combiner_base + (i >>2 ) *0x10 ); irq =IRQ_SPI (i);#ifdef CONFIG_OF if (np) irq =irq_of_parse_and_map (np, i);#endif +combiner_init_one (i, combiner_base + (i >>2 ) *0x10 , irq);combiner_cascade_irq (i, irq); } } --1.7.9.5
PATCH v3 2/4 ARM: EXYNOS: Correct combined IRQs for exynos4412
In reply to Chanho ParkThis patch corrects combined IRQs for exynos4412 platform. The exynos4412 has four extra combined irq group. Each irq is mapped to IRQ_SPI(xx). Unfortunately, extra combined IRQs isn't sequential. So, we need to map the irq manually.
--- arch/arm/mach-exynos/common.c | 31 ++++++++++++++++++++++++------ arch/arm/mach-exynos/include/mach/irqs.h | 2 +- 2 files changed, 26 insertions(+), 7 deletions(-)
arch/arm/mach-exynos/common.c +25 -6
@@ -560,23 +560,39 @@ static struct irq_domain_ops combiner_irq_domain_ops = { .map = combiner_irq_domain_map, }; +static unsigned int get_combiner_extra_irq (int group) +{ +switch (group) { +case 16 : +return IRQ_SPI (107 ); +case 17 : +return IRQ_SPI (108 ); +case 18 : +return IRQ_SPI (48 ); +case 19 : +return IRQ_SPI (42 ); +default : +return 0 ; + } +} +static void __init combiner_init (void __iomem *combiner_base,struct device_node *np) {int i, irq, irq_base;unsigned int max_nr, nr_irq; + max_nr =soc_is_exynos5250 () ?EXYNOS5_MAX_COMBINER_NR : +EXYNOS4_MAX_COMBINER_NR ; +if (np) {if (of_property_read_u32 (np,"samsung,combiner-nr" , &max_nr)) {pr_warning ("%s: number of combiners not specified, " "setting default as %d.\n" , - __func__,EXYNOS4_MAX_COMBINER_NR ); - max_nr =EXYNOS4_MAX_COMBINER_NR ; + __func__, max_nr); } - }else { - max_nr =soc_is_exynos5250 () ?EXYNOS5_MAX_COMBINER_NR : -EXYNOS4_MAX_COMBINER_NR ; } + nr_irq = max_nr *MAX_IRQ_IN_COMBINER ; irq_base =irq_alloc_descs (COMBINER_IRQ (0 ,0 ),1 , nr_irq,0 );
@@ -593,7 +609,10 @@ static void __init combiner_init(void __iomem *combiner_base, }for (i =0 ; i < max_nr; i++) { - irq =IRQ_SPI (i); +if (i <16 ||soc_is_exynos5250 ()) + irq =IRQ_SPI (i); +else + irq =get_combiner_extra_irq (i);#ifdef CONFIG_OF if (np) irq =irq_of_parse_and_map (np, i);
arch/arm/mach-exynos/include/mach/irqs.h +1 -1
@@ -165,7 +165,7 @@#define EXYNOS4_IRQ_FIMD0_VSYNC COMBINER_IRQ(11, 1)#define EXYNOS4_IRQ_FIMD0_SYSTEM COMBINER_IRQ(11, 2) -#define EXYNOS4_MAX_COMBINER_NR 16 +#define EXYNOS4_MAX_COMBINER_NR 20#define EXYNOS4_IRQ_GPIO1_NR_GROUPS 16#define EXYNOS4_IRQ_GPIO2_NR_GROUPS 9
Signature · 1 line
1.7.9.5
PATCH v3 2/4 ARM: EXYNOS: Correct combined IRQs for exynos4412
Quoted 48 lines · Chanho Park
This patch corrects combined IRQs for exynos4412 platform. The exynos4412 has four extra combined irq group. Each irq is mapped to
IRQ_SPI(xx). Unfortunately, extra combined IRQs isn't sequential. So, we need to map the irq manually.Signed-off-by Chanho Park <[email protected]>Signed-off-by Kyungmin Park <[email protected]>--- arch/arm/mach-exynos/common.c | 31 ++++++++++++++++++++++++------ arch/arm/mach-exynos/include/mach/irqs.h | 2 +- 2 files changed, 26 insertions(+), 7 deletions(-)arch/arm/mach-exynos/common.c +19
-0@@ -560,23 +560,39 @@ static struct irq_domain_ops combiner_irq_domain_ops = { .map = combiner_irq_domain_map, }; +static unsigned int get_combiner_extra_irq (int group) +{ +switch (group) { +case 16 : +return IRQ_SPI (107 ); +case 17 : +return IRQ_SPI (108 ); +case 18 : +return IRQ_SPI (48 ); +case 19 : +return IRQ_SPI (42 ); +default : +return 0 ; + } +} +static void __init combiner_init (void __iomem *combiner_base,struct device_node *np) {int i, irq, irq_base;unsigned int max_nr, nr_irq; + max_nr =soc_is_exynos5250 () ?EXYNOS5_MAX_COMBINER_NR : +EXYNOS4_MAX_COMBINER_NR ; +if (np) {if (of_property_read_u32 (np,"samsung,combiner-nr" , &max_nr)) { pr_warning("%s: number of combiners not specified, " "setting default as %d.\n",
arch/arm/mach-exynos/common.c static struct irq_domain_ops combiner_irq_domain_ops = { · line 596
Quoted 10 lines
arch/arm/mach-exynos/common.c +2
-5- __func__, EXYNOS4_MAX_COMBINER_NR); - max_nr =EXYNOS4_MAX_COMBINER_NR ; + __func__, max_nr); } - }else { - max_nr =soc_is_exynos5250 () ?EXYNOS5_MAX_COMBINER_NR : -EXYNOS4_MAX_COMBINER_NR ; } + nr_irq = max_nr *MAX_IRQ_IN_COMBINER ;
Along with this change, this patch should update the default value "samsung,combiner-nr" binding in device tree binding documentation for combiner. It should state that is Exynos5 will use 32 and Exynos4 will use 20 as the default value.
Quoted 19 lines
arch/arm/mach-exynos/common.c +4
-1irq_base =irq_alloc_descs (COMBINER_IRQ (0 ,0 ),1 , nr_irq,0 );@@ -593,7 +609,10 @@ static void __init combiner_init(void __iomem *combiner_base, }for (i =0 ; i < max_nr; i++) { - irq =IRQ_SPI (i); +if (i <16 ||soc_is_exynos5250 ()) + irq =IRQ_SPI (i); +else + irq =get_combiner_extra_irq (i);#ifdef CONFIG_OF if (np) irq =irq_of_parse_and_map (np, i);arch/arm/mach-exynos/include/mach/irqs.h +0
-0
arch/arm/mach-exynos/include/mach/irqs.h line 168
Quoted 5 lines
arch/arm/mach-exynos/include/mach/irqs.h +1
-1@@ -165,7 +165,7 @@#define EXYNOS4_IRQ_FIMD0_VSYNC COMBINER_IRQ(11, 1)#define EXYNOS4_IRQ_FIMD0_SYSTEM COMBINER_IRQ(11, 2) -#define EXYNOS4_MAX_COMBINER_NR 16 +#define EXYNOS4_MAX_COMBINER_NR 20
Will this not break Exynos4210 which has only 16 combiners? This is fine in case max-combiner values is listed in dt mode, but in non-dt mode or if max-combiner is not specified in dt, this will not be correct.
Quoted 6 lines
arch/arm/mach-exynos/include/mach/irqs.h +0
-1#define EXYNOS4_IRQ_GPIO1_NR_GROUPS 16#define EXYNOS4_IRQ_GPIO2_NR_GROUPS 9 --1.7.9.5
PATCH v3 2/4 ARM: EXYNOS: Correct combined IRQs for exynos4412
Quoted 102 lines
-----Original Message-----
From: Thomas Abraham [mailto:[email protected]]
Sent: Wednesday, August 29, 2012 8:10 PM
To: Chanho Park
Cc: [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]; Kyungmin Park
Subject: Re: [PATCH v3 2/4] ARM: EXYNOS: Correct combined IRQs for exynos4412Quoted 3 lines · Chanho Park
This patch corrects combined IRQs for exynos4412 platform. The exynos4412 has four extra combined irq group. Each irq is mapped to
IRQ_SPI(xx). Unfortunately, extra combined IRQs isn't sequential. So, weneed to map the irq manually.
Quoted 5 lines
Signed-off-by Chanho Park <[email protected]>Signed-off-by Kyungmin Park <[email protected]>--- arch/arm/mach-exynos/common.c | 31++++++++++++++++++++++++------
arch/arm/mach-exynos/common.c static struct irq_domain_ops
Quoted 8 lines
arch/arm/mach-exynos/include/mach/irqs.h | 2 +- 2 files changed, 26 insertions(+), 7 deletions(-)(quoted diff) +0
-0
b/arch/arm/mach-exynos/common.cindex f194bbc..be61564 100644arch/arm/mach-exynos/common.c +0
-0@@ -560,23 +560,39 @@ static struct irq_domain_ops
combiner_irq_domain_ops= {Quoted 18 lines
arch/arm/mach-exynos/common.c +15
-0.map = combiner_irq_domain_map, }; +static unsigned int get_combiner_extra_irq (int group) { +switch (group) { +case 16 : +return IRQ_SPI (107 ); +case 17 : +return IRQ_SPI (108 ); +case 18 : +return IRQ_SPI (48 ); +case 19 : +return IRQ_SPI (42 ); +default : +return 0 ; + } +} +arch/arm/mach-exynos/common.c static struct irq_domain_ops combiner_irq_domain_ops = {
Quoted 10 lines
arch/arm/mach-exynos/common.c +3
-0static void __init combiner_init (void __iomem *combiner_base,struct device_node *np) {int i, irq, irq_base;unsigned int max_nr, nr_irq; + max_nr =soc_is_exynos5250 () ?EXYNOS5_MAX_COMBINER_NR : +EXYNOS4_MAX_COMBINER_NR ; +if (np) {if (of_property_read_u32 (np,"samsung,combiner-nr" , &max_nr)){
arch/arm/mach-exynos/common.c static struct irq_domain_ops combiner_irq_domain_ops = { · line 596
Quoted 12 lines
arch/arm/mach-exynos/common.c +2
-5pr_warning ("%s: number of combiners not specified, " "setting default as %d.\n" , - __func__,EXYNOS4_MAX_COMBINER_NR ); - max_nr =EXYNOS4_MAX_COMBINER_NR ; + __func__, max_nr); } - }else { - max_nr =soc_is_exynos5250 () ?EXYNOS5_MAX_COMBINER_NR : -EXYNOS4_MAX_COMBINER_NR ; } + nr_irq = max_nr *MAX_IRQ_IN_COMBINER ;Along with this change, this patch should update the default value "samsung,combiner-nr" binding in device tree binding documentation for combiner. It should state that is Exynos5 will use 32 and Exynos4 will use 20 as the default value.
arch/arm/mach-exynos/common.c static void __init combiner_init(void __iomem
Quoted 3 lines
arch/arm/mach-exynos/common.c +0
-0irq_base =irq_alloc_descs (COMBINER_IRQ (0 ,0 ),1 , nr_irq,0 );@@ -593,7 +609,10 @@ static void __init combiner_init(void __iomem
*combiner_base,Quoted 20 lines
arch/arm/mach-exynos/common.c +4
-1}for (i =0 ; i < max_nr; i++) { - irq =IRQ_SPI (i); +if (i <16 ||soc_is_exynos5250 ()) + irq =IRQ_SPI (i); +else + irq =get_combiner_extra_irq (i);#ifdef CONFIG_OF if (np) irq = irq_of_parse_and_map(np, i); diff --git
a/arch/arm/mach-exynos/include/mach/irqs.hb/arch/arm/mach-exynos/include/mach/irqs.h
index 35bced6..357ed7f 100644arch/arm/mach-exynos/include/mach/irqs.h +0
-0@@ -165,7 +165,7 @@#define EXYNOS4_IRQ_FIMD0_VSYNC COMBINER_IRQ(11, 1)#define EXYNOS4_IRQ_FIMD0_SYSTEM COMBINER_IRQ(11, 2)
Quoted 6 lines
arch/arm/mach-exynos/include/mach/irqs.h line 168
Quoted 2 lines
arch/arm/mach-exynos/include/mach/irqs.h +1
-1-#define EXYNOS4_MAX_COMBINER_NR 16 +#define EXYNOS4_MAX_COMBINER_NR 20Will this not break Exynos4210 which has only 16 combiners? This is fine in case max-combiner values is listed in dt mode, but in non-dt mode or if max- combiner is not specified in dt, this will not be correct.
I didn't have test about exynos4210 because I don't have the 4210 board. However, there is no problem of exynos4212 which has 18 combiner. On second thought, it might break by accessing undefined area. Ok, I'll resolve it and resubmit patch.
Best regards,
Chanho Park
Quoted 7 lines
Quoted 7 lines
arch/arm/mach-exynos/include/mach/irqs.h +0
-1#define EXYNOS4_IRQ_GPIO1_NR_GROUPS 16#define EXYNOS4_IRQ_GPIO2_NR_GROUPS 9 --1.7.9.5
PATCH v3 3/4 ARM: EXYNOS: Enable PMUs for exynos4
In reply to Chanho ParkThis patch define irq numbers of ARM performance monitoring unit for exynos4. The number of CPU cores and PMU irq numbers are vary according to soc types. So we need to identify each soc type using soc_is_xxx function and define the pmu irqs dynamically. In case of exynos4412, there are 4 cpu cores and pmus.
--- arch/arm/mach-exynos/common.c | 45 ++++++++++++++++++++++++++++++ arch/arm/mach-exynos/include/mach/irqs.h | 8 ++++-- arch/arm/plat-samsung/devs.c | 2 +- 3 files changed, 52 insertions(+), 3 deletions(-)
arch/arm/mach-exynos/common.c +45 -0
@@ -30,11 +30,13 @@#include <asm/mach/map.h> #include <asm/mach/irq.h> #include <asm/cacheflush.h> +#include <asm/pmu.h> #include <mach/regs-irq.h> #include <mach/regs-pmu.h> #include <mach/regs-gpio.h> #include <mach/pmu.h> +#include <mach/irqs.h> #include <plat/cpu.h> #include <plat/clock.h>
@@ -1056,3 +1058,46 @@ static int __init exynos_init_irq_eint(void)return 0 ; }arch_initcall (exynos_init_irq_eint); + +#if defined(CONFIG_CPU_EXYNOS4210 ) || defined(CONFIG_SOC_EXYNOS4212 ) +static struct resource exynos42xx_pmu_resource[] = { +DEFINE_RES_IRQ (EXYNOS4_IRQ_PMU ), +DEFINE_RES_IRQ (EXYNOS4_IRQ_PMU_CPU1 ), +}; + +static struct platform_device exynos42xx_device_pmu = { + .name ="arm-pmu" , + .num_resources =ARRAY_SIZE (exynos42xx_pmu_resource), + .resource = exynos42xx_pmu_resource, +}; +#endif + +#if defined(CONFIG_SOC_EXYNOS4412 ) +static struct resource exynos44xx_pmu_resource[] = { +DEFINE_RES_IRQ (EXYNOS4_IRQ_PMU ), +DEFINE_RES_IRQ (EXYNOS4_IRQ_PMU_CPU1 ), +DEFINE_RES_IRQ (EXYNOS4_IRQ_PMU_CPU2 ), +DEFINE_RES_IRQ (EXYNOS4_IRQ_PMU_CPU3 ), +}; + +static struct platform_device exynos44xx_device_pmu = { + .name ="arm-pmu" , + .num_resources =ARRAY_SIZE (exynos44xx_pmu_resource), + .resource = exynos44xx_pmu_resource, +}; +#endif + +static int __init exynos_armpmu_init (void ) +{ +#if defined(CONFIG_CPU_EXYNOS4210 ) || defined(CONFIG_SOC_EXYNOS4212 ) +if (soc_is_exynos4210 () ||soc_is_exynos4212 ()) +platform_device_register (&exynos42xx_device_pmu); +#endif +#if defined(CONFIG_SOC_EXYNOS4412 ) +if (soc_is_exynos4412 ()) +platform_device_register (&exynos44xx_device_pmu); +#endif + +return 0 ; +} +arch_initcall (exynos_armpmu_init);
arch/arm/mach-exynos/include/mach/irqs.h +6 -2
@@ -128,7 +128,7 @@#define EXYNOS4_IRQ_ADC1 IRQ_SPI(107)#define EXYNOS4_IRQ_PEN1 IRQ_SPI(108)#define EXYNOS4_IRQ_KEYPAD IRQ_SPI(109) -#define EXYNOS4_IRQ_PMU IRQ_SPI(110) +#define EXYNOS4_IRQ_POWER_PMU IRQ_SPI(110)#define EXYNOS4_IRQ_GPS IRQ_SPI(111)#define EXYNOS4_IRQ_INTFEEDCTRL_SSS IRQ_SPI(112)#define EXYNOS4_IRQ_SLIMBUS IRQ_SPI(113)
@@ -136,6 +136,11 @@#define EXYNOS4_IRQ_TSI IRQ_SPI(115)#define EXYNOS4_IRQ_SATA IRQ_SPI(116) +#define EXYNOS4_IRQ_PMU COMBINER_IRQ(2, 2) +#define EXYNOS4_IRQ_PMU_CPU1 COMBINER_IRQ(3, 2) +#define EXYNOS4_IRQ_PMU_CPU2 COMBINER_IRQ(18, 2) +#define EXYNOS4_IRQ_PMU_CPU3 COMBINER_IRQ(19, 2) +#define EXYNOS4_IRQ_SYSMMU_MDMA0_0 COMBINER_IRQ(4, 0)#define EXYNOS4_IRQ_SYSMMU_SSS_0 COMBINER_IRQ(4, 1)#define EXYNOS4_IRQ_SYSMMU_FIMC0_0 COMBINER_IRQ(4, 2)
@@ -230,7 +235,6 @@#define IRQ_TC EXYNOS4_IRQ_PEN0#define IRQ_KEYPAD EXYNOS4_IRQ_KEYPAD -#define IRQ_PMU EXYNOS4_IRQ_PMU#define IRQ_FIMD0_FIFO EXYNOS4_IRQ_FIMD0_FIFO#define IRQ_FIMD0_VSYNC EXYNOS4_IRQ_FIMD0_VSYNC
arch/arm/plat-samsung/devs.c +1 -1
@@ -1125,7 +1125,7 @@ struct platform_device s5p_device_onenand = {/* PMU */ -#ifdef CONFIG_PLAT_S5P +#if defined(CONFIG_PLAT_S5P ) && !defined(CONFIG_ARCH_EXYNOS )static struct resource s5p_pmu_resource[] = {DEFINE_RES_IRQ (IRQ_PMU ) };
Signature · 1 line
1.7.9.5
PATCH v3 3/4 ARM: EXYNOS: Enable PMUs for exynos4
Hi Chanho,
Quoted 64 lines · Chanho Park
This patch define irq numbers of ARM performance monitoring unit for exynos4. The number of CPU cores and PMU irq numbers are vary according to soc types. So we need to identify each soc type using
soc_is_xxxfunction and define the pmu irqs dynamically. In case of exynos4412, there are 4 cpu cores and pmus.Signed-off-by Chanho Park <[email protected]>Signed-off-by Kyungmin Park <[email protected]>--- arch/arm/mach-exynos/common.c | 45 ++++++++++++++++++++++++++++++ arch/arm/mach-exynos/include/mach/irqs.h | 8 ++++-- arch/arm/plat-samsung/devs.c | 2 +- 3 files changed, 52 insertions(+), 3 deletions(-)arch/arm/mach-exynos/common.c +31
-0@@ -30,11 +30,13 @@#include <asm/mach/map.h> #include <asm/mach/irq.h> #include <asm/cacheflush.h> +#include <asm/pmu.h> #include <mach/regs-irq.h> #include <mach/regs-pmu.h> #include <mach/regs-gpio.h> #include <mach/pmu.h> +#include <mach/irqs.h> #include <plat/cpu.h> #include <plat/clock.h> @@ -1056,3 +1058,46 @@ static int __init exynos_init_irq_eint(void)return 0 ; }arch_initcall (exynos_init_irq_eint); + +#if defined(CONFIG_CPU_EXYNOS4210 ) || defined(CONFIG_SOC_EXYNOS4212 ) +static struct resource exynos42xx_pmu_resource[] = { +DEFINE_RES_IRQ (EXYNOS4_IRQ_PMU ), +DEFINE_RES_IRQ (EXYNOS4_IRQ_PMU_CPU1 ), +}; + +static struct platform_device exynos42xx_device_pmu = { + .name ="arm-pmu" , + .num_resources =ARRAY_SIZE (exynos42xx_pmu_resource), + .resource = exynos42xx_pmu_resource, +}; +#endif + +#if defined(CONFIG_SOC_EXYNOS4412 ) +static struct resource exynos44xx_pmu_resource[] = { +DEFINE_RES_IRQ (EXYNOS4_IRQ_PMU ), +DEFINE_RES_IRQ (EXYNOS4_IRQ_PMU_CPU1 ), +DEFINE_RES_IRQ (EXYNOS4_IRQ_PMU_CPU2 ), +DEFINE_RES_IRQ (EXYNOS4_IRQ_PMU_CPU3 ), +}; + +static struct platform_device exynos44xx_device_pmu = { + .name ="arm-pmu" , + .num_resources =ARRAY_SIZE (exynos44xx_pmu_resource), + .resource = exynos44xx_pmu_resource, +}; +#endif +
arch/arm/mach-exynos/common.c static int __init exynos_init_irq_eint(void) · line 1099
Quoted 10 lines
arch/arm/mach-exynos/common.c +10
-0+static int __init exynos_armpmu_init (void ) +{ +#if defined(CONFIG_CPU_EXYNOS4210 ) || defined(CONFIG_SOC_EXYNOS4212 ) +if (soc_is_exynos4210 () ||soc_is_exynos4212 ()) +platform_device_register (&exynos42xx_device_pmu); +#endif +#if defined(CONFIG_SOC_EXYNOS4412 ) +if (soc_is_exynos4412 ()) +platform_device_register (&exynos44xx_device_pmu); +#endif
Do we need both compile time and run-time checks here?
Quoted 53 lines
arch/arm/mach-exynos/common.c +4
-0+ +return 0 ; +} +arch_initcall (exynos_armpmu_init);arch/arm/mach-exynos/include/mach/irqs.h +6
-2@@ -128,7 +128,7 @@#define EXYNOS4_IRQ_ADC1 IRQ_SPI(107)#define EXYNOS4_IRQ_PEN1 IRQ_SPI(108)#define EXYNOS4_IRQ_KEYPAD IRQ_SPI(109) -#define EXYNOS4_IRQ_PMU IRQ_SPI(110) +#define EXYNOS4_IRQ_POWER_PMU IRQ_SPI(110)#define EXYNOS4_IRQ_GPS IRQ_SPI(111)#define EXYNOS4_IRQ_INTFEEDCTRL_SSS IRQ_SPI(112)#define EXYNOS4_IRQ_SLIMBUS IRQ_SPI(113)@@ -136,6 +136,11 @@#define EXYNOS4_IRQ_TSI IRQ_SPI(115)#define EXYNOS4_IRQ_SATA IRQ_SPI(116) +#define EXYNOS4_IRQ_PMU COMBINER_IRQ(2, 2) +#define EXYNOS4_IRQ_PMU_CPU1 COMBINER_IRQ(3, 2) +#define EXYNOS4_IRQ_PMU_CPU2 COMBINER_IRQ(18, 2) +#define EXYNOS4_IRQ_PMU_CPU3 COMBINER_IRQ(19, 2) +#define EXYNOS4_IRQ_SYSMMU_MDMA0_0 COMBINER_IRQ(4, 0)#define EXYNOS4_IRQ_SYSMMU_SSS_0 COMBINER_IRQ(4, 1)#define EXYNOS4_IRQ_SYSMMU_FIMC0_0 COMBINER_IRQ(4, 2)@@ -230,7 +235,6 @@#define IRQ_TC EXYNOS4_IRQ_PEN0#define IRQ_KEYPAD EXYNOS4_IRQ_KEYPAD -#define IRQ_PMU EXYNOS4_IRQ_PMU#define IRQ_FIMD0_FIFO EXYNOS4_IRQ_FIMD0_FIFO#define IRQ_FIMD0_VSYNC EXYNOS4_IRQ_FIMD0_VSYNCarch/arm/plat-samsung/devs.c +1
-2@@ -1125,7 +1125,7 @@ struct platform_device s5p_device_onenand = {/* PMU */ -#ifdef CONFIG_PLAT_S5P +#if defined(CONFIG_PLAT_S5P ) && !defined(CONFIG_ARCH_EXYNOS )static struct resource s5p_pmu_resource[] = {DEFINE_RES_IRQ (IRQ_PMU ) }; --1.7.9.5
Signature · 2 lines
With warm regards, Sachin
PATCH v3 3/4 ARM: EXYNOS: Enable PMUs for exynos4
Quoted 85 lines
-----Original Message-----
From: Sachin Kamat [mailto:[email protected]]
Sent: Wednesday, August 29, 2012 12:39 PM
To: Chanho Park
Cc: [email protected]; [email protected]; linux- [email protected]; [email protected]; [email protected]; [email protected]; Kyungmin Park
Subject: Re: [PATCH v3 3/4] ARM: EXYNOS: Enable PMUs for exynos4Hi Chanho,
Quoted 1 line · Chanho Park
This patch define irq numbers of ARM performance monitoring unit for
exynos4.
Quoted 1 line
The number of CPU cores and PMU irq numbers are vary according to soc
types.
Quoted 2 lines
So we need to identify each soc type using
soc_is_xxxfunction and define the pmu irqs dynamically. In case of exynos4412, there are 4 cpucores and pmus.
Quoted 5 lines
Signed-off-by Chanho Park <[email protected]>Signed-off-by Kyungmin Park <[email protected]>--- arch/arm/mach-exynos/common.c | 45++++++++++++++++++++++++++++++
Quoted 23 lines
arch/arm/mach-exynos/include/mach/irqs.h | 8 ++++-- arch/arm/plat-samsung/devs.c | 2 +- 3 files changed, 52 insertions(+), 3 deletions(-)(quoted diff) +0
-0
b/arch/arm/mach-exynos/common.cindex be61564..24b78bd 100644arch/arm/mach-exynos/common.c +2
-0@@ -30,11 +30,13 @@#include <asm/mach/map.h> #include <asm/mach/irq.h> #include <asm/cacheflush.h> +#include <asm/pmu.h> #include <mach/regs-irq.h> #include <mach/regs-pmu.h> #include <mach/regs-gpio.h> #include <mach/pmu.h> +#include <mach/irqs.h> #include <plat/cpu.h> #include <plat/clock.h> arch/arm/mach-exynos/common.c static int __init exynos_init_irq_eint(void) · line 1062
Quoted 5 lines
arch/arm/mach-exynos/common.c +2
-0@@ -1056,3 +1058,46 @@ static int __init exynos_init_irq_eint(void)return 0 ; }arch_initcall (exynos_init_irq_eint); + +#if defined(CONFIG_CPU_EXYNOS4210) ||
defined(CONFIG_SOC_EXYNOS4212)Quoted 19 lines
arch/arm/mach-exynos/common.c +19
-0+static struct resource exynos42xx_pmu_resource[] = { +DEFINE_RES_IRQ (EXYNOS4_IRQ_PMU ), +DEFINE_RES_IRQ (EXYNOS4_IRQ_PMU_CPU1 ), +}; + +static struct platform_device exynos42xx_device_pmu = { + .name ="arm-pmu" , + .num_resources =ARRAY_SIZE (exynos42xx_pmu_resource), + .resource = exynos42xx_pmu_resource, +}; +#endif + +#if defined(CONFIG_SOC_EXYNOS4412 ) +static struct resource exynos44xx_pmu_resource[] = { +DEFINE_RES_IRQ (EXYNOS4_IRQ_PMU ), +DEFINE_RES_IRQ (EXYNOS4_IRQ_PMU_CPU1 ), +DEFINE_RES_IRQ (EXYNOS4_IRQ_PMU_CPU2 ), +DEFINE_RES_IRQ (EXYNOS4_IRQ_PMU_CPU3 ), +};arch/arm/mach-exynos/common.c static int __init exynos_init_irq_eint(void)
Quoted 10 lines
arch/arm/mach-exynos/common.c +10
-0+ +static struct platform_device exynos44xx_device_pmu = { + .name ="arm-pmu" , + .num_resources =ARRAY_SIZE (exynos44xx_pmu_resource), + .resource = exynos44xx_pmu_resource, +}; +#endif + +static int __init exynos_armpmu_init(void) { #if +defined(CONFIG_CPU_EXYNOS4210) ||
defined(CONFIG_SOC_EXYNOS4212)
Quoted 9 lines
arch/arm/mach-exynos/common.c static int __init exynos_init_irq_eint(void) · line 1099
Quoted 7 lines
arch/arm/mach-exynos/common.c +7
-0+if (soc_is_exynos4210 () ||soc_is_exynos4212 ()) +platform_device_register (&exynos42xx_device_pmu); +#endif +#if defined(CONFIG_SOC_EXYNOS4412 ) +if (soc_is_exynos4412 ()) +platform_device_register (&exynos44xx_device_pmu); +#endif Do we need both compile time and run-time checks here?
I think we can reduce code size and avoid unnecessary comparison using compile time check if turn off these kernel configurations.
And runtime check is helpful when turned on all SoC types in the kernel configurations.
Best regards,
Chanho Park
Quoted 62 lines
Quoted 54 lines
arch/arm/mach-exynos/common.c +4
-0+ +return 0 ; +} +arch_initcall (exynos_armpmu_init);arch/arm/mach-exynos/include/mach/irqs.h +6
-2@@ -128,7 +128,7 @@#define EXYNOS4_IRQ_ADC1 IRQ_SPI(107)#define EXYNOS4_IRQ_PEN1 IRQ_SPI(108)#define EXYNOS4_IRQ_KEYPAD IRQ_SPI(109) -#define EXYNOS4_IRQ_PMU IRQ_SPI(110) +#define EXYNOS4_IRQ_POWER_PMU IRQ_SPI(110)#define EXYNOS4_IRQ_GPS IRQ_SPI(111)#define EXYNOS4_IRQ_INTFEEDCTRL_SSS IRQ_SPI(112)#define EXYNOS4_IRQ_SLIMBUS IRQ_SPI(113)@@ -136,6 +136,11 @@#define EXYNOS4_IRQ_TSI IRQ_SPI(115)#define EXYNOS4_IRQ_SATA IRQ_SPI(116) +#define EXYNOS4_IRQ_PMU COMBINER_IRQ(2, 2) +#define EXYNOS4_IRQ_PMU_CPU1 COMBINER_IRQ(3, 2) +#define EXYNOS4_IRQ_PMU_CPU2 COMBINER_IRQ(18, 2) +#define EXYNOS4_IRQ_PMU_CPU3 COMBINER_IRQ(19, 2) +#define EXYNOS4_IRQ_SYSMMU_MDMA0_0 COMBINER_IRQ(4, 0)#define EXYNOS4_IRQ_SYSMMU_SSS_0 COMBINER_IRQ(4, 1)#define EXYNOS4_IRQ_SYSMMU_FIMC0_0 COMBINER_IRQ(4, 2)@@ -230,7 +235,6 @@#define IRQ_TC EXYNOS4_IRQ_PEN0#define IRQ_KEYPAD EXYNOS4_IRQ_KEYPAD -#define IRQ_PMU EXYNOS4_IRQ_PMU#define IRQ_FIMD0_FIFO EXYNOS4_IRQ_FIMD0_FIFO#define IRQ_FIMD0_VSYNC EXYNOS4_IRQ_FIMD0_VSYNC(quoted diff) +0
-0
b/arch/arm/plat-samsung/devs.cindex fc49f3d..3b44dad 100644arch/arm/plat-samsung/devs.c +1
-2@@ -1125,7 +1125,7 @@ struct platform_device s5p_device_onenand = {/* PMU */ -#ifdef CONFIG_PLAT_S5P +#if defined(CONFIG_PLAT_S5P ) && !defined(CONFIG_ARCH_EXYNOS )static struct resource s5p_pmu_resource[] = {DEFINE_RES_IRQ (IRQ_PMU ) }; --Quoted 2 lines
1.7.9.5
--
With warm regards,
Sachin
PATCH v3 3/4 ARM: EXYNOS: Enable PMUs for exynos4
In reply to Chanho ParkQuoted 18 lines · Chanho Park
This patch define irq numbers of ARM performance monitoring unit for exynos4. The number of CPU cores and PMU irq numbers are vary according to soc types. So we need to identify each soc type using
soc_is_xxxfunction and define the pmu irqs dynamically. In case of exynos4412, there are 4 cpu cores and pmus.Signed-off-by Chanho Park <[email protected]>Signed-off-by Kyungmin Park <[email protected]>--- arch/arm/mach-exynos/common.c | 45 ++++++++++++++++++++++++++++++ arch/arm/mach-exynos/include/mach/irqs.h | 8 ++++-- arch/arm/plat-samsung/devs.c | 2 +- 3 files changed, 52 insertions(+), 3 deletions(-)arch/arm/mach-exynos/common.c +0
-0
arch/arm/mach-exynos/common.c line 33
Quoted 4 lines
arch/arm/mach-exynos/common.c +1
-0@@ -30,11 +30,13 @@#include <asm/mach/map.h> #include <asm/mach/irq.h> #include <asm/cacheflush.h> +#include <asm/pmu.h>
Why do you need this header file?
Quoted 15 lines
arch/arm/mach-exynos/common.c +4
-0#include <mach/regs-irq.h> #include <mach/regs-pmu.h> #include <mach/regs-gpio.h> #include <mach/pmu.h> +#include <mach/irqs.h> #include <plat/cpu.h> #include <plat/clock.h> @@ -1056,3 +1058,46 @@ static int __init exynos_init_irq_eint(void)return 0 ; }arch_initcall (exynos_init_irq_eint); + +#if defined(CONFIG_CPU_EXYNOS4210 ) || defined(CONFIG_SOC_EXYNOS4212 ) +static struct resource exynos42xx_pmu_resource[] = {
arch/arm/mach-exynos/common.c static int __init exynos_init_irq_eint(void) · line 1073
Quoted 10 lines
arch/arm/mach-exynos/common.c +10
-0+DEFINE_RES_IRQ (EXYNOS4_IRQ_PMU ), + DEFINE_RES_IRQ(EXYNOS4_IRQ_PMU_CPU1), +}; + +static struct platform_device exynos42xx_device_pmu = { + .name ="arm-pmu" , + .num_resources =ARRAY_SIZE (exynos42xx_pmu_resource), + .resource = exynos42xx_pmu_resource, +}; +#endif
Given that you don't pass an id and your device-tree binding is that for Cortex A15, I assume this patch series is based on my perf/updates branch?
That's good because it reduces the potential for conflicts, but you should make sure that whoever you send this to is aware of the dependency.
Cheers,
Will
PATCH v3 3/4 ARM: EXYNOS: Enable PMUs for exynos4
Quoted 28 lines
-----Original Message-----
From: [email protected] [mailto:linux-arm- [email protected]] On Behalf Of Will Deacon
Sent: Thursday, August 30, 2012 6:34 AM
To: Chanho Park
Cc: [email protected]; [email protected]; [email protected]; Kyungmin Park; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v3 3/4] ARM: EXYNOS: Enable PMUs for exynos4Quoted 1 line · Chanho Park
This patch define irq numbers of ARM performance monitoring unit for
exynos4.
Quoted 1 line
The number of CPU cores and PMU irq numbers are vary according to soc
types.
Quoted 2 lines
So we need to identify each soc type using
soc_is_xxxfunction and define the pmu irqs dynamically. In case of exynos4412, there are 4 cpucores and pmus.
Quoted 5 lines
Signed-off-by Chanho Park <[email protected]>Signed-off-by Kyungmin Park <[email protected]>--- arch/arm/mach-exynos/common.c | 45++++++++++++++++++++++++++++++
Quoted 4 lines
arch/arm/mach-exynos/include/mach/irqs.h | 8 ++++-- arch/arm/plat-samsung/devs.c | 2 +- 3 files changed, 52 insertions(+), 3 deletions(-)
Quoted 11 lines
arch/arm/mach-exynos/common.c line 33
Quoted 9 lines
(quoted diff) +0
-0
b/arch/arm/mach-exynos/common.cindex be61564..24b78bd 100644arch/arm/mach-exynos/common.c +1
-0@@ -30,11 +30,13 @@#include <asm/mach/map.h> #include <asm/mach/irq.h> #include <asm/cacheflush.h> +#include <asm/pmu.h> Why do you need this header file?
Oh, I'll remove it. Thanks.
Quoted 31 lines
Quoted 10 lines
arch/arm/mach-exynos/common.c +1
-0#include <mach/regs-irq.h> #include <mach/regs-pmu.h> #include <mach/regs-gpio.h> #include <mach/pmu.h> +#include <mach/irqs.h> #include <plat/cpu.h> #include <plat/clock.h> arch/arm/mach-exynos/common.c static int __init exynos_init_irq_eint(void) · line 1062
Quoted 5 lines
arch/arm/mach-exynos/common.c +2
-0@@ -1056,3 +1058,46 @@ static int __init exynos_init_irq_eint(void)return 0 ; }arch_initcall (exynos_init_irq_eint); + +#if defined(CONFIG_CPU_EXYNOS4210) ||
defined(CONFIG_SOC_EXYNOS4212)arch/arm/mach-exynos/common.c static int __init exynos_init_irq_eint(void) · line 1073
Quoted 11 lines
arch/arm/mach-exynos/common.c +11
-0+static struct resource exynos42xx_pmu_resource[] = { +DEFINE_RES_IRQ (EXYNOS4_IRQ_PMU ), +DEFINE_RES_IRQ (EXYNOS4_IRQ_PMU_CPU1 ), +}; + +static struct platform_device exynos42xx_device_pmu = { + .name ="arm-pmu" , + .num_resources =ARRAY_SIZE (exynos42xx_pmu_resource), + .resource = exynos42xx_pmu_resource, +}; +#endif Given that you don't pass an id and your device-tree binding is that for Cortex A15, I assume this patch series is based on my perf/updates branch?
Quoted 2 lines
That's good because it reduces the potential for conflicts, but you should make sure that whoever you send this to is aware of the dependency.
Yes. This patch is based on your latest patchset to avoid conflict because I saw Kukjin had acked your patch. I think he'll resolve the dependency. If not, I'll re-submit this patch after applied your patch.
Best regards,
Chanho Park
Quoted 9 lines
Cheers,
Will
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v3 4/4 ARM: EXYNOS: Add arm-pmu DT binding for exynos5250
In reply to Chanho ParkThis patch enables arm-pmu to bind device tree for exynos5250. The exynos5250 has two pmus which have combiner irq type.
--- arch/arm/boot/dts/exynos5250.dtsi | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm/boot/dts/exynos5250.dtsi +6 -0
@@ -52,6 +52,12 @@ <0 28 0>, <0 29 0>, <0 30 0>, <0 31 0>; }; + pmu { + compatible = "arm,cortex-a15-pmu"; + interrupt-parent = <&combiner>; + interrupts = <1 2>, <22 4>; + }; + watchdog { compatible = "samsung,s3c2410-wdt"; reg = <0x101D0000 0x100>;
Signature · 1 line
1.7.9.5
PATCH v3 4/4 ARM: EXYNOS: Add arm-pmu DT binding for exynos5250
Quoted 27 lines · Chanho Park
This patch enables arm-pmu to bind device tree for exynos5250. The exynos5250 has two pmus which have combiner irq type.
Signed-off-by Chanho Park <[email protected]>Signed-off-by Kyungmin Park <[email protected]>--- arch/arm/boot/dts/exynos5250.dtsi | 6 ++++++ 1 file changed, 6 insertions(+)arch/arm/boot/dts/exynos5250.dtsi +6
-1@@ -52,6 +52,12 @@ <0 28 0>, <0 29 0>, <0 30 0>, <0 31 0>; }; + pmu { + compatible = "arm,cortex-a15-pmu"; + interrupt-parent = <&combiner>; + interrupts = <1 2>, <22 4>; + }; + watchdog { compatible = "samsung,s3c2410-wdt"; reg = <0x101D0000 0x100>; --
Quoted 2 lines
1.7.9.5
Probably, this should be doable for Exynos4 as well.