* [PATCH v2 1/2] drm/amdgpu: return early for non-TTM_PL_TT type BOs
@ 2021-06-29 7:36 ` Nirmoy Das
0 siblings, 0 replies; 14+ messages in thread
From: Nirmoy Das @ 2021-06-29 7:36 UTC (permalink / raw)
To: dri-devel; +Cc: Felix.Kuehling, Nirmoy Das, Christian.Koenig, amd-gfx
Return early for non-TTM_PL_TT BOs so that we don't pass
wrong pointer to amdgpu_gtt_mgr_has_gart_addr() which assumes
ttm_resource argument to be TTM_PL_TT type BO's.
v2: merge if-conditions
Signed-off-by: Nirmoy Das <nirmoy.das@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index b46726e47bce..208bc3ec1aff 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -926,7 +926,8 @@ static int amdgpu_ttm_backend_bind(struct ttm_device *bdev,
bo_mem->mem_type == AMDGPU_PL_OA)
return -EINVAL;
- if (!amdgpu_gtt_mgr_has_gart_addr(bo_mem)) {
+ if ((bo_mem->mem_type != TTM_PL_TT) ||
+ !amdgpu_gtt_mgr_has_gart_addr(bo_mem)) {
gtt->offset = AMDGPU_BO_INVALID_OFFSET;
return 0;
}
--
2.32.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 1/2] drm/amdgpu: return early for non-TTM_PL_TT type BOs
@ 2021-06-29 7:36 ` Nirmoy Das
0 siblings, 0 replies; 14+ messages in thread
From: Nirmoy Das @ 2021-06-29 7:36 UTC (permalink / raw)
To: dri-devel; +Cc: Felix.Kuehling, Nirmoy Das, Christian.Koenig, amd-gfx
Return early for non-TTM_PL_TT BOs so that we don't pass
wrong pointer to amdgpu_gtt_mgr_has_gart_addr() which assumes
ttm_resource argument to be TTM_PL_TT type BO's.
v2: merge if-conditions
Signed-off-by: Nirmoy Das <nirmoy.das@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index b46726e47bce..208bc3ec1aff 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -926,7 +926,8 @@ static int amdgpu_ttm_backend_bind(struct ttm_device *bdev,
bo_mem->mem_type == AMDGPU_PL_OA)
return -EINVAL;
- if (!amdgpu_gtt_mgr_has_gart_addr(bo_mem)) {
+ if ((bo_mem->mem_type != TTM_PL_TT) ||
+ !amdgpu_gtt_mgr_has_gart_addr(bo_mem)) {
gtt->offset = AMDGPU_BO_INVALID_OFFSET;
return 0;
}
--
2.32.0
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 2/2] drm/amdgpu: raise error on incorrect mem_type
2021-06-29 7:36 ` Nirmoy Das
@ 2021-06-29 7:36 ` Nirmoy Das
-1 siblings, 0 replies; 14+ messages in thread
From: Nirmoy Das @ 2021-06-29 7:36 UTC (permalink / raw)
To: dri-devel; +Cc: Felix.Kuehling, Nirmoy Das, Christian.Koenig, amd-gfx
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;
+ node = to_amdgpu_gtt_node(res);
return drm_mm_node_allocated(&node->base.mm_nodes[0]);
}
--
2.32.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 2/2] drm/amdgpu: raise error on incorrect mem_type
@ 2021-06-29 7:36 ` Nirmoy Das
0 siblings, 0 replies; 14+ messages in thread
From: Nirmoy Das @ 2021-06-29 7:36 UTC (permalink / raw)
To: dri-devel; +Cc: Felix.Kuehling, Nirmoy Das, Christian.Koenig, amd-gfx
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;
+ node = to_amdgpu_gtt_node(res);
return drm_mm_node_allocated(&node->base.mm_nodes[0]);
}
--
2.32.0
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH v2 1/2] drm/amdgpu: return early for non-TTM_PL_TT type BOs
2021-06-29 7:36 ` Nirmoy Das
@ 2021-06-29 11:05 ` Christian König
-1 siblings, 0 replies; 14+ messages in thread
From: Christian König @ 2021-06-29 11:05 UTC (permalink / raw)
To: Nirmoy Das, dri-devel; +Cc: Felix.Kuehling, amd-gfx
Am 29.06.21 um 09:36 schrieb Nirmoy Das:
> Return early for non-TTM_PL_TT BOs so that we don't pass
> wrong pointer to amdgpu_gtt_mgr_has_gart_addr() which assumes
> ttm_resource argument to be TTM_PL_TT type BO's.
>
> v2: merge if-conditions
>
> Signed-off-by: Nirmoy Das <nirmoy.das@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> index b46726e47bce..208bc3ec1aff 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -926,7 +926,8 @@ static int amdgpu_ttm_backend_bind(struct ttm_device *bdev,
> bo_mem->mem_type == AMDGPU_PL_OA)
> return -EINVAL;
>
> - if (!amdgpu_gtt_mgr_has_gart_addr(bo_mem)) {
> + if ((bo_mem->mem_type != TTM_PL_TT) ||
Please drop the extra (), apart from that the patch is Reviewed-by:
Christian König <christian.koenig@amd.com>
> + !amdgpu_gtt_mgr_has_gart_addr(bo_mem)) {
> gtt->offset = AMDGPU_BO_INVALID_OFFSET;
> return 0;
> }
> --
> 2.32.0
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 1/2] drm/amdgpu: return early for non-TTM_PL_TT type BOs
@ 2021-06-29 11:05 ` Christian König
0 siblings, 0 replies; 14+ messages in thread
From: Christian König @ 2021-06-29 11:05 UTC (permalink / raw)
To: Nirmoy Das, dri-devel; +Cc: Felix.Kuehling, amd-gfx
Am 29.06.21 um 09:36 schrieb Nirmoy Das:
> Return early for non-TTM_PL_TT BOs so that we don't pass
> wrong pointer to amdgpu_gtt_mgr_has_gart_addr() which assumes
> ttm_resource argument to be TTM_PL_TT type BO's.
>
> v2: merge if-conditions
>
> Signed-off-by: Nirmoy Das <nirmoy.das@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> index b46726e47bce..208bc3ec1aff 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -926,7 +926,8 @@ static int amdgpu_ttm_backend_bind(struct ttm_device *bdev,
> bo_mem->mem_type == AMDGPU_PL_OA)
> return -EINVAL;
>
> - if (!amdgpu_gtt_mgr_has_gart_addr(bo_mem)) {
> + if ((bo_mem->mem_type != TTM_PL_TT) ||
Please drop the extra (), apart from that the patch is Reviewed-by:
Christian König <christian.koenig@amd.com>
> + !amdgpu_gtt_mgr_has_gart_addr(bo_mem)) {
> gtt->offset = AMDGPU_BO_INVALID_OFFSET;
> return 0;
> }
> --
> 2.32.0
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/2] drm/amdgpu: raise error on incorrect mem_type
2021-06-29 7:36 ` Nirmoy Das
@ 2021-06-29 11:06 ` Christian König
-1 siblings, 0 replies; 14+ messages in thread
From: Christian König @ 2021-06-29 11:06 UTC (permalink / raw)
To: Nirmoy Das, dri-devel; +Cc: Felix.Kuehling, amd-gfx
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]);
> }
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/2] drm/amdgpu: raise error on incorrect mem_type
@ 2021-06-29 11:06 ` Christian König
0 siblings, 0 replies; 14+ messages in thread
From: Christian König @ 2021-06-29 11:06 UTC (permalink / raw)
To: Nirmoy Das, dri-devel; +Cc: Felix.Kuehling, amd-gfx
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
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 1/2] drm/amdgpu: return early for non-TTM_PL_TT type BOs
2021-06-29 11:05 ` Christian König
@ 2021-06-29 11:09 ` Das, Nirmoy
-1 siblings, 0 replies; 14+ messages in thread
From: Das, Nirmoy @ 2021-06-29 11:09 UTC (permalink / raw)
To: Christian König, dri-devel; +Cc: Felix.Kuehling, amd-gfx
On 6/29/2021 1:05 PM, Christian König wrote:
> Am 29.06.21 um 09:36 schrieb Nirmoy Das:
>> Return early for non-TTM_PL_TT BOs so that we don't pass
>> wrong pointer to amdgpu_gtt_mgr_has_gart_addr() which assumes
>> ttm_resource argument to be TTM_PL_TT type BO's.
>>
>> v2: merge if-conditions
>>
>> Signed-off-by: Nirmoy Das <nirmoy.das@amd.com>
>
>> ---
>> drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> index b46726e47bce..208bc3ec1aff 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> @@ -926,7 +926,8 @@ static int amdgpu_ttm_backend_bind(struct
>> ttm_device *bdev,
>> bo_mem->mem_type == AMDGPU_PL_OA)
>> return -EINVAL;
>>
>> - if (!amdgpu_gtt_mgr_has_gart_addr(bo_mem)) {
>> + if ((bo_mem->mem_type != TTM_PL_TT) ||
>
> Please drop the extra (), apart from that the patch is Reviewed-by:
> Christian König <christian.koenig@amd.com>
Thanks, I will send a next revision.
Nirmoy
>
>> + !amdgpu_gtt_mgr_has_gart_addr(bo_mem)) {
>> gtt->offset = AMDGPU_BO_INVALID_OFFSET;
>> return 0;
>> }
>> --
>> 2.32.0
>>
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 1/2] drm/amdgpu: return early for non-TTM_PL_TT type BOs
@ 2021-06-29 11:09 ` Das, Nirmoy
0 siblings, 0 replies; 14+ messages in thread
From: Das, Nirmoy @ 2021-06-29 11:09 UTC (permalink / raw)
To: Christian König, dri-devel; +Cc: Felix.Kuehling, amd-gfx
On 6/29/2021 1:05 PM, Christian König wrote:
> Am 29.06.21 um 09:36 schrieb Nirmoy Das:
>> Return early for non-TTM_PL_TT BOs so that we don't pass
>> wrong pointer to amdgpu_gtt_mgr_has_gart_addr() which assumes
>> ttm_resource argument to be TTM_PL_TT type BO's.
>>
>> v2: merge if-conditions
>>
>> Signed-off-by: Nirmoy Das <nirmoy.das@amd.com>
>
>> ---
>> drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> index b46726e47bce..208bc3ec1aff 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
>> @@ -926,7 +926,8 @@ static int amdgpu_ttm_backend_bind(struct
>> ttm_device *bdev,
>> bo_mem->mem_type == AMDGPU_PL_OA)
>> return -EINVAL;
>>
>> - if (!amdgpu_gtt_mgr_has_gart_addr(bo_mem)) {
>> + if ((bo_mem->mem_type != TTM_PL_TT) ||
>
> Please drop the extra (), apart from that the patch is Reviewed-by:
> Christian König <christian.koenig@amd.com>
Thanks, I will send a next revision.
Nirmoy
>
>> + !amdgpu_gtt_mgr_has_gart_addr(bo_mem)) {
>> gtt->offset = AMDGPU_BO_INVALID_OFFSET;
>> return 0;
>> }
>> --
>> 2.32.0
>>
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/2] drm/amdgpu: raise error on incorrect mem_type
2021-06-29 11:06 ` Christian König
@ 2021-06-29 11:43 ` Das, Nirmoy
-1 siblings, 0 replies; 14+ messages in thread
From: Das, Nirmoy @ 2021-06-29 11:43 UTC (permalink / raw)
To: Christian König, dri-devel; +Cc: Felix.Kuehling, amd-gfx
On 6/29/2021 1:06 PM, Christian König wrote:
>
>
> 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.
This is in-case we accidentally use amdgpu_gtt_mgr_has_gart_addr() for
PREEMPT bo in future. I will drop it as the previous patch should give
us enough hint.
Regards,
Nirmoy
>
> Christian.
>
>> + node = to_amdgpu_gtt_node(res);
>> return drm_mm_node_allocated(&node->base.mm_nodes[0]);
>> }
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/2] drm/amdgpu: raise error on incorrect mem_type
@ 2021-06-29 11:43 ` Das, Nirmoy
0 siblings, 0 replies; 14+ messages in thread
From: Das, Nirmoy @ 2021-06-29 11:43 UTC (permalink / raw)
To: Christian König, dri-devel; +Cc: Felix.Kuehling, amd-gfx
On 6/29/2021 1:06 PM, Christian König wrote:
>
>
> 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.
This is in-case we accidentally use amdgpu_gtt_mgr_has_gart_addr() for
PREEMPT bo in future. I will drop it as the previous patch should give
us enough hint.
Regards,
Nirmoy
>
> 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
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 2/2] drm/amdgpu: raise error on incorrect mem_type
2021-06-25 17:28 [PATCH 1/2] drm/amdgpu: return early for preempt " Nirmoy Das
@ 2021-06-25 17:28 ` Nirmoy Das
0 siblings, 0 replies; 14+ messages in thread
From: Nirmoy Das @ 2021-06-25 17:28 UTC (permalink / raw)
To: dri-devel; +Cc: Felix.Kuehling, Nirmoy Das, Christian.Koenig, amd-gfx
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;
+ node = to_amdgpu_gtt_node(res);
return drm_mm_node_allocated(&node->base.mm_nodes[0]);
}
--
2.32.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 2/2] drm/amdgpu: raise error on incorrect mem_type
@ 2021-06-25 17:28 ` Nirmoy Das
0 siblings, 0 replies; 14+ messages in thread
From: Nirmoy Das @ 2021-06-25 17:28 UTC (permalink / raw)
To: dri-devel; +Cc: Felix.Kuehling, Nirmoy Das, Christian.Koenig, amd-gfx
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;
+ node = to_amdgpu_gtt_node(res);
return drm_mm_node_allocated(&node->base.mm_nodes[0]);
}
--
2.32.0
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 14+ messages in thread
end of thread, other threads:[~2021-06-29 11:43 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` Nirmoy Das
2021-06-29 7:36 ` [PATCH 2/2] drm/amdgpu: raise error on incorrect mem_type Nirmoy Das
2021-06-29 7:36 ` Nirmoy Das
2021-06-29 11:06 ` Christian König
2021-06-29 11:06 ` Christian König
2021-06-29 11:43 ` Das, Nirmoy
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:05 ` Christian König
2021-06-29 11:09 ` Das, Nirmoy
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
2021-06-25 17:28 ` Nirmoy Das
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.