[RFC v2 21/21] nvme-pci: don't allow mapping of bvecs with offset

From: Leon Romanovsky
Date: Thu Sep 12 2024 - 07:26:41 EST


From: Leon Romanovsky <leonro@xxxxxxxxxx>

It is a hack, but direct DMA works now.

Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxx>
---
drivers/nvme/host/pci.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index 881cbf2c0cac..1872fa91ac76 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -791,6 +791,9 @@ static blk_status_t nvme_map_data(struct nvme_dev *dev, struct request *req,
return BLK_STS_RESOURCE;

rq_for_each_bvec(bv, req, iter) {
+ if (bv.bv_offset != 0)
+ goto out_free;
+
dma_addr = dma_map_bvec(dev->dev, &bv, rq_dma_dir(req), 0);
if (dma_mapping_error(dev->dev, dma_addr))
goto out_free;
--
2.46.0