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 updates from Thomas Gleixner:

- A fix for a add_efi_memmap parameter regression which ensures that
the parameter is parsed before it is used.

- Reinstate the virtual capsule mapping as the cached copy turned out
to break Quark and other things

- Remove Matt Fleming as EFI co-maintainer. He stepped back a few days
ago. Thanks Matt for all your great work!

* 'efi-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
MAINTAINERS: Remove Matt Fleming as EFI co-maintainer
efi/capsule-loader: Reinstate virtual capsule mapping
x86/efi: Fix kernel param add_efi_memmap regression

+57 -17
+3 -4
MAINTAINERS
··· 5149 5149 EFI TEST DRIVER 5150 5150 L: linux-efi@vger.kernel.org 5151 5151 M: Ivan Hu <ivan.hu@canonical.com> 5152 - M: Matt Fleming <matt@codeblueprint.co.uk> 5152 + M: Ard Biesheuvel <ard.biesheuvel@linaro.org> 5153 5153 S: Maintained 5154 5154 F: drivers/firmware/efi/test/ 5155 5155 5156 5156 EFI VARIABLE FILESYSTEM 5157 5157 M: Matthew Garrett <matthew.garrett@nebula.com> 5158 5158 M: Jeremy Kerr <jk@ozlabs.org> 5159 - M: Matt Fleming <matt@codeblueprint.co.uk> 5160 - T: git git://git.kernel.org/pub/scm/linux/kernel/git/mfleming/efi.git 5159 + M: Ard Biesheuvel <ard.biesheuvel@linaro.org> 5160 + T: git git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi.git 5161 5161 L: linux-efi@vger.kernel.org 5162 5162 S: Maintained 5163 5163 F: fs/efivarfs/ ··· 5318 5318 F: security/integrity/evm/ 5319 5319 5320 5320 EXTENSIBLE FIRMWARE INTERFACE (EFI) 5321 - M: Matt Fleming <matt@codeblueprint.co.uk> 5322 5321 M: Ard Biesheuvel <ard.biesheuvel@linaro.org> 5323 5322 L: linux-efi@vger.kernel.org 5324 5323 T: git git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi.git
+2 -3
arch/x86/kernel/setup.c
··· 906 906 set_bit(EFI_BOOT, &efi.flags); 907 907 set_bit(EFI_64BIT, &efi.flags); 908 908 } 909 - 910 - if (efi_enabled(EFI_BOOT)) 911 - efi_memblock_x86_reserve_range(); 912 909 #endif 913 910 914 911 x86_init.oem.arch_setup(); ··· 959 962 960 963 parse_early_param(); 961 964 965 + if (efi_enabled(EFI_BOOT)) 966 + efi_memblock_x86_reserve_range(); 962 967 #ifdef CONFIG_MEMORY_HOTPLUG 963 968 /* 964 969 * Memory used by the kernel cannot be hot-removed because Linux
+12 -1
arch/x86/platform/efi/quirks.c
··· 592 592 /* 593 593 * Update the first page pointer to skip over the CSH header. 594 594 */ 595 - cap_info->pages[0] += csh->headersize; 595 + cap_info->phys[0] += csh->headersize; 596 + 597 + /* 598 + * cap_info->capsule should point at a virtual mapping of the entire 599 + * capsule, starting at the capsule header. Our image has the Quark 600 + * security header prepended, so we cannot rely on the default vmap() 601 + * mapping created by the generic capsule code. 602 + * Given that the Quark firmware does not appear to care about the 603 + * virtual mapping, let's just point cap_info->capsule at our copy 604 + * of the capsule header. 605 + */ 606 + cap_info->capsule = &cap_info->header; 596 607 597 608 return 1; 598 609 }
+37 -8
drivers/firmware/efi/capsule-loader.c
··· 20 20 21 21 #define NO_FURTHER_WRITE_ACTION -1 22 22 23 - #ifndef phys_to_page 24 - #define phys_to_page(x) pfn_to_page((x) >> PAGE_SHIFT) 25 - #endif 26 - 27 23 /** 28 24 * efi_free_all_buff_pages - free all previous allocated buffer pages 29 25 * @cap_info: pointer to current instance of capsule_info structure ··· 31 35 static void efi_free_all_buff_pages(struct capsule_info *cap_info) 32 36 { 33 37 while (cap_info->index > 0) 34 - __free_page(phys_to_page(cap_info->pages[--cap_info->index])); 38 + __free_page(cap_info->pages[--cap_info->index]); 35 39 36 40 cap_info->index = NO_FURTHER_WRITE_ACTION; 37 41 } ··· 67 71 68 72 cap_info->pages = temp_page; 69 73 74 + temp_page = krealloc(cap_info->phys, 75 + pages_needed * sizeof(phys_addr_t *), 76 + GFP_KERNEL | __GFP_ZERO); 77 + if (!temp_page) 78 + return -ENOMEM; 79 + 80 + cap_info->phys = temp_page; 81 + 70 82 return 0; 71 83 } 72 84 ··· 109 105 **/ 110 106 static ssize_t efi_capsule_submit_update(struct capsule_info *cap_info) 111 107 { 108 + bool do_vunmap = false; 112 109 int ret; 113 110 114 - ret = efi_capsule_update(&cap_info->header, cap_info->pages); 111 + /* 112 + * cap_info->capsule may have been assigned already by a quirk 113 + * handler, so only overwrite it if it is NULL 114 + */ 115 + if (!cap_info->capsule) { 116 + cap_info->capsule = vmap(cap_info->pages, cap_info->index, 117 + VM_MAP, PAGE_KERNEL); 118 + if (!cap_info->capsule) 119 + return -ENOMEM; 120 + do_vunmap = true; 121 + } 122 + 123 + ret = efi_capsule_update(cap_info->capsule, cap_info->phys); 124 + if (do_vunmap) 125 + vunmap(cap_info->capsule); 115 126 if (ret) { 116 127 pr_err("capsule update failed\n"); 117 128 return ret; ··· 184 165 goto failed; 185 166 } 186 167 187 - cap_info->pages[cap_info->index++] = page_to_phys(page); 168 + cap_info->pages[cap_info->index] = page; 169 + cap_info->phys[cap_info->index] = page_to_phys(page); 188 170 cap_info->page_bytes_remain = PAGE_SIZE; 171 + cap_info->index++; 189 172 } else { 190 - page = phys_to_page(cap_info->pages[cap_info->index - 1]); 173 + page = cap_info->pages[cap_info->index - 1]; 191 174 } 192 175 193 176 kbuff = kmap(page); ··· 273 252 struct capsule_info *cap_info = file->private_data; 274 253 275 254 kfree(cap_info->pages); 255 + kfree(cap_info->phys); 276 256 kfree(file->private_data); 277 257 file->private_data = NULL; 278 258 return 0; ··· 299 277 300 278 cap_info->pages = kzalloc(sizeof(void *), GFP_KERNEL); 301 279 if (!cap_info->pages) { 280 + kfree(cap_info); 281 + return -ENOMEM; 282 + } 283 + 284 + cap_info->phys = kzalloc(sizeof(void *), GFP_KERNEL); 285 + if (!cap_info->phys) { 286 + kfree(cap_info->pages); 302 287 kfree(cap_info); 303 288 return -ENOMEM; 304 289 }
+3 -1
include/linux/efi.h
··· 140 140 141 141 struct capsule_info { 142 142 efi_capsule_header_t header; 143 + efi_capsule_header_t *capsule; 143 144 int reset_type; 144 145 long index; 145 146 size_t count; 146 147 size_t total_size; 147 - phys_addr_t *pages; 148 + struct page **pages; 149 + phys_addr_t *phys; 148 150 size_t page_bytes_remain; 149 151 }; 150 152