On 2021-05-02 5:32 p.m., John Hubbard wrote: > On 5/2/21 4:28 PM, John Hubbard wrote: >> On 4/8/21 10:01 AM, Logan Gunthorpe wrote: > ... >>> @@ -387,19 +388,37 @@ void dma_direct_unmap_sg(struct device *dev, struct >>> scatterlist *sgl, >> >> This routine now deserves a little bit of commenting, now that it is >> doing less obvious things. How about something like this: >> >> /* >> * Unmaps pages, except for PCI_P2PDMA pages, which were never mapped in the >> * first place. Instead of unmapping PCI_P2PDMA entries, simply remove the >> * SG_PCI_P2PDMA mark >> */ > > I got that kind of wrong. They *were* mapped, but need to be left mostly > alone...maybe you can word it better. Here's my second draft: > > /* > * Unmaps pages, except for PCI_P2PDMA pages, which should not be unmapped at > * this point. Instead of unmapping PCI_P2PDMA entries, simply remove the > * SG_PCI_P2PDMA mark. > */ > > ...am I getting close? :) I don't think your original comment was wrong per se. But I guess it depends on your definition of "mapped". In dma-direct the physical address is added to the SGL and, on some arches, the address has to be synced on unmap. With P2PDMA, the PCI bus address is sometimes added to the SGL and no sync is necessary at the end. Logan _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu
- [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
- Re: [PATCH 09/16] dma-direct: Support PCI P2PDMA ... Logan Gunthorpe
- Re: [PATCH 09/16] dma-direct: Support PCI P2P... John Hubbard
- [PATCH 07/16] PCI/P2PDMA: Make pci_p2pdma_map_type() non-s... Logan Gunthorpe
- Re: [PATCH 07/16] PCI/P2PDMA: Make pci_p2pdma_map_typ... John Hubbard
- Re: [PATCH 07/16] PCI/P2PDMA: Make pci_p2pdma_map... Logan Gunthorpe
- Re: [PATCH 07/16] PCI/P2PDMA: Make pci_p2pdma_map_typ... Don Dutile
- Re: [PATCH 07/16] PCI/P2PDMA: Make pci_p2pdma_map... Logan Gunthorpe
- [PATCH 05/16] dma-mapping: Introduce dma_map_sg_p2pdma() Logan Gunthorpe