aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorSteve Sistare <steven.sistare@oracle.com>2024-02-13 06:25:58 -0800
committerMichael S. Tsirkin <mst@redhat.com>2024-03-19 02:45:49 -0400
commitc4e8b5aed7cd18bb8377b6dd461e336688c5d503 (patch)
tree8c2e2128c1806348f18b36d9c9cf1bf6d1f34129
parentvirtio: reenable config if freezing device failed (diff)
downloadwireguard-linux-c4e8b5aed7cd18bb8377b6dd461e336688c5d503.tar.xz
wireguard-linux-c4e8b5aed7cd18bb8377b6dd461e336688c5d503.zip
vdpa: skip suspend/resume ops if not DRIVER_OK
If a vdpa device is not in state DRIVER_OK, then there is no driver state to preserve, so no need to call the suspend and resume driver ops. Suggested-by: Eugenio Perez Martin <eperezma@redhat.com>" Signed-off-by: Steve Sistare <steven.sistare@oracle.com> Message-Id: <1707834358-165470-1-git-send-email-steven.sistare@oracle.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Eugenio PĂ©rez <eperezma@redhat.com>
-rw-r--r--drivers/vhost/vdpa.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
index bc4a51e4638b..aef92a7c57f3 100644
--- a/drivers/vhost/vdpa.c
+++ b/drivers/vhost/vdpa.c
@@ -595,6 +595,9 @@ static long vhost_vdpa_suspend(struct vhost_vdpa *v)
const struct vdpa_config_ops *ops = vdpa->config;
int ret;
+ if (!(ops->get_status(vdpa) & VIRTIO_CONFIG_S_DRIVER_OK))
+ return 0;
+
if (!ops->suspend)
return -EOPNOTSUPP;
@@ -615,6 +618,9 @@ static long vhost_vdpa_resume(struct vhost_vdpa *v)
const struct vdpa_config_ops *ops = vdpa->config;
int ret;
+ if (!(ops->get_status(vdpa) & VIRTIO_CONFIG_S_DRIVER_OK))
+ return 0;
+
if (!ops->resume)
return -EOPNOTSUPP;