From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751272AbdJWJFx (ORCPT ); Mon, 23 Oct 2017 05:05:53 -0400 Received: from smtp-out6.electric.net ([192.162.217.181]:58123 "EHLO smtp-out6.electric.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750811AbdJWJFv (ORCPT ); Mon, 23 Oct 2017 05:05:51 -0400 From: David Laight To: "'Jim Quinlan'" , Christoph Hellwig CC: Robin Murphy , "linux-kernel@vger.kernel.org" , Mark Rutland , Linux-MIPS , 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 Thread-Topic: [PATCH 5/9] PCI: host: brcmstb: add dma-ranges for inbound traffic Thread-Index: AQHTSbf9TBl9DXAo7kWMSYcuxab+MqLxJ8ng Date: Mon, 23 Oct 2017 09:06:03 +0000 Message-ID: <063D6719AE5E284EB5DD2968C1650D6DD009F05A@AcuExch.aculab.com> References: <1507761269-7017-6-git-send-email-jim2101024@gmail.com> <589c04cb-061b-a453-3188-79324a02388e@arm.com> <20171017081422.GA19475@lst.de> <20171018065316.GA11183@lst.de> <20171019091644.GA14983@lst.de> <20171020073730.GA12937@lst.de> <20171020145752.GA4694@lst.de> In-Reply-To: Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.202.99.200] Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 X-Outbound-IP: 156.67.243.126 X-Env-From: David.Laight@ACULAB.COM X-Proto: esmtps X-Revdns: X-HELO: AcuExch.aculab.com X-TLS: TLSv1:AES128-SHA:128 X-Authenticated_ID: X-PolicySMART: 3396946, 3397078 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by nfs id v9N95vnL021647 From: Jim Quinlan > Sent: 20 October 2017 16:28 > On Fri, Oct 20, 2017 at 10:57 AM, Christoph Hellwig wrote: > > On Fri, Oct 20, 2017 at 10:41:56AM -0400, Jim Quinlan wrote: > >> I am not sure I understand your comment -- the size of the request > >> shouldn't be a factor. Let's look at your example of the DMA request > >> of 3fffff00 to 4000000f (physical memory). Lets say it is for 15 > >> pages. If we block out the last page [0x3ffff000..0x3fffffff] from > >> what is available, there is no 15 page span that can happen across the > >> 0x40000000 boundary. For SG, there can be no merge that connects a > >> page from one region to another region. Can you give an example of > >> the scenario you are thinking of? > > > > What prevents a merge from say the regions of > > 0....3fffffff and 40000000....7fffffff? > > Huh? [0x3ffff000...x3ffffff] is not available to be used. Drawing from > the original example, we now have to tell Linux that these are now our > effective memory regions: > > memc0-a@[ 0....3fffefff] <=> pci@[ 0....3fffefff] > memc0-b@[100000000...13fffefff] <=> pci@[ 40000000....7fffefff] > memc1-a@[ 40000000....7fffefff] <=> pci@[ 80000000....bfffefff] > memc1-b@[300000000...33fffefff] <=> pci@[ c0000000....ffffefff] > memc2-a@[ 80000000....bfffefff] <=> pci@[100000000...13fffefff] > memc2-b@[c00000000...c3fffffff] <=> pci@[140000000...17fffffff] > > This leaves a one-page gap between phsyical memory regions which would > normally be contiguous. One cannot have a dma alloc that spans any two > regions. This is a drastic step, but I don't see an alternative. > Perhaps I may be missing what you are saying... Isn't this all unnecessary? Both kmalloc() and dma_alloc() are constrained to allocate memory that doesn't cross an address boundary that is larger than the size. So if you allocate 16k it won't cross a 16k physical address boundary. David