From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40656) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XTT50-00027w-Q4 for qemu-devel@nongnu.org; Mon, 15 Sep 2014 06:00:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XTT4u-0001Qh-Kh for qemu-devel@nongnu.org; Mon, 15 Sep 2014 06:00:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41963) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XTT4u-0001Q8-DU for qemu-devel@nongnu.org; Mon, 15 Sep 2014 06:00:12 -0400 Date: Mon, 15 Sep 2014 12:59:44 +0300 From: "Michael S. Tsirkin" Message-ID: <20140915095944.GD31236@redhat.com> References: <1410459530-29832-1-git-send-email-mst@redhat.com> <5416B5E1.6050000@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5416B5E1.6050000@redhat.com> Subject: Re: [Qemu-devel] [PATCH v5] virtio-pci: enable bus master for old guests List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jason Wang Cc: qemu-devel@nongnu.org, Anthony Liguori On Mon, Sep 15, 2014 at 05:48:17PM +0800, Jason Wang wrote: > On 09/12/2014 02:20 AM, Michael S. Tsirkin wrote: > > 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 > > Signed-off-by: Michael S. Tsirkin > > --- > > Sorry, v4 was broken - forgot to commit before git format-patch. > > Here's the correct version. > > Still not tested - will do next week. > > Testing reports appreciated meanwhile. > > > > 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. */ > > So with this patch, we can also remove the detecting and handling of > VIRTIO_PCI_FLAG_BUS_MATER_BUG? Yes - I sent a follow-up patch to do that. -- MST