This is the third and final part of my series to start supporting P2P with DMA-buf.
The implementation is straight forward, apart from a helper to aid constructing scatterlists without having struct pages we only add a new flag indicating that an DMA-buf importer can handle peer2peer.
The exporter can then check if P2P is general possible using the pci_p2pdma_distance_many() function and if necessary can also clear the flag.
The rest is an example how to implementing the necessary functionality into the amdgpu driver to setup scatterlists pointing to device memory.
Please review and comment, Christian.