Commit e27b176b authored by Andrew Jones's avatar Andrew Jones Committed by Paolo Bonzini
Browse files

arm/arm64: Introduce mmu_disable

Allow unit test cpus to disable the MMU. Why not? We want the
test framework to be as flexible as possible. Callers will have
to deal with the cache coherency fallout... Cache flush support
is still forthcoming to the framework though.
Signed-off-by: Andrew Jones's avatarAndrew Jones <>
Signed-off-by: default avatarPaolo Bonzini <>
parent 23fb3b17
......@@ -159,6 +159,15 @@ asm_mmu_enable:
mov pc, lr
.globl asm_mmu_disable
/* SCTLR */
mrc p15, 0, r0, c1, c0, 0
bic r0, #CR_M
mcr p15, 0, r0, c1, c0, 0
mov pc, lr
* Vector stubs
* Simplified version of the Linux kernel implementation
......@@ -146,6 +146,14 @@ asm_mmu_enable:
.globl asm_mmu_disable
mrs x0, sctlr_el1
bic x0, x0, SCTLR_EL1_M
msr sctlr_el1, x0
* Vectors
* Adapted from arch/arm64/kernel/entry.S
......@@ -4,6 +4,7 @@ extern pgd_t *mmu_idmap;
extern bool mmu_enabled(void);
extern void mmu_set_enabled(void);
extern void mmu_enable(pgd_t *pgtable);
extern void mmu_disable(void);
extern void mmu_enable_idmap(void);
extern void mmu_init_io_sect(pgd_t *pgtable, unsigned long virt_offset);
extern void mmu_set_range_sect(pgd_t *pgtable, unsigned long virt_offset,
......@@ -35,6 +35,14 @@ void mmu_enable(pgd_t *pgtable)
extern void asm_mmu_disable(void);
void mmu_disable(void)
struct thread_info *ti = current_thread_info();
cpumask_clear_cpu(ti->cpu, &mmu_enabled_cpumask);
void mmu_set_range_ptes(pgd_t *pgtable, unsigned long virt_offset,
unsigned long phys_start, unsigned long phys_end,
pgprot_t prot)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment