[RFC PATCH v2 11/11] nvme-pci: Convert to using dma_map_sg for p2pdma pages
Logan Gunthorpe
logang at deltatee.com
Fri Mar 12 01:37:03 GMT 2021
On 2021-03-11 4:59 p.m., Jason Gunthorpe wrote:
> On Thu, Mar 11, 2021 at 04:31:41PM -0700, Logan Gunthorpe wrote:
>> Convert to using dma_[un]map_sg() for PCI p2pdma pages.
>>
>> This should be equivalent, though support will be somewhat less
>> (only dma-direct and dma-iommu are currently supported).
>>
>> Signed-off-by: Logan Gunthorpe <logang at deltatee.com>
>> drivers/nvme/host/pci.c | 27 +++++++--------------------
>> 1 file changed, 7 insertions(+), 20 deletions(-)
>>
>> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
>> index 7d40c6a9e58e..89ca5acf7a62 100644
>> +++ b/drivers/nvme/host/pci.c
>> @@ -577,17 +577,6 @@ static void nvme_free_sgls(struct nvme_dev *dev, struct request *req)
>>
>> }
>>
>> -static void nvme_unmap_sg(struct nvme_dev *dev, struct request *req)
>> -{
>> - struct nvme_iod *iod = blk_mq_rq_to_pdu(req);
>> -
>> - if (is_pci_p2pdma_page(sg_page(iod->sg)))
>> - pci_p2pdma_unmap_sg(dev->dev, iod->sg, iod->nents,
>> - rq_dma_dir(req));
>> - else
>> - dma_unmap_sg(dev->dev, iod->sg, iod->nents, rq_dma_dir(req));
>> -}
>
> Can the two other places with this code pattern be changed too?
Yes, if this goes forward, I imagine completely dropping
pci_p2pdma_unmap_sg().
Logan
More information about the Linux-nvme
mailing list