Message ID | 20210625172804.3193-1-nirmoy.das@amd.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/2] drm/amdgpu: return early for preempt type BOs | expand |
Am 25.06.21 um 19:28 schrieb Nirmoy Das: > Return early for AMDGPU_PL_PREEMPT 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. > > Signed-off-by: Nirmoy Das <nirmoy.das@amd.com> > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c > index b46726e47bce..3df06772a425 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c > @@ -926,6 +926,11 @@ static int amdgpu_ttm_backend_bind(struct ttm_device *bdev, > bo_mem->mem_type == AMDGPU_PL_OA) > return -EINVAL; > > + if (bo_mem->mem_type == AMDGPU_PL_PREEMPT) { Probably better to merge that into the if below. E.g. if bo_mem->mem_type != TTM_PL_TT || ..... Christian. > + gtt->offset = AMDGPU_BO_INVALID_OFFSET; > + return 0; > + } > + > if (!amdgpu_gtt_mgr_has_gart_addr(bo_mem)) { > gtt->offset = AMDGPU_BO_INVALID_OFFSET; > return 0;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c index b46726e47bce..3df06772a425 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c @@ -926,6 +926,11 @@ static int amdgpu_ttm_backend_bind(struct ttm_device *bdev, bo_mem->mem_type == AMDGPU_PL_OA) return -EINVAL; + if (bo_mem->mem_type == AMDGPU_PL_PREEMPT) { + gtt->offset = AMDGPU_BO_INVALID_OFFSET; + return 0; + } + if (!amdgpu_gtt_mgr_has_gart_addr(bo_mem)) { gtt->offset = AMDGPU_BO_INVALID_OFFSET; return 0;
Return early for AMDGPU_PL_PREEMPT 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. Signed-off-by: Nirmoy Das <nirmoy.das@amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 5 +++++ 1 file changed, 5 insertions(+)