computing-offload/generic_vdpa/qemu/0001-vhost-vdpa-add-VHOST_BACKEND_F_BYTEMAPLOG.patch
jiangdongxu fac818adb1 vdpa: change libvirt/qemu/kernel base version and docs
Change-Id: I574115f5e44e56ac2baaad71eeab6b9fd7149747
2024-10-15 17:39:52 +08:00

50 lines
1.8 KiB
Diff

From 39945124e7f39e36ba5220965f76b592a1d1b502 Mon Sep 17 00:00:00 2001
From: libai <libai12@huawei.com>
Date: Mon, 4 Dec 2023 14:49:53 +0800
Subject: [PATCH 01/16] vhost-vdpa: add VHOST_BACKEND_F_BYTEMAPLOG
support VHOST_BACKEND_F_BYTEMAPLOG to support vhost
device bytemap logging.
Signed-off-by: libai <libai12@huawei.com>
---
hw/virtio/vhost-vdpa.c | 9 +++++----
include/standard-headers/linux/vhost_types.h | 3 +++
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
index 819b2d8..ce8ff7f 100644
--- a/hw/virtio/vhost-vdpa.c
+++ b/hw/virtio/vhost-vdpa.c
@@ -829,10 +829,11 @@ static int vhost_vdpa_set_features(struct vhost_dev *dev,
static int vhost_vdpa_set_backend_cap(struct vhost_dev *dev)
{
uint64_t features;
- uint64_t f = 0x1ULL << VHOST_BACKEND_F_IOTLB_MSG_V2 |
- 0x1ULL << VHOST_BACKEND_F_IOTLB_BATCH |
- 0x1ULL << VHOST_BACKEND_F_IOTLB_ASID |
- 0x1ULL << VHOST_BACKEND_F_SUSPEND;
+ uint64_t f = BIT_ULL(VHOST_BACKEND_F_IOTLB_MSG_V2) |
+ BIT_ULL(VHOST_BACKEND_F_IOTLB_BATCH) |
+ BIT_ULL(VHOST_BACKEND_F_IOTLB_ASID) |
+ BIT_ULL(VHOST_BACKEND_F_SUSPEND) |
+ BIT_ULL(VHOST_BACKEND_F_BYTEMAPLOG);
int r;
if (vhost_vdpa_call(dev, VHOST_GET_BACKEND_FEATURES, &features)) {
diff --git a/include/standard-headers/linux/vhost_types.h b/include/standard-headers/linux/vhost_types.h
index 5ad07e1..7625de5 100644
--- a/include/standard-headers/linux/vhost_types.h
+++ b/include/standard-headers/linux/vhost_types.h
@@ -186,4 +186,7 @@ struct vhost_vdpa_iova_range {
*/
#define VHOST_BACKEND_F_ENABLE_AFTER_DRIVER_OK 0x6
+/* device can use bytemap log */
+#define VHOST_BACKEND_F_BYTEMAPLOG 0x3f
+
#endif
--
2.46.0.windows.1