Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LtORa-00059a-7X for qemu-devel@nongnu.org; Mon, 13 Apr 2009 11:51:34 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LtORV-00052j-Db for qemu-devel@nongnu.org; Mon, 13 Apr 2009 11:51:33 -0400 Received: from [199.232.76.173] (port=38152 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LtORV-00052Y-7P for qemu-devel@nongnu.org; Mon, 13 Apr 2009 11:51:29 -0400 Received: from mail.gmx.net ([213.165.64.20]:59150) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1LtORU-0006sz-Ik for qemu-devel@nongnu.org; Mon, 13 Apr 2009 11:51:28 -0400 Message-ID: From: "Sebastian Herbszt" References: <1239419318.20633.10.camel@localhost.localdomain> <6F64D9258BE74551983017A7F9B94472@FSCPC> <9ae48b020904121446k70ca257v30a17754f374ce5a@mail.gmail.com> In-Reply-To: <9ae48b020904121446k70ca257v30a17754f374ce5a@mail.gmail.com> Date: Mon, 13 Apr 2009 17:49:28 +0200 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH] Fix timer interrupt routing for non-ACPI guest Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Ed Swierk Cc: bochs-developers@lists.sourceforge.net, qemu-devel@nongnu.org Ed Swierk wrote: >>> The interrupt routing table in the MPTABLE needs to route the timer >>> interrupt (IRQ 0) to IOAPIC pin 2. >> >> Do you refer here to "5.3 Assigning of I/O Interrupts to the APIC I/O Unit" >> from MultiProcessor Specification 1.4 or some other documentation? > > I confess I haven't checked actual documentation; instead I've > referred to code from Coreboot that seems to work. For example the > bus_isa interrupts at > http://tracker.coreboot.org/trac/coreboot/browser/trunk/coreboot-v2/src/mainboard/msi/ms9185/mptable.c > . Looks like this sets: ExtINT IRQ0 -> 0:0 INT IRQ1 -> 0:1 INT IRQ0 -> 0:2 INT IRQ3 -> 0:3 This seems to also be what VMware provides: Int: type 3, pol 1, trig 1, bus 02, IRQ 00, APIC ID 1, APIC INT 00 Int: type 0, pol 1, trig 1, bus 02, IRQ 01, APIC ID 1, APIC INT 01 Int: type 0, pol 1, trig 1, bus 02, IRQ 00, APIC ID 1, APIC INT 02 Int: type 0, pol 1, trig 1, bus 02, IRQ 03, APIC ID 1, APIC INT 03 ..TIMER: vector=0x31 apic1=0 pin1=2 apic2=0 pin2=0 >> ..TIMER: vector=0x31 apic1=0 pin1=2 apic2=-1 pin2=-1 >> >> IRQ0 -> 0:2 >> IRQ1 -> 0:1 >> IRQ3 -> 0:3 > > I suspect the latter is correct but I don't know that it really makes > a difference, at least to Linux. We can achieve this Int: type 3, pol 0, trig 0, bus 00, IRQ 00, APIC ID 1, APIC INT 00 Int: type 0, pol 0, trig 0, bus 00, IRQ 00, APIC ID 1, APIC INT 02 Int: type 0, pol 0, trig 0, bus 00, IRQ 01, APIC ID 1, APIC INT 01 Int: type 0, pol 0, trig 0, bus 00, IRQ 03, APIC ID 1, APIC INT 03 ..TIMER: vector=0x31 apic1=0 pin1=2 apic2=0 pin2=0 with the following patch. - Sebastian Index: bochs-cvs/bios/rombios32.c =================================================================== --- bochs-cvs.orig/bios/rombios32.c +++ bochs-cvs/bios/rombios32.c @@ -1142,16 +1142,27 @@ static void mptable_init(void) putb(&q, 1); /* enable */ putle32(&q, 0xfec00000); /* I/O APIC addr */ + putb(&q, 3); /* entry type = I/O interrupt */ + putb(&q, 3); /* interrupt type = ExtINT */ + putb(&q, 0); /* flags: po=0, el=0 */ + putb(&q, 0); + putb(&q, 0); /* source bus ID = ISA */ + putb(&q, 0); /* source bus IRQ */ + putb(&q, ioapic_id); /* dest I/O APIC ID */ + putb(&q, 0); /* dest I/O APIC interrupt in */ + /* irqs */ for(i = 0; i < 16; i++) { + if (i == 2) + continue; putb(&q, 3); /* entry type = I/O interrupt */ putb(&q, 0); /* interrupt type = vectored interrupt */ putb(&q, 0); /* flags: po=0, el=0 */ putb(&q, 0); putb(&q, 0); /* source bus ID = ISA */ - putb(&q, (i == 2) ? 0 : i); /* source bus IRQ */ + putb(&q, i); /* source bus IRQ */ putb(&q, ioapic_id); /* dest I/O APIC ID */ - putb(&q, i); /* dest I/O APIC interrupt in */ + putb(&q, (i == 0) ? 2 : i); /* dest I/O APIC interrupt in */ } /* patch length */ len = q - mp_config_table;