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

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