mopsfelder / rpms / qemu

Forked from rpms/qemu 4 years ago
Clone
fa00e1e
From 10d5ce98cc29e06928b24891cf6fd75438b95604 Mon Sep 17 00:00:00 2001
5544c1b
From: Jason Baron <jbaron@redhat.com>
5544c1b
Date: Tue, 4 Sep 2012 16:08:08 -0400
5544c1b
Subject: [PATCH] ahci: properly reset PxCMD on HBA reset
5544c1b
5544c1b
While testing q35, I found that windows 7 (specifically, windows 7 ultimate
5544c1b
with sp1 x64), wouldn't install because it can't find the cdrom or disk drive.
5544c1b
The failure message is: 'A required cd/dvd device driver is missing. If you
5544c1b
have a driver floppy disk, CD, DVD, or USB flash drive, please insert it now.'
5544c1b
This can also be reproduced on piix by adding an ahci controller, and
5544c1b
observing that windows 7 does not see any devices behind it.
5544c1b
5544c1b
The problem is that when windows issues a HBA reset, qemu does not reset the
5544c1b
individual ports' PxCMD register. Windows 7 then reads back the PxCMD register
5544c1b
and presumably assumes that the ahci controller has already been initialized.
5544c1b
Windows then never sets up the PxIE register to enable interrupts, and thus it
5544c1b
never gets irqs back when it sends ata device inquiry commands.
5544c1b
5544c1b
This change brings qemu into ahci 1.3 specification compliance.
5544c1b
5544c1b
Section 10.4.3 HBA Reset:
5544c1b
5544c1b
"
5544c1b
When GHC.HR is set to '1', GHC.AE, GHC.IE, the IS register, and all port
5544c1b
register fields (except PxFB/PxFBU/PxCLB/PxCLBU) that are not HwInit in the
5544c1b
HBA's register memory space are reset.
5544c1b
"
5544c1b
5544c1b
I've also re-tested Fedora 16 and 17 to verify that they continue to work with
5544c1b
this change.
5544c1b
5544c1b
Signed-off-by: Jason Baron <jbaron@redhat.com>
5544c1b
Acked-by: Alexander Graf <agraf@suse.de>
5544c1b
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5544c1b
(cherry picked from commit 2a4f4f34e6fe55f4c82507c3e7ec9b58c2e24ad4)
5544c1b
5544c1b
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
5544c1b
---
5544c1b
 hw/ide/ahci.c | 2 +-
5544c1b
 1 file changed, 1 insertion(+), 1 deletion(-)
5544c1b
5544c1b
diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
5544c1b
index 5ea3cad..68671bc 100644
5544c1b
--- a/hw/ide/ahci.c
5544c1b
+++ b/hw/ide/ahci.c
5544c1b
@@ -1175,7 +1175,6 @@ void ahci_init(AHCIState *s, DeviceState *qdev, DMAContext *dma, int ports)
5544c1b
         ad->port_no = i;
5544c1b
         ad->port.dma = &ad->dma;
5544c1b
         ad->port.dma->ops = &ahci_dma_ops;
5544c1b
-        ad->port_regs.cmd = PORT_CMD_SPIN_UP | PORT_CMD_POWER_ON;
5544c1b
     }
5544c1b
 }
5544c1b
 
5544c1b
@@ -1199,6 +1198,7 @@ void ahci_reset(AHCIState *s)
5544c1b
         pr->irq_stat = 0;
5544c1b
         pr->irq_mask = 0;
5544c1b
         pr->scr_ctl = 0;
5544c1b
+        pr->cmd = PORT_CMD_SPIN_UP | PORT_CMD_POWER_ON;
5544c1b
         ahci_reset_port(s, i);
5544c1b
     }
5544c1b
 }