CVS commit: src/sys/arch/powerpc/ibm4xx

2020-09-09 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Sep 10 04:36:24 UTC 2020

Modified Files:
src/sys/arch/powerpc/ibm4xx: pmap.c

Log Message:
Tiny cosmetic fix for previous. No functional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/sys/arch/powerpc/ibm4xx/pmap.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/powerpc/ibm4xx/pmap.c
diff -u src/sys/arch/powerpc/ibm4xx/pmap.c:1.94 src/sys/arch/powerpc/ibm4xx/pmap.c:1.95
--- src/sys/arch/powerpc/ibm4xx/pmap.c:1.94	Thu Sep 10 04:31:55 2020
+++ src/sys/arch/powerpc/ibm4xx/pmap.c	Thu Sep 10 04:36:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.94 2020/09/10 04:31:55 rin Exp $	*/
+/*	$NetBSD: pmap.c,v 1.95 2020/09/10 04:36:24 rin Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.94 2020/09/10 04:31:55 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.95 2020/09/10 04:36:24 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -1160,9 +1160,9 @@ pmap_deactivate(struct lwp *l)
 void
 pmap_procwr(struct proc *p, vaddr_t va, size_t len)
 {
+	struct pmap *pm = p->p_vmspace->vm_map.pmap;
 
 	if (__predict_true(p == curproc)) {
-		struct pmap *pm = p->p_vmspace->vm_map.pmap;
 		int msr, ctx, opid;
 
 		/*
@@ -1203,7 +1203,6 @@ pmap_procwr(struct proc *p, vaddr_t va, 
 			: "=" (msr), "=" (opid)
 			: "r" (ctx), "r" (va), "r" (len), "r" (CACHELINESIZE));
 	} else {
-		struct pmap *pm = p->p_vmspace->vm_map.pmap;
 		paddr_t pa;
 		vaddr_t tva, eva;
 		int tlen;



CVS commit: src/sys/arch/powerpc/ibm4xx

2020-09-09 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Sep 10 04:36:24 UTC 2020

Modified Files:
src/sys/arch/powerpc/ibm4xx: pmap.c

Log Message:
Tiny cosmetic fix for previous. No functional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/sys/arch/powerpc/ibm4xx/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/ibm4xx

2020-09-09 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Sep 10 04:31:55 UTC 2020

Modified Files:
src/sys/arch/powerpc/ibm4xx: pmap.c

Log Message:
Real fix for pmap_procwr(), attempted in revs 1.85 and 1.87:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/powerpc/ibm4xx/pmap.c#rev1.85
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/powerpc/ibm4xx/pmap.c#rev1.87

ibm4xx has VIPT icache and operations in pmap_procwr() should be done with
DMMU enabled (write back dcache into memory and invalidate icache).

When p == curproc, this is trivial. However, p != curproc needs a special
care; we cannot rely upon TLB miss handler in user context. Therefore,
extract pa and operate against it.

Note that va below VM_MIN_KERNEL_ADDRESS (== 2GB at the moment) is reserved
for direct mapping.

Tested by gdb with WIP software single stepping for ibm4xx.


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/arch/powerpc/ibm4xx/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/ibm4xx

2020-09-09 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Sep 10 04:31:55 UTC 2020

Modified Files:
src/sys/arch/powerpc/ibm4xx: pmap.c

Log Message:
Real fix for pmap_procwr(), attempted in revs 1.85 and 1.87:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/powerpc/ibm4xx/pmap.c#rev1.85
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/powerpc/ibm4xx/pmap.c#rev1.87

ibm4xx has VIPT icache and operations in pmap_procwr() should be done with
DMMU enabled (write back dcache into memory and invalidate icache).

When p == curproc, this is trivial. However, p != curproc needs a special
care; we cannot rely upon TLB miss handler in user context. Therefore,
extract pa and operate against it.

Note that va below VM_MIN_KERNEL_ADDRESS (== 2GB at the moment) is reserved
for direct mapping.

Tested by gdb with WIP software single stepping for ibm4xx.


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/arch/powerpc/ibm4xx/pmap.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/powerpc/ibm4xx/pmap.c
diff -u src/sys/arch/powerpc/ibm4xx/pmap.c:1.93 src/sys/arch/powerpc/ibm4xx/pmap.c:1.94
--- src/sys/arch/powerpc/ibm4xx/pmap.c:1.93	Thu Sep 10 03:32:46 2020
+++ src/sys/arch/powerpc/ibm4xx/pmap.c	Thu Sep 10 04:31:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.93 2020/09/10 03:32:46 rin Exp $	*/
+/*	$NetBSD: pmap.c,v 1.94 2020/09/10 04:31:55 rin Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.93 2020/09/10 03:32:46 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.94 2020/09/10 04:31:55 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -1160,42 +1160,72 @@ pmap_deactivate(struct lwp *l)
 void
 pmap_procwr(struct proc *p, vaddr_t va, size_t len)
 {
-	struct pmap *pm = p->p_vmspace->vm_map.pmap;
-	int msr, ctx, opid, step;
 
-	step = CACHELINESIZE;
+	if (__predict_true(p == curproc)) {
+		struct pmap *pm = p->p_vmspace->vm_map.pmap;
+		int msr, ctx, opid;
 
-	/*
-	 * Need to turn off IMMU and switch to user context.
-	 * (icbi uses DMMU).
-	 */
-	if (!(ctx = pm->pm_ctx)) {
-		/* No context -- assign it one */
-		ctx_alloc(pm);
-		ctx = pm->pm_ctx;
-	}
-	__asm volatile(
-		"mfmsr %0;"
-		"li %1, %7;"
-		"andc %1,%0,%1;"
-		"mtmsr %1;"
-		"isync;"
-		"mfpid %1;"
-		"mtpid %2;"
-		"isync;"
+		/*
+		 * Take it easy! TLB miss handler takes care of us.
+		 */
+
+		/*
+	 	 * Need to turn off IMMU and switch to user context.
+		 * (icbi uses DMMU).
+		 */
+
+		if (!(ctx = pm->pm_ctx)) {
+			/* No context -- assign it one */
+			ctx_alloc(pm);
+			ctx = pm->pm_ctx;
+		}
+
+		__asm volatile(
+			"mfmsr %0;"
+			"li %1,0x20;"		/* Turn off IMMU */
+			"andc %1,%0,%1;"
+			"ori %1,%1,0x10;"	/* Turn on DMMU for sure */
+			"mtmsr %1;"
+			"isync;"
+			"mfpid %1;"
+			"mtpid %2;"
+			"isync;"
 		"1:"
-		"dcbst 0,%3;"
-		"icbi 0,%3;"
-		"add %3,%3,%5;"
-		"addc. %4,%4,%6;"
-		"bge 1b;"
-		"sync;"
-		"mtpid %1;"
-		"mtmsr %0;"
-		"isync;"
-		: "=" (msr), "=" (opid)
-		: "r" (ctx), "r" (va), "r" (len), "r" (step), "r" (-step),
-		  "K" (PSL_IR | PSL_DR));
+			"dcbst 0,%3;"
+			"icbi 0,%3;"
+			"add %3,%3,%5;"
+			"sub. %4,%4,%5;"
+			"bge 1b;"
+			"sync;"
+			"mtpid %1;"
+			"mtmsr %0;"
+			"isync;"
+			: "=" (msr), "=" (opid)
+			: "r" (ctx), "r" (va), "r" (len), "r" (CACHELINESIZE));
+	} else {
+		struct pmap *pm = p->p_vmspace->vm_map.pmap;
+		paddr_t pa;
+		vaddr_t tva, eva;
+		int tlen;
+
+		/*
+		 * For p != curproc, we cannot rely upon TLB miss handler in
+		 * user context. Therefore, extract pa and operate againt it.
+		 *
+		 * Note that va below VM_MIN_KERNEL_ADDRESS is reserved for
+		 * direct mapping.
+		 */
+
+		for (tva = va; len > 0; tva = eva, len -= tlen) {
+			eva = uimin(tva + len, trunc_page(tva + PAGE_SIZE));
+			tlen = eva - tva;
+			if (!pmap_extract(pm, tva, )) {
+/* XXX should be already unmapped */
+continue;
+			}
+			__syncicache((void *)pa, tlen);
+		}
+	}
 }
 
 static inline void



CVS commit: src/sys/arch/powerpc

2020-09-09 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Sep 10 03:32:46 UTC 2020

Modified Files:
src/sys/arch/powerpc/conf: files.powerpc
src/sys/arch/powerpc/ibm4xx: pmap.c

Log Message:
Introduce PMAP_TLBDEBUG option for ibm4xx: clear only TLBHI[V] bit when
TLB entry is invalidated, instead of clearing entire TLBHI register.


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/sys/arch/powerpc/conf/files.powerpc
cvs rdiff -u -r1.92 -r1.93 src/sys/arch/powerpc/ibm4xx/pmap.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/powerpc/conf/files.powerpc
diff -u src/sys/arch/powerpc/conf/files.powerpc:1.94 src/sys/arch/powerpc/conf/files.powerpc:1.95
--- src/sys/arch/powerpc/conf/files.powerpc:1.94	Tue Jun 30 16:20:01 2020
+++ src/sys/arch/powerpc/conf/files.powerpc	Thu Sep 10 03:32:46 2020
@@ -1,11 +1,11 @@
-#	$NetBSD: files.powerpc,v 1.94 2020/06/30 16:20:01 maxv Exp $
+#	$NetBSD: files.powerpc,v 1.95 2020/09/10 03:32:46 rin Exp $
 
 defflag	opt_altivec.h	ALTIVEC K_ALTIVEC PPC_HAVE_SPE
 defflag	opt_openpic.h	OPENPIC_DISTRIBUTE
 defparam opt_ppcparam.h	L2CR_CONFIG L3CR_CONFIG INTSTK CLOCKBASE VERBOSE_INITPPC
 defflag	opt_ppcarch.h	PPC_OEA PPC_OEA601 PPC_OEA64 PPC_OEA64_BRIDGE PPC_MPC8XX PPC_IBM4XX PPC_IBM403 PPC_IBM440 PPC_BOOKE
 defflag opt_ppccache.h	CACHE_PROTO_MEI
-defflag opt_pmap.h	PMAPDEBUG PMAPCHECK PMAPCOUNTERS PMAP_MINIMALTLB
+defflag opt_pmap.h	PMAPDEBUG PMAPCHECK PMAPCOUNTERS PMAP_MINIMALTLB PMAP_TLBDEBUG
 defparam opt_pmap.h	PTEGCOUNT PMAP_MEMLIMIT
 
 file	arch/powerpc/powerpc/core_machdep.c		coredump

Index: src/sys/arch/powerpc/ibm4xx/pmap.c
diff -u src/sys/arch/powerpc/ibm4xx/pmap.c:1.92 src/sys/arch/powerpc/ibm4xx/pmap.c:1.93
--- src/sys/arch/powerpc/ibm4xx/pmap.c:1.92	Thu Sep 10 03:23:55 2020
+++ src/sys/arch/powerpc/ibm4xx/pmap.c	Thu Sep 10 03:32:46 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.92 2020/09/10 03:23:55 rin Exp $	*/
+/*	$NetBSD: pmap.c,v 1.93 2020/09/10 03:32:46 rin Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -67,10 +67,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.92 2020/09/10 03:23:55 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.93 2020/09/10 03:32:46 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
+#include "opt_pmap.h"
 #endif
 
 #include 
@@ -193,6 +194,8 @@ static inline int pte_enter(struct pmap 
 static inline int pmap_enter_pv(struct pmap *, vaddr_t, paddr_t, int);
 static void pmap_remove_pv(struct pmap *, vaddr_t, paddr_t);
 
+static inline void tlb_invalidate_entry(int);
+
 static int ppc4xx_tlb_size_mask(size_t, int *, int *);
 
 
@@ -1195,6 +1198,43 @@ pmap_procwr(struct proc *p, vaddr_t va, 
 		  "K" (PSL_IR | PSL_DR));
 }
 
+static inline void
+tlb_invalidate_entry(int i)
+{
+#ifdef PMAP_TLBDEBUG
+	/*
+	 * Clear only TLBHI[V] bit so that we can track invalidated entry.
+	 */
+	register_t msr, pid, hi;
+
+	KASSERT(mfspr(SPR_PID) == KERNEL_PID);
+
+	__asm volatile(
+		"mfmsr	%0;"
+		"li	%1,0;"
+		"mtmsr	%1;"
+		"mfpid	%1;"
+		"tlbre	%2,%3,0;"
+		"andc	%2,%2,%4;"
+		"tlbwe	%2,%3,0;"
+		"mtpid	%1;"
+		"mtmsr	%0;"
+		"isync;"
+		: "=" (msr), "=" (pid), "=" (hi)
+		: "r" (i), "r" (TLB_VALID));
+#else
+	/*
+	 * Just clear entire TLBHI register.
+	 */
+	__asm volatile(
+		"tlbwe %0,%1,0;"
+		"isync;"
+		: : "r" (0), "r" (i));
+#endif
+
+	tlb_info[i].ti_ctx = 0;
+	tlb_info[i].ti_flags = 0;
+}
 
 /* This has to be done in real mode !!! */
 void
@@ -1228,13 +1268,7 @@ ppc4xx_tlb_flush(vaddr_t va, int pid)
 		: "r" (va), "r" (pid));
 	if (found && !TLB_LOCKED(i)) {
 		/* Now flush translation */
-		__asm volatile(
-			"tlbwe %0,%1,0;"
-			"isync;"
-			: : "r" (0), "r" (i));
-
-		tlb_info[i].ti_ctx = 0;
-		tlb_info[i].ti_flags = 0;
+		tlb_invalidate_entry(i);
 		tlbnext = i;
 		/* Successful flushes */
 		tlbflush_ev.ev_count++;
@@ -1247,12 +1281,8 @@ ppc4xx_tlb_flush_all(void)
 	u_long i;
 
 	for (i = 0; i < NTLB; i++)
-		if (!TLB_LOCKED(i)) {
-			__asm volatile(
-"tlbwe %0,%1,0;" : : "r" (0), "r" (i));
-			tlb_info[i].ti_ctx = 0;
-			tlb_info[i].ti_flags = 0;
-		}
+		if (!TLB_LOCKED(i))
+			tlb_invalidate_entry(i);
 
 	__asm volatile("isync");
 }
@@ -1526,10 +1556,11 @@ ctx_flush(int cnum)
 			if (i < tlb_nreserved)
 panic("TLB entry %d not locked", i);
 #endif
-			/* Invalidate particular TLB entry regardless of locked status */
-			__asm volatile("tlbwe %0,%1,0" : :"r"(0),"r"(i));
-			tlb_info[i].ti_ctx = 0;
-			tlb_info[i].ti_flags = 0;
+			/*
+			 * Invalidate particular TLB entry regardless of
+			 * locked status
+			 */
+			tlb_invalidate_entry(i);
 		}
 	}
 	return (0);



CVS commit: src/sys/arch/powerpc

2020-09-09 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Sep 10 03:32:46 UTC 2020

Modified Files:
src/sys/arch/powerpc/conf: files.powerpc
src/sys/arch/powerpc/ibm4xx: pmap.c

Log Message:
Introduce PMAP_TLBDEBUG option for ibm4xx: clear only TLBHI[V] bit when
TLB entry is invalidated, instead of clearing entire TLBHI register.


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/sys/arch/powerpc/conf/files.powerpc
cvs rdiff -u -r1.92 -r1.93 src/sys/arch/powerpc/ibm4xx/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/ibm4xx

2020-09-09 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Sep 10 03:23:55 UTC 2020

Modified Files:
src/sys/arch/powerpc/ibm4xx: pmap.c

Log Message:
pmap_kenter_pa: Remove comment which says ``Have to remove any existing
mapping first.'' Contrary to this comment, pmap_kremove(9) has never
been called there since rev 1.1, and we don't for other ports also.


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/sys/arch/powerpc/ibm4xx/pmap.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/powerpc/ibm4xx/pmap.c
diff -u src/sys/arch/powerpc/ibm4xx/pmap.c:1.91 src/sys/arch/powerpc/ibm4xx/pmap.c:1.92
--- src/sys/arch/powerpc/ibm4xx/pmap.c:1.91	Thu Sep 10 03:02:36 2020
+++ src/sys/arch/powerpc/ibm4xx/pmap.c	Thu Sep 10 03:23:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.91 2020/09/10 03:02:36 rin Exp $	*/
+/*	$NetBSD: pmap.c,v 1.92 2020/09/10 03:23:55 rin Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.91 2020/09/10 03:02:36 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.92 2020/09/10 03:23:55 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -931,10 +931,6 @@ pmap_kenter_pa(vaddr_t va, paddr_t pa, v
 	struct pmap *pm = pmap_kernel();
 
 	/*
-	 * Have to remove any existing mapping first.
-	 */
-
-	/*
 	 * Generate TTE.
 	 *
 	 * 



CVS commit: src/sys/arch/powerpc/ibm4xx

2020-09-09 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Sep 10 03:23:55 UTC 2020

Modified Files:
src/sys/arch/powerpc/ibm4xx: pmap.c

Log Message:
pmap_kenter_pa: Remove comment which says ``Have to remove any existing
mapping first.'' Contrary to this comment, pmap_kremove(9) has never
been called there since rev 1.1, and we don't for other ports also.


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/sys/arch/powerpc/ibm4xx/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/ibm4xx

2020-09-09 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Sep 10 03:02:36 UTC 2020

Modified Files:
src/sys/arch/powerpc/ibm4xx: pmap.c

Log Message:
Introduce PV_VA() macro to extract va from pv->pv_va by clearing
PV_WIRED flag, and use it where appropriate.

There should be no functional changes. Only for safety in future.


To generate a diff of this commit:
cvs rdiff -u -r1.90 -r1.91 src/sys/arch/powerpc/ibm4xx/pmap.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/powerpc/ibm4xx/pmap.c
diff -u src/sys/arch/powerpc/ibm4xx/pmap.c:1.90 src/sys/arch/powerpc/ibm4xx/pmap.c:1.91
--- src/sys/arch/powerpc/ibm4xx/pmap.c:1.90	Mon Jul  6 10:40:21 2020
+++ src/sys/arch/powerpc/ibm4xx/pmap.c	Thu Sep 10 03:02:36 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.90 2020/07/06 10:40:21 rin Exp $	*/
+/*	$NetBSD: pmap.c,v 1.91 2020/09/10 03:02:36 rin Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.90 2020/07/06 10:40:21 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.91 2020/09/10 03:02:36 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -156,7 +156,8 @@ static char *pmap_attrib;
 #define PV_WIRE(pv)	((pv)->pv_va |= PV_WIRED)
 #define PV_UNWIRE(pv)	((pv)->pv_va &= ~PV_WIRED)
 #define PV_ISWIRED(pv)	((pv)->pv_va & PV_WIRED)
-#define PV_CMPVA(va,pv)	(!(((pv)->pv_va ^ (va)) & (~PV_WIRED)))
+#define PV_VA(pv)	((pv)->pv_va & ~PV_WIRED)
+#define PV_CMPVA(va,pv)	(!(PV_VA(pv) ^ (va)))
 
 struct pv_entry {
 	struct pv_entry *pv_next;	/* Linked list of mappings */
@@ -1115,14 +1116,14 @@ pmap_page_protect(struct vm_page *pg, vm
 		npv = pv->pv_next;
 
 		pm = pv->pv_pm;
-		va = pv->pv_va;
+		va = PV_VA(pv);
 		pmap_protect(pm, va, va + PAGE_SIZE, prot);
 	}
 	/* Now check the head pv */
 	if (pvh->pv_pm) {
 		pv = pvh;
 		pm = pv->pv_pm;
-		va = pv->pv_va;
+		va = PV_VA(pv);
 		pmap_protect(pm, va, va + PAGE_SIZE, prot);
 	}
 }



CVS commit: src/sys/arch/powerpc/ibm4xx

2020-09-09 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Sep 10 03:02:36 UTC 2020

Modified Files:
src/sys/arch/powerpc/ibm4xx: pmap.c

Log Message:
Introduce PV_VA() macro to extract va from pv->pv_va by clearing
PV_WIRED flag, and use it where appropriate.

There should be no functional changes. Only for safety in future.


To generate a diff of this commit:
cvs rdiff -u -r1.90 -r1.91 src/sys/arch/powerpc/ibm4xx/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/booke

2020-09-09 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Sep 10 02:45:28 UTC 2020

Modified Files:
src/sys/arch/powerpc/booke: trap.c

Log Message:
Fix build with UVMHIST; stop passing string literal to UVMHIST_LOG(),
and also cast pointer arguments into uintptr_t.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/powerpc/booke/trap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/booke

2020-09-09 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Thu Sep 10 02:45:28 UTC 2020

Modified Files:
src/sys/arch/powerpc/booke: trap.c

Log Message:
Fix build with UVMHIST; stop passing string literal to UVMHIST_LOG(),
and also cast pointer arguments into uintptr_t.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/powerpc/booke/trap.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/powerpc/booke/trap.c
diff -u src/sys/arch/powerpc/booke/trap.c:1.34 src/sys/arch/powerpc/booke/trap.c:1.35
--- src/sys/arch/powerpc/booke/trap.c:1.34	Wed Jul 15 09:10:14 2020
+++ src/sys/arch/powerpc/booke/trap.c	Thu Sep 10 02:45:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.34 2020/07/15 09:10:14 rin Exp $	*/
+/*	$NetBSD: trap.c,v 1.35 2020/09/10 02:45:28 rin Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.34 2020/07/15 09:10:14 rin Exp $");
+__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.35 2020/09/10 02:45:28 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altivec.h"
@@ -294,12 +294,18 @@ isi_exception(struct trapframe *tf, ksig
 		KASSERT(pg);
 		struct vm_page_md * const mdpg = VM_PAGE_TO_MD(pg);
 
-		UVMHIST_LOG(pmapexechist,
-		"srr0=%#x pg=%p (pa %#"PRIxPADDR"): %s", 
-		tf->tf_srr0, pg, pa, 
-		(VM_PAGEMD_EXECPAGE_P(mdpg)
-			? "no syncicache (already execpage)"
-			: "performed syncicache (now execpage)"));
+#ifdef UVMHIST
+		if (VM_PAGEMD_EXECPAGE_P(mdpg))
+			UVMHIST_LOG(pmapexechist,
+			"srr0=%#x pg=%p (pa %#"PRIxPADDR"): "
+			"no syncicache (already execpage)", 
+			tf->tf_srr0, (uintptr_t)pg, pa, 0);
+		else
+			UVMHIST_LOG(pmapexechist,
+			"srr0=%#x pg=%p (pa %#"PRIxPADDR"): "
+			"performed syncicache (now execpage)",
+			tf->tf_srr0, (uintptr_t)pg, pa, 0);
+#endif
 
 		if (!VM_PAGEMD_EXECPAGE_P(mdpg)) {
 			ci->ci_softc->cpu_ev_exec_trap_sync.ev_count++;



CVS commit: src/sys/arch/powerpc/fpu

2020-07-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 15 09:42:43 UTC 2020

Modified Files:
src/sys/arch/powerpc/fpu: fpu_emu.c

Log Message:
Now, FPU emulation for booke and ibm4xx works fine at a level where
all the related ATF tests pass correctly. However, there still remain
problems:

- FEX and VX bits for FPSCR cannot be modified by mcrfs, mtfsf{,i},
  and mtfsb[01].
- Invalid operations should be treated differently depending on
  FPSCR[VE].

Therefore, comment them in order not to be forgotten.

No binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/powerpc/fpu/fpu_emu.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/powerpc/fpu/fpu_emu.c
diff -u src/sys/arch/powerpc/fpu/fpu_emu.c:1.32 src/sys/arch/powerpc/fpu/fpu_emu.c:1.33
--- src/sys/arch/powerpc/fpu/fpu_emu.c:1.32	Wed Jul 15 09:36:35 2020
+++ src/sys/arch/powerpc/fpu/fpu_emu.c	Wed Jul 15 09:42:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_emu.c,v 1.32 2020/07/15 09:36:35 rin Exp $ */
+/*	$NetBSD: fpu_emu.c,v 1.33 2020/07/15 09:42:43 rin Exp $ */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.32 2020/07/15 09:36:35 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.33 2020/07/15 09:42:43 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -605,6 +605,15 @@ fpu_execute(struct trapframe *tf, struct
 fe->fe_cx = mask & a[1];
 fe->fe_fpscr = (fe->fe_fpscr&~mask) | 
 	(fe->fe_cx);
+/*
+ * XXX
+ * Forbidden to set FEX and VX, also for
+ * mcrfs, mtfsfi, and mtfsb[01].
+ *
+ * XXX
+ * Handle invalid operation differently,
+ * depending on VE.
+ */
 /* XXX weird stuff about OX, FX, FEX, and VX should be handled */
 break;
 			case	OPC63_FCTID:



CVS commit: src/sys/arch/powerpc/fpu

2020-07-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 15 09:42:43 UTC 2020

Modified Files:
src/sys/arch/powerpc/fpu: fpu_emu.c

Log Message:
Now, FPU emulation for booke and ibm4xx works fine at a level where
all the related ATF tests pass correctly. However, there still remain
problems:

- FEX and VX bits for FPSCR cannot be modified by mcrfs, mtfsf{,i},
  and mtfsb[01].
- Invalid operations should be treated differently depending on
  FPSCR[VE].

Therefore, comment them in order not to be forgotten.

No binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/powerpc/fpu/fpu_emu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/fpu

2020-07-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 15 09:36:35 UTC 2020

Modified Files:
src/sys/arch/powerpc/fpu: fpu_emu.c

Log Message:
Try to fix FPSCR bits in the end of emulation:

- FPSCR[FEX] is not a sticky bit.
- Turn on FPSCR[FEX] if the emulated instruction causes invalid operation,
  and invalid operation exception is not masked out.
- FPSCR[VX] is not a sticky bit, however it should be set when at least
  one of FPSCR[VXfoo] bits (they are sticky!) is set.
- FPSCR[FX] is a sticky bit, and it should be set if FPSCR is modified by
  instructions other than mtfsf{,i}.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/powerpc/fpu/fpu_emu.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/powerpc/fpu/fpu_emu.c
diff -u src/sys/arch/powerpc/fpu/fpu_emu.c:1.31 src/sys/arch/powerpc/fpu/fpu_emu.c:1.32
--- src/sys/arch/powerpc/fpu/fpu_emu.c:1.31	Wed Jul 15 09:22:26 2020
+++ src/sys/arch/powerpc/fpu/fpu_emu.c	Wed Jul 15 09:36:35 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_emu.c,v 1.31 2020/07/15 09:22:26 rin Exp $ */
+/*	$NetBSD: fpu_emu.c,v 1.32 2020/07/15 09:36:35 rin Exp $ */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.31 2020/07/15 09:22:26 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.32 2020/07/15 09:36:35 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -147,7 +147,9 @@ FPU_EMU_EVCNT_DECL(fnmadd);
 			FPSCR_VXZDZ|FPSCR_VXIMZ|FPSCR_VXVC|FPSCR_VXSOFT|\
 			FPSCR_VXSQRT|FPSCR_VXCVI)
 #define	FPSR_EX		(FPSCR_VE|FPSCR_OE|FPSCR_UE|FPSCR_ZE|FPSCR_XE)
-#define	FPSR_EXOP	(FPSR_EX_MSK&(~FPSR_EX))
+#define	FPSR_INV	(FPSCR_VXSNAN|FPSCR_VXISI|FPSCR_VXIDI|		\
+			FPSCR_VXZDZ|FPSCR_VXIMZ|FPSCR_VXVC|FPSCR_VXSOFT|\
+			FPSCR_VXSQRT|FPSCR_VXCVI)
 
 
 int fpe_debug = 0;
@@ -287,6 +289,7 @@ fpu_execute(struct trapframe *tf, struct
 	int ra, rb, rc, rt, type, mask, fsr, cx, bf, setcr;
 	unsigned int cond;
 	struct fpreg *fs;
+	int mtfsf = 0;
 
 	/* Setup work. */
 	fp = NULL;
@@ -550,6 +553,7 @@ fpu_execute(struct trapframe *tf, struct
 	sizeof(double));
 break;
 			case	OPC63_MTFSFI:
+mtfsf = 1;
 FPU_EMU_EVCNT_INCR(mtfsfi);
 DPRINTF(FPE_INSN, ("fpu_execute: MTFSFI\n"));
 rb >>= 1;
@@ -585,6 +589,7 @@ fpu_execute(struct trapframe *tf, struct
 	sizeof(fs->fpscr));
 break;
 			case	OPC63_MTFSF:
+mtfsf = 1;
 FPU_EMU_EVCNT_INCR(mtfsf);
 DPRINTF(FPE_INSN, ("fpu_execute: MTFSF\n"));
 if ((rt = instr.i_xfl.i_flm) == -1)
@@ -769,11 +774,10 @@ fpu_execute(struct trapframe *tf, struct
 	if (fp)
 		fpu_implode(fe, fp, type, (u_int *)>fpreg[rt]);
 	cx = fe->fe_cx;
-	fsr = fe->fe_fpscr;
+	fsr = fe->fe_fpscr & ~(FPSCR_FEX|FPSCR_VX);
 	if (cx != 0) {
-		fsr &= ~FPSCR_FX;
-		if ((cx^fsr)_EX_MSK)
-			fsr |= FPSCR_FX;
+		if (cx & FPSR_INV)
+			cx |= FPSCR_VX;
 		mask = fsr & FPSR_EX;
 		mask <<= (25-3);
 		if (cx & mask) 
@@ -782,11 +786,13 @@ fpu_execute(struct trapframe *tf, struct
 			/* Need to replace CC */
 			fsr &= ~FPSCR_FPRF;
 		}
-		if (cx & (FPSR_EXOP))
-			fsr |= FPSCR_VX;
 		fsr |= cx;
 		DPRINTF(FPE_INSN, ("fpu_execute: cx %x, fsr %x\n", cx, fsr));
 	}
+	if (fsr & FPSR_INV)
+		fsr |= FPSCR_VX;
+	if (mtfsf == 0 && ((fsr ^ fe->fe_fpscr) & FPSR_EX_MSK))
+		fsr |= FPSCR_FX;
 
 	if (cond) {
 		cond = fsr & 0xf000;



CVS commit: src/sys/arch/powerpc/fpu

2020-07-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 15 09:36:35 UTC 2020

Modified Files:
src/sys/arch/powerpc/fpu: fpu_emu.c

Log Message:
Try to fix FPSCR bits in the end of emulation:

- FPSCR[FEX] is not a sticky bit.
- Turn on FPSCR[FEX] if the emulated instruction causes invalid operation,
  and invalid operation exception is not masked out.
- FPSCR[VX] is not a sticky bit, however it should be set when at least
  one of FPSCR[VXfoo] bits (they are sticky!) is set.
- FPSCR[FX] is a sticky bit, and it should be set if FPSCR is modified by
  instructions other than mtfsf{,i}.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/powerpc/fpu/fpu_emu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/fpu

2020-07-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 15 09:22:26 UTC 2020

Modified Files:
src/sys/arch/powerpc/fpu: fpu_emu.c

Log Message:
Set ksi_code correctly via fpu_get_fault_code() for SIGFPE.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/powerpc/fpu/fpu_emu.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/powerpc/fpu/fpu_emu.c
diff -u src/sys/arch/powerpc/fpu/fpu_emu.c:1.30 src/sys/arch/powerpc/fpu/fpu_emu.c:1.31
--- src/sys/arch/powerpc/fpu/fpu_emu.c:1.30	Wed Jul 15 09:16:35 2020
+++ src/sys/arch/powerpc/fpu/fpu_emu.c	Wed Jul 15 09:22:26 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_emu.c,v 1.30 2020/07/15 09:16:35 rin Exp $ */
+/*	$NetBSD: fpu_emu.c,v 1.31 2020/07/15 09:22:26 rin Exp $ */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.30 2020/07/15 09:16:35 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.31 2020/07/15 09:22:26 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -244,6 +244,7 @@ success:
 		DPRINTF(FPE_EX, ("fpu_emulate: SIGFPE\n"));
 		ksi->ksi_signo = SIGFPE;
 		ksi->ksi_trap = EXC_PGM;
+		ksi->ksi_code = fpu_get_fault_code();
 		return true;
 
 	case FAULT:



CVS commit: src/sys/arch/powerpc/fpu

2020-07-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 15 09:22:26 UTC 2020

Modified Files:
src/sys/arch/powerpc/fpu: fpu_emu.c

Log Message:
Set ksi_code correctly via fpu_get_fault_code() for SIGFPE.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/powerpc/fpu/fpu_emu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc

2020-07-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 15 09:19:49 UTC 2020

Modified Files:
src/sys/arch/powerpc/include: fpu.h
src/sys/arch/powerpc/powerpc: fpu.c

Log Message:
Expose fpu_get_fault_code() even if !PPC_HAVE_FPU, and
adjust it to systems without FPU.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/powerpc/include/fpu.h
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/powerpc/powerpc/fpu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc

2020-07-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 15 09:19:49 UTC 2020

Modified Files:
src/sys/arch/powerpc/include: fpu.h
src/sys/arch/powerpc/powerpc: fpu.c

Log Message:
Expose fpu_get_fault_code() even if !PPC_HAVE_FPU, and
adjust it to systems without FPU.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/powerpc/include/fpu.h
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/powerpc/powerpc/fpu.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/powerpc/include/fpu.h
diff -u src/sys/arch/powerpc/include/fpu.h:1.24 src/sys/arch/powerpc/include/fpu.h:1.25
--- src/sys/arch/powerpc/include/fpu.h:1.24	Mon Jul  6 10:52:12 2020
+++ src/sys/arch/powerpc/include/fpu.h	Wed Jul 15 09:19:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu.h,v 1.24 2020/07/06 10:52:12 rin Exp $	*/
+/*	$NetBSD: fpu.h,v 1.25 2020/07/15 09:19:49 rin Exp $	*/
 
 /*-
  * Copyright (C) 1996 Wolfgang Solfrank.
@@ -83,6 +83,8 @@ void	fpu_mark_used(struct lwp *);
 void	fpu_restore_from_mcontext(struct lwp *, const mcontext_t *);
 bool	fpu_save_to_mcontext(struct lwp *, mcontext_t *, unsigned int *);
 
+int	fpu_get_fault_code(void);
+
 extern const pcu_ops_t fpu_ops;
 
 /* List of PowerPC architectures that support FPUs. */
@@ -112,8 +114,6 @@ fpu_discard(lwp_t *l)
 void	fpu_load_from_fpreg(const struct fpreg *);
 void	fpu_unload_to_fpreg(struct fpreg *);
 
-int	fpu_get_fault_code(void);
-
 #endif /* PPC_HAVE_FPU */
 #endif /* _KERNEL */
 

Index: src/sys/arch/powerpc/powerpc/fpu.c
diff -u src/sys/arch/powerpc/powerpc/fpu.c:1.41 src/sys/arch/powerpc/powerpc/fpu.c:1.42
--- src/sys/arch/powerpc/powerpc/fpu.c:1.41	Mon Jul  6 10:52:12 2020
+++ src/sys/arch/powerpc/powerpc/fpu.c	Wed Jul 15 09:19:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu.c,v 1.41 2020/07/06 10:52:12 rin Exp $	*/
+/*	$NetBSD: fpu.c,v 1.42 2020/07/15 09:19:49 rin Exp $	*/
 
 /*
  * Copyright (C) 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.41 2020/07/06 10:52:12 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu.c,v 1.42 2020/07/15 09:19:49 rin Exp $");
 
 #include 
 #include 
@@ -124,7 +124,6 @@ fpu_state_release(lwp_t *l)
 #endif
 }
 
-#ifdef PPC_HAVE_FPU
 #define	STICKYBITS	(FPSCR_VX|FPSCR_OX|FPSCR_UX|FPSCR_ZX|FPSCR_XX)
 #define	STICKYSHIFT	25
 #define	MASKBITS	(FPSCR_VE|FPSCR_OE|FPSCR_UE|FPSCR_ZE|FPSCR_XE)
@@ -139,6 +138,7 @@ fpu_get_fault_code(void)
 	uint32_t fpscr, ofpscr;
 	int code;
 
+#ifdef PPC_HAVE_FPU
 	kpreempt_disable();
 
 	struct cpu_info * const ci = curcpu();
@@ -182,6 +182,10 @@ fpu_get_fault_code(void)
 	}
 
 	kpreempt_enable();
+#else /* !PPC_HAVE_FPU */
+	fpscr64 = *(uint64_t *)>pcb_fpu.fpscr;
+	((uint32_t *)>pcb_fpu.fpscr)[_QUAD_LOWWORD] &= ~MASKBITS;
+#endif
 
 	/*
 	 * Now determine the fault type.  First we test to see if any of sticky
@@ -207,7 +211,6 @@ fpu_get_fault_code(void)
 	elsecode = 0;
 	return code;
 }
-#endif /* PPC_HAVE_FPU */
 
 bool
 fpu_save_to_mcontext(lwp_t *l, mcontext_t *mcp, unsigned int *flagp)



CVS commit: src/sys/arch/powerpc/fpu

2020-07-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 15 09:16:35 UTC 2020

Modified Files:
src/sys/arch/powerpc/fpu: fpu_emu.c

Log Message:
Do not raise SIGFPE unless MSR[FE0] or MSR[FE1] is set via fenv(3).


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/powerpc/fpu/fpu_emu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/fpu

2020-07-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 15 09:16:35 UTC 2020

Modified Files:
src/sys/arch/powerpc/fpu: fpu_emu.c

Log Message:
Do not raise SIGFPE unless MSR[FE0] or MSR[FE1] is set via fenv(3).


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/powerpc/fpu/fpu_emu.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/powerpc/fpu/fpu_emu.c
diff -u src/sys/arch/powerpc/fpu/fpu_emu.c:1.29 src/sys/arch/powerpc/fpu/fpu_emu.c:1.30
--- src/sys/arch/powerpc/fpu/fpu_emu.c:1.29	Wed Jul 15 08:29:07 2020
+++ src/sys/arch/powerpc/fpu/fpu_emu.c	Wed Jul 15 09:16:35 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_emu.c,v 1.29 2020/07/15 08:29:07 rin Exp $ */
+/*	$NetBSD: fpu_emu.c,v 1.30 2020/07/15 09:16:35 rin Exp $ */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.29 2020/07/15 08:29:07 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.30 2020/07/15 09:16:35 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -92,6 +92,8 @@ __KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 
 #include 
 
 #include 
+#include 
+
 #include 
 #include 
 #include 
@@ -191,6 +193,7 @@ fpu_dumpfpn(struct fpn *fp)
 bool
 fpu_emulate(struct trapframe *tf, struct fpreg *fpf, ksiginfo_t *ksi)
 {
+	struct pcb *pcb;
 	union instr insn;
 	struct fpemu fe;
 
@@ -229,11 +232,15 @@ fpu_emulate(struct trapframe *tf, struct
 	}
 	switch (fpu_execute(tf, , )) {
 	case 0:
+success:
 		DPRINTF(FPE_EX, ("fpu_emulate: success\n"));
 		tf->tf_srr0 += 4;
 		return true;
 
 	case FPE:
+		pcb = lwp_getpcb(curlwp);
+		if ((pcb->pcb_flags & PSL_FE_PREC) == 0)
+			goto success;
 		DPRINTF(FPE_EX, ("fpu_emulate: SIGFPE\n"));
 		ksi->ksi_signo = SIGFPE;
 		ksi->ksi_trap = EXC_PGM;



CVS commit: src/sys/arch/powerpc

2020-07-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 15 09:10:14 UTC 2020

Modified Files:
src/sys/arch/powerpc/booke: trap.c
src/sys/arch/powerpc/ibm4xx: trap.c

Log Message:
For booke and ibm4xx, emulate m[ft]msr in user mode, in the same
manner as oea.

Now, user process can decide by itself whether floating-point
exception triggers SIGFPE or not via fenv(3).


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/powerpc/booke/trap.c
cvs rdiff -u -r1.84 -r1.85 src/sys/arch/powerpc/ibm4xx/trap.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/powerpc/booke/trap.c
diff -u src/sys/arch/powerpc/booke/trap.c:1.33 src/sys/arch/powerpc/booke/trap.c:1.34
--- src/sys/arch/powerpc/booke/trap.c:1.33	Wed Jul 15 07:44:34 2020
+++ src/sys/arch/powerpc/booke/trap.c	Wed Jul 15 09:10:14 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.33 2020/07/15 07:44:34 rin Exp $	*/
+/*	$NetBSD: trap.c,v 1.34 2020/07/15 09:10:14 rin Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.33 2020/07/15 07:44:34 rin Exp $");
+__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.34 2020/07/15 09:10:14 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altivec.h"
@@ -437,10 +437,7 @@ emulate_opcode(struct trapframe *tf, ksi
 		return true;
 	}
 
-	/*
-	 * If we bothered to emulate FP, we would try to do so here.
-	 */
-	return false;
+	return emulate_mxmsr(curlwp, tf, opcode);
 }
 
 static int

Index: src/sys/arch/powerpc/ibm4xx/trap.c
diff -u src/sys/arch/powerpc/ibm4xx/trap.c:1.84 src/sys/arch/powerpc/ibm4xx/trap.c:1.85
--- src/sys/arch/powerpc/ibm4xx/trap.c:1.84	Wed Jul 15 08:48:40 2020
+++ src/sys/arch/powerpc/ibm4xx/trap.c	Wed Jul 15 09:10:14 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.84 2020/07/15 08:48:40 rin Exp $	*/
+/*	$NetBSD: trap.c,v 1.85 2020/07/15 09:10:14 rin Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -69,7 +69,7 @@
 #define	__UFETCHSTORE_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.84 2020/07/15 08:48:40 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.85 2020/07/15 09:10:14 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -287,6 +287,7 @@ vm_signal:
 		if (rv == 0) {
 			break;
 		}
+isi:
 		KSI_INIT_TRAP();
 		ksi.ksi_trap = EXC_ISI;
 		ksi.ksi_addr = (void *)tf->tf_srr0;
@@ -324,6 +325,20 @@ sigtrap:
 			}
 			ksi.ksi_code = TRAP_BRKPT;
 			ksi.ksi_signo = SIGTRAP;
+		} else if (tf->tf_esr & ESR_PPR) {
+			uint32_t opcode;
+
+			rv = copyin((void *)tf->tf_srr0, ,
+			sizeof(opcode));
+			if (rv)
+goto isi;
+			if (emulate_mxmsr(l, tf, opcode)) {
+tf->tf_srr0 += 4;
+break;
+			}
+
+			ksi.ksi_code = ILL_PRVOPC;
+			ksi.ksi_signo = SIGILL;
 		} else {
 			pcb = lwp_getpcb(l);
 



CVS commit: src/sys/arch/powerpc

2020-07-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 15 09:10:14 UTC 2020

Modified Files:
src/sys/arch/powerpc/booke: trap.c
src/sys/arch/powerpc/ibm4xx: trap.c

Log Message:
For booke and ibm4xx, emulate m[ft]msr in user mode, in the same
manner as oea.

Now, user process can decide by itself whether floating-point
exception triggers SIGFPE or not via fenv(3).


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/powerpc/booke/trap.c
cvs rdiff -u -r1.84 -r1.85 src/sys/arch/powerpc/ibm4xx/trap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc

2020-07-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 15 08:58:52 UTC 2020

Modified Files:
src/sys/arch/powerpc/include: cpu.h instr.h
src/sys/arch/powerpc/powerpc: powerpc_machdep.c trap.c

Log Message:
Factor out emulation code for m[ft]msr in user mode from oea, and
adjust it for systems without FPU.

Now, it can be used from booke and ibm4xx in order to support fenv(3).


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/sys/arch/powerpc/include/cpu.h
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/powerpc/include/instr.h
cvs rdiff -u -r1.79 -r1.80 src/sys/arch/powerpc/powerpc/powerpc_machdep.c
cvs rdiff -u -r1.162 -r1.163 src/sys/arch/powerpc/powerpc/trap.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/powerpc/include/cpu.h
diff -u src/sys/arch/powerpc/include/cpu.h:1.114 src/sys/arch/powerpc/include/cpu.h:1.115
--- src/sys/arch/powerpc/include/cpu.h:1.114	Tue Jul  7 01:39:23 2020
+++ src/sys/arch/powerpc/include/cpu.h	Wed Jul 15 08:58:51 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.114 2020/07/07 01:39:23 rin Exp $	*/
+/*	$NetBSD: cpu.h,v 1.115 2020/07/15 08:58:51 rin Exp $	*/
 
 /*
  * Copyright (C) 1999 Wolfgang Solfrank.
@@ -391,6 +391,8 @@ void	icache_inv(vaddr_t, vsize_t);
 void *	mapiodev(paddr_t, psize_t, bool);
 void	unmapiodev(vaddr_t, vsize_t);
 
+int	emulate_mxmsr(struct lwp *, struct trapframe *, uint32_t);
+
 #ifdef MULTIPROCESSOR
 int	md_setup_trampoline(volatile struct cpu_hatch_data *,
 	struct cpu_info *);

Index: src/sys/arch/powerpc/include/instr.h
diff -u src/sys/arch/powerpc/include/instr.h:1.8 src/sys/arch/powerpc/include/instr.h:1.9
--- src/sys/arch/powerpc/include/instr.h:1.8	Mon Feb 27 06:54:00 2017
+++ src/sys/arch/powerpc/include/instr.h	Wed Jul 15 08:58:51 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: instr.h,v 1.8 2017/02/27 06:54:00 chs Exp $ */
+/*	$NetBSD: instr.h,v 1.9 2020/07/15 08:58:51 rin Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -405,12 +405,6 @@ union instr {
 #define	OPC_MFSPR_REG(o)	(((o) >> 21) & 0x1f)
 #define	OPC_MFSPR_P(o, spr)	(((o) & OPC_MFSPR_MASK) == OPC_MFSPR(spr))
 
-#define	OPC_MFMSR_CODE		0x7ca6
-#define	OPC_MFMSR_MASK		0xfc1f
-#define	OPC_MFMSR		OPC_MFMSR_CODE
-#define	OPC_MFMSR_REG(o)	(((o) >> 21) & 0x1f)
-#define	OPC_MFMSR_P(o)		(((o) & OPC_MFMSR_MASK) == OPC_MFMSR_CODE)
-
 /*
  * booke doesn't have lwsync even though gcc emits it so we have to emulate it.
  */

Index: src/sys/arch/powerpc/powerpc/powerpc_machdep.c
diff -u src/sys/arch/powerpc/powerpc/powerpc_machdep.c:1.79 src/sys/arch/powerpc/powerpc/powerpc_machdep.c:1.80
--- src/sys/arch/powerpc/powerpc/powerpc_machdep.c:1.79	Tue Jul  7 01:39:23 2020
+++ src/sys/arch/powerpc/powerpc/powerpc_machdep.c	Wed Jul 15 08:58:52 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: powerpc_machdep.c,v 1.79 2020/07/07 01:39:23 rin Exp $	*/
+/*	$NetBSD: powerpc_machdep.c,v 1.80 2020/07/15 08:58:52 rin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: powerpc_machdep.c,v 1.79 2020/07/07 01:39:23 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: powerpc_machdep.c,v 1.80 2020/07/15 08:58:52 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altivec.h"
@@ -738,6 +738,82 @@ cpu_debug_dump(void)
 #endif	/* DDB */
 #endif /* MULTIPROCESSOR */
 
+int
+emulate_mxmsr(struct lwp *l, struct trapframe *tf, uint32_t opcode)
+{
+
+#define	OPC_MFMSR_CODE		0x7ca6
+#define	OPC_MFMSR_MASK		0xfc1f
+#define	OPC_MFMSR_P(o)		(((o) & OPC_MFMSR_MASK) == OPC_MFMSR_CODE)
+
+#define	OPC_MTMSR_CODE		0x7c000124
+#define	OPC_MTMSR_MASK		0xfc1f
+#define	OPC_MTMSR_P(o)		(((o) & OPC_MTMSR_MASK) == OPC_MTMSR_CODE)
+
+#define	OPC_MXMSR_REG(o)	(((o) >> 21) & 0x1f)
+
+	if (OPC_MFMSR_P(opcode)) {
+		struct pcb * const pcb = lwp_getpcb(l);
+		register_t msr = tf->tf_srr1 & PSL_USERSRR1;
+
+		if (fpu_used_p(l))
+			msr |= PSL_FP;
+#ifdef ALTIVEC
+		if (vec_used_p(l))
+			msr |= PSL_VEC;
+#endif
+
+		msr |= (pcb->pcb_flags & PSL_FE_PREC);
+		tf->tf_fixreg[OPC_MXMSR_REG(opcode)] = msr;
+		return 1;
+	}
+
+	if (OPC_MTMSR_P(opcode)) {
+		struct pcb * const pcb = lwp_getpcb(l);
+		register_t msr = tf->tf_fixreg[OPC_MXMSR_REG(opcode)];
+
+		/*
+		 * Ignore the FP enable bit in the requested MSR.
+		 * It might be set in the thread's actual MSR but the
+		 * user code isn't allowed to change it.
+		 */
+		msr &= ~PSL_FP;
+#ifdef ALTIVEC
+		msr &= ~PSL_VEC;
+#endif
+
+		/*
+		 * Don't let the user muck with bits he's not allowed to.
+		 */
+#ifdef PPC_HAVE_FPU
+		if (!PSL_USEROK_P(msr))
+#else
+		if (!PSL_USEROK_P(msr & ~PSL_FE_PREC))
+#endif
+			return 0;
+
+		/*
+		 * For now, only update the FP exception mode.
+		 */
+		pcb->pcb_flags &= ~PSL_FE_PREC;
+		pcb->pcb_flags |= msr & PSL_FE_PREC;
+
+#ifdef PPC_HAVE_FPU
+		/*
+		 * If we think we have the FPU, update SRR1 too.  If we're
+		 * wrong userret() will take care of it.
+		 */
+		if 

CVS commit: src/sys/arch/powerpc

2020-07-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 15 08:58:52 UTC 2020

Modified Files:
src/sys/arch/powerpc/include: cpu.h instr.h
src/sys/arch/powerpc/powerpc: powerpc_machdep.c trap.c

Log Message:
Factor out emulation code for m[ft]msr in user mode from oea, and
adjust it for systems without FPU.

Now, it can be used from booke and ibm4xx in order to support fenv(3).


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/sys/arch/powerpc/include/cpu.h
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/powerpc/include/instr.h
cvs rdiff -u -r1.79 -r1.80 src/sys/arch/powerpc/powerpc/powerpc_machdep.c
cvs rdiff -u -r1.162 -r1.163 src/sys/arch/powerpc/powerpc/trap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/ibm4xx

2020-07-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 15 08:48:40 UTC 2020

Modified Files:
src/sys/arch/powerpc/ibm4xx: trap.c

Log Message:
Treat trap instruction from userland correctly in EXC_PGM handler;
raise SIGTRAP with TRAP_BRKPT instead of SIGILL.


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/arch/powerpc/ibm4xx/trap.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/powerpc/ibm4xx/trap.c
diff -u src/sys/arch/powerpc/ibm4xx/trap.c:1.83 src/sys/arch/powerpc/ibm4xx/trap.c:1.84
--- src/sys/arch/powerpc/ibm4xx/trap.c:1.83	Mon Jul  6 10:41:43 2020
+++ src/sys/arch/powerpc/ibm4xx/trap.c	Wed Jul 15 08:48:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.83 2020/07/06 10:41:43 rin Exp $	*/
+/*	$NetBSD: trap.c,v 1.84 2020/07/15 08:48:40 rin Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -69,7 +69,7 @@
 #define	__UFETCHSTORE_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.83 2020/07/06 10:41:43 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.84 2020/07/15 08:48:40 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -309,27 +309,38 @@ vm_signal:
 		break;
 
 	case EXC_PGM|EXC_USER:
-		/*
-		 * Illegal insn:
-		 *
-		 * let's try to see if its FPU and can be emulated.
-		 */
 		curcpu()->ci_data.cpu_ntrap++;
-		pcb = lwp_getpcb(l);
 
-		if (__predict_false(!fpu_used_p(l))) {
-			memset(>pcb_fpu, 0, sizeof(pcb->pcb_fpu));
-			fpu_mark_used(l);
-		}
+		KSI_INIT_TRAP();
+		ksi.ksi_trap = EXC_PGM;
+		ksi.ksi_addr = (void *)tf->tf_srr0;
 
-		if (fpu_emulate(tf, >pcb_fpu, )) {
-			if (ksi.ksi_signo == 0)	/* was emulated */
+		if (tf->tf_esr & ESR_PTR) {
+sigtrap:
+			if (p->p_raslist != NULL &&
+			ras_lookup(p, (void *)tf->tf_srr0) != (void *) -1) {
+tf->tf_srr1 += 4;
 break;
+			}
+			ksi.ksi_code = TRAP_BRKPT;
+			ksi.ksi_signo = SIGTRAP;
 		} else {
-			ksi.ksi_signo = SIGILL;
-			ksi.ksi_code = ILL_ILLOPC;
-			ksi.ksi_trap = EXC_PGM;
-			ksi.ksi_addr = (void *)tf->tf_srr0;
+			pcb = lwp_getpcb(l);
+
+			if (__predict_false(!fpu_used_p(l))) {
+memset(>pcb_fpu, 0, sizeof(pcb->pcb_fpu));
+fpu_mark_used(l);
+			}
+
+			if (fpu_emulate(tf, >pcb_fpu, )) {
+if (ksi.ksi_signo == 0)	/* was emulated */
+	break;
+else if (ksi.ksi_signo == SIGTRAP)
+	goto sigtrap;	/* XXX H/W bug? */
+			} else {
+ksi.ksi_code = ILL_ILLOPC;
+ksi.ksi_signo = SIGILL;
+			}
 		}
 
 		trapsignal(l, );



CVS commit: src/sys/arch/powerpc/ibm4xx

2020-07-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 15 08:48:40 UTC 2020

Modified Files:
src/sys/arch/powerpc/ibm4xx: trap.c

Log Message:
Treat trap instruction from userland correctly in EXC_PGM handler;
raise SIGTRAP with TRAP_BRKPT instead of SIGILL.


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/arch/powerpc/ibm4xx/trap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/fpu

2020-07-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 15 08:29:07 UTC 2020

Modified Files:
src/sys/arch/powerpc/fpu: fpu_emu.c

Log Message:
FPSCR[FEX] is not a sticky bit; it is always cleared when read from
userland via mffs on real hardware.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/powerpc/fpu/fpu_emu.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/powerpc/fpu/fpu_emu.c
diff -u src/sys/arch/powerpc/fpu/fpu_emu.c:1.28 src/sys/arch/powerpc/fpu/fpu_emu.c:1.29
--- src/sys/arch/powerpc/fpu/fpu_emu.c:1.28	Wed Jul 15 08:10:41 2020
+++ src/sys/arch/powerpc/fpu/fpu_emu.c	Wed Jul 15 08:29:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_emu.c,v 1.28 2020/07/15 08:10:41 rin Exp $ */
+/*	$NetBSD: fpu_emu.c,v 1.29 2020/07/15 08:29:07 rin Exp $ */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.28 2020/07/15 08:10:41 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.29 2020/07/15 08:29:07 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -571,6 +571,8 @@ fpu_execute(struct trapframe *tf, struct
 			case	OPC63_MFFS:
 FPU_EMU_EVCNT_INCR(mffs);
 DPRINTF(FPE_INSN, ("fpu_execute: MFFS\n"));
+/* XXX FEX is not sticky */
+fs->fpscr &= ~FPSCR_FEX;
 memcpy(>fpreg[rt], >fpscr,
 	sizeof(fs->fpscr));
 break;



CVS commit: src/sys/arch/powerpc/fpu

2020-07-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 15 08:29:07 UTC 2020

Modified Files:
src/sys/arch/powerpc/fpu: fpu_emu.c

Log Message:
FPSCR[FEX] is not a sticky bit; it is always cleared when read from
userland via mffs on real hardware.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/powerpc/fpu/fpu_emu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/fpu

2020-07-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 15 08:10:41 UTC 2020

Modified Files:
src/sys/arch/powerpc/fpu: fpu_emu.c

Log Message:
PR port-powerpc/55425

Fix emulation for mtfsf; source register is frB here.

Now, userland processes successfully change rounding mode, by which
FPU-optimized code in OpenSSL works just fine as far as I can see.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/powerpc/fpu/fpu_emu.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/powerpc/fpu/fpu_emu.c
diff -u src/sys/arch/powerpc/fpu/fpu_emu.c:1.27 src/sys/arch/powerpc/fpu/fpu_emu.c:1.28
--- src/sys/arch/powerpc/fpu/fpu_emu.c:1.27	Wed Jul 15 07:54:25 2020
+++ src/sys/arch/powerpc/fpu/fpu_emu.c	Wed Jul 15 08:10:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_emu.c,v 1.27 2020/07/15 07:54:25 rin Exp $ */
+/*	$NetBSD: fpu_emu.c,v 1.28 2020/07/15 08:10:41 rin Exp $ */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.27 2020/07/15 07:54:25 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.28 2020/07/15 08:10:41 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -586,7 +586,7 @@ fpu_execute(struct trapframe *tf, struct
 		if (rt & (1fpreg[rb];
 fe->fe_cx = mask & a[1];
 fe->fe_fpscr = (fe->fe_fpscr&~mask) | 
 	(fe->fe_cx);



CVS commit: src/sys/arch/powerpc/fpu

2020-07-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 15 08:10:41 UTC 2020

Modified Files:
src/sys/arch/powerpc/fpu: fpu_emu.c

Log Message:
PR port-powerpc/55425

Fix emulation for mtfsf; source register is frB here.

Now, userland processes successfully change rounding mode, by which
FPU-optimized code in OpenSSL works just fine as far as I can see.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/powerpc/fpu/fpu_emu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/powerpc

2020-07-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 15 07:58:26 UTC 2020

Modified Files:
src/sys/arch/powerpc/powerpc: trap.c

Log Message:
Rename emulated_opcode() to emulate_privileged() for clarity.
No functional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.161 -r1.162 src/sys/arch/powerpc/powerpc/trap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/powerpc

2020-07-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 15 07:58:26 UTC 2020

Modified Files:
src/sys/arch/powerpc/powerpc: trap.c

Log Message:
Rename emulated_opcode() to emulate_privileged() for clarity.
No functional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.161 -r1.162 src/sys/arch/powerpc/powerpc/trap.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/powerpc/powerpc/trap.c
diff -u src/sys/arch/powerpc/powerpc/trap.c:1.161 src/sys/arch/powerpc/powerpc/trap.c:1.162
--- src/sys/arch/powerpc/powerpc/trap.c:1.161	Mon Jul  6 11:24:57 2020
+++ src/sys/arch/powerpc/powerpc/trap.c	Wed Jul 15 07:58:26 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.161 2020/07/06 11:24:57 rin Exp $	*/
+/*	$NetBSD: trap.c,v 1.162 2020/07/15 07:58:26 rin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -35,7 +35,7 @@
 #define	__UCAS_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.161 2020/07/06 11:24:57 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.162 2020/07/15 07:58:26 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altivec.h"
@@ -69,7 +69,7 @@ __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.1
 #include 
 #include 
 
-static int emulated_opcode(struct lwp *, struct trapframe *);
+static int emulate_privileged(struct lwp *, struct trapframe *);
 static int fix_unaligned(struct lwp *, struct trapframe *);
 static inline vaddr_t setusr(vaddr_t, size_t *);
 static inline void unsetusr(void);
@@ -435,7 +435,7 @@ vm_signal:
 ksi.ksi_signo = SIGFPE;
 ksi.ksi_code = fpu_get_fault_code();
 			} else if (tf->tf_srr1 & 0x4) {
-if (emulated_opcode(l, tf)) {
+if (emulate_privileged(l, tf)) {
 	tf->tf_srr0 += 4;
 	break;
 }
@@ -1076,8 +1076,8 @@ fix_unaligned(struct lwp *l, struct trap
 	return -1;
 }
 
-int
-emulated_opcode(struct lwp *l, struct trapframe *tf)
+static int
+emulate_privileged(struct lwp *l, struct trapframe *tf)
 {
 	uint32_t opcode;
 



CVS commit: src/sys/arch/powerpc/fpu

2020-07-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 15 07:54:25 UTC 2020

Modified Files:
src/sys/arch/powerpc/fpu: fpu_emu.c

Log Message:
For trap instruction, ksi_code should be TRAP_BRKPT not TRAP_TRACE.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/powerpc/fpu/fpu_emu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/fpu

2020-07-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 15 07:54:25 UTC 2020

Modified Files:
src/sys/arch/powerpc/fpu: fpu_emu.c

Log Message:
For trap instruction, ksi_code should be TRAP_BRKPT not TRAP_TRACE.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/powerpc/fpu/fpu_emu.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/powerpc/fpu/fpu_emu.c
diff -u src/sys/arch/powerpc/fpu/fpu_emu.c:1.26 src/sys/arch/powerpc/fpu/fpu_emu.c:1.27
--- src/sys/arch/powerpc/fpu/fpu_emu.c:1.26	Wed Jul 15 07:52:58 2020
+++ src/sys/arch/powerpc/fpu/fpu_emu.c	Wed Jul 15 07:54:25 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_emu.c,v 1.26 2020/07/15 07:52:58 rin Exp $ */
+/*	$NetBSD: fpu_emu.c,v 1.27 2020/07/15 07:54:25 rin Exp $ */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.26 2020/07/15 07:52:58 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.27 2020/07/15 07:54:25 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -224,7 +224,7 @@ fpu_emulate(struct trapframe *tf, struct
 		DPRINTF(FPE_EX, ("fpu_emulate: SIGTRAP\n"));
 		ksi->ksi_signo = SIGTRAP;
 		ksi->ksi_trap = EXC_PGM;
-		ksi->ksi_code = TRAP_TRACE;
+		ksi->ksi_code = TRAP_BRKPT;
 		return true;
 	}
 	switch (fpu_execute(tf, , )) {



CVS commit: src/sys/arch/powerpc/fpu

2020-07-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 15 07:52:58 UTC 2020

Modified Files:
src/sys/arch/powerpc/fpu: fpu_emu.c

Log Message:
Do not set ksi->ksi_addr twice. No functional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/powerpc/fpu/fpu_emu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/fpu

2020-07-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 15 07:52:58 UTC 2020

Modified Files:
src/sys/arch/powerpc/fpu: fpu_emu.c

Log Message:
Do not set ksi->ksi_addr twice. No functional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/powerpc/fpu/fpu_emu.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/powerpc/fpu/fpu_emu.c
diff -u src/sys/arch/powerpc/fpu/fpu_emu.c:1.25 src/sys/arch/powerpc/fpu/fpu_emu.c:1.26
--- src/sys/arch/powerpc/fpu/fpu_emu.c:1.25	Wed Jul 15 07:37:25 2020
+++ src/sys/arch/powerpc/fpu/fpu_emu.c	Wed Jul 15 07:52:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_emu.c,v 1.25 2020/07/15 07:37:25 rin Exp $ */
+/*	$NetBSD: fpu_emu.c,v 1.26 2020/07/15 07:52:58 rin Exp $ */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.25 2020/07/15 07:37:25 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.26 2020/07/15 07:52:58 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -211,7 +211,6 @@ fpu_emulate(struct trapframe *tf, struct
 		ksi->ksi_signo = SIGSEGV;
 		ksi->ksi_trap = EXC_ISI;
 		ksi->ksi_code = SEGV_MAPERR;
-		ksi->ksi_addr = (void *)tf->tf_srr0;
 		return true;
 	}
 
@@ -226,7 +225,6 @@ fpu_emulate(struct trapframe *tf, struct
 		ksi->ksi_signo = SIGTRAP;
 		ksi->ksi_trap = EXC_PGM;
 		ksi->ksi_code = TRAP_TRACE;
-		ksi->ksi_addr = (void *)tf->tf_srr0;
 		return true;
 	}
 	switch (fpu_execute(tf, , )) {



CVS commit: src/sys/arch/powerpc/fpu

2020-07-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 15 07:47:27 UTC 2020

Modified Files:
src/sys/arch/powerpc/fpu: fpu_div.c

Log Message:
Do not raise divide-by-zero exception when dividend is zero.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/powerpc/fpu/fpu_div.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/fpu

2020-07-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 15 07:47:27 UTC 2020

Modified Files:
src/sys/arch/powerpc/fpu: fpu_div.c

Log Message:
Do not raise divide-by-zero exception when dividend is zero.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/powerpc/fpu/fpu_div.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/powerpc/fpu/fpu_div.c
diff -u src/sys/arch/powerpc/fpu/fpu_div.c:1.5 src/sys/arch/powerpc/fpu/fpu_div.c:1.6
--- src/sys/arch/powerpc/fpu/fpu_div.c:1.5	Sat Jun 27 03:07:57 2020
+++ src/sys/arch/powerpc/fpu/fpu_div.c	Wed Jul 15 07:47:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_div.c,v 1.5 2020/06/27 03:07:57 rin Exp $ */
+/*	$NetBSD: fpu_div.c,v 1.6 2020/07/15 07:47:27 rin Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_div.c,v 1.5 2020/06/27 03:07:57 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_div.c,v 1.6 2020/07/15 07:47:27 rin Exp $");
 
 #include 
 #if defined(DIAGNOSTIC)||defined(DEBUG)
@@ -200,7 +200,6 @@ fpu_div(struct fpemu *fe)
 		return (x);
 	}
 	if (ISZERO(x)) {
-		fe->fe_cx |= FPSCR_ZX;
 		if (x->fp_class == y->fp_class) {
 			fe->fe_cx |= FPSCR_VXZDZ;
 			return (fpu_newnan(fe));



CVS commit: src/sys/arch/powerpc/booke

2020-07-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 15 07:44:34 UTC 2020

Modified Files:
src/sys/arch/powerpc/booke: trap.c

Log Message:
Do not use curlwp twice. No functional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/powerpc/booke/trap.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/powerpc/booke/trap.c
diff -u src/sys/arch/powerpc/booke/trap.c:1.32 src/sys/arch/powerpc/booke/trap.c:1.33
--- src/sys/arch/powerpc/booke/trap.c:1.32	Tue Jul  7 00:49:09 2020
+++ src/sys/arch/powerpc/booke/trap.c	Wed Jul 15 07:44:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.32 2020/07/07 00:49:09 rin Exp $	*/
+/*	$NetBSD: trap.c,v 1.33 2020/07/15 07:44:34 rin Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.32 2020/07/07 00:49:09 rin Exp $");
+__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.33 2020/07/15 07:44:34 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altivec.h"
@@ -477,10 +477,12 @@ pgm_exception(struct trapframe *tf, ksig
 	}
 
 	if (tf->tf_esr & ESR_PIL) {
-		struct pcb * const pcb = lwp_getpcb(curlwp);
-		if (__predict_false(!fpu_used_p(curlwp))) {
+		struct lwp * const l = curlwp;
+		struct pcb * const pcb = lwp_getpcb(l);
+
+		if (__predict_false(!fpu_used_p(l))) {
 			memset(>pcb_fpu, 0, sizeof(pcb->pcb_fpu));
-			fpu_mark_used(curlwp);
+			fpu_mark_used(l);
 		}
 		if (fpu_emulate(tf, >pcb_fpu, ksi)) {
 			if (ksi->ksi_signo == 0) {



CVS commit: src/sys/arch/powerpc/booke

2020-07-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 15 07:44:34 UTC 2020

Modified Files:
src/sys/arch/powerpc/booke: trap.c

Log Message:
Do not use curlwp twice. No functional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/powerpc/booke/trap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/fpu

2020-07-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 15 07:37:25 UTC 2020

Modified Files:
src/sys/arch/powerpc/fpu: fpu_emu.c

Log Message:
Remove old workaround foe cache problem on ibm4xx.
The problem seems gone already.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/powerpc/fpu/fpu_emu.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/powerpc/fpu/fpu_emu.c
diff -u src/sys/arch/powerpc/fpu/fpu_emu.c:1.24 src/sys/arch/powerpc/fpu/fpu_emu.c:1.25
--- src/sys/arch/powerpc/fpu/fpu_emu.c:1.24	Mon Jul  6 10:31:23 2020
+++ src/sys/arch/powerpc/fpu/fpu_emu.c	Wed Jul 15 07:37:25 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_emu.c,v 1.24 2020/07/06 10:31:23 rin Exp $ */
+/*	$NetBSD: fpu_emu.c,v 1.25 2020/07/15 07:37:25 rin Exp $ */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -76,11 +76,10 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.24 2020/07/06 10:31:23 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_emu.c,v 1.25 2020/07/15 07:37:25 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
-#include "opt_ppcarch.h"
 #endif
 
 #include 
@@ -260,17 +259,6 @@ fpu_emulate(struct trapframe *tf, struct
 			opc_disasm((vaddr_t)(tf->tf_srr0), insn.i_int);
 		}
 #endif
-#if defined(PPC_IBM4XX) && defined(DDB) && defined(DEBUG)
-		/*
-		*  retry an illegal insn once due to cache issues.
-		*/
-		static int lastill = 0;
-		if (lastill == tf->tf_srr0) {
-			if (fpe_debug & FPE_EX)
-Debugger();
-		}
-		lastill = tf->tf_srr0;
-#endif /* PPC_IBM4XX && DDB && DEBUG */
 		return false;
 	}
 }



CVS commit: src/sys/arch/powerpc/fpu

2020-07-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Jul 15 07:37:25 UTC 2020

Modified Files:
src/sys/arch/powerpc/fpu: fpu_emu.c

Log Message:
Remove old workaround foe cache problem on ibm4xx.
The problem seems gone already.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/powerpc/fpu/fpu_emu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/pic

2020-07-12 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul 13 00:04:04 UTC 2020

Modified Files:
src/sys/arch/powerpc/pic: pic_openpic.c

Log Message:
Drop unused opt_interrupt.h include.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/powerpc/pic/pic_openpic.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/powerpc/pic/pic_openpic.c
diff -u src/sys/arch/powerpc/pic/pic_openpic.c:1.18 src/sys/arch/powerpc/pic/pic_openpic.c:1.19
--- src/sys/arch/powerpc/pic/pic_openpic.c:1.18	Sun Jul 12 23:54:38 2020
+++ src/sys/arch/powerpc/pic/pic_openpic.c	Mon Jul 13 00:04:03 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pic_openpic.c,v 1.18 2020/07/12 23:54:38 rin Exp $ */
+/*	$NetBSD: pic_openpic.c,v 1.19 2020/07/13 00:04:03 rin Exp $ */
 
 /*-
  * Copyright (c) 2007 Michael Lorenz
@@ -27,10 +27,9 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pic_openpic.c,v 1.18 2020/07/12 23:54:38 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pic_openpic.c,v 1.19 2020/07/13 00:04:03 rin Exp $");
 
 #ifdef _KERNEL_OPT
-#include "opt_interrupt.h"
 #include "opt_multiprocessor.h"
 #endif
 



CVS commit: src/sys/arch/powerpc/pic

2020-07-12 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul 13 00:04:04 UTC 2020

Modified Files:
src/sys/arch/powerpc/pic: pic_openpic.c

Log Message:
Drop unused opt_interrupt.h include.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/powerpc/pic/pic_openpic.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/pic

2020-07-12 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Jul 12 23:54:39 UTC 2020

Modified Files:
src/sys/arch/powerpc/pic: pic_openpic.c

Log Message:
No need to test _KERNEL_OPT twice.
No binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/powerpc/pic/pic_openpic.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/powerpc/pic/pic_openpic.c
diff -u src/sys/arch/powerpc/pic/pic_openpic.c:1.17 src/sys/arch/powerpc/pic/pic_openpic.c:1.18
--- src/sys/arch/powerpc/pic/pic_openpic.c:1.17	Mon Jul  6 10:54:56 2020
+++ src/sys/arch/powerpc/pic/pic_openpic.c	Sun Jul 12 23:54:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pic_openpic.c,v 1.17 2020/07/06 10:54:56 rin Exp $ */
+/*	$NetBSD: pic_openpic.c,v 1.18 2020/07/12 23:54:38 rin Exp $ */
 
 /*-
  * Copyright (c) 2007 Michael Lorenz
@@ -27,13 +27,10 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pic_openpic.c,v 1.17 2020/07/06 10:54:56 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pic_openpic.c,v 1.18 2020/07/12 23:54:38 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_interrupt.h"
-#endif
-
-#ifdef _KERNEL_OPT
 #include "opt_multiprocessor.h"
 #endif
 



CVS commit: src/sys/arch/powerpc/pic

2020-07-12 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Jul 12 23:54:39 UTC 2020

Modified Files:
src/sys/arch/powerpc/pic: pic_openpic.c

Log Message:
No need to test _KERNEL_OPT twice.
No binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/powerpc/pic/pic_openpic.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/powerpc

2020-07-12 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Jul 12 21:18:01 UTC 2020

Modified Files:
src/sys/arch/powerpc/powerpc: trap_subr.S

Log Message:
No need to work around for IBM405 Errata 77; ibm4xx does not use this file.


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/arch/powerpc/powerpc/trap_subr.S

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/powerpc/powerpc/trap_subr.S
diff -u src/sys/arch/powerpc/powerpc/trap_subr.S:1.83 src/sys/arch/powerpc/powerpc/trap_subr.S:1.84
--- src/sys/arch/powerpc/powerpc/trap_subr.S:1.83	Mon Jul  6 11:09:15 2020
+++ src/sys/arch/powerpc/powerpc/trap_subr.S	Sun Jul 12 21:18:01 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap_subr.S,v 1.83 2020/07/06 11:09:15 rin Exp $	*/
+/*	$NetBSD: trap_subr.S,v 1.84 2020/07/12 21:18:01 rin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -321,7 +321,6 @@ dsitrap_fix_dbat7:
 	ldreg	%r30,(CI_DISISAVE+CPUSAVE_R30)(%r1)	/* restore r30 */
 	ldreg	%r31,(CI_DISISAVE+CPUSAVE_R31)(%r1)	/* restore r31 */
 	mfsprg1	%r1
-	IBM405_ERRATA77_SYNC
 	RFI/* return to trapped code */
 1:
 #endif	/* !PPC_MPC8XX */
@@ -394,7 +393,6 @@ _C_LABEL(dsi601trap):
 	ldreg	%r30,(CI_DISISAVE+CPUSAVE_R30)(%r1)	/* restore r30 */
 	ldreg	%r31,(CI_DISISAVE+CPUSAVE_R31)(%r1)	/* restore r31 */
 	mfsprg1	%r1
-	IBM405_ERRATA77_SYNC
 	RFI/* return to trapped code */
 1:
 	mflr	%r28			/* save LR */
@@ -511,7 +509,6 @@ _C_LABEL(tlbimiss):
 	srwi	%r1,%r1,8		/* get byte 7 of pte */
 	tlbli	%r0			/* load the itlb */
 	stb	%r1,6(%r2)		/* update page table */
-	IBM405_ERRATA77_SYNC
 	RFI
 
 3:	/* not found in pteg */
@@ -571,7 +568,6 @@ _C_LABEL(tlbdlmiss):
 	srwi	%r1,%r1,8		/* get byte 7 of pte */
 	tlbld	%r0			/* load the dtlb */
 	stb	%r1,6(%r2)		/* update page table */
-	IBM405_ERRATA77_SYNC
 	RFI
 
 3:	/* not found in pteg */
@@ -628,7 +624,6 @@ _C_LABEL(tlbdsmiss):
 	mtcrf	0x80,%r3		/* and restore */
 	mtspr	SPR_RPA,%r1		/* set the pte */
 	tlbld	%r0			/* load the dtlb */
-	IBM405_ERRATA77_SYNC
 	RFI
 
 3:	/* not found in pteg */
@@ -1002,7 +997,6 @@ trapleave:
 	FRAME_RESTORE_CALLEE
 intrleave:
 	FRAME_LEAVE(CI_TEMPSAVE)
-	IBM405_ERRATA77_SYNC
 	RFI
 
 /*
@@ -1226,7 +1220,6 @@ ddbtrap:
 	beq	trapagain
 	FRAME_RESTORE_CALLEE
 	FRAME_LEAVE(CI_DDBSAVE)
-	IBM405_ERRATA77_SYNC
 	RFI
 #endif /* DDB || KGDB */
 



CVS commit: src/sys/arch/powerpc/powerpc

2020-07-12 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Jul 12 21:18:01 UTC 2020

Modified Files:
src/sys/arch/powerpc/powerpc: trap_subr.S

Log Message:
No need to work around for IBM405 Errata 77; ibm4xx does not use this file.


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/arch/powerpc/powerpc/trap_subr.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/ibm4xx

2020-07-12 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Jul 12 21:16:23 UTC 2020

Modified Files:
src/sys/arch/powerpc/ibm4xx: 4xx_trap_subr.S

Log Message:
Fix comment.

ibm4xx does not use powerpc/powerpc/trap_subr.S, but
powerpc/ibm4xx/trap_subr.S.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/powerpc/ibm4xx/4xx_trap_subr.S

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/powerpc/ibm4xx/4xx_trap_subr.S
diff -u src/sys/arch/powerpc/ibm4xx/4xx_trap_subr.S:1.8 src/sys/arch/powerpc/ibm4xx/4xx_trap_subr.S:1.9
--- src/sys/arch/powerpc/ibm4xx/4xx_trap_subr.S:1.8	Sun Mar  1 23:23:36 2020
+++ src/sys/arch/powerpc/ibm4xx/4xx_trap_subr.S	Sun Jul 12 21:16:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: 4xx_trap_subr.S,v 1.8 2020/03/01 23:23:36 rin Exp $	*/
+/*	$NetBSD: 4xx_trap_subr.S,v 1.9 2020/07/12 21:16:23 rin Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 /* This file provides necessary handlers for 405GP CPU
- * It should be included in locore.S after powerpc/powerpc/trap_subr.S
+ * It should be included in locore.S after powerpc/ibm4xx/trap_subr.S
  */
 
 	.text



CVS commit: src/sys/arch/powerpc/ibm4xx

2020-07-12 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Jul 12 21:16:23 UTC 2020

Modified Files:
src/sys/arch/powerpc/ibm4xx: 4xx_trap_subr.S

Log Message:
Fix comment.

ibm4xx does not use powerpc/powerpc/trap_subr.S, but
powerpc/ibm4xx/trap_subr.S.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/powerpc/ibm4xx/4xx_trap_subr.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/oea

2020-07-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jul  7 13:57:20 UTC 2020

Modified Files:
src/sys/arch/powerpc/oea: ofw_rascons.c

Log Message:
rascons_init_rasops(): Initialize color palette only for macppc.
Fix build failure for ofppc.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/powerpc/oea/ofw_rascons.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/powerpc/oea/ofw_rascons.c
diff -u src/sys/arch/powerpc/oea/ofw_rascons.c:1.16 src/sys/arch/powerpc/oea/ofw_rascons.c:1.17
--- src/sys/arch/powerpc/oea/ofw_rascons.c:1.16	Tue Jul  7 02:33:54 2020
+++ src/sys/arch/powerpc/oea/ofw_rascons.c	Tue Jul  7 13:57:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw_rascons.c,v 1.16 2020/07/07 02:33:54 rin Exp $	*/
+/*	$NetBSD: ofw_rascons.c,v 1.17 2020/07/07 13:57:20 rin Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_rascons.c,v 1.16 2020/07/07 02:33:54 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_rascons.c,v 1.17 2020/07/07 13:57:20 rin Exp $");
 
 #include "wsdisplay.h"
 
@@ -286,6 +286,7 @@ rascons_init_rasops(int node, struct ras
 		width / ri->ri_font->fontwidth);
 	}
 
+#ifdef macppc
 	if (depth == 8 && ofw_quiesce) {
 		/*
 		 * Open Firmware will be quiesced. This is last chance to
@@ -297,6 +298,7 @@ rascons_init_rasops(int node, struct ras
 			rasops_cmap[3 * i + 2], i);
 		}
 	}
+#endif
 
 	return true;
 }



CVS commit: src/sys/arch/powerpc/oea

2020-07-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jul  7 13:57:20 UTC 2020

Modified Files:
src/sys/arch/powerpc/oea: ofw_rascons.c

Log Message:
rascons_init_rasops(): Initialize color palette only for macppc.
Fix build failure for ofppc.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/powerpc/oea/ofw_rascons.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/oea

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jul  7 02:10:21 UTC 2020

Modified Files:
src/sys/arch/powerpc/oea: ofw_rascons.c

Log Message:
Fix boot failure for PowerMac11,2 when ``auto-boot?'' is true.

For some machines like PowerMac11,2, Open Firmware does not correctly
initialize console-related variables, like font-adr and line#, when
``auto-boot?'' is true; -1 is returned instead of correct values.

Fall back to wsfont embedded in kernel in this case. Also, do not use
line# if it is negative.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/powerpc/oea/ofw_rascons.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/oea

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jul  7 02:10:21 UTC 2020

Modified Files:
src/sys/arch/powerpc/oea: ofw_rascons.c

Log Message:
Fix boot failure for PowerMac11,2 when ``auto-boot?'' is true.

For some machines like PowerMac11,2, Open Firmware does not correctly
initialize console-related variables, like font-adr and line#, when
``auto-boot?'' is true; -1 is returned instead of correct values.

Fall back to wsfont embedded in kernel in this case. Also, do not use
line# if it is negative.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/powerpc/oea/ofw_rascons.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/powerpc/oea/ofw_rascons.c
diff -u src/sys/arch/powerpc/oea/ofw_rascons.c:1.14 src/sys/arch/powerpc/oea/ofw_rascons.c:1.15
--- src/sys/arch/powerpc/oea/ofw_rascons.c:1.14	Mon Mar 16 22:02:37 2020
+++ src/sys/arch/powerpc/oea/ofw_rascons.c	Tue Jul  7 02:10:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw_rascons.c,v 1.14 2020/03/16 22:02:37 macallan Exp $	*/
+/*	$NetBSD: ofw_rascons.c,v 1.15 2020/07/07 02:10:20 rin Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_rascons.c,v 1.14 2020/03/16 22:02:37 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_rascons.c,v 1.15 2020/07/07 02:10:20 rin Exp $");
 
 #include "wsdisplay.h"
 
@@ -87,6 +87,8 @@ rascons_cnattach(void)
 
 	/* get current cursor position */
 	OF_interpret("line#", 0, 1, );
+	if (crow < 0)
+		crow = 0;
 
 	/* move (rom monitor) cursor to the lowest line - 1 */
 	/*  - Why? */
@@ -165,7 +167,11 @@ rascons_finalize(void)
 	if (needs_finalize == 0) return;
 
 	/* get current cursor position */
-	if (romfont_loaded) OF_interpret("line#", 0, 1, );
+	if (romfont_loaded) {
+		OF_interpret("line#", 0, 1, );
+		if (crow < 0)
+			crow = 0;
+	}
 
 	ri->ri_ops.allocattr(ri, 0, 0, 0, );
 	wsdisplay_preattach(_stdscreen, ri, 0, uimax(0,
@@ -179,9 +185,16 @@ copy_rom_font(void)
 	int char_width, char_height, stride;
 	int chosen, mmu, m, e, size;
 
-	/* Get ROM FONT address. */
+	/*
+	 * Get ROM FONT address.
+	 *
+	 * For some machines like ``PowerMac11,2'', Open Firmware does not
+	 * initialize console-related variables when auto-boot? is true;
+	 * -1 is returned instead of correct value. Fall back to wsfont
+	 * embedded in kernel in this case.
+	 */
 	OF_interpret("font-adr", 0, 1, );
-	if (romfont == NULL)
+	if (romfont == NULL || romfont == (u_char *)-1)
 		return -1;
 
 	chosen = OF_finddevice("/chosen");



CVS commit: src/sys/arch/powerpc

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jul  7 01:39:23 UTC 2020

Modified Files:
src/sys/arch/powerpc/include: cpu.h
src/sys/arch/powerpc/powerpc: powerpc_machdep.c

Log Message:
Part of PR port-powerpc/55425
openssl fails on FPU emulation for powerpc

Provide machdep.fpu_present sysctl variable like other ports.

Userland can get informed that FPU is absent and emulated in software
(and calculation results may not be correct in bit-to-bit precision).

This variable should be useful even if we could fix FPU emulation;
it is much faster to skip FPU arithmetic in general, rather than
relying upon emulation by kernel via illegal instruction handler.


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/arch/powerpc/include/cpu.h
cvs rdiff -u -r1.78 -r1.79 src/sys/arch/powerpc/powerpc/powerpc_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jul  7 01:39:23 UTC 2020

Modified Files:
src/sys/arch/powerpc/include: cpu.h
src/sys/arch/powerpc/powerpc: powerpc_machdep.c

Log Message:
Part of PR port-powerpc/55425
openssl fails on FPU emulation for powerpc

Provide machdep.fpu_present sysctl variable like other ports.

Userland can get informed that FPU is absent and emulated in software
(and calculation results may not be correct in bit-to-bit precision).

This variable should be useful even if we could fix FPU emulation;
it is much faster to skip FPU arithmetic in general, rather than
relying upon emulation by kernel via illegal instruction handler.


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/arch/powerpc/include/cpu.h
cvs rdiff -u -r1.78 -r1.79 src/sys/arch/powerpc/powerpc/powerpc_machdep.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/powerpc/include/cpu.h
diff -u src/sys/arch/powerpc/include/cpu.h:1.113 src/sys/arch/powerpc/include/cpu.h:1.114
--- src/sys/arch/powerpc/include/cpu.h:1.113	Mon Jul  6 13:20:55 2020
+++ src/sys/arch/powerpc/include/cpu.h	Tue Jul  7 01:39:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.113 2020/07/06 13:20:55 rin Exp $	*/
+/*	$NetBSD: cpu.h,v 1.114 2020/07/07 01:39:23 rin Exp $	*/
 
 /*
  * Copyright (C) 1999 Wolfgang Solfrank.
@@ -489,5 +489,6 @@ void	__syncicache(void *, size_t);
 #define	CPU_BOOTED_DEVICE	9	/* string: device we booted from */
 #define	CPU_BOOTED_KERNEL	10	/* string: kernel we booted */
 #define	CPU_EXECPROT		11	/* bool: PROT_EXEC works */
+#define	CPU_FPU			12
 
 #endif	/* _POWERPC_CPU_H_ */

Index: src/sys/arch/powerpc/powerpc/powerpc_machdep.c
diff -u src/sys/arch/powerpc/powerpc/powerpc_machdep.c:1.78 src/sys/arch/powerpc/powerpc/powerpc_machdep.c:1.79
--- src/sys/arch/powerpc/powerpc/powerpc_machdep.c:1.78	Mon Jul  6 09:34:18 2020
+++ src/sys/arch/powerpc/powerpc/powerpc_machdep.c	Tue Jul  7 01:39:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: powerpc_machdep.c,v 1.78 2020/07/06 09:34:18 rin Exp $	*/
+/*	$NetBSD: powerpc_machdep.c,v 1.79 2020/07/07 01:39:23 rin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: powerpc_machdep.c,v 1.78 2020/07/06 09:34:18 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: powerpc_machdep.c,v 1.79 2020/07/07 01:39:23 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altivec.h"
@@ -285,6 +285,17 @@ SYSCTL_SETUP(sysctl_machdep_setup, "sysc
 		   CTLTYPE_STRING, "booted_kernel", NULL,
 		   sysctl_machdep_booted_kernel, 0, NULL, 0,
 		   CTL_MACHDEP, CPU_BOOTED_KERNEL, CTL_EOL);
+	sysctl_createv(clog, 0, NULL, NULL,
+		   CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
+		   CTLTYPE_INT, "fpu_present", NULL,
+		   NULL,
+#if defined(PPC_HAVE_FPU)
+		   1,
+#else
+		   0,
+#endif
+		   NULL, 0,
+		   CTL_MACHDEP, CPU_FPU, CTL_EOL);
 }
 
 /*



CVS commit: src/sys/arch/powerpc/booke

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jul  7 00:59:30 UTC 2020

Modified Files:
src/sys/arch/powerpc/booke: e500_tlb.c

Log Message:
Revert previous; tmpfs should be fixed instead.

Pointed out by thorpej@, thanks!


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/powerpc/booke/e500_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/powerpc/booke/e500_tlb.c
diff -u src/sys/arch/powerpc/booke/e500_tlb.c:1.22 src/sys/arch/powerpc/booke/e500_tlb.c:1.23
--- src/sys/arch/powerpc/booke/e500_tlb.c:1.22	Tue Jul  7 00:28:30 2020
+++ src/sys/arch/powerpc/booke/e500_tlb.c	Tue Jul  7 00:59:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: e500_tlb.c,v 1.22 2020/07/07 00:28:30 rin Exp $	*/
+/*	$NetBSD: e500_tlb.c,v 1.23 2020/07/07 00:59:29 rin Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -37,7 +37,7 @@
 #define	__PMAP_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: e500_tlb.c,v 1.22 2020/07/07 00:28:30 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: e500_tlb.c,v 1.23 2020/07/07 00:59:29 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_multiprocessor.h"
@@ -536,13 +536,6 @@ e500_tlb_invalidate_addr(vaddr_t va, tlb
 static bool
 e500_tlb_update_addr(vaddr_t va, tlb_asid_t asid, pt_entry_t pte, bool insert)
 {
-
-	/*
-	 * In case where pmap_kenter_pa(9) is called for va with page offset.
-	 * Required for tmpfs.
-	 */
-	va &= ~PAGE_MASK;
-
 #if defined(MULTIPROCESSOR)
 	e500_tlb_invalidate_addr(va, asid);
 	return true;



CVS commit: src/sys/arch/powerpc/booke

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jul  7 00:59:30 UTC 2020

Modified Files:
src/sys/arch/powerpc/booke: e500_tlb.c

Log Message:
Revert previous; tmpfs should be fixed instead.

Pointed out by thorpej@, thanks!


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/powerpc/booke/e500_tlb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: CVS commit: src/sys/arch/powerpc/booke

2020-07-06 Thread Rin Okuyama

On 2020/07/07 9:51, Jason Thorpe wrote:

On Jul 6, 2020, at 5:28 PM, Rin Okuyama  wrote:

Module Name:src
Committed By:   rin
Date:   Tue Jul  7 00:28:31 UTC 2020

Modified Files:
src/sys/arch/powerpc/booke: e500_tlb.c

Log Message:
Fix kernel panic due to tmpfs.

pmap for booke assumes that the ``va'' argument for pmap_kenter_pa(9) is
page-aligned. However, by recent changes, tmpfs became to use ``va'' with
page offset via ubc_uiomove(9). So, truncate it to page boundary.


This change seems wrong.  I think it needs to be fixed in tmpfs.


Thank you for your comment. OK, I will revert this and send PR.

rin


Re: CVS commit: src/sys/arch/powerpc/booke

2020-07-06 Thread Jason Thorpe



> On Jul 6, 2020, at 5:28 PM, Rin Okuyama  wrote:
> 
> Module Name:  src
> Committed By: rin
> Date: Tue Jul  7 00:28:31 UTC 2020
> 
> Modified Files:
>   src/sys/arch/powerpc/booke: e500_tlb.c
> 
> Log Message:
> Fix kernel panic due to tmpfs.
> 
> pmap for booke assumes that the ``va'' argument for pmap_kenter_pa(9) is
> page-aligned. However, by recent changes, tmpfs became to use ``va'' with
> page offset via ubc_uiomove(9). So, truncate it to page boundary.

This change seems wrong.  I think it needs to be fixed in tmpfs.

-- thorpej



CVS commit: src/sys/arch/powerpc/booke

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jul  7 00:49:09 UTC 2020

Modified Files:
src/sys/arch/powerpc/booke: trap.c

Log Message:
For booke, fix signo and other siginfo returned for userland by
syncing with oea and ibm4xx.

Now, tests/kernel/t_trapsignal:bus_handle and friends pass on booke.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/powerpc/booke/trap.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/powerpc/booke/trap.c
diff -u src/sys/arch/powerpc/booke/trap.c:1.31 src/sys/arch/powerpc/booke/trap.c:1.32
--- src/sys/arch/powerpc/booke/trap.c:1.31	Tue Jul  7 00:41:32 2020
+++ src/sys/arch/powerpc/booke/trap.c	Tue Jul  7 00:49:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.31 2020/07/07 00:41:32 rin Exp $	*/
+/*	$NetBSD: trap.c,v 1.32 2020/07/07 00:49:09 rin Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.31 2020/07/07 00:41:32 rin Exp $");
+__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.32 2020/07/07 00:49:09 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altivec.h"
@@ -112,15 +112,13 @@ mchk_exception(struct trapframe *tf, ksi
 	struct cpu_info * const ci = curcpu();
 	int rv = EFAULT;
 
-	if (usertrap)
+	if (usertrap) {
 		ci->ci_ev_umchk.ev_count++;
-
-	if (rv != 0 && usertrap) {
 		KSI_INIT_TRAP(ksi);
-		ksi->ksi_signo = SIGSEGV;
-		ksi->ksi_trap = EXC_DSI;
-		ksi->ksi_code = SEGV_ACCERR;
+		ksi->ksi_signo = SIGBUS;
+		ksi->ksi_trap = EXC_MCHK;
 		ksi->ksi_addr = (void *)faultva;
+		ksi->ksi_code = BUS_OBJERR;
 	}
 
 	return rv;
@@ -169,8 +167,6 @@ pagefault(struct vm_map *map, vaddr_t va
 		rv = uvm_fault(map, trunc_page(va), ftype);
 		if (rv == 0)
 			uvm_grow(l->l_proc, trunc_page(va));
-		if (rv == EACCES)
-			rv = EFAULT;
 	} else {
 		if (cpu_intr_p())
 			return EFAULT;
@@ -184,12 +180,33 @@ pagefault(struct vm_map *map, vaddr_t va
 			if (rv == 0)
 uvm_grow(l->l_proc, trunc_page(va));
 		}
-		if (rv == EACCES)
-			rv = EFAULT;
 	}
 	return rv;
 }
 
+static void
+vm_signal(int error, int trap, vaddr_t addr, ksiginfo_t *ksi)
+{
+
+	KSI_INIT_TRAP(ksi);
+	switch (error) {
+	case EINVAL:
+		ksi->ksi_signo = SIGBUS;
+		ksi->ksi_code = BUS_ADRERR;
+		break;
+	case EACCES:
+		ksi->ksi_signo = SIGSEGV;
+		ksi->ksi_code = SEGV_ACCERR;
+		break;
+	default:
+		ksi->ksi_signo = SIGSEGV;
+		ksi->ksi_code = SEGV_MAPERR;
+		break;
+	}
+	ksi->ksi_trap = trap;
+	ksi->ksi_addr = (void *)addr;
+}
+
 static int
 dsi_exception(struct trapframe *tf, ksiginfo_t *ksi)
 {
@@ -236,16 +253,9 @@ dsi_exception(struct trapframe *tf, ksig
 
 	int rv = pagefault(faultmap, faultva, ftype, usertrap);
 
-	/*
-	 * We can't get a MAPERR here since that's a different exception.
-	 */
 	if (__predict_false(rv != 0 && usertrap)) {
 		ci->ci_ev_udsi_fatal.ev_count++;
-		KSI_INIT_TRAP(ksi);
-		ksi->ksi_signo = SIGSEGV;
-		ksi->ksi_trap = EXC_DSI;
-		ksi->ksi_code = SEGV_ACCERR;
-		ksi->ksi_addr = (void *)faultva;
+		vm_signal(rv, EXC_DSI, faultva, ksi);
 	}
 	return rv;
 }
@@ -313,16 +323,8 @@ isi_exception(struct trapframe *tf, ksig
 	usertrap);
 
 	if (__predict_false(rv != 0 && usertrap)) {
-		/*
-		 * We can't get a MAPERR here since
-		 * that's a different exception.
-		 */
 		ci->ci_ev_isi_fatal.ev_count++;
-		KSI_INIT_TRAP(ksi);
-		ksi->ksi_signo = SIGSEGV;
-		ksi->ksi_trap = EXC_ISI;
-		ksi->ksi_code = SEGV_ACCERR;
-		ksi->ksi_addr = (void *)tf->tf_srr0; /* not truncated */
+		vm_signal(rv, EXC_ISI, tf->tf_srr0, ksi);
 	}
 	UVMHIST_LOG(pmapexechist, "<- %d", rv, 0,0,0);
 	return rv;
@@ -358,11 +360,7 @@ dtlb_exception(struct trapframe *tf, ksi
 
 	if (__predict_false(rv != 0 && usertrap)) {
 		ci->ci_ev_udsi_fatal.ev_count++;
-		KSI_INIT_TRAP(ksi);
-		ksi->ksi_signo = SIGSEGV;
-		ksi->ksi_trap = EXC_DSI;
-		ksi->ksi_code = (rv == EACCES ? SEGV_ACCERR : SEGV_MAPERR);
-		ksi->ksi_addr = (void *)faultva;
+		vm_signal(rv, EXC_DSI, faultva, ksi);
 	}
 	return rv;
 }
@@ -382,11 +380,7 @@ itlb_exception(struct trapframe *tf, ksi
 
 	if (__predict_false(rv != 0 && usertrap)) {
 		ci->ci_ev_isi_fatal.ev_count++;
-		KSI_INIT_TRAP(ksi);
-		ksi->ksi_signo = SIGSEGV;
-		ksi->ksi_trap = EXC_ISI;
-		ksi->ksi_code = (rv == EACCES ? SEGV_ACCERR : SEGV_MAPERR);
-		ksi->ksi_addr = (void *)tf->tf_srr0;
+		vm_signal(rv, EXC_ISI, tf->tf_srr0, ksi);
 	}
 	return rv;
 }
@@ -880,6 +874,7 @@ trap(enum ppc_booke_exceptions trap_code
 			p->p_pid, l->l_lid, p->p_comm,
 			l->l_cred ?  kauth_cred_geteuid(l->l_cred) : -1);
 			ksi.ksi_signo = SIGKILL;
+			ksi.ksi_code = 0;
 		}
 		if (rv != 0) {
 			/*



CVS commit: src/sys/arch/powerpc/booke

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jul  7 00:49:09 UTC 2020

Modified Files:
src/sys/arch/powerpc/booke: trap.c

Log Message:
For booke, fix signo and other siginfo returned for userland by
syncing with oea and ibm4xx.

Now, tests/kernel/t_trapsignal:bus_handle and friends pass on booke.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/powerpc/booke/trap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/booke

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jul  7 00:41:32 UTC 2020

Modified Files:
src/sys/arch/powerpc/booke: trap.c

Log Message:
Do not clear pcb_onfault for error path of setfault().
This is caller's responsibility, and all the callers actually do so.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/powerpc/booke/trap.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/powerpc/booke/trap.c
diff -u src/sys/arch/powerpc/booke/trap.c:1.30 src/sys/arch/powerpc/booke/trap.c:1.31
--- src/sys/arch/powerpc/booke/trap.c:1.30	Tue Jul  7 00:37:46 2020
+++ src/sys/arch/powerpc/booke/trap.c	Tue Jul  7 00:41:32 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.30 2020/07/07 00:37:46 rin Exp $	*/
+/*	$NetBSD: trap.c,v 1.31 2020/07/07 00:41:32 rin Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.30 2020/07/07 00:37:46 rin Exp $");
+__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.31 2020/07/07 00:41:32 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altivec.h"
@@ -691,7 +691,6 @@ onfaulted(struct trapframe *tf, register
 	tf->tf_fixreg[2] = fb->fb_r2;
 	tf->tf_fixreg[3] = rv;
 	memcpy(>tf_fixreg[13], fb->fb_fixreg, sizeof(fb->fb_fixreg));
-	pcb->pcb_onfault = NULL;
 	return true;
 }
 



CVS commit: src/sys/arch/powerpc/booke

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jul  7 00:41:32 UTC 2020

Modified Files:
src/sys/arch/powerpc/booke: trap.c

Log Message:
Do not clear pcb_onfault for error path of setfault().
This is caller's responsibility, and all the callers actually do so.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/powerpc/booke/trap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/booke

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jul  7 00:37:46 UTC 2020

Modified Files:
src/sys/arch/powerpc/booke: trap.c

Log Message:
For booke, restore callee saved registers when recovery for page fault
fails for kernel.

OOPS! How on the earth we had overlooked this error so far...


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/powerpc/booke/trap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/booke

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jul  7 00:37:46 UTC 2020

Modified Files:
src/sys/arch/powerpc/booke: trap.c

Log Message:
For booke, restore callee saved registers when recovery for page fault
fails for kernel.

OOPS! How on the earth we had overlooked this error so far...


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/powerpc/booke/trap.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/powerpc/booke/trap.c
diff -u src/sys/arch/powerpc/booke/trap.c:1.29 src/sys/arch/powerpc/booke/trap.c:1.30
--- src/sys/arch/powerpc/booke/trap.c:1.29	Mon Jul  6 10:13:02 2020
+++ src/sys/arch/powerpc/booke/trap.c	Tue Jul  7 00:37:46 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.29 2020/07/06 10:13:02 rin Exp $	*/
+/*	$NetBSD: trap.c,v 1.30 2020/07/07 00:37:46 rin Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.29 2020/07/06 10:13:02 rin Exp $");
+__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.30 2020/07/07 00:37:46 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altivec.h"
@@ -690,6 +690,7 @@ onfaulted(struct trapframe *tf, register
 	tf->tf_fixreg[1] = fb->fb_sp;
 	tf->tf_fixreg[2] = fb->fb_r2;
 	tf->tf_fixreg[3] = rv;
+	memcpy(>tf_fixreg[13], fb->fb_fixreg, sizeof(fb->fb_fixreg));
 	pcb->pcb_onfault = NULL;
 	return true;
 }



CVS commit: src/sys/arch/powerpc/booke

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jul  7 00:28:31 UTC 2020

Modified Files:
src/sys/arch/powerpc/booke: e500_tlb.c

Log Message:
Fix kernel panic due to tmpfs.

pmap for booke assumes that the ``va'' argument for pmap_kenter_pa(9) is
page-aligned. However, by recent changes, tmpfs became to use ``va'' with
page offset via ubc_uiomove(9). So, truncate it to page boundary.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/powerpc/booke/e500_tlb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/booke

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Jul  7 00:28:31 UTC 2020

Modified Files:
src/sys/arch/powerpc/booke: e500_tlb.c

Log Message:
Fix kernel panic due to tmpfs.

pmap for booke assumes that the ``va'' argument for pmap_kenter_pa(9) is
page-aligned. However, by recent changes, tmpfs became to use ``va'' with
page offset via ubc_uiomove(9). So, truncate it to page boundary.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/powerpc/booke/e500_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/powerpc/booke/e500_tlb.c
diff -u src/sys/arch/powerpc/booke/e500_tlb.c:1.21 src/sys/arch/powerpc/booke/e500_tlb.c:1.22
--- src/sys/arch/powerpc/booke/e500_tlb.c:1.21	Mon Jul  6 10:12:04 2020
+++ src/sys/arch/powerpc/booke/e500_tlb.c	Tue Jul  7 00:28:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: e500_tlb.c,v 1.21 2020/07/06 10:12:04 rin Exp $	*/
+/*	$NetBSD: e500_tlb.c,v 1.22 2020/07/07 00:28:30 rin Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -37,7 +37,7 @@
 #define	__PMAP_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: e500_tlb.c,v 1.21 2020/07/06 10:12:04 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: e500_tlb.c,v 1.22 2020/07/07 00:28:30 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_multiprocessor.h"
@@ -536,6 +536,13 @@ e500_tlb_invalidate_addr(vaddr_t va, tlb
 static bool
 e500_tlb_update_addr(vaddr_t va, tlb_asid_t asid, pt_entry_t pte, bool insert)
 {
+
+	/*
+	 * In case where pmap_kenter_pa(9) is called for va with page offset.
+	 * Required for tmpfs.
+	 */
+	va &= ~PAGE_MASK;
+
 #if defined(MULTIPROCESSOR)
 	e500_tlb_invalidate_addr(va, asid);
 	return true;



CVS commit: src/sys/arch/powerpc/include

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul  6 13:20:55 UTC 2020

Modified Files:
src/sys/arch/powerpc/include: cpu.h

Log Message:
Use (CI_SAVEMAX*CPUSAVE_LEN) as CPUSAVE_SIZE for MODULAR || _MODULE,
since it exceeds 128 (256 for now).

XXX
We should use CTASSERT here, but it conflicts with genassym...


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/sys/arch/powerpc/include/cpu.h

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/powerpc/include/cpu.h
diff -u src/sys/arch/powerpc/include/cpu.h:1.112 src/sys/arch/powerpc/include/cpu.h:1.113
--- src/sys/arch/powerpc/include/cpu.h:1.112	Mon Jul  6 10:50:32 2020
+++ src/sys/arch/powerpc/include/cpu.h	Mon Jul  6 13:20:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.112 2020/07/06 10:50:32 rin Exp $	*/
+/*	$NetBSD: cpu.h,v 1.113 2020/07/06 13:20:55 rin Exp $	*/
 
 /*
  * Copyright (C) 1999 Wolfgang Solfrank.
@@ -98,10 +98,11 @@ struct cpu_info {
 #define	CI_SAVEMMU	(3*CPUSAVE_LEN)
 #define	CI_SAVEMAX	(4*CPUSAVE_LEN)
 #define	CPUSAVE_LEN	8
-#if !defined(PPC_BOOKE) && !defined(MODULAR) && !defined(_MODULE)
-#define	CPUSAVE_SIZE	(CI_SAVEMAX*CPUSAVE_LEN)
-#else
+#if defined(PPC_BOOKE) && !defined(MODULAR) && !defined(_MODULE)
 #define	CPUSAVE_SIZE	128
+#else
+#define	CPUSAVE_SIZE	(CI_SAVEMAX*CPUSAVE_LEN)
+// XXX CTASSERT(CPUSAVE_SIZE >= 128);
 #endif
 #define	CPUSAVE_R28	0		/* where r28 gets saved */
 #define	CPUSAVE_R29	1		/* where r29 gets saved */



CVS commit: src/sys/arch/powerpc/include

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul  6 13:20:55 UTC 2020

Modified Files:
src/sys/arch/powerpc/include: cpu.h

Log Message:
Use (CI_SAVEMAX*CPUSAVE_LEN) as CPUSAVE_SIZE for MODULAR || _MODULE,
since it exceeds 128 (256 for now).

XXX
We should use CTASSERT here, but it conflicts with genassym...


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/sys/arch/powerpc/include/cpu.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/ibm4xx

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul  6 13:10:19 UTC 2020

Modified Files:
src/sys/arch/powerpc/ibm4xx: ibm4xx_machdep.c

Log Message:
Set cpu_psluserset, cpu_pslusermod, cpu_pslusermask for MODULAR.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/powerpc/ibm4xx/ibm4xx_machdep.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/powerpc/ibm4xx/ibm4xx_machdep.c
diff -u src/sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c:1.31 src/sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c:1.32
--- src/sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c:1.31	Mon Jul  6 10:34:23 2020
+++ src/sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c	Mon Jul  6 13:10:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ibm4xx_machdep.c,v 1.31 2020/07/06 10:34:23 rin Exp $	*/
+/*	$NetBSD: ibm4xx_machdep.c,v 1.32 2020/07/06 13:10:19 rin Exp $	*/
 /*	Original: ibm40x_machdep.c,v 1.3 2005/01/17 17:19:36 shige Exp $ */
 
 /*
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ibm4xx_machdep.c,v 1.31 2020/07/06 10:34:23 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ibm4xx_machdep.c,v 1.32 2020/07/06 13:10:19 rin Exp $");
 
 #include "ksyms.h"
 
@@ -115,6 +115,12 @@ char msgbuf[MSGBUFSIZE];
 void *startsym, *endsym;
 #endif
 
+#ifdef MODULAR
+register_t cpu_psluserset = PSL_USERSET;
+register_t cpu_pslusermod = PSL_USERMOD;
+register_t cpu_pslusermask = PSL_USERMASK;
+#endif
+
 /*
  * Trap vectors
  */



CVS commit: src/sys/arch/powerpc/ibm4xx

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul  6 13:10:19 UTC 2020

Modified Files:
src/sys/arch/powerpc/ibm4xx: ibm4xx_machdep.c

Log Message:
Set cpu_psluserset, cpu_pslusermod, cpu_pslusermask for MODULAR.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/powerpc

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul  6 11:24:57 UTC 2020

Modified Files:
src/sys/arch/powerpc/powerpc: trap.c

Log Message:
Stop using DDBX which is defined nowhere.


To generate a diff of this commit:
cvs rdiff -u -r1.160 -r1.161 src/sys/arch/powerpc/powerpc/trap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/powerpc

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul  6 11:24:57 UTC 2020

Modified Files:
src/sys/arch/powerpc/powerpc: trap.c

Log Message:
Stop using DDBX which is defined nowhere.


To generate a diff of this commit:
cvs rdiff -u -r1.160 -r1.161 src/sys/arch/powerpc/powerpc/trap.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/powerpc/powerpc/trap.c
diff -u src/sys/arch/powerpc/powerpc/trap.c:1.160 src/sys/arch/powerpc/powerpc/trap.c:1.161
--- src/sys/arch/powerpc/powerpc/trap.c:1.160	Mon Jul  6 11:23:59 2020
+++ src/sys/arch/powerpc/powerpc/trap.c	Mon Jul  6 11:24:57 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.160 2020/07/06 11:23:59 rin Exp $	*/
+/*	$NetBSD: trap.c,v 1.161 2020/07/06 11:24:57 rin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -35,7 +35,7 @@
 #define	__UCAS_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.160 2020/07/06 11:23:59 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.161 2020/07/06 11:24:57 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altivec.h"
@@ -486,7 +486,7 @@ vm_signal:
 	default:
 		printf("trap type %x at %lx\n", type, tf->tf_srr0);
 brain_damage2:
-#ifdef DDBX
+#if defined(DDB) && 0 /* XXX */
 		if (kdb_trap(type, tf))
 			return;
 #endif



CVS commit: src/sys/arch/powerpc/powerpc

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul  6 11:23:59 UTC 2020

Modified Files:
src/sys/arch/powerpc/powerpc: trap.c

Log Message:
This file is not used for ibm4xx.


To generate a diff of this commit:
cvs rdiff -u -r1.159 -r1.160 src/sys/arch/powerpc/powerpc/trap.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/powerpc/powerpc/trap.c
diff -u src/sys/arch/powerpc/powerpc/trap.c:1.159 src/sys/arch/powerpc/powerpc/trap.c:1.160
--- src/sys/arch/powerpc/powerpc/trap.c:1.159	Mon Jul  6 11:08:21 2020
+++ src/sys/arch/powerpc/powerpc/trap.c	Mon Jul  6 11:23:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.159 2020/07/06 11:08:21 rin Exp $	*/
+/*	$NetBSD: trap.c,v 1.160 2020/07/06 11:23:59 rin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -35,7 +35,7 @@
 #define	__UCAS_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.159 2020/07/06 11:08:21 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.160 2020/07/06 11:23:59 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altivec.h"
@@ -160,7 +160,7 @@ trap(struct trapframe *tf)
 	trunc_page(va), false)) {
 	return;
 }
-#if defined(DIAGNOSTIC) && !defined(PPC_OEA64) && !defined (PPC_IBM4XX)
+#if defined(DIAGNOSTIC) && !defined(PPC_OEA64)
 			} else if ((va >> ADDR_SR_SHFT) == USER_SR) {
 printf("trap: kernel %s DSI trap @ %#lx by %#lx"
 " (DSISR %#x): USER_SR unset\n",



CVS commit: src/sys/arch/powerpc/powerpc

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul  6 11:23:59 UTC 2020

Modified Files:
src/sys/arch/powerpc/powerpc: trap.c

Log Message:
This file is not used for ibm4xx.


To generate a diff of this commit:
cvs rdiff -u -r1.159 -r1.160 src/sys/arch/powerpc/powerpc/trap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/powerpc

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul  6 11:09:15 UTC 2020

Modified Files:
src/sys/arch/powerpc/powerpc: trap_subr.S

Log Message:
Include required opt_*.h for sure.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/arch/powerpc/powerpc/trap_subr.S

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/powerpc/powerpc/trap_subr.S
diff -u src/sys/arch/powerpc/powerpc/trap_subr.S:1.82 src/sys/arch/powerpc/powerpc/trap_subr.S:1.83
--- src/sys/arch/powerpc/powerpc/trap_subr.S:1.82	Mon Jul  6 09:34:18 2020
+++ src/sys/arch/powerpc/powerpc/trap_subr.S	Mon Jul  6 11:09:15 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap_subr.S,v 1.82 2020/07/06 09:34:18 rin Exp $	*/
+/*	$NetBSD: trap_subr.S,v 1.83 2020/07/06 11:09:15 rin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -40,6 +40,9 @@
 
 #ifdef _KERNEL_OPT
 #include "opt_altivec.h"
+#include "opt_ddb.h"
+#include "opt_kgdb.h"
+#include "opt_ppcarch.h"
 #endif
 
 /* LINTSTUB: include  */



CVS commit: src/sys/arch/powerpc/powerpc

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul  6 11:09:15 UTC 2020

Modified Files:
src/sys/arch/powerpc/powerpc: trap_subr.S

Log Message:
Include required opt_*.h for sure.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/arch/powerpc/powerpc/trap_subr.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/powerpc

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul  6 11:08:22 UTC 2020

Modified Files:
src/sys/arch/powerpc/powerpc: trap.c

Log Message:
- Drop unused opt_multiprocessor.h.
- Include missing opt_ppcarch.h.


To generate a diff of this commit:
cvs rdiff -u -r1.158 -r1.159 src/sys/arch/powerpc/powerpc/trap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/powerpc

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul  6 11:08:22 UTC 2020

Modified Files:
src/sys/arch/powerpc/powerpc: trap.c

Log Message:
- Drop unused opt_multiprocessor.h.
- Include missing opt_ppcarch.h.


To generate a diff of this commit:
cvs rdiff -u -r1.158 -r1.159 src/sys/arch/powerpc/powerpc/trap.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/powerpc/powerpc/trap.c
diff -u src/sys/arch/powerpc/powerpc/trap.c:1.158 src/sys/arch/powerpc/powerpc/trap.c:1.159
--- src/sys/arch/powerpc/powerpc/trap.c:1.158	Mon Jul  6 09:34:18 2020
+++ src/sys/arch/powerpc/powerpc/trap.c	Mon Jul  6 11:08:21 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.158 2020/07/06 09:34:18 rin Exp $	*/
+/*	$NetBSD: trap.c,v 1.159 2020/07/06 11:08:21 rin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -35,12 +35,12 @@
 #define	__UCAS_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.158 2020/07/06 09:34:18 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.159 2020/07/06 11:08:21 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altivec.h"
 #include "opt_ddb.h"
-#include "opt_multiprocessor.h"
+#include "opt_ppcarch.h"
 #endif
 
 #include 



CVS commit: src/sys/arch/powerpc/powerpc

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul  6 11:07:39 UTC 2020

Modified Files:
src/sys/arch/powerpc/powerpc: syscall.c

Log Message:
Drop unused opt_altivec.h and opt_multiprocessor.h.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/powerpc/powerpc/syscall.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/powerpc

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul  6 11:07:39 UTC 2020

Modified Files:
src/sys/arch/powerpc/powerpc: syscall.c

Log Message:
Drop unused opt_altivec.h and opt_multiprocessor.h.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/powerpc/powerpc/syscall.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/powerpc/powerpc/syscall.c
diff -u src/sys/arch/powerpc/powerpc/syscall.c:1.56 src/sys/arch/powerpc/powerpc/syscall.c:1.57
--- src/sys/arch/powerpc/powerpc/syscall.c:1.56	Mon Jul  6 09:34:18 2020
+++ src/sys/arch/powerpc/powerpc/syscall.c	Mon Jul  6 11:07:39 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: syscall.c,v 1.56 2020/07/06 09:34:18 rin Exp $	*/
+/*	$NetBSD: syscall.c,v 1.57 2020/07/06 11:07:39 rin Exp $	*/
 
 /*
  * Copyright (C) 2002 Matt Thomas
@@ -35,11 +35,6 @@
 /* DO NOT INCLUDE opt_compat_XXX.h */
 /* If needed, they will be included by file that includes this one */
 
-#ifdef _KERNEL_OPT
-#include "opt_altivec.h"
-#include "opt_multiprocessor.h"
-#endif
-
 #include 
 #include 
 #include 
@@ -64,7 +59,7 @@
 #define EMULNAME(x)	(x)
 #define EMULNAMEU(x)	(x)
 
-__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.56 2020/07/06 09:34:18 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.57 2020/07/06 11:07:39 rin Exp $");
 
 void
 md_child_return(struct lwp *l)



CVS commit: src/sys/arch/powerpc/powerpc

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul  6 11:06:52 UTC 2020

Modified Files:
src/sys/arch/powerpc/powerpc: locore_subr.S

Log Message:
Drop unused opt_lockdebug.h.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/powerpc/powerpc/locore_subr.S

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/powerpc/powerpc/locore_subr.S
diff -u src/sys/arch/powerpc/powerpc/locore_subr.S:1.62 src/sys/arch/powerpc/powerpc/locore_subr.S:1.63
--- src/sys/arch/powerpc/powerpc/locore_subr.S:1.62	Mon Jul  6 09:34:18 2020
+++ src/sys/arch/powerpc/powerpc/locore_subr.S	Mon Jul  6 11:06:52 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore_subr.S,v 1.62 2020/07/06 09:34:18 rin Exp $	*/
+/*	$NetBSD: locore_subr.S,v 1.63 2020/07/06 11:06:52 rin Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -75,7 +75,6 @@
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
-#include "opt_lockdebug.h"
 #include "opt_modular.h"
 #include "opt_multiprocessor.h"
 #include "opt_ppcarch.h"



CVS commit: src/sys/arch/powerpc/powerpc

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul  6 11:06:52 UTC 2020

Modified Files:
src/sys/arch/powerpc/powerpc: locore_subr.S

Log Message:
Drop unused opt_lockdebug.h.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/powerpc/powerpc/locore_subr.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/powerpc

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul  6 11:05:54 UTC 2020

Modified Files:
src/sys/arch/powerpc/powerpc: kgdb_machdep.c

Log Message:
- Drop unused opt_ddb.h.
- Include missing opt_ppcarch.h.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/powerpc/powerpc/kgdb_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/powerpc

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul  6 11:05:54 UTC 2020

Modified Files:
src/sys/arch/powerpc/powerpc: kgdb_machdep.c

Log Message:
- Drop unused opt_ddb.h.
- Include missing opt_ppcarch.h.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/powerpc/powerpc/kgdb_machdep.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/powerpc/powerpc/kgdb_machdep.c
diff -u src/sys/arch/powerpc/powerpc/kgdb_machdep.c:1.23 src/sys/arch/powerpc/powerpc/kgdb_machdep.c:1.24
--- src/sys/arch/powerpc/powerpc/kgdb_machdep.c:1.23	Mon Jul  6 09:34:18 2020
+++ src/sys/arch/powerpc/powerpc/kgdb_machdep.c	Mon Jul  6 11:05:54 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kgdb_machdep.c,v 1.23 2020/07/06 09:34:18 rin Exp $	*/
+/*	$NetBSD: kgdb_machdep.c,v 1.24 2020/07/06 11:05:54 rin Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -36,10 +36,10 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kgdb_machdep.c,v 1.23 2020/07/06 09:34:18 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kgdb_machdep.c,v 1.24 2020/07/06 11:05:54 rin Exp $");
 
 #ifdef _KERNEL_OPT
-#include "opt_ddb.h"
+#include "opt_ppcarch.h"
 #endif
 
 /*



CVS commit: src/sys/arch/powerpc/powerpc

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul  6 11:05:05 UTC 2020

Modified Files:
src/sys/arch/powerpc/powerpc: core_machdep.c

Log Message:
Drop unused opt_ppcarch.h.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/powerpc/powerpc/core_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/powerpc

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul  6 11:05:05 UTC 2020

Modified Files:
src/sys/arch/powerpc/powerpc: core_machdep.c

Log Message:
Drop unused opt_ppcarch.h.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/powerpc/powerpc/core_machdep.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/powerpc/powerpc/core_machdep.c
diff -u src/sys/arch/powerpc/powerpc/core_machdep.c:1.10 src/sys/arch/powerpc/powerpc/core_machdep.c:1.11
--- src/sys/arch/powerpc/powerpc/core_machdep.c:1.10	Wed Nov 20 19:37:52 2019
+++ src/sys/arch/powerpc/powerpc/core_machdep.c	Mon Jul  6 11:05:05 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: core_machdep.c,v 1.10 2019/11/20 19:37:52 pgoyette Exp $	*/
+/*	$NetBSD: core_machdep.c,v 1.11 2020/07/06 11:05:05 rin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,11 +32,10 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: core_machdep.c,v 1.10 2019/11/20 19:37:52 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: core_machdep.c,v 1.11 2020/07/06 11:05:05 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altivec.h"
-#include "opt_ppcarch.h"
 #endif
 
 #include 



CVS commit: src/sys/arch/powerpc/pic

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul  6 11:02:44 UTC 2020

Modified Files:
src/sys/arch/powerpc/pic: openpic_common.c pic_distopenpic.c

Log Message:
Drop unused opt_interrupt.h.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/powerpc/pic/openpic_common.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/powerpc/pic/pic_distopenpic.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/pic

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul  6 11:02:44 UTC 2020

Modified Files:
src/sys/arch/powerpc/pic: openpic_common.c pic_distopenpic.c

Log Message:
Drop unused opt_interrupt.h.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/powerpc/pic/openpic_common.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/powerpc/pic/pic_distopenpic.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/powerpc/pic/openpic_common.c
diff -u src/sys/arch/powerpc/pic/openpic_common.c:1.8 src/sys/arch/powerpc/pic/openpic_common.c:1.9
--- src/sys/arch/powerpc/pic/openpic_common.c:1.8	Mon Jul  6 09:34:18 2020
+++ src/sys/arch/powerpc/pic/openpic_common.c	Mon Jul  6 11:02:44 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: openpic_common.c,v 1.8 2020/07/06 09:34:18 rin Exp $ */
+/*	$NetBSD: openpic_common.c,v 1.9 2020/07/06 11:02:44 rin Exp $ */
 
 /*-
  * Copyright (c) 2007 Michael Lorenz
@@ -27,10 +27,9 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: openpic_common.c,v 1.8 2020/07/06 09:34:18 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: openpic_common.c,v 1.9 2020/07/06 11:02:44 rin Exp $");
 
 #ifdef _KERNEL_OPT
-#include "opt_interrupt.h"
 #include "opt_openpic.h"
 #endif
 

Index: src/sys/arch/powerpc/pic/pic_distopenpic.c
diff -u src/sys/arch/powerpc/pic/pic_distopenpic.c:1.12 src/sys/arch/powerpc/pic/pic_distopenpic.c:1.13
--- src/sys/arch/powerpc/pic/pic_distopenpic.c:1.12	Mon Jul  6 09:34:18 2020
+++ src/sys/arch/powerpc/pic/pic_distopenpic.c	Mon Jul  6 11:02:44 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pic_distopenpic.c,v 1.12 2020/07/06 09:34:18 rin Exp $ */
+/*	$NetBSD: pic_distopenpic.c,v 1.13 2020/07/06 11:02:44 rin Exp $ */
 
 /*-
  * Copyright (c) 2008 Tim Rightnour
@@ -30,10 +30,9 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pic_distopenpic.c,v 1.12 2020/07/06 09:34:18 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pic_distopenpic.c,v 1.13 2020/07/06 11:02:44 rin Exp $");
 
 #ifdef _KERNEL_OPT
-#include "opt_interrupt.h"
 #include "opt_openpic.h"
 #endif
 



CVS commit: src/sys/arch/powerpc/pic

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul  6 11:01:24 UTC 2020

Modified Files:
src/sys/arch/powerpc/pic: ipi.c

Log Message:
Drop unused opt_altivec.h, opt_interrupt.h, opt_ipi.h, and opt_pic.h.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/powerpc/pic/ipi.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/powerpc/pic/ipi.c
diff -u src/sys/arch/powerpc/pic/ipi.c:1.15 src/sys/arch/powerpc/pic/ipi.c:1.16
--- src/sys/arch/powerpc/pic/ipi.c:1.15	Mon Jul  6 09:34:18 2020
+++ src/sys/arch/powerpc/pic/ipi.c	Mon Jul  6 11:01:24 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ipi.c,v 1.15 2020/07/06 09:34:18 rin Exp $ */
+/* $NetBSD: ipi.c,v 1.16 2020/07/06 11:01:24 rin Exp $ */
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,14 +29,10 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipi.c,v 1.15 2020/07/06 09:34:18 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipi.c,v 1.16 2020/07/06 11:01:24 rin Exp $");
 
 #ifdef _KERNEL_OPT
-#include "opt_altivec.h"
-#include "opt_interrupt.h"
-#include "opt_ipi.h"
 #include "opt_multiprocessor.h"
-#include "opt_pic.h"
 #endif
 
 #include 



CVS commit: src/sys/arch/powerpc/pic

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul  6 11:01:24 UTC 2020

Modified Files:
src/sys/arch/powerpc/pic: ipi.c

Log Message:
Drop unused opt_altivec.h, opt_interrupt.h, opt_ipi.h, and opt_pic.h.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/powerpc/pic/ipi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/oea

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul  6 10:59:37 UTC 2020

Modified Files:
src/sys/arch/powerpc/oea: ofwoea_machdep.c

Log Message:
- Drop unused opt_compat_netbsd.h.
- Include missing opt_multiprocessor.h.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/powerpc/oea/ofwoea_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/oea

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul  6 10:59:37 UTC 2020

Modified Files:
src/sys/arch/powerpc/oea: ofwoea_machdep.c

Log Message:
- Drop unused opt_compat_netbsd.h.
- Include missing opt_multiprocessor.h.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/powerpc/oea/ofwoea_machdep.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/powerpc/oea/ofwoea_machdep.c
diff -u src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.48 src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.49
--- src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.48	Mon Jul  6 09:34:17 2020
+++ src/sys/arch/powerpc/oea/ofwoea_machdep.c	Mon Jul  6 10:59:37 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ofwoea_machdep.c,v 1.48 2020/07/06 09:34:17 rin Exp $ */
+/* $NetBSD: ofwoea_machdep.c,v 1.49 2020/07/06 10:59:37 rin Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,16 +30,16 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.48 2020/07/06 09:34:17 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.49 2020/07/06 10:59:37 rin Exp $");
 
 #include "ksyms.h"
 #include "wsdisplay.h"
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
-#include "opt_compat_netbsd.h"
 #include "opt_kgdb.h"
 #include "opt_modular.h"
+#include "opt_multiprocessor.h"
 #include "opt_oea.h"
 #include "opt_ofwoea.h"
 #include "opt_ppcarch.h"



CVS commit: src/sys/arch/powerpc/oea

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul  6 10:58:06 UTC 2020

Modified Files:
src/sys/arch/powerpc/oea: cpu_speedctl.c

Log Message:
Drop unused opt_ppcparam.h.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/powerpc/oea/cpu_speedctl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/powerpc/oea

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul  6 10:58:06 UTC 2020

Modified Files:
src/sys/arch/powerpc/oea: cpu_speedctl.c

Log Message:
Drop unused opt_ppcparam.h.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/powerpc/oea/cpu_speedctl.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/powerpc/oea/cpu_speedctl.c
diff -u src/sys/arch/powerpc/oea/cpu_speedctl.c:1.2 src/sys/arch/powerpc/oea/cpu_speedctl.c:1.3
--- src/sys/arch/powerpc/oea/cpu_speedctl.c:1.2	Mon Jul  6 09:34:17 2020
+++ src/sys/arch/powerpc/oea/cpu_speedctl.c	Mon Jul  6 10:58:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_speedctl.c,v 1.2 2020/07/06 09:34:17 rin Exp $ */
+/*	$NetBSD: cpu_speedctl.c,v 1.3 2020/07/06 10:58:06 rin Exp $ */
 
 /*-
  * Copyright (c) 2006 Michael Lorenz
@@ -27,11 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_speedctl.c,v 1.2 2020/07/06 09:34:17 rin Exp $");
-
-#ifdef _KERNEL_OPT
-#include "opt_ppcparam.h"
-#endif
+__KERNEL_RCSID(0, "$NetBSD: cpu_speedctl.c,v 1.3 2020/07/06 10:58:06 rin Exp $");
 
 #include 
 #include 



CVS commit: src/sys/arch/powerpc/include/oea

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul  6 10:57:03 UTC 2020

Modified Files:
src/sys/arch/powerpc/include/oea: pmap.h

Log Message:
Include missing opt_modular.h so that struct vm_page_md is compatible to
that for booke.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/powerpc/include/oea/pmap.h

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/powerpc/include/oea/pmap.h
diff -u src/sys/arch/powerpc/include/oea/pmap.h:1.31 src/sys/arch/powerpc/include/oea/pmap.h:1.32
--- src/sys/arch/powerpc/include/oea/pmap.h:1.31	Mon Jul  6 09:10:02 2020
+++ src/sys/arch/powerpc/include/oea/pmap.h	Mon Jul  6 10:57:03 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.31 2020/07/06 09:10:02 rin Exp $	*/
+/*	$NetBSD: pmap.h,v 1.32 2020/07/06 10:57:03 rin Exp $	*/
 
 /*-
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -44,6 +44,7 @@
 
 #ifdef _KERNEL_OPT
 #include "opt_ppcarch.h"
+#include "opt_modular.h"
 #endif
 #include 
 



CVS commit: src/sys/arch/powerpc/include/oea

2020-07-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul  6 10:57:03 UTC 2020

Modified Files:
src/sys/arch/powerpc/include/oea: pmap.h

Log Message:
Include missing opt_modular.h so that struct vm_page_md is compatible to
that for booke.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/powerpc/include/oea/pmap.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



  1   2   3   4   5   6   7   8   9   10   >