[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 04/40] vdpa: piggyback desc_group index when probing isolated cvq
From: |
Si-Wei Liu |
Subject: |
[PATCH 04/40] vdpa: piggyback desc_group index when probing isolated cvq |
Date: |
Thu, 7 Dec 2023 09:39:17 -0800 |
Same as the previous commit, but do it for cvq instead of data vqs.
Signed-off-by: Si-Wei Liu <si-wei.liu@oracle.com>
---
net/vhost-vdpa.c | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index 0cf3147..cb5705d 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -1601,16 +1601,19 @@ static const VhostShadowVirtqueueOps
vhost_vdpa_net_svq_ops = {
};
/**
- * Probe if CVQ is isolated
+ * Probe if CVQ is isolated, and piggyback its descriptor group
+ * index if supported
*
* @device_fd The vdpa device fd
* @features Features offered by the device.
* @cvq_index The control vq pair index
+ * @desc_grpidx The CVQ's descriptor group index to return
*
- * Returns <0 in case of failure, 0 if false and 1 if true.
+ * Returns <0 in case of failure, 0 if false and 1 if true (isolated).
*/
static int vhost_vdpa_probe_cvq_isolation(int device_fd, uint64_t features,
- int cvq_index, Error **errp)
+ int cvq_index, int64_t *desc_grpidx,
+ Error **errp)
{
uint64_t backend_features;
int64_t cvq_group;
@@ -1667,6 +1670,13 @@ static int vhost_vdpa_probe_cvq_isolation(int device_fd,
uint64_t features,
goto out;
}
+ if (backend_features & BIT_ULL(VHOST_BACKEND_F_DESC_ASID)) {
+ int64_t desc_group = vhost_vdpa_get_vring_desc_group(device_fd,
+ cvq_index, errp);
+ if (likely(desc_group >= 0) && desc_group != cvq_group)
+ *desc_grpidx = desc_group;
+ }
+
for (int i = 0; i < cvq_index; ++i) {
int64_t group = vhost_vdpa_get_vring_group(device_fd, i, errp);
if (unlikely(group < 0)) {
@@ -1685,6 +1695,8 @@ static int vhost_vdpa_probe_cvq_isolation(int device_fd,
uint64_t features,
out:
status = 0;
ioctl(device_fd, VHOST_VDPA_SET_STATUS, &status);
+ status = VIRTIO_CONFIG_S_ACKNOWLEDGE | VIRTIO_CONFIG_S_DRIVER;
+ ioctl(device_fd, VHOST_VDPA_SET_STATUS, &status);
return r;
}
@@ -1791,6 +1803,7 @@ static NetClientState *net_vhost_vdpa_init(NetClientState
*peer,
Error **errp)
{
NetClientState *nc = NULL;
+ int64_t desc_group = -1;
VhostVDPAState *s;
int ret = 0;
assert(name);
@@ -1802,7 +1815,7 @@ static NetClientState *net_vhost_vdpa_init(NetClientState
*peer,
} else {
cvq_isolated = vhost_vdpa_probe_cvq_isolation(vdpa_device_fd, features,
queue_pair_index * 2,
- errp);
+ &desc_group, errp);
if (unlikely(cvq_isolated < 0)) {
return NULL;
}
--
1.8.3.1
- [PATCH 05/40] vdpa: populate desc_group from net_vhost_vdpa_init, (continued)
- [PATCH 05/40] vdpa: populate desc_group from net_vhost_vdpa_init, Si-Wei Liu, 2023/12/07
- [PATCH 03/40] vdpa: probe descriptor group index for data vqs, Si-Wei Liu, 2023/12/07
- [PATCH 02/40] vdpa: add vhost_vdpa_get_vring_desc_group, Si-Wei Liu, 2023/12/07
- [PATCH 06/40] vhost: make svq work with gpa without iova translation, Si-Wei Liu, 2023/12/07
- [PATCH 07/40] vdpa: move around vhost_vdpa_set_address_space_id, Si-Wei Liu, 2023/12/07
- [PATCH 04/40] vdpa: piggyback desc_group index when probing isolated cvq,
Si-Wei Liu <=
- [PATCH 09/40] vdpa: no repeat setting shadow_data, Si-Wei Liu, 2023/12/07
- [PATCH 10/40] vdpa: assign svq descriptors a separate ASID when possible, Si-Wei Liu, 2023/12/07
- [PATCH 13/40] vdpa: ref counting VhostVDPAShared, Si-Wei Liu, 2023/12/07
- [PATCH 14/40] vdpa: convert iova_tree to ref count based, Si-Wei Liu, 2023/12/07
- [PATCH 15/40] vdpa: add svq_switching and flush_map to header, Si-Wei Liu, 2023/12/07
- [PATCH 12/40] vdpa: check map_thread_enabled before join maps thread, Si-Wei Liu, 2023/12/07
- [PATCH 11/40] vdpa: factor out vhost_vdpa_last_dev, Si-Wei Liu, 2023/12/07