Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1370210 > unrolled thread
| Started by | "Michael S. Tsirkin" <mst@redhat.com> |
|---|---|
| First post | 2016-04-03 14:30 +0200 |
| Last post | 2016-04-05 05:00 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] virtio: virtio 1.0 cs04 spec compliance for reset "Michael S. Tsirkin" <mst@redhat.com> - 2016-04-03 14:30 +0200
Re: [PATCH] virtio: virtio 1.0 cs04 spec compliance for reset Jason Wang <jasowang@redhat.com> - 2016-04-05 05:00 +0200
| From | "Michael S. Tsirkin" <mst@redhat.com> |
|---|---|
| Date | 2016-04-03 14:30 +0200 |
| Subject | [PATCH] virtio: virtio 1.0 cs04 spec compliance for reset |
| Message-ID | <rjPkd-3fW-1@gated-at.bofh.it> |
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); } -- MST
[toc] | [next] | [standalone]
| From | Jason Wang <jasowang@redhat.com> |
|---|---|
| Date | 2016-04-05 05:00 +0200 |
| Message-ID | <rkpnI-4zp-13@gated-at.bofh.it> |
| In reply to | #1370210 |
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>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web