summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorOwain Ainsworth <oga@cvs.openbsd.org>2010-05-10 22:15:00 +0000
committerOwain Ainsworth <oga@cvs.openbsd.org>2010-05-10 22:15:00 +0000
commit15ca8620be7dd1040b73cae0f166028a6d226ebc (patch)
tree70ccc6ffd0b6380e53b517dab1d589960fbc47bc /sys/dev/pci
parent2b601f55313e89133dd0f5ff0322650efdceab3a (diff)
Remove the additional paranoia that I added compared to upstream
(reading back the relocation). It doesn't add any real security and when we actually need to map the buffer on demand to read/write it makes things cripplingly slow. The correct way to make this utterly incorruptible is a radeon-kms-like command checker to the command streams. This is on my todo list. Thanks to drahn@ for additional testing.
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/drm/i915_drv.c33
1 files changed, 8 insertions, 25 deletions
diff --git a/sys/dev/pci/drm/i915_drv.c b/sys/dev/pci/drm/i915_drv.c
index 17db4153740..4a5c155e11f 100644
--- a/sys/dev/pci/drm/i915_drv.c
+++ b/sys/dev/pci/drm/i915_drv.c
@@ -2956,35 +2956,18 @@ i915_gem_object_pin_and_relocate(struct drm_obj *obj,
reloc_offset = obj_priv->gtt_offset + reloc->offset;
reloc_val = target_obj_priv->gtt_offset + reloc->delta;
- if ((ret = agp_map_subregion(dev_priv->agph,
- trunc_page(reloc_offset), PAGE_SIZE, &bsh)) != 0) {
- DRM_ERROR("map failed...\n");
- goto err;
- }
- /*
- * we do this differently to linux, in the case where the
- * presumed offset matches we actually read to check it's
- * correct, but at least it won't involve idling the gpu if
- * it was reading from it before, only if writing (which would
- * be bad anyway since we're now using it as a command buffer).
- */
if (target_obj_priv->gtt_offset == reloc->presumed_offset) {
- ret = i915_gem_object_set_to_gtt_domain(obj, 0, 1);
- if (ret != 0)
- goto err;
- if (bus_space_read_4(dev_priv->bst, bsh,
- reloc_offset & PAGE_MASK) == reloc_val) {
- agp_unmap_subregion(dev_priv->agph, bsh,
- PAGE_SIZE);
- drm_gem_object_unreference(target_obj);
- continue;
- }
- DRM_DEBUG("reloc tested and found incorrect\n");
+ drm_gem_object_unreference(target_obj);
+ continue;
}
ret = i915_gem_object_set_to_gtt_domain(obj, 1, 1);
- if (ret != 0) {
- agp_unmap_subregion(dev_priv->agph, bsh, PAGE_SIZE);
+ if (ret != 0)
+ goto err;
+
+ if ((ret = agp_map_subregion(dev_priv->agph,
+ trunc_page(reloc_offset), PAGE_SIZE, &bsh)) != 0) {
+ DRM_ERROR("map failed...\n");
goto err;
}