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 11:35:00 +0000 Message-ID: <20170322113500.GA3940@red-moon> References: <1490123810-12383-1-git-send-email-ard.biesheuvel@linaro.org> <20170322102939.GB3519@red-moon> <35F65528-FC1F-4813-A0C6-641CF864212A@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <35F65528-FC1F-4813-A0C6-641CF864212A-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> Sender: linux-efi-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Ard Biesheuvel Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, matt-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org, pjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org, bhelgaas-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org, hanjun.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org, heyi.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org, linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, yinghai-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org List-Id: linux-efi@vger.kernel.org [+Yinghai] On Wed, Mar 22, 2017 at 11:08:48AM +0000, Ard Biesheuvel wrote: > > > On 22 Mar 2017, at 10:29, Lorenzo Pieralisi wrote: > > > >> 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