]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
nvme: make prp passthrough usage less scary
authorKeith Busch <kbusch@kernel.org>
Wed, 6 May 2026 13:05:14 +0000 (06:05 -0700)
committerKeith Busch <kbusch@kernel.org>
Mon, 11 May 2026 15:07:39 +0000 (08:07 -0700)
The warning is a bit alarming, and it only prints for the very first
non-sgl capable device that receives a passthrough command. Just log an
informational message on initial discovery for every device.

Reviewed-by: Jens Axboe <axboe@kernel.dk>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
drivers/nvme/host/core.c
drivers/nvme/host/ioctl.c

index dc388e24caadeb3df036f9b90623e5c877dd508b..1e7e42b43aa3f1ac1bf1575a9f9ac46b37fc7f94 100644 (file)
@@ -3749,6 +3749,10 @@ int nvme_init_ctrl_finish(struct nvme_ctrl *ctrl, bool was_suspended)
                ret = nvme_hwmon_init(ctrl);
                if (ret == -EINTR)
                        return ret;
+
+               if (!nvme_ctrl_sgl_supported(ctrl))
+                       dev_info(ctrl->device,
+                               "passthrough uses implicit buffer lengths\n");
        }
 
        clear_bit(NVME_CTRL_DIRTY_CAPABILITY, &ctrl->flags);
index 9597a87cf05dc32a7eb0373485f575502c32a105..e232188ccd0268be8b2807b0358951ef82712cf4 100644 (file)
@@ -120,21 +120,12 @@ static int nvme_map_user_request(struct request *req, u64 ubuffer,
        struct nvme_ns *ns = q->queuedata;
        struct block_device *bdev = ns ? ns->disk->part0 : NULL;
        bool supports_metadata = bdev && blk_get_integrity(bdev->bd_disk);
-       struct nvme_ctrl *ctrl = nvme_req(req)->ctrl;
        bool has_metadata = meta_buffer && meta_len;
        struct bio *bio = NULL;
        int ret;
 
-       if (!nvme_ctrl_sgl_supported(ctrl))
-               dev_warn_once(ctrl->device, "using unchecked data buffer\n");
-       if (has_metadata) {
-               if (!supports_metadata)
-                       return -EINVAL;
-
-               if (!nvme_ctrl_meta_sgl_supported(ctrl))
-                       dev_warn_once(ctrl->device,
-                                     "using unchecked metadata buffer\n");
-       }
+       if (has_metadata && !supports_metadata)
+               return -EINVAL;
 
        if (iter)
                ret = blk_rq_map_user_iov(q, req, NULL, iter, GFP_KERNEL);