Commit 6e0c5bf0 authored by Matthew Auld's avatar Matthew Auld

drm/i915/selftests: handle allocation failures

If we have to contend with non-mappable LMEM, then we need to ensure the
object fits within the mappable portion, like in the selftests, where we
later try to CPU access the pages. However if it can't then we need to
gracefully handle this, without throwing an error.

Also it looks like TTM will return -ENOMEM, in ttm_bo_mem_space() after
exhausting all possible placements.
Signed-off-by: default avatarMatthew Auld <matthew.auld@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: default avatarThomas Hellström <thomas.hellstrom@linux.intel.com>
Acked-by: default avatarNirmoy Das <nirmoy.das@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220228123607.580432-3-matthew.auld@intel.com
parent 503725c2
...@@ -1345,7 +1345,7 @@ static int igt_ppgtt_smoke_huge(void *arg) ...@@ -1345,7 +1345,7 @@ static int igt_ppgtt_smoke_huge(void *arg)
err = i915_gem_object_pin_pages_unlocked(obj); err = i915_gem_object_pin_pages_unlocked(obj);
if (err) { if (err) {
if (err == -ENXIO || err == -E2BIG) { if (err == -ENXIO || err == -E2BIG || err == -ENOMEM) {
i915_gem_object_put(obj); i915_gem_object_put(obj);
size >>= 1; size >>= 1;
goto try_again; goto try_again;
......
...@@ -822,8 +822,14 @@ static int igt_lmem_create_with_ps(void *arg) ...@@ -822,8 +822,14 @@ static int igt_lmem_create_with_ps(void *arg)
i915_gem_object_lock(obj, NULL); i915_gem_object_lock(obj, NULL);
err = i915_gem_object_pin_pages(obj); err = i915_gem_object_pin_pages(obj);
if (err) if (err) {
if (err == -ENXIO || err == -E2BIG || err == -ENOMEM) {
pr_info("%s not enough lmem for ps(%u) err=%d\n",
__func__, ps, err);
err = 0;
}
goto out_put; goto out_put;
}
daddr = i915_gem_object_get_dma_address(obj, 0); daddr = i915_gem_object_get_dma_address(obj, 0);
if (!IS_ALIGNED(daddr, ps)) { if (!IS_ALIGNED(daddr, ps)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment