[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b8e4d303-f226-53d9-f383-73872e41002b@arm.com>
Date: Wed, 13 Nov 2019 21:24:52 +0000
From: Robin Murphy <robin.murphy@....com>
To: Florian Fainelli <f.fainelli@...il.com>,
Nicolas Saenz Julienne <nsaenzjulienne@...e.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Andy Lutomirski <luto@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
Hanjun Guo <guohanjun@...wei.com>,
Sudeep Holla <sudeep.holla@....com>,
Jens Axboe <axboe@...nel.dk>, Joerg Roedel <joro@...tes.org>,
Rob Herring <robh+dt@...nel.org>,
Frank Rowand <frowand.list@...il.com>,
Christoph Hellwig <hch@....de>,
Marek Szyprowski <m.szyprowski@...sung.com>
Cc: Benjamin Herrenschmidt <benh@...nel.crashing.org>,
linux-mips@...r.kernel.org, linux-ide@...r.kernel.org,
Paul Mackerras <paulus@...ba.org>,
"H. Peter Anvin" <hpa@...or.com>,
Paul Burton <paulburton@...nel.org>,
Michael Ellerman <mpe@...erman.id.au>, x86@...nel.org,
phil@...pberrypi.org, linux-acpi@...r.kernel.org,
Ingo Molnar <mingo@...hat.com>, linux-pci@...r.kernel.org,
James Hogan <jhogan@...nel.org>, Len Brown <lenb@...nel.org>,
devicetree@...r.kernel.org, Borislav Petkov <bp@...en8.de>,
Thomas Gleixner <tglx@...utronix.de>,
linux-arm-kernel@...ts.infradead.org,
"Rafael J. Wysocki" <rjw@...ysocki.net>,
linux-kernel@...r.kernel.org, Ralf Baechle <ralf@...ux-mips.org>,
iommu@...ts.linux-foundation.org, linuxppc-dev@...ts.ozlabs.org
Subject: Re: [PATCH] dma-mapping: treat dev->bus_dma_mask as a DMA limit
On 2019-11-13 8:41 pm, Florian Fainelli wrote:
> On 11/13/19 12:34 PM, Robin Murphy wrote:
>> On 13/11/2019 4:13 pm, Nicolas Saenz Julienne wrote:
>>> Using a mask to represent bus DMA constraints has a set of limitations.
>>> The biggest one being it can only hold a power of two (minus one). The
>>> DMA mapping code is already aware of this and treats dev->bus_dma_mask
>>> as a limit. This quirk is already used by some architectures although
>>> still rare.
>>>
>>> With the introduction of the Raspberry Pi 4 we've found a new contender
>>> for the use of bus DMA limits, as its PCIe bus can only address the
>>> lower 3GB of memory (of a total of 4GB). This is impossible to represent
>>> with a mask. To make things worse the device-tree code rounds non power
>>> of two bus DMA limits to the next power of two, which is unacceptable in
>>> this case.
>>>
>>> In the light of this, rename dev->bus_dma_mask to dev->bus_dma_limit all
>>> over the tree and treat it as such. Note that dev->bus_dma_limit is
>>> meant to contain the higher accesible DMA address.
>>
>> Neat, you win a "why didn't I do it that way in the first place?" :)
>>
>> Looking at it without all the history of previous attempts, this looks
>> entirely reasonable, and definitely a step in the right direction.
>
> And while you are changing those, would it make sense to not only rename
> the structure member but introduce a getter and setter in order to ease
> future work where this would no longer be a scalar?
I doubt it - once we get as a far as supporting multiple DMA ranges,
there will be a whole load of infrastructure churn anyway if only to
replace dma_pfn_offset, and I'm not sure a simple get/set paradigm would
even be viable, so it's probably better to save that until clearly
necessary.
Robin.
Powered by blists - more mailing lists