Steven Smith
2009-Aug-17 09:17 UTC
[Xen-devel] Xen on machines with non-contiguous io-apics
(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
diff -r 46b874d60375 xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c Fri Aug 14 12:26:35 2009 +0100
+++ b/xen/arch/x86/io_apic.c Fri Aug 14 17:18:19 2009 +0100
@@ -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 )
diff -r 46b874d60375 xen/arch/x86/mpparse.c
--- a/xen/arch/x86/mpparse.c Fri Aug 14 12:26:35 2009 +0100
+++ b/xen/arch/x86/mpparse.c Fri Aug 14 17:18:19 2009 +0100
@@ -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
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Jan Beulich
2009-Aug-17 09:44 UTC
Re: [Xen-devel] Xen on machines with non-contiguous io-apics
>>> Steven Smith <steven.smith@citrix.com> 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. > >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 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel