Commit e0f92f0d authored by Ard Biesheuvel's avatar Ard Biesheuvel Committed by Catalin Marinas

arm64: Revert "mm: provide idmap pointer to cpu_replace_ttbr1()"

This reverts commit 1682c45b, which is no longer needed now that
we create the permanent kernel mapping directly during early boot.

This is a RINO (revert in name only) given that some of the code has
moved around, but the changes are straight-forward.
Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20240214122845.2033971-69-ardb+git@google.comSigned-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
parent ba5b0333
...@@ -108,18 +108,13 @@ static inline void cpu_uninstall_idmap(void) ...@@ -108,18 +108,13 @@ static inline void cpu_uninstall_idmap(void)
cpu_switch_mm(mm->pgd, mm); cpu_switch_mm(mm->pgd, mm);
} }
static inline void __cpu_install_idmap(pgd_t *idmap) static inline void cpu_install_idmap(void)
{ {
cpu_set_reserved_ttbr0(); cpu_set_reserved_ttbr0();
local_flush_tlb_all(); local_flush_tlb_all();
cpu_set_idmap_tcr_t0sz(); cpu_set_idmap_tcr_t0sz();
cpu_switch_mm(lm_alias(idmap), &init_mm); cpu_switch_mm(lm_alias(idmap_pg_dir), &init_mm);
}
static inline void cpu_install_idmap(void)
{
__cpu_install_idmap(idmap_pg_dir);
} }
/* /*
...@@ -146,21 +141,21 @@ static inline void cpu_install_ttbr0(phys_addr_t ttbr0, unsigned long t0sz) ...@@ -146,21 +141,21 @@ static inline void cpu_install_ttbr0(phys_addr_t ttbr0, unsigned long t0sz)
isb(); isb();
} }
void __cpu_replace_ttbr1(pgd_t *pgdp, pgd_t *idmap, bool cnp); void __cpu_replace_ttbr1(pgd_t *pgdp, bool cnp);
static inline void cpu_enable_swapper_cnp(void) static inline void cpu_enable_swapper_cnp(void)
{ {
__cpu_replace_ttbr1(lm_alias(swapper_pg_dir), idmap_pg_dir, true); __cpu_replace_ttbr1(lm_alias(swapper_pg_dir), true);
} }
static inline void cpu_replace_ttbr1(pgd_t *pgdp, pgd_t *idmap) static inline void cpu_replace_ttbr1(pgd_t *pgdp)
{ {
/* /*
* Only for early TTBR1 replacement before cpucaps are finalized and * Only for early TTBR1 replacement before cpucaps are finalized and
* before we've decided whether to use CNP. * before we've decided whether to use CNP.
*/ */
WARN_ON(system_capabilities_finalized()); WARN_ON(system_capabilities_finalized());
__cpu_replace_ttbr1(pgdp, idmap, false); __cpu_replace_ttbr1(pgdp, false);
} }
/* /*
......
...@@ -225,7 +225,7 @@ static void __init kasan_init_shadow(void) ...@@ -225,7 +225,7 @@ static void __init kasan_init_shadow(void)
*/ */
memcpy(tmp_pg_dir, swapper_pg_dir, sizeof(tmp_pg_dir)); memcpy(tmp_pg_dir, swapper_pg_dir, sizeof(tmp_pg_dir));
dsb(ishst); dsb(ishst);
cpu_replace_ttbr1(lm_alias(tmp_pg_dir), idmap_pg_dir); cpu_replace_ttbr1(lm_alias(tmp_pg_dir));
clear_pgds(KASAN_SHADOW_START, KASAN_SHADOW_END); clear_pgds(KASAN_SHADOW_START, KASAN_SHADOW_END);
...@@ -261,7 +261,7 @@ static void __init kasan_init_shadow(void) ...@@ -261,7 +261,7 @@ static void __init kasan_init_shadow(void)
PAGE_KERNEL_RO)); PAGE_KERNEL_RO));
memset(kasan_early_shadow_page, KASAN_SHADOW_INIT, PAGE_SIZE); memset(kasan_early_shadow_page, KASAN_SHADOW_INIT, PAGE_SIZE);
cpu_replace_ttbr1(lm_alias(swapper_pg_dir), idmap_pg_dir); cpu_replace_ttbr1(lm_alias(swapper_pg_dir));
} }
static void __init kasan_init_depth(void) static void __init kasan_init_depth(void)
......
...@@ -1445,7 +1445,7 @@ void ptep_modify_prot_commit(struct vm_area_struct *vma, unsigned long addr, pte ...@@ -1445,7 +1445,7 @@ void ptep_modify_prot_commit(struct vm_area_struct *vma, unsigned long addr, pte
* Atomically replaces the active TTBR1_EL1 PGD with a new VA-compatible PGD, * Atomically replaces the active TTBR1_EL1 PGD with a new VA-compatible PGD,
* avoiding the possibility of conflicting TLB entries being allocated. * avoiding the possibility of conflicting TLB entries being allocated.
*/ */
void __cpu_replace_ttbr1(pgd_t *pgdp, pgd_t *idmap, bool cnp) void __cpu_replace_ttbr1(pgd_t *pgdp, bool cnp)
{ {
typedef void (ttbr_replace_func)(phys_addr_t); typedef void (ttbr_replace_func)(phys_addr_t);
extern ttbr_replace_func idmap_cpu_replace_ttbr1; extern ttbr_replace_func idmap_cpu_replace_ttbr1;
...@@ -1460,7 +1460,7 @@ void __cpu_replace_ttbr1(pgd_t *pgdp, pgd_t *idmap, bool cnp) ...@@ -1460,7 +1460,7 @@ void __cpu_replace_ttbr1(pgd_t *pgdp, pgd_t *idmap, bool cnp)
replace_phys = (void *)__pa_symbol(idmap_cpu_replace_ttbr1); replace_phys = (void *)__pa_symbol(idmap_cpu_replace_ttbr1);
__cpu_install_idmap(idmap); cpu_install_idmap();
/* /*
* We really don't want to take *any* exceptions while TTBR1 is * We really don't want to take *any* exceptions while TTBR1 is
......
Markdown is supported
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