vfio/pci: Fix RTL8168 NIC quirks
commit69970fcef937bddd7f745efe39501c7716fdfe56
authorAlex Williamson <alex.williamson@redhat.com>
Wed, 22 Jul 2015 20:56:01 +0000 (22 14:56 -0600)
committerAlex Williamson <alex.williamson@redhat.com>
Wed, 22 Jul 2015 20:56:01 +0000 (22 14:56 -0600)
tree6f239beb1860d91aead40bdc82bbbf65f321505e
parentb69b30532e0a80e25449244c01b0cbed000c99a3
vfio/pci: Fix RTL8168 NIC quirks

The RTL8168 quirk correctly describes using bit 31 as a signal to
mark a latch/completion, but the code mistakenly uses bit 28.  This
causes the Realtek driver to spin on this register for quite a while,
20k cycles on Windows 7 v7.092 driver.  Then it gets frustrated and
tries to set the bit itself and spins for another 20k cycles.  For
some this still results in a working driver, for others not.  About
the only thing the code really does in its current form is protect
the guest from sneaking in writes to the real hardware MSI-X table.
The fix is obviously to use bit 31 as we document that we should.

The other problem doesn't seem to affect current drivers as nobody
seems to use these window registers for writes to the MSI-X table, but
we need to use the stored data when a write is triggered, not the
value of the current write, which only provides the offset.

Note that only the Windows drivers from Realtek seem to use these
registers, the Microsoft drivers provided with Windows 8.1 do not
access them, nor do Linux in-kernel drivers.

Link: https://bugs.launchpad.net/qemu/+bug/1384892
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Cc: qemu-stable@nongnu.org # v2.1+
hw/vfio/pci.c