summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2018-10-31 08:50:26 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2018-10-31 08:50:26 +0000
commit11cd045a6b01fc57b8f558340ee12a6b0d9277a4 (patch)
treebeb321a7a892ba850aff8e24a218d810317ac868 /sys/dev
parent54d5cb46157164d31a59414e58eab9a960756897 (diff)
Add support to uvm to establish write-combining mappings. Use this in the
inteldrm driver to add support for the I915_MMAP_WC flag. ok deraadt@, jsg@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/drm/drm_linux.h6
-rw-r--r--sys/dev/pci/drm/i915/i915_dma.c2
-rw-r--r--sys/dev/pci/drm/i915/i915_gem.c3
3 files changed, 5 insertions, 6 deletions
diff --git a/sys/dev/pci/drm/drm_linux.h b/sys/dev/pci/drm/drm_linux.h
index ba24e5faa83..a1a35d1f66a 100644
--- a/sys/dev/pci/drm/drm_linux.h
+++ b/sys/dev/pci/drm/drm_linux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: drm_linux.h,v 1.91 2018/08/20 19:33:31 kettenis Exp $ */
+/* $OpenBSD: drm_linux.h,v 1.92 2018/10/31 08:50:25 kettenis Exp $ */
/*
* Copyright (c) 2013, 2014, 2015 Mark Kettenis
* Copyright (c) 2017 Martin Pieuchot
@@ -2123,7 +2123,7 @@ typedef int pgprot_t;
static inline pgprot_t
pgprot_writecombine(pgprot_t prot)
{
-#ifdef PMAP_WC
+#if PMAP_WC != 0
return prot | PMAP_WC;
#else
return prot | PMAP_NOCACHE;
@@ -2133,7 +2133,7 @@ pgprot_writecombine(pgprot_t prot)
static inline pgprot_t
pgprot_noncached(pgprot_t prot)
{
-#ifdef PMAP_DEVICE
+#if PMAP_DEVICE != 0
return prot | PMAP_DEVICE;
#else
return prot | PMAP_NOCACHE;
diff --git a/sys/dev/pci/drm/i915/i915_dma.c b/sys/dev/pci/drm/i915/i915_dma.c
index 51e673480b8..54225532eea 100644
--- a/sys/dev/pci/drm/i915/i915_dma.c
+++ b/sys/dev/pci/drm/i915/i915_dma.c
@@ -156,11 +156,9 @@ static int i915_getparam(struct drm_device *dev, void *data,
case I915_PARAM_HAS_COHERENT_PHYS_GTT:
value = 1;
break;
-#ifdef notyet
case I915_PARAM_MMAP_VERSION:
value = 1;
break;
-#endif
case I915_PARAM_SUBSLICE_TOTAL:
value = INTEL_INFO(dev)->subslice_total;
if (!value)
diff --git a/sys/dev/pci/drm/i915/i915_gem.c b/sys/dev/pci/drm/i915/i915_gem.c
index 017d4ea943c..f018a6adadc 100644
--- a/sys/dev/pci/drm/i915/i915_gem.c
+++ b/sys/dev/pci/drm/i915/i915_gem.c
@@ -1987,7 +1987,8 @@ i915_gem_mmap_ioctl(struct drm_device *dev, void *data,
addr = 0;
ret = -uvm_map(&curproc->p_vmspace->vm_map, &addr, size,
obj->uao, args->offset, 0, UVM_MAPFLAG(PROT_READ | PROT_WRITE,
- PROT_READ | PROT_WRITE, MAP_INHERIT_SHARE, MADV_RANDOM, 0));
+ PROT_READ | PROT_WRITE, MAP_INHERIT_SHARE, MADV_RANDOM,
+ (args->flags & I915_MMAP_WC) ? UVM_FLAG_WC : 0));
if (ret == 0)
uao_reference(obj->uao);
drm_gem_object_unreference_unlocked(obj);