From: Will Deacon Date: Tue, 14 Nov 2017 13:58:08 +0000 (+0000) Subject: FROMLIST: arm64: mm: Add arm64_kernel_unmapped_at_el0 helper X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9497136713f61e65b91329750cc1c013616ccf7f;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git FROMLIST: arm64: mm: Add arm64_kernel_unmapped_at_el0 helper In order for code such as TLB invalidation to operate efficiently when the decision to map the kernel at EL0 is determined at runtime, this patch introduces a helper function, arm64_kernel_unmapped_at_el0, to determine whether or not the kernel is mapped whilst running in userspace. Currently, this just reports the value of CONFIG_UNMAP_KERNEL_AT_EL0, but will later be hooked up to a fake CPU capability using a static key. Reviewed-by: Mark Rutland Tested-by: Laura Abbott Tested-by: Shanker Donthineni Signed-off-by: Will Deacon (cherry picked from git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git commit fc0e1299da548b32440051f58f08e0c1eb7edd0b) Change-Id: I0f48eadf55ee97f09553380a62d9fffe54d9dc83 Signed-off-by: Greg Hackmann Signed-off-by: Greg Kroah-Hartman --- diff --git a/arch/arm64/include/asm/mmu.h b/arch/arm64/include/asm/mmu.h index be814d4f71cb..8e60392c9137 100644 --- a/arch/arm64/include/asm/mmu.h +++ b/arch/arm64/include/asm/mmu.h @@ -18,6 +18,8 @@ #define USER_ASID_FLAG (UL(1) << 48) +#ifndef __ASSEMBLY__ + typedef struct { atomic64_t id; void *vdso; @@ -30,6 +32,11 @@ typedef struct { */ #define ASID(mm) ((mm)->context.id.counter & 0xffff) +static inline bool arm64_kernel_unmapped_at_el0(void) +{ + return IS_ENABLED(CONFIG_UNMAP_KERNEL_AT_EL0); +} + extern void paging_init(void); extern void __iomem *early_io_map(phys_addr_t phys, unsigned long virt); extern void init_mem_pgprot(void); @@ -38,4 +45,5 @@ extern void create_pgd_mapping(struct mm_struct *mm, phys_addr_t phys, pgprot_t prot); extern void *fixmap_remap_fdt(phys_addr_t dt_phys); +#endif /* !__ASSEMBLY__ */ #endif