[PATCH] GICv3: Add restart handler to detach CPU from GICv3

Joakim Tjernlund Joakim.Tjernlund at infinera.com
Tue Jan 3 08:27:07 PST 2023


On Fri, 2022-12-16 at 17:21 +0100, Joakim Tjernlund wrote:

Ping?

> Needed for reboot without resetting the whole GIC
> 
> Signed-off-by: Joakim Tjernlund <joakim.tjernlund at infinera.com>
> ---
>  drivers/irqchip/irq-gic-v3.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
> index dd7e7f061e8f..1989ea3d2db4 100644
> --- a/drivers/irqchip/irq-gic-v3.c
> +++ b/drivers/irqchip/irq-gic-v3.c
> @@ -23,6 +23,7 @@
>  #include <linux/irqchip/arm-gic-common.h>
>  #include <linux/irqchip/arm-gic-v3.h>
>  #include <linux/irqchip/irq-partition-percpu.h>
> +#include <linux/reboot.h>
>  
>  #include <asm/cputype.h>
>  #include <asm/exception.h>
> @@ -1359,6 +1360,22 @@ static void gic_cpu_pm_init(void)
>  static inline void gic_cpu_pm_init(void) { }
>  #endif /* CONFIG_CPU_PM */
>  
> +static int gicv3_restart_notify(struct notifier_block *nb,
> +                              unsigned long mode, void *cmd)
> +{
> +       if (gic_dist_security_disabled()) {
> +               gic_write_grpen1(0);
> +               gic_enable_redist(false);
> +       }
> +
> +       return NOTIFY_DONE;
> +}
> +
> +static struct notifier_block gicv3_restart_nb = {
> +       .notifier_call = gicv3_restart_notify,
> +       .priority = 255, /* Call last */
> +};
> +
>  static struct irq_chip gic_chip = {
>  	.name			= "GICv3",
>  	.irq_mask		= gic_mask_irq,
> @@ -1849,6 +1866,7 @@ static int __init gic_init_bases(void __iomem *dist_base,
>  	gic_cpu_init();
>  	gic_smp_init();
>  	gic_cpu_pm_init();
> +	register_restart_handler(&gicv3_restart_nb);
>  
>  	if (gic_dist_supports_lpis()) {
>  		its_init(handle, &gic_data.rdists, gic_data.domain);



More information about the linux-arm-kernel mailing list