Commit 3b326b4a authored by jiangdongxu's avatar jiangdongxu Committed by Jiang Dongxu
Browse files

vdpa: add CONFIG_VHOST_VDPA_MIGRATION

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: default avatarjiangdongxu <jiangdongxu1@huawei.com>
parent 10606656
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -6396,6 +6396,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

#
+1 −0
Original line number Diff line number Diff line
@@ -7073,6 +7073,7 @@ CONFIG_VHOST_MENU=y
CONFIG_VHOST_NET=m
# CONFIG_VHOST_SCSI is not set
CONFIG_VHOST_VSOCK=m
# CONFIG_VHOST_VDPA_MIGRATION is not set
# CONFIG_VHOST_CROSS_ENDIAN_LEGACY is not set

#
+11 −0
Original line number Diff line number Diff line
@@ -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
+6 −0
Original line number Diff line number Diff line
@@ -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)