Received: by 10.192.165.148 with SMTP id m20csp3643835imm; Mon, 7 May 2018 16:21:05 -0700 (PDT) X-Google-Smtp-Source: AB8JxZq0Jzaxh4Iw38mQbeKNiFtHU1rUflP7CSe+gDnkHrGp8JXdYP/leO0g81C5fMh7k8dFhR9S X-Received: by 2002:a17:902:7149:: with SMTP id u9-v6mr38803515plm.356.1525735265858; Mon, 07 May 2018 16:21:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525735265; cv=none; d=google.com; s=arc-20160816; b=Ip84PpSwkhOcaIUfuFa9e3dx6IF3dSAN7m7ptQCQMp1wFGwmeciBrnIIB8wGT2poVc 4gwEOkMbHfM7eP+p7DL7RbKa6STKnaqUrjFqfey4sQc5FpgdhbwN0GNvfIEZqJIAoRsD IQmZAQ9I508cXVOE8Mj42mXciYReBphZcrPPtOqBR1Ijut4gNWDSQNlCfONpwwO82RJh YeEoFvIMiBji4shR7nlZ0Z59IaxBG6GiCLhiIM0HiXz9R3E+GqThfaPhWRIjRQieyywN aWTJ87I95KHpB0ETUZ67qL99mSF1YNUANDB//vThzBc9C+xUj55u1Hyv2JZzhsI6Ku0R H+Eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=UxFPkH92RCbKBmzQi7xDZSqiKnpyE5u9q1L1qoNbUPo=; b=GRxF0lu6ZBWL+FViQ7q+oIkz5RpqC6LBkkCoKVAFm78rzJ0skFUVqURzz9chDjPk85 8dsjO04umv1JSx/zsT25W0+glnT11cySSG7MnwndTc+sVMty8eXpfteF14Le5d6l0mOB YJK4ml6BrYkn9tAGnt7Rg/J0FCXZUZtYujEDMhnhm4SOnCIjsgUTbsDtcav1qR1tUXfL vKjsP7Jt4WHVm61op1GL3A6SvUR4nIFi23XZJ5iU/Z77SZemj07NQ8/zmda94s8eCsAH 5+d9NxyHiTLofgX7aFa0asMyOj8cI+8AYEkoJ5xHOk775f7WrL2vpRJPzwt7B2rzSR2q I69Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IXAjp4JE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b66-v6si23731638plb.107.2018.05.07.16.20.50; Mon, 07 May 2018 16:21:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IXAjp4JE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753507AbeEGXUd (ORCPT + 99 others); Mon, 7 May 2018 19:20:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:56196 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752966AbeEGXUb (ORCPT ); Mon, 7 May 2018 19:20:31 -0400 Received: from localhost (unknown [69.71.5.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F3D172173F; Mon, 7 May 2018 23:20:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1525735231; bh=uMpChOMYQ2wC0oxRe2x8YaL2fRjO77/eg79ert1mdTg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=IXAjp4JEciGxyb228foWex0uECnArFvJGfp4OhPa/6hwtgLwx9MGGLoKnwPZioT2X K5lGm6ENi9pNrs+3ypogmNSkE4q3QVEk7+cS3PcF/WJqqR8QKOAhRb7LJhhZD7xH5K h31ZThWZ9Fef1piw4y0Ez0OddY/WRHmy40TL/OMU= Date: Mon, 7 May 2018 18:20:29 -0500 From: Bjorn Helgaas To: Logan Gunthorpe Cc: 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, Stephen Bates , 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 , Christian =?iso-8859-1?Q?K=F6nig?= , Jonathan Corbet Subject: Re: [PATCH v4 06/14] PCI/P2PDMA: Add P2P DMA driver writer's documentation Message-ID: <20180507232029.GH161390@bhelgaas-glaptop.roam.corp.google.com> References: <20180423233046.21476-1-logang@deltatee.com> <20180423233046.21476-7-logang@deltatee.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180423233046.21476-7-logang@deltatee.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 23, 2018 at 05:30:38PM -0600, Logan Gunthorpe wrote: > Add a restructured text file describing how to write drivers > with support for P2P DMA transactions. The document describes > how to use the APIs that were added in the previous few > commits. > > Also adds an index for the PCI documentation tree even though this > is the only PCI document that has been converted to restructured text > at this time. > > Signed-off-by: Logan Gunthorpe > Cc: Jonathan Corbet > --- > Documentation/PCI/index.rst | 14 +++ > Documentation/driver-api/pci/index.rst | 1 + > Documentation/driver-api/pci/p2pdma.rst | 166 ++++++++++++++++++++++++++++++++ > Documentation/index.rst | 3 +- > 4 files changed, 183 insertions(+), 1 deletion(-) > create mode 100644 Documentation/PCI/index.rst > create mode 100644 Documentation/driver-api/pci/p2pdma.rst > > diff --git a/Documentation/PCI/index.rst b/Documentation/PCI/index.rst > new file mode 100644 > index 000000000000..2fdc4b3c291d > --- /dev/null > +++ b/Documentation/PCI/index.rst > @@ -0,0 +1,14 @@ > +================================== > +Linux PCI Driver Developer's Guide > +================================== > + > +.. toctree:: > + > + p2pdma > + > +.. only:: subproject and html > + > + Indices > + ======= > + > + * :ref:`genindex` > diff --git a/Documentation/driver-api/pci/index.rst b/Documentation/driver-api/pci/index.rst > index 03b57cbf8cc2..d12eeafbfc90 100644 > --- a/Documentation/driver-api/pci/index.rst > +++ b/Documentation/driver-api/pci/index.rst > @@ -10,6 +10,7 @@ The Linux PCI driver implementer's API guide > :maxdepth: 2 > > pci > + p2pdma > > .. only:: subproject and html > > diff --git a/Documentation/driver-api/pci/p2pdma.rst b/Documentation/driver-api/pci/p2pdma.rst > new file mode 100644 > index 000000000000..49a512c405b2 > --- /dev/null > +++ b/Documentation/driver-api/pci/p2pdma.rst > @@ -0,0 +1,166 @@ > +============================ > +PCI Peer-to-Peer DMA Support > +============================ > + > +The PCI bus has pretty decent support for performing DMA transfers > +between two endpoints on the bus. This type of transaction is s/endpoints/devices/ > +henceforth called Peer-to-Peer (or P2P). However, there are a number of > +issues that make P2P transactions tricky to do in a perfectly safe way. > + > +One of the biggest issues is that PCI Root Complexes are not required s/PCI Root Complexes .../ PCI doesn't require forwarding transactions between hierarchy domains, and in PCIe, each Root Port defines a separate hierarchy domain./ > +to support forwarding packets between Root Ports. To make things worse, > +there is no simple way to determine if a given Root Complex supports > +this or not. (See PCIe r4.0, sec 1.3.1). Therefore, as of this writing, > +the kernel only supports doing P2P when the endpoints involved are all > +behind the same PCIe root port as the spec guarantees that all > +packets will always be routable but does not require routing between > +root ports. s/endpoints involved .../ devices involved are all behind the same PCI bridge, as such devices are all in the same PCI hierarchy domain, and the spec guarantees that all transactions within the hierarchy will be routable, but it does not require routing between hierarchies./ > + > +The second issue is that to make use of existing interfaces in Linux, > +memory that is used for P2P transactions needs to be backed by struct > +pages. However, PCI BARs are not typically cache coherent so there are > +a few corner case gotchas with these pages so developers need to > +be careful about what they do with them.