Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Somalapuram Amaranath <Amaranath.Somalapuram@amd.com>,
	dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org,
	intel-gfx@lists.freedesktop.org
Cc: alexander.deucher@amd.com, arunpravin.paneerselvam@amd.com
Subject: Re: [Intel-gfx] [PATCH v3 3/4] drm/amdgpu: Clean up page shift operation and GWS and OA
Date: Wed, 11 Jan 2023 10:11:29 +0100	[thread overview]
Message-ID: <c15c5f15-4356-1181-cf2f-6b4d8405a34a@amd.com> (raw)
In-Reply-To: <20230111063524.2374038-3-Amaranath.Somalapuram@amd.com>

Am 11.01.23 um 07:35 schrieb Somalapuram Amaranath:
> Remove page shift operations as ttm_resource moved
> from num_pages to size_t size in bytes.

This patch here is at least missing to remove the shifts in 
amdgpu_job_set_resources():


         if (gds) {
                 job->gds_base = amdgpu_bo_gpu_offset(gds) >> PAGE_SHIFT;
                 job->gds_size = amdgpu_bo_size(gds) >> PAGE_SHIFT;
         }
         if (gws) {
                 job->gws_base = amdgpu_bo_gpu_offset(gws) >> PAGE_SHIFT;
                 job->gws_size = amdgpu_bo_size(gws) >> PAGE_SHIFT;
         }
         if (oa) {
                 job->oa_base = amdgpu_bo_gpu_offset(oa) >> PAGE_SHIFT;
                 job->oa_size = amdgpu_bo_size(oa) >> PAGE_SHIFT;
         }

As well as adjusting the call to amdgpu_ttm_init_on_chip() to be in 
bytes and not pages.

There are probably more places which I missed to mention as well.

Regards,
Christian.

>
> Signed-off-by: Somalapuram Amaranath <Amaranath.Somalapuram@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_object.c     |  4 +---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_res_cursor.h | 12 ++++++------
>   2 files changed, 7 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index 974e85d8b6cc..19ad365dc159 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -541,12 +541,10 @@ int amdgpu_bo_create(struct amdgpu_device *adev,
>   	if (bp->domain & (AMDGPU_GEM_DOMAIN_GWS | AMDGPU_GEM_DOMAIN_OA)) {
>   		/* GWS and OA don't need any alignment. */
>   		page_align = bp->byte_align;
> -		size <<= PAGE_SHIFT;
> -
>   	} else if (bp->domain & AMDGPU_GEM_DOMAIN_GDS) {
>   		/* Both size and alignment must be a multiple of 4. */
>   		page_align = ALIGN(bp->byte_align, 4);
> -		size = ALIGN(size, 4) << PAGE_SHIFT;
> +		size = ALIGN(size, 4);
>   	} else {
>   		/* Memory should be aligned at least to a page size. */
>   		page_align = ALIGN(bp->byte_align, PAGE_SIZE) >> PAGE_SHIFT;
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_res_cursor.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_res_cursor.h
> index 5c4f93ee0c57..f92b61350efe 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_res_cursor.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_res_cursor.h
> @@ -91,11 +91,11 @@ static inline void amdgpu_res_first(struct ttm_resource *res,
>   		break;
>   	case TTM_PL_TT:
>   		node = to_ttm_range_mgr_node(res)->mm_nodes;
> -		while (start >= node->size << PAGE_SHIFT)
> -			start -= node++->size << PAGE_SHIFT;
> +		while (start >= node->size)
> +			start -= node++->size;
>   
> -		cur->start = (node->start << PAGE_SHIFT) + start;
> -		cur->size = min((node->size << PAGE_SHIFT) - start, size);
> +		cur->start = (node->start) + start;
> +		cur->size = min(node->size - start, size);
>   		cur->remaining = size;
>   		cur->node = node;
>   		break;
> @@ -155,8 +155,8 @@ static inline void amdgpu_res_next(struct amdgpu_res_cursor *cur, uint64_t size)
>   		node = cur->node;
>   
>   		cur->node = ++node;
> -		cur->start = node->start << PAGE_SHIFT;
> -		cur->size = min(node->size << PAGE_SHIFT, cur->remaining);
> +		cur->start = node->start;
> +		cur->size = min(node->size, cur->remaining);
>   		break;
>   	default:
>   		return;


  reply	other threads:[~2023-01-11  9:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-11  6:35 [Intel-gfx] [PATCH v3 1/4] drm/ttm: Clean up page shift operation Somalapuram Amaranath
2023-01-11  6:35 ` [Intel-gfx] [PATCH v3 2/4] drm/gem: Remove BUG_ON in drm_gem_private_object_init Somalapuram Amaranath
2023-01-11  9:12   ` Christian König
2023-01-11  6:35 ` [Intel-gfx] [PATCH v3 3/4] drm/amdgpu: Clean up page shift operation and GWS and OA Somalapuram Amaranath
2023-01-11  9:11   ` Christian König [this message]
2023-01-11  6:35 ` [Intel-gfx] [PATCH v3 4/4] drm/i915: Clean up page shift operation Somalapuram Amaranath
2023-01-11  9:13 ` [Intel-gfx] [PATCH v3 1/4] drm/ttm: " Christian König
2023-01-11 12:15 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for series starting with [v3,1/4] " Patchwork
2023-01-15 16:23 ` [Intel-gfx] [PATCH v3 1/4] " kernel test robot

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=c15c5f15-4356-1181-cf2f-6b4d8405a34a@amd.com \
    --to=christian.koenig@amd.com \
    --cc=Amaranath.Somalapuram@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=arunpravin.paneerselvam@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@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