]> rtime.felk.cvut.cz Git - lisovros/qemu_apohw.git/commit
ahci: properly shadow the TFD register
authorJohn Snow <jsnow@redhat.com>
Thu, 21 Aug 2014 17:44:36 +0000 (13:44 -0400)
committerStefan Hajnoczi <stefanha@redhat.com>
Mon, 22 Sep 2014 10:39:41 +0000 (11:39 +0100)
commitfac7aa7fc2ebc26803b0a7b44b010f47ce3e1dd8
treeef5728c6913edc08f7af22b6797b4de1c3b7f160
parent96d6d3bad978a4085b9560e30316c98cb6e0489c
ahci: properly shadow the TFD register

In a real AHCI device, several S/ATA registers are mirrored or shadowed
within the AHCI register set. These registers are not updated
synchronously for each read access, but are instead updated after a
Device-to-Host Register FIS packet is received. The D2H FIS contains
the values from these registers on the device.

In QEMU, by reaching directly into the device to grab these bits before
they are "sent," we may introduce race conditions where unexpected
values are present "before they are sent" which could cause issues for
some guests, particularly if an attempt is made to read the PxTFD
register prior to enabling the port, where incorrect values will be read.

This patch also addresses the boot-time values for the PxTFD and PxSIG
registers to bring them in line with the AHCI 1.3 specification.

Lastly, several fields (PxTFD, PxSIG and PxSACT) are read-only,
and any attempts to write to them should be ignored.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-id: 1408643079-30675-6-git-send-email-jsnow@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
hw/ide/ahci.c