diff mbox series

[PULL,08/21] vdpa: do not set virtio status bits if unneeded

Message ID e6ed6d80556c66e2f76b8c6975c5abe2ace5ca90.1703582625.git.mst@redhat.com (mailing list archive)
State New, archived
Headers show
Series [PULL,01/21] virtio: rng: Check notifier helpers for VIRTIO_CONFIG_IRQ_IDX | expand

Commit Message

Michael S. Tsirkin Dec. 26, 2023, 9:24 a.m. UTC
From: Eugenio Pérez <eperezma@redhat.com>

Next commits will set DRIVER and ACKNOWLEDGE flags repeatedly in the
case of a migration destination.  Let's save ioctls with this.

Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Message-Id: <20231215172830.2540987-2-eperezma@redhat.com>
---
 hw/virtio/vhost-vdpa.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
index 819b2d811a..401dfa96fd 100644
--- a/hw/virtio/vhost-vdpa.c
+++ b/hw/virtio/vhost-vdpa.c
@@ -511,6 +511,10 @@  static int vhost_vdpa_add_status(struct vhost_dev *dev, uint8_t status)
     if (ret < 0) {
         return ret;
     }
+    if ((s & status) == status) {
+        /* Don't set bits already set */
+        return 0;
+    }
 
     s |= status;