From: Florian Fainelli <f.fainelli@gmail.com>
To: Robin Murphy <robin.murphy@arm.com>,
Nicolas Saenz Julienne <nsaenzjulienne@suse.de>,
linux-pci <linux-pci@vger.kernel.org>,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
linux-rpi-kernel <linux-rpi-kernel@lists.infradead.org>,
devicetree <devicetree@vger.kernel.org>
Cc: Rob Herring <robh@kernel.org>,
Florian Fainelli <f.fainelli@gmail.com>,
Bjorn Helgaas <helgaas@kernel.org>,
Robin Murphy <robin.murphy@arm.con>,
bcm-kernel-feedback-list <bcm-kernel-feedback-list@broadcom.com>
Subject: Re: RPi4 can't deal with 64 bit PCI accesses
Date: Wed, 24 Feb 2021 08:55:10 -0800 [thread overview]
Message-ID: <6088038a-2366-2f63-0678-c65a0d2efabd@gmail.com> (raw)
In-Reply-To: <2220c875-f327-586c-79c7-eadff87e4b4d@arm.com>
On 2/22/2021 8:56 AM, Robin Murphy wrote:
> On 2021-02-22 15:47, Nicolas Saenz Julienne wrote:
>> Hi everyone,
>> Raspberry Pi 4, a 64bit arm system on chip, contains a PCIe bus that
>> can't
>> handle 64bit accesses to its MMIO address space, in other words,
>> writeq() has
>> to be split into two distinct writel() operations. This isn't ideal,
>> as it
>> misrepresents PCI's promise of being able to treat device memory as
>> regular
>> memory, ultimately breaking a bunch of PCI device drivers[1].
>>
>> I'd like to have a go at fixing this in a way that can be distributed
>> in a
>> generic distro without prejudice to other users.
>>
>> AFAIK there is no way to detect this limitation through generic PCIe
>> capabilities, so one solution would be to expose it through firmware
>> (devicetree in this case), and pass the limitations through 'struct
>> device' so
>> as for the drivers to choose the right access method in a way that
>> doesn't
>> affect performance much[2]. All in all, most of this doesn't need to be
>> PCI-centric as the property could be applied to any MMIO bus.
>
> It is indeed something that people can get wrong with internal buses as
> well - for example commit f2d9848aeb9f is such a workaround, also
> conveniently illustrating the case of significant functionality having
> to be disabled where the device *does* require 64-bit atomicity for
> correctness.
>
> Working around kernel I/O accessors is all very well, but another
> concern for PCI in particular is when things like framebuffer memory can
> get mmap'ed into userspace (or even memremap'ed within the kernel). Even
> in AArch32, compiled code may result in 64-bit accesses being generated
> depending on how the CPU and interconnect handle LDRD/STRD/LDM/STM/etc.,
> so it's basically not safe to ever let that happen at all.
Agreed, this makes finding a generic solution a tiny bit harder. Do you
have something in mind Nicolas?
--
Florian
next prev parent reply other threads:[~2021-02-24 16:57 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-22 15:47 RPi4 can't deal with 64 bit PCI accesses Nicolas Saenz Julienne
2021-02-22 16:18 ` Ard Biesheuvel
2021-02-22 16:36 ` Nicolas Saenz Julienne
2021-02-22 16:56 ` Robin Murphy
2021-02-24 16:55 ` Florian Fainelli [this message]
2021-02-24 20:25 ` Christoph Hellwig
2021-02-24 20:35 ` Florian Fainelli
2021-02-25 10:29 ` Neil Armstrong
2021-02-25 11:10 ` Robin Murphy
2021-02-25 11:35 ` Nicolas Saenz Julienne
2021-02-26 5:32 ` Christoph Hellwig
2021-02-25 10:41 ` David Woodhouse
2021-02-22 17:55 ` Russell King - ARM Linux admin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6088038a-2366-2f63-0678-c65a0d2efabd@gmail.com \
--to=f.fainelli@gmail.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=devicetree@vger.kernel.org \
--cc=helgaas@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=nsaenzjulienne@suse.de \
--cc=robh@kernel.org \
--cc=robin.murphy@arm.com \
--cc=robin.murphy@arm.con \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).