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

arm/arm64: drop mmu_set_enabled

The mmu is enabled automatically for all cpus, they must disable it
themselves if they don't want it on. Switch from managing a cpumask
of enabled cpus to one of disabled cpus. This allows us to remove
the mmu_set_enabled call from secondary_cinit, and the function all
Signed-off-by: Andrew Jones's avatarAndrew Jones <>
[Place CPUs in MMU disabled state at startup. - Paolo]
Signed-off-by: default avatarPaolo Bonzini <>
parent e27b176b
......@@ -2,8 +2,8 @@
#define __ASMARM_MMU_API_H_
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_mark_disabled(int cpu);
extern void mmu_disable(void);
extern void mmu_enable_idmap(void);
extern void mmu_init_io_sect(pgd_t *pgtable, unsigned long virt_offset);
......@@ -14,32 +14,38 @@ extern unsigned long etext;
pgd_t *mmu_idmap;
static cpumask_t mmu_enabled_cpumask;
/* CPU 0 starts with disabled MMU */
static cpumask_t mmu_disabled_cpumask = { {1} };
bool mmu_enabled(void)
struct thread_info *ti = current_thread_info();
return cpumask_test_cpu(ti->cpu, &mmu_enabled_cpumask);
int cpu = current_thread_info()->cpu;
void mmu_set_enabled(void)
struct thread_info *ti = current_thread_info();
cpumask_set_cpu(ti->cpu, &mmu_enabled_cpumask);
return !cpumask_test_cpu(cpu, &mmu_disabled_cpumask);
extern void asm_mmu_enable(phys_addr_t pgtable);
void mmu_enable(pgd_t *pgtable)
int cpu = current_thread_info()->cpu;
cpumask_clear_cpu(cpu, &mmu_disabled_cpumask);
void mmu_mark_disabled(int cpu)
cpumask_set_cpu(cpu, &mmu_disabled_cpumask);
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);
int cpu = current_thread_info()->cpu;
......@@ -9,6 +9,7 @@
#include <asm/psci.h>
#include <asm/setup.h>
#include <asm/page.h>
#include <asm/mmu-api.h>
......@@ -29,6 +30,7 @@ int psci_cpu_on(unsigned long cpuid, unsigned long entry_point)
extern void secondary_entry(void);
int cpu_psci_cpu_boot(unsigned int cpu)
int err = psci_cpu_on(cpus[cpu], __pa(secondary_entry));
if (err)
printf("failed to boot CPU%d (%d)\n", cpu, err);
......@@ -23,7 +23,6 @@ secondary_entry_fn secondary_cinit(void)
secondary_entry_fn entry;
thread_info_init(ti, 0);
* Save secondary_data.entry locally to avoid opening a race
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