diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-12-04 11:50:58 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-12-14 14:21:44 -0500 |
commit | bef8f9ee32511a28f1c9a7d3b8c51cdac030b564 (patch) | |
tree | bac7425c7920061c9629aa0579daaade49ba9315 /arch/arm/common | |
parent | ff2e27ae0b17f53a6a289c87d325f706598f3788 (diff) |
ARM: GIC: move gic_data[] initialization into gic_init()
This avoids writing unnecessarily to gic_data[] from other CPUs,
making this a mostly read-only variable.
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Tested-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/common')
-rw-r--r-- | arch/arm/common/gic.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/arch/arm/common/gic.c b/arch/arm/common/gic.c index 9105d48c02de..c7155bdeb815 100644 --- a/arch/arm/common/gic.c +++ b/arch/arm/common/gic.c | |||
@@ -36,7 +36,7 @@ | |||
36 | static DEFINE_SPINLOCK(irq_controller_lock); | 36 | static DEFINE_SPINLOCK(irq_controller_lock); |
37 | 37 | ||
38 | /* Address of GIC 0 CPU interface */ | 38 | /* Address of GIC 0 CPU interface */ |
39 | void __iomem *gic_cpu_base_addr; | 39 | void __iomem *gic_cpu_base_addr __read_mostly; |
40 | 40 | ||
41 | struct gic_chip_data { | 41 | struct gic_chip_data { |
42 | unsigned int irq_offset; | 42 | unsigned int irq_offset; |
@@ -48,7 +48,7 @@ struct gic_chip_data { | |||
48 | #define MAX_GIC_NR 1 | 48 | #define MAX_GIC_NR 1 |
49 | #endif | 49 | #endif |
50 | 50 | ||
51 | static struct gic_chip_data gic_data[MAX_GIC_NR]; | 51 | static struct gic_chip_data gic_data[MAX_GIC_NR] __read_mostly; |
52 | 52 | ||
53 | static inline void __iomem *gic_dist_base(unsigned int irq) | 53 | static inline void __iomem *gic_dist_base(unsigned int irq) |
54 | { | 54 | { |
@@ -216,21 +216,16 @@ void __init gic_cascade_irq(unsigned int gic_nr, unsigned int irq) | |||
216 | set_irq_chained_handler(irq, gic_handle_cascade_irq); | 216 | set_irq_chained_handler(irq, gic_handle_cascade_irq); |
217 | } | 217 | } |
218 | 218 | ||
219 | static void __init gic_dist_init(unsigned int gic_nr, void __iomem *base, | 219 | static void __init gic_dist_init(struct gic_chip_data *gic, |
220 | unsigned int irq_start) | 220 | unsigned int irq_start) |
221 | { | 221 | { |
222 | unsigned int gic_irqs, irq_limit, i; | 222 | unsigned int gic_irqs, irq_limit, i; |
223 | void __iomem *base = gic->dist_base; | ||
223 | u32 cpumask = 1 << smp_processor_id(); | 224 | u32 cpumask = 1 << smp_processor_id(); |
224 | 225 | ||
225 | if (gic_nr >= MAX_GIC_NR) | ||
226 | BUG(); | ||
227 | |||
228 | cpumask |= cpumask << 8; | 226 | cpumask |= cpumask << 8; |
229 | cpumask |= cpumask << 16; | 227 | cpumask |= cpumask << 16; |
230 | 228 | ||
231 | gic_data[gic_nr].dist_base = base; | ||
232 | gic_data[gic_nr].irq_offset = (irq_start - 1) & ~31; | ||
233 | |||
234 | writel(0, base + GIC_DIST_CTRL); | 229 | writel(0, base + GIC_DIST_CTRL); |
235 | 230 | ||
236 | /* | 231 | /* |
@@ -270,7 +265,7 @@ static void __init gic_dist_init(unsigned int gic_nr, void __iomem *base, | |||
270 | /* | 265 | /* |
271 | * Limit number of interrupts registered to the platform maximum | 266 | * Limit number of interrupts registered to the platform maximum |
272 | */ | 267 | */ |
273 | irq_limit = gic_data[gic_nr].irq_offset + gic_irqs; | 268 | irq_limit = gic->irq_offset + gic_irqs; |
274 | if (WARN_ON(irq_limit > NR_IRQS)) | 269 | if (WARN_ON(irq_limit > NR_IRQS)) |
275 | irq_limit = NR_IRQS; | 270 | irq_limit = NR_IRQS; |
276 | 271 | ||
@@ -279,7 +274,7 @@ static void __init gic_dist_init(unsigned int gic_nr, void __iomem *base, | |||
279 | */ | 274 | */ |
280 | for (i = irq_start; i < irq_limit; i++) { | 275 | for (i = irq_start; i < irq_limit; i++) { |
281 | set_irq_chip(i, &gic_chip); | 276 | set_irq_chip(i, &gic_chip); |
282 | set_irq_chip_data(i, &gic_data[gic_nr]); | 277 | set_irq_chip_data(i, gic); |
283 | set_irq_handler(i, handle_level_irq); | 278 | set_irq_handler(i, handle_level_irq); |
284 | set_irq_flags(i, IRQF_VALID | IRQF_PROBE); | 279 | set_irq_flags(i, IRQF_VALID | IRQF_PROBE); |
285 | } | 280 | } |
@@ -287,19 +282,12 @@ static void __init gic_dist_init(unsigned int gic_nr, void __iomem *base, | |||
287 | writel(1, base + GIC_DIST_CTRL); | 282 | writel(1, base + GIC_DIST_CTRL); |
288 | } | 283 | } |
289 | 284 | ||
290 | static void __cpuinit gic_cpu_init(unsigned int gic_nr, void __iomem *base) | 285 | static void __cpuinit gic_cpu_init(struct gic_chip_data *gic) |
291 | { | 286 | { |
292 | void __iomem *dist_base; | 287 | void __iomem *dist_base = gic->dist_base; |
288 | void __iomem *base = gic->cpu_base; | ||
293 | int i; | 289 | int i; |
294 | 290 | ||
295 | if (gic_nr >= MAX_GIC_NR) | ||
296 | BUG(); | ||
297 | |||
298 | dist_base = gic_data[gic_nr].dist_base; | ||
299 | BUG_ON(!dist_base); | ||
300 | |||
301 | gic_data[gic_nr].cpu_base = base; | ||
302 | |||
303 | /* | 291 | /* |
304 | * Deal with the banked PPI and SGI interrupts - disable all | 292 | * Deal with the banked PPI and SGI interrupts - disable all |
305 | * PPI interrupts, ensure all SGI interrupts are enabled. | 293 | * PPI interrupts, ensure all SGI interrupts are enabled. |
@@ -320,15 +308,27 @@ static void __cpuinit gic_cpu_init(unsigned int gic_nr, void __iomem *base) | |||
320 | void __init gic_init(unsigned int gic_nr, unsigned int irq_start, | 308 | void __init gic_init(unsigned int gic_nr, unsigned int irq_start, |
321 | void __iomem *dist_base, void __iomem *cpu_base) | 309 | void __iomem *dist_base, void __iomem *cpu_base) |
322 | { | 310 | { |
311 | struct gic_chip_data *gic; | ||
312 | |||
313 | BUG_ON(gic_nr >= MAX_GIC_NR); | ||
314 | |||
315 | gic = &gic_data[gic_nr]; | ||
316 | gic->dist_base = dist_base; | ||
317 | gic->cpu_base = cpu_base; | ||
318 | gic->irq_offset = (irq_start - 1) & ~31; | ||
319 | |||
323 | if (gic_nr == 0) | 320 | if (gic_nr == 0) |
324 | gic_cpu_base_addr = cpu_base; | 321 | gic_cpu_base_addr = cpu_base; |
325 | gic_dist_init(gic_nr, dist_base, irq_start); | 322 | |
326 | gic_cpu_init(gic_nr, cpu_base); | 323 | gic_dist_init(gic, irq_start); |
324 | gic_cpu_init(gic); | ||
327 | } | 325 | } |
328 | 326 | ||
329 | void __cpuinit gic_secondary_init(unsigned int gic_nr) | 327 | void __cpuinit gic_secondary_init(unsigned int gic_nr) |
330 | { | 328 | { |
331 | gic_cpu_init(gic_nr, gic_data[gic_nr].cpu_base); | 329 | BUG_ON(gic_nr >= MAX_GIC_NR); |
330 | |||
331 | gic_cpu_init(&gic_data[gic_nr]); | ||
332 | } | 332 | } |
333 | 333 | ||
334 | #ifdef CONFIG_SMP | 334 | #ifdef CONFIG_SMP |