[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240412133017.483407-3-lulu@redhat.com>
Date: Fri, 12 Apr 2024 21:28:22 +0800
From: Cindy Lu <lulu@...hat.com>
To: lulu@...hat.com,
jasowang@...hat.com,
mst@...hat.com,
linux-kernel@...r.kernel.org,
virtualization@...ts.linux-foundation.org
Subject: [PATCH v5 2/5] vduse: Add new ioctl VDUSE_DEV_GET_STATUS
The ioctl VDUSE_DEV_GET_STATUS is used by the Userspace App
to get the device status
Signed-off-by: Cindy Lu <lulu@...hat.com>
---
drivers/vdpa/vdpa_user/vduse_dev.c | 7 +++++++
include/uapi/linux/vduse.h | 2 ++
2 files changed, 9 insertions(+)
diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c
index ab246da27616..ef3c9681941e 100644
--- a/drivers/vdpa/vdpa_user/vduse_dev.c
+++ b/drivers/vdpa/vdpa_user/vduse_dev.c
@@ -1389,6 +1389,13 @@ static long vduse_dev_ioctl(struct file *file, unsigned int cmd,
ret = 0;
break;
}
+
+ case VDUSE_DEV_GET_STATUS:
+ /*
+ * Returns the status read from device
+ */
+ ret = put_user(dev->status, (u8 __user *)argp);
+ break;
default:
ret = -ENOIOCTLCMD;
break;
diff --git a/include/uapi/linux/vduse.h b/include/uapi/linux/vduse.h
index 125d7529d91b..f501173a9d69 100644
--- a/include/uapi/linux/vduse.h
+++ b/include/uapi/linux/vduse.h
@@ -353,4 +353,6 @@ struct vduse_dev_response {
/* get device configuration space */
#define VDUSE_DEV_GET_CONFIG _IOR(VDUSE_BASE, 0x1b, struct vduse_config_data)
+#define VDUSE_DEV_GET_STATUS _IOR(VDUSE_BASE, 0x1c, __u8)
+
#endif /* _UAPI_VDUSE_H_ */
--
2.43.0
Powered by blists - more mailing lists