AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Nirmoy Das <nirmoy.das@amd.com>, dri-devel@lists.freedesktop.org
Cc: Felix.Kuehling@amd.com, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 2/2] drm/amdgpu: raise error on incorrect mem_type
Date: Tue, 29 Jun 2021 13:06:02 +0200	[thread overview]
Message-ID: <d5cf73d6-ede7-c2fe-1b1b-7cbc89ae9978@amd.com> (raw)
In-Reply-To: <20210629073629.3069-2-nirmoy.das@amd.com>



Am 29.06.21 um 09:36 schrieb Nirmoy Das:
> Be more defensive and raise error on wrong mem_type
> argument in amdgpu_gtt_mgr_has_gart_addr().
>
> Signed-off-by: Nirmoy Das <nirmoy.das@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
> index 543000304a1c..0b0fa87b115c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
> @@ -107,8 +107,12 @@ const struct attribute_group amdgpu_gtt_mgr_attr_group = {
>    */
>   bool amdgpu_gtt_mgr_has_gart_addr(struct ttm_resource *res)
>   {
> -	struct amdgpu_gtt_node *node = to_amdgpu_gtt_node(res);
> +	struct amdgpu_gtt_node *node;
> +
> +	if (WARN_ON(res->mem_type != TTM_PL_TT))
> +		return false;

I'm not sure that is a good idea. The GTT manager itself shouldn't have 
to deal with incorrect usage of it's component.

Christian.

>   
> +	node = to_amdgpu_gtt_node(res);
>   	return drm_mm_node_allocated(&node->base.mm_nodes[0]);
>   }
>   

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  reply	other threads:[~2021-06-29 11:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-29  7:36 [PATCH v2 1/2] drm/amdgpu: return early for non-TTM_PL_TT type BOs Nirmoy Das
2021-06-29  7:36 ` [PATCH 2/2] drm/amdgpu: raise error on incorrect mem_type Nirmoy Das
2021-06-29 11:06   ` Christian König [this message]
2021-06-29 11:43     ` Das, Nirmoy
2021-06-29 11:05 ` [PATCH v2 1/2] drm/amdgpu: return early for non-TTM_PL_TT type BOs Christian König
2021-06-29 11:09   ` Das, Nirmoy
  -- strict thread matches above, loose matches on Subject: below --
2021-06-25 17:28 [PATCH 1/2] drm/amdgpu: return early for preempt " Nirmoy Das
2021-06-25 17:28 ` [PATCH 2/2] drm/amdgpu: raise error on incorrect mem_type Nirmoy Das

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=d5cf73d6-ede7-c2fe-1b1b-7cbc89ae9978@amd.com \
    --to=christian.koenig@amd.com \
    --cc=Felix.Kuehling@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=nirmoy.das@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox