From: Steven Smith Subject: Xen on machines with non-contiguous io-apics Date: Mon, 17 Aug 2009 10:17:28 +0100 Message-ID: <20090817091728.GA26646@weybridge.uk.xensource.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0892815374==" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --===============0892815374== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="UlVJffcvxoiEqYs2" Content-Disposition: inline --UlVJffcvxoiEqYs2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable (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 @@ } } =20 +unsigned highest_gsi(void); + void __init init_ioapic_mappings(void) { unsigned long ioapic_phys; @@ -2250,6 +2252,9 @@ nr_irqs +=3D nr_ioapic_registers[i]; } } + + nr_irqs =3D highest_gsi(); + if ( !smp_found_config || skip_ioapic_setup || nr_irqs < 16 ) nr_irqs =3D 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; } =20 +unsigned highest_gsi(void) +{ + unsigned x; + unsigned res; + + res =3D 0; + for (x =3D 0; x < nr_ioapics; x++) { + if (res < mp_ioapic_routing[x].gsi_end) + res =3D mp_ioapic_routing[x].gsi_end; + } + return res; +} + =20 void __init mp_override_legacy_irq ( u8 bus_irq, --UlVJffcvxoiEqYs2 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFKiSAovAgSWYI3DVMRAk/MAKCIoew3nROTpiELzTbcWaZP5i1GJgCfWb9w ttGAEUeh5D8r6CKfgQzEkgU= =rg0Q -----END PGP SIGNATURE----- --UlVJffcvxoiEqYs2-- --===============0892815374== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============0892815374==--