From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: "linux-efi@vger.kernel.org" <linux-efi@vger.kernel.org>,
Matt Fleming <matt@codeblueprint.co.uk>,
linux-pci <linux-pci@vger.kernel.org>,
Peter Jones <pjones@redhat.com>, Heyi Guo <heyi.guo@linaro.org>,
Lukas Wunner <lukas@wunner.de>,
Hanjun Guo <hanjun.guo@linaro.org>,
Bjorn Helgaas <bhelgaas@google.com>,
Yinghai Lu <yinghai@kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v3] efifb: avoid reconfiguration of BAR that covers the framebuffer
Date: Thu, 23 Mar 2017 10:57:27 +0000 [thread overview]
Message-ID: <20170323105727.GA2441@red-moon> (raw)
In-Reply-To: <CAKv+Gu93eJ-js3g7M6Jdm6XGMaWMswFmzBG2qNT4rn+3=1+EyA@mail.gmail.com>
On Thu, Mar 23, 2017 at 09:04:03AM +0000, Ard Biesheuvel wrote:
> On 23 March 2017 at 08:48, Lukas Wunner <lukas@wunner.de> wrote:
> > On Wed, Mar 22, 2017 at 07:32:43PM +0000, Ard Biesheuvel wrote:
> >> On 22 March 2017 at 19:31, Lukas Wunner <lukas@wunner.de> wrote:
> >> > On Wed, Mar 22, 2017 at 03:30:29PM +0000, Ard Biesheuvel wrote:
> >> >> On UEFI systems, the PCI subsystem is enumerated by the firmware,
> >> >> and if a graphical framebuffer is exposed by a PCI device, its base
> >> >> address and size are exposed to the OS via the Graphics Output
> >> >> Protocol (GOP).
> >> >>
> >> >> On arm64 PCI systems, the entire PCI hierarchy is reconfigured from
> >> >> scratch at boot. This may result in the GOP framebuffer address to
> >> >> become stale, if the BAR covering the framebuffer is modified. This
> >> >> will cause the framebuffer to become unresponsive, and may in some
> >> >> cases result in unpredictable behavior if the range is reassigned to
> >> >> another device.
> >> >
> >> > Hm, commit message seems to indicate the issue is restricted to arm64,
> >> > yet there's no IS_ENABLED(ARM64) to constrain the added code to that arch?
> >>
> >> True. I am eager to get some x86 coverage for this, since I would
> >> expect this not to do any harm. But I'm fine with making it ARM/arm64
> >> specific in the final version.
> >
> > I see. IIUC, this is only a problem because pci_bus_assign_resources()
> > is called from arch/arm64/kernel/pci.c:pci_acpi_scan_root() (as well as
> > the host drivers) and x86 isn't affected because it doesn't do that.
> >
>
> Correct. But on x86 (or rather, on a PC), you can be sure that UEFI
> (or the legacy PCI bios) performed the resource assignment already.
> One could argue that this is equally the case when running arm64 in
> ACPI mode, but in general, you cannot assume the presence of firmware
> on ARM/arm64 that has already taken care of this, and so the state of
> the BARs has to be presumed invalid.
The story is a bit more convoluted than that owing to x86 (and other
arches) legacy.
x86 tries to claim all PCI resources (in two passes - first enabled
devices, second disabled devices) and that predates ACPI/UEFI.
Mind, x86 reassign resources that can't be claimed too, the only
difference with ARM64 is that, for the better or the worse, we
have decided not to claim the FW PCI set-up on ARM64 even if it
is sane, we do not even try, it was a deliberate choice.
This patch should be harmless on x86 since if the FB PCI BAR is set
up sanely, claiming it again should be a nop (to be checked).
For all the talk about PCI being arch agnostic as I said manifold
times before, that's just theory. In practice different arches
treat PCI FW set-up differently, it would be ideal to make them
uniform but legacy is huge and there is a massive risk of triggering
regressions, it is no mean feat (if achievable at all).
Lorenzo
> > I have no opinion on executing the quirk on x86 as well, I was just
> > confused by the discrepancy between commit message and patch, but that
> > can easily be remedied with a copy+paste of what you replied to Sinan:
> >
> > "On x86, it works, given that BARs are usually not reassigned,
> > and so the patch should be a no-op in that case, although it
> > should still be an improvement to check whether the device that
> > owns the BAR actually has memory decoding enabled before we
> > attach the framebuffer driver to it."
> >
> >
>
> OK, I will include that.
>
> >> >> +DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, efifb_fixup_resources);
> >> >
> >> > Maybe this can be constrained to PCI_BASE_CLASS_DISPLAY?
> >>
> >> How does one do that with DECLARE_PCI_FIXUP_HEADER?
> >
> > With DECLARE_PCI_FIXUP_CLASS_HEADER().
> >
>
> Ah ok, thanks for pointing that out.
>
> I do wonder whether it makes sense to keep the code as is, so that we
> spot unexpected configurations, i.e., where the GOP points into a BAR
> that is unrelated to graphics. In this case, I think we should disable
> efifb rather than proceed without claiming any PCI resources (as we
> did without this patch)
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2017-03-23 10:57 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-22 15:30 [PATCH v3] efifb: avoid reconfiguration of BAR that covers the framebuffer Ard Biesheuvel
2017-03-22 19:31 ` Lukas Wunner
2017-03-22 19:32 ` Ard Biesheuvel
2017-03-23 8:48 ` Lukas Wunner
2017-03-23 9:04 ` Ard Biesheuvel
2017-03-23 10:57 ` Lorenzo Pieralisi [this message]
2017-03-23 12:25 ` Ard Biesheuvel
2017-03-23 14:31 ` Lorenzo Pieralisi
2017-03-23 15:15 ` Ard Biesheuvel
2017-03-27 15:37 ` Ard Biesheuvel
2017-03-28 21:27 ` Sinan Kaya
2017-03-28 21:39 ` Ard Biesheuvel
2017-03-28 21:49 ` Sinan Kaya
2017-03-30 8:46 ` Ard Biesheuvel
2017-03-30 10:05 ` Lorenzo Pieralisi
2017-03-30 10:09 ` Ard Biesheuvel
2017-03-30 11:42 ` okaya
2017-03-30 13:38 ` Ard Biesheuvel
2017-03-30 13:50 ` Sinan Kaya
2017-04-02 15:16 ` Ard Biesheuvel
2017-04-10 15:28 ` Ard Biesheuvel
2017-04-10 16:53 ` Lorenzo Pieralisi
2017-04-10 17:06 ` Sinan Kaya
2017-04-10 17:13 ` Ard Biesheuvel
2017-04-10 17:29 ` Ard Biesheuvel
2017-04-11 13:16 ` Lorenzo Pieralisi
2017-04-11 16:06 ` Ard Biesheuvel
2017-04-23 1:45 ` Yinghai Lu
2017-04-27 13:55 ` Ard Biesheuvel
2017-04-28 20:51 ` Yinghai Lu
2017-03-22 19:36 ` Sinan Kaya
2017-03-22 19:41 ` Ard Biesheuvel
2017-03-22 19:49 ` Sinan Kaya
2017-03-22 19:52 ` Ard Biesheuvel
2017-03-22 19:57 ` Sinan Kaya
2017-03-22 20:00 ` Ard Biesheuvel
2017-05-03 3:09 ` Heyi Guo
2017-05-18 14:01 ` Bjorn Helgaas
2017-05-20 8:19 ` Heyi Guo
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=20170323105727.GA2441@red-moon \
--to=lorenzo.pieralisi@arm.com \
--cc=ard.biesheuvel@linaro.org \
--cc=bhelgaas@google.com \
--cc=hanjun.guo@linaro.org \
--cc=heyi.guo@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=matt@codeblueprint.co.uk \
--cc=pjones@redhat.com \
--cc=yinghai@kernel.org \
/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).