computing-offload/generic_vdpa/qemu/vhost-add-vhost_dev_suspend-resume_op.patch
jiangdongxu 79c4324644 add generic_vdpa basecode
Change-Id: I2d302dda68298877c65c99147f5bf22186a59aac
2024-09-19 17:19:46 +08:00

65 lines
2.5 KiB
Diff

From 745bbf64b2a1e74366550bffbb68da1df2a9f378 Mon Sep 17 00:00:00 2001
From: fangyi <eric.fangyi@huawei.com>
Date: Mon, 4 Dec 2023 15:13:41 +0800
Subject: [PATCH] vhost: add vhost_dev_suspend/resume_op
Signed-off-by: jiangdongxu <jiangdongxu1@huawei.com>
Signed-off-by: fangyi <eric.fangyi@huawei.com>
---
include/hw/virtio/vhost-backend.h | 5 +++++
linux-headers/linux/vhost.h | 17 +++++++++++++++++
2 files changed, 22 insertions(+)
diff --git a/include/hw/virtio/vhost-backend.h b/include/hw/virtio/vhost-backend.h
index 86154dd0b2..2ca6250567 100644
--- a/include/hw/virtio/vhost-backend.h
+++ b/include/hw/virtio/vhost-backend.h
@@ -135,6 +135,9 @@ typedef int (*vhost_set_config_call_op)(struct vhost_dev *dev,
typedef void (*vhost_set_used_memslots_op)(struct vhost_dev *dev);
typedef unsigned int (*vhost_get_used_memslots_op)(void);
+typedef int (*vhost_dev_suspend_op)(struct vhost_dev *dev);
+typedef int (*vhost_dev_resume_op)(struct vhost_dev *dev);
+
typedef struct VhostOps {
VhostBackendType backend_type;
vhost_backend_init vhost_backend_init;
@@ -186,6 +189,8 @@ typedef struct VhostOps {
vhost_set_config_call_op vhost_set_config_call;
vhost_set_used_memslots_op vhost_set_used_memslots;
vhost_get_used_memslots_op vhost_get_used_memslots;
+ vhost_dev_suspend_op vhost_dev_suspend;
+ vhost_dev_resume_op vhost_dev_resume;
} VhostOps;
int vhost_backend_update_device_iotlb(struct vhost_dev *dev,
diff --git a/linux-headers/linux/vhost.h b/linux-headers/linux/vhost.h
index 65c6b49788..9b3f71b20f 100644
--- a/linux-headers/linux/vhost.h
+++ b/linux-headers/linux/vhost.h
@@ -175,4 +175,21 @@
#define VHOST_VDPA_SET_GROUP_ASID _IOW(VHOST_VIRTIO, 0x7C, \
struct vhost_vring_state)
+/* Suspend a device so it does not process virtqueue requests anymore
+ *
+ * After the return of ioctl the device must preserve all the necessary state
+ * (the virtqueue vring base plus the possible device specific states) that is
+ * required for restoring in the future. The device must not change its
+ * configuration after that point.
+ */
+#define VHOST_VDPA_SUSPEND _IO(VHOST_VIRTIO, 0x7D)
+
+/* Resume a device so it can resume processing virtqueue requests
+ *
+ * After the return of this ioctl the device will have restored all the
+ * necessary states and it is fully operational to continue processing the
+ * virtqueue descriptors.
+ */
+#define VHOST_VDPA_RESUME _IO(VHOST_VIRTIO, 0x7E)
+
#endif
--
2.27.0