Module Name: src
Committed By: maxv
Date: Sun Feb 18 14:07:29 UTC 2018
Modified Files:
src/sys/arch/amd64/amd64: locore.S
src/sys/arch/amd64/include: pmap.h
src/sys/arch/x86/x86: pmap.c svs.c
Log Message:
Add svs_enabled, which defaults to 'true' when SVS is compiled (no dynamic
detection yet).
To generate a diff of this commit:
cvs rdiff -u -r1.150 -r1.151 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/amd64/include/pmap.h
cvs rdiff -u -r1.280 -r1.281 src/sys/arch/x86/x86/pmap.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/x86/x86/svs.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/amd64/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.150 src/sys/arch/amd64/amd64/locore.S:1.151
--- src/sys/arch/amd64/amd64/locore.S:1.150 Sat Jan 27 17:54:13 2018
+++ src/sys/arch/amd64/amd64/locore.S Sun Feb 18 14:07:29 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.S,v 1.150 2018/01/27 17:54:13 maxv Exp $ */
+/* $NetBSD: locore.S,v 1.151 2018/02/18 14:07:29 maxv Exp $ */
/*
* Copyright-o-rama!
@@ -1091,7 +1091,11 @@ ENTRY(cpu_switchto)
#ifdef SVS
pushq %rdx
+ movb _C_LABEL(svs_enabled),%dl
+ testb %dl,%dl
+ jz .Lskip_svs
callq _C_LABEL(svs_lwp_switch)
+.Lskip_svs:
popq %rdx
#endif
Index: src/sys/arch/amd64/include/pmap.h
diff -u src/sys/arch/amd64/include/pmap.h:1.42 src/sys/arch/amd64/include/pmap.h:1.43
--- src/sys/arch/amd64/include/pmap.h:1.42 Sun Jan 21 10:59:21 2018
+++ src/sys/arch/amd64/include/pmap.h Sun Feb 18 14:07:29 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.h,v 1.42 2018/01/21 10:59:21 maxv Exp $ */
+/* $NetBSD: pmap.h,v 1.43 2018/02/18 14:07:29 maxv Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -221,6 +221,7 @@
void svs_pmap_sync(struct pmap *, int);
void svs_lwp_switch(struct lwp *, struct lwp *);
void svs_pdir_switch(struct pmap *);
+extern bool svs_enabled;
#include <x86/pmap.h>
Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.280 src/sys/arch/x86/x86/pmap.c:1.281
--- src/sys/arch/x86/x86/pmap.c:1.280 Sat Feb 17 17:44:09 2018
+++ src/sys/arch/x86/x86/pmap.c Sun Feb 18 14:07:29 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.280 2018/02/17 17:44:09 maxv Exp $ */
+/* $NetBSD: pmap.c,v 1.281 2018/02/18 14:07:29 maxv Exp $ */
/*
* Copyright (c) 2008, 2010, 2016, 2017 The NetBSD Foundation, Inc.
@@ -170,7 +170,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.280 2018/02/17 17:44:09 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.281 2018/02/18 14:07:29 maxv Exp $");
#include "opt_user_ldt.h"
#include "opt_lockdebug.h"
@@ -2130,7 +2130,7 @@ pmap_free_ptp(struct pmap *pmap, struct
xen_kpm_sync(pmap, index);
}
#elif defined(SVS)
- if (level == PTP_LEVELS - 1) {
+ if (svs_enabled && level == PTP_LEVELS - 1) {
svs_pmap_sync(pmap, index);
}
#endif
@@ -2235,7 +2235,7 @@ pmap_get_ptp(struct pmap *pmap, vaddr_t
xen_kpm_sync(pmap, index);
}
#elif defined(SVS)
- if (i == PTP_LEVELS) {
+ if (svs_enabled && i == PTP_LEVELS) {
svs_pmap_sync(pmap, index);
}
#endif
Index: src/sys/arch/x86/x86/svs.c
diff -u src/sys/arch/x86/x86/svs.c:1.2 src/sys/arch/x86/x86/svs.c:1.3
--- src/sys/arch/x86/x86/svs.c:1.2 Sat Feb 17 17:44:09 2018
+++ src/sys/arch/x86/x86/svs.c Sun Feb 18 14:07:29 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: svs.c,v 1.2 2018/02/17 17:44:09 maxv Exp $ */
+/* $NetBSD: svs.c,v 1.3 2018/02/18 14:07:29 maxv Exp $ */
/*
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.2 2018/02/17 17:44:09 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.3 2018/02/18 14:07:29 maxv Exp $");
#include "opt_svs.h"
@@ -90,6 +90,8 @@ __KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.2
* with USER_LDT.
*/
+bool svs_enabled __read_mostly = false;
+
struct svs_utls {
paddr_t kpdirpa;
uint64_t scratch;
@@ -503,6 +505,7 @@ void svs_init(void);
void
svs_init(void)
{
+ svs_enabled = true;
svs_pgg_update(false);
}