From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Return-Path: From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, linux-efi@vger.kernel.org Subject: [PATCH v2] efifb: avoid reconfiguration of BAR that covers the framebuffer Date: Tue, 21 Mar 2017 19:16:50 +0000 Message-Id: <1490123810-12383-1-git-send-email-ard.biesheuvel@linaro.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lorenzo.pieralisi@arm.com, Ard Biesheuvel , matt@codeblueprint.co.uk, linux-pci@vger.kernel.org, heyi.guo@linaro.org, pjones@redhat.com, hanjun.guo@linaro.org, bhelgaas@google.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+bjorn=helgaas.com@lists.infradead.org List-ID: 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