Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/external/bsd/drm2 Reduce diffs by nixing DRM_SUSER macro...
details: https://anonhg.NetBSD.org/src/rev/6f5b32cc28bd
branches: trunk
changeset: 744839:6f5b32cc28bd
user: riastradh <riastradh%NetBSD.org@localhost>
date: Fri Feb 14 04:36:55 2020 +0000
description:
Reduce diffs by nixing DRM_SUSER macro, deleted upstream long ago.
Instead stub Linux capable(CAP_SYS_ADMIN).
diffstat:
sys/external/bsd/drm2/dist/drm/drm_bufs.c | 23 +------
sys/external/bsd/drm2/dist/drm/drm_crtc.c | 11 +--
sys/external/bsd/drm2/dist/drm/drm_ioctl.c | 8 +-
sys/external/bsd/drm2/dist/drm/i915/i915_dma.c | 8 +-
sys/external/bsd/drm2/dist/drm/i915/i915_gem_context.c | 10 +--
sys/external/bsd/drm2/dist/drm/i915/i915_gem_execbuffer.c | 9 +--
sys/external/bsd/drm2/dist/drm/i915/intel_uncore.c | 13 +---
sys/external/bsd/drm2/dist/drm/ttm/ttm_bo_util.c | 5 +-
sys/external/bsd/drm2/dist/drm/ttm/ttm_memory.c | 13 +---
sys/external/bsd/drm2/dist/drm/via/via_dma.c | 12 +---
sys/external/bsd/drm2/drm/drm_fops.c | 6 +-
sys/external/bsd/drm2/drm/drm_vm.c | 6 +-
sys/external/bsd/drm2/include/drm/drm_auth_netbsd.h | 44 -------------
sys/external/bsd/drm2/include/drm/drm_os_netbsd.h | 3 +-
sys/external/bsd/drm2/include/linux/capability.h | 48 +++++++++++++++
sys/external/bsd/drm2/include/linux/fs.h | 4 +-
16 files changed, 79 insertions(+), 144 deletions(-)
diffs (truncated from 563 to 300 lines):
diff -r e7b26315f8d8 -r 6f5b32cc28bd sys/external/bsd/drm2/dist/drm/drm_bufs.c
--- a/sys/external/bsd/drm2/dist/drm/drm_bufs.c Fri Feb 14 04:36:33 2020 +0000
+++ b/sys/external/bsd/drm2/dist/drm/drm_bufs.c Fri Feb 14 04:36:55 2020 +0000
@@ -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 <sys/cdefs.h>
-__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 <linux/vmalloc.h>
#include <linux/slab.h>
@@ -424,17 +424,8 @@
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 @@
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 @@
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);
diff -r e7b26315f8d8 -r 6f5b32cc28bd sys/external/bsd/drm2/dist/drm/drm_crtc.c
--- a/sys/external/bsd/drm2/dist/drm/drm_crtc.c Fri Feb 14 04:36:33 2020 +0000
+++ b/sys/external/bsd/drm2/dist/drm/drm_crtc.c Fri Feb 14 04:36:55 2020 +0000
@@ -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 <jesse.barnes%intel.com@localhost>
*/
#include <sys/cdefs.h>
-__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 <linux/err.h>
#include <linux/spinlock.h>
@@ -3462,12 +3462,7 @@
r->bpp = fb->bits_per_pixel;
r->pitch = fb->pitches[0];
if (fb->funcs->create_handle) {
- if (file_priv->is_master ||
-#ifdef __NetBSD__
- DRM_SUSER() ||
-#else
- capable(CAP_SYS_ADMIN) ||
-#endif
+ if (file_priv->is_master || capable(CAP_SYS_ADMIN) ||
drm_is_control_client(file_priv)) {
ret = fb->funcs->create_handle(fb, file_priv,
&r->handle);
diff -r e7b26315f8d8 -r 6f5b32cc28bd sys/external/bsd/drm2/dist/drm/drm_ioctl.c
--- a/sys/external/bsd/drm2/dist/drm/drm_ioctl.c Fri Feb 14 04:36:33 2020 +0000
+++ b/sys/external/bsd/drm2/dist/drm/drm_ioctl.c Fri Feb 14 04:36:55 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: drm_ioctl.c,v 1.11 2018/09/14 05:31:14 maya Exp $ */
+/* $NetBSD: drm_ioctl.c,v 1.12 2020/02/14 04:36:56 riastradh Exp $ */
/*
* Created: Fri Jan 8 09:01:26 1999 by faith%valinux.com@localhost
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_ioctl.c,v 1.11 2018/09/14 05:31:14 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_ioctl.c,v 1.12 2020/02/14 04:36:56 riastradh Exp $");
#include <drm/drmP.h>
#include <drm/drm_core.h>
@@ -529,11 +529,7 @@
int drm_ioctl_permit(u32 flags, struct drm_file *file_priv)
{
/* ROOT_ONLY is only for CAP_SYS_ADMIN */
-#ifdef __NetBSD__
- if (unlikely((flags & DRM_ROOT_ONLY) && !DRM_SUSER()))
-#else
if (unlikely((flags & DRM_ROOT_ONLY) && !capable(CAP_SYS_ADMIN)))
-#endif
return -EACCES;
/* AUTH is only for authenticated or render client */
diff -r e7b26315f8d8 -r 6f5b32cc28bd sys/external/bsd/drm2/dist/drm/i915/i915_dma.c
--- a/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c Fri Feb 14 04:36:33 2020 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/i915_dma.c Fri Feb 14 04:36:55 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: i915_dma.c,v 1.30 2020/02/14 04:36:11 riastradh Exp $ */
+/* $NetBSD: i915_dma.c,v 1.31 2020/02/14 04:36:56 riastradh Exp $ */
/* i915_dma.c -- DMA support for the I915 -*- linux-c -*-
*/
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i915_dma.c,v 1.30 2020/02/14 04:36:11 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_dma.c,v 1.31 2020/02/14 04:36:56 riastradh Exp $");
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
@@ -139,11 +139,7 @@
value = 1;
break;
case I915_PARAM_HAS_SECURE_BATCHES:
-#ifdef __NetBSD__
- value = HAS_SECURE_BATCHES(dev_priv) && DRM_SUSER();
-#else
value = HAS_SECURE_BATCHES(dev_priv) && capable(CAP_SYS_ADMIN);
-#endif
break;
case I915_PARAM_HAS_PINNED_BATCHES:
value = 1;
diff -r e7b26315f8d8 -r 6f5b32cc28bd sys/external/bsd/drm2/dist/drm/i915/i915_gem_context.c
--- a/sys/external/bsd/drm2/dist/drm/i915/i915_gem_context.c Fri Feb 14 04:36:33 2020 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/i915_gem_context.c Fri Feb 14 04:36:55 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: i915_gem_context.c,v 1.10 2019/12/05 20:03:09 maya Exp $ */
+/* $NetBSD: i915_gem_context.c,v 1.11 2020/02/14 04:36:56 riastradh Exp $ */
/*
* Copyright © 2011-2012 Intel Corporation
@@ -88,7 +88,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i915_gem_context.c,v 1.10 2019/12/05 20:03:09 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_gem_context.c,v 1.11 2020/02/14 04:36:56 riastradh Exp $");
#include <linux/err.h>
#include <drm/drmP.h>
@@ -975,15 +975,9 @@
case I915_CONTEXT_PARAM_BAN_PERIOD:
if (args->size)
ret = -EINVAL;
-#ifdef __NetBSD__
- else if (args->value < ctx->hang_stats.ban_period_seconds &&
- !DRM_SUSER())
- ret = -EPERM;
-#else
else if (args->value < ctx->hang_stats.ban_period_seconds &&
!capable(CAP_SYS_ADMIN))
ret = -EPERM;
-#endif
else
ctx->hang_stats.ban_period_seconds = args->value;
break;
diff -r e7b26315f8d8 -r 6f5b32cc28bd sys/external/bsd/drm2/dist/drm/i915/i915_gem_execbuffer.c
--- a/sys/external/bsd/drm2/dist/drm/i915/i915_gem_execbuffer.c Fri Feb 14 04:36:33 2020 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/i915_gem_execbuffer.c Fri Feb 14 04:36:55 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: i915_gem_execbuffer.c,v 1.9 2019/12/05 20:03:09 maya Exp $ */
+/* $NetBSD: i915_gem_execbuffer.c,v 1.10 2020/02/14 04:36:56 riastradh Exp $ */
/*
* Copyright © 2008,2010 Intel Corporation
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i915_gem_execbuffer.c,v 1.9 2019/12/05 20:03:09 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_gem_execbuffer.c,v 1.10 2020/02/14 04:36:56 riastradh Exp $");
#include <drm/drmP.h>
#include <drm/i915_drm.h>
@@ -1465,13 +1465,8 @@
/* Return -EPERM to trigger fallback code on old binaries. */
if (!HAS_SECURE_BATCHES(dev_priv))
return -EPERM;
-#ifdef __NetBSD__
- if (!file->is_master || !DRM_SUSER())
- return -EPERM;
-#else
if (!file->is_master || !capable(CAP_SYS_ADMIN))
return -EPERM;
-#endif
dispatch_flags |= I915_DISPATCH_SECURE;
}
diff -r e7b26315f8d8 -r 6f5b32cc28bd sys/external/bsd/drm2/dist/drm/i915/intel_uncore.c
--- a/sys/external/bsd/drm2/dist/drm/i915/intel_uncore.c Fri Feb 14 04:36:33 2020 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/intel_uncore.c Fri Feb 14 04:36:55 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: intel_uncore.c,v 1.11 2019/07/24 14:57:09 msaitoh Exp $ */
+/* $NetBSD: intel_uncore.c,v 1.12 2020/02/14 04:36:56 riastradh Exp $ */
/*
* Copyright © 2013 Intel Corporation
@@ -24,7 +24,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intel_uncore.c,v 1.11 2019/07/24 14:57:09 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_uncore.c,v 1.12 2020/02/14 04:36:56 riastradh Exp $");
#include "i915_drv.h"
#include "intel_drv.h"
@@ -1384,13 +1384,8 @@
if (args->flags || args->pad)
return -EINVAL;
-#ifdef __NetBSD__
- if (args->ctx_id == DEFAULT_CONTEXT_HANDLE && !DRM_SUSER())
- return -EPERM;
-#else
if (args->ctx_id == DEFAULT_CONTEXT_HANDLE && !capable(CAP_SYS_ADMIN))
return -EPERM;
-#endif
ret = mutex_lock_interruptible(&dev->struct_mutex);
if (ret)
@@ -1403,11 +1398,7 @@
}
hs = &ctx->hang_stats;
-#ifdef __NetBSD__
- if (DRM_SUSER())
-#else
if (capable(CAP_SYS_ADMIN))
-#endif
args->reset_count = i915_reset_count(&dev_priv->gpu_error);
else
args->reset_count = 0;
diff -r e7b26315f8d8 -r 6f5b32cc28bd sys/external/bsd/drm2/dist/drm/ttm/ttm_bo_util.c
--- a/sys/external/bsd/drm2/dist/drm/ttm/ttm_bo_util.c Fri Feb 14 04:36:33 2020 +0000
+++ b/sys/external/bsd/drm2/dist/drm/ttm/ttm_bo_util.c Fri Feb 14 04:36:55 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ttm_bo_util.c,v 1.16 2020/02/14 04:35:20 riastradh Exp $ */
+/* $NetBSD: ttm_bo_util.c,v 1.17 2020/02/14 04:36:56 riastradh Exp $ */
/**************************************************************************
*
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ttm_bo_util.c,v 1.16 2020/02/14 04:35:20 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ttm_bo_util.c,v 1.17 2020/02/14 04:36:56 riastradh Exp $");
#include <drm/ttm/ttm_bo_driver.h>
#include <drm/ttm/ttm_placement.h>
@@ -48,7 +48,6 @@
#ifdef __NetBSD__ /* PMAP_* caching flags for ttm_io_prot */
#include <uvm/uvm_pmap.h>
-#include <drm/drm_auth_netbsd.h>
#include <linux/nbsd-namespace.h>
#endif
diff -r e7b26315f8d8 -r 6f5b32cc28bd sys/external/bsd/drm2/dist/drm/ttm/ttm_memory.c
--- a/sys/external/bsd/drm2/dist/drm/ttm/ttm_memory.c Fri Feb 14 04:36:33 2020 +0000
+++ b/sys/external/bsd/drm2/dist/drm/ttm/ttm_memory.c Fri Feb 14 04:36:55 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ttm_memory.c,v 1.4 2018/08/27 14:41:10 riastradh Exp $ */
+/* $NetBSD: ttm_memory.c,v 1.5 2020/02/14 04:36:56 riastradh Exp $ */
/**************************************************************************
Home |
Main Index |
Thread Index |
Old Index