Merge tag 'efi-next' of git://git.kernel.org/pub/scm/linux/kernel/git/mfleming/efi into x86/efi

Pull efi changes from Matt Fleming:

 * We don't need to carry our own formatting code in the esrt driver
   because the kobject API can do that for us - Rasmus Villemoes

 * Update the arm64 file paths in Documentation/efi-stub.txt to match
   the current tree - Alan Ott

 * Consistently preface all print statements with "efi" arch/x86 so
   that it's more obvious to users reporting problems which statements
   in the kernel log are relevant for EFI - Matt Fleming

 * Fix a boot crash in the ACPI BGRT driver and delete
   efi_lookup_mapped_addr() since it's useless now that the EFI
   mappings *only* exist in the 'efi_pgd' page table. Instead we
   always early_memremap() the BGRT memory - Sai Praneeth Prakhya
This commit is contained in:
Thomas Gleixner
2015-12-19 21:24:52 +01:00
6 changed files with 25 additions and 64 deletions

View File

@ -10,12 +10,12 @@ arch/x86/boot/header.S and arch/x86/boot/compressed/eboot.c,
respectively. For ARM the EFI stub is implemented in respectively. For ARM the EFI stub is implemented in
arch/arm/boot/compressed/efi-header.S and arch/arm/boot/compressed/efi-header.S and
arch/arm/boot/compressed/efi-stub.c. EFI stub code that is shared arch/arm/boot/compressed/efi-stub.c. EFI stub code that is shared
between architectures is in drivers/firmware/efi/efi-stub-helper.c. between architectures is in drivers/firmware/efi/libstub.
For arm64, there is no compressed kernel support, so the Image itself For arm64, there is no compressed kernel support, so the Image itself
masquerades as a PE/COFF image and the EFI stub is linked into the masquerades as a PE/COFF image and the EFI stub is linked into the
kernel. The arm64 EFI stub lives in arch/arm64/kernel/efi-entry.S kernel. The arm64 EFI stub lives in arch/arm64/kernel/efi-entry.S
and arch/arm64/kernel/efi-stub.c. and drivers/firmware/efi/libstub/arm64-stub.c.
By using the EFI boot stub it's possible to boot a Linux kernel By using the EFI boot stub it's possible to boot a Linux kernel
without the use of a conventional EFI boot loader, such as grub or without the use of a conventional EFI boot loader, such as grub or

View File

@ -10,6 +10,9 @@
* it under the terms of the GNU General Public License version 2 as * it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/acpi.h> #include <linux/acpi.h>
@ -28,8 +31,7 @@ struct bmp_header {
void __init efi_bgrt_init(void) void __init efi_bgrt_init(void)
{ {
acpi_status status; acpi_status status;
void __iomem *image; void *image;
bool ioremapped = false;
struct bmp_header bmp_header; struct bmp_header bmp_header;
if (acpi_disabled) if (acpi_disabled)
@ -70,20 +72,14 @@ void __init efi_bgrt_init(void)
return; return;
} }
image = efi_lookup_mapped_addr(bgrt_tab->image_address); image = early_memremap(bgrt_tab->image_address, sizeof(bmp_header));
if (!image) { if (!image) {
image = early_ioremap(bgrt_tab->image_address, pr_err("Ignoring BGRT: failed to map image header memory\n");
sizeof(bmp_header)); return;
ioremapped = true;
if (!image) {
pr_err("Ignoring BGRT: failed to map image header memory\n");
return;
}
} }
memcpy_fromio(&bmp_header, image, sizeof(bmp_header)); memcpy(&bmp_header, image, sizeof(bmp_header));
if (ioremapped) early_memunmap(image, sizeof(bmp_header));
early_iounmap(image, sizeof(bmp_header));
bgrt_image_size = bmp_header.size; bgrt_image_size = bmp_header.size;
bgrt_image = kmalloc(bgrt_image_size, GFP_KERNEL | __GFP_NOWARN); bgrt_image = kmalloc(bgrt_image_size, GFP_KERNEL | __GFP_NOWARN);
@ -93,18 +89,14 @@ void __init efi_bgrt_init(void)
return; return;
} }
if (ioremapped) { image = early_memremap(bgrt_tab->image_address, bmp_header.size);
image = early_ioremap(bgrt_tab->image_address, if (!image) {
bmp_header.size); pr_err("Ignoring BGRT: failed to map image memory\n");
if (!image) { kfree(bgrt_image);
pr_err("Ignoring BGRT: failed to map image memory\n"); bgrt_image = NULL;
kfree(bgrt_image); return;
bgrt_image = NULL;
return;
}
} }
memcpy_fromio(bgrt_image, image, bgrt_image_size); memcpy(bgrt_image, image, bgrt_image_size);
if (ioremapped) early_memunmap(image, bmp_header.size);
early_iounmap(image, bmp_header.size);
} }

View File

@ -15,6 +15,8 @@
* *
*/ */
#define pr_fmt(fmt) "efi: " fmt
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/mm.h> #include <linux/mm.h>

View File

@ -1,3 +1,5 @@
#define pr_fmt(fmt) "efi: " fmt
#include <linux/init.h> #include <linux/init.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/string.h> #include <linux/string.h>
@ -256,7 +258,7 @@ void __init efi_apply_memmap_quirks(void)
* services. * services.
*/ */
if (!efi_runtime_supported()) { if (!efi_runtime_supported()) {
pr_info("efi: Setup done, disabling due to 32/64-bit mismatch\n"); pr_info("Setup done, disabling due to 32/64-bit mismatch\n");
efi_unmap_memmap(); efi_unmap_memmap();
} }

View File

@ -324,38 +324,6 @@ u64 __init efi_mem_desc_end(efi_memory_desc_t *md)
return end; return end;
} }
/*
* We can't ioremap data in EFI boot services RAM, because we've already mapped
* it as RAM. So, look it up in the existing EFI memory map instead. Only
* callable after efi_enter_virtual_mode and before efi_free_boot_services.
*/
void __iomem *efi_lookup_mapped_addr(u64 phys_addr)
{
struct efi_memory_map *map;
void *p;
map = efi.memmap;
if (!map)
return NULL;
if (WARN_ON(!map->map))
return NULL;
for (p = map->map; p < map->map_end; p += map->desc_size) {
efi_memory_desc_t *md = p;
u64 size = md->num_pages << EFI_PAGE_SHIFT;
u64 end = md->phys_addr + size;
if (!(md->attribute & EFI_MEMORY_RUNTIME) &&
md->type != EFI_BOOT_SERVICES_CODE &&
md->type != EFI_BOOT_SERVICES_DATA)
continue;
if (!md->virt_addr)
continue;
if (phys_addr >= md->phys_addr && phys_addr < end) {
phys_addr += md->virt_addr - md->phys_addr;
return (__force void __iomem *)(unsigned long)phys_addr;
}
}
return NULL;
}
static __initdata efi_config_table_type_t common_tables[] = { static __initdata efi_config_table_type_t common_tables[] = {
{ACPI_20_TABLE_GUID, "ACPI 2.0", &efi.acpi20}, {ACPI_20_TABLE_GUID, "ACPI 2.0", &efi.acpi20},
{ACPI_TABLE_GUID, "ACPI", &efi.acpi}, {ACPI_TABLE_GUID, "ACPI", &efi.acpi},

View File

@ -167,14 +167,11 @@ static struct kset *esrt_kset;
static int esre_create_sysfs_entry(void *esre, int entry_num) static int esre_create_sysfs_entry(void *esre, int entry_num)
{ {
struct esre_entry *entry; struct esre_entry *entry;
char name[20];
entry = kzalloc(sizeof(*entry), GFP_KERNEL); entry = kzalloc(sizeof(*entry), GFP_KERNEL);
if (!entry) if (!entry)
return -ENOMEM; return -ENOMEM;
sprintf(name, "entry%d", entry_num);
entry->kobj.kset = esrt_kset; entry->kobj.kset = esrt_kset;
if (esrt->fw_resource_version == 1) { if (esrt->fw_resource_version == 1) {
@ -182,7 +179,7 @@ static int esre_create_sysfs_entry(void *esre, int entry_num)
entry->esre.esre1 = esre; entry->esre.esre1 = esre;
rc = kobject_init_and_add(&entry->kobj, &esre1_ktype, NULL, rc = kobject_init_and_add(&entry->kobj, &esre1_ktype, NULL,
"%s", name); "entry%d", entry_num);
if (rc) { if (rc) {
kfree(entry); kfree(entry);
return rc; return rc;