gic: preserve gic V2 bypass bits in cpu ctrl register
Subsystems (2)
PATCH v6 1/1 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 bootload 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.
---
V6: add gic_cpu_if_up function to replace macro used in v5
V5: Use macro to replace read modify write of cpu_ctrl register.
V4: Change to use bypass mask, change ot user more suitable variable name.
drivers/irqchip/irq-gic.c | 30 +++++++++++++++++++++++++++--- include/linux/irqchip/arm-gic.h | 1 + 2 files changed, 28 insertions(+), 3 deletions(-)
drivers/irqchip/irq-gic.c +27 -3
@@ -449,13 +449,36 @@ static void gic_cpu_init(struct gic_chip_data *gic)writel_relaxed (0xa0a0a0a0 , dist_base +GIC_DIST_PRI + i *4 /4 );writel_relaxed (0xf0 , base +GIC_CPU_PRIMASK ); -writel_relaxed (1 , base +GIC_CPU_CTRL ); + +gic_cpu_if_up (); +} + +void gic_cpu_if_up (void ) +{ +void __iomem *cpu_base =gic_data_cpu_base (&gic_data[0 ]); +u32 bypass; + +/* +* Preserve bypass disable bits to be written back later +*/ + bypass =readl (cpu_base +GIC_CPU_CTRL ); + bypass &=0x1e0 ; + +writel_relaxed (bypass |0x1 , cpu_base +GIC_CPU_CTRL ); }void gic_cpu_if_down (void ) {void __iomem *cpu_base =gic_data_cpu_base (&gic_data[0 ]); -writel_relaxed (0 , cpu_base +GIC_CPU_CTRL ); +u32 bypass; + +/* +* Preserve bypass disable bits to be written back later +*/ + bypass =readl (cpu_base +GIC_CPU_CTRL ); + bypass &=0x1e0 ; + +writel_relaxed (bypass, cpu_base +GIC_CPU_CTRL ); }#ifdef CONFIG_CPU_PM
@@ -590,7 +613,8 @@ static void gic_cpu_restore(unsigned int gic_nr)writel_relaxed (0xa0a0a0a0 , dist_base +GIC_DIST_PRI + i *4 );writel_relaxed (0xf0 , cpu_base +GIC_CPU_PRIMASK ); -writel_relaxed (1 , cpu_base +GIC_CPU_CTRL ); + +gic_cpu_if_up (); }static int gic_notifier (struct notifier_block *self,unsigned long cmd,void *v)
include/linux/irqchip/arm-gic.h +1 -0
@@ -80,6 +80,7 @@ extern struct irq_chip gic_arch_extn;void gic_init_bases (unsigned int ,int ,void __iomem *,void __iomem *,u32 offset,struct device_node *);void gic_cascade_irq (unsigned int gic_nr,unsigned int irq); +void gic_cpu_if_up (void );void gic_cpu_if_down (void ); static inline void gic_init(unsigned int nr, int start,
Signature · 1 line
1.7.6.1
Quoted 23 lines · Feng Kan
This change is made to preserve the GIC v2 bypass bits in the
GIC_CPU_CTRLregister (also known as theGICC_CTLRregister in spec). This code will preserve all bits configured by the bootload 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 Vinayak Kale <[email protected]>Acked-by Anup Patel <[email protected]>Signed-off-by Feng Kan <[email protected]>---
V6: addgic_cpu_if_upfunction to replace macro used in v5
V5: Use macro to replace read modify write ofcpu_ctrlregister.
V4: Change to use bypass mask, change ot user more suitable variable name.drivers/irqchip/irq-gic.c | 30 +++++++++++++++++++++++++++--- include/linux/irqchip/arm-gic.h | 1 + 2 files changed, 28 insertions(+), 3 deletions(-)drivers/irqchip/irq-gic.c +0
-0
drivers/irqchip/irq-gic.c static void gic_cpu_init(struct gic_chip_data *gic) · line 453
Quoted 6 lines
drivers/irqchip/irq-gic.c +2
-1@@ -449,13 +449,36 @@ static void gic_cpu_init(struct gic_chip_data *gic)writel_relaxed (0xa0a0a0a0 , dist_base +GIC_DIST_PRI + i *4 /4 );writel_relaxed (0xf0 , base +GIC_CPU_PRIMASK ); -writel_relaxed (1 , base +GIC_CPU_CTRL ); + +gic_cpu_if_up ();
Use before definition. The only reason GCC doesn't scream is because of the useless prototype in irqchip/arm-gic.h (see below).
drivers/irqchip/irq-gic.c static void gic_cpu_init(struct gic_chip_data *gic) · line 456
Quoted 3 lines
drivers/irqchip/irq-gic.c +3
-0+} + +void gic_cpu_if_up (void )
Why isn't it static?
drivers/irqchip/irq-gic.c static void gic_cpu_init(struct gic_chip_data *gic) · line 461
Quoted 5 lines
drivers/irqchip/irq-gic.c +5
-0+{ +void __iomem *cpu_base =gic_data_cpu_base (&gic_data[0 ]); +u32 bypass; + +/*
Trailing whitespace
Quoted 5 lines
drivers/irqchip/irq-gic.c +5
-0+* Preserve bypass disable bits to be written back later +*/ + bypass =readl (cpu_base +GIC_CPU_CTRL ); + bypass &=0x1e0 ; +
drivers/irqchip/irq-gic.c static void gic_cpu_init(struct gic_chip_data *gic) · line 475
Quoted 10 lines
drivers/irqchip/irq-gic.c +4
-1+writel_relaxed (bypass |0x1 , cpu_base +GIC_CPU_CTRL ); }void gic_cpu_if_down (void ) {void __iomem *cpu_base =gic_data_cpu_base (&gic_data[0 ]); -writel_relaxed (0 , cpu_base +GIC_CPU_CTRL ); +u32 bypass; + +/*
Trailing whitespace
Quoted 10 lines
drivers/irqchip/irq-gic.c +6
-0+* Preserve bypass disable bits to be written back later +*/ + bypass =readl (cpu_base +GIC_CPU_CTRL ); + bypass &=0x1e0 ; + +writel_relaxed (bypass, cpu_base +GIC_CPU_CTRL ); }#ifdef CONFIG_CPU_PM
drivers/irqchip/irq-gic.c static void gic_cpu_restore(unsigned int gic_nr) · line 616
Quoted 5 lines
drivers/irqchip/irq-gic.c +1
-1@@ -590,7 +613,8 @@ static void gic_cpu_restore(unsigned int gic_nr)writel_relaxed (0xa0a0a0a0 , dist_base +GIC_DIST_PRI + i *4 );writel_relaxed (0xf0 , cpu_base +GIC_CPU_PRIMASK ); -writel_relaxed (1 , cpu_base +GIC_CPU_CTRL ); +
Trailing whitespace
include/linux/irqchip/arm-gic.h extern struct irq_chip gic_arch_extn; · line 83
Quoted 13 lines
drivers/irqchip/irq-gic.c +1
-0+gic_cpu_if_up (); }static int gic_notifier (struct notifier_block *self,unsigned long cmd,void *v)include/linux/irqchip/arm-gic.h +1
-0@@ -80,6 +80,7 @@ extern struct irq_chip gic_arch_extn;void gic_init_bases (unsigned int ,int ,void __iomem *,void __iomem *,u32 offset,struct device_node *);void gic_cascade_irq (unsigned int gic_nr,unsigned int irq); +void gic_cpu_if_up (void );
Why do you need to expose this to the rest of the kernel, while there is obviously no caller?
include/linux/irqchip/arm-gic.h extern struct irq_chip gic_arch_extn; · line 86
Quoted 3 lines
include/linux/irqchip/arm-gic.h +0
-0void gic_cpu_if_down (void ); static inline void gic_init(unsigned int nr, int start,
So how many other versions of this incredibly simple patch are we going to see? Please, read what you're sending, run checkpatch, try to apply the patch to a clean tree (git am screams), get it reviewed by your friends and colleagues before gracing the list and our inboxes with it. At the moment, you're just wasting everybody's time and bandwidth, as I obviously spend more time reviewing and testing this thing than you do.
M.
Signature · 1 line
Jazz is not dead. It just smells funny.