[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v3 12/15] virtio-pci: enable bus master for old guest
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL v3 12/15] virtio-pci: enable bus master for old guests |
Date: |
Thu, 18 Sep 2014 21:54:52 +0300 |
commit cc943c36faa192cd4b32af8fe5edb31894017d35
pci: Use bus master address space for delivering MSI/MSI-X messages
breaks virtio-net for rhel6.[56] x86 guests because they don't
enable bus mastering for virtio PCI devices. For the same reason,
rhel6.[56] ppc64 guests cannot boot on a virtio-blk disk anymore.
Old guests forgot to enable bus mastering, enable it automatically on
DRIVER (guests use some devices before DRIVER_OK).
Reported-by: Greg Kurz <address@hidden>
Reviewed-by: Greg Kurz <address@hidden>
Tested-by: Greg Kurz <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
hw/virtio/virtio-pci.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index ddb5da1..a827cd4 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -314,6 +314,16 @@ static void virtio_ioport_write(void *opaque, uint32_t
addr, uint32_t val)
msix_unuse_all_vectors(&proxy->pci_dev);
}
+ /* Linux before 2.6.34 drives the device without enabling
+ the PCI device bus master bit. Enable it automatically
+ for the guest. This is a PCI spec violation but so is
+ initiating DMA with bus master bit clear. */
+ if (val == (VIRTIO_CONFIG_S_ACKNOWLEDGE | VIRTIO_CONFIG_S_DRIVER)) {
+ pci_default_write_config(&proxy->pci_dev, PCI_COMMAND,
+ proxy->pci_dev.config[PCI_COMMAND] |
+ PCI_COMMAND_MASTER, 1);
+ }
+
/* Linux before 2.6.34 sets the device as OK without enabling
the PCI device bus master bit. In this case we need to disable
some safety checks. */
--
MST
- [Qemu-devel] [PULL v3 03/15] tests: disable global props test for old glib, (continued)
- [Qemu-devel] [PULL v3 03/15] tests: disable global props test for old glib, Michael S. Tsirkin, 2014/09/18
- [Qemu-devel] [PULL v3 04/15] test-qdev-global-props: Run tests on subprocess, Michael S. Tsirkin, 2014/09/18
- [Qemu-devel] [PULL v3 05/15] test-qdev-global-props: Initialize not_used=true for all props, Michael S. Tsirkin, 2014/09/18
- [Qemu-devel] [PULL v3 06/15] test-qdev-global-props: Test handling of hotpluggable and non-device types, Michael S. Tsirkin, 2014/09/18
- [Qemu-devel] [PULL v3 07/15] qdev: Rename qdev_prop_check_global() to qdev_prop_check_globals(), Michael S. Tsirkin, 2014/09/18
- [Qemu-devel] [PULL v3 08/15] qdev: Move global validation to a single function, Michael S. Tsirkin, 2014/09/18
- [Qemu-devel] [PULL v3 09/15] Revert "rng-egd: remove redundant free", Michael S. Tsirkin, 2014/09/18
- [Qemu-devel] [PULL v3 10/15] virtio-net: drop assert on vm stop, Michael S. Tsirkin, 2014/09/18
- [Qemu-devel] [PULL v3 11/15] Revert "virtio: don't call device on !vm_running", Michael S. Tsirkin, 2014/09/18
- [Qemu-devel] [PULL v3 13/15] vhost-user: fix VIRTIO_NET_F_MRG_RXBUF negotiation, Michael S. Tsirkin, 2014/09/18
- [Qemu-devel] [PULL v3 12/15] virtio-pci: enable bus master for old guests,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL v3 15/15] pc: leave more space for BIOS allocations, Michael S. Tsirkin, 2014/09/18
- [Qemu-devel] [PULL v3 14/15] virtio-pci: fix migration for pci bus master, Michael S. Tsirkin, 2014/09/18
- Re: [Qemu-devel] [PULL v3 14/15] virtio-pci: fix migration for pci bus master, Michael S. Tsirkin, 2014/09/29
- Re: [Qemu-devel] [PULL v3 14/15] virtio-pci: fix migration for pci bus master, Greg Kurz, 2014/09/29
- Re: [Qemu-devel] [PULL v3 14/15] virtio-pci: fix migration for pci bus master, Nikunj A Dadhania, 2014/09/30
[Qemu-devel] [PULL v3 01/15] hw/machine: Free old values of string properties, Michael S. Tsirkin, 2014/09/18