diff options
author | Juergen Gross <jgross@suse.com> | 2020-09-13 15:23:02 +0300 |
---|---|---|
committer | Juergen Gross <jgross@suse.com> | 2020-10-20 11:22:14 +0300 |
commit | 7beb290caa2adb0a399e735a1e175db9aae0523a (patch) | |
tree | bd7aa413caa2e839b3c4f5ad42b7365f3ab7c6b8 /drivers/xen/events/events_base.c | |
parent | c44b849cee8c3ac587da3b0980e01f77500d158c (diff) | |
download | linux-7beb290caa2adb0a399e735a1e175db9aae0523a.tar.xz |
xen/events: use a common cpu hotplug hook for event channels
Today only fifo event channels have a cpu hotplug callback. In order
to prepare for more percpu (de)init work move that callback into
events_base.c and add percpu_init() and percpu_deinit() hooks to
struct evtchn_ops.
This is part of XSA-332.
Cc: stable@vger.kernel.org
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Wei Liu <wl@xen.org>
Diffstat (limited to 'drivers/xen/events/events_base.c')
-rw-r--r-- | drivers/xen/events/events_base.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c index 1eba8bc209ad..9cbfea5e9a08 100644 --- a/drivers/xen/events/events_base.c +++ b/drivers/xen/events/events_base.c @@ -34,6 +34,7 @@ #include <linux/irqnr.h> #include <linux/pci.h> #include <linux/spinlock.h> +#include <linux/cpuhotplug.h> #ifdef CONFIG_X86 #include <asm/desc.h> @@ -1830,6 +1831,26 @@ static inline void xen_alloc_callback_vector(void) {} static bool fifo_events = true; module_param(fifo_events, bool, 0); +static int xen_evtchn_cpu_prepare(unsigned int cpu) +{ + int ret = 0; + + if (evtchn_ops->percpu_init) + ret = evtchn_ops->percpu_init(cpu); + + return ret; +} + +static int xen_evtchn_cpu_dead(unsigned int cpu) +{ + int ret = 0; + + if (evtchn_ops->percpu_deinit) + ret = evtchn_ops->percpu_deinit(cpu); + + return ret; +} + void __init xen_init_IRQ(void) { int ret = -EINVAL; @@ -1840,6 +1861,10 @@ void __init xen_init_IRQ(void) if (ret < 0) xen_evtchn_2l_init(); + cpuhp_setup_state_nocalls(CPUHP_XEN_EVTCHN_PREPARE, + "xen/evtchn:prepare", + xen_evtchn_cpu_prepare, xen_evtchn_cpu_dead); + evtchn_to_irq = kcalloc(EVTCHN_ROW(xen_evtchn_max_channels()), sizeof(*evtchn_to_irq), GFP_KERNEL); BUG_ON(!evtchn_to_irq); |