From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KuWrn-0001Rb-NX for qemu-devel@nongnu.org; Mon, 27 Oct 2008 14:31:03 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KuWri-0001Q6-IC for qemu-devel@nongnu.org; Mon, 27 Oct 2008 14:31:02 -0400 Received: from [199.232.76.173] (port=38694 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KuWri-0001Q2-FH for qemu-devel@nongnu.org; Mon, 27 Oct 2008 14:30:58 -0400 Received: from e1.ny.us.ibm.com ([32.97.182.141]:54916) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KuWrg-0000RJ-0z for qemu-devel@nongnu.org; Mon, 27 Oct 2008 14:30:58 -0400 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by e1.ny.us.ibm.com (8.13.8/8.13.8) with ESMTP id m9RIUiv6017195 for ; Mon, 27 Oct 2008 14:30:44 -0400 Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id m9RIUiFT117974 for ; Mon, 27 Oct 2008 14:30:44 -0400 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m9RIUcHN008453 for ; Mon, 27 Oct 2008 14:30:38 -0400 Received: from [9.65.94.29] (sig-9-65-94-29.mts.ibm.com [9.65.94.29]) by d01av02.pok.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id m9RIUc8N008436 for ; Mon, 27 Oct 2008 14:30:38 -0400 Subject: Re: [Qemu-devel] [PATCH 1/2] Add Interrupt Source Override Structure to BIOS From: Beth Kon In-Reply-To: <1225131623.7555.72.camel@beth-laptop> References: <1225131623.7555.72.camel@beth-laptop> Content-Type: text/plain Date: Mon, 27 Oct 2008 14:30:47 -0400 Message-Id: <1225132247.7555.81.camel@beth-laptop> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On Mon, 2008-10-27 at 14:20 -0400, Beth Kon wrote: > Looking into a problem with getting the HPET to work for both Windows > and Linux revealed what appears to be a problem with QEMU's interrupt > generation. > > Since QEMU supports both APIC and dual 8259 mode (as indicated by bit 0 > of the MADT flags - PCAT COMPAT), the BIOS should include the Interrupt > Source Override structure to inform the OS that IRQ0 is mapped to > interrupt 2 in APIC mode, which is the standard scheme for the PIT. > > What must be happening is that Linux is abiding by what the BIOS says > and expecting INTI0 from the APIC (since there is no Interrupt Source > Override). Windows must be ignoring the Interrupt Source Override > information and just expecting to see the timer interrupt on INTI2. So > the HPET had to raise both 0 and 2 to keep them both happy. > > Patch 1 adds the Interrupt Source Override to BIOS, and Patch 2 modifies > ioapic_set_irq to change vector 0 to 2. > > Making this change allowed Windows and Linux to both work with HPET code > that just raised IRQ0. > > That said, I don't understand why the PIT was working with the code as > it was in the case of Windows, unless in that case windows was honoring > the Interrupt Source Override (or the lack of one, I should say). I'm > not sure these patches are the right solution for all cases, but they > work for the HPET. I should add that KVM does have an Interrupt Source > Override structure in their BIOS but they do not remap 0 to 2, so maybe > I'm missing something here. Comments appreciated. > Forgot .... Signed-off-by Beth Kon -- Elizabeth Kon (Beth) IBM Linux Technology Center Open Hypervisor Team email: eak@us.ibm.com