qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>, qemu-devel@nongnu.org
Cc: Anthony Liguori <aliguori@amazon.com>
Subject: Re: [Qemu-devel] [PATCH v5] virtio-pci: enable bus master for old guests
Date: Mon, 15 Sep 2014 17:48:17 +0800	[thread overview]
Message-ID: <5416B5E1.6050000@redhat.com> (raw)
In-Reply-To: <1410459530-29832-1-git-send-email-mst@redhat.com>

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 <gkurz@linux.vnet.ibm.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> 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?

  parent reply	other threads:[~2014-09-15  9:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-11 18:20 [Qemu-devel] [PATCH v5] virtio-pci: enable bus master for old guests Michael S. Tsirkin
2014-09-11 18:42 ` Greg Kurz
2014-09-14 10:44   ` Michael S. Tsirkin
2014-09-15  9:48 ` Jason Wang [this message]
2014-09-15  9:59   ` Michael S. Tsirkin
2014-09-15 10:13     ` Amos Kong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5416B5E1.6050000@redhat.com \
    --to=jasowang@redhat.com \
    --cc=aliguori@amazon.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).