Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull EFI fixes from Thomas Gleixner:
"Three fixes from EFI land:

- prevent accessing a Graphic Output Device (GOP) which the kernel
does not know to handle

- prevent PCI reconfiguration to modify a BAR which covers the
framebuffer because that's already in use through the EFI GOP
interface

- avoid reserving EFI runtime regions as this results in bogus memory
mappings"

* 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86/efi: Don't try to reserve runtime regions
efi/fb: Avoid reconfiguration of BAR that covers the framebuffer
efi/libstub: Skip GOP with PIXEL_BLT_ONLY format

+73 -3
+4
arch/x86/platform/efi/quirks.c
··· 201 201 return; 202 202 } 203 203 204 + /* No need to reserve regions that will never be freed. */ 205 + if (md.attribute & EFI_MEMORY_RUNTIME) 206 + return; 207 + 204 208 size += addr % EFI_PAGE_SIZE; 205 209 size = round_up(size, EFI_PAGE_SIZE); 206 210 addr = round_down(addr, EFI_PAGE_SIZE);
+4 -2
drivers/firmware/efi/libstub/gop.c
··· 149 149 150 150 status = __gop_query32(sys_table_arg, gop32, &info, &size, 151 151 &current_fb_base); 152 - if (status == EFI_SUCCESS && (!first_gop || conout_found)) { 152 + if (status == EFI_SUCCESS && (!first_gop || conout_found) && 153 + info->pixel_format != PIXEL_BLT_ONLY) { 153 154 /* 154 155 * Systems that use the UEFI Console Splitter may 155 156 * provide multiple GOP devices, not all of which are ··· 267 266 268 267 status = __gop_query64(sys_table_arg, gop64, &info, &size, 269 268 &current_fb_base); 270 - if (status == EFI_SUCCESS && (!first_gop || conout_found)) { 269 + if (status == EFI_SUCCESS && (!first_gop || conout_found) && 270 + info->pixel_format != PIXEL_BLT_ONLY) { 271 271 /* 272 272 * Systems that use the UEFI Console Splitter may 273 273 * provide multiple GOP devices, not all of which are
+65 -1
drivers/video/fbdev/efifb.c
··· 10 10 #include <linux/efi.h> 11 11 #include <linux/errno.h> 12 12 #include <linux/fb.h> 13 + #include <linux/pci.h> 13 14 #include <linux/platform_device.h> 14 15 #include <linux/screen_info.h> 15 16 #include <video/vga.h> ··· 144 143 }; 145 144 ATTRIBUTE_GROUPS(efifb); 146 145 146 + static bool pci_dev_disabled; /* FB base matches BAR of a disabled device */ 147 + 147 148 static int efifb_probe(struct platform_device *dev) 148 149 { 149 150 struct fb_info *info; ··· 155 152 unsigned int size_total; 156 153 char *option = NULL; 157 154 158 - if (screen_info.orig_video_isVGA != VIDEO_TYPE_EFI) 155 + if (screen_info.orig_video_isVGA != VIDEO_TYPE_EFI || pci_dev_disabled) 159 156 return -ENODEV; 160 157 161 158 if (fb_get_options("efifb", &option)) ··· 363 360 }; 364 361 365 362 builtin_platform_driver(efifb_driver); 363 + 364 + #if defined(CONFIG_PCI) && !defined(CONFIG_X86) 365 + 366 + static bool pci_bar_found; /* did we find a BAR matching the efifb base? */ 367 + 368 + static void claim_efifb_bar(struct pci_dev *dev, int idx) 369 + { 370 + u16 word; 371 + 372 + pci_bar_found = true; 373 + 374 + pci_read_config_word(dev, PCI_COMMAND, &word); 375 + if (!(word & PCI_COMMAND_MEMORY)) { 376 + pci_dev_disabled = true; 377 + dev_err(&dev->dev, 378 + "BAR %d: assigned to efifb but device is disabled!\n", 379 + idx); 380 + return; 381 + } 382 + 383 + if (pci_claim_resource(dev, idx)) { 384 + pci_dev_disabled = true; 385 + dev_err(&dev->dev, 386 + "BAR %d: failed to claim resource for efifb!\n", idx); 387 + return; 388 + } 389 + 390 + dev_info(&dev->dev, "BAR %d: assigned to efifb\n", idx); 391 + } 392 + 393 + static void efifb_fixup_resources(struct pci_dev *dev) 394 + { 395 + u64 base = screen_info.lfb_base; 396 + u64 size = screen_info.lfb_size; 397 + int i; 398 + 399 + if (pci_bar_found || screen_info.orig_video_isVGA != VIDEO_TYPE_EFI) 400 + return; 401 + 402 + if (screen_info.capabilities & VIDEO_CAPABILITY_64BIT_BASE) 403 + base |= (u64)screen_info.ext_lfb_base << 32; 404 + 405 + if (!base) 406 + return; 407 + 408 + for (i = 0; i < PCI_STD_RESOURCE_END; i++) { 409 + struct resource *res = &dev->resource[i]; 410 + 411 + if (!(res->flags & IORESOURCE_MEM)) 412 + continue; 413 + 414 + if (res->start <= base && res->end >= base + size - 1) { 415 + claim_efifb_bar(dev, i); 416 + break; 417 + } 418 + } 419 + } 420 + DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_ANY_ID, PCI_ANY_ID, PCI_BASE_CLASS_DISPLAY, 421 + 16, efifb_fixup_resources); 422 + 423 + #endif