public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] GICv3: Add restart handler to detach CPU from GICv3
@ 2022-12-16 16:21 Joakim Tjernlund
  2023-01-03 16:27 ` Joakim Tjernlund
  0 siblings, 1 reply; 8+ messages in thread
From: Joakim Tjernlund @ 2022-12-16 16:21 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: Joakim Tjernlund

Needed for reboot without resetting the whole GIC

Signed-off-by: Joakim Tjernlund <joakim.tjernlund@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);
-- 
2.37.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-01-05 20:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-16 16:21 [PATCH] GICv3: Add restart handler to detach CPU from GICv3 Joakim Tjernlund
2023-01-03 16:27 ` Joakim Tjernlund
2023-01-04 16:04   ` Mark Rutland
2023-01-04 16:50     ` Marc Zyngier
2023-01-04 17:23       ` Joakim Tjernlund
2023-01-04 18:48         ` Marc Zyngier
2023-01-04 19:52           ` Joakim Tjernlund
2023-01-05 10:37             ` Marc Zyngier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox