Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4c6b485d authored by Will Deacon's avatar Will Deacon Committed by Channagoud Kadabi
Browse files

UPSTREAM: 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: default avatarMark Rutland <mark.rutland@arm.com>
Tested-by: default avatarLaura Abbott <labbott@redhat.com>
Tested-by: default avatarShanker Donthineni <shankerd@codeaurora.org>
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
(cherry picked from commit fc0e1299da548b32440051f58f08e0c1eb7edd0b)

Change-Id: I2d34c2d7b88f82d848d7063efdae7c3cc4fe8fd6
Signed-off-by: default avatarTodd Poynor <toddpoynor@google.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
Git-commit: d6ca455d
Git-repo: https://android.googlesource.com/kernel/common/


Signed-off-by: default avatarChannagoud Kadabi <ckadabi@codeaurora.org>
parent 2ae77fb1
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -19,6 +19,8 @@

#define USER_ASID_FLAG	(UL(1) << 48)

#ifndef __ASSEMBLY__

typedef struct {
	atomic64_t	id;
	void		*vdso;
@@ -31,6 +33,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 bootmem_init(void);
extern void __iomem *early_io_map(phys_addr_t phys, unsigned long virt);
@@ -40,4 +47,5 @@ extern void create_pgd_mapping(struct mm_struct *mm, phys_addr_t phys,
			       pgprot_t prot, bool allow_block_mappings);
extern void *fixmap_remap_fdt(phys_addr_t dt_phys);

#endif	/* !__ASSEMBLY__ */
#endif