Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

nvme-pci: use blk_map_iter for p2p metadata

The dma_map_bvec helper doesn't work for p2p data, so use the same
blk_map_iter method that sgl uses for this memory type.

Reported-by: Leon Romanovsky <leon@kernel.org>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>

+10 -3
+10 -3
drivers/nvme/host/pci.c
··· 1042 1042 return nvme_pci_setup_data_prp(req, &iter); 1043 1043 } 1044 1044 1045 - static blk_status_t nvme_pci_setup_meta_sgls(struct request *req) 1045 + static blk_status_t nvme_pci_setup_meta_iter(struct request *req) 1046 1046 { 1047 1047 struct nvme_queue *nvmeq = req->mq_hctx->driver_data; 1048 1048 unsigned int entries = req->nr_integrity_segments; ··· 1072 1072 * descriptor provides an explicit length, so we're relying on that 1073 1073 * mechanism to catch any misunderstandings between the application and 1074 1074 * device. 1075 + * 1076 + * P2P DMA also needs to use the blk_dma_iter method, so mptr setup 1077 + * leverages this routine when that happens. 1075 1078 */ 1076 - if (entries == 1 && !(nvme_req(req)->flags & NVME_REQ_USERCMD)) { 1079 + if (!nvme_ctrl_meta_sgl_supported(&dev->ctrl) || 1080 + (entries == 1 && !(nvme_req(req)->flags & NVME_REQ_USERCMD))) { 1077 1081 iod->cmd.common.metadata = cpu_to_le64(iter.addr); 1078 1082 iod->meta_total_len = iter.len; 1079 1083 iod->meta_dma = iter.addr; ··· 1118 1114 struct nvme_queue *nvmeq = req->mq_hctx->driver_data; 1119 1115 struct bio_vec bv = rq_integrity_vec(req); 1120 1116 1117 + if (is_pci_p2pdma_page(bv.bv_page)) 1118 + return nvme_pci_setup_meta_iter(req); 1119 + 1121 1120 iod->meta_dma = dma_map_bvec(nvmeq->dev->dev, &bv, rq_dma_dir(req), 0); 1122 1121 if (dma_mapping_error(nvmeq->dev->dev, iod->meta_dma)) 1123 1122 return BLK_STS_IOERR; ··· 1135 1128 1136 1129 if ((iod->cmd.common.flags & NVME_CMD_SGL_METABUF) && 1137 1130 nvme_pci_metadata_use_sgls(req)) 1138 - return nvme_pci_setup_meta_sgls(req); 1131 + return nvme_pci_setup_meta_iter(req); 1139 1132 return nvme_pci_setup_meta_mptr(req); 1140 1133 } 1141 1134