[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6e4880b3-1fb6-0cbf-c1a5-7a46fd9ccf62@marcan.st>
Date: Sat, 6 Mar 2021 03:18:16 +0900
From: Hector Martin <marcan@...can.st>
To: Rob Herring <robh@...nel.org>
Cc: linux-arm-kernel <linux-arm-kernel@...ts.infradead.org>,
Marc Zyngier <maz@...nel.org>, Arnd Bergmann <arnd@...nel.org>,
Olof Johansson <olof@...om.net>,
Krzysztof Kozlowski <krzk@...nel.org>,
Mark Kettenis <mark.kettenis@...all.nl>,
Tony Lindgren <tony@...mide.com>,
Mohamed Mediouni <mohamed.mediouni@...amail.com>,
Stan Skowronek <stan@...ellium.com>,
Alexander Graf <graf@...zon.com>,
Will Deacon <will@...nel.org>,
Linus Walleij <linus.walleij@...aro.org>,
Mark Rutland <mark.rutland@....com>,
Andy Shevchenko <andy.shevchenko@...il.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jonathan Corbet <corbet@....net>,
Catalin Marinas <catalin.marinas@....com>,
Christoph Hellwig <hch@...radead.org>,
"David S. Miller" <davem@...emloft.net>,
devicetree@...r.kernel.org,
"open list:SERIAL DRIVERS" <linux-serial@...r.kernel.org>,
Linux Doc Mailing List <linux-doc@...r.kernel.org>,
linux-samsung-soc <linux-samsung-soc@...r.kernel.org>,
"open list:GENERIC INCLUDE/ASM HEADER FILES"
<linux-arch@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [RFT PATCH v3 12/27] of/address: Add infrastructure to declare
MMIO as non-posted
On 06/03/2021 02.39, Rob Herring wrote:
> I'm still a little hesitant to add these properties and having some
> default. I worry about a similar situation as 'dma-coherent' where the
> assumed default on non-coherent on Arm doesn't work for PowerPC which
> defaults coherent. More below on this.
The intent of the default here is that it matches what ioremap() does on
other platforms already (where it does not make any claims of being
posted, though it could be on some platforms). It could be per-platform
what that means... but either way it should be what drivers get today
without asking for anything special.
>> - return ioremap(res.start, resource_size(&res));
>> + if (res.flags & IORESOURCE_MEM_NONPOSTED)
>> + return ioremap_np(res.start, resource_size(&res));
>> + else
>> + return ioremap(res.start, resource_size(&res));
>
> This and the devm variants all scream for a ioremap_extended()
> function. IOW, it would be better if the ioremap flavor was a
> parameter. Unless we could implement that just for arm64 first, that's
> a lot of refactoring...
I agree, but yeah... that's one big refactor to try to do now...
> What's the code path using these functions on the M1 where we need to
> return 'posted'? It's just downstream PCI mappings (PCI memory space),
> right? Those would never hit these paths because they don't have a DT
> node or if they do the memory space is not part of it. So can't the
> check just be:
>
> bool of_mmio_is_nonposted(struct device_node *np)
> {
> return np && of_machine_is_compatible("apple,arm-platform");
> }
Yes; the implementation was trying to be generic, but AIUI we don't need
this on M1 because the PCI mappings don't go through this codepath, and
nothing else needs posted mode. My first hack was something not too
unlike this, then I was going to get rid of apple,arm-platform and just
have this be a generic mechanism with the properties, but then we added
the optimization to not do the lookups on other platforms, and now we're
coming full circle... :-)
If you prefer to handle it this way for now I can do it like this. I
think we should still have the DT bindings and properties though (even
if not used), as they do describe the hardware properly, and in the
future we might want to use them instead of having a quirk.
--
Hector Martin (marcan@...can.st)
Public Key: https://mrcn.st/pub
Powered by blists - more mailing lists