[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1704919215-91319-5-git-send-email-steven.sistare@oracle.com>
Date: Wed, 10 Jan 2024 12:40:06 -0800
From: Steve Sistare <steven.sistare@...cle.com>
To: virtualization@...ts.linux-foundation.org, linux-kernel@...r.kernel.org
Cc: "Michael S. Tsirkin" <mst@...hat.com>, Jason Wang <jasowang@...hat.com>,
Si-Wei Liu <si-wei.liu@...cle.com>,
Eugenio Perez Martin <eperezma@...hat.com>,
Xuan Zhuo <xuanzhuo@...ux.alibaba.com>,
Dragos Tatulea <dtatulea@...dia.com>, Eli Cohen <elic@...dia.com>,
Xie Yongji <xieyongji@...edance.com>,
Steve Sistare <steven.sistare@...cle.com>
Subject: [RFC V1 04/13] vhost-vdpa: VHOST_BACKEND_F_NEW_OWNER
Add the VHOST_BACKEND_F_NEW_OWNER backend capability, which indicates that
VHOST_NEW_OWNER is supported.
Signed-off-by: Steve Sistare <steven.sistare@...cle.com>
---
drivers/vhost/vdpa.c | 7 ++++++-
include/uapi/linux/vhost_types.h | 2 ++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
index eb3a95e703b0..faed6471934a 100644
--- a/drivers/vhost/vdpa.c
+++ b/drivers/vhost/vdpa.c
@@ -621,6 +621,10 @@ static long vhost_vdpa_new_owner(struct vhost_vdpa *v)
struct mm_struct *mm_new = current->mm;
long pinned_vm = v->pinned_vm;
unsigned long lock_limit = PFN_DOWN(rlimit(RLIMIT_MEMLOCK));
+ u64 features = vhost_vdpa_get_backend_features(v);
+
+ if (!(features & BIT_ULL(VHOST_BACKEND_F_NEW_OWNER)))
+ return -EOPNOTSUPP;
if (!mm_old)
return -EINVAL;
@@ -784,7 +788,8 @@ static long vhost_vdpa_unlocked_ioctl(struct file *filep,
BIT_ULL(VHOST_BACKEND_F_IOTLB_PERSIST) |
BIT_ULL(VHOST_BACKEND_F_SUSPEND) |
BIT_ULL(VHOST_BACKEND_F_RESUME) |
- BIT_ULL(VHOST_BACKEND_F_ENABLE_AFTER_DRIVER_OK)))
+ BIT_ULL(VHOST_BACKEND_F_ENABLE_AFTER_DRIVER_OK) |
+ BIT_ULL(VHOST_BACKEND_F_NEW_OWNER)))
return -EOPNOTSUPP;
if ((features & BIT_ULL(VHOST_BACKEND_F_SUSPEND)) &&
!vhost_vdpa_can_suspend(v))
diff --git a/include/uapi/linux/vhost_types.h b/include/uapi/linux/vhost_types.h
index d7656908f730..9177843951e9 100644
--- a/include/uapi/linux/vhost_types.h
+++ b/include/uapi/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
+/* Supports VHOST_NEW_OWNER */
+#define VHOST_BACKEND_F_NEW_OWNER 0x9
#endif
--
2.39.3
Powered by blists - more mailing lists