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/dist/drm/i915 Fix mapping of non-page-...



details:   https://anonhg.NetBSD.org/src/rev/04bcaa80b6cf
branches:  trunk
changeset: 366303:04bcaa80b6cf
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Aug 27 14:44:16 2018 +0000

description:
Fix mapping of non-page-aligned stuff in vmap_batch.

diffstat:

 sys/external/bsd/drm2/dist/drm/i915/i915_cmd_parser.c |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (43 lines):

diff -r 7538e82e96ba -r 04bcaa80b6cf sys/external/bsd/drm2/dist/drm/i915/i915_cmd_parser.c
--- a/sys/external/bsd/drm2/dist/drm/i915/i915_cmd_parser.c     Mon Aug 27 14:44:04 2018 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/i915_cmd_parser.c     Mon Aug 27 14:44:16 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i915_cmd_parser.c,v 1.10 2018/08/27 14:44:04 riastradh Exp $   */
+/*     $NetBSD: i915_cmd_parser.c,v 1.11 2018/08/27 14:44:16 riastradh Exp $   */
 
 /*
  * Copyright © 2013 Intel Corporation
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i915_cmd_parser.c,v 1.10 2018/08/27 14:44:04 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_cmd_parser.c,v 1.11 2018/08/27 14:44:16 riastradh Exp $");
 
 #include "i915_drv.h"
 
@@ -864,11 +864,14 @@
                       unsigned start, unsigned len)
 {
 #ifdef __NetBSD__
+       /* Round to an integral number of pages starting on page boundary.  */
+       unsigned start0 = rounddown(start, PAGE_SIZE);
+       unsigned len0 = roundup(start + len, PAGE_SIZE) - start0;
        vaddr_t va = 0;
        int error;
 
-       error = uvm_map(kernel_map, &va, len, obj->base.filp, start,
-           sizeof(u32), UVM_MAPFLAG(UVM_PROT_RW, UVM_PROT_RW, UVM_INH_NONE,
+       error = uvm_map(kernel_map, &va, len0, obj->base.filp, start0,
+           PAGE_SIZE, UVM_MAPFLAG(UVM_PROT_RW, UVM_PROT_RW, UVM_INH_NONE,
                UVM_ADV_SEQUENTIAL, UVM_FLAG_NOWAIT));
        if (error)
                return NULL;
@@ -876,6 +879,7 @@
        /* uvm_map consumes a reference on success.  */
        uao_reference(obj->base.filp);
 
+       /* Caller will take care of finding the offset in the page.  */
        return (void *)va;
 #else
        int i;



Home | Main Index | Thread Index | Old Index