CVS commit: src/sys/arch/arm/arm32

2024-04-13 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Apr 13 12:28:01 UTC 2024

Modified Files:
src/sys/arch/arm/arm32: pmap.c

Log Message:
port-arm/58135: reproducible pmap KASSERT failure for armv7 with NFS root

Don't unconditionally set XN in pmap_clearbit - only set it if a mapping
exists VM_PROT_EXEC is being cleared.

I've simplified the #ifdefs in the patch from the PR.


To generate a diff of this commit:
cvs rdiff -u -r1.442 -r1.443 src/sys/arch/arm/arm32/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/arm/arm32/pmap.c
diff -u src/sys/arch/arm/arm32/pmap.c:1.442 src/sys/arch/arm/arm32/pmap.c:1.443
--- src/sys/arch/arm/arm32/pmap.c:1.442	Sat Apr 13 10:36:01 2024
+++ src/sys/arch/arm/arm32/pmap.c	Sat Apr 13 12:28:01 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.442 2024/04/13 10:36:01 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.443 2024/04/13 12:28:01 skrll Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -193,7 +193,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.442 2024/04/13 10:36:01 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.443 2024/04/13 12:28:01 skrll Exp $");
 
 #include 
 #include 
@@ -2330,15 +2330,10 @@ pmap_clearbit(struct vm_page_md *md, pad
 #ifdef PMAP_CACHE_VIPT
 	const bool want_syncicache = PV_IS_EXEC_P(md->pvh_attrs);
 	bool need_syncicache = false;
-#ifdef ARM_MMU_EXTENDED
-	const u_int execbits = (maskbits & PVF_EXEC) ? L2_XS_XN : 0;
-#else
-	const u_int execbits = 0;
+#ifndef ARM_MMU_EXTENDED
 	bool need_vac_me_harder = false;
 #endif
-#else
-	const u_int execbits = 0;
-#endif
+#endif /* PMAP_CACHE_VIPT */
 
 	UVMHIST_FUNC(__func__);
 	UVMHIST_CALLARGS(maphist, "md %#jx pa %#jx maskbits %#jx",
@@ -2421,9 +2416,14 @@ pmap_clearbit(struct vm_page_md *md, pad
 
 		pt_entry_t * const ptep = >l2b_kva[l2pte_index(va)];
 		const pt_entry_t opte = *ptep;
-		pt_entry_t npte = opte | execbits;
+		pt_entry_t npte = opte;
+
+#if defined(ARM_MMU_EXTENDED)
+		if ((maskbits & PVF_EXEC) != 0 && l2pte_valid_p(opte)) {
+			KASSERT((opte & L2_TYPE_S) != 0);
+			npte |= L2_XS_XN;
+		}
 
-#ifdef ARM_MMU_EXTENDED
 		KASSERT((opte & L2_XS_nG) == (pm == pmap_kernel() ? 0 : L2_XS_nG));
 #endif
 



CVS commit: src/sys/arch/arm/arm32

2024-04-13 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Apr 13 12:28:01 UTC 2024

Modified Files:
src/sys/arch/arm/arm32: pmap.c

Log Message:
port-arm/58135: reproducible pmap KASSERT failure for armv7 with NFS root

Don't unconditionally set XN in pmap_clearbit - only set it if a mapping
exists VM_PROT_EXEC is being cleared.

I've simplified the #ifdefs in the patch from the PR.


To generate a diff of this commit:
cvs rdiff -u -r1.442 -r1.443 src/sys/arch/arm/arm32/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/arm/arm32

2024-04-13 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Apr 13 10:36:01 UTC 2024

Modified Files:
src/sys/arch/arm/arm32: pmap.c

Log Message:
Restore a space I accidentally removed from a copyright with

$NetBSD: pmap.c,v 1.396 2020/03/13 16:14:18 skrll Exp $


To generate a diff of this commit:
cvs rdiff -u -r1.441 -r1.442 src/sys/arch/arm/arm32/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/arm/arm32/pmap.c
diff -u src/sys/arch/arm/arm32/pmap.c:1.441 src/sys/arch/arm/arm32/pmap.c:1.442
--- src/sys/arch/arm/arm32/pmap.c:1.441	Wed Dec 13 06:42:40 2023
+++ src/sys/arch/arm/arm32/pmap.c	Sat Apr 13 10:36:01 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.441 2023/12/13 06:42:40 rin Exp $	*/
+/*	$NetBSD: pmap.c,v 1.442 2024/04/13 10:36:01 skrll Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -47,7 +47,7 @@
  *notice, this list of conditions and the following disclaimer in the
  *documentation and/or other materials provided with the distribution.
  * 3. The name of the company nor the name of the author may be used to
- *   endorse or promote products derived from this software without specific
+ *endorse or promote products derived from this software without specific
  *prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
@@ -193,7 +193,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.441 2023/12/13 06:42:40 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.442 2024/04/13 10:36:01 skrll Exp $");
 
 #include 
 #include 



CVS commit: src/sys/arch/arm/arm32

2024-04-13 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Apr 13 10:36:01 UTC 2024

Modified Files:
src/sys/arch/arm/arm32: pmap.c

Log Message:
Restore a space I accidentally removed from a copyright with

$NetBSD: pmap.c,v 1.396 2020/03/13 16:14:18 skrll Exp $


To generate a diff of this commit:
cvs rdiff -u -r1.441 -r1.442 src/sys/arch/arm/arm32/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/arm/arm32

2024-01-15 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Mon Jan 15 20:35:23 UTC 2024

Modified Files:
src/sys/arch/arm/arm32: vm_machdep.c

Log Message:
Include  with "#ifdef STACKCHECKS" guard.

The include was lost on rev 1.77 during includes cleanup and KNF, however
it is still needed with STACKCHECKS build option.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/arch/arm/arm32/vm_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/arm/arm32/vm_machdep.c
diff -u src/sys/arch/arm/arm32/vm_machdep.c:1.78 src/sys/arch/arm/arm32/vm_machdep.c:1.79
--- src/sys/arch/arm/arm32/vm_machdep.c:1.78	Sun Mar 28 10:29:05 2021
+++ src/sys/arch/arm/arm32/vm_machdep.c	Mon Jan 15 20:35:22 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.78 2021/03/28 10:29:05 skrll Exp $	*/
+/*	$NetBSD: vm_machdep.c,v 1.79 2024/01/15 20:35:22 andvar Exp $	*/
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -44,7 +44,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.78 2021/03/28 10:29:05 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.79 2024/01/15 20:35:22 andvar Exp $");
 
 #include "opt_armfpe.h"
 #include "opt_cputypes.h"
@@ -55,6 +55,9 @@ __KERNEL_RCSID(0, "$NetBSD: vm_machdep.c
 #include 
 #include 
 #include 
+#ifdef STACKCHECKS
+#include 
+#endif
 #include 
 #include 
 



CVS commit: src/sys/arch/arm/arm32

2024-01-15 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Mon Jan 15 20:35:23 UTC 2024

Modified Files:
src/sys/arch/arm/arm32: vm_machdep.c

Log Message:
Include  with "#ifdef STACKCHECKS" guard.

The include was lost on rev 1.77 during includes cleanup and KNF, however
it is still needed with STACKCHECKS build option.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/arch/arm/arm32/vm_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/arm/arm32

2023-12-12 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Dec 13 06:42:41 UTC 2023

Modified Files:
src/sys/arch/arm/arm32: pmap.c

Log Message:
arm: pmap: Fix clang build without DIAGNOSTIC


To generate a diff of this commit:
cvs rdiff -u -r1.440 -r1.441 src/sys/arch/arm/arm32/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/arm/arm32/pmap.c
diff -u src/sys/arch/arm/arm32/pmap.c:1.440 src/sys/arch/arm/arm32/pmap.c:1.441
--- src/sys/arch/arm/arm32/pmap.c:1.440	Thu Oct 12 11:33:37 2023
+++ src/sys/arch/arm/arm32/pmap.c	Wed Dec 13 06:42:40 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.440 2023/10/12 11:33:37 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.441 2023/12/13 06:42:40 rin Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -193,7 +193,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.440 2023/10/12 11:33:37 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.441 2023/12/13 06:42:40 rin Exp $");
 
 #include 
 #include 
@@ -547,7 +547,7 @@ pmap_release_page_lock(struct vm_page_md
 	mutex_exit(_lock);
 }
 
-static inline int
+static inline int __diagused
 pmap_page_locked_p(struct vm_page_md *md)
 {
 	return mutex_owned(_lock);



CVS commit: src/sys/arch/arm/arm32

2023-12-12 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Dec 13 06:42:41 UTC 2023

Modified Files:
src/sys/arch/arm/arm32: pmap.c

Log Message:
arm: pmap: Fix clang build without DIAGNOSTIC


To generate a diff of this commit:
cvs rdiff -u -r1.440 -r1.441 src/sys/arch/arm/arm32/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/arm/arm32

2023-10-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct  6 09:53:02 UTC 2023

Modified Files:
src/sys/arch/arm/arm32: fault.c

Log Message:
Fix previous and restore setting of "user" flag from trapframe.


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/sys/arch/arm/arm32/fault.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/arm/arm32/fault.c
diff -u src/sys/arch/arm/arm32/fault.c:1.117 src/sys/arch/arm/arm32/fault.c:1.118
--- src/sys/arch/arm/arm32/fault.c:1.117	Thu Oct  5 19:41:03 2023
+++ src/sys/arch/arm/arm32/fault.c	Fri Oct  6 09:53:02 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: fault.c,v 1.117 2023/10/05 19:41:03 ad Exp $	*/
+/*	$NetBSD: fault.c,v 1.118 2023/10/06 09:53:02 martin Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.117 2023/10/05 19:41:03 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.118 2023/10/06 09:53:02 martin Exp $");
 
 #include 
 
@@ -819,13 +819,14 @@ prefetch_abort_handler(trapframe_t *tf)
 
 	l = curlwp;
 	pcb = lwp_getpcb(l);
+	user = TRAP_USERMODE(tf) != 0;
 
 	/*
 	 * Enable IRQ's (disabled by the abort) This always comes
 	 * from user mode so we know interrupts were not disabled.
 	 * But we check anyway.
 	 */
-	KASSERT(!TRAP_USERMODE(tf) || VALID_PSR(tf->tf_spsr));
+	KASSERT(!user || VALID_PSR(tf->tf_spsr));
 #ifdef __NO_FIQ
 	if (__predict_true((tf->tf_spsr & I32_bit) != I32_bit))
 		restore_interrupts(tf->tf_spsr & IF32_bits);



CVS commit: src/sys/arch/arm/arm32

2023-10-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Oct  6 09:53:02 UTC 2023

Modified Files:
src/sys/arch/arm/arm32: fault.c

Log Message:
Fix previous and restore setting of "user" flag from trapframe.


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

2023-08-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Aug  2 14:36:40 UTC 2023

Modified Files:
src/sys/arch/arm/arm32: db_interface.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/arm/arm32/db_interface.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/arm/arm32/db_interface.c
diff -u src/sys/arch/arm/arm32/db_interface.c:1.64 src/sys/arch/arm/arm32/db_interface.c:1.65
--- src/sys/arch/arm/arm32/db_interface.c:1.64	Wed Oct 26 23:38:06 2022
+++ src/sys/arch/arm/arm32/db_interface.c	Wed Aug  2 14:36:39 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_interface.c,v 1.64 2022/10/26 23:38:06 riastradh Exp $	*/
+/*	$NetBSD: db_interface.c,v 1.65 2023/08/02 14:36:39 skrll Exp $	*/
 
 /*
  * Copyright (c) 1996 Scott K. Stevens
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.64 2022/10/26 23:38:06 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.65 2023/08/02 14:36:39 skrll Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -276,10 +276,10 @@ db_write_bytes(vaddr_t addr, size_t size
 	}
 
 	if (size == 4 && (addr & 3) == 0 && ((uintptr_t)data & 3) == 0)
-		*((int*)dst) = *((const int *)data);
+		*((int *)dst) = *((const int *)data);
 	else
 	if (size == 2 && (addr & 1) == 0 && ((uintptr_t)data & 1) == 0)
-		*((short*)dst) = *((const short *)data);
+		*((short *)dst) = *((const short *)data);
 	else {
 		loop = size;
 		while (loop-- > 0) {



CVS commit: src/sys/arch/arm/arm32

2023-08-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Aug  2 14:36:40 UTC 2023

Modified Files:
src/sys/arch/arm/arm32: db_interface.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/arm/arm32/db_interface.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/arm/arm32

2023-07-28 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Jul 28 06:21:02 UTC 2023

Modified Files:
src/sys/arch/arm/arm32: bus_dma.c

Log Message:
arm/bus_dma: Fix misleading comment:

- * For a virtually-indexed write-back cache, we need
- * to do the following things:
+ * For a write-back cache, we need to do the following things:

This comment was written long ago when we supported only virtually-
indexed caches for arm. But subsequent comments are valid also for
physically-indexed cache.


To generate a diff of this commit:
cvs rdiff -u -r1.143 -r1.144 src/sys/arch/arm/arm32/bus_dma.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/arm/arm32/bus_dma.c
diff -u src/sys/arch/arm/arm32/bus_dma.c:1.143 src/sys/arch/arm/arm32/bus_dma.c:1.144
--- src/sys/arch/arm/arm32/bus_dma.c:1.143	Mon Apr  3 06:42:57 2023
+++ src/sys/arch/arm/arm32/bus_dma.c	Fri Jul 28 06:21:02 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.143 2023/04/03 06:42:57 skrll Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.144 2023/07/28 06:21:02 rin Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2020 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include "opt_cputypes.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.143 2023/04/03 06:42:57 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.144 2023/07/28 06:21:02 rin Exp $");
 
 #include 
 
@@ -1114,8 +1114,7 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dm
 	len, offset, map->dm_mapsize);
 
 	/*
-	 * For a virtually-indexed write-back cache, we need
-	 * to do the following things:
+	 * For a write-back cache, we need to do the following things:
 	 *
 	 *	PREREAD -- Invalidate the D-cache.  We do this
 	 *	here in case a write-back is required by the back-end.



CVS commit: src/sys/arch/arm/arm32

2023-07-28 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Jul 28 06:21:02 UTC 2023

Modified Files:
src/sys/arch/arm/arm32: bus_dma.c

Log Message:
arm/bus_dma: Fix misleading comment:

- * For a virtually-indexed write-back cache, we need
- * to do the following things:
+ * For a write-back cache, we need to do the following things:

This comment was written long ago when we supported only virtually-
indexed caches for arm. But subsequent comments are valid also for
physically-indexed cache.


To generate a diff of this commit:
cvs rdiff -u -r1.143 -r1.144 src/sys/arch/arm/arm32/bus_dma.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/arm/arm32

2023-04-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Apr  3 06:42:57 UTC 2023

Modified Files:
src/sys/arch/arm/arm32: bus_dma.c

Log Message:
Use PRI{u,x}{BUSSIZE,VADDR,PADDR} etc


To generate a diff of this commit:
cvs rdiff -u -r1.142 -r1.143 src/sys/arch/arm/arm32/bus_dma.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/arm/arm32/bus_dma.c
diff -u src/sys/arch/arm/arm32/bus_dma.c:1.142 src/sys/arch/arm/arm32/bus_dma.c:1.143
--- src/sys/arch/arm/arm32/bus_dma.c:1.142	Mon Apr  3 06:39:10 2023
+++ src/sys/arch/arm/arm32/bus_dma.c	Mon Apr  3 06:42:57 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.142 2023/04/03 06:39:10 skrll Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.143 2023/04/03 06:42:57 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2020 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include "opt_cputypes.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.142 2023/04/03 06:39:10 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.143 2023/04/03 06:42:57 skrll Exp $");
 
 #include 
 
@@ -184,7 +184,7 @@ _bus_dma_busaddr_to_paddr(bus_dma_tag_t 
 		&& curaddr < dr->dr_busbase + dr->dr_len)
 			return curaddr - dr->dr_busbase + dr->dr_sysbase;
 	}
-	panic("%s: curaddr %#lx not in range", __func__, curaddr);
+	panic("%s: curaddr %#" PRIxBUSADDR "not in range", __func__, curaddr);
 }
 
 /*
@@ -538,7 +538,7 @@ _bus_dmamap_load(bus_dma_tag_t t, bus_dm
 	map->dm_nsegs = 0;
 	map->_dm_buftype = _BUS_DMA_BUFTYPE_INVALID;
 	KASSERTMSG(map->dm_maxsegsz <= map->_dm_maxmaxsegsz,
-	"dm_maxsegsz %lu _dm_maxmaxsegsz %lu",
+	"dm_maxsegsz %" PRIuBUSSIZE " _dm_maxmaxsegsz %" PRIuBUSSIZE,
 	map->dm_maxsegsz, map->_dm_maxmaxsegsz);
 
 	if (buflen > map->_dm_size)
@@ -612,7 +612,7 @@ _bus_dmamap_load_mbuf(bus_dma_tag_t t, b
 	map->dm_nsegs = 0;
 	map->_dm_buftype = _BUS_DMA_BUFTYPE_INVALID;
 	KASSERTMSG(map->dm_maxsegsz <= map->_dm_maxmaxsegsz,
-	"dm_maxsegsz %lu _dm_maxmaxsegsz %lu",
+	"dm_maxsegsz %" PRIuBUSSIZE " _dm_maxmaxsegsz %" PRIuBUSSIZE,
 	map->dm_maxsegsz, map->_dm_maxmaxsegsz);
 
 	KASSERT(m0->m_flags & M_PKTHDR);
@@ -739,7 +739,7 @@ _bus_dmamap_load_uio(bus_dma_tag_t t, bu
 	map->dm_mapsize = 0;
 	map->dm_nsegs = 0;
 	KASSERTMSG(map->dm_maxsegsz <= map->_dm_maxmaxsegsz,
-	"dm_maxsegsz %lu _dm_maxmaxsegsz %lu",
+	"dm_maxsegsz %" PRIuBUSSIZE " _dm_maxmaxsegsz %" PRIuBUSSIZE,
 	map->dm_maxsegsz, map->_dm_maxmaxsegsz);
 
 	resid = uio->uio_resid;
@@ -868,7 +868,7 @@ _bus_dmamap_sync_segment(vaddr_t va, pad
 #endif
 
 	KASSERTMSG((va & PAGE_MASK) == (pa & PAGE_MASK),
-	"va %#lx pa %#lx", va, pa);
+	"va %#" PRIxVADDR " pa %#" PRIxPADDR, va, pa);
 #if 0
 	printf("sync_segment: va=%#lx pa=%#lx len=%#lx ops=%#x ro=%d\n",
 	va, pa, len, ops, readonly_p);
@@ -1107,10 +1107,10 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dm
 		panic("%s: mix PRE and POST", __func__);
 
 	KASSERTMSG(offset < map->dm_mapsize,
-	"offset %lu mapsize %lu",
+	"offset %" PRIxBUSADDR " mapsize %" PRIuBUSSIZE,
 	offset, map->dm_mapsize);
 	KASSERTMSG(len > 0 && offset + len <= map->dm_mapsize,
-	"len %lu offset %lu mapsize %lu",
+	"len %" PRIuBUSSIZE " offset %" PRIxBUSADDR " mapsize %" PRIuBUSSIZE,
 	len, offset, map->dm_mapsize);
 
 	/*
@@ -1694,7 +1694,7 @@ _bus_dmamem_alloc_range(bus_dma_tag_t t,
 	int curseg, error;
 
 	KASSERTMSG(boundary == 0 || (boundary & (boundary - 1)) == 0,
-	"invalid boundary %#lx", boundary);
+	"invalid boundary %#" PRIxBUSSIZE, boundary);
 
 #ifdef DEBUG_DMA
 	printf("alloc_range: t=%p size=%#lx align=%#lx boundary=%#lx segs=%p nsegs=%#x rsegs=%p flags=%#x lo=%#lx hi=%#lx\n",
@@ -1743,8 +1743,10 @@ _bus_dmamem_alloc_range(bus_dma_tag_t t,
 	for (; m != NULL; m = TAILQ_NEXT(m, pageq.queue)) {
 		curaddr = VM_PAGE_TO_PHYS(m);
 		KASSERTMSG(low <= curaddr && curaddr < high,
-		"uvm_pglistalloc returned non-sensicaladdress %#lx "
-		"(low=%#lx, high=%#lx\n", curaddr, low, high);
+		"uvm_pglistalloc returned non-sensical "
+		"address %#" PRIxPADDR "(low=%#" PRIxPADDR
+		", high=%#" PRIxPADDR "\n",
+		curaddr, low, high);
 #ifdef DEBUG_DMA
 		printf("alloc: page %#lx\n", curaddr);
 #endif	/* DEBUG_DMA */



CVS commit: src/sys/arch/arm/arm32

2023-04-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Apr  3 06:42:57 UTC 2023

Modified Files:
src/sys/arch/arm/arm32: bus_dma.c

Log Message:
Use PRI{u,x}{BUSSIZE,VADDR,PADDR} etc


To generate a diff of this commit:
cvs rdiff -u -r1.142 -r1.143 src/sys/arch/arm/arm32/bus_dma.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/arm/arm32

2023-04-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Apr  3 06:39:10 UTC 2023

Modified Files:
src/sys/arch/arm/arm32: bus_dma.c

Log Message:
More KNF


To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.142 src/sys/arch/arm/arm32/bus_dma.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/arm/arm32/bus_dma.c
diff -u src/sys/arch/arm/arm32/bus_dma.c:1.141 src/sys/arch/arm/arm32/bus_dma.c:1.142
--- src/sys/arch/arm/arm32/bus_dma.c:1.141	Mon Apr  3 06:35:13 2023
+++ src/sys/arch/arm/arm32/bus_dma.c	Mon Apr  3 06:39:10 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.141 2023/04/03 06:35:13 skrll Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.142 2023/04/03 06:39:10 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2020 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include "opt_cputypes.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.141 2023/04/03 06:35:13 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.142 2023/04/03 06:39:10 skrll Exp $");
 
 #include 
 
@@ -875,7 +875,7 @@ _bus_dmamap_sync_segment(vaddr_t va, pad
 #endif
 
 	switch (ops) {
-	case BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE:
+	case BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE:
 		if (!readonly_p) {
 			STAT_INCR(sync_prereadwrite);
 			cpu_dcache_wbinv_range(va, len);
@@ -932,7 +932,7 @@ _bus_dmamap_sync_segment(vaddr_t va, pad
 	 * Since these can't be dirty, we can just invalidate them and don't
 	 * have to worry about having to write back their contents.
 	 */
-	case BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE:
+	case BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE:
 		STAT_INCR(sync_postreadwrite);
 		cpu_dcache_inv_range(va, len);
 		cpu_sdcache_inv_range(va, pa, len);
@@ -1102,8 +1102,8 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dm
 	/*
 	 * Mixing of PRE and POST operations is not allowed.
 	 */
-	if ((ops & (BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE)) != 0 &&
-	(ops & (BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE)) != 0)
+	if ((ops & (BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE)) != 0 &&
+	(ops & (BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE)) != 0)
 		panic("%s: mix PRE and POST", __func__);
 
 	KASSERTMSG(offset < map->dm_mapsize,
@@ -1121,7 +1121,7 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dm
 	 *	here in case a write-back is required by the back-end.
 	 *
 	 *	PREWRITE -- Write-back the D-cache.  Note that if
-	 *	we are doing a PREREAD|PREWRITE, we can collapse
+	 *	we are doing a PREREAD | PREWRITE, we can collapse
 	 *	the whole thing into a single Wb-Inv.
 	 *
 	 *	POSTREAD -- Re-invalidate the D-cache in case speculative
@@ -1136,9 +1136,9 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dm
 	const bool bouncing = false;
 #endif
 
-	const int pre_ops = ops & (BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
+	const int pre_ops = ops & (BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 #if defined(CPU_CORTEX) || defined(CPU_ARMV8)
-	const int post_ops = ops & (BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE);
+	const int post_ops = ops & (BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
 #else
 	const int post_ops = 0;
 #endif
@@ -1199,7 +1199,7 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dm
 	/* Skip cache frobbing if mapping was COHERENT */
 	if ((map->_dm_flags & _BUS_DMAMAP_COHERENT)) {
 		switch (ops) {
-		case BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE:
+		case BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE:
 			STAT_INCR(sync_coherent_prereadwrite);
 			break;
 
@@ -1211,7 +1211,7 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dm
 			STAT_INCR(sync_coherent_prewrite);
 			break;
 
-		case BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE:
+		case BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE:
 			STAT_INCR(sync_coherent_postreadwrite);
 			break;
 



CVS commit: src/sys/arch/arm/arm32

2023-04-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Apr  3 06:39:10 UTC 2023

Modified Files:
src/sys/arch/arm/arm32: bus_dma.c

Log Message:
More KNF


To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.142 src/sys/arch/arm/arm32/bus_dma.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/arm/arm32

2023-04-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Apr  3 06:35:14 UTC 2023

Modified Files:
src/sys/arch/arm/arm32: bus_dma.c

Log Message:
Some KNF


To generate a diff of this commit:
cvs rdiff -u -r1.140 -r1.141 src/sys/arch/arm/arm32/bus_dma.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/arm/arm32

2023-04-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Apr  3 06:35:14 UTC 2023

Modified Files:
src/sys/arch/arm/arm32: bus_dma.c

Log Message:
Some KNF


To generate a diff of this commit:
cvs rdiff -u -r1.140 -r1.141 src/sys/arch/arm/arm32/bus_dma.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/arm/arm32/bus_dma.c
diff -u src/sys/arch/arm/arm32/bus_dma.c:1.140 src/sys/arch/arm/arm32/bus_dma.c:1.141
--- src/sys/arch/arm/arm32/bus_dma.c:1.140	Mon Apr  3 06:33:55 2023
+++ src/sys/arch/arm/arm32/bus_dma.c	Mon Apr  3 06:35:13 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.140 2023/04/03 06:33:55 skrll Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.141 2023/04/03 06:35:13 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2020 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include "opt_cputypes.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.140 2023/04/03 06:33:55 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.141 2023/04/03 06:35:13 skrll Exp $");
 
 #include 
 
@@ -384,7 +384,7 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_
 	map->_dm_segcnt = nsegments;
 	map->_dm_maxmaxsegsz = maxsegsz;
 	map->_dm_boundary = boundary;
-	map->_dm_flags = flags & ~(BUS_DMA_WAITOK|BUS_DMA_NOWAIT);
+	map->_dm_flags = flags & ~(BUS_DMA_WAITOK | BUS_DMA_NOWAIT);
 	map->_dm_origbuf = NULL;
 	map->_dm_buftype = _BUS_DMA_BUFTYPE_INVALID;
 	map->_dm_vmspace = vmspace_kernel();
@@ -640,8 +640,8 @@ _bus_dmamap_load_mbuf(bus_dma_tag_t t, b
 			error = EFAULT;
 			break;
 		}
-		switch (m->m_flags & (M_EXT|M_EXT_CLUSTER|M_EXT_PAGES)) {
-		case M_EXT|M_EXT_CLUSTER:
+		switch (m->m_flags & (M_EXT | M_EXT_CLUSTER | M_EXT_PAGES)) {
+		case M_EXT | M_EXT_CLUSTER:
 			/* XXX KDASSERT */
 			KASSERT(m->m_ext.ext_paddr != M_PADDR_INVALID);
 			paddr = m->m_ext.ext_paddr +
@@ -651,7 +651,7 @@ _bus_dmamap_load_mbuf(bus_dma_tag_t t, b
 			false);
 			break;
 
-		case M_EXT|M_EXT_PAGES:
+		case M_EXT | M_EXT_PAGES:
 			KASSERT(m->m_ext.ext_buf <= m->m_data);
 			KASSERT(m->m_data <=
 			m->m_ext.ext_buf + m->m_ext.ext_size);



CVS commit: src/sys/arch/arm/arm32

2023-04-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Apr  3 06:33:55 UTC 2023

Modified Files:
src/sys/arch/arm/arm32: bus_dma.c

Log Message:
spaces -> TAB


To generate a diff of this commit:
cvs rdiff -u -r1.139 -r1.140 src/sys/arch/arm/arm32/bus_dma.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/arm/arm32/bus_dma.c
diff -u src/sys/arch/arm/arm32/bus_dma.c:1.139 src/sys/arch/arm/arm32/bus_dma.c:1.140
--- src/sys/arch/arm/arm32/bus_dma.c:1.139	Sat Feb 25 08:05:46 2023
+++ src/sys/arch/arm/arm32/bus_dma.c	Mon Apr  3 06:33:55 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.139 2023/02/25 08:05:46 skrll Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.140 2023/04/03 06:33:55 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2020 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include "opt_cputypes.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.139 2023/02/25 08:05:46 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.140 2023/04/03 06:33:55 skrll Exp $");
 
 #include 
 
@@ -259,7 +259,7 @@ _bus_dmamap_load_paddr(bus_dma_tag_t t, 
 	((segs[nseg - 1]._ds_flags ^ _ds_flags) & _BUS_DMAMAP_COHERENT) == 0 &&
 	(map->_dm_boundary == 0 ||
 	 (segs[nseg - 1].ds_addr & bmask) == (curaddr & bmask))) {
-	 	/* coalesce */
+		/* coalesce */
 		segs[nseg - 1].ds_len += sgsize;
 	} else if (nseg >= map->_dm_segcnt) {
 		return EFBIG;



CVS commit: src/sys/arch/arm/arm32

2023-04-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Apr  3 06:33:55 UTC 2023

Modified Files:
src/sys/arch/arm/arm32: bus_dma.c

Log Message:
spaces -> TAB


To generate a diff of this commit:
cvs rdiff -u -r1.139 -r1.140 src/sys/arch/arm/arm32/bus_dma.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/arm/arm32

2023-03-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Mar  1 08:17:53 UTC 2023

Modified Files:
src/sys/arch/arm/arm32: cpuswitch.S

Log Message:
arm32: Optimization: Omit needless membar when triggering softint.

When we are triggering a softint, it can't already hold any mutexes.
So any path to mutex_exit(mtx) must go via mutex_enter(mtx), which is
always done with atomic r/m/w, and we need not issue any explicit
barrier between ci->ci_curlwp = softlwp and a potential load of
mtx->mtx_owner in mutex_exit.

PR kern/57240

XXX pullup-8
XXX pullup-9
XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/sys/arch/arm/arm32/cpuswitch.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/arm/arm32/cpuswitch.S
diff -u src/sys/arch/arm/arm32/cpuswitch.S:1.106 src/sys/arch/arm/arm32/cpuswitch.S:1.107
--- src/sys/arch/arm/arm32/cpuswitch.S:1.106	Thu Feb 23 14:55:25 2023
+++ src/sys/arch/arm/arm32/cpuswitch.S	Wed Mar  1 08:17:53 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpuswitch.S,v 1.106 2023/02/23 14:55:25 riastradh Exp $	*/
+/*	$NetBSD: cpuswitch.S,v 1.107 2023/03/01 08:17:53 riastradh Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -87,7 +87,7 @@
 #include 
 #include 
 
-	RCSID("$NetBSD: cpuswitch.S,v 1.106 2023/02/23 14:55:25 riastradh Exp $")
+	RCSID("$NetBSD: cpuswitch.S,v 1.107 2023/03/01 08:17:53 riastradh Exp $")
 
 /* LINTSTUB: include  */
 
@@ -417,9 +417,13 @@ ENTRY_NP(softint_switch)
 	dmb/* for mutex_enter; see cpu_switchto */
 #endif
 	str	r5, [r7, #(CI_CURLWP)]	/* save new lwp */
-#ifdef _ARM_ARCH_7
-	dmb/* for mutex_enter; see cpu_switchto */
-#endif
+	/*
+	 * No need for barrier after ci->ci_curlwp = softlwp -- when we
+	 * enter a softint lwp, it can't be holding any mutexes, so it
+	 * can't release any until after it has acquired them, so we
+	 * need not participate in the protocol with mutex_vector_enter
+	 * barriers here.
+	 */
 
 #ifdef KASAN
 	mov	r0, r5



CVS commit: src/sys/arch/arm/arm32

2023-03-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Mar  1 08:17:53 UTC 2023

Modified Files:
src/sys/arch/arm/arm32: cpuswitch.S

Log Message:
arm32: Optimization: Omit needless membar when triggering softint.

When we are triggering a softint, it can't already hold any mutexes.
So any path to mutex_exit(mtx) must go via mutex_enter(mtx), which is
always done with atomic r/m/w, and we need not issue any explicit
barrier between ci->ci_curlwp = softlwp and a potential load of
mtx->mtx_owner in mutex_exit.

PR kern/57240

XXX pullup-8
XXX pullup-9
XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/sys/arch/arm/arm32/cpuswitch.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/arm/arm32

2023-02-25 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Feb 25 08:05:46 UTC 2023

Modified Files:
src/sys/arch/arm/arm32: bus_dma.c

Log Message:
Don't refer to physical_{start,end} here and just pass minimum (0UL)
address and maximum (~0UL) physical address.  The values are passed
through to uvm_pglistalloc which knows about the RAM ranges.


To generate a diff of this commit:
cvs rdiff -u -r1.138 -r1.139 src/sys/arch/arm/arm32/bus_dma.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/arm/arm32/bus_dma.c
diff -u src/sys/arch/arm/arm32/bus_dma.c:1.138 src/sys/arch/arm/arm32/bus_dma.c:1.139
--- src/sys/arch/arm/arm32/bus_dma.c:1.138	Tue Oct 11 22:03:37 2022
+++ src/sys/arch/arm/arm32/bus_dma.c	Sat Feb 25 08:05:46 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.138 2022/10/11 22:03:37 andvar Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.139 2023/02/25 08:05:46 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2020 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include "opt_cputypes.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.138 2022/10/11 22:03:37 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.139 2023/02/25 08:05:46 skrll Exp $");
 
 #include 
 
@@ -1327,9 +1327,6 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dm
  * by bus-specific DMA memory allocation functions.
  */
 
-extern paddr_t physical_start;
-extern paddr_t physical_end;
-
 int
 _bus_dmamem_alloc(bus_dma_tag_t t, bus_size_t size, bus_size_t alignment,
 bus_size_t boundary, bus_dma_segment_t *segs, int nsegs, int *rsegs,
@@ -1359,8 +1356,7 @@ _bus_dmamem_alloc(bus_dma_tag_t t, bus_s
 		}
 	} else {
 		error = _bus_dmamem_alloc_range(t, size, alignment, boundary,
-		segs, nsegs, rsegs, flags, trunc_page(physical_start),
-		trunc_page(physical_end));
+		segs, nsegs, rsegs, flags, 0UL, ~0UL);
 	}
 
 #ifdef DEBUG_DMA



CVS commit: src/sys/arch/arm/arm32

2023-02-25 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Feb 25 08:05:46 UTC 2023

Modified Files:
src/sys/arch/arm/arm32: bus_dma.c

Log Message:
Don't refer to physical_{start,end} here and just pass minimum (0UL)
address and maximum (~0UL) physical address.  The values are passed
through to uvm_pglistalloc which knows about the RAM ranges.


To generate a diff of this commit:
cvs rdiff -u -r1.138 -r1.139 src/sys/arch/arm/arm32/bus_dma.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/arm/arm32

2023-01-19 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu Jan 19 08:03:52 UTC 2023

Modified Files:
src/sys/arch/arm/arm32: arm32_machdep.c

Log Message:
Support remaining common boot options.


To generate a diff of this commit:
cvs rdiff -u -r1.144 -r1.145 src/sys/arch/arm/arm32/arm32_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/arm/arm32/arm32_machdep.c
diff -u src/sys/arch/arm/arm32/arm32_machdep.c:1.144 src/sys/arch/arm/arm32/arm32_machdep.c:1.145
--- src/sys/arch/arm/arm32/arm32_machdep.c:1.144	Thu Jul 28 09:14:23 2022
+++ src/sys/arch/arm/arm32/arm32_machdep.c	Thu Jan 19 08:03:51 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: arm32_machdep.c,v 1.144 2022/07/28 09:14:23 riastradh Exp $	*/
+/*	$NetBSD: arm32_machdep.c,v 1.145 2023/01/19 08:03:51 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: arm32_machdep.c,v 1.144 2022/07/28 09:14:23 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arm32_machdep.c,v 1.145 2023/01/19 08:03:51 mlelstv Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_arm_start.h"
@@ -575,6 +575,26 @@ parse_mi_bootargs(char *args)
 	|| get_bootconf_option(args, "-a", BOOTOPT_TYPE_BOOLEAN, ))
 		if (integer)
 			boothowto |= RB_ASKNAME;
+	if (get_bootconf_option(args, "userconf", BOOTOPT_TYPE_BOOLEAN, )
+	|| get_bootconf_option(args, "-c", BOOTOPT_TYPE_BOOLEAN, ))
+		if (integer)
+			boothowto |= RB_USERCONF;
+	if (get_bootconf_option(args, "halt", BOOTOPT_TYPE_BOOLEAN, )
+	|| get_bootconf_option(args, "-b", BOOTOPT_TYPE_BOOLEAN, ))
+		if (integer)
+			boothowto |= RB_HALT;
+	if (get_bootconf_option(args, "-1", BOOTOPT_TYPE_BOOLEAN, ))
+		if (integer)
+			boothowto |= RB_MD1;
+	if (get_bootconf_option(args, "-2", BOOTOPT_TYPE_BOOLEAN, ))
+		if (integer)
+			boothowto |= RB_MD2;
+	if (get_bootconf_option(args, "-3", BOOTOPT_TYPE_BOOLEAN, ))
+		if (integer)
+			boothowto |= RB_MD3;
+	if (get_bootconf_option(args, "-4", BOOTOPT_TYPE_BOOLEAN, ))
+		if (integer)
+			boothowto |= RB_MD4;
 
 /*	if (get_bootconf_option(args, "nbuf", BOOTOPT_TYPE_INT, ))
 		bufpages = integer;*/
@@ -603,6 +623,10 @@ parse_mi_bootargs(char *args)
 	|| get_bootconf_option(args, "-x", BOOTOPT_TYPE_BOOLEAN, ))
 		if (integer)
 			boothowto |= AB_DEBUG;
+	if (get_bootconf_option(args, "silent", BOOTOPT_TYPE_BOOLEAN, )
+	|| get_bootconf_option(args, "-z", BOOTOPT_TYPE_BOOLEAN, ))
+		if (integer)
+			boothowto |= AB_SILENT;
 }
 
 #ifdef __HAVE_FAST_SOFTINTS



CVS commit: src/sys/arch/arm/arm32

2023-01-19 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Thu Jan 19 08:03:52 UTC 2023

Modified Files:
src/sys/arch/arm/arm32: arm32_machdep.c

Log Message:
Support remaining common boot options.


To generate a diff of this commit:
cvs rdiff -u -r1.144 -r1.145 src/sys/arch/arm/arm32/arm32_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/arm/arm32

2022-07-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Jul 28 09:14:23 UTC 2022

Modified Files:
src/sys/arch/arm/arm32: arm32_machdep.c

Log Message:
arm32: Refactor splhigh and restore in dosoftints.

No functional change intended.  splhigh always returns ci->ci_cpl,
which should not be changing at this point.  Makes the bracketing by
splhigh/splx clearer.


To generate a diff of this commit:
cvs rdiff -u -r1.143 -r1.144 src/sys/arch/arm/arm32/arm32_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/arm/arm32/arm32_machdep.c
diff -u src/sys/arch/arm/arm32/arm32_machdep.c:1.143 src/sys/arch/arm/arm32/arm32_machdep.c:1.144
--- src/sys/arch/arm/arm32/arm32_machdep.c:1.143	Sat Mar 12 09:16:05 2022
+++ src/sys/arch/arm/arm32/arm32_machdep.c	Thu Jul 28 09:14:23 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: arm32_machdep.c,v 1.143 2022/03/12 09:16:05 skrll Exp $	*/
+/*	$NetBSD: arm32_machdep.c,v 1.144 2022/07/28 09:14:23 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: arm32_machdep.c,v 1.143 2022/03/12 09:16:05 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arm32_machdep.c,v 1.144 2022/07/28 09:14:23 riastradh Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_arm_start.h"
@@ -663,15 +663,16 @@ dosoftints(void)
 	struct cpu_info * const ci = curcpu();
 	const int opl = ci->ci_cpl;
 	const uint32_t softiplmask = SOFTIPLMASK(opl);
+	int s;
 
-	splhigh();
+	s = splhigh();
+	KASSERT(s == opl);
 	for (;;) {
 		u_int softints = ci->ci_softints & softiplmask;
 		KASSERT((softints != 0) == ((ci->ci_softints >> opl) != 0));
 		KASSERT(opl == IPL_NONE || (softints & (1 << (opl - IPL_SOFTCLOCK))) == 0);
 		if (softints == 0) {
-			splx(opl);
-			return;
+			break;
 		}
 #define	DOSOFTINT(n) \
 		if (ci->ci_softints & (1 << (IPL_SOFT ## n - IPL_SOFTCLOCK))) { \
@@ -687,6 +688,7 @@ dosoftints(void)
 		DOSOFTINT(CLOCK);
 		panic("dosoftints wtf (softints=%u?, ipl=%d)", softints, opl);
 	}
+	splx(s);
 }
 #endif /* !__HAVE_PIC_FAST_SOFTINTS */
 #endif /* __HAVE_FAST_SOFTINTS */



CVS commit: src/sys/arch/arm/arm32

2022-07-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Jul 28 09:14:23 UTC 2022

Modified Files:
src/sys/arch/arm/arm32: arm32_machdep.c

Log Message:
arm32: Refactor splhigh and restore in dosoftints.

No functional change intended.  splhigh always returns ci->ci_cpl,
which should not be changing at this point.  Makes the bracketing by
splhigh/splx clearer.


To generate a diff of this commit:
cvs rdiff -u -r1.143 -r1.144 src/sys/arch/arm/arm32/arm32_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/arm/arm32

2022-03-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Mar 19 09:54:25 UTC 2022

Modified Files:
src/sys/arch/arm/arm32: pmap.c

Log Message:
Alight code re-organisation so it better matches the VPRINTF headings
it is under. NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.433 -r1.434 src/sys/arch/arm/arm32/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/arm/arm32/pmap.c
diff -u src/sys/arch/arm/arm32/pmap.c:1.433 src/sys/arch/arm/arm32/pmap.c:1.434
--- src/sys/arch/arm/arm32/pmap.c:1.433	Sat Mar 12 15:32:31 2022
+++ src/sys/arch/arm/arm32/pmap.c	Sat Mar 19 09:54:25 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.433 2022/03/12 15:32:31 riastradh Exp $	*/
+/*	$NetBSD: pmap.c,v 1.434 2022/03/19 09:54:25 skrll Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -192,7 +192,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.433 2022/03/12 15:32:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.434 2022/03/19 09:54:25 skrll Exp $");
 
 #include 
 #include 
@@ -6229,6 +6229,7 @@ pmap_bootstrap(vaddr_t vstart, vaddr_t v
 	 * Initialise the kernel pmap object
 	 */
 	curcpu()->ci_pmap_cur = pm;
+	pm->pm_refs = 1;
 #ifdef ARM_MMU_EXTENDED
 	pm->pm_l1 = l1pt;
 	pm->pm_l1_pa = kernel_l1pt.pv_pa;
@@ -6242,6 +6243,7 @@ pmap_bootstrap(vaddr_t vstart, vaddr_t v
 #else
 	pm->pm_l1 = l1;
 #endif
+	mutex_init(>pm_lock, MUTEX_DEFAULT, IPL_VM);
 
 	VPRINTF("locks ");
 	/*
@@ -6250,8 +6252,6 @@ pmap_bootstrap(vaddr_t vstart, vaddr_t v
 	 */
 	mutex_init(_lock, MUTEX_DEFAULT, IPL_VM);
 	mutex_init(_lock, MUTEX_DEFAULT, IPL_NONE);
-	mutex_init(>pm_lock, MUTEX_DEFAULT, IPL_VM);
-	pm->pm_refs = 1;
 
 	VPRINTF("l1pt ");
 	/*



CVS commit: src/sys/arch/arm/arm32

2022-03-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Mar 19 09:54:25 UTC 2022

Modified Files:
src/sys/arch/arm/arm32: pmap.c

Log Message:
Alight code re-organisation so it better matches the VPRINTF headings
it is under. NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.433 -r1.434 src/sys/arch/arm/arm32/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/arm/arm32

2022-02-06 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Feb  6 22:21:25 UTC 2022

Modified Files:
src/sys/arch/arm/arm32: bus_dma.c

Log Message:
if we have to bounce a buffer, clear our anything already setup in
the map before trying again.

riastradh@ noticed that a map had two types of mbuf types, and this
seems to avoid it as seen on eqos(4) on quartz64.

add a couple more event counts for bus dma events.

ok @skrll @raistradh @jmcneill

XXX: pullup-8 and pullup-9 probably.


To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 src/sys/arch/arm/arm32/bus_dma.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/arm/arm32/bus_dma.c
diff -u src/sys/arch/arm/arm32/bus_dma.c:1.134 src/sys/arch/arm/arm32/bus_dma.c:1.135
--- src/sys/arch/arm/arm32/bus_dma.c:1.134	Mon Dec 20 13:58:58 2021
+++ src/sys/arch/arm/arm32/bus_dma.c	Sun Feb  6 22:21:25 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.134 2021/12/20 13:58:58 skrll Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.135 2022/02/06 22:21:25 mrg Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2020 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include "opt_cputypes.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.134 2021/12/20 13:58:58 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.135 2022/02/06 22:21:25 mrg Exp $");
 
 #include 
 
@@ -71,6 +71,8 @@ static struct evcnt bus_dma_write_bounce
 	EVCNT_INITIALIZER(EVCNT_TYPE_MISC, NULL, "busdma", "write bounces");
 static struct evcnt bus_dma_bounced_unloads =
 	EVCNT_INITIALIZER(EVCNT_TYPE_MISC, NULL, "busdma", "bounced unloads");
+static struct evcnt bus_dma_bounced_mbuf_loads =
+	EVCNT_INITIALIZER(EVCNT_TYPE_MISC, NULL, "busdma", "bounced mbuf loads");
 static struct evcnt bus_dma_unloads =
 	EVCNT_INITIALIZER(EVCNT_TYPE_MISC, NULL, "busdma", "unloads");
 static struct evcnt bus_dma_bounced_destroys =
@@ -93,6 +95,8 @@ static struct evcnt bus_dma_sync_postrea
 	EVCNT_INITIALIZER(EVCNT_TYPE_MISC, NULL, "busdma", "sync postreadwrite");
 static struct evcnt bus_dma_sync_postwrite =
 	EVCNT_INITIALIZER(EVCNT_TYPE_MISC, NULL, "busdma", "sync postwrite");
+static struct evcnt bus_dma_inrange_fail =
+	EVCNT_INITIALIZER(EVCNT_TYPE_MISC, NULL, "busdma", "inrange check failed");
 
 static struct evcnt bus_dma_sync_coherent_prereadwrite =
 	EVCNT_INITIALIZER(EVCNT_TYPE_MISC, NULL, "busdma", "sync coherent prereadwrite");
@@ -118,6 +122,7 @@ EVCNT_ATTACH_STATIC(bus_dma_unloads);
 EVCNT_ATTACH_STATIC(bus_dma_bounced_unloads);
 EVCNT_ATTACH_STATIC(bus_dma_destroys);
 EVCNT_ATTACH_STATIC(bus_dma_bounced_destroys);
+EVCNT_ATTACH_STATIC(bus_dma_bounced_mbuf_loads);
 EVCNT_ATTACH_STATIC(bus_dma_sync_prereadwrite);
 EVCNT_ATTACH_STATIC(bus_dma_sync_preread_begin);
 EVCNT_ATTACH_STATIC(bus_dma_sync_preread);
@@ -126,6 +131,7 @@ EVCNT_ATTACH_STATIC(bus_dma_sync_prewrit
 EVCNT_ATTACH_STATIC(bus_dma_sync_postread);
 EVCNT_ATTACH_STATIC(bus_dma_sync_postreadwrite);
 EVCNT_ATTACH_STATIC(bus_dma_sync_postwrite);
+EVCNT_ATTACH_STATIC(bus_dma_inrange_fail);
 
 EVCNT_ATTACH_STATIC(bus_dma_sync_coherent_prereadwrite);
 EVCNT_ATTACH_STATIC(bus_dma_sync_coherent_preread);
@@ -210,8 +216,10 @@ _bus_dmamap_load_paddr(bus_dma_tag_t t, 
 		/* XXX cache last result? */
 		const struct arm32_dma_range * const dr =
 		_bus_dma_paddr_inrange(t->_ranges, t->_nranges, paddr);
-		if (dr == NULL)
+		if (dr == NULL) {
+			STAT_INCR(inrange_fail);
 			return EINVAL;
+		}
 
 		/*
 		 * If this region is coherent, mark the segment as coherent.
@@ -305,6 +313,15 @@ _bus_dma_load_bouncebuf(bus_dma_tag_t t,
 	}
 
 	/*
+	 * Since we're trying again, clear the previous attempt.
+	 */
+	map->dm_mapsize = 0;
+	map->dm_nsegs = 0;
+	map->_dm_buftype = _BUS_DMA_BUFTYPE_INVALID;
+	/* _bus_dmamap_load_buffer() clears this if we're not... */
+	map->_dm_flags |= _BUS_DMAMAP_COHERENT;
+
+	/*
 	 * Cache a pointer to the caller's buffer and load the DMA map
 	 * with the bounce buffer.
 	 */
@@ -698,6 +715,7 @@ _bus_dmamap_load_mbuf(bus_dma_tag_t t, b
 	if (cookie != NULL && (cookie->id_flags & _BUS_DMA_MIGHT_NEED_BOUNCE)) {
 		error = _bus_dma_load_bouncebuf(t, map, m0, m0->m_pkthdr.len,
 		_BUS_DMA_BUFTYPE_MBUF, flags);
+		STAT_INCR(bounced_mbuf_loads);
 	}
 #endif
 	return error;



CVS commit: src/sys/arch/arm/arm32

2022-02-06 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Feb  6 22:21:25 UTC 2022

Modified Files:
src/sys/arch/arm/arm32: bus_dma.c

Log Message:
if we have to bounce a buffer, clear our anything already setup in
the map before trying again.

riastradh@ noticed that a map had two types of mbuf types, and this
seems to avoid it as seen on eqos(4) on quartz64.

add a couple more event counts for bus dma events.

ok @skrll @raistradh @jmcneill

XXX: pullup-8 and pullup-9 probably.


To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 src/sys/arch/arm/arm32/bus_dma.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/arm/arm32

2022-01-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan  1 15:09:01 UTC 2022

Modified Files:
src/sys/arch/arm/arm32: pmap.c

Log Message:
KASSERT now always uses the expression, so don't protect with DIAGNOSTIC


To generate a diff of this commit:
cvs rdiff -u -r1.430 -r1.431 src/sys/arch/arm/arm32/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/arm/arm32/pmap.c
diff -u src/sys/arch/arm/arm32/pmap.c:1.430 src/sys/arch/arm/arm32/pmap.c:1.431
--- src/sys/arch/arm/arm32/pmap.c:1.430	Thu Aug 26 04:56:21 2021
+++ src/sys/arch/arm/arm32/pmap.c	Sat Jan  1 10:09:01 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.430 2021/08/26 08:56:21 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.431 2022/01/01 15:09:01 christos Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -192,7 +192,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.430 2021/08/26 08:56:21 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.431 2022/01/01 15:09:01 christos Exp $");
 
 #include 
 #include 
@@ -529,13 +529,11 @@ pmap_release_page_lock(struct vm_page_md
 	mutex_exit(_lock);
 }
 
-#ifdef DIAGNOSTIC
 static inline int
 pmap_page_locked_p(struct vm_page_md *md)
 {
 	return mutex_owned(_lock);
 }
-#endif
 
 
 /*



CVS commit: src/sys/arch/arm/arm32

2022-01-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan  1 15:09:01 UTC 2022

Modified Files:
src/sys/arch/arm/arm32: pmap.c

Log Message:
KASSERT now always uses the expression, so don't protect with DIAGNOSTIC


To generate a diff of this commit:
cvs rdiff -u -r1.430 -r1.431 src/sys/arch/arm/arm32/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/arm/arm32

2021-12-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Dec 20 13:58:58 UTC 2021

Modified Files:
src/sys/arch/arm/arm32: bus_dma.c

Log Message:
_bus_dmatag_subregion is always EOPNOTSUPP for !_ARM32_NEED_BUS_DMA_BOUNCE
No need to check {min,max}_addr. Compiler did the right thing, but...


To generate a diff of this commit:
cvs rdiff -u -r1.133 -r1.134 src/sys/arch/arm/arm32/bus_dma.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/arm/arm32/bus_dma.c
diff -u src/sys/arch/arm/arm32/bus_dma.c:1.133 src/sys/arch/arm/arm32/bus_dma.c:1.134
--- src/sys/arch/arm/arm32/bus_dma.c:1.133	Mon Aug 30 22:56:26 2021
+++ src/sys/arch/arm/arm32/bus_dma.c	Mon Dec 20 13:58:58 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.133 2021/08/30 22:56:26 jmcneill Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.134 2021/12/20 13:58:58 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2020 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include "opt_cputypes.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.133 2021/08/30 22:56:26 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.134 2021/12/20 13:58:58 skrll Exp $");
 
 #include 
 
@@ -1889,10 +1889,10 @@ int
 _bus_dmatag_subregion(bus_dma_tag_t tag, bus_addr_t min_addr,
 bus_addr_t max_addr, bus_dma_tag_t *newtag, int flags)
 {
+#ifdef _ARM32_NEED_BUS_DMA_BOUNCE
 	if (min_addr >= max_addr)
 		return EOPNOTSUPP;
 
-#ifdef _ARM32_NEED_BUS_DMA_BOUNCE
 	struct arm32_dma_range *dr;
 	bool psubset = true;
 	size_t nranges = 0;



CVS commit: src/sys/arch/arm/arm32

2021-12-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Dec 20 13:58:58 UTC 2021

Modified Files:
src/sys/arch/arm/arm32: bus_dma.c

Log Message:
_bus_dmatag_subregion is always EOPNOTSUPP for !_ARM32_NEED_BUS_DMA_BOUNCE
No need to check {min,max}_addr. Compiler did the right thing, but...


To generate a diff of this commit:
cvs rdiff -u -r1.133 -r1.134 src/sys/arch/arm/arm32/bus_dma.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/arm/arm32

2021-11-12 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Nov 13 00:13:17 UTC 2021

Modified Files:
src/sys/arch/arm/arm32: arm32_machdep.c

Log Message:
Support 'boot -1' on arm


To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.142 src/sys/arch/arm/arm32/arm32_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/arm/arm32/arm32_machdep.c
diff -u src/sys/arch/arm/arm32/arm32_machdep.c:1.141 src/sys/arch/arm/arm32/arm32_machdep.c:1.142
--- src/sys/arch/arm/arm32/arm32_machdep.c:1.141	Sun Oct 31 16:23:47 2021
+++ src/sys/arch/arm/arm32/arm32_machdep.c	Sat Nov 13 00:13:17 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: arm32_machdep.c,v 1.141 2021/10/31 16:23:47 skrll Exp $	*/
+/*	$NetBSD: arm32_machdep.c,v 1.142 2021/11/13 00:13:17 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: arm32_machdep.c,v 1.141 2021/10/31 16:23:47 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arm32_machdep.c,v 1.142 2021/11/13 00:13:17 jmcneill Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_arm_start.h"
@@ -558,6 +558,9 @@ parse_mi_bootargs(char *args)
 {
 	int integer;
 
+	if (get_bootconf_option(args, "-1", BOOTOPT_TYPE_BOOLEAN, ))
+		if (integer)
+			boothowto |= RB_MD1;
 	if (get_bootconf_option(args, "single", BOOTOPT_TYPE_BOOLEAN, )
 	|| get_bootconf_option(args, "-s", BOOTOPT_TYPE_BOOLEAN, ))
 		if (integer)



CVS commit: src/sys/arch/arm/arm32

2021-11-12 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Nov 13 00:13:17 UTC 2021

Modified Files:
src/sys/arch/arm/arm32: arm32_machdep.c

Log Message:
Support 'boot -1' on arm


To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.142 src/sys/arch/arm/arm32/arm32_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/arm/arm32

2021-10-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Oct 21 07:03:26 UTC 2021

Modified Files:
src/sys/arch/arm/arm32: arm32_machdep.c

Log Message:
Whitespace in a comment


To generate a diff of this commit:
cvs rdiff -u -r1.139 -r1.140 src/sys/arch/arm/arm32/arm32_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/arm/arm32

2021-10-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Oct 21 07:03:26 UTC 2021

Modified Files:
src/sys/arch/arm/arm32: arm32_machdep.c

Log Message:
Whitespace in a comment


To generate a diff of this commit:
cvs rdiff -u -r1.139 -r1.140 src/sys/arch/arm/arm32/arm32_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/arm/arm32/arm32_machdep.c
diff -u src/sys/arch/arm/arm32/arm32_machdep.c:1.139 src/sys/arch/arm/arm32/arm32_machdep.c:1.140
--- src/sys/arch/arm/arm32/arm32_machdep.c:1.139	Tue Dec  1 02:43:14 2020
+++ src/sys/arch/arm/arm32/arm32_machdep.c	Thu Oct 21 07:03:26 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: arm32_machdep.c,v 1.139 2020/12/01 02:43:14 rin Exp $	*/
+/*	$NetBSD: arm32_machdep.c,v 1.140 2021/10/21 07:03:26 skrll Exp $	*/
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: arm32_machdep.c,v 1.139 2020/12/01 02:43:14 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arm32_machdep.c,v 1.140 2021/10/21 07:03:26 skrll Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_arm_start.h"
@@ -727,7 +727,7 @@ cpu_uarea_alloc_idlelwp(struct cpu_info 
  * printf isn't available to us for a number of reasons.
  *
  * -  kprint_init has been called and printf will try to take locks which we
- *can't  do just yet because bootstrap translation tables do not allowing
+ *can't do just yet because bootstrap translation tables do not allowing
  *caching.
  *
  * -  kmutex(9) relies on curcpu which isn't setup yet.



CVS commit: src/sys/arch/arm/arm32

2021-10-11 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Oct 11 07:32:52 UTC 2021

Modified Files:
src/sys/arch/arm/arm32: cpu.c

Log Message:
For some classic CPUs, info->[id]cache_sets are not initialized.
Calculate and print numbers of sets in this case.


To generate a diff of this commit:
cvs rdiff -u -r1.150 -r1.151 src/sys/arch/arm/arm32/cpu.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/arm/arm32/cpu.c
diff -u src/sys/arch/arm/arm32/cpu.c:1.150 src/sys/arch/arm/arm32/cpu.c:1.151
--- src/sys/arch/arm/arm32/cpu.c:1.150	Mon Oct 11 07:19:37 2021
+++ src/sys/arch/arm/arm32/cpu.c	Mon Oct 11 07:32:52 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.150 2021/10/11 07:19:37 rin Exp $	*/
+/*	$NetBSD: cpu.c,v 1.151 2021/10/11 07:32:52 rin Exp $	*/
 
 /*
  * Copyright (c) 1995 Mark Brinicombe.
@@ -46,7 +46,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.150 2021/10/11 07:19:37 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.151 2021/10/11 07:32:52 rin Exp $");
 
 #include 
 
@@ -612,7 +612,9 @@ print_cache_info(device_t dv, struct arm
 		level + 1,
 		info->dcache_size / 1024,
 		info->dcache_line_size, info->dcache_ways,
-		info->dcache_sets,
+		info->dcache_sets ? info->dcache_sets :
+			info->dcache_size /
+			(info->dcache_line_size * info->dcache_ways),
 		wtnames[info->cache_type],
 		info->dcache_type & CACHE_TYPE_PIxx ? 'P' : 'V',
 		info->dcache_type & CACHE_TYPE_xxPT ? 'P' : 'V');
@@ -621,14 +623,18 @@ print_cache_info(device_t dv, struct arm
 		level + 1,
 		info->icache_size / 1024,
 		info->icache_line_size, info->icache_ways,
-		info->icache_sets,
+		info->icache_sets ? info->icache_sets :
+			info->icache_size /
+			(info->icache_line_size * info->icache_ways),
 		info->icache_type & CACHE_TYPE_PIxx ? 'P' : 'V',
 		info->icache_type & CACHE_TYPE_xxPT ? 'P' : 'V');
 		aprint_normal_dev(dv, "L%u %dKB/%dB %d-way (%u set) %s %cI%cT Data cache\n",
 		level + 1,
 		info->dcache_size / 1024,
 		info->dcache_line_size, info->dcache_ways,
-		info->dcache_sets,
+		info->dcache_sets ? info->dcache_sets :
+			info->dcache_size /
+			(info->dcache_line_size * info->dcache_ways),
 		wtnames[info->cache_type],
 		info->dcache_type & CACHE_TYPE_PIxx ? 'P' : 'V',
 		info->dcache_type & CACHE_TYPE_xxPT ? 'P' : 'V');



CVS commit: src/sys/arch/arm/arm32

2021-10-11 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Oct 11 07:32:52 UTC 2021

Modified Files:
src/sys/arch/arm/arm32: cpu.c

Log Message:
For some classic CPUs, info->[id]cache_sets are not initialized.
Calculate and print numbers of sets in this case.


To generate a diff of this commit:
cvs rdiff -u -r1.150 -r1.151 src/sys/arch/arm/arm32/cpu.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/arm/arm32

2021-10-11 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Oct 11 07:26:17 UTC 2021

Modified Files:
src/sys/arch/arm/arm32: spl.S

Log Message:
splx: Restore interrupts before dosoftints() for __HAVE_FAST_SOFTINTS.

No functional changes; All the users of arm32/spl.S, i.e., acorn32,
hpcarm/sa11x0, and shark have not switched to __HAVE_FAST_SOFTINTS yet.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/arm32/spl.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/arm/arm32/spl.S
diff -u src/sys/arch/arm/arm32/spl.S:1.10 src/sys/arch/arm/arm32/spl.S:1.11
--- src/sys/arch/arm/arm32/spl.S:1.10	Mon Dec  2 18:36:10 2013
+++ src/sys/arch/arm/arm32/spl.S	Mon Oct 11 07:26:17 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: spl.S,v 1.10 2013/12/02 18:36:10 joerg Exp $	*/
+/*	$NetBSD: spl.S,v 1.11 2021/10/11 07:26:17 rin Exp $	*/
 
 /*
  * Copyright (c) 1996-1998 Mark Brinicombe.
@@ -43,7 +43,7 @@
 #include 
 #include 
 
-	RCSID("$NetBSD: spl.S,v 1.10 2013/12/02 18:36:10 joerg Exp $")
+	RCSID("$NetBSD: spl.S,v 1.11 2021/10/11 07:26:17 rin Exp $")
 
 	.text
 	.align	0
@@ -111,8 +111,8 @@ ENTRY(splx)
 	str	r3, [r1, #CI_CPL]	/* Store the new spl level */
 
 	bl	_C_LABEL(irq_setmasks)	/* Update the actual masks */
+	msr	cpsr_c, r4
 #ifdef __HAVE_FAST_SOFTINTS
 	bl	_C_LABEL(dosoftints)	/* Process any pending soft ints */
 #endif
-	msr	cpsr_c, r4
 	ldmfd	sp!, {r0, r1, r4, pc}



CVS commit: src/sys/arch/arm/arm32

2021-10-11 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Oct 11 07:26:17 UTC 2021

Modified Files:
src/sys/arch/arm/arm32: spl.S

Log Message:
splx: Restore interrupts before dosoftints() for __HAVE_FAST_SOFTINTS.

No functional changes; All the users of arm32/spl.S, i.e., acorn32,
hpcarm/sa11x0, and shark have not switched to __HAVE_FAST_SOFTINTS yet.


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

2021-10-11 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Oct 11 07:19:37 UTC 2021

Modified Files:
src/sys/arch/arm/arm32: cpu.c

Log Message:
pN steppings are used for ARM926EJ-S, although only r0 seems to be available.


To generate a diff of this commit:
cvs rdiff -u -r1.149 -r1.150 src/sys/arch/arm/arm32/cpu.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/arm/arm32/cpu.c
diff -u src/sys/arch/arm/arm32/cpu.c:1.149 src/sys/arch/arm/arm32/cpu.c:1.150
--- src/sys/arch/arm/arm32/cpu.c:1.149	Thu Sep 23 06:34:00 2021
+++ src/sys/arch/arm/arm32/cpu.c	Mon Oct 11 07:19:37 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.149 2021/09/23 06:34:00 skrll Exp $	*/
+/*	$NetBSD: cpu.c,v 1.150 2021/10/11 07:19:37 rin Exp $	*/
 
 /*
  * Copyright (c) 1995 Mark Brinicombe.
@@ -46,7 +46,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.149 2021/09/23 06:34:00 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.150 2021/10/11 07:19:37 rin Exp $");
 
 #include 
 
@@ -476,8 +476,8 @@ const struct cpuidtab cpuids[] = {
 
 	{ CPU_ID_ARM1026EJS,	CPU_CLASS_ARM10EJ,	"ARM1026EJ-S",
 	  generic_steppings, "5TEJ" },
-	{ CPU_ID_ARM926EJS,	CPU_CLASS_ARM9EJS,	"ARM926EJ-S",
-	  generic_steppings, "5TEJ" },
+	{ CPU_ID_ARM926EJS,	CPU_CLASS_ARM9EJS,	"ARM926EJ-S r0",
+	  pN_steppings, "5TEJ" },
 
 	{ CPU_ID_ARM1136JS,	CPU_CLASS_ARM11J,	"ARM1136J-S r0",
 	  pN_steppings, "6J" },



CVS commit: src/sys/arch/arm/arm32

2021-10-11 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Oct 11 07:19:37 UTC 2021

Modified Files:
src/sys/arch/arm/arm32: cpu.c

Log Message:
pN steppings are used for ARM926EJ-S, although only r0 seems to be available.


To generate a diff of this commit:
cvs rdiff -u -r1.149 -r1.150 src/sys/arch/arm/arm32/cpu.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/arm/arm32

2021-08-26 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Aug 26 08:56:21 UTC 2021

Modified Files:
src/sys/arch/arm/arm32: pmap.c

Log Message:
Improve a comment


To generate a diff of this commit:
cvs rdiff -u -r1.429 -r1.430 src/sys/arch/arm/arm32/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/arm/arm32/pmap.c
diff -u src/sys/arch/arm/arm32/pmap.c:1.429 src/sys/arch/arm/arm32/pmap.c:1.430
--- src/sys/arch/arm/arm32/pmap.c:1.429	Tue Aug 24 07:32:31 2021
+++ src/sys/arch/arm/arm32/pmap.c	Thu Aug 26 08:56:21 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.429 2021/08/24 07:32:31 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.430 2021/08/26 08:56:21 skrll Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -192,7 +192,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.429 2021/08/24 07:32:31 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.430 2021/08/26 08:56:21 skrll Exp $");
 
 #include 
 #include 
@@ -6023,7 +6023,7 @@ pmap_growkernel(vaddr_t maxkvaddr)
 		KASSERT(*pdep == 0);
 		l1pte_setone(pdep, npde);
 #else
-		/* Distribute new L1 entry to all other L1s */
+		/* Distribute new L1 entry to all L1s */
 		SLIST_FOREACH(l1, _list, l1_link) {
 			pd_entry_t * const pdep = >l1_kva[l1slot];
 			l1pte_setone(pdep, npde);



CVS commit: src/sys/arch/arm/arm32

2021-08-26 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Aug 26 08:56:21 UTC 2021

Modified Files:
src/sys/arch/arm/arm32: pmap.c

Log Message:
Improve a comment


To generate a diff of this commit:
cvs rdiff -u -r1.429 -r1.430 src/sys/arch/arm/arm32/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/arm/arm32

2021-08-24 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Aug 24 07:32:31 UTC 2021

Modified Files:
src/sys/arch/arm/arm32: pmap.c

Log Message:
Remove '\n' from UVMHIST format


To generate a diff of this commit:
cvs rdiff -u -r1.428 -r1.429 src/sys/arch/arm/arm32/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/arm/arm32/pmap.c
diff -u src/sys/arch/arm/arm32/pmap.c:1.428 src/sys/arch/arm/arm32/pmap.c:1.429
--- src/sys/arch/arm/arm32/pmap.c:1.428	Tue Mar 23 10:21:49 2021
+++ src/sys/arch/arm/arm32/pmap.c	Tue Aug 24 07:32:31 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.428 2021/03/23 10:21:49 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.429 2021/08/24 07:32:31 skrll Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -192,7 +192,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.428 2021/03/23 10:21:49 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.429 2021/08/24 07:32:31 skrll Exp $");
 
 #include 
 #include 
@@ -5979,7 +5979,7 @@ vaddr_t
 pmap_growkernel(vaddr_t maxkvaddr)
 {
 	UVMHIST_FUNC(__func__);
-	UVMHIST_CALLARGS(maphist, "growing kernel from %#jx to %#jx\n",
+	UVMHIST_CALLARGS(maphist, "growing kernel from %#jx to %#jx",
 	pmap_curmaxkvaddr, maxkvaddr, 0, 0);
 
 	pmap_t kpm = pmap_kernel();



CVS commit: src/sys/arch/arm/arm32

2021-08-24 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Aug 24 07:32:31 UTC 2021

Modified Files:
src/sys/arch/arm/arm32: pmap.c

Log Message:
Remove '\n' from UVMHIST format


To generate a diff of this commit:
cvs rdiff -u -r1.428 -r1.429 src/sys/arch/arm/arm32/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/arm/arm32

2020-11-21 Thread Rin Okuyama

Excellent! Thank you so much for finding out and fixing this!

Full ATF successfully completed for Raspberry Pi 2b, which formerly
crashed due to "anon != NULL && anon->an_ref != 0" panic.

Now, ATF is running on Cubietruck and Raspberry Pi Zero W.

Thanks,
rin

On 2020/11/22 4:44, Nick Hudson wrote:

Module Name:src
Committed By:   skrll
Date:   Sat Nov 21 19:44:52 UTC 2020

Modified Files:
src/sys/arch/arm/arm32: cpuswitch.S

Log Message:
Ensure that r5 contains curlwp before DO_AST_AND_RESTORE_ALIGNMENT_FAULTS
in lwp_trampoline as required by the move to make ASTs operate per-LWP
rather than per-CPU.

Thanks to martin@ for bisecting the amap corruption he was seeing and
testing this fix.


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/sys/arch/arm/arm32/cpuswitch.S

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/arm/arm32

2020-02-22 Thread Nick Hudson

On 21/02/2020 23:27, Maya Rashish wrote:
[...]


Index: src/sys/arch/arm/arm32/bus_dma.c
diff -u src/sys/arch/arm/arm32/bus_dma.c:1.118 
src/sys/arch/arm/arm32/bus_dma.c:1.119
--- src/sys/arch/arm/arm32/bus_dma.c:1.118  Tue Nov  5 10:21:31 2019
+++ src/sys/arch/arm/arm32/bus_dma.cFri Feb 21 23:27:06 2020

[...]


@@ -404,7 +404,7 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_
  #ifdef DEBUG_DMA
printf("dmamap_create:map=%p\n", map);
  #endif/* DEBUG_DMA */
-   return 0;
+   return error;
  }

  /*



This isn't correct for the case where _ARM32_NEED_BUS_DMA_BOUNCE isn't
defined.

I'll fix it.

Nick


CVS commit: src/sys/arch/arm/arm32

2019-11-29 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Fri Nov 29 17:33:43 UTC 2019

Modified Files:
src/sys/arch/arm/arm32: fault.c

Log Message:
if Thumb-32 bit instruction located on a page boundariy, also need to consider 
the pc + 2 address.

Fix PR/54720. more detail and PoC are descrived in the PR.


To generate a diff of this commit:
cvs rdiff -u -r1.108 -r1.109 src/sys/arch/arm/arm32/fault.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/arm/arm32/fault.c
diff -u src/sys/arch/arm/arm32/fault.c:1.108 src/sys/arch/arm/arm32/fault.c:1.109
--- src/sys/arch/arm/arm32/fault.c:1.108	Sat Apr  6 03:06:25 2019
+++ src/sys/arch/arm/arm32/fault.c	Fri Nov 29 17:33:43 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: fault.c,v 1.108 2019/04/06 03:06:25 thorpej Exp $	*/
+/*	$NetBSD: fault.c,v 1.109 2019/11/29 17:33:43 ryo Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -81,7 +81,7 @@
 #include "opt_kgdb.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.108 2019/04/06 03:06:25 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.109 2019/11/29 17:33:43 ryo Exp $");
 
 #include 
 #include 
@@ -838,6 +838,9 @@ prefetch_abort_handler(trapframe_t *tf)
 	UVMHIST_LOG(maphist, " (pc=0x%jx, l=0x%#jx, tf=0x%#jx)",
 	fault_pc, (uintptr_t)l, (uintptr_t)tf, 0);
 
+#ifdef THUMB_CODE
+ recheck:
+#endif
 	/* Ok validate the address, can only execute in USER space */
 	if (__predict_false(fault_pc >= VM_MAXUSER_ADDRESS ||
 	(fault_pc < VM_MIN_ADDRESS && vector_page == ARM_VECTORS_LOW))) {
@@ -897,6 +900,18 @@ do_trapsignal:
 	call_trapsignal(l, tf, );
 
 out:
+
+#ifdef THUMB_CODE
+#define THUMB_32BIT(hi) (((hi) & 0xe000) == 0xe000 && ((hi) & 0x1800))
+	/* thumb-32 instruction was located on page boundary? */
+	if ((tf->tf_spsr & PSR_T_bit) &&
+	((fault_pc & PAGE_MASK) == (PAGE_SIZE - THUMB_INSN_SIZE)) &&
+	THUMB_32BIT(*(uint16_t *)tf->tf_pc)) {
+		fault_pc = tf->tf_pc + THUMB_INSN_SIZE;
+		goto recheck;
+	}
+#endif /* THUMB_CODE */
+
 	KASSERT(!TRAP_USERMODE(tf) || VALID_R15_PSR(tf->tf_pc, tf->tf_spsr));
 	userret(l);
 }



CVS commit: src/sys/arch/arm/arm32

2019-11-29 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Fri Nov 29 17:33:43 UTC 2019

Modified Files:
src/sys/arch/arm/arm32: fault.c

Log Message:
if Thumb-32 bit instruction located on a page boundariy, also need to consider 
the pc + 2 address.

Fix PR/54720. more detail and PoC are descrived in the PR.


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

2019-11-05 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Nov  5 10:21:31 UTC 2019

Modified Files:
src/sys/arch/arm/arm32: bus_dma.c

Log Message:
Do not try to use direct map for prefetchable mappings


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/sys/arch/arm/arm32/bus_dma.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/arm/arm32/bus_dma.c
diff -u src/sys/arch/arm/arm32/bus_dma.c:1.117 src/sys/arch/arm/arm32/bus_dma.c:1.118
--- src/sys/arch/arm/arm32/bus_dma.c:1.117	Tue Nov  5 09:57:47 2019
+++ src/sys/arch/arm/arm32/bus_dma.c	Tue Nov  5 10:21:31 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.117 2019/11/05 09:57:47 jmcneill Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.118 2019/11/05 10:21:31 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include "opt_cputypes.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.117 2019/11/05 09:57:47 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.118 2019/11/05 10:21:31 jmcneill Exp $");
 
 #include 
 #include 
@@ -1339,7 +1339,7 @@ _bus_dmamem_map(bus_dma_tag_t t, bus_dma
 	 * contiguous area then this area is already mapped.  Let's see if we
 	 * avoid having a separate mapping for it.
 	 */
-	if (nsegs == 1) {
+	if (nsegs == 1 && (flags & BUS_DMA_PREFETCHABLE) == 0) {
 		/*
 		 * If this is a non-COHERENT mapping, then the existing kernel
 		 * mapping is already compatible with it.



CVS commit: src/sys/arch/arm/arm32

2019-11-05 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Nov  5 10:21:31 UTC 2019

Modified Files:
src/sys/arch/arm/arm32: bus_dma.c

Log Message:
Do not try to use direct map for prefetchable mappings


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

2019-11-05 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Nov  5 09:57:47 UTC 2019

Modified Files:
src/sys/arch/arm/arm32: bus_dma.c

Log Message:
bus_dmamem_map: honour BUS_DMA_PREFETCHABLE hint


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

2019-11-05 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Nov  5 09:57:47 UTC 2019

Modified Files:
src/sys/arch/arm/arm32: bus_dma.c

Log Message:
bus_dmamem_map: honour BUS_DMA_PREFETCHABLE hint


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/sys/arch/arm/arm32/bus_dma.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/arm/arm32/bus_dma.c
diff -u src/sys/arch/arm/arm32/bus_dma.c:1.116 src/sys/arch/arm/arm32/bus_dma.c:1.117
--- src/sys/arch/arm/arm32/bus_dma.c:1.116	Sat Aug 24 11:51:26 2019
+++ src/sys/arch/arm/arm32/bus_dma.c	Tue Nov  5 09:57:47 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.116 2019/08/24 11:51:26 jmcneill Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.117 2019/11/05 09:57:47 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include "opt_cputypes.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.116 2019/08/24 11:51:26 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.117 2019/11/05 09:57:47 jmcneill Exp $");
 
 #include 
 #include 
@@ -1426,6 +1426,7 @@ _bus_dmamem_map(bus_dma_tag_t t, bus_dma
 		pa < (segs[curseg].ds_addr + segs[curseg].ds_len);
 		pa += PAGE_SIZE, va += PAGE_SIZE, size -= PAGE_SIZE) {
 			bool uncached = (flags & BUS_DMA_COHERENT);
+			bool prefetchable = (flags & BUS_DMA_PREFETCHABLE);
 #ifdef DEBUG_DMA
 			printf("wiring p%lx to v%lx", pa, va);
 #endif	/* DEBUG_DMA */
@@ -1443,8 +1444,14 @@ _bus_dmamem_map(bus_dma_tag_t t, bus_dma
 uncached = false;
 			}
 
+			u_int pmap_flags = PMAP_WIRED;
+			if (prefetchable)
+pmap_flags |= PMAP_WRITE_COMBINE;
+			else if (uncached)
+pmap_flags |= PMAP_NOCACHE;
+
 			pmap_kenter_pa(va, pa, VM_PROT_READ | VM_PROT_WRITE,
-			PMAP_WIRED | (uncached ? PMAP_NOCACHE : 0));
+			pmap_flags);
 		}
 	}
 	pmap_update(pmap_kernel());



CVS commit: src/sys/arch/arm/arm32

2019-10-20 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 20 14:25:14 UTC 2019

Modified Files:
src/sys/arch/arm/arm32: cpu.c

Log Message:
cpu_hatched_p only for MULTIPROCESSOR


To generate a diff of this commit:
cvs rdiff -u -r1.133 -r1.134 src/sys/arch/arm/arm32/cpu.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/arm/arm32/cpu.c
diff -u src/sys/arch/arm/arm32/cpu.c:1.133 src/sys/arch/arm/arm32/cpu.c:1.134
--- src/sys/arch/arm/arm32/cpu.c:1.133	Sat Oct 19 18:04:26 2019
+++ src/sys/arch/arm/arm32/cpu.c	Sun Oct 20 14:25:14 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.133 2019/10/19 18:04:26 jmcneill Exp $	*/
+/*	$NetBSD: cpu.c,v 1.134 2019/10/20 14:25:14 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 1995 Mark Brinicombe.
@@ -46,7 +46,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.133 2019/10/19 18:04:26 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.134 2019/10/20 14:25:14 jmcneill Exp $");
 
 #include 
 #include 
@@ -239,12 +239,14 @@ cpu_attach(device_t dv, cpuid_t id)
 	vfp_attach(ci);		/* XXX SMP */
 }
 
+#ifdef MULTIPROCESSOR
 bool
 cpu_hatched_p(u_int cpuindex)
 {
 	membar_consumer();
 	return (arm_cpu_hatched & __BIT(cpuindex)) != 0;
 }
+#endif
 
 enum cpu_class {
 	CPU_CLASS_NONE,



CVS commit: src/sys/arch/arm/arm32

2019-10-20 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 20 14:25:14 UTC 2019

Modified Files:
src/sys/arch/arm/arm32: cpu.c

Log Message:
cpu_hatched_p only for MULTIPROCESSOR


To generate a diff of this commit:
cvs rdiff -u -r1.133 -r1.134 src/sys/arch/arm/arm32/cpu.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/arm/arm32

2019-09-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Sep 29 06:51:45 UTC 2019

Modified Files:
src/sys/arch/arm/arm32: cpu.c

Log Message:
aprint_debug_dev output alignment


To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.132 src/sys/arch/arm/arm32/cpu.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/arm/arm32/cpu.c
diff -u src/sys/arch/arm/arm32/cpu.c:1.131 src/sys/arch/arm/arm32/cpu.c:1.132
--- src/sys/arch/arm/arm32/cpu.c:1.131	Sun Sep  8 07:59:43 2019
+++ src/sys/arch/arm/arm32/cpu.c	Sun Sep 29 06:51:45 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.131 2019/09/08 07:59:43 tnn Exp $	*/
+/*	$NetBSD: cpu.c,v 1.132 2019/09/29 06:51:45 skrll Exp $	*/
 
 /*
  * Copyright (c) 1995 Mark Brinicombe.
@@ -46,7 +46,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.131 2019/09/08 07:59:43 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.132 2019/09/29 06:51:45 skrll Exp $");
 
 #include 
 #include 
@@ -689,6 +689,8 @@ identify_arm_cpu(device_t dv, struct cpu
 		aprint_normal(": %s\n", model);
 	}
 
+	aprint_debug_dev(dv, "midr:   %#x\n", arm_cpuid);
+
 	aprint_normal("%s:", xname);
 
 	switch (cpu_class) {
@@ -856,11 +858,11 @@ identify_features(device_t dv)
 	cpu_processor_features[0] = armreg_pfr0_read();
 	cpu_processor_features[1] = armreg_pfr1_read();
 
-	aprint_debug_dev(dv, "sctlr: %#x\n", armreg_sctlr_read());
-	aprint_debug_dev(dv, "actlr: %#x\n", armreg_auxctl_read());
+	aprint_debug_dev(dv, "sctlr:  %#x\n", armreg_sctlr_read());
+	aprint_debug_dev(dv, "actlr:  %#x\n", armreg_auxctl_read());
 	aprint_debug_dev(dv, "revidr: %#x\n", armreg_revidr_read());
 #ifdef MULTIPROCESSOR
-	aprint_debug_dev(dv, "mpidr: %#x\n", armreg_mpidr_read());
+	aprint_debug_dev(dv, "mpidr:  %#x\n", armreg_mpidr_read());
 #endif
 	aprint_debug_dev(dv,
 	"isar: [0]=%#x [1]=%#x [2]=%#x [3]=%#x, [4]=%#x, [5]=%#x\n",



CVS commit: src/sys/arch/arm/arm32

2019-09-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Sep 29 06:51:45 UTC 2019

Modified Files:
src/sys/arch/arm/arm32: cpu.c

Log Message:
aprint_debug_dev output alignment


To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.132 src/sys/arch/arm/arm32/cpu.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/arm/arm32

2019-09-25 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Sep 25 16:37:54 UTC 2019

Modified Files:
src/sys/arch/arm/arm32: pmap.c

Log Message:
Convert a __CTASSERT into a KASSERT as L1_S_CACHE_MASK may not be a
compile time constant if ARM_NMMUS > 1


To generate a diff of this commit:
cvs rdiff -u -r1.373 -r1.374 src/sys/arch/arm/arm32/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/arm/arm32/pmap.c
diff -u src/sys/arch/arm/arm32/pmap.c:1.373 src/sys/arch/arm/arm32/pmap.c:1.374
--- src/sys/arch/arm/arm32/pmap.c:1.373	Tue Apr 23 11:21:21 2019
+++ src/sys/arch/arm/arm32/pmap.c	Wed Sep 25 16:37:54 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.373 2019/04/23 11:21:21 bouyer Exp $	*/
+/*	$NetBSD: pmap.c,v 1.374 2019/09/25 16:37:54 skrll Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -221,7 +221,7 @@
 #include 
 #endif
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.373 2019/04/23 11:21:21 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.374 2019/09/25 16:37:54 skrll Exp $");
 
 //#define PMAP_DEBUG
 #ifdef PMAP_DEBUG
@@ -6406,7 +6406,7 @@ pmap_set_pt_cache_mode(pd_entry_t *kl1, 
 		pd_entry_t pde = *pdep;
 
 		if (l1pte_section_p(pde)) {
-			__CTASSERT((L1_S_CACHE_MASK & L1_S_V6_SUPER) == 0);
+			KASSERT((L1_S_CACHE_MASK & L1_S_V6_SUPER) == 0);
 			if ((pde & L1_S_CACHE_MASK) != pte_l1_s_cache_mode_pt) {
 *pdep = (pde & ~L1_S_CACHE_MASK) |
 pte_l1_s_cache_mode_pt;



CVS commit: src/sys/arch/arm/arm32

2019-09-25 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Sep 25 16:37:54 UTC 2019

Modified Files:
src/sys/arch/arm/arm32: pmap.c

Log Message:
Convert a __CTASSERT into a KASSERT as L1_S_CACHE_MASK may not be a
compile time constant if ARM_NMMUS > 1


To generate a diff of this commit:
cvs rdiff -u -r1.373 -r1.374 src/sys/arch/arm/arm32/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/arm/arm32

2019-09-13 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Sep 13 06:30:10 UTC 2019

Modified Files:
src/sys/arch/arm/arm32: cpuswitch.S

Log Message:
Typo in comment


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/arch/arm/arm32/cpuswitch.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/arm/arm32

2019-09-13 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Sep 13 06:30:10 UTC 2019

Modified Files:
src/sys/arch/arm/arm32: cpuswitch.S

Log Message:
Typo in comment


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/arch/arm/arm32/cpuswitch.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/arm/arm32/cpuswitch.S
diff -u src/sys/arch/arm/arm32/cpuswitch.S:1.93 src/sys/arch/arm/arm32/cpuswitch.S:1.94
--- src/sys/arch/arm/arm32/cpuswitch.S:1.93	Thu Nov 22 21:28:21 2018
+++ src/sys/arch/arm/arm32/cpuswitch.S	Fri Sep 13 06:30:10 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpuswitch.S,v 1.93 2018/11/22 21:28:21 skrll Exp $	*/
+/*	$NetBSD: cpuswitch.S,v 1.94 2019/09/13 06:30:10 skrll Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -87,7 +87,7 @@
 #include 
 #include 
 
-	RCSID("$NetBSD: cpuswitch.S,v 1.93 2018/11/22 21:28:21 skrll Exp $")
+	RCSID("$NetBSD: cpuswitch.S,v 1.94 2019/09/13 06:30:10 skrll Exp $")
 
 /* LINTSTUB: include  */
 
@@ -452,7 +452,7 @@ END(softint_switch)
  * r7 = curcpu()
  */
 ENTRY_NP(softint_tramp)
-	ldr	r3, [r7, #(CI_MTX_COUNT)]	/* readust after mi_switch */
+	ldr	r3, [r7, #(CI_MTX_COUNT)]	/* readjust after mi_switch */
 	add	r3, r3, #1
 	str	r3, [r7, #(CI_MTX_COUNT)]
 



CVS commit: src/sys/arch/arm/arm32

2019-09-08 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Sep  8 07:59:44 UTC 2019

Modified Files:
src/sys/arch/arm/arm32: cpu.c

Log Message:
report A12 as A17 to the user. A12 is retcon'ed by ARM.


To generate a diff of this commit:
cvs rdiff -u -r1.130 -r1.131 src/sys/arch/arm/arm32/cpu.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/arm/arm32/cpu.c
diff -u src/sys/arch/arm/arm32/cpu.c:1.130 src/sys/arch/arm/arm32/cpu.c:1.131
--- src/sys/arch/arm/arm32/cpu.c:1.130	Sat Sep  7 19:42:42 2019
+++ src/sys/arch/arm/arm32/cpu.c	Sun Sep  8 07:59:43 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.130 2019/09/07 19:42:42 tnn Exp $	*/
+/*	$NetBSD: cpu.c,v 1.131 2019/09/08 07:59:43 tnn Exp $	*/
 
 /*
  * Copyright (c) 1995 Mark Brinicombe.
@@ -46,7 +46,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.130 2019/09/07 19:42:42 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.131 2019/09/08 07:59:43 tnn Exp $");
 
 #include 
 #include 
@@ -518,7 +518,7 @@ const struct cpuidtab cpuids[] = {
 	  pN_steppings, "7A" },
 	{ CPU_ID_CORTEXA9R4,	CPU_CLASS_CORTEX,	"Cortex-A9 r4",
 	  pN_steppings, "7A" },
-	{ CPU_ID_CORTEXA12R0,	CPU_CLASS_CORTEX,	"Cortex-A12 r0",
+	{ CPU_ID_CORTEXA12R0,	CPU_CLASS_CORTEX,	"Cortex-A17(A12) r0",	/* A12 was rebranded A17 */
 	  pN_steppings, "7A" },
 	{ CPU_ID_CORTEXA15R2,	CPU_CLASS_CORTEX,	"Cortex-A15 r2",
 	  pN_steppings, "7A" },



CVS commit: src/sys/arch/arm/arm32

2019-09-08 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Sep  8 07:59:44 UTC 2019

Modified Files:
src/sys/arch/arm/arm32: cpu.c

Log Message:
report A12 as A17 to the user. A12 is retcon'ed by ARM.


To generate a diff of this commit:
cvs rdiff -u -r1.130 -r1.131 src/sys/arch/arm/arm32/cpu.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/arm/arm32

2019-08-24 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug 24 11:51:26 UTC 2019

Modified Files:
src/sys/arch/arm/arm32: bus_dma.c

Log Message:
bus_dmamap_load_raw: support coherent mappings
bus_dmamap_sync: support syncing "raw" buffer types


To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.116 src/sys/arch/arm/arm32/bus_dma.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/arm/arm32

2019-08-24 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug 24 11:51:26 UTC 2019

Modified Files:
src/sys/arch/arm/arm32: bus_dma.c

Log Message:
bus_dmamap_load_raw: support coherent mappings
bus_dmamap_sync: support syncing "raw" buffer types


To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.116 src/sys/arch/arm/arm32/bus_dma.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/arm/arm32/bus_dma.c
diff -u src/sys/arch/arm/arm32/bus_dma.c:1.115 src/sys/arch/arm/arm32/bus_dma.c:1.116
--- src/sys/arch/arm/arm32/bus_dma.c:1.115	Fri Jun 14 09:09:12 2019
+++ src/sys/arch/arm/arm32/bus_dma.c	Sat Aug 24 11:51:26 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.115 2019/06/14 09:09:12 skrll Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.116 2019/08/24 11:51:26 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include "opt_cputypes.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.115 2019/06/14 09:09:12 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.116 2019/08/24 11:51:26 jmcneill Exp $");
 
 #include 
 #include 
@@ -750,8 +750,10 @@ _bus_dmamap_load_raw(bus_dma_tag_t t, bu
 		sgsize = MIN(ds->ds_len, size);
 		if (sgsize == 0)
 			continue;
+		const bool coherent =
+		(ds->_ds_flags & _BUS_DMAMAP_COHERENT) != 0;
 		error = _bus_dmamap_load_paddr(t, map, ds->ds_addr,
-		sgsize, false);
+		sgsize, coherent);
 		if (error != 0)
 			break;
 		size -= sgsize;
@@ -766,6 +768,9 @@ _bus_dmamap_load_raw(bus_dma_tag_t t, bu
 	/* XXX TBD bounce */
 
 	map->dm_mapsize = size0;
+	map->_dm_origbuf = NULL;
+	map->_dm_buftype = _BUS_DMA_BUFTYPE_RAW;
+	map->_dm_vmspace = NULL;
 	return 0;
 }
 
@@ -1165,6 +1170,7 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dm
 
 	switch (buftype) {
 	case _BUS_DMA_BUFTYPE_LINEAR:
+	case _BUS_DMA_BUFTYPE_RAW:
 		_bus_dmamap_sync_linear(t, map, offset, len, ops);
 		break;
 
@@ -1176,10 +1182,6 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dm
 		_bus_dmamap_sync_uio(t, map, offset, len, ops);
 		break;
 
-	case _BUS_DMA_BUFTYPE_RAW:
-		panic("_bus_dmamap_sync: _BUS_DMA_BUFTYPE_RAW");
-		break;
-
 	case _BUS_DMA_BUFTYPE_INVALID:
 		panic("_bus_dmamap_sync: _BUS_DMA_BUFTYPE_INVALID");
 		break;



CVS commit: src/sys/arch/arm/arm32

2019-08-11 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Aug 11 06:49:31 UTC 2019

Modified Files:
src/sys/arch/arm/arm32: exception.S

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/arm/arm32/exception.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/arm/arm32/exception.S
diff -u src/sys/arch/arm/arm32/exception.S:1.24 src/sys/arch/arm/arm32/exception.S:1.25
--- src/sys/arch/arm/arm32/exception.S:1.24	Fri Jul  7 00:34:09 2017
+++ src/sys/arch/arm/arm32/exception.S	Sun Aug 11 06:49:31 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: exception.S,v 1.24 2017/07/07 00:34:09 chs Exp $	*/
+/*	$NetBSD: exception.S,v 1.25 2019/08/11 06:49:31 skrll Exp $	*/
 
 /*
  * Copyright (c) 1994-1997 Mark Brinicombe.
@@ -51,9 +51,9 @@
 
 #include 
 
-	RCSID("$NetBSD: exception.S,v 1.24 2017/07/07 00:34:09 chs Exp $")
+	RCSID("$NetBSD: exception.S,v 1.25 2019/08/11 06:49:31 skrll Exp $")
 
-	.text	
+	.text
 	.align	0
 
 AST_ALIGNMENT_FAULT_LOCALS



CVS commit: src/sys/arch/arm/arm32

2019-08-11 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Aug 11 06:49:31 UTC 2019

Modified Files:
src/sys/arch/arm/arm32: exception.S

Log Message:
Trailing whitespace


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

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

Modified Files:
src/sys/arch/arm/arm32: db_interface.c

Log Message:
Fix hand-crafted trap instruction in cpu_Debugger() for big endian.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/arm/arm32/db_interface.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/arm/arm32/db_interface.c
diff -u src/sys/arch/arm/arm32/db_interface.c:1.58 src/sys/arch/arm/arm32/db_interface.c:1.59
--- src/sys/arch/arm/arm32/db_interface.c:1.58	Mon May 28 21:05:00 2018
+++ src/sys/arch/arm/arm32/db_interface.c	Sun Jul 21 16:12:59 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_interface.c,v 1.58 2018/05/28 21:05:00 chs Exp $	*/
+/*	$NetBSD: db_interface.c,v 1.59 2019/07/21 16:12:59 rin Exp $	*/
 
 /*
  * Copyright (c) 1996 Scott K. Stevens
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.58 2018/05/28 21:05:00 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.59 2019/07/21 16:12:59 rin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -302,7 +302,11 @@ db_write_bytes(vaddr_t addr, size_t size
 void
 cpu_Debugger(void)
 {
+#if _BYTE_ORDER == _LITTLE_ENDIAN
 	__asm(".word	0xe7ff");
+#else
+	__asm(".word	0xffe7");
+#endif
 }
 
 int



CVS commit: src/sys/arch/arm/arm32

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

Modified Files:
src/sys/arch/arm/arm32: db_interface.c

Log Message:
Fix hand-crafted trap instruction in cpu_Debugger() for big endian.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/arm/arm32/db_interface.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/arm/arm32

2019-06-14 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Jun 14 09:09:12 UTC 2019

Modified Files:
src/sys/arch/arm/arm32: bus_dma.c

Log Message:
Simplify the _ARM32_NEED_BUS_DMA_BOUNCE #ifdefs and rely on compiler
optimisation of the bouncing = false case.

Drain the write buf (aka DSB) in more cases

Catch all CPUs that support speculation. (thunderx isn't CPU_CORTEX)


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

2019-06-14 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Jun 14 09:09:12 UTC 2019

Modified Files:
src/sys/arch/arm/arm32: bus_dma.c

Log Message:
Simplify the _ARM32_NEED_BUS_DMA_BOUNCE #ifdefs and rely on compiler
optimisation of the bouncing = false case.

Drain the write buf (aka DSB) in more cases

Catch all CPUs that support speculation. (thunderx isn't CPU_CORTEX)


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/sys/arch/arm/arm32/bus_dma.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/arm/arm32/bus_dma.c
diff -u src/sys/arch/arm/arm32/bus_dma.c:1.114 src/sys/arch/arm/arm32/bus_dma.c:1.115
--- src/sys/arch/arm/arm32/bus_dma.c:1.114	Sat Jun  8 11:57:27 2019
+++ src/sys/arch/arm/arm32/bus_dma.c	Fri Jun 14 09:09:12 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.114 2019/06/08 11:57:27 skrll Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.115 2019/06/14 09:09:12 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include "opt_cputypes.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.114 2019/06/08 11:57:27 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.115 2019/06/14 09:09:12 skrll Exp $");
 
 #include 
 #include 
@@ -254,12 +254,13 @@ _bus_dmamap_load_paddr(bus_dma_tag_t t, 
 	return 0;
 }
 
+static int _bus_dma_uiomove(void *buf, struct uio *uio, size_t n,
+	int direction);
+
 #ifdef _ARM32_NEED_BUS_DMA_BOUNCE
 static int _bus_dma_alloc_bouncebuf(bus_dma_tag_t t, bus_dmamap_t map,
 	bus_size_t size, int flags);
 static void _bus_dma_free_bouncebuf(bus_dma_tag_t t, bus_dmamap_t map);
-static int _bus_dma_uiomove(void *buf, struct uio *uio, size_t n,
-	int direction);
 
 static int
 _bus_dma_load_bouncebuf(bus_dma_tag_t t, bus_dmamap_t map, void *buf,
@@ -796,7 +797,7 @@ _bus_dmamap_sync_segment(vaddr_t va, pad
 bool readonly_p)
 {
 
-#if defined(ARM_MMU_EXTENDED) || defined(CPU_CORTEX)
+#if defined(ARM_MMU_EXTENDED)
 	/*
 	 * No optimisations are available for readonly mbufs on armv6+, so
 	 * assume it's not readonly from here on.
@@ -863,7 +864,8 @@ _bus_dmamap_sync_segment(vaddr_t va, pad
 		cpu_sdcache_wb_range(va, pa, len);
 		break;
 
-#ifdef CPU_CORTEX
+#if defined(CPU_CORTEX) || defined(CPU_ARMV8)
+
 	/*
 	 * Cortex CPUs can do speculative loads so we need to clean the cache
 	 * after a DMA read to deal with any speculatively loaded cache lines.
@@ -1074,22 +1076,23 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dm
 #endif
 
 	const int pre_ops = ops & (BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
-#ifdef CPU_CORTEX
+#if defined(CPU_CORTEX) || defined(CPU_ARMV8)
 	const int post_ops = ops & (BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE);
 #else
 	const int post_ops = 0;
 #endif
-	if (!bouncing) {
-		if (pre_ops == 0 && post_ops == BUS_DMASYNC_POSTWRITE) {
-			STAT_INCR(sync_postwrite);
-			return;
-		} else if (pre_ops == 0 && post_ops == 0) {
-			return;
-		}
+	if (pre_ops == 0 && post_ops == 0)
+		return;
+
+	if (post_ops == BUS_DMASYNC_POSTWRITE) {
+		KASSERT(pre_ops == 0);
+		STAT_INCR(sync_postwrite);
+		return;
 	}
+
 	KASSERTMSG(bouncing || pre_ops != 0 || (post_ops & BUS_DMASYNC_POSTREAD),
 	"pre_ops %#x post_ops %#x", pre_ops, post_ops);
-#ifdef _ARM32_NEED_BUS_DMA_BOUNCE
+
 	if (bouncing && (ops & BUS_DMASYNC_PREWRITE)) {
 		struct arm32_bus_dma_cookie * const cookie = map->_dm_cookie;
 		STAT_INCR(write_bounces);
@@ -1123,23 +1126,28 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dm
 #endif /* DIAGNOSTIC */
 		}
 	}
-#endif /* _ARM32_NEED_BUS_DMA_BOUNCE */
 
-	/* Skip cache frobbing if mapping was COHERENT. */
-	if (!bouncing && (map->_dm_flags & _BUS_DMAMAP_COHERENT)) {
-		/* Drain the write buffer. */
-		if (pre_ops & BUS_DMASYNC_PREWRITE)
+	/* Skip cache frobbing if mapping was COHERENT */
+	if ((map->_dm_flags & _BUS_DMAMAP_COHERENT)) {
+		/*
+		 * Drain the write buffer of DMA operators.
+		 * 1) when cpu->device (prewrite)
+		 * 2) when device->cpu (postread)
+		 */
+		if ((pre_ops & BUS_DMASYNC_PREWRITE) || (post_ops & BUS_DMASYNC_POSTREAD))
 			cpu_drain_writebuf();
-		return;
-	}
 
-#ifdef _ARM32_NEED_BUS_DMA_BOUNCE
-	if (bouncing && ((map->_dm_flags & _BUS_DMAMAP_COHERENT) || pre_ops == 0)) {
-		goto bounce_it;
+		/*
+		 * Only thing left to do for COHERENT mapping is copy from bounce
+		 * in the POSTREAD case.
+		 */
+		if (bouncing && (post_ops & BUS_DMASYNC_POSTREAD))
+			goto bounce_it;
+
+		return;
 	}
-#endif /* _ARM32_NEED_BUS_DMA_BOUNCE */
 
-#ifndef ARM_MMU_EXTENDED
+#if !defined( ARM_MMU_EXTENDED)
 	/*
 	 * If the mapping belongs to a non-kernel vmspace, and the
 	 * vmspace has not been active since the last time a full
@@ -1151,11 +1159,9 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dm
 #endif
 
 	int buftype = map->_dm_buftype;
-#ifdef _ARM32_NEED_BUS_DMA_BOUNCE
 	if (bouncing) {
 		buftype = _BUS_DMA_BUFTYPE_LINEAR;
 	}
-#endif
 
 	switch (buftype) {
 	case 

CVS commit: src/sys/arch/arm/arm32

2019-06-08 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jun  8 11:57:27 UTC 2019

Modified Files:
src/sys/arch/arm/arm32: bus_dma.c

Log Message:
Fix comment


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/arch/arm/arm32/bus_dma.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/arm/arm32/bus_dma.c
diff -u src/sys/arch/arm/arm32/bus_dma.c:1.113 src/sys/arch/arm/arm32/bus_dma.c:1.114
--- src/sys/arch/arm/arm32/bus_dma.c:1.113	Fri Sep 14 10:13:02 2018
+++ src/sys/arch/arm/arm32/bus_dma.c	Sat Jun  8 11:57:27 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.113 2018/09/14 10:13:02 skrll Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.114 2019/06/08 11:57:27 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include "opt_cputypes.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.113 2018/09/14 10:13:02 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.114 2019/06/08 11:57:27 skrll Exp $");
 
 #include 
 #include 
@@ -1022,9 +1022,6 @@ _bus_dmamap_sync_uio(bus_dma_tag_t t, bu
  * Common function for DMA map synchronization.  May be called
  * by bus-specific DMA map synchronization functions.
  *
- * This version works for the Virtually Indexed Virtually Tagged
- * cache found on 32-bit ARM processors.
- *
  * XXX Should have separate versions for write-through vs.
  * XXX write-back caches.  We currently assume write-back
  * XXX here, which is not as efficient as it could be for



CVS commit: src/sys/arch/arm/arm32

2019-06-08 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jun  8 11:57:27 UTC 2019

Modified Files:
src/sys/arch/arm/arm32: bus_dma.c

Log Message:
Fix comment


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

2018-07-17 Thread Joerg Sonnenberger
On Tue, Jul 17, 2018 at 05:29:07AM +, Martin Husemann wrote:
> Module Name:  src
> Committed By: martin
> Date: Tue Jul 17 05:29:07 UTC 2018
> 
> Modified Files:
>   src/sys/arch/arm/arm32: bus_dma.c
> 
> Log Message:
> Revert previous and cast to u_quad_t instead (t is for ptrdiff_t and off_t
> does not match that on all arm)

Please do not use *quad_t.

Joerg


Re: CVS commit: src/sys/arch/arm/arm32

2016-07-15 Thread coypu
On Fri, Jul 15, 2016 at 05:59:46AM +, Nick Hudson wrote:
> +
> +bool
> +mm_md_page_color(paddr_t pa, int *colorp)
> +{
> + *colorp = atop(pa & arm_cache_prefer_mask);
> +
> + return arm_cache_prefer_mask ? false : true;
> +}
> 

arm_cache_prefer_mask only exists for armv6/armv7 now


Re: CVS commit: src/sys/arch/arm/arm32

2016-07-15 Thread coypu
On Fri, Jul 15, 2016 at 05:59:46AM +, Nick Hudson wrote:
> Module Name:  src
> Committed By: skrll
> Date: Fri Jul 15 05:59:46 UTC 2016
> 
> Modified Files:
>   src/sys/arch/arm/arm32: arm32_machdep.c
> 
> Log Message:
> Provide a mm_md_page_color and fix some kernel builds
> 
> 

Seems it broke the rest of them.
I can build with this diff, but I don't know if it is correct.
Index: arm32_machdep.c
===
RCS file: /cvsroot/src/sys/arch/arm/arm32/arm32_machdep.c,v
retrieving revision 1.111
diff -u -r1.111 arm32_machdep.c
--- arm32_machdep.c 15 Jul 2016 05:59:46 -  1.111
+++ arm32_machdep.c 15 Jul 2016 19:31:34 -
@@ -746,11 +746,3 @@
return rv;
 }
 #endif
-
-bool
-mm_md_page_color(paddr_t pa, int *colorp)
-{
-   *colorp = atop(pa & arm_cache_prefer_mask);
-
-   return arm_cache_prefer_mask ? false : true;
-}
Index: pmap.c
===
RCS file: /cvsroot/src/sys/arch/arm/arm32/pmap.c,v
retrieving revision 1.335
diff -u -r1.335 pmap.c
--- pmap.c  14 Jul 2016 15:51:41 -  1.335
+++ pmap.c  15 Jul 2016 19:31:37 -
@@ -519,6 +519,13 @@
 vaddr_t pmap_directlimit;
 #endif
 
+static inline bool
+mm_md_page_color(paddr_t pa, int *colorp)
+{
+   *colorp = atop(pa & arm_cache_prefer_mask);
+
+   return arm_cache_prefer_mask ? false : true;
+}
 /*
  * Misc. locking data structures
  */
@@ -7945,3 +7952,4 @@
 #endif
 }
 #endif /* __HAVE_MM_MD_DIRECT_MAPPED_PHYS */
+


Re: CVS commit: src/sys/arch/arm/arm32

2014-04-02 Thread Hisashi T Fujinaka

On Wed, 2 Apr 2014, Matt Thomas wrote:


Module Name:src
Committed By:   matt
Date:   Wed Apr  2 14:05:54 UTC 2014

Modified Files:
src/sys/arch/arm/arm32: pmap.c

Log Message:
Init the page_lock to IPL_VM iff VIPT  arm_cache_prefer_mask != 0 otherwise
use IPL_NONE.  Don't bother with page_lock for KMPAGEs.


To generate a diff of this commit:
cvs rdiff -u -r1.277 -r1.278 src/sys/arch/arm/arm32/pmap.c

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


This won't build without DIAGNOSITC defined. In map_kremove_pg() you use
omd without defining it otherwise.

--
Hisashi T Fujinaka - ht...@twofifty.com
BSEE(6/86) + BSChem(3/95) + BAEnglish(8/95) + MSCS(8/03) + $2.50 = latte


CVS commit: src/sys/arch/arm/arm32

2010-01-23 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Jan 23 15:58:13 UTC 2010

Modified Files:
src/sys/arch/arm/arm32: cpu.c

Log Message:
rename a local cpu_name structure member to avoid potential conflict
with sys/cpu.h's.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/arm/arm32/cpu.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/arm/arm32

2010-01-18 Thread Julio M. Merino Vidal
Module Name:src
Committed By:   jmmv
Date:   Mon Jan 18 23:04:30 UTC 2010

Modified Files:
src/sys/arch/arm/arm32: arm32_machdep.c

Log Message:
Define an empty module_init_md function so that kernels with 'options
MODULAR' can be built (at least in shark).  Still not working due to
some relocations resolving to too far away symbols though.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/arm/arm32/arm32_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/arm/arm32

2010-01-01 Thread Havard Eidnes
Module Name:src
Committed By:   he
Date:   Sat Jan  2 07:53:29 UTC 2010

Modified Files:
src/sys/arch/arm/arm32: pmap.c

Log Message:
Remove a shadowed and unused local declaration so that this builds again.


To generate a diff of this commit:
cvs rdiff -u -r1.210 -r1.211 src/sys/arch/arm/arm32/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/arm/arm32

2009-12-31 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Thu Dec 31 16:00:53 UTC 2009

Modified Files:
src/sys/arch/arm/arm32: pmap.c

Log Message:
pmap_page_remove(): remove an unused local variable; no functional changes.


To generate a diff of this commit:
cvs rdiff -u -r1.207 -r1.208 src/sys/arch/arm/arm32/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/arm/arm32

2009-12-31 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Fri Jan  1 02:32:29 UTC 2010

Modified Files:
src/sys/arch/arm/arm32: pmap.c

Log Message:
Sprinkle assertions after calling pmap_get_l2_bucket().


To generate a diff of this commit:
cvs rdiff -u -r1.209 -r1.210 src/sys/arch/arm/arm32/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/arm/arm32

2009-12-03 Thread Masao Uebayashi
I spoke too early.  I still see problems.  I'll post this to port-arm@ after
sorting out things.

Masao

-- 
Masao Uebayashi / Tombi Inc. / Tel: +81-90-9141-4635


Re: CVS commit: src/sys/arch/arm/arm32

2009-11-30 Thread Rafal Boni
On Sat, Nov 28, 2009 at 11:44:45AM +, Steve Woodford wrote:
 Module Name:  src
 Committed By: scw
 Date: Sat Nov 28 11:44:45 UTC 2009
 
 Modified Files:
   src/sys/arch/arm/arm32: pmap.c
 
 Log Message:
 Apply some band-aid to pmap_activate() for PR kern/41058:
 
 There's a corner case here which can leave turds in the cache as
 reported in kern/41058. They're probably left over during tear-down and
 switching away from an exiting process. Until the root cause is identified
 and fixed, zap the cache when switching pmaps. This will result in a few
 unnecessary cache flushes, but that's better than silently corrupting data.
 
 Also remove an extraneous return statement in pmap_page_protect() which
 crept in during the matt-armv6 merge.

Hmm, this reminds me of port-arm/38950, where we were seeing hangs on exit
due to some don't-need-to-do-full-context-switch optimizations.  Could the
two issues be related?  I haven't looked at this issue, but I did do a bunch
of analysis for port-arm/38950, there's a fair bit of background there.

--rafal

-- 
  Time is an illusion; lunchtime, doubly so. |/\/\|   Rafal Boni
   -- Ford Prefect   |\/\/|  ra...@pobox.com