Pass the pmap in tlb_set_asid for the benefit of aarch64.

This commit is contained in:
skrll 2021-10-02 14:28:04 +00:00
parent cbab0923d7
commit bf021c82f6
8 changed files with 26 additions and 25 deletions

View File

@ -31,7 +31,7 @@
#include "opt_multiprocessor.h" #include "opt_multiprocessor.h"
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(1, "$NetBSD: arm32_tlb.c,v 1.14 2020/10/30 18:54:36 skrll Exp $"); __KERNEL_RCSID(1, "$NetBSD: arm32_tlb.c,v 1.15 2021/10/02 14:28:04 skrll Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/types.h> #include <sys/types.h>
@ -50,7 +50,7 @@ tlb_get_asid(void)
} }
void void
tlb_set_asid(tlb_asid_t asid) tlb_set_asid(tlb_asid_t asid, pmap_t pm)
{ {
dsb(sy); dsb(sy);
if (asid == KERNEL_PID) { if (asid == KERNEL_PID) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: mips_fixup.c,v 1.21 2021/02/16 06:06:58 simonb Exp $ */ /* $NetBSD: mips_fixup.c,v 1.22 2021/10/02 14:28:04 skrll Exp $ */
/*- /*-
* Copyright (c) 2010 The NetBSD Foundation, Inc. * Copyright (c) 2010 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mips_fixup.c,v 1.21 2021/02/16 06:06:58 simonb Exp $"); __KERNEL_RCSID(0, "$NetBSD: mips_fixup.c,v 1.22 2021/10/02 14:28:04 skrll Exp $");
#include "opt_mips3_wired.h" #include "opt_mips3_wired.h"
#include "opt_multiprocessor.h" #include "opt_multiprocessor.h"
@ -545,7 +545,7 @@ mips_fixup_stubs(uint32_t *start, uint32_t *end)
void mips_cpu_switch_resume(struct lwp *) __stub; void mips_cpu_switch_resume(struct lwp *) __stub;
tlb_asid_t tlb_asid_t
tlb_get_asid(void) __stub; tlb_get_asid(void) __stub;
void tlb_set_asid(uint32_t) __stub; void tlb_set_asid(uint32_t, struct pmap *) __stub;
void tlb_invalidate_all(void) __stub; void tlb_invalidate_all(void) __stub;
void tlb_invalidate_globals(void) __stub; void tlb_invalidate_globals(void) __stub;
void tlb_invalidate_asids(uint32_t, uint32_t) __stub; void tlb_invalidate_asids(uint32_t, uint32_t) __stub;
@ -575,7 +575,7 @@ tlb_get_asid(void)
} }
void void
tlb_set_asid(uint32_t asid) tlb_set_asid(uint32_t asid, struct pmap *pm)
{ {
(*mips_locore_jumpvec.ljv_tlb_set_asid)(asid); (*mips_locore_jumpvec.ljv_tlb_set_asid)(asid);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap_machdep.c,v 1.35 2021/10/02 13:41:50 skrll Exp $ */ /* $NetBSD: pmap_machdep.c,v 1.36 2021/10/02 14:28:04 skrll Exp $ */
/*- /*-
* Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@ -67,7 +67,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pmap_machdep.c,v 1.35 2021/10/02 13:41:50 skrll Exp $"); __KERNEL_RCSID(0, "$NetBSD: pmap_machdep.c,v 1.36 2021/10/02 14:28:04 skrll Exp $");
/* /*
* Manages physical address maps. * Manages physical address maps.
@ -492,7 +492,7 @@ pmap_bootstrap(void)
pool_init(&pmap_pv_pool, sizeof(struct pv_entry), 0, 0, 0, "pvpl", pool_init(&pmap_pv_pool, sizeof(struct pv_entry), 0, 0, 0, "pvpl",
&pmap_pv_page_allocator, IPL_NONE); &pmap_pv_page_allocator, IPL_NONE);
tlb_set_asid(KERNEL_PID); tlb_set_asid(KERNEL_PID, pmap_kernel());
#ifdef MIPS3_PLUS /* XXX mmu XXX */ #ifdef MIPS3_PLUS /* XXX mmu XXX */
/* /*

View File

@ -1,4 +1,4 @@
/* $NetBSD: booke_pmap.c,v 1.33 2021/10/02 13:41:50 skrll Exp $ */ /* $NetBSD: booke_pmap.c,v 1.34 2021/10/02 14:28:04 skrll Exp $ */
/*- /*-
* Copyright (c) 2010, 2011 The NetBSD Foundation, Inc. * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
* All rights reserved. * All rights reserved.
@ -37,7 +37,7 @@
#define __PMAP_PRIVATE #define __PMAP_PRIVATE
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: booke_pmap.c,v 1.33 2021/10/02 13:41:50 skrll Exp $"); __KERNEL_RCSID(0, "$NetBSD: booke_pmap.c,v 1.34 2021/10/02 14:28:04 skrll Exp $");
#ifdef _KERNEL_OPT #ifdef _KERNEL_OPT
#include "opt_multiprocessor.h" #include "opt_multiprocessor.h"
@ -300,7 +300,7 @@ pmap_bootstrap(vaddr_t startkernel, vaddr_t endkernel,
pool_init(&pmap_pv_pool, sizeof(struct pv_entry), 0, 0, 0, "pvpl", pool_init(&pmap_pv_pool, sizeof(struct pv_entry), 0, 0, 0, "pvpl",
&pmap_pv_page_allocator, IPL_NONE); &pmap_pv_page_allocator, IPL_NONE);
tlb_set_asid(KERNEL_PID); tlb_set_asid(KERNEL_PID, pmap_kernel());
return endkernel; return endkernel;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: booke_stubs.c,v 1.11 2020/07/06 09:34:16 rin Exp $ */ /* $NetBSD: booke_stubs.c,v 1.12 2021/10/02 14:28:04 skrll Exp $ */
/*- /*-
* Copyright (c) 2010, 2011 The NetBSD Foundation, Inc. * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
* All rights reserved. * All rights reserved.
@ -35,7 +35,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: booke_stubs.c,v 1.11 2020/07/06 09:34:16 rin Exp $"); __KERNEL_RCSID(0, "$NetBSD: booke_stubs.c,v 1.12 2021/10/02 14:28:04 skrll Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/cpu.h> #include <sys/cpu.h>
@ -45,10 +45,10 @@ __KERNEL_RCSID(0, "$NetBSD: booke_stubs.c,v 1.11 2020/07/06 09:34:16 rin Exp $")
#define __stub __section(".stub") __noprofile #define __stub __section(".stub") __noprofile
void tlb_set_asid(tlb_asid_t) __stub; void tlb_set_asid(tlb_asid_t, struct pmap *) __stub;
void void
tlb_set_asid(tlb_asid_t asid) tlb_set_asid(tlb_asid_t asid, struct pmap *pm)
{ {
(*cpu_md_ops.md_tlb_ops->md_tlb_set_asid)(asid); (*cpu_md_ops.md_tlb_ops->md_tlb_set_asid)(asid);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap_machdep.c,v 1.7 2021/05/01 07:41:24 skrll Exp $ */ /* $NetBSD: pmap_machdep.c,v 1.8 2021/10/02 14:28:05 skrll Exp $ */
/* /*
* Copyright (c) 2014, 2019, 2021 The NetBSD Foundation, Inc. * Copyright (c) 2014, 2019, 2021 The NetBSD Foundation, Inc.
@ -34,7 +34,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
__RCSID("$NetBSD: pmap_machdep.c,v 1.7 2021/05/01 07:41:24 skrll Exp $"); __RCSID("$NetBSD: pmap_machdep.c,v 1.8 2021/10/02 14:28:05 skrll Exp $");
#include <sys/param.h> #include <sys/param.h>
@ -171,7 +171,7 @@ tlb_get_asid(void)
} }
void void
tlb_set_asid(tlb_asid_t asid) tlb_set_asid(tlb_asid_t asid, struct pmap *pm)
{ {
riscvreg_asid_write(asid); riscvreg_asid_write(asid);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap_tlb.c,v 1.45 2021/09/12 09:05:01 skrll Exp $ */ /* $NetBSD: pmap_tlb.c,v 1.46 2021/10/02 14:28:05 skrll Exp $ */
/*- /*-
* Copyright (c) 2010 The NetBSD Foundation, Inc. * Copyright (c) 2010 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.45 2021/09/12 09:05:01 skrll Exp $"); __KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.46 2021/10/02 14:28:05 skrll Exp $");
/* /*
* Manages address spaces in a TLB. * Manages address spaces in a TLB.
@ -958,7 +958,7 @@ pmap_tlb_asid_acquire(pmap_t pm, struct lwp *l)
ci->ci_pmap_asid_cur = pai->pai_asid; ci->ci_pmap_asid_cur = pai->pai_asid;
UVMHIST_LOG(maphist, "setting asid to %#jx", pai->pai_asid, UVMHIST_LOG(maphist, "setting asid to %#jx", pai->pai_asid,
0, 0, 0); 0, 0, 0);
tlb_set_asid(pai->pai_asid); tlb_set_asid(pai->pai_asid, pm);
pmap_tlb_asid_check(); pmap_tlb_asid_check();
} else { } else {
printf("%s: l (%p) != curlwp %p\n", __func__, l, curlwp); printf("%s: l (%p) != curlwp %p\n", __func__, l, curlwp);
@ -996,7 +996,7 @@ pmap_tlb_asid_deactivate(pmap_t pm)
} }
#endif #endif
curcpu()->ci_pmap_asid_cur = KERNEL_PID; curcpu()->ci_pmap_asid_cur = KERNEL_PID;
tlb_set_asid(KERNEL_PID); tlb_set_asid(KERNEL_PID, pmap_kernel());
pmap_tlb_pai_check(cpu_tlb_info(curcpu()), false); pmap_tlb_pai_check(cpu_tlb_info(curcpu()), false);
#if defined(DEBUG) #if defined(DEBUG)

View File

@ -1,4 +1,4 @@
/* $NetBSD: tlb.h,v 1.4 2017/06/24 05:31:03 skrll Exp $ */ /* $NetBSD: tlb.h,v 1.5 2021/10/02 14:28:05 skrll Exp $ */
/*- /*-
* Copyright (c) 2011 The NetBSD Foundation, Inc. * Copyright (c) 2011 The NetBSD Foundation, Inc.
* All rights reserved. * All rights reserved.
@ -33,6 +33,7 @@
#if defined(_KERNEL) || defined(_KMEMUSER) #if defined(_KERNEL) || defined(_KMEMUSER)
struct tlbmask; struct tlbmask;
struct pmap;
typedef bool (*tlb_walkfunc_t)(void *, vaddr_t, tlb_asid_t, pt_entry_t); typedef bool (*tlb_walkfunc_t)(void *, vaddr_t, tlb_asid_t, pt_entry_t);
@ -54,7 +55,7 @@ struct tlb_md_ops {
tlb_asid_t tlb_asid_t
tlb_get_asid(void); tlb_get_asid(void);
void tlb_set_asid(tlb_asid_t); void tlb_set_asid(tlb_asid_t, struct pmap *);
void tlb_invalidate_all(void); void tlb_invalidate_all(void);
void tlb_invalidate_globals(void); void tlb_invalidate_globals(void);
void tlb_invalidate_asids(tlb_asid_t, tlb_asid_t); void tlb_invalidate_asids(tlb_asid_t, tlb_asid_t);