Message ID | 20241113125158.1959533-1-chenhuacai@loongson.cn (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/radeon: Use ttm_bo_move_null() in radeon_bo_move() | expand |
Am 13.11.24 um 13:51 schrieb Huacai Chen: > Since ttm_bo_move_null() is exactly the same as ttm_resource_free() + > ttm_bo_assign_mem(), we use ttm_bo_move_null() for the GTT --> SYSTEM > move case too. Then the code is more consistent as the SYSTEM --> GTT > move case. > > Signed-off-by: Huacai Chen <chenhuacai@loongson.cn> Looks reasonable to me, Acked-by: Christian König <christian.koenig@amd.com> > --- > drivers/gpu/drm/radeon/radeon_ttm.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c > index 69d0c12fa419..616d25c8c2de 100644 > --- a/drivers/gpu/drm/radeon/radeon_ttm.c > +++ b/drivers/gpu/drm/radeon/radeon_ttm.c > @@ -219,8 +219,7 @@ static int radeon_bo_move(struct ttm_buffer_object *bo, bool evict, > if (old_mem->mem_type == TTM_PL_TT && > new_mem->mem_type == TTM_PL_SYSTEM) { > radeon_ttm_tt_unbind(bo->bdev, bo->ttm); > - ttm_resource_free(bo, &bo->resource); > - ttm_bo_assign_mem(bo, new_mem); > + ttm_bo_move_null(bo, new_mem); > goto out; > } > if (rdev->ring[radeon_copy_ring_index(rdev)].ready &&
Applied. Thanks! Alex On Wed, Nov 13, 2024 at 8:04 AM Christian König <christian.koenig@amd.com> wrote: > > Am 13.11.24 um 13:51 schrieb Huacai Chen: > > Since ttm_bo_move_null() is exactly the same as ttm_resource_free() + > > ttm_bo_assign_mem(), we use ttm_bo_move_null() for the GTT --> SYSTEM > > move case too. Then the code is more consistent as the SYSTEM --> GTT > > move case. > > > > Signed-off-by: Huacai Chen <chenhuacai@loongson.cn> > > Looks reasonable to me, Acked-by: Christian König <christian.koenig@amd.com> > > > --- > > drivers/gpu/drm/radeon/radeon_ttm.c | 3 +-- > > 1 file changed, 1 insertion(+), 2 deletions(-) > > > > diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c > > index 69d0c12fa419..616d25c8c2de 100644 > > --- a/drivers/gpu/drm/radeon/radeon_ttm.c > > +++ b/drivers/gpu/drm/radeon/radeon_ttm.c > > @@ -219,8 +219,7 @@ static int radeon_bo_move(struct ttm_buffer_object *bo, bool evict, > > if (old_mem->mem_type == TTM_PL_TT && > > new_mem->mem_type == TTM_PL_SYSTEM) { > > radeon_ttm_tt_unbind(bo->bdev, bo->ttm); > > - ttm_resource_free(bo, &bo->resource); > > - ttm_bo_assign_mem(bo, new_mem); > > + ttm_bo_move_null(bo, new_mem); > > goto out; > > } > > if (rdev->ring[radeon_copy_ring_index(rdev)].ready && >
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c index 69d0c12fa419..616d25c8c2de 100644 --- a/drivers/gpu/drm/radeon/radeon_ttm.c +++ b/drivers/gpu/drm/radeon/radeon_ttm.c @@ -219,8 +219,7 @@ static int radeon_bo_move(struct ttm_buffer_object *bo, bool evict, if (old_mem->mem_type == TTM_PL_TT && new_mem->mem_type == TTM_PL_SYSTEM) { radeon_ttm_tt_unbind(bo->bdev, bo->ttm); - ttm_resource_free(bo, &bo->resource); - ttm_bo_assign_mem(bo, new_mem); + ttm_bo_move_null(bo, new_mem); goto out; } if (rdev->ring[radeon_copy_ring_index(rdev)].ready &&
Since ttm_bo_move_null() is exactly the same as ttm_resource_free() + ttm_bo_assign_mem(), we use ttm_bo_move_null() for the GTT --> SYSTEM move case too. Then the code is more consistent as the SYSTEM --> GTT move case. Signed-off-by: Huacai Chen <chenhuacai@loongson.cn> --- drivers/gpu/drm/radeon/radeon_ttm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)