From patchwork Tue Aug 18 01:02:29 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Herbert Poetzl X-Patchwork-Id: 31548 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by bilbo.ozlabs.org (Postfix) with ESMTPS id A4194B7BAB for ; Tue, 18 Aug 2009 13:51:54 +1000 (EST) Received: from localhost ([127.0.0.1]:37431 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MdFjk-0002qK-2M for incoming@patchwork.ozlabs.org; Mon, 17 Aug 2009 23:51:52 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MdD6Z-0008DY-Cx for qemu-devel@nongnu.org; Mon, 17 Aug 2009 21:03:15 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MdD6U-00089G-AV for qemu-devel@nongnu.org; Mon, 17 Aug 2009 21:03:14 -0400 Received: from [199.232.76.173] (port=38636 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MdD6U-00089D-4I for qemu-devel@nongnu.org; Mon, 17 Aug 2009 21:03:10 -0400 Received: from mail.13thfloor.at ([213.145.232.33]:42913) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MdD6T-0000pR-HT for qemu-devel@nongnu.org; Mon, 17 Aug 2009 21:03:09 -0400 Received: by mail.13thfloor.at (Postfix, from userid 1001) id CA8713C205; Tue, 18 Aug 2009 03:02:29 +0200 (CEST) Date: Tue, 18 Aug 2009 03:02:29 +0200 From: Herbert Poetzl To: kvm@vger.kernel.org, qemu-devel@nongnu.org Message-ID: <20090818010229.GA6083@MAIL.13thfloor.at> Mail-Followup-To: kvm@vger.kernel.org, qemu-devel@nongnu.org, Avi Kivity References: <20090817022024.GE1025@MAIL.13thfloor.at> Mime-Version: 1.0 Content-Disposition: inline In-Reply-To: <20090817022024.GE1025@MAIL.13thfloor.at> User-Agent: Mutt/1.5.11 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-Mailman-Approved-At: Mon, 17 Aug 2009 23:49:49 -0400 Cc: Avi Kivity Subject: [Qemu-devel] Re: i8259 defaults wrong? X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org >On Mon, Aug 17, 2009 at 04:20:24AM +0200, Herbert Poetzl wrote: >> >> Greetings! >> >> looking at the i8259 implementation found in qemu >> as well as in the in-kernel kvm implementation, I >> see that on pic_reset() special_fully_nested_mode >> is set to zero, but the intel(r) 8259A manual says >> on page 15: >> >> Fully Nested Mode >> >> This mode is entered after initialization unless >> another mode is programmed. >> >> any comments are appreciated, a patch should be >> trivial, but I'd gladly submit one if requested. > > Well, does the BIOS set fully nested mode on reset? no idea, but as far as I tested, it doesn't matter for Linux guests, but makes some other operating systems - which seem to heavily rely on this default (e.g. OpenStep, darwin) - work like expected. > If not, a kvm change is difficult, since the bios > and kvm are updated independently. nevertheless IMHO it should be fixed ASAP, and the required change is trivial, i.e. only a single line in the kvm/qemu code needs to be changed to make it work correctly (see patches below) best, Herbert please CC me as I'm not subscribed to either list ; fix i8259 reset behaviour ; qemu/kvm (outside the kernel) ; >> TIA, >> Herbert --- ./hw/i8259.c.orig 2009-08-12 19:45:45.000000000 +0200 +++ ./hw/i8259.c 2009-08-17 03:48:15.000000000 +0200 @@ -295,7 +295,7 @@ static void pic_reset(void *opaque) s->init_state = 0; s->auto_eoi = 0; s->rotate_on_auto_eoi = 0; - s->special_fully_nested_mode = 0; + s->special_fully_nested_mode = 1; s->init4 = 0; s->single_mode = 0; /* Note: ELCR is not reset */ ; fix i8259 reset behaviour ; kvm (inside the kernel) --- ./arch/x86/kvm/i8259.c.orig 2009-06-11 17:12:23.000000000 +0200 +++ ./arch/x86/kvm/i8259.c 2009-08-18 02:50:00.000000000 +0200 @@ -279,7 +279,7 @@ void kvm_pic_reset(struct kvm_kpic_state s->init_state = 0; s->auto_eoi = 0; s->rotate_on_auto_eoi = 0; - s->special_fully_nested_mode = 0; + s->special_fully_nested_mode = 1; s->init4 = 0; }