|
|
29b115 |
From 58acdab17ec00ab76105ab92a51c5ba4dec3df5a Mon Sep 17 00:00:00 2001
|
|
|
29b115 |
From: Si-Wei Liu <si-wei.liu@oracle.com>
|
|
|
29b115 |
Date: Fri, 6 May 2022 19:28:17 -0700
|
|
|
29b115 |
Subject: [PATCH 13/16] vhost-vdpa: change name and polarity for
|
|
|
29b115 |
vhost_vdpa_one_time_request()
|
|
|
29b115 |
MIME-Version: 1.0
|
|
|
29b115 |
Content-Type: text/plain; charset=UTF-8
|
|
|
29b115 |
Content-Transfer-Encoding: 8bit
|
|
|
29b115 |
|
|
|
29b115 |
RH-Author: Jason Wang <jasowang@redhat.com>
|
|
|
29b115 |
RH-MergeRequest: 98: Multiqueue fixes for vhost-vDPA
|
|
|
29b115 |
RH-Commit: [6/7] 7029778f463a136ff412c63b86b6953390e47bf8 (jasowang/qemu-kvm-cs)
|
|
|
29b115 |
RH-Bugzilla: 2070804
|
|
|
29b115 |
RH-Acked-by: Eugenio PĂ©rez <eperezma@redhat.com>
|
|
|
29b115 |
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
|
|
|
29b115 |
RH-Acked-by: Cindy Lu <lulu@redhat.com>
|
|
|
29b115 |
|
|
|
29b115 |
The name vhost_vdpa_one_time_request() was confusing. No
|
|
|
29b115 |
matter whatever it returns, its typical occurrence had
|
|
|
29b115 |
always been at requests that only need to be applied once.
|
|
|
29b115 |
And the name didn't suggest what it actually checks for.
|
|
|
29b115 |
Change it to vhost_vdpa_first_dev() with polarity flipped
|
|
|
29b115 |
for better readibility of code. That way it is able to
|
|
|
29b115 |
reflect what the check is really about.
|
|
|
29b115 |
|
|
|
29b115 |
This call is applicable to request which performs operation
|
|
|
29b115 |
only once, before queues are set up, and usually at the beginning
|
|
|
29b115 |
of the caller function. Document the requirement for it in place.
|
|
|
29b115 |
|
|
|
29b115 |
Signed-off-by: Si-Wei Liu <si-wei.liu@oracle.com>
|
|
|
29b115 |
Message-Id: <1651890498-24478-7-git-send-email-si-wei.liu@oracle.com>
|
|
|
29b115 |
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
29b115 |
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
29b115 |
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
|
|
|
29b115 |
Acked-by: Jason Wang <jasowang@redhat.com>
|
|
|
29b115 |
(cherry picked from commit d71b0609fc04217e28d17009f04d74b08be6f466)
|
|
|
29b115 |
Signed-off-by: Jason Wang <jasowang@redhat.com>
|
|
|
29b115 |
---
|
|
|
29b115 |
hw/virtio/vhost-vdpa.c | 23 +++++++++++++++--------
|
|
|
29b115 |
1 file changed, 15 insertions(+), 8 deletions(-)
|
|
|
29b115 |
|
|
|
29b115 |
diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
|
|
|
29b115 |
index 6e3dbd9e89..33dcaa135e 100644
|
|
|
29b115 |
--- a/hw/virtio/vhost-vdpa.c
|
|
|
29b115 |
+++ b/hw/virtio/vhost-vdpa.c
|
|
|
29b115 |
@@ -366,11 +366,18 @@ static void vhost_vdpa_get_iova_range(struct vhost_vdpa *v)
|
|
|
29b115 |
v->iova_range.last);
|
|
|
29b115 |
}
|
|
|
29b115 |
|
|
|
29b115 |
-static bool vhost_vdpa_one_time_request(struct vhost_dev *dev)
|
|
|
29b115 |
+/*
|
|
|
29b115 |
+ * The use of this function is for requests that only need to be
|
|
|
29b115 |
+ * applied once. Typically such request occurs at the beginning
|
|
|
29b115 |
+ * of operation, and before setting up queues. It should not be
|
|
|
29b115 |
+ * used for request that performs operation until all queues are
|
|
|
29b115 |
+ * set, which would need to check dev->vq_index_end instead.
|
|
|
29b115 |
+ */
|
|
|
29b115 |
+static bool vhost_vdpa_first_dev(struct vhost_dev *dev)
|
|
|
29b115 |
{
|
|
|
29b115 |
struct vhost_vdpa *v = dev->opaque;
|
|
|
29b115 |
|
|
|
29b115 |
- return v->index != 0;
|
|
|
29b115 |
+ return v->index == 0;
|
|
|
29b115 |
}
|
|
|
29b115 |
|
|
|
29b115 |
static int vhost_vdpa_get_dev_features(struct vhost_dev *dev,
|
|
|
29b115 |
@@ -451,7 +458,7 @@ static int vhost_vdpa_init(struct vhost_dev *dev, void *opaque, Error **errp)
|
|
|
29b115 |
|
|
|
29b115 |
vhost_vdpa_get_iova_range(v);
|
|
|
29b115 |
|
|
|
29b115 |
- if (vhost_vdpa_one_time_request(dev)) {
|
|
|
29b115 |
+ if (!vhost_vdpa_first_dev(dev)) {
|
|
|
29b115 |
return 0;
|
|
|
29b115 |
}
|
|
|
29b115 |
|
|
|
29b115 |
@@ -594,7 +601,7 @@ static int vhost_vdpa_memslots_limit(struct vhost_dev *dev)
|
|
|
29b115 |
static int vhost_vdpa_set_mem_table(struct vhost_dev *dev,
|
|
|
29b115 |
struct vhost_memory *mem)
|
|
|
29b115 |
{
|
|
|
29b115 |
- if (vhost_vdpa_one_time_request(dev)) {
|
|
|
29b115 |
+ if (!vhost_vdpa_first_dev(dev)) {
|
|
|
29b115 |
return 0;
|
|
|
29b115 |
}
|
|
|
29b115 |
|
|
|
29b115 |
@@ -623,7 +630,7 @@ static int vhost_vdpa_set_features(struct vhost_dev *dev,
|
|
|
29b115 |
struct vhost_vdpa *v = dev->opaque;
|
|
|
29b115 |
int ret;
|
|
|
29b115 |
|
|
|
29b115 |
- if (vhost_vdpa_one_time_request(dev)) {
|
|
|
29b115 |
+ if (!vhost_vdpa_first_dev(dev)) {
|
|
|
29b115 |
return 0;
|
|
|
29b115 |
}
|
|
|
29b115 |
|
|
|
29b115 |
@@ -665,7 +672,7 @@ static int vhost_vdpa_set_backend_cap(struct vhost_dev *dev)
|
|
|
29b115 |
|
|
|
29b115 |
features &= f;
|
|
|
29b115 |
|
|
|
29b115 |
- if (!vhost_vdpa_one_time_request(dev)) {
|
|
|
29b115 |
+ if (vhost_vdpa_first_dev(dev)) {
|
|
|
29b115 |
r = vhost_vdpa_call(dev, VHOST_SET_BACKEND_FEATURES, &features);
|
|
|
29b115 |
if (r) {
|
|
|
29b115 |
return -EFAULT;
|
|
|
29b115 |
@@ -1118,7 +1125,7 @@ static int vhost_vdpa_set_log_base(struct vhost_dev *dev, uint64_t base,
|
|
|
29b115 |
struct vhost_log *log)
|
|
|
29b115 |
{
|
|
|
29b115 |
struct vhost_vdpa *v = dev->opaque;
|
|
|
29b115 |
- if (v->shadow_vqs_enabled || vhost_vdpa_one_time_request(dev)) {
|
|
|
29b115 |
+ if (v->shadow_vqs_enabled || !vhost_vdpa_first_dev(dev)) {
|
|
|
29b115 |
return 0;
|
|
|
29b115 |
}
|
|
|
29b115 |
|
|
|
29b115 |
@@ -1240,7 +1247,7 @@ static int vhost_vdpa_get_features(struct vhost_dev *dev,
|
|
|
29b115 |
|
|
|
29b115 |
static int vhost_vdpa_set_owner(struct vhost_dev *dev)
|
|
|
29b115 |
{
|
|
|
29b115 |
- if (vhost_vdpa_one_time_request(dev)) {
|
|
|
29b115 |
+ if (!vhost_vdpa_first_dev(dev)) {
|
|
|
29b115 |
return 0;
|
|
|
29b115 |
}
|
|
|
29b115 |
|
|
|
29b115 |
--
|
|
|
29b115 |
2.31.1
|
|
|
29b115 |
|