From: "Eugenio Pérez" <eperezma@redhat.com>
To: "Michael S . Tsirkin" <mst@redhat.com>
Cc: "Eugenio Pérez" <eperezma@redhat.com>,
"Laurent Vivier" <lvivier@redhat.com>,
"Yongji Xie" <xieyongji@bytedance.com>,
linux-kernel@vger.kernel.org,
"Stefano Garzarella" <sgarzare@redhat.com>,
"Jason Wang" <jasowangio@gmail.com>,
"Xuan Zhuo" <xuanzhuo@linux.alibaba.com>,
virtualization@lists.linux.dev,
"Maxime Coquelin" <mcoqueli@redhat.com>
Subject: [PATCH v4 3/4] vduse: add VDUSE_SET_FEATURES ioctl
Date: Tue, 7 Jul 2026 14:25:01 +0200 [thread overview]
Message-ID: <20260707122502.239022-4-eperezma@redhat.com> (raw)
In-Reply-To: <20260707122502.239022-1-eperezma@redhat.com>
Add an ioctl to allow VDUSE instances to set the VDUSE features
supported by the userland VDUSE instance.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
v4: New in v4.
---
drivers/vdpa/vdpa_user/vduse_dev.c | 24 ++++++++++++++++++++++++
include/uapi/linux/vduse.h | 3 +++
2 files changed, 27 insertions(+)
diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c
index e1930e38df7a..4d561b9fbf5e 100644
--- a/drivers/vdpa/vdpa_user/vduse_dev.c
+++ b/drivers/vdpa/vdpa_user/vduse_dev.c
@@ -160,6 +160,7 @@ struct vduse_dev_msg {
struct vduse_control {
u64 api_version;
+ u64 vduse_features;
};
static DEFINE_MUTEX(vduse_lock);
@@ -2349,7 +2350,29 @@ static long vduse_ioctl(struct file *file, unsigned int cmd,
case VDUSE_GET_FEATURES:
ret = put_user(vduse_features, (u64 __user *)argp);
break;
+ case VDUSE_SET_FEATURES: {
+ u64 features;
+ ret = -EFAULT;
+ if (get_user(features, (u64 __user *)argp)) {
+ dev_dbg(vduse_ctrl_dev, "Could not get vduse features");
+ break;
+ }
+
+ ret = -EINVAL;
+ if (features & ~vduse_features) {
+ dev_dbg(vduse_ctrl_dev,
+ "Invalid features in %llx, expected %llx",
+ features, vduse_features);
+ break;
+ }
+
+ ret = 0;
+ control->vduse_features = features;
+ dev_dbg(vduse_ctrl_dev, "Set features %llx", features);
+
+ break;
+ }
default:
ret = -EINVAL;
break;
@@ -2376,6 +2399,7 @@ static int vduse_open(struct inode *inode, struct file *file)
return -ENOMEM;
control->api_version = VDUSE_API_VERSION_NOT_ASKED;
+ control->vduse_features = 0;
file->private_data = control;
return 0;
diff --git a/include/uapi/linux/vduse.h b/include/uapi/linux/vduse.h
index 89aa3b448c0a..f14c965bb7f6 100644
--- a/include/uapi/linux/vduse.h
+++ b/include/uapi/linux/vduse.h
@@ -66,6 +66,9 @@ struct vduse_dev_config {
/* Get the VDUSE supported features */
#define VDUSE_GET_FEATURES _IOR(VDUSE_BASE, 0x04, __u64)
+/* Set the VDUSE features */
+#define VDUSE_SET_FEATURES _IOW(VDUSE_BASE, 0x05, __u64)
+
/* The ioctls for VDUSE device (/dev/vduse/$NAME) */
/**
--
2.55.0
next prev parent reply other threads:[~2026-07-07 12:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-07 12:24 [PATCH v4 0/4] Add queue ready message to VDUSE Eugenio Pérez
2026-07-07 12:24 ` [PATCH v4 1/4] vduse: store control device pointer Eugenio Pérez
2026-07-07 12:25 ` [PATCH v4 2/4] vduse: add VDUSE_GET_FEATURES ioctl Eugenio Pérez
2026-07-07 12:25 ` Eugenio Pérez [this message]
2026-07-07 12:25 ` [PATCH v4 4/4] vduse: add F_QUEUE_READY feature Eugenio Pérez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260707122502.239022-4-eperezma@redhat.com \
--to=eperezma@redhat.com \
--cc=jasowangio@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lvivier@redhat.com \
--cc=mcoqueli@redhat.com \
--cc=mst@redhat.com \
--cc=sgarzare@redhat.com \
--cc=virtualization@lists.linux.dev \
--cc=xieyongji@bytedance.com \
--cc=xuanzhuo@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.