From patchwork Fri Sep 14 12:39:08 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 183918 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 CD9C72C0085 for ; Fri, 14 Sep 2012 23:13:13 +1000 (EST) Received: from localhost ([::1]:33628 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TCVCO-0001vL-NR for incoming@patchwork.ozlabs.org; Fri, 14 Sep 2012 08:40:44 -0400 Received: from eggs.gnu.org ([208.118.235.92]:54238) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TCVBF-0007w4-HS for qemu-devel@nongnu.org; Fri, 14 Sep 2012 08:39:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TCVB9-0004rM-6G for qemu-devel@nongnu.org; Fri, 14 Sep 2012 08:39:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:11214) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TCVB8-0004rF-Ta for qemu-devel@nongnu.org; Fri, 14 Sep 2012 08:39:27 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q8ECdPgk008124 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 14 Sep 2012 08:39:25 -0400 Received: from dhcp-5-188.str.redhat.com (vpn1-6-21.ams2.redhat.com [10.36.6.21]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q8ECdDOh028864; Fri, 14 Sep 2012 08:39:24 -0400 From: Kevin Wolf To: anthony@codemonkey.ws Date: Fri, 14 Sep 2012 14:39:08 +0200 Message-Id: <1347626352-6023-8-git-send-email-kwolf@redhat.com> In-Reply-To: <1347626352-6023-1-git-send-email-kwolf@redhat.com> References: <1347626352-6023-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 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, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 07/11] 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 From: Jason Baron 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. 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 Acked-by: Alexander Graf Signed-off-by: Kevin Wolf --- hw/ide/ahci.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c index 5ea3cad..68671bc 100644 --- a/hw/ide/ahci.c +++ b/hw/ide/ahci.c @@ -1175,7 +1175,6 @@ void ahci_init(AHCIState *s, DeviceState *qdev, DMAContext *dma, int ports) ad->port_no = i; ad->port.dma = &ad->dma; ad->port.dma->ops = &ahci_dma_ops; - ad->port_regs.cmd = PORT_CMD_SPIN_UP | PORT_CMD_POWER_ON; } } @@ -1199,6 +1198,7 @@ void ahci_reset(AHCIState *s) pr->irq_stat = 0; pr->irq_mask = 0; pr->scr_ctl = 0; + pr->cmd = PORT_CMD_SPIN_UP | PORT_CMD_POWER_ON; ahci_reset_port(s, i); } }