|
|
7f1c5b |
From 63a45add7c9f7bb2b7775ae4cb2d7df22f7f2033 Mon Sep 17 00:00:00 2001
|
|
|
7f1c5b |
From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= <eperezma@redhat.com>
|
|
|
7f1c5b |
Date: Thu, 15 Dec 2022 12:31:39 +0100
|
|
|
7f1c5b |
Subject: [PATCH 07/14] vdpa: move SVQ vring features check to net/
|
|
|
7f1c5b |
MIME-Version: 1.0
|
|
|
7f1c5b |
Content-Type: text/plain; charset=UTF-8
|
|
|
7f1c5b |
Content-Transfer-Encoding: 8bit
|
|
|
7f1c5b |
|
|
|
7f1c5b |
RH-Author: Eugenio Pérez <eperezma@redhat.com>
|
|
|
7f1c5b |
RH-MergeRequest: 136: vDPA ASID support in Qemu
|
|
|
7f1c5b |
RH-Bugzilla: 2104412
|
|
|
7f1c5b |
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
|
|
|
7f1c5b |
RH-Acked-by: Cindy Lu <lulu@redhat.com>
|
|
|
7f1c5b |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
7f1c5b |
RH-Commit: [7/13] a24189aea4dbde3ed4486f685d0d88aeee1a0ee7 (eperezmartin/qemu-kvm)
|
|
|
7f1c5b |
|
|
|
7f1c5b |
The next patches will start control SVQ if possible. However, we don't
|
|
|
7f1c5b |
know if that will be possible at qemu boot anymore.
|
|
|
7f1c5b |
|
|
|
7f1c5b |
Since the moved checks will be already evaluated at net/ to know if it
|
|
|
7f1c5b |
is ok to shadow CVQ, move them.
|
|
|
7f1c5b |
|
|
|
7f1c5b |
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
|
|
|
7f1c5b |
Acked-by: Jason Wang <jasowang@redhat.com>
|
|
|
7f1c5b |
Message-Id: <20221215113144.322011-8-eperezma@redhat.com>
|
|
|
7f1c5b |
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
7f1c5b |
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
7f1c5b |
(cherry picked from commit 258a03941fd23108a322d09abc9c55341e09688d)
|
|
|
7f1c5b |
---
|
|
|
7f1c5b |
hw/virtio/vhost-vdpa.c | 32 ++------------------------------
|
|
|
7f1c5b |
net/vhost-vdpa.c | 3 ++-
|
|
|
7f1c5b |
2 files changed, 4 insertions(+), 31 deletions(-)
|
|
|
7f1c5b |
|
|
|
7f1c5b |
diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
|
|
|
7f1c5b |
index 9e7cbf1776..84218ce078 100644
|
|
|
7f1c5b |
--- a/hw/virtio/vhost-vdpa.c
|
|
|
7f1c5b |
+++ b/hw/virtio/vhost-vdpa.c
|
|
|
7f1c5b |
@@ -389,29 +389,9 @@ static int vhost_vdpa_get_dev_features(struct vhost_dev *dev,
|
|
|
7f1c5b |
return ret;
|
|
|
7f1c5b |
}
|
|
|
7f1c5b |
|
|
|
7f1c5b |
-static int vhost_vdpa_init_svq(struct vhost_dev *hdev, struct vhost_vdpa *v,
|
|
|
7f1c5b |
- Error **errp)
|
|
|
7f1c5b |
+static void vhost_vdpa_init_svq(struct vhost_dev *hdev, struct vhost_vdpa *v)
|
|
|
7f1c5b |
{
|
|
|
7f1c5b |
g_autoptr(GPtrArray) shadow_vqs = NULL;
|
|
|
7f1c5b |
- uint64_t dev_features, svq_features;
|
|
|
7f1c5b |
- int r;
|
|
|
7f1c5b |
- bool ok;
|
|
|
7f1c5b |
-
|
|
|
7f1c5b |
- if (!v->shadow_vqs_enabled) {
|
|
|
7f1c5b |
- return 0;
|
|
|
7f1c5b |
- }
|
|
|
7f1c5b |
-
|
|
|
7f1c5b |
- r = vhost_vdpa_get_dev_features(hdev, &dev_features);
|
|
|
7f1c5b |
- if (r != 0) {
|
|
|
7f1c5b |
- error_setg_errno(errp, -r, "Can't get vdpa device features");
|
|
|
7f1c5b |
- return r;
|
|
|
7f1c5b |
- }
|
|
|
7f1c5b |
-
|
|
|
7f1c5b |
- svq_features = dev_features;
|
|
|
7f1c5b |
- ok = vhost_svq_valid_features(svq_features, errp);
|
|
|
7f1c5b |
- if (unlikely(!ok)) {
|
|
|
7f1c5b |
- return -1;
|
|
|
7f1c5b |
- }
|
|
|
7f1c5b |
|
|
|
7f1c5b |
shadow_vqs = g_ptr_array_new_full(hdev->nvqs, vhost_svq_free);
|
|
|
7f1c5b |
for (unsigned n = 0; n < hdev->nvqs; ++n) {
|
|
|
7f1c5b |
@@ -422,7 +402,6 @@ static int vhost_vdpa_init_svq(struct vhost_dev *hdev, struct vhost_vdpa *v,
|
|
|
7f1c5b |
}
|
|
|
7f1c5b |
|
|
|
7f1c5b |
v->shadow_vqs = g_steal_pointer(&shadow_vqs);
|
|
|
7f1c5b |
- return 0;
|
|
|
7f1c5b |
}
|
|
|
7f1c5b |
|
|
|
7f1c5b |
static int vhost_vdpa_init(struct vhost_dev *dev, void *opaque, Error **errp)
|
|
|
7f1c5b |
@@ -447,10 +426,7 @@ static int vhost_vdpa_init(struct vhost_dev *dev, void *opaque, Error **errp)
|
|
|
7f1c5b |
dev->opaque = opaque ;
|
|
|
7f1c5b |
v->listener = vhost_vdpa_memory_listener;
|
|
|
7f1c5b |
v->msg_type = VHOST_IOTLB_MSG_V2;
|
|
|
7f1c5b |
- ret = vhost_vdpa_init_svq(dev, v, errp);
|
|
|
7f1c5b |
- if (ret) {
|
|
|
7f1c5b |
- goto err;
|
|
|
7f1c5b |
- }
|
|
|
7f1c5b |
+ vhost_vdpa_init_svq(dev, v);
|
|
|
7f1c5b |
|
|
|
7f1c5b |
if (!vhost_vdpa_first_dev(dev)) {
|
|
|
7f1c5b |
return 0;
|
|
|
7f1c5b |
@@ -460,10 +436,6 @@ static int vhost_vdpa_init(struct vhost_dev *dev, void *opaque, Error **errp)
|
|
|
7f1c5b |
VIRTIO_CONFIG_S_DRIVER);
|
|
|
7f1c5b |
|
|
|
7f1c5b |
return 0;
|
|
|
7f1c5b |
-
|
|
|
7f1c5b |
-err:
|
|
|
7f1c5b |
- ram_block_discard_disable(false);
|
|
|
7f1c5b |
- return ret;
|
|
|
7f1c5b |
}
|
|
|
7f1c5b |
|
|
|
7f1c5b |
static void vhost_vdpa_host_notifier_uninit(struct vhost_dev *dev,
|
|
|
7f1c5b |
diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
|
|
|
7f1c5b |
index 8d3ed095d0..85aa0da39a 100644
|
|
|
7f1c5b |
--- a/net/vhost-vdpa.c
|
|
|
7f1c5b |
+++ b/net/vhost-vdpa.c
|
|
|
7f1c5b |
@@ -117,9 +117,10 @@ static bool vhost_vdpa_net_valid_svq_features(uint64_t features, Error **errp)
|
|
|
7f1c5b |
if (invalid_dev_features) {
|
|
|
7f1c5b |
error_setg(errp, "vdpa svq does not work with features 0x%" PRIx64,
|
|
|
7f1c5b |
invalid_dev_features);
|
|
|
7f1c5b |
+ return false;
|
|
|
7f1c5b |
}
|
|
|
7f1c5b |
|
|
|
7f1c5b |
- return !invalid_dev_features;
|
|
|
7f1c5b |
+ return vhost_svq_valid_features(features, errp);
|
|
|
7f1c5b |
}
|
|
|
7f1c5b |
|
|
|
7f1c5b |
static int vhost_vdpa_net_check_device_id(struct vhost_net *net)
|
|
|
7f1c5b |
--
|
|
|
7f1c5b |
2.31.1
|
|
|
7f1c5b |
|