From patchwork Sat Mar 12 10:53:10 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Blue Swirl X-Patchwork-Id: 86490 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 ozlabs.org (Postfix) with ESMTPS id E5849B6F7B for ; Sat, 12 Mar 2011 21:54:06 +1100 (EST) Received: from localhost ([127.0.0.1]:33747 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PyMSQ-0004rm-OV for incoming@patchwork.ozlabs.org; Sat, 12 Mar 2011 05:54:02 -0500 Received: from [140.186.70.92] (port=34180 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PyMRw-0004ra-RC for qemu-devel@nongnu.org; Sat, 12 Mar 2011 05:53:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PyMRv-0006dO-E7 for qemu-devel@nongnu.org; Sat, 12 Mar 2011 05:53:32 -0500 Received: from mail-vx0-f173.google.com ([209.85.220.173]:39036) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PyMRv-0006dE-BD for qemu-devel@nongnu.org; Sat, 12 Mar 2011 05:53:31 -0500 Received: by vxb41 with SMTP id 41so3573541vxb.4 for ; Sat, 12 Mar 2011 02:53:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=yr9269NEHnMbYxPvFarrHbqUtNjE78upBNuoZEY0Qk0=; b=ut4PPTSrDHJvCGbqgss+JKD2c0P24hsd+pXXob60Ny5if4Zn8sVv3KhLXu98jFfbuc 4VLee6ZKT6XSb670lOwLNx8yMKPCkAE0IC7dYDn65Y/Y0Cu3MhNkWq3Oms02nDwB5YnJ H8R5vp1EUpsMAlwLp0rBjFdBv/3qx/MtUL55I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=XR+6XoQBPFOBCLzbk0W5encxg9le4H0D+YzyCbblC3m7QmaQ5XB74WawglthbluU5b YXtKmn8SsfcYbIKPShu5CPsdGwKnyK2LPUALtbkx+usdUgaTkXzMlQmkL6Zl2Ny7qvL2 oIrmCBwnjbX3xAB4ayBPVV4bZm0ojO+MERSw0= Received: by 10.52.74.106 with SMTP id s10mr5471759vdv.150.1299927210183; Sat, 12 Mar 2011 02:53:30 -0800 (PST) MIME-Version: 1.0 Received: by 10.220.179.7 with HTTP; Sat, 12 Mar 2011 02:53:10 -0800 (PST) In-Reply-To: References: From: Blue Swirl Date: Sat, 12 Mar 2011 12:53:10 +0200 Message-ID: To: Stefan Hajnoczi X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.220.173 Cc: qemu-devel Subject: [Qemu-devel] Re: fdc: refactor device creation causes guest kernel panic 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 Wed, Mar 9, 2011 at 4:34 PM, Stefan Hajnoczi wrote: > The following kernel panic occurs when the RHEL6 installer starts on > qemu.git/master: > > BUG: unable to handle kernel NULL pointer dereference at (null) > IP: [] floppy_ready+0xfb/0x730 [floppy] > > For full details see http://pastebin.com/SYE5A6LA. > > git-bisect revealed that the following commit causes this panic: > > commit 63ffb564dca94f8bda01ed6d209784104630a4d2 > Author: Blue Swirl > Date:   Sat Feb 5 16:32:23 2011 +0000 > >    fdc: refactor device creation > >    Turn fdc_init_isa into an inline function. > >    Get floppy geometry directly from the drives. > >    Don't expose FDCtrl. > >    Signed-off-by: Blue Swirl > > The CMOS value at 0x10 has changed from 0x00 to 0x40 but I have not > located the root cause of the problem. > > Blue Swirl: Any thoughts on this bug? The logic for calculating the drive state in pc.c does not match fdc.c logic. Please try this patch. &fd_type[i]); Tested-by: Stefan Hajnoczi From a008e6fd41a31d437670eaa0ddf12352e8a4a8fb Mon Sep 17 00:00:00 2001 Message-Id: From: Blue Swirl Date: Sat, 12 Mar 2011 09:52:25 +0000 Subject: [PATCH] pc: fix wrong CMOS values for floppy drives Before commit 63ffb564dca94f8bda01ed6d209784104630a4d2, states for floppy drives were calculated in fdc.c:fd_revalidate(). There it is also considered whether a disk is inserted or not. The commit didn't copy the logic completely to pc.c, which caused a regression. Fix by adding the same check also to pc.c. Signed-off-by: Blue Swirl --- hw/pc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/hw/pc.c b/hw/pc.c index 5966bf1..4d67d9f 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -382,7 +382,7 @@ void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size, /* floppy type */ for (i = 0; i < 2; i++) { fd[i] = drive_get(IF_FLOPPY, 0, i); - if (fd[i]) { + if (fd[i] && bdrv_is_inserted(fd[i]->bdrv)) { bdrv_get_floppy_geometry_hint(fd[i]->bdrv, &nb_heads, &max_track, &last_sect, FDRIVE_DRV_NONE, &fd_type[i]); -- 1.7.2.3