From fd0f38ddd1af32b04241e5b5539d867fcd7d458d Mon Sep 17 00:00:00 2001 From: Mirela Simonovic Date: Fri, 1 Jun 2018 15:17:47 +0200 Subject: [PATCH] xen/arm: Release maintenance interrupt when CPU is hot-unplugged When a CPU is hot-unplugged the maintenance interrupt has to be released in order to free the memory that was allocated when the CPU was hotplugged and interrupt requested. The interrupt was requested using request_irq() which is called from start_secondary-> init_maintenance_interrupt. With this patch the interrupt will be released when the CPU_DYING event is received by the callback which is added in gic.c. Signed-off-by: Mirela Simonovic Acked-by: Julien Grall --- xen/arch/arm/gic.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c index 653a815127..5474030386 100644 --- a/xen/arch/arm/gic.c +++ b/xen/arch/arm/gic.c @@ -27,6 +27,8 @@ #include #include #include +#include +#include #include #include #include @@ -462,6 +464,35 @@ int gic_iomem_deny_access(const struct domain *d) return gic_hw_ops->iomem_deny_access(d); } +static int cpu_gic_callback(struct notifier_block *nfb, + unsigned long action, + void *hcpu) +{ + switch ( action ) + { + case CPU_DYING: + /* This is reverting the work done in init_maintenance_interrupt */ + release_irq(gic_hw_ops->info->maintenance_irq, NULL); + break; + default: + break; + } + + return NOTIFY_DONE; +} + +static struct notifier_block cpu_gic_nfb = { + .notifier_call = cpu_gic_callback, +}; + +static int __init cpu_gic_notifier_init(void) +{ + register_cpu_notifier(&cpu_gic_nfb); + + return 0; +} +__initcall(cpu_gic_notifier_init); + /* * Local variables: * mode: C -- 2.30.2