Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm Catch up with aarch64 TTBR0 handling in pmap_{,...
details: https://anonhg.NetBSD.org/src/rev/8fd72715c143
branches: trunk
changeset: 365930:8fd72715c143
user: skrll <skrll%NetBSD.org@localhost>
date: Tue May 03 20:12:27 2022 +0000
description:
Catch up with aarch64 TTBR0 handling in pmap_{,de}activate_efirt and
kpreempt_{en,dis}able.
diffstat:
sys/arch/arm/arm/efi_machdep.c | 18 ++++++++++++++++--
sys/arch/arm/arm32/pmap.c | 20 +++++++++++++-------
2 files changed, 29 insertions(+), 9 deletions(-)
diffs (135 lines):
diff -r 4c3c6c611457 -r 8fd72715c143 sys/arch/arm/arm/efi_machdep.c
--- a/sys/arch/arm/arm/efi_machdep.c Tue May 03 20:10:20 2022 +0000
+++ b/sys/arch/arm/arm/efi_machdep.c Tue May 03 20:12:27 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: efi_machdep.c,v 1.1 2022/04/02 11:16:06 skrll Exp $ */
+/* $NetBSD: efi_machdep.c,v 1.2 2022/05/03 20:12:27 skrll Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: efi_machdep.c,v 1.1 2022/04/02 11:16:06 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: efi_machdep.c,v 1.2 2022/05/03 20:12:27 skrll Exp $");
#include <sys/param.h>
#include <uvm/uvm_extern.h>
@@ -50,6 +50,10 @@
int
arm_efirt_md_enter(void)
{
+ kpreempt_disable();
+
+ struct lwp * const l = curlwp;
+
arm_efirt_state.aert_tpidrprw = armreg_tpidrprw_read();
/* Disable the VFP. */
@@ -65,6 +69,9 @@
if (err)
return err;
+ if ((l->l_flag & LW_SYSTEM) == 0) {
+ pmap_deactivate(l);
+ }
pmap_activate_efirt();
return 0;
@@ -73,7 +80,12 @@
void
arm_efirt_md_exit(void)
{
+ struct lwp * const l = curlwp;
+
pmap_deactivate_efirt();
+ if ((l->l_flag & LW_SYSTEM) == 0) {
+ pmap_activate(l);
+ }
armreg_tpidrprw_write(arm_efirt_state.aert_tpidrprw);
@@ -83,6 +95,8 @@
/* Remove custom fault handler */
cpu_unset_onfault();
+
+ kpreempt_enable();
}
diff -r 4c3c6c611457 -r 8fd72715c143 sys/arch/arm/arm32/pmap.c
--- a/sys/arch/arm/arm32/pmap.c Tue May 03 20:10:20 2022 +0000
+++ b/sys/arch/arm/arm32/pmap.c Tue May 03 20:12:27 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.436 2022/04/09 23:38:31 riastradh Exp $ */
+/* $NetBSD: pmap.c,v 1.437 2022/05/03 20:12:28 skrll Exp $ */
/*
* Copyright 2003 Wasabi Systems, Inc.
@@ -193,7 +193,7 @@
#endif
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.436 2022/04/09 23:38:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.437 2022/05/03 20:12:28 skrll Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -4986,15 +4986,16 @@
void
pmap_activate_efirt(void)
{
- kpreempt_disable();
-
- struct cpu_info * const ci = curcpu();
struct pmap * const pm = &efirt_pmap;
- struct pmap_asid_info * const pai = PMAP_PAI(pm, cpu_tlb_info(ci));
UVMHIST_FUNC(__func__);
UVMHIST_CALLARGS(maphist, " (pm=%#jx)", (uintptr_t)pm, 0, 0, 0);
+ KASSERT(kpreempt_disabled());
+
+ struct cpu_info * const ci = curcpu();
+ struct pmap_asid_info * const pai = PMAP_PAI(pm, cpu_tlb_info(ci));
+
PMAPCOUNT(activations);
/*
@@ -5038,6 +5039,10 @@
UVMHIST_CALLARGS(maphist, "l=%#jx pm=%#jx", (uintptr_t)l,
(uintptr_t)npm, 0, 0);
+#ifdef ARM_MMU_EXTENDED
+ KASSERT(kpreempt_disabled());
+#endif
+
struct cpu_info * const ci = curcpu();
/*
@@ -5197,6 +5202,7 @@
(uintptr_t)pm, 0, 0);
#ifdef ARM_MMU_EXTENDED
+ KASSERT(kpreempt_disabled());
pmap_md_pdetab_deactivate(pm);
#else
/*
@@ -5219,6 +5225,7 @@
{
UVMHIST_FUNC(__func__); UVMHIST_CALLED(maphist);
+ KASSERT(kpreempt_disabled());
struct cpu_info * const ci = curcpu();
/*
@@ -5234,7 +5241,6 @@
KASSERTMSG(ci->ci_pmap_asid_cur == KERNEL_PID, "ci_pmap_asid_cur %u",
ci->ci_pmap_asid_cur);
- kpreempt_enable();
UVMHIST_LOG(maphist, " <-- done", 0, 0, 0, 0);
}
Home |
Main Index |
Thread Index |
Old Index