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,
shashank.sharma@amd.com
Subject: Re: [PATCH 1/2] drm/ttm: Clean up page shift operation
Date: Wed, 16 Nov 2022 13:25:39 +0100 [thread overview]
Message-ID: <0fca1cf1-5373-53a1-25cd-7c700c90add1@amd.com> (raw)
In-Reply-To: <20221116085012.187756-1-Amaranath.Somalapuram@amd.com>
Am 16.11.22 um 09:50 schrieb Somalapuram Amaranath:
> remove page shift operations as ttm_resource moved
> from num_pages to size_t size in bytes.
>
> Signed-off-by: Somalapuram Amaranath <Amaranath.Somalapuram@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 4 +---
> drivers/gpu/drm/ttm/ttm_range_manager.c | 2 +-
> 2 files changed, 2 insertions(+), 4 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/ttm/ttm_range_manager.c b/drivers/gpu/drm/ttm/ttm_range_manager.c
> index 0a8bc0b7f380..4c7cba4ffdbf 100644
> --- a/drivers/gpu/drm/ttm/ttm_range_manager.c
> +++ b/drivers/gpu/drm/ttm/ttm_range_manager.c
> @@ -83,7 +83,7 @@ static int ttm_range_man_alloc(struct ttm_resource_manager *man,
>
> spin_lock(&rman->lock);
> ret = drm_mm_insert_node_in_range(mm, &node->mm_nodes[0],
> - PFN_UP(node->base.size),
> + node->base.size,
> bo->page_alignment, 0,
> place->fpfn, lpfn, mode);
You need to make sure that fpfn and lpfn are now page shifted instead.
Same for the overlap and compatible functions.
Regards,
Christian.
> spin_unlock(&rman->lock);
WARNING: multiple messages have this Message-ID (diff)
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 1/2] drm/ttm: Clean up page shift operation
Date: Wed, 16 Nov 2022 13:25:39 +0100 [thread overview]
Message-ID: <0fca1cf1-5373-53a1-25cd-7c700c90add1@amd.com> (raw)
In-Reply-To: <20221116085012.187756-1-Amaranath.Somalapuram@amd.com>
Am 16.11.22 um 09:50 schrieb Somalapuram Amaranath:
> remove page shift operations as ttm_resource moved
> from num_pages to size_t size in bytes.
>
> Signed-off-by: Somalapuram Amaranath <Amaranath.Somalapuram@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 4 +---
> drivers/gpu/drm/ttm/ttm_range_manager.c | 2 +-
> 2 files changed, 2 insertions(+), 4 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/ttm/ttm_range_manager.c b/drivers/gpu/drm/ttm/ttm_range_manager.c
> index 0a8bc0b7f380..4c7cba4ffdbf 100644
> --- a/drivers/gpu/drm/ttm/ttm_range_manager.c
> +++ b/drivers/gpu/drm/ttm/ttm_range_manager.c
> @@ -83,7 +83,7 @@ static int ttm_range_man_alloc(struct ttm_resource_manager *man,
>
> spin_lock(&rman->lock);
> ret = drm_mm_insert_node_in_range(mm, &node->mm_nodes[0],
> - PFN_UP(node->base.size),
> + node->base.size,
> bo->page_alignment, 0,
> place->fpfn, lpfn, mode);
You need to make sure that fpfn and lpfn are now page shifted instead.
Same for the overlap and compatible functions.
Regards,
Christian.
> spin_unlock(&rman->lock);
next prev parent reply other threads:[~2022-11-16 12:26 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-16 8:50 [PATCH 1/2] drm/ttm: Clean up page shift operation Somalapuram Amaranath
2022-11-16 8:50 ` [Intel-gfx] " Somalapuram Amaranath
2022-11-16 8:50 ` [PATCH 2/2] drm/gem: Remove BUG_ON in drm_gem_private_object_init Somalapuram Amaranath
2022-11-16 8:50 ` [Intel-gfx] " Somalapuram Amaranath
2022-11-16 9:20 ` Arunpravin Paneer Selvam
2022-11-16 9:20 ` [Intel-gfx] " Arunpravin Paneer Selvam
2022-11-16 10:26 ` Christian König
2022-11-16 10:26 ` [Intel-gfx] " Christian König
2022-11-22 5:18 ` Somalapuram, Amaranath
2022-11-22 5:18 ` [Intel-gfx] " Somalapuram, Amaranath
2022-11-22 6:23 ` Arunpravin Paneer Selvam
2022-11-22 6:23 ` [Intel-gfx] " Arunpravin Paneer Selvam
2022-11-16 12:25 ` Christian König [this message]
2022-11-16 12:25 ` [Intel-gfx] [PATCH 1/2] drm/ttm: Clean up page shift operation Christian König
2022-11-16 18:38 ` [Intel-gfx] ✓ Fi.CI.BAT: success for series starting with [1/2] " Patchwork
2022-11-17 1:08 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2022-11-18 2:45 ` [PATCH 1/2] " kernel test robot
2022-11-18 2:45 ` kernel test robot
2022-11-18 2:45 ` [Intel-gfx] " 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=0fca1cf1-5373-53a1-25cd-7c700c90add1@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 \
--cc=shashank.sharma@amd.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.