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

2024-05-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue May 28 11:06:07 UTC 2024

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

Log Message:
- initialize bootpath
- if we don't get anything useful from args, check /chosen
now my G5 finds its boot device even when netbooting a kernel directly


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 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.63 src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.64
--- src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.63	Sat Sep 23 21:26:16 2023
+++ src/sys/arch/powerpc/oea/ofwoea_machdep.c	Tue May 28 11:06:07 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: ofwoea_machdep.c,v 1.63 2023/09/23 21:26:16 andvar Exp $ */
+/* $NetBSD: ofwoea_machdep.c,v 1.64 2024/05/28 11:06:07 macallan Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.63 2023/09/23 21:26:16 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.64 2024/05/28 11:06:07 macallan Exp $");
 
 #include "ksyms.h"
 #include "wsdisplay.h"
@@ -113,7 +113,7 @@ struct OF_translation ofw_translations[O
 struct pmap ofw_pmap;
 struct bat ofw_battable[BAT_VA2IDX(0x)+1];
 
-char bootpath[256];
+char bootpath[256] = "";
 char model_name[64];
 #if NKSYMS || defined(DDB) || defined(MODULAR)
 void *startsym, *endsym;
@@ -165,7 +165,10 @@ ofwoea_initppc(u_int startkernel, u_int 
 			while (*args)
 BOOT_FLAG(*args++, boothowto);
 		}
-	} else {
+	}
+
+	/* if bootpath is still empty, get it from /chosen */
+	if (bootpath[0] == 0) {
 		int chs = OF_finddevice("/chosen");
 		int len;
 



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

2024-05-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue May 28 11:06:07 UTC 2024

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

Log Message:
- initialize bootpath
- if we don't get anything useful from args, check /chosen
now my G5 finds its boot device even when netbooting a kernel directly


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 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

2024-01-19 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jan 20 00:19:07 UTC 2024

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

Log Message:
powerpc: oea: Decode IBM750CL L2 cache information.


To generate a diff of this commit:
cvs rdiff -u -r1.108 -r1.109 src/sys/arch/powerpc/oea/cpu_subr.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

2024-01-19 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jan 20 00:19:07 UTC 2024

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

Log Message:
powerpc: oea: Decode IBM750CL L2 cache information.


To generate a diff of this commit:
cvs rdiff -u -r1.108 -r1.109 src/sys/arch/powerpc/oea/cpu_subr.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_subr.c
diff -u src/sys/arch/powerpc/oea/cpu_subr.c:1.108 src/sys/arch/powerpc/oea/cpu_subr.c:1.109
--- src/sys/arch/powerpc/oea/cpu_subr.c:1.108	Sun Mar 21 23:41:52 2021
+++ src/sys/arch/powerpc/oea/cpu_subr.c	Sat Jan 20 00:19:07 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.108 2021/03/21 23:41:52 rin Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.109 2024/01/20 00:19:07 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2001 Matt Thomas.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.108 2021/03/21 23:41:52 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.109 2024/01/20 00:19:07 jmcneill Exp $");
 
 #include "sysmon_envsys.h"
 
@@ -153,6 +153,19 @@ static const struct fmttab cpu_7450_l3cr
 	{ 0, 0, NULL },
 };
 
+static const struct fmttab cpu_ibm750cl_l2cr_formats[] = {
+	{ L2CR_L2E, 0, " disabled" },
+	{ L2CR_L2DO|L2CR_L2IO, L2CR_L2DO, " data-only" },
+	{ L2CR_L2DO|L2CR_L2IO, L2CR_L2IO, " instruction-only" },
+	{ L2CR_L2DO|L2CR_L2IO, L2CR_L2DO|L2CR_L2IO, " locked" },
+	{ 0, ~0, " 256KB" },
+	{ L2CR_L2WT, L2CR_L2WT, " WT" },
+	{ L2CR_L2WT, 0, " WB" },
+	{ L2CR_L2PE, L2CR_L2PE, " with ECC" },
+	{ 0, ~0, " L2 cache" },
+	{ 0, 0, NULL }
+};
+
 static const struct fmttab cpu_ibm750_l2cr_formats[] = {
 	{ L2CR_L2E, 0, " disabled" },
 	{ L2CR_L2DO|L2CR_L2IO, L2CR_L2DO, " data-only" },
@@ -1078,10 +1091,13 @@ cpu_config_l2cr(int pvr)
 		break;
 	case MPC750:
 		if ((pvr & 0xff00) == 0x00082200 /* IBM750CX */ ||
-		(pvr & 0xef00) == 0x00082300 /* IBM750CXe */)
+		(pvr & 0xef00) == 0x00082300 /* IBM750CXe */) {
 			cpu_fmttab_print(cpu_ibm750_l2cr_formats, l2cr);
-		else
+		} else if ((pvr & 0xf0e0) == 0x00087000 /* IBM750CL */) {
+			cpu_fmttab_print(cpu_ibm750cl_l2cr_formats, l2cr);
+		} else {
 			cpu_fmttab_print(cpu_l2cr_formats, l2cr);
+		}
 		break;
 	case MPC7447A:
 	case MPC7457:



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

2024-01-19 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jan 20 00:18:20 UTC 2024

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

Log Message:
powerpc: oea: Fix prefetchable mappings

Prefetchable mappings need PMAP_NOCACHE to get write-combine semantics.


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/sys/arch/powerpc/oea/oea_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

2024-01-19 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jan 20 00:18:20 UTC 2024

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

Log Message:
powerpc: oea: Fix prefetchable mappings

Prefetchable mappings need PMAP_NOCACHE to get write-combine semantics.


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/sys/arch/powerpc/oea/oea_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/oea_machdep.c
diff -u src/sys/arch/powerpc/oea/oea_machdep.c:1.84 src/sys/arch/powerpc/oea/oea_machdep.c:1.85
--- src/sys/arch/powerpc/oea/oea_machdep.c:1.84	Sun Aug  7 09:37:46 2022
+++ src/sys/arch/powerpc/oea/oea_machdep.c	Sat Jan 20 00:18:19 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: oea_machdep.c,v 1.84 2022/08/07 09:37:46 andvar Exp $	*/
+/*	$NetBSD: oea_machdep.c,v 1.85 2024/01/20 00:18:19 jmcneill Exp $	*/
 
 /*
  * Copyright (C) 2002 Matt Thomas
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: oea_machdep.c,v 1.84 2022/08/07 09:37:46 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: oea_machdep.c,v 1.85 2024/01/20 00:18:19 jmcneill Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altivec.h"
@@ -1064,7 +1064,7 @@ mapiodev(paddr_t pa, psize_t len, bool p
 
 	for (; len > 0; len -= PAGE_SIZE) {
 		pmap_kenter_pa(taddr, faddr, VM_PROT_READ | VM_PROT_WRITE,
-		(prefetchable ? PMAP_MD_PREFETCHABLE : PMAP_NOCACHE));
+		PMAP_NOCACHE | (prefetchable ? PMAP_MD_PREFETCHABLE : 0));
 		faddr += PAGE_SIZE;
 		taddr += PAGE_SIZE;
 	}



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

2023-12-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Dec 15 09:36:36 UTC 2023

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

Log Message:
powerpc/oea: pmap_create: Use PR_ZERO and drop memset(9), NFC

Part of PR kern/57621


To generate a diff of this commit:
cvs rdiff -u -r1.119 -r1.120 src/sys/arch/powerpc/oea/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/oea/pmap.c
diff -u src/sys/arch/powerpc/oea/pmap.c:1.119 src/sys/arch/powerpc/oea/pmap.c:1.120
--- src/sys/arch/powerpc/oea/pmap.c:1.119	Fri Dec 15 09:35:29 2023
+++ src/sys/arch/powerpc/oea/pmap.c	Fri Dec 15 09:36:35 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.119 2023/12/15 09:35:29 rin Exp $	*/
+/*	$NetBSD: pmap.c,v 1.120 2023/12/15 09:36:35 rin Exp $	*/
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -63,7 +63,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.119 2023/12/15 09:35:29 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.120 2023/12/15 09:36:35 rin Exp $");
 
 #define	PMAP_NOOPNAMES
 
@@ -1136,9 +1136,8 @@ pmap_create(void)
 {
 	pmap_t pm;
 
-	pm = pool_get(_pool, PR_WAITOK);
+	pm = pool_get(_pool, PR_WAITOK | PR_ZERO);
 	KASSERT((vaddr_t)pm < VM_MIN_KERNEL_ADDRESS);
-	memset((void *)pm, 0, sizeof *pm);
 	pmap_pinit(pm);
 	
 	DPRINTFN(CREATE, "pmap_create: pm %p:\n"



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

2023-12-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Dec 15 09:36:36 UTC 2023

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

Log Message:
powerpc/oea: pmap_create: Use PR_ZERO and drop memset(9), NFC

Part of PR kern/57621


To generate a diff of this commit:
cvs rdiff -u -r1.119 -r1.120 src/sys/arch/powerpc/oea/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/oea

2023-12-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Dec 15 09:35:29 UTC 2023

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

Log Message:
powerpc/oea: pmap: Fix mostly-pointless overhead of pmap_pvo_pool

(1) Drop __aligned(32) from struct pvo_entry; otherwise,
sizeof(struct pvo_entry) is round-up'ed to a multiple of 32.

(2) Do not set sizeof(struct pvo_entry) to `align` argument for
pool_init(9); it must be power of 2.

(3) Align pvo_entry to 32-byte boundary only if reasonably possible,
i.e., OEA without DIAGNOSTIC (--> POOL_REDZONE) for now.

Part of PR kern/57621


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/sys/arch/powerpc/oea/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/oea/pmap.c
diff -u src/sys/arch/powerpc/oea/pmap.c:1.118 src/sys/arch/powerpc/oea/pmap.c:1.119
--- src/sys/arch/powerpc/oea/pmap.c:1.118	Fri Dec 15 09:33:29 2023
+++ src/sys/arch/powerpc/oea/pmap.c	Fri Dec 15 09:35:29 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.118 2023/12/15 09:33:29 rin Exp $	*/
+/*	$NetBSD: pmap.c,v 1.119 2023/12/15 09:35:29 rin Exp $	*/
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -63,7 +63,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.118 2023/12/15 09:33:29 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.119 2023/12/15 09:35:29 rin Exp $");
 
 #define	PMAP_NOOPNAMES
 
@@ -292,7 +292,7 @@ const struct pmap_ops PMAPNAME(ops) = {
 #endif /* !PMAPNAME */
 
 /*
- * The following structure is aligned to 32 bytes 
+ * The following structure is aligned to 32 bytes, if reasonably possible.
  */
 struct pvo_entry {
 	LIST_ENTRY(pvo_entry) pvo_vlink;	/* Link to common virt page */
@@ -317,7 +317,14 @@ struct pvo_entry {
 #define	PVO_REMOVE		6		/* PVO has been removed */
 #define	PVO_WHERE_MASK		15
 #define	PVO_WHERE_SHFT		8
-} __attribute__ ((aligned (32)));
+};
+
+#if defined(PMAP_OEA) && !defined(DIAGNOSTIC)
+#define	PMAP_PVO_ENTRY_ALIGN	32
+#else
+#define	PMAP_PVO_ENTRY_ALIGN	__alignof(struct pvo_entry)
+#endif
+
 #define	PVO_VADDR(pvo)		((pvo)->pvo_vaddr & ~ADDR_POFF)
 #define	PVO_PTEGIDX_GET(pvo)	((pvo)->pvo_vaddr & PVO_PTEGIDX_MASK)
 #define	PVO_PTEGIDX_ISSET(pvo)	((pvo)->pvo_vaddr & PVO_PTEGIDX_VALID)
@@ -3440,7 +3447,7 @@ pmap_bootstrap1(paddr_t kernelstart, pad
 #endif
 
 	pool_init(_pvo_pool, sizeof(struct pvo_entry),
-	sizeof(struct pvo_entry), 0, 0, "pmap_pvopl",
+	PMAP_PVO_ENTRY_ALIGN, 0, 0, "pmap_pvopl",
 	_pool_allocator, IPL_VM);
 
 	pool_setlowat(_pvo_pool, 1008);



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

2023-12-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Dec 15 09:35:29 UTC 2023

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

Log Message:
powerpc/oea: pmap: Fix mostly-pointless overhead of pmap_pvo_pool

(1) Drop __aligned(32) from struct pvo_entry; otherwise,
sizeof(struct pvo_entry) is round-up'ed to a multiple of 32.

(2) Do not set sizeof(struct pvo_entry) to `align` argument for
pool_init(9); it must be power of 2.

(3) Align pvo_entry to 32-byte boundary only if reasonably possible,
i.e., OEA without DIAGNOSTIC (--> POOL_REDZONE) for now.

Part of PR kern/57621


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/sys/arch/powerpc/oea/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/oea

2023-12-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Dec 15 09:33:30 UTC 2023

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

Log Message:
powerpc/oea: pmap: Rework pmap_pte_spill()

It was broken in many ways... Now, it gets working stable both for
OEA and OEA64_BRIDGE, as far as I can see.

Part of PR kern/57621


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/sys/arch/powerpc/oea/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/oea/pmap.c
diff -u src/sys/arch/powerpc/oea/pmap.c:1.117 src/sys/arch/powerpc/oea/pmap.c:1.118
--- src/sys/arch/powerpc/oea/pmap.c:1.117	Fri Dec 15 09:32:05 2023
+++ src/sys/arch/powerpc/oea/pmap.c	Fri Dec 15 09:33:29 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.117 2023/12/15 09:32:05 rin Exp $	*/
+/*	$NetBSD: pmap.c,v 1.118 2023/12/15 09:33:29 rin Exp $	*/
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -63,7 +63,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.117 2023/12/15 09:32:05 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.118 2023/12/15 09:33:29 rin Exp $");
 
 #define	PMAP_NOOPNAMES
 
@@ -879,48 +879,35 @@ pmap_pte_insert(int ptegidx, struct pte 
  * Tries to spill a page table entry from the overflow area.
  * This runs in either real mode (if dealing with a exception spill)
  * or virtual mode when dealing with manually spilling one of the
- * kernel's pte entries.  In either case, interrupts are already
- * disabled.
+ * kernel's pte entries.
  */
 
 int
-pmap_pte_spill(struct pmap *pm, vaddr_t addr, bool exec)
+pmap_pte_spill(struct pmap *pm, vaddr_t addr, bool isi_p)
 {
-	struct pvo_entry *source_pvo, *victim_pvo, *next_pvo;
-	struct pvo_entry *pvo;
-	/* XXX: gcc -- vpvoh is always set at either *1* or *2* */
-	struct pvo_tqhead *pvoh, *vpvoh = NULL;
-	int ptegidx, i, j;
+	struct pvo_tqhead *spvoh, *vpvoh;
+	struct pvo_entry *pvo, *source_pvo, *victim_pvo;
 	volatile struct pteg *pteg;
 	volatile struct pte *pt;
+	register_t msr, vsid, hash;
+	int ptegidx, hid, i, j;
+	int done = 0;
 
 	PMAP_LOCK();
+	msr = pmap_interrupts_off();
+
+	/* XXXRO paranoid? */
+	if (pm->pm_evictions == 0)
+		goto out;
 
 	ptegidx = va_to_pteg(pm, addr);
 
 	/*
-	 * Have to substitute some entry. Use the primary hash for this.
-	 * Use low bits of timebase as random generator.  Make sure we are
-	 * not picking a kernel pte for replacement.
+	 * Find source pvo.
 	 */
-	pteg = _pteg_table[ptegidx];
-	i = MFTB() & 7;
-	for (j = 0; j < 8; j++) {
-		pt = >pt[i];
-		if ((pt->pte_hi & PTE_VALID) == 0)
-			break;
-		if (VSID_TO_HASH((pt->pte_hi & PTE_VSID) >> PTE_VSID_SHFT)
-< PHYSMAP_VSIDBITS)
-			break;
-		i = (i + 1) & 7;
-	}
-	KASSERT(j < 8);
-
+	spvoh = _pvo_table[ptegidx];
 	source_pvo = NULL;
-	victim_pvo = NULL;
-	pvoh = _pvo_table[ptegidx];
-	TAILQ_FOREACH(pvo, pvoh, pvo_olink) {
-
+	TAILQ_FOREACH(pvo, spvoh, pvo_olink) {
 		/*
 		 * We need to find pvo entry for this address...
 		 */
@@ -931,101 +918,105 @@ pmap_pte_spill(struct pmap *pm, vaddr_t 
 		 * a valid PTE, then we know we can't find it because all
 		 * evicted PVOs always are first in the list.
 		 */
-		if (source_pvo == NULL && (pvo->pvo_pte.pte_hi & PTE_VALID))
+		if ((pvo->pvo_pte.pte_hi & PTE_VALID) != 0)
 			break;
-		if (source_pvo == NULL && pm == pvo->pvo_pmap &&
-		addr == PVO_VADDR(pvo)) {
 
-			/*
-			 * Now we have found the entry to be spilled into the
-			 * pteg.  Attempt to insert it into the page table.
-			 */
-			j = pmap_pte_insert(ptegidx, >pvo_pte);
-			if (j >= 0) {
-PVO_PTEGIDX_SET(pvo, j);
-PMAP_PVO_CHECK(pvo);	/* sanity check */
-PVO_WHERE(pvo, SPILL_INSERT);
-pvo->pvo_pmap->pm_evictions--;
-PMAPCOUNT(ptes_spilled);
-PMAPCOUNT2(((pvo->pvo_pte.pte_hi & PTE_HID)
-? pmap_evcnt_ptes_secondary
-: pmap_evcnt_ptes_primary)[j]);
-
-/*
- * Since we keep the evicted entries at the
- * from of the PVO list, we need move this
- * (now resident) PVO after the evicted
- * entries.
- */
-next_pvo = TAILQ_NEXT(pvo, pvo_olink);
-
-/*
- * If we don't have to move (either we were the
- * last entry or the next entry was valid),
- * don't change our position.  Otherwise 
- * move ourselves to the tail of the queue.
- */
-if (next_pvo != NULL &&
-!(next_pvo->pvo_pte.pte_hi & PTE_VALID)) {
-	TAILQ_REMOVE(pvoh, pvo, pvo_olink);
-	TAILQ_INSERT_TAIL(pvoh, pvo, pvo_olink);
-}
-PMAP_UNLOCK();
-return 1;
+		if (pm == pvo->pvo_pmap && addr == PVO_VADDR(pvo)) {
+			if (isi_p) {
+if (!PVO_EXECUTABLE_P(pvo))
+	goto out;
+#if defined(PMAP_OEA) || defined(PMAP_OEA64_BRIDGE)
+int sr __diagused =
+PVO_VADDR(pvo) >> ADDR_SR_SHFT;
+KASSERT((pm->pm_sr[sr] & SR_NOEXEC) == 0);
+#endif
 			}
+			KASSERT(!PVO_PTEGIDX_ISSET(pvo));
+			/* XXXRO where check */
 			source_pvo = 

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

2023-12-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Dec 15 09:33:30 UTC 2023

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

Log Message:
powerpc/oea: pmap: Rework pmap_pte_spill()

It was broken in many ways... Now, it gets working stable both for
OEA and OEA64_BRIDGE, as far as I can see.

Part of PR kern/57621


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/sys/arch/powerpc/oea/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/oea

2023-12-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Dec 15 09:32:05 UTC 2023

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

Log Message:
powerpc/oea: pmap: Drop unused argument for pmap_pvo_reclaim(), NFC

Part of PR kern/57621


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/sys/arch/powerpc/oea/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/oea/pmap.c
diff -u src/sys/arch/powerpc/oea/pmap.c:1.116 src/sys/arch/powerpc/oea/pmap.c:1.117
--- src/sys/arch/powerpc/oea/pmap.c:1.116	Fri Dec  8 21:46:02 2023
+++ src/sys/arch/powerpc/oea/pmap.c	Fri Dec 15 09:32:05 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.116 2023/12/08 21:46:02 andvar Exp $	*/
+/*	$NetBSD: pmap.c,v 1.117 2023/12/15 09:32:05 rin Exp $	*/
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -63,7 +63,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.116 2023/12/08 21:46:02 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.117 2023/12/15 09:32:05 rin Exp $");
 
 #define	PMAP_NOOPNAMES
 
@@ -388,7 +388,7 @@ static void pmap_pvo_free(struct pvo_ent
 static void pmap_pvo_free_list(struct pvo_head *);
 static struct pvo_entry *pmap_pvo_find_va(pmap_t, vaddr_t, int *); 
 static volatile struct pte *pmap_pvo_to_pte(const struct pvo_entry *, int);
-static struct pvo_entry *pmap_pvo_reclaim(struct pmap *);
+static struct pvo_entry *pmap_pvo_reclaim(void);
 static void pvo_set_exec(struct pvo_entry *);
 static void pvo_clear_exec(struct pvo_entry *);
 
@@ -1507,7 +1507,7 @@ pmap_pvo_check(const struct pvo_entry *p
  */
 
 struct pvo_entry *
-pmap_pvo_reclaim(struct pmap *pm)
+pmap_pvo_reclaim(void)
 {
 	struct pvo_tqhead *pvoh;
 	struct pvo_entry *pvo;
@@ -1615,7 +1615,7 @@ pmap_pvo_enter(pmap_t pm, struct pool *p
 	++pmap_pvo_enter_depth;
 #endif
 	if (pvo == NULL) {
-		pvo = pmap_pvo_reclaim(pm);
+		pvo = pmap_pvo_reclaim();
 		if (pvo == NULL) {
 			if ((flags & PMAP_CANFAIL) == 0)
 panic("pmap_pvo_enter: failed");



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

2023-12-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Dec 15 09:32:05 UTC 2023

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

Log Message:
powerpc/oea: pmap: Drop unused argument for pmap_pvo_reclaim(), NFC

Part of PR kern/57621


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/sys/arch/powerpc/oea/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/oea

2023-10-09 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Oct  9 13:01:58 UTC 2023

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

Log Message:
powerpc/oea: pmap: Use pool_allocator_nointr() for pmap_pool

As done for (majority of) other pmap implementations.

pmap_pool_allocator() allocates memory below 256MB, but it is not
necessary for struct pmap.

Fix part of PR kern/57621, i.e., stall in pmap_create(9).

There should be another bugs that cause (MP?) kernel hangs
reported in the PR, in pmap or other MD components for powerpc
(PR port-powerpc/56922 should be one of the candidates).

XXX
pmap for powerpc/oea apparently needs some clean ups. But leave it
as is, and pull up this minimum fix to netbsd-10 at the moment.


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/sys/arch/powerpc/oea/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/oea/pmap.c
diff -u src/sys/arch/powerpc/oea/pmap.c:1.114 src/sys/arch/powerpc/oea/pmap.c:1.115
--- src/sys/arch/powerpc/oea/pmap.c:1.114	Mon May  9 11:39:44 2022
+++ src/sys/arch/powerpc/oea/pmap.c	Mon Oct  9 13:01:58 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.114 2022/05/09 11:39:44 rin Exp $	*/
+/*	$NetBSD: pmap.c,v 1.115 2023/10/09 13:01:58 rin Exp $	*/
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -63,7 +63,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.114 2022/05/09 11:39:44 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.115 2023/10/09 13:01:58 rin Exp $");
 
 #define	PMAP_NOOPNAMES
 
@@ -3448,7 +3448,7 @@ pmap_bootstrap1(paddr_t kernelstart, pad
 	pool_setlowat(_pvo_pool, 1008);
 
 	pool_init(_pool, sizeof(struct pmap),
-	sizeof(void *), 0, 0, "pmap_pl", _pool_allocator,
+	sizeof(void *), 0, 0, "pmap_pl", _allocator_nointr,
 	IPL_NONE);
 
 #if defined(PMAP_NEED_MAPKERNEL)



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

2023-10-09 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Oct  9 13:01:58 UTC 2023

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

Log Message:
powerpc/oea: pmap: Use pool_allocator_nointr() for pmap_pool

As done for (majority of) other pmap implementations.

pmap_pool_allocator() allocates memory below 256MB, but it is not
necessary for struct pmap.

Fix part of PR kern/57621, i.e., stall in pmap_create(9).

There should be another bugs that cause (MP?) kernel hangs
reported in the PR, in pmap or other MD components for powerpc
(PR port-powerpc/56922 should be one of the candidates).

XXX
pmap for powerpc/oea apparently needs some clean ups. But leave it
as is, and pull up this minimum fix to netbsd-10 at the moment.


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/sys/arch/powerpc/oea/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/oea

2023-09-23 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Sep 23 21:26:16 UTC 2023

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

Log Message:
add ifdef NWSDISPLAY > 0 around rascons_* functions usage,
otherwise implementation is not available, which breaks macppc MAMBO config.

potentially better solution to provide empty implementation, comments welcome.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/powerpc/oea/ofw_autoconf.c
cvs rdiff -u -r1.62 -r1.63 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

2023-09-23 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Sep 23 21:26:16 UTC 2023

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

Log Message:
add ifdef NWSDISPLAY > 0 around rascons_* functions usage,
otherwise implementation is not available, which breaks macppc MAMBO config.

potentially better solution to provide empty implementation, comments welcome.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/powerpc/oea/ofw_autoconf.c
cvs rdiff -u -r1.62 -r1.63 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/ofw_autoconf.c
diff -u src/sys/arch/powerpc/oea/ofw_autoconf.c:1.25 src/sys/arch/powerpc/oea/ofw_autoconf.c:1.26
--- src/sys/arch/powerpc/oea/ofw_autoconf.c:1.25	Wed Dec 14 13:19:04 2022
+++ src/sys/arch/powerpc/oea/ofw_autoconf.c	Sat Sep 23 21:26:16 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ofw_autoconf.c,v 1.25 2022/12/14 13:19:04 macallan Exp $ */
+/* $NetBSD: ofw_autoconf.c,v 1.26 2023/09/23 21:26:16 andvar Exp $ */
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
  * Copyright (C) 1995, 1996 TooLs GmbH.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_autoconf.c,v 1.25 2022/12/14 13:19:04 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_autoconf.c,v 1.26 2023/09/23 21:26:16 andvar Exp $");
 
 #ifdef ofppc
 #include "gtpci.h"
@@ -82,7 +82,9 @@ static void canonicalize_bootpath(void);
 void
 cpu_configure(void)
 {
+#if NWSDISPLAY > 0
 	rascons_add_rom_font();
+#endif
 	init_interrupt();
 	canonicalize_bootpath();
 

Index: src/sys/arch/powerpc/oea/ofwoea_machdep.c
diff -u src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.62 src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.63
--- src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.62	Sun Dec  5 07:13:48 2021
+++ src/sys/arch/powerpc/oea/ofwoea_machdep.c	Sat Sep 23 21:26:16 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ofwoea_machdep.c,v 1.62 2021/12/05 07:13:48 msaitoh Exp $ */
+/* $NetBSD: ofwoea_machdep.c,v 1.63 2023/09/23 21:26:16 andvar Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.62 2021/12/05 07:13:48 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.63 2023/09/23 21:26:16 andvar Exp $");
 
 #include "ksyms.h"
 #include "wsdisplay.h"
@@ -270,7 +270,9 @@ ofwoea_initppc(u_int startkernel, u_int 
 
 	restore_ofmap();
 
+#if NWSDISPLAY > 0
 	rascons_finalize();
+#endif
 
 #if NKSYMS || defined(DDB) || defined(MODULAR)
 	ksyms_addsyms_elf((int)((uintptr_t)endsym - (uintptr_t)startsym), startsym, endsym);



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

2022-12-14 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Dec 14 13:19:05 UTC 2022

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

Log Message:
if we have the ROM font, make it available to wsdisplay
needs testing on non-macppc


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/powerpc/oea/ofw_autoconf.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_autoconf.c
diff -u src/sys/arch/powerpc/oea/ofw_autoconf.c:1.24 src/sys/arch/powerpc/oea/ofw_autoconf.c:1.25
--- src/sys/arch/powerpc/oea/ofw_autoconf.c:1.24	Wed Nov 27 21:07:32 2019
+++ src/sys/arch/powerpc/oea/ofw_autoconf.c	Wed Dec 14 13:19:04 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ofw_autoconf.c,v 1.24 2019/11/27 21:07:32 joerg Exp $ */
+/* $NetBSD: ofw_autoconf.c,v 1.25 2022/12/14 13:19:04 macallan Exp $ */
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
  * Copyright (C) 1995, 1996 TooLs GmbH.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_autoconf.c,v 1.24 2019/11/27 21:07:32 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_autoconf.c,v 1.25 2022/12/14 13:19:04 macallan Exp $");
 
 #ifdef ofppc
 #include "gtpci.h"
@@ -61,6 +61,11 @@ __KERNEL_RCSID(0, "$NetBSD: ofw_autoconf
 #include 
 #include 
 
+#include 
+#include 
+#include 
+#include 
+
 #include 
 
 #include 
@@ -77,6 +82,7 @@ static void canonicalize_bootpath(void);
 void
 cpu_configure(void)
 {
+	rascons_add_rom_font();
 	init_interrupt();
 	canonicalize_bootpath();
 



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

2022-12-14 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Dec 14 13:19:05 UTC 2022

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

Log Message:
if we have the ROM font, make it available to wsdisplay
needs testing on non-macppc


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/powerpc/oea/ofw_autoconf.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

2022-12-05 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Dec  6 01:14:37 UTC 2022

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

Log Message:
convert more seriously early output to ofprint
regular console output needs more of the kernel in working order now, and this
stuff happ0ens long before the banner


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/powerpc/oea/ofw_consinit.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_consinit.c
diff -u src/sys/arch/powerpc/oea/ofw_consinit.c:1.26 src/sys/arch/powerpc/oea/ofw_consinit.c:1.27
--- src/sys/arch/powerpc/oea/ofw_consinit.c:1.26	Thu Nov 24 00:07:49 2022
+++ src/sys/arch/powerpc/oea/ofw_consinit.c	Tue Dec  6 01:14:36 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ofw_consinit.c,v 1.26 2022/11/24 00:07:49 macallan Exp $ */
+/* $NetBSD: ofw_consinit.c,v 1.27 2022/12/06 01:14:36 macallan Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_consinit.c,v 1.26 2022/11/24 00:07:49 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_consinit.c,v 1.27 2022/12/06 01:14:36 macallan Exp $");
 
 #include "adb.h"
 #include "adbkbd.h"
@@ -191,7 +191,7 @@ ofwoea_cnprobe_keyboard(void)
 	memset(name, 0, sizeof(name));
 	OF_getprop(node, "name", name, sizeof(name));
 	if (strcmp(name, "keyboard") != 0) {
-		printf("WARNING: stdin is not a keyboard: %s\n", name);
+		ofprint("WARNING: stdin is not a keyboard: %s\n", name);
 		return;
 	}
 
@@ -199,21 +199,21 @@ ofwoea_cnprobe_keyboard(void)
 	OF_getprop(OF_parent(node), "name", name, sizeof(name));
 #if NAKBD > 0
 	if (strcmp(name, "adb") == 0) {
-		printf("console keyboard type: ADB\n");
+		ofprint("console keyboard type: ADB\n");
 		selected_keyboard = akbd_cnattach;
 		goto kbd_found;
 	}
 #endif
 #if NADBKBD > 0
 	if (strcmp(name, "adb") == 0) {
-		printf("console keyboard type: ADB\n");
+		ofprint("console keyboard type: ADB\n");
 		selected_keyboard = adbkbd_cnattach;
 		goto kbd_found;
 	}
 #endif
 #if NPCKBC > 0
 	if (strcmp(name, "isa") == 0) {
-		printf("console keyboard type: PC Keyboard\n");
+		ofprint("console keyboard type: PC Keyboard\n");
 		selected_keyboard = ofwoea_pckbd_cnattach;
 		goto kbd_found;
 	}
@@ -271,7 +271,7 @@ ofwoea_cnprobe_keyboard(void)
 
 		adb_node = OF_finddevice("/pci/mac-io/via-pmu/adb");
 		if (adb_node > 0) {
-			printf("ADB support found\n");
+			ofprint("ADB support found\n");
 #if NAKBD > 0
 			selected_keyboard = akbd_cnattach;
 #endif
@@ -280,7 +280,7 @@ ofwoea_cnprobe_keyboard(void)
 #endif
 		} else {
 			/* must be USB */
-			printf("No ADB support present, assuming USB "
+			ofprint("No ADB support present, assuming USB "
 			   "keyboard\n");
 #if NUKBD > 0
 			selected_keyboard = ukbd_cnattach;
@@ -300,8 +300,8 @@ ofwoea_cnprobe_keyboard(void)
 	if (OF_call_method("`usb-kbd-ihandles", kstdin, 0, 1, ) >= 0 &&
 	ukbds != NULL && ukbds->ihandle != 0 &&
 	OF_instance_to_package(ukbds->ihandle) != -1) {
-		printf("usb-kbd-ihandles matches\n");
-		printf("console keyboard type: USB\n");
+		ofprint("usb-kbd-ihandles matches\n");
+		ofprint("console keyboard type: USB\n");
 		selected_keyboard = ukbd_cnattach;
 		goto kbd_found;
 	}
@@ -309,8 +309,8 @@ ofwoea_cnprobe_keyboard(void)
 	if (OF_call_method("`usb-kbd-ihandle", kstdin, 0, 1, ) >= 0 &&
 	ukbd != 0 &&
 	OF_instance_to_package(ukbd) != -1) {
-		printf("usb-kbd-ihandle matches\n");
-		printf("console keyboard type: USB\n");
+		ofprint("usb-kbd-ihandle matches\n");
+		ofprint("console keyboard type: USB\n");
 		kstdin = ukbd;
 		selected_keyboard = ukbd_cnattach;
 		goto kbd_found;
@@ -321,8 +321,8 @@ ofwoea_cnprobe_keyboard(void)
 	if (OF_call_method("`adb-kbd-ihandle", kstdin, 0, 1, ) >= 0 &&
 	akbd != 0 &&
 	OF_instance_to_package(akbd) != -1) {
-		printf("adb-kbd-ihandle matches\n");
-		printf("console keyboard type: ADB\n");
+		ofprint("adb-kbd-ihandle matches\n");
+		ofprint("console keyboard type: ADB\n");
 		kstdin = akbd;
 #if NAKBD > 0
 		selected_keyboard = akbd_cnattach;
@@ -339,8 +339,8 @@ ofwoea_cnprobe_keyboard(void)
 	 * XXX Old firmware does not have `usb-kbd-ihandles method.  Assume
 	 * XXX USB keyboard anyway.
 	 */
-	printf("defaulting to USB...");
-	printf("console keyboard type: USB\n");
+	ofprint("defaulting to USB...");
+	ofprint("console keyboard type: USB\n");
 	selected_keyboard = ukbd_cnattach;
 	goto kbd_found;
 #endif
@@ -348,7 +348,7 @@ ofwoea_cnprobe_keyboard(void)
 	/*
 	 * No keyboard is found.  Just return.
 	 */
-	printf("no console keyboard\n");
+	ofprint("no console keyboard\n");
 	return;
 
 kbd_found:



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

2022-12-05 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Dec  6 01:14:37 UTC 2022

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

Log Message:
convert more seriously early output to ofprint
regular console output needs more of the kernel in working order now, and this
stuff happ0ens long before the banner


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/powerpc/oea/ofw_consinit.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

2022-05-09 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon May  9 11:39:44 UTC 2022

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

Log Message:
PR port-powerpc/56818

Fix inverted logic introduced in rev. 1.108, by which modified/referenced
bits of pages were never cleared appropriately.

Now, full ATF runs on macppc and sandpoint, with no regression observed.


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/arch/powerpc/oea/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/oea/pmap.c
diff -u src/sys/arch/powerpc/oea/pmap.c:1.113 src/sys/arch/powerpc/oea/pmap.c:1.114
--- src/sys/arch/powerpc/oea/pmap.c:1.113	Sat Apr  9 23:38:32 2022
+++ src/sys/arch/powerpc/oea/pmap.c	Mon May  9 11:39:44 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.113 2022/04/09 23:38:32 riastradh Exp $	*/
+/*	$NetBSD: pmap.c,v 1.114 2022/05/09 11:39:44 rin Exp $	*/
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -63,7 +63,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.113 2022/04/09 23:38:32 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.114 2022/05/09 11:39:44 rin Exp $");
 
 #define	PMAP_NOOPNAMES
 
@@ -674,7 +674,7 @@ static inline void
 pmap_pp_attr_clear(struct pmap_page *pp, int ptebit)
 {
 
-	pp->pp_attrs &= ptebit;
+	pp->pp_attrs &= ~ptebit;
 }
 
 static inline void



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

2022-05-09 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon May  9 11:39:44 UTC 2022

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

Log Message:
PR port-powerpc/56818

Fix inverted logic introduced in rev. 1.108, by which modified/referenced
bits of pages were never cleared appropriately.

Now, full ATF runs on macppc and sandpoint, with no regression observed.


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/arch/powerpc/oea/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/oea

2022-02-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 18 19:04:52 UTC 2022

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

Log Message:
Backout previous and fix the correct macro magic


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/arch/powerpc/oea/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/oea/pmap.c
diff -u src/sys/arch/powerpc/oea/pmap.c:1.110 src/sys/arch/powerpc/oea/pmap.c:1.111
--- src/sys/arch/powerpc/oea/pmap.c:1.110	Fri Feb 18 18:58:15 2022
+++ src/sys/arch/powerpc/oea/pmap.c	Fri Feb 18 19:04:52 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.110 2022/02/18 18:58:15 martin Exp $	*/
+/*	$NetBSD: pmap.c,v 1.111 2022/02/18 19:04:52 martin Exp $	*/
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -63,7 +63,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.110 2022/02/18 18:58:15 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.111 2022/02/18 19:04:52 martin Exp $");
 
 #define	PMAP_NOOPNAMES
 
@@ -162,6 +162,7 @@ static u_int mem_cnt, avail_cnt;
 #define pmap_protect		PMAPNAME(protect)
 #define pmap_unwire		PMAPNAME(unwire)
 #define pmap_page_protect	PMAPNAME(page_protect)
+#define	pmap_pv_protect		PMAPNAME(pv_protect)
 #define pmap_query_bit		PMAPNAME(query_bit)
 #define pmap_clear_bit		PMAPNAME(clear_bit)
 
@@ -214,7 +215,7 @@ STATIC bool pmap_extract(pmap_t, vaddr_t
 STATIC void pmap_protect(pmap_t, vaddr_t, vaddr_t, vm_prot_t);
 STATIC void pmap_unwire(pmap_t, vaddr_t);
 STATIC void pmap_page_protect(struct vm_page *, vm_prot_t);
-void pmap_pv_protect(paddr_t, vm_prot_t);
+STATIC void pmap_pv_protect(paddr_t, vm_prot_t);
 STATIC bool pmap_query_bit(struct vm_page *, int);
 STATIC bool pmap_clear_bit(struct vm_page *, int);
 
@@ -258,6 +259,7 @@ const struct pmap_ops PMAPNAME(ops) = {
 	.pmapop_protect = pmap_protect,
 	.pmapop_unwire = pmap_unwire,
 	.pmapop_page_protect = pmap_page_protect,
+	.pmapop_pv_protect = pmap_pv_protect,
 	.pmapop_query_bit = pmap_query_bit,
 	.pmapop_clear_bit = pmap_clear_bit,
 	.pmapop_activate = pmap_activate,



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

2022-02-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 18 19:04:52 UTC 2022

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

Log Message:
Backout previous and fix the correct macro magic


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/arch/powerpc/oea/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/oea

2022-02-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 18 18:58:15 UTC 2022

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

Log Message:
pmap_pv_protect is not STATIC


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 src/sys/arch/powerpc/oea/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/oea/pmap.c
diff -u src/sys/arch/powerpc/oea/pmap.c:1.109 src/sys/arch/powerpc/oea/pmap.c:1.110
--- src/sys/arch/powerpc/oea/pmap.c:1.109	Wed Feb 16 23:49:27 2022
+++ src/sys/arch/powerpc/oea/pmap.c	Fri Feb 18 18:58:15 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.109 2022/02/16 23:49:27 riastradh Exp $	*/
+/*	$NetBSD: pmap.c,v 1.110 2022/02/18 18:58:15 martin Exp $	*/
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -63,7 +63,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.109 2022/02/16 23:49:27 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.110 2022/02/18 18:58:15 martin Exp $");
 
 #define	PMAP_NOOPNAMES
 
@@ -214,7 +214,7 @@ STATIC bool pmap_extract(pmap_t, vaddr_t
 STATIC void pmap_protect(pmap_t, vaddr_t, vaddr_t, vm_prot_t);
 STATIC void pmap_unwire(pmap_t, vaddr_t);
 STATIC void pmap_page_protect(struct vm_page *, vm_prot_t);
-STATIC void pmap_pv_protect(paddr_t, vm_prot_t);
+void pmap_pv_protect(paddr_t, vm_prot_t);
 STATIC bool pmap_query_bit(struct vm_page *, int);
 STATIC bool pmap_clear_bit(struct vm_page *, int);
 



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

2022-02-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 18 18:58:15 UTC 2022

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

Log Message:
pmap_pv_protect is not STATIC


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 src/sys/arch/powerpc/oea/pmap.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/oea

2021-04-01 Thread Jason Thorpe
Ugh.  Can we please stop making these hacky one-offs in "shared by all PowerPC 
platforms" code?  This actually points to a deeper problem in the pmap code 
that needs to be addressed correctly.

> On Apr 1, 2021, at 3:02 PM, Michael Lorenz  wrote:
> 
> Module Name:  src
> Committed By: macallan
> Date: Thu Apr  1 22:02:20 UTC 2021
> 
> Modified Files:
>   src/sys/arch/powerpc/oea: ofwoea_machdep.c
> 
> Log Message:
> avoid mapping 0xf000 - my beige G3 DSIs on it
> with this my the machine boots again
> tested on a variety of G4 and G5 models with no problems
> 
> 
> To generate a diff of this commit:
> cvs rdiff -u -r1.59 -r1.60 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.
> 

-- thorpej



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

2019-11-27 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Wed Nov 27 21:07:32 UTC 2019

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

Log Message:
Add a hack for qemu/macppc. OF_finddevice calls will crash depending on
the boot loader and kernel being used. This patch allows using
-prom-env qemu_boot_hack=y to disable the lookup.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/powerpc/oea/ofw_autoconf.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

2019-11-27 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Wed Nov 27 21:07:32 UTC 2019

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

Log Message:
Add a hack for qemu/macppc. OF_finddevice calls will crash depending on
the boot loader and kernel being used. This patch allows using
-prom-env qemu_boot_hack=y to disable the lookup.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/powerpc/oea/ofw_autoconf.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_autoconf.c
diff -u src/sys/arch/powerpc/oea/ofw_autoconf.c:1.23 src/sys/arch/powerpc/oea/ofw_autoconf.c:1.24
--- src/sys/arch/powerpc/oea/ofw_autoconf.c:1.23	Wed Nov 21 17:54:42 2018
+++ src/sys/arch/powerpc/oea/ofw_autoconf.c	Wed Nov 27 21:07:32 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ofw_autoconf.c,v 1.23 2018/11/21 17:54:42 scole Exp $ */
+/* $NetBSD: ofw_autoconf.c,v 1.24 2019/11/27 21:07:32 joerg Exp $ */
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
  * Copyright (C) 1995, 1996 TooLs GmbH.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_autoconf.c,v 1.23 2018/11/21 17:54:42 scole Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_autoconf.c,v 1.24 2019/11/27 21:07:32 joerg Exp $");
 
 #ifdef ofppc
 #include "gtpci.h"
@@ -137,10 +137,17 @@ canonicalize_bootpath(void)
 	 *   /pci/mac-io/ata-3@2000/disk@0:0/netbsd.new		(OF-3.x)
 	 */
 	strcpy(cbootpath, bootpath);
-	while ((node = OF_finddevice(cbootpath)) == -1) {
-		if ((p = strrchr(cbootpath, '/')) == NULL)
-			break;
-		*p = '\0';
+
+	if ((node = OF_finddevice("/options")) == -1 ||
+	OF_getprop(node, "qemu_boot_hack", type, sizeof(type) - 1) == -1 ||
+	type[0] != 'y') {
+		while ((node = OF_finddevice(cbootpath)) == -1) {
+			if ((p = strrchr(cbootpath, '/')) == NULL)
+break;
+			*p = '\0';
+		}
+	} else {
+		node = -1;
 	}
 
 	printf("bootpath: %s\n", bootpath);



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

2019-11-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Nov 15 23:43:13 UTC 2019

Modified Files:
src/sys/arch/powerpc/oea: ofw_subr.S

Log Message:
bump OF_buf(fer) since we may put extra parameters in there


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/powerpc/oea/ofw_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/oea/ofw_subr.S
diff -u src/sys/arch/powerpc/oea/ofw_subr.S:1.10 src/sys/arch/powerpc/oea/ofw_subr.S:1.11
--- src/sys/arch/powerpc/oea/ofw_subr.S:1.10	Wed Jul 27 22:04:23 2011
+++ src/sys/arch/powerpc/oea/ofw_subr.S	Fri Nov 15 23:43:12 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw_subr.S,v 1.10 2011/07/27 22:04:23 macallan Exp $	*/
+/*	$NetBSD: ofw_subr.S,v 1.11 2019/11/15 23:43:12 macallan Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -39,7 +39,7 @@
 	.local	OF_buffer
 
 	.lcomm	firmstk,NBPG,16
-	.lcomm	OF_buffer,NBPG,4
+	.lcomm	OF_buffer,NBPG + 36,4
 	.comm	openfirmware_entry,4,4	/* openfirmware entry point */
 	.lcomm	ofwsrsave,64,4		/* openfirmware SR savearea */
 	.comm	ofwmsr,20,4		/* msr & sprg[0-3] used in OF */



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

2019-11-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Nov 15 23:43:13 UTC 2019

Modified Files:
src/sys/arch/powerpc/oea: ofw_subr.S

Log Message:
bump OF_buf(fer) since we may put extra parameters in there


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/powerpc/oea/ofw_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

2019-10-25 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Oct 25 17:17:30 UTC 2019

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

Log Message:
register the IPI before spinning up CPUs, and make sure to do it exactly once
with this, and previous commits, G5s with four CPUs work
tested by Romain Dolbeau


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/sys/arch/powerpc/oea/cpu_subr.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_subr.c
diff -u src/sys/arch/powerpc/oea/cpu_subr.c:1.101 src/sys/arch/powerpc/oea/cpu_subr.c:1.102
--- src/sys/arch/powerpc/oea/cpu_subr.c:1.101	Fri Sep 20 21:27:29 2019
+++ src/sys/arch/powerpc/oea/cpu_subr.c	Fri Oct 25 17:17:30 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.101 2019/09/20 21:27:29 macallan Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.102 2019/10/25 17:17:30 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2001 Matt Thomas.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.101 2019/09/20 21:27:29 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.102 2019/10/25 17:17:30 macallan Exp $");
 
 #include "opt_ppcparam.h"
 #include "opt_ppccache.h"
@@ -452,6 +452,12 @@ cpu_attach_common(device_t self, int id)
 	ci->ci_dev = self;
 	ci->ci_idlespin = cpu_idlespin;
 
+#ifdef MULTIPROCESSOR
+	/* Register IPI Interrupt */
+	if ((ipiops.ppc_establish_ipi) && (id == 0))
+		ipiops.ppc_establish_ipi(IST_LEVEL, IPL_HIGH, NULL);
+#endif
+
 	pvr = mfpvr();
 	vers = (pvr >> 16) & 0x;
 
@@ -1408,10 +1414,6 @@ cpu_spinup(device_t self, struct cpu_inf
 		return -1;
 	}
 
-	/* Register IPI Interrupt */
-	if (ipiops.ppc_establish_ipi)
-		ipiops.ppc_establish_ipi(IST_LEVEL, IPL_HIGH, NULL);
-
 	return 0;
 }
 



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

2019-10-25 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Oct 25 17:17:30 UTC 2019

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

Log Message:
register the IPI before spinning up CPUs, and make sure to do it exactly once
with this, and previous commits, G5s with four CPUs work
tested by Romain Dolbeau


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/sys/arch/powerpc/oea/cpu_subr.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

2019-09-20 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Sep 20 21:27:29 UTC 2019

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

Log Message:
don't enable NAP mode on 7450 CPUs - my Quicksilver has two of those and we
hang hard shortly after boot with NAP enabled, even on UP kernels


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/sys/arch/powerpc/oea/cpu_subr.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_subr.c
diff -u src/sys/arch/powerpc/oea/cpu_subr.c:1.100 src/sys/arch/powerpc/oea/cpu_subr.c:1.101
--- src/sys/arch/powerpc/oea/cpu_subr.c:1.100	Fri Aug  2 05:08:07 2019
+++ src/sys/arch/powerpc/oea/cpu_subr.c	Fri Sep 20 21:27:29 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.100 2019/08/02 05:08:07 macallan Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.101 2019/09/20 21:27:29 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2001 Matt Thomas.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.100 2019/08/02 05:08:07 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.101 2019/09/20 21:27:29 macallan Exp $");
 
 #include "opt_ppcparam.h"
 #include "opt_ppccache.h"
@@ -584,8 +584,11 @@ cpu_setup(device_t self, struct cpu_info
 			hid0 &= ~HID0_BTIC;
 		/* Select NAP mode. */
 		hid0 &= ~HID0_SLEEP;
-		hid0 |= HID0_NAP | HID0_DPM;
-		powersave = 1;
+		/* XXX my quicksilver hangs if nap is enabled */
+		if (vers != MPC7450) {
+			hid0 |= HID0_NAP | HID0_DPM;
+			powersave = 1;
+		}
 		break;
 #endif
 



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

2019-09-20 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Sep 20 21:27:29 UTC 2019

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

Log Message:
don't enable NAP mode on 7450 CPUs - my Quicksilver has two of those and we
hang hard shortly after boot with NAP enabled, even on UP kernels


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/sys/arch/powerpc/oea/cpu_subr.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

2019-08-01 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Aug  2 05:08:07 UTC 2019

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

Log Message:
first step to address PR54331:
poll h->hatch_running for a bit instead of blindly relying on a fixed timeout
for secondary CPUs to wake up and get ready

needs more testing, possibly pullup


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/sys/arch/powerpc/oea/cpu_subr.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_subr.c
diff -u src/sys/arch/powerpc/oea/cpu_subr.c:1.99 src/sys/arch/powerpc/oea/cpu_subr.c:1.100
--- src/sys/arch/powerpc/oea/cpu_subr.c:1.99	Wed Feb  6 07:32:50 2019
+++ src/sys/arch/powerpc/oea/cpu_subr.c	Fri Aug  2 05:08:07 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.99 2019/02/06 07:32:50 mrg Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.100 2019/08/02 05:08:07 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2001 Matt Thomas.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.99 2019/02/06 07:32:50 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.100 2019/08/02 05:08:07 macallan Exp $");
 
 #include "opt_ppcparam.h"
 #include "opt_ppccache.h"
@@ -1381,6 +1381,17 @@ cpu_spinup(device_t self, struct cpu_inf
 	__asm volatile ("dcbst 0,%0"::"r"(>hatch_running):"memory");
 	__asm volatile ("sync; isync");
 #endif
+	int hatch_bail = 0;
+	while ((h->hatch_running < 1) && (hatch_bail < 10)) {
+		delay(1);
+		hatch_bail++;
+#ifdef CACHE_PROTO_MEI
+		__asm volatile ("dcbi 0,%0"::"r"(>hatch_running):"memory");
+		__asm volatile ("sync; isync");
+		__asm volatile ("dcbst 0,%0"::"r"(>hatch_running):"memory");
+		__asm volatile ("sync; isync");
+#endif
+	}
 	if (h->hatch_running < 1) {
 #ifdef CACHE_PROTO_MEI
 		__asm volatile ("dcbi 0,%0"::"r"(_spinstart_ack):"memory");



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

2019-08-01 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Aug  2 05:08:07 UTC 2019

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

Log Message:
first step to address PR54331:
poll h->hatch_running for a bit instead of blindly relying on a fixed timeout
for secondary CPUs to wake up and get ready

needs more testing, possibly pullup


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/sys/arch/powerpc/oea/cpu_subr.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/oea

2013-05-13 Thread Michael
On Mon, 13 May 2013 00:12:01 +
Michael Lorenz macal...@netbsd.org wrote:

 Module Name:  src
 Committed By: macallan
 Date: Mon May 13 00:12:01 UTC 2013
 
 Modified Files:
   src/sys/arch/powerpc/oea: ofwoea_machdep.c
 
 Log Message:
 more G5 stuff:
 - call OF_quiesce()
 - properly map the message buffer

Forgot:
From Phileas Fogg

have fun
Michael


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

2010-11-15 Thread David Holland
On Mon, Nov 15, 2010 at 02:48:29PM +0900, SODA Noriyuki wrote:
  Well, there is another thing which has to be considered.  That is
  name space pollution.
  Header files which are exported to userland (for userland visible APIs)
  should not export random symbols.  Only symbols which are defined as
  the interface of the header file are allowed to be exported.

Indeed. Properly speaking though, headers that are exported to
userland should define only the precise symbols that userland needs;
kernel-only material should be kept elsewhere.

We're a long way from that. Someday I'll clean it all up, but I think
it had better wait until after we get version control that supports
rename.

In the meantime, wrapping in _KERNEL is the best we can do...

-- 
David A. Holland
dholl...@netbsd.org


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

2010-11-15 Thread David Holland
(moving this to tech-kern because it's the right place and per request)

On Mon, Nov 15, 2010 at 11:24:21AM +0900, Masao Uebayashi wrote:
   Every header file should include the things it requires to compile.
   Therefore, there should in principle be no cases where a header file
   (or source file) needs to #include something it doesn't itself use.
  
  This clarifies my long-unanswered question, thanks!

*bow*

  I've (re)built about 300 kernels in the last days.  I've found:
  
  - sys/sysctl.h's struct kinfo_proc should be moved into sys/proc.h
(I've done this locally).  Otherwise all sysctl node providers
includes sys/proc.h and uvm/uvm_extern.h.
(This is where I started...)

I'm not sure this is a good plan in the long run. Shouldn't it at some
point be unhooked fully from the real proc structure?

  - sys/syscallargs.h should be split into pieces, otherwise all its
users have to know unrelated types (sys/mount.h, sys/cpu.h).

Since system calls don't in general pass structures by value, it
shouldn't need most of those header files, just forward declarations
of the structs.

(this is, btw, one of the reasons to avoid silly typedefs)

  - sys/proc.h's tsleep(), wakeup(), and friends should be moved into
some common header, because it's widely used API.  sys/proc.h will
be used only for struct proc related things.

Given that this is a deprecated API in the long term I'm not sure it's
worthwhile.

-- 
David A. Holland
dholl...@netbsd.org


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

2010-11-15 Thread David Laight
On Mon, Nov 15, 2010 at 08:50:34AM +, David Holland wrote:
 On Mon, Nov 15, 2010 at 02:48:29PM +0900, SODA Noriyuki wrote:
   Well, there is another thing which has to be considered.  That is
   name space pollution.
   Header files which are exported to userland (for userland visible APIs)
   should not export random symbols.  Only symbols which are defined as
   the interface of the header file are allowed to be exported.
 
 Indeed. Properly speaking though, headers that are exported to
 userland should define only the precise symbols that userland needs;
 kernel-only material should be kept elsewhere.

One start would be to add a sys/proc_internal.h so that sys/proc
can be reduced to only stuff that userspace and some kernel parts
are really expected to use.

David

-- 
David Laight: da...@l8s.co.uk


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

2010-11-15 Thread Arnaud Lacombe
Hi,

On Mon, Nov 15, 2010 at 5:41 PM, David Laight da...@l8s.co.uk wrote:
 On Mon, Nov 15, 2010 at 08:50:34AM +, David Holland wrote:
 On Mon, Nov 15, 2010 at 02:48:29PM +0900, SODA Noriyuki wrote:
   Well, there is another thing which has to be considered.  That is
   name space pollution.
   Header files which are exported to userland (for userland visible APIs)
   should not export random symbols.  Only symbols which are defined as
   the interface of the header file are allowed to be exported.

 Indeed. Properly speaking though, headers that are exported to
 userland should define only the precise symbols that userland needs;
 kernel-only material should be kept elsewhere.

 One start would be to add a sys/proc_internal.h so that sys/proc
 can be reduced to only stuff that userspace and some kernel parts
 are really expected to use.

For the record, Linux kernels do sanitize their header before
installation. One of the tools (unifdef) used still has a

__IDSTRING(NetBSD, $NetBSD: unifdef.c,v 1.8 2000/07/03 02:51:36 matt Exp $);
and
__FBSDID($FreeBSD: /repoman/r/ncvs/src/usr.bin/unifdef/unifdef.c,v
1.20 2005/05/21 09:55:09 ru Exp $);

so I guess it should already be in the tree, but maybe not the latest
version. It is ran with -U__KERNEL__ by a headers install script,
they wrote it in perl, but there it is not doing anything special
sed(1) would not do.

 - Arnaud


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

2010-11-15 Thread Masao Uebayashi
On Mon, Nov 15, 2010 at 11:24:21AM +0900, Masao Uebayashi wrote:
 On Sun, Nov 14, 2010 at 05:52:51AM +, David Holland wrote:
  On Sun, Nov 14, 2010 at 03:32:44AM +, Masao Uebayashi wrote:
XXX What is the conclusion about direct vs. indirect #include from 
  headers?
  
  Every header file should include the things it requires to compile.
  Therefore, there should in principle be no cases where a header file
  (or source file) needs to #include something it doesn't itself use.
 
 This clarifies my long-unanswered question, thanks!
 
 I've (re)built about 300 kernels in the last days.  I've found:
 
 - sys/sysctl.h's struct kinfo_proc should be moved into sys/proc.h
   (I've done this locally).  Otherwise all sysctl node providers
   includes sys/proc.h and uvm/uvm_extern.h.
   (This is where I started...)
 
 - sys/syscallargs.h should be split into pieces, otherwise all its
   users have to know unrelated types (sys/mount.h, sys/cpu.h).
 
 - sys/proc.h's tsleep(), wakeup(), and friends should be moved into
   some common header, because it's widely used API.  sys/proc.h will
   be used only for struct proc related things.

Another thing:

- We should provide sysconf() for kernel modules (device drivers) too,
  otherwise we have to expose unnecessary symbols (uvmexp).


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

2010-11-15 Thread David Holland
On Tue, Nov 16, 2010 at 10:20:46AM +0900, Masao Uebayashi wrote:
  Another thing:
  
  - We should provide sysconf() for kernel modules (device drivers) too,
otherwise we have to expose unnecessary symbols (uvmexp).

Why not the complete sysctl tree?

-- 
David A. Holland
dholl...@netbsd.org


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

2010-11-14 Thread Masao Uebayashi
On Sun, Nov 14, 2010 at 05:52:51AM +, David Holland wrote:
 On Sun, Nov 14, 2010 at 03:32:44AM +, Masao Uebayashi wrote:
   XXX What is the conclusion about direct vs. indirect #include from headers?
 
 Every header file should include the things it requires to compile.
 Therefore, there should in principle be no cases where a header file
 (or source file) needs to #include something it doesn't itself use.

This clarifies my long-unanswered question, thanks!

I've (re)built about 300 kernels in the last days.  I've found:

- sys/sysctl.h's struct kinfo_proc should be moved into sys/proc.h
  (I've done this locally).  Otherwise all sysctl node providers
  includes sys/proc.h and uvm/uvm_extern.h.
  (This is where I started...)

- sys/syscallargs.h should be split into pieces, otherwise all its
  users have to know unrelated types (sys/mount.h, sys/cpu.h).

- sys/proc.h's tsleep(), wakeup(), and friends should be moved into
  some common header, because it's widely used API.  sys/proc.h will
  be used only for struct proc related things.


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

2010-11-14 Thread Masao Uebayashi
On Mon, Nov 15, 2010 at 11:24:21AM +0900, Masao Uebayashi wrote:
 On Sun, Nov 14, 2010 at 05:52:51AM +, David Holland wrote:
  On Sun, Nov 14, 2010 at 03:32:44AM +, Masao Uebayashi wrote:
XXX What is the conclusion about direct vs. indirect #include from 
  headers?
  
  Every header file should include the things it requires to compile.
  Therefore, there should in principle be no cases where a header file
  (or source file) needs to #include something it doesn't itself use.
 
 This clarifies my long-unanswered question, thanks!
 
 I've (re)built about 300 kernels in the last days.  I've found:
 
 - sys/sysctl.h's struct kinfo_proc should be moved into sys/proc.h
   (I've done this locally).  Otherwise all sysctl node providers
   includes sys/proc.h and uvm/uvm_extern.h.
   (This is where I started...)
 
 - sys/syscallargs.h should be split into pieces, otherwise all its
   users have to know unrelated types (sys/mount.h, sys/cpu.h).
 
 - sys/proc.h's tsleep(), wakeup(), and friends should be moved into
   some common header, because it's widely used API.  sys/proc.h will
   be used only for struct proc related things.

Note that none of ltsleep(), tsleep(), and wakeup() use struct proc as
part of interface.


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

2010-11-14 Thread SODA Noriyuki
 On Sun, 14 Nov 2010 05:52:51 +,
David Holland dholland-sourcechan...@netbsd.org said:

 On Sun, Nov 14, 2010 at 03:32:44AM +, Masao Uebayashi wrote:
 XXX What is the conclusion about direct vs. indirect #include from headers?
 
 Every header file should include the things it requires to compile.
 Therefore, there should in principle be no cases where a header file
 (or source file) needs to #include something it doesn't itself use.

Well, there is another thing which has to be considered.  That is
name space pollution.
Header files which are exported to userland (for userland visible APIs)
should not export random symbols.  Only symbols which are defined as
the interface of the header file are allowed to be exported.

It seems the sys/param.h change is safe about this point though,
because all definitions of the uvm_param.h seem to be protected
by defined(_KERNEL).
-- 
soda


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

2010-11-14 Thread Bernd Ernesti
On Mon, Nov 15, 2010 at 11:24:21AM +0900, Masao Uebayashi wrote:
 On Sun, Nov 14, 2010 at 05:52:51AM +, David Holland wrote:
  On Sun, Nov 14, 2010 at 03:32:44AM +, Masao Uebayashi wrote:
XXX What is the conclusion about direct vs. indirect #include from 
  headers?
  
  Every header file should include the things it requires to compile.
  Therefore, there should in principle be no cases where a header file
  (or source file) needs to #include something it doesn't itself use.
 
 This clarifies my long-unanswered question, thanks!
 
 I've (re)built about 300 kernels in the last days.  I've found:
 
 - sys/sysctl.h's struct kinfo_proc should be moved into sys/proc.h
   (I've done this locally).  Otherwise all sysctl node providers
   includes sys/proc.h and uvm/uvm_extern.h.
   (This is where I started...)
 
 - sys/syscallargs.h should be split into pieces, otherwise all its
   users have to know unrelated types (sys/mount.h, sys/cpu.h).
 
 - sys/proc.h's tsleep(), wakeup(), and friends should be moved into
   some common header, because it's widely used API.  sys/proc.h will
   be used only for struct proc related things.

What are the issues here that we need to fix this right now?

Can you please post changes and/or start a thread about all this
before you do them on tech-kern?

Bernd



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

2010-11-14 Thread Adam Hamsik

On Nov,Monday 15 2010, at 7:16 AM, Bernd Ernesti wrote:

 On Mon, Nov 15, 2010 at 11:24:21AM +0900, Masao Uebayashi wrote:
 On Sun, Nov 14, 2010 at 05:52:51AM +, David Holland wrote:
 On Sun, Nov 14, 2010 at 03:32:44AM +, Masao Uebayashi wrote:
 XXX What is the conclusion about direct vs. indirect #include from headers?
 
 Every header file should include the things it requires to compile.
 Therefore, there should in principle be no cases where a header file
 (or source file) needs to #include something it doesn't itself use.
 
 This clarifies my long-unanswered question, thanks!
 
 I've (re)built about 300 kernels in the last days.  I've found:
 
 - sys/sysctl.h's struct kinfo_proc should be moved into sys/proc.h
  (I've done this locally).  Otherwise all sysctl node providers
  includes sys/proc.h and uvm/uvm_extern.h.
  (This is where I started...)
 
 - sys/syscallargs.h should be split into pieces, otherwise all its
  users have to know unrelated types (sys/mount.h, sys/cpu.h).
 
 - sys/proc.h's tsleep(), wakeup(), and friends should be moved into
  some common header, because it's widely used API.  sys/proc.h will
  be used only for struct proc related things.
 
 What are the issues here that we need to fix this right now?

I think that it's quite good time to fix, it would be much harder to do this 
after 6.0 branch.

Regards

Adam.



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

2010-11-13 Thread David Holland
On Sun, Nov 14, 2010 at 03:32:44AM +, Masao Uebayashi wrote:
  XXX What is the conclusion about direct vs. indirect #include from headers?

Every header file should include the things it requires to compile.
Therefore, there should in principle be no cases where a header file
(or source file) needs to #include something it doesn't itself use.

-- 
David A. Holland
dholl...@netbsd.org


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

2010-03-10 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Wed Mar 10 18:36:05 UTC 2010

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

Log Message:
Remove white-spaces.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/powerpc/oea/ofw_consinit.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/powerpc/oea/ofw_rascons.c
cvs rdiff -u -r1.18 -r1.19 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

2010-01-20 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jan 20 16:36:55 UTC 2010

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

Log Message:
pass some OF properties as device properties for network devices
namely local-mac-address and shared-pins needed by gem


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/powerpc/oea/ofw_autoconf.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

2010-01-17 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sun Jan 17 16:47:17 UTC 2010

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

Log Message:
Heed modeldata.ranges_offset while constructing the ranges bitmap.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 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.