diff options
author | Feng Kan <fkan@apm.com> | 2014-07-30 17:56:59 -0400 |
---|---|---|
committer | Jason Cooper <jason@lakedaemon.net> | 2014-08-19 11:08:07 -0400 |
commit | 3228950621d92f0f212378f95a6998ef3a1be0bb (patch) | |
tree | 65909d6760b53af50ee62cc0c7e98154eebfd04a | |
parent | e5f81539f657af7e9f54ea37986fde8f92acef22 (diff) |
irqchip: gic: Preserve gic V2 bypass bits in cpu ctrl register
This change is made to preserve the GIC v2 bypass bits in the
GIC_CPU_CTRL register (also known as the GICC_CTLR register in spec).
This code will preserve all bits configured by the bootloader regarding
v2 bypass group bits. In the X-Gene platform, the bypass functionality
is not used and bypass bits should not be changed by the kernel gic
code as it could lead to incorrect behavior.
Signed-off-by: Feng Kan <fkan@apm.com>
Reviewed-by: Vinayak Kale <vkale@apm.com>
Reviewed-by: Anup Patel <apatel@apm.com>
Link: https://lkml.kernel.org/r/1406757419-18729-3-git-send-email-fkan@apm.com
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
-rw-r--r-- | drivers/irqchip/irq-gic.c | 25 | ||||
-rw-r--r-- | include/linux/irqchip/arm-gic.h | 1 |
2 files changed, 23 insertions, 3 deletions
diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c index 35847453cecb..2500f6ba29e1 100644 --- a/drivers/irqchip/irq-gic.c +++ b/drivers/irqchip/irq-gic.c | |||
@@ -353,6 +353,21 @@ static u8 gic_get_cpumask(struct gic_chip_data *gic) | |||
353 | return mask; | 353 | return mask; |
354 | } | 354 | } |
355 | 355 | ||
356 | static void gic_cpu_if_up(void) | ||
357 | { | ||
358 | void __iomem *cpu_base = gic_data_cpu_base(&gic_data[0]); | ||
359 | u32 bypass = 0; | ||
360 | |||
361 | /* | ||
362 | * Preserve bypass disable bits to be written back later | ||
363 | */ | ||
364 | bypass = readl(cpu_base + GIC_CPU_CTRL); | ||
365 | bypass &= GICC_DIS_BYPASS_MASK; | ||
366 | |||
367 | writel_relaxed(bypass | GICC_ENABLE, cpu_base + GIC_CPU_CTRL); | ||
368 | } | ||
369 | |||
370 | |||
356 | static void __init gic_dist_init(struct gic_chip_data *gic) | 371 | static void __init gic_dist_init(struct gic_chip_data *gic) |
357 | { | 372 | { |
358 | unsigned int i; | 373 | unsigned int i; |
@@ -401,13 +416,17 @@ static void gic_cpu_init(struct gic_chip_data *gic) | |||
401 | gic_cpu_config(dist_base, NULL); | 416 | gic_cpu_config(dist_base, NULL); |
402 | 417 | ||
403 | writel_relaxed(GICC_INT_PRI_THRESHOLD, base + GIC_CPU_PRIMASK); | 418 | writel_relaxed(GICC_INT_PRI_THRESHOLD, base + GIC_CPU_PRIMASK); |
404 | writel_relaxed(GICC_ENABLE, base + GIC_CPU_CTRL); | 419 | gic_cpu_if_up(); |
405 | } | 420 | } |
406 | 421 | ||
407 | void gic_cpu_if_down(void) | 422 | void gic_cpu_if_down(void) |
408 | { | 423 | { |
409 | void __iomem *cpu_base = gic_data_cpu_base(&gic_data[0]); | 424 | void __iomem *cpu_base = gic_data_cpu_base(&gic_data[0]); |
410 | writel_relaxed(0, cpu_base + GIC_CPU_CTRL); | 425 | u32 val = 0; |
426 | |||
427 | val = readl(cpu_base + GIC_CPU_CTRL); | ||
428 | val &= ~GICC_ENABLE; | ||
429 | writel_relaxed(val, cpu_base + GIC_CPU_CTRL); | ||
411 | } | 430 | } |
412 | 431 | ||
413 | #ifdef CONFIG_CPU_PM | 432 | #ifdef CONFIG_CPU_PM |
@@ -543,7 +562,7 @@ static void gic_cpu_restore(unsigned int gic_nr) | |||
543 | dist_base + GIC_DIST_PRI + i * 4); | 562 | dist_base + GIC_DIST_PRI + i * 4); |
544 | 563 | ||
545 | writel_relaxed(GICC_INT_PRI_THRESHOLD, cpu_base + GIC_CPU_PRIMASK); | 564 | writel_relaxed(GICC_INT_PRI_THRESHOLD, cpu_base + GIC_CPU_PRIMASK); |
546 | writel_relaxed(GICC_ENABLE, cpu_base + GIC_CPU_CTRL); | 565 | gic_cpu_if_up(); |
547 | } | 566 | } |
548 | 567 | ||
549 | static int gic_notifier(struct notifier_block *self, unsigned long cmd, void *v) | 568 | static int gic_notifier(struct notifier_block *self, unsigned long cmd, void *v) |
diff --git a/include/linux/irqchip/arm-gic.h b/include/linux/irqchip/arm-gic.h index 5cb9d41af5be..13eed92c7d24 100644 --- a/include/linux/irqchip/arm-gic.h +++ b/include/linux/irqchip/arm-gic.h | |||
@@ -25,6 +25,7 @@ | |||
25 | #define GICC_INT_PRI_THRESHOLD 0xf0 | 25 | #define GICC_INT_PRI_THRESHOLD 0xf0 |
26 | #define GICC_IAR_INT_ID_MASK 0x3ff | 26 | #define GICC_IAR_INT_ID_MASK 0x3ff |
27 | #define GICC_INT_SPURIOUS 1023 | 27 | #define GICC_INT_SPURIOUS 1023 |
28 | #define GICC_DIS_BYPASS_MASK 0x1e0 | ||
28 | 29 | ||
29 | #define GIC_DIST_CTRL 0x000 | 30 | #define GIC_DIST_CTRL 0x000 |
30 | #define GIC_DIST_CTR 0x004 | 31 | #define GIC_DIST_CTR 0x004 |