Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: Somalapuram Amaranath <Amaranath.Somalapuram@amd.com>,
	dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org,
	intel-gfx@lists.freedesktop.org, nouveau@lists.freedesktop.org
Cc: alexander.deucher@amd.com, christian.koenig@amd.com,
	arunpravin.paneerselvam@amd.com
Subject: Re: [Intel-gfx]  [PATCH 3/6] drm/i915: fix’s on ttm_resource rework to use size_t type
Date: Wed, 19 Oct 2022 18:44:49 +0200	[thread overview]
Message-ID: <5075ed5c-0cc0-2351-bc51-58fe2bd06de7@gmail.com> (raw)
In-Reply-To: <20221019152736.654451-3-Amaranath.Somalapuram@amd.com>

Am 19.10.22 um 17:27 schrieb Somalapuram Amaranath:
> Fix the ttm_resource from num_pages to size_t size.
>
> Signed-off-by: Somalapuram Amaranath <Amaranath.Somalapuram@amd.com>

Acked-by: Christian König <christian.koenig@amd.com>

> ---
>   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 +-
>   4 files changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
> index 4f861782c3e8..7a1e92c11946 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
> @@ -649,7 +649,7 @@ bool i915_ttm_resource_mappable(struct ttm_resource *res)
>   	if (!i915_ttm_cpu_maps_iomem(res))
>   		return true;
>   
> -	return bman_res->used_visible_size == bman_res->base.num_pages;
> +	return bman_res->used_visible_size == PFN_UP(bman_res->base.size);
>   }
>   
>   static int i915_ttm_io_mem_reserve(struct ttm_device *bdev, struct ttm_resource *mem)
> diff --git a/drivers/gpu/drm/i915/i915_scatterlist.c b/drivers/gpu/drm/i915/i915_scatterlist.c
> index dcc081874ec8..114e5e39aa72 100644
> --- a/drivers/gpu/drm/i915/i915_scatterlist.c
> +++ b/drivers/gpu/drm/i915/i915_scatterlist.c
> @@ -158,7 +158,7 @@ struct i915_refct_sgt *i915_rsgt_from_buddy_resource(struct ttm_resource *res,
>   						     u32 page_alignment)
>   {
>   	struct i915_ttm_buddy_resource *bman_res = to_ttm_buddy_resource(res);
> -	const u64 size = res->num_pages << PAGE_SHIFT;
> +	const u64 size = res->size;
>   	const u32 max_segment = round_down(UINT_MAX, page_alignment);
>   	struct drm_buddy *mm = bman_res->mm;
>   	struct list_head *blocks = &bman_res->blocks;
> @@ -177,7 +177,7 @@ struct i915_refct_sgt *i915_rsgt_from_buddy_resource(struct ttm_resource *res,
>   
>   	i915_refct_sgt_init(rsgt, size);
>   	st = &rsgt->table;
> -	if (sg_alloc_table(st, res->num_pages, GFP_KERNEL)) {
> +	if (sg_alloc_table(st, PFN_UP(res->size), GFP_KERNEL)) {
>   		i915_refct_sgt_put(rsgt);
>   		return ERR_PTR(-ENOMEM);
>   	}
> diff --git a/drivers/gpu/drm/i915/i915_ttm_buddy_manager.c b/drivers/gpu/drm/i915/i915_ttm_buddy_manager.c
> index e19452f0e100..7e611476c7a4 100644
> --- a/drivers/gpu/drm/i915/i915_ttm_buddy_manager.c
> +++ b/drivers/gpu/drm/i915/i915_ttm_buddy_manager.c
> @@ -62,8 +62,8 @@ static int i915_ttm_buddy_man_alloc(struct ttm_resource_manager *man,
>   	if (place->fpfn || lpfn != man->size)
>   		bman_res->flags |= DRM_BUDDY_RANGE_ALLOCATION;
>   
> -	GEM_BUG_ON(!bman_res->base.num_pages);
> -	size = bman_res->base.num_pages << PAGE_SHIFT;
> +	GEM_BUG_ON(!bman_res->base.size);
> +	size = bman_res->base.size;
>   
>   	min_page_size = bman->default_page_size;
>   	if (bo->page_alignment)
> @@ -72,7 +72,7 @@ static int i915_ttm_buddy_man_alloc(struct ttm_resource_manager *man,
>   	GEM_BUG_ON(min_page_size < mm->chunk_size);
>   	GEM_BUG_ON(!IS_ALIGNED(size, min_page_size));
>   
> -	if (place->fpfn + bman_res->base.num_pages != place->lpfn &&
> +	if (place->fpfn + PFN_UP(bman_res->base.size) != place->lpfn &&
>   	    place->flags & TTM_PL_FLAG_CONTIGUOUS) {
>   		unsigned long pages;
>   
> @@ -108,7 +108,7 @@ static int i915_ttm_buddy_man_alloc(struct ttm_resource_manager *man,
>   		goto err_free_blocks;
>   
>   	if (place->flags & TTM_PL_FLAG_CONTIGUOUS) {
> -		u64 original_size = (u64)bman_res->base.num_pages << PAGE_SHIFT;
> +		u64 original_size = (u64)bman_res->base.size;
>   
>   		drm_buddy_block_trim(mm,
>   				     original_size,
> @@ -116,7 +116,7 @@ static int i915_ttm_buddy_man_alloc(struct ttm_resource_manager *man,
>   	}
>   
>   	if (lpfn <= bman->visible_size) {
> -		bman_res->used_visible_size = bman_res->base.num_pages;
> +		bman_res->used_visible_size = PFN_UP(bman_res->base.size);
>   	} else {
>   		struct drm_buddy_block *block;
>   
> @@ -228,7 +228,7 @@ static bool i915_ttm_buddy_man_compatible(struct ttm_resource_manager *man,
>   
>   	if (!place->fpfn &&
>   	    place->lpfn == i915_ttm_buddy_man_visible_size(man))
> -		return bman_res->used_visible_size == res->num_pages;
> +		return bman_res->used_visible_size == PFN_UP(res->size);
>   
>   	/* Check each drm buddy block individually */
>   	list_for_each_entry(block, &bman_res->blocks, link) {
> diff --git a/drivers/gpu/drm/i915/intel_region_ttm.c b/drivers/gpu/drm/i915/intel_region_ttm.c
> index 575d67bc6ffe..cf89d0c2a2d9 100644
> --- a/drivers/gpu/drm/i915/intel_region_ttm.c
> +++ b/drivers/gpu/drm/i915/intel_region_ttm.c
> @@ -244,7 +244,7 @@ void intel_region_ttm_resource_free(struct intel_memory_region *mem,
>   	struct ttm_resource_manager *man = mem->region_private;
>   	struct ttm_buffer_object mock_bo = {};
>   
> -	mock_bo.base.size = res->num_pages << PAGE_SHIFT;
> +	mock_bo.base.size = res->size;
>   	mock_bo.bdev = &mem->i915->bdev;
>   	res->bo = &mock_bo;
>   


  reply	other threads:[~2022-10-19 16:44 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-19 15:27 [Intel-gfx] [PATCH 1/6] drm/ttm: rework on ttm_resource to use size_t type Somalapuram Amaranath
2022-10-19 15:27 ` [Intel-gfx] [PATCH 2/6] drm/amd: fix’s on ttm_resource rework " Somalapuram Amaranath
2022-10-19 16:43   ` Christian König
2022-10-19 15:27 ` [Intel-gfx] [PATCH 3/6] drm/i915: " Somalapuram Amaranath
2022-10-19 16:44   ` Christian König [this message]
2022-10-19 15:27 ` [Intel-gfx] [PATCH 4/6] drm/nouveau: " Somalapuram Amaranath
2022-10-19 16:48   ` Christian König
2022-10-19 15:27 ` [Intel-gfx] [PATCH 5/6] drm/radeon: " Somalapuram Amaranath
2022-10-19 16:53   ` Christian König
2022-10-19 15:27 ` [Intel-gfx] [PATCH 6/6] drm/vmwgfx: " Somalapuram Amaranath
2022-10-19 16:42 ` [Intel-gfx] [PATCH 1/6] drm/ttm: rework on ttm_resource " Christian König
2022-10-20  3:56 ` kernel test robot
2022-10-20  7:49 ` kernel test robot
2022-10-24 15:15 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/6] " Patchwork
2022-10-24 15:15 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-10-24 15:34 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5075ed5c-0cc0-2351-bc51-58fe2bd06de7@gmail.com \
    --to=ckoenig.leichtzumerken@gmail.com \
    --cc=Amaranath.Somalapuram@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=arunpravin.paneerselvam@amd.com \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=nouveau@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox