Message ID | 20210629073629.3069-1-nirmoy.das@amd.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [v2,1/2] drm/amdgpu: return early for non-TTM_PL_TT type BOs | expand |
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 >
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 >> >
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; }
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(-) -- 2.32.0