]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915/ttm: fix large buffer population trucation
authorRobert Beckett <bob.beckett@collabora.com>
Fri, 10 Dec 2021 19:50:05 +0000 (19:50 +0000)
committerMatthew Auld <matthew.auld@intel.com>
Tue, 14 Dec 2021 14:40:10 +0000 (14:40 +0000)
ttm->num_pages is uint32_t which was causing very large buffers to
only populate a truncated size.

This fixes gem_create@create-clear igt test on large memory systems.

Fixes: d659f0ef280f ("drm/i915/ttm: add tt shmem backend")
Signed-off-by: Robert Beckett <bob.beckett@collabora.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20211210195005.2582884-1-bob.beckett@collabora.com
drivers/gpu/drm/i915/gem/i915_gem_ttm.c

index 218a9b3037c72ebf11fc6952b454a0e0f65b2dc7..923cc7ad8d7070304f3021a4ee5d5eb55c396070 100644 (file)
@@ -166,7 +166,7 @@ static int i915_ttm_tt_shmem_populate(struct ttm_device *bdev,
        struct intel_memory_region *mr = i915->mm.regions[INTEL_MEMORY_SYSTEM];
        struct i915_ttm_tt *i915_tt = container_of(ttm, typeof(*i915_tt), ttm);
        const unsigned int max_segment = i915_sg_segment_size();
-       const size_t size = ttm->num_pages << PAGE_SHIFT;
+       const size_t size = (size_t)ttm->num_pages << PAGE_SHIFT;
        struct file *filp = i915_tt->filp;
        struct sgt_iter sgt_iter;
        struct sg_table *st;