On 2021-05-02 7:34 p.m., John Hubbard wrote:
>> if (iod->npages == 0)
>> dma_pool_free(dev->prp_small_pool, nvme_pci_iod_list(req)[0],
>> iod->first_dma);
>> @@ -868,14 +857,13 @@ static blk_status_t nvme_map_data(struct nvme_dev
>> *dev, struct request *req,
>> if (!iod->nents)
>> goto out_free_sg;
>>
>> - if (is_pci_p2pdma_page(sg_page(iod->sg)))
>> - nr_mapped = pci_p2pdma_map_sg_attrs(dev->dev, iod->sg,
>> - iod->nents, rq_dma_dir(req), DMA_ATTR_NO_WARN);
>> - else
>> - nr_mapped = dma_map_sg_attrs(dev->dev, iod->sg, iod->nents,
>> - rq_dma_dir(req), DMA_ATTR_NO_WARN);
>> - if (!nr_mapped)
>> + nr_mapped = dma_map_sg_p2pdma_attrs(dev->dev, iod->sg, iod->nents,
>> + rq_dma_dir(req), DMA_ATTR_NO_WARN);
>> + if (nr_mapped < 0) {
>> + if (nr_mapped != -ENOMEM)
>> + ret = BLK_STS_TARGET;
>> goto out_free_sg;
>> + }
>
> But now the "nr_mapped == 0" case is no longer doing an early out_free_sg.
> Is that OK?
dma_map_sg_p2pdma_attrs() never returns zero. It will return -ENOMEM in
the same situation and results in the same goto out_free_sg.
Logan
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
- Re: [PATCH 03/16] PCI/P2PDMA: Attempt to ... Logan Gunthorpe
- [PATCH 12/16] nvme-pci: Check DMA ops when indicating supp... Logan Gunthorpe
- Re: [PATCH 12/16] nvme-pci: Check DMA ops when indica... John Hubbard
- Re: [PATCH 12/16] nvme-pci: Check DMA ops when in... Logan Gunthorpe
- Re: [PATCH 12/16] nvme-pci: Check DMA ops whe... John Hubbard
- [PATCH 06/16] lib/scatterlist: Add flag for indicating P2P... Logan Gunthorpe
- [PATCH 16/16] PCI/P2PDMA: Remove pci_p2pdma_[un]map_sg() Logan Gunthorpe
- [PATCH 13/16] nvme-pci: Convert to using dma_map_sg_p2pdma... Logan Gunthorpe
- Re: [PATCH 13/16] nvme-pci: Convert to using dma_map_... John Hubbard
- Re: [PATCH 13/16] nvme-pci: Convert to using dma_... Logan Gunthorpe
- Re: [PATCH 13/16] nvme-pci: Convert to using ... John Hubbard
- [PATCH 09/16] dma-direct: Support PCI P2PDMA pages in dma-... Logan Gunthorpe
- Re: [PATCH 09/16] dma-direct: Support PCI P2PDMA page... Jason Gunthorpe
- Re: [PATCH 09/16] dma-direct: Support PCI P2PDMA ... Jason Gunthorpe
- Re: [PATCH 09/16] dma-direct: Support PCI P2P... Logan Gunthorpe
- Re: [PATCH 09/16] dma-direct: Support PCI P2PDMA page... John Hubbard
- Re: [PATCH 09/16] dma-direct: Support PCI P2PDMA ... John Hubbard
- Re: [PATCH 09/16] dma-direct: Support PCI P2P... Logan Gunthorpe
- Re: [PATCH 09/16] dma-direct: Support PCI P2PDMA ... Logan Gunthorpe
- Re: [PATCH 09/16] dma-direct: Support PCI P2P... John Hubbard
