mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-15 15:04:27 +08:00
9fc68b717c
Recent UEFI versions expose permission attributes for runtime services memory regions, either in the UEFI memory map or in the separate memory attributes table. This allows the kernel to map these regions with stricter permissions, rather than the RWX permissions that are used by default. So wire this up in our mapping routine. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk> Cc: Borislav Petkov <bp@alien8.de> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Leif Lindholm <leif.lindholm@linaro.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Peter Jones <pjones@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Russell King <rmk+kernel@arm.linux.org.uk> Cc: Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Will Deacon <will.deacon@arm.com> Cc: linux-efi@vger.kernel.org Link: http://lkml.kernel.org/r/1461614832-17633-11-git-send-email-matt@codeblueprint.co.uk Signed-off-by: Ingo Molnar <mingo@kernel.org>
85 lines
2.3 KiB
C
85 lines
2.3 KiB
C
/*
|
|
* Copyright (C) 2015 Linaro Ltd <ard.biesheuvel@linaro.org>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*/
|
|
|
|
#ifndef __ASM_ARM_EFI_H
|
|
#define __ASM_ARM_EFI_H
|
|
|
|
#include <asm/cacheflush.h>
|
|
#include <asm/cachetype.h>
|
|
#include <asm/early_ioremap.h>
|
|
#include <asm/fixmap.h>
|
|
#include <asm/highmem.h>
|
|
#include <asm/mach/map.h>
|
|
#include <asm/mmu_context.h>
|
|
#include <asm/pgtable.h>
|
|
|
|
#ifdef CONFIG_EFI
|
|
void efi_init(void);
|
|
|
|
int efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md);
|
|
int efi_set_mapping_permissions(struct mm_struct *mm, efi_memory_desc_t *md);
|
|
|
|
#define efi_call_virt(f, ...) \
|
|
({ \
|
|
efi_##f##_t *__f; \
|
|
efi_status_t __s; \
|
|
\
|
|
efi_virtmap_load(); \
|
|
__f = efi.systab->runtime->f; \
|
|
__s = __f(__VA_ARGS__); \
|
|
efi_virtmap_unload(); \
|
|
__s; \
|
|
})
|
|
|
|
#define __efi_call_virt(f, ...) \
|
|
({ \
|
|
efi_##f##_t *__f; \
|
|
\
|
|
efi_virtmap_load(); \
|
|
__f = efi.systab->runtime->f; \
|
|
__f(__VA_ARGS__); \
|
|
efi_virtmap_unload(); \
|
|
})
|
|
|
|
static inline void efi_set_pgd(struct mm_struct *mm)
|
|
{
|
|
check_and_switch_context(mm, NULL);
|
|
}
|
|
|
|
void efi_virtmap_load(void);
|
|
void efi_virtmap_unload(void);
|
|
|
|
#else
|
|
#define efi_init()
|
|
#endif /* CONFIG_EFI */
|
|
|
|
/* arch specific definitions used by the stub code */
|
|
|
|
#define efi_call_early(f, ...) sys_table_arg->boottime->f(__VA_ARGS__)
|
|
|
|
/*
|
|
* A reasonable upper bound for the uncompressed kernel size is 32 MBytes,
|
|
* so we will reserve that amount of memory. We have no easy way to tell what
|
|
* the actuall size of code + data the uncompressed kernel will use.
|
|
* If this is insufficient, the decompressor will relocate itself out of the
|
|
* way before performing the decompression.
|
|
*/
|
|
#define MAX_UNCOMP_KERNEL_SIZE SZ_32M
|
|
|
|
/*
|
|
* The kernel zImage should preferably be located between 32 MB and 128 MB
|
|
* from the base of DRAM. The min address leaves space for a maximal size
|
|
* uncompressed image, and the max address is due to how the zImage decompressor
|
|
* picks a destination address.
|
|
*/
|
|
#define ZIMAGE_OFFSET_LIMIT SZ_128M
|
|
#define MIN_ZIMAGE_OFFSET MAX_UNCOMP_KERNEL_SIZE
|
|
#define MAX_FDT_OFFSET ZIMAGE_OFFSET_LIMIT
|
|
|
|
#endif /* _ASM_ARM_EFI_H */
|