On Sat, Oct 09, 2021 at 06:49:36PM +0800, Dongdong Liu wrote: > Add a 10-Bit Tag check in the P2PDMA code to ensure that a device with > 10-Bit Tag Requester doesn't interact with a device that does not > support 10-Bit Tag Completer. Before that happens, the kernel should > emit a warning. > Signed-off-by: Dongdong Liu <liudongdong3@xxxxxxxxxx> > Reviewed-by: Logan Gunthorpe <logang@xxxxxxxxxxxx> > @@ -532,6 +577,9 @@ calc_map_type_and_dist(struct pci_dev *provider, struct pci_dev *client, > map_type = PCI_P2PDMA_MAP_NOT_SUPPORTED; > } > done: > + if (pci_10bit_tags_unsupported(client, provider, verbose)) > + map_type = PCI_P2PDMA_MAP_NOT_SUPPORTED; I need to be convinced that this check is in the right spot to catch all potential P2PDMA situations. The pci_p2pmem_find() and pci_p2pdma_distance() interfaces eventually call calc_map_type_and_dist(). But those interfaces don't actually produce DMA bus addresses, and I'm not convinced that all P2PDMA users use them. nvme *does* use them, but infiniband (rdma_rw_map_sg()) does not, and it calls pci_p2pdma_map_sg(). amdgpu_dma_buf_attach() calls pci_p2pdma_distance_many() but I don't know where it sets up P2PDMA transactions. cxgb4 and qed mention "peer2peer", but I don't know whether they are related; they don't seem to use any pci_p2p.* interfaces. > rcu_read_lock(); > p2pdma = rcu_dereference(provider->p2pdma); > if (p2pdma) > -- > 2.22.0 >