CVS commit: src/sys/dev/usb

2022-08-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug  7 11:25:33 UTC 2022

Modified Files:
src/sys/dev/usb: uirda.c

Log Message:
uirda(4): Unconditionally initializes mutexes and selq on attach.

We're going to unconditionally destroy them on detach.

Reported-by: syzbot+6b8aea3a51d8b1e5a...@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=ec5ed628986cba5aab5705691596a2d27b0301fc


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/dev/usb/uirda.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/dev/usb/uirda.c
diff -u src/sys/dev/usb/uirda.c:1.52 src/sys/dev/usb/uirda.c:1.53
--- src/sys/dev/usb/uirda.c:1.52	Sun Sep 26 15:08:29 2021
+++ src/sys/dev/usb/uirda.c	Sun Aug  7 11:25:32 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: uirda.c,v 1.52 2021/09/26 15:08:29 thorpej Exp $	*/
+/*	$NetBSD: uirda.c,v 1.53 2022/08/07 11:25:32 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uirda.c,v 1.52 2021/09/26 15:08:29 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uirda.c,v 1.53 2022/08/07 11:25:32 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -201,6 +201,10 @@ uirda_attach(device_t parent, device_t s
 	sc->sc_udev = dev;
 	sc->sc_iface = iface;
 
+	mutex_init(>sc_wr_buf_lk, MUTEX_DEFAULT, IPL_NONE);
+	mutex_init(>sc_rd_buf_lk, MUTEX_DEFAULT, IPL_NONE);
+	selinit(>sc_rd_sel);
+
 	if (sc->sc_hdszi == 0)
 		sc->sc_hdszi = UIRDA_INPUT_HEADER_SIZE;
 
@@ -280,10 +284,6 @@ uirda_attach(device_t parent, device_t s
 
 	usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, sc->sc_dev);
 
-	mutex_init(>sc_wr_buf_lk, MUTEX_DEFAULT, IPL_NONE);
-	mutex_init(>sc_rd_buf_lk, MUTEX_DEFAULT, IPL_NONE);
-	selinit(>sc_rd_sel);
-
 	ia.ia_type = IR_TYPE_IRFRAME;
 	ia.ia_methods = sc->sc_irm ? sc->sc_irm : _methods;
 	ia.ia_handle = sc;



CVS commit: src/sys/dev/usb

2022-08-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug  7 11:25:33 UTC 2022

Modified Files:
src/sys/dev/usb: uirda.c

Log Message:
uirda(4): Unconditionally initializes mutexes and selq on attach.

We're going to unconditionally destroy them on detach.

Reported-by: syzbot+6b8aea3a51d8b1e5a...@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=ec5ed628986cba5aab5705691596a2d27b0301fc


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/dev/usb/uirda.c

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



CVS commit: src/common/lib/libc/arch/aarch64/atomic

2022-08-06 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  6 21:31:33 UTC 2022

Modified Files:
src/common/lib/libc/arch/aarch64/atomic: Makefile.inc __aarch64_lse.S

Log Message:
aarch64: Implement __aarch64_casN_sync.

gcc generates calls to this symbol in programs that use
__sync_*_compare_and_swap, which require full sequential consistency
barriers, including store-before-load ordering on both sides of the
atomic; none of the release/acquire operations guarantee that, so we
have to insert explicit DMB instructions.

Note: gcc's own definition omits some of the DMB instructions, but I
can't prove that it's correct that way -- stores preceding the CAS
must complete before the load part of the CAS, and the store part of
the CAS must complete before loads following the CAS.  Maybe there's
some way to prove that one of these orderings is guaranteed some
other way than a DMB but I'm not seeing it, and store-before-load
ordering is hard to understand.

Patch by skrll@ based on a patch by mrg@, soliloquy in commit message
by me.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/arch/aarch64/atomic/Makefile.inc
cvs rdiff -u -r1.6 -r1.7 \
src/common/lib/libc/arch/aarch64/atomic/__aarch64_lse.S

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

Modified files:

Index: src/common/lib/libc/arch/aarch64/atomic/Makefile.inc
diff -u src/common/lib/libc/arch/aarch64/atomic/Makefile.inc:1.4 src/common/lib/libc/arch/aarch64/atomic/Makefile.inc:1.5
--- src/common/lib/libc/arch/aarch64/atomic/Makefile.inc:1.4	Tue Apr 27 09:14:24 2021
+++ src/common/lib/libc/arch/aarch64/atomic/Makefile.inc	Sat Aug  6 21:31:33 2022
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.4 2021/04/27 09:14:24 skrll Exp $
+# $NetBSD: Makefile.inc,v 1.5 2022/08/06 21:31:33 riastradh Exp $
 
 .if defined(LIB) && (${LIB} == "kern" || ${LIB} == "c" || ${LIB} == "pthread" \
 	|| ${LIB} == "rump")
@@ -14,7 +14,7 @@ SRCS.atomic+=	membar_ops.S
 #and cas nand or sub swap xor
 .for op in swp cas clr set eor add
 .for sz in 1 2 4 8
-.for ar in _relax _acq _rel _acq_rel
+.for ar in _relax _acq _rel _acq_rel _sync
 __aarch64_${op}${sz}${ar}.S: __aarch64_lse.S
 	${_MKTARGET_CREATE}
 	printf '#define OP ${op}\n#define OP_${op}\n#define SZ ${sz}\n#define AR ${ar}\n#define AR${ar}\n#include "__aarch64_lse.S"\n' > ${.TARGET}
@@ -23,7 +23,7 @@ SRCS.gen+=	__aarch64_${op}${sz}${ar}.S
 .endfor
 .endfor
 .for op in casp
-.for ar in _relax _acq _rel _acq_rel
+.for ar in _relax _acq _rel _acq_rel _sync
 __aarch64_${op}${ar}.S: __aarch64_lse.S
 	${_MKTARGET_CREATE}
 	printf '#define OP ${op}\n#define OP_${op}\n#define AR ${ar}\n#define AR${ar}\n#include "__aarch64_lse.S"\n' > ${.TARGET}

Index: src/common/lib/libc/arch/aarch64/atomic/__aarch64_lse.S
diff -u src/common/lib/libc/arch/aarch64/atomic/__aarch64_lse.S:1.6 src/common/lib/libc/arch/aarch64/atomic/__aarch64_lse.S:1.7
--- src/common/lib/libc/arch/aarch64/atomic/__aarch64_lse.S:1.6	Sat Jul 23 13:30:15 2022
+++ src/common/lib/libc/arch/aarch64/atomic/__aarch64_lse.S	Sat Aug  6 21:31:33 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: __aarch64_lse.S,v 1.6 2022/07/23 13:30:15 skrll Exp $ */
+/* $NetBSD: __aarch64_lse.S,v 1.7 2022/08/06 21:31:33 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -64,21 +64,31 @@
 #if defined(AR_relax)
 #define ACQ
 #define REL
+#define DMB
 #endif
 
 #if defined(AR_acq)
 #define ACQ	a
 #define REL
+#define DMB
 #endif
 
 #if defined(AR_rel)
 #define ACQ
 #define REL	l
+#define DMB
 #endif
 
 #if defined(AR_acq_rel)
 #define ACQ	a
 #define REL	l
+#define DMB
+#endif
+
+#if defined(AR_sync)
+#define ACQ
+#define REL
+#define DMB	dmb ish
 #endif
 
 #if defined(OP_clr)
@@ -134,14 +144,18 @@
 ENTRY_NP(SWP_FUNC)
 #ifdef _HAVE_LSE
 	DO_LSE_INSN_IF_SUPPORTED(99f)
+	DMB
 	SWP	R0, R0, [x1]
+	DMB
 	ret
 99:
 #endif
 	mov	x4, x0			/* need x0 for return value	*/
+	DMB/* potential barrier		*/
 1:	LDXR	R0, [x1]		/* load old value		*/
 	STXR	w3, R4, [x1]		/* store new value		*/
 	cbnz	w3, 2f			/*   succeed?? no, try again	*/
+	DMB/* potential barrier		*/
 	ret/* return old value		*/
 2:	b	1b
 END(SWP_FUNC)
@@ -151,16 +165,20 @@ END(SWP_FUNC)
 ENTRY_NP(CAS_FUNC)
 #ifdef _HAVE_LSE
 	DO_LSE_INSN_IF_SUPPORTED(99f)
+	DMB
 	CAS	R0, R1, [x2]
+	DMB
 	ret
 99:
 #endif
 	mov	x4, x0			/* need x0 for return value	*/
+	DMB/* potential barrier		*/
 1:	LDXR	R0, [x2]		/* load old value		*/
 	cmp	R0, R4			/* compare			*/
 	b.ne	2f			/*   not equal? return		*/
 	STXR	w3, R1, [x2]		/* store new value		*/
 	cbnz	w3, 3f			/*   succeed? nope, try again.	*/
+	DMB/* potential barrier		*/
 2:	ret/* return.			*/
 3:	b	1b
 END(CAS_FUNC)
@@ -170,12 +188,15 @@ END(CAS_FUNC)
 ENTRY_NP(CASP_FUNC)
 #ifdef _HAVE_LSE
 	DO_LSE_INSN_IF_SUPPORTED(99f)
+	DMB
 	CASP	x0, x1, x2, x3, [x4]
+	DMB
 	ret
 99:
 #endif
 	mov	x5, x0			/* need x0 for return value	*/
 	mov	x6, x1			/* need x1 for return 

CVS commit: src/common/lib/libc/arch/aarch64/atomic

2022-08-06 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  6 21:31:33 UTC 2022

Modified Files:
src/common/lib/libc/arch/aarch64/atomic: Makefile.inc __aarch64_lse.S

Log Message:
aarch64: Implement __aarch64_casN_sync.

gcc generates calls to this symbol in programs that use
__sync_*_compare_and_swap, which require full sequential consistency
barriers, including store-before-load ordering on both sides of the
atomic; none of the release/acquire operations guarantee that, so we
have to insert explicit DMB instructions.

Note: gcc's own definition omits some of the DMB instructions, but I
can't prove that it's correct that way -- stores preceding the CAS
must complete before the load part of the CAS, and the store part of
the CAS must complete before loads following the CAS.  Maybe there's
some way to prove that one of these orderings is guaranteed some
other way than a DMB but I'm not seeing it, and store-before-load
ordering is hard to understand.

Patch by skrll@ based on a patch by mrg@, soliloquy in commit message
by me.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/arch/aarch64/atomic/Makefile.inc
cvs rdiff -u -r1.6 -r1.7 \
src/common/lib/libc/arch/aarch64/atomic/__aarch64_lse.S

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



CVS commit: src/sys/kern

2022-08-06 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  6 21:21:10 UTC 2022

Modified Files:
src/sys/kern: vfs_vnops.c

Log Message:
vnodeops(9): Take exclusive lock in read/seek for f_offset update.

Otherwise concurrent readers/seekers might clobber it.


To generate a diff of this commit:
cvs rdiff -u -r1.234 -r1.235 src/sys/kern/vfs_vnops.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/kern/vfs_vnops.c
diff -u src/sys/kern/vfs_vnops.c:1.234 src/sys/kern/vfs_vnops.c:1.235
--- src/sys/kern/vfs_vnops.c:1.234	Mon Jul 18 04:30:30 2022
+++ src/sys/kern/vfs_vnops.c	Sat Aug  6 21:21:10 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_vnops.c,v 1.234 2022/07/18 04:30:30 thorpej Exp $	*/
+/*	$NetBSD: vfs_vnops.c,v 1.235 2022/08/06 21:21:10 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.234 2022/07/18 04:30:30 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.235 2022/08/06 21:21:10 riastradh Exp $");
 
 #include "veriexec.h"
 
@@ -647,7 +647,10 @@ vn_read(file_t *fp, off_t *offset, struc
 		ioflag |= IO_ALTSEMANTICS;
 	if (fflag & FDIRECT)
 		ioflag |= IO_DIRECT;
-	vn_lock(vp, LK_SHARED | LK_RETRY);
+	if (offset == >f_offset && (flags & FOF_UPDATE_OFFSET) != 0)
+		vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+	else
+		vn_lock(vp, LK_SHARED | LK_RETRY);
 	uio->uio_offset = *offset;
 	count = uio->uio_resid;
 	error = VOP_READ(vp, uio, ioflag, cred);
@@ -1135,7 +1138,10 @@ vn_seek(struct file *fp, off_t delta, in
 	if (vp->v_type == VFIFO)
 		return ESPIPE;
 
-	vn_lock(vp, LK_SHARED | LK_RETRY);
+	if (flags & FOF_UPDATE_OFFSET)
+		vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+	else
+		vn_lock(vp, LK_SHARED | LK_RETRY);
 
 	/* Compute the old and new offsets.  */
 	oldoff = fp->f_offset;



CVS commit: src/sys/kern

2022-08-06 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  6 21:21:10 UTC 2022

Modified Files:
src/sys/kern: vfs_vnops.c

Log Message:
vnodeops(9): Take exclusive lock in read/seek for f_offset update.

Otherwise concurrent readers/seekers might clobber it.


To generate a diff of this commit:
cvs rdiff -u -r1.234 -r1.235 src/sys/kern/vfs_vnops.c

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



CVS commit: src/sys/dev/pci

2022-08-06 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  6 15:38:42 UTC 2022

Modified Files:
src/sys/dev/pci: if_sip.c

Log Message:
sip(4): Tidy up DMA syncs.

- No membar_producer in sip_init_rxdesc -- use bus_dmamap_sync with
  BUS_DMASYNC_PREWRITE to order updates to the DMA descriptors.

- Omit needless membar_producer in sip_init_txdesc -- the hardware
  will not look at any of these descriptors until we set CMDSTS_OWN
  on the first one in the sequence, which is done later in the
  caller, sipcom_start.

- In gsip_rxintr, make sure to read cmdsts _before_ extsts, by
  separating them with BUS_DMASYNC_PREREAD.  Otherwise, the CPU might
  reorder the loads and read a stale extsts first before witnessing
  an updated cmdsts with the CMDSTS_OWN bit that transfers ownership
  of the rx packet to us.


To generate a diff of this commit:
cvs rdiff -u -r1.186 -r1.187 src/sys/dev/pci/if_sip.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/dev/pci/if_sip.c
diff -u src/sys/dev/pci/if_sip.c:1.186 src/sys/dev/pci/if_sip.c:1.187
--- src/sys/dev/pci/if_sip.c:1.186	Tue May 24 20:50:19 2022
+++ src/sys/dev/pci/if_sip.c	Sat Aug  6 15:38:42 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_sip.c,v 1.186 2022/05/24 20:50:19 andvar Exp $	*/
+/*	$NetBSD: if_sip.c,v 1.187 2022/08/06 15:38:42 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_sip.c,v 1.186 2022/05/24 20:50:19 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sip.c,v 1.187 2022/08/06 15:38:42 riastradh Exp $");
 
 #include 
 #include 
@@ -569,7 +569,6 @@ sip_init_txdesc(struct sip_softc *sc, in
 		sipd->sipd_words[sc->sc_bufptr_idx] = htole32(bufptr);
 	}
 	sipd->sipd_words[sc->sc_extsts_idx] = 0;
-	membar_producer();
 	sipd->sipd_words[sc->sc_cmdsts_idx] = htole32(cmdsts);
 	/* sip_cdtxsync() will be done later. */
 }
@@ -596,7 +595,7 @@ sip_init_rxdesc(struct sip_softc *sc, in
 		htole32(rxs->rxs_dmamap->dm_segs[0].ds_addr);
 	}
 	sipd->sipd_words[sc->sc_extsts_idx] = 0;
-	membar_producer();
+	sip_cdrxsync(sc, x, BUS_DMASYNC_PREWRITE);
 	sipd->sipd_words[sc->sc_cmdsts_idx] =
 	htole32(CMDSTS_INTR | (sc->sc_parm->p_rxbuf_len &
 				   sc->sc_bits.b_cmdsts_size_mask));
@@ -2126,9 +2125,6 @@ gsip_rxintr(struct sip_softc *sc)
 
 		cmdsts =
 		le32toh(sc->sc_rxdescs[i].sipd_words[sc->sc_cmdsts_idx]);
-		extsts =
-		le32toh(sc->sc_rxdescs[i].sipd_words[sc->sc_extsts_idx]);
-		len = CMDSTS_SIZE(sc, cmdsts);
 
 		/*
 		 * NOTE: OWN is set if owned by _consumer_.  We're the
@@ -2142,6 +2138,12 @@ gsip_rxintr(struct sip_softc *sc)
 			break;
 		}
 
+		sip_cdrxsync(sc, i, BUS_DMASYNC_POSTREAD);
+
+		extsts =
+		le32toh(sc->sc_rxdescs[i].sipd_words[sc->sc_extsts_idx]);
+		len = CMDSTS_SIZE(sc, cmdsts);
+
 		if (__predict_false(sc->sc_rxdiscard)) {
 			sip_init_rxdesc(sc, i);
 			if ((cmdsts & CMDSTS_MORE) == 0) {



CVS commit: src/sys/dev/pci

2022-08-06 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  6 15:38:42 UTC 2022

Modified Files:
src/sys/dev/pci: if_sip.c

Log Message:
sip(4): Tidy up DMA syncs.

- No membar_producer in sip_init_rxdesc -- use bus_dmamap_sync with
  BUS_DMASYNC_PREWRITE to order updates to the DMA descriptors.

- Omit needless membar_producer in sip_init_txdesc -- the hardware
  will not look at any of these descriptors until we set CMDSTS_OWN
  on the first one in the sequence, which is done later in the
  caller, sipcom_start.

- In gsip_rxintr, make sure to read cmdsts _before_ extsts, by
  separating them with BUS_DMASYNC_PREREAD.  Otherwise, the CPU might
  reorder the loads and read a stale extsts first before witnessing
  an updated cmdsts with the CMDSTS_OWN bit that transfers ownership
  of the rx packet to us.


To generate a diff of this commit:
cvs rdiff -u -r1.186 -r1.187 src/sys/dev/pci/if_sip.c

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



CVS commit: src/sys/kern

2022-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Aug  5 23:43:46 UTC 2022

Modified Files:
src/sys/kern: kern_entropy.c

Log Message:
entropy: Don't disclose stack garbage in kern.entropy sysctls.

kern.entropy.consolidate and kern.entropy.gather are supposed to be
write-only -- it doesn't make any sense to read from them, but I
suppose it's better to read-as-zero than read-as-stack-secrets!


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

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



CVS commit: src/sys/kern

2022-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Aug  5 23:43:46 UTC 2022

Modified Files:
src/sys/kern: kern_entropy.c

Log Message:
entropy: Don't disclose stack garbage in kern.entropy sysctls.

kern.entropy.consolidate and kern.entropy.gather are supposed to be
write-only -- it doesn't make any sense to read from them, but I
suppose it's better to read-as-zero than read-as-stack-secrets!


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/kern/kern_entropy.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/kern/kern_entropy.c
diff -u src/sys/kern/kern_entropy.c:1.56 src/sys/kern/kern_entropy.c:1.57
--- src/sys/kern/kern_entropy.c:1.56	Fri May 13 09:40:02 2022
+++ src/sys/kern/kern_entropy.c	Fri Aug  5 23:43:46 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_entropy.c,v 1.56 2022/05/13 09:40:02 riastradh Exp $	*/
+/*	$NetBSD: kern_entropy.c,v 1.57 2022/08/05 23:43:46 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_entropy.c,v 1.56 2022/05/13 09:40:02 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_entropy.c,v 1.57 2022/08/05 23:43:46 riastradh Exp $");
 
 #include 
 #include 
@@ -1291,7 +1291,7 @@ static int
 sysctl_entropy_consolidate(SYSCTLFN_ARGS)
 {
 	struct sysctlnode node = *rnode;
-	int arg;
+	int arg = 0;
 	int error;
 
 	KASSERT(E->stage == ENTROPY_HOT);
@@ -1317,7 +1317,7 @@ static int
 sysctl_entropy_gather(SYSCTLFN_ARGS)
 {
 	struct sysctlnode node = *rnode;
-	int arg;
+	int arg = 0;
 	int error;
 
 	KASSERT(E->stage == ENTROPY_HOT);



CVS commit: src/sys/fs/ptyfs

2022-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Aug  5 10:36:02 UTC 2022

Modified Files:
src/sys/fs/ptyfs: ptyfs_vnops.c

Log Message:
ptyfs: Don't copy out cookies past end of buffer.

Reported-by: syzbot+2aae7c4eddc796f91...@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=5fe24c1da952ac2ea498d745d6479bc6be91a751


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/fs/ptyfs/ptyfs_vnops.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/fs/ptyfs/ptyfs_vnops.c
diff -u src/sys/fs/ptyfs/ptyfs_vnops.c:1.68 src/sys/fs/ptyfs/ptyfs_vnops.c:1.69
--- src/sys/fs/ptyfs/ptyfs_vnops.c:1.68	Wed Dec  8 20:11:54 2021
+++ src/sys/fs/ptyfs/ptyfs_vnops.c	Fri Aug  5 10:36:02 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ptyfs_vnops.c,v 1.68 2021/12/08 20:11:54 andvar Exp $	*/
+/*	$NetBSD: ptyfs_vnops.c,v 1.69 2022/08/05 10:36:02 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1993, 1995
@@ -76,7 +76,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ptyfs_vnops.c,v 1.68 2021/12/08 20:11:54 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ptyfs_vnops.c,v 1.69 2022/08/05 10:36:02 riastradh Exp $");
 
 #include 
 #include 
@@ -691,7 +691,7 @@ ptyfs_readdir(void *v)
 		*ap->a_cookies = cookies;
 	}
 
-	for (; i < 2; i++) {
+	for (; i < 2 && uio->uio_resid >= UIO_MX; i++) {
 		/* `.' and/or `..' */
 		dp->d_fileno = PTYFS_FILENO(PTYFSroot, 0);
 		dp->d_namlen = i + 1;



CVS commit: src/sys/fs/ptyfs

2022-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Aug  5 10:36:02 UTC 2022

Modified Files:
src/sys/fs/ptyfs: ptyfs_vnops.c

Log Message:
ptyfs: Don't copy out cookies past end of buffer.

Reported-by: syzbot+2aae7c4eddc796f91...@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=5fe24c1da952ac2ea498d745d6479bc6be91a751


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/fs/ptyfs/ptyfs_vnops.c

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



CVS commit: src/distrib/sets/lists/modules

2022-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Aug  5 08:48:37 UTC 2022

Modified Files:
src/distrib/sets/lists/modules: md.amd64 md.i386

Log Message:
i915: Restore non-obsolete set list entries.


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/distrib/sets/lists/modules/md.amd64
cvs rdiff -u -r1.93 -r1.94 src/distrib/sets/lists/modules/md.i386

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

Modified files:

Index: src/distrib/sets/lists/modules/md.amd64
diff -u src/distrib/sets/lists/modules/md.amd64:1.95 src/distrib/sets/lists/modules/md.amd64:1.96
--- src/distrib/sets/lists/modules/md.amd64:1.95	Thu Jul 28 22:00:23 2022
+++ src/distrib/sets/lists/modules/md.amd64	Fri Aug  5 08:48:36 2022
@@ -1,4 +1,4 @@
-# $NetBSD: md.amd64,v 1.95 2022/07/28 22:00:23 riastradh Exp $
+# $NetBSD: md.amd64,v 1.96 2022/08/05 08:48:36 riastradh Exp $
 #
 ./@MODULEDIR@/acpiacadmodules-base-kernel	kmod
 ./@MODULEDIR@/acpiacad/acpiacad.kmod		modules-base-kernel	kmod
@@ -162,8 +162,8 @@
 ./@MODULEDIR@/hpqlb/hpqlb.kmod			modules-base-kernel	kmod
 ./@MODULEDIR@/i915drmmodules-base-kernel	kmod
 ./@MODULEDIR@/i915drm/i915drm.kmod		modules-base-kernel	kmod
-./@MODULEDIR@/i915drmkms			modules-obsolete	obsolete
-./@MODULEDIR@/i915drmkms/i915drmkms.kmod	modules-obsolete	obsolete
+./@MODULEDIR@/i915drmkms			modules-base-kernel	kmod
+./@MODULEDIR@/i915drmkms/i915drmkms.kmod	modules-base-kernel	kmod
 ./@MODULEDIR@/ichsmbmodules-base-kernel	kmod
 ./@MODULEDIR@/ichsmb/ichsmb.kmod		modules-base-kernel	kmod
 ./@MODULEDIR@/if_iavfmodules-base-kernel	kmod

Index: src/distrib/sets/lists/modules/md.i386
diff -u src/distrib/sets/lists/modules/md.i386:1.93 src/distrib/sets/lists/modules/md.i386:1.94
--- src/distrib/sets/lists/modules/md.i386:1.93	Thu Jul 28 22:00:23 2022
+++ src/distrib/sets/lists/modules/md.i386	Fri Aug  5 08:48:36 2022
@@ -1,4 +1,4 @@
-# $NetBSD: md.i386,v 1.93 2022/07/28 22:00:23 riastradh Exp $
+# $NetBSD: md.i386,v 1.94 2022/08/05 08:48:36 riastradh Exp $
 #
 ./@MODULEDIR@/acpiacadmodules-base-kernel	kmod
 ./@MODULEDIR@/acpiacad/acpiacad.kmod		modules-base-kernel	kmod
@@ -114,8 +114,8 @@
 ./@MODULEDIR@/hpqlb/hpqlb.kmod			modules-base-kernel	kmod
 ./@MODULEDIR@/i915drmmodules-base-kernel	kmod
 ./@MODULEDIR@/i915drm/i915drm.kmod		modules-base-kernel	kmod
-./@MODULEDIR@/i915drmkms			modules-obsolete	obsolete
-./@MODULEDIR@/i915drmkms/i915drmkms.kmod	modules-obsolete	obsolete
+./@MODULEDIR@/i915drmkms			modules-base-kernel	kmod
+./@MODULEDIR@/i915drmkms/i915drmkms.kmod	modules-base-kernel	kmod
 ./@MODULEDIR@/ichsmbmodules-base-kernel kmod
 ./@MODULEDIR@/ichsmb/ichsmb.kmod		modules-base-kernel kmod
 ./@MODULEDIR@/if_iavfmodules-base-kernel	kmod



CVS commit: src/distrib/sets/lists/modules

2022-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Aug  5 08:48:37 UTC 2022

Modified Files:
src/distrib/sets/lists/modules: md.amd64 md.i386

Log Message:
i915: Restore non-obsolete set list entries.


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/distrib/sets/lists/modules/md.amd64
cvs rdiff -u -r1.93 -r1.94 src/distrib/sets/lists/modules/md.i386

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



CVS commit: src/common/lib/libprop

2022-08-04 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Aug  4 09:02:29 UTC 2022

Modified Files:
src/common/lib/libprop: prop_object.c

Log Message:
proplib: Fix mistake in previous -- use strncmp for prefix matching.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/common/lib/libprop/prop_object.c

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

Modified files:

Index: src/common/lib/libprop/prop_object.c
diff -u src/common/lib/libprop/prop_object.c:1.33 src/common/lib/libprop/prop_object.c:1.34
--- src/common/lib/libprop/prop_object.c:1.33	Wed Aug  3 21:20:21 2022
+++ src/common/lib/libprop/prop_object.c	Thu Aug  4 09:02:29 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: prop_object.c,v 1.33 2022/08/03 21:20:21 riastradh Exp $	*/
+/*	$NetBSD: prop_object.c,v 1.34 2022/08/04 09:02:29 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007 The NetBSD Foundation, Inc.
@@ -735,7 +735,7 @@ _prop_object_internalize_context_alloc(c
 		if (_PROP_EOF(*xml) || *xml != '<')
 			goto bad;
 
-#define	MATCH(str)	(strcmp([1], str) == 0)
+#define	MATCH(str)	(strncmp([1], str, strlen(str)) == 0)
 
 		/*
 		 * Skip over the XML preamble that Apple XML property



CVS commit: src/common/lib/libprop

2022-08-04 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Aug  4 09:02:29 UTC 2022

Modified Files:
src/common/lib/libprop: prop_object.c

Log Message:
proplib: Fix mistake in previous -- use strncmp for prefix matching.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/common/lib/libprop/prop_object.c

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



CVS commit: src/common/lib/libprop

2022-08-03 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Aug  3 21:20:21 UTC 2022

Modified Files:
src/common/lib/libprop: prop_object.c

Log Message:
proplib: Don't run off end of buffer with memcmp.

The input is required to be NUL-terminated anyway, so just use strcmp
here.

Reported-by: syzbot+69838802c8ec55909...@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=927d66e8aa079ba2be43497425a6d9878025ad09


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/common/lib/libprop/prop_object.c

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

Modified files:

Index: src/common/lib/libprop/prop_object.c
diff -u src/common/lib/libprop/prop_object.c:1.32 src/common/lib/libprop/prop_object.c:1.33
--- src/common/lib/libprop/prop_object.c:1.32	Wed Aug  3 21:13:46 2022
+++ src/common/lib/libprop/prop_object.c	Wed Aug  3 21:20:21 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: prop_object.c,v 1.32 2022/08/03 21:13:46 riastradh Exp $	*/
+/*	$NetBSD: prop_object.c,v 1.33 2022/08/03 21:20:21 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007 The NetBSD Foundation, Inc.
@@ -735,7 +735,7 @@ _prop_object_internalize_context_alloc(c
 		if (_PROP_EOF(*xml) || *xml != '<')
 			goto bad;
 
-#define	MATCH(str)	(memcmp([1], str, sizeof(str) - 1) == 0)
+#define	MATCH(str)	(strcmp([1], str) == 0)
 
 		/*
 		 * Skip over the XML preamble that Apple XML property



CVS commit: src/common/lib/libprop

2022-08-03 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Aug  3 21:20:21 UTC 2022

Modified Files:
src/common/lib/libprop: prop_object.c

Log Message:
proplib: Don't run off end of buffer with memcmp.

The input is required to be NUL-terminated anyway, so just use strcmp
here.

Reported-by: syzbot+69838802c8ec55909...@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=927d66e8aa079ba2be43497425a6d9878025ad09


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/common/lib/libprop/prop_object.c

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



CVS commit: src/common/lib/libprop

2022-08-03 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Aug  3 21:13:46 UTC 2022

Modified Files:
src/common/lib/libprop: prop_array_util.c prop_data.c prop_dictionary.c
prop_dictionary_util.c prop_kern.c prop_number.c prop_object.c
prop_string.c

Log Message:
proplib: Nix trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/common/lib/libprop/prop_array_util.c \
src/common/lib/libprop/prop_dictionary_util.c
cvs rdiff -u -r1.17 -r1.18 src/common/lib/libprop/prop_data.c
cvs rdiff -u -r1.44 -r1.45 src/common/lib/libprop/prop_dictionary.c
cvs rdiff -u -r1.24 -r1.25 src/common/lib/libprop/prop_kern.c
cvs rdiff -u -r1.33 -r1.34 src/common/lib/libprop/prop_number.c
cvs rdiff -u -r1.31 -r1.32 src/common/lib/libprop/prop_object.c
cvs rdiff -u -r1.16 -r1.17 src/common/lib/libprop/prop_string.c

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

Modified files:

Index: src/common/lib/libprop/prop_array_util.c
diff -u src/common/lib/libprop/prop_array_util.c:1.8 src/common/lib/libprop/prop_array_util.c:1.9
--- src/common/lib/libprop/prop_array_util.c:1.8	Sun Jun 14 21:31:01 2020
+++ src/common/lib/libprop/prop_array_util.c	Wed Aug  3 21:13:46 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: prop_array_util.c,v 1.8 2020/06/14 21:31:01 christos Exp $	*/
+/*	$NetBSD: prop_array_util.c,v 1.9 2022/08/03 21:13:46 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2020 The NetBSD Foundation, Inc.
@@ -49,7 +49,7 @@ prop_array_get_bool(prop_array_t array, 
 	b = prop_array_get(array, indx);
 	if (prop_object_type(b) != PROP_TYPE_BOOL)
 		return (false);
-	
+
 	*valp = prop_bool_true(b);
 
 	return (true);
Index: src/common/lib/libprop/prop_dictionary_util.c
diff -u src/common/lib/libprop/prop_dictionary_util.c:1.8 src/common/lib/libprop/prop_dictionary_util.c:1.9
--- src/common/lib/libprop/prop_dictionary_util.c:1.8	Mon Jun 15 00:46:00 2020
+++ src/common/lib/libprop/prop_dictionary_util.c	Wed Aug  3 21:13:46 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: prop_dictionary_util.c,v 1.8 2020/06/15 00:46:00 christos Exp $	*/
+/*	$NetBSD: prop_dictionary_util.c,v 1.9 2022/08/03 21:13:46 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2020 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@ prop_dictionary_get_bool(prop_dictionary
 	b = prop_dictionary_get(dict, key);
 	if (prop_object_type(b) != PROP_TYPE_BOOL)
 		return (false);
-	
+
 	*valp = prop_bool_true(b);
 
 	return (true);
@@ -179,7 +179,7 @@ prop_dictionary_get_string(prop_dictiona
 	cp = prop_string_value(str);
 	if (cp == NULL)
 		return (false);
-	
+
 	*cpp = cp;
 	return (true);
 }

Index: src/common/lib/libprop/prop_data.c
diff -u src/common/lib/libprop/prop_data.c:1.17 src/common/lib/libprop/prop_data.c:1.18
--- src/common/lib/libprop/prop_data.c:1.17	Mon Jun  8 21:31:56 2020
+++ src/common/lib/libprop/prop_data.c	Wed Aug  3 21:13:46 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: prop_data.c,v 1.17 2020/06/08 21:31:56 thorpej Exp $	*/
+/*	$NetBSD: prop_data.c,v 1.18 2022/08/03 21:13:46 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2020 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@ _prop_data_externalize(struct _prop_obje
 
 	if (_prop_object_externalize_end_tag(ctx, "data") == false)
 		return (false);
-	
+
 	return (true);
 }
 
@@ -377,7 +377,7 @@ prop_data_copy_value(prop_data_t pd, voi
 
 	if (! prop_object_is_data(pd))
 		return (false);
-	
+
 	if (buf == NULL || buflen < pd->pd_size)
 		return (false);
 
@@ -411,7 +411,7 @@ prop_data_data(prop_data_t pd)
 	v = _PROP_MALLOC(pd->pd_size, M_TEMP);
 	if (v != NULL)
 		memcpy(v, pd->pd_immutable, pd->pd_size);
-	
+
 	return (v);
 }
 
@@ -569,7 +569,7 @@ _prop_data_internalize_decode(struct _pr
 return (false);
 			ch = (unsigned char) *src;
 			/* FALLTHROUGH */
-		
+
 		case 3:		/* Valid, two bytes of info */
 			/*
 			 * We know this char is a =.  Is there anything but
@@ -662,7 +662,7 @@ _prop_data_internalize(prop_stack_t stac
 	buf = _PROP_MALLOC(len + 1, M_PROP_DATA);
 	if (buf == NULL)
 		return (true);
-	
+
 	if (_prop_data_internalize_decode(ctx, buf, len + 1, ,
 	  >poic_cp) == false) {
 		_PROP_FREE(buf, M_PROP_DATA);

Index: src/common/lib/libprop/prop_dictionary.c
diff -u src/common/lib/libprop/prop_dictionary.c:1.44 src/common/lib/libprop/prop_dictionary.c:1.45
--- src/common/lib/libprop/prop_dictionary.c:1.44	Sat Jul  2 16:30:13 2022
+++ src/common/lib/libprop/prop_dictionary.c	Wed Aug  3 21:13:46 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: prop_dictionary.c,v 1.44 2022/07/02 16:30:13 andvar Exp $	*/
+/*	$NetBSD: prop_dictionary.c,v 1.45 2022/08/03 21:13:46 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2020 The NetBSD Foundation, Inc.
@@ -133,7 +133,7 @@ static const struct _prop_object_type _p
 	.pot_equals		=	_prop_dictionary_equals,
 	.pot_equals_finish	=	_prop_dictionary_equals_finish,
 	.pot_lock 	=   _prop_dictionary_lock,
-	.pot_unlock 	=   

CVS commit: src/common/lib/libprop

2022-08-03 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Aug  3 21:13:46 UTC 2022

Modified Files:
src/common/lib/libprop: prop_array_util.c prop_data.c prop_dictionary.c
prop_dictionary_util.c prop_kern.c prop_number.c prop_object.c
prop_string.c

Log Message:
proplib: Nix trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/common/lib/libprop/prop_array_util.c \
src/common/lib/libprop/prop_dictionary_util.c
cvs rdiff -u -r1.17 -r1.18 src/common/lib/libprop/prop_data.c
cvs rdiff -u -r1.44 -r1.45 src/common/lib/libprop/prop_dictionary.c
cvs rdiff -u -r1.24 -r1.25 src/common/lib/libprop/prop_kern.c
cvs rdiff -u -r1.33 -r1.34 src/common/lib/libprop/prop_number.c
cvs rdiff -u -r1.31 -r1.32 src/common/lib/libprop/prop_object.c
cvs rdiff -u -r1.16 -r1.17 src/common/lib/libprop/prop_string.c

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



CVS commit: src/sys/kern

2022-08-03 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Aug  3 11:09:13 UTC 2022

Modified Files:
src/sys/kern: vfs_lockf.c

Log Message:
kern/vfs_lockf.c: Fix overflow in overflow detection.

Reported-by: syzbot+cda9440741a151674...@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=030eb71324790093d467799263cd0789e5097229


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/kern/vfs_lockf.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/kern/vfs_lockf.c
diff -u src/sys/kern/vfs_lockf.c:1.76 src/sys/kern/vfs_lockf.c:1.77
--- src/sys/kern/vfs_lockf.c:1.76	Fri Jul  1 01:04:01 2022
+++ src/sys/kern/vfs_lockf.c	Wed Aug  3 11:09:13 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_lockf.c,v 1.76 2022/07/01 01:04:01 riastradh Exp $	*/
+/*	$NetBSD: vfs_lockf.c,v 1.77 2022/08/03 11:09:13 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_lockf.c,v 1.76 2022/07/01 01:04:01 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_lockf.c,v 1.77 2022/08/03 11:09:13 riastradh Exp $");
 
 #include 
 #include 
@@ -844,7 +844,8 @@ lf_advlock(struct vop_advlock_args *ap, 
 		end = -1;
 	else {
 		if (fl->l_len >= 0) {
-			if (fl->l_len - 1 > __type_max(off_t) - start)
+			if (start >= 0 &&
+			fl->l_len - 1 > __type_max(off_t) - start)
 return EINVAL;
 			end = start + fl->l_len - 1;
 		} else {



CVS commit: src/sys/kern

2022-08-03 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Aug  3 11:09:13 UTC 2022

Modified Files:
src/sys/kern: vfs_lockf.c

Log Message:
kern/vfs_lockf.c: Fix overflow in overflow detection.

Reported-by: syzbot+cda9440741a151674...@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=030eb71324790093d467799263cd0789e5097229


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/kern/vfs_lockf.c

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



CVS commit: src/sys/kern

2022-08-03 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Aug  3 09:40:25 UTC 2022

Modified Files:
src/sys/kern: kern_ras.c

Log Message:
rasctl(2): Avoid overflow in address range arithmetic.

Remove various contortions to suppress warnings.  Rely on
-Wno-type-limits instead.

Reported-by: syzbot+8b0f1ced3fce82031...@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=e9055200701cffd653d5b13491d85c34e07f06a3


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/kern/kern_ras.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/kern/kern_ras.c
diff -u src/sys/kern/kern_ras.c:1.40 src/sys/kern/kern_ras.c:1.41
--- src/sys/kern/kern_ras.c:1.40	Sat Dec 14 16:58:25 2019
+++ src/sys/kern/kern_ras.c	Wed Aug  3 09:40:25 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_ras.c,v 1.40 2019/12/14 16:58:25 riastradh Exp $	*/
+/*	$NetBSD: kern_ras.c,v 1.41 2022/08/03 09:40:25 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_ras.c,v 1.40 2019/12/14 16:58:25 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_ras.c,v 1.41 2022/08/03 09:40:25 riastradh Exp $");
 
 #include 
 #include 
@@ -156,14 +156,6 @@ ras_purgeall(void)
 
 #if defined(__HAVE_RAS)
 
-#if __GNUC_PREREQ__(4, 8)
-#define	__WARNING_PUSH_LESS_NULL_PTR	_Pragma("GCC diagnostic push") 	_Pragma("GCC diagnostic ignored \"-Wextra\"")
-#define	__WARNING_POP_LESS_NULL_PTR	_Pragma("GCC diagnostic pop")
-#else
-#define	__WARNING_PUSH_LESS_NULL_PTR
-#define	__WARNING_POP_LESS_NULL_PTR
-#endif
-
 /*
  * Install the new sequence.  If it already exists, return
  * an error.
@@ -180,17 +172,12 @@ ras_install(void *addr, size_t len)
 	if (len == 0)
 		return EINVAL;
 
-	endaddr = (char *)addr + len;
-
-	/* Do not warn about < NULL pointer comparison */
-	__WARNING_PUSH_LESS_NULL_PTR
-	if (addr < (void *)VM_MIN_ADDRESS || addr > (void *)VM_MAXUSER_ADDRESS)
-		return EINVAL;
-	if (endaddr > (void *)VM_MAXUSER_ADDRESS)
+	if ((uintptr_t)addr < VM_MIN_ADDRESS ||
+	(uintptr_t)addr > VM_MAXUSER_ADDRESS)
 		return EINVAL;
-	if (endaddr < addr)
+	if (len > VM_MAXUSER_ADDRESS - (uintptr_t)addr)
 		return EINVAL;
-	__WARNING_POP_LESS_NULL_PTR
+	endaddr = (char *)addr + len;
 
 	newrp = kmem_alloc(sizeof(*newrp), KM_SLEEP);
 	newrp->ras_startaddr = addr;



CVS commit: src/sys/kern

2022-08-03 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Aug  3 09:40:25 UTC 2022

Modified Files:
src/sys/kern: kern_ras.c

Log Message:
rasctl(2): Avoid overflow in address range arithmetic.

Remove various contortions to suppress warnings.  Rely on
-Wno-type-limits instead.

Reported-by: syzbot+8b0f1ced3fce82031...@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=e9055200701cffd653d5b13491d85c34e07f06a3


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/kern/kern_ras.c

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



CVS commit: src

2022-08-03 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Aug  3 09:37:37 UTC 2022

Modified Files:
src/share/mk: bsd.kmodule.mk
src/sys/conf: Makefile.kern.inc

Log Message:
sys: Build kernel with -Wno-type-limits.

The type-limits warning is actively harmful because it discourages
writing safe portable overflow detection logic which happens, on some
architectures, to be dead code.


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 src/share/mk/bsd.kmodule.mk
cvs rdiff -u -r1.293 -r1.294 src/sys/conf/Makefile.kern.inc

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



CVS commit: src

2022-08-03 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Aug  3 09:37:37 UTC 2022

Modified Files:
src/share/mk: bsd.kmodule.mk
src/sys/conf: Makefile.kern.inc

Log Message:
sys: Build kernel with -Wno-type-limits.

The type-limits warning is actively harmful because it discourages
writing safe portable overflow detection logic which happens, on some
architectures, to be dead code.


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 src/share/mk/bsd.kmodule.mk
cvs rdiff -u -r1.293 -r1.294 src/sys/conf/Makefile.kern.inc

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

Modified files:

Index: src/share/mk/bsd.kmodule.mk
diff -u src/share/mk/bsd.kmodule.mk:1.79 src/share/mk/bsd.kmodule.mk:1.80
--- src/share/mk/bsd.kmodule.mk:1.79	Sun Jul 17 14:10:55 2022
+++ src/share/mk/bsd.kmodule.mk	Wed Aug  3 09:37:36 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.kmodule.mk,v 1.79 2022/07/17 14:10:55 riastradh Exp $
+#	$NetBSD: bsd.kmodule.mk,v 1.80 2022/08/03 09:37:36 riastradh Exp $
 
 # We are not building this with PIE
 MKPIE=no
@@ -36,6 +36,7 @@ CWARNFLAGS.clang+=	-Wno-error=constant-c
 # XXX until the kernel is fixed again...
 CFLAGS+=	-fno-strict-aliasing
 CWARNFLAGS+=	-Wno-pointer-sign -Wno-attributes
+CWARNFLAGS+=	-Wno-type-limits
 CWARNFLAGS.gcc+=	${GCC_NO_ADDR_OF_PACKED_MEMBER}
 CWARNFLAGS.clang+=	-Wno-error=address-of-packed-member
 

Index: src/sys/conf/Makefile.kern.inc
diff -u src/sys/conf/Makefile.kern.inc:1.293 src/sys/conf/Makefile.kern.inc:1.294
--- src/sys/conf/Makefile.kern.inc:1.293	Thu Jan  6 17:05:32 2022
+++ src/sys/conf/Makefile.kern.inc	Wed Aug  3 09:37:37 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.kern.inc,v 1.293 2022/01/06 17:05:32 christos Exp $
+#	$NetBSD: Makefile.kern.inc,v 1.294 2022/08/03 09:37:37 riastradh Exp $
 #
 # This file contains common `MI' targets and definitions and it is included
 # at the bottom of each `MD' ${MACHINE}/conf/Makefile.${MACHINE}.
@@ -82,6 +82,7 @@ CWARNFLAGS+=	-Wcast-qual -Wwrite-strings
 CWARNFLAGS+=	-Wno-unreachable-code
 #CWARNFLAGS+=	-Wc++-compat -Wno-error=c++-compat
 CWARNFLAGS+=	-Wno-pointer-sign -Wno-attributes
+CWARNFLAGS+=	-Wno-type-limits
 .  if ${MACHINE} == "i386" || ${MACHINE_ARCH} == "x86_64" || \
 	${MACHINE_ARCH} == "sparc64" || ${MACHINE} == "prep"
 CWARNFLAGS+=	-Wextra -Wno-unused-parameter



CVS commit: src/sys/compat/common

2022-08-02 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Aug  3 01:38:51 UTC 2022

Modified Files:
src/sys/compat/common: if_media_80.c

Log Message:
sys/compat/common/if_media_80.c: Add kernel rcsid.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/compat/common/if_media_80.c

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



CVS commit: src/sys/compat/common

2022-08-02 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Aug  3 01:38:51 UTC 2022

Modified Files:
src/sys/compat/common: if_media_80.c

Log Message:
sys/compat/common/if_media_80.c: Add kernel rcsid.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/compat/common/if_media_80.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/compat/common/if_media_80.c
diff -u src/sys/compat/common/if_media_80.c:1.4 src/sys/compat/common/if_media_80.c:1.5
--- src/sys/compat/common/if_media_80.c:1.4	Tue Sep  7 11:43:02 2021
+++ src/sys/compat/common/if_media_80.c	Wed Aug  3 01:38:51 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_media_80.c,v 1.4 2021/09/07 11:43:02 riastradh Exp $	*/
+/*	$NetBSD: if_media_80.c,v 1.5 2022/08/03 01:38:51 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -65,6 +65,7 @@
  */
 
 #include 
+__KERNEL_RCSID(0, "$NetBSD: if_media_80.c,v 1.5 2022/08/03 01:38:51 riastradh Exp $");
 
 #include 
 #include 



CVS commit: src/sys/dev/wsfb

2022-08-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug  1 23:30:10 UTC 2022

Modified Files:
src/sys/dev/wsfb: genfb.c

Log Message:
genfb: Handle uninitialized softc in genfb_enable/disable_polling.

This can happen due to janky MD kludgerosity like x86
x86_genfb_ddb_trap_callback, which should really be cleaned up, but
at least this might help with the recursive traps we've been seeing
in syzbot.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/dev/wsfb/genfb.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/dev/wsfb/genfb.c
diff -u src/sys/dev/wsfb/genfb.c:1.89 src/sys/dev/wsfb/genfb.c:1.90
--- src/sys/dev/wsfb/genfb.c:1.89	Sun Jul 17 13:10:54 2022
+++ src/sys/dev/wsfb/genfb.c	Mon Aug  1 23:30:10 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: genfb.c,v 1.89 2022/07/17 13:10:54 riastradh Exp $ */
+/*	$NetBSD: genfb.c,v 1.90 2022/08/01 23:30:10 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2007 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.89 2022/07/17 13:10:54 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.90 2022/08/01 23:30:10 riastradh Exp $");
 
 #include 
 #include 
@@ -985,6 +985,9 @@ genfb_enable_polling(device_t dev)
 	struct genfb_softc *sc = device_private(dev);
 	struct genfb_private *scp = sc->sc_private;
 
+	if (scp == NULL)
+		return;
+
 	if (scp->sc_console_screen.scr_vd) {
 		SCREEN_ENABLE_DRAWING(>sc_console_screen);
 		vcons_hard_switch(>sc_console_screen);
@@ -1000,6 +1003,9 @@ genfb_disable_polling(device_t dev)
 	struct genfb_softc *sc = device_private(dev);
 	struct genfb_private *scp = sc->sc_private;
 
+	if (scp == NULL)
+		return;
+
 	if (scp->sc_console_screen.scr_vd) {
 		if (scp->sc_ops.genfb_disable_polling)
 			(*scp->sc_ops.genfb_disable_polling)(sc);



CVS commit: src/sys/dev/wsfb

2022-08-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug  1 23:30:10 UTC 2022

Modified Files:
src/sys/dev/wsfb: genfb.c

Log Message:
genfb: Handle uninitialized softc in genfb_enable/disable_polling.

This can happen due to janky MD kludgerosity like x86
x86_genfb_ddb_trap_callback, which should really be cleaned up, but
at least this might help with the recursive traps we've been seeing
in syzbot.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/dev/wsfb/genfb.c

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



CVS commit: src/sys/external/bsd/drm2/dist/drm/amd/amdgpu

2022-07-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jul 30 17:12:39 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu: amdgpu_gart.c

Log Message:
amdgpu: Make sure to bus_dmamap_sync before using zero'd dummy page.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gart.c

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



CVS commit: src/sys/external/bsd/drm2/dist/drm/amd/amdgpu

2022-07-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jul 30 17:12:39 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu: amdgpu_gart.c

Log Message:
amdgpu: Make sure to bus_dmamap_sync before using zero'd dummy page.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gart.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/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gart.c
diff -u src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gart.c:1.9 src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gart.c:1.10
--- src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gart.c:1.9	Sat Jul 30 16:55:00 2022
+++ src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gart.c	Sat Jul 30 17:12:39 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: amdgpu_gart.c,v 1.9 2022/07/30 16:55:00 riastradh Exp $	*/
+/*	$NetBSD: amdgpu_gart.c,v 1.10 2022/07/30 17:12:39 riastradh Exp $	*/
 
 /*
  * Copyright 2008 Advanced Micro Devices, Inc.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_gart.c,v 1.9 2022/07/30 16:55:00 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_gart.c,v 1.10 2022/07/30 17:12:39 riastradh Exp $");
 
 #include 
 #include 
@@ -105,6 +105,9 @@ static int amdgpu_gart_dummy_page_init(s
 	if (error)
 		goto fail2;
 
+	bus_dmamap_sync(adev->ddev->dmat, adev->dummy_page_map, 0, PAGE_SIZE,
+	BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
+
 	/* Success!  */
 	adev->dummy_page_addr = adev->dummy_page_map->dm_segs[0].ds_addr;
 	return 0;



CVS commit: src/sys/external/bsd/drm2/dist/drm/amd/amdgpu

2022-07-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jul 30 16:55:00 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu: amdgpu_gart.c

Log Message:
amdgpu: Make sure dummy page is zero-filled.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gart.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/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gart.c
diff -u src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gart.c:1.8 src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gart.c:1.9
--- src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gart.c:1.8	Fri Dec 24 11:19:55 2021
+++ src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gart.c	Sat Jul 30 16:55:00 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: amdgpu_gart.c,v 1.8 2021/12/24 11:19:55 riastradh Exp $	*/
+/*	$NetBSD: amdgpu_gart.c,v 1.9 2022/07/30 16:55:00 riastradh Exp $	*/
 
 /*
  * Copyright 2008 Advanced Micro Devices, Inc.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_gart.c,v 1.8 2021/12/24 11:19:55 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_gart.c,v 1.9 2022/07/30 16:55:00 riastradh Exp $");
 
 #include 
 #include 
@@ -78,6 +78,7 @@ static int amdgpu_gart_dummy_page_init(s
 {
 #ifdef __NetBSD__
 	int rsegs;
+	void *p;
 	int error;
 
 	/* XXX Can this be called more than once??  */
@@ -89,6 +90,12 @@ static int amdgpu_gart_dummy_page_init(s
 	if (error)
 		goto fail0;
 	KASSERT(rsegs == 1);
+	error = bus_dmamem_map(adev->ddev->dmat, >dummy_page_seg, 1,
+	PAGE_SIZE, , BUS_DMA_WAITOK);
+	if (error)
+		goto fail1;
+	memset(p, 0, PAGE_SIZE);
+	bus_dmamem_unmap(adev->ddev->dmat, p, PAGE_SIZE);
 	error = bus_dmamap_create(adev->ddev->dmat, PAGE_SIZE, 1, PAGE_SIZE, 0,
 	BUS_DMA_WAITOK, >dummy_page_map);
 	if (error)



CVS commit: src/sys/external/bsd/drm2/dist/drm/amd/amdgpu

2022-07-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jul 30 16:55:00 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu: amdgpu_gart.c

Log Message:
amdgpu: Make sure dummy page is zero-filled.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gart.c

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



CVS commit: src/sys

2022-07-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jul 30 14:13:27 UTC 2022

Modified Files:
src/sys/arch/sparc/include: types.h
src/sys/kern: subr_csan.c
src/sys/sys: atomic.h

Log Message:
sys/atomic.h: Fix atomic_store_* on sparcv7, sparcv8.

These did not cooperate with the hash-locked scheme of the other
atomic operations, with the effect that, for instance, a typical
naive spin lock based on atomic_*,

volatile unsigned locked = 0;
lock()
{
while (atomic_swap_uint(, 1))
continue;
membar_acquire();
}
unlock()
{
membar_release();
atomic_store_relaxed(, 0);
}

would fail to achieve mutual exclusion.

For this case, we need to use atomic_swap_* (or, for 8- or 16-bit
objects, atomic_cas_32 loops, since there is no atomic_swap_8 or
atomic_swap_16).

The new machine/types.h macro __HAVE_HASHLOCKED_ATOMICS says whether
these contortions are necessary.

Note that this _requires_ the use of atomic_store_*(p, v), not
regular stores *p = v, to work with the r/m/w atomic operations.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/sparc/include/types.h
cvs rdiff -u -r1.13 -r1.14 src/sys/kern/subr_csan.c
cvs rdiff -u -r1.24 -r1.25 src/sys/sys/atomic.h

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

Modified files:

Index: src/sys/arch/sparc/include/types.h
diff -u src/sys/arch/sparc/include/types.h:1.71 src/sys/arch/sparc/include/types.h:1.72
--- src/sys/arch/sparc/include/types.h:1.71	Sat Jan 23 19:38:53 2021
+++ src/sys/arch/sparc/include/types.h	Sat Jul 30 14:13:27 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.71 2021/01/23 19:38:53 christos Exp $ */
+/*	$NetBSD: types.h,v 1.72 2022/07/30 14:13:27 riastradh Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -48,6 +48,7 @@
 #endif
 
 #if defined(_KERNEL_OPT)
+#include "opt_multiprocessor.h"
 #include "opt_sparc_arch.h"
 #endif
 
@@ -135,6 +136,9 @@ typedef unsigned long int	__register_t;
 #define	__HAVE_FAST_SOFTINTS
 #else
 #define	__HAVE_MM_MD_READWRITE
+#ifdef MULTIPROCESSOR
+#define	__HAVE_HASHLOCKED_ATOMICS
+#endif
 #endif
 
 #define	__HAVE_CPU_LWP_SETPRIVATE

Index: src/sys/kern/subr_csan.c
diff -u src/sys/kern/subr_csan.c:1.13 src/sys/kern/subr_csan.c:1.14
--- src/sys/kern/subr_csan.c:1.13	Sat Sep 11 10:09:55 2021
+++ src/sys/kern/subr_csan.c	Sat Jul 30 14:13:27 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_csan.c,v 1.13 2021/09/11 10:09:55 riastradh Exp $	*/
+/*	$NetBSD: subr_csan.c,v 1.14 2022/07/30 14:13:27 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2019-2020 Maxime Villard, m00nbsd.net
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_csan.c,v 1.13 2021/09/11 10:09:55 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_csan.c,v 1.14 2022/07/30 14:13:27 riastradh Exp $");
 
 #include 
 #include 
@@ -615,12 +615,16 @@ void
 kcsan_atomic_store(volatile void *p, const void *v, int size)
 {
 	kcsan_access((uintptr_t)p, size, true, true, __RET_ADDR);
+#ifdef __HAVE_HASHLOCKED_ATOMICS
+	__do_atomic_store(p, v, size);
+#else
 	switch (size) {
 	case 1: *(volatile uint8_t *)p = *(const uint8_t *)v; break;
 	case 2: *(volatile uint16_t *)p = *(const uint16_t *)v; break;
 	case 4: *(volatile uint32_t *)p = *(const uint32_t *)v; break;
 	case 8: *(volatile uint64_t *)p = *(const uint64_t *)v; break;
 	}
+#endif
 }
 
 /* -- */

Index: src/sys/sys/atomic.h
diff -u src/sys/sys/atomic.h:1.24 src/sys/sys/atomic.h:1.25
--- src/sys/sys/atomic.h:1.24	Sat Apr  9 23:34:30 2022
+++ src/sys/sys/atomic.h	Sat Jul 30 14:13:27 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic.h,v 1.24 2022/04/09 23:34:30 riastradh Exp $	*/
+/*	$NetBSD: atomic.h,v 1.25 2022/07/30 14:13:27 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
@@ -433,9 +433,14 @@ void kcsan_atomic_store(volatile void *,
 	__typeof__(*(p)) v = *(p)
 #define __END_ATOMIC_LOAD(v) \
 	v
+#ifdef __HAVE_HASHLOCKED_ATOMICS
+#define __DO_ATOMIC_STORE(p, v)		  \
+	__do_atomic_store(p, __UNVOLATILE(), sizeof(v))
+#else  /* !__HAVE_HASHLOCKED_ATOMICS */
 #define __DO_ATOMIC_STORE(p, v) \
 	*p = v
 #endif
+#endif
 
 #define	atomic_load_relaxed(p)		  \
 ({	  \
@@ -480,6 +485,51 @@ void kcsan_atomic_store(volatile void *,
 	__DO_ATOMIC_STORE(__as_ptr, __as_val);  \
 })
 
+#ifdef __HAVE_HASHLOCKED_ATOMICS
+static void __inline __always_inline
+__do_atomic_store(volatile void *p, const void *q, size_t size)
+{
+	switch (size) {
+	case 1: {
+		uint8_t v;
+		unsigned s = 8 * ((uintptr_t)p & 3);
+		uint32_t o, n, m = ~(0xffU << s);
+		memcpy(, q, 1);
+		do {
+			o = atomic_load_relaxed((const volatile uint32_t *)p);
+			n = (o & m) | ((uint32_t)v << s);
+		} while (atomic_cas_32((volatile uint32_t *)p, o, n) != o);
+		break;
+	}
+	case 2: {
+		uint16_t v;
+		unsigned s = 8 * (((uintptr_t)p & 2) >> 1);
+		uint32_t o, n, 

CVS commit: src/sys

2022-07-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jul 30 14:13:27 UTC 2022

Modified Files:
src/sys/arch/sparc/include: types.h
src/sys/kern: subr_csan.c
src/sys/sys: atomic.h

Log Message:
sys/atomic.h: Fix atomic_store_* on sparcv7, sparcv8.

These did not cooperate with the hash-locked scheme of the other
atomic operations, with the effect that, for instance, a typical
naive spin lock based on atomic_*,

volatile unsigned locked = 0;
lock()
{
while (atomic_swap_uint(, 1))
continue;
membar_acquire();
}
unlock()
{
membar_release();
atomic_store_relaxed(, 0);
}

would fail to achieve mutual exclusion.

For this case, we need to use atomic_swap_* (or, for 8- or 16-bit
objects, atomic_cas_32 loops, since there is no atomic_swap_8 or
atomic_swap_16).

The new machine/types.h macro __HAVE_HASHLOCKED_ATOMICS says whether
these contortions are necessary.

Note that this _requires_ the use of atomic_store_*(p, v), not
regular stores *p = v, to work with the r/m/w atomic operations.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/sparc/include/types.h
cvs rdiff -u -r1.13 -r1.14 src/sys/kern/subr_csan.c
cvs rdiff -u -r1.24 -r1.25 src/sys/sys/atomic.h

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



CVS commit: src

2022-07-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jul 30 14:11:01 UTC 2022

Modified Files:
src/common/lib/libc/arch/i386/atomic: atomic.S
src/common/lib/libc/arch/x86_64/atomic: atomic.S
src/sys/arch/amd64/include: frameasm.h
src/sys/arch/i386/include: frameasm.h
src/sys/arch/x86/x86: patch.c

Log Message:
x86: Eliminate mfence hotpatch for membar_sync.

The more-compatible  LOCK ADD $0,-N(%rsp)  turns out to be cheaper
than MFENCE anyway.  Let's save some space and maintenance and rip
out the hotpatching for it.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/common/lib/libc/arch/i386/atomic/atomic.S
cvs rdiff -u -r1.28 -r1.29 src/common/lib/libc/arch/x86_64/atomic/atomic.S
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/amd64/include/frameasm.h
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/i386/include/frameasm.h
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/x86/x86/patch.c

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

Modified files:

Index: src/common/lib/libc/arch/i386/atomic/atomic.S
diff -u src/common/lib/libc/arch/i386/atomic/atomic.S:1.35 src/common/lib/libc/arch/i386/atomic/atomic.S:1.36
--- src/common/lib/libc/arch/i386/atomic/atomic.S:1.35	Sat Apr  9 23:32:51 2022
+++ src/common/lib/libc/arch/i386/atomic/atomic.S	Sat Jul 30 14:11:00 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic.S,v 1.35 2022/04/09 23:32:51 riastradh Exp $	*/
+/*	$NetBSD: atomic.S,v 1.36 2022/07/30 14:11:00 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -46,11 +46,9 @@
 #include "opt_xen.h"
 #include 
 #define LOCK			HOTPATCH(HP_NAME_NOLOCK, 1); lock
-#define HOTPATCH_SSE2_MFENCE	HOTPATCH(HP_NAME_SSE2_MFENCE, 7);
 #define HOTPATCH_CAS_64		HOTPATCH(HP_NAME_CAS_64, 49);
 #else
 #define LOCK			lock
-#define HOTPATCH_SSE2_MFENCE	/* nothing */
 #define HOTPATCH_CAS_64		/* nothing */
 #endif
 
@@ -198,13 +196,22 @@ END(_membar_release)
 
 ENTRY(_membar_sync)
 	/*
-	 * MFENCE, or a serializing instruction like a locked addq,
+	 * MFENCE, or a serializing instruction like a locked ADDL,
 	 * is necessary to order store-before-load.  Every other
 	 * ordering -- load-before-anything, anything-before-store --
 	 * is already guaranteed without explicit barriers.
+	 *
+	 * Empirically it turns out locked ADDL is cheaper than MFENCE,
+	 * so we use that, with an offset below the return address on
+	 * the stack to avoid a false dependency with RET.  (It might
+	 * even be better to use a much lower offset, say -128, to
+	 * avoid false dependencies for subsequent callees of the
+	 * caller.)
+	 *
+	 * https://pvk.ca/Blog/2014/10/19/performance-optimisation-~-writing-an-essay/
+	 * https://shipilev.net/blog/2014/on-the-fence-with-dependencies/
+	 * https://www.agner.org/optimize/instruction_tables.pdf
 	 */
-	HOTPATCH_SSE2_MFENCE
-	/* 7 bytes of instructions */
 	LOCK
 	addl	$0, -4(%esp)
 	ret
@@ -406,13 +413,3 @@ STRONG_ALIAS(_membar_consumer,_membar_ac
 STRONG_ALIAS(_membar_producer,_membar_release)
 STRONG_ALIAS(_membar_enter,_membar_sync)
 STRONG_ALIAS(_membar_exit,_membar_release)
-
-#ifdef _HARDKERNEL
-	.section .rodata
-
-LABEL(sse2_mfence)
-	mfence
-	ret
-	nop; nop; nop;
-LABEL(sse2_mfence_end)
-#endif	/* _HARDKERNEL */

Index: src/common/lib/libc/arch/x86_64/atomic/atomic.S
diff -u src/common/lib/libc/arch/x86_64/atomic/atomic.S:1.28 src/common/lib/libc/arch/x86_64/atomic/atomic.S:1.29
--- src/common/lib/libc/arch/x86_64/atomic/atomic.S:1.28	Sat Apr  9 23:32:52 2022
+++ src/common/lib/libc/arch/x86_64/atomic/atomic.S	Sat Jul 30 14:11:00 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic.S,v 1.28 2022/04/09 23:32:52 riastradh Exp $	*/
+/*	$NetBSD: atomic.S,v 1.29 2022/07/30 14:11:00 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -38,15 +38,6 @@
 #define	ALIAS(f, t)	WEAK_ALIAS(f,t)
 #endif
 
-#ifdef _HARDKERNEL
-#include 
-#define LOCK			HOTPATCH(HP_NAME_NOLOCK, 1); lock
-#define HOTPATCH_SSE2_MFENCE	HOTPATCH(HP_NAME_SSE2_MFENCE, 8);
-#else
-#define LOCK			lock
-#define HOTPATCH_SSE2_MFENCE	/* nothing */
-#endif
-
 	.text
 
 /* 32-bit */
@@ -273,13 +264,22 @@ END(_membar_release)
 
 ENTRY(_membar_sync)
 	/*
-	 * MFENCE, or a serializing instruction like a locked addq,
+	 * MFENCE, or a serializing instruction like a locked ADDQ,
 	 * is necessary to order store-before-load.  Every other
 	 * ordering -- load-before-anything, anything-before-store --
 	 * is already guaranteed without explicit barriers.
+	 *
+	 * Empirically it turns out locked ADDQ is cheaper than MFENCE,
+	 * so we use that, with an offset below the return address on
+	 * the stack to avoid a false dependency with RET.  (It might
+	 * even be better to use a much lower offset, say -128, to
+	 * avoid false dependencies for subsequent callees of the
+	 * caller.)
+	 *
+	 * https://pvk.ca/Blog/2014/10/19/performance-optimisation-~-writing-an-essay/
+	 * 

CVS commit: src

2022-07-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jul 30 14:11:01 UTC 2022

Modified Files:
src/common/lib/libc/arch/i386/atomic: atomic.S
src/common/lib/libc/arch/x86_64/atomic: atomic.S
src/sys/arch/amd64/include: frameasm.h
src/sys/arch/i386/include: frameasm.h
src/sys/arch/x86/x86: patch.c

Log Message:
x86: Eliminate mfence hotpatch for membar_sync.

The more-compatible  LOCK ADD $0,-N(%rsp)  turns out to be cheaper
than MFENCE anyway.  Let's save some space and maintenance and rip
out the hotpatching for it.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/common/lib/libc/arch/i386/atomic/atomic.S
cvs rdiff -u -r1.28 -r1.29 src/common/lib/libc/arch/x86_64/atomic/atomic.S
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/amd64/include/frameasm.h
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/i386/include/frameasm.h
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/x86/x86/patch.c

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



CVS commit: src/external/cddl/osnet/sys

2022-07-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jul 30 13:09:20 UTC 2022

Modified Files:
src/external/cddl/osnet/sys/kern: misc.c
src/external/cddl/osnet/sys/sys: proc.h

Log Message:
solaris: Give threads less bad names.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/cddl/osnet/sys/kern/misc.c
cvs rdiff -u -r1.9 -r1.10 src/external/cddl/osnet/sys/sys/proc.h

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



CVS commit: src/external/cddl/osnet/sys

2022-07-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jul 30 13:09:20 UTC 2022

Modified Files:
src/external/cddl/osnet/sys/kern: misc.c
src/external/cddl/osnet/sys/sys: proc.h

Log Message:
solaris: Give threads less bad names.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/cddl/osnet/sys/kern/misc.c
cvs rdiff -u -r1.9 -r1.10 src/external/cddl/osnet/sys/sys/proc.h

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

Modified files:

Index: src/external/cddl/osnet/sys/kern/misc.c
diff -u src/external/cddl/osnet/sys/kern/misc.c:1.9 src/external/cddl/osnet/sys/kern/misc.c:1.10
--- src/external/cddl/osnet/sys/kern/misc.c:1.9	Thu Jun 11 19:20:42 2020
+++ src/external/cddl/osnet/sys/kern/misc.c	Sat Jul 30 13:09:19 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: misc.c,v 1.9 2020/06/11 19:20:42 ad Exp $	*/
+/*	$NetBSD: misc.c,v 1.10 2022/07/30 13:09:19 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -94,8 +94,8 @@ vn_is_readonly(vnode_t *vp)
 }
 
 kthread_t *
-thread_create(void * stk, size_t stksize, void (*proc)(), void *arg,
-	  size_t len, proc_t *pp, int state, pri_t pri)
+solaris__thread_create(void * stk, size_t stksize, void (*proc)(), void *arg,
+size_t len, proc_t *pp, int state, pri_t pri, const char *name)
 {
 	int error;
 	lwp_t *thr;
@@ -105,7 +105,7 @@ thread_create(void * stk, size_t stksize
 	ASSERT(state == TS_RUN);
 
 	error = kthread_create(pri, KTHREAD_MPSAFE, NULL,
-	proc, arg, , "zfs");
+	proc, arg, , "%s", name);
 	KASSERT(error == 0);
 	return thr;
 }

Index: src/external/cddl/osnet/sys/sys/proc.h
diff -u src/external/cddl/osnet/sys/sys/proc.h:1.9 src/external/cddl/osnet/sys/sys/proc.h:1.10
--- src/external/cddl/osnet/sys/sys/proc.h:1.9	Thu Nov 15 04:55:26 2018
+++ src/external/cddl/osnet/sys/sys/proc.h	Sat Jul 30 13:09:19 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: proc.h,v 1.9 2018/11/15 04:55:26 riastradh Exp $	*/
+/*	$NetBSD: proc.h,v 1.10 2022/07/30 13:09:19 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -89,8 +89,11 @@ typedef struct lwp	*kthread_id_t;
 struct contract {
 };
 
-kthread_t *thread_create(void *, size_t, void (*)(void *), void *, size_t,
-			 proc_t *, int, pri_t);
+#define	thread_create(stk, stksz, proc, arg, len, pp, state, pri)	  \
+	solaris__thread_create(stk, stksz, proc, arg, len, pp, state, pri,\
+	#proc)
+kthread_t *solaris__thread_create(void *, size_t, void (*)(void *), void *,
+size_t, proc_t *, int, pri_t, const char *);
 void	thread_exit(void);
 void	thread_join(uint64_t);
 



CVS commit: src/external/cddl/osnet/sys/sys

2022-07-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jul 30 13:03:05 UTC 2022

Modified Files:
src/external/cddl/osnet/sys/sys: sdt.h

Log Message:
osnet: Stop disabling dtrace probes.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/cddl/osnet/sys/sys/sdt.h

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

Modified files:

Index: src/external/cddl/osnet/sys/sys/sdt.h
diff -u src/external/cddl/osnet/sys/sys/sdt.h:1.8 src/external/cddl/osnet/sys/sys/sdt.h:1.9
--- src/external/cddl/osnet/sys/sys/sdt.h:1.8	Mon May 28 21:05:10 2018
+++ src/external/cddl/osnet/sys/sys/sdt.h	Sat Jul 30 13:03:05 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdt.h,v 1.8 2018/05/28 21:05:10 chs Exp $	*/
+/*	$NetBSD: sdt.h,v 1.9 2022/07/30 13:03:05 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek 
@@ -33,27 +33,6 @@
 
 #include_next 
 #include 
- 
-#undef	DTRACE_PROBE
-#undef	DTRACE_PROBE1
-#undef	DTRACE_PROBE2
-#undef	DTRACE_PROBE3
-#undef	DTRACE_PROBE4
-#undef	DTRACE_PROBE5
-#undef	DTRACE_PROBE6
-#undef	DTRACE_PROBE7
-
-#define	DTRACE_PROBE(name)
-#define	DTRACE_PROBE1(name, type1, arg1)
-#define	DTRACE_PROBE2(name, type1, arg1, type2, arg2)
-#define	DTRACE_PROBE3(name, type1, arg1, type2, arg2, type3, arg3)
-#define	DTRACE_PROBE4(name, type1, arg1, type2, arg2, type3, arg3, type4, arg4) 
-#define	DTRACE_PROBE5(name, type1, arg1, type2, arg2, type3, arg3, \
-	type4, arg4, type5, arg5)
-#define	DTRACE_PROBE6(name, type1, arg1, type2, arg2, type3, arg3, \
-	type4, arg4, type5, arg5, type6, arg6)
-#define	DTRACE_PROBE7(name, type1, arg1, type2, arg2, type3, arg3, \
-	type4, arg4, type5, arg5, type6, arg6, type7, arg7)
 
 #ifdef KDTRACE_HOOKS
 SDT_PROBE_DECLARE(sdt, , , set__error);



CVS commit: src/external/cddl/osnet/sys/sys

2022-07-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jul 30 13:03:05 UTC 2022

Modified Files:
src/external/cddl/osnet/sys/sys: sdt.h

Log Message:
osnet: Stop disabling dtrace probes.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/cddl/osnet/sys/sys/sdt.h

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



CVS commit: src/external/cddl/osnet/sys/sys

2022-07-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jul 30 12:59:31 UTC 2022

Modified Files:
src/external/cddl/osnet/sys/sys: kcondvar.h

Log Message:
zfs: Give condvars more meaningful names.

These will be truncated to 16 characters, but hey, better'n `zfscv'.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/cddl/osnet/sys/sys/kcondvar.h

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

Modified files:

Index: src/external/cddl/osnet/sys/sys/kcondvar.h
diff -u src/external/cddl/osnet/sys/sys/kcondvar.h:1.4 src/external/cddl/osnet/sys/sys/kcondvar.h:1.5
--- src/external/cddl/osnet/sys/sys/kcondvar.h:1.4	Mon May 28 21:05:10 2018
+++ src/external/cddl/osnet/sys/sys/kcondvar.h	Sat Jul 30 12:59:31 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: kcondvar.h,v 1.4 2018/05/28 21:05:10 chs Exp $	*/
+/*	$NetBSD: kcondvar.h,v 1.5 2022/07/30 12:59:31 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@ typedef enum {
 	TR_CLOCK_TICK,
 } time_res_t;
 
-#define	cv_init(a, b, c, d)	cv_init(a, "zfscv")
+#define	cv_init(a, b, c, d)	cv_init(a, #a)
 
 static inline clock_t
 cv_timedwait_hires(kcondvar_t *cvp, kmutex_t *mp, hrtime_t tim, hrtime_t res,



CVS commit: src/external/cddl/osnet/sys/sys

2022-07-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jul 30 12:59:31 UTC 2022

Modified Files:
src/external/cddl/osnet/sys/sys: kcondvar.h

Log Message:
zfs: Give condvars more meaningful names.

These will be truncated to 16 characters, but hey, better'n `zfscv'.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/cddl/osnet/sys/sys/kcondvar.h

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



CVS commit: src/sys/external/bsd

2022-07-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Jul 29 23:50:44 UTC 2022

Modified Files:
src/sys/external/bsd/common/include/linux: printk.h
src/sys/external/bsd/drm2/include/linux: device.h

Log Message:
drm: Reduce verbosity of drm kernel messages.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/external/bsd/common/include/linux/printk.h
cvs rdiff -u -r1.16 -r1.17 src/sys/external/bsd/drm2/include/linux/device.h

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



CVS commit: src/sys/external/bsd

2022-07-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Jul 29 23:50:44 UTC 2022

Modified Files:
src/sys/external/bsd/common/include/linux: printk.h
src/sys/external/bsd/drm2/include/linux: device.h

Log Message:
drm: Reduce verbosity of drm kernel messages.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/external/bsd/common/include/linux/printk.h
cvs rdiff -u -r1.16 -r1.17 src/sys/external/bsd/drm2/include/linux/device.h

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

Modified files:

Index: src/sys/external/bsd/common/include/linux/printk.h
diff -u src/sys/external/bsd/common/include/linux/printk.h:1.12 src/sys/external/bsd/common/include/linux/printk.h:1.13
--- src/sys/external/bsd/common/include/linux/printk.h:1.12	Sun Dec 19 12:02:38 2021
+++ src/sys/external/bsd/common/include/linux/printk.h	Fri Jul 29 23:50:44 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: printk.h,v 1.12 2021/12/19 12:02:38 riastradh Exp $	*/
+/*	$NetBSD: printk.h,v 1.13 2022/07/29 23:50:44 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -48,14 +48,14 @@
 #define	pr_warn_once	printf	/* XXX */
 #define	pr_notice	printf	/* XXX */
 #define	pr_debug	printf	/* XXX */
-#define	KERN_EMERG	"kern emerg: "
-#define	KERN_ALERT	"kern alert: "
-#define	KERN_CRIT	"kern crit: "
-#define	KERN_ERR	"kern error: "
-#define	KERN_WARNING	"kern warning: "
-#define	KERN_NOTICE	"kern notice: "
-#define	KERN_INFO	"kern info: "
-#define	KERN_DEBUG	"kern debug: "
+#define	KERN_EMERG	"emerg: "
+#define	KERN_ALERT	"alert: "
+#define	KERN_CRIT	"crit: "
+#define	KERN_ERR	"error: "
+#define	KERN_WARNING	"warning: "
+#define	KERN_NOTICE	"notice: "
+#define	KERN_INFO	""
+#define	KERN_DEBUG	"debug: "
 #define	KERN_CONT	""
 
 #define	printk_ratelimit()	0 /* XXX */

Index: src/sys/external/bsd/drm2/include/linux/device.h
diff -u src/sys/external/bsd/drm2/include/linux/device.h:1.16 src/sys/external/bsd/drm2/include/linux/device.h:1.17
--- src/sys/external/bsd/drm2/include/linux/device.h:1.16	Sun Jul 17 14:11:18 2022
+++ src/sys/external/bsd/drm2/include/linux/device.h	Fri Jul 29 23:50:44 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: device.h,v 1.16 2022/07/17 14:11:18 riastradh Exp $	*/
+/*	$NetBSD: device.h,v 1.17 2022/07/29 23:50:44 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -72,9 +72,9 @@
 
 #define	dev_info(DEV, FMT, ...)	do {	  \
 	if (DEV)			  \
-		aprint_normal_dev((DEV), "info: " FMT, ##__VA_ARGS__);	  \
+		aprint_normal_dev((DEV), FMT, ##__VA_ARGS__);		  \
 	else  \
-		aprint_normal("info: " FMT, ##__VA_ARGS__);		  \
+		aprint_normal(FMT, ##__VA_ARGS__);			  \
 } while (0)
 
 #define	dev_dbg(DEV, FMT, ...)	do {	  \



CVS commit: src/sys/external/bsd/drm2/dist/drm/amd/amdgpu

2022-07-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Jul 29 12:43:15 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu: amdgpu_ttm.c

Log Message:
amdgpu: Make amdgpu_ttm_io_mem_pfn return pfn, not paddr.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ttm.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/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ttm.c
diff -u src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ttm.c:1.11 src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ttm.c:1.12
--- src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ttm.c:1.11	Wed Jul 20 01:11:54 2022
+++ src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ttm.c	Fri Jul 29 12:43:15 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: amdgpu_ttm.c,v 1.11 2022/07/20 01:11:54 riastradh Exp $	*/
+/*	$NetBSD: amdgpu_ttm.c,v 1.12 2022/07/29 12:43:15 riastradh Exp $	*/
 
 /*
  * Copyright 2009 Jerome Glisse.
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_ttm.c,v 1.11 2022/07/20 01:11:54 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_ttm.c,v 1.12 2022/07/29 12:43:15 riastradh Exp $");
 
 #include 
 #include 
@@ -777,7 +777,7 @@ static unsigned long amdgpu_ttm_io_mem_p
 	 */
 	const paddr_t cookie = bus_space_mmap(bo->bdev->memt, bo->mem.bus.base,
 	(mm->start + page_offset) << PAGE_SHIFT, /*vm_prot*/0, /*flags*/0);
-	return pmap_phys_address(cookie);
+	return pmap_phys_address(cookie) >> PAGE_SHIFT;
 #else
 	return (bo->mem.bus.base >> PAGE_SHIFT) + mm->start +
 		(offset >> PAGE_SHIFT);



CVS commit: src/sys/external/bsd/drm2/dist/drm/amd/amdgpu

2022-07-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Jul 29 12:43:15 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu: amdgpu_ttm.c

Log Message:
amdgpu: Make amdgpu_ttm_io_mem_pfn return pfn, not paddr.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ttm.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

2022-07-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Jul 29 10:08:01 UTC 2022

Modified Files:
src/sys/arch/amd64/conf: INSTALL
src/sys/arch/i386/conf: INSTALL

Log Message:
x86: Disable new DRM_LEGACY option in INSTALL kernel.

The INSTALL kernel appears to be intended to have no drm in it at
all, but DRM_LEGACY brings it in just for modules.


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/sys/arch/amd64/conf/INSTALL
cvs rdiff -u -r1.335 -r1.336 src/sys/arch/i386/conf/INSTALL

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

Modified files:

Index: src/sys/arch/amd64/conf/INSTALL
diff -u src/sys/arch/amd64/conf/INSTALL:1.95 src/sys/arch/amd64/conf/INSTALL:1.96
--- src/sys/arch/amd64/conf/INSTALL:1.95	Thu Apr 18 17:13:00 2019
+++ src/sys/arch/amd64/conf/INSTALL	Fri Jul 29 10:08:01 2022
@@ -1,4 +1,4 @@
-# $NetBSD: INSTALL,v 1.95 2019/04/18 17:13:00 maya Exp $
+# $NetBSD: INSTALL,v 1.96 2022/07/29 10:08:01 riastradh Exp $
 #
 #	INSTALL - Installation kernel.
 #
@@ -8,7 +8,7 @@
 include	"arch/amd64/conf/GENERIC"
 
 options 	CONSDEVNAME="\"com\"",CONADDR=0x2f8,CONSPEED=115200
-#ident 		"INSTALL-$Revision: 1.95 $"
+#ident 		"INSTALL-$Revision: 1.96 $"
 
 no options	MEMORY_DISK_DYNAMIC
 no options	FONT_BOLD16x32
@@ -22,3 +22,4 @@ options 	MEMORY_DISK_RBFLAGS=RB_SINGLE	#
 no i915drmkms* at pci?
 no radeon* at pci?
 no nouveau*	   at pci?
+no options 	DRM_LEGACY

Index: src/sys/arch/i386/conf/INSTALL
diff -u src/sys/arch/i386/conf/INSTALL:1.335 src/sys/arch/i386/conf/INSTALL:1.336
--- src/sys/arch/i386/conf/INSTALL:1.335	Tue Dec 11 16:52:49 2018
+++ src/sys/arch/i386/conf/INSTALL	Fri Jul 29 10:08:01 2022
@@ -1,4 +1,4 @@
-# $NetBSD: INSTALL,v 1.335 2018/12/11 16:52:49 maya Exp $
+# $NetBSD: INSTALL,v 1.336 2022/07/29 10:08:01 riastradh Exp $
 #
 #	INSTALL - Installation kernel.
 #
@@ -7,7 +7,7 @@
 
 include	"arch/i386/conf/MONOLITHIC"
 
-#ident 		"INSTALL-$Revision: 1.335 $"
+#ident 		"INSTALL-$Revision: 1.336 $"
 
 no options	MEMORY_DISK_DYNAMIC
 options 	MEMORY_DISK_IS_ROOT	# force root on memory disk
@@ -19,6 +19,7 @@ options 	MEMORY_DISK_RBFLAGS=RB_SINGLE	#
 no i915drmkms* at pci?
 no radeon* at pci?
 no nouveau*	   at pci?
+no options 	DRM_LEGACY
 
 # pre-PCI graphics drivers, not enabled in GENERIC
 vga0		at isa?



CVS commit: src/sys/arch

2022-07-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Jul 29 10:08:01 UTC 2022

Modified Files:
src/sys/arch/amd64/conf: INSTALL
src/sys/arch/i386/conf: INSTALL

Log Message:
x86: Disable new DRM_LEGACY option in INSTALL kernel.

The INSTALL kernel appears to be intended to have no drm in it at
all, but DRM_LEGACY brings it in just for modules.


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/sys/arch/amd64/conf/INSTALL
cvs rdiff -u -r1.335 -r1.336 src/sys/arch/i386/conf/INSTALL

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



CVS commit: src

2022-07-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Jul 28 22:00:24 UTC 2022

Modified Files:
src/distrib/sets/lists/debug: module.md.amd64 module.md.i386
src/distrib/sets/lists/modules: md.amd64 md.i386
src/sys/modules: Makefile

Log Message:
drm: Hook up the drmkms modules to the build.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/distrib/sets/lists/debug/module.md.amd64
cvs rdiff -u -r1.6 -r1.7 src/distrib/sets/lists/debug/module.md.i386
cvs rdiff -u -r1.94 -r1.95 src/distrib/sets/lists/modules/md.amd64
cvs rdiff -u -r1.92 -r1.93 src/distrib/sets/lists/modules/md.i386
cvs rdiff -u -r1.268 -r1.269 src/sys/modules/Makefile

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



CVS commit: src

2022-07-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Jul 28 22:00:24 UTC 2022

Modified Files:
src/distrib/sets/lists/debug: module.md.amd64 module.md.i386
src/distrib/sets/lists/modules: md.amd64 md.i386
src/sys/modules: Makefile

Log Message:
drm: Hook up the drmkms modules to the build.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/distrib/sets/lists/debug/module.md.amd64
cvs rdiff -u -r1.6 -r1.7 src/distrib/sets/lists/debug/module.md.i386
cvs rdiff -u -r1.94 -r1.95 src/distrib/sets/lists/modules/md.amd64
cvs rdiff -u -r1.92 -r1.93 src/distrib/sets/lists/modules/md.i386
cvs rdiff -u -r1.268 -r1.269 src/sys/modules/Makefile

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

Modified files:

Index: src/distrib/sets/lists/debug/module.md.amd64
diff -u src/distrib/sets/lists/debug/module.md.amd64:1.11 src/distrib/sets/lists/debug/module.md.amd64:1.12
--- src/distrib/sets/lists/debug/module.md.amd64:1.11	Thu Jul 28 16:45:31 2022
+++ src/distrib/sets/lists/debug/module.md.amd64	Thu Jul 28 22:00:23 2022
@@ -1,4 +1,4 @@
-# $NetBSD: module.md.amd64,v 1.11 2022/07/28 16:45:31 martin Exp $
+# $NetBSD: module.md.amd64,v 1.12 2022/07/28 22:00:23 riastradh Exp $
 ./usr/libdata/debug/@MODULEDIR@/acpiacadmodules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/acpiacad/acpiacad.kmod.debug		modules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/acpibatmodules-base-kernel	kmod,debug
@@ -107,14 +107,18 @@
 ./usr/libdata/debug/@MODULEDIR@/cxdtv/cxdtv.kmod.debug			modules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/drmmodules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/drm/drm.kmod.debug			modules-base-kernel	kmod,debug
-./usr/libdata/debug/@MODULEDIR@/drmkmsmodules-obsolete	obsolete
-./usr/libdata/debug/@MODULEDIR@/drmkms/drmkms.kmod.debug		modules-obsolete	obsolete
-./usr/libdata/debug/@MODULEDIR@/drmkms_agp			modules-obsolete	obsolete
-./usr/libdata/debug/@MODULEDIR@/drmkms_agp/drmkms_agp.kmod.debug	modules-obsolete	obsolete
-./usr/libdata/debug/@MODULEDIR@/drmkms_linux			modules-obsolete	obsolete
-./usr/libdata/debug/@MODULEDIR@/drmkms_linux/drmkms_linux.kmod.debug	modules-obsolete	obsolete
-./usr/libdata/debug/@MODULEDIR@/drmkms_pci			modules-obsolete	obsolete
-./usr/libdata/debug/@MODULEDIR@/drmkms_pci/drmkms_pci.kmod.debug	modules-obsolete	obsolete
+./usr/libdata/debug/@MODULEDIR@/drmkmsmodules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/drmkms/drmkms.kmod.debug		modules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/drmkms_agp			modules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/drmkms_agp/drmkms_agp.kmod.debug	modules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/drmkms_linux			modules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/drmkms_linux/drmkms_linux.kmod.debug	modules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/drmkms_pci			modules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/drmkms_pci/drmkms_pci.kmod.debug	modules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/drmkms_sched			modules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/drmkms_sched/drmkms_sched.kmod.debug	modules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/drmkms_ttm			modules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/drmkms_ttm/drmkms_ttm.kmod.debug	modules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/dtrace_syscall_linux		modules-base-kernel	kmod,dtrace,debug
 ./usr/libdata/debug/@MODULEDIR@/dtrace_syscall_linux/dtrace_syscall_linux.kmod.debug	modules-base-kernel	kmod,dtrace,debug
 ./usr/libdata/debug/@MODULEDIR@/dtrace_syscall_linux32		modules-base-kernel	kmod,dtrace,debug
@@ -151,8 +155,8 @@
 ./usr/libdata/debug/@MODULEDIR@/hpqlb/hpqlb.kmod.debug			modules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/i915drmmodules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/i915drm/i915drm.kmod.debug		modules-base-kernel	kmod,debug
-./usr/libdata/debug/@MODULEDIR@/i915drmkms			modules-obsolete	obsolete
-./usr/libdata/debug/@MODULEDIR@/i915drmkms/i915drmkms.kmod.debug	modules-obsolete	obsolete
+./usr/libdata/debug/@MODULEDIR@/i915drmkms			modules-base-kernel	kmod,debug
+./usr/libdata/debug/@MODULEDIR@/i915drmkms/i915drmkms.kmod.debug	modules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/ichsmbmodules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/ichsmb/ichsmb.kmod.debug		modules-base-kernel	kmod,debug
 ./usr/libdata/debug/@MODULEDIR@/if_iavfmodules-base-kernel	kmod,debug

Index: src/distrib/sets/lists/debug/module.md.i386
diff -u src/distrib/sets/lists/debug/module.md.i386:1.6 src/distrib/sets/lists/debug/module.md.i386:1.7
--- src/distrib/sets/lists/debug/module.md.i386:1.6	Wed Jul 27 20:34:30 2022
+++ src/distrib/sets/lists/debug/module.md.i386	Thu Jul 28 22:00:23 2022
@@ -1,4 +1,4 @@
-# 

CVS commit: src/sys

2022-07-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Jul 28 21:52:37 UTC 2022

Modified Files:
src/sys/arch/i386/conf: GENERIC
src/sys/external/bsd/drm2/drm: files.drmkms

Log Message:
drm: New option DRM_LEGACY.

This brings in the `drmums' components, which are the parts of the
current drm code base (sys/external/bsd/drm2) needed by legacy
user-mode-setting drivers (currently just viadrmums), in contrast to
the old drm code base (sys/external/bsd/drm).

This way, viadrmums.kmod can be loaded into GENERIC i386 kernels, but
platforms without any relevant legacy UMS drivers don't get the
legacy goo statically baked in.


To generate a diff of this commit:
cvs rdiff -u -r1.1238 -r1.1239 src/sys/arch/i386/conf/GENERIC
cvs rdiff -u -r1.82 -r1.83 src/sys/external/bsd/drm2/drm/files.drmkms

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/i386/conf/GENERIC
diff -u src/sys/arch/i386/conf/GENERIC:1.1238 src/sys/arch/i386/conf/GENERIC:1.1239
--- src/sys/arch/i386/conf/GENERIC:1.1238	Sat Apr 16 11:57:46 2022
+++ src/sys/arch/i386/conf/GENERIC	Thu Jul 28 21:52:36 2022
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1238 2022/04/16 11:57:46 nia Exp $
+# $NetBSD: GENERIC,v 1.1239 2022/07/28 21:52:36 riastradh Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.1238 $"
+#ident		"GENERIC-$Revision: 1.1239 $"
 
 maxusers	64		# estimated number of users
 
@@ -554,7 +554,8 @@ radeondrmkmsfb* at radeonfbbus?
 nouveau*	at pci? dev ? function ?
 nouveaufb*	at nouveaufbbus?
 
-# DRMUMS drivers
+# DRMUMS drivers -- make them loadable, but not statically linked in
+options 	DRM_LEGACY
 #viadrmums*	at drm?
 
 # Serial Devices

Index: src/sys/external/bsd/drm2/drm/files.drmkms
diff -u src/sys/external/bsd/drm2/drm/files.drmkms:1.82 src/sys/external/bsd/drm2/drm/files.drmkms:1.83
--- src/sys/external/bsd/drm2/drm/files.drmkms:1.82	Thu Jul 28 10:43:35 2022
+++ src/sys/external/bsd/drm2/drm/files.drmkms	Thu Jul 28 21:52:36 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: files.drmkms,v 1.82 2022/07/28 10:43:35 riastradh Exp $
+#	$NetBSD: files.drmkms,v 1.83 2022/07/28 21:52:36 riastradh Exp $
 
 version	20180827
 
@@ -86,7 +86,17 @@ makeoptions 	drmkms 	"CWARNFLAGS.drm_ioc
 makeoptions	drmkms	"CWARNFLAGS.drm_mm.c"+="${${ACTIVE_CC} == clang :? -Wno-unused-function :}"
 makeoptions 	drmkms 	"CWARNFLAGS.drm_modes.c"+="-Wno-shadow"
 
-# Legacy user-mode setting
+# Legacy user-mode setting -- for the following legacy drivers:
+#
+#   mach64*
+#   mga*
+#   savage*
+#   sis*
+#   tdfx*
+#   via
+#
+# * not yet adapted to current drm code base
+#
 define	drmums: drmkms
 makeoptions	drmums	"CPPFLAGS.drmkms"+="-DCONFIG_DRM_LEGACY"
 makeoptions	drmums	"CPPFLAGS.drmums"+="${CPPFLAGS.drmkms}"
@@ -97,6 +107,10 @@ file	external/bsd/drm2/dist/drm/drm_lega
 file	external/bsd/drm2/drm/drm_lock.c		drmums
 file	external/bsd/drm2/drm/drm_scatter.c		drmums
 
+# Set `options DRM_LEGACY' to allow loading modules requiring drmums
+# even if none are statically linked into the kernel.
+defflag		DRM_LEGACY: drmums
+
 # GPU scheduler
 define	drmkms_sched: drmkms
 makeoptions	drmkms_sched	"CPPFLAGS.drmkms_sched"+="${CPPFLAGS.drmkms}"



CVS commit: src/sys

2022-07-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Jul 28 21:52:37 UTC 2022

Modified Files:
src/sys/arch/i386/conf: GENERIC
src/sys/external/bsd/drm2/drm: files.drmkms

Log Message:
drm: New option DRM_LEGACY.

This brings in the `drmums' components, which are the parts of the
current drm code base (sys/external/bsd/drm2) needed by legacy
user-mode-setting drivers (currently just viadrmums), in contrast to
the old drm code base (sys/external/bsd/drm).

This way, viadrmums.kmod can be loaded into GENERIC i386 kernels, but
platforms without any relevant legacy UMS drivers don't get the
legacy goo statically baked in.


To generate a diff of this commit:
cvs rdiff -u -r1.1238 -r1.1239 src/sys/arch/i386/conf/GENERIC
cvs rdiff -u -r1.82 -r1.83 src/sys/external/bsd/drm2/drm/files.drmkms

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



CVS commit: src/sys/external/bsd/drm2/dist/drm/scheduler

2022-07-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Jul 28 10:44:46 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/dist/drm/scheduler: sched_fence.c

Log Message:
drmkms_sched: Fix typo in module definition.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
src/sys/external/bsd/drm2/dist/drm/scheduler/sched_fence.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/external/bsd/drm2/dist/drm/scheduler/sched_fence.c
diff -u src/sys/external/bsd/drm2/dist/drm/scheduler/sched_fence.c:1.6 src/sys/external/bsd/drm2/dist/drm/scheduler/sched_fence.c:1.7
--- src/sys/external/bsd/drm2/dist/drm/scheduler/sched_fence.c:1.6	Thu Jul 28 10:42:45 2022
+++ src/sys/external/bsd/drm2/dist/drm/scheduler/sched_fence.c	Thu Jul 28 10:44:46 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: sched_fence.c,v 1.6 2022/07/28 10:42:45 riastradh Exp $	*/
+/*	$NetBSD: sched_fence.c,v 1.7 2022/07/28 10:44:46 riastradh Exp $	*/
 
 /*
  * Copyright 2015 Advanced Micro Devices, Inc.
@@ -24,7 +24,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sched_fence.c,v 1.6 2022/07/28 10:42:45 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sched_fence.c,v 1.7 2022/07/28 10:44:46 riastradh Exp $");
 
 #include 
 #include 
@@ -197,7 +197,7 @@ MODULE_LICENSE("GPL and additional right
 MODULE(MODULE_CLASS_MISC, drmkms_sched, "drmkms,drmkms_linux");
 
 static int
-drmsched_modcmd(modcmd_t cmd, void *arg)
+drmkms_sched_modcmd(modcmd_t cmd, void *arg)
 {
 
 	switch (cmd) {



CVS commit: src/sys/external/bsd/drm2/dist/drm/scheduler

2022-07-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Jul 28 10:44:46 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/dist/drm/scheduler: sched_fence.c

Log Message:
drmkms_sched: Fix typo in module definition.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
src/sys/external/bsd/drm2/dist/drm/scheduler/sched_fence.c

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



CVS commit: src/sys/external/bsd/drm2/drm

2022-07-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Jul 28 10:43:36 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/drm: files.drmkms

Log Message:
drmkms_sched: Remove duplicate module definition.


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/external/bsd/drm2/drm/files.drmkms

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

Modified files:

Index: src/sys/external/bsd/drm2/drm/files.drmkms
diff -u src/sys/external/bsd/drm2/drm/files.drmkms:1.81 src/sys/external/bsd/drm2/drm/files.drmkms:1.82
--- src/sys/external/bsd/drm2/drm/files.drmkms:1.81	Sun Jul 24 19:23:59 2022
+++ src/sys/external/bsd/drm2/drm/files.drmkms	Thu Jul 28 10:43:35 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: files.drmkms,v 1.81 2022/07/24 19:23:59 riastradh Exp $
+#	$NetBSD: files.drmkms,v 1.82 2022/07/28 10:43:35 riastradh Exp $
 
 version	20180827
 
@@ -104,7 +104,6 @@ makeoptions	drmkms_sched	"CPPFLAGS.drmkm
 file	external/bsd/drm2/dist/drm/scheduler/sched_entity.c	drmkms_sched
 file	external/bsd/drm2/dist/drm/scheduler/sched_fence.c	drmkms_sched
 file	external/bsd/drm2/dist/drm/scheduler/sched_main.c	drmkms_sched
-file	external/bsd/drm2/drm/sched_module.c			drmkms_sched
 
 # Generated from drm2netbsd.
 #file	external/bsd/drm2/dist/drm/drm_agpsupport.c	drmkms	# drmkms_pci



CVS commit: src/sys/external/bsd/drm2/drm

2022-07-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Jul 28 10:43:36 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/drm: files.drmkms

Log Message:
drmkms_sched: Remove duplicate module definition.


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/external/bsd/drm2/drm/files.drmkms

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



CVS commit: src/sys

2022-07-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Jul 28 10:42:46 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/dist/drm/scheduler: sched_fence.c
src/sys/modules/drmkms_sched: Makefile
Removed Files:
src/sys/external/bsd/drm2/drm: sched_module.c

Log Message:
drmkms_sched: Remove duplicate module definition.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
src/sys/external/bsd/drm2/dist/drm/scheduler/sched_fence.c
cvs rdiff -u -r1.1 -r0 src/sys/external/bsd/drm2/drm/sched_module.c
cvs rdiff -u -r1.3 -r1.4 src/sys/modules/drmkms_sched/Makefile

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



CVS commit: src/sys

2022-07-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Jul 28 10:42:46 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/dist/drm/scheduler: sched_fence.c
src/sys/modules/drmkms_sched: Makefile
Removed Files:
src/sys/external/bsd/drm2/drm: sched_module.c

Log Message:
drmkms_sched: Remove duplicate module definition.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
src/sys/external/bsd/drm2/dist/drm/scheduler/sched_fence.c
cvs rdiff -u -r1.1 -r0 src/sys/external/bsd/drm2/drm/sched_module.c
cvs rdiff -u -r1.3 -r1.4 src/sys/modules/drmkms_sched/Makefile

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/scheduler/sched_fence.c
diff -u src/sys/external/bsd/drm2/dist/drm/scheduler/sched_fence.c:1.5 src/sys/external/bsd/drm2/dist/drm/scheduler/sched_fence.c:1.6
--- src/sys/external/bsd/drm2/dist/drm/scheduler/sched_fence.c:1.5	Sun Dec 19 12:32:45 2021
+++ src/sys/external/bsd/drm2/dist/drm/scheduler/sched_fence.c	Thu Jul 28 10:42:45 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: sched_fence.c,v 1.5 2021/12/19 12:32:45 riastradh Exp $	*/
+/*	$NetBSD: sched_fence.c,v 1.6 2022/07/28 10:42:45 riastradh Exp $	*/
 
 /*
  * Copyright 2015 Advanced Micro Devices, Inc.
@@ -24,7 +24,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sched_fence.c,v 1.5 2021/12/19 12:32:45 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sched_fence.c,v 1.6 2022/07/28 10:42:45 riastradh Exp $");
 
 #include 
 #include 
@@ -194,7 +194,8 @@ MODULE_DESCRIPTION("DRM GPU scheduler");
 MODULE_LICENSE("GPL and additional rights");
 
 #ifdef __NetBSD__
-MODULE(MODULE_CLASS_MISC, drmsched, NULL);
+MODULE(MODULE_CLASS_MISC, drmkms_sched, "drmkms,drmkms_linux");
+
 static int
 drmsched_modcmd(modcmd_t cmd, void *arg)
 {

Index: src/sys/modules/drmkms_sched/Makefile
diff -u src/sys/modules/drmkms_sched/Makefile:1.3 src/sys/modules/drmkms_sched/Makefile:1.4
--- src/sys/modules/drmkms_sched/Makefile:1.3	Thu Jul 28 10:41:07 2022
+++ src/sys/modules/drmkms_sched/Makefile	Thu Jul 28 10:42:46 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.3 2022/07/28 10:41:07 riastradh Exp $
+#	$NetBSD: Makefile,v 1.4 2022/07/28 10:42:46 riastradh Exp $
 
 .include "../Makefile.inc"
 .include "../drmkms/Makefile.inc"
@@ -11,7 +11,6 @@ KMOD=	drmkms_sched
 SRCS+=	sched_entity.c
 SRCS+=	sched_fence.c
 SRCS+=	sched_main.c
-SRCS+=	sched_module.c
 
 WARNS=	3
 



CVS commit: src/sys/modules/drmkms_sched

2022-07-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Jul 28 10:41:07 UTC 2022

Modified Files:
src/sys/modules/drmkms_sched: Makefile

Log Message:
drmkms_sched: Revert previous MKLDSCRIPT, red herring.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/modules/drmkms_sched/Makefile

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

Modified files:

Index: src/sys/modules/drmkms_sched/Makefile
diff -u src/sys/modules/drmkms_sched/Makefile:1.2 src/sys/modules/drmkms_sched/Makefile:1.3
--- src/sys/modules/drmkms_sched/Makefile:1.2	Thu Jul 28 10:24:46 2022
+++ src/sys/modules/drmkms_sched/Makefile	Thu Jul 28 10:41:07 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.2 2022/07/28 10:24:46 riastradh Exp $
+#	$NetBSD: Makefile,v 1.3 2022/07/28 10:41:07 riastradh Exp $
 
 .include "../Makefile.inc"
 .include "../drmkms/Makefile.inc"
@@ -7,7 +7,6 @@
 .PATH:	${S}/external/bsd/drm2/drm
 
 KMOD=	drmkms_sched
-MKLDSCRIPT=yes
 
 SRCS+=	sched_entity.c
 SRCS+=	sched_fence.c



CVS commit: src/sys/modules/drmkms_sched

2022-07-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Jul 28 10:41:07 UTC 2022

Modified Files:
src/sys/modules/drmkms_sched: Makefile

Log Message:
drmkms_sched: Revert previous MKLDSCRIPT, red herring.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/modules/drmkms_sched/Makefile

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/pic

2022-07-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Jul 28 10:26:26 UTC 2022

Modified Files:
src/sys/arch/arm/pic: pic.c

Log Message:
arm/pic: Mark definitions static to match declarations.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/arch/arm/pic/pic.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/pic/pic.c
diff -u src/sys/arch/arm/pic/pic.c:1.82 src/sys/arch/arm/pic/pic.c:1.83
--- src/sys/arch/arm/pic/pic.c:1.82	Thu Jul 28 10:26:15 2022
+++ src/sys/arch/arm/pic/pic.c	Thu Jul 28 10:26:26 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pic.c,v 1.82 2022/07/28 10:26:15 riastradh Exp $	*/
+/*	$NetBSD: pic.c,v 1.83 2022/07/28 10:26:26 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pic.c,v 1.82 2022/07/28 10:26:15 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pic.c,v 1.83 2022/07/28 10:26:26 riastradh Exp $");
 
 #include 
 #include 
@@ -298,7 +298,7 @@ pic_mark_pending_sources(struct pic_soft
 	return ipl_mask;
 }
 
-uint32_t
+static uint32_t
 pic_find_pending_irqs_by_ipl(struct pic_softc *pic, size_t irq_base,
 	uint32_t pending, int ipl)
 {
@@ -369,7 +369,7 @@ pic_dispatch(struct intrsource *is, void
 }
 
 #if defined(__HAVE_PIC_PENDING_INTRS)
-void
+static void
 pic_deliver_irqs(struct cpu_info *ci, struct pic_softc *pic, int ipl,
 void *frame)
 {
@@ -505,7 +505,7 @@ pic_list_unblock_irqs(struct cpu_info *c
 	}
 }
 
-struct pic_softc *
+static struct pic_softc *
 pic_list_find_pic_by_pending_ipl(struct cpu_info *ci, uint32_t ipl_mask)
 {
 	uint32_t pending_pics = ci->ci_pending_pics;
@@ -524,7 +524,7 @@ pic_list_find_pic_by_pending_ipl(struct 
 	}
 }
 
-void
+static void
 pic_list_deliver_irqs(struct cpu_info *ci, register_t psw, int ipl,
 void *frame)
 {



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

2022-07-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Jul 28 10:26:26 UTC 2022

Modified Files:
src/sys/arch/arm/pic: pic.c

Log Message:
arm/pic: Mark definitions static to match declarations.


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

2022-07-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Jul 28 10:26:15 UTC 2022

Modified Files:
src/sys/arch/arm/pic: pic.c

Log Message:
arm/pic: Assert ci_cpl doesn't lower across interrupt handler.


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/arch/arm/pic/pic.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/pic/pic.c
diff -u src/sys/arch/arm/pic/pic.c:1.81 src/sys/arch/arm/pic/pic.c:1.82
--- src/sys/arch/arm/pic/pic.c:1.81	Thu Jul 28 07:15:27 2022
+++ src/sys/arch/arm/pic/pic.c	Thu Jul 28 10:26:15 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pic.c,v 1.81 2022/07/28 07:15:27 skrll Exp $	*/
+/*	$NetBSD: pic.c,v 1.82 2022/07/28 10:26:15 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pic.c,v 1.81 2022/07/28 07:15:27 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pic.c,v 1.82 2022/07/28 10:26:15 riastradh Exp $");
 
 #include 
 #include 
@@ -333,6 +333,7 @@ pic_dispatch(struct intrsource *is, void
 {
 	int (*func)(void *) = is->is_func;
 	void *arg = is->is_arg;
+	int ocpl, ncpl;
 
 	if (__predict_false(arg == NULL)) {
 		if (__predict_false(frame == NULL)) {
@@ -342,6 +343,7 @@ pic_dispatch(struct intrsource *is, void
 		arg = frame;
 	}
 
+	ocpl = curcpu()->ci_cpl;
 #ifdef MULTIPROCESSOR
 	if (!is->is_mpsafe) {
 		KERNEL_LOCK(1, NULL);
@@ -354,6 +356,11 @@ pic_dispatch(struct intrsource *is, void
 	} else
 #endif
 		(void)(*func)(arg);
+	ncpl = curcpu()->ci_cpl;
+	KASSERTMSG(ocpl <= ncpl, "pic %s irq %u intrsource %s:"
+	" cpl slipped %d -> %d",
+	is->is_pic->pic_name, is->is_irq, is->is_source,
+	ocpl, ncpl);
 
 	struct pic_percpu * const pcpu = percpu_getref(is->is_pic->pic_percpu);
 	KASSERT(pcpu->pcpu_magic == PICPERCPU_MAGIC);



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

2022-07-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Jul 28 10:26:15 UTC 2022

Modified Files:
src/sys/arch/arm/pic: pic.c

Log Message:
arm/pic: Assert ci_cpl doesn't lower across interrupt handler.


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/arch/arm/pic/pic.c

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



CVS commit: src/sys/modules/drmkms_sched

2022-07-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Jul 28 10:24:46 UTC 2022

Modified Files:
src/sys/modules/drmkms_sched: Makefile

Log Message:
drmkms_sched: Fix link sets in module.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/modules/drmkms_sched/Makefile

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

Modified files:

Index: src/sys/modules/drmkms_sched/Makefile
diff -u src/sys/modules/drmkms_sched/Makefile:1.1 src/sys/modules/drmkms_sched/Makefile:1.2
--- src/sys/modules/drmkms_sched/Makefile:1.1	Sat Jul 23 12:52:10 2022
+++ src/sys/modules/drmkms_sched/Makefile	Thu Jul 28 10:24:46 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.1 2022/07/23 12:52:10 riastradh Exp $
+#	$NetBSD: Makefile,v 1.2 2022/07/28 10:24:46 riastradh Exp $
 
 .include "../Makefile.inc"
 .include "../drmkms/Makefile.inc"
@@ -7,6 +7,7 @@
 .PATH:	${S}/external/bsd/drm2/drm
 
 KMOD=	drmkms_sched
+MKLDSCRIPT=yes
 
 SRCS+=	sched_entity.c
 SRCS+=	sched_fence.c



CVS commit: src/sys/modules/drmkms_sched

2022-07-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Jul 28 10:24:46 UTC 2022

Modified Files:
src/sys/modules/drmkms_sched: Makefile

Log Message:
drmkms_sched: Fix link sets in module.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/modules/drmkms_sched/Makefile

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/aarch64/aarch64

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

Modified Files:
src/sys/arch/aarch64/aarch64: cpu_machdep.c

Log Message:
aarch64: 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.12 -r1.13 src/sys/arch/aarch64/aarch64/cpu_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/aarch64/aarch64/cpu_machdep.c
diff -u src/sys/arch/aarch64/aarch64/cpu_machdep.c:1.12 src/sys/arch/aarch64/aarch64/cpu_machdep.c:1.13
--- src/sys/arch/aarch64/aarch64/cpu_machdep.c:1.12	Thu Sep 23 15:19:03 2021
+++ src/sys/arch/aarch64/aarch64/cpu_machdep.c	Thu Jul 28 09:14:12 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_machdep.c,v 1.12 2021/09/23 15:19:03 ryo Exp $ */
+/* $NetBSD: cpu_machdep.c,v 1.13 2022/07/28 09:14:12 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2014, 2019 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: cpu_machdep.c,v 1.12 2021/09/23 15:19:03 ryo Exp $");
+__KERNEL_RCSID(1, "$NetBSD: cpu_machdep.c,v 1.13 2022/07/28 09:14:12 riastradh Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -114,8 +114,10 @@ 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));
@@ -130,8 +132,7 @@ dosoftints(void)
 kpreempt(-2);
 			}
 #endif
-			splx(opl);
-			return;
+			break;
 		}
 #define DOSOFTINT(n) \
 		if (ci->ci_softints & (1 << (IPL_SOFT ## n - IPL_SOFTCLOCK))) {\
@@ -147,6 +148,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/aarch64/aarch64

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

Modified Files:
src/sys/arch/aarch64/aarch64: cpu_machdep.c

Log Message:
aarch64: 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.12 -r1.13 src/sys/arch/aarch64/aarch64/cpu_machdep.c

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



CVS commit: src/lib/libc/sys

2022-07-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Jul 25 22:50:42 UTC 2022

Modified Files:
src/lib/libc/sys: mincore.2

Log Message:
mincore(2): Clarify units of len argument: bytes, not pages.

Minor tidying while here:

- Use .Fa, not .Ar, for function arguments.
- Reduce verbiage of opening sentence.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/lib/libc/sys/mincore.2

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

Modified files:

Index: src/lib/libc/sys/mincore.2
diff -u src/lib/libc/sys/mincore.2:1.19 src/lib/libc/sys/mincore.2:1.20
--- src/lib/libc/sys/mincore.2:1.19	Thu May 13 10:20:58 2004
+++ src/lib/libc/sys/mincore.2	Mon Jul 25 22:50:42 2022
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mincore.2,v 1.19 2004/05/13 10:20:58 wiz Exp $
+.\"	$NetBSD: mincore.2,v 1.20 2022/07/25 22:50:42 riastradh Exp $
 .\"
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -44,14 +44,16 @@
 .Sh DESCRIPTION
 The
 .Fn mincore
-system call
-allows a process to obtain information about whether pages are
-core resident.
+system call tells whether the pages covering
+.Fa len
+bytes of data starting at
+.Fa addr
+are core resident in the process.
 The status of the memory range is returned in the character-per-page array
-.Ar vec .
+.Fa vec .
 If the page is resident, the least significant bit of the corresponding
 character in
-.Ar vec
+.Fa vec
 will be set.
 Other bits are reserved for additional information
 which future implementations may return.
@@ -73,13 +75,13 @@ The
 call will fail if:
 .Bl -tag -width Er
 .It Bq Er EFAULT
-.Ar vec
+.Fa vec
 points to an illegal address.
 .It Bq Er EINVAL
-.Ar addr
+.Fa addr
 is not a multiple of the system page size.
 .It Bq Er EINVAL
-.Ar len
+.Fa len
 is equal to 0.
 .It Bq Er ENOMEM
 The address range specified is invalid for the calling process,



CVS commit: src/lib/libc/sys

2022-07-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Jul 25 22:50:42 UTC 2022

Modified Files:
src/lib/libc/sys: mincore.2

Log Message:
mincore(2): Clarify units of len argument: bytes, not pages.

Minor tidying while here:

- Use .Fa, not .Ar, for function arguments.
- Reduce verbiage of opening sentence.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/lib/libc/sys/mincore.2

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



CVS commit: src/tests/lib/libexecinfo

2022-07-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Jul 25 22:43:01 UTC 2022

Modified Files:
src/tests/lib/libexecinfo: t_sig_backtrace.c

Log Message:
t_sig_backtrace: Pacify vfork clobber warning with volatile.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libexecinfo/t_sig_backtrace.c

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



CVS commit: src/tests/lib/libexecinfo

2022-07-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Jul 25 22:43:01 UTC 2022

Modified Files:
src/tests/lib/libexecinfo: t_sig_backtrace.c

Log Message:
t_sig_backtrace: Pacify vfork clobber warning with volatile.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libexecinfo/t_sig_backtrace.c

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

Modified files:

Index: src/tests/lib/libexecinfo/t_sig_backtrace.c
diff -u src/tests/lib/libexecinfo/t_sig_backtrace.c:1.5 src/tests/lib/libexecinfo/t_sig_backtrace.c:1.6
--- src/tests/lib/libexecinfo/t_sig_backtrace.c:1.5	Mon Jul 25 22:37:37 2022
+++ src/tests/lib/libexecinfo/t_sig_backtrace.c	Mon Jul 25 22:43:01 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_sig_backtrace.c,v 1.5 2022/07/25 22:37:37 riastradh Exp $	*/
+/*	$NetBSD: t_sig_backtrace.c,v 1.6 2022/07/25 22:43:01 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_sig_backtrace.c,v 1.5 2022/07/25 22:37:37 riastradh Exp $");
+__RCSID("$NetBSD: t_sig_backtrace.c,v 1.6 2022/07/25 22:43:01 riastradh Exp $");
 
 #include 
 #include 
@@ -83,8 +83,10 @@ func3(int i)
 }
 
 static int __noinline
-the_loop_deref(int i)
+the_loop_deref(int i0)
 {
+	volatile int i = i0;
+
 	while (*foo != 0) {
 		i = func3(i);
 		i = func1(i);
@@ -100,8 +102,10 @@ the_loop_deref(int i)
 }
 
 static int __noinline
-the_loop_jump(int i)
+the_loop_jump(int i0)
 {
+	volatile int i = i0;
+
 	while ((*bar)() != 0) {
 		i = func3(i);
 		i = func1(i);



CVS commit: src/tests/lib/libexecinfo

2022-07-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Jul 25 22:37:37 UTC 2022

Modified Files:
src/tests/lib/libexecinfo: t_sig_backtrace.c

Log Message:
execinfo(3): Mark sig_backtrace_jump test as xfail.

PR lib/56940


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libexecinfo/t_sig_backtrace.c

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

Modified files:

Index: src/tests/lib/libexecinfo/t_sig_backtrace.c
diff -u src/tests/lib/libexecinfo/t_sig_backtrace.c:1.4 src/tests/lib/libexecinfo/t_sig_backtrace.c:1.5
--- src/tests/lib/libexecinfo/t_sig_backtrace.c:1.4	Mon Jul 25 11:02:41 2022
+++ src/tests/lib/libexecinfo/t_sig_backtrace.c	Mon Jul 25 22:37:37 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_sig_backtrace.c,v 1.4 2022/07/25 11:02:41 riastradh Exp $	*/
+/*	$NetBSD: t_sig_backtrace.c,v 1.5 2022/07/25 22:37:37 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_sig_backtrace.c,v 1.4 2022/07/25 11:02:41 riastradh Exp $");
+__RCSID("$NetBSD: t_sig_backtrace.c,v 1.5 2022/07/25 22:37:37 riastradh Exp $");
 
 #include 
 #include 
@@ -225,6 +225,8 @@ ATF_TC_BODY(sig_backtrace_jump, tc)
 	};
 	ATF_REQUIRE(sigaction(SIGSEGV, , NULL) == 0);
 
+	atf_tc_expect_fail("PR lib/56940");
+
 	if (setjmp(env) == 0) {
 		printf("%d\n", the_loop_jump(0));
 	}



CVS commit: src/tests/lib/libexecinfo

2022-07-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Jul 25 22:37:37 UTC 2022

Modified Files:
src/tests/lib/libexecinfo: t_sig_backtrace.c

Log Message:
execinfo(3): Mark sig_backtrace_jump test as xfail.

PR lib/56940


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libexecinfo/t_sig_backtrace.c

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



CVS commit: src/tests/lib/libexecinfo

2022-07-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Jul 25 11:02:41 UTC 2022

Modified Files:
src/tests/lib/libexecinfo: t_sig_backtrace.c

Log Message:
execinfo: Fix mistake in previous: match `the_loop*' as prefix.

Now that there are two functions we need to catch either one.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libexecinfo/t_sig_backtrace.c

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



CVS commit: src/tests/lib/libexecinfo

2022-07-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Jul 25 11:02:41 UTC 2022

Modified Files:
src/tests/lib/libexecinfo: t_sig_backtrace.c

Log Message:
execinfo: Fix mistake in previous: match `the_loop*' as prefix.

Now that there are two functions we need to catch either one.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libexecinfo/t_sig_backtrace.c

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

Modified files:

Index: src/tests/lib/libexecinfo/t_sig_backtrace.c
diff -u src/tests/lib/libexecinfo/t_sig_backtrace.c:1.3 src/tests/lib/libexecinfo/t_sig_backtrace.c:1.4
--- src/tests/lib/libexecinfo/t_sig_backtrace.c:1.3	Mon Jul 25 10:38:17 2022
+++ src/tests/lib/libexecinfo/t_sig_backtrace.c	Mon Jul 25 11:02:41 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_sig_backtrace.c,v 1.3 2022/07/25 10:38:17 riastradh Exp $	*/
+/*	$NetBSD: t_sig_backtrace.c,v 1.4 2022/07/25 11:02:41 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_sig_backtrace.c,v 1.3 2022/07/25 10:38:17 riastradh Exp $");
+__RCSID("$NetBSD: t_sig_backtrace.c,v 1.4 2022/07/25 11:02:41 riastradh Exp $");
 
 #include 
 #include 
@@ -155,7 +155,7 @@ handler(int s)
 			continue;
 		}
 		if (found_sigtramp && !found_the_loop &&
-		strcmp(strings[i], "the_loop") == 0) {
+		strncmp(strings[i], "the_loop", strlen("the_loop")) == 0) {
 			found_the_loop = true;
 			continue;
 		}



CVS commit: src/tests/lib/libexecinfo

2022-07-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Jul 25 10:38:17 UTC 2022

Modified Files:
src/tests/lib/libexecinfo: t_sig_backtrace.c

Log Message:
execinfo: Test stack traces through null pointer jump too.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libexecinfo/t_sig_backtrace.c

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

Modified files:

Index: src/tests/lib/libexecinfo/t_sig_backtrace.c
diff -u src/tests/lib/libexecinfo/t_sig_backtrace.c:1.2 src/tests/lib/libexecinfo/t_sig_backtrace.c:1.3
--- src/tests/lib/libexecinfo/t_sig_backtrace.c:1.2	Tue Nov 23 23:29:55 2021
+++ src/tests/lib/libexecinfo/t_sig_backtrace.c	Mon Jul 25 10:38:17 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_sig_backtrace.c,v 1.2 2021/11/23 23:29:55 thorpej Exp $	*/
+/*	$NetBSD: t_sig_backtrace.c,v 1.3 2022/07/25 10:38:17 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_sig_backtrace.c,v 1.2 2021/11/23 23:29:55 thorpej Exp $");
+__RCSID("$NetBSD: t_sig_backtrace.c,v 1.3 2022/07/25 10:38:17 riastradh Exp $");
 
 #include 
 #include 
@@ -48,8 +48,10 @@ __RCSID("$NetBSD: t_sig_backtrace.c,v 1.
 stack_t sig_stack;
 
 char *foo;
+char *(*bar)(void);
 
-static int the_loop(int);
+static int the_loop_deref(int);
+static int the_loop_jump(int);
 
 #ifdef NOINLINE_HACK
 volatile int noinline;
@@ -59,7 +61,7 @@ static int __noinline
 func1(int i)
 {
 	if (i > 100) {
-		return the_loop(i);
+		return the_loop_deref(i);
 	}
 	return i + 1;
 }
@@ -81,7 +83,7 @@ func3(int i)
 }
 
 static int __noinline
-the_loop(int i)
+the_loop_deref(int i)
 {
 	while (*foo != 0) {
 		i = func3(i);
@@ -97,6 +99,23 @@ the_loop(int i)
 	return i;
 }
 
+static int __noinline
+the_loop_jump(int i)
+{
+	while ((*bar)() != 0) {
+		i = func3(i);
+		i = func1(i);
+		i = func2(i);
+	}
+
+#ifdef NOINLINE_HACK
+	if (noinline)
+		vfork();
+#endif
+
+	return i;
+}
+
 jmp_buf env;
 
 static void
@@ -155,14 +174,42 @@ handler(int s)
 	longjmp(env, 1);
 }
 
-ATF_TC(sig_backtrace);
-ATF_TC_HEAD(sig_backtrace, tc)
+ATF_TC(sig_backtrace_deref);
+ATF_TC_HEAD(sig_backtrace_deref, tc)
+{
+	atf_tc_set_md_var(tc, "descr",
+	"Test backtrace(3) across signal handlers, null pointer deref");
+}
+
+ATF_TC_BODY(sig_backtrace_deref, tc)
+{
+	sig_stack.ss_sp = mmap(NULL, SIGSTKSZ, PROT_READ | PROT_WRITE,
+	MAP_ANON | MAP_STACK, -1, 0);
+	ATF_REQUIRE(sig_stack.ss_sp != MAP_FAILED);
+
+	sig_stack.ss_size = SIGSTKSZ;
+	sig_stack.ss_flags = 0;
+	ATF_REQUIRE(sigaltstack(_stack, NULL) == 0);
+
+	struct sigaction sa = {
+		.sa_handler = handler,
+		.sa_flags = SA_ONSTACK,
+	};
+	ATF_REQUIRE(sigaction(SIGSEGV, , NULL) == 0);
+
+	if (setjmp(env) == 0) {
+		printf("%d\n", the_loop_deref(0));
+	}
+}
+
+ATF_TC(sig_backtrace_jump);
+ATF_TC_HEAD(sig_backtrace_jump, tc)
 {
 	atf_tc_set_md_var(tc, "descr",
-	"Test backtrace(3) across signal handlers");
+	"Test backtrace(3) across signal handlers, null pointer jump");
 }
 
-ATF_TC_BODY(sig_backtrace, tc)
+ATF_TC_BODY(sig_backtrace_jump, tc)
 {
 	sig_stack.ss_sp = mmap(NULL, SIGSTKSZ, PROT_READ | PROT_WRITE,
 	MAP_ANON | MAP_STACK, -1, 0);
@@ -179,13 +226,14 @@ ATF_TC_BODY(sig_backtrace, tc)
 	ATF_REQUIRE(sigaction(SIGSEGV, , NULL) == 0);
 
 	if (setjmp(env) == 0) {
-		printf("%d\n", the_loop(0));
+		printf("%d\n", the_loop_jump(0));
 	}
 }
 
 ATF_TP_ADD_TCS(tp)
 {
-	ATF_TP_ADD_TC(tp, sig_backtrace);
+	ATF_TP_ADD_TC(tp, sig_backtrace_deref);
+	ATF_TP_ADD_TC(tp, sig_backtrace_jump);
 
 	return atf_no_error();
 }



CVS commit: src/tests/lib/libexecinfo

2022-07-25 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Jul 25 10:38:17 UTC 2022

Modified Files:
src/tests/lib/libexecinfo: t_sig_backtrace.c

Log Message:
execinfo: Test stack traces through null pointer jump too.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libexecinfo/t_sig_backtrace.c

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



CVS commit: src/sys/sys

2022-07-24 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 24 20:28:39 UTC 2022

Modified Files:
src/sys/sys: lock.h

Log Message:
sys/lock.h: Need  for nullop.

But only do that we're not using SPINLOCK_BACKOFF_HOOK from
.


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/sys/sys/lock.h

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

Modified files:

Index: src/sys/sys/lock.h
diff -u src/sys/sys/lock.h:1.91 src/sys/sys/lock.h:1.92
--- src/sys/sys/lock.h:1.91	Tue Dec 22 01:58:58 2020
+++ src/sys/sys/lock.h	Sun Jul 24 20:28:39 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: lock.h,v 1.91 2020/12/22 01:58:58 ad Exp $	*/
+/*	$NetBSD: lock.h,v 1.92 2022/07/24 20:28:39 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2006, 2007 The NetBSD Foundation, Inc.
@@ -51,6 +51,7 @@
 #define	SPINLOCK_SPIN_HOOK
 #endif
 #ifndef SPINLOCK_BACKOFF_HOOK
+#include 
 #define	SPINLOCK_BACKOFF_HOOK		nullop(NULL)
 #endif
 #ifndef	SPINLOCK_BACKOFF_MIN



CVS commit: src/sys/sys

2022-07-24 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 24 20:28:39 UTC 2022

Modified Files:
src/sys/sys: lock.h

Log Message:
sys/lock.h: Need  for nullop.

But only do that we're not using SPINLOCK_BACKOFF_HOOK from
.


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/sys/sys/lock.h

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



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

2022-07-24 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 24 20:28:32 UTC 2022

Modified Files:
src/sys/arch/aarch64/include: lock.h

Log Message:
aarch64/lock.h: Need  for _HARDKERNEL.

Add include guard while here.

XXX Why does this aarch64-specific file have #ifdef __aarch64__?


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/aarch64/include/lock.h

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

Modified files:

Index: src/sys/arch/aarch64/include/lock.h
diff -u src/sys/arch/aarch64/include/lock.h:1.4 src/sys/arch/aarch64/include/lock.h:1.5
--- src/sys/arch/aarch64/include/lock.h:1.4	Sun Sep 26 20:15:04 2021
+++ src/sys/arch/aarch64/include/lock.h	Sun Jul 24 20:28:32 2022
@@ -1,4 +1,9 @@
-/* $NetBSD: lock.h,v 1.4 2021/09/26 20:15:04 jmcneill Exp $ */
+/* $NetBSD: lock.h,v 1.5 2022/07/24 20:28:32 riastradh Exp $ */
+
+#ifndef	_AARCH64_LOCK_H_
+#define	_AARCH64_LOCK_H_
+
+#include 
 
 #ifdef __aarch64__
 # ifdef _HARDKERNEL
@@ -11,3 +16,5 @@
 #elif defined(__arm__)
 # include 
 #endif
+
+#endif	/* _AARCH64_LOCK_H_ */



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

2022-07-24 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 24 20:28:32 UTC 2022

Modified Files:
src/sys/arch/aarch64/include: lock.h

Log Message:
aarch64/lock.h: Need  for _HARDKERNEL.

Add include guard while here.

XXX Why does this aarch64-specific file have #ifdef __aarch64__?


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/aarch64/include/lock.h

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



CVS commit: src/sys/external/bsd/drm2/dist/drm/amd/display/dc

2022-07-24 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 24 20:05:08 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/dist/drm/amd/display/dc: os_types.h

Log Message:
amdgpu: Define DC_FPU_START/END on Arm.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/sys/external/bsd/drm2/dist/drm/amd/display/dc/os_types.h

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/amd/display/dc/os_types.h
diff -u src/sys/external/bsd/drm2/dist/drm/amd/display/dc/os_types.h:1.3 src/sys/external/bsd/drm2/dist/drm/amd/display/dc/os_types.h:1.4
--- src/sys/external/bsd/drm2/dist/drm/amd/display/dc/os_types.h:1.3	Sun Dec 19 11:35:07 2021
+++ src/sys/external/bsd/drm2/dist/drm/amd/display/dc/os_types.h	Sun Jul 24 20:05:08 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: os_types.h,v 1.3 2021/12/19 11:35:07 riastradh Exp $	*/
+/*	$NetBSD: os_types.h,v 1.4 2022/07/24 20:05:08 riastradh Exp $	*/
 
 /*
  * Copyright 2012-16 Advanced Micro Devices, Inc.
@@ -53,16 +53,21 @@
 #define dm_error(fmt, ...) DRM_ERROR(fmt, ##__VA_ARGS__)
 
 #if defined(CONFIG_DRM_AMD_DC_DCN)
-#if defined(CONFIG_X86)
 #ifdef __NetBSD__
+#if defined(__i386__) || defined(__x86_64__)
 #include 
 #define	DC_FP_START()	fpu_kern_enter()
 #define	DC_FP_END()	fpu_kern_leave()
-#else
+#elif defined(__arm__) || defined(__aarch64__)
+#include 
+#define	DC_FP_START()	fpu_kern_enter()
+#define	DC_FP_END()	fpu_kern_leave()
+#endif
+#else	/* !__NetBSD__ */
+#if defined(CONFIG_X86)
 #include 
 #define DC_FP_START() kernel_fpu_begin()
 #define DC_FP_END() kernel_fpu_end()
-#endif
 #elif defined(CONFIG_PPC64)
 #include 
 #include 
@@ -92,6 +97,7 @@
 }
 #endif
 #endif
+#endif
 
 /*
  *



CVS commit: src/sys/external/bsd/drm2/dist/drm/amd/display/dc

2022-07-24 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 24 20:05:08 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/dist/drm/amd/display/dc: os_types.h

Log Message:
amdgpu: Define DC_FPU_START/END on Arm.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/sys/external/bsd/drm2/dist/drm/amd/display/dc/os_types.h

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



CVS commit: src/sys

2022-07-24 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 24 20:05:01 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/amdgpu: files.amdgpu
src/sys/modules/amdgpu: Makefile

Log Message:
amdgpu: Sprinkle missing COPTS.amdgpu_float options.

For some reason x86 didn't need these but aarch64 does.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/external/bsd/drm2/amdgpu/files.amdgpu
cvs rdiff -u -r1.1 -r1.2 src/sys/modules/amdgpu/Makefile

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

Modified files:

Index: src/sys/external/bsd/drm2/amdgpu/files.amdgpu
diff -u src/sys/external/bsd/drm2/amdgpu/files.amdgpu:1.28 src/sys/external/bsd/drm2/amdgpu/files.amdgpu:1.29
--- src/sys/external/bsd/drm2/amdgpu/files.amdgpu:1.28	Sat Jul 23 12:52:09 2022
+++ src/sys/external/bsd/drm2/amdgpu/files.amdgpu	Sun Jul 24 20:05:00 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: files.amdgpu,v 1.28 2022/07/23 12:52:09 riastradh Exp $
+#	$NetBSD: files.amdgpu,v 1.29 2022/07/24 20:05:00 riastradh Exp $
 
 version	20180827
 
@@ -70,6 +70,7 @@ elifdef aarch64
 makeoptions	amdgpu	"COPTS.amdgpu_float"+="-march=armv8-a"
 endif
 
+makeoptions	amdgpu	"COPTS.amdgpu_dcn10_resource.c"+="${COPTS.amdgpu_float}"
 makeoptions	amdgpu	"COPTS.amdgpu_dcn20_resource.c"+="${COPTS.amdgpu_float}"
 makeoptions	amdgpu	"COPTS.amdgpu_dcn21_resource.c"+="${COPTS.amdgpu_float}"
 makeoptions	amdgpu	"COPTS.amdgpu_dcn_calc_auto.c"+="${COPTS.amdgpu_float}"
@@ -82,10 +83,12 @@ makeoptions	amdgpu	"COPTS.amdgpu_display
 makeoptions	amdgpu	"COPTS.amdgpu_display_rq_dlg_calc_20.c"+="${COPTS.amdgpu_float}"
 makeoptions	amdgpu	"COPTS.amdgpu_display_rq_dlg_calc_20v2.c"+="${COPTS.amdgpu_float}"
 makeoptions	amdgpu	"COPTS.amdgpu_display_rq_dlg_calc_21.c"+="${COPTS.amdgpu_float}"
+makeoptions	amdgpu	"COPTS.amdgpu_display_rq_dlg_helpers.c"+="${COPTS.amdgpu_float}"
 makeoptions	amdgpu	"COPTS.amdgpu_dml1_display_rq_dlg_calc.c"+="${COPTS.amdgpu_float}"
 makeoptions	amdgpu	"COPTS.amdgpu_dml_common_defs.c"+="${COPTS.amdgpu_float}"
 makeoptions	amdgpu	"COPTS.amdgpu_rc_calc.c"+="${COPTS.amdgpu_float}"
 makeoptions	amdgpu	"COPTS.amdgpu_rc_calc_dpi.c"+="${COPTS.amdgpu_float}"
+makeoptions	amdgpu	"COPTS.amdgpu_rn_clk_mgr.c"+="${COPTS.amdgpu_float}"
 
 # Local additions.
 file	external/bsd/drm2/amdgpu/amdgpu_module.c	amdgpu

Index: src/sys/modules/amdgpu/Makefile
diff -u src/sys/modules/amdgpu/Makefile:1.1 src/sys/modules/amdgpu/Makefile:1.2
--- src/sys/modules/amdgpu/Makefile:1.1	Sun Dec 19 12:39:09 2021
+++ src/sys/modules/amdgpu/Makefile	Sun Jul 24 20:05:00 2022
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1 2021/12/19 12:39:09 riastradh Exp $
+# $NetBSD: Makefile,v 1.2 2022/07/24 20:05:00 riastradh Exp $
 
 .include "../Makefile.inc"
 .include "../drmkms/Makefile.inc"
@@ -54,6 +54,7 @@ CWARNFLAGS.amdgpu_navi10_ppt.c+=	-Wno-ty
 CWARNFLAGS.amdgpu_rn_clk_mgr.c+=	-Wno-type-limits
 CWARNFLAGS.amdgpu_vega10_reg_init.c+=	-Wno-cast-qual
 CWARNFLAGS.amdgpu_vega20_reg_init.c+=	-Wno-cast-qual
+COPTS.amdgpu_dcn10_resource.c+=	${COPTS.amdgpu_float}
 COPTS.amdgpu_dcn20_resource.c+=	${COPTS.amdgpu_float}
 COPTS.amdgpu_dcn21_resource.c+=	${COPTS.amdgpu_float}
 COPTS.amdgpu_dcn_calc_auto.c+=	${COPTS.amdgpu_float}
@@ -66,10 +67,12 @@ COPTS.amdgpu_display_mode_vba_21.c+=	${C
 COPTS.amdgpu_display_rq_dlg_calc_20.c+=	${COPTS.amdgpu_float}
 COPTS.amdgpu_display_rq_dlg_calc_20v2.c+=	${COPTS.amdgpu_float}
 COPTS.amdgpu_display_rq_dlg_calc_21.c+=	${COPTS.amdgpu_float}
+COPTS.amdgpu_display_rq_dlg_helpers.c+=	${COPTS.amdgpu_float}
 COPTS.amdgpu_dml1_display_rq_dlg_calc.c+=	${COPTS.amdgpu_float}
 COPTS.amdgpu_dml_common_defs.c+=	${COPTS.amdgpu_float}
 COPTS.amdgpu_rc_calc.c+=	${COPTS.amdgpu_float}
 COPTS.amdgpu_rc_calc_dpi.c+=	${COPTS.amdgpu_float}
+COPTS.amdgpu_rn_clk_mgr.c+=	${COPTS.amdgpu_float}
 
 # sed -ne 's,^file	\(external/bsd/drm2/.*\)/[^/ 	]*	.*,.PATH:	\1,gp' 

CVS commit: src/sys

2022-07-24 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 24 20:05:01 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/amdgpu: files.amdgpu
src/sys/modules/amdgpu: Makefile

Log Message:
amdgpu: Sprinkle missing COPTS.amdgpu_float options.

For some reason x86 didn't need these but aarch64 does.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/external/bsd/drm2/amdgpu/files.amdgpu
cvs rdiff -u -r1.1 -r1.2 src/sys/modules/amdgpu/Makefile

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



CVS commit: src/sys/external/bsd/drm2/drm

2022-07-24 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 24 19:24:00 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/drm: files.drmkms

Log Message:
drm: Fix CPPFLAGS for drm scheduler code.


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/sys/external/bsd/drm2/drm/files.drmkms

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

Modified files:

Index: src/sys/external/bsd/drm2/drm/files.drmkms
diff -u src/sys/external/bsd/drm2/drm/files.drmkms:1.80 src/sys/external/bsd/drm2/drm/files.drmkms:1.81
--- src/sys/external/bsd/drm2/drm/files.drmkms:1.80	Sat Jul 23 12:52:10 2022
+++ src/sys/external/bsd/drm2/drm/files.drmkms	Sun Jul 24 19:23:59 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: files.drmkms,v 1.80 2022/07/23 12:52:10 riastradh Exp $
+#	$NetBSD: files.drmkms,v 1.81 2022/07/24 19:23:59 riastradh Exp $
 
 version	20180827
 
@@ -99,7 +99,7 @@ file	external/bsd/drm2/drm/drm_scatter.c
 
 # GPU scheduler
 define	drmkms_sched: drmkms
-makeoptions	drmkms_sched	"CPPFLAGS.drmsched"+="${CPPFLAGS.drmkms}"
+makeoptions	drmkms_sched	"CPPFLAGS.drmkms_sched"+="${CPPFLAGS.drmkms}"
 
 file	external/bsd/drm2/dist/drm/scheduler/sched_entity.c	drmkms_sched
 file	external/bsd/drm2/dist/drm/scheduler/sched_fence.c	drmkms_sched



CVS commit: src/sys/external/bsd/drm2/drm

2022-07-24 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 24 19:24:00 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/drm: files.drmkms

Log Message:
drm: Fix CPPFLAGS for drm scheduler code.


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/sys/external/bsd/drm2/drm/files.drmkms

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



CVS commit: src/sys/kern

2022-07-24 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 24 19:23:44 UTC 2022

Modified Files:
src/sys/kern: kern_event.c

Log Message:
kern_event.c: Mark KASSERT-only static function as __diagused.

Otherwise clang objects with -Wunneeded-internal-declaration.


To generate a diff of this commit:
cvs rdiff -u -r1.145 -r1.146 src/sys/kern/kern_event.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/kern/kern_event.c
diff -u src/sys/kern/kern_event.c:1.145 src/sys/kern/kern_event.c:1.146
--- src/sys/kern/kern_event.c:1.145	Tue Jul 19 01:03:05 2022
+++ src/sys/kern/kern_event.c	Sun Jul 24 19:23:44 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_event.c,v 1.145 2022/07/19 01:03:05 thorpej Exp $	*/
+/*	$NetBSD: kern_event.c,v 1.146 2022/07/24 19:23:44 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009, 2021 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
 #endif /* _KERNEL_OPT */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.145 2022/07/19 01:03:05 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.146 2022/07/24 19:23:44 riastradh Exp $");
 
 #include 
 #include 
@@ -169,7 +169,7 @@ knote_foplock_exit(struct knote *kn)
 	mutex_exit(_TO_KIMPL(kn)->ki_foplock);
 }
 
-static inline bool
+static inline bool __diagused
 knote_foplock_owned(struct knote *kn)
 {
 	return mutex_owned(_TO_KIMPL(kn)->ki_foplock);



CVS commit: src/sys/kern

2022-07-24 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 24 19:23:44 UTC 2022

Modified Files:
src/sys/kern: kern_event.c

Log Message:
kern_event.c: Mark KASSERT-only static function as __diagused.

Otherwise clang objects with -Wunneeded-internal-declaration.


To generate a diff of this commit:
cvs rdiff -u -r1.145 -r1.146 src/sys/kern/kern_event.c

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



CVS commit: src/sys

2022-07-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jul 23 12:52:10 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/amdgpu: amdgpu_module.c files.amdgpu
src/sys/external/bsd/drm2/drm: files.drmkms
Added Files:
src/sys/external/bsd/drm2/drm: sched_module.c
src/sys/modules/drmkms_sched: Makefile

Log Message:
drm: Split scheduler into separate module.

Used only by amdgpu, and it uses something that is currently broken
from the gcc update on aarch64, so let's make it a little more
optional.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/drm2/amdgpu/amdgpu_module.c
cvs rdiff -u -r1.27 -r1.28 src/sys/external/bsd/drm2/amdgpu/files.amdgpu
cvs rdiff -u -r1.79 -r1.80 src/sys/external/bsd/drm2/drm/files.drmkms
cvs rdiff -u -r0 -r1.1 src/sys/external/bsd/drm2/drm/sched_module.c
cvs rdiff -u -r0 -r1.1 src/sys/modules/drmkms_sched/Makefile

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

Modified files:

Index: src/sys/external/bsd/drm2/amdgpu/amdgpu_module.c
diff -u src/sys/external/bsd/drm2/amdgpu/amdgpu_module.c:1.10 src/sys/external/bsd/drm2/amdgpu/amdgpu_module.c:1.11
--- src/sys/external/bsd/drm2/amdgpu/amdgpu_module.c:1.10	Sun Jul 17 15:36:15 2022
+++ src/sys/external/bsd/drm2/amdgpu/amdgpu_module.c	Sat Jul 23 12:52:09 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: amdgpu_module.c,v 1.10 2022/07/17 15:36:15 riastradh Exp $	*/
+/*	$NetBSD: amdgpu_module.c,v 1.11 2022/07/23 12:52:09 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_module.c,v 1.10 2022/07/17 15:36:15 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_module.c,v 1.11 2022/07/23 12:52:09 riastradh Exp $");
 
 #include 
 #include 
@@ -50,7 +50,7 @@ __KERNEL_RCSID(0, "$NetBSD: amdgpu_modul
 #include "amdgpu_amdkfd.h"
 #include "amdgpu_drv.h"
 
-MODULE(MODULE_CLASS_DRIVER, amdgpu, "drmkms,drmkms_pci,drmkms_ttm"); /* XXX drmkms_i2c */
+MODULE(MODULE_CLASS_DRIVER, amdgpu, "drmkms,drmkms_pci,drmkms_sched,drmkms_ttm"); /* XXX drmkms_i2c */
 
 #ifdef _MODULE
 #include "ioconf.c"

Index: src/sys/external/bsd/drm2/amdgpu/files.amdgpu
diff -u src/sys/external/bsd/drm2/amdgpu/files.amdgpu:1.27 src/sys/external/bsd/drm2/amdgpu/files.amdgpu:1.28
--- src/sys/external/bsd/drm2/amdgpu/files.amdgpu:1.27	Tue Jul 19 23:19:06 2022
+++ src/sys/external/bsd/drm2/amdgpu/files.amdgpu	Sat Jul 23 12:52:09 2022
@@ -1,9 +1,9 @@
-#	$NetBSD: files.amdgpu,v 1.27 2022/07/19 23:19:06 riastradh Exp $
+#	$NetBSD: files.amdgpu,v 1.28 2022/07/23 12:52:09 riastradh Exp $
 
 version	20180827
 
 define	amdgpufbbus	{ }
-device	amdgpu: drmkms, drmkms_pci, drmkms_ttm, amdgpufbbus, firmload
+device	amdgpu: drmkms, drmkms_pci, drmkms_sched, drmkms_ttm, amdgpufbbus, firmload
 attach	amdgpu at pci
 makeoptions	amdgpu		"CPPFLAGS.amdgpu"+="${CPPFLAGS.drmkms}"
 

Index: src/sys/external/bsd/drm2/drm/files.drmkms
diff -u src/sys/external/bsd/drm2/drm/files.drmkms:1.79 src/sys/external/bsd/drm2/drm/files.drmkms:1.80
--- src/sys/external/bsd/drm2/drm/files.drmkms:1.79	Wed Jul 20 10:01:01 2022
+++ src/sys/external/bsd/drm2/drm/files.drmkms	Sat Jul 23 12:52:10 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: files.drmkms,v 1.79 2022/07/20 10:01:01 riastradh Exp $
+#	$NetBSD: files.drmkms,v 1.80 2022/07/23 12:52:10 riastradh Exp $
 
 version	20180827
 
@@ -98,9 +98,13 @@ file	external/bsd/drm2/drm/drm_lock.c		d
 file	external/bsd/drm2/drm/drm_scatter.c		drmums
 
 # GPU scheduler
-file	external/bsd/drm2/dist/drm/scheduler/sched_entity.c	drmkms
-file	external/bsd/drm2/dist/drm/scheduler/sched_fence.c	drmkms
-file	external/bsd/drm2/dist/drm/scheduler/sched_main.c	drmkms
+define	drmkms_sched: drmkms
+makeoptions	drmkms_sched	"CPPFLAGS.drmsched"+="${CPPFLAGS.drmkms}"
+
+file	external/bsd/drm2/dist/drm/scheduler/sched_entity.c	drmkms_sched
+file	external/bsd/drm2/dist/drm/scheduler/sched_fence.c	drmkms_sched
+file	external/bsd/drm2/dist/drm/scheduler/sched_main.c	drmkms_sched
+file	external/bsd/drm2/drm/sched_module.c			drmkms_sched
 
 # Generated from drm2netbsd.
 #file	external/bsd/drm2/dist/drm/drm_agpsupport.c	drmkms	# drmkms_pci

Added files:

Index: src/sys/external/bsd/drm2/drm/sched_module.c
diff -u /dev/null src/sys/external/bsd/drm2/drm/sched_module.c:1.1
--- /dev/null	Sat Jul 23 12:52:10 2022
+++ src/sys/external/bsd/drm2/drm/sched_module.c	Sat Jul 23 12:52:10 2022
@@ -0,0 +1,48 @@
+/*	$NetBSD: sched_module.c,v 1.1 2022/07/23 12:52:10 riastradh Exp $	*/
+
+/*-
+ * Copyright (c) 2022 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must 

CVS commit: src/sys

2022-07-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jul 23 12:52:10 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/amdgpu: amdgpu_module.c files.amdgpu
src/sys/external/bsd/drm2/drm: files.drmkms
Added Files:
src/sys/external/bsd/drm2/drm: sched_module.c
src/sys/modules/drmkms_sched: Makefile

Log Message:
drm: Split scheduler into separate module.

Used only by amdgpu, and it uses something that is currently broken
from the gcc update on aarch64, so let's make it a little more
optional.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/drm2/amdgpu/amdgpu_module.c
cvs rdiff -u -r1.27 -r1.28 src/sys/external/bsd/drm2/amdgpu/files.amdgpu
cvs rdiff -u -r1.79 -r1.80 src/sys/external/bsd/drm2/drm/files.drmkms
cvs rdiff -u -r0 -r1.1 src/sys/external/bsd/drm2/drm/sched_module.c
cvs rdiff -u -r0 -r1.1 src/sys/modules/drmkms_sched/Makefile

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



CVS commit: src/sys/external/bsd/drm2/pci

2022-07-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jul 23 08:45:03 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/pci: drm_pci_busid.c

Log Message:
drm: Go back to using device_unit(pciN) for pci busid.

This isn't arbitrary; it has to match existing logic in userland in
libpciaccess, and until we extend the pci(4) ioctl interface, and
find some way to handle userland compatibility, we can't change it.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/pci/drm_pci_busid.c

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



CVS commit: src/sys/external/bsd/drm2/pci

2022-07-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jul 23 08:45:03 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/pci: drm_pci_busid.c

Log Message:
drm: Go back to using device_unit(pciN) for pci busid.

This isn't arbitrary; it has to match existing logic in userland in
libpciaccess, and until we extend the pci(4) ioctl interface, and
find some way to handle userland compatibility, we can't change it.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/pci/drm_pci_busid.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/external/bsd/drm2/pci/drm_pci_busid.c
diff -u src/sys/external/bsd/drm2/pci/drm_pci_busid.c:1.2 src/sys/external/bsd/drm2/pci/drm_pci_busid.c:1.3
--- src/sys/external/bsd/drm2/pci/drm_pci_busid.c:1.2	Wed Jul 20 01:20:20 2022
+++ src/sys/external/bsd/drm2/pci/drm_pci_busid.c	Sat Jul 23 08:45:03 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_pci_busid.c,v 1.2 2022/07/20 01:20:20 riastradh Exp $	*/
+/*	$NetBSD: drm_pci_busid.c,v 1.3 2022/07/23 08:45:03 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drm_pci_busid.c,v 1.2 2022/07/20 01:20:20 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_pci_busid.c,v 1.3 2022/07/23 08:45:03 riastradh Exp $");
 
 #include 
 #include 
@@ -52,7 +52,7 @@ drm_pci_set_busid(struct drm_device *dev
 	KASSERT(dev_is_pci(dev->dev));
 
 	master->unique = kasprintf(GFP_KERNEL, "pci:%04x:%02x:%02x.%d",
-	pci_domain_nr(dev->pdev->bus),
+	device_unit(device_parent(dev->dev)),
 	pa->pa_bus, pa->pa_device, pa->pa_function);
 	if (master->unique == NULL)
 		return -ENOMEM;



CVS commit: src/sys/external/bsd/drm2/ttm

2022-07-21 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Jul 21 08:07:56 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/ttm: ttm_bo_vm.c

Log Message:
drm/ttm: Cast to potentially larger types before << PAGE_SHIFT.

Not sure if this is a problem but it might affect, e.g., i386pae.
Can't hurt, in any case, to cast to what the type will be after the
shift anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/external/bsd/drm2/ttm/ttm_bo_vm.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/external/bsd/drm2/ttm/ttm_bo_vm.c
diff -u src/sys/external/bsd/drm2/ttm/ttm_bo_vm.c:1.21 src/sys/external/bsd/drm2/ttm/ttm_bo_vm.c:1.22
--- src/sys/external/bsd/drm2/ttm/ttm_bo_vm.c:1.21	Wed Jul 20 01:12:14 2022
+++ src/sys/external/bsd/drm2/ttm/ttm_bo_vm.c	Thu Jul 21 08:07:56 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ttm_bo_vm.c,v 1.21 2022/07/20 01:12:14 riastradh Exp $	*/
+/*	$NetBSD: ttm_bo_vm.c,v 1.22 2022/07/21 08:07:56 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ttm_bo_vm.c,v 1.21 2022/07/20 01:12:14 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ttm_bo_vm.c,v 1.22 2022/07/21 08:07:56 riastradh Exp $");
 
 #include 
 
@@ -163,7 +163,7 @@ ttm_bo_uvm_fault(struct uvm_faultinfo *u
 			.flags = TTM_OPT_FLAG_FORCE_ALLOC,
 		};
 		u.ttm = bo->ttm;
-		size = (bo->ttm->num_pages << PAGE_SHIFT);
+		size = (size_t)bo->ttm->num_pages << PAGE_SHIFT;
 		if (ISSET(bo->mem.placement, TTM_PL_FLAG_CACHED))
 			pgprot = vm_prot;
 		else
@@ -195,12 +195,12 @@ ttm_bo_uvm_fault(struct uvm_faultinfo *u
 		if (!bo->mem.bus.is_iomem) {
 			paddr = page_to_phys(u.ttm->pages[startpage + i]);
 		} else if (bdev->driver->io_mem_pfn) {
-			paddr = (*bdev->driver->io_mem_pfn)(bo, startpage + i)
-			<< PAGE_SHIFT;
+			paddr = (paddr_t)(*bdev->driver->io_mem_pfn)(bo,
+			startpage + i) << PAGE_SHIFT;
 		} else {
 			const paddr_t cookie = bus_space_mmap(bdev->memt,
-			u.base, ((startpage + i) << PAGE_SHIFT), vm_prot,
-			0);
+			u.base, (off_t)(startpage + i) << PAGE_SHIFT,
+			vm_prot, 0);
 
 			paddr = pmap_phys_address(cookie);
 		}
@@ -292,7 +292,7 @@ ttm_bo_mmap_object(struct ttm_bo_device 
 	/* Success!  */
 	*uobjp = >uvmobj;
 	*uoffsetp = (offset -
-	(drm_vma_node_start(>base.vma_node) << PAGE_SHIFT));
+	((off_t)drm_vma_node_start(>base.vma_node) << PAGE_SHIFT));
 	return 0;
 
 fail1:	ttm_bo_put(bo);



CVS commit: src/sys/external/bsd/drm2/ttm

2022-07-21 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Jul 21 08:07:56 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/ttm: ttm_bo_vm.c

Log Message:
drm/ttm: Cast to potentially larger types before << PAGE_SHIFT.

Not sure if this is a problem but it might affect, e.g., i386pae.
Can't hurt, in any case, to cast to what the type will be after the
shift anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/external/bsd/drm2/ttm/ttm_bo_vm.c

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



  1   2   3   4   5   6   7   8   9   10   >