From mboxrd@z Thu Jan 1 00:00:00 1970 From: lorenzo.pieralisi@arm.com (Lorenzo Pieralisi) Date: Tue, 21 Mar 2017 11:54:48 +0000 Subject: [PATCH] efifb: avoid reconfiguration of BAR that covers the framebuffer In-Reply-To: <1490048037-1850-1-git-send-email-ard.biesheuvel@linaro.org> References: <1490048037-1850-1-git-send-email-ard.biesheuvel@linaro.org> Message-ID: <20170321115447.GA3667@red-moon> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org [+Bjorn] On Mon, Mar 20, 2017 at 10:13:57PM +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. How does it currently work on eg x86 ? I suspect it just works because on x86 resources are claimed at boot and if the FB memory BAR contains reasonable values it is left alone by the kernel code reassigning resources on x86. > 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 > --- > drivers/video/fbdev/efifb.c | 33 ++++++++++++++++++++ > 1 file changed, 33 insertions(+) > > diff --git a/drivers/video/fbdev/efifb.c b/drivers/video/fbdev/efifb.c > index 8c4dc1e1f94f..97a3b15b6f04 100644 > --- a/drivers/video/fbdev/efifb.c > +++ b/drivers/video/fbdev/efifb.c > @@ -10,6 +10,7 @@ > #include > #include > #include > +#include > #include > #include > #include