Module Name:    src
Committed By:   maxv
Date:           Mon May 27 17:32:36 UTC 2019

Modified Files:
        src/sys/arch/amd64/amd64: genassym.cf
        src/sys/arch/x86/include: cpu.h
        src/sys/arch/x86/x86: cpu.c pmap.c svs.c x86_tlb.c

Log Message:
Remove 'ci_svs_kpdirpa', unused. While here fix a few comments here and
there, reduces a future diff.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/sys/arch/amd64/amd64/genassym.cf
cvs rdiff -u -r1.105 -r1.106 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.168 -r1.169 src/sys/arch/x86/x86/cpu.c
cvs rdiff -u -r1.331 -r1.332 src/sys/arch/x86/x86/pmap.c
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/x86/x86/svs.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/x86/x86/x86_tlb.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/genassym.cf
diff -u src/sys/arch/amd64/amd64/genassym.cf:1.74 src/sys/arch/amd64/amd64/genassym.cf:1.75
--- src/sys/arch/amd64/amd64/genassym.cf:1.74	Fri Feb 15 08:54:01 2019
+++ src/sys/arch/amd64/amd64/genassym.cf	Mon May 27 17:32:36 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.74 2019/02/15 08:54:01 nonaka Exp $
+#	$NetBSD: genassym.cf,v 1.75 2019/05/27 17:32:36 maxv Exp $
 
 #
 # Copyright (c) 1998, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -236,7 +236,6 @@ define	CPU_INFO_PMAP		offsetof(struct cp
 define	CPU_INFO_TSS		offsetof(struct cpu_info, ci_tss)
 ifdef SVS
 define	CPU_INFO_UPDIRPA	offsetof(struct cpu_info, ci_svs_updirpa)
-define	CPU_INFO_KPDIRPA	offsetof(struct cpu_info, ci_svs_kpdirpa)
 define	CPU_INFO_RSP0		offsetof(struct cpu_info, ci_svs_rsp0)
 define	CPU_INFO_URSP0		offsetof(struct cpu_info, ci_svs_ursp0)
 define	CPU_INFO_KRSP0		offsetof(struct cpu_info, ci_svs_krsp0)

Index: src/sys/arch/x86/include/cpu.h
diff -u src/sys/arch/x86/include/cpu.h:1.105 src/sys/arch/x86/include/cpu.h:1.106
--- src/sys/arch/x86/include/cpu.h:1.105	Fri Feb 15 08:54:01 2019
+++ src/sys/arch/x86/include/cpu.h	Mon May 27 17:32:36 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.105 2019/02/15 08:54:01 nonaka Exp $	*/
+/*	$NetBSD: cpu.h,v 1.106 2019/05/27 17:32:36 maxv Exp $	*/
 
 /*
  * Copyright (c) 1990 The Regents of the University of California.
@@ -245,7 +245,7 @@ struct cpu_info {
 #ifdef SVS
 	pd_entry_t *	ci_svs_updir;
 	paddr_t		ci_svs_updirpa;
-	paddr_t		ci_svs_kpdirpa;
+	paddr_t		ci_unused;
 	kmutex_t	ci_svs_mtx;
 	pd_entry_t *	ci_svs_rsp0_pte;
 	vaddr_t		ci_svs_rsp0;

Index: src/sys/arch/x86/x86/cpu.c
diff -u src/sys/arch/x86/x86/cpu.c:1.168 src/sys/arch/x86/x86/cpu.c:1.169
--- src/sys/arch/x86/x86/cpu.c:1.168	Sat Mar  9 08:42:26 2019
+++ src/sys/arch/x86/x86/cpu.c	Mon May 27 17:32:36 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.168 2019/03/09 08:42:26 maxv Exp $	*/
+/*	$NetBSD: cpu.c,v 1.169 2019/05/27 17:32:36 maxv Exp $	*/
 
 /*
  * Copyright (c) 2000-2012 NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.168 2019/03/09 08:42:26 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.169 2019/05/27 17:32:36 maxv Exp $");
 
 #include "opt_ddb.h"
 #include "opt_mpbios.h"		/* for MPDEBUG */
@@ -584,15 +584,12 @@ cpu_init(struct cpu_info *ci)
 
 	lcr0(rcr0() | CR0_WP);
 
-	/*
-	 * On a P6 or above, enable global TLB caching if the
-	 * hardware supports it.
-	 */
+	/* If global TLB caching is supported, enable it */
 	if (cpu_feature[0] & CPUID_PGE)
 #ifdef SVS
 		if (!svs_enabled)
 #endif
-		cr4 |= CR4_PGE;	/* enable global TLB caching */
+		cr4 |= CR4_PGE;
 
 	/*
 	 * If we have FXSAVE/FXRESTOR, use them.

Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.331 src/sys/arch/x86/x86/pmap.c:1.332
--- src/sys/arch/x86/x86/pmap.c:1.331	Tue Mar 12 08:29:52 2019
+++ src/sys/arch/x86/x86/pmap.c	Mon May 27 17:32:36 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.331 2019/03/12 08:29:52 gson Exp $	*/
+/*	$NetBSD: pmap.c,v 1.332 2019/05/27 17:32:36 maxv Exp $	*/
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.331 2019/03/12 08:29:52 gson Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.332 2019/05/27 17:32:36 maxv Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -1116,15 +1116,14 @@ pmap_bootstrap(vaddr_t kva_start)
 
 #if !defined(XENPV)
 	/*
-	 * Begin to enable global TLB entries if they are supported.
-	 * The G bit has no effect until the CR4_PGE bit is set in CR4,
-	 * which happens in cpu_init(), which is run on each cpu
-	 * (and happens later)
+	 * Begin to enable global TLB entries if they are supported: add PTE_G
+	 * attribute to already mapped kernel pages.
+	 *
+	 * The G bit has no effect until the CR4_PGE bit is set in CR4, which
+	 * happens later in cpu_init().
 	 */
 	if (cpu_feature[0] & CPUID_PGE) {
-		pmap_pg_g = PTE_G;		/* enable software */
-
-		/* add PTE_G attribute to already mapped kernel pages */
+		pmap_pg_g = PTE_G;
 		pmap_remap_global();
 	}
 #endif

Index: src/sys/arch/x86/x86/svs.c
diff -u src/sys/arch/x86/x86/svs.c:1.26 src/sys/arch/x86/x86/svs.c:1.27
--- src/sys/arch/x86/x86/svs.c:1.26	Wed May 15 17:31:41 2019
+++ src/sys/arch/x86/x86/svs.c	Mon May 27 17:32:36 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: svs.c,v 1.26 2019/05/15 17:31:41 maxv Exp $	*/
+/*	$NetBSD: svs.c,v 1.27 2019/05/27 17:32:36 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018-2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.26 2019/05/15 17:31:41 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.27 2019/05/27 17:32:36 maxv Exp $");
 
 #include "opt_svs.h"
 
@@ -432,8 +432,6 @@ cpu_svs_init(struct cpu_info *ci)
 
 	pmap_update(pmap_kernel());
 
-	ci->ci_svs_kpdirpa = pmap_pdirpa(pmap_kernel(), 0);
-
 	mutex_init(&ci->ci_svs_mtx, MUTEX_DEFAULT, IPL_VM);
 
 	svs_page_add(ci, (vaddr_t)&pcpuarea->idt);
@@ -547,11 +545,9 @@ svs_pdir_switch(struct pmap *pmap)
 	KASSERT(kpreempt_disabled());
 	KASSERT(pmap != pmap_kernel());
 
-	ci->ci_svs_kpdirpa = pmap_pdirpa(pmap, 0);
-
 	/* Update the info in the UTLS page */
 	utls = (struct svs_utls *)ci->ci_svs_utls;
-	utls->kpdirpa = ci->ci_svs_kpdirpa;
+	utls->kpdirpa = pmap_pdirpa(pmap, 0);
 
 	mutex_enter(&ci->ci_svs_mtx);
 

Index: src/sys/arch/x86/x86/x86_tlb.c
diff -u src/sys/arch/x86/x86/x86_tlb.c:1.7 src/sys/arch/x86/x86/x86_tlb.c:1.8
--- src/sys/arch/x86/x86/x86_tlb.c:1.7	Sun Apr 21 06:37:21 2019
+++ src/sys/arch/x86/x86/x86_tlb.c	Mon May 27 17:32:36 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: x86_tlb.c,v 1.7 2019/04/21 06:37:21 maxv Exp $	*/
+/*	$NetBSD: x86_tlb.c,v 1.8 2019/05/27 17:32:36 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2008-2012 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: x86_tlb.c,v 1.7 2019/04/21 06:37:21 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: x86_tlb.c,v 1.8 2019/05/27 17:32:36 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -200,10 +200,10 @@ pmap_tlb_invalidate(const pmap_tlb_packe
 	/* Find out what we need to invalidate. */
 	if (tp->tp_count == (uint16_t)-1) {
 		if (tp->tp_pte & PTE_G) {
-			/* Invalidating user and kernel TLB entries. */
+			/* Invalidating all TLB entries. */
 			tlbflushg();
 		} else {
-			/* Invalidating user TLB entries only. */
+			/* Invalidating non-global TLB entries only. */
 			tlbflush();
 		}
 	} else {

Reply via email to