drm/i915/selftests/perf: watch out for stolen objects
authorMatthew Auld <matthew.auld@intel.com>
Mon, 23 Mar 2020 11:03:01 +0000 (11:03 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Mon, 23 Mar 2020 11:52:34 +0000 (11:52 +0000)
Stolen memory is allocated at creation, returning -ENOSPC if we run out
space.

Closes: https://gitlab.freedesktop.org/drm/intel/issues/1424
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20200323110301.38806-1-matthew.auld@intel.com
drivers/gpu/drm/i915/selftests/intel_memory_region.c

index 2a1d4ba1f9f3a798d4e568e4e356144a755a4a5e..6e80d99048e4bd363e04abf493336fd2cd9d11ec 100644 (file)
@@ -594,8 +594,11 @@ create_region_for_mapping(struct intel_memory_region *mr, u64 size, u32 type,
        void *addr;
 
        obj = i915_gem_object_create_region(mr, size, 0);
-       if (IS_ERR(obj))
+       if (IS_ERR(obj)) {
+               if (PTR_ERR(obj) == -ENOSPC) /* Stolen memory */
+                       return ERR_PTR(-ENODEV);
                return obj;
+       }
 
        addr = i915_gem_object_pin_map(obj, type);
        if (IS_ERR(addr)) {