diff options
author | Matthew Auld <matthew.auld@intel.com> | 2022-07-11 10:58:59 +0200 |
---|---|---|
committer | Matthew Auld <matthew.auld@intel.com> | 2022-07-11 17:35:37 +0200 |
commit | bc99f1209f19fefa3ee11e77464ccfae541f4291 (patch) | |
tree | 8b51fff7ee7377908cb8efda769d4d0381a0111f /drivers/gpu/drm/i915/selftests/mock_region.c | |
parent | drm/i915/selftests: fix a couple IS_ERR() vs NULL tests (diff) | |
download | linux-bc99f1209f19fefa3ee11e77464ccfae541f4291.tar.xz linux-bc99f1209f19fefa3ee11e77464ccfae541f4291.zip |
drm/i915/ttm: fix sg_table construction
If we encounter some monster sized local-memory page that exceeds the
maximum sg length (UINT32_MAX), ensure that don't end up with some
misaligned address in the entry that follows, leading to fireworks
later. Also ensure we have some coverage of this in the selftests.
v2(Chris):
- Use round_down consistently to avoid udiv errors
v3(Nirmoy):
- Also update the max_segment in the selftest
Fixes: f701b16d4cc5 ("drm/i915/ttm: add i915_sg_from_buddy_resource")
Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/6379
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Nirmoy Das <nirmoy.das@linux.intel.com>
Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220711085859.24198-1-matthew.auld@intel.com
Diffstat (limited to 'drivers/gpu/drm/i915/selftests/mock_region.c')
-rw-r--r-- | drivers/gpu/drm/i915/selftests/mock_region.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/selftests/mock_region.c b/drivers/gpu/drm/i915/selftests/mock_region.c index 670557ce1024..bac21fe84ca5 100644 --- a/drivers/gpu/drm/i915/selftests/mock_region.c +++ b/drivers/gpu/drm/i915/selftests/mock_region.c @@ -33,7 +33,8 @@ static int mock_region_get_pages(struct drm_i915_gem_object *obj) return PTR_ERR(obj->mm.res); obj->mm.rsgt = intel_region_ttm_resource_to_rsgt(obj->mm.region, - obj->mm.res); + obj->mm.res, + obj->mm.region->min_page_size); if (IS_ERR(obj->mm.rsgt)) { err = PTR_ERR(obj->mm.rsgt); goto err_free_resource; |