Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ef35a4e6 authored by Konrad Rzeszutek Wilk's avatar Konrad Rzeszutek Wilk
Browse files

xen/time: Add default value of -1 for IRQ and check for that.



If the timer interrupt has been de-init or is just now being
initialized, the default value of -1 should be preset as
interrupt line. Check for that and if something is odd
WARN us.

Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
parent 94032c50
Loading
Loading
Loading
Loading
+5 −2
Original line number Original line Diff line number Diff line
@@ -377,7 +377,7 @@ static const struct clock_event_device xen_vcpuop_clockevent = {


static const struct clock_event_device *xen_clockevent =
static const struct clock_event_device *xen_clockevent =
	&xen_timerop_clockevent;
	&xen_timerop_clockevent;
static DEFINE_PER_CPU(struct clock_event_device, xen_clock_events);
static DEFINE_PER_CPU(struct clock_event_device, xen_clock_events) = { .irq = -1 };


static irqreturn_t xen_timer_interrupt(int irq, void *dev_id)
static irqreturn_t xen_timer_interrupt(int irq, void *dev_id)
{
{
@@ -401,6 +401,9 @@ void xen_setup_timer(int cpu)
	struct clock_event_device *evt;
	struct clock_event_device *evt;
	int irq;
	int irq;


	evt = &per_cpu(xen_clock_events, cpu);
	WARN(evt->irq >= 0, "IRQ%d for CPU%d is already allocated\n", evt->irq, cpu);

	printk(KERN_INFO "installing Xen timer for CPU %d\n", cpu);
	printk(KERN_INFO "installing Xen timer for CPU %d\n", cpu);


	name = kasprintf(GFP_KERNEL, "timer%d", cpu);
	name = kasprintf(GFP_KERNEL, "timer%d", cpu);
@@ -413,7 +416,6 @@ void xen_setup_timer(int cpu)
				      IRQF_FORCE_RESUME,
				      IRQF_FORCE_RESUME,
				      name, NULL);
				      name, NULL);


	evt = &per_cpu(xen_clock_events, cpu);
	memcpy(evt, xen_clockevent, sizeof(*evt));
	memcpy(evt, xen_clockevent, sizeof(*evt));


	evt->cpumask = cpumask_of(cpu);
	evt->cpumask = cpumask_of(cpu);
@@ -426,6 +428,7 @@ void xen_teardown_timer(int cpu)
	BUG_ON(cpu == 0);
	BUG_ON(cpu == 0);
	evt = &per_cpu(xen_clock_events, cpu);
	evt = &per_cpu(xen_clock_events, cpu);
	unbind_from_irqhandler(evt->irq, NULL);
	unbind_from_irqhandler(evt->irq, NULL);
	evt->irq = -1;
}
}


void xen_setup_cpu_clockevents(void)
void xen_setup_cpu_clockevents(void)