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

2020-02-13 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Feb 14 07:23:24 UTC 2020

Modified Files:
src/sys/arch/arm/arm32: genassym.cf

Log Message:
Sort define CI_*. NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/sys/arch/arm/arm32/genassym.cf

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

Modified files:

Index: src/sys/arch/arm/arm32/genassym.cf
diff -u src/sys/arch/arm/arm32/genassym.cf:1.85 src/sys/arch/arm/arm32/genassym.cf:1.86
--- src/sys/arch/arm/arm32/genassym.cf:1.85	Wed Jan 29 19:29:23 2020
+++ src/sys/arch/arm/arm32/genassym.cf	Fri Feb 14 07:23:24 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.85 2020/01/29 19:29:23 skrll Exp $
+#	$NetBSD: genassym.cf,v 1.86 2020/02/14 07:23:24 skrll Exp $
 
 # Copyright (c) 1982, 1990 The Regents of the University of California.
 # All rights reserved.
@@ -220,24 +220,24 @@ define	CF_SLEEP		offsetof(struct cpu_fun
 define	CF_CONTROL		offsetof(struct cpu_functions, cf_control)
 
 define	CI_ARM_CPUID		offsetof(struct cpu_info, ci_arm_cpuid)
-define	CI_CURLWP		offsetof(struct cpu_info, ci_curlwp)
-define	CI_CPL			offsetof(struct cpu_info, ci_cpl)
 define	CI_ASTPENDING		offsetof(struct cpu_info, ci_astpending)
+define	CI_CPL			offsetof(struct cpu_info, ci_cpl)
+define	CI_CURLWP		offsetof(struct cpu_info, ci_curlwp)
 define	CI_INTR_DEPTH		offsetof(struct cpu_info, ci_intr_depth)
 define	CI_MTX_COUNT		offsetof(struct cpu_info, ci_mtx_count)
+define	CI_LASTLWP		offsetof(struct cpu_info, ci_lastlwp)
 define	CI_UNDEFSAVE		offsetof(struct cpu_info, ci_undefsave[0])
+define	CI_IDLELWP		offsetof(struct cpu_info, ci_data.cpu_idlelwp)
+define	CI_CC_NINTR		offsetof(struct cpu_info, ci_data.cpu_nintr)
 if defined(EXEC_AOUT)
 define	CI_CTRL			offsetof(struct cpu_info, ci_ctrl)
 endif
 ifdef __HAVE_FAST_SOFTINTS
 define	CI_SOFTINTS		offsetof(struct cpu_info, ci_softints)
 endif
-define	CI_IDLELWP		offsetof(struct cpu_info, ci_data.cpu_idlelwp)
-define	CI_CC_NINTR		offsetof(struct cpu_info, ci_data.cpu_nintr)
 ifdef FPU_VFP
 define	CI_VFP_ID		offsetof(struct cpu_info, ci_vfp_id)
 endif
-define	CI_LASTLWP		offsetof(struct cpu_info, ci_lastlwp)
 
 define	VFP_FPEXC_EN		VFP_FPEXC_EN
 



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

2020-02-13 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Feb 14 07:21:02 UTC 2020

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

Log Message:
sort __HAVE_* defines.  NFCI


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/aarch64/include/types.h

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

Modified files:

Index: src/sys/arch/aarch64/include/types.h
diff -u src/sys/arch/aarch64/include/types.h:1.13 src/sys/arch/aarch64/include/types.h:1.14
--- src/sys/arch/aarch64/include/types.h:1.13	Fri Dec  6 18:16:22 2019
+++ src/sys/arch/aarch64/include/types.h	Fri Feb 14 07:21:02 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: types.h,v 1.13 2019/12/06 18:16:22 kamil Exp $ */
+/* $NetBSD: types.h,v 1.14 2020/02/14 07:21:02 skrll Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -92,19 +92,19 @@ typedef __uint64_t __register_t;
 #define __SIMPLELOCK_LOCKED	1
 #define __SIMPLELOCK_UNLOCKED	0
 
+#define __HAVE_ATOMIC64_OPS
+#define __HAVE_COMMON___TLS_GET_ADDR
+#define __HAVE_CPU_COUNTER
+#define __HAVE_CPU_DATA_FIRST
 #define __HAVE_FAST_SOFTINTS
+#define __HAVE_MINIMAL_EMUL
 #define __HAVE_MM_MD_DIRECT_MAPPED_PHYS
 #define __HAVE_MM_MD_KERNACC
-#define __HAVE_CPU_COUNTER
-#define __HAVE_SYSCALL_INTERN
 #define __HAVE_NEW_STYLE_BUS_H
-#define __HAVE_MINIMAL_EMUL
-#define __HAVE_CPU_DATA_FIRST
-#define __HAVE___LWP_GETPRIVATE_FAST
-#define __HAVE_COMMON___TLS_GET_ADDR
-#define __HAVE_TLS_VARIANT_I
 #define __HAVE_OLD_DISKLABEL	/* compatibility */
-#define __HAVE_ATOMIC64_OPS
+#define __HAVE_SYSCALL_INTERN
+#define __HAVE_TLS_VARIANT_I
+#define __HAVE___LWP_GETPRIVATE_FAST
 
 #if defined(_KERNEL) || defined(_KMEMUSER)
 #define PCU_FPU			0



CVS commit: src/sys/external/bsd

2020-02-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Feb 14 04:38:48 UTC 2020

Modified Files:
src/sys/external/bsd/common/include/linux: list.h
src/sys/external/bsd/drm2/dist/drm: drm_edid.c
src/sys/external/bsd/drm2/dist/drm/nouveau: nouveau_drm.c nouveau_gem.c
src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/timer:
nouveau_nvkm_subdev_timer_base.c
src/sys/external/bsd/drm2/include/linux: nbsd-namespace.h

Log Message:
Add LIST_HEAD to  too.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/external/bsd/common/include/linux/list.h
cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm2/dist/drm/drm_edid.c
cvs rdiff -u -r1.18 -r1.19 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c
cvs rdiff -u -r1.9 -r1.10 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c
cvs rdiff -u -r1.2 -r1.3 \

src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/timer/nouveau_nvkm_subdev_timer_base.c
cvs rdiff -u -r1.1 -r1.2 \
src/sys/external/bsd/drm2/include/linux/nbsd-namespace.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/list.h
diff -u src/sys/external/bsd/common/include/linux/list.h:1.18 src/sys/external/bsd/common/include/linux/list.h:1.19
--- src/sys/external/bsd/common/include/linux/list.h:1.18	Mon Aug 27 13:56:58 2018
+++ src/sys/external/bsd/common/include/linux/list.h	Fri Feb 14 04:38:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: list.h,v 1.18 2018/08/27 13:56:58 riastradh Exp $	*/
+/*	$NetBSD: list.h,v 1.19 2020/02/14 04:38:48 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -61,6 +61,8 @@ struct list_head {
 
 #define	LIST_HEAD_INIT(name)	{ .prev = &(name), .next = &(name) }
 
+#define	LINUX_LIST_HEAD(name)	struct list_head name = LIST_HEAD_INIT(name)
+
 static inline void
 INIT_LIST_HEAD(struct list_head *head)
 {

Index: src/sys/external/bsd/drm2/dist/drm/drm_edid.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_edid.c:1.6 src/sys/external/bsd/drm2/dist/drm/drm_edid.c:1.7
--- src/sys/external/bsd/drm2/dist/drm/drm_edid.c:1.6	Mon Aug 27 04:58:19 2018
+++ src/sys/external/bsd/drm2/dist/drm/drm_edid.c	Fri Feb 14 04:38:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_edid.c,v 1.6 2018/08/27 04:58:19 riastradh Exp $	*/
+/*	$NetBSD: drm_edid.c,v 1.7 2020/02/14 04:38:48 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2006 Luc Verhaegen (quirks list)
@@ -30,7 +30,7 @@
  * DEALINGS IN THE SOFTWARE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drm_edid.c,v 1.6 2018/08/27 04:58:19 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_edid.c,v 1.7 2020/02/14 04:38:48 riastradh Exp $");
 
 #include 
 #include 
@@ -48,6 +48,8 @@ __KERNEL_RCSID(0, "$NetBSD: drm_edid.c,v
 #include 
 #include 
 
+#include 
+
 #define version_greater(edid, maj, min) \
 	(((edid)->version > (maj)) || \
 	 ((edid)->version == (maj) && (edid)->revision > (min)))
@@ -2673,7 +2675,7 @@ add_alternate_cea_modes(struct drm_conne
 {
 	struct drm_device *dev = connector->dev;
 	struct drm_display_mode *mode, *tmp;
-	struct list_head list = LIST_HEAD_INIT(list);
+	LIST_HEAD(list);
 	int modes = 0;
 
 	/* Don't add CEA modes if the CEA extension block is missing */

Index: src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c:1.18 src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c:1.19
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c:1.18	Fri Feb 14 04:35:20 2020
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c	Fri Feb 14 04:38:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_drm.c,v 1.18 2020/02/14 04:35:20 riastradh Exp $	*/
+/*	$NetBSD: nouveau_drm.c,v 1.19 2020/02/14 04:38:48 riastradh Exp $	*/
 
 /*
  * Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nouveau_drm.c,v 1.18 2020/02/14 04:35:20 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_drm.c,v 1.19 2020/02/14 04:38:48 riastradh Exp $");
 
 #include 
 #include 
@@ -61,7 +61,11 @@ __KERNEL_RCSID(0, "$NetBSD: nouveau_drm.
 #include "nouveau_platform.h"
 #include "nouveau_ttm.h"
 
+#ifdef __NetBSD__
+#include 
+#include 
 #include 
+#endif
 
 MODULE_PARM_DESC(config, "option string to pass to driver core");
 char *nouveau_config;
@@ -949,8 +953,6 @@ nouveau_ioctls[] = {
 };
 
 #ifdef __NetBSD__
-#include 
-#include 
 static int			/* XXX expose to ioc32 */
 nouveau_ioctl_override(struct file *fp, unsigned long cmd, void *data)
 {

Index: src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c:1.9 src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c:1.10
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c:1.9	Sun Jan 27 02:08:42 2019
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_gem.c	Fri Feb 14 04:38:48 2020
@@ -1,4 +1

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

2020-02-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Feb 14 04:37:29 UTC 2020

Modified Files:
src/sys/external/bsd/drm2/dist/drm: drm_crtc.c drm_fb_helper.c
drm_prime.c
src/sys/external/bsd/drm2/dist/drm/nouveau: nouveau_abi16.c
src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04:
nouveau_dispnv04_arb.c
src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/disp:
nouveau_nvkm_engine_disp_dport.c
src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/bios:
nouveau_nvkm_subdev_bios_pll.c
src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/devinit:
nouveau_nvkm_subdev_devinit_nv04.c
src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mxm:
nouveau_nvkm_subdev_mxm_nv50.c
src/sys/external/bsd/drm2/dist/drm/radeon: atombios.h
src/sys/external/bsd/drm2/dist/drm/ttm: ttm_bo.c ttm_bo_util.c
src/sys/external/bsd/drm2/dist/drm/vmwgfx: vmwgfx_kms.c

Log Message:
Revert cosmetic changes.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/external/bsd/drm2/dist/drm/drm_crtc.c \
src/sys/external/bsd/drm2/dist/drm/drm_fb_helper.c
cvs rdiff -u -r1.8 -r1.9 src/sys/external/bsd/drm2/dist/drm/drm_prime.c
cvs rdiff -u -r1.4 -r1.5 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_abi16.c
cvs rdiff -u -r1.3 -r1.4 \
src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_arb.c
cvs rdiff -u -r1.3 -r1.4 \

src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/disp/nouveau_nvkm_engine_disp_dport.c
cvs rdiff -u -r1.2 -r1.3 \

src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/bios/nouveau_nvkm_subdev_bios_pll.c
cvs rdiff -u -r1.2 -r1.3 \

src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/devinit/nouveau_nvkm_subdev_devinit_nv04.c
cvs rdiff -u -r1.2 -r1.3 \

src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mxm/nouveau_nvkm_subdev_mxm_nv50.c
cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm2/dist/drm/radeon/atombios.h
cvs rdiff -u -r1.17 -r1.18 src/sys/external/bsd/drm2/dist/drm/ttm/ttm_bo.c \
src/sys/external/bsd/drm2/dist/drm/ttm/ttm_bo_util.c
cvs rdiff -u -r1.5 -r1.6 \
src/sys/external/bsd/drm2/dist/drm/vmwgfx/vmwgfx_kms.c

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/drm_crtc.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_crtc.c:1.14 src/sys/external/bsd/drm2/dist/drm/drm_crtc.c:1.15
--- src/sys/external/bsd/drm2/dist/drm/drm_crtc.c:1.14	Fri Feb 14 04:36:55 2020
+++ src/sys/external/bsd/drm2/dist/drm/drm_crtc.c	Fri Feb 14 04:37:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_crtc.c,v 1.14 2020/02/14 04:36:55 riastradh Exp $	*/
+/*	$NetBSD: drm_crtc.c,v 1.15 2020/02/14 04:37:27 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2006-2008 Intel Corporation
@@ -32,7 +32,7 @@
  *  Jesse Barnes 
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drm_crtc.c,v 1.14 2020/02/14 04:36:55 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_crtc.c,v 1.15 2020/02/14 04:37:27 riastradh Exp $");
 
 #include 
 #include 
@@ -3065,8 +3065,7 @@ int drm_mode_addfb(struct drm_device *de
 		   void *data, struct drm_file *file_priv)
 {
 	struct drm_mode_fb_cmd *or = data;
-	static const struct drm_mode_fb_cmd2 zero_fbcmd;
-	struct drm_mode_fb_cmd2 r = zero_fbcmd;
+	struct drm_mode_fb_cmd2 r = {};
 	int ret;
 
 	/* convert to new format and call new ioctl */
Index: src/sys/external/bsd/drm2/dist/drm/drm_fb_helper.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_fb_helper.c:1.14 src/sys/external/bsd/drm2/dist/drm/drm_fb_helper.c:1.15
--- src/sys/external/bsd/drm2/dist/drm/drm_fb_helper.c:1.14	Fri Feb 14 04:37:09 2020
+++ src/sys/external/bsd/drm2/dist/drm/drm_fb_helper.c	Fri Feb 14 04:37:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_fb_helper.c,v 1.14 2020/02/14 04:37:09 riastradh Exp $	*/
+/*	$NetBSD: drm_fb_helper.c,v 1.15 2020/02/14 04:37:27 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2006-2009 Red Hat Inc.
@@ -30,7 +30,7 @@
  *  Jesse Barnes 
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drm_fb_helper.c,v 1.14 2020/02/14 04:37:09 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_fb_helper.c,v 1.15 2020/02/14 04:37:27 riastradh Exp $");
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
@@ -584,7 +584,7 @@ static struct sysrq_key_op sysrq_drm_fb_
 	.action_msg = "Restore framebuffer console",
 };
 #else
-static struct sysrq_key_op sysrq_drm_fb_helper_restore_op;
+static struct sysrq_key_op sysrq_drm_fb_helper_restore_op = { };
 #endif
 
 #ifndef __NetBSD__		/* XXX fb info */

Index: src/sys/external/bsd/drm2/dist/drm/drm_prime.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_prime.c:1.8 src/sys/external/bsd/drm2/dist/drm/drm_prime.c:1.9
--- src/sys/external/bsd/drm2/dist/drm/drm_prime.c:1.8	Fri Feb 14 04:35:19 2020
+++ src/sys/external/bsd/drm2/dist/drm/drm_prime.c	Fri Feb 14 04:37:27 2020
@

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

2020-02-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Feb 14 04:38:24 UTC 2020

Modified Files:
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu: amdgpu_cs.c amdgpu_gem.c
amdgpu_ttm.c
src/sys/external/bsd/drm2/dist/drm/radeon: radeon_cs.c radeon_gem.c
radeon_ttm.c

Log Message:
Implement drm userptr with uvm_vslock & bus_dmamap_load_uio.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_cs.c
cvs rdiff -u -r1.5 -r1.6 \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gem.c
cvs rdiff -u -r1.4 -r1.5 \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ttm.c
cvs rdiff -u -r1.4 -r1.5 \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_cs.c
cvs rdiff -u -r1.7 -r1.8 \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_gem.c
cvs rdiff -u -r1.15 -r1.16 \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_ttm.c

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_cs.c
diff -u src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_cs.c:1.3 src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_cs.c:1.4
--- src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_cs.c:1.3	Mon Aug 27 14:04:50 2018
+++ src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_cs.c	Fri Feb 14 04:38:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: amdgpu_cs.c,v 1.3 2018/08/27 14:04:50 riastradh Exp $	*/
+/*	$NetBSD: amdgpu_cs.c,v 1.4 2020/02/14 04:38:23 riastradh Exp $	*/
 
 /*
  * Copyright 2008 Jerome Glisse.
@@ -27,7 +27,7 @@
  *Jerome Glisse 
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_cs.c,v 1.3 2018/08/27 14:04:50 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_cs.c,v 1.4 2020/02/14 04:38:23 riastradh Exp $");
 
 #include 
 #include 
@@ -406,7 +406,7 @@ static int amdgpu_cs_parser_relocs(struc
 	struct amdgpu_fpriv *fpriv = p->filp->driver_priv;
 	struct amdgpu_cs_buckets buckets;
 	struct list_head duplicates;
-	bool need_mmap_lock __diagused = false;
+	bool need_mmap_lock = false;
 	int i, r;
 
 	if (p->bo_list) {
@@ -426,9 +426,8 @@ static int amdgpu_cs_parser_relocs(struc
 		list_add(&p->uf_entry.tv.head, &p->validated);
 
 #ifdef __NetBSD__
-	KASSERTMSG(!need_mmap_lock,
-	"someone didn't finish adding support for userptr"
-	" and it wasn't me");
+	if (need_mmap_lock)
+		vm_map_lock_read(&curproc->p_vmspace->vm_map);
 #else
 	if (need_mmap_lock)
 		down_read(¤t->mm->mmap_sem);
@@ -450,7 +449,10 @@ error_validate:
 		ttm_eu_backoff_reservation(&p->ticket, &p->validated);
 
 error_reserve:
-#ifndef __NetBSD__
+#ifdef __NetBSD__
+	if (need_mmap_lock)
+		vm_map_unlock_read(&curproc->p_vmspace->vm_map);
+#else
 	if (need_mmap_lock)
 		up_read(¤t->mm->mmap_sem);
 #endif

Index: src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gem.c
diff -u src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gem.c:1.5 src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gem.c:1.6
--- src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gem.c:1.5	Fri Feb 14 04:35:19 2020
+++ src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gem.c	Fri Feb 14 04:38:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: amdgpu_gem.c,v 1.5 2020/02/14 04:35:19 riastradh Exp $	*/
+/*	$NetBSD: amdgpu_gem.c,v 1.6 2020/02/14 04:38:23 riastradh Exp $	*/
 
 /*
  * Copyright 2008 Advanced Micro Devices, Inc.
@@ -28,7 +28,7 @@
  *  Jerome Glisse
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_gem.c,v 1.5 2020/02/14 04:35:19 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_gem.c,v 1.6 2020/02/14 04:38:23 riastradh Exp $");
 
 #include 
 #include 
@@ -228,15 +228,6 @@ error_unlock:
 int amdgpu_gem_userptr_ioctl(struct drm_device *dev, void *data,
 			 struct drm_file *filp)
 {
-#ifdef __NetBSD__
-	/*
-	 * XXX Too painful to contemplate for now.  If you add this,
-	 * make sure to update amdgpu_cs.c amdgpu_cs_parser_relocs
-	 * (need_mmap_lock), and anything else using
-	 * amdgpu_ttm_tt_has_userptr.
-	 */
-	return -ENODEV;
-#else
 	struct amdgpu_device *adev = dev->dev_private;
 	struct drm_amdgpu_gem_userptr *args = data;
 	struct drm_gem_object *gobj;
@@ -281,17 +272,29 @@ int amdgpu_gem_userptr_ioctl(struct drm_
 	}
 
 	if (args->flags & AMDGPU_GEM_USERPTR_VALIDATE) {
+#ifdef __NetBSD__
+		vm_map_lock_read(&curproc->p_vmspace->vm_map);
+#else
 		down_read(¤t->mm->mmap_sem);
+#endif
 		r = amdgpu_bo_reserve(bo, true);
 		if (r) {
+#ifdef __NetBSD__
+			vm_map_unlock_read(&curproc->p_vmspace->vm_map);
+#else
 			up_read(¤t->mm->mmap_sem);
+#endif
 			goto release_object;
 		}
 
 		amdgpu_ttm_placement_from_domain(bo, AMDGPU_GEM_DOMAIN_GTT);
 		r = ttm_bo_validate(&bo->tbo, &bo->placement, true, false);
 		amdgpu_bo_unreserve(bo);
+#ifdef __NetBSD__
+		vm_map_unlock_read(&curproc->p_vmspace->vm_map);
+#else
 		up_read(¤t->mm->mmap_sem);
+#endif
 		if (r)
 			goto release_object;
 	}
@@ -312,7 +315,

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

2020-02-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Feb 14 04:38:13 UTC 2020

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

Log Message:
Revert unnecessary change.

The only way this logic can reach the reference to stat is if repcnt
goes to zero, which -- since it starts at 4 -- can only happen if we
go through several iterations of the loop, which in turn implies that
stat is initialized.

If GCC still complains about this, it's wrong and should be dealt
with some other way.


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

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_display.c
diff -u src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_display.c:1.5 src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_display.c:1.6
--- src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_display.c:1.5	Sat Feb 23 19:56:51 2019
+++ src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_display.c	Fri Feb 14 04:38:13 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: amdgpu_display.c,v 1.5 2019/02/23 19:56:51 kamil Exp $	*/
+/*	$NetBSD: amdgpu_display.c,v 1.6 2020/02/14 04:38:13 riastradh Exp $	*/
 
 /*
  * Copyright 2007-8 Advanced Micro Devices, Inc.
@@ -26,7 +26,7 @@
  *  Alex Deucher
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_display.c,v 1.5 2019/02/23 19:56:51 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_display.c,v 1.6 2020/02/14 04:38:13 riastradh Exp $");
 
 #include 
 #include 
@@ -101,8 +101,7 @@ static void amdgpu_flip_work_func(struct
 	 * In practice this won't execute very often unless on very fast
 	 * machines because the time window for this to happen is very small.
 	 */
-	if (amdgpuCrtc->enabled) {
-	while (--repcnt) {
+	while (amdgpuCrtc->enabled && --repcnt) {
 		/* GET_DISTANCE_TO_VBLANKSTART returns distance to real vblank
 		 * start in hpos, and to the "fudged earlier" vblank start in
 		 * vpos.
@@ -135,7 +134,6 @@ static void amdgpu_flip_work_func(struct
  "hpos %d\n", work->crtc_id, min_udelay,
  vblank->framedur_ns / 1000,
  vblank->linedur_ns / 1000, stat, vpos, hpos);
-	}
 
 	/* do the flip (mmio) */
 	adev->mode_info.funcs->page_flip(adev, work->crtc_id, work->base);



CVS commit: src/sys/external/bsd

2020-02-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Feb 14 04:38:36 UTC 2020

Modified Files:
src/sys/external/bsd/common/include/linux: kernel.h
src/sys/external/bsd/drm2/dist/drm: drm_modes.c

Log Message:
Implement (obsolete) simple_strtol stub; reduce diff.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/external/bsd/common/include/linux/kernel.h
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/drm2/dist/drm/drm_modes.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/common/include/linux/kernel.h
diff -u src/sys/external/bsd/common/include/linux/kernel.h:1.23 src/sys/external/bsd/common/include/linux/kernel.h:1.24
--- src/sys/external/bsd/common/include/linux/kernel.h:1.23	Mon Sep 30 12:20:54 2019
+++ src/sys/external/bsd/common/include/linux/kernel.h	Fri Feb 14 04:38:36 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kernel.h,v 1.23 2019/09/30 12:20:54 christos Exp $	*/
+/*	$NetBSD: kernel.h,v 1.24 2020/02/14 04:38:36 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -196,6 +196,18 @@ kstrtol(const char *s, unsigned base, lo
 	return 0;
 }
 
+static inline long
+simple_strtol(const char *s, char **endp, unsigned base)
+{
+	long v;
+
+	*endp = NULL;		/* paranoia */
+	v = strtoll(s, endp, base);
+	if (v < LONG_MIN || LONG_MAX < v)
+		return 0;
+	return v;
+}
+
 static __inline char * __printflike(2, 0)
 kvasprintf(gfp_t gfp, const char *fmt, va_list va)
 {

Index: src/sys/external/bsd/drm2/dist/drm/drm_modes.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_modes.c:1.7 src/sys/external/bsd/drm2/dist/drm/drm_modes.c:1.8
--- src/sys/external/bsd/drm2/dist/drm/drm_modes.c:1.7	Mon Aug 27 04:58:19 2018
+++ src/sys/external/bsd/drm2/dist/drm/drm_modes.c	Fri Feb 14 04:38:36 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_modes.c,v 1.7 2018/08/27 04:58:19 riastradh Exp $	*/
+/*	$NetBSD: drm_modes.c,v 1.8 2020/02/14 04:38:36 riastradh Exp $	*/
 
 /*
  * Copyright © 1997-2003 by The XFree86 Project, Inc.
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drm_modes.c,v 1.7 2018/08/27 04:58:19 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_modes.c,v 1.8 2020/02/14 04:38:36 riastradh Exp $");
 
 #include 
 #include 
@@ -1236,7 +1236,7 @@ bool drm_mode_parse_command_line_for_con
 	const char *name;
 	unsigned int namelen;
 	bool res_specified = false, bpp_specified = false, refresh_specified = false;
-	long xres = 0, yres = 0, bpp = 32, refresh = 0;
+	unsigned int xres = 0, yres = 0, bpp = 32, refresh = 0;
 	bool yres_specified = false, cvt = false, rb = false;
 	bool interlace = false, margins = false, was_digit = false;
 	int i;
@@ -1261,35 +1261,26 @@ bool drm_mode_parse_command_line_for_con
 		case '@':
 			if (!refresh_specified && !bpp_specified &&
 			!yres_specified && !cvt && !rb && was_digit) {
-if (kstrtol(&name[i+1], 10, &refresh) == 0) {
-	refresh_specified = true;
-	was_digit = false;
-} else {
-	goto done;
-}
+refresh = simple_strtol(&name[i+1], NULL, 10);
+refresh_specified = true;
+was_digit = false;
 			} else
 goto done;
 			break;
 		case '-':
 			if (!bpp_specified && !yres_specified && !cvt &&
 			!rb && was_digit) {
-if (kstrtol(&name[i+1], 10, &bpp) == 0) {
-	bpp_specified = true;
-	was_digit = false;
-} else {
-	goto done;
-}
+bpp = simple_strtol(&name[i+1], NULL, 10);
+bpp_specified = true;
+was_digit = false;
 			} else
 goto done;
 			break;
 		case 'x':
 			if (!yres_specified && was_digit) {
-if (kstrtol(&name[i+1], 10, &yres) == 0) {
-	yres_specified = true;
-	was_digit = false;
-} else {
-	goto done;
-}
+yres = simple_strtol(&name[i+1], NULL, 10);
+yres_specified = true;
+was_digit = false;
 			} else
 goto done;
 			break;
@@ -1347,8 +1338,8 @@ bool drm_mode_parse_command_line_for_con
 	}
 
 	if (i < 0 && yres_specified) {
-		char *ch = NULL;
-		xres = strtoll(name, &ch, 10);
+		char *ch;
+		xres = simple_strtol(name, &ch, 10);
 		if ((ch != NULL) && (*ch == 'x'))
 			res_specified = true;
 		else



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

2020-02-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Feb 14 04:37:43 UTC 2020

Modified Files:
src/sys/external/bsd/drm2/dist/drm/radeon: radeon.h
src/sys/external/bsd/drm2/dist/drm/via: via_dmablit.c via_irq.c
via_video.c
src/sys/external/bsd/drm2/include/drm: drm_wait_netbsd.h

Log Message:
DRM_HZ -> HZ, to reduce diffs.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/drm2/dist/drm/radeon/radeon.h
cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm2/dist/drm/via/via_dmablit.c \
src/sys/external/bsd/drm2/dist/drm/via/via_irq.c \
src/sys/external/bsd/drm2/dist/drm/via/via_video.c
cvs rdiff -u -r1.15 -r1.16 \
src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.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/radeon/radeon.h
diff -u src/sys/external/bsd/drm2/dist/drm/radeon/radeon.h:1.7 src/sys/external/bsd/drm2/dist/drm/radeon/radeon.h:1.8
--- src/sys/external/bsd/drm2/dist/drm/radeon/radeon.h:1.7	Sun Jan 26 14:36:35 2020
+++ src/sys/external/bsd/drm2/dist/drm/radeon/radeon.h	Fri Feb 14 04:37:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: radeon.h,v 1.7 2020/01/26 14:36:35 jmcneill Exp $	*/
+/*	$NetBSD: radeon.h,v 1.8 2020/02/14 04:37:43 riastradh Exp $	*/
 
 /*
  * Copyright 2008 Advanced Micro Devices, Inc.
@@ -127,7 +127,7 @@ extern int radeon_mst;
  * symbol;
  */
 #define RADEON_MAX_USEC_TIMEOUT			10	/* 100 ms */
-#define RADEON_FENCE_JIFFIES_TIMEOUT		(DRM_HZ / 2)
+#define RADEON_FENCE_JIFFIES_TIMEOUT		(HZ / 2)
 /* RADEON_IB_POOL_SIZE must be a power of 2 */
 #define RADEON_IB_POOL_SIZE			16
 #define RADEON_DEBUGFS_MAX_COMPONENTS		32

Index: src/sys/external/bsd/drm2/dist/drm/via/via_dmablit.c
diff -u src/sys/external/bsd/drm2/dist/drm/via/via_dmablit.c:1.6 src/sys/external/bsd/drm2/dist/drm/via/via_dmablit.c:1.7
--- src/sys/external/bsd/drm2/dist/drm/via/via_dmablit.c:1.6	Mon Aug 27 04:58:37 2018
+++ src/sys/external/bsd/drm2/dist/drm/via/via_dmablit.c	Fri Feb 14 04:37:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: via_dmablit.c,v 1.6 2018/08/27 04:58:37 riastradh Exp $	*/
+/*	$NetBSD: via_dmablit.c,v 1.7 2020/02/14 04:37:43 riastradh Exp $	*/
 
 /* via_dmablit.c -- PCI DMA BitBlt support for the VIA Unichrome/Pro
  *
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: via_dmablit.c,v 1.6 2018/08/27 04:58:37 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: via_dmablit.c,v 1.7 2020/02/14 04:37:43 riastradh Exp $");
 
 #include 
 #include 
@@ -514,7 +514,7 @@ via_dmablit_handler(struct drm_device *d
 
 		via_abort_dmablit(dev, engine);
 		blitq->aborting = 1;
-		blitq->end = jiffies + DRM_HZ;
+		blitq->end = jiffies + HZ;
 	}
 
 	if (!blitq->is_active) {
@@ -523,7 +523,7 @@ via_dmablit_handler(struct drm_device *d
 			blitq->is_active = 1;
 			blitq->cur = cur;
 			blitq->num_outstanding--;
-			blitq->end = jiffies + DRM_HZ;
+			blitq->end = jiffies + HZ;
 			if (!timer_pending(&blitq->poll_timer))
 mod_timer(&blitq->poll_timer, jiffies + 1);
 		} else {
@@ -603,7 +603,7 @@ via_dmablit_sync(struct drm_device *dev,
 #ifdef __NetBSD__
 	spin_lock(&blitq->blit_lock);
 	if (via_dmablit_active(blitq, engine, handle, &queue)) {
-		DRM_SPIN_WAIT_ON(ret, queue, &blitq->blit_lock, 3*DRM_HZ,
+		DRM_SPIN_WAIT_ON(ret, queue, &blitq->blit_lock, 3*HZ,
 		!via_dmablit_active(blitq, engine, handle, NULL));
 	}
 	spin_unlock(&blitq->blit_lock);
@@ -881,7 +881,7 @@ via_dmablit_grab_slot(drm_via_blitq_t *b
 	while (blitq->num_free == 0) {
 #ifdef __NetBSD__
 		DRM_SPIN_WAIT_ON(ret, &blitq->busy_queue, &blitq->blit_lock,
-		DRM_HZ,
+		HZ,
 		blitq->num_free > 0);
 		/* Map -EINTR to -EAGAIN.  */
 		if (ret == -EINTR)
Index: src/sys/external/bsd/drm2/dist/drm/via/via_irq.c
diff -u src/sys/external/bsd/drm2/dist/drm/via/via_irq.c:1.6 src/sys/external/bsd/drm2/dist/drm/via/via_irq.c:1.7
--- src/sys/external/bsd/drm2/dist/drm/via/via_irq.c:1.6	Mon Aug 27 04:58:37 2018
+++ src/sys/external/bsd/drm2/dist/drm/via/via_irq.c	Fri Feb 14 04:37:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: via_irq.c,v 1.6 2018/08/27 04:58:37 riastradh Exp $	*/
+/*	$NetBSD: via_irq.c,v 1.7 2020/02/14 04:37:43 riastradh Exp $	*/
 
 /* via_irq.c
  *
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: via_irq.c,v 1.6 2018/08/27 04:58:37 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: via_irq.c,v 1.7 2020/02/14 04:37:43 riastradh Exp $");
 
 #include 
 #include 
@@ -256,13 +256,13 @@ via_driver_irq_wait(struct drm_device *d
 	spin_lock(&cur_irq->irq_lock);
 	if (masks[real_irq][2] && !force_sequence) {
 		DRM_SPIN_WAIT_ON(ret, &cur_irq->irq_queue, &cur_irq->irq_lock,
-		3 * DRM_HZ,
+		3 * HZ,
 		((VIA_READ(masks[irq][2]) & masks[irq][3]) ==
 			masks[irq][4]));
 		cur_irq_sequence = cur_irq->irq_received;
 	} else {
 		DRM_SPIN_WAIT_ON(ret, &cur_irq->irq_queue, &cur_irq->irq_lock,
-		3 * DRM_HZ,
+		3

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

2020-02-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Feb 14 04:36:57 UTC 2020

Modified Files:
src/sys/external/bsd/drm2/dist/drm: drm_bufs.c drm_crtc.c drm_ioctl.c
src/sys/external/bsd/drm2/dist/drm/i915: i915_dma.c i915_gem_context.c
i915_gem_execbuffer.c intel_uncore.c
src/sys/external/bsd/drm2/dist/drm/ttm: ttm_bo_util.c ttm_memory.c
src/sys/external/bsd/drm2/dist/drm/via: via_dma.c
src/sys/external/bsd/drm2/drm: drm_fops.c drm_vm.c
src/sys/external/bsd/drm2/include/drm: drm_os_netbsd.h
src/sys/external/bsd/drm2/include/linux: fs.h
Added Files:
src/sys/external/bsd/drm2/include/linux: capability.h
Removed Files:
src/sys/external/bsd/drm2/include/drm: drm_auth_netbsd.h

Log Message:
Reduce diffs by nixing DRM_SUSER macro, deleted upstream long ago.

Instead stub Linux capable(CAP_SYS_ADMIN).


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/drm2/dist/drm/drm_bufs.c
cvs rdiff -u -r1.13 -r1.14 src/sys/external/bsd/drm2/dist/drm/drm_crtc.c
cvs rdiff -u -r1.11 -r1.12 src/sys/external/bsd/drm2/dist/drm/drm_ioctl.c
cvs rdiff -u -r1.30 -r1.31 src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c
cvs rdiff -u -r1.10 -r1.11 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_context.c
cvs rdiff -u -r1.9 -r1.10 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_execbuffer.c
cvs rdiff -u -r1.11 -r1.12 \
src/sys/external/bsd/drm2/dist/drm/i915/intel_uncore.c
cvs rdiff -u -r1.16 -r1.17 \
src/sys/external/bsd/drm2/dist/drm/ttm/ttm_bo_util.c
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/dist/drm/ttm/ttm_memory.c
cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm2/dist/drm/via/via_dma.c
cvs rdiff -u -r1.14 -r1.15 src/sys/external/bsd/drm2/drm/drm_fops.c
cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/drm2/drm/drm_vm.c
cvs rdiff -u -r1.2 -r0 \
src/sys/external/bsd/drm2/include/drm/drm_auth_netbsd.h
cvs rdiff -u -r1.16 -r1.17 \
src/sys/external/bsd/drm2/include/drm/drm_os_netbsd.h
cvs rdiff -u -r0 -r1.1 src/sys/external/bsd/drm2/include/linux/capability.h
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/include/linux/fs.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_bufs.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_bufs.c:1.10 src/sys/external/bsd/drm2/dist/drm/drm_bufs.c:1.11
--- src/sys/external/bsd/drm2/dist/drm/drm_bufs.c:1.10	Fri Feb 14 04:30:04 2020
+++ src/sys/external/bsd/drm2/dist/drm/drm_bufs.c	Fri Feb 14 04:36:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_bufs.c,v 1.10 2020/02/14 04:30:04 riastradh Exp $	*/
+/*	$NetBSD: drm_bufs.c,v 1.11 2020/02/14 04:36:55 riastradh Exp $	*/
 
 /*
  * Legacy: Generic DRM Buffer Management
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drm_bufs.c,v 1.10 2020/02/14 04:30:04 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_bufs.c,v 1.11 2020/02/14 04:36:55 riastradh Exp $");
 
 #include 
 #include 
@@ -424,17 +424,8 @@ int drm_legacy_addmap_ioctl(struct drm_d
 	struct drm_map_list *maplist;
 	int err;
 
-#ifdef __NetBSD__
-#  if 0/* XXX Old drm did this.  */
-	if (!(dev->flags & (FREAD | FWRITE)))
-		return -EACCES;
-#  endif
-	if (!(DRM_SUSER() || map->type == _DRM_AGP || map->type == _DRM_SHM))
-		return -EACCES;	/* XXX */
-#else
 	if (!(capable(CAP_SYS_ADMIN) || map->type == _DRM_AGP || map->type == _DRM_SHM))
 		return -EPERM;
-#endif
 
 	err = drm_addmap_core(dev, map->offset, map->size, map->type,
 			  map->flags, &maplist);
@@ -856,13 +847,8 @@ int drm_legacy_addbufs_pci(struct drm_de
 	if (!dma)
 		return -EINVAL;
 
-#ifdef __NetBSD__
-	if (!DRM_SUSER())
-		return -EACCES;	/* XXX */
-#else
 	if (!capable(CAP_SYS_ADMIN))
 		return -EPERM;
-#endif
 
 	count = request->count;
 	order = order_base_2(request->size);
@@ -1064,13 +1050,8 @@ static int drm_legacy_addbufs_sg(struct 
 	if (!dma)
 		return -EINVAL;
 
-#ifdef __NetBSD__
-	if (!DRM_SUSER())
-		return -EACCES;	/* XXX */
-#else
 	if (!capable(CAP_SYS_ADMIN))
 		return -EPERM;
-#endif
 
 	count = request->count;
 	order = order_base_2(request->size);

Index: src/sys/external/bsd/drm2/dist/drm/drm_crtc.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_crtc.c:1.13 src/sys/external/bsd/drm2/dist/drm/drm_crtc.c:1.14
--- src/sys/external/bsd/drm2/dist/drm/drm_crtc.c:1.13	Fri Feb 14 04:35:19 2020
+++ src/sys/external/bsd/drm2/dist/drm/drm_crtc.c	Fri Feb 14 04:36:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_crtc.c,v 1.13 2020/02/14 04:35:19 riastradh Exp $	*/
+/*	$NetBSD: drm_crtc.c,v 1.14 2020/02/14 04:36:55 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2006-2008 Intel Corporation
@@ -32,7 +32,7 @@
  *  Jesse Barnes 
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drm_crtc.c,v 1.13 2020/02/14 04:35:19 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_crtc.c,v 1.14 2020/02/14 04:36:55 riastradh Exp $");
 
 #include 
 #i

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

2020-02-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Feb 14 04:37:10 UTC 2020

Modified Files:
src/sys/external/bsd/drm2/dist/drm: drm_fb_helper.c
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu: amdgpu_device.c
amdgpu_fb.c
src/sys/external/bsd/drm2/dist/drm/i915: i915_drv.c intel_fbdev.c
src/sys/external/bsd/drm2/dist/drm/nouveau: nouveau_fbcon.c
src/sys/external/bsd/drm2/dist/drm/radeon: radeon_device.c
src/sys/external/bsd/drm2/include/linux: console.h fb.h

Log Message:
Stub out console_lock/unlock and drm_fb_helper_set_suspend.

Reduce some more diffs.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/external/bsd/drm2/dist/drm/drm_fb_helper.c
cvs rdiff -u -r1.5 -r1.6 \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c
cvs rdiff -u -r1.4 -r1.5 \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_fb.c
cvs rdiff -u -r1.17 -r1.18 src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.c
cvs rdiff -u -r1.9 -r1.10 \
src/sys/external/bsd/drm2/dist/drm/i915/intel_fbdev.c
cvs rdiff -u -r1.8 -r1.9 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fbcon.c
cvs rdiff -u -r1.8 -r1.9 \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_device.c
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/include/linux/console.h
cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm2/include/linux/fb.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_fb_helper.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_fb_helper.c:1.13 src/sys/external/bsd/drm2/dist/drm/drm_fb_helper.c:1.14
--- src/sys/external/bsd/drm2/dist/drm/drm_fb_helper.c:1.13	Tue Nov  5 04:09:51 2019
+++ src/sys/external/bsd/drm2/dist/drm/drm_fb_helper.c	Fri Feb 14 04:37:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_fb_helper.c,v 1.13 2019/11/05 04:09:51 msaitoh Exp $	*/
+/*	$NetBSD: drm_fb_helper.c,v 1.14 2020/02/14 04:37:09 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2006-2009 Red Hat Inc.
@@ -30,7 +30,7 @@
  *  Jesse Barnes 
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drm_fb_helper.c,v 1.13 2019/11/05 04:09:51 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_fb_helper.c,v 1.14 2020/02/14 04:37:09 riastradh Exp $");
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
@@ -864,7 +864,11 @@ void drm_fb_helper_fini(struct drm_fb_he
 }
 EXPORT_SYMBOL(drm_fb_helper_fini);
 
-#ifndef __NetBSD__		/* XXX fb info */
+#ifdef __NetBSD__		/* XXX fb info */
+void drm_fb_helper_set_suspend(struct drm_fb_helper *fb_helper, int state)
+{
+}
+#else
 /**
  * drm_fb_helper_unlink_fbi - wrapper around unlink_framebuffer
  * @fb_helper: driver-allocated fbdev helper

Index: src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c
diff -u src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c:1.5 src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c:1.6
--- src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c:1.5	Fri Feb 14 04:35:19 2020
+++ src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c	Fri Feb 14 04:37:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: amdgpu_device.c,v 1.5 2020/02/14 04:35:19 riastradh Exp $	*/
+/*	$NetBSD: amdgpu_device.c,v 1.6 2020/02/14 04:37:09 riastradh Exp $	*/
 
 /*
  * Copyright 2008 Advanced Micro Devices, Inc.
@@ -28,7 +28,7 @@
  *  Jerome Glisse
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_device.c,v 1.5 2020/02/14 04:35:19 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_device.c,v 1.6 2020/02/14 04:37:09 riastradh Exp $");
 
 #include 
 #include 
@@ -1893,13 +1893,11 @@ int amdgpu_suspend_kms(struct drm_device
 	}
 #endif
 
-#ifndef __NetBSD__		/* XXX amdgpu fb */
 	if (fbcon) {
 		console_lock();
 		amdgpu_fbdev_set_suspend(adev, 1);
 		console_unlock();
 	}
-#endif
 	return 0;
 }
 
@@ -1922,11 +1920,9 @@ int amdgpu_resume_kms(struct drm_device 
 	if (dev->switch_power_state == DRM_SWITCH_POWER_OFF)
 		return 0;
 
-#ifndef __NetBSD__		/* XXX amdgpu fb */
 	if (fbcon) {
 		console_lock();
 	}
-#endif
 #ifndef __NetBSD__		/* pmf handles this for us.  */
 	if (resume) {
 		pci_set_power_state(dev->pdev, PCI_D0);
@@ -1957,10 +1953,8 @@ int amdgpu_resume_kms(struct drm_device 
 
 	r = amdgpu_late_init(adev);
 	if (r) {
-#ifndef __NetBSD__
 		if (fbcon)
 			console_unlock();
-#endif
 		return r;
 	}
 
@@ -2012,12 +2006,10 @@ int amdgpu_resume_kms(struct drm_device 
 	dev->dev->power.disable_depth--;
 #endif
 
-#ifndef __NetBSD__		/* XXX amdgpu fb */
 	if (fbcon) {
 		amdgpu_fbdev_set_suspend(adev, 0);
 		console_unlock();
 	}
-#endif
 
 	return 0;
 }

Index: src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_fb.c
diff -u src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_fb.c:1.4 src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_fb.c:1.5
--- src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_fb.c:1.4	Fri Feb 14 04:35:19 2020
+++ src/sys/external/bsd/drm2/dist/dr

CVS commit: src/sys

2020-02-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Feb 14 04:36:33 UTC 2020

Modified Files:
src/sys/secmodel: secmodel.h
src/sys/sys: kauth.h

Log Message:
Provide necessary forward declarations or includes.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/secmodel/secmodel.h
cvs rdiff -u -r1.82 -r1.83 src/sys/sys/kauth.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/secmodel/secmodel.h
diff -u src/sys/secmodel/secmodel.h:1.4 src/sys/secmodel/secmodel.h:1.5
--- src/sys/secmodel/secmodel.h:1.4	Sun Dec  4 19:24:59 2011
+++ src/sys/secmodel/secmodel.h	Fri Feb 14 04:36:33 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: secmodel.h,v 1.4 2011/12/04 19:24:59 jym Exp $ */
+/* $NetBSD: secmodel.h,v 1.5 2020/02/14 04:36:33 riastradh Exp $ */
 /*-
  * Copyright (c) 2006, 2011 Elad Efrat 
  * All rights reserved.
@@ -29,6 +29,8 @@
 #ifndef _SECMODEL_SECMODEL_H_
 #define	_SECMODEL_SECMODEL_H_
 
+#include 
+
 #include 
 
 void secmodel_init(void);

Index: src/sys/sys/kauth.h
diff -u src/sys/sys/kauth.h:1.82 src/sys/sys/kauth.h:1.83
--- src/sys/sys/kauth.h:1.82	Wed Apr 10 18:49:04 2019
+++ src/sys/sys/kauth.h	Fri Feb 14 04:36:33 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: kauth.h,v 1.82 2019/04/10 18:49:04 maxv Exp $ */
+/* $NetBSD: kauth.h,v 1.83 2020/02/14 04:36:33 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2005, 2006 Elad Efrat   
@@ -46,6 +46,8 @@ struct tty;
 struct vnode;
 struct cwdinfo;
 
+enum uio_seg;
+
 /* Types. */
 typedef struct kauth_scope *kauth_scope_t;
 typedef struct kauth_listener  *kauth_listener_t;



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

2020-02-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Feb 14 04:35:20 UTC 2020

Modified Files:
src/sys/external/bsd/drm2/dist/drm: drm_crtc.c drm_dp_helper.c
drm_dp_mst_topology.c drm_drv.c drm_gem.c drm_global.c drm_prime.c
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu: amdgpu_bo_list.c
amdgpu_ctx.c amdgpu_cz_smc.c amdgpu_device.c amdgpu_fb.c
amdgpu_fence.c amdgpu_gem.c amdgpu_gfx_v8_0.c amdgpu_i2c.c
amdgpu_kms.c amdgpu_object.c amdgpu_sdma_v2_4.c amdgpu_sdma_v3_0.c
amdgpu_ucode.c amdgpu_uvd.c amdgpu_vm.c
src/sys/external/bsd/drm2/dist/drm/i915: i915_dma.c i915_gem.c
i915_gem_render_state.c i915_gem_stolen.c intel_display.c
intel_fbc.c intel_i2c.c intel_lrc.c intel_pm.c intel_psr.c
intel_runtime_pm.c
src/sys/external/bsd/drm2/dist/drm/nouveau: nouveau_drm.c
nouveau_nv84_fence.c
src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04:
nouveau_dispnv04_overlay.c
src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device:
nouveau_nvkm_engine_device_base.c
src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/i2c:
nouveau_nvkm_subdev_i2c_aux.c nouveau_nvkm_subdev_i2c_bus.c
nouveau_nvkm_subdev_i2c_pad.c
src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mmu:
nouveau_nvkm_subdev_mmu_base.c
src/sys/external/bsd/drm2/dist/drm/radeon: radeon_cik.c radeon_device.c
radeon_evergreen_cs.c radeon_fb.c radeon_fence.c radeon_gem.c
radeon_i2c.c radeon_ni.c radeon_object.c radeon_r600.c radeon_si.c
radeon_uvd.c radeon_vm.c
src/sys/external/bsd/drm2/dist/drm/ttm: ttm_bo.c ttm_bo_util.c
Added Files:
src/sys/external/bsd/drm2/include/linux: nbsd-namespace.h

Log Message:
Use a header file hack to cope with Linux/NetBSD namespace clashes.

Currently serves for:

ALIGN
mutex_init
mutex_destroy


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/external/bsd/drm2/dist/drm/drm_crtc.c \
src/sys/external/bsd/drm2/dist/drm/drm_gem.c
cvs rdiff -u -r1.9 -r1.10 src/sys/external/bsd/drm2/dist/drm/drm_dp_helper.c
cvs rdiff -u -r1.3 -r1.4 \
src/sys/external/bsd/drm2/dist/drm/drm_dp_mst_topology.c
cvs rdiff -u -r1.10 -r1.11 src/sys/external/bsd/drm2/dist/drm/drm_drv.c
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/dist/drm/drm_global.c
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/drm2/dist/drm/drm_prime.c
cvs rdiff -u -r1.5 -r1.6 \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_bo_list.c \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_uvd.c
cvs rdiff -u -r1.4 -r1.5 \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ctx.c \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_fence.c \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gem.c \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ucode.c
cvs rdiff -u -r1.3 -r1.4 \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_cz_smc.c \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_fb.c \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_i2c.c \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_kms.c \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_object.c \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_vm.c
cvs rdiff -u -r1.2 -r1.3 \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gfx_v8_0.c
cvs rdiff -u -r1.1 -r1.2 \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_sdma_v2_4.c \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_sdma_v3_0.c
cvs rdiff -u -r1.28 -r1.29 src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c \
src/sys/external/bsd/drm2/dist/drm/i915/intel_display.c
cvs rdiff -u -r1.57 -r1.58 src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c
cvs rdiff -u -r1.9 -r1.10 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_render_state.c
cvs rdiff -u -r1.12 -r1.13 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_stolen.c
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/dist/drm/i915/intel_fbc.c
cvs rdiff -u -r1.17 -r1.18 \
src/sys/external/bsd/drm2/dist/drm/i915/intel_i2c.c
cvs rdiff -u -r1.10 -r1.11 \
src/sys/external/bsd/drm2/dist/drm/i915/intel_lrc.c
cvs rdiff -u -r1.20 -r1.21 src/sys/external/bsd/drm2/dist/drm/i915/intel_pm.c
cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm2/dist/drm/i915/intel_psr.c
cvs rdiff -u -r1.7 -r1.8 \
src/sys/external/bsd/drm2/dist/drm/i915/intel_runtime_pm.c
cvs rdiff -u -r1.17 -r1.18 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_drm.c
cvs rdiff -u -r1.6 -r1.7 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv84_fence.c
cvs rdiff -u -r1.3 -r1.4 \

src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04/nouveau_dispnv04_overlay.c
cvs rdiff -u -r1.8 -r1.9 \

src/sys/external/bsd/drm

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

2020-02-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Feb 14 04:36:12 UTC 2020

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915: i915_debugfs.c i915_dma.c
i915_drv.h i915_irq.c intel_audio.c intel_crt.c intel_ddi.c
intel_display.c intel_dp.c intel_dp_mst.c intel_drv.h intel_dsi.c
intel_dvo.c intel_fbc.c intel_fifo_underrun.c intel_hdmi.c
intel_lvds.c intel_overlay.c intel_panel.c intel_pm.c intel_psr.c
intel_runtime_pm.c intel_sdvo.c intel_sideband.c intel_sprite.c
intel_tv.c

Log Message:
Undo the `enum pipe' -> `enum i915_pipe' rename.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_debugfs.c \
src/sys/external/bsd/drm2/dist/drm/i915/intel_dp_mst.c \
src/sys/external/bsd/drm2/dist/drm/i915/intel_sideband.c
cvs rdiff -u -r1.29 -r1.30 src/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c \
src/sys/external/bsd/drm2/dist/drm/i915/intel_display.c
cvs rdiff -u -r1.30 -r1.31 src/sys/external/bsd/drm2/dist/drm/i915/i915_drv.h
cvs rdiff -u -r1.17 -r1.18 src/sys/external/bsd/drm2/dist/drm/i915/i915_irq.c
cvs rdiff -u -r1.5 -r1.6 \
src/sys/external/bsd/drm2/dist/drm/i915/intel_audio.c \
src/sys/external/bsd/drm2/dist/drm/i915/intel_fbc.c
cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm2/dist/drm/i915/intel_crt.c
cvs rdiff -u -r1.10 -r1.11 \
src/sys/external/bsd/drm2/dist/drm/i915/intel_ddi.c
cvs rdiff -u -r1.20 -r1.21 src/sys/external/bsd/drm2/dist/drm/i915/intel_dp.c
cvs rdiff -u -r1.11 -r1.12 \
src/sys/external/bsd/drm2/dist/drm/i915/intel_drv.h
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/dist/drm/i915/intel_dsi.c \
src/sys/external/bsd/drm2/dist/drm/i915/intel_dvo.c
cvs rdiff -u -r1.2 -r1.3 \
src/sys/external/bsd/drm2/dist/drm/i915/intel_fifo_underrun.c
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/drm2/dist/drm/i915/intel_hdmi.c \
src/sys/external/bsd/drm2/dist/drm/i915/intel_lvds.c \
src/sys/external/bsd/drm2/dist/drm/i915/intel_psr.c \
src/sys/external/bsd/drm2/dist/drm/i915/intel_tv.c
cvs rdiff -u -r1.8 -r1.9 \
src/sys/external/bsd/drm2/dist/drm/i915/intel_overlay.c \
src/sys/external/bsd/drm2/dist/drm/i915/intel_runtime_pm.c
cvs rdiff -u -r1.12 -r1.13 \
src/sys/external/bsd/drm2/dist/drm/i915/intel_panel.c \
src/sys/external/bsd/drm2/dist/drm/i915/intel_sdvo.c
cvs rdiff -u -r1.21 -r1.22 src/sys/external/bsd/drm2/dist/drm/i915/intel_pm.c
cvs rdiff -u -r1.9 -r1.10 \
src/sys/external/bsd/drm2/dist/drm/i915/intel_sprite.c

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/i915/i915_debugfs.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_debugfs.c:1.3 src/sys/external/bsd/drm2/dist/drm/i915/i915_debugfs.c:1.4
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_debugfs.c:1.3	Mon Aug 27 04:58:23 2018
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_debugfs.c	Fri Feb 14 04:36:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_debugfs.c,v 1.3 2018/08/27 04:58:23 riastradh Exp $	*/
+/*	$NetBSD: i915_debugfs.c,v 1.4 2020/02/14 04:36:11 riastradh Exp $	*/
 
 /*
  * Copyright © 2008 Intel Corporation
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i915_debugfs.c,v 1.3 2018/08/27 04:58:23 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_debugfs.c,v 1.4 2020/02/14 04:36:11 riastradh Exp $");
 
 #include 
 #include 
@@ -3286,7 +3286,7 @@ static int i915_drrs_status(struct seq_f
 struct pipe_crc_info {
 	const char *name;
 	struct drm_device *dev;
-	enum i915_pipe pipe;
+	enum pipe pipe;
 };
 
 static int i915_dp_mst_info(struct seq_file *m, void *unused)
@@ -3462,7 +3462,7 @@ static struct pipe_crc_info i915_pipe_cr
 };
 
 static int i915_pipe_crc_create(struct dentry *root, struct drm_minor *minor,
-enum i915_pipe pipe)
+enum pipe pipe)
 {
 	struct drm_device *dev = minor->dev;
 	struct dentry *ent;
@@ -3536,7 +3536,7 @@ static int i8xx_pipe_crc_ctl_reg(enum in
 	return 0;
 }
 
-static int i9xx_pipe_crc_auto_source(struct drm_device *dev, enum i915_pipe pipe,
+static int i9xx_pipe_crc_auto_source(struct drm_device *dev, enum pipe pipe,
  enum intel_pipe_crc_source *source)
 {
 	struct intel_encoder *encoder;
@@ -3589,7 +3589,7 @@ static int i9xx_pipe_crc_auto_source(str
 }
 
 static int vlv_pipe_crc_ctl_reg(struct drm_device *dev,
-enum i915_pipe pipe,
+enum pipe pipe,
 enum intel_pipe_crc_source *source,
 uint32_t *val)
 {
@@ -3660,7 +3660,7 @@ static int vlv_pipe_crc_ctl_reg(struct d
 }
 
 static int i9xx_pipe_crc_ctl_reg(struct drm_device *dev,
- enum i915_pipe pipe,
+ enum pipe pipe,
  enum intel_pipe_crc_source *source,
  uint32_t *val)
 {
@@ -3736,7 +3736,7 @@ static int i9xx_pipe_crc_ctl_reg(struct 
 }
 
 static void vlv_undo_pipe_scramble_reset(struct drm_device *dev,
-	 enum i915_pipe pipe)
+	

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

2020-02-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Feb 14 04:29:42 UTC 2020

Modified Files:
src/sys/external/bsd/drm2/dist/drm/radeon: radeon_ci_dpm.c
radeon_evergreen_cs.c radeon_rv770_dpm.c radeon_si_dpm.c
radeon_sumo_dpm.c radeon_trinity_dpm.c

Log Message:
We use -Wno-shadow for radeon; remove unused diff.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_ci_dpm.c \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_evergreen_cs.c \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_si_dpm.c
cvs rdiff -u -r1.1 -r1.2 \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_rv770_dpm.c \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_sumo_dpm.c \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_trinity_dpm.c

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/radeon/radeon_ci_dpm.c
diff -u src/sys/external/bsd/drm2/dist/drm/radeon/radeon_ci_dpm.c:1.2 src/sys/external/bsd/drm2/dist/drm/radeon/radeon_ci_dpm.c:1.3
--- src/sys/external/bsd/drm2/dist/drm/radeon/radeon_ci_dpm.c:1.2	Fri Feb 14 04:29:19 2020
+++ src/sys/external/bsd/drm2/dist/drm/radeon/radeon_ci_dpm.c	Fri Feb 14 04:29:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: radeon_ci_dpm.c,v 1.2 2020/02/14 04:29:19 riastradh Exp $	*/
+/*	$NetBSD: radeon_ci_dpm.c,v 1.3 2020/02/14 04:29:42 riastradh Exp $	*/
 
 /*
  * Copyright 2013 Advanced Micro Devices, Inc.
@@ -24,7 +24,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: radeon_ci_dpm.c,v 1.2 2020/02/14 04:29:19 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeon_ci_dpm.c,v 1.3 2020/02/14 04:29:42 riastradh Exp $");
 
 #include 
 #include "drmP.h"
@@ -386,29 +386,29 @@ static int ci_min_max_v_gnbl_pm_lid_from
 	struct ci_power_info *pi = ci_get_pi(rdev);
 	u8 *hi_vid = pi->smc_powertune_table.BapmVddCVidHiSidd;
 	u8 *lo_vid = pi->smc_powertune_table.BapmVddCVidLoSidd;
-	int i, vmin, vmax;
+	int i, min, max;
 
-	vmin = vmax = hi_vid[0];
+	min = max = hi_vid[0];
 	for (i = 0; i < 8; i++) {
 		if (0 != hi_vid[i]) {
-			if (vmin > hi_vid[i])
-vmin = hi_vid[i];
-			if (vmax < hi_vid[i])
-vmax = hi_vid[i];
+			if (min > hi_vid[i])
+min = hi_vid[i];
+			if (max < hi_vid[i])
+max = hi_vid[i];
 		}
 
 		if (0 != lo_vid[i]) {
-			if (vmin > lo_vid[i])
-vmin = lo_vid[i];
-			if (vmax < lo_vid[i])
-vmax = lo_vid[i];
+			if (min > lo_vid[i])
+min = lo_vid[i];
+			if (max < lo_vid[i])
+max = lo_vid[i];
 		}
 	}
 
-	if ((vmin == 0) || (vmax == 0))
+	if ((min == 0) || (max == 0))
 		return -EINVAL;
-	pi->smc_powertune_table.GnbLPMLMaxVid = (u8)vmax;
-	pi->smc_powertune_table.GnbLPMLMinVid = (u8)vmin;
+	pi->smc_powertune_table.GnbLPMLMaxVid = (u8)max;
+	pi->smc_powertune_table.GnbLPMLMinVid = (u8)min;
 
 	return 0;
 }
@@ -2443,15 +2443,15 @@ static u8 ci_get_sleep_divider_id_from_c
 {
 	u32 i;
 	u32 tmp;
-	u32 vmin = (min_sclk_in_sr > CISLAND_MINIMUM_ENGINE_CLOCK) ?
+	u32 min = (min_sclk_in_sr > CISLAND_MINIMUM_ENGINE_CLOCK) ?
 		min_sclk_in_sr : CISLAND_MINIMUM_ENGINE_CLOCK;
 
-	if (sclk < vmin)
+	if (sclk < min)
 		return 0;
 
 	for (i = CISLAND_MAX_DEEPSLEEP_DIVIDER_ID;  ; i--) {
 		tmp = sclk / (1 << i);
-		if (tmp >= vmin || i == 0)
+		if (tmp >= min || i == 0)
 			break;
 	}
 
Index: src/sys/external/bsd/drm2/dist/drm/radeon/radeon_evergreen_cs.c
diff -u src/sys/external/bsd/drm2/dist/drm/radeon/radeon_evergreen_cs.c:1.2 src/sys/external/bsd/drm2/dist/drm/radeon/radeon_evergreen_cs.c:1.3
--- src/sys/external/bsd/drm2/dist/drm/radeon/radeon_evergreen_cs.c:1.2	Fri Feb  8 04:11:53 2019
+++ src/sys/external/bsd/drm2/dist/drm/radeon/radeon_evergreen_cs.c	Fri Feb 14 04:29:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: radeon_evergreen_cs.c,v 1.2 2019/02/08 04:11:53 mrg Exp $	*/
+/*	$NetBSD: radeon_evergreen_cs.c,v 1.3 2020/02/14 04:29:42 riastradh Exp $	*/
 
 /*
  * Copyright 2010 Advanced Micro Devices, Inc.
@@ -28,7 +28,7 @@
  *  Jerome Glisse
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: radeon_evergreen_cs.c,v 1.2 2019/02/08 04:11:53 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeon_evergreen_cs.c,v 1.3 2020/02/14 04:29:42 riastradh Exp $");
 
 #include 
 #include "radeon.h"
@@ -37,8 +37,8 @@ __KERNEL_RCSID(0, "$NetBSD: radeon_everg
 #include "cayman_reg_safe.h"
 
 #ifndef __NetBSD__
-#define MAX(a,b)			(((a)>(b))?(a):(b))
-#define MIN(a,b)			(((a)<(b))?(a):(b))
+#define MAX(a,b)   (((a)>(b))?(a):(b))
+#define MIN(a,b)   (((a)<(b))?(a):(b))
 #endif
 
 #define REG_SAFE_BM_SIZE ARRAY_SIZE(evergreen_reg_safe_bm)
@@ -455,21 +455,21 @@ static int evergreen_cs_track_validate_c
 		 */
 		if (!surf.mode) {
 			uint32_t *ib = p->ib.ptr;
-			unsigned long tmp, nby, bsize, size, vmin = 0;
+			unsigned long tmp, nby, bsize, size, min = 0;
 
 			/* find the height the ddx wants */
 			if (surf.nby > 8) {
-vmin = surf.nby - 8;
+		

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

2020-02-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Feb 14 04:30:06 UTC 2020

Modified Files:
src/sys/external/bsd/drm2/amdgpu: files.amdgpu
src/sys/external/bsd/drm2/dist/drm: drm_bufs.c drm_crtc.c
drm_dp_helper.c
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu: amdgpu_atom.c
amdgpu_atombios.c amdgpu_atombios_encoders.c amdgpu_bo_list.c
amdgpu_ci_dpm.c amdgpu_cz_dpm.c amdgpu_cz_smc.c amdgpu_dce_v10_0.c
amdgpu_dce_v11_0.c amdgpu_dce_v8_0.c amdgpu_dpm.c amdgpu_fence.c
amdgpu_gmc_v7_0.c amdgpu_gmc_v8_0.c amdgpu_kv_dpm.c amdgpu_test.c
amdgpu_ucode.c amdgpu_uvd.c
src/sys/external/bsd/drm2/dist/drm/i915: i915_cmd_parser.c i915_gem.c
i915_guc_submission.c intel_bios.c intel_opregion.c intel_psr.c
src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/bios:
nouveau_nvkm_subdev_bios_shadowpci.c
src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/instmem:
nouveau_nvkm_subdev_instmem_base.c
nouveau_nvkm_subdev_instmem_nv40.c
src/sys/external/bsd/drm2/dist/drm/radeon: drm_buffer.c radeon_test.c
radeon_uvd.c
src/sys/external/bsd/drm2/drm: files.drmkms
src/sys/external/bsd/drm2/i915drm: files.i915drmkms
src/sys/external/bsd/drm2/nouveau: files.nouveau
src/sys/external/bsd/drm2/radeon: files.radeon

Log Message:
Eliminate -Wpointer-arith patches; use -Wno-pointer-arith instead.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/drm2/amdgpu/files.amdgpu
cvs rdiff -u -r1.9 -r1.10 src/sys/external/bsd/drm2/dist/drm/drm_bufs.c
cvs rdiff -u -r1.11 -r1.12 src/sys/external/bsd/drm2/dist/drm/drm_crtc.c
cvs rdiff -u -r1.8 -r1.9 src/sys/external/bsd/drm2/dist/drm/drm_dp_helper.c
cvs rdiff -u -r1.1 -r1.2 \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_atom.c \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_atombios_encoders.c \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_cz_dpm.c \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gmc_v7_0.c \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gmc_v8_0.c
cvs rdiff -u -r1.3 -r1.4 \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_atombios.c \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ci_dpm.c \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_dce_v8_0.c \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_dpm.c \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_fence.c \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_test.c \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ucode.c
cvs rdiff -u -r1.4 -r1.5 \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_bo_list.c \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_uvd.c
cvs rdiff -u -r1.2 -r1.3 \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_cz_smc.c \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_dce_v10_0.c \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_dce_v11_0.c \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_kv_dpm.c
cvs rdiff -u -r1.20 -r1.21 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_cmd_parser.c
cvs rdiff -u -r1.56 -r1.57 src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c
cvs rdiff -u -r1.8 -r1.9 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_guc_submission.c
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/drm2/dist/drm/i915/intel_bios.c
cvs rdiff -u -r1.15 -r1.16 \
src/sys/external/bsd/drm2/dist/drm/i915/intel_opregion.c
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/dist/drm/i915/intel_psr.c
cvs rdiff -u -r1.3 -r1.4 \

src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/bios/nouveau_nvkm_subdev_bios_shadowpci.c
cvs rdiff -u -r1.4 -r1.5 \

src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/instmem/nouveau_nvkm_subdev_instmem_base.c
cvs rdiff -u -r1.7 -r1.8 \

src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/instmem/nouveau_nvkm_subdev_instmem_nv40.c
cvs rdiff -u -r1.2 -r1.3 \
src/sys/external/bsd/drm2/dist/drm/radeon/drm_buffer.c
cvs rdiff -u -r1.3 -r1.4 \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_test.c
cvs rdiff -u -r1.4 -r1.5 \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_uvd.c
cvs rdiff -u -r1.33 -r1.34 src/sys/external/bsd/drm2/drm/files.drmkms
cvs rdiff -u -r1.38 -r1.39 src/sys/external/bsd/drm2/i915drm/files.i915drmkms
cvs rdiff -u -r1.28 -r1.29 src/sys/external/bsd/drm2/nouveau/files.nouveau
cvs rdiff -u -r1.27 -r1.28 src/sys/external/bsd/drm2/radeon/files.radeon

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

Modified files:

Index: src/sys/external/bsd/drm2/amdgpu/files.amdgpu
diff -u src/sys/external/bsd/drm2/amdgpu/files.amdgpu:1.7 src/sys/external/bsd/drm2/amdgpu/files.amdgpu:1.8
--- src/sys/external/bsd/drm2/amdgpu/files.amdgpu:1.7	Mon Aug 27 16:06

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

2020-02-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Feb 14 04:29:20 UTC 2020

Modified Files:
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu: amdgpu_ci_dpm.c
src/sys/external/bsd/drm2/dist/drm/radeon: radeon_ci_dpm.c
radeon_si_dpm.c
src/sys/external/bsd/drm2/pci: drm_pci.c

Log Message:
New stub to reduce diff.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ci_dpm.c
cvs rdiff -u -r1.1 -r1.2 \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_ci_dpm.c \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_si_dpm.c
cvs rdiff -u -r1.32 -r1.33 src/sys/external/bsd/drm2/pci/drm_pci.c

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ci_dpm.c
diff -u src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ci_dpm.c:1.2 src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ci_dpm.c:1.3
--- src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ci_dpm.c:1.2	Mon Aug 27 14:24:03 2018
+++ src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_ci_dpm.c	Fri Feb 14 04:29:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: amdgpu_ci_dpm.c,v 1.2 2018/08/27 14:24:03 riastradh Exp $	*/
+/*	$NetBSD: amdgpu_ci_dpm.c,v 1.3 2020/02/14 04:29:19 riastradh Exp $	*/
 
 /*
  * Copyright 2013 Advanced Micro Devices, Inc.
@@ -24,7 +24,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_ci_dpm.c,v 1.2 2018/08/27 14:24:03 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_ci_dpm.c,v 1.3 2020/02/14 04:29:19 riastradh Exp $");
 
 #include 
 #include 
@@ -5858,22 +5858,18 @@ static int ci_dpm_init(struct amdgpu_dev
 	u8 frev, crev;
 	struct ci_power_info *pi;
 	int ret;
-#ifndef __NetBSD__		/* XXX amdgpu pcie */
 	u32 mask;
-#endif
 
 	pi = kzalloc(sizeof(struct ci_power_info), GFP_KERNEL);
 	if (pi == NULL)
 		return -ENOMEM;
 	adev->pm.dpm.priv = pi;
 
-#ifndef __NetBSD__		/* XXX amdgpu pcie */
 	ret = drm_pcie_get_speed_cap_mask(adev->ddev, &mask);
 	if (ret)
 		pi->sys_pcie_mask = 0;
 	else
 		pi->sys_pcie_mask = mask;
-#endif
 	pi->force_pcie_gen = AMDGPU_PCIE_GEN_INVALID;
 
 	pi->pcie_gen_performance.max = AMDGPU_PCIE_GEN1;

Index: src/sys/external/bsd/drm2/dist/drm/radeon/radeon_ci_dpm.c
diff -u src/sys/external/bsd/drm2/dist/drm/radeon/radeon_ci_dpm.c:1.1 src/sys/external/bsd/drm2/dist/drm/radeon/radeon_ci_dpm.c:1.2
--- src/sys/external/bsd/drm2/dist/drm/radeon/radeon_ci_dpm.c:1.1	Mon Aug 27 14:38:20 2018
+++ src/sys/external/bsd/drm2/dist/drm/radeon/radeon_ci_dpm.c	Fri Feb 14 04:29:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: radeon_ci_dpm.c,v 1.1 2018/08/27 14:38:20 riastradh Exp $	*/
+/*	$NetBSD: radeon_ci_dpm.c,v 1.2 2020/02/14 04:29:19 riastradh Exp $	*/
 
 /*
  * Copyright 2013 Advanced Micro Devices, Inc.
@@ -24,7 +24,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: radeon_ci_dpm.c,v 1.1 2018/08/27 14:38:20 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeon_ci_dpm.c,v 1.2 2020/02/14 04:29:19 riastradh Exp $");
 
 #include 
 #include "drmP.h"
@@ -5664,22 +5664,18 @@ int ci_dpm_init(struct radeon_device *rd
 	u8 frev, crev;
 	struct ci_power_info *pi;
 	int ret;
-#ifndef __NetBSD__
 	u32 mask;
-#endif
 
 	pi = kzalloc(sizeof(struct ci_power_info), GFP_KERNEL);
 	if (pi == NULL)
 		return -ENOMEM;
 	rdev->pm.dpm.priv = pi;
 
-#ifndef __NetBSD__
 	ret = drm_pcie_get_speed_cap_mask(rdev->ddev, &mask);
 	if (ret)
 		pi->sys_pcie_mask = 0;
 	else
 		pi->sys_pcie_mask = mask;
-#endif
 	pi->force_pcie_gen = RADEON_PCIE_GEN_INVALID;
 
 	pi->pcie_gen_performance.max = RADEON_PCIE_GEN1;
Index: src/sys/external/bsd/drm2/dist/drm/radeon/radeon_si_dpm.c
diff -u src/sys/external/bsd/drm2/dist/drm/radeon/radeon_si_dpm.c:1.1 src/sys/external/bsd/drm2/dist/drm/radeon/radeon_si_dpm.c:1.2
--- src/sys/external/bsd/drm2/dist/drm/radeon/radeon_si_dpm.c:1.1	Mon Aug 27 14:38:20 2018
+++ src/sys/external/bsd/drm2/dist/drm/radeon/radeon_si_dpm.c	Fri Feb 14 04:29:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: radeon_si_dpm.c,v 1.1 2018/08/27 14:38:20 riastradh Exp $	*/
+/*	$NetBSD: radeon_si_dpm.c,v 1.2 2020/02/14 04:29:19 riastradh Exp $	*/
 
 /*
  * Copyright 2013 Advanced Micro Devices, Inc.
@@ -24,7 +24,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: radeon_si_dpm.c,v 1.1 2018/08/27 14:38:20 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeon_si_dpm.c,v 1.2 2020/02/14 04:29:19 riastradh Exp $");
 
 #include "drmP.h"
 #include "radeon.h"
@@ -6957,9 +6957,7 @@ int si_dpm_init(struct radeon_device *rd
 	struct si_power_info *si_pi;
 	struct atom_clock_dividers dividers;
 	int ret;
-#ifndef __NetBSD__		/* XXX radeon pcie */
 	u32 mask;
-#endif
 
 	si_pi = kzalloc(sizeof(struct si_power_info), GFP_KERNEL);
 	if (si_pi == NULL)
@@ -6969,13 +6967,11 @@ int si_dpm_init(struct radeon_device *rd
 	eg_pi = &ni_pi->eg;
 	pi = &eg_pi->rv7xx;
 
-#ifndef __NetBSD__		/* XXX radeon pcie */
 	ret = drm_pcie_get_speed_cap_m

CVS commit: src/tests/lib/libc/sys

2020-02-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb 14 04:20:59 UTC 2020

Modified Files:
src/tests/lib/libc/sys: t_ptrace_x86_wait.h

Log Message:
Instead of turning optimization off, use unique labels with %= (thanks joerg@)


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/tests/lib/libc/sys/t_ptrace_x86_wait.h

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

Modified files:

Index: src/tests/lib/libc/sys/t_ptrace_x86_wait.h
diff -u src/tests/lib/libc/sys/t_ptrace_x86_wait.h:1.22 src/tests/lib/libc/sys/t_ptrace_x86_wait.h:1.23
--- src/tests/lib/libc/sys/t_ptrace_x86_wait.h:1.22	Thu Feb 13 13:31:54 2020
+++ src/tests/lib/libc/sys/t_ptrace_x86_wait.h	Thu Feb 13 23:20:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_x86_wait.h,v 1.22 2020/02/13 18:31:54 tnn Exp $	*/
+/*	$NetBSD: t_ptrace_x86_wait.h,v 1.23 2020/02/14 04:20:59 christos Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ -1972,11 +1972,6 @@ ATF_TC_HEAD(x86_cve_2018_8897, tc)
 #define X86_CVE_2018_8897_PAGE 0x5000 /* page addressable by 32-bit registers */
 
 static void
-#ifdef __clang__
-__attribute__((optnone))
-#else
-__attribute__((__optimize__("O0")))
-#endif
 x86_cve_2018_8897_trigger(void)
 {
 	/*
@@ -2077,13 +2072,13 @@ x86_cve_2018_8897_trigger(void)
 		);
 #else /* !__PIE__ */
 	__asm__ __volatile__(
-		"   movq $farjmp32, %%rax\n\t"
+		"   movq $farjmp32%=, %%rax\n\t"
 		"   ljmp *(%%rax)\n\t"
-		"farjmp32:\n\t"
-		"   .long trigger32\n\t"
+		"farjmp32%=:\n\t"
+		"   .long trigger32%=\n\t"
 		"   .word 0x73\n\t"
 		"   .code32\n\t"
-		"trigger32:\n\t"
+		"trigger32%=:\n\t"
 		"   movl $0x5000, %%esp\n\t"
 		"   pop %%ss\n\t"
 		"   int $4\n\t"



CVS commit: src/external/bsd/jemalloc/include/jemalloc/internal

2020-02-13 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Feb 14 01:52:35 UTC 2020

Modified Files:
src/external/bsd/jemalloc/include/jemalloc/internal: hash.h

Log Message:
Fix undefined behavior in hash.h (jemalloc)

Cherry-pick upstream patch:

Fix Undefined Behavior in hash.h

hash.h:200:27, left shift of 250 by 24 places cannot be represented in type 
'int'

https://github.com/jemalloc/jemalloc/commit/7fd22f7b2ea5ce2540563ece8e2d30a5316ac857


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/external/bsd/jemalloc/include/jemalloc/internal/hash.h

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

Modified files:

Index: src/external/bsd/jemalloc/include/jemalloc/internal/hash.h
diff -u src/external/bsd/jemalloc/include/jemalloc/internal/hash.h:1.2 src/external/bsd/jemalloc/include/jemalloc/internal/hash.h:1.3
--- src/external/bsd/jemalloc/include/jemalloc/internal/hash.h:1.2	Mon Mar  4 20:21:18 2019
+++ src/external/bsd/jemalloc/include/jemalloc/internal/hash.h	Fri Feb 14 01:52:35 2020
@@ -183,21 +183,21 @@ hash_x86_128(const void *key, const int 
 			k4 *= c4; k4 = hash_rotl_32(k4, 18); k4 *= c1; h4 ^= k4;
 			/*FALLTHROUGH*/
 
-		case 12: k3 ^= tail[11] << 24;	/*FALLTHROUGH*/
+		case 12: k3 ^= (uint32_t)tail[11] << 24;	/*FALLTHROUGH*/
 		case 11: k3 ^= tail[10] << 16;	/*FALLTHROUGH*/
 		case 10: k3 ^= tail[ 9] << 8;	/*FALLTHROUGH*/
 		case  9: k3 ^= tail[ 8] << 0;
 			k3 *= c3; k3 = hash_rotl_32(k3, 17); k3 *= c4; h3 ^= k3;
 			/*FALLTHROUGH*/
 
-		case  8: k2 ^= tail[ 7] << 24;	/*FALLTHROUGH*/
+		case  8: k2 ^= (uint32_t)tail[ 7] << 24;	/*FALLTHROUGH*/
 		case  7: k2 ^= tail[ 6] << 16;	/*FALLTHROUGH*/
 		case  6: k2 ^= tail[ 5] << 8;	/*FALLTHROUGH*/
 		case  5: k2 ^= tail[ 4] << 0;
 			k2 *= c2; k2 = hash_rotl_32(k2, 16); k2 *= c3; h2 ^= k2;
 			/*FALLTHROUGH*/
 
-		case  4: k1 ^= tail[ 3] << 24;	/*FALLTHROUGH*/
+		case  4: k1 ^= (uint32_t)tail[ 3] << 24;	/*FALLTHROUGH*/
 		case  3: k1 ^= tail[ 2] << 16;	/*FALLTHROUGH*/
 		case  2: k1 ^= tail[ 1] << 8;	/*FALLTHROUGH*/
 		case  1: k1 ^= tail[ 0] << 0;



CVS commit: [netbsd-9] src

2020-02-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 14 00:06:29 UTC 2020

Modified Files:
src/doc [netbsd-9]: CHANGES-9.0
src/external/gpl2/groff/tmac [netbsd-9]: mdoc.local
src/sys/sys [netbsd-9]: param.h

Log Message:
Welcome to NetBSD 9.0 - the "Valentine Release"


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.179 -r1.1.2.180 src/doc/CHANGES-9.0
cvs rdiff -u -r1.5.6.3 -r1.5.6.4 src/external/gpl2/groff/tmac/mdoc.local
cvs rdiff -u -r1.599.2.4 -r1.599.2.5 src/sys/sys/param.h

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.0
diff -u src/doc/CHANGES-9.0:1.1.2.179 src/doc/CHANGES-9.0:1.1.2.180
--- src/doc/CHANGES-9.0:1.1.2.179	Thu Feb 13 19:40:59 2020
+++ src/doc/CHANGES-9.0	Fri Feb 14 00:06:28 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.0,v 1.1.2.179 2020/02/13 19:40:59 martin Exp $
+# $NetBSD: CHANGES-9.0,v 1.1.2.180 2020/02/14 00:06:28 martin Exp $
 
 A complete list of changes from the initial NetBSD 9.0 branch on 2019-07-30
 until the 9.0 release:
@@ -8877,3 +8877,7 @@ sys/net/if_pppoe.c1.149
 	Safely extract character sequences from packet for printing.
 	[mlelstv, ticket #708]
 
+external/gpl2/groff/tmac/mdoc.local		(manual edited)
+sys/sys/param.h	(manual edited)
+
+	Welcome to 9.0!

Index: src/external/gpl2/groff/tmac/mdoc.local
diff -u src/external/gpl2/groff/tmac/mdoc.local:1.5.6.3 src/external/gpl2/groff/tmac/mdoc.local:1.5.6.4
--- src/external/gpl2/groff/tmac/mdoc.local:1.5.6.3	Fri Jan 31 12:19:17 2020
+++ src/external/gpl2/groff/tmac/mdoc.local	Fri Feb 14 00:06:28 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: mdoc.local,v 1.5.6.3 2020/01/31 12:19:17 martin Exp $
+.\" $NetBSD: mdoc.local,v 1.5.6.4 2020/02/14 00:06:28 martin Exp $
 .\"
 .\" Copyright (c) 2003, 2004 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -44,9 +44,9 @@
 .as doc-str-St--ieee1275-94 " (\*[Lq]\*[doc-Tn-font-size]Open Firmware\*[doc-str-St]\*[Rq])
 .
 .\" Default .Os value
-.ds doc-operating-system NetBSD\~9.0_RC2
+.ds doc-operating-system NetBSD\~9.0
 .\" Default footer operating system value
-.ds doc-default-operating-system NetBSD\~9.0_RC2
+.ds doc-default-operating-system NetBSD\~9.0
 .\" Other known versions, not yet in groff distribution
 .ds doc-operating-system-NetBSD-1.3.3  1.3.3
 .ds doc-operating-system-NetBSD-1.6.3  1.6.3

Index: src/sys/sys/param.h
diff -u src/sys/sys/param.h:1.599.2.4 src/sys/sys/param.h:1.599.2.5
--- src/sys/sys/param.h:1.599.2.4	Fri Jan 31 12:19:17 2020
+++ src/sys/sys/param.h	Fri Feb 14 00:06:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.599.2.4 2020/01/31 12:19:17 martin Exp $	*/
+/*	$NetBSD: param.h,v 1.599.2.5 2020/02/14 00:06:28 martin Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -67,7 +67,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	9	/* NetBSD 9.0_RC2 */
+#define	__NetBSD_Version__	9	/* NetBSD 9.0 */
 
 #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \
 (m) * 100) + (p) * 100) <= __NetBSD_Version__)



CVS commit: src/sys/dev/pci

2020-02-13 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Thu Feb 13 23:05:53 UTC 2020

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

Log Message:
redundant include


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/pci/if_rge.c

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

Modified files:

Index: src/sys/dev/pci/if_rge.c
diff -u src/sys/dev/pci/if_rge.c:1.5 src/sys/dev/pci/if_rge.c:1.6
--- src/sys/dev/pci/if_rge.c:1.5	Tue Feb  4 07:41:21 2020
+++ src/sys/dev/pci/if_rge.c	Thu Feb 13 23:05:53 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_rge.c,v 1.5 2020/02/04 07:41:21 skrll Exp $	*/
+/*	$NetBSD: if_rge.c,v 1.6 2020/02/13 23:05:53 sevan Exp $	*/
 /*	$OpenBSD: if_rge.c,v 1.2 2020/01/02 09:00:45 kevlo Exp $	*/
 
 /*
@@ -18,9 +18,8 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.5 2020/02/04 07:41:21 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.6 2020/02/13 23:05:53 sevan Exp $");
 
-/* #include "bpfilter.h" Sevan */
 /* #include "vlan.h" Sevan */
 
 #include 



CVS commit: src/share/man/man4

2020-02-13 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Thu Feb 13 22:48:12 UTC 2020

Modified Files:
src/share/man/man4: gpio.4

Log Message:
grammar


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/share/man/man4/gpio.4

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

Modified files:

Index: src/share/man/man4/gpio.4
diff -u src/share/man/man4/gpio.4:1.34 src/share/man/man4/gpio.4:1.35
--- src/share/man/man4/gpio.4:1.34	Sat Nov  2 18:56:41 2019
+++ src/share/man/man4/gpio.4	Thu Feb 13 22:48:11 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: gpio.4,v 1.34 2019/11/02 18:56:41 tnn Exp $
+.\" $NetBSD: gpio.4,v 1.35 2020/02/13 22:48:11 sevan Exp $
 .\"	$OpenBSD: gpio.4,v 1.5 2004/11/23 09:39:29 reyk Exp $
 .\"
 .\" Copyright (c) 2004 Alexander Yurchenko 
@@ -15,7 +15,7 @@
 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\"
-.Dd November 2, 2019
+.Dd February 13, 2020
 .Dt GPIO 4
 .Os
 .Sh NAME
@@ -232,7 +232,7 @@ The
 driver was written by
 .An Alexander Yurchenko Aq Mt gra...@openbsd.org .
 .Nm
-and was ported to
+was ported to
 .Nx
 by
 .An Jared D. McNeill Aq Mt jmcne...@netbsd.org .



CVS commit: [netbsd-9] src/doc

2020-02-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb 13 19:40:59 UTC 2020

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

Log Message:
Tickets #706 and #708


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.178 -r1.1.2.179 src/doc/CHANGES-9.0

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.0
diff -u src/doc/CHANGES-9.0:1.1.2.178 src/doc/CHANGES-9.0:1.1.2.179
--- src/doc/CHANGES-9.0:1.1.2.178	Wed Feb 12 20:11:33 2020
+++ src/doc/CHANGES-9.0	Thu Feb 13 19:40:59 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.0,v 1.1.2.178 2020/02/12 20:11:33 martin Exp $
+# $NetBSD: CHANGES-9.0,v 1.1.2.179 2020/02/13 19:40:59 martin Exp $
 
 A complete list of changes from the initial NetBSD 9.0 branch on 2019-07-30
 until the 9.0 release:
@@ -8867,3 +8867,13 @@ sys/stand/efiboot/version			1.14
 	Support random seed loading from efiboot.
 	[riastradh, ticket #705]
 
+sys/compat/netbsd32/netbsd32_ioctl.c		1.108,1.109
+
+	Do not use strlcpy to copy untrusted input.
+	[mlelstv, ticket #706]
+
+sys/net/if_pppoe.c1.149
+
+	Safely extract character sequences from packet for printing.
+	[mlelstv, ticket #708]
+



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

2020-02-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb 13 19:40:05 UTC 2020

Modified Files:
src/sys/net [netbsd-9]: if_pppoe.c

Log Message:
Pull up following revision(s) (requested by mlelstv in ticket #708):

sys/net/if_pppoe.c: revision 1.149

safely extract character sequences from packet for printing.


To generate a diff of this commit:
cvs rdiff -u -r1.147 -r1.147.4.1 src/sys/net/if_pppoe.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/net/if_pppoe.c
diff -u src/sys/net/if_pppoe.c:1.147 src/sys/net/if_pppoe.c:1.147.4.1
--- src/sys/net/if_pppoe.c:1.147	Mon Mar 18 11:38:03 2019
+++ src/sys/net/if_pppoe.c	Thu Feb 13 19:40:05 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_pppoe.c,v 1.147 2019/03/18 11:38:03 msaitoh Exp $ */
+/* $NetBSD: if_pppoe.c,v 1.147.4.1 2020/02/13 19:40:05 martin Exp $ */
 
 /*
  * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.147 2019/03/18 11:38:03 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.147.4.1 2020/02/13 19:40:05 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "pppoe.h"
@@ -558,6 +558,7 @@ pppoe_dispatch_disc_pkt(struct mbuf *m, 
 	const char *err_msg;
 	char devname[IF_NAMESIZE];
 	char *error;
+	size_t dlen;
 	uint8_t *ac_cookie;
 	size_t ac_cookie_len;
 	uint8_t *relay_sid;
@@ -631,7 +632,8 @@ pppoe_dispatch_disc_pkt(struct mbuf *m, 
 			break;	/* ignored */
 		case PPPOE_TAG_ACNAME:
 			if (len > 0) {
-error = malloc(len + 1, M_TEMP, M_NOWAIT);
+dlen = 4 * len + 1;
+error = malloc(dlen, M_TEMP, M_NOWAIT);
 if (error == NULL)
 	break;
 
@@ -643,7 +645,9 @@ pppoe_dispatch_disc_pkt(struct mbuf *m, 
 	goto done;
 }
 
-strlcpy(error, mtod(n, char*) + noff, len + 1);
+strnvisx(error, dlen,
+mtod(n, char*) + noff, len,
+VIS_SAFE | VIS_OCTAL);
 printf("pppoe: connected to %s\n", error);
 free(error, M_TEMP);
 			}
@@ -704,15 +708,17 @@ pppoe_dispatch_disc_pkt(struct mbuf *m, 
 		if (err_msg) {
 			error = NULL;
 			if (errortag && len) {
-error = malloc(len + 1, M_TEMP,
+dlen = 4 * len + 1;
+error = malloc(dlen, M_TEMP,
 M_NOWAIT|M_ZERO);
 n = m_pulldown(m, off + sizeof(*pt), len,
 &noff);
 if (!n) {
 	m = NULL;
 } else if (error) {
-	strlcpy(error, mtod(n, char *) + noff,
-	len + 1);
+	strnvisx(error, dlen,
+	mtod(n, char*) + noff, len,
+	VIS_SAFE | VIS_OCTAL);
 }
 			}
 			if (error) {



CVS commit: [netbsd-8] src/doc

2020-02-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb 13 19:38:52 UTC 2020

Modified Files:
src/doc [netbsd-8]: CHANGES-8.2

Log Message:
Tickets #1504 and #1505


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.97 -r1.1.2.98 src/doc/CHANGES-8.2

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-8.2
diff -u src/doc/CHANGES-8.2:1.1.2.97 src/doc/CHANGES-8.2:1.1.2.98
--- src/doc/CHANGES-8.2:1.1.2.97	Wed Feb 12 20:15:04 2020
+++ src/doc/CHANGES-8.2	Thu Feb 13 19:38:52 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.2,v 1.1.2.97 2020/02/12 20:15:04 martin Exp $
+# $NetBSD: CHANGES-8.2,v 1.1.2.98 2020/02/13 19:38:52 martin Exp $
 
 A complete list of changes from the NetBSD 8.1 release to the NetBSD 8.2
 release:
@@ -2036,3 +2036,13 @@ external/bsd/ppp/dist/pppd/eap.c		1.5
 	pppd: Fix bounds check in EAP code.
 	[christos, ticket #1503]
 
+sys/compat/netbsd32/netbsd32_ioctl.c		1.108,1.109
+
+	Do not use strlcpy to copy untrusted input.
+	[mlelstv, ticket #1504]
+
+sys/net/if_pppoe.c1.149
+
+	Safely extract character sequences from packet for printing.
+	[mlelstv, ticket #1505]
+



CVS commit: [netbsd-8] src/sys/net

2020-02-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb 13 19:37:39 UTC 2020

Modified Files:
src/sys/net [netbsd-8]: if_pppoe.c

Log Message:
Pull up following revision(s) (requested by mlelstv in ticket #1505):

sys/net/if_pppoe.c: revision 1.149

safely extract character sequences from packet for printing.


To generate a diff of this commit:
cvs rdiff -u -r1.125.6.9 -r1.125.6.10 src/sys/net/if_pppoe.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/net/if_pppoe.c
diff -u src/sys/net/if_pppoe.c:1.125.6.9 src/sys/net/if_pppoe.c:1.125.6.10
--- src/sys/net/if_pppoe.c:1.125.6.9	Thu Jul 12 15:11:56 2018
+++ src/sys/net/if_pppoe.c	Thu Feb 13 19:37:39 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_pppoe.c,v 1.125.6.9 2018/07/12 15:11:56 martin Exp $ */
+/* $NetBSD: if_pppoe.c,v 1.125.6.10 2020/02/13 19:37:39 martin Exp $ */
 
 /*-
  * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.125.6.9 2018/07/12 15:11:56 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.125.6.10 2020/02/13 19:37:39 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "pppoe.h"
@@ -524,6 +524,7 @@ pppoe_dispatch_disc_pkt(struct mbuf *m, 
 	const char *err_msg;
 	char devname[IF_NAMESIZE];
 	char *error;
+	size_t dlen;
 	uint8_t *ac_cookie;
 	size_t ac_cookie_len;
 	uint8_t *relay_sid;
@@ -610,7 +611,8 @@ pppoe_dispatch_disc_pkt(struct mbuf *m, 
 			break;	/* ignored */
 		case PPPOE_TAG_ACNAME:
 			if (len > 0) {
-error = malloc(len + 1, M_TEMP, M_NOWAIT);
+dlen = 4 * len + 1;
+error = malloc(dlen, M_TEMP, M_NOWAIT);
 if (error == NULL)
 	break;
 
@@ -622,7 +624,9 @@ pppoe_dispatch_disc_pkt(struct mbuf *m, 
 	goto done;
 }
 
-strlcpy(error, mtod(n, char*) + noff, len + 1);
+strnvisx(error, dlen,
+mtod(n, char*) + noff, len,
+VIS_SAFE | VIS_OCTAL);
 printf("pppoe: connected to %s\n", error);
 free(error, M_TEMP);
 			}
@@ -683,15 +687,17 @@ pppoe_dispatch_disc_pkt(struct mbuf *m, 
 		if (err_msg) {
 			error = NULL;
 			if (errortag && len) {
-error = malloc(len + 1, M_TEMP,
+dlen = 4 * len + 1;
+error = malloc(dlen, M_TEMP,
 M_NOWAIT|M_ZERO);
 n = m_pulldown(m, off + sizeof(*pt), len,
 &noff);
 if (!n) {
 	m = NULL;
 } else if (error) {
-	strlcpy(error, mtod(n, char *) + noff,
-	len + 1);
+	strnvisx(error, dlen,
+	mtod(n, char*) + noff, len,
+	VIS_SAFE | VIS_OCTAL);
 }
 			}
 			if (error) {



CVS commit: [netbsd-8] src/sys/compat/netbsd32

2020-02-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb 13 19:34:30 UTC 2020

Modified Files:
src/sys/compat/netbsd32 [netbsd-8]: netbsd32_ioctl.c

Log Message:
Pull up following revision(s) (requested by mlelstv in ticket #1504):

sys/compat/netbsd32/netbsd32_ioctl.c: revision 1.108
sys/compat/netbsd32/netbsd32_ioctl.c: revision 1.109

Don't use strlcpy to copy untrusted input, it may not be NUL-terminated.

Where did the +1 came from ?


To generate a diff of this commit:
cvs rdiff -u -r1.89.8.2 -r1.89.8.3 src/sys/compat/netbsd32/netbsd32_ioctl.c

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

Modified files:

Index: src/sys/compat/netbsd32/netbsd32_ioctl.c
diff -u src/sys/compat/netbsd32/netbsd32_ioctl.c:1.89.8.2 src/sys/compat/netbsd32/netbsd32_ioctl.c:1.89.8.3
--- src/sys/compat/netbsd32/netbsd32_ioctl.c:1.89.8.2	Mon Jul 22 16:27:29 2019
+++ src/sys/compat/netbsd32/netbsd32_ioctl.c	Thu Feb 13 19:34:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_ioctl.c,v 1.89.8.2 2019/07/22 16:27:29 martin Exp $	*/
+/*	$NetBSD: netbsd32_ioctl.c,v 1.89.8.3 2020/02/13 19:34:29 martin Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.89.8.2 2019/07/22 16:27:29 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.89.8.3 2020/02/13 19:34:29 martin Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ntp.h"
@@ -145,7 +145,7 @@ static inline void
 netbsd32_to_if_addrprefreq(const struct netbsd32_if_addrprefreq *ifap32,
 	struct if_addrprefreq *ifap, u_long cmd)
 {
-	strlcpy(ifap->ifap_name, ifap32->ifap_name, sizeof(ifap->ifap_name));
+	memcpy(ifap->ifap_name, ifap32->ifap_name, IFNAMSIZ);
 	ifap->ifap_preference = ifap32->ifap_preference;
 	memcpy(&ifap->ifap_addr, &ifap32->ifap_addr,
 	min(ifap32->ifap_addr.ss_len, _SS_MAXSIZE));
@@ -341,7 +341,7 @@ static inline void
 netbsd32_to_ieee80211req(struct netbsd32_ieee80211req *ireq32,
 			 struct ieee80211req *ireq, u_long cmd)
 {
-	strlcpy(ireq->i_name, ireq32->i_name, IFNAMSIZ);
+	memcpy(ireq->i_name, ireq32->i_name, IFNAMSIZ);
 	ireq->i_type = ireq32->i_type;
 	ireq->i_val = ireq32->i_val;
 	ireq->i_len = ireq32->i_len;
@@ -355,7 +355,7 @@ netbsd32_to_ieee80211_nwkey(struct netbs
 {
 	int i;
 
-	strlcpy(nwk->i_name, nwk32->i_name, IFNAMSIZ);
+	memcpy(nwk->i_name, nwk32->i_name, IFNAMSIZ);
 	nwk->i_wepon = nwk32->i_wepon;
 	nwk->i_defkid = nwk32->i_defkid;
 	for (i = 0; i < IEEE80211_WEP_NKID; i++) {
@@ -569,7 +569,7 @@ static inline void
 netbsd32_from_if_addrprefreq(const struct if_addrprefreq *ifap,
 	struct netbsd32_if_addrprefreq *ifap32, u_long cmd)
 {
-	strlcpy(ifap32->ifap_name, ifap->ifap_name, sizeof(ifap32->ifap_name));
+	memcpy(ifap32->ifap_name, ifap->ifap_name, IFNAMSIZ);
 	ifap32->ifap_preference = ifap->ifap_preference;
 	memcpy(&ifap32->ifap_addr, &ifap->ifap_addr,
 	min(ifap->ifap_addr.ss_len, _SS_MAXSIZE));
@@ -770,7 +770,7 @@ static inline void
 netbsd32_from_ieee80211req(struct ieee80211req *ireq,
 			   struct netbsd32_ieee80211req *ireq32, u_long cmd)
 {
-	strlcpy(ireq32->i_name, ireq->i_name, IFNAMSIZ);
+	memcpy(ireq32->i_name, ireq->i_name, IFNAMSIZ);
 	ireq32->i_type = ireq->i_type;
 	ireq32->i_val = ireq->i_val;
 	ireq32->i_len = ireq->i_len;
@@ -784,7 +784,7 @@ netbsd32_from_ieee80211_nwkey(struct iee
 {
 	int i;
 
-	strlcpy(nwk32->i_name, nwk->i_name, IFNAMSIZ);
+	memcpy(nwk32->i_name, nwk->i_name, IFNAMSIZ);
 	nwk32->i_wepon = nwk->i_wepon;
 	nwk32->i_defkid = nwk->i_defkid;
 	for (i = 0; i < IEEE80211_WEP_NKID; i++) {



CVS commit: [netbsd-9] src/sys/compat/netbsd32

2020-02-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb 13 19:28:15 UTC 2020

Modified Files:
src/sys/compat/netbsd32 [netbsd-9]: netbsd32_ioctl.c

Log Message:
Pull up following revision(s) (requested by mlelstv in ticket #706):

sys/compat/netbsd32/netbsd32_ioctl.c: revision 1.108
sys/compat/netbsd32/netbsd32_ioctl.c: revision 1.109

Don't use strlcpy to copy untrusted input, it may not be NUL-terminated.

Where did the +1 came from ?


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.103.2.1 src/sys/compat/netbsd32/netbsd32_ioctl.c

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

Modified files:

Index: src/sys/compat/netbsd32/netbsd32_ioctl.c
diff -u src/sys/compat/netbsd32/netbsd32_ioctl.c:1.103 src/sys/compat/netbsd32/netbsd32_ioctl.c:1.103.2.1
--- src/sys/compat/netbsd32/netbsd32_ioctl.c:1.103	Fri May 17 07:37:12 2019
+++ src/sys/compat/netbsd32/netbsd32_ioctl.c	Thu Feb 13 19:28:15 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_ioctl.c,v 1.103 2019/05/17 07:37:12 msaitoh Exp $	*/
+/*	$NetBSD: netbsd32_ioctl.c,v 1.103.2.1 2020/02/13 19:28:15 martin Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.103 2019/05/17 07:37:12 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.103.2.1 2020/02/13 19:28:15 martin Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ntp.h"
@@ -146,7 +146,7 @@ netbsd32_to_if_addrprefreq(const struct 
 struct if_addrprefreq *ifap, u_long cmd)
 {
 
-	strlcpy(ifap->ifap_name, ifap32->ifap_name, sizeof(ifap->ifap_name));
+	memcpy(ifap->ifap_name, ifap32->ifap_name, IFNAMSIZ);
 	ifap->ifap_preference = ifap32->ifap_preference;
 	memcpy(&ifap->ifap_addr, &ifap32->ifap_addr,
 	uimin(ifap32->ifap_addr.ss_len, _SS_MAXSIZE));
@@ -385,7 +385,7 @@ netbsd32_to_ieee80211req(struct netbsd32
 struct ieee80211req *ireq, u_long cmd)
 {
 
-	strlcpy(ireq->i_name, ireq32->i_name, IFNAMSIZ);
+	memcpy(ireq->i_name, ireq32->i_name, IFNAMSIZ);
 	ireq->i_type = ireq32->i_type;
 	ireq->i_val = ireq32->i_val;
 	ireq->i_len = ireq32->i_len;
@@ -398,7 +398,7 @@ netbsd32_to_ieee80211_nwkey(struct netbs
 {
 	int i;
 
-	strlcpy(nwk->i_name, nwk32->i_name, IFNAMSIZ);
+	memcpy(nwk->i_name, nwk32->i_name, IFNAMSIZ);
 	nwk->i_wepon = nwk32->i_wepon;
 	nwk->i_defkid = nwk32->i_defkid;
 	for (i = 0; i < IEEE80211_WEP_NKID; i++) {
@@ -629,7 +629,7 @@ netbsd32_from_if_addrprefreq(const struc
 struct netbsd32_if_addrprefreq *ifap32, u_long cmd)
 {
 
-	strlcpy(ifap32->ifap_name, ifap->ifap_name, sizeof(ifap32->ifap_name));
+	memcpy(ifap32->ifap_name, ifap->ifap_name, IFNAMSIZ);
 	ifap32->ifap_preference = ifap->ifap_preference;
 	memcpy(&ifap32->ifap_addr, &ifap->ifap_addr,
 	uimin(ifap->ifap_addr.ss_len, _SS_MAXSIZE));
@@ -864,7 +864,7 @@ netbsd32_from_ieee80211req(struct ieee80
 struct netbsd32_ieee80211req *ireq32, u_long cmd)
 {
 
-	strlcpy(ireq32->i_name, ireq->i_name, IFNAMSIZ);
+	memcpy(ireq32->i_name, ireq->i_name, IFNAMSIZ);
 	ireq32->i_type = ireq->i_type;
 	ireq32->i_val = ireq->i_val;
 	ireq32->i_len = ireq->i_len;
@@ -877,7 +877,7 @@ netbsd32_from_ieee80211_nwkey(struct iee
 {
 	int i;
 
-	strlcpy(nwk32->i_name, nwk->i_name, IFNAMSIZ);
+	memcpy(nwk32->i_name, nwk->i_name, IFNAMSIZ);
 	nwk32->i_wepon = nwk->i_wepon;
 	nwk32->i_defkid = nwk->i_defkid;
 	for (i = 0; i < IEEE80211_WEP_NKID; i++) {



CVS commit: src/tests/lib/libc/sys

2020-02-13 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Thu Feb 13 18:31:55 UTC 2020

Modified Files:
src/tests/lib/libc/sys: t_ptrace_x86_wait.h

Log Message:
adjust r1.19; add clang equivalent of gcc specific attribute


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/tests/lib/libc/sys/t_ptrace_x86_wait.h

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

Modified files:

Index: src/tests/lib/libc/sys/t_ptrace_x86_wait.h
diff -u src/tests/lib/libc/sys/t_ptrace_x86_wait.h:1.21 src/tests/lib/libc/sys/t_ptrace_x86_wait.h:1.22
--- src/tests/lib/libc/sys/t_ptrace_x86_wait.h:1.21	Thu Feb 13 15:27:25 2020
+++ src/tests/lib/libc/sys/t_ptrace_x86_wait.h	Thu Feb 13 18:31:54 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_x86_wait.h,v 1.21 2020/02/13 15:27:25 mgorny Exp $	*/
+/*	$NetBSD: t_ptrace_x86_wait.h,v 1.22 2020/02/13 18:31:54 tnn Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ -1971,7 +1971,12 @@ ATF_TC_HEAD(x86_cve_2018_8897, tc)
 
 #define X86_CVE_2018_8897_PAGE 0x5000 /* page addressable by 32-bit registers */
 
-static __attribute__((__optimize__("O0"))) void
+static void
+#ifdef __clang__
+__attribute__((optnone))
+#else
+__attribute__((__optimize__("O0")))
+#endif
 x86_cve_2018_8897_trigger(void)
 {
 	/*



CVS commit: src/tests/dev/audio

2020-02-13 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Thu Feb 13 18:06:26 UTC 2020

Modified Files:
src/tests/dev/audio: audiotest.c

Log Message:
don't use variable 'newval' uninitialized when multiuser mode unchanged


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/dev/audio/audiotest.c

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

Modified files:

Index: src/tests/dev/audio/audiotest.c
diff -u src/tests/dev/audio/audiotest.c:1.2 src/tests/dev/audio/audiotest.c:1.3
--- src/tests/dev/audio/audiotest.c:1.2	Wed Feb 12 07:02:21 2020
+++ src/tests/dev/audio/audiotest.c	Thu Feb 13 18:06:26 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: audiotest.c,v 1.2 2020/02/12 07:02:21 martin Exp $	*/
+/*	$NetBSD: audiotest.c,v 1.3 2020/02/13 18:06:26 tnn Exp $	*/
 
 /*
  * Copyright (C) 2019 Tetsuya Isaki. All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: audiotest.c,v 1.2 2020/02/12 07:02:21 martin Exp $");
+__RCSID("$NetBSD: audiotest.c,v 1.3 2020/02/13 18:06:26 tnn Exp $");
 
 #include 
 #include 
@@ -2331,6 +2331,8 @@ test_open_multiuser(int multiuser)
 		r = SYSCTLBYNAME(mibname, NULL, NULL, &newval, sizeof(newval));
 		REQUIRED_SYS_EQ(0, r);
 		DPRINTF("  > new multiuser=%d\n", multiuser);
+	} else {
+		newval = oldval;
 	}
 
 	/* Do test */
@@ -6109,6 +6111,8 @@ test_audioctl_open_multiuser(int multius
 		r = SYSCTLBYNAME(mibname, NULL, NULL, &newval, sizeof(newval));
 		REQUIRED_SYS_EQ(0, r);
 		DPRINTF("  > new multiuser=%d\n", multiuser);
+	} else {
+		newval = oldval;
 	}
 
 	/* Do test */



CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs

2020-02-13 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Thu Feb 13 16:53:32 UTC 2020

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_vnops.c

Log Message:
zfs_netbsd_setattr: ignore size changes on device nodes.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c

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

Modified files:

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.56 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.57
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.56	Sat Jan 18 15:21:32 2020
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c	Thu Feb 13 16:53:32 2020
@@ -5575,6 +5575,9 @@ zfs_netbsd_setattr(void *v)
 
 	zflags = VTOZ(vp)->z_pflags;
 
+	/* Ignore size changes on device nodes. */
+	if (vp->v_type == VBLK || vp->v_type == VCHR)
+		xvap.xva_vattr.va_mask &= ~AT_SIZE;
 	if (vap->va_flags != VNOVAL) {
 		int error;
 



CVS commit: src/tests/lib/libc/sys

2020-02-13 Thread Michał Górny
Module Name:src
Committed By:   mgorny
Date:   Thu Feb 13 15:27:41 UTC 2020

Modified Files:
src/tests/lib/libc/sys: t_ptrace_wait.c

Log Message:
Enable combined breakpoint, watchpoint and signal tests


To generate a diff of this commit:
cvs rdiff -u -r1.161 -r1.162 src/tests/lib/libc/sys/t_ptrace_wait.c

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

Modified files:

Index: src/tests/lib/libc/sys/t_ptrace_wait.c
diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.161 src/tests/lib/libc/sys/t_ptrace_wait.c:1.162
--- src/tests/lib/libc/sys/t_ptrace_wait.c:1.161	Thu Feb 13 15:27:25 2020
+++ src/tests/lib/libc/sys/t_ptrace_wait.c	Thu Feb 13 15:27:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.161 2020/02/13 15:27:25 mgorny Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.162 2020/02/13 15:27:41 mgorny Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.161 2020/02/13 15:27:25 mgorny Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.162 2020/02/13 15:27:41 mgorny Exp $");
 
 #define __LEGACY_PT_LWPINFO
 
@@ -8954,6 +8954,50 @@ THREAD_CONCURRENT_TEST(thread_concurrent
 THREAD_CONCURRENT_TEST(thread_concurrent_watchpoints, TCSH_DISCARD,
 0, 0, THREAD_CONCURRENT_WATCHPOINT_NUM,
 "Verify that concurrent breakpoints are reported correctly");
+THREAD_CONCURRENT_TEST(thread_concurrent_bp_wp, TCSH_DISCARD,
+THREAD_CONCURRENT_BREAKPOINT_NUM, 0, THREAD_CONCURRENT_WATCHPOINT_NUM,
+"Verify that concurrent breakpoints and watchpoints are reported "
+"correctly");
+
+THREAD_CONCURRENT_TEST(thread_concurrent_bp_sig, TCSH_DISCARD,
+THREAD_CONCURRENT_BREAKPOINT_NUM, THREAD_CONCURRENT_SIGNALS_NUM, 0,
+"Verify that concurrent breakpoints and signals are reported correctly");
+THREAD_CONCURRENT_TEST(thread_concurrent_bp_sig_sig_ign, TCSH_SIG_IGN,
+THREAD_CONCURRENT_BREAKPOINT_NUM, THREAD_CONCURRENT_SIGNALS_NUM, 0,
+"Verify that concurrent breakpoints and signals are reported correctly "
+"and passed back to SIG_IGN handler");
+THREAD_CONCURRENT_TEST(thread_concurrent_bp_sig_handler, TCSH_HANDLER,
+THREAD_CONCURRENT_BREAKPOINT_NUM, THREAD_CONCURRENT_SIGNALS_NUM, 0,
+"Verify that concurrent breakpoints and signals are reported correctly "
+"and passed back to a handler function");
+
+THREAD_CONCURRENT_TEST(thread_concurrent_wp_sig, TCSH_DISCARD,
+0, THREAD_CONCURRENT_SIGNALS_NUM, THREAD_CONCURRENT_WATCHPOINT_NUM,
+"Verify that concurrent watchpoints and signals are reported correctly");
+THREAD_CONCURRENT_TEST(thread_concurrent_wp_sig_sig_ign, TCSH_SIG_IGN,
+0, THREAD_CONCURRENT_SIGNALS_NUM, THREAD_CONCURRENT_WATCHPOINT_NUM,
+"Verify that concurrent watchpoints and signals are reported correctly "
+"and passed back to SIG_IGN handler");
+THREAD_CONCURRENT_TEST(thread_concurrent_wp_sig_handler, TCSH_HANDLER,
+0, THREAD_CONCURRENT_SIGNALS_NUM, THREAD_CONCURRENT_WATCHPOINT_NUM,
+"Verify that concurrent watchpoints and signals are reported correctly "
+"and passed back to a handler function");
+
+THREAD_CONCURRENT_TEST(thread_concurrent_bp_wp_sig, TCSH_DISCARD,
+THREAD_CONCURRENT_BREAKPOINT_NUM, THREAD_CONCURRENT_SIGNALS_NUM,
+THREAD_CONCURRENT_WATCHPOINT_NUM,
+"Verify that concurrent breakpoints, watchpoints and signals are reported "
+"correctly");
+THREAD_CONCURRENT_TEST(thread_concurrent_bp_wp_sig_sig_ign, TCSH_SIG_IGN,
+THREAD_CONCURRENT_BREAKPOINT_NUM, THREAD_CONCURRENT_SIGNALS_NUM,
+THREAD_CONCURRENT_WATCHPOINT_NUM,
+"Verify that concurrent breakpoints, watchpoints and signals are reported "
+"correctly and passed back to SIG_IGN handler");
+THREAD_CONCURRENT_TEST(thread_concurrent_bp_wp_sig_handler, TCSH_HANDLER,
+THREAD_CONCURRENT_BREAKPOINT_NUM, THREAD_CONCURRENT_SIGNALS_NUM,
+THREAD_CONCURRENT_WATCHPOINT_NUM,
+"Verify that concurrent breakpoints, watchpoints and signals are reported "
+"correctly and passed back to a handler function");
 
 #endif /*defined(TWAIT_HAVE_STATUS)*/
 
@@ -9550,6 +9594,16 @@ ATF_TP_ADD_TCS(tp)
 #if defined(__i386__) || defined(__x86_64__)
 	ATF_TP_ADD_TC(tp, thread_concurrent_breakpoints);
 	ATF_TP_ADD_TC(tp, thread_concurrent_watchpoints);
+	ATF_TP_ADD_TC(tp, thread_concurrent_bp_wp);
+	ATF_TP_ADD_TC(tp, thread_concurrent_bp_sig);
+	ATF_TP_ADD_TC(tp, thread_concurrent_bp_sig_sig_ign);
+	ATF_TP_ADD_TC(tp, thread_concurrent_bp_sig_handler);
+	ATF_TP_ADD_TC(tp, thread_concurrent_wp_sig);
+	ATF_TP_ADD_TC(tp, thread_concurrent_wp_sig_sig_ign);
+	ATF_TP_ADD_TC(tp, thread_concurrent_wp_sig_handler);
+	ATF_TP_ADD_TC(tp, thread_concurrent_bp_wp_sig);
+	ATF_TP_ADD_TC(tp, thread_concurrent_bp_wp_sig_sig_ign);
+	ATF_TP_ADD_TC(tp, thread_concurrent_bp_wp_sig_handler);
 #endif
 #endif
 



CVS commit: src/tests/lib/libc/sys

2020-02-13 Thread Michał Górny
Module Name:src
Committed By:   mgorny
Date:   Thu Feb 13 15:27:25 UTC 2020

Modified Files:
src/tests/lib/libc/sys: t_ptrace_wait.c t_ptrace_x86_wait.h

Log Message:
Extend concurrent events test to watchpoints


To generate a diff of this commit:
cvs rdiff -u -r1.160 -r1.161 src/tests/lib/libc/sys/t_ptrace_wait.c
cvs rdiff -u -r1.20 -r1.21 src/tests/lib/libc/sys/t_ptrace_x86_wait.h

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

Modified files:

Index: src/tests/lib/libc/sys/t_ptrace_wait.c
diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.160 src/tests/lib/libc/sys/t_ptrace_wait.c:1.161
--- src/tests/lib/libc/sys/t_ptrace_wait.c:1.160	Thu Feb 13 15:27:05 2020
+++ src/tests/lib/libc/sys/t_ptrace_wait.c	Thu Feb 13 15:27:25 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.160 2020/02/13 15:27:05 mgorny Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.161 2020/02/13 15:27:25 mgorny Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.160 2020/02/13 15:27:05 mgorny Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.161 2020/02/13 15:27:25 mgorny Exp $");
 
 #define __LEGACY_PT_LWPINFO
 
@@ -8622,6 +8622,7 @@ ATF_TC_BODY(core_dump_procinfo, tc)
 
 #define THREAD_CONCURRENT_BREAKPOINT_NUM 50
 #define THREAD_CONCURRENT_SIGNALS_NUM 50
+#define THREAD_CONCURRENT_WATCHPOINT_NUM 50
 
 /* List of signals to use for the test */
 const int thread_concurrent_signals_list[] = {
@@ -8647,6 +8648,7 @@ enum thread_concurrent_signal_handling {
 
 static pthread_barrier_t thread_concurrent_barrier;
 static pthread_key_t thread_concurrent_key;
+static uint32_t thread_concurrent_watchpoint_var = 0;
 
 static void *
 thread_concurrent_breakpoint_thread(void *arg)
@@ -8687,10 +8689,20 @@ thread_concurrent_signals_thread(void *a
 	return NULL;
 }
 
+static void *
+thread_concurrent_watchpoint_thread(void *arg)
+{
+	pthread_barrier_wait(&thread_concurrent_barrier);
+	DPRINTF("Before modifying var from LWP %d\n", _lwp_self());
+	thread_concurrent_watchpoint_var = 1;
+	return NULL;
+}
+
 #if defined(__i386__) || defined(__x86_64__)
 enum thread_concurrent_sigtrap_event {
 	TCSE_UNKNOWN,
-	TCSE_BREAKPOINT
+	TCSE_BREAKPOINT,
+	TCSE_WATCHPOINT
 };
 
 static void
@@ -8701,7 +8713,7 @@ thread_concurrent_handle_sigtrap(pid_t c
 
 static void
 thread_concurrent_test(enum thread_concurrent_signal_handling signal_handle,
-int breakpoint_threads, int signal_threads)
+int breakpoint_threads, int signal_threads, int watchpoint_threads)
 {
 	const int exitval = 5;
 	const int sigval = SIGSTOP;
@@ -8711,6 +8723,8 @@ thread_concurrent_test(enum thread_concu
 	= {{0, 0}};
 	struct lwp_event_count bp_counts[THREAD_CONCURRENT_BREAKPOINT_NUM]
 	= {{0, 0}};
+	struct lwp_event_count wp_counts[THREAD_CONCURRENT_BREAKPOINT_NUM]
+	= {{0, 0}};
 	ptrace_event_t event;
 	int i;
 
@@ -8722,12 +8736,14 @@ thread_concurrent_test(enum thread_concu
 	/* Protect against out-of-bounds array access. */
 	ATF_REQUIRE(breakpoint_threads <= THREAD_CONCURRENT_BREAKPOINT_NUM);
 	ATF_REQUIRE(signal_threads <= THREAD_CONCURRENT_SIGNALS_NUM);
+	ATF_REQUIRE(watchpoint_threads <= THREAD_CONCURRENT_WATCHPOINT_NUM);
 
 	DPRINTF("Before forking process PID=%d\n", getpid());
 	SYSCALL_REQUIRE((child = fork()) != -1);
 	if (child == 0) {
 		pthread_t bp_threads[THREAD_CONCURRENT_BREAKPOINT_NUM];
 		pthread_t sig_threads[THREAD_CONCURRENT_SIGNALS_NUM];
+		pthread_t wp_threads[THREAD_CONCURRENT_WATCHPOINT_NUM];
 
 		DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid());
 		FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
@@ -8757,7 +8773,8 @@ thread_concurrent_test(enum thread_concu
 		DPRINTF("Before starting threads from the child\n");
 		FORKEE_ASSERT(pthread_barrier_init(
 		&thread_concurrent_barrier, NULL,
-		breakpoint_threads + signal_threads) == 0);
+		breakpoint_threads + signal_threads + watchpoint_threads)
+		== 0);
 		FORKEE_ASSERT(pthread_key_create(&thread_concurrent_key, NULL)
 		== 0);
 
@@ -8770,8 +8787,15 @@ thread_concurrent_test(enum thread_concu
 			FORKEE_ASSERT(pthread_create(&bp_threads[i], NULL,
 			thread_concurrent_breakpoint_thread, NULL) == 0);
 		}
+		for (i = 0; i < watchpoint_threads; i++) {
+			FORKEE_ASSERT(pthread_create(&wp_threads[i], NULL,
+			thread_concurrent_watchpoint_thread, NULL) == 0);
+		}
 
 		DPRINTF("Before joining threads from the child\n");
+		for (i = 0; i < watchpoint_threads; i++) {
+			FORKEE_ASSERT(pthread_join(wp_threads[i], NULL) == 0);
+		}
 		for (i = 0; i < breakpoint_threads; i++) {
 			FORKEE_ASSERT(pthread_join(bp_threads[i], NULL) == 0);
 		}
@@ -8852,6 +8876,10 @@ thread_concurrent_test(enum thread_concu
 	*FIND_EVENT_COUNT(bp_counts,
 	info.psi_lwpid) += 1;
 	break;
+case TCSE_WATCHPOINT:
+	*FIND_EVENT_COUNT(wp_counts,
+	info.psi_lwpid) += 1

CVS commit: src/tests/lib/libc/sys

2020-02-13 Thread Michał Górny
Module Name:src
Committed By:   mgorny
Date:   Thu Feb 13 15:27:05 UTC 2020

Modified Files:
src/tests/lib/libc/sys: t_ptrace_wait.c t_ptrace_x86_wait.h

Log Message:
Extend concurrent events test to breakpoints

Add testing for concurrent breakpoint hits.  The code is currently
x86-specific but since it reuses most of the generic concurrent event
test code, it's put in t_ptrace_wait.c with arch-specific hooks.


To generate a diff of this commit:
cvs rdiff -u -r1.159 -r1.160 src/tests/lib/libc/sys/t_ptrace_wait.c
cvs rdiff -u -r1.19 -r1.20 src/tests/lib/libc/sys/t_ptrace_x86_wait.h

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

Modified files:

Index: src/tests/lib/libc/sys/t_ptrace_wait.c
diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.159 src/tests/lib/libc/sys/t_ptrace_wait.c:1.160
--- src/tests/lib/libc/sys/t_ptrace_wait.c:1.159	Thu Feb 13 15:26:45 2020
+++ src/tests/lib/libc/sys/t_ptrace_wait.c	Thu Feb 13 15:27:05 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.159 2020/02/13 15:26:45 mgorny Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.160 2020/02/13 15:27:05 mgorny Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.159 2020/02/13 15:26:45 mgorny Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.160 2020/02/13 15:27:05 mgorny Exp $");
 
 #define __LEGACY_PT_LWPINFO
 
@@ -8620,6 +8620,7 @@ ATF_TC_BODY(core_dump_procinfo, tc)
 
 #if defined(TWAIT_HAVE_STATUS)
 
+#define THREAD_CONCURRENT_BREAKPOINT_NUM 50
 #define THREAD_CONCURRENT_SIGNALS_NUM 50
 
 /* List of signals to use for the test */
@@ -8647,6 +8648,16 @@ enum thread_concurrent_signal_handling {
 static pthread_barrier_t thread_concurrent_barrier;
 static pthread_key_t thread_concurrent_key;
 
+static void *
+thread_concurrent_breakpoint_thread(void *arg)
+{
+	static volatile int watchme = 1;
+	pthread_barrier_wait(&thread_concurrent_barrier);
+	DPRINTF("Before entering breakpoint func from LWP %d\n", _lwp_self());
+	check_happy(watchme);
+	return NULL;
+}
+
 static void
 thread_concurrent_sig_handler(int sig)
 {
@@ -8676,9 +8687,21 @@ thread_concurrent_signals_thread(void *a
 	return NULL;
 }
 
+#if defined(__i386__) || defined(__x86_64__)
+enum thread_concurrent_sigtrap_event {
+	TCSE_UNKNOWN,
+	TCSE_BREAKPOINT
+};
+
+static void
+thread_concurrent_lwp_setup(pid_t child, lwpid_t lwpid);
+static enum thread_concurrent_sigtrap_event
+thread_concurrent_handle_sigtrap(pid_t child, ptrace_siginfo_t *info);
+#endif
+
 static void
 thread_concurrent_test(enum thread_concurrent_signal_handling signal_handle,
-int signal_threads)
+int breakpoint_threads, int signal_threads)
 {
 	const int exitval = 5;
 	const int sigval = SIGSTOP;
@@ -8686,6 +8709,8 @@ thread_concurrent_test(enum thread_concu
 	int status;
 	struct lwp_event_count signal_counts[THREAD_CONCURRENT_SIGNALS_NUM]
 	= {{0, 0}};
+	struct lwp_event_count bp_counts[THREAD_CONCURRENT_BREAKPOINT_NUM]
+	= {{0, 0}};
 	ptrace_event_t event;
 	int i;
 
@@ -8695,11 +8720,13 @@ thread_concurrent_test(enum thread_concu
 		atf_tc_skip("PR kern/54960");
 
 	/* Protect against out-of-bounds array access. */
+	ATF_REQUIRE(breakpoint_threads <= THREAD_CONCURRENT_BREAKPOINT_NUM);
 	ATF_REQUIRE(signal_threads <= THREAD_CONCURRENT_SIGNALS_NUM);
 
 	DPRINTF("Before forking process PID=%d\n", getpid());
 	SYSCALL_REQUIRE((child = fork()) != -1);
 	if (child == 0) {
+		pthread_t bp_threads[THREAD_CONCURRENT_BREAKPOINT_NUM];
 		pthread_t sig_threads[THREAD_CONCURRENT_SIGNALS_NUM];
 
 		DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid());
@@ -8730,7 +8757,7 @@ thread_concurrent_test(enum thread_concu
 		DPRINTF("Before starting threads from the child\n");
 		FORKEE_ASSERT(pthread_barrier_init(
 		&thread_concurrent_barrier, NULL,
-		signal_threads) == 0);
+		breakpoint_threads + signal_threads) == 0);
 		FORKEE_ASSERT(pthread_key_create(&thread_concurrent_key, NULL)
 		== 0);
 
@@ -8739,8 +8766,15 @@ thread_concurrent_test(enum thread_concu
 			thread_concurrent_signals_thread,
 			&signal_handle) == 0);
 		}
+		for (i = 0; i < breakpoint_threads; i++) {
+			FORKEE_ASSERT(pthread_create(&bp_threads[i], NULL,
+			thread_concurrent_breakpoint_thread, NULL) == 0);
+		}
 
 		DPRINTF("Before joining threads from the child\n");
+		for (i = 0; i < breakpoint_threads; i++) {
+			FORKEE_ASSERT(pthread_join(bp_threads[i], NULL) == 0);
+		}
 		for (i = 0; i < signal_threads; i++) {
 			FORKEE_ASSERT(pthread_join(sig_threads[i], NULL) == 0);
 		}
@@ -8804,10 +8838,25 @@ thread_concurrent_test(enum thread_concu
 expected_sig, WSTOPSIG(status));
 
 			*FIND_EVENT_COUNT(signal_counts, info.psi_lwpid) += 1;
+		} else if (info.psi_siginfo.si_code == TRAP_LWP) {
+#if defined(__i386__) || defined(__x86_64__)
+			thread_concurrent_lwp_setup(child, info.psi_lwpid);
+#endif
 		} else 

CVS commit: src/tests/lib/libc/sys

2020-02-13 Thread Michał Górny
Module Name:src
Committed By:   mgorny
Date:   Thu Feb 13 15:26:18 UTC 2020

Modified Files:
src/tests/lib/libc/sys: t_ptrace_wait.c

Log Message:
Test whether signal handler is called in concurrent bombarding


To generate a diff of this commit:
cvs rdiff -u -r1.157 -r1.158 src/tests/lib/libc/sys/t_ptrace_wait.c

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

Modified files:

Index: src/tests/lib/libc/sys/t_ptrace_wait.c
diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.157 src/tests/lib/libc/sys/t_ptrace_wait.c:1.158
--- src/tests/lib/libc/sys/t_ptrace_wait.c:1.157	Thu Feb 13 15:25:58 2020
+++ src/tests/lib/libc/sys/t_ptrace_wait.c	Thu Feb 13 15:26:18 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.157 2020/02/13 15:25:58 mgorny Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.158 2020/02/13 15:26:18 mgorny Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.157 2020/02/13 15:25:58 mgorny Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.158 2020/02/13 15:26:18 mgorny Exp $");
 
 #define __LEGACY_PT_LWPINFO
 
@@ -8645,11 +8645,15 @@ enum thread_concurrent_signal_handling {
 };
 
 static pthread_barrier_t thread_concurrent_barrier;
+static pthread_key_t thread_concurrent_key;
 
 static void
 thread_concurrent_sig_handler(int sig)
 {
-	/* TODO: verify that handler is actually called */
+	void *tls_val = pthread_getspecific(thread_concurrent_key);
+	DPRINTF("Before increment, LWP %d tls_val=%p\n", _lwp_self(), tls_val);
+	FORKEE_ASSERT(pthread_setspecific(thread_concurrent_key,
+	(void*)((uintptr_t)tls_val + 1)) == 0);
 }
 
 static void *
@@ -8657,10 +8661,18 @@ thread_concurrent_signals_thread(void *a
 {
 	int sigval = thread_concurrent_signals_list[
 	_lwp_self() % __arraycount(thread_concurrent_signals_list)];
+	enum thread_concurrent_signal_handling *signal_handle = arg;
+	void *tls_val;
+
 	pthread_barrier_wait(&thread_concurrent_barrier);
 	DPRINTF("Before raising %s from LWP %d\n", strsignal(sigval),
 		_lwp_self());
 	pthread_kill(pthread_self(), sigval);
+	if (*signal_handle == TCSH_HANDLER) {
+	tls_val = pthread_getspecific(thread_concurrent_key);
+	DPRINTF("After raising, LWP %d tls_val=%p\n", _lwp_self(), tls_val);
+	FORKEE_ASSERT(tls_val == (void*)1);
+	}
 	return NULL;
 }
 
@@ -8718,10 +8730,13 @@ thread_concurrent_test(enum thread_concu
 		FORKEE_ASSERT(pthread_barrier_init(
 		&thread_concurrent_barrier, NULL,
 		signal_threads) == 0);
+		FORKEE_ASSERT(pthread_key_create(&thread_concurrent_key, NULL)
+		== 0);
 
 		for (i = 0; i < signal_threads; i++) {
 			FORKEE_ASSERT(pthread_create(&sig_threads[i], NULL,
-			thread_concurrent_signals_thread, NULL) == 0);
+			thread_concurrent_signals_thread,
+			&signal_handle) == 0);
 		}
 
 		DPRINTF("Before joining threads from the child\n");
@@ -8729,6 +8744,7 @@ thread_concurrent_test(enum thread_concu
 			FORKEE_ASSERT(pthread_join(sig_threads[i], NULL) == 0);
 		}
 
+		FORKEE_ASSERT(pthread_key_delete(thread_concurrent_key) == 0);
 		FORKEE_ASSERT(pthread_barrier_destroy(
 		&thread_concurrent_barrier) == 0);
 



CVS commit: src/tests/lib/libc/sys

2020-02-13 Thread Michał Górny
Module Name:src
Committed By:   mgorny
Date:   Thu Feb 13 15:26:45 UTC 2020

Modified Files:
src/tests/lib/libc/sys: t_ptrace_wait.c

Log Message:
Include LWP events in concurrent event test

LWP events will be necessary when breakpoint/watchpoint support is added
to the test.  However, they also benefit us by testing whether TRAP_LWP
events do not break signal reporting.


To generate a diff of this commit:
cvs rdiff -u -r1.158 -r1.159 src/tests/lib/libc/sys/t_ptrace_wait.c

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

Modified files:

Index: src/tests/lib/libc/sys/t_ptrace_wait.c
diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.158 src/tests/lib/libc/sys/t_ptrace_wait.c:1.159
--- src/tests/lib/libc/sys/t_ptrace_wait.c:1.158	Thu Feb 13 15:26:18 2020
+++ src/tests/lib/libc/sys/t_ptrace_wait.c	Thu Feb 13 15:26:45 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.158 2020/02/13 15:26:18 mgorny Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.159 2020/02/13 15:26:45 mgorny Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.158 2020/02/13 15:26:18 mgorny Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.159 2020/02/13 15:26:45 mgorny Exp $");
 
 #define __LEGACY_PT_LWPINFO
 
@@ -8686,6 +8686,7 @@ thread_concurrent_test(enum thread_concu
 	int status;
 	struct lwp_event_count signal_counts[THREAD_CONCURRENT_SIGNALS_NUM]
 	= {{0, 0}};
+	ptrace_event_t event;
 	int i;
 
 	if (signal_handle == TCSH_SIG_IGN)
@@ -8758,13 +8759,18 @@ thread_concurrent_test(enum thread_concu
 
 	validate_status_stopped(status, sigval);
 
+	DPRINTF("Set LWP event mask for the child process\n");
+	memset(&event, 0, sizeof(event));
+	event.pe_set_event |= PTRACE_LWP_CREATE;
+	SYSCALL_REQUIRE(ptrace(PT_SET_EVENT_MASK, child, &event, sizeof(event))
+	!= -1);
+
 	DPRINTF("Before resuming the child process where it left off\n");
 	SYSCALL_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
 
 	DPRINTF("Before entering signal collection loop\n");
 	while (1) {
 		ptrace_siginfo_t info;
-		int expected_sig;
 
 		DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME);
 		TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0),
@@ -8785,21 +8791,29 @@ thread_concurrent_test(enum thread_concu
 		info.psi_siginfo.si_signo, info.psi_lwpid,
 		WSTOPSIG(status));
 
-		expected_sig = thread_concurrent_signals_list[info.psi_lwpid %
-		__arraycount(thread_concurrent_signals_list)];
-		ATF_CHECK_EQ_MSG(info.psi_siginfo.si_signo, expected_sig,
-		"lwp=%d, expected %d, got %d", info.psi_lwpid,
-		expected_sig, info.psi_siginfo.si_signo);
-		ATF_CHECK_EQ_MSG(WSTOPSIG(status), expected_sig,
-		"lwp=%d, expected %d, got %d", info.psi_lwpid,
-		expected_sig, WSTOPSIG(status));
+		ATF_CHECK_EQ_MSG(info.psi_siginfo.si_signo, WSTOPSIG(status),
+		"lwp=%d, WSTOPSIG=%d, psi_siginfo=%d", info.psi_lwpid,
+		WSTOPSIG(status), info.psi_siginfo.si_signo);
+
+		if (WSTOPSIG(status) != SIGTRAP) {
+			int expected_sig =
+			thread_concurrent_signals_list[info.psi_lwpid %
+			__arraycount(thread_concurrent_signals_list)];
+			ATF_CHECK_EQ_MSG(WSTOPSIG(status), expected_sig,
+"lwp=%d, expected %d, got %d", info.psi_lwpid,
+expected_sig, WSTOPSIG(status));
 
-		*FIND_EVENT_COUNT(signal_counts, info.psi_lwpid) += 1;
+			*FIND_EVENT_COUNT(signal_counts, info.psi_lwpid) += 1;
+		} else {
+			ATF_CHECK_EQ_MSG(info.psi_siginfo.si_code, TRAP_LWP,
+			"lwp=%d, expected TRAP_LWP (%d), got %d",
+			info.psi_lwpid, TRAP_LWP, info.psi_siginfo.si_code);
+		}
 
 		DPRINTF("Before resuming the child process\n");
 		SYSCALL_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1,
-		 signal_handle != TCSH_DISCARD ? WSTOPSIG(status) : 0)
-		 != -1);
+		 signal_handle != TCSH_DISCARD && WSTOPSIG(status) != SIGTRAP
+		 ? WSTOPSIG(status) : 0) != -1);
 	}
 
 	for (i = 0; i < signal_threads; i++)



CVS commit: src/tests/lib/libc/sys

2020-02-13 Thread Michał Górny
Module Name:src
Committed By:   mgorny
Date:   Thu Feb 13 15:25:58 UTC 2020

Modified Files:
src/tests/lib/libc/sys: t_ptrace_wait.c

Log Message:
Extend concurrent signal tests to pass signal back to the thread


To generate a diff of this commit:
cvs rdiff -u -r1.156 -r1.157 src/tests/lib/libc/sys/t_ptrace_wait.c

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

Modified files:

Index: src/tests/lib/libc/sys/t_ptrace_wait.c
diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.156 src/tests/lib/libc/sys/t_ptrace_wait.c:1.157
--- src/tests/lib/libc/sys/t_ptrace_wait.c:1.156	Thu Feb 13 15:25:29 2020
+++ src/tests/lib/libc/sys/t_ptrace_wait.c	Thu Feb 13 15:25:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.156 2020/02/13 15:25:29 mgorny Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.157 2020/02/13 15:25:58 mgorny Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.156 2020/02/13 15:25:29 mgorny Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.157 2020/02/13 15:25:58 mgorny Exp $");
 
 #define __LEGACY_PT_LWPINFO
 
@@ -8635,8 +8635,23 @@ const int thread_concurrent_signals_list
 	SIGUSR2
 };
 
+enum thread_concurrent_signal_handling {
+	/* the signal is discarded by debugger */
+	TCSH_DISCARD,
+	/* the handler is set to SIG_IGN */
+	TCSH_SIG_IGN,
+	/* an actual handler is used */
+	TCSH_HANDLER
+};
+
 static pthread_barrier_t thread_concurrent_barrier;
 
+static void
+thread_concurrent_sig_handler(int sig)
+{
+	/* TODO: verify that handler is actually called */
+}
+
 static void *
 thread_concurrent_signals_thread(void *arg)
 {
@@ -8650,7 +8665,8 @@ thread_concurrent_signals_thread(void *a
 }
 
 static void
-thread_concurrent_test(int signal_threads)
+thread_concurrent_test(enum thread_concurrent_signal_handling signal_handle,
+int signal_threads)
 {
 	const int exitval = 5;
 	const int sigval = SIGSTOP;
@@ -8660,6 +8676,11 @@ thread_concurrent_test(int signal_thread
 	= {{0, 0}};
 	int i;
 
+	if (signal_handle == TCSH_SIG_IGN)
+		atf_tc_expect_fail("PR kern/54960");
+	else if (signal_handle == TCSH_HANDLER)
+		atf_tc_skip("PR kern/54960");
+
 	/* Protect against out-of-bounds array access. */
 	ATF_REQUIRE(signal_threads <= THREAD_CONCURRENT_SIGNALS_NUM);
 
@@ -8674,6 +8695,25 @@ thread_concurrent_test(int signal_thread
 		DPRINTF("Before raising %s from child\n", strsignal(sigval));
 		FORKEE_ASSERT(raise(sigval) == 0);
 
+		if (signal_handle != TCSH_DISCARD) {
+			struct sigaction sa;
+			unsigned int j;
+
+			memset(&sa, 0, sizeof(sa));
+			if (signal_handle == TCSH_SIG_IGN)
+sa.sa_handler = SIG_IGN;
+			else
+sa.sa_handler = thread_concurrent_sig_handler;
+			sigemptyset(&sa.sa_mask);
+
+			for (j = 0;
+			j < __arraycount(thread_concurrent_signals_list);
+			j++)
+FORKEE_ASSERT(sigaction(
+thread_concurrent_signals_list[j], &sa, NULL)
+!= -1);
+		}
+
 		DPRINTF("Before starting threads from the child\n");
 		FORKEE_ASSERT(pthread_barrier_init(
 		&thread_concurrent_barrier, NULL,
@@ -8741,7 +8781,9 @@ thread_concurrent_test(int signal_thread
 		*FIND_EVENT_COUNT(signal_counts, info.psi_lwpid) += 1;
 
 		DPRINTF("Before resuming the child process\n");
-		SYSCALL_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
+		SYSCALL_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1,
+		 signal_handle != TCSH_DISCARD ? WSTOPSIG(status) : 0)
+		 != -1);
 	}
 
 	for (i = 0; i < signal_threads; i++)
@@ -8756,7 +8798,7 @@ thread_concurrent_test(int signal_thread
 	validate_status_exited(status, exitval);
 }
 
-#define THREAD_CONCURRENT_TEST(test, sigs, descr)			\
+#define THREAD_CONCURRENT_TEST(test, sig_hdl, sigs, descr)		\
 ATF_TC(test);\
 ATF_TC_HEAD(test, tc)			\
 {	\
@@ -8765,13 +8807,21 @@ ATF_TC_HEAD(test, tc)			\
 	\
 ATF_TC_BODY(test, tc)			\
 {	\
-	thread_concurrent_test(sigs);	\
+	thread_concurrent_test(sig_hdl, sigs);\
 }
 
-THREAD_CONCURRENT_TEST(thread_concurrent_signals,
-   THREAD_CONCURRENT_SIGNALS_NUM,
-   "Verify that concurrent signals issued to a single thread are reported "
-   "correctly");
+THREAD_CONCURRENT_TEST(thread_concurrent_signals, TCSH_DISCARD,
+THREAD_CONCURRENT_SIGNALS_NUM,
+"Verify that concurrent signals issued to a single thread are reported "
+"correctly");
+THREAD_CONCURRENT_TEST(thread_concurrent_signals_sig_ign, TCSH_SIG_IGN,
+THREAD_CONCURRENT_SIGNALS_NUM,
+"Verify that concurrent signals issued to a single thread are reported "
+"correctly and passed back to SIG_IGN handler");
+THREAD_CONCURRENT_TEST(thread_concurrent_signals_handler, TCSH_HANDLER,
+THREAD_CONCURRENT_SIGNALS_NUM,
+"Verify that concurrent signals issued to a single thread are reported "
+"correctly and passed back to a handler function");
 
 #endif /*defined(TWAIT_HAVE_STATUS)*/
 

CVS commit: src/tests/lib/libc/sys

2020-02-13 Thread Michał Górny
Module Name:src
Committed By:   mgorny
Date:   Thu Feb 13 15:25:29 UTC 2020

Modified Files:
src/tests/lib/libc/sys: t_ptrace_wait.c

Log Message:
Generalize thread_concurrent_signals to a generic factory

Build thread_concurrent_signals on a generic parametrized
thread_concurrent_test() function.  At first, this permits adjusting
the number of running signal threads but in the followup commits
support for different concurrent events (breakpoints, watchpoints)
and different signal handling will be added.


To generate a diff of this commit:
cvs rdiff -u -r1.155 -r1.156 src/tests/lib/libc/sys/t_ptrace_wait.c

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

Modified files:

Index: src/tests/lib/libc/sys/t_ptrace_wait.c
diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.155 src/tests/lib/libc/sys/t_ptrace_wait.c:1.156
--- src/tests/lib/libc/sys/t_ptrace_wait.c:1.155	Tue Feb 11 00:41:37 2020
+++ src/tests/lib/libc/sys/t_ptrace_wait.c	Thu Feb 13 15:25:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.155 2020/02/11 00:41:37 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.156 2020/02/13 15:25:29 mgorny Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.155 2020/02/11 00:41:37 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.156 2020/02/13 15:25:29 mgorny Exp $");
 
 #define __LEGACY_PT_LWPINFO
 
@@ -8620,13 +8620,7 @@ ATF_TC_BODY(core_dump_procinfo, tc)
 
 #if defined(TWAIT_HAVE_STATUS)
 
-ATF_TC(thread_concurrent_signals);
-ATF_TC_HEAD(thread_concurrent_signals, tc)
-{
-	atf_tc_set_md_var(tc, "descr",
-	"Verify that concurrent signals issued to a single thread "
-	"are reported correctly");
-}
+#define THREAD_CONCURRENT_SIGNALS_NUM 50
 
 /* List of signals to use for the test */
 const int thread_concurrent_signals_list[] = {
@@ -8641,23 +8635,22 @@ const int thread_concurrent_signals_list
 	SIGUSR2
 };
 
-pthread_barrier_t thread_concurrent_signals_barrier;
+static pthread_barrier_t thread_concurrent_barrier;
 
 static void *
 thread_concurrent_signals_thread(void *arg)
 {
 	int sigval = thread_concurrent_signals_list[
 	_lwp_self() % __arraycount(thread_concurrent_signals_list)];
-	pthread_barrier_wait(&thread_concurrent_signals_barrier);
+	pthread_barrier_wait(&thread_concurrent_barrier);
 	DPRINTF("Before raising %s from LWP %d\n", strsignal(sigval),
 		_lwp_self());
 	pthread_kill(pthread_self(), sigval);
 	return NULL;
 }
 
-#define THREAD_CONCURRENT_SIGNALS_NUM 50
-
-ATF_TC_BODY(thread_concurrent_signals, tc)
+static void
+thread_concurrent_test(int signal_threads)
 {
 	const int exitval = 5;
 	const int sigval = SIGSTOP;
@@ -8665,12 +8658,15 @@ ATF_TC_BODY(thread_concurrent_signals, t
 	int status;
 	struct lwp_event_count signal_counts[THREAD_CONCURRENT_SIGNALS_NUM]
 	= {{0, 0}};
-	unsigned int i;
+	int i;
+
+	/* Protect against out-of-bounds array access. */
+	ATF_REQUIRE(signal_threads <= THREAD_CONCURRENT_SIGNALS_NUM);
 
 	DPRINTF("Before forking process PID=%d\n", getpid());
 	SYSCALL_REQUIRE((child = fork()) != -1);
 	if (child == 0) {
-		pthread_t threads[THREAD_CONCURRENT_SIGNALS_NUM];
+		pthread_t sig_threads[THREAD_CONCURRENT_SIGNALS_NUM];
 
 		DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid());
 		FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
@@ -8680,21 +8676,21 @@ ATF_TC_BODY(thread_concurrent_signals, t
 
 		DPRINTF("Before starting threads from the child\n");
 		FORKEE_ASSERT(pthread_barrier_init(
-		&thread_concurrent_signals_barrier, NULL,
-		__arraycount(threads)) == 0);
+		&thread_concurrent_barrier, NULL,
+		signal_threads) == 0);
 
-		for (i = 0; i < __arraycount(threads); i++) {
-			FORKEE_ASSERT(pthread_create(&threads[i], NULL,
+		for (i = 0; i < signal_threads; i++) {
+			FORKEE_ASSERT(pthread_create(&sig_threads[i], NULL,
 			thread_concurrent_signals_thread, NULL) == 0);
 		}
 
 		DPRINTF("Before joining threads from the child\n");
-		for (i = 0; i < __arraycount(threads); i++) {
-			FORKEE_ASSERT(pthread_join(threads[i], NULL) == 0);
+		for (i = 0; i < signal_threads; i++) {
+			FORKEE_ASSERT(pthread_join(sig_threads[i], NULL) == 0);
 		}
 
 		FORKEE_ASSERT(pthread_barrier_destroy(
-		&thread_concurrent_signals_barrier) == 0);
+		&thread_concurrent_barrier) == 0);
 
 		DPRINTF("Before exiting of the child process\n");
 		_exit(exitval);
@@ -8748,14 +8744,35 @@ ATF_TC_BODY(thread_concurrent_signals, t
 		SYSCALL_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1);
 	}
 
-	for (i = 0; i < __arraycount(signal_counts); i++)
+	for (i = 0; i < signal_threads; i++)
 		ATF_CHECK_EQ_MSG(signal_counts[i].lec_count, 1,
 		"signal_counts[%d].lec_count=%d; lec_lwp=%d",
 		i, signal_counts[i].lec_count, signal_counts[i].lec_lwp);
+	for (i = signal_threads; i < THREAD_CONCURRENT_SIGNALS_NUM; i++)
+		ATF_CHECK_EQ_MSG

CVS commit: src/tests/lib/libc/sys

2020-02-13 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Feb 13 13:38:44 UTC 2020

Modified Files:
src/tests/lib/libc/sys: t_ptrace_wait.h

Log Message:
Disable UBSan warnings for trigger_segv()

Dereferencing the NULL pointer is on purpose.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/tests/lib/libc/sys/t_ptrace_wait.h

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

Modified files:

Index: src/tests/lib/libc/sys/t_ptrace_wait.h
diff -u src/tests/lib/libc/sys/t_ptrace_wait.h:1.20 src/tests/lib/libc/sys/t_ptrace_wait.h:1.21
--- src/tests/lib/libc/sys/t_ptrace_wait.h:1.20	Thu Feb 13 13:34:47 2020
+++ src/tests/lib/libc/sys/t_ptrace_wait.h	Thu Feb 13 13:38:44 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.h,v 1.20 2020/02/13 13:34:47 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.h,v 1.21 2020/02/13 13:38:44 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ -606,6 +606,11 @@ trigger_trap(void)
 #endif
 }
 
+#if defined(__clang__)
+__attribute__((no_sanitize("undefined")))
+#else
+__attribute__((no_sanitize_undefined))
+#endif
 static void __used
 trigger_segv(void)
 {



CVS commit: src/tests/lib/libc/sys

2020-02-13 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Feb 13 13:34:48 UTC 2020

Modified Files:
src/tests/lib/libc/sys: t_ptrace_wait.h

Log Message:
Disable UBSan reports in trigger_fpe()

Division by 0 is on purpose.


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

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

Modified files:

Index: src/tests/lib/libc/sys/t_ptrace_wait.h
diff -u src/tests/lib/libc/sys/t_ptrace_wait.h:1.19 src/tests/lib/libc/sys/t_ptrace_wait.h:1.20
--- src/tests/lib/libc/sys/t_ptrace_wait.h:1.19	Tue Feb 11 00:41:37 2020
+++ src/tests/lib/libc/sys/t_ptrace_wait.h	Thu Feb 13 13:34:47 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.h,v 1.19 2020/02/11 00:41:37 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.h,v 1.20 2020/02/13 13:34:47 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ -642,6 +642,11 @@ are_fpu_exceptions_supported(void)
 	return true;
 }
 
+#if defined(__clang__)
+__attribute__((no_sanitize("undefined")))
+#else
+__attribute__((no_sanitize_undefined))
+#endif
 static void __used
 trigger_fpe(void)
 {



CVS commit: src/doc

2020-02-13 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Feb 13 12:23:40 UTC 2020

Modified Files:
src/doc: 3RDPARTY

Log Message:
binutils-2.34 and gdb-9.1 out.


To generate a diff of this commit:
cvs rdiff -u -r1.1689 -r1.1690 src/doc/3RDPARTY

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1689 src/doc/3RDPARTY:1.1690
--- src/doc/3RDPARTY:1.1689	Mon Jan 27 21:14:17 2020
+++ src/doc/3RDPARTY	Thu Feb 13 12:23:39 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1689 2020/01/27 21:14:17 roy Exp $
+#	$NetBSD: 3RDPARTY,v 1.1690 2020/02/13 12:23:39 wiz Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -456,7 +456,7 @@ Before importing a new version of extern
 
 Package:	gdb
 Version:	8.3
-Current Vers:	8.3.1
+Current Vers:	9.1
 Maintainer:	FSF
 Archive Site:	ftp://ftp.gnu.org/gnu/gdb/
 Home Page:	http://www.gnu.org/software/gdb/
@@ -473,7 +473,7 @@ When updating GDB, it is imperative to t
 
 Package:	binutils
 Version:	2.31.1
-Current Vers:	2.32
+Current Vers:	2.34
 Maintainer:	FSF
 Archive Site:	ftp://ftp.gnu.org/gnu/binutils/
 Home Page:	http://www.gnu.org/software/binutils/