ARM: GIC: cleanup
Subsystems (8)
cover ARM: GIC: cleanup
This patch series cleans up the GIC code, consolidating some of the per-platform practices into the common GIC code.
One notable change is to the initialization methods - we used to require platforms to pass in the address of the per-CPU interfaces despite them always being identical between all cores. This was nonsense, as even in the extremely unlikely event that they were different, we aren't storing them in a per-CPU manner.
The GIC initialization methods are now simpler: one call to gic_init() from the boot CPU, and a call to gic_secondary_init() as each secondary CPU starts - and no need for platforms to keep track of the address anymore.
One question remains on this: on platforms where there are more than one GIC, do these have separate CPU interfaces as well?
We also consolidate gic_cpu_base_addr to save platforms using that - but only for the first GIC, and therefore we can have a common get_irqnr_preamble assembler macro for platforms which make use of this.
Lastly, we move the GIC data to __read_mostly - and when we have support for this feature, we benefit from avoiding potential cache line ping-pongs between cores for data so marked.
arch/arm/common/gic.c | 59 +++++++++++++------- arch/arm/include/asm/hardware/entry-macro-gic.S | 7 +++ arch/arm/include/asm/hardware/gic.h | 6 ++- arch/arm/mach-cns3xxx/core.c | 7 +-- arch/arm/mach-cns3xxx/core.h | 1 - arch/arm/mach-cns3xxx/include/mach/entry-macro.S | 5 -- arch/arm/mach-msm/board-msm8x60.c | 7 +-- arch/arm/mach-omap2/include/mach/entry-macro.S | 1 + arch/arm/mach-omap2/include/mach/omap4-common.h | 1 - arch/arm/mach-omap2/omap-smp.c | 2 +- arch/arm/mach-omap2/omap4-common.c | 11 ++-- arch/arm/mach-realview/core.c | 3 - arch/arm/mach-realview/core.h | 1 - arch/arm/mach-realview/include/mach/entry-macro.S | 5 -- arch/arm/mach-realview/platsmp.c | 2 +- arch/arm/mach-realview/realview_eb.c | 14 ++--- arch/arm/mach-realview/realview_pb1176.c | 11 ++-- arch/arm/mach-realview/realview_pb11mp.c | 10 ++-- arch/arm/mach-realview/realview_pba8.c | 6 +- arch/arm/mach-realview/realview_pbx.c | 13 ++--- arch/arm/mach-s5pv310/cpu.c | 6 +-- arch/arm/mach-s5pv310/include/mach/smp.h | 2 - arch/arm/mach-s5pv310/platsmp.c | 2 +- arch/arm/mach-tegra/include/mach/entry-macro.S | 2 +- arch/arm/mach-tegra/irq.c | 4 +- arch/arm/mach-tegra/platsmp.c | 2 +- arch/arm/mach-ux500/cpu.c | 4 +- arch/arm/mach-ux500/include/mach/entry-macro.S | 1 + arch/arm/mach-ux500/platsmp.c | 2 +- arch/arm/mach-vexpress/core.h | 2 - arch/arm/mach-vexpress/ct-ca9x4.c | 7 +-- arch/arm/mach-vexpress/include/mach/entry-macro.S | 5 -- arch/arm/mach-vexpress/platsmp.c | 2 +- 33 files changed, 100 insertions(+), 113 deletions(-)
PATCH 1/5 ARM: GIC: provide a single initialization function for boot CPU
Provide gic_init() which initializes the GIC distributor and current CPU's GIC interface for the boot (or single) CPU.
--- arch/arm/common/gic.c | 11 +++++++++-- arch/arm/include/asm/hardware/gic.h | 2 +- arch/arm/mach-cns3xxx/core.c | 4 ++-- arch/arm/mach-msm/board-msm8x60.c | 3 +-- arch/arm/mach-omap2/omap4-common.c | 4 ++-- arch/arm/mach-realview/realview_eb.c | 12 ++++++------ arch/arm/mach-realview/realview_pb1176.c | 10 ++++++---- arch/arm/mach-realview/realview_pb11mp.c | 9 +++++---- arch/arm/mach-realview/realview_pba8.c | 5 +++-- arch/arm/mach-realview/realview_pbx.c | 11 +++++------ arch/arm/mach-s5pv310/cpu.c | 3 +-- arch/arm/mach-tegra/irq.c | 4 ++-- arch/arm/mach-ux500/cpu.c | 4 ++-- arch/arm/mach-vexpress/ct-ca9x4.c | 3 +-- 14 files changed, 46 insertions(+), 39 deletions(-)
arch/arm/common/gic.c +9 -2
@@ -207,8 +207,8 @@ void __init gic_cascade_irq(unsigned int gic_nr, unsigned int irq)set_irq_chained_handler (irq, gic_handle_cascade_irq); } -void __init gic_dist_init (unsigned int gic_nr,void __iomem *base, -unsigned int irq_start) +static void __init gic_dist_init (unsigned int gic_nr,void __iomem *base, +unsigned int irq_start) {unsigned int max_irq, i;u32 cpumask =1 <<smp_processor_id ();
@@ -306,6 +306,13 @@ void __cpuinit gic_cpu_init(unsigned int gic_nr, void __iomem *base)writel (1 , base +GIC_CPU_CTRL ); } +void __init gic_init (unsigned int gic_nr,unsigned int irq_start, +void __iomem *dist_base,void __iomem *cpu_base) +{ +gic_dist_init (gic_nr, dist_base, irq_start); +gic_cpu_init (gic_nr, cpu_base); +} +#ifdef CONFIG_SMP void gic_raise_softirq (const struct cpumask *mask,unsigned int irq) {
arch/arm/include/asm/hardware/gic.h +1 -1
@@ -33,8 +33,8 @@#define GIC_DIST_SOFTINT 0xf00#ifndef __ASSEMBLY__ -void gic_dist_init (unsigned int gic_nr,void __iomem *base,unsigned int irq_start);void gic_cpu_init (unsigned int gic_nr,void __iomem *base); +void gic_init (unsigned int ,unsigned int ,void __iomem *,void __iomem *);void gic_cascade_irq (unsigned int gic_nr,unsigned int irq);void gic_raise_softirq (const struct cpumask *mask,unsigned int irq);#endif
arch/arm/mach-cns3xxx/core.c +2 -2
@@ -74,8 +74,8 @@ void __iomem *gic_cpu_base_addr;void __init cns3xxx_init_irq (void ) { gic_cpu_base_addr =__io (CNS3XXX_TC11MP_GIC_CPU_BASE_VIRT ); -gic_dist_init (0 ,__io (CNS3XXX_TC11MP_GIC_DIST_BASE_VIRT ),29 ); -gic_cpu_init (0 , gic_cpu_base_addr); +gic_init (0 ,29 ,__io (CNS3XXX_TC11MP_GIC_DIST_BASE_VIRT ), + gic_cpu_base_addr); }void cns3xxx_power_off (void )
arch/arm/mach-msm/board-msm8x60.c +1 -2
@@ -44,9 +44,8 @@ static void __init msm8x60_init_irq(void) {unsigned int i; -gic_dist_init (0 ,MSM_QGIC_DIST_BASE ,GIC_PPI_START ); gic_cpu_base_addr = (void *)MSM_QGIC_CPU_BASE ; -gic_cpu_init (0 ,MSM_QGIC_CPU_BASE ); +gic_init (0 ,GIC_PPI_START ,MSM_QGIC_DIST_BASE , gic_cpu_base_addr);/* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */ writel (0xFFFFD7FF ,MSM_QGIC_DIST_BASE +GIC_DIST_CONFIG +4 );
arch/arm/mach-omap2/omap4-common.c +2 -2
@@ -35,12 +35,12 @@ void __init gic_init_irq(void)/* Static mapping, never released */ gic_dist_base_addr =ioremap (OMAP44XX_GIC_DIST_BASE ,SZ_4K );BUG_ON (!gic_dist_base_addr); -gic_dist_init (0 , gic_dist_base_addr,29 );/* Static mapping, never released */ gic_cpu_base_addr =ioremap (OMAP44XX_GIC_CPU_BASE ,SZ_512 );BUG_ON (!gic_cpu_base_addr); -gic_cpu_init (0 , gic_cpu_base_addr); + +gic_init (0 ,29 , gic_dist_base_addr, gic_cpu_base_addr); }#ifdef CONFIG_CACHE_L2X0
arch/arm/mach-realview/realview_eb.c +6 -6
@@ -365,20 +365,20 @@ static void __init gic_init_irq(void)/* core tile GIC, primary */ gic_cpu_base_addr =__io_address (REALVIEW_EB11MP_GIC_CPU_BASE ); -gic_dist_init (0 ,__io_address (REALVIEW_EB11MP_GIC_DIST_BASE ),29 ); -gic_cpu_init (0 , gic_cpu_base_addr); +gic_init (0 ,29 ,__io_address (REALVIEW_EB11MP_GIC_DIST_BASE ), + gic_cpu_base_addr);#ifndef CONFIG_REALVIEW_EB_ARM11MP_REVB /* board GIC, secondary */ -gic_dist_init (1 ,__io_address (REALVIEW_EB_GIC_DIST_BASE ),64 ); -gic_cpu_init (1 ,__io_address (REALVIEW_EB_GIC_CPU_BASE )); +gic_init (1 ,64 ,__io_address (REALVIEW_EB_GIC_DIST_BASE ), +__io_address (REALVIEW_EB_GIC_CPU_BASE ));gic_cascade_irq (1 ,IRQ_EB11MP_EB_IRQ1 );#endif }else {/* board GIC, primary */ gic_cpu_base_addr =__io_address (REALVIEW_EB_GIC_CPU_BASE ); -gic_dist_init (0 ,__io_address (REALVIEW_EB_GIC_DIST_BASE ),29 ); -gic_cpu_init (0 , gic_cpu_base_addr); +gic_init (0 ,29 ,__io_address (REALVIEW_EB_GIC_DIST_BASE ), + gic_cpu_base_addr); } }
arch/arm/mach-realview/realview_pb1176.c +6 -4
@@ -305,12 +305,14 @@ static void __init gic_init_irq(void) {/* ARM1176 DevChip GIC, primary */ gic_cpu_base_addr =__io_address (REALVIEW_DC1176_GIC_CPU_BASE ); -gic_dist_init (0 ,__io_address (REALVIEW_DC1176_GIC_DIST_BASE ),IRQ_DC1176_GIC_START ); -gic_cpu_init (0 , gic_cpu_base_addr); +gic_init (0 ,IRQ_DC1176_GIC_START , +__io_address (REALVIEW_DC1176_GIC_DIST_BASE ), + gic_cpu_base_addr);/* board GIC, secondary */ -gic_dist_init (1 ,__io_address (REALVIEW_PB1176_GIC_DIST_BASE ),IRQ_PB1176_GIC_START ); -gic_cpu_init (1 ,__io_address (REALVIEW_PB1176_GIC_CPU_BASE )); +gic_init (1 ,IRQ_PB1176_GIC_START , +__io_address (REALVIEW_PB1176_GIC_DIST_BASE ), +__io_address (REALVIEW_PB1176_GIC_CPU_BASE ));gic_cascade_irq (1 ,IRQ_DC1176_PB_IRQ1 ); }
arch/arm/mach-realview/realview_pb11mp.c +5 -4
@@ -310,12 +310,13 @@ static void __init gic_init_irq(void)/* ARM11MPCore test chip GIC, primary */ gic_cpu_base_addr =__io_address (REALVIEW_TC11MP_GIC_CPU_BASE ); -gic_dist_init (0 ,__io_address (REALVIEW_TC11MP_GIC_DIST_BASE ),29 ); -gic_cpu_init (0 , gic_cpu_base_addr); +gic_init (0 ,29 ,__io_address (REALVIEW_TC11MP_GIC_DIST_BASE ), + gic_cpu_base_addr);/* board GIC, secondary */ -gic_dist_init (1 ,__io_address (REALVIEW_PB11MP_GIC_DIST_BASE ),IRQ_PB11MP_GIC_START ); -gic_cpu_init (1 ,__io_address (REALVIEW_PB11MP_GIC_CPU_BASE )); +gic_init (1 ,IRQ_PB11MP_GIC_START , +__io_address (REALVIEW_PB11MP_GIC_DIST_BASE ), +__io_address (REALVIEW_PB11MP_GIC_CPU_BASE ));gic_cascade_irq (1 ,IRQ_TC11MP_PB_IRQ1 ); }
arch/arm/mach-realview/realview_pba8.c +3 -2
@@ -274,8 +274,9 @@ static void __init gic_init_irq(void) {/* ARM PB-A8 on-board GIC */ gic_cpu_base_addr =__io_address (REALVIEW_PBA8_GIC_CPU_BASE ); -gic_dist_init (0 ,__io_address (REALVIEW_PBA8_GIC_DIST_BASE ),IRQ_PBA8_GIC_START ); -gic_cpu_init (0 ,__io_address (REALVIEW_PBA8_GIC_CPU_BASE )); +gic_init (0 ,IRQ_PBA8_GIC_START , +__io_address (REALVIEW_PBA8_GIC_DIST_BASE ), +__io_address (REALVIEW_PBA8_GIC_CPU_BASE )); }static void __init realview_pba8_timer_init (void )
arch/arm/mach-realview/realview_pbx.c +5 -6
@@ -314,14 +314,13 @@ static void __init gic_init_irq(void)/* ARM PBX on-board GIC */ if (core_tile_pbx11mp () ||core_tile_pbxa9mp ()) { gic_cpu_base_addr =__io_address (REALVIEW_PBX_TILE_GIC_CPU_BASE ); -gic_dist_init (0 ,__io_address (REALVIEW_PBX_TILE_GIC_DIST_BASE ), -29 ); -gic_cpu_init (0 ,__io_address (REALVIEW_PBX_TILE_GIC_CPU_BASE )); +gic_init (0 ,29 ,__io_address (REALVIEW_PBX_TILE_GIC_DIST_BASE ), +__io_address (REALVIEW_PBX_TILE_GIC_CPU_BASE )); }else { gic_cpu_base_addr =__io_address (REALVIEW_PBX_GIC_CPU_BASE ); -gic_dist_init (0 ,__io_address (REALVIEW_PBX_GIC_DIST_BASE ), -IRQ_PBX_GIC_START ); -gic_cpu_init (0 ,__io_address (REALVIEW_PBX_GIC_CPU_BASE )); +gic_init (0 ,IRQ_PBX_GIC_START , +__io_address (REALVIEW_PBX_GIC_DIST_BASE ), +__io_address (REALVIEW_PBX_GIC_CPU_BASE )); } }
arch/arm/mach-s5pv310/cpu.c +1 -2
@@ -123,8 +123,7 @@ void __init s5pv310_init_irq(void)int irq; gic_cpu_base_addr =S5P_VA_GIC_CPU ; -gic_dist_init (0 ,S5P_VA_GIC_DIST ,IRQ_LOCALTIMER ); -gic_cpu_init (0 ,S5P_VA_GIC_CPU ); +gic_init (0 ,IRQ_LOCALTIMER ,S5P_VA_GIC_DIST ,S5P_VA_GIC_CPU );for (irq =0 ; irq <MAX_COMBINER_NR ; irq++) { combiner_init(irq, (void __iomem *)S5P_VA_COMBINER(irq),
arch/arm/mach-tegra/irq.c +2 -2
@@ -94,8 +94,8 @@ void __init tegra_init_irq(void)writel (0 ,ictlr_to_virt (i) +ICTLR_CPU_IEP_CLASS ); } -gic_dist_init (0 ,IO_ADDRESS (TEGRA_ARM_INT_DIST_BASE ),29 ); -gic_cpu_init (0 ,IO_ADDRESS (TEGRA_ARM_PERIF_BASE +0x100 )); +gic_init (0 ,29 ,IO_ADDRESS (TEGRA_ARM_INT_DIST_BASE ), +IO_ADDRESS (TEGRA_ARM_PERIF_BASE +0x100 )); gic =get_irq_chip (29 ); gic_unmask_irq = gic->unmask;
arch/arm/mach-ux500/cpu.c +2 -2
@@ -61,8 +61,8 @@ void __init ux500_init_devices(void)void __init ux500_init_irq (void ) { -gic_dist_init (0 ,__io_address (UX500_GIC_DIST_BASE ),29 ); -gic_cpu_init (0 ,__io_address (UX500_GIC_CPU_BASE )); +gic_init (0 ,29 ,__io_address (UX500_GIC_DIST_BASE ), +__io_address (UX500_GIC_CPU_BASE ));/* * Init clocks here so that they are available for system timer
arch/arm/mach-vexpress/ct-ca9x4.c +1 -2
@@ -65,8 +65,7 @@ void __iomem *gic_cpu_base_addr;static void __init ct_ca9x4_init_irq (void ) { gic_cpu_base_addr =MMIO_P2V (A9_MPCORE_GIC_CPU ); -gic_dist_init (0 ,MMIO_P2V (A9_MPCORE_GIC_DIST ),29 ); -gic_cpu_init (0 , gic_cpu_base_addr); +gic_init (0 ,29 ,MMIO_P2V (A9_MPCORE_GIC_DIST ), gic_cpu_base_addr); }#if 0
Signature · 1 line
1.6.2.5
PATCH 1/5 ARM: GIC: provide a single initialization function for boot CPU
Quoted 4 lines · Russell King - ARM Linux
Provide
gic_init()which initializes the GIC distributor and current CPU's GIC interface for the boot (or single) CPU.Signed-off-by Russell King <[email protected]>
PATCH 2/5 ARM: GIC: Remove MMIO address from gic_cpu_init, rename to gic_secondary_init
In reply to Russell King - ARM LinuxWe don't need to re-pass the base address for the CPU interfaces to the GIC for secondary CPUs, as it will never be different from the boot CPU
- and even if it was, we'd overwrite the boot CPU's base address.
Get rid of this argument, and rename to gic_secondary_init().
--- arch/arm/common/gic.c | 7 ++++++- arch/arm/include/asm/hardware/gic.h | 2 +- arch/arm/mach-omap2/omap-smp.c | 2 +- arch/arm/mach-realview/platsmp.c | 2 +- arch/arm/mach-s5pv310/platsmp.c | 2 +- arch/arm/mach-tegra/platsmp.c | 2 +- arch/arm/mach-ux500/platsmp.c | 2 +- arch/arm/mach-vexpress/platsmp.c | 2 +- 8 files changed, 13 insertions(+), 8 deletions(-)
arch/arm/common/gic.c +6 -1
@@ -276,7 +276,7 @@ static void __init gic_dist_init(unsigned int gic_nr, void __iomem *base,writel (1 , base +GIC_DIST_CTRL ); } -void __cpuinit gic_cpu_init (unsigned int gic_nr,void __iomem *base) +static void __cpuinit gic_cpu_init (unsigned int gic_nr,void __iomem *base) {void __iomem *dist_base;int i;
@@ -313,6 +313,11 @@ void __init gic_init(unsigned int gic_nr, unsigned int irq_start,gic_cpu_init (gic_nr, cpu_base); } +void __cpuinit gic_secondary_init (unsigned int gic_nr) +{ +gic_cpu_init (gic_nr, gic_data[gic_nr].cpu_base); +} +#ifdef CONFIG_SMP void gic_raise_softirq (const struct cpumask *mask,unsigned int irq) {
arch/arm/include/asm/hardware/gic.h +1 -1
@@ -33,8 +33,8 @@#define GIC_DIST_SOFTINT 0xf00#ifndef __ASSEMBLY__ -void gic_cpu_init (unsigned int gic_nr,void __iomem *base);void gic_init (unsigned int ,unsigned int ,void __iomem *,void __iomem *); +void gic_secondary_init (unsigned int );void gic_cascade_irq (unsigned int gic_nr,unsigned int irq);void gic_raise_softirq (const struct cpumask *mask,unsigned int irq);#endif
arch/arm/mach-omap2/omap-smp.c +1 -1
@@ -50,7 +50,7 @@ void __cpuinit platform_secondary_init(unsigned int cpu)* core (e.g. timer irq), then they will not have been enabled * for us: do so */ -gic_cpu_init (0 , gic_cpu_base_addr); +gic_secondary_init (0 );/* * Synchronise with the boot thread.
arch/arm/mach-realview/platsmp.c +1 -1
@@ -69,7 +69,7 @@ void __cpuinit platform_secondary_init(unsigned int cpu)* core (e.g. timer irq), then they will not have been enabled * for us: do so */ -gic_cpu_init (0 , gic_cpu_base_addr); +gic_secondary_init (0 );/* * let the primary processor know we're out of the
arch/arm/mach-s5pv310/platsmp.c +1 -1
@@ -54,7 +54,7 @@ void __cpuinit platform_secondary_init(unsigned int cpu)* core (e.g. timer irq), then they will not have been enabled * for us: do so */ -gic_cpu_init (0 , gic_cpu_base_addr); +gic_secondary_init (0 );/* * let the primary processor know we're out of the
arch/arm/mach-tegra/platsmp.c +1 -1
@@ -48,7 +48,7 @@ void __cpuinit platform_secondary_init(unsigned int cpu)* core (e.g. timer irq), then they will not have been enabled * for us: do so */ -gic_cpu_init (0 ,IO_ADDRESS (TEGRA_ARM_PERIF_BASE ) +0x100 ); +gic_secondary_init (0 );/* * Synchronise with the boot thread.
arch/arm/mach-ux500/platsmp.c +1 -1
@@ -44,7 +44,7 @@ void __cpuinit platform_secondary_init(unsigned int cpu)* core (e.g. timer irq), then they will not have been enabled * for us: do so */ -gic_cpu_init (0 ,__io_address (UX500_GIC_CPU_BASE )); +gic_secondary_init (0 );/* * let the primary processor know we're out of the
arch/arm/mach-vexpress/platsmp.c +1 -1
@@ -51,7 +51,7 @@ void __cpuinit platform_secondary_init(unsigned int cpu)* core (e.g. timer irq), then they will not have been enabled * for us: do so */ -gic_cpu_init (0 , gic_cpu_base_addr); +gic_secondary_init (0 );/* * let the primary processor know we're out of the
Signature · 1 line
1.6.2.5
PATCH 2/5 ARM: GIC: Remove MMIO address from gic_cpu_init, rename to gic_secondary_init
Quoted 7 lines · Russell King - ARM Linux
We don't need to re-pass the base address for the CPU interfaces to the GIC for secondary CPUs, as it will never be different from the boot CPU
- and even if it was, we'd overwrite the boot CPU's base address.Get rid of this argument, and rename to
gic_secondary_init().Signed-off-by Russell King <[email protected]>
(minor issue, maybe a comment for gic_secondary_init just in case anyone things about primary and secondary GICs).
PATCH 3/5 ARM: GIC: consolidate gic_cpu_base_addr to common GIC code
In reply to Russell King - ARM LinuxEvery architecture using the GIC has a gic_cpu_base_addr pointer for GIC 0 for their entry assembly code to use to decode the cause of the current interrupt. Move this into the common GIC code.
--- arch/arm/common/gic.c | 5 +++++ arch/arm/include/asm/hardware/gic.h | 2 ++ arch/arm/mach-cns3xxx/core.c | 5 +---- arch/arm/mach-cns3xxx/core.h | 1 - arch/arm/mach-msm/board-msm8x60.c | 6 ++---- arch/arm/mach-omap2/include/mach/omap4-common.h | 1 - arch/arm/mach-omap2/omap4-common.c | 9 +++++---- arch/arm/mach-realview/core.c | 3 --- arch/arm/mach-realview/core.h | 1 - arch/arm/mach-realview/realview_eb.c | 6 ++---- arch/arm/mach-realview/realview_pb1176.c | 3 +-- arch/arm/mach-realview/realview_pb11mp.c | 3 +-- arch/arm/mach-realview/realview_pba8.c | 1 - arch/arm/mach-realview/realview_pbx.c | 2 -- arch/arm/mach-s5pv310/cpu.c | 3 --- arch/arm/mach-s5pv310/include/mach/smp.h | 2 -- arch/arm/mach-vexpress/core.h | 2 -- arch/arm/mach-vexpress/ct-ca9x4.c | 6 ++---- 18 files changed, 21 insertions(+), 40 deletions(-)
arch/arm/common/gic.c +5 -0
@@ -35,6 +35,9 @@static DEFINE_SPINLOCK (irq_controller_lock); +/* Address of GIC 0 CPU interface */ +void __iomem *gic_cpu_base_addr; +struct gic_chip_data {unsigned int irq_offset;void __iomem *dist_base;
@@ -309,6 +312,8 @@ static void __cpuinit gic_cpu_init(unsigned int gic_nr, void __iomem *base)void __init gic_init (unsigned int gic_nr,unsigned int irq_start,void __iomem *dist_base,void __iomem *cpu_base) { +if (gic_nr ==0 ) + gic_cpu_base_addr = cpu_base;gic_dist_init (gic_nr, dist_base, irq_start);gic_cpu_init (gic_nr, cpu_base); }
arch/arm/include/asm/hardware/gic.h +2 -0
@@ -33,6 +33,8 @@#define GIC_DIST_SOFTINT 0xf00#ifndef __ASSEMBLY__ +extern void __iomem *gic_cpu_base_addr; +void gic_init (unsigned int ,unsigned int ,void __iomem *,void __iomem *);void gic_secondary_init (unsigned int );void gic_cascade_irq (unsigned int gic_nr,unsigned int irq);
arch/arm/mach-cns3xxx/core.c +1 -4
@@ -69,13 +69,10 @@ void __init cns3xxx_map_io(void) }/* used by entry-macro.S */ -void __iomem *gic_cpu_base_addr; -void __init cns3xxx_init_irq (void ) { - gic_cpu_base_addr =__io (CNS3XXX_TC11MP_GIC_CPU_BASE_VIRT );gic_init (0 ,29 ,__io (CNS3XXX_TC11MP_GIC_DIST_BASE_VIRT ), - gic_cpu_base_addr); +__io (CNS3XXX_TC11MP_GIC_CPU_BASE_VIRT )); }void cns3xxx_power_off (void )
arch/arm/mach-cns3xxx/core.h +0 -1
@@ -11,7 +11,6 @@#ifndef __CNS3XXX_CORE_H#define __CNS3XXX_CORE_H -extern void __iomem *gic_cpu_base_addr;extern struct sys_timer cns3xxx_timer;void __init cns3xxx_map_io (void );
arch/arm/mach-msm/board-msm8x60.c +2 -4
@@ -28,8 +28,6 @@#include <mach/board.h> #include <mach/msm_iomap.h> -void __iomem *gic_cpu_base_addr; -unsigned long clk_get_max_axi_khz (void ) {return 0 ;
@@ -44,8 +42,8 @@ static void __init msm8x60_init_irq(void) {unsigned int i; - gic_cpu_base_addr = (void *)MSM_QGIC_CPU_BASE ; -gic_init (0 ,GIC_PPI_START ,MSM_QGIC_DIST_BASE , gic_cpu_base_addr); +gic_init (0 ,GIC_PPI_START ,MSM_QGIC_DIST_BASE , + (void *)MSM_QGIC_CPU_BASE );/* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */ writel (0xFFFFD7FF ,MSM_QGIC_DIST_BASE +GIC_DIST_CONFIG +4 );
arch/arm/mach-omap2/include/mach/omap4-common.h +0 -1
@@ -24,7 +24,6 @@extern void __iomem *l2cache_base;#endif -extern void __iomem *gic_cpu_base_addr;extern void __iomem *gic_dist_base_addr;extern void __init gic_init_irq (void );
arch/arm/mach-omap2/omap4-common.c +5 -4
@@ -26,21 +26,22 @@void __iomem *l2cache_base;#endif -void __iomem *gic_cpu_base_addr;void __iomem *gic_dist_base_addr;void __init gic_init_irq (void ) { +void __iomem *gic_cpu_base; +/* Static mapping, never released */ gic_dist_base_addr =ioremap (OMAP44XX_GIC_DIST_BASE ,SZ_4K );BUG_ON (!gic_dist_base_addr);/* Static mapping, never released */ - gic_cpu_base_addr =ioremap (OMAP44XX_GIC_CPU_BASE ,SZ_512 ); -BUG_ON (!gic_cpu_base_addr); + gic_cpu_base =ioremap (OMAP44XX_GIC_CPU_BASE ,SZ_512 ); +BUG_ON (!gic_cpu_base); -gic_init (0 ,29 , gic_dist_base_addr, gic_cpu_base_addr); +gic_init (0 ,29 , gic_dist_base_addr, gic_cpu_base); }#ifdef CONFIG_CACHE_L2X0
arch/arm/mach-realview/core.c +0 -3
@@ -54,9 +54,6 @@#include "core.h" -/* used by entry-macro.S and platsmp.c */ -void __iomem *gic_cpu_base_addr; -#ifdef CONFIG_ZONE_DMA /* * Adjust the zones if there are restrictions for DMA access.
arch/arm/mach-realview/core.h +0 -1
@@ -53,7 +53,6 @@ extern struct platform_device realview_i2c_device;extern struct mmci_platform_data realview_mmc0_plat_data;extern struct mmci_platform_data realview_mmc1_plat_data;extern struct clcd_board clcd_plat_data; -extern void __iomem *gic_cpu_base_addr;extern void __iomem *timer0_va_base;extern void __iomem *timer1_va_base;extern void __iomem *timer2_va_base;
arch/arm/mach-realview/realview_eb.c +2 -4
@@ -364,9 +364,8 @@ static void __init gic_init_irq(void)writel (0x00000000 ,__io_address (REALVIEW_SYS_LOCK ));/* core tile GIC, primary */ - gic_cpu_base_addr =__io_address (REALVIEW_EB11MP_GIC_CPU_BASE );gic_init (0 ,29 ,__io_address (REALVIEW_EB11MP_GIC_DIST_BASE ), - gic_cpu_base_addr); +__io_address (REALVIEW_EB11MP_GIC_CPU_BASE ));#ifndef CONFIG_REALVIEW_EB_ARM11MP_REVB /* board GIC, secondary */
@@ -376,9 +375,8 @@ static void __init gic_init_irq(void)#endif }else {/* board GIC, primary */ - gic_cpu_base_addr =__io_address (REALVIEW_EB_GIC_CPU_BASE );gic_init (0 ,29 ,__io_address (REALVIEW_EB_GIC_DIST_BASE ), - gic_cpu_base_addr); +__io_address (REALVIEW_EB_GIC_CPU_BASE )); } }
arch/arm/mach-realview/realview_pb1176.c +1 -2
@@ -304,10 +304,9 @@ static struct platform_device char_lcd_device = {static void __init gic_init_irq (void ) {/* ARM1176 DevChip GIC, primary */ - gic_cpu_base_addr =__io_address (REALVIEW_DC1176_GIC_CPU_BASE );gic_init (0 ,IRQ_DC1176_GIC_START ,__io_address (REALVIEW_DC1176_GIC_DIST_BASE ), - gic_cpu_base_addr); +__io_address (REALVIEW_DC1176_GIC_CPU_BASE ));/* board GIC, secondary */ gic_init(1, IRQ_PB1176_GIC_START,
arch/arm/mach-realview/realview_pb11mp.c +1 -2
@@ -309,9 +309,8 @@ static void __init gic_init_irq(void)writel (0x00000000 ,__io_address (REALVIEW_SYS_LOCK ));/* ARM11MPCore test chip GIC, primary */ - gic_cpu_base_addr =__io_address (REALVIEW_TC11MP_GIC_CPU_BASE );gic_init (0 ,29 ,__io_address (REALVIEW_TC11MP_GIC_DIST_BASE ), - gic_cpu_base_addr); +__io_address (REALVIEW_TC11MP_GIC_CPU_BASE ));/* board GIC, secondary */ gic_init(1, IRQ_PB11MP_GIC_START,
arch/arm/mach-realview/realview_pba8.c +0 -1
@@ -273,7 +273,6 @@ static struct platform_device pmu_device = {static void __init gic_init_irq (void ) {/* ARM PB-A8 on-board GIC */ - gic_cpu_base_addr =__io_address (REALVIEW_PBA8_GIC_CPU_BASE );gic_init (0 ,IRQ_PBA8_GIC_START ,__io_address (REALVIEW_PBA8_GIC_DIST_BASE ),__io_address (REALVIEW_PBA8_GIC_CPU_BASE ));
arch/arm/mach-realview/realview_pbx.c +0 -2
@@ -313,11 +313,9 @@ static void __init gic_init_irq(void) {/* ARM PBX on-board GIC */ if (core_tile_pbx11mp () ||core_tile_pbxa9mp ()) { - gic_cpu_base_addr =__io_address (REALVIEW_PBX_TILE_GIC_CPU_BASE );gic_init (0 ,29 ,__io_address (REALVIEW_PBX_TILE_GIC_DIST_BASE ),__io_address (REALVIEW_PBX_TILE_GIC_CPU_BASE )); }else { - gic_cpu_base_addr =__io_address (REALVIEW_PBX_GIC_CPU_BASE );gic_init (0 ,IRQ_PBX_GIC_START ,__io_address (REALVIEW_PBX_GIC_DIST_BASE ),__io_address (REALVIEW_PBX_GIC_CPU_BASE ));
arch/arm/mach-s5pv310/cpu.c +0 -3
@@ -24,8 +24,6 @@#include <mach/regs-irq.h> -void __iomem *gic_cpu_base_addr; -extern int combiner_init (unsigned int combiner_nr,void __iomem *base,unsigned int irq_start);extern void combiner_cascade_irq (unsigned int combiner_nr,unsigned int irq);
@@ -122,7 +120,6 @@ void __init s5pv310_init_irq(void) {int irq; - gic_cpu_base_addr =S5P_VA_GIC_CPU ;gic_init (0 ,IRQ_LOCALTIMER ,S5P_VA_GIC_DIST ,S5P_VA_GIC_CPU );for (irq =0 ; irq <MAX_COMBINER_NR ; irq++) {
arch/arm/mach-s5pv310/include/mach/smp.h +0 -2
@@ -9,8 +9,6 @@#include <asm/hardware/gic.h> #include <asm/smp_mpidr.h> -extern void __iomem *gic_cpu_base_addr; -/* * We use IRQ1 as the IPI */
arch/arm/mach-vexpress/core.h +0 -2
@@ -22,5 +22,3 @@ struct map_desc;void v2m_map_io (struct map_desc *tile,size_t num);extern struct sys_timer v2m_timer; - -extern void __iomem *gic_cpu_base_addr;
arch/arm/mach-vexpress/ct-ca9x4.c +2 -4
@@ -60,12 +60,10 @@ static void __init ct_ca9x4_map_io(void)v2m_map_io (ct_ca9x4_io_desc,ARRAY_SIZE (ct_ca9x4_io_desc)); } -void __iomem *gic_cpu_base_addr; -static void __init ct_ca9x4_init_irq (void ) { - gic_cpu_base_addr =MMIO_P2V (A9_MPCORE_GIC_CPU ); -gic_init (0 ,29 ,MMIO_P2V (A9_MPCORE_GIC_DIST ), gic_cpu_base_addr); +gic_init (0 ,29 ,MMIO_P2V (A9_MPCORE_GIC_DIST ), +MMIO_P2V (A9_MPCORE_GIC_CPU )); }#if 0
Signature · 1 line
1.6.2.5
PATCH 3/5 ARM: GIC: consolidate gic_cpu_base_addr to common GIC code
Quoted 5 lines · Russell King - ARM Linux
Every architecture using the GIC has a
gic_cpu_base_addrpointer for GIC 0 for their entry assembly code to use to decode the cause of the current interrupt. ?Move this into the common GIC code.Signed-off-by Russell King <[email protected]>
PATCH 4/5 ARM: GIC: move gic_data[] initialization into gic_init()
In reply to Russell King - ARM LinuxThis avoids writing unnecessarily to gic_data[] from other CPUs, making this a mostly read-only variable.
--- arch/arm/common/gic.c | 48 ++++++++++++++++++++++++------------------------ 1 files changed, 24 insertions(+), 24 deletions(-)
arch/arm/common/gic.c +24 -24
@@ -36,7 +36,7 @@static DEFINE_SPINLOCK (irq_controller_lock);/* Address of GIC 0 CPU interface */ -void __iomem *gic_cpu_base_addr; +void __iomem *gic_cpu_base_addr__read_mostly ;struct gic_chip_data {unsigned int irq_offset;
@@ -48,7 +48,7 @@ struct gic_chip_data {#define MAX_GIC_NR 1#endif -static struct gic_chip_data gic_data[MAX_GIC_NR ]; +static struct gic_chip_data gic_data[MAX_GIC_NR ]__read_mostly ;static inline void __iomem *gic_dist_base (unsigned int irq) {
@@ -210,21 +210,16 @@ void __init gic_cascade_irq(unsigned int gic_nr, unsigned int irq)set_irq_chained_handler (irq, gic_handle_cascade_irq); } -static void __init gic_dist_init (unsigned int gic_nr,void __iomem *base, +static void __init gic_dist_init (struct gic_chip_data *gic,unsigned int irq_start) {unsigned int max_irq, i; +void __iomem *base = gic->dist_base;u32 cpumask =1 <<smp_processor_id (); -if (gic_nr >=MAX_GIC_NR ) -BUG (); - cpumask |= cpumask <<8 ; cpumask |= cpumask <<16 ; - gic_data[gic_nr].dist_base = base; - gic_data[gic_nr].irq_offset = (irq_start -1 ) & ~31 ; -writel (0 , base +GIC_DIST_CTRL );/*
@@ -269,9 +264,9 @@ static void __init gic_dist_init(unsigned int gic_nr, void __iomem *base,/* * Setup the Linux IRQ subsystem. */ -for (i = irq_start; i < gic_data[gic_nr].irq_offset + max_irq; i++) { +for (i = irq_start; i < gic->irq_offset + max_irq; i++) {set_irq_chip (i, &gic_chip); -set_irq_chip_data (i, &gic_data[gic_nr]); +set_irq_chip_data (i, gic);set_irq_handler (i, handle_level_irq);set_irq_flags (i,IRQF_VALID |IRQF_PROBE ); }
@@ -279,19 +274,12 @@ static void __init gic_dist_init(unsigned int gic_nr, void __iomem *base,writel (1 , base +GIC_DIST_CTRL ); } -static void __cpuinit gic_cpu_init (unsigned int gic_nr,void __iomem *base) +static void __cpuinit gic_cpu_init (struct gic_chip_data *gic) { -void __iomem *dist_base; +void __iomem *dist_base = gic->dist_base; +void __iomem *base = gic->cpu_base;int i; -if (gic_nr >=MAX_GIC_NR ) -BUG (); - - dist_base = gic_data[gic_nr].dist_base; -BUG_ON (!dist_base); - - gic_data[gic_nr].cpu_base = base; -/* * Deal with the banked PPI and SGI interrupts - disable all * PPI interrupts, ensure all SGI interrupts are enabled.
@@ -312,15 +300,27 @@ static void __cpuinit gic_cpu_init(unsigned int gic_nr, void __iomem *base)void __init gic_init (unsigned int gic_nr,unsigned int irq_start,void __iomem *dist_base,void __iomem *cpu_base) { +struct gic_chip_data *gic; + +BUG_ON (gic_nr >=MAX_GIC_NR ); + + gic = &gic_data[gic_nr]; + gic->dist_base = dist_base; + gic->cpu_base = cpu_base; + gic->irq_offset = (irq_start -1 ) & ~31 ; +if (gic_nr ==0 ) gic_cpu_base_addr = cpu_base; -gic_dist_init (gic_nr, dist_base, irq_start); -gic_cpu_init (gic_nr, cpu_base); + +gic_dist_init (gic, irq_start); +gic_cpu_init (gic); }void __cpuinit gic_secondary_init (unsigned int gic_nr) { -gic_cpu_init (gic_nr, gic_data[gic_nr].cpu_base); +BUG_ON (gic_nr >=MAX_GIC_NR ); + +gic_cpu_init (&gic_data[gic_nr]); }#ifdef CONFIG_SMP
Signature · 1 line
1.6.2.5
PATCH 4/5 ARM: GIC: move gic_data[] initialization into gic_init()
Quoted 4 lines · Russell King - ARM Linux
This avoids writing unnecessarily to gic_data[] from other CPUs, making this a mostly read-only variable.
Signed-off-by Russell King <[email protected]>
PATCH 5/5 ARM: GIC: private a standard get_irqnr_preamble assembler macro
In reply to Russell King - ARM LinuxProvide a standard get_irqnr_preamble assembler macro for platforms to use, which retrieves the base address of the GIC CPU interface from gic_cpu_base_addr. Allow platforms to override this by defining HAVE_GET_IRQNR_PREAMBLE.
--- arch/arm/include/asm/hardware/entry-macro-gic.S | 7 +++++++ arch/arm/mach-cns3xxx/include/mach/entry-macro.S | 5 ----- arch/arm/mach-omap2/include/mach/entry-macro.S | 1 + arch/arm/mach-realview/include/mach/entry-macro.S | 5 ----- arch/arm/mach-tegra/include/mach/entry-macro.S | 2 +- arch/arm/mach-ux500/include/mach/entry-macro.S | 1 + arch/arm/mach-vexpress/include/mach/entry-macro.S | 5 ----- 7 files changed, 10 insertions(+), 16 deletions(-)
arch/arm/include/asm/hardware/entry-macro-gic.S +7 -0
@@ -10,6 +10,13 @@ #include <asm/hardware/gic.h> +#ifndef HAVE_GET_IRQNR_PREAMBLE + .macro get_irqnr_preamble, base, tmp + ldr \base, =gic_cpu_base_addr + ldr \base, [\base] + .endm +#endif + /* * The interrupt numbering scheme is defined in the * interrupt controller spec. To wit:
arch/arm/mach-cns3xxx/include/mach/entry-macro.S +0 -5
@@ -14,10 +14,5 @@ .macro disable_fiq .endm - .macro get_irqnr_preamble, base, tmp - ldr \base, =gic_cpu_base_addr - ldr \base, [\base] - .endm - .macro arch_ret_to_user, tmp1, tmp2 .endm
arch/arm/mach-omap2/include/mach/entry-macro.S +1 -0
@@ -170,6 +170,7 @@ omap_irq_base: .word 0 #ifdef CONFIG_ARCH_OMAP4 +#define HAVE_GET_IRQNR_PREAMBLE #include <asm/hardware/entry-macro-gic.S> .macro get_irqnr_preamble, base, tmp
arch/arm/mach-realview/include/mach/entry-macro.S +0 -5
@@ -13,11 +13,6 @@ .macro disable_fiq .endm - .macro get_irqnr_preamble, base, tmp - ldr \base, =gic_cpu_base_addr - ldr \base, [\base] - .endm - .macro arch_ret_to_user, tmp1, tmp2 .endm
arch/arm/mach-tegra/include/mach/entry-macro.S +1 -1
@@ -16,7 +16,7 @@ #include <mach/io.h> #if defined(CONFIG_ARM_GIC) - +#define HAVE_GET_IRQNR_PREAMBLE #include <asm/hardware/entry-macro-gic.S> /* Uses the GIC interrupt controller built into the cpu */
arch/arm/mach-ux500/include/mach/entry-macro.S +1 -0
@@ -11,6 +11,7 @@ * warranty of any kind, whether express or implied. */ #include <mach/hardware.h> +#define HAVE_GET_IRQNR_PREAMBLE #include <asm/hardware/entry-macro-gic.S> .macro disable_fiq
arch/arm/mach-vexpress/include/mach/entry-macro.S +0 -5
@@ -3,10 +3,5 @@ .macro disable_fiq .endm - .macro get_irqnr_preamble, base, tmp - ldr \base, =gic_cpu_base_addr - ldr \base, [\base] - .endm - .macro arch_ret_to_user, tmp1, tmp2 .endm
Signature · 1 line
1.6.2.5
PATCH 5/5 ARM: GIC: private a standard get_irqnr_preamble assembler macro
Quoted 6 lines · Russell King - ARM Linux
Provide a standard
get_irqnr_preambleassembler macro for platforms to use, which retrieves the base address of the GIC CPU interface fromgic_cpu_base_addr. ?Allow platforms to override this by definingHAVE_GET_IRQNR_PREAMBLE.Signed-off-by Russell King <[email protected]>
cover ARM: GIC: cleanup
In reply to Russell King - ARM LinuxSorry for being late on testing this out. The patch series and works on the msm 8660.
Quoted 9 lines · Russell King - ARM Linux
This patch series cleans up the GIC code, consolidating some of the per-platform practices into the common GIC code.
One notable change is to the initialization methods - we used to require platforms to pass in the address of the per-CPU interfaces despite them always being identical between all cores. This was nonsense, as even in the extremely unlikely event that they were different, we aren't storing them in a per-CPU manner.
Quoted 4 lines
The GIC initialization methods are now simpler: one call to
gic_init()from the boot CPU, and a call togic_secondary_init()as each secondary CPU starts - and no need for platforms to keep track of the address anymore.
--
"Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum."
cover ARM: GIC: cleanup
Quoted 4 lines · Abhijeet Dharmapurikar
Sorry for being late on testing this out. The patch series and works on the msm 8660.
Would you prefer a Tested-by: ?
cover ARM: GIC: cleanup
Quoted 7 lines · Russell King - ARM Linux
Quoted 4 lines · Abhijeet Dharmapurikar
Sorry for being late on testing this out. The patch series and works on the msm 8660.
Would you prefer a Tested-by: ?
Yes, Tested-by is more appropriate.