From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Hellwig Subject: Re: [PATCH 5/9] PCI: host: brcmstb: add dma-ranges for inbound traffic Date: Thu, 19 Oct 2017 11:16:44 +0200 Message-ID: <20171019091644.GA14983@lst.de> References: <1507761269-7017-1-git-send-email-jim2101024@gmail.com> <1507761269-7017-6-git-send-email-jim2101024@gmail.com> <589c04cb-061b-a453-3188-79324a02388e@arm.com> <20171017081422.GA19475@lst.de> <20171018065316.GA11183@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Jim Quinlan Cc: Mark Rutland , linux-mips-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org, Florian Fainelli , devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-pci , Kevin Cernekee , Will Deacon , linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Ralf Baechle , iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, Rob Herring , bcm-kernel-feedback-list , Gregory Fong , Catalin Marinas , Bjorn Helgaas , Brian Norris , Christoph Hellwig , linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org List-Id: iommu@lists.linux-foundation.org On Wed, Oct 18, 2017 at 10:41:17AM -0400, Jim Quinlan wrote: > That's what brcm_to_{pci,cpu} are for -- they keep a list of the > dma-ranges given in the PCIe DT node, and translate from system memory > addresses to pci-space addresses, and vice versa. As long as people > are using the DMA API it should work. It works for all of the ARM, > ARM64, and MIPS Broadcom systems I've tested, using eight different EP > devices. Note that I am not thrilled to be advocating this mechanism > but it seemed the best alternative. Say we are using your original example ranges: memc0-a@[ 0....3fffffff] <=> pci@[ 0....3fffffff] memc0-b@[100000000...13fffffff] <=> pci@[ 40000000....7fffffff] memc1-a@[ 40000000....7fffffff] <=> pci@[ 80000000....bfffffff] memc1-b@[300000000...33fffffff] <=> pci@[ c0000000....ffffffff] memc2-a@[ 80000000....bfffffff] <=> pci@[100000000...13fffffff] memc2-b@[c00000000...c3fffffff] <=> pci@[140000000...17fffffff] and now you get a dma mapping request for physical addresses 3fffff00 to 4000000f, which would span two of your ranges. How is this going to work? > I would prefer that the same code work for all three architectures. > What I would like from ARM/ARM64 is the ability to override > phys_to_dma() and dma_to_phys(); I thought the chances of that being > accepted would be slim. But you are right, I should ask the > maintainers. It is still better than trying to stack dma ops, which is a receipe for problems down the road. From mboxrd@z Thu Jan 1 00:00:00 1970 Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 19 Oct 2017 11:16:56 +0200 (CEST) Received: from verein.lst.de ([213.95.11.211]:59634 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP id S23990414AbdJSJQuC56VX (ORCPT ); Thu, 19 Oct 2017 11:16:50 +0200 Received: by newverein.lst.de (Postfix, from userid 2407) id E7D99DE7AB; Thu, 19 Oct 2017 11:16:44 +0200 (CEST) Date: Thu, 19 Oct 2017 11:16:44 +0200 From: Christoph Hellwig To: Jim Quinlan Cc: Christoph Hellwig , Robin Murphy , linux-kernel@vger.kernel.org, Mark Rutland , linux-mips@linux-mips.org, Florian Fainelli , devicetree@vger.kernel.org, linux-pci , Kevin Cernekee , Will Deacon , Ralf Baechle , Rob Herring , bcm-kernel-feedback-list , Gregory Fong , Catalin Marinas , Bjorn Helgaas , Brian Norris , linux-arm-kernel@lists.infradead.org, Marek Szyprowski , iommu@lists.linux-foundation.org Subject: Re: [PATCH 5/9] PCI: host: brcmstb: add dma-ranges for inbound traffic Message-ID: <20171019091644.GA14983@lst.de> References: <1507761269-7017-1-git-send-email-jim2101024@gmail.com> <1507761269-7017-6-git-send-email-jim2101024@gmail.com> <589c04cb-061b-a453-3188-79324a02388e@arm.com> <20171017081422.GA19475@lst.de> <20171018065316.GA11183@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Return-Path: X-Envelope-To: <"|/home/ecartis/ecartis -s linux-mips"> (uid 0) X-Orcpt: rfc822;linux-mips@linux-mips.org Original-Recipient: rfc822;linux-mips@linux-mips.org X-archive-position: 60457 X-ecartis-version: Ecartis v1.0.0 Sender: linux-mips-bounce@linux-mips.org Errors-to: linux-mips-bounce@linux-mips.org X-original-sender: hch@lst.de Precedence: bulk List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: linux-mips X-List-ID: linux-mips List-subscribe: List-owner: List-post: List-archive: X-list: linux-mips On Wed, Oct 18, 2017 at 10:41:17AM -0400, Jim Quinlan wrote: > That's what brcm_to_{pci,cpu} are for -- they keep a list of the > dma-ranges given in the PCIe DT node, and translate from system memory > addresses to pci-space addresses, and vice versa. As long as people > are using the DMA API it should work. It works for all of the ARM, > ARM64, and MIPS Broadcom systems I've tested, using eight different EP > devices. Note that I am not thrilled to be advocating this mechanism > but it seemed the best alternative. Say we are using your original example ranges: memc0-a@[ 0....3fffffff] <=> pci@[ 0....3fffffff] memc0-b@[100000000...13fffffff] <=> pci@[ 40000000....7fffffff] memc1-a@[ 40000000....7fffffff] <=> pci@[ 80000000....bfffffff] memc1-b@[300000000...33fffffff] <=> pci@[ c0000000....ffffffff] memc2-a@[ 80000000....bfffffff] <=> pci@[100000000...13fffffff] memc2-b@[c00000000...c3fffffff] <=> pci@[140000000...17fffffff] and now you get a dma mapping request for physical addresses 3fffff00 to 4000000f, which would span two of your ranges. How is this going to work? > I would prefer that the same code work for all three architectures. > What I would like from ARM/ARM64 is the ability to override > phys_to_dma() and dma_to_phys(); I thought the chances of that being > accepted would be slim. But you are right, I should ask the > maintainers. It is still better than trying to stack dma ops, which is a receipe for problems down the road. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Return-Path: Date: Thu, 19 Oct 2017 11:16:44 +0200 From: Christoph Hellwig To: Jim Quinlan Subject: Re: [PATCH 5/9] PCI: host: brcmstb: add dma-ranges for inbound traffic Message-ID: <20171019091644.GA14983@lst.de> References: <1507761269-7017-1-git-send-email-jim2101024@gmail.com> <1507761269-7017-6-git-send-email-jim2101024@gmail.com> <589c04cb-061b-a453-3188-79324a02388e@arm.com> <20171017081422.GA19475@lst.de> <20171018065316.GA11183@lst.de> MIME-Version: 1.0 In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , linux-mips@linux-mips.org, Florian Fainelli , devicetree@vger.kernel.org, linux-pci , Kevin Cernekee , Will Deacon , linux-kernel@vger.kernel.org, Ralf Baechle , iommu@lists.linux-foundation.org, Rob Herring , bcm-kernel-feedback-list , Gregory Fong , Catalin Marinas , Bjorn Helgaas , Brian Norris , Robin Murphy , Christoph Hellwig , linux-arm-kernel@lists.infradead.org, Marek Szyprowski Content-Type: text/plain; charset="us-ascii" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+bjorn=helgaas.com@lists.infradead.org List-ID: On Wed, Oct 18, 2017 at 10:41:17AM -0400, Jim Quinlan wrote: > That's what brcm_to_{pci,cpu} are for -- they keep a list of the > dma-ranges given in the PCIe DT node, and translate from system memory > addresses to pci-space addresses, and vice versa. As long as people > are using the DMA API it should work. It works for all of the ARM, > ARM64, and MIPS Broadcom systems I've tested, using eight different EP > devices. Note that I am not thrilled to be advocating this mechanism > but it seemed the best alternative. Say we are using your original example ranges: memc0-a@[ 0....3fffffff] <=> pci@[ 0....3fffffff] memc0-b@[100000000...13fffffff] <=> pci@[ 40000000....7fffffff] memc1-a@[ 40000000....7fffffff] <=> pci@[ 80000000....bfffffff] memc1-b@[300000000...33fffffff] <=> pci@[ c0000000....ffffffff] memc2-a@[ 80000000....bfffffff] <=> pci@[100000000...13fffffff] memc2-b@[c00000000...c3fffffff] <=> pci@[140000000...17fffffff] and now you get a dma mapping request for physical addresses 3fffff00 to 4000000f, which would span two of your ranges. How is this going to work? > I would prefer that the same code work for all three architectures. > What I would like from ARM/ARM64 is the ability to override > phys_to_dma() and dma_to_phys(); I thought the chances of that being > accepted would be slim. But you are right, I should ask the > maintainers. It is still better than trying to stack dma ops, which is a receipe for problems down the road. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 From: hch@lst.de (Christoph Hellwig) Date: Thu, 19 Oct 2017 11:16:44 +0200 Subject: [PATCH 5/9] PCI: host: brcmstb: add dma-ranges for inbound traffic In-Reply-To: References: <1507761269-7017-1-git-send-email-jim2101024@gmail.com> <1507761269-7017-6-git-send-email-jim2101024@gmail.com> <589c04cb-061b-a453-3188-79324a02388e@arm.com> <20171017081422.GA19475@lst.de> <20171018065316.GA11183@lst.de> Message-ID: <20171019091644.GA14983@lst.de> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Wed, Oct 18, 2017 at 10:41:17AM -0400, Jim Quinlan wrote: > That's what brcm_to_{pci,cpu} are for -- they keep a list of the > dma-ranges given in the PCIe DT node, and translate from system memory > addresses to pci-space addresses, and vice versa. As long as people > are using the DMA API it should work. It works for all of the ARM, > ARM64, and MIPS Broadcom systems I've tested, using eight different EP > devices. Note that I am not thrilled to be advocating this mechanism > but it seemed the best alternative. Say we are using your original example ranges: memc0-a@[ 0....3fffffff] <=> pci@[ 0....3fffffff] memc0-b@[100000000...13fffffff] <=> pci@[ 40000000....7fffffff] memc1-a@[ 40000000....7fffffff] <=> pci@[ 80000000....bfffffff] memc1-b@[300000000...33fffffff] <=> pci@[ c0000000....ffffffff] memc2-a@[ 80000000....bfffffff] <=> pci@[100000000...13fffffff] memc2-b@[c00000000...c3fffffff] <=> pci@[140000000...17fffffff] and now you get a dma mapping request for physical addresses 3fffff00 to 4000000f, which would span two of your ranges. How is this going to work? > I would prefer that the same code work for all three architectures. > What I would like from ARM/ARM64 is the ability to override > phys_to_dma() and dma_to_phys(); I thought the chances of that being > accepted would be slim. But you are right, I should ask the > maintainers. It is still better than trying to stack dma ops, which is a receipe for problems down the road.