Skip to contentSkip to conversation

Implement initial driver for virtio-RDMA devices(kernel), virtio-rdma device model(qemu) and vhost-user-RDMA backend device(dpdk)

PATCH New [email protected] 1 participant 5 messages Dec 17, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi all,

This testing instructions aims to introduce an emulating a soft ROCE device with normal NIC(no RDMA), we have finished a vhost-user RDMA device demo, which can work with RDMA features such as CM, QP type of UC/UD and so on.

There are testing instructions of the demo:

1.Test Environment Configuration
Hardware Environment
Servers: 1 identically configured servers

CPU: HUAWEI Kunpeng 920 (96 cores)

Memory: 3T DDR4

NIC: TAP (paired virtio-net device for RDMA)

Software Environment
Server Host OS: 6.4.0-10.1.0.20.oe2309.aarch64

Kernel: linux-6.16.8 (with kernel-vrdma module)

QEMU: 9.0.2 (compiled with vhost-user-rdma virtual device support)

DPDK: 24.07.0-rc2

Dependencies:

rdma-core

rdma_rxe

libibverbs-dev

2. Test Procedures
a. Starting DPDK with vhost-user-rdma first:
1). Configure Hugepages
echo 2048 | sudo tee /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages
2). app start
/DPDKDIR/build/examples/dpdk-vhost_user_rdma -l 1-4 -n 4 --vdev "net_tap0" -- --socket-file /tmp/vhost-rdma0

b. Booting guest kernel with qemu, command line:
...
-netdev tap,id=hostnet1,ifname=tap1,script=no,downscript=no
-device virtio-net-pci,netdev=hostnet1,id=net1,mac=52:54:00:14:72:30,bus=pci.3,addr=0x0.0,multifunction=on -chardev socket,path=/tmp/vhost-rdma0,id=vurdma
-device vhost-user-rdma-pci,bus=pci.3,addr=0x0.1,page-per-vq=on,disable-legacy=on,chardev=vurdma
...

c. Guest Kernel Module Loading and Validation
# Load vhost_rdma kernel module
sudo modprobe vrdma

# Verify module loading
lsmod | grep vrdma

# Check kernel logs
dmesg | grep vhost_rdma

# Expected output:

[    4.935473] vrdma_init_device: Initializing vRDMA device with max_cq=64, max_qp=64
[    4.949888] [vrdma_init_device]: Successfully initialized, last qp_vq index=192
[    4.949907] [vrdma_init_netdev]: Found paired net_device 'enp3s0f0' (on 0000:03:00.0)
[    4.949924] Bound vRDMA device to net_device 'enp3s0f0'
[    5.026032] vrdma virtio2: vrdma_alloc_pd: allocated PD 1
[    5.028006] Successfully registered vRDMA device as 'vrdma0'
[    5.028020] [vrdma_probe]: Successfully probed VirtIO RDMA device (index=2)
[    5.028104] VirtIO RDMA driver initialized successfully

d. Inside VM, one rdma device fs node will be generated in /dev/infiniband:
[root@localhost ~]# ll -h /dev/infiniband/
total 0
drwxr-xr-x. 2 root root 60 Dec 17 11:24 by-ibdev
drwxr-xr-x. 2 root root 60 Dec 17 11:24 by-path
crw-rw-rw-. 1 root root 10, 259 Dec 17 11:24 rdma_cm crw-rw-rw-. 1 root root 231, 192 Dec 17 11:24 uverbs0

e. The following are to be done in the future version:
1). SRQ support
2). DPDK support for physical RDMA NIC for handling the datapath between front and backend 3). Reset of VirtQueue
4). Increase size of VirtQueue for PCI transport
5). Performance Testing

f. Test Results
1). Functional Test Results:
Kernel module loading PASS Module loaded without errors
DPDK startup PASS vhost-user-rdma backend initialized
QEMU VM launch PASS VM booted using RDMA device
Network connectivity PASS Host-VM communication established
RDMA device detection PASS Virtual RDMA device recognized

f.Test Conclusion
1). Full functional compliance with specifications 2). Stable operation under extended stress conditions

Recommendations:
1). Optimize memory copy paths for higher throughput 2). Enhance error handling and recovery mechanisms

#1 lore raw

PATCH 1/14 examples/vhost_user_rdma: implement core application initialization for supporting vhost_user_rdma device

From: xiongweimin <[email protected]>

This commit introduces the main initialization routine for vHost RDMA application built on DPDK. The implementation includes:

1. DPDK EAL environment initialization with proper signal handling
2. Argument parsing for application-specific configuration
3. Creation of shared memory resources:
- Packet buffer pools with per-core caching
- Optimized ring buffers for RX/TX with SP/MC synchronization flags
4. Backend network device detection and initialization
5. Worker thread launch across available cores
6. Multi-device support with shared/dedicated resource allocation
7. vHost device construction and driver registration

Key features:
- NUMA-aware resource allocation using rte_socket_id()
- Optimized ring flags (SP_ENQ, MC_HTS_DEQ) for lockless operation
- Graceful shutdown handling through signal interception
- Resource isolation for multi-device configurations

Change-Id I1a42aeaa04595d13fc392452c1c9ca3f97442acc
---
 examples/meson.build                      |   1 +
 examples/vhost_user_rdma/main.c           | 607 ++++++++++++++++++
 examples/vhost_user_rdma/meson.build      |  45 ++
 examples/vhost_user_rdma/vhost_rdma.c     | 697 +++++++++++++++++++++
 examples/vhost_user_rdma/vhost_rdma.h     | 444 ++++++++++++++
 examples/vhost_user_rdma/vhost_rdma_ib.c  | 647 ++++++++++++++++++++
 examples/vhost_user_rdma/vhost_rdma_ib.h  | 710 ++++++++++++++++++++++
 examples/vhost_user_rdma/vhost_rdma_log.h |  52 ++
 examples/vhost_user_rdma/vhost_rdma_pkt.h | 296 +++++++++
 9 files changed, 3499 insertions(+)
 create mode 100644 examples/vhost_user_rdma/main.c
 create mode 100644 examples/vhost_user_rdma/meson.build
 create mode 100644 examples/vhost_user_rdma/vhost_rdma.c
 create mode 100644 examples/vhost_user_rdma/vhost_rdma.h
 create mode 100644 examples/vhost_user_rdma/vhost_rdma_ib.c
 create mode 100644 examples/vhost_user_rdma/vhost_rdma_ib.h
 create mode 100644 examples/vhost_user_rdma/vhost_rdma_log.h
 create mode 100644 examples/vhost_user_rdma/vhost_rdma_pkt.h
examples/meson.build +1 -0
index 8e8968a1fa..780d49d4b4 100644
@@ -54,6 +54,7 @@ all_examples = [
         'vdpa',
         'vhost',
         'vhost_blk',
+        'vhost_user_rdma',
         'vhost_crypto',
         'vm_power_manager',
         'vm_power_manager/guest_cli',
examples/vhost_user_rdma/main.c new file +607 -0

607 lines not on this page · raw message

examples/vhost_user_rdma/meson.build new file +45 -0

45 lines not on this page · raw message

examples/vhost_user_rdma/vhost_rdma.c new file +697 -0

698 lines not on this page · raw message

examples/vhost_user_rdma/vhost_rdma.h new file +444 -0

445 lines not on this page · raw message

examples/vhost_user_rdma/vhost_rdma_ib.c new file +647 -0

648 lines not on this page · raw message

examples/vhost_user_rdma/vhost_rdma_ib.h new file +710 -0

550 lines not on this page · raw message

examples/vhost_user_rdma/vhost_rdma_log.h new file +52 -0

52 lines not on this page · raw message

examples/vhost_user_rdma/vhost_rdma_pkt.h new file +296 -0

296 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.43.0

Part of the diff is not shown here. View the raw message.

#2 lore raw

PATCH 2/14 examples/vhost_user_rdma: implement device and port query commands

In reply to [email protected]

From: xiongweimin <[email protected]>

Added RDMA control command handlers for:
- VHOST_RDMA_CTRL_ROCE_QUERY_DEVICE
- VHOST_RDMA_CTRL_ROCE_QUERY_PORT

Key features:
1. Device capability reporting:
- Maximum MR size and page size capabilities
- Queue Pair (QP) limits (max WR, SGE, CQE)
- Resource limits (MR, PD, AH counts)
- RDMA protocol capabilities

2. Port attribute reporting:
- GID table length and port state
- MTU settings (active, physical, maximum)
- Link speed and width capabilities
- Error counters and security attributes

3. Response validation:
- CHK_IOVEC macro ensures response buffer safety
- Fixed attribute values for standard RDMA v2 compliance
- Structured response formats matching IB specification

Change-Id I17ac65a0801ebf5e0b0d83a50877004a54840365
---
 examples/vhost_user_rdma/vhost_rdma_ib.c | 27 ++++++++++++
 examples/vhost_user_rdma/vhost_rdma_ib.h | 56 +++++++++++++++++++++++-
 2 files changed, 82 insertions(+), 1 deletion(-)
examples/vhost_user_rdma/vhost_rdma_ib.c +27 -0
index 5535a8696b..edb6e3fea3 100644
@@ -537,12 +537,39 @@ vhost_rdma_query_device(struct vhost_rdma_device *dev, CTRL_NO_CMD,
 	return 0;
 }
 
+static int
+vhost_rdma_query_port(__rte_unused struct vhost_rdma_device *dev,
+					CTRL_NO_CMD,
+					struct iovec *out)
+{
+	struct vhost_rdma_ack_query_port *rsp;
+
+	CHK_IOVEC(rsp, out);
+
+	rsp->gid_tbl_len = VHOST_MAX_GID_TBL_LEN;
+	rsp->max_msg_sz = 0x800000;
+	rsp->active_mtu = VHOST_RDMA_IB_MTU_256;
+	rsp->phys_mtu = VHOST_RDMA_IB_MTU_256;
+	rsp->port_cap_flags = 65536UL;
+	rsp->bad_pkey_cntr = 0UL;
+	rsp->phys_state = VHOST_RDMA_IB_PORT_PHYS_STATE_POLLING;
+	rsp->pkey_tbl_len = 1UL;
+	rsp->qkey_viol_cntr = 0UL;
+	rsp->state = VHOST_RDMA_IB_PORT_DOWN;
+	rsp->active_speed = 1UL;
+	rsp->active_width = VHOST_RDMA_IB_WIDTH_1X;
+	rsp->max_mtu = VHOST_RDMA_IB_MTU_4096;
+
+	return 0;
+}
+
 /* Command handler table declaration */
 struct {
 	int (*handler)(struct vhost_rdma_device *dev, struct iovec *in, struct iovec *out);
 	const char *name;  /* Name of the command (for logging) */
 } cmd_tbl[] = {
 	DEFINE_VIRTIO_RDMA_CMD(VHOST_RDMA_CTRL_ROCE_QUERY_DEVICE, vhost_rdma_query_device),
+	DEFINE_VIRTIO_RDMA_CMD(VHOST_RDMA_CTRL_ROCE_QUERY_PORT, vhost_rdma_query_port),
 };
 
 /**
examples/vhost_user_rdma/vhost_rdma_ib.h +55 -1

68 lines not on this page · raw message

Signature · 1 line
2.43.0
#3 lore raw

PATCH 3/14 examples/vhost_user_rdma: implement create and destroy completion queue commands

In reply to [email protected]

From: xiongweimin <[email protected]>

This commit adds core functionality for managing RDMA Completion Queues (CQs):
1. CREATE_CQ command handler with resource allocation and initialization
2. DESTROY_CQ command with safe teardown procedures
3. Reference counting for lifecycle management
4. Concurrency control via spinlocks
5. Integration with device resource pools

Key features:
- Strict validation of CQ size against device capabilities
- Atomic state management with is_dying flag
- Virtual queue index reset during destruction
- Error logging for allocation failures
- Memory-safe buffer handling with CHK_IOVEC

Change-Id Ie4b51c90f36a1ceadfe4dbc622dc6fcaaaaf4261
---
 examples/vhost_user_rdma/vhost_rdma_ib.c | 59 +++++++++++++++++++++++-
 examples/vhost_user_rdma/vhost_rdma_ib.h | 33 ++++++++++++-
 2 files changed, 89 insertions(+), 3 deletions(-)
examples/vhost_user_rdma/vhost_rdma_ib.c +57 -2
index edb6e3fea3..5ec0de8ae7 100644
@@ -563,13 +563,68 @@ vhost_rdma_query_port(__rte_unused struct vhost_rdma_device *dev,
 	return 0;
 }
 
+static int
+vhost_rdma_create_cq(struct vhost_rdma_device *dev,
+					struct iovec *in,
+					struct iovec *out)
+{
+	struct vhost_rdma_cmd_create_cq *create_cmd;
+	struct vhost_rdma_ack_create_cq *create_rsp;
+	struct vhost_rdma_cq *cq;
+	uint32_t cqn;
+
+	CHK_IOVEC(create_cmd, in);
+	if (create_cmd->cqe > dev->attr.max_cqe)
+		return -EINVAL;
+
+	CHK_IOVEC(create_rsp, out);
+
+	cq = vhost_rdma_pool_alloc(&dev->cq_pool, &cqn);
+	if (cq == NULL) {
+		RDMA_LOG_ERR("cq alloc failed");
+	}
+	vhost_rdma_ref_init(cq);
+
+	rte_spinlock_init(&cq->cq_lock);
+	cq->is_dying = false;
+	cq->notify = 0;
+	cq->vq = &dev->cq_vqs[cqn];
+	cq->cqn = cqn;
+	create_rsp->cqn = cqn;
+
+	return 0;
+}
+
+static int
+vhost_rdma_destroy_cq(struct vhost_rdma_device *dev, struct iovec *in, CTRL_NO_RSP)
+{
+	struct vhost_rdma_cmd_destroy_cq *destroy_cmd;
+	struct vhost_rdma_cq *cq;
+
+	CHK_IOVEC(destroy_cmd, in);
+
+	cq = vhost_rdma_pool_get(&dev->cq_pool, destroy_cmd->cqn);
+
+	rte_spinlock_lock(&cq->cq_lock);
+	cq->is_dying = true;
+	cq->vq->last_avail_idx = 0;
+	cq->vq->last_used_idx = 0;
+	rte_spinlock_unlock(&cq->cq_lock);
+
+	vhost_rdma_drop_ref(cq, dev, cq);
+
+	return 0;
+}
+
 /* Command handler table declaration */
 struct {
 	int (*handler)(struct vhost_rdma_device *dev, struct iovec *in, struct iovec *out);
 	const char *name;  /* Name of the command (for logging) */
 } cmd_tbl[] = {
-	DEFINE_VIRTIO_RDMA_CMD(VHOST_RDMA_CTRL_ROCE_QUERY_DEVICE, vhost_rdma_query_device),
-	DEFINE_VIRTIO_RDMA_CMD(VHOST_RDMA_CTRL_ROCE_QUERY_PORT, vhost_rdma_query_port),
+	DEFINE_VIRTIO_RDMA_CMD(VHOST_RDMA_CTRL_ROCE_QUERY_DEVICE,			vhost_rdma_query_device),
+	DEFINE_VIRTIO_RDMA_CMD(VHOST_RDMA_CTRL_ROCE_QUERY_PORT,				vhost_rdma_query_port),
+	DEFINE_VIRTIO_RDMA_CMD(VHOST_RDMA_CTRL_ROCE_CREATE_CQ,				vhost_rdma_create_cq),
+	DEFINE_VIRTIO_RDMA_CMD(VHOST_RDMA_CTRL_ROCE_DESTROY_CQ,				vhost_rdma_destroy_cq),
 };
 
 /**
examples/vhost_user_rdma/vhost_rdma_ib.h +32 -1
index 664067b024..6420c8c7e2 100644
@@ -31,6 +31,12 @@
 
 #include "eal_interrupts.h"
 
+#define vhost_rdma_ref_init(obj) \
+	do{\
+		rte_atomic32_init(&(obj)->refcnt); \
+		rte_atomic32_inc(&(obj)->refcnt); \
+	}while(0)
+
 /* Forward declarations */
 struct vhost_rdma_device;
 struct vhost_queue;
@@ -370,7 +376,7 @@ struct vhost_user_rdma_msg {
  * @brief Completion Queue (CQ)
  */
 struct vhost_rdma_cq {
-	struct vhost_queue *vq;			/**< Notification V-ring */
+	struct vhost_user_queue *vq;         /**< Notification V-ring */
 	rte_spinlock_t cq_lock;			/**< Protect CQ operations */
 	uint8_t notify;					/**< Notify pending flag */
 	bool is_dying;					/**< Being destroyed */
@@ -676,6 +682,31 @@ struct vhost_rdma_ack_query_port {
 	uint32_t			reserved[32];	/* For future extensions */
 }__rte_packed;
 
+struct vhost_rdma_cmd_create_cq {
+        /* Size of CQ */
+        uint32_t cqe;
+};
+
+struct vhost_rdma_ack_create_cq {
+        /* The index of CQ */
+        uint32_t cqn;
+};
+
+struct vhost_rdma_cmd_destroy_cq {
+        /* The index of CQ */
+        uint32_t cqn;
+};
+
+struct vhost_rdma_ack_create_pd {
+        /* The handle of PD */
+        uint32_t pdn;
+};
+
+struct vhost_rdma_cmd_destroy_pd {
+        /* The handle of PD */
+        uint32_t pdn;
+};
+
 /**
  * @brief Convert IB MTU enum to byte size
  * @param mtu The MTU enum value
Signature · 1 line
2.43.0
#4 lore raw

PATCH 1/1 hw/rdma: Implement vhost-user RDMA device with PCI support

In reply to [email protected]

From: xiongweimin <[email protected]>

This commit introduces a complete vhost-user RDMA device implementation including PCI interface bindings. The implementation enables RDMA operations through a vhost-user backend and provides a PCI device interface for guests.

Key components included:
1. PCI device binding layer:
- Automatic MSI-X vector allocation (queues + 1)
- Virtio 1.0 compliance (no legacy support)
- Standard Red Hat vendor/device IDs
- Bootindex property passthrough
- Transitional/non-transitional device variants

2. Core vhost-user RDMA device:
- Chardev-based backend communication
- Dynamic connection management with reconnect
- 256 virtqueues (512 entries each)
- Feature negotiation (VIRTIO_F_VERSION_1, INDIRECT_DESC, etc.)
- Config space handling with live updates
- VM state preservation for migration
- Graceful start/stop sequences
- Host notifier management

3. Key functionalities:
- Automatic backend connection management
- Config change notification handling
- Queue enablement on guest activity
- Error handling for backend disconnections
- Resource cleanup on device unrealize

The implementation follows virtio and vhost-user standards, providing a foundation for RDMA virtualization using user-space backends.

Change-Id I3299219282bc98800422e132298006ed1b3637da
---
 hw/rdma/Kconfig                             |   5 +
 hw/rdma/meson.build                         |   5 +
 hw/rdma/vhost-user-rdma.c                   | 463 ++++++++++++++++++++
 hw/virtio/meson.build                       |   1 +
 hw/virtio/vhost-user-rdma-pci.c             |  93 ++++
 hw/virtio/vhost-user.c                      |  11 +
 hw/virtio/vhost.c                           |   2 +
 hw/virtio/virtio.c                          |   1 +
 include/hw/pci/pci.h                        |   1 +
 include/hw/virtio/vhost-user-rdma.h         |  43 ++
 include/hw/virtio/virtio.h                  |   2 +-
 include/standard-headers/linux/virtio_ids.h |   1 +
 include/standard-headers/rdma/virtio_rdma.h |  60 +++
 13 files changed, 687 insertions(+), 1 deletion(-)
 create mode 100644 hw/rdma/vhost-user-rdma.c
 create mode 100644 hw/virtio/vhost-user-rdma-pci.c
 create mode 100644 include/hw/virtio/vhost-user-rdma.h
 create mode 100644 include/standard-headers/rdma/virtio_rdma.h
hw/rdma/Kconfig +5 -0
index 840320bdc0..1cb7ee72ab 100644
@@ -1,3 +1,8 @@
 config VMW_PVRDMA
     default y if PCI_DEVICES
     depends on PVRDMA && MSI_NONBROKEN && VMXNET3_PCI
+
+config VHOST_USER_RDMA
+    bool
+    default y if VIRTIO_PCI
+    depends on VIRTIO && VHOST_USER && LINUX
hw/rdma/meson.build +5 -0
index 363c9b8c83..51c47b2d44 100644
@@ -10,3 +10,8 @@ specific_ss.add(when: 'CONFIG_VMW_PVRDMA', if_true: files(
   'vmw/pvrdma_dev_ring.c',
   'vmw/pvrdma_main.c',
 ))
+
+
+specific_ss.add(when: 'CONFIG_VHOST_USER_RDMA', if_true: files(
+  'vhost-user-rdma.c',
+))
hw/rdma/vhost-user-rdma.c new file +463 -0

463 lines not on this page · raw message

hw/virtio/meson.build +1 -0
index d7f18c96e6..3f0a7da910 100644
@@ -63,6 +63,7 @@ virtio_pci_ss.add(when: 'CONFIG_VHOST_VSOCK', if_true: files('vhost-vsock-pci.c'
 virtio_pci_ss.add(when: 'CONFIG_VHOST_USER_VSOCK', if_true: files('vhost-user-vsock-pci.c'))
 virtio_pci_ss.add(when: 'CONFIG_VHOST_USER_BLK', if_true: files('vhost-user-blk-pci.c'))
 virtio_pci_ss.add(when: 'CONFIG_VHOST_USER_SCSI', if_true: files('vhost-user-scsi-pci.c'))
+virtio_pci_ss.add(when: 'CONFIG_VHOST_USER_RDMA', if_true: files('vhost-user-rdma-pci.c'))
 virtio_pci_ss.add(when: 'CONFIG_VHOST_SCSI', if_true: files('vhost-scsi-pci.c'))
 virtio_pci_ss.add(when: 'CONFIG_VHOST_USER_FS', if_true: files('vhost-user-fs-pci.c'))
 
hw/virtio/vhost-user-rdma-pci.c new file +93 -0

93 lines not on this page · raw message

hw/virtio/vhost-user.c +11 -0
index cdf9af4a4b..eb0813bddd 100644
@@ -460,6 +460,7 @@ static int vhost_user_set_log_base(struct vhost_dev *dev, uint64_t base,
     }
 
     if (shmfd) {
+        error_report("vhost_user_read: vhost_user_set_log_base");
         msg.hdr.size = 0;
         ret = vhost_user_read(dev, &msg);
         if (ret < 0) {
@@ -753,6 +754,7 @@ static int send_add_regions(struct vhost_dev *dev,
             if (track_ramblocks) {
                 uint64_t reply_gpa;
 
+                error_report("vhost_user_read: send_add_regions");
                 ret = vhost_user_read(dev, &msg_reply);
                 if (ret < 0) {
                     return ret;
@@ -930,6 +932,7 @@ static int vhost_user_set_mem_table_postcopy(struct vhost_dev *dev,
             return ret;
         }
 
+        error_report("vhost_user_read: vhost_user_set_mem_table_postcopy");
         ret = vhost_user_read(dev, &msg_reply);
         if (ret < 0) {
             return ret;
@@ -1287,6 +1290,7 @@ static int vhost_user_get_vring_base(struct vhost_dev *dev,
         return ret;
     }
 
+    error_report("vhost_user_read: vhost_user_get_vring_base");
     ret = vhost_user_read(dev, &msg);
     if (ret < 0) {
         return ret;
@@ -1433,6 +1437,7 @@ static int vhost_user_set_features(struct vhost_dev *dev,
      * VHOST_USER_F_PROTOCOL_FEATURES bit for enabling protocol
      * features.
      */
+
     ret = vhost_user_set_u64(dev, VHOST_USER_SET_FEATURES,
                               features | dev->backend_features,
                               log_enabled);
@@ -1673,6 +1678,7 @@ int vhost_user_get_shared_object(struct vhost_dev *dev, unsigned char *uuid,
         return ret;
     }
 
+    error_report("vhost_user_read: vhost_user_get_shared_object");
     ret = vhost_user_read(dev, &msg);
     if (ret < 0) {
         return ret;
@@ -1998,6 +2004,7 @@ static int vhost_user_postcopy_advise(struct vhost_dev *dev, Error **errp)
         return ret;
     }
 
+    error_report("vhost_user_read: vhost_user_postcopy_advise");
     ret = vhost_user_read(dev, &msg);
     if (ret < 0) {
         error_setg(errp, "Failed to get postcopy_advise reply from vhost");
@@ -2435,6 +2442,7 @@ static int vhost_user_get_config(struct vhost_dev *dev, uint8_t *config,
         return ret;
     }
 
+    error_report("vhost_user_read: vhost_user_get_config");
     ret = vhost_user_read(dev, &msg);
     if (ret < 0) {
         error_setg_errno(errp, -ret, "vhost_get_config failed");
@@ -2578,6 +2586,7 @@ static int vhost_user_crypto_create_session(struct vhost_dev *dev,
         return ret;
     }
 
+    error_report("vhost_user_read: vhost_user_crypto_create_session");
     ret = vhost_user_read(dev, &msg);
     if (ret < 0) {
         error_report("vhost_user_read() return %d, create session failed",
@@ -2923,6 +2932,7 @@ static int vhost_user_set_device_state_fd(struct vhost_dev *dev,
         return ret;
     }
 
+    error_report("vhost_user_read: vhost_user_set_device_state_fd");
     ret = vhost_user_read(dev, &msg);
     if (ret < 0) {
         error_setg_errno(errp, -ret,
@@ -2985,6 +2995,7 @@ static int vhost_user_check_device_state(struct vhost_dev *dev, Error **errp)
         return ret;
     }
 
+    error_report("vhost_user_read: vhost_user_check_device_state");
     ret = vhost_user_read(dev, &msg);
     if (ret < 0) {
         error_setg_errno(errp, -ret,
hw/virtio/vhost.c +2 -0
index f50180e60e..87cec36828 100644
@@ -934,6 +934,7 @@ static int vhost_dev_set_features(struct vhost_dev *dev,
             features |= 0x1ULL << VIRTIO_F_IOMMU_PLATFORM;
        }
     }
+
     r = dev->vhost_ops->vhost_set_features(dev, features);
     if (r < 0) {
         VHOST_OPS_DEBUG(r, "vhost_set_features failed");
@@ -1804,6 +1805,7 @@ void vhost_ack_features(struct vhost_dev *hdev, const int *feature_bits,
                         uint64_t features)
 {
     const int *bit = feature_bits;
+    info_report("vhost_ack_features");
     while (*bit != VHOST_INVALID_FEATURE_BIT) {
         uint64_t bit_mask = (1ULL << *bit);
         if (features & bit_mask) {
hw/virtio/virtio.c +1 -0
index fd2dfe3a6b..bee7156e6d 100644
@@ -181,6 +181,7 @@ const char *virtio_device_names[] = {
     [VIRTIO_ID_FS] = "virtio-user-fs",
     [VIRTIO_ID_PMEM] = "virtio-pmem",
     [VIRTIO_ID_RPMB] = "virtio-rpmb",
+    [VIRTIO_ID_RDMA] = "virtio-rdma",
     [VIRTIO_ID_MAC80211_HWSIM] = "virtio-mac-hwsim",
     [VIRTIO_ID_VIDEO_ENCODER] = "virtio-vid-encoder",
     [VIRTIO_ID_VIDEO_DECODER] = "virtio-vid-decoder",
include/hw/pci/pci.h +1 -0
index eaa3fc99d8..a1eccfb78b 100644
@@ -85,6 +85,7 @@ extern bool pci_available;
 #define PCI_DEVICE_ID_VIRTIO_RNG         0x1005
 #define PCI_DEVICE_ID_VIRTIO_9P          0x1009
 #define PCI_DEVICE_ID_VIRTIO_VSOCK       0x1012
+#define PCI_DEVICE_ID_VIRTIO_RDMA        0x1016
 
 /*
  * modern virtio-pci devices get their id assigned automatically,
include/hw/virtio/vhost-user-rdma.h new file +43 -0

43 lines not on this page · raw message

include/hw/virtio/virtio.h +1 -1
index 7d5ffdc145..f74da61477 100644
@@ -369,7 +369,7 @@ typedef struct VirtIORNGConf VirtIORNGConf;
     DEFINE_PROP_BIT64("packed", _state, _field, \
                       VIRTIO_F_RING_PACKED, false), \
     DEFINE_PROP_BIT64("queue_reset", _state, _field, \
-                      VIRTIO_F_RING_RESET, true)
+                      VIRTIO_F_RING_RESET, false)
 
 hwaddr virtio_queue_get_desc_addr(VirtIODevice *vdev, int n);
 bool virtio_queue_enabled_legacy(VirtIODevice *vdev, int n);
include/standard-headers/linux/virtio_ids.h +1 -0
index 7aa2eb7662..ff2d0b01b4 100644
@@ -68,6 +68,7 @@
 #define VIRTIO_ID_AUDIO_POLICY		39 /* virtio audio policy */
 #define VIRTIO_ID_BT			40 /* virtio bluetooth */
 #define VIRTIO_ID_GPIO			41 /* virtio gpio */
+#define VIRTIO_ID_RDMA          42 /* virtio rdma */
 
 /*
  * Virtio Transitional IDs
include/standard-headers/rdma/virtio_rdma.h new file +60 -0

60 lines not on this page · raw message

Signature · 1 line
2.43.0