Commit 1ff2b0c3 authored by Lin Ming's avatar Lin Ming Committed by Konrad Rzeszutek Wilk

xen: implement IRQ_WORK_VECTOR handler

Signed-off-by: default avatarLin Ming <mlin@ss.pku.edu.cn>
Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
parent f447d56d
...@@ -6,6 +6,7 @@ enum ipi_vector { ...@@ -6,6 +6,7 @@ enum ipi_vector {
XEN_CALL_FUNCTION_VECTOR, XEN_CALL_FUNCTION_VECTOR,
XEN_CALL_FUNCTION_SINGLE_VECTOR, XEN_CALL_FUNCTION_SINGLE_VECTOR,
XEN_SPIN_UNLOCK_VECTOR, XEN_SPIN_UNLOCK_VECTOR,
XEN_IRQ_WORK_VECTOR,
XEN_NR_IPIS, XEN_NR_IPIS,
}; };
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <linux/err.h> #include <linux/err.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/smp.h> #include <linux/smp.h>
#include <linux/irq_work.h>
#include <asm/paravirt.h> #include <asm/paravirt.h>
#include <asm/desc.h> #include <asm/desc.h>
...@@ -41,10 +42,12 @@ cpumask_var_t xen_cpu_initialized_map; ...@@ -41,10 +42,12 @@ cpumask_var_t xen_cpu_initialized_map;
static DEFINE_PER_CPU(int, xen_resched_irq); static DEFINE_PER_CPU(int, xen_resched_irq);
static DEFINE_PER_CPU(int, xen_callfunc_irq); static DEFINE_PER_CPU(int, xen_callfunc_irq);
static DEFINE_PER_CPU(int, xen_callfuncsingle_irq); static DEFINE_PER_CPU(int, xen_callfuncsingle_irq);
static DEFINE_PER_CPU(int, xen_irq_work);
static DEFINE_PER_CPU(int, xen_debug_irq) = -1; static DEFINE_PER_CPU(int, xen_debug_irq) = -1;
static irqreturn_t xen_call_function_interrupt(int irq, void *dev_id); static irqreturn_t xen_call_function_interrupt(int irq, void *dev_id);
static irqreturn_t xen_call_function_single_interrupt(int irq, void *dev_id); static irqreturn_t xen_call_function_single_interrupt(int irq, void *dev_id);
static irqreturn_t xen_irq_work_interrupt(int irq, void *dev_id);
/* /*
* Reschedule call back. * Reschedule call back.
...@@ -143,6 +146,17 @@ static int xen_smp_intr_init(unsigned int cpu) ...@@ -143,6 +146,17 @@ static int xen_smp_intr_init(unsigned int cpu)
goto fail; goto fail;
per_cpu(xen_callfuncsingle_irq, cpu) = rc; per_cpu(xen_callfuncsingle_irq, cpu) = rc;
callfunc_name = kasprintf(GFP_KERNEL, "irqwork%d", cpu);
rc = bind_ipi_to_irqhandler(XEN_IRQ_WORK_VECTOR,
cpu,
xen_irq_work_interrupt,
IRQF_DISABLED|IRQF_PERCPU|IRQF_NOBALANCING,
callfunc_name,
NULL);
if (rc < 0)
goto fail;
per_cpu(xen_irq_work, cpu) = rc;
return 0; return 0;
fail: fail:
...@@ -155,6 +169,8 @@ static int xen_smp_intr_init(unsigned int cpu) ...@@ -155,6 +169,8 @@ static int xen_smp_intr_init(unsigned int cpu)
if (per_cpu(xen_callfuncsingle_irq, cpu) >= 0) if (per_cpu(xen_callfuncsingle_irq, cpu) >= 0)
unbind_from_irqhandler(per_cpu(xen_callfuncsingle_irq, cpu), unbind_from_irqhandler(per_cpu(xen_callfuncsingle_irq, cpu),
NULL); NULL);
if (per_cpu(xen_irq_work, cpu) >= 0)
unbind_from_irqhandler(per_cpu(xen_irq_work, cpu), NULL);
return rc; return rc;
} }
...@@ -509,6 +525,9 @@ static inline int xen_map_vector(int vector) ...@@ -509,6 +525,9 @@ static inline int xen_map_vector(int vector)
case CALL_FUNCTION_SINGLE_VECTOR: case CALL_FUNCTION_SINGLE_VECTOR:
xen_vector = XEN_CALL_FUNCTION_SINGLE_VECTOR; xen_vector = XEN_CALL_FUNCTION_SINGLE_VECTOR;
break; break;
case IRQ_WORK_VECTOR:
xen_vector = XEN_IRQ_WORK_VECTOR;
break;
default: default:
xen_vector = -1; xen_vector = -1;
printk(KERN_ERR "xen: vector 0x%x is not implemented\n", printk(KERN_ERR "xen: vector 0x%x is not implemented\n",
...@@ -588,6 +607,16 @@ static irqreturn_t xen_call_function_single_interrupt(int irq, void *dev_id) ...@@ -588,6 +607,16 @@ static irqreturn_t xen_call_function_single_interrupt(int irq, void *dev_id)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static irqreturn_t xen_irq_work_interrupt(int irq, void *dev_id)
{
irq_enter();
irq_work_run();
inc_irq_stat(apic_irq_work_irqs);
irq_exit();
return IRQ_HANDLED;
}
static const struct smp_ops xen_smp_ops __initconst = { static const struct smp_ops xen_smp_ops __initconst = {
.smp_prepare_boot_cpu = xen_smp_prepare_boot_cpu, .smp_prepare_boot_cpu = xen_smp_prepare_boot_cpu,
.smp_prepare_cpus = xen_smp_prepare_cpus, .smp_prepare_cpus = xen_smp_prepare_cpus,
...@@ -634,6 +663,7 @@ static void xen_hvm_cpu_die(unsigned int cpu) ...@@ -634,6 +663,7 @@ static void xen_hvm_cpu_die(unsigned int cpu)
unbind_from_irqhandler(per_cpu(xen_callfunc_irq, cpu), NULL); unbind_from_irqhandler(per_cpu(xen_callfunc_irq, cpu), NULL);
unbind_from_irqhandler(per_cpu(xen_debug_irq, cpu), NULL); unbind_from_irqhandler(per_cpu(xen_debug_irq, cpu), NULL);
unbind_from_irqhandler(per_cpu(xen_callfuncsingle_irq, cpu), NULL); unbind_from_irqhandler(per_cpu(xen_callfuncsingle_irq, cpu), NULL);
unbind_from_irqhandler(per_cpu(xen_irq_work, cpu), NULL);
native_cpu_die(cpu); native_cpu_die(cpu);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment