From: jiangdongxu jiangdongxu1@huawei.com
virt inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I8TP8X
----------------------------------------------------------------------
Add CONFIG_VHOST_VDPA_MIGRATION to control vdpa migration code compile or not.
Signed-off-by: jiangdongxu jiangdongxu1@huawei.com --- arch/arm64/configs/openeuler_defconfig | 1 + drivers/vhost/Kconfig | 11 +++++++++++ drivers/vhost/vdpa.c | 6 ++++++ 3 files changed, 18 insertions(+)
diff --git a/arch/arm64/configs/openeuler_defconfig b/arch/arm64/configs/openeuler_defconfig index 2ddea5999010..aed04c56f267 100644 --- a/arch/arm64/configs/openeuler_defconfig +++ b/arch/arm64/configs/openeuler_defconfig @@ -6385,6 +6385,7 @@ CONFIG_VHOST_NET=m CONFIG_VHOST_SCSI=m CONFIG_VHOST_VSOCK=m CONFIG_VHOST_VDPA=m +# CONFIG_VHOST_VDPA_MIGRATION is not set # CONFIG_VHOST_CROSS_ENDIAN_LEGACY is not set
# diff --git a/drivers/vhost/Kconfig b/drivers/vhost/Kconfig index b455d9ab6f3d..90301436b41e 100644 --- a/drivers/vhost/Kconfig +++ b/drivers/vhost/Kconfig @@ -79,6 +79,17 @@ config VHOST_VDPA To compile this driver as a module, choose M here: the module will be called vhost_vdpa.
+config VHOST_VDPA_MIGRATION + tristate "vdpa migration support for vhost-vdpa" + default n + help + This option allows vhost vdpa to support migration. + Userspace programs can migration vdpa device using + VHOST_SET_LOG_BASE/VHOST_SET_LOG_SIZE/VHOST_LOG_SYNC/VHOST_LOG_SYNC/ + VHOST_LOG_SYNC/VHOST_GET_DEV_BUFFER_SIZE ioctls. + + This is only support arm64 platform. + config VHOST_CROSS_ENDIAN_LEGACY bool "Cross-endian support for vhost" default n diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c index 7bef364935b2..d22d6623aebd 100644 --- a/drivers/vhost/vdpa.c +++ b/drivers/vhost/vdpa.c @@ -571,6 +571,7 @@ static long vhost_vdpa_resume(struct vhost_vdpa *v) return ops->resume(vdpa); }
+#ifdef CONFIG_VHOST_VDPA_MIGRATION static int vhost_vdpa_get_dev_buffer_size(struct vhost_vdpa *v, uint32_t __user *argp) { @@ -688,6 +689,7 @@ static long vhost_vdpa_log_sync(struct vhost_vdpa *v)
return ops->log_sync(vdpa); } +#endif
static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd, void __user *argp) @@ -864,6 +866,7 @@ static long vhost_vdpa_unlocked_ioctl(struct file *filep, r = -EFAULT; break; case VHOST_SET_LOG_BASE: +#ifdef CONFIG_VHOST_VDPA_MIGRATION r = vhost_vdpa_set_log_base(v, argp); break; case VHOST_SET_LOG_SIZE: @@ -872,6 +875,7 @@ static long vhost_vdpa_unlocked_ioctl(struct file *filep, case VHOST_LOG_SYNC: r = vhost_vdpa_log_sync(v); break; +#endif case VHOST_SET_LOG_FD: r = -ENOIOCTLCMD; break; @@ -903,6 +907,7 @@ static long vhost_vdpa_unlocked_ioctl(struct file *filep, case VHOST_VDPA_RESUME: r = vhost_vdpa_resume(v); break; +#ifdef CONFIG_VHOST_VDPA_MIGRATION case VHOST_GET_DEV_BUFFER_SIZE: r = vhost_vdpa_get_dev_buffer_size(v, argp); break; @@ -915,6 +920,7 @@ static long vhost_vdpa_unlocked_ioctl(struct file *filep, case VHOST_VDPA_SET_MIG_STATE: r = vhost_vdpa_set_mig_state(v, argp); break; +#endif default: r = vhost_dev_ioctl(&v->vdev, cmd, argp); if (r == -ENOIOCTLCMD)