From 3fe9a15feba924675ffcc5b797185091cfb8a007 Mon Sep 17 00:00:00 2001 From: libai Date: Mon, 4 Dec 2023 14:49:53 +0800 Subject: [PATCH] vhost-vdpa: add VHOST_BACKEND_F_BYTEMAPLOG support VHOST_BACKEND_F_BYTEMAPLOG to support vhost device bytemap logging. Signed-off-by: libai --- hw/virtio/vhost-vdpa.c | 9 +++++---- include/standard-headers/linux/vhost_types.h | 2 ++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 819b2d811a..ce8ff7f417 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 fd54044936..46fc53cd83 100644 --- a/include/standard-headers/linux/vhost_types.h +++ b/include/standard-headers/linux/vhost_types.h @@ -192,5 +192,7 @@ struct vhost_vdpa_iova_range { #define VHOST_BACKEND_F_DESC_ASID 0x7 /* IOTLB don't flush memory mapping across device reset */ #define VHOST_BACKEND_F_IOTLB_PERSIST 0x8 +/* device can use bytemap log */ +#define VHOST_BACKEND_F_BYTEMAPLOG 0x3f #endif -- 2.27.0