Module Name: src
Committed By: jym
Date: Sat Jun 6 22:30:41 UTC 2009
Modified Files:
src/sys/arch/xen/x86 [jym-xensuspend]: intr.c
Log Message:
As requested by cegger@, apply the following patch to jym-xensuspend branch:
Interrupt handling in Xen 3.5 changed. There's no longer
a hardcoded upper limit. So *our* upper limit of 200 may be different from
machine to machine now.
So just retry if the hypercall failed.
To generate a diff of this commit:
cvs rdiff -u -r1.21.8.1 -r1.21.8.2 src/sys/arch/xen/x86/intr.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/xen/x86/intr.c
diff -u src/sys/arch/xen/x86/intr.c:1.21.8.1 src/sys/arch/xen/x86/intr.c:1.21.8.2
--- src/sys/arch/xen/x86/intr.c:1.21.8.1 Wed May 13 17:18:50 2009
+++ src/sys/arch/xen/x86/intr.c Sat Jun 6 22:30:41 2009
@@ -103,7 +103,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.21.8.1 2009/05/13 17:18:50 jym Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.21.8.2 2009/06/06 22:30:41 jym Exp $");
#include "opt_multiprocessor.h"
#include "opt_xen.h"
@@ -257,6 +257,9 @@
* of the next device if this one used this IRQ. The easiest is
* to allocate IRQs top-down, starting with a high number.
* 250 and 230 have been tried, but got rejected by Xen.
+ *
+ * Xen 3.5 also rejects 200. Try out all values until Xen accepts
+ * or none is available.
*/
static int xen_next_irq = 200;
struct ioapic_softc *ioapic = ioapic_find(APIC_IRQ_APIC(*pirq));
@@ -271,11 +274,16 @@
irq = APIC_IRQ_LEGACY_IRQ(*pirq);
if (irq <= 0 || irq > 15)
irq = xen_next_irq--;
+retry:
/* allocate vector and route interrupt */
op.cmd = PHYSDEVOP_ASSIGN_VECTOR;
op.u.irq_op.irq = irq;
- if (HYPERVISOR_physdev_op(&op) < 0)
- panic("PHYSDEVOP_ASSIGN_VECTOR irq %d", irq);
+ if (HYPERVISOR_physdev_op(&op) < 0) {
+ irq = xen_next_irq--;
+ if (xen_next_irq == 15)
+ panic("PHYSDEVOP_ASSIGN_VECTOR irq %d", irq);
+ goto retry;
+ }
irq2vect[irq] = op.u.irq_op.vector;
vect2irq[op.u.irq_op.vector] = irq;
pic->pic_addroute(pic, &phycpu_info_primary, pin,