[Intel-gfx] [PATCH v2] drm/ttm: rework on ttm_resource to use size_t type

Matthew Auld matthew.william.auld at gmail.com
Tue Oct 25 16:57:42 UTC 2022


On Tue, 25 Oct 2022 at 16:51, Somalapuram Amaranath
<Amaranath.Somalapuram at amd.com> wrote:
>
> Change ttm_resource structure from num_pages to size_t size in bytes.
> v1 -> v2: change PFN_UP(dst_mem->size) to ttm->num_pages
> v1 -> v2: change bo->resource->size to bo->base.size at some places
> v1 -> v2: remove the local variable
> v1 -> v2: cleanup cmp_size_smaller_first()
>
> Signed-off-by: Somalapuram Amaranath <Amaranath.Somalapuram at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c    |  2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_object.c     |  3 ++-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_res_cursor.h |  4 ++--
>  drivers/gpu/drm/amd/amdgpu/amdgpu_trace.h      |  2 +-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c        |  6 +++---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c   |  8 ++++----
>  drivers/gpu/drm/i915/gem/i915_gem_ttm.c        |  2 +-
>  drivers/gpu/drm/i915/i915_scatterlist.c        |  4 ++--
>  drivers/gpu/drm/i915/i915_ttm_buddy_manager.c  | 12 ++++++------
>  drivers/gpu/drm/i915/intel_region_ttm.c        |  2 +-
>  drivers/gpu/drm/nouveau/nouveau_bo.c           |  4 ++--
>  drivers/gpu/drm/nouveau/nouveau_bo0039.c       |  4 ++--
>  drivers/gpu/drm/nouveau/nouveau_bo5039.c       |  2 +-
>  drivers/gpu/drm/nouveau/nouveau_bo74c1.c       |  2 +-
>  drivers/gpu/drm/nouveau/nouveau_bo85b5.c       |  4 ++--
>  drivers/gpu/drm/nouveau/nouveau_bo9039.c       |  4 ++--
>  drivers/gpu/drm/nouveau/nouveau_bo90b5.c       |  4 ++--
>  drivers/gpu/drm/nouveau/nouveau_boa0b5.c       |  2 +-
>  drivers/gpu/drm/nouveau/nouveau_gem.c          |  5 ++---
>  drivers/gpu/drm/nouveau/nouveau_mem.c          |  4 ++--
>  drivers/gpu/drm/nouveau/nouveau_ttm.c          |  2 +-
>  drivers/gpu/drm/radeon/radeon_cs.c             |  7 +++++--
>  drivers/gpu/drm/radeon/radeon_object.c         |  4 ++--
>  drivers/gpu/drm/radeon/radeon_trace.h          |  2 +-
>  drivers/gpu/drm/radeon/radeon_ttm.c            |  4 ++--
>  drivers/gpu/drm/ttm/ttm_bo.c                   |  3 ---
>  drivers/gpu/drm/ttm/ttm_bo_util.c              |  6 +++---
>  drivers/gpu/drm/ttm/ttm_bo_vm.c                |  4 ++--
>  drivers/gpu/drm/ttm/ttm_range_manager.c        |  2 +-
>  drivers/gpu/drm/ttm/ttm_resource.c             | 14 ++++++--------
>  drivers/gpu/drm/vmwgfx/vmwgfx_blit.c           |  4 ++--
>  drivers/gpu/drm/vmwgfx/vmwgfx_bo.c             |  6 +++---
>  drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c        |  2 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c        |  2 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c  |  6 +++---
>  drivers/gpu/drm/vmwgfx/vmwgfx_kms.c            |  2 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_page_dirty.c     |  6 +++---
>  include/drm/ttm/ttm_resource.h                 |  4 ++--
>  38 files changed, 79 insertions(+), 81 deletions(-)
>

<snip>

> diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c
> index 38119311284d..f86dc92965bb 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo_vm.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c
> @@ -217,7 +217,7 @@ vm_fault_t ttm_bo_vm_fault_reserved(struct vm_fault *vmf,
>         page_last = vma_pages(vma) + vma->vm_pgoff -
>                 drm_vma_node_start(&bo->base.vma_node);
>
> -       if (unlikely(page_offset >= bo->resource->num_pages))
> +       if (unlikely(page_offset >= bo->base.size))

At a glance it looks like we are missing PFN_UP(bo->base.size) for this one?


More information about the dri-devel mailing list