qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] virtio-mmio: update queue size on guest write
@ 2019-12-24  8:14 Denis Plotnikov
  2019-12-24 15:02 ` Stefano Garzarella
  0 siblings, 1 reply; 2+ messages in thread
From: Denis Plotnikov @ 2019-12-24  8:14 UTC (permalink / raw)
  To: qemu-devel; +Cc: mst

Some guests read back queue size after writing it.
Always update the on size write otherwise they might be confused.

Signed-off-by: Denis Plotnikov <dplotnikov@virtuozzo.com>
---
 hw/virtio/virtio-mmio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c
index 94d934c44b..1e40a74869 100644
--- a/hw/virtio/virtio-mmio.c
+++ b/hw/virtio/virtio-mmio.c
@@ -295,8 +295,9 @@ static void virtio_mmio_write(void *opaque, hwaddr offset, uint64_t value,
         break;
     case VIRTIO_MMIO_QUEUE_NUM:
         trace_virtio_mmio_queue_write(value, VIRTQUEUE_MAX_SIZE);
+        virtio_queue_set_num(vdev, vdev->queue_sel, value);
+
         if (proxy->legacy) {
-            virtio_queue_set_num(vdev, vdev->queue_sel, value);
             virtio_queue_update_rings(vdev, vdev->queue_sel);
         } else {
             proxy->vqs[vdev->queue_sel].num = value;
-- 
2.17.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v1] virtio-mmio: update queue size on guest write
  2019-12-24  8:14 [PATCH v1] virtio-mmio: update queue size on guest write Denis Plotnikov
@ 2019-12-24 15:02 ` Stefano Garzarella
  0 siblings, 0 replies; 2+ messages in thread
From: Stefano Garzarella @ 2019-12-24 15:02 UTC (permalink / raw)
  To: Denis Plotnikov; +Cc: qemu-devel, mst

On Tue, Dec 24, 2019 at 11:14:46AM +0300, Denis Plotnikov wrote:
> Some guests read back queue size after writing it.
> Always update the on size write otherwise they might be confused.
> 
> Signed-off-by: Denis Plotnikov <dplotnikov@virtuozzo.com>
> ---
>  hw/virtio/virtio-mmio.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

When I reviewed the Michael's patch for pci transport, I planned to do
the same but I postponed for several reason.

Thanks for doing that!

Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>

> 
> diff --git a/hw/virtio/virtio-mmio.c b/hw/virtio/virtio-mmio.c
> index 94d934c44b..1e40a74869 100644
> --- a/hw/virtio/virtio-mmio.c
> +++ b/hw/virtio/virtio-mmio.c
> @@ -295,8 +295,9 @@ static void virtio_mmio_write(void *opaque, hwaddr offset, uint64_t value,
>          break;
>      case VIRTIO_MMIO_QUEUE_NUM:
>          trace_virtio_mmio_queue_write(value, VIRTQUEUE_MAX_SIZE);
> +        virtio_queue_set_num(vdev, vdev->queue_sel, value);
> +
>          if (proxy->legacy) {
> -            virtio_queue_set_num(vdev, vdev->queue_sel, value);
>              virtio_queue_update_rings(vdev, vdev->queue_sel);
>          } else {
>              proxy->vqs[vdev->queue_sel].num = value;
> -- 
> 2.17.0
> 
> 



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-12-24 15:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-24  8:14 [PATCH v1] virtio-mmio: update queue size on guest write Denis Plotnikov
2019-12-24 15:02 ` Stefano Garzarella

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).