summaryrefslogtreecommitdiff
path: root/drivers/scsi
diff options
context:
space:
mode:
authorYang Xiuwei <yangxiuwei@kylinos.cn>2026-03-17 15:22:25 +0800
committerJens Axboe <axboe@kernel.dk>2026-03-19 11:38:24 -0600
commita1e97ce80d9f41d0bb83951d758ff6fe49f3de60 (patch)
tree76c84703b7d5b00cb692f6a08938137a87ac9c8b /drivers/scsi
parent7da9261bab0a82bdbc4aafd2ad4bc3529b7cb772 (diff)
downloadlwn-a1e97ce80d9f41d0bb83951d758ff6fe49f3de60.tar.gz
lwn-a1e97ce80d9f41d0bb83951d758ff6fe49f3de60.zip
bsg: add io_uring command support to generic layer
Add an io_uring command handler to the generic BSG layer. The new .uring_cmd file operation validates io_uring features and delegates handling to a per-queue bsg_uring_cmd_fn callback. Extend bsg_register_queue() so transport drivers can register both sg_io and io_uring command handlers. Signed-off-by: Yang Xiuwei <yangxiuwei@kylinos.cn> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Link: https://patch.msgid.link/20260317072226.2598233-3-yangxiuwei@kylinos.cn Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/scsi_bsg.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/scsi/scsi_bsg.c b/drivers/scsi/scsi_bsg.c
index a9a9ec086a7e..4d57e524e141 100644
--- a/drivers/scsi/scsi_bsg.c
+++ b/drivers/scsi/scsi_bsg.c
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/bsg.h>
+#include <linux/io_uring/cmd.h>
#include <scsi/scsi.h>
#include <scsi/scsi_ioctl.h>
#include <scsi/scsi_cmnd.h>
@@ -9,6 +10,12 @@
#define uptr64(val) ((void __user *)(uintptr_t)(val))
+static int scsi_bsg_uring_cmd(struct request_queue *q, struct io_uring_cmd *ioucmd,
+ unsigned int issue_flags, bool open_for_write)
+{
+ return -EOPNOTSUPP;
+}
+
static int scsi_bsg_sg_io_fn(struct request_queue *q, struct sg_io_v4 *hdr,
bool open_for_write, unsigned int timeout)
{
@@ -99,5 +106,6 @@ out_put_request:
struct bsg_device *scsi_bsg_register_queue(struct scsi_device *sdev)
{
return bsg_register_queue(sdev->request_queue, &sdev->sdev_gendev,
- dev_name(&sdev->sdev_gendev), scsi_bsg_sg_io_fn);
+ dev_name(&sdev->sdev_gendev), scsi_bsg_sg_io_fn,
+ scsi_bsg_uring_cmd);
}