CVS commit: src/sys

2022-07-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jul 18 04:32:35 UTC 2022

Modified Files:
src/sys/kern: vnode_if.c
src/sys/rump/include/rump: rumpvnode_if.h
src/sys/rump/librump/rumpvfs: rumpvnode_if.c
src/sys/sys: vnode_if.h

Log Message:
Regen for:

Make kqueue event status for vnodes shareable, and for stacked file systems
like nullfs, make the upper vnode share that status with the lower vnode.

And, lo, NetBSD 9.99.99.

Fixes PR kern/56713.


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/sys/kern/vnode_if.c
cvs rdiff -u -r1.39 -r1.40 src/sys/rump/include/rump/rumpvnode_if.h
cvs rdiff -u -r1.39 -r1.40 src/sys/rump/librump/rumpvfs/rumpvnode_if.c
cvs rdiff -u -r1.110 -r1.111 src/sys/sys/vnode_if.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/kern/vnode_if.c
diff -u src/sys/kern/vnode_if.c:1.117 src/sys/kern/vnode_if.c:1.118
--- src/sys/kern/vnode_if.c:1.117	Tue May  3 13:55:29 2022
+++ src/sys/kern/vnode_if.c	Mon Jul 18 04:32:35 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnode_if.c,v 1.117 2022/05/03 13:55:29 hannken Exp $	*/
+/*	$NetBSD: vnode_if.c,v 1.118 2022/07/18 04:32:35 thorpej Exp $	*/
 
 /*
  * Warning: DO NOT EDIT! This file is automatically generated!
@@ -7,7 +7,7 @@
  * Created from the file:
  *	NetBSD: vnode_if.src,v 1.84 2022/05/03 08:33:59 hannken Exp
  * by the script:
- *	NetBSD: vnode_if.sh,v 1.75 2022/05/03 13:54:18 hannken Exp
+ *	NetBSD: vnode_if.sh,v 1.76 2022/07/18 04:30:30 thorpej Exp
  */
 
 /*
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vnode_if.c,v 1.117 2022/05/03 13:55:29 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnode_if.c,v 1.118 2022/07/18 04:32:35 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_vnode_lockdebug.h"
@@ -137,7 +137,7 @@ do {	\
 	 */\
 	mutex_enter((thisvp)->v_interlock);\
 	if (__predict_true((e) == 0)) {	\
-		knote(&(thisvp)->v_klist, (n));\
+		knote(&(thisvp)->v_klist->vk_klist, (n));		\
 	}\
 	holdrelel((thisvp));		\
 	mutex_exit((thisvp)->v_interlock);\
@@ -250,7 +250,7 @@ do {	\
 		 * meaningless from the watcher's perspective.		\
 		 */			\
 		if (__predict_true(thisvp->v_op != dead_vnodeop_p)) {	\
-			knote(>v_klist,\
+			knote(>v_klist->vk_klist,		\
 			((ap)->a_fflag & FWRITE)			\
 			? NOTE_CLOSE_WRITE : NOTE_CLOSE);		\
 		}			\

Index: src/sys/rump/include/rump/rumpvnode_if.h
diff -u src/sys/rump/include/rump/rumpvnode_if.h:1.39 src/sys/rump/include/rump/rumpvnode_if.h:1.40
--- src/sys/rump/include/rump/rumpvnode_if.h:1.39	Tue May  3 13:55:29 2022
+++ src/sys/rump/include/rump/rumpvnode_if.h	Mon Jul 18 04:32:35 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpvnode_if.h,v 1.39 2022/05/03 13:55:29 hannken Exp $	*/
+/*	$NetBSD: rumpvnode_if.h,v 1.40 2022/07/18 04:32:35 thorpej Exp $	*/
 
 /*
  * Warning: DO NOT EDIT! This file is automatically generated!
@@ -7,7 +7,7 @@
  * Created from the file:
  *	NetBSD: vnode_if.src,v 1.84 2022/05/03 08:33:59 hannken Exp
  * by the script:
- *	NetBSD: vnode_if.sh,v 1.75 2022/05/03 13:54:18 hannken Exp
+ *	NetBSD: vnode_if.sh,v 1.76 2022/07/18 04:30:30 thorpej Exp
  */
 
 /*

Index: src/sys/rump/librump/rumpvfs/rumpvnode_if.c
diff -u src/sys/rump/librump/rumpvfs/rumpvnode_if.c:1.39 src/sys/rump/librump/rumpvfs/rumpvnode_if.c:1.40
--- src/sys/rump/librump/rumpvfs/rumpvnode_if.c:1.39	Tue May  3 13:55:29 2022
+++ src/sys/rump/librump/rumpvfs/rumpvnode_if.c	Mon Jul 18 04:32:35 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpvnode_if.c,v 1.39 2022/05/03 13:55:29 hannken Exp $	*/
+/*	$NetBSD: rumpvnode_if.c,v 1.40 2022/07/18 04:32:35 thorpej Exp $	*/
 
 /*
  * Warning: DO NOT EDIT! This file is automatically generated!
@@ -7,7 +7,7 @@
  * Created from the file:
  *	NetBSD: vnode_if.src,v 1.84 2022/05/03 08:33:59 hannken Exp
  * by the script:
- *	NetBSD: vnode_if.sh,v 1.75 2022/05/03 13:54:18 hannken Exp
+ *	NetBSD: vnode_if.sh,v 1.76 2022/07/18 04:30:30 thorpej Exp
  */
 
 /*
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rumpvnode_if.c,v 1.39 2022/05/03 13:55:29 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpvnode_if.c,v 1.40 2022/07/18 04:32:35 thorpej Exp $");
 
 #include 
 #include 

Index: src/sys/sys/vnode_if.h
diff -u src/sys/sys/vnode_if.h:1.110 src/sys/sys/vnode_if.h:1.111
--- src/sys/sys/vnode_if.h:1.110	Tue May  3 13:55:29 2022
+++ src/sys/sys/vnode_if.h	Mon Jul 18 04:32:35 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnode_if.h,v 1.110 2022/05/03 13:55:29 hannken Exp $	*/
+/*	$NetBSD: vnode_if.h,v 1.111 2022/07/18 04:32:35 thorpej Exp $	*/
 
 /*
  * Warning: DO NOT EDIT! This file is automatically generated!
@@ -7,7 +7,7 @@
  * Created from the file:
  *	NetBSD: vnode_if.src,v 1.84 2022/05/03 08:33:59 hannken Exp
  * by the script:
- *	NetBSD: vnode_if.sh,v 1.75 2022/05/03 13:54:18 hannken Exp
+ *	NetBSD: vnode_if.sh,v 1.76 2022/07/18 04:30:30 thorpej Exp
 

CVS commit: src/sys

2022-07-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jul 18 04:32:35 UTC 2022

Modified Files:
src/sys/kern: vnode_if.c
src/sys/rump/include/rump: rumpvnode_if.h
src/sys/rump/librump/rumpvfs: rumpvnode_if.c
src/sys/sys: vnode_if.h

Log Message:
Regen for:

Make kqueue event status for vnodes shareable, and for stacked file systems
like nullfs, make the upper vnode share that status with the lower vnode.

And, lo, NetBSD 9.99.99.

Fixes PR kern/56713.


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/sys/kern/vnode_if.c
cvs rdiff -u -r1.39 -r1.40 src/sys/rump/include/rump/rumpvnode_if.h
cvs rdiff -u -r1.39 -r1.40 src/sys/rump/librump/rumpvfs/rumpvnode_if.c
cvs rdiff -u -r1.110 -r1.111 src/sys/sys/vnode_if.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-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jul 18 04:30:31 UTC 2022

Modified Files:
src/sys/fs/union: union_subr.c
src/sys/kern: vfs_vnode.c vfs_vnops.c vnode_if.sh
src/sys/miscfs/genfs: layer_vfsops.c
src/sys/sys: param.h vnode.h vnode_impl.h
src/tests/lib/libc/kevent_nullmnt: t_nullmnt.sh

Log Message:
Make kqueue event status for vnodes shareable, and for stacked file systems
like nullfs, make the upper vnode share that status with the lower vnode.

And, lo, NetBSD 9.99.99.

Fixes PR kern/56713.


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/fs/union/union_subr.c
cvs rdiff -u -r1.143 -r1.144 src/sys/kern/vfs_vnode.c
cvs rdiff -u -r1.233 -r1.234 src/sys/kern/vfs_vnops.c
cvs rdiff -u -r1.75 -r1.76 src/sys/kern/vnode_if.sh
cvs rdiff -u -r1.54 -r1.55 src/sys/miscfs/genfs/layer_vfsops.c
cvs rdiff -u -r1.711 -r1.712 src/sys/sys/param.h
cvs rdiff -u -r1.301 -r1.302 src/sys/sys/vnode.h
cvs rdiff -u -r1.23 -r1.24 src/sys/sys/vnode_impl.h
cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libc/kevent_nullmnt/t_nullmnt.sh

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/union/union_subr.c
diff -u src/sys/fs/union/union_subr.c:1.81 src/sys/fs/union/union_subr.c:1.82
--- src/sys/fs/union/union_subr.c:1.81	Sat Mar 19 13:53:32 2022
+++ src/sys/fs/union/union_subr.c	Mon Jul 18 04:30:30 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: union_subr.c,v 1.81 2022/03/19 13:53:32 hannken Exp $	*/
+/*	$NetBSD: union_subr.c,v 1.82 2022/07/18 04:30:30 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1994
@@ -72,7 +72,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: union_subr.c,v 1.81 2022/03/19 13:53:32 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: union_subr.c,v 1.82 2022/07/18 04:30:30 thorpej Exp $");
 
 #include 
 #include 
@@ -232,10 +232,11 @@ union_newupper(struct union_node *un, st
 	unlock_ap.a_desc = VDESC(vop_unlock);
 	unlock_ap.a_vp = UNIONTOV(un);
 	genfs_unlock(_ap);
-	/* Update union vnode interlock & vmobjlock. */
+	/* Update union vnode interlock, vmobjlock, & klist. */
 	vshareilock(UNIONTOV(un), uppervp);
 	rw_obj_hold(uppervp->v_uobj.vmobjlock);
 	uvm_obj_setlock((un)->v_uobj, uppervp->v_uobj.vmobjlock);
+	vshareklist(UNIONTOV(un), uppervp);
 	mutex_exit(>un_lock);
 	if (ohash != nhash) {
 		LIST_INSERT_HEAD([nhash], un, un_cache);
@@ -577,6 +578,7 @@ union_loadvnode(struct mount *mp, struct
 	vshareilock(vp, svp);
 	rw_obj_hold(svp->v_uobj.vmobjlock);
 	uvm_obj_setlock(>v_uobj, svp->v_uobj.vmobjlock);
+	vshareklist(vp, svp);
 
 	/* detect the root vnode (and aliases) */
 	if ((un->un_uppervp == um->um_uppervp) &&

Index: src/sys/kern/vfs_vnode.c
diff -u src/sys/kern/vfs_vnode.c:1.143 src/sys/kern/vfs_vnode.c:1.144
--- src/sys/kern/vfs_vnode.c:1.143	Sat Apr  9 23:45:45 2022
+++ src/sys/kern/vfs_vnode.c	Mon Jul 18 04:30:30 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_vnode.c,v 1.143 2022/04/09 23:45:45 riastradh Exp $	*/
+/*	$NetBSD: vfs_vnode.c,v 1.144 2022/07/18 04:30:30 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1997-2011, 2019, 2020 The NetBSD Foundation, Inc.
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.143 2022/04/09 23:45:45 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.144 2022/07/18 04:30:30 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pax.h"
@@ -457,7 +457,8 @@ vnalloc_marker(struct mount *mp)
 	vp->v_mount = mp;
 	vp->v_type = VBAD;
 	vp->v_interlock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NONE);
-	klist_init(>v_klist);
+	klist_init(>vi_klist.vk_klist);
+	vp->v_klist = >vi_klist;
 	vip->vi_state = VS_MARKER;
 
 	return vp;
@@ -475,7 +476,7 @@ vnfree_marker(vnode_t *vp)
 	KASSERT(vip->vi_state == VS_MARKER);
 	mutex_obj_free(vp->v_interlock);
 	uvm_obj_destroy(>v_uobj, true);
-	klist_fini(>v_klist);
+	klist_fini(>vi_klist.vk_klist);
 	pool_cache_put(vcache_pool, vip);
 }
 
@@ -1391,7 +1392,8 @@ vcache_alloc(void)
 	vp->v_interlock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NONE);
 
 	uvm_obj_init(>v_uobj, _vnodeops, true, 1);
-	klist_init(>v_klist);
+	klist_init(>vi_klist.vk_klist);
+	vp->v_klist = >vi_klist;
 	cv_init(>v_cv, "vnode");
 	cache_vnode_init(vp);
 
@@ -1453,7 +1455,9 @@ vcache_free(vnode_impl_t *vip)
 	mutex_obj_free(vp->v_interlock);
 	rw_destroy(>vi_lock);
 	uvm_obj_destroy(>v_uobj, true);
-	klist_fini(>v_klist);
+	KASSERT(vp->v_klist == >vi_klist ||
+		SLIST_EMPTY(>vi_klist.vk_klist));
+	klist_fini(>vi_klist.vk_klist);
 	cv_destroy(>v_cv);
 	cache_vnode_fini(vp);
 	pool_cache_put(vcache_pool, vip);
@@ -1916,7 +1920,7 @@ vcache_reclaim(vnode_t *vp)
 	 * Don't check for interest in NOTE_REVOKE; it's always posted
 	 * because it sets EV_EOF.
 	 */
-	KNOTE(>v_klist, NOTE_REVOKE);
+	KNOTE(>v_klist->vk_klist, NOTE_REVOKE);
 	mutex_exit(vp->v_interlock);
 
 	/*
@@ -2095,3 +2099,28 @@ vshareilock(vnode_t *tvp, vnode_t *fvp)
 	tvp->v_interlock = fvp->v_interlock;
 	mutex_obj_free(oldlock);
 

CVS commit: src

2022-07-17 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Jul 18 04:30:31 UTC 2022

Modified Files:
src/sys/fs/union: union_subr.c
src/sys/kern: vfs_vnode.c vfs_vnops.c vnode_if.sh
src/sys/miscfs/genfs: layer_vfsops.c
src/sys/sys: param.h vnode.h vnode_impl.h
src/tests/lib/libc/kevent_nullmnt: t_nullmnt.sh

Log Message:
Make kqueue event status for vnodes shareable, and for stacked file systems
like nullfs, make the upper vnode share that status with the lower vnode.

And, lo, NetBSD 9.99.99.

Fixes PR kern/56713.


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/fs/union/union_subr.c
cvs rdiff -u -r1.143 -r1.144 src/sys/kern/vfs_vnode.c
cvs rdiff -u -r1.233 -r1.234 src/sys/kern/vfs_vnops.c
cvs rdiff -u -r1.75 -r1.76 src/sys/kern/vnode_if.sh
cvs rdiff -u -r1.54 -r1.55 src/sys/miscfs/genfs/layer_vfsops.c
cvs rdiff -u -r1.711 -r1.712 src/sys/sys/param.h
cvs rdiff -u -r1.301 -r1.302 src/sys/sys/vnode.h
cvs rdiff -u -r1.23 -r1.24 src/sys/sys/vnode_impl.h
cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libc/kevent_nullmnt/t_nullmnt.sh

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/common/include/asm

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 22:02:23 UTC 2022

Modified Files:
src/sys/external/bsd/common/include/asm: barrier.h

Log Message:
drm: Fix missing barrier definitions on arm.

The definition will work on armv7; don't think we have any drmkms
drivers on armv<7.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/external/bsd/common/include/asm/barrier.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/asm/barrier.h
diff -u src/sys/external/bsd/common/include/asm/barrier.h:1.14 src/sys/external/bsd/common/include/asm/barrier.h:1.15
--- src/sys/external/bsd/common/include/asm/barrier.h:1.14	Sun Jul 17 18:45:48 2022
+++ src/sys/external/bsd/common/include/asm/barrier.h	Sun Jul 17 22:02:23 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: barrier.h,v 1.14 2022/07/17 18:45:48 riastradh Exp $	*/
+/*	$NetBSD: barrier.h,v 1.15 2022/07/17 22:02:23 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -54,6 +54,10 @@
 #define	mb()	__asm __volatile ("dsb sy" ::: "memory")
 #define	wmb()	__asm __volatile ("dsb st" ::: "memory")
 #define	rmb()	__asm __volatile ("dsb ld" ::: "memory")
+#elif defined(__arm__)
+#define	mb()	__asm __volatile ("dsb" ::: "memory")
+#define	wmb()	mb()
+#define	rmb()	mb()
 #elif defined(__i386__) || defined(__x86_64__)
 #include 
 #define	mb()	x86_mfence()



CVS commit: src/sys/external/bsd/common/include/asm

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 22:02:23 UTC 2022

Modified Files:
src/sys/external/bsd/common/include/asm: barrier.h

Log Message:
drm: Fix missing barrier definitions on arm.

The definition will work on armv7; don't think we have any drmkms
drivers on armv<7.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/external/bsd/common/include/asm/barrier.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-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 20:23:17 UTC 2022

Modified Files:
src/sys/arch/arm/fdt: arm_simplefb.c
src/sys/dev/wscons: wsdisplay_vcons.c wsdisplay_vconsvar.h

Log Message:
wsdisplay(4): Make most of struct vcons_data private.

More importantly, make sizeof(struct vcons_data) independent of
whether VCONS_DRAW_INTR  is defined.

Allocate the private space with kmem rather than in the caller.

This still doesn't have very good separation between interface
parameters and internal state, but it's better than before, and is
necessary to make genfb usable in modules.

In arm_simplefb.c, this removes use of the use_intr member.  That
assignment became redundant with the introduction of vcons_earlyinit,
so there's no need to replace it by anything.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/fdt/arm_simplefb.c
cvs rdiff -u -r1.62 -r1.63 src/sys/dev/wscons/wsdisplay_vcons.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/wscons/wsdisplay_vconsvar.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/arm/fdt/arm_simplefb.c
diff -u src/sys/arch/arm/fdt/arm_simplefb.c:1.11 src/sys/arch/arm/fdt/arm_simplefb.c:1.12
--- src/sys/arch/arm/fdt/arm_simplefb.c:1.11	Mon Aug 30 22:47:24 2021
+++ src/sys/arch/arm/fdt/arm_simplefb.c	Sun Jul 17 20:23:17 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: arm_simplefb.c,v 1.11 2021/08/30 22:47:24 jmcneill Exp $ */
+/* $NetBSD: arm_simplefb.c,v 1.12 2022/07/17 20:23:17 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #include "opt_vcons.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: arm_simplefb.c,v 1.11 2021/08/30 22:47:24 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arm_simplefb.c,v 1.12 2022/07/17 20:23:17 riastradh Exp $");
 
 #include 
 #include 
@@ -281,9 +281,6 @@ arm_simplefb_preattach(void)
 	vcons_earlyinit(_simplefb_vcons_data, sc, _simplefb_stdscreen,
 	_simplefb_accessops);
 	arm_simplefb_vcons_data.init_screen = arm_simplefb_init_screen;
-#ifdef VCONS_DRAW_INTR
-	arm_simplefb_vcons_data.use_intr = 0;
-#endif
 	vcons_init_screen(_simplefb_vcons_data, _simplefb_screen, 1,
 	);
 	arm_simplefb_screen.scr_flags |= VCONS_SCREEN_IS_STATIC;

Index: src/sys/dev/wscons/wsdisplay_vcons.c
diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.62 src/sys/dev/wscons/wsdisplay_vcons.c:1.63
--- src/sys/dev/wscons/wsdisplay_vcons.c:1.62	Sun Jul 17 11:43:39 2022
+++ src/sys/dev/wscons/wsdisplay_vcons.c	Sun Jul 17 20:23:17 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: wsdisplay_vcons.c,v 1.62 2022/07/17 11:43:39 riastradh Exp $ */
+/*	$NetBSD: wsdisplay_vcons.c,v 1.63 2022/07/17 20:23:17 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2005, 2006 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.62 2022/07/17 11:43:39 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.63 2022/07/17 20:23:17 riastradh Exp $");
 
 #include 
 #include 
@@ -43,6 +43,7 @@ __KERNEL_RCSID(0, "$NetBSD: wsdisplay_vc
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -63,6 +64,40 @@ __KERNEL_RCSID(0, "$NetBSD: wsdisplay_vc
 #define DPRINTF if (0) printf
 #endif
 
+struct vcons_data_private {
+	/* accessops */
+	int (*ioctl)(void *, void *, u_long, void *, int, struct lwp *);
+
+	/* rasops */
+	void (*copycols)(void *, int, int, int, int);
+	void (*erasecols)(void *, int, int, int, long);
+	void (*copyrows)(void *, int, int, int);
+	void (*eraserows)(void *, int, int, long);
+	void (*cursor)(void *, int, int, int);
+
+	/* virtual screen management stuff */
+	void (*switch_cb)(void *, int, int);
+	void *switch_cb_arg;
+	struct callout switch_callout;
+	uint32_t switch_pending;
+	LIST_HEAD(, vcons_screen) screens;
+	struct vcons_screen *wanted;
+	const struct wsscreen_descr *currenttype;
+	struct wsscreen_descr *defaulttype;
+	int switch_poll_count;
+
+#ifdef VCONS_DRAW_INTR
+	int cells;
+	long *attrs;
+	uint32_t *chars;
+	int cursor_offset;
+	callout_t intr;
+	int intr_valid;
+	void *intr_softint;
+	int use_intr;		/* use intr drawing when non-zero */
+#endif
+};
+
 static void vcons_dummy_init_screen(void *, struct vcons_screen *, int,
 	long *);
 
@@ -123,13 +158,14 @@ static void vcons_unlock(struct vcons_sc
 static void vcons_intr(void *);
 static void vcons_softintr(void *);
 static void vcons_init_thread(void *);
+static void vcons_invalidate_cache(struct vcons_data *);
 #endif
 
 static inline bool
 vcons_use_intr(const struct vcons_screen *scr)
 {
 #ifdef VCONS_DRAW_INTR
-	return scr->scr_vd->use_intr;
+	return scr->scr_vd->private->use_intr;
 #else
 	return false;
 #endif
@@ -149,10 +185,12 @@ vcons_init_common(struct vcons_data *vd,
 struct wsscreen_descr *def, struct wsdisplay_accessops *ao,
 int enable_intr)
 {
+	struct vcons_data_private *vdp;
 
 	/* zero out everything so we can rely on untouched fields 

CVS commit: src/sys

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 20:23:17 UTC 2022

Modified Files:
src/sys/arch/arm/fdt: arm_simplefb.c
src/sys/dev/wscons: wsdisplay_vcons.c wsdisplay_vconsvar.h

Log Message:
wsdisplay(4): Make most of struct vcons_data private.

More importantly, make sizeof(struct vcons_data) independent of
whether VCONS_DRAW_INTR  is defined.

Allocate the private space with kmem rather than in the caller.

This still doesn't have very good separation between interface
parameters and internal state, but it's better than before, and is
necessary to make genfb usable in modules.

In arm_simplefb.c, this removes use of the use_intr member.  That
assignment became redundant with the introduction of vcons_earlyinit,
so there's no need to replace it by anything.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/fdt/arm_simplefb.c
cvs rdiff -u -r1.62 -r1.63 src/sys/dev/wscons/wsdisplay_vcons.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/wscons/wsdisplay_vconsvar.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/common/include/asm

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 18:45:48 UTC 2022

Modified Files:
src/sys/external/bsd/common/include/asm: barrier.h

Log Message:
drm: Comment *mb() vs smp_*mb() and omit default for *mb().

In general membar_*() is _not_ enough for *mb(), because membar_*()
is only for CPU/CPU synchronization on normal memory, and *mb()
requires machine-dependent I/O logic.  Leave it as an `#error' case
if the architecture isn't listed here.  But membar_*() is OK for
smp_*().

Fill in powerpc and sparc while here, as examples of what the
now-removed defaults failed to do.  If you want to use drm on a mips
or alpha system yer gonna hafta fill this in yourself.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/external/bsd/common/include/asm/barrier.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/asm/barrier.h
diff -u src/sys/external/bsd/common/include/asm/barrier.h:1.13 src/sys/external/bsd/common/include/asm/barrier.h:1.14
--- src/sys/external/bsd/common/include/asm/barrier.h:1.13	Sat Apr  9 23:43:30 2022
+++ src/sys/external/bsd/common/include/asm/barrier.h	Sun Jul 17 18:45:48 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: barrier.h,v 1.13 2022/04/09 23:43:30 riastradh Exp $	*/
+/*	$NetBSD: barrier.h,v 1.14 2022/07/17 18:45:48 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -42,6 +42,14 @@
 #define	MULTIPROCESSOR	1	/* safer to assume multiprocessor */
 #endif
 
+/*
+ * I/O memory barriers.  drm uses these to order memory operations on
+ * normal or write-combining/prefetchable, or uncacheable I/O
+ * operations, for coordination between the CPU and I/O devices.
+ *
+ * In NetBSD, this is normally done with bus_space_barrier, but Linux
+ * doesn't pass around the bus space tag and handle needed for that.
+ */
 #if defined(__aarch64__)
 #define	mb()	__asm __volatile ("dsb sy" ::: "memory")
 #define	wmb()	__asm __volatile ("dsb st" ::: "memory")
@@ -51,12 +59,27 @@
 #define	mb()	x86_mfence()
 #define	wmb()	x86_sfence()
 #define	rmb()	x86_lfence()
+#elif defined(__powerpc__)
+#define	mb()	__asm __volatile ("eieio" ::: "memory")
+#define	wmb()	mb()
+#define	rmb()	mb()
+#elif defined(__sparc__) || defined(__sparc64__)
+#ifdef __sparc64__
+#define	mb()	__asm __volatile ("membar #MemIssue" ::: "memory")
 #else
-#define	mb	membar_sync
-#define	wmb	membar_producer
-#define	rmb	membar_consumer
+#define	mb()	membar_sync()	/* ldstub */
+#endif
+#define	wmb()	mb()		/* XXX could maybe be __insn_barrier in TSO */
+#define	rmb()	mb()		/* XXX could maybe be __insn_barrier in TSO */
+#else
+#error Define machine-dependent memory-mapped I/O barriers for drm.
 #endif
 
+/*
+ * MP memory barriers.  drm uses these to order memory operations on
+ * normal memory for coordination between CPUs.  Aliases for NetBSD's
+ * membar_*.
+ */
 #ifdef MULTIPROCESSOR
 #  define	smp_mbmembar_sync
 #  define	smp_wmbmembar_producer



CVS commit: src/sys/external/bsd/common/include/asm

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 18:45:48 UTC 2022

Modified Files:
src/sys/external/bsd/common/include/asm: barrier.h

Log Message:
drm: Comment *mb() vs smp_*mb() and omit default for *mb().

In general membar_*() is _not_ enough for *mb(), because membar_*()
is only for CPU/CPU synchronization on normal memory, and *mb()
requires machine-dependent I/O logic.  Leave it as an `#error' case
if the architecture isn't listed here.  But membar_*() is OK for
smp_*().

Fill in powerpc and sparc while here, as examples of what the
now-removed defaults failed to do.  If you want to use drm on a mips
or alpha system yer gonna hafta fill this in yourself.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/external/bsd/common/include/asm/barrier.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/include/linux

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 17:04:02 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/include/linux: ww_mutex.h

Log Message:
linux/ww_mutex: Make wwm_debug member unconditional.

This way LOCKDEBUG doesn't change any structure sizes.  Shuffle
members around to make better use of padding, on both LP32 and LP64.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/external/bsd/drm2/include/linux/ww_mutex.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/include/linux/ww_mutex.h
diff -u src/sys/external/bsd/drm2/include/linux/ww_mutex.h:1.14 src/sys/external/bsd/drm2/include/linux/ww_mutex.h:1.15
--- src/sys/external/bsd/drm2/include/linux/ww_mutex.h:1.14	Sun Dec 19 10:38:14 2021
+++ src/sys/external/bsd/drm2/include/linux/ww_mutex.h	Sun Jul 17 17:04:02 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ww_mutex.h,v 1.14 2021/12/19 10:38:14 riastradh Exp $	*/
+/*	$NetBSD: ww_mutex.h,v 1.15 2022/07/17 17:04:02 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -58,13 +58,16 @@ struct ww_acquire_ctx {
 	struct rb_node	wwx_rb_node;
 };
 
+enum ww_mutex_state {
+	WW_UNLOCKED,	/* nobody owns it */
+	WW_OWNED,	/* owned by a lwp without a context */
+	WW_CTX,		/* owned by a context */
+	WW_WANTOWN,	/* owned by ctx, waiters w/o ctx waiting */
+};
+
 struct ww_mutex {
-	enum ww_mutex_state {
-		WW_UNLOCKED,	/* nobody owns it */
-		WW_OWNED,	/* owned by a lwp without a context */
-		WW_CTX,		/* owned by a context */
-		WW_WANTOWN,	/* owned by ctx, waiters w/o ctx waiting */
-	}			wwm_state;
+	uint8_t			wwm_state;
+	bool			wwm_debug;
 	union {
 		struct lwp		*owner;
 		struct ww_acquire_ctx	*ctx;
@@ -77,9 +80,6 @@ struct ww_mutex {
 	struct ww_class		*wwm_class;
 	struct rb_tree		wwm_waiters;
 	kcondvar_t		wwm_cv;
-#ifdef LOCKDEBUG
-	bool			wwm_debug;
-#endif
 };
 
 /* XXX Make the nm output a little more greppable...  */



CVS commit: src/sys/external/bsd/drm2/include/linux

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 17:04:02 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/include/linux: ww_mutex.h

Log Message:
linux/ww_mutex: Make wwm_debug member unconditional.

This way LOCKDEBUG doesn't change any structure sizes.  Shuffle
members around to make better use of padding, on both LP32 and LP64.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/external/bsd/drm2/include/linux/ww_mutex.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/vmwgfx

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 15:37:10 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/vmwgfx: vmwgfx_module.c

Log Message:
vmwgfx: Depend on drmkms_ttm module.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/external/bsd/drm2/vmwgfx/vmwgfx_module.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/vmwgfx/vmwgfx_module.c
diff -u src/sys/external/bsd/drm2/vmwgfx/vmwgfx_module.c:1.1 src/sys/external/bsd/drm2/vmwgfx/vmwgfx_module.c:1.2
--- src/sys/external/bsd/drm2/vmwgfx/vmwgfx_module.c:1.1	Thu Feb 17 01:21:03 2022
+++ src/sys/external/bsd/drm2/vmwgfx/vmwgfx_module.c	Sun Jul 17 15:37:10 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmwgfx_module.c,v 1.1 2022/02/17 01:21:03 riastradh Exp $	*/
+/*	$NetBSD: vmwgfx_module.c,v 1.2 2022/07/17 15:37:10 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2022 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vmwgfx_module.c,v 1.1 2022/02/17 01:21:03 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vmwgfx_module.c,v 1.2 2022/07/17 15:37:10 riastradh Exp $");
 
 #include 
 #include 
@@ -42,7 +42,7 @@ __KERNEL_RCSID(0, "$NetBSD: vmwgfx_modul
 
 #include "vmwgfx_drv.h"
 
-MODULE(MODULE_CLASS_DRIVER, vmwgfx, "drmkms,drmkms_pci"); /* XXX drmkms_i2c, drmkms_ttm */
+MODULE(MODULE_CLASS_DRIVER, vmwgfx, "drmkms,drmkms_pci,drmkms_ttm"); /* XXX drmkms_i2c */
 
 #ifdef _MODULE
 #include "ioconf.c"



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

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 15:37:10 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/vmwgfx: vmwgfx_module.c

Log Message:
vmwgfx: Depend on drmkms_ttm module.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/external/bsd/drm2/vmwgfx/vmwgfx_module.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/radeon

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 15:37:00 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/radeon: radeon_module.c

Log Message:
radeon: Depend on drmkms_ttm module.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/drm2/radeon/radeon_module.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/radeon/radeon_module.c
diff -u src/sys/external/bsd/drm2/radeon/radeon_module.c:1.7 src/sys/external/bsd/drm2/radeon/radeon_module.c:1.8
--- src/sys/external/bsd/drm2/radeon/radeon_module.c:1.7	Sun Dec 19 10:33:00 2021
+++ src/sys/external/bsd/drm2/radeon/radeon_module.c	Sun Jul 17 15:36:59 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: radeon_module.c,v 1.7 2021/12/19 10:33:00 riastradh Exp $	*/
+/*	$NetBSD: radeon_module.c,v 1.8 2022/07/17 15:36:59 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: radeon_module.c,v 1.7 2021/12/19 10:33:00 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeon_module.c,v 1.8 2022/07/17 15:36:59 riastradh Exp $");
 
 #include 
 #include 
@@ -45,7 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: radeon_modul
 
 #include "radeon_drv.h"
 
-MODULE(MODULE_CLASS_DRIVER, radeon, "drmkms,drmkms_pci"); /* XXX drmkms_i2c, drmkms_ttm */
+MODULE(MODULE_CLASS_DRIVER, radeon, "drmkms,drmkms_pci,drmkms_ttm"); /* XXX drmkms_i2c */
 
 #ifdef _MODULE
 #include "ioconf.c"



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

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 15:37:00 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/radeon: radeon_module.c

Log Message:
radeon: Depend on drmkms_ttm module.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/drm2/radeon/radeon_module.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/nouveau

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 15:36:51 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/nouveau: nouveau_module.c

Log Message:
nouveau: Depend on drmkms_ttm module.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/drm2/nouveau/nouveau_module.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/nouveau/nouveau_module.c
diff -u src/sys/external/bsd/drm2/nouveau/nouveau_module.c:1.10 src/sys/external/bsd/drm2/nouveau/nouveau_module.c:1.11
--- src/sys/external/bsd/drm2/nouveau/nouveau_module.c:1.10	Sun Dec 19 10:32:59 2021
+++ src/sys/external/bsd/drm2/nouveau/nouveau_module.c	Sun Jul 17 15:36:51 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_module.c,v 1.10 2021/12/19 10:32:59 riastradh Exp $	*/
+/*	$NetBSD: nouveau_module.c,v 1.11 2022/07/17 15:36:51 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nouveau_module.c,v 1.10 2021/12/19 10:32:59 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_module.c,v 1.11 2022/07/17 15:36:51 riastradh Exp $");
 
 #include 
 #include 
@@ -40,7 +40,7 @@ __KERNEL_RCSID(0, "$NetBSD: nouveau_modu
 
 #include 
 
-MODULE(MODULE_CLASS_DRIVER, nouveau, "drmkms"); /* XXX drmkms_i2c, drmkms_ttm */
+MODULE(MODULE_CLASS_DRIVER, nouveau, "drmkms,drmkms_ttm"); /* XXX drmkms_i2c */
 
 #ifdef _MODULE
 #include "ioconf.c"



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

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 15:36:51 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/nouveau: nouveau_module.c

Log Message:
nouveau: Depend on drmkms_ttm module.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/drm2/nouveau/nouveau_module.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/amdgpu

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 15:36:15 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/amdgpu: amdgpu_module.c

Log Message:
amdgpu: Depend on drmkms_ttm module.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/external/bsd/drm2/amdgpu/amdgpu_module.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/amdgpu/amdgpu_module.c
diff -u src/sys/external/bsd/drm2/amdgpu/amdgpu_module.c:1.9 src/sys/external/bsd/drm2/amdgpu/amdgpu_module.c:1.10
--- src/sys/external/bsd/drm2/amdgpu/amdgpu_module.c:1.9	Sun Dec 19 12:30:40 2021
+++ src/sys/external/bsd/drm2/amdgpu/amdgpu_module.c	Sun Jul 17 15:36:15 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: amdgpu_module.c,v 1.9 2021/12/19 12:30:40 riastradh Exp $	*/
+/*	$NetBSD: amdgpu_module.c,v 1.10 2022/07/17 15:36:15 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_module.c,v 1.9 2021/12/19 12:30:40 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_module.c,v 1.10 2022/07/17 15:36:15 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"); /* XXX drmkms_i2c, drmkms_ttm */
+MODULE(MODULE_CLASS_DRIVER, amdgpu, "drmkms,drmkms_pci,drmkms_ttm"); /* XXX drmkms_i2c */
 
 #ifdef _MODULE
 #include "ioconf.c"



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

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 15:36:15 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/amdgpu: amdgpu_module.c

Log Message:
amdgpu: Depend on drmkms_ttm module.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/external/bsd/drm2/amdgpu/amdgpu_module.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-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 15:36:05 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/ttm: files.ttm
src/sys/modules: Makefile
Added Files:
src/sys/external/bsd/drm2/ttm: ttm_module.c
src/sys/modules/drmkms_ttm: Makefile

Log Message:
drm: Modularize ttm.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/drm2/ttm/files.ttm
cvs rdiff -u -r0 -r1.1 src/sys/external/bsd/drm2/ttm/ttm_module.c
cvs rdiff -u -r1.266 -r1.267 src/sys/modules/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/modules/drmkms_ttm/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/ttm/files.ttm
diff -u src/sys/external/bsd/drm2/ttm/files.ttm:1.7 src/sys/external/bsd/drm2/ttm/files.ttm:1.8
--- src/sys/external/bsd/drm2/ttm/files.ttm:1.7	Sun Dec 19 10:55:38 2021
+++ src/sys/external/bsd/drm2/ttm/files.ttm	Sun Jul 17 15:36:05 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: files.ttm,v 1.7 2021/12/19 10:55:38 riastradh Exp $
+#	$NetBSD: files.ttm,v 1.8 2022/07/17 15:36:05 riastradh Exp $
 
 # TTM, the texture and tiling manager.
 
@@ -17,8 +17,7 @@ file	external/bsd/drm2/dist/drm/ttm/ttm_
 file	external/bsd/drm2/dist/drm/ttm/ttm_bo.c			drmkms_ttm
 file	external/bsd/drm2/dist/drm/ttm/ttm_bo_util.c		drmkms_ttm
 file	external/bsd/drm2/ttm/ttm_bo_vm.c			drmkms_ttm
-# Linux module goo.
-#file	external/bsd/drm2/dist/drm/ttm/ttm_module.c		drmkms_ttm
+file	external/bsd/drm2/ttm/ttm_module.c			drmkms_ttm
 # Used only by vmwgfx.  Needs porting for rcu -> pserialize.
 #file	external/bsd/drm2/dist/drm/ttm/ttm_object.c		drmkms_ttm
 # Used only by vmwgfx.  Needs porting.  Does silly things like SIGKILL.

Index: src/sys/modules/Makefile
diff -u src/sys/modules/Makefile:1.266 src/sys/modules/Makefile:1.267
--- src/sys/modules/Makefile:1.266	Sat Jun  4 03:31:10 2022
+++ src/sys/modules/Makefile	Sun Jul 17 15:36:05 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.266 2022/06/04 03:31:10 pgoyette Exp $
+#	$NetBSD: Makefile,v 1.267 2022/07/17 15:36:05 riastradh Exp $
 
 .include 
 
@@ -354,6 +354,7 @@ SUBDIR+=	drm
 #SUBDIR+=	drmkms_agp
 #SUBDIR+=	drmkms_linux
 #SUBDIR+=	drmkms_pci
+#SUBDIR+=	drmkms_ttm
 SUBDIR+=	i915drm
 #SUBDIR+=	i915drmkms
 #

Added files:

Index: src/sys/external/bsd/drm2/ttm/ttm_module.c
diff -u /dev/null src/sys/external/bsd/drm2/ttm/ttm_module.c:1.1
--- /dev/null	Sun Jul 17 15:36:05 2022
+++ src/sys/external/bsd/drm2/ttm/ttm_module.c	Sun Jul 17 15:36:05 2022
@@ -0,0 +1,51 @@
+/*	$NetBSD: ttm_module.c,v 1.1 2022/07/17 15:36:05 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 reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: ttm_module.c,v 1.1 2022/07/17 15:36:05 riastradh Exp $");
+
+#include 
+#include 
+
+MODULE(MODULE_CLASS_DRIVER, drmkms_ttm, "drmkms");
+
+static int
+drmkms_ttm_modcmd(modcmd_t cmd, void *arg)
+{
+
+	switch (cmd) {
+	case MODULE_CMD_INIT:
+		return 0;
+	case MODULE_CMD_AUTOUNLOAD:
+		return EBUSY;
+	case MODULE_CMD_FINI:
+		return 0;
+	default:
+		return ENOTTY;
+	}
+}

Index: src/sys/modules/drmkms_ttm/Makefile
diff -u /dev/null src/sys/modules/drmkms_ttm/Makefile:1.1
--- /dev/null	Sun Jul 17 15:36:05 2022
+++ src/sys/modules/drmkms_ttm/Makefile	Sun Jul 17 15:36:05 2022
@@ -0,0 +1,35 @@
+# $NetBSD: Makefile,v 1.1 2022/07/17 15:36:05 riastradh Exp $
+
+.include "../Makefile.inc"
+.include "../drmkms/Makefile.inc"
+
+KMOD=	drmkms_ttm
+
+.PATH:	${S}/external/bsd/drm2/ttm
+.PATH:	${S}/external/bsd/drm2/dist/drm/ttm
+
+CPPFLAGS+=	-DCONFIG_AGP=1
+
+WARNS=	3
+

CVS commit: src/sys

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 15:36:05 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/ttm: files.ttm
src/sys/modules: Makefile
Added Files:
src/sys/external/bsd/drm2/ttm: ttm_module.c
src/sys/modules/drmkms_ttm: Makefile

Log Message:
drm: Modularize ttm.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/drm2/ttm/files.ttm
cvs rdiff -u -r0 -r1.1 src/sys/external/bsd/drm2/ttm/ttm_module.c
cvs rdiff -u -r1.266 -r1.267 src/sys/modules/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/modules/drmkms_ttm/Makefile

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

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 15:35:42 UTC 2022

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

Log Message:
drm: Include GPU scheduler in drmkms.kmod.

Could be split into a separate module, but whatever.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/modules/drmkms/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/Makefile
diff -u src/sys/modules/drmkms/Makefile:1.17 src/sys/modules/drmkms/Makefile:1.18
--- src/sys/modules/drmkms/Makefile:1.17	Sun Jul 17 15:05:09 2022
+++ src/sys/modules/drmkms/Makefile	Sun Jul 17 15:35:42 2022
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.17 2022/07/17 15:05:09 riastradh Exp $
+# $NetBSD: Makefile,v 1.18 2022/07/17 15:35:42 riastradh Exp $
 
 .include "../Makefile.inc"
 .include "Makefile.inc"
@@ -11,6 +11,7 @@ MKLDSCRIPT=yes
 .PATH:	${S}/external/bsd/drm2/pci
 
 .PATH:	${S}/external/bsd/drm2/dist/drm
+.PATH:	${S}/external/bsd/drm2/dist/drm/scheduler
 
 # NetBSD additions.
 SRCS+=	drm_agp_hook.c
@@ -51,6 +52,11 @@ SRCS+=	drm_legacy_misc.c
 SRCS+=	drm_lock.c
 SRCS+=	drm_scatter.c
 
+# GPU scheduler
+SRCS+=	sched_entity.c
+SRCS+=	sched_fence.c
+SRCS+=	sched_main.c
+
 # Upstream source files.
 #SRCS+=	drm_agpsupport.c
 SRCS+=	drm_atomic.c



CVS commit: src/sys/modules/drmkms

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 15:35:42 UTC 2022

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

Log Message:
drm: Include GPU scheduler in drmkms.kmod.

Could be split into a separate module, but whatever.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/modules/drmkms/Makefile

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

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 15:05:09 UTC 2022

Modified Files:
src/sys/modules/drmkms: Makefile Makefile.inc

Log Message:
drm: Sync module/drmkms/Makefile with files.drmkms.

Unconditionally include legacy APIs for viadrmums.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/modules/drmkms/Makefile
cvs rdiff -u -r1.7 -r1.8 src/sys/modules/drmkms/Makefile.inc

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/Makefile
diff -u src/sys/modules/drmkms/Makefile:1.16 src/sys/modules/drmkms/Makefile:1.17
--- src/sys/modules/drmkms/Makefile:1.16	Sun Jul 17 14:11:40 2022
+++ src/sys/modules/drmkms/Makefile	Sun Jul 17 15:05:09 2022
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.16 2022/07/17 14:11:40 riastradh Exp $
+# $NetBSD: Makefile,v 1.17 2022/07/17 15:05:09 riastradh Exp $
 
 .include "../Makefile.inc"
 .include "Makefile.inc"
@@ -16,10 +16,10 @@ MKLDSCRIPT=yes
 SRCS+=	drm_agp_hook.c
 SRCS+=	drm_cdevsw.c
 SRCS+=	drm_gem_vm.c
-SRCS+=	drm_hdcp.c
 SRCS+=	drm_module.c
 SRCS+=	drm_sysctl.c
 
+# pci bus ids -- doesn't depend on all of pci, just the header files
 SRCS+=	drm_pci_busid.c
 
 # Generic, unaccelerated kms framebuffer.
@@ -27,9 +27,6 @@ SRCS+=	drmfb.c
 
 # XXX ttm
 
-# Code imported from Linux - expects signed overflow to be OK.
-COPTS+=	-fwrapv
-
 CPPFLAGS+=	-I.
 
 # XXX CWARNFLAGS.foo.c doesn't work.
@@ -46,8 +43,16 @@ COPTS.drm_ioctl.c+=		-Wno-shadow
 COPTS.drm_mm.c+=		${${ACTIVE_CC} == clang :? -Wno-unused-function :}
 COPTS.drm_modes.c+=		-Wno-shadow
 
+# Legacy user-mode setting
+SRCS+=	drm_bufs.c
+SRCS+=	drm_context.c
+SRCS+=	drm_dma.c
+SRCS+=	drm_legacy_misc.c
+SRCS+=	drm_lock.c
+SRCS+=	drm_scatter.c
+
 # Upstream source files.
-#SRCS+=	drm_agpsupport.c	# Moved to drmkms_pci module.
+#SRCS+=	drm_agpsupport.c
 SRCS+=	drm_atomic.c
 SRCS+=	drm_atomic_helper.c
 SRCS+=	drm_atomic_state_helper.c
@@ -73,6 +78,7 @@ SRCS+=	drm_edid.c
 SRCS+=	drm_encoder.c
 SRCS+=	drm_encoder_slave.c
 SRCS+=	drm_fb_helper.c
+SRCS+=	drm_file.c
 SRCS+=	drm_flip_work.c
 #SRCS+=	drm_format_helper.c
 SRCS+=	drm_fourcc.c
@@ -81,10 +87,9 @@ SRCS+=	drm_gem.c
 SRCS+=	drm_gem_cma_helper.c
 SRCS+=	drm_gem_framebuffer_helper.c
 SRCS+=	drm_hashtab.c
-#SRCS+=	drm_hdcp.c		# Local override.
+SRCS+=	drm_hdcp.c
 SRCS+=	drm_ioctl.c
 SRCS+=	drm_irq.c
-SRCS+=	drm_lock.c
 #SRCS+=	drm_kms_helper_common.c
 SRCS+=	drm_lease.c
 SRCS+=	drm_memory.c
@@ -96,7 +101,7 @@ SRCS+=	drm_modeset_helper.c
 SRCS+=	drm_modeset_lock.c
 SRCS+=	drm_panel.c
 SRCS+=	drm_panel_orientation_quirks.c
-#SRCS+=	drm_pci.c		# Moved to drmkms_pci module.
+#SRCS+=	drm_pci.c
 SRCS+=	drm_plane.c
 SRCS+=	drm_plane_helper.c
 SRCS+=	drm_prime.c

Index: src/sys/modules/drmkms/Makefile.inc
diff -u src/sys/modules/drmkms/Makefile.inc:1.7 src/sys/modules/drmkms/Makefile.inc:1.8
--- src/sys/modules/drmkms/Makefile.inc:1.7	Sun Jul 17 14:11:40 2022
+++ src/sys/modules/drmkms/Makefile.inc	Sun Jul 17 15:05:09 2022
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.7 2022/07/17 14:11:40 riastradh Exp $
+# $NetBSD: Makefile.inc,v 1.8 2022/07/17 15:05:09 riastradh Exp $
 
 # Common makefile cruft for drm2 code.
 
@@ -43,5 +43,8 @@ CPPFLAGS+=	-DCONFIG_PCI=1
 
 CWARNFLAGS+=	-Wno-missing-field-initializers
 
+# Needed for drmums modules.
+CPPFLAGS+=	-DCONFIG_DRM_LEGACY
+
 # XXX Is this the right place to set this?
 CPPFLAGS+=	-DDIAGNOSTIC



CVS commit: src/sys/modules/drmkms

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 15:05:09 UTC 2022

Modified Files:
src/sys/modules/drmkms: Makefile Makefile.inc

Log Message:
drm: Sync module/drmkms/Makefile with files.drmkms.

Unconditionally include legacy APIs for viadrmums.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/modules/drmkms/Makefile
cvs rdiff -u -r1.7 -r1.8 src/sys/modules/drmkms/Makefile.inc

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-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 14:11:40 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/drm: drm_module.c
src/sys/modules/drmkms: Makefile Makefile.inc
src/sys/modules/drmkms_linux: Makefile
src/sys/modules/i915drmkms: Makefile

Log Message:
drm: Dust off module build a little.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/external/bsd/drm2/drm/drm_module.c
cvs rdiff -u -r1.15 -r1.16 src/sys/modules/drmkms/Makefile
cvs rdiff -u -r1.6 -r1.7 src/sys/modules/drmkms/Makefile.inc
cvs rdiff -u -r1.14 -r1.15 src/sys/modules/drmkms_linux/Makefile
cvs rdiff -u -r1.19 -r1.20 src/sys/modules/i915drmkms/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/drm/drm_module.c
diff -u src/sys/external/bsd/drm2/drm/drm_module.c:1.29 src/sys/external/bsd/drm2/drm/drm_module.c:1.30
--- src/sys/external/bsd/drm2/drm/drm_module.c:1.29	Fri Dec 31 17:22:45 2021
+++ src/sys/external/bsd/drm2/drm/drm_module.c	Sun Jul 17 14:11:40 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_module.c,v 1.29 2021/12/31 17:22:45 riastradh Exp $	*/
+/*	$NetBSD: drm_module.c,v 1.30 2022/07/17 14:11:40 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drm_module.c,v 1.29 2021/12/31 17:22:45 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_module.c,v 1.30 2022/07/17 14:11:40 riastradh Exp $");
 
 #include 
 #include 
@@ -206,9 +206,7 @@ drmkms_modcmd(modcmd_t cmd, void *arg __
 
 	case MODULE_CMD_FINI:
 #ifdef _MODULE
-		error = devsw_detach(NULL, _cdevsw);
-		if (error)
-			return error;
+		devsw_detach(NULL, _cdevsw);
 #endif
 		drm_fini();
 		return 0;

Index: src/sys/modules/drmkms/Makefile
diff -u src/sys/modules/drmkms/Makefile:1.15 src/sys/modules/drmkms/Makefile:1.16
--- src/sys/modules/drmkms/Makefile:1.15	Sun Dec 19 11:54:24 2021
+++ src/sys/modules/drmkms/Makefile	Sun Jul 17 14:11:40 2022
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.15 2021/12/19 11:54:24 riastradh Exp $
+# $NetBSD: Makefile,v 1.16 2022/07/17 14:11:40 riastradh Exp $
 
 .include "../Makefile.inc"
 .include "Makefile.inc"
@@ -41,9 +41,9 @@ COPTS.drm_crtc.c+=		-Wno-shadow
 COPTS.drm_client_modeset.c+=	-Wno-shadow
 COPTS.drm_dp_helper.c+=		-Wno-pointer-arith
 COPTS.drm_fb_helper.c+=		-Wno-shadow
-COPTS.drm_edid.c+=		-Wno-error=attributes
 COPTS.drm_edid.c+=		-Wno-shadow
 COPTS.drm_ioctl.c+=		-Wno-shadow
+COPTS.drm_mm.c+=		${${ACTIVE_CC} == clang :? -Wno-unused-function :}
 COPTS.drm_modes.c+=		-Wno-shadow
 
 # Upstream source files.

Index: src/sys/modules/drmkms/Makefile.inc
diff -u src/sys/modules/drmkms/Makefile.inc:1.6 src/sys/modules/drmkms/Makefile.inc:1.7
--- src/sys/modules/drmkms/Makefile.inc:1.6	Sun Dec 19 11:54:24 2021
+++ src/sys/modules/drmkms/Makefile.inc	Sun Jul 17 14:11:40 2022
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.6 2021/12/19 11:54:24 riastradh Exp $
+# $NetBSD: Makefile.inc,v 1.7 2022/07/17 14:11:40 riastradh Exp $
 
 # Common makefile cruft for drm2 code.
 
@@ -30,13 +30,13 @@ CPPFLAGS+=	-DCONFIG_X86_PAT
 .elif ${MACHINE} == "evbarm"
 CPPFLAGS+=	-DCONFIG_ARM
 .elif ${MACHINE_ARCH} == "aarch64"
-CPPFLAGS+=	-DCONFIG_AARCH64
+CPPFLAGS+=	-DCONFIG_ARM64
 .endif
 
 CPPFLAGS+=	-DCONFIG_BACKLIGHT_CLASS_DEVICE=0
 CPPFLAGS+=	-DCONFIG_BACKLIGHT_CLASS_DEVICE_MODULE=0
-CPPFLAGS+=	-DCONFIG_DRM_FBDEV_EMULATION=0
-CPPFLAGS+=	-DCONFIG_DRM_FBDEV_OVERALLOC=1000
+CPPFLAGS+=	-DCONFIG_DRM_FBDEV_EMULATION=1
+CPPFLAGS+=	-DCONFIG_DRM_FBDEV_OVERALLOC=100
 CPPFLAGS+=	-DCONFIG_FB=0
 CPPFLAGS+=	-DCONFIG_LOCKDEP=0
 CPPFLAGS+=	-DCONFIG_PCI=1

Index: src/sys/modules/drmkms_linux/Makefile
diff -u src/sys/modules/drmkms_linux/Makefile:1.14 src/sys/modules/drmkms_linux/Makefile:1.15
--- src/sys/modules/drmkms_linux/Makefile:1.14	Sun Dec 19 11:54:24 2021
+++ src/sys/modules/drmkms_linux/Makefile	Sun Jul 17 14:11:40 2022
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.14 2021/12/19 11:54:24 riastradh Exp $
+# $NetBSD: Makefile,v 1.15 2022/07/17 14:11:40 riastradh Exp $
 
 #
 # At some point this needs to turn into linux.kmod and a proper home for it
@@ -46,7 +46,7 @@ SRCS+=	linux_notifier.c
 SRCS+=	linux_pci.c
 SRCS+=	linux_radixtree.c
 SRCS+=	linux_rwsem.c
-SRCS+=	linux_sg.c
+SRCS+=	linux_sgt.c
 SRCS+=	linux_stop_machine.c
 SRCS+=	linux_sync_file.c
 SRCS+=	linux_wait_bit.c

Index: src/sys/modules/i915drmkms/Makefile
diff -u src/sys/modules/i915drmkms/Makefile:1.19 src/sys/modules/i915drmkms/Makefile:1.20
--- src/sys/modules/i915drmkms/Makefile:1.19	Sun Dec 19 01:03:42 2021
+++ src/sys/modules/i915drmkms/Makefile	Sun Jul 17 14:11:40 2022
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.19 2021/12/19 01:03:42 riastradh Exp $
+# $NetBSD: Makefile,v 1.20 2022/07/17 14:11:40 riastradh Exp $
 
 .include "../Makefile.inc"
 .include "../drmkms/Makefile.inc"
@@ -10,6 +10,10 @@ MKLDSCRIPT=yes
 .PATH:	

CVS commit: src/sys

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 14:11:40 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/drm: drm_module.c
src/sys/modules/drmkms: Makefile Makefile.inc
src/sys/modules/drmkms_linux: Makefile
src/sys/modules/i915drmkms: Makefile

Log Message:
drm: Dust off module build a little.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/external/bsd/drm2/drm/drm_module.c
cvs rdiff -u -r1.15 -r1.16 src/sys/modules/drmkms/Makefile
cvs rdiff -u -r1.6 -r1.7 src/sys/modules/drmkms/Makefile.inc
cvs rdiff -u -r1.14 -r1.15 src/sys/modules/drmkms_linux/Makefile
cvs rdiff -u -r1.19 -r1.20 src/sys/modules/i915drmkms/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

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 14:11:18 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/dist/drm: drm_drv.c
src/sys/external/bsd/drm2/include/linux: device.h

Log Message:
drm: Ifdef out devm_* stuff rather than stub it out.

Stub is not helpful, and this pollutes the symbol namespace.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/external/bsd/drm2/dist/drm/drm_drv.c
cvs rdiff -u -r1.15 -r1.16 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/drm2/dist/drm/drm_drv.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_drv.c:1.22 src/sys/external/bsd/drm2/dist/drm/drm_drv.c:1.23
--- src/sys/external/bsd/drm2/dist/drm/drm_drv.c:1.22	Sun Dec 19 12:32:01 2021
+++ src/sys/external/bsd/drm2/dist/drm/drm_drv.c	Sun Jul 17 14:11:18 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_drv.c,v 1.22 2021/12/19 12:32:01 riastradh Exp $	*/
+/*	$NetBSD: drm_drv.c,v 1.23 2022/07/17 14:11:18 riastradh Exp $	*/
 
 /*
  * Created: Fri Jan 19 10:48:35 2001 by fa...@acm.org
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drm_drv.c,v 1.22 2021/12/19 12:32:01 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_drv.c,v 1.23 2022/07/17 14:11:18 riastradh Exp $");
 
 #include 
 #include 
@@ -767,6 +767,8 @@ err_pswitch:
 }
 EXPORT_SYMBOL(drm_dev_init);
 
+#ifndef __NetBSD__
+
 static void devm_drm_dev_init_release(void *data)
 {
 	drm_dev_put(data);
@@ -806,6 +808,8 @@ int devm_drm_dev_init(struct device *par
 }
 EXPORT_SYMBOL(devm_drm_dev_init);
 
+#endif
+
 /**
  * drm_dev_fini - Finalize a dead DRM device
  * @dev: DRM device

Index: src/sys/external/bsd/drm2/include/linux/device.h
diff -u src/sys/external/bsd/drm2/include/linux/device.h:1.15 src/sys/external/bsd/drm2/include/linux/device.h:1.16
--- src/sys/external/bsd/drm2/include/linux/device.h:1.15	Sun Dec 19 12:29:09 2021
+++ src/sys/external/bsd/drm2/include/linux/device.h	Sun Jul 17 14:11:18 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: device.h,v 1.15 2021/12/19 12:29:09 riastradh Exp $	*/
+/*	$NetBSD: device.h,v 1.16 2022/07/17 14:11:18 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -96,11 +96,4 @@ dev_pm_set_driver_flags(struct device *d
 {
 }
 
-static inline int
-devm_add_action(struct device *parent, void (*func)(void *),
-void *data)
-{
-	panic("TODO");
-}
-
 #endif  /* _LINUX_DEVICE_H_ */



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

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 14:11:18 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/dist/drm: drm_drv.c
src/sys/external/bsd/drm2/include/linux: device.h

Log Message:
drm: Ifdef out devm_* stuff rather than stub it out.

Stub is not helpful, and this pollutes the symbol namespace.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/external/bsd/drm2/dist/drm/drm_drv.c
cvs rdiff -u -r1.15 -r1.16 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-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 14:11:07 UTC 2022

Modified Files:
src/sys/external/bsd/common/include/linux: tasklet.h
src/sys/external/bsd/drm2/include/linux: sync_file.h

Log Message:
linux: Add missing symbol namespacing for tasklet, sync_file.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/common/include/linux/tasklet.h
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/include/linux/sync_file.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/tasklet.h
diff -u src/sys/external/bsd/common/include/linux/tasklet.h:1.6 src/sys/external/bsd/common/include/linux/tasklet.h:1.7
--- src/sys/external/bsd/common/include/linux/tasklet.h:1.6	Sun Dec 19 11:49:11 2021
+++ src/sys/external/bsd/common/include/linux/tasklet.h	Sun Jul 17 14:11:07 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: tasklet.h,v 1.6 2021/12/19 11:49:11 riastradh Exp $	*/
+/*	$NetBSD: tasklet.h,v 1.7 2022/07/17 14:11:07 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2018, 2020 The NetBSD Foundation, Inc.
@@ -39,6 +39,7 @@
 #define	__tasklet_is_enabled		linux___tasklet_is_enabled
 #define	__tasklet_is_scheduled		linux___tasklet_is_scheduled
 #define	tasklet_disable			linux_tasklet_disable
+#define	tasklet_disable_nosync		linux_tasklet_disable_nosync
 #define	tasklet_enable			linux_tasklet_enable
 #define	tasklet_hi_schedule		linux_tasklet_hi_schedule
 #define	tasklet_init			linux_tasklet_init

Index: src/sys/external/bsd/drm2/include/linux/sync_file.h
diff -u src/sys/external/bsd/drm2/include/linux/sync_file.h:1.4 src/sys/external/bsd/drm2/include/linux/sync_file.h:1.5
--- src/sys/external/bsd/drm2/include/linux/sync_file.h:1.4	Sun Dec 19 10:45:49 2021
+++ src/sys/external/bsd/drm2/include/linux/sync_file.h	Sun Jul 17 14:11:07 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: sync_file.h,v 1.4 2021/12/19 10:45:49 riastradh Exp $	*/
+/*	$NetBSD: sync_file.h,v 1.5 2022/07/17 14:11:07 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -37,6 +37,9 @@
 
 #include 
 
+#define	sync_file_create	linux_sync_file_create
+#define	sync_file_get_fence	linux_sync_file_get_fence
+
 struct dma_fence;
 struct file;
 struct sync_file;



CVS commit: src/sys/external/bsd

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 14:11:07 UTC 2022

Modified Files:
src/sys/external/bsd/common/include/linux: tasklet.h
src/sys/external/bsd/drm2/include/linux: sync_file.h

Log Message:
linux: Add missing symbol namespacing for tasklet, sync_file.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/common/include/linux/tasklet.h
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/include/linux/sync_file.h

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



CVS commit: src/share/mk

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 14:10:55 UTC 2022

Modified Files:
src/share/mk: bsd.kmodule.mk

Log Message:
bsd.kmodule.mk: Also sync no-address-of-packed-member.

This is not actually a good idea to disable -- it can lead to real
problems -- but let's just make it the same for the kernel build and
module builds.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/share/mk/bsd.kmodule.mk

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.78 src/share/mk/bsd.kmodule.mk:1.79
--- src/share/mk/bsd.kmodule.mk:1.78	Sun Jul 17 13:38:06 2022
+++ src/share/mk/bsd.kmodule.mk	Sun Jul 17 14:10:55 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.kmodule.mk,v 1.78 2022/07/17 13:38:06 riastradh Exp $
+#	$NetBSD: bsd.kmodule.mk,v 1.79 2022/07/17 14:10:55 riastradh Exp $
 
 # We are not building this with PIE
 MKPIE=no
@@ -36,6 +36,8 @@ CWARNFLAGS.clang+=	-Wno-error=constant-c
 # XXX until the kernel is fixed again...
 CFLAGS+=	-fno-strict-aliasing
 CWARNFLAGS+=	-Wno-pointer-sign -Wno-attributes
+CWARNFLAGS.gcc+=	${GCC_NO_ADDR_OF_PACKED_MEMBER}
+CWARNFLAGS.clang+=	-Wno-error=address-of-packed-member
 
 # XXX This is a workaround for platforms that have relative relocations
 # that, when relocated by the module loader, result in addresses that



CVS commit: src/share/mk

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 14:10:55 UTC 2022

Modified Files:
src/share/mk: bsd.kmodule.mk

Log Message:
bsd.kmodule.mk: Also sync no-address-of-packed-member.

This is not actually a good idea to disable -- it can lead to real
problems -- but let's just make it the same for the kernel build and
module builds.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/share/mk/bsd.kmodule.mk

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

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 14:10:43 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/i915drm: i915_module.c

Log Message:
i915: Omit needless i915_global_buddy_init declaration.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/external/bsd/drm2/i915drm/i915_module.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/i915drm/i915_module.c
diff -u src/sys/external/bsd/drm2/i915drm/i915_module.c:1.18 src/sys/external/bsd/drm2/i915drm/i915_module.c:1.19
--- src/sys/external/bsd/drm2/i915drm/i915_module.c:1.18	Sun Feb 27 21:22:01 2022
+++ src/sys/external/bsd/drm2/i915drm/i915_module.c	Sun Jul 17 14:10:43 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_module.c,v 1.18 2022/02/27 21:22:01 riastradh Exp $	*/
+/*	$NetBSD: i915_module.c,v 1.19 2022/07/17 14:10:43 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i915_module.c,v 1.18 2022/02/27 21:22:01 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_module.c,v 1.19 2022/07/17 14:10:43 riastradh Exp $");
 
 #include 
 #include 
@@ -58,8 +58,6 @@ struct drm_sysctl_def i915_def = DRM_SYS
 extern spinlock_t i915_sw_fence_lock;
 extern spinlock_t *const i915_schedule_lock;
 
-int i915_global_buddy_init(void); /* XXX */
-
 static int
 i915drmkms_init(void)
 {



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

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 14:10:43 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/i915drm: i915_module.c

Log Message:
i915: Omit needless i915_global_buddy_init declaration.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/external/bsd/drm2/i915drm/i915_module.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/i915drm

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 14:10:32 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/i915drm: files.i915drmkms
Removed Files:
src/sys/external/bsd/drm2/i915drm: i915_perf.c

Log Message:
i915: Remove spurious local i915_perf.c override.


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/sys/external/bsd/drm2/i915drm/files.i915drmkms
cvs rdiff -u -r1.2 -r0 src/sys/external/bsd/drm2/i915drm/i915_perf.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/i915drm/files.i915drmkms
diff -u src/sys/external/bsd/drm2/i915drm/files.i915drmkms:1.86 src/sys/external/bsd/drm2/i915drm/files.i915drmkms:1.87
--- src/sys/external/bsd/drm2/i915drm/files.i915drmkms:1.86	Sun Feb 27 21:22:01 2022
+++ src/sys/external/bsd/drm2/i915drm/files.i915drmkms	Sun Jul 17 14:10:32 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: files.i915drmkms,v 1.86 2022/02/27 21:22:01 riastradh Exp $
+#	$NetBSD: files.i915drmkms,v 1.87 2022/07/17 14:10:32 riastradh Exp $
 
 version	20180827
 
@@ -66,7 +66,6 @@ file	external/bsd/drm2/i915drm/intelfb.c
 # Local overrides
 file	external/bsd/drm2/i915drm/i915_gem_userptr.c	i915drmkms
 file	external/bsd/drm2/i915drm/i915_gemfs.c	i915drmkms
-file	external/bsd/drm2/i915drm/i915_perf.c	i915drmkms
 file	external/bsd/drm2/i915drm/i915_switcheroo.c	i915drmkms
 file	external/bsd/drm2/i915drm/i915_sysfs.c	i915drmkms
 file	external/bsd/drm2/i915drm/i915_trace_points.c	i915drmkms



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

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 14:10:32 UTC 2022

Modified Files:
src/sys/external/bsd/drm2/i915drm: files.i915drmkms
Removed Files:
src/sys/external/bsd/drm2/i915drm: i915_perf.c

Log Message:
i915: Remove spurious local i915_perf.c override.


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/sys/external/bsd/drm2/i915drm/files.i915drmkms
cvs rdiff -u -r1.2 -r0 src/sys/external/bsd/drm2/i915drm/i915_perf.c

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



CVS commit: src/share/mk

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 13:38:06 UTC 2022

Modified Files:
src/share/mk: bsd.kmodule.mk

Log Message:
bsd.kmodule.mk: Use -Wno-attributes like conf/Makefie.kern.inc.


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/share/mk/bsd.kmodule.mk

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.77 src/share/mk/bsd.kmodule.mk:1.78
--- src/share/mk/bsd.kmodule.mk:1.77	Tue Mar 29 22:48:04 2022
+++ src/share/mk/bsd.kmodule.mk	Sun Jul 17 13:38:06 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.kmodule.mk,v 1.77 2022/03/29 22:48:04 christos Exp $
+#	$NetBSD: bsd.kmodule.mk,v 1.78 2022/07/17 13:38:06 riastradh Exp $
 
 # We are not building this with PIE
 MKPIE=no
@@ -34,7 +34,8 @@ CPPFLAGS+=	-D_KERNEL -D_MODULE -DSYSCTL_
 CWARNFLAGS.clang+=	-Wno-error=constant-conversion
 
 # XXX until the kernel is fixed again...
-CFLAGS+=	-fno-strict-aliasing -Wno-pointer-sign
+CFLAGS+=	-fno-strict-aliasing
+CWARNFLAGS+=	-Wno-pointer-sign -Wno-attributes
 
 # XXX This is a workaround for platforms that have relative relocations
 # that, when relocated by the module loader, result in addresses that



CVS commit: src/share/mk

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 13:38:06 UTC 2022

Modified Files:
src/share/mk: bsd.kmodule.mk

Log Message:
bsd.kmodule.mk: Use -Wno-attributes like conf/Makefie.kern.inc.


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/share/mk/bsd.kmodule.mk

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



CVS commit: src/sys/dev/wsfb

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 13:10:54 UTC 2022

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

Log Message:
genfb(4): Make internal parts of struct genfb_softc private.

This way the ABI has no ifdefs, so it has a chance to be usable in
modules.  This also makes genfb much easier to maintain without
worrying about ABI breakage.


To generate a diff of this commit:
cvs rdiff -u -r1.88 -r1.89 src/sys/dev/wsfb/genfb.c
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/wsfb/genfbvar.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/dev/wsfb/genfb.c
diff -u src/sys/dev/wsfb/genfb.c:1.88 src/sys/dev/wsfb/genfb.c:1.89
--- src/sys/dev/wsfb/genfb.c:1.88	Sun Jul 17 13:10:04 2022
+++ src/sys/dev/wsfb/genfb.c	Sun Jul 17 13:10:54 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: genfb.c,v 1.88 2022/07/17 13:10:04 riastradh Exp $ */
+/*	$NetBSD: genfb.c,v 1.89 2022/07/17 13:10:54 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2007 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.88 2022/07/17 13:10:04 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.89 2022/07/17 13:10:54 riastradh Exp $");
 
 #include 
 #include 
@@ -75,6 +75,64 @@ __KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.
 #define GENFB_BRIGHTNESS_STEP 15
 #define	GENFB_CHAR_WIDTH_MM 3
 
+struct genfb_private {
+	struct genfb_ops sc_ops;
+	struct vcons_screen sc_console_screen;
+	struct wsscreen_descr sc_defaultscreen_descr;
+	const struct wsscreen_descr *sc_screens[1];
+	struct wsscreen_list sc_screenlist;
+	struct genfb_colormap_callback *sc_cmcb;
+	struct genfb_parameter_callback *sc_backlight;
+	struct genfb_parameter_callback *sc_brightness;
+	struct genfb_mode_callback *sc_modecb;
+	int sc_backlight_level, sc_backlight_on;
+	void *sc_shadowfb;
+	bool sc_enable_shadowfb;
+	int sc_mode;
+	u_char sc_cmap_red[256];
+	u_char sc_cmap_green[256];
+	u_char sc_cmap_blue[256];
+	bool sc_want_clear;
+#ifdef SPLASHSCREEN
+	struct splash_info sc_splash;
+#endif
+	struct wsdisplay_accessops sc_accessops;
+#if GENFB_GLYPHCACHE > 0
+	/*
+	 * The generic glyphcache code makes a bunch of assumptions that are
+	 * true for most graphics hardware with a directly supported blitter.
+	 * For example it assume that
+	 * - VRAM access from the host is expensive
+	 * - copying data around in VRAM is cheap and can happen in parallel
+	 *   to the host CPU
+	 * -> therefore we draw glyphs normally if we have to, so the ( assumed
+	 *to be hardware assisted ) driver supplied putchar() method doesn't
+	 *need to be glyphcache aware, then copy them away for later use
+	 * for genfb things are a bit different. On most hardware:
+	 * - VRAM access from the host is still expensive
+	 * - copying data around in VRAM is also expensive since we don't have
+	 *   a blitter and VRAM is mapped uncached
+	 * - VRAM reads are usually slower than writes ( write combining and
+	 *   such help writes but not reads, and VRAM might be behind an
+	 *   asymmetric bus like AGP ) and must be avoided, both are much
+	 *   slower than main memory
+	 * -> therefore we cache glyphs in main memory, no reason to map it
+	 *uncached, we draw into the cache first and then copy the glyph
+	 *into video memory to avoid framebuffer reads and to allow more
+	 *efficient write accesses than putchar() would offer
+	 * Because of this we can't use the generic code but we can recycle a
+	 * few data structures.
+	 */
+	uint8_t *sc_cache;
+	struct rasops_info sc_cache_ri;
+	void (*sc_putchar)(void *, int, int, u_int, long);
+	int sc_cache_cells;
+	int sc_nbuckets;	/* buckets allocated */
+	gc_bucket *sc_buckets;	/* we allocate as many as we can get into ram */
+	int sc_attrmap[256];	/* mapping a colour attribute to a bucket */
+#endif
+};
+
 static int	genfb_ioctl(void *, void *, u_long, void *, int, struct lwp *);
 static paddr_t	genfb_mmap(void *, void *, off_t, int);
 static void	genfb_pollc(void *, int);
@@ -107,11 +165,14 @@ static struct genfb_softc *genfb_softc =
 void
 genfb_init(struct genfb_softc *sc)
 {
+	struct genfb_private *scp;
 	prop_dictionary_t dict;
 	uint64_t cmap_cb, pmf_cb, mode_cb, bl_cb, br_cb, fbaddr;
 	uint64_t fboffset;
 	bool console;
 
+	scp = sc->sc_private = kmem_zalloc(sizeof(*sc->sc_private), KM_SLEEP);
+
 	dict = device_properties(sc->sc_dev);
 #ifdef GENFB_DEBUG
 	printf("%s", prop_dictionary_externalize(dict));
@@ -120,20 +181,20 @@ genfb_init(struct genfb_softc *sc)
 
 	if (!prop_dictionary_get_uint32(dict, "width", >sc_width)) {
 		GPRINTF("no width property\n");
-		return;
+		goto bad;
 	}
 	if (!prop_dictionary_get_uint32(dict, "height", >sc_height)) {
 		GPRINTF("no height property\n");
-		return;
+		goto bad;
 	}
 	if (!prop_dictionary_get_uint32(dict, "depth", >sc_depth)) {
 		GPRINTF("no depth property\n");
-		return;
+		goto bad;
 	}
 
 	if (!prop_dictionary_get_uint64(dict, "address", 

CVS commit: src/sys/dev/wsfb

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 13:10:54 UTC 2022

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

Log Message:
genfb(4): Make internal parts of struct genfb_softc private.

This way the ABI has no ifdefs, so it has a chance to be usable in
modules.  This also makes genfb much easier to maintain without
worrying about ABI breakage.


To generate a diff of this commit:
cvs rdiff -u -r1.88 -r1.89 src/sys/dev/wsfb/genfb.c
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/wsfb/genfbvar.h

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



CVS commit: src/sys/dev/wsfb

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 13:10:04 UTC 2022

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

Log Message:
genfb(4): KASSERT(a && b) -> KASSERT(a); KASSERT(b)

Better diagnostics.  No other functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 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.87 src/sys/dev/wsfb/genfb.c:1.88
--- src/sys/dev/wsfb/genfb.c:1.87	Sat Jul  9 13:37:12 2022
+++ src/sys/dev/wsfb/genfb.c	Sun Jul 17 13:10:04 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: genfb.c,v 1.87 2022/07/09 13:37:12 rin Exp $ */
+/*	$NetBSD: genfb.c,v 1.88 2022/07/17 13:10:04 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2007 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.87 2022/07/09 13:37:12 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.88 2022/07/17 13:10:04 riastradh Exp $");
 
 #include 
 #include 
@@ -608,7 +608,8 @@ genfb_init_screen(void *cookie, struct v
 			ri->ri_bpos = bits * 2;
 		} else if (is_swapped) {
 			/* byte-swapped, must be 32 bpp */
-			KASSERT(ri->ri_depth == 32 && bits == 8);
+			KASSERT(ri->ri_depth == 32);
+			KASSERT(bits == 8);
 			ri->ri_rpos = 8;
 			ri->ri_gpos = 16;
 			ri->ri_bpos = 24;
@@ -879,8 +880,8 @@ genfb_brightness_up(device_t dev)
 {
 	struct genfb_softc *sc = device_private(dev);
 
-	KASSERT(sc->sc_brightness != NULL &&
-		sc->sc_brightness->gpc_upd_parameter != NULL);
+	KASSERT(sc->sc_brightness != NULL);
+	KASSERT(sc->sc_brightness->gpc_upd_parameter != NULL);
 
 	(void)sc->sc_brightness->gpc_upd_parameter(
 	sc->sc_brightness->gpc_cookie, GENFB_BRIGHTNESS_STEP);
@@ -891,8 +892,8 @@ genfb_brightness_down(device_t dev)
 {
 	struct genfb_softc *sc = device_private(dev);
 
-	KASSERT(sc->sc_brightness != NULL &&
-		sc->sc_brightness->gpc_upd_parameter != NULL);
+	KASSERT(sc->sc_brightness != NULL);
+	KASSERT(sc->sc_brightness->gpc_upd_parameter != NULL);
 
 	(void)sc->sc_brightness->gpc_upd_parameter(
 	sc->sc_brightness->gpc_cookie, - GENFB_BRIGHTNESS_STEP);



CVS commit: src/sys/dev/wsfb

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 13:10:04 UTC 2022

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

Log Message:
genfb(4): KASSERT(a && b) -> KASSERT(a); KASSERT(b)

Better diagnostics.  No other functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 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: [netbsd-9] src/doc

2022-07-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jul 17 12:56:05 UTC 2022

Modified Files:
src/doc [netbsd-9]: CHANGES-9.3

Log Message:
Ticket #1480


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.111 -r1.1.2.112 src/doc/CHANGES-9.3

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



CVS commit: [netbsd-9] src/doc

2022-07-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jul 17 12:56:05 UTC 2022

Modified Files:
src/doc [netbsd-9]: CHANGES-9.3

Log Message:
Ticket #1480


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.111 -r1.1.2.112 src/doc/CHANGES-9.3

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

Modified files:

Index: src/doc/CHANGES-9.3
diff -u src/doc/CHANGES-9.3:1.1.2.111 src/doc/CHANGES-9.3:1.1.2.112
--- src/doc/CHANGES-9.3:1.1.2.111	Sun Jul 17 10:35:07 2022
+++ src/doc/CHANGES-9.3	Sun Jul 17 12:56:05 2022
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.3,v 1.1.2.111 2022/07/17 10:35:07 martin Exp $
+# $NetBSD: CHANGES-9.3,v 1.1.2.112 2022/07/17 12:56:05 martin Exp $
 
 A complete list of changes from the NetBSD 9.2 release to the NetBSD 9.3
 release:
@@ -1879,3 +1879,9 @@ sys/kern/subr_pool.c1.285
 	output for kernel pool pages in "vmstat -s" output.
 	[simonb, ticket #1479]
 
+usr.bin/vmstat/vmstat.c1.255
+
+	Fix Fixes overflow errors for pools larger than 4GB
+	when operating on core files.
+	[simonb, ticket #1480]
+



CVS commit: [netbsd-9] src/usr.bin/vmstat

2022-07-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jul 17 12:54:56 UTC 2022

Modified Files:
src/usr.bin/vmstat [netbsd-9]: vmstat.c

Log Message:
Pull up following revision(s) (requested by simonb in ticket #1480):

usr.bin/vmstat/vmstat.c: revision 1.255

When operating on core files or /dev/mem when using the -M option,
use 64-bit math to calculate pool sizes.  Fixes overflow errors for
pools larger than 4GB and gives the correct output with "vmstat -m"
for in use, total allocation and utilisation numbers.


To generate a diff of this commit:
cvs rdiff -u -r1.227.2.1 -r1.227.2.2 src/usr.bin/vmstat/vmstat.c

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

Modified files:

Index: src/usr.bin/vmstat/vmstat.c
diff -u src/usr.bin/vmstat/vmstat.c:1.227.2.1 src/usr.bin/vmstat/vmstat.c:1.227.2.2
--- src/usr.bin/vmstat/vmstat.c:1.227.2.1	Fri Dec 18 12:23:16 2020
+++ src/usr.bin/vmstat/vmstat.c	Sun Jul 17 12:54:56 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: vmstat.c,v 1.227.2.1 2020/12/18 12:23:16 martin Exp $ */
+/* $NetBSD: vmstat.c,v 1.227.2.2 2022/07/17 12:54:56 martin Exp $ */
 
 /*-
  * Copyright (c) 1998, 2000, 2001, 2007 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)vmstat.c	8.2 (Berkeley) 3/1/95";
 #else
-__RCSID("$NetBSD: vmstat.c,v 1.227.2.1 2020/12/18 12:23:16 martin Exp $");
+__RCSID("$NetBSD: vmstat.c,v 1.227.2.2 2022/07/17 12:54:56 martin Exp $");
 #endif
 #endif /* not lint */
 
@@ -1570,7 +1570,7 @@ dopool(int verbose, int wide)
 {
 	int first, ovflw;
 	void *addr;
-	long total, inuse, this_total, this_inuse;
+	uint64_t total, inuse, this_total, this_inuse;
 	struct {
 		uint64_t pt_nget;
 		uint64_t pt_nfail;
@@ -1664,8 +1664,8 @@ dopool(int verbose, int wide)
 			PRWORD(ovflw, " 0x%0*x", 5, 1,
 			pp->pr_flags | pp->pr_roflags);
 
-		this_inuse = pp->pr_nout * pp->pr_size;
-		this_total = pp->pr_npages * pa.pa_pagesz;
+		this_inuse = (uint64_t)pp->pr_nout * pp->pr_size;
+		this_total = (uint64_t)pp->pr_npages * pa.pa_pagesz;
 		if (pp->pr_roflags & PR_RECURSIVE) {
 			/*
 			 * Don't count in-use memory, since it's part
@@ -1704,7 +1704,8 @@ dopool(int verbose, int wide)
 	inuse /= KILO;
 	total /= KILO;
 	(void)printf(
-	"\nIn use %ldK, total allocated %ldK; utilization %.1f%%\n",
+	"\nIn use %" PRIu64 "K, "
+	"total allocated %" PRIu64 "K; utilization %.1f%%\n",
 	inuse, total, (100.0 * inuse) / total);
 }
 



CVS commit: [netbsd-9] src/usr.bin/vmstat

2022-07-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jul 17 12:54:56 UTC 2022

Modified Files:
src/usr.bin/vmstat [netbsd-9]: vmstat.c

Log Message:
Pull up following revision(s) (requested by simonb in ticket #1480):

usr.bin/vmstat/vmstat.c: revision 1.255

When operating on core files or /dev/mem when using the -M option,
use 64-bit math to calculate pool sizes.  Fixes overflow errors for
pools larger than 4GB and gives the correct output with "vmstat -m"
for in use, total allocation and utilisation numbers.


To generate a diff of this commit:
cvs rdiff -u -r1.227.2.1 -r1.227.2.2 src/usr.bin/vmstat/vmstat.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/wscons

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 11:44:30 UTC 2022

Modified Files:
src/sys/dev/wscons: wsmouse.c

Log Message:
wsmouse(4): Nix trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/dev/wscons/wsmouse.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/wscons/wsmouse.c
diff -u src/sys/dev/wscons/wsmouse.c:1.71 src/sys/dev/wscons/wsmouse.c:1.72
--- src/sys/dev/wscons/wsmouse.c:1.71	Sun Jul 17 11:42:55 2022
+++ src/sys/dev/wscons/wsmouse.c	Sun Jul 17 11:44:30 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: wsmouse.c,v 1.71 2022/07/17 11:42:55 riastradh Exp $ */
+/* $NetBSD: wsmouse.c,v 1.72 2022/07/17 11:44:30 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -104,7 +104,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wsmouse.c,v 1.71 2022/07/17 11:42:55 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsmouse.c,v 1.72 2022/07/17 11:44:30 riastradh Exp $");
 
 #include "wsmouse.h"
 #include "wsdisplay.h"
@@ -622,7 +622,7 @@ wsmouse_set_params(struct wsmouse_softc 
 	size_t i = 0;
 
 	for (i = 0; i < nparams; ++i) {
-		switch (buf[i].key) {	
+		switch (buf[i].key) {
 		case WSMOUSECFG_REVERSE_SCROLLING:
 			sc->sc_reverse_scroll = (buf[i].value != 0);
 			break;
@@ -644,7 +644,7 @@ wsmouse_get_params(struct wsmouse_softc 
 	size_t i = 0;
 
 	for (i = 0; i < nparams; ++i) {
-		switch (buf[i].key) {	
+		switch (buf[i].key) {
 		case WSMOUSECFG_REVERSE_SCROLLING:
 			buf[i].value = sc->sc_reverse_scroll;
 			break;



CVS commit: src/sys/dev/wscons

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 11:44:30 UTC 2022

Modified Files:
src/sys/dev/wscons: wsmouse.c

Log Message:
wsmouse(4): Nix trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/dev/wscons/wsmouse.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/wscons

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 11:43:39 UTC 2022

Modified Files:
src/sys/dev/wscons: wsdisplay.c wsdisplay_vcons.c

Log Message:
wsdisplay(4): KNF: return foo, not return (foo)

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.164 -r1.165 src/sys/dev/wscons/wsdisplay.c
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/wscons/wsdisplay_vcons.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/wscons/wsdisplay.c
diff -u src/sys/dev/wscons/wsdisplay.c:1.164 src/sys/dev/wscons/wsdisplay.c:1.165
--- src/sys/dev/wscons/wsdisplay.c:1.164	Sun Jul 17 11:43:11 2022
+++ src/sys/dev/wscons/wsdisplay.c	Sun Jul 17 11:43:39 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: wsdisplay.c,v 1.164 2022/07/17 11:43:11 riastradh Exp $ */
+/* $NetBSD: wsdisplay.c,v 1.165 2022/07/17 11:43:39 riastradh Exp $ */
 
 /*
  * Copyright (c) 1996, 1997 Christopher G. Demetriou.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.164 2022/07/17 11:43:11 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.165 2022/07/17 11:43:39 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_wsdisplay_compat.h"
@@ -339,7 +339,7 @@ wsscreen_attach(struct wsdisplay_softc *
 			if (dconf->wsemul == NULL) {
 free(dconf, M_DEVBUF);
 free(scr, M_DEVBUF);
-return (NULL);
+return NULL;
 			}
 			dconf->wsemulcookie =
 			  (*dconf->wsemul->attach)(0, type, cookie,
@@ -370,7 +370,7 @@ wsscreen_attach(struct wsdisplay_softc *
 	if (console)
 		callout_schedule(>scr_getc_ch, mstohz(10));
 #endif
-	return (scr);
+	return scr;
 }
 
 static void
@@ -405,15 +405,15 @@ wsdisplay_screentype_pick(const struct w
 
 	KASSERT(scrdata->nscreens > 0);
 	if (name == NULL)
-		return (scrdata->screens[0]);
+		return scrdata->screens[0];
 
 	for (i = 0; i < scrdata->nscreens; i++) {
 		scr = scrdata->screens[i];
 		if (!strcmp(name, scr->name))
-			return (scr);
+			return scr;
 	}
 
-	return (0);
+	return 0;
 }
 
 /*
@@ -447,12 +447,12 @@ wsdisplay_addscreen(struct wsdisplay_sof
 	int s;
 
 	if (idx < 0 || idx >= WSDISPLAY_MAXSCREEN)
-		return (EINVAL);
+		return EINVAL;
 	if (sc->sc_scr[idx] != NULL)
-		return (EBUSY);
+		return EBUSY;
 	scrdesc = wsdisplay_screentype_pick(sc->sc_scrdata, screentype);
 	if (!scrdesc)
-		return (ENXIO);
+		return ENXIO;
 
 	/*
 	 * if this screen can resize we need to copy the descr so each screen
@@ -469,14 +469,14 @@ wsdisplay_addscreen(struct wsdisplay_sof
 	error = (*sc->sc_accessops->alloc_screen)(sc->sc_accesscookie,
 			scrdesc, , , , );
 	if (error)
-		return (error);
+		return error;
 
 	scr = wsscreen_attach(sc, 0, emul, scrdesc,
 			  cookie, ccol, crow, defattr);
 	if (scr == NULL) {
 		(*sc->sc_accessops->free_screen)(sc->sc_accesscookie,
 		 cookie);
-		return (ENXIO);
+		return ENXIO;
 	}
 
 	sc->sc_scr[idx] = scr;
@@ -491,7 +491,7 @@ wsdisplay_addscreen(struct wsdisplay_sof
 		sc->sc_focus = scr;
 	}
 	splx(s);
-	return (0);
+	return 0;
 }
 
 static void
@@ -560,14 +560,14 @@ wsdisplay_delscreen(struct wsdisplay_sof
 	void *cookie;
 
 	if (idx < 0 || idx >= WSDISPLAY_MAXSCREEN)
-		return (EINVAL);
+		return EINVAL;
 	if ((scr = sc->sc_scr[idx]) == NULL)
-		return (ENXIO);
+		return ENXIO;
 
 	if (scr->scr_dconf == _console_conf ||
 	scr->scr_syncops ||
 	((scr->scr_flags & SCR_OPEN) && !(flags & WSDISPLAY_DELSCR_FORCE)))
-		return(EBUSY);
+		return EBUSY;
 
 	wsdisplay_closescreen(sc, scr);
 
@@ -602,7 +602,7 @@ wsdisplay_delscreen(struct wsdisplay_sof
 	 cookie);
 
 	aprint_verbose_dev(sc->sc_dev, "screen %d deleted\n", idx);
-	return (0);
+	return 0;
 }
 
 /*
@@ -621,13 +621,13 @@ wsdisplay_emul_match(device_t parent, cf
 		 */
 		if (match->cf_loc[WSEMULDISPLAYDEVCF_CONSOLE] != 0 &&
 		ap->console != 0)
-			return (10);
+			return 10;
 		else
-			return (0);
+			return 0;
 	}
 
 	/* If console-ness unspecified, it wins. */
-	return (1);
+	return 1;
 }
 
 void
@@ -671,7 +671,7 @@ wsemuldisplaydevprint(void *aux, const c
 	aprint_normal(" console %d", ap->console);
 #endif
 
-	return (UNCONF);
+	return UNCONF;
 }
 
 int
@@ -701,7 +701,7 @@ wsdisplay_noemul_match(device_t parent, 
 #endif
 
 	/* Always match. */
-	return (1);
+	return 1;
 }
 
 void
@@ -756,11 +756,11 @@ wsdisplay_dosync(struct wsdisplay_softc 
 			cv_wait_sig(>sc_flagscv, >sc_flagsmtx);
 		mutex_exit(>sc_flagsmtx);
 		if (sc->sc_flags & SC_SWITCHERROR)
-			return (EIO); /* XXX pass real error */
+			return EIO; /* XXX pass real error */
 	} else {
 		sc->sc_flags &= ~SC_SWITCHPENDING;
 		if (res)
-			return (res);
+			return res;
 	}
 	if (attach)
 		sc->sc_flags |= SC_XATTACHED;
@@ -781,9 +781,9 @@ wsdisplay_handlex(int resume)
 			continue;
 		res = wsdisplay_dosync(device_private(dv), resume);
 		if (res)
-			return (res);
+			return res;
 	}
-	return (0);
+	return 0;
 }
 
 static bool
@@ -811,7 

CVS commit: src/sys/dev/wscons

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 11:43:39 UTC 2022

Modified Files:
src/sys/dev/wscons: wsdisplay.c wsdisplay_vcons.c

Log Message:
wsdisplay(4): KNF: return foo, not return (foo)

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.164 -r1.165 src/sys/dev/wscons/wsdisplay.c
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/wscons/wsdisplay_vcons.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/wscons

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 11:43:11 UTC 2022

Modified Files:
src/sys/dev/wscons: wsdisplay.c wsdisplay_vcons.c

Log Message:
wsdisplay(4): KASSERT(a && b) -> KASSERT(a); KASSERT(b)

Better diagnostics this way.  No other functional change.  Omit
needless #ifdef DIAGNOSTIC while here; the compiler can optimize the
dead code away.


To generate a diff of this commit:
cvs rdiff -u -r1.163 -r1.164 src/sys/dev/wscons/wsdisplay.c
cvs rdiff -u -r1.60 -r1.61 src/sys/dev/wscons/wsdisplay_vcons.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/wscons/wsdisplay.c
diff -u src/sys/dev/wscons/wsdisplay.c:1.163 src/sys/dev/wscons/wsdisplay.c:1.164
--- src/sys/dev/wscons/wsdisplay.c:1.163	Fri Dec 31 14:19:57 2021
+++ src/sys/dev/wscons/wsdisplay.c	Sun Jul 17 11:43:11 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: wsdisplay.c,v 1.163 2021/12/31 14:19:57 riastradh Exp $ */
+/* $NetBSD: wsdisplay.c,v 1.164 2022/07/17 11:43:11 riastradh Exp $ */
 
 /*
  * Copyright (c) 1996, 1997 Christopher G. Demetriou.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.163 2021/12/31 14:19:57 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.164 2022/07/17 11:43:11 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_wsdisplay_compat.h"
@@ -790,12 +790,13 @@ static bool
 wsdisplay_suspend(device_t dv, const pmf_qual_t *qual)
 {
 	struct wsdisplay_softc *sc = device_private(dv);
-#ifdef DIAGNOSTIC
 	struct wsscreen *scr = sc->sc_focus;
+
 	if (sc->sc_flags & SC_XATTACHED) {
-		KASSERT(scr && scr->scr_syncops);
+		KASSERT(scr);
+		KASSERT(scr->scr_syncops);
 	}
-#endif
+
 #if 1
 	/*
 	 * XXX X servers should have been detached earlier.

Index: src/sys/dev/wscons/wsdisplay_vcons.c
diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.60 src/sys/dev/wscons/wsdisplay_vcons.c:1.61
--- src/sys/dev/wscons/wsdisplay_vcons.c:1.60	Sun Jul 17 11:31:47 2022
+++ src/sys/dev/wscons/wsdisplay_vcons.c	Sun Jul 17 11:43:11 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: wsdisplay_vcons.c,v 1.60 2022/07/17 11:31:47 riastradh Exp $ */
+/*	$NetBSD: wsdisplay_vcons.c,v 1.61 2022/07/17 11:43:11 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2005, 2006 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.60 2022/07/17 11:31:47 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.61 2022/07/17 11:43:11 riastradh Exp $");
 
 #include 
 #include 
@@ -1317,7 +1317,8 @@ vcons_putwschar(struct vcons_screen *scr
 	struct rasops_info *ri;
 	int error;
 
-	KASSERT(scr != NULL && wsc != NULL);
+	KASSERT(scr != NULL);
+	KASSERT(wsc != NULL);
 
 	ri = >scr_ri;
 
@@ -1356,7 +1357,8 @@ vcons_getwschar(struct vcons_screen *scr
 	struct rasops_info *ri;
 	int fg, bg, ul;
 
-	KASSERT(scr != NULL && wsc != NULL);
+	KASSERT(scr != NULL);
+	KASSERT(wsc != NULL);
 
 	ri = >scr_ri;
 



CVS commit: src/sys/dev/wscons

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 11:43:11 UTC 2022

Modified Files:
src/sys/dev/wscons: wsdisplay.c wsdisplay_vcons.c

Log Message:
wsdisplay(4): KASSERT(a && b) -> KASSERT(a); KASSERT(b)

Better diagnostics this way.  No other functional change.  Omit
needless #ifdef DIAGNOSTIC while here; the compiler can optimize the
dead code away.


To generate a diff of this commit:
cvs rdiff -u -r1.163 -r1.164 src/sys/dev/wscons/wsdisplay.c
cvs rdiff -u -r1.60 -r1.61 src/sys/dev/wscons/wsdisplay_vcons.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/wscons

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 11:42:55 UTC 2022

Modified Files:
src/sys/dev/wscons: wsmouse.c

Log Message:
wsmouse(4): KASSERT(a && b) -> KASSERT(a); KASSERT(b)

Better diagnostics.  No other functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/dev/wscons/wsmouse.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/wscons/wsmouse.c
diff -u src/sys/dev/wscons/wsmouse.c:1.70 src/sys/dev/wscons/wsmouse.c:1.71
--- src/sys/dev/wscons/wsmouse.c:1.70	Tue Sep 28 06:14:27 2021
+++ src/sys/dev/wscons/wsmouse.c	Sun Jul 17 11:42:55 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: wsmouse.c,v 1.70 2021/09/28 06:14:27 nia Exp $ */
+/* $NetBSD: wsmouse.c,v 1.71 2022/07/17 11:42:55 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -104,7 +104,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wsmouse.c,v 1.70 2021/09/28 06:14:27 nia Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsmouse.c,v 1.71 2022/07/17 11:42:55 riastradh Exp $");
 
 #include "wsmouse.h"
 #include "wsdisplay.h"
@@ -602,8 +602,8 @@ wsmouse_repeat(void *v)
 			newdelay = sc->sc_repeat.wr_delay_minimum;
 		else if (newdelay > sc->sc_repeat.wr_delay_minimum)
 			newdelay -= sc->sc_repeat.wr_delay_decrement;
-		KASSERT(newdelay >= sc->sc_repeat.wr_delay_minimum &&
-		newdelay <= sc->sc_repeat.wr_delay_first);
+		KASSERT(newdelay >= sc->sc_repeat.wr_delay_minimum);
+		KASSERT(newdelay <= sc->sc_repeat.wr_delay_first);
 	}
 
 	/*



CVS commit: src/sys/dev/wscons

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 11:42:55 UTC 2022

Modified Files:
src/sys/dev/wscons: wsmouse.c

Log Message:
wsmouse(4): KASSERT(a && b) -> KASSERT(a); KASSERT(b)

Better diagnostics.  No other functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/dev/wscons/wsmouse.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/wscons

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 11:31:47 UTC 2022

Modified Files:
src/sys/dev/wscons: wsdisplay_vcons.c

Log Message:
wsdisplay(4): Use DPRINTF; reduce #ifdefs.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/dev/wscons/wsdisplay_vcons.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/wscons/wsdisplay_vcons.c
diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.59 src/sys/dev/wscons/wsdisplay_vcons.c:1.60
--- src/sys/dev/wscons/wsdisplay_vcons.c:1.59	Sun Jul 17 11:31:07 2022
+++ src/sys/dev/wscons/wsdisplay_vcons.c	Sun Jul 17 11:31:47 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: wsdisplay_vcons.c,v 1.59 2022/07/17 11:31:07 riastradh Exp $ */
+/*	$NetBSD: wsdisplay_vcons.c,v 1.60 2022/07/17 11:31:47 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2005, 2006 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.59 2022/07/17 11:31:07 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.60 2022/07/17 11:31:47 riastradh Exp $");
 
 #include 
 #include 
@@ -1343,10 +1343,8 @@ vcons_putwschar(struct vcons_screen *scr
 	if (error)
 		return error;
 	vcons_putchar(ri, wsc->row, wsc->col, wsc->letter, attr);
-#ifdef VCONS_DEBUG
-	printf("vcons_putwschar(%d, %d, %x, %lx\n", wsc->row, wsc->col,
+	DPRINTF("vcons_putwschar(%d, %d, %x, %lx\n", wsc->row, wsc->col,
 	wsc->letter, attr);
-#endif
 	return 0;
 }
 
@@ -1384,10 +1382,8 @@ vcons_getwschar(struct vcons_screen *scr
 	wsc->letter = scr->scr_chars[offset];
 	attr = scr->scr_attrs[offset];
 
-#ifdef VCONS_DEBUG
-	printf("vcons_getwschar: %d, %d, %x, %lx\n", wsc->row,
+	DPRINTF("vcons_getwschar: %d, %d, %x, %lx\n", wsc->row,
 	wsc->col, wsc->letter, attr);
-#endif
 
 	/*
 	 * this is ugly. We need to break up an attribute into colours and



CVS commit: src/sys/dev/wscons

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 11:31:47 UTC 2022

Modified Files:
src/sys/dev/wscons: wsdisplay_vcons.c

Log Message:
wsdisplay(4): Use DPRINTF; reduce #ifdefs.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/dev/wscons/wsdisplay_vcons.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/wscons

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 11:31:07 UTC 2022

Modified Files:
src/sys/dev/wscons: wsdisplay_vcons.c

Log Message:
wsdisplay(4): Insert memory barriers for scr_dirty synchronization.

Otherwise vcons_update_screen in vcons_softintr might attempt to draw
stale data from the buffers on the screen.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/dev/wscons/wsdisplay_vcons.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/wscons/wsdisplay_vcons.c
diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.58 src/sys/dev/wscons/wsdisplay_vcons.c:1.59
--- src/sys/dev/wscons/wsdisplay_vcons.c:1.58	Sun Jul 17 11:30:27 2022
+++ src/sys/dev/wscons/wsdisplay_vcons.c	Sun Jul 17 11:31:07 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: wsdisplay_vcons.c,v 1.58 2022/07/17 11:30:27 riastradh Exp $ */
+/*	$NetBSD: wsdisplay_vcons.c,v 1.59 2022/07/17 11:31:07 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2005, 2006 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.58 2022/07/17 11:30:27 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.59 2022/07/17 11:31:07 riastradh Exp $");
 
 #include 
 #include 
@@ -139,6 +139,7 @@ static inline void
 vcons_dirty(struct vcons_screen *scr)
 {
 #ifdef VCONS_DRAW_INTR
+	membar_release();
 	atomic_inc_uint(>scr_dirty);
 #endif
 }
@@ -1520,6 +1521,7 @@ vcons_softintr(void *cookie)
 	if (scr && vd->use_intr) {
 		if (!SCREEN_IS_BUSY(scr)) {
 			dirty = atomic_swap_uint(>scr_dirty, 0);
+			membar_acquire();
 			if (vd->use_intr == 2) {
 if ((scr->scr_flags & VCONS_NO_REDRAW) == 0) {
 	vd->use_intr = 1;



CVS commit: src/sys/dev/wscons

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 11:31:07 UTC 2022

Modified Files:
src/sys/dev/wscons: wsdisplay_vcons.c

Log Message:
wsdisplay(4): Insert memory barriers for scr_dirty synchronization.

Otherwise vcons_update_screen in vcons_softintr might attempt to draw
stale data from the buffers on the screen.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/dev/wscons/wsdisplay_vcons.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/wscons

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 11:30:27 UTC 2022

Modified Files:
src/sys/dev/wscons: wsdisplay_vcons.c

Log Message:
wsdisplay(4): Factor out scr_dirty setting.

Reduces #ifdefs.  No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/dev/wscons/wsdisplay_vcons.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/wscons/wsdisplay_vcons.c
diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.57 src/sys/dev/wscons/wsdisplay_vcons.c:1.58
--- src/sys/dev/wscons/wsdisplay_vcons.c:1.57	Sun Jul 17 11:20:04 2022
+++ src/sys/dev/wscons/wsdisplay_vcons.c	Sun Jul 17 11:30:27 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: wsdisplay_vcons.c,v 1.57 2022/07/17 11:20:04 riastradh Exp $ */
+/*	$NetBSD: wsdisplay_vcons.c,v 1.58 2022/07/17 11:30:27 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2005, 2006 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.57 2022/07/17 11:20:04 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.58 2022/07/17 11:30:27 riastradh Exp $");
 
 #include 
 #include 
@@ -135,6 +135,14 @@ vcons_use_intr(const struct vcons_screen
 #endif
 }
 
+static inline void
+vcons_dirty(struct vcons_screen *scr)
+{
+#ifdef VCONS_DRAW_INTR
+	atomic_inc_uint(>scr_dirty);
+#endif
+}
+
 static int
 vcons_init_common(struct vcons_data *vd, void *cookie,
 struct wsscreen_descr *def, struct wsdisplay_accessops *ao,
@@ -895,9 +903,7 @@ vcons_copycols_buffer(void *cookie, int 
 	memmove(>scr_chars[offset + to], >scr_chars[offset + from],
 	ncols * sizeof(uint32_t));
 
-#ifdef VCONS_DRAW_INTR
-	atomic_inc_uint(>scr_dirty);
-#endif
+	vcons_dirty(scr);
 }
 
 static void
@@ -979,9 +985,7 @@ vcons_erasecols_buffer(void *cookie, int
 		scr->scr_chars[offset + i] = 0x20;
 	}
 
-#ifdef VCONS_DRAW_INTR
-	atomic_inc_uint(>scr_dirty);
-#endif
+	vcons_dirty(scr);
 }
 
 #ifdef VCONS_DRAW_INTR
@@ -1051,9 +1055,7 @@ vcons_copyrows_buffer(void *cookie, int 
 	memmove(>scr_chars[to], >scr_chars[from],
 	len * sizeof(uint32_t));
 
-#ifdef VCONS_DRAW_INTR
-	atomic_inc_uint(>scr_dirty);
-#endif
+	vcons_dirty(scr);
 }
 
 static void
@@ -1137,9 +1139,7 @@ vcons_eraserows_buffer(void *cookie, int
 		scr->scr_chars[i] = 0x20;
 	}
 
-#ifdef VCONS_DRAW_INTR
-	atomic_inc_uint(>scr_dirty);
-#endif
+	vcons_dirty(scr);
 }
 
 #ifdef VCONS_DRAW_INTR
@@ -1196,9 +1196,7 @@ vcons_putchar_buffer(void *cookie, int r
 		scr->scr_chars[pos + offset] = c;
 	}
 
-#ifdef VCONS_DRAW_INTR
-	atomic_inc_uint(>scr_dirty);
-#endif
+	vcons_dirty(scr);
 }
 
 #ifdef VCONS_DRAW_INTR
@@ -1258,9 +1256,7 @@ vcons_cursor(void *cookie, int on, int r
 		if (scr->scr_ri.ri_crow != row || scr->scr_ri.ri_ccol != col) {
 			scr->scr_ri.ri_crow = row;
 			scr->scr_ri.ri_ccol = col;
-#if defined(VCONS_DRAW_INTR)
-			atomic_inc_uint(>scr_dirty);
-#endif
+			vcons_dirty(scr);
 		}
 		vcons_unlock(scr);
 		return;
@@ -1576,7 +1572,7 @@ vcons_disable_polling(struct vcons_data 
 
 	vd->use_intr = 2;
 	if (scr)
-		atomic_inc_uint(>scr_dirty);
+		vcons_dirty(scr);
 #endif
 }
 



CVS commit: src/sys/dev/wscons

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 11:30:27 UTC 2022

Modified Files:
src/sys/dev/wscons: wsdisplay_vcons.c

Log Message:
wsdisplay(4): Factor out scr_dirty setting.

Reduces #ifdefs.  No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/dev/wscons/wsdisplay_vcons.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/wscons

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 11:20:04 UTC 2022

Modified Files:
src/sys/dev/wscons: wsdisplay_vcons.c

Log Message:
wsdisplay(4): Factor out use_intr tests.

Nix a lot of #ifdefs this way.  Compiler can take care of dead code
if appropriate.  No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/dev/wscons/wsdisplay_vcons.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/wscons/wsdisplay_vcons.c
diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.56 src/sys/dev/wscons/wsdisplay_vcons.c:1.57
--- src/sys/dev/wscons/wsdisplay_vcons.c:1.56	Sun Jul 17 10:28:09 2022
+++ src/sys/dev/wscons/wsdisplay_vcons.c	Sun Jul 17 11:20:04 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: wsdisplay_vcons.c,v 1.56 2022/07/17 10:28:09 riastradh Exp $ */
+/*	$NetBSD: wsdisplay_vcons.c,v 1.57 2022/07/17 11:20:04 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2005, 2006 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.56 2022/07/17 10:28:09 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.57 2022/07/17 11:20:04 riastradh Exp $");
 
 #include 
 #include 
@@ -125,6 +125,16 @@ static void vcons_softintr(void *);
 static void vcons_init_thread(void *);
 #endif
 
+static inline bool
+vcons_use_intr(const struct vcons_screen *scr)
+{
+#ifdef VCONS_DRAW_INTR
+	return scr->scr_vd->use_intr;
+#else
+	return false;
+#endif
+}
+
 static int
 vcons_init_common(struct vcons_data *vd, void *cookie,
 struct wsscreen_descr *def, struct wsdisplay_accessops *ao,
@@ -898,10 +908,8 @@ vcons_copycols(void *cookie, int row, in
 
 	vcons_copycols_buffer(cookie, row, srccol, dstcol, ncols);
 
-#if defined(VCONS_DRAW_INTR)
-	if (scr->scr_vd->use_intr)
+	if (vcons_use_intr(scr))
 		return;
-#endif
 
 	vcons_lock(scr);
 	if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) {
@@ -1001,10 +1009,8 @@ vcons_erasecols(void *cookie, int row, i
 
 	vcons_erasecols_buffer(cookie, row, startcol, ncols, fillattr);
 
-#if defined(VCONS_DRAW_INTR)
-	if (scr->scr_vd->use_intr)
+	if (vcons_use_intr(scr))
 		return;
-#endif
 
 	vcons_lock(scr);
 	if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) {
@@ -1058,10 +1064,8 @@ vcons_copyrows(void *cookie, int srcrow,
 
 	vcons_copyrows_buffer(cookie, srcrow, dstrow, nrows);
 
-#if defined(VCONS_DRAW_INTR)
-	if (scr->scr_vd->use_intr)
+	if (vcons_use_intr(scr))
 		return;
-#endif
 
 	vcons_lock(scr);
 	if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) {
@@ -1163,10 +1167,8 @@ vcons_eraserows(void *cookie, int row, i
 
 	vcons_eraserows_buffer(cookie, row, nrows, fillattr);
 
-#if defined(VCONS_DRAW_INTR)
-	if (scr->scr_vd->use_intr)
+	if (vcons_use_intr(scr))
 		return;
-#endif
 
 	vcons_lock(scr);
 	if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) {
@@ -1228,10 +1230,8 @@ vcons_putchar(void *cookie, int row, int
 
 	vcons_putchar_buffer(cookie, row, col, c, attr);
 
-#if defined(VCONS_DRAW_INTR)
-	if (scr->scr_vd->use_intr)
+	if (vcons_use_intr(scr))
 		return;
-#endif
 
 	vcons_lock(scr);
 	if (SCREEN_IS_VISIBLE(scr) && SCREEN_CAN_DRAW(scr)) {
@@ -1253,19 +1253,18 @@ vcons_cursor(void *cookie, int on, int r
 	struct rasops_info *ri = cookie;
 	struct vcons_screen *scr = ri->ri_hw;
 
-
-#if defined(VCONS_DRAW_INTR)
-	if (scr->scr_vd->use_intr) {
+	if (vcons_use_intr(scr)) {
 		vcons_lock(scr);
 		if (scr->scr_ri.ri_crow != row || scr->scr_ri.ri_ccol != col) {
 			scr->scr_ri.ri_crow = row;
 			scr->scr_ri.ri_ccol = col;
+#if defined(VCONS_DRAW_INTR)
 			atomic_inc_uint(>scr_dirty);
+#endif
 		}
 		vcons_unlock(scr);
 		return;
 	}
-#endif
 
 	vcons_lock(scr);
 



CVS commit: src/sys/dev/wscons

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 11:20:04 UTC 2022

Modified Files:
src/sys/dev/wscons: wsdisplay_vcons.c

Log Message:
wsdisplay(4): Factor out use_intr tests.

Nix a lot of #ifdefs this way.  Compiler can take care of dead code
if appropriate.  No functional change intended.


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

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



CVS commit: [netbsd-9] src/doc

2022-07-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jul 17 10:35:07 UTC 2022

Modified Files:
src/doc [netbsd-9]: CHANGES-9.3

Log Message:
Ticket #1479


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.110 -r1.1.2.111 src/doc/CHANGES-9.3

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

Modified files:

Index: src/doc/CHANGES-9.3
diff -u src/doc/CHANGES-9.3:1.1.2.110 src/doc/CHANGES-9.3:1.1.2.111
--- src/doc/CHANGES-9.3:1.1.2.110	Fri Jul 15 17:18:23 2022
+++ src/doc/CHANGES-9.3	Sun Jul 17 10:35:07 2022
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.3,v 1.1.2.110 2022/07/15 17:18:23 martin Exp $
+# $NetBSD: CHANGES-9.3,v 1.1.2.111 2022/07/17 10:35:07 martin Exp $
 
 A complete list of changes from the NetBSD 9.2 release to the NetBSD 9.3
 release:
@@ -1873,3 +1873,9 @@ xsrc-9/external/mit/xorg-server/dist/xkb
 	   Out-Of-Bounds Access
 	[mrg, ticket #1478]
 
+sys/kern/subr_pool.c1.285
+
+	Fix overflow errors for pools larger than 4GB and
+	output for kernel pool pages in "vmstat -s" output.
+	[simonb, ticket #1479]
+



CVS commit: [netbsd-9] src/doc

2022-07-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jul 17 10:35:07 UTC 2022

Modified Files:
src/doc [netbsd-9]: CHANGES-9.3

Log Message:
Ticket #1479


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.110 -r1.1.2.111 src/doc/CHANGES-9.3

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



CVS commit: [netbsd-9] src/sys/kern

2022-07-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jul 17 10:34:10 UTC 2022

Modified Files:
src/sys/kern [netbsd-9]: subr_pool.c

Log Message:
Pull up following revision(s) (requested by simonb in ticket #1479):

sys/kern/subr_pool.c: revision 1.285

Use 64-bit math to calculate pool sizes.  Fixes overflow errors for
pools larger than 4GB and gives the correct output for kernel pool pages
in "vmstat -s" output.


To generate a diff of this commit:
cvs rdiff -u -r1.252.2.3 -r1.252.2.4 src/sys/kern/subr_pool.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/subr_pool.c
diff -u src/sys/kern/subr_pool.c:1.252.2.3 src/sys/kern/subr_pool.c:1.252.2.4
--- src/sys/kern/subr_pool.c:1.252.2.3	Sun Mar  8 11:04:43 2020
+++ src/sys/kern/subr_pool.c	Sun Jul 17 10:34:10 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_pool.c,v 1.252.2.3 2020/03/08 11:04:43 martin Exp $	*/
+/*	$NetBSD: subr_pool.c,v 1.252.2.4 2022/07/17 10:34:10 martin Exp $	*/
 
 /*
  * Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008, 2010, 2014, 2015, 2018
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.252.2.3 2020/03/08 11:04:43 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.252.2.4 2022/07/17 10:34:10 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -1678,10 +1678,11 @@ pool_totalpages_locked(void)
 	uint64_t total = 0;
 
 	TAILQ_FOREACH(pp, _head, pr_poollist) {
-		uint64_t bytes = pp->pr_npages * pp->pr_alloc->pa_pagesz;
+		uint64_t bytes =
+		(uint64_t)pp->pr_npages * pp->pr_alloc->pa_pagesz;
 
 		if ((pp->pr_roflags & PR_RECURSIVE) != 0)
-			bytes -= (pp->pr_nout * pp->pr_size);
+			bytes -= ((uint64_t)pp->pr_nout * pp->pr_size);
 		total += bytes;
 	}
 



CVS commit: [netbsd-9] src/sys/kern

2022-07-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jul 17 10:34:10 UTC 2022

Modified Files:
src/sys/kern [netbsd-9]: subr_pool.c

Log Message:
Pull up following revision(s) (requested by simonb in ticket #1479):

sys/kern/subr_pool.c: revision 1.285

Use 64-bit math to calculate pool sizes.  Fixes overflow errors for
pools larger than 4GB and gives the correct output for kernel pool pages
in "vmstat -s" output.


To generate a diff of this commit:
cvs rdiff -u -r1.252.2.3 -r1.252.2.4 src/sys/kern/subr_pool.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-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 10:28:09 UTC 2022

Modified Files:
src/sys/arch/arm/omap: omapfb.c
src/sys/arch/arm/ti: omap3_dss.c
src/sys/dev/pci: wcfb.c
src/sys/dev/wscons: wsdisplay_vcons.c wsdisplay_vconsvar.h

Log Message:
wsdisplay(4): Factor out WSDISPLAY_SCROLLSUPPORT logic.

Should find a way to avoid the #ifdefs in the .h file, but this makes
the code a good deal more legible and easier to maitain, at least.
No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/arm/omap/omapfb.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/ti/omap3_dss.c
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/pci/wcfb.c
cvs rdiff -u -r1.55 -r1.56 src/sys/dev/wscons/wsdisplay_vcons.c
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/wscons/wsdisplay_vconsvar.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/arm/omap/omapfb.c
diff -u src/sys/arch/arm/omap/omapfb.c:1.30 src/sys/arch/arm/omap/omapfb.c:1.31
--- src/sys/arch/arm/omap/omapfb.c:1.30	Sat Aug  7 16:18:45 2021
+++ src/sys/arch/arm/omap/omapfb.c	Sun Jul 17 10:28:09 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: omapfb.c,v 1.30 2021/08/07 16:18:45 thorpej Exp $	*/
+/*	$NetBSD: omapfb.c,v 1.31 2022/07/17 10:28:09 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2010 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: omapfb.c,v 1.30 2021/08/07 16:18:45 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: omapfb.c,v 1.31 2022/07/17 10:28:09 riastradh Exp $");
 
 #include 
 #include 
@@ -980,9 +980,7 @@ omapfb_cursor(void *cookie, int on, int 
 	int pos;
 
 	pos = col + row * ri->ri_cols;
-#ifdef WSDISPLAY_SCROLLSUPPORT
-	pos += scr->scr_offset_to_zero;
-#endif
+	pos += vcons_offset_to_zero(scr);
 	if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL) {
 		if (ri->ri_flg & RI_CURSOR) {
 			omapfb_putchar(cookie, row, col, scr->scr_chars[pos],

Index: src/sys/arch/arm/ti/omap3_dss.c
diff -u src/sys/arch/arm/ti/omap3_dss.c:1.5 src/sys/arch/arm/ti/omap3_dss.c:1.6
--- src/sys/arch/arm/ti/omap3_dss.c:1.5	Sat Aug  7 16:18:46 2021
+++ src/sys/arch/arm/ti/omap3_dss.c	Sun Jul 17 10:28:09 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: omap3_dss.c,v 1.5 2021/08/07 16:18:46 thorpej Exp $	*/
+/*	$NetBSD: omap3_dss.c,v 1.6 2022/07/17 10:28:09 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2010 Michael Lorenz
@@ -33,7 +33,7 @@
 #include "opt_wsdisplay_compat.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: omap3_dss.c,v 1.5 2021/08/07 16:18:46 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: omap3_dss.c,v 1.6 2022/07/17 10:28:09 riastradh Exp $");
 
 #include 
 #include 
@@ -993,9 +993,7 @@ omapfb_cursor(void *cookie, int on, int 
 	int pos;
 
 	pos = col + row * ri->ri_cols;
-#ifdef WSDISPLAY_SCROLLSUPPORT
-	pos += scr->scr_offset_to_zero;
-#endif
+	pos += vcons_offset_to_zero(scr);
 	if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL) {
 		if (ri->ri_flg & RI_CURSOR) {
 			omapfb_putchar(cookie, row, col, scr->scr_chars[pos],

Index: src/sys/dev/pci/wcfb.c
diff -u src/sys/dev/pci/wcfb.c:1.20 src/sys/dev/pci/wcfb.c:1.21
--- src/sys/dev/pci/wcfb.c:1.20	Sat Aug  7 16:19:14 2021
+++ src/sys/dev/pci/wcfb.c	Sun Jul 17 10:28:09 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: wcfb.c,v 1.20 2021/08/07 16:19:14 thorpej Exp $ */
+/*	$NetBSD: wcfb.c,v 1.21 2022/07/17 10:28:09 riastradh Exp $ */
 
 /*
  * Copyright (c) 2007, 2008, 2009 Miodrag Vallat.
@@ -20,7 +20,7 @@
 /* a driver for (some) 3DLabs Wildcat cards, based on OpenBSD's ifb driver */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wcfb.c,v 1.20 2021/08/07 16:19:14 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wcfb.c,v 1.21 2022/07/17 10:28:09 riastradh Exp $");
 
 #include 
 #include 
@@ -590,9 +590,7 @@ wcfb_cursor(void *cookie, int on, int ro
 		if (ri->ri_flg & RI_CURSOR) {
 			/* remove cursor */
 			coffset = ri->ri_ccol + (ri->ri_crow * ri->ri_cols);
-#ifdef WSDISPLAY_SCROLLSUPPORT
-			coffset += scr->scr_offset_to_zero;
-#endif
+			coffset += vcons_offset_to_zero(scr);
 			wcfb_putchar(cookie, ri->ri_crow,
 			ri->ri_ccol, scr->scr_chars[coffset],
 			scr->scr_attrs[coffset]);

Index: src/sys/dev/wscons/wsdisplay_vcons.c
diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.55 src/sys/dev/wscons/wsdisplay_vcons.c:1.56
--- src/sys/dev/wscons/wsdisplay_vcons.c:1.55	Sun Jul 17 10:27:45 2022
+++ src/sys/dev/wscons/wsdisplay_vcons.c	Sun Jul 17 10:28:09 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: wsdisplay_vcons.c,v 1.55 2022/07/17 10:27:45 riastradh Exp $ */
+/*	$NetBSD: wsdisplay_vcons.c,v 1.56 2022/07/17 10:28:09 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2005, 2006 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.55 2022/07/17 10:27:45 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.56 2022/07/17 10:28:09 riastradh Exp $");
 
 #include 
 #include 
@@ -878,21 +878,12 @@ vcons_copycols_buffer(void *cookie, int 
 	struct 

CVS commit: src/sys

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 10:28:09 UTC 2022

Modified Files:
src/sys/arch/arm/omap: omapfb.c
src/sys/arch/arm/ti: omap3_dss.c
src/sys/dev/pci: wcfb.c
src/sys/dev/wscons: wsdisplay_vcons.c wsdisplay_vconsvar.h

Log Message:
wsdisplay(4): Factor out WSDISPLAY_SCROLLSUPPORT logic.

Should find a way to avoid the #ifdefs in the .h file, but this makes
the code a good deal more legible and easier to maitain, at least.
No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/arm/omap/omapfb.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/ti/omap3_dss.c
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/pci/wcfb.c
cvs rdiff -u -r1.55 -r1.56 src/sys/dev/wscons/wsdisplay_vcons.c
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/wscons/wsdisplay_vconsvar.h

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



CVS commit: src/sys/dev/wscons

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 10:27:45 UTC 2022

Modified Files:
src/sys/dev/wscons: wsdisplay_vcons.c

Log Message:
wsdisplay(4): Nix trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/dev/wscons/wsdisplay_vcons.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/wscons

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 10:27:45 UTC 2022

Modified Files:
src/sys/dev/wscons: wsdisplay_vcons.c

Log Message:
wsdisplay(4): Nix trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/dev/wscons/wsdisplay_vcons.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/wscons/wsdisplay_vcons.c
diff -u src/sys/dev/wscons/wsdisplay_vcons.c:1.54 src/sys/dev/wscons/wsdisplay_vcons.c:1.55
--- src/sys/dev/wscons/wsdisplay_vcons.c:1.54	Sat Jul 16 10:57:59 2022
+++ src/sys/dev/wscons/wsdisplay_vcons.c	Sun Jul 17 10:27:45 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: wsdisplay_vcons.c,v 1.54 2022/07/16 10:57:59 mlelstv Exp $ */
+/*	$NetBSD: wsdisplay_vcons.c,v 1.55 2022/07/17 10:27:45 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2005, 2006 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.54 2022/07/16 10:57:59 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.55 2022/07/17 10:27:45 riastradh Exp $");
 
 #include 
 #include 
@@ -63,11 +63,11 @@ __KERNEL_RCSID(0, "$NetBSD: wsdisplay_vc
 #define DPRINTF if (0) printf
 #endif
 
-static void vcons_dummy_init_screen(void *, struct vcons_screen *, int, 
+static void vcons_dummy_init_screen(void *, struct vcons_screen *, int,
 	long *);
 
 static int  vcons_ioctl(void *, void *, u_long, void *, int, struct lwp *);
-static int  vcons_alloc_screen(void *, const struct wsscreen_descr *, void **, 
+static int  vcons_alloc_screen(void *, const struct wsscreen_descr *, void **,
 	int *, int *, long *);
 static void vcons_free_screen(void *, void *);
 static int  vcons_show_screen(void *, void *, int, void (*)(void *, int, int),
@@ -259,9 +259,9 @@ vcons_alloc_buffers(struct vcons_data *v
 	int size;
 #endif
 
-	/* 
-	 * we allocate both chars and attributes in one chunk, attributes first 
-	 * because they have the (potentially) bigger alignment 
+	/*
+	 * we allocate both chars and attributes in one chunk, attributes first
+	 * because they have the (potentially) bigger alignment
 	 */
 #ifdef WSDISPLAY_SCROLLSUPPORT
 	cnt = (ri->ri_rows + WSDISPLAY_SCROLLBACK_LINES) * ri->ri_cols;
@@ -273,15 +273,15 @@ vcons_alloc_buffers(struct vcons_data *v
 #else
 	cnt = ri->ri_rows * ri->ri_cols;
 #endif
-	scr->scr_attrs = malloc(cnt * (sizeof(long) + 
+	scr->scr_attrs = malloc(cnt * (sizeof(long) +
 	sizeof(uint32_t)), M_DEVBUF, M_WAITOK);
 	if (scr->scr_attrs == NULL)
 		return ENOMEM;
 
 	scr->scr_chars = (uint32_t *)>scr_attrs[cnt];
 
-	/* 
-	 * fill the attribute buffer with *defattr, chars with 0x20 
+	/*
+	 * fill the attribute buffer with *defattr, chars with 0x20
 	 * since we don't know if the driver tries to mimic firmware output or
 	 * reset everything we do nothing to VRAM here, any driver that feels
 	 * the need to clear screen or something will have to do it on its own
@@ -323,15 +323,15 @@ vcons_init_screen(struct vcons_data *vd,
 
 	if (scr->scr_type == NULL)
 		scr->scr_type = vd->defaulttype;
-	
+
 	/*
 	 * call the driver-supplied init_screen function which is expected
 	 * to set up rasops_info, override cursor() and probably others
 	 */
 	vd->init_screen(vd->cookie, scr, existing, defattr);
 
-	/* 
-	 * save the non virtual console aware rasops and replace them with 
+	/*
+	 * save the non virtual console aware rasops and replace them with
 	 * our wrappers
 	 */
 	vd->eraserows = ri->ri_ops.eraserows;
@@ -356,8 +356,8 @@ vcons_init_screen(struct vcons_data *vd,
 		vd->cursor = ri->ri_ops.cursor;
 	}
 
-	ri->ri_ops.eraserows = vcons_eraserows;	
-	ri->ri_ops.erasecols = vcons_erasecols;	
+	ri->ri_ops.eraserows = vcons_eraserows;
+	ri->ri_ops.erasecols = vcons_erasecols;
 	ri->ri_ops.putchar   = vcons_putchar;
 	ri->ri_ops.cursor= vcons_cursor;
 	ri->ri_ops.copycols  = vcons_copycols;
@@ -381,14 +381,14 @@ vcons_init_screen(struct vcons_data *vd,
 		vd->active = scr;
 		SCREEN_VISIBLE(scr);
 	}
-	
+
 	if (existing) {
 		SCREEN_VISIBLE(scr);
 		vd->active = scr;
 	} else {
 		SCREEN_INVISIBLE(scr);
 	}
-	
+
 	LIST_INSERT_HEAD(>screens, scr, next);
 	return 0;
 }
@@ -453,8 +453,8 @@ vcons_load_font(void *v, void *cookie, s
 		free(scr->scr_attrs, M_DEVBUF);
 	/* allocate new buffers */
 	vcons_alloc_buffers(vd, scr);
-	
-	/* save the potentially changed ri_ops */ 
+
+	/* save the potentially changed ri_ops */
 	vd->eraserows = ri->ri_ops.eraserows;
 	vd->erasecols = ri->ri_ops.erasecols;
 	scr->putchar   = ri->ri_ops.putchar;
@@ -479,8 +479,8 @@ vcons_load_font(void *v, void *cookie, s
 	}
 
 	/* and put our wrappers back */
-	ri->ri_ops.eraserows = vcons_eraserows;	
-	ri->ri_ops.erasecols = vcons_erasecols;	
+	ri->ri_ops.eraserows = vcons_eraserows;
+	ri->ri_ops.erasecols = vcons_erasecols;
 	ri->ri_ops.putchar   = vcons_putchar;
 	ri->ri_ops.cursor= vcons_cursor;
 	ri->ri_ops.copycols  = vcons_copycols;
@@ 

CVS commit: src/sys/dev/pci

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 10:10:45 UTC 2022

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

Log Message:
agp(4): Use bus_space_barrier, not membar_producer.


To generate a diff of this commit:
cvs rdiff -u -r1.124 -r1.125 src/sys/dev/pci/agp_i810.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/agp_i810.c
diff -u src/sys/dev/pci/agp_i810.c:1.124 src/sys/dev/pci/agp_i810.c:1.125
--- src/sys/dev/pci/agp_i810.c:1.124	Sun Nov 10 21:16:36 2019
+++ src/sys/dev/pci/agp_i810.c	Sun Jul 17 10:10:45 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: agp_i810.c,v 1.124 2019/11/10 21:16:36 chs Exp $	*/
+/*	$NetBSD: agp_i810.c,v 1.125 2022/07/17 10:10:45 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2000 Doug Rabson
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: agp_i810.c,v 1.124 2019/11/10 21:16:36 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: agp_i810.c,v 1.125 2022/07/17 10:10:45 riastradh Exp $");
 
 #include 
 #include 
@@ -173,7 +173,8 @@ agp_i810_post_gtt_entry(struct agp_i810_
 	 * read, because I don't have enough time or hardware to
 	 * conduct conclusive tests.
 	 */
-	membar_producer();
+	bus_space_barrier(isc->gtt_bst, isc->gtt_bsh, 0, isc->gtt_size,
+	BUS_SPACE_BARRIER_WRITE);
 	(void)bus_space_read_4(isc->gtt_bst, isc->gtt_bsh,
 	4*(off >> AGP_PAGE_SHIFT));
 }



CVS commit: src/sys/dev/pci

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 10:10:45 UTC 2022

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

Log Message:
agp(4): Use bus_space_barrier, not membar_producer.


To generate a diff of this commit:
cvs rdiff -u -r1.124 -r1.125 src/sys/dev/pci/agp_i810.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/macppc/conf

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 10:01:18 UTC 2022

Modified Files:
src/sys/arch/macppc/conf: std.macppc

Log Message:
std.macppc: Nix trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/macppc/conf/std.macppc

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/macppc/conf/std.macppc
diff -u src/sys/arch/macppc/conf/std.macppc:1.26 src/sys/arch/macppc/conf/std.macppc:1.27
--- src/sys/arch/macppc/conf/std.macppc:1.26	Thu Jul 14 11:10:02 2022
+++ src/sys/arch/macppc/conf/std.macppc	Sun Jul 17 10:01:18 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: std.macppc,v 1.26 2022/07/14 11:10:02 macallan Exp $
+#	$NetBSD: std.macppc,v 1.27 2022/07/17 10:01:18 riastradh Exp $
 #
 # Standard/required options for NetBSD/macppc.
 
@@ -22,7 +22,7 @@ options 	INTSTK=0x2000
 # pose as a USB keyboard
 options 	ADBKBD_EMUL_USB
 
-# default to console switching using Command-Fn, for tradition 
+# default to console switching using Command-Fn, for tradition
 options 	ADBKBD_LAYOUT="(KB_US | KB_APPLE)"
 options 	UKBD_LAYOUT="(KB_US | KB_APPLE)"
 



CVS commit: src/sys/arch/macppc/conf

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 10:01:18 UTC 2022

Modified Files:
src/sys/arch/macppc/conf: std.macppc

Log Message:
std.macppc: Nix trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/macppc/conf/std.macppc

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/common/include/linux

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 08:34:00 UTC 2022

Modified Files:
src/sys/external/bsd/common/include/linux: compiler.h

Log Message:
linux/compiler.h: Add missing barriers in READ_ONCE, WRITE_ONCE.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/external/bsd/common/include/linux/compiler.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/compiler.h
diff -u src/sys/external/bsd/common/include/linux/compiler.h:1.8 src/sys/external/bsd/common/include/linux/compiler.h:1.9
--- src/sys/external/bsd/common/include/linux/compiler.h:1.8	Sat Apr  9 23:43:31 2022
+++ src/sys/external/bsd/common/include/linux/compiler.h	Sun Jul 17 08:34:00 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: compiler.h,v 1.8 2022/04/09 23:43:31 riastradh Exp $	*/
+/*	$NetBSD: compiler.h,v 1.9 2022/07/17 08:34:00 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -62,6 +62,7 @@
 	BUILD_BUG_ON_ZERO(__same_type((X), &(X)[0]))
 
 #define	READ_ONCE(X)	({		  \
+	__insn_barrier();		  \
 	typeof(X) __read_once_tmp = (X);  \
 	membar_datadep_consumer();	  \
 	__read_once_tmp;		  \
@@ -69,7 +70,9 @@
 
 #define	WRITE_ONCE(X, V)	({	  \
 	typeof(X) __write_once_tmp = (V);  \
+	__insn_barrier();		  \
 	(X) = __write_once_tmp;		  \
+	__insn_barrier();		  \
 	__write_once_tmp;		  \
 })
 



CVS commit: src/sys/external/bsd/common/include/linux

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 08:34:00 UTC 2022

Modified Files:
src/sys/external/bsd/common/include/linux: compiler.h

Log Message:
linux/compiler.h: Add missing barriers in READ_ONCE, WRITE_ONCE.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/external/bsd/common/include/linux/compiler.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/x86/x86

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 08:33:48 UTC 2022

Modified Files:
src/sys/arch/x86/x86: bus_space.c

Log Message:
x86: Cite reference for bus_space_barrier memory ordering rules.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/x86/x86/bus_space.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/x86/x86

2022-07-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 17 08:33:48 UTC 2022

Modified Files:
src/sys/arch/x86/x86: bus_space.c

Log Message:
x86: Cite reference for bus_space_barrier memory ordering rules.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/x86/x86/bus_space.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/x86/x86/bus_space.c
diff -u src/sys/arch/x86/x86/bus_space.c:1.46 src/sys/arch/x86/x86/bus_space.c:1.47
--- src/sys/arch/x86/x86/bus_space.c:1.46	Thu Oct  7 12:52:27 2021
+++ src/sys/arch/x86/x86/bus_space.c	Sun Jul 17 08:33:48 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_space.c,v 1.46 2021/10/07 12:52:27 msaitoh Exp $	*/
+/*	$NetBSD: bus_space.c,v 1.47 2022/07/17 08:33:48 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_space.c,v 1.46 2021/10/07 12:52:27 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_space.c,v 1.47 2022/07/17 08:33:48 riastradh Exp $");
 
 #include 
 #include 
@@ -899,6 +899,14 @@ bus_space_barrier(bus_space_tag_t tag, b
 	 * consulting the page tables), so just issue the fence
 	 * unconditionally.  Chances are either it's necessary or the
 	 * cost is small in comparison to device register I/O.
+	 *
+	 * Reference:
+	 *
+	 *	AMD64 Architecture Programmer's Manual, Volume 2:
+	 *	System Programming, 24593--Rev. 3.38--November 2021,
+	 *	Sec. 7.4.2 Memory Barrier Interaction with Memory
+	 *	Types, Table 7-3, p. 196.
+	 *	https://web.archive.org/web/20220625040004/https://www.amd.com/system/files/TechDocs/24593.pdf#page=256
 	 */
 	switch (flags) {
 	case 0: