aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-05-16 16:06:27 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-05-16 16:06:27 -0400
commit49817c33433a3cd6f320b13699e6746cc39b453b (patch)
tree1eb8c4a4d585e648b0783741c02ab611149971d9 /arch/arm
parent230e51f21101e49c8d73018d414adbd0d57459a1 (diff)
parent6c5450ef66816216e574885cf8d3ddb31ef77428 (diff)
Merge branch 'efi-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull EFI updates from Ingo Molnar: "The main changes in this cycle were: - Drop the unused EFI_SYSTEM_TABLES efi.flags bit and ensure the ARM/arm64 EFI System Table mapping is read-only (Ard Biesheuvel) - Add a comment to explain that one of the code paths in the x86/pat code is only executed for EFI boot (Matt Fleming) - Improve Secure Boot status checks on arm64 and handle unexpected errors (Linn Crosetto) - Remove the global EFI memory map variable 'memmap' as the same information is already available in efi::memmap (Matt Fleming) - Add EFI Memory Attribute table support for ARM/arm64 (Ard Biesheuvel) - Add EFI GOP framebuffer support for ARM/arm64 (Ard Biesheuvel) - Add EFI Bootloader Control driver for storing reboot(2) data in EFI variables for consumption by bootloaders (Jeremy Compostella) - Add Core EFI capsule support (Matt Fleming) - Add EFI capsule char driver (Kweh, Hock Leong) - Unify EFI memory map code for ARM and arm64 (Ard Biesheuvel) - Add generic EFI support for detecting when firmware corrupts CPU status register bits (like IRQ flags) when performing EFI runtime service calls (Mark Rutland) ... and other misc cleanups" * 'efi-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (46 commits) efivarfs: Make efivarfs_file_ioctl() static efi: Merge boolean flag arguments efi/capsule: Move 'capsule' to the stack in efi_capsule_supported() efibc: Fix excessive stack footprint warning efi/capsule: Make efi_capsule_pending() lockless efi: Remove unnecessary (and buggy) .memmap initialization from the Xen EFI driver efi/runtime-wrappers: Remove ARCH_EFI_IRQ_FLAGS_MASK #ifdef x86/efi: Enable runtime call flag checking arm/efi: Enable runtime call flag checking arm64/efi: Enable runtime call flag checking efi/runtime-wrappers: Detect firmware IRQ flag corruption efi/runtime-wrappers: Remove redundant #ifdefs x86/efi: Move to generic {__,}efi_call_virt() arm/efi: Move to generic {__,}efi_call_virt() arm64/efi: Move to generic {__,}efi_call_virt() efi/runtime-wrappers: Add {__,}efi_call_virt() templates efi/arm-init: Reserve rather than unmap the memory map for ARM as well efi: Add misc char driver interface to update EFI firmware x86/efi: Force EFI reboot to process pending capsules efi: Add 'capsule' update support ...
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/include/asm/efi.h37
-rw-r--r--arch/arm/kernel/efi.c41
-rw-r--r--arch/arm/kernel/setup.c3
3 files changed, 63 insertions, 18 deletions
diff --git a/arch/arm/include/asm/efi.h b/arch/arm/include/asm/efi.h
index e0eea72deb87..a708fa1f0905 100644
--- a/arch/arm/include/asm/efi.h
+++ b/arch/arm/include/asm/efi.h
@@ -17,34 +17,28 @@
17#include <asm/mach/map.h> 17#include <asm/mach/map.h>
18#include <asm/mmu_context.h> 18#include <asm/mmu_context.h>
19#include <asm/pgtable.h> 19#include <asm/pgtable.h>
20#include <asm/ptrace.h>
20 21
21#ifdef CONFIG_EFI 22#ifdef CONFIG_EFI
22void efi_init(void); 23void efi_init(void);
23 24
24int efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md); 25int efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md);
26int efi_set_mapping_permissions(struct mm_struct *mm, efi_memory_desc_t *md);
25 27
26#define efi_call_virt(f, ...) \ 28#define arch_efi_call_virt_setup() efi_virtmap_load()
27({ \ 29#define arch_efi_call_virt_teardown() efi_virtmap_unload()
28 efi_##f##_t *__f; \
29 efi_status_t __s; \
30 \
31 efi_virtmap_load(); \
32 __f = efi.systab->runtime->f; \
33 __s = __f(__VA_ARGS__); \
34 efi_virtmap_unload(); \
35 __s; \
36})
37 30
38#define __efi_call_virt(f, ...) \ 31#define arch_efi_call_virt(f, args...) \
39({ \ 32({ \
40 efi_##f##_t *__f; \ 33 efi_##f##_t *__f; \
41 \
42 efi_virtmap_load(); \
43 __f = efi.systab->runtime->f; \ 34 __f = efi.systab->runtime->f; \
44 __f(__VA_ARGS__); \ 35 __f(args); \
45 efi_virtmap_unload(); \
46}) 36})
47 37
38#define ARCH_EFI_IRQ_FLAGS_MASK \
39 (PSR_J_BIT | PSR_E_BIT | PSR_A_BIT | PSR_I_BIT | PSR_F_BIT | \
40 PSR_T_BIT | MODE_MASK)
41
48static inline void efi_set_pgd(struct mm_struct *mm) 42static inline void efi_set_pgd(struct mm_struct *mm)
49{ 43{
50 check_and_switch_context(mm, NULL); 44 check_and_switch_context(mm, NULL);
@@ -59,7 +53,16 @@ void efi_virtmap_unload(void);
59 53
60/* arch specific definitions used by the stub code */ 54/* arch specific definitions used by the stub code */
61 55
62#define efi_call_early(f, ...) sys_table_arg->boottime->f(__VA_ARGS__) 56#define efi_call_early(f, ...) sys_table_arg->boottime->f(__VA_ARGS__)
57#define __efi_call_early(f, ...) f(__VA_ARGS__)
58#define efi_is_64bit() (false)
59
60struct screen_info *alloc_screen_info(efi_system_table_t *sys_table_arg);
61void free_screen_info(efi_system_table_t *sys_table, struct screen_info *si);
62
63static inline void efifb_setup_from_dmi(struct screen_info *si, const char *opt)
64{
65}
63 66
64/* 67/*
65 * A reasonable upper bound for the uncompressed kernel size is 32 MBytes, 68 * A reasonable upper bound for the uncompressed kernel size is 32 MBytes,
diff --git a/arch/arm/kernel/efi.c b/arch/arm/kernel/efi.c
index ff8a9d8acfac..9f43ba012d10 100644
--- a/arch/arm/kernel/efi.c
+++ b/arch/arm/kernel/efi.c
@@ -11,6 +11,41 @@
11#include <asm/mach/map.h> 11#include <asm/mach/map.h>
12#include <asm/mmu_context.h> 12#include <asm/mmu_context.h>
13 13
14static int __init set_permissions(pte_t *ptep, pgtable_t token,
15 unsigned long addr, void *data)
16{
17 efi_memory_desc_t *md = data;
18 pte_t pte = *ptep;
19
20 if (md->attribute & EFI_MEMORY_RO)
21 pte = set_pte_bit(pte, __pgprot(L_PTE_RDONLY));
22 if (md->attribute & EFI_MEMORY_XP)
23 pte = set_pte_bit(pte, __pgprot(L_PTE_XN));
24 set_pte_ext(ptep, pte, PTE_EXT_NG);
25 return 0;
26}
27
28int __init efi_set_mapping_permissions(struct mm_struct *mm,
29 efi_memory_desc_t *md)
30{
31 unsigned long base, size;
32
33 base = md->virt_addr;
34 size = md->num_pages << EFI_PAGE_SHIFT;
35
36 /*
37 * We can only use apply_to_page_range() if we can guarantee that the
38 * entire region was mapped using pages. This should be the case if the
39 * region does not cover any naturally aligned SECTION_SIZE sized
40 * blocks.
41 */
42 if (round_down(base + size, SECTION_SIZE) <
43 round_up(base, SECTION_SIZE) + SECTION_SIZE)
44 return apply_to_page_range(mm, base, size, set_permissions, md);
45
46 return 0;
47}
48
14int __init efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md) 49int __init efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md)
15{ 50{
16 struct map_desc desc = { 51 struct map_desc desc = {
@@ -34,5 +69,11 @@ int __init efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md)
34 desc.type = MT_DEVICE; 69 desc.type = MT_DEVICE;
35 70
36 create_mapping_late(mm, &desc, true); 71 create_mapping_late(mm, &desc, true);
72
73 /*
74 * If stricter permissions were specified, apply them now.
75 */
76 if (md->attribute & (EFI_MEMORY_RO | EFI_MEMORY_XP))
77 return efi_set_mapping_permissions(mm, md);
37 return 0; 78 return 0;
38} 79}
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 2c4bea39cf22..7d4e2850910c 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -883,7 +883,8 @@ static void __init request_standard_resources(const struct machine_desc *mdesc)
883 request_resource(&ioport_resource, &lp2); 883 request_resource(&ioport_resource, &lp2);
884} 884}
885 885
886#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE) 886#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE) || \
887 defined(CONFIG_EFI)
887struct screen_info screen_info = { 888struct screen_info screen_info = {
888 .orig_video_lines = 30, 889 .orig_video_lines = 30,
889 .orig_video_cols = 80, 890 .orig_video_cols = 80,