79c4324644
Change-Id: I2d302dda68298877c65c99147f5bf22186a59aac
71 lines
2.6 KiB
Diff
71 lines
2.6 KiB
Diff
From d97454d68f90b441d3fa19c496a7fe6916f50e31 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= <eperezma@redhat.com>
|
|
Date: Fri, 3 Mar 2023 18:24:41 +0100
|
|
Subject: [PATCH] vdpa net: block migration if the device has CVQ
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
Devices with CVQ need to migrate state beyond vq state. Leaving this to
|
|
future series.
|
|
|
|
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
|
|
Message-Id: <20230303172445.1089785-11-eperezma@redhat.com>
|
|
Tested-by: Lei Yang <leiyang@redhat.com>
|
|
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
|
|
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
|
Signed-off-by: fangyi <eric.fangyi@huawei.com>
|
|
---
|
|
hw/virtio/vhost-vdpa.c | 1 +
|
|
include/hw/virtio/vhost-vdpa.h | 1 +
|
|
net/vhost-vdpa.c | 9 +++++++++
|
|
3 files changed, 11 insertions(+)
|
|
|
|
diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
|
|
index f5d816f5ec..dd1ba8878c 100644
|
|
--- a/hw/virtio/vhost-vdpa.c
|
|
+++ b/hw/virtio/vhost-vdpa.c
|
|
@@ -450,6 +450,7 @@ static int vhost_vdpa_init(struct vhost_dev *dev, void *opaque, Error **errp)
|
|
v->msg_type = VHOST_IOTLB_MSG_V2;
|
|
vhost_vdpa_init_svq(dev, v);
|
|
|
|
+ error_propagate(&dev->migration_blocker, v->migration_blocker);
|
|
if (!vhost_vdpa_first_dev(dev)) {
|
|
return 0;
|
|
}
|
|
diff --git a/include/hw/virtio/vhost-vdpa.h b/include/hw/virtio/vhost-vdpa.h
|
|
index 7997f09a8d..620a0f70ab 100644
|
|
--- a/include/hw/virtio/vhost-vdpa.h
|
|
+++ b/include/hw/virtio/vhost-vdpa.h
|
|
@@ -48,6 +48,7 @@ typedef struct vhost_vdpa {
|
|
const VhostShadowVirtqueueOps *shadow_vq_ops;
|
|
void *shadow_vq_ops_opaque;
|
|
struct vhost_dev *dev;
|
|
+ Error *migration_blocker;
|
|
VhostVDPAHostNotifier notifier[VIRTIO_QUEUE_MAX];
|
|
} VhostVDPA;
|
|
|
|
diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
|
|
index 8192045735..dc1b4c4be2 100644
|
|
--- a/net/vhost-vdpa.c
|
|
+++ b/net/vhost-vdpa.c
|
|
@@ -721,6 +721,15 @@ static NetClientState *net_vhost_vdpa_init(NetClientState *peer,
|
|
|
|
s->vhost_vdpa.shadow_vq_ops = &vhost_vdpa_net_svq_ops;
|
|
s->vhost_vdpa.shadow_vq_ops_opaque = s;
|
|
+
|
|
+ /*
|
|
+ * TODO: We cannot migrate devices with CVQ as there is no way to set
|
|
+ * the device state (MAC, MQ, etc) before starting the datapath.
|
|
+ *
|
|
+ * Migration blocker ownership now belongs to s->vhost_vdpa.
|
|
+ */
|
|
+ error_setg(&s->vhost_vdpa.migration_blocker,
|
|
+ "net vdpa cannot migrate with CVQ feature");
|
|
}
|
|
ret = vhost_vdpa_add(nc, (void *)&s->vhost_vdpa, queue_pair_index, nvqs);
|
|
if (ret) {
|
|
--
|
|
2.27.0
|
|
|