From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753855AbdESQ12 (ORCPT ); Fri, 19 May 2017 12:27:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:43770 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751003AbdESQ1Z (ORCPT ); Fri, 19 May 2017 12:27:25 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0F97F23990 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=helgaas@kernel.org Date: Fri, 19 May 2017 11:27:16 -0500 From: Bjorn Helgaas To: Ard Biesheuvel Cc: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner , "H . Peter Anvin" , leif.lindholm@linaro.org, lorenzo.pieralisi@arm.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: Re: [PATCH 2/2] efifb: Avoid reconfiguration of BAR that covers the framebuffer Message-ID: <20170519162716.GA684@bhelgaas-glaptop.roam.corp.google.com> References: <20170404152744.26687-1-ard.biesheuvel@linaro.org> <20170404152744.26687-3-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170404152744.26687-3-ard.biesheuvel@linaro.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [+cc linux-pci] On Tue, Apr 04, 2017 at 04:27:44PM +0100, 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 non-x86 quirk to the EFI fb driver to find the BAR associated > with the GOP base address, and claim the BAR resource so that the PCI > core will not move it. I know this has already been merged as 55d728a40d36 ("efi/fb: Avoid reconfiguration of BAR that covers the framebuffer"), and I'm not suggesting that we revert it, but I have some misgivings. One is the "#ifndef CONFIG_X86". In principle, there is nothing arch- specific here. I don't think it's a good idea to build in dependencies on things like "this arch preserves (or reprograms) PCI BARs". The PCI core may reprogram all, some, or none of the PCI BARs, depending on what (if anything) firmware has done. Another is the use of pci_claim_resource() to express the idea that "this BAR can not be moved". We have IORESOURCE_PCI_FIXED for that purpose, and previous versions of the patch used that. I understand there was some problem with that, but I wish we could figure out and fix that problem instead of using a different mechanism. I'm not even completely sold on the idea that we need to prevent the BAR from being moved. I'm not a UEFI expert, but if this requirement is in the spec, we should reference it. If not, it should be sufficient to remember the boot-time BAR value, match the GOP base to *that*, and map it to whatever the current BAR value is. > Fixes: 9822504c1fa5 ("efifb: Enable the efi-framebuffer platform driver ...") > Cc: # v4.7+ > Cc: Matt Fleming > Cc: Peter Jones > Signed-off-by: Ard Biesheuvel > --- > drivers/video/fbdev/efifb.c | 66 ++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 65 insertions(+), 1 deletion(-) > > diff --git a/drivers/video/fbdev/efifb.c b/drivers/video/fbdev/efifb.c > index 8c4dc1e1f94f..758960b6aec9 100644 > --- a/drivers/video/fbdev/efifb.c > +++ b/drivers/video/fbdev/efifb.c > @@ -10,6 +10,7 @@ > #include > #include > #include > +#include > #include > #include > #include