Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/aarch64 Deal with the pmap limitation of maxproc in...
details: https://anonhg.NetBSD.org/src/rev/fdfdcb6c91ff
branches: trunk
changeset: 379341:fdfdcb6c91ff
user: skrll <skrll%NetBSD.org@localhost>
date: Sat May 29 06:54:20 2021 +0000
description:
Deal with the pmap limitation of maxproc in a more complete way and
recognise CPUs with only 8bit ASIDs.
diffstat:
sys/arch/aarch64/aarch64/pmap.c | 14 ++++++--------
sys/arch/aarch64/include/cpu.h | 19 +++++++++++++++++--
2 files changed, 23 insertions(+), 10 deletions(-)
diffs (75 lines):
diff -r d04ac86b028d -r fdfdcb6c91ff sys/arch/aarch64/aarch64/pmap.c
--- a/sys/arch/aarch64/aarch64/pmap.c Sat May 29 06:37:21 2021 +0000
+++ b/sys/arch/aarch64/aarch64/pmap.c Sat May 29 06:54:20 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.107 2021/04/30 20:07:22 skrll Exp $ */
+/* $NetBSD: pmap.c,v 1.108 2021/05/29 06:54:20 skrll Exp $ */
/*
* Copyright (c) 2017 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.107 2021/04/30 20:07:22 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.108 2021/05/29 06:54:20 skrll Exp $");
#include "opt_arm_debug.h"
#include "opt_ddb.h"
@@ -554,6 +554,10 @@ pmap_init(void)
pool_cache_bootstrap(&_pmap_pv_pool, sizeof(struct pv_entry),
32, 0, PR_LARGECACHE, "pvpl", NULL, IPL_NONE, _pmap_pv_ctor,
NULL, NULL);
+
+ int nmaxproc = cpu_maxproc();
+ if (maxproc > nmaxproc)
+ maxproc = nmaxproc;
}
void
@@ -1420,12 +1424,6 @@ pmap_protect(struct pmap *pm, vaddr_t sv
pm_unlock(pm);
}
-/* XXX: due to the current implementation of pmap depends on 16bit ASID */
-int
-cpu_maxproc(void)
-{
- return 65535;
-}
void
pmap_activate(struct lwp *l)
diff -r d04ac86b028d -r fdfdcb6c91ff sys/arch/aarch64/include/cpu.h
--- a/sys/arch/aarch64/include/cpu.h Sat May 29 06:37:21 2021 +0000
+++ b/sys/arch/aarch64/include/cpu.h Sat May 29 06:54:20 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.35 2021/05/29 06:37:21 skrll Exp $ */
+/* $NetBSD: cpu.h,v 1.36 2021/05/29 06:54:20 skrll Exp $ */
/*-
* Copyright (c) 2014, 2020 The NetBSD Foundation, Inc.
@@ -149,7 +149,22 @@ static __inline struct cpu_info *lwp_get
#undef curlwp
#define curlwp (aarch64_curlwp())
-int cpu_maxproc(void);
+static inline int
+cpu_maxproc(void)
+{
+ /*
+ * the pmap uses PID for ASID.
+ */
+ switch (__SHIFTOUT(reg_id_aa64mmfr0_el1_read(), ID_AA64MMFR0_EL1_ASIDBITS)) {
+ case ID_AA64MMFR0_EL1_ASIDBITS_8BIT:
+ return (1U << 8) - 1;
+ case ID_AA64MMFR0_EL1_ASIDBITS_16BIT:
+ return (1U << 16) - 1;
+ default:
+ return 0;
+ }
+}
+
void cpu_signotify(struct lwp *l);
void cpu_need_proftick(struct lwp *l);
Home |
Main Index |
Thread Index |
Old Index