Module Name: src Committed By: riastradh Date: Sun Dec 19 11:27:20 UTC 2021
Modified Files: src/sys/external/bsd/drm2/dist/drm/i915: i915_gem_evict.c src/sys/external/bsd/drm2/dist/drm/i915/gem: i915_gem_context.c i915_gem_dmabuf.c Log Message: drm/i915: Misc build fixes. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 \ src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_evict.c cvs rdiff -u -r1.3 -r1.4 \ src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_context.c \ src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_dmabuf.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_gem_evict.c diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_evict.c:1.4 src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_evict.c:1.5 --- src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_evict.c:1.4 Sun Dec 19 01:24:25 2021 +++ src/sys/external/bsd/drm2/dist/drm/i915/i915_gem_evict.c Sun Dec 19 11:27:20 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: i915_gem_evict.c,v 1.4 2021/12/19 01:24:25 riastradh Exp $ */ +/* $NetBSD: i915_gem_evict.c,v 1.5 2021/12/19 11:27:20 riastradh Exp $ */ /* * Copyright © 2008-2010 Intel Corporation @@ -29,7 +29,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: i915_gem_evict.c,v 1.4 2021/12/19 01:24:25 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: i915_gem_evict.c,v 1.5 2021/12/19 11:27:20 riastradh Exp $"); #include <drm/i915_drm.h> @@ -39,6 +39,8 @@ __KERNEL_RCSID(0, "$NetBSD: i915_gem_evi #include "i915_drv.h" #include "i915_trace.h" +#include <linux/nbsd-namespace.h> + I915_SELFTEST_DECLARE(static struct igt_evict_ctl { bool fail_if_busy:1; } igt_evict_ctl;) Index: src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_context.c diff -u src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_context.c:1.3 src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_context.c:1.4 --- src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_context.c:1.3 Sun Dec 19 01:24:25 2021 +++ src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_context.c Sun Dec 19 11:27:20 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: i915_gem_context.c,v 1.3 2021/12/19 01:24:25 riastradh Exp $ */ +/* $NetBSD: i915_gem_context.c,v 1.4 2021/12/19 11:27:20 riastradh Exp $ */ /* * SPDX-License-Identifier: MIT @@ -67,11 +67,13 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: i915_gem_context.c,v 1.3 2021/12/19 01:24:25 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: i915_gem_context.c,v 1.4 2021/12/19 11:27:20 riastradh Exp $"); #include <linux/log2.h> #include <linux/nospec.h> +#include <asm/uaccess.h> + #include <drm/i915_drm.h> #include "gt/gen6_ppgtt.h" @@ -87,6 +89,8 @@ __KERNEL_RCSID(0, "$NetBSD: i915_gem_con #include "i915_trace.h" #include "i915_user_extensions.h" +#include <linux/nbsd-namespace.h> + #define ALL_L3_SLICES(dev) (1 << NUM_L3_SLICES(dev)) - 1 static struct i915_global_gem_context { @@ -317,7 +321,9 @@ static void i915_gem_context_free(struct if (ctx->timeline) intel_timeline_put(ctx->timeline); +#ifndef __NetBSD__ put_pid(ctx->pid); +#endif mutex_destroy(&ctx->mutex); kfree_rcu(ctx, rcu); @@ -808,10 +814,11 @@ static int gem_context_register(struct i #else ctx->pid = get_task_pid(current, PIDTYPE_PID); #endif - snprintf(ctx->name, sizeof(ctx->name), "%s[%d]", #ifdef __NetBSD__ - curproc->p_comm, (int)curproc->p_pid)); + snprintf(ctx->name, sizeof(ctx->name), "%s[%d]", + curproc->p_comm, (int)curproc->p_pid); #else + snprintf(ctx->name, sizeof(ctx->name), "%s[%d]", current->comm, pid_nr(ctx->pid)); #endif @@ -2233,8 +2240,13 @@ int i915_gem_context_create_ioctl(struct ext_data.fpriv = file->driver_priv; if (client_is_banned(ext_data.fpriv)) { +#ifdef __NetBSD__ + DRM_DEBUG("client %s[%d] banned from creating ctx\n", + curproc->p_comm, (int)curproc->p_pid); +#else DRM_DEBUG("client %s[%d] banned from creating ctx\n", current->comm, task_pid_nr(current)); +#endif return -EIO; } Index: src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_dmabuf.c diff -u src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_dmabuf.c:1.3 src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_dmabuf.c:1.4 --- src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_dmabuf.c:1.3 Sun Dec 19 01:24:25 2021 +++ src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_dmabuf.c Sun Dec 19 11:27:20 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: i915_gem_dmabuf.c,v 1.3 2021/12/19 01:24:25 riastradh Exp $ */ +/* $NetBSD: i915_gem_dmabuf.c,v 1.4 2021/12/19 11:27:20 riastradh Exp $ */ /* * SPDX-License-Identifier: MIT @@ -7,7 +7,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: i915_gem_dmabuf.c,v 1.3 2021/12/19 01:24:25 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: i915_gem_dmabuf.c,v 1.4 2021/12/19 11:27:20 riastradh Exp $"); #include <linux/dma-buf.h> #include <linux/highmem.h> @@ -44,7 +44,7 @@ static struct sg_table *i915_gem_map_dma st = drm_prime_pglist_to_sg(&obj->mm.pageq, obj->base.size >> PAGE_SHIFT); if (IS_ERR(st)) - goto err_unpin; + goto err_unpin_pages; #else /* Copy sg so that we make an independent mapping */ st = kmalloc(sizeof(struct sg_table), GFP_KERNEL); @@ -135,7 +135,7 @@ static int i915_gem_dmabuf_mmap(struct d if (!obj->base.filp) return -ENODEV; /* XXX review mmap refcount */ - drm_gem_object_reference(&obj->base); + drm_gem_object_get(&obj->base); *advicep = UVM_ADV_RANDOM; *uobjp = &obj->base.gemo_uvmobj; *maxprotp = prot;