aboutsummaryrefslogtreecommitdiff
path: root/hw/virtio-pci.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2011-08-04 17:15:22 -0500
committerAnthony Liguori <aliguori@us.ibm.com>2011-08-04 17:15:22 -0500
commit81e34a2401f7ffd519bb7f093e833cb48734169f (patch)
tree146a7b6eebbee1367453fde501d4462ac6d9f8b4 /hw/virtio-pci.c
parente06516f565dca3636a4cbef770b191a5fcdf63ab (diff)
parentcb4b4fde82b064472c13fb9d983ca36a70e560aa (diff)
Merge remote-tracking branch 'mst/for_anthony' into staging
Diffstat (limited to 'hw/virtio-pci.c')
-rw-r--r--hw/virtio-pci.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index 316bf92db0..f3b3293db0 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -27,6 +27,7 @@
#include "kvm.h"
#include "blockdev.h"
#include "virtio-pci.h"
+#include "range.h"
/* from Linux's linux/virtio_pci.h */
@@ -516,17 +517,16 @@ static void virtio_write_config(PCIDevice *pci_dev, uint32_t address,
{
VirtIOPCIProxy *proxy = DO_UPCAST(VirtIOPCIProxy, pci_dev, pci_dev);
- if (PCI_COMMAND == address) {
- if (!(val & PCI_COMMAND_MASTER)) {
- if (!(proxy->flags & VIRTIO_PCI_FLAG_BUS_MASTER_BUG)) {
- virtio_pci_stop_ioeventfd(proxy);
- virtio_set_status(proxy->vdev,
- proxy->vdev->status & ~VIRTIO_CONFIG_S_DRIVER_OK);
- }
- }
+ pci_default_write_config(pci_dev, address, val, len);
+
+ if (range_covers_byte(address, len, PCI_COMMAND) &&
+ !(pci_dev->config[PCI_COMMAND] & PCI_COMMAND_MASTER) &&
+ !(proxy->flags & VIRTIO_PCI_FLAG_BUS_MASTER_BUG)) {
+ virtio_pci_stop_ioeventfd(proxy);
+ virtio_set_status(proxy->vdev,
+ proxy->vdev->status & ~VIRTIO_CONFIG_S_DRIVER_OK);
}
- pci_default_write_config(pci_dev, address, val, len);
msix_write_config(pci_dev, address, val, len);
}