Module Name:    src
Committed By:   riastradh
Date:           Wed May 14 13:59:19 UTC 2014

Modified Files:
        src/sys/external/bsd/drm2/dist/drm/i915: i915_gem.c

Log Message:
Reject 32-bit paddrs on 965.

XXX Doing the check here is wrong; it serves only to report an
earlier problem, which is that there's on way to express constraints
on paddrs to uvm_obj_wirepages.  bus_dmamem_alloc can do this, but it
gives us pages out of thin air, not pages backing a uvm object.  I
was hoping this wouldn't manifest as a real problem, but evidently it
does.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.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.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.5 src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.6
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.5	Wed May 14 13:53:41 2014
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c	Wed May 14 13:59:19 2014
@@ -2205,15 +2205,19 @@ i915_gem_object_get_pages_gtt(struct drm
 	KASSERT(obj->igo_nsegs <= (obj->base.size / PAGE_SIZE));
 
 	/*
-	 * Check that the paddrs will fit in 40 bits.
+	 * Check that the paddrs will fit in 40 bits, or 32 bits on i965.
 	 *
 	 * XXX This is wrong; we ought to pass this constraint to
 	 * bus_dmamem_wire_uvm_object instead.
 	 */
 	TAILQ_FOREACH(page, &obj->igo_pageq, pageq.queue) {
-		if (VM_PAGE_TO_PHYS(page) & ~0xffffffffffULL) {
-			DRM_ERROR("GEM physical address exceeds 40 bits"
+		const uint64_t mask =
+		    (IS_BROADWATER(dev) || IS_CRESTLINE(dev)?
+			0xffffffffULL : 0xffffffffffULL);
+		if (VM_PAGE_TO_PHYS(page) & mask) {
+			DRM_ERROR("GEM physical address exceeds %u bits"
 			    ": %"PRIxMAX"\n",
+			    popcount64(mask),
 			    (uintmax_t)VM_PAGE_TO_PHYS(page));
 			error = -EIO;
 			goto fail2;

Reply via email to