[PATCH 2/2] drm/amdgpu: re-apply "move internal vram_mgr function into the C file""

Arunpravin Paneer Selvam arunpravin.paneerselvam at amd.com
Thu Jul 14 13:26:40 UTC 2022


Hi Christian,

I verified the patch.

Reviewed-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam at amd.com>

Thanks,
Arun

On 7/14/2022 6:53 PM, Christian König wrote:
> This re-applys commit 708d19d9f362766147cab79eccae60912c6d3068.
>
> The original problem this was reverted for was found and the correct fix
> will be merged to drm-misc-next-fixes.
>
> Signed-off-by: Christian König<christian.koenig at amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 29 ++++++++++++++++++++
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h | 27 ------------------
>   2 files changed, 29 insertions(+), 27 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
> index 51d9d3a4456c..7a5e8a7b4a1b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
> @@ -50,6 +50,35 @@ to_amdgpu_device(struct amdgpu_vram_mgr *mgr)
>   	return container_of(mgr, struct amdgpu_device, mman.vram_mgr);
>   }
>   
> +static inline struct drm_buddy_block *
> +amdgpu_vram_mgr_first_block(struct list_head *list)
> +{
> +	return list_first_entry_or_null(list, struct drm_buddy_block, link);
> +}
> +
> +static inline bool amdgpu_is_vram_mgr_blocks_contiguous(struct list_head *head)
> +{
> +	struct drm_buddy_block *block;
> +	u64 start, size;
> +
> +	block = amdgpu_vram_mgr_first_block(head);
> +	if (!block)
> +		return false;
> +
> +	while (head != block->link.next) {
> +		start = amdgpu_vram_mgr_block_start(block);
> +		size = amdgpu_vram_mgr_block_size(block);
> +
> +		block = list_entry(block->link.next, struct drm_buddy_block, link);
> +		if (start + size != amdgpu_vram_mgr_block_start(block))
> +			return false;
> +	}
> +
> +	return true;
> +}
> +
> +
> +
>   /**
>    * DOC: mem_info_vram_total
>    *
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h
> index 9a2db87186c7..4b267bf1c5db 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.h
> @@ -53,33 +53,6 @@ static inline u64 amdgpu_vram_mgr_block_size(struct drm_buddy_block *block)
>   	return PAGE_SIZE << drm_buddy_block_order(block);
>   }
>   
> -static inline struct drm_buddy_block *
> -amdgpu_vram_mgr_first_block(struct list_head *list)
> -{
> -	return list_first_entry_or_null(list, struct drm_buddy_block, link);
> -}
> -
> -static inline bool amdgpu_is_vram_mgr_blocks_contiguous(struct list_head *head)
> -{
> -	struct drm_buddy_block *block;
> -	u64 start, size;
> -
> -	block = amdgpu_vram_mgr_first_block(head);
> -	if (!block)
> -		return false;
> -
> -	while (head != block->link.next) {
> -		start = amdgpu_vram_mgr_block_start(block);
> -		size = amdgpu_vram_mgr_block_size(block);
> -
> -		block = list_entry(block->link.next, struct drm_buddy_block, link);
> -		if (start + size != amdgpu_vram_mgr_block_start(block))
> -			return false;
> -	}
> -
> -	return true;
> -}
> -
>   static inline struct amdgpu_vram_mgr_resource *
>   to_amdgpu_vram_mgr_resource(struct ttm_resource *res)
>   {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20220714/cdbb5973/attachment.htm>


More information about the amd-gfx mailing list