Received: from list by lists.gnu.org with archive (Exim 4.71) id 1ezU3q-0003v6-SU for mharc-grub-devel@gnu.org; Fri, 23 Mar 2018 17:17:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57302) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ezSJH-0003QU-MA for grub-devel@gnu.org; Fri, 23 Mar 2018 15:25:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ezSJD-00015w-Nc for grub-devel@gnu.org; Fri, 23 Mar 2018 15:25:07 -0400 Received: from relay3.sgi.com ([192.48.152.1]:37495 helo=relay.sgi.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ezSJD-00012e-H5 for grub-devel@gnu.org; Fri, 23 Mar 2018 15:25:03 -0400 Received: from stormcage.americas.sgi.com (stormcage.americas.sgi.com [128.162.236.70]) by relay3.corp.sgi.com (Postfix) with ESMTP id D9649AC001; Fri, 23 Mar 2018 12:24:55 -0700 (PDT) Received: by stormcage.americas.sgi.com (Postfix, from userid 5508) id 67758200FDA40; Fri, 23 Mar 2018 14:24:55 -0500 (CDT) Message-Id: <20180323191145.581426496@stormcage.americas.sgi.com> References: <20180323191132.701444498@stormcage.americas.sgi.com> User-Agent: quilt/0.46-1 Date: Fri, 23 Mar 2018 14:11:33 -0500 From: Mike Travis To: grub-devel@gnu.org Cc: Michael Chang , Tony Ernst Subject: [PATCH 1/1] Fix PCIe LER when GRUB2 accesses non-enabled MMIO data from VGA Content-Disposition: inline; filename=skip-non-vga-devices X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy] X-Received-From: 192.48.152.1 X-Mailman-Approved-At: Fri, 23 Mar 2018 17:17:17 -0400 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2018 19:25:08 -0000 A GPU inserted into a PCIe I/O slot disappears during system startup. The problem centers around GRUB and a specific VGA init function in efi_uga.c. This causes an LER (link error recorvery) because the MMIO memory has not been enabled before attempting access. The fix is to add the same coding used in other VGA drivers, specifically to add a check to insure that it is indeed a VGA controller. And then enable the MMIO address space with the specific bits. Signed-off-by: Mike Travis Reviewed-by: Michael Chang --- grub-2.02/grub-core/video/efi_uga.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) Index: grub-2.02/grub-core/video/efi_uga.c =================================================================== --- grub-2.02/grub-core/video/efi_uga.c.orig +++ grub-2.02/grub-core/video/efi_uga.c @@ -95,9 +95,19 @@ find_card (grub_pci_device_t dev, grub_p { struct find_framebuf_ctx *ctx = data; grub_pci_address_t addr; + grub_uint32_t class; addr = grub_pci_make_address (dev, GRUB_PCI_REG_CLASS); - if (grub_pci_read (addr) >> 24 == 0x3) + class = grub_pci_read (addr); + if (((class >> 16) & 0xffff) != GRUB_PCI_CLASS_SUBCLASS_VGA) + return 0; + + /* Enable MEM address spaces */ + { + grub_pci_address_t rcaddr = grub_pci_make_address (dev, GRUB_PCI_REG_COMMAND); + grub_pci_write_word (rcaddr, grub_pci_read_word (rcaddr) | GRUB_PCI_COMMAND_MEM_ENABLED); + } + { int i; --