From patchwork Thu Aug 23 21:09:25 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Baron X-Patchwork-Id: 179724 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 1FDDB2C00BE for ; Fri, 24 Aug 2012 07:09:52 +1000 (EST) Received: from localhost ([::1]:47031 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T4ef0-0001eh-57 for incoming@patchwork.ozlabs.org; Thu, 23 Aug 2012 17:09:50 -0400 Received: from eggs.gnu.org ([208.118.235.92]:53665) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T4eeo-0001eQ-T3 for qemu-devel@nongnu.org; Thu, 23 Aug 2012 17:09:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T4eek-0002Ak-BG for qemu-devel@nongnu.org; Thu, 23 Aug 2012 17:09:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:14412) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T4eek-0002AX-3J for qemu-devel@nongnu.org; Thu, 23 Aug 2012 17:09:34 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q7NL9W7T015530 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 23 Aug 2012 17:09:32 -0400 Received: from redhat.com (dhcp-185-114.bos.redhat.com [10.16.185.114]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q7NL9P9t016424; Thu, 23 Aug 2012 17:09:25 -0400 Date: Thu, 23 Aug 2012 17:09:25 -0400 From: Jason Baron Message-Id: <201208232109.q7NL9P9t016424@int-mx09.intmail.prod.int.phx2.redhat.com> To: agraf@suse.de X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, aliguori@us.ibm.com, mst@redhat.com, qemu-devel@nongnu.org, jan.kiszka@siemens.com, armbru@redhat.com, lcapitulino@redhat.com, yamahata@valinux.co.jp, alex.williamson@redhat.com, pbonzini@redhat.com, afaerber@suse.de Subject: [Qemu-devel] [PATCH] ahci: properly reset PxCMD on HBA reset X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org While testing q35, I found that windows 7 (specifically, windows 7 ultimate with sp1 x64), wouldn't install because it can't find the cdrom or disk drive. The failure message is: 'A required cd/dvd device driver is missing. If you have a driver floppy disk, CD, DVD, or USB flash drive, please insert it now.' This can also be reproduced on piix by adding an ahci controller, and observing that windows 7 does not see any devices behind it. The problem is that when windows issues a HBA reset, qemu does not reset the individual ports' PxCMD register. Windows 7 then reads back the PxCMD register and presumably assumes that the ahci controller has already been initialized. Windows then never sets up the PxIE register to enable interrupts, and thus it never gets irqs back when it sends ata device inquiry commands. I believe this change brings qemu into ahci 1.3 specification compliance. Section 10.4.3 HBA Reset: " When GHC.HR is set to '1', GHC.AE, GHC.IE, the IS register, and all port register fields (except PxFB/PxFBU/PxCLB/PxCLBU) that are not HwInit in the HBA's register memory space are reset. " I've also re-tested Fedora 16 and 17 to verify that they continue to work with this change. Signed-off-by: Jason Baron --- hw/ide/ahci.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c index 9fe89a5..06c236f 100644 --- a/hw/ide/ahci.c +++ b/hw/ide/ahci.c @@ -1199,6 +1199,7 @@ void ahci_reset(AHCIState *s) pr->irq_stat = 0; pr->irq_mask = 0; pr->scr_ctl = 0; + pr->cmd = 0; ahci_reset_port(s, i); } }