linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V1] vdpa: suspend and resume require DRIVER_OK
@ 2024-02-09 22:29 Steve Sistare
  2024-02-12  8:19 ` Michael S. Tsirkin
  0 siblings, 1 reply; 8+ messages in thread
From: Steve Sistare @ 2024-02-09 22:29 UTC (permalink / raw)
  To: virtualization, linux-kernel
  Cc: Michael S. Tsirkin, Jason Wang, Si-Wei Liu, Eugenio Perez Martin,
	Stefano Garzarella, Steve Sistare

Calling suspend or resume requires VIRTIO_CONFIG_S_DRIVER_OK, for all
vdpa devices.

Suggested-by: Eugenio Perez Martin <eperezma@redhat.com>"
Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
---
 drivers/vhost/vdpa.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
index bc4a51e4638b..ce1882acfc3b 100644
--- a/drivers/vhost/vdpa.c
+++ b/drivers/vhost/vdpa.c
@@ -598,6 +598,9 @@ static long vhost_vdpa_suspend(struct vhost_vdpa *v)
 	if (!ops->suspend)
 		return -EOPNOTSUPP;
 
+	if (!(ops->get_status(vdpa) & VIRTIO_CONFIG_S_DRIVER_OK))
+		return -EINVAL;
+
 	ret = ops->suspend(vdpa);
 	if (!ret)
 		v->suspended = true;
@@ -618,6 +621,9 @@ static long vhost_vdpa_resume(struct vhost_vdpa *v)
 	if (!ops->resume)
 		return -EOPNOTSUPP;
 
+	if (!(ops->get_status(vdpa) & VIRTIO_CONFIG_S_DRIVER_OK))
+		return -EINVAL;
+
 	ret = ops->resume(vdpa);
 	if (!ret)
 		v->suspended = false;
-- 
2.39.3


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

end of thread, other threads:[~2024-02-13  8:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-09 22:29 [PATCH V1] vdpa: suspend and resume require DRIVER_OK Steve Sistare
2024-02-12  8:19 ` Michael S. Tsirkin
2024-02-12 14:56   ` Steven Sistare
2024-02-12 15:56     ` Michael S. Tsirkin
2024-02-12 16:37       ` Steven Sistare
2024-02-13  0:06         ` Michael S. Tsirkin
2024-02-13  7:49   ` Eugenio Perez Martin
2024-02-13  8:08     ` Eugenio Perez Martin

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