From: Jason Wang <jasowang@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>, linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org,
virtualization@lists.linux-foundation.org,
Bandan Das <bsd@redhat.com>
Subject: Re: [PATCH] virtio: virtio 1.0 cs04 spec compliance for reset
Date: Tue, 5 Apr 2016 10:53:53 +0800 [thread overview]
Message-ID: <570328C1.9010709@redhat.com> (raw)
In-Reply-To: <1459686336-29527-1-git-send-email-mst@redhat.com>
On 04/03/2016 08:26 PM, Michael S. Tsirkin wrote:
> The spec says: after writing 0 to device_status, the driver MUST wait
> for a read of device_status to return 0 before reinitializing the
> device.
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> drivers/virtio/virtio_pci_modern.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/virtio/virtio_pci_modern.c b/drivers/virtio/virtio_pci_modern.c
> index f6f28cc..e76bd91 100644
> --- a/drivers/virtio/virtio_pci_modern.c
> +++ b/drivers/virtio/virtio_pci_modern.c
> @@ -17,6 +17,7 @@
> *
> */
>
> +#include <linux/delay.h>
> #define VIRTIO_PCI_NO_LEGACY
> #include "virtio_pci_common.h"
>
> @@ -271,9 +272,13 @@ static void vp_reset(struct virtio_device *vdev)
> struct virtio_pci_device *vp_dev = to_vp_device(vdev);
> /* 0 status means a reset. */
> vp_iowrite8(0, &vp_dev->common->device_status);
> - /* Flush out the status write, and flush in device writes,
> - * including MSI-X interrupts, if any. */
> - vp_ioread8(&vp_dev->common->device_status);
> + /* After writing 0 to device_status, the driver MUST wait for a read of
> + * device_status to return 0 before reinitializing the device.
> + * This will flush out the status write, and flush in device writes,
> + * including MSI-X interrupts, if any.
> + */
> + while (vp_ioread8(&vp_dev->common->device_status))
> + msleep(1);
> /* Flush pending VQ/configuration callbacks. */
> vp_synchronize_vectors(vdev);
> }
Acked-by: Jason Wang <jasowang@redhat.com>
next prev parent reply other threads:[~2016-04-05 2:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-03 12:26 [PATCH] virtio: virtio 1.0 cs04 spec compliance for reset Michael S. Tsirkin
2016-04-05 2:53 ` Jason Wang [this message]
2016-04-05 2:53 ` Jason Wang
-- strict thread matches above, loose matches on Subject: below --
2016-04-03 12:26 Michael S. Tsirkin
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=570328C1.9010709@redhat.com \
--to=jasowang@redhat.com \
--cc=bsd@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=stable@vger.kernel.org \
--cc=virtualization@lists.linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.