diff options
author | Andrzej Hajda <[email protected]> | 2023-06-01 16:44:50 +0200 |
---|---|---|
committer | Andrzej Hajda <[email protected]> | 2023-06-02 14:01:23 +0200 |
commit | 4d4de1cbdb26829615d05e6b556011d308880e82 (patch) | |
tree | 3842af434398402a56b0068ef74b0d0981bfeb54 | |
parent | 1baeef6cd2229e01091c69cef042f6b688e194be (diff) |
drm/i915/gt: limit lmem allocation size to succeed on SmallBars
In case system is short on mappable memory (256MB on SmallBar) allocation
of two 1GB buffers will fail.
Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/8300
Signed-off-by: Andrzej Hajda <[email protected]>
Reviewed-by: Andi Shyti <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
-rw-r--r-- | drivers/gpu/drm/i915/gt/selftest_tlb.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/gpu/drm/i915/gt/selftest_tlb.c b/drivers/gpu/drm/i915/gt/selftest_tlb.c index 4493c8518e91..3bd6b540257b 100644 --- a/drivers/gpu/drm/i915/gt/selftest_tlb.c +++ b/drivers/gpu/drm/i915/gt/selftest_tlb.c @@ -190,11 +190,18 @@ out: static struct drm_i915_gem_object *create_lmem(struct intel_gt *gt) { + struct intel_memory_region *mr = gt->i915->mm.regions[INTEL_REGION_LMEM_0]; + resource_size_t size = SZ_1G; + /* * Allocation of largest possible page size allows to test all types - * of pages. + * of pages. To succeed with both allocations, especially in case of Small + * BAR, try to allocate no more than quarter of mappable memory. */ - return i915_gem_object_create_lmem(gt->i915, SZ_1G, I915_BO_ALLOC_CONTIGUOUS); + if (mr && size > mr->io_size / 4) + size = mr->io_size / 4; + + return i915_gem_object_create_lmem(gt->i915, size, I915_BO_ALLOC_CONTIGUOUS); } static struct drm_i915_gem_object *create_smem(struct intel_gt *gt) |