Skip to contentSkip to conversation

Xen on machines with non-contiguous io-apics

PATCH Steven Smith 2 participants 2 messages Aug 17, 2009

lore
Share & tools
lore
#0 lore raw

(Mostly a bug report, with a kind of half-fix at the end.)

I have a test box with two IOAPICS which present non-contiguous GSIs according to the ACPI tables (the first offers 0-24 and the second 32-56). The latest xen-unstable with current pvops dom0 fails to boot on this machine, because the dom0 kernel can't claim any GSIs above
48. This is because the PHYSDEVOP_alloc_irq_vector implementation won't let it get at anything above nr_irqs, which is just the sum of the number of registers across all APICs.

The patch below fixes this by just setting nr_irqs to the highest GSI offered by any IOAPIC. I don't understand this stuff well enough to say whether that's the right fix (and the patch isn't suitable for applying, anyway), but it does make the machine boot.

Steven

xen/arch/x86/io_apic.c +5 -0
diff -r 46b874d60375 xen/arch/x86/io_apic.c
@@ -2209,6 +2209,8 @@
     }
 }
 
+unsigned highest_gsi(void);
+
 void __init init_ioapic_mappings(void)
 {
     unsigned long ioapic_phys;
@@ -2250,6 +2252,9 @@
             nr_irqs += nr_ioapic_registers[i];
         }
     }
+
+    nr_irqs = highest_gsi();
+
     if ( !smp_found_config || skip_ioapic_setup || nr_irqs < 16 )
         nr_irqs = 16;
     else if ( nr_irqs > PAGE_SIZE * 8 )
xen/arch/x86/mpparse.c +13 -0
diff -r 46b874d60375 xen/arch/x86/mpparse.c
@@ -945,6 +945,19 @@
 	return;
 }
 
+unsigned highest_gsi(void)
+{
+    unsigned x;
+    unsigned res;
+
+    res = 0;
+    for (x = 0; x < nr_ioapics; x++) {
+        if (res < mp_ioapic_routing[x].gsi_end)
+            res = mp_ioapic_routing[x].gsi_end;
+    }
+    return res;
+}
+
 
 void __init mp_override_legacy_irq (
 	u8			bus_irq,

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 9 lines
Quoted 1 line
Quoted 1 line

Steven Smith <[email protected]> 17.08.09 11:17 >>>

I have a test box with two IOAPICS which present non-contiguous GSIs according to the ACPI tables (the first offers 0-24 and the second 32-56). The latest xen-unstable with current pvops dom0 fails to boot on this machine, because the dom0 kernel can't claim any GSIs above
48. This is because the PHYSDEVOP_alloc_irq_vector implementation won't let it get at anything above nr_irqs, which is just the sum of the number of registers across all APICs.

Quoted 4 lines

The patch below fixes this by just setting nr_irqs to the highest GSI offered by any IOAPIC. I don't understand this stuff well enough to say whether that's the right fix (and the patch isn't suitable for applying, anyway), but it does make the machine boot.

This seems to mostly be in line with upstream Linux, except that it's lacking the fallback for when ACPI is disabled. See acpi_probe_gsi() and its use in 2.6.31-rcX.

Jan