From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lorenzo Pieralisi Subject: Re: [PATCH v2] efifb: avoid reconfiguration of BAR that covers the framebuffer Date: Wed, 22 Mar 2017 10:29:39 +0000 Message-ID: <20170322102939.GB3519@red-moon> References: <1490123810-12383-1-git-send-email-ard.biesheuvel@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1490123810-12383-1-git-send-email-ard.biesheuvel@linaro.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=m.gmane.org@lists.infradead.org To: Ard Biesheuvel Cc: linux-efi@vger.kernel.org, matt@codeblueprint.co.uk, linux-pci@vger.kernel.org, heyi.guo@linaro.org, pjones@redhat.com, hanjun.guo@linaro.org, bhelgaas@google.com, linux-arm-kernel@lists.infradead.org List-Id: linux-efi@vger.kernel.org On Tue, Mar 21, 2017 at 07:16:50PM +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. > > So add a quirk to the EFI fb driver to find the BAR associated with > the GOP base address, and set the IORESOURCE_PCI_FIXED attribute so > that the PCI core will leave it alone. > > Signed-off-by: Ard Biesheuvel > --- > As it turns out, setting the IORESOURCE_PCI_FIXED flag is not sufficient > to make the PCI core leave the BARs alone, so instead, the BAR resource > is claimed in the quirk handler. > > As suggested by Lorenzo, a check is added that the device has memory > decoding enabled, and if it doesn't, no attempt is made to use the > EFI framebuffer. > > drivers/video/fbdev/efifb.c | 58 +++++++++++++++++++- > 1 file changed, 57 insertions(+), 1 deletion(-) > > diff --git a/drivers/video/fbdev/efifb.c b/drivers/video/fbdev/efifb.c > index 8c4dc1e1f94f..eeeaf78c4a5b 100644 > --- a/drivers/video/fbdev/efifb.c > +++ b/drivers/video/fbdev/efifb.c > @@ -10,6 +10,7 @@ > #include > #include > #include > +#include > #include > #include > #include