]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
nvme: set dma alignment to qword
authorKeith Busch <kbusch@kernel.org>
Thu, 21 May 2020 02:22:53 +0000 (19:22 -0700)
committerChristoph Hellwig <hch@lst.de>
Wed, 27 May 2020 05:12:40 +0000 (07:12 +0200)
The default dma alignment mask is 511, which is much larger than any nvme
controller requires. NVMe controllers accept qword aligned DMA addresses,
so set the request_queue constraints to that. This can help avoid bounce
buffers on user passthrough commands.

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

index a3a4dbc59af18be0d20f4b3f7f066e4d3279cf14..569671e264b509157c512968265f9c87b5ad36d4 100644 (file)
@@ -2322,6 +2322,7 @@ static void nvme_set_queue_limits(struct nvme_ctrl *ctrl,
                blk_queue_max_segments(q, min_t(u32, max_segments, USHRT_MAX));
        }
        blk_queue_virt_boundary(q, ctrl->page_size - 1);
+       blk_queue_dma_alignment(q, 7);
        if (ctrl->vwc & NVME_CTRL_VWC_PRESENT)
                vwc = true;
        blk_queue_write_cache(q, vwc, vwc);