45 lines
1.5 KiB
Diff
45 lines
1.5 KiB
Diff
From 11c0e08a95c35adec07e3b40d1bd9452d7113236 Mon Sep 17 00:00:00 2001
|
|
From: jiangdongxu <jiangdongxu1@huawei.com>
|
|
Date: Thu, 14 Dec 2023 11:05:52 +0800
|
|
Subject: [PATCH] vdpa: set vring enable only if the vring address has already
|
|
been set
|
|
|
|
Currently, vhost-vdpa does not determine the status of each vring when
|
|
performing the enable operation on vring. When the vBIOS(EDK2) is running,
|
|
the driver will not enable all vrings. In this case, setting all vrings
|
|
to enable is isconsistent with the actual situation.
|
|
|
|
Add logic when enabling vring, make a judement on the vring status. If the
|
|
vring address is not set, the vring will not enabled.
|
|
|
|
Signed-off-by: jiangdongxu <jiangdongxu1@huawei.com>
|
|
---
|
|
hw/virtio/vhost-vdpa.c | 9 +++++++++
|
|
1 file changed, 9 insertions(+)
|
|
|
|
diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
|
|
index c7aaff7f20..36ed0c9a99 100644
|
|
--- a/hw/virtio/vhost-vdpa.c
|
|
+++ b/hw/virtio/vhost-vdpa.c
|
|
@@ -714,8 +714,17 @@ static int vhost_vdpa_get_vq_index(struct vhost_dev *dev, int idx)
|
|
static int vhost_vdpa_set_vring_ready(struct vhost_dev *dev)
|
|
{
|
|
int i;
|
|
+ int idx;
|
|
+ hwaddr addr;
|
|
+
|
|
trace_vhost_vdpa_set_vring_ready(dev);
|
|
for (i = 0; i < dev->nvqs; ++i) {
|
|
+ idx = vhost_vdpa_get_vq_index(dev, dev->vq_index + i);
|
|
+ addr = virtio_queue_get_desc_addr(dev->vdev, idx);
|
|
+ if (addr == 0) {
|
|
+ continue;
|
|
+ }
|
|
+
|
|
struct vhost_vring_state state = {
|
|
.index = dev->vq_index + i,
|
|
.num = 1,
|
|
--
|
|
2.27.0
|
|
|