[PATCH 1/2] vdpa: add log operations

From: Jiang Dongxu
Date: Fri Aug 25 2023 - 21:25:15 EST


From: jiangdongxu <jiangdongxu1@xxxxxxxxxx>

Several new interfaces are introduced to allow vdpa
device logging guest memory during live migration and
return to the VMM.

The set_log_base interface is used to set the base
address for buffer storing bitmaps.

The set_log_size interface is used to set the size
of buffer used for storing bitmaps.

The log_sync interface is used to copy the bitmaps
from kernel space to user space of VMM.

These operations are optional. If they are not implemented,
these operations will return EOPNOTSUPP.

Signed-off-by: jiangdongxu <jiangdongxu1@xxxxxxxxxx>
---
include/linux/vdpa.h | 14 ++++++++++++++
1 file changed, 14 insertions(+)

diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h
index db1b0eaef4eb..985eed4f05b3 100644
--- a/include/linux/vdpa.h
+++ b/include/linux/vdpa.h
@@ -327,6 +327,15 @@ struct vdpa_map_file {
* @unbind_mm: Unbind the device from the address space
* bound using the bind_mm callback. (optional)
* @vdev: vdpa device
+ * @set_log_base Set base address for logging. (optional)
+ * @vdev: vdpa device
+ * @base: base address
+ * @set_log_size Set buffer size for logging. (optional)
+ * @vdev: vdpa device
+ * @size: logging buffer size
+ * @log_sync Synchronize logging buffer from kernel space to
+ * user space. (optional)
+ * @vdev: vdpa device
* @free: Free resources that belongs to vDPA (optional)
* @vdev: vdpa device
*/
@@ -396,6 +405,11 @@ struct vdpa_config_ops {
int (*bind_mm)(struct vdpa_device *vdev, struct mm_struct *mm);
void (*unbind_mm)(struct vdpa_device *vdev);

+ /* Log ops */
+ int (*set_log_base)(struct vdpa_device *vdev, uint64_t base);
+ int (*set_log_size)(struct vdpa_device *vdev, uint64_t size);
+ int (*log_sync)(struct vdpa_device *vdev);
+
/* Free device resources */
void (*free)(struct vdpa_device *vdev);
};
--
2.27.0