Blame SOURCES/0288-efi-uga-Fix-PCIe-LER-when-GRUB2-accesses-non-enabled.patch

f725e3
From a897321d9c318c18c92c6431115fd9be71fedba1 Mon Sep 17 00:00:00 2001
f725e3
From: "mike.travis@hpe.com" <mike.travis@hpe.com>
f725e3
Date: Wed, 28 Mar 2018 11:42:18 -0500
f725e3
Subject: [PATCH 288/288] efi/uga: Fix PCIe LER when GRUB2 accesses non-enabled
f725e3
 MMIO data from VGA
f725e3
f725e3
A GPU inserted into a PCIe I/O slot disappears during system startup.
f725e3
The problem centers around GRUB and a specific VGA init function in
f725e3
efi_uga.c. This causes an LER (Link Error Recorvery) because the MMIO
f725e3
memory has not been enabled before attempting access.
f725e3
f725e3
The fix is to add the same coding used in other VGA drivers, specifically
f725e3
to add a check to insure that it is indeed a VGA controller. And then
f725e3
enable the MMIO address space with the specific bits.
f725e3
f725e3
Signed-off-by: Mike Travis <mike.travis@hpe.com>
f725e3
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
f725e3
---
f725e3
 grub-core/video/efi_uga.c | 13 +++++++++++--
f725e3
 1 file changed, 11 insertions(+), 2 deletions(-)
f725e3
f725e3
diff --git a/grub-core/video/efi_uga.c b/grub-core/video/efi_uga.c
f725e3
index 1d4091c5631..97a607c01a5 100644
f725e3
--- a/grub-core/video/efi_uga.c
f725e3
+++ b/grub-core/video/efi_uga.c
f725e3
@@ -94,10 +94,19 @@ static int
f725e3
 find_card (grub_pci_device_t dev, grub_pci_id_t pciid, void *data)
f725e3
 {
f725e3
   struct find_framebuf_ctx *ctx = data;
f725e3
-  grub_pci_address_t addr;
f725e3
+  grub_pci_address_t addr, rcaddr;
f725e3
+  grub_uint32_t subclass;
f725e3
 
f725e3
   addr = grub_pci_make_address (dev, GRUB_PCI_REG_CLASS);
f725e3
-  if (grub_pci_read (addr) >> 24 == 0x3)
f725e3
+  subclass = (grub_pci_read (addr) >> 16) & 0xffff;
f725e3
+
f725e3
+  if (subclass != GRUB_PCI_CLASS_SUBCLASS_VGA)
f725e3
+    return 0;
f725e3
+
f725e3
+  /* Enable MEM address spaces */
f725e3
+  rcaddr = grub_pci_make_address (dev, GRUB_PCI_REG_COMMAND);
f725e3
+  grub_pci_write_word (rcaddr, grub_pci_read_word (rcaddr) | GRUB_PCI_COMMAND_MEM_ENABLED);
f725e3
+
f725e3
     {
f725e3
       int i;
f725e3
 
f725e3
-- 
f725e3
2.17.1
f725e3