Module Name: src Committed By: riastradh Date: Sun Sep 8 16:05:07 UTC 2013
Modified Files: src/sys/external/bsd/drm2/dist/drm/i915 [riastradh-drm2]: i915_gem.c Log Message: Check that GEM wired pages use at most 40 bits of physical addresses. Can't express this constraint to uvm_obj_wirepages at the moment, so at least fail early and noisily if we violate it. To generate a diff of this commit: cvs rdiff -u -r1.1.1.1.2.13 -r1.1.1.1.2.14 \ 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.1.1.1.2.13 src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.1.1.1.2.14 --- src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.1.1.1.2.13 Sun Sep 8 16:04:09 2013 +++ src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c Sun Sep 8 16:05:06 2013 @@ -2166,6 +2166,7 @@ static int i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj) { struct drm_device *const dev = obj->base.dev; + struct vm_page *page; int error; /* XXX Cargo-culted from the Linux code. */ @@ -2191,6 +2192,21 @@ i915_gem_object_get_pages_gtt(struct drm KASSERT(0 < obj->igo_nsegs); KASSERT(obj->igo_nsegs <= (obj->base.size / PAGE_SIZE)); + /* + * Check that the paddrs will fit in 40 bits. + * + * 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" + ": %"PRIxMAX"\n", + (uintmax_t)VM_PAGE_TO_PHYS(page)); + goto fail2; + } + } + /* XXX errno NetBSD->Linux */ error = -bus_dmamap_create(dev->dmat, obj->base.size, obj->igo_nsegs, PAGE_SIZE, 0, BUS_DMA_NOWAIT, &obj->igo_dmamap);