aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Fleming <[email protected]>2016-06-23 11:36:32 +0100
committerMatt Fleming <[email protected]>2016-09-09 16:08:38 +0100
commit4bc9f92e64c81192dcca1c495354bcc7c3b43e7d (patch)
tree1e8decb9bf86792cd280c4ee6bc976d3c0d5f096
parent8e80632fb23f021ce5a6957f2edcdae4645a7030 (diff)
x86/efi-bgrt: Use efi_mem_reserve() to avoid copying image data
efi_mem_reserve() allows us to permanently mark EFI boot services regions as reserved, which means we no longer need to copy the image data out and into a separate buffer. Leaving the data in the original boot services region has the added benefit that BGRT images can now be passed across kexec reboot. Reviewed-by: Josh Triplett <[email protected]> Tested-by: Dave Young <[email protected]> [kexec/kdump] Tested-by: Ard Biesheuvel <[email protected]> [arm] Acked-by: Ard Biesheuvel <[email protected]> Cc: Leif Lindholm <[email protected]> Cc: Peter Jones <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Josh Boyer <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Môshe van der Sterre <[email protected]> Signed-off-by: Matt Fleming <[email protected]>
-rw-r--r--arch/x86/platform/efi/efi-bgrt.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/arch/x86/platform/efi/efi-bgrt.c b/arch/x86/platform/efi/efi-bgrt.c
index 6a2f5691b1ab..6aad870e8962 100644
--- a/arch/x86/platform/efi/efi-bgrt.c
+++ b/arch/x86/platform/efi/efi-bgrt.c
@@ -82,21 +82,12 @@ void __init efi_bgrt_init(void)
}
bgrt_image_size = bmp_header.size;
- bgrt_image = kmalloc(bgrt_image_size, GFP_KERNEL | __GFP_NOWARN);
+ bgrt_image = memremap(bgrt_tab->image_address, bmp_header.size, MEMREMAP_WB);
if (!bgrt_image) {
- pr_notice("Ignoring BGRT: failed to allocate memory for image (wanted %zu bytes)\n",
- bgrt_image_size);
- return;
- }
-
- image = memremap(bgrt_tab->image_address, bmp_header.size, MEMREMAP_WB);
- if (!image) {
pr_notice("Ignoring BGRT: failed to map image memory\n");
- kfree(bgrt_image);
bgrt_image = NULL;
return;
}
- memcpy(bgrt_image, image, bgrt_image_size);
- memunmap(image);
+ efi_mem_reserve(bgrt_tab->image_address, bgrt_image_size);
}