From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1163535AbeCAXpZ (ORCPT ); Thu, 1 Mar 2018 18:45:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:38258 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1163111AbeCAXpW (ORCPT ); Thu, 1 Mar 2018 18:45:22 -0500 DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BC5D92177C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=helgaas@kernel.org Date: Thu, 1 Mar 2018 17:45:19 -0600 From: Bjorn Helgaas To: Stephen Bates Cc: Logan Gunthorpe , "linux-kernel@vger.kernel.org" , "linux-pci@vger.kernel.org" , "linux-nvme@lists.infradead.org" , "linux-rdma@vger.kernel.org" , "linux-nvdimm@lists.01.org" , "linux-block@vger.kernel.org" , Christoph Hellwig , Jens Axboe , Keith Busch , Sagi Grimberg , Bjorn Helgaas , Jason Gunthorpe , Max Gurtovoy , Dan Williams , =?iso-8859-1?B?Suly9G1l?= Glisse , Benjamin Herrenschmidt , Alex Williamson Subject: Re: [PATCH v2 01/10] PCI/P2PDMA: Support peer to peer memory Message-ID: <20180301234519.GC74737@bhelgaas-glaptop.roam.corp.google.com> References: <20180228234006.21093-1-logang@deltatee.com> <20180228234006.21093-2-logang@deltatee.com> <20180301173752.GE13722@bhelgaas-glaptop.roam.corp.google.com> <20180301230032.GA74737@bhelgaas-glaptop.roam.corp.google.com> <9B84B347-2CCF-4250-89ED-B29892E76597@raithlin.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9B84B347-2CCF-4250-89ED-B29892E76597@raithlin.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 01, 2018 at 11:14:46PM +0000, Stephen Bates wrote: > > I'm pretty sure the spec disallows routing-to-self so doing a P2P > > transaction in that sense isn't going to work unless the device > > specifically supports it and intercepts the traffic before it gets to > > the port. > > This is correct. Unless the device intercepts the TLP before it hits > the root-port then this would be considered a "route to self" > violation and an error event would occur. The same holds for the > downstream port on a PCI switch (unless route-to-self violations are > disabled which violates the spec but which I have seen done in > certain applications). I agree that a function doing DMA to a sibling within the same multi-function device would probably not generate a TLP for it (I would be curious to read about this in the spec if you have a pointer). More fundamentally, is there some multi-function-specific restriction on peer-to-peer DMA? In conventional PCI, single-function devices on the same bus can DMA to each other. The transactions will appear on the bus, but the upstream bridge will ignore them because the address is inside the bridge's memory window. As far as I know, the same should happen on PCIe. I don't know what happens with functions of a multi-function device, either in conventional PCI or PCIe. I don't remember a restriction on whether they can DMA to each other, but maybe there is. Bjorn