From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47551) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XRlgA-0007sk-A9 for qemu-devel@nongnu.org; Wed, 10 Sep 2014 13:27:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XRlg5-0001j4-87 for qemu-devel@nongnu.org; Wed, 10 Sep 2014 13:27:38 -0400 Date: Wed, 10 Sep 2014 20:30:47 +0300 From: "Michael S. Tsirkin" Message-ID: <1410370197-15976-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] [PATCH v2] virtio-pci: enable bus master for old guests List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, Anthony Liguori 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 Old guests forgot to enable bus mastering, enable it automatically when driver discovers device. Cc: qemu-stable@nongnu.org Reported-by: Greg Kurz Signed-off-by: Michael S. Tsirkin --- OK, this should have better luck. This also makes it possible to simplify code, will do that in a follow-up patch. hw/virtio/virtio-pci.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index ddb5da1..a29d94f 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -303,6 +303,14 @@ static void virtio_ioport_write(void *opaque, uint32_t addr, uint32_t val) virtio_pci_stop_ioeventfd(proxy); } + /* Linux before 2.6.34 uses the device without enabling + the PCI device bus master bit. As a work-around, enable it + automatically when driver detects the device. */ + if (val == VIRTIO_CONFIG_S_ACKNOWLEDGE) { + memory_region_set_enabled(&proxy->pci_dev.bus_master_enable_region, + true); + } + virtio_set_status(vdev, val & 0xFF); if (val & VIRTIO_CONFIG_S_DRIVER_OK) { -- MST