Message ID | 20200731040520.3701599-13-airlied@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | ttm mem manager refactoring. | expand |
Am 31.07.20 um 06:04 schrieb Dave Airlie: > From: Dave Airlie <airlied@redhat.com> > > Remove the exit path, since this can't fail now. > > Signed-off-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Christian König <christian.koenig@amd.com> > --- > drivers/gpu/drm/ttm/ttm_bo.c | 30 +++++++++++++++++------------- > 1 file changed, 17 insertions(+), 13 deletions(-) > > diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c > index a658fd584c6d..476e768c5bd2 100644 > --- a/drivers/gpu/drm/ttm/ttm_bo.c > +++ b/drivers/gpu/drm/ttm/ttm_bo.c > @@ -1644,6 +1644,22 @@ int ttm_bo_device_release(struct ttm_bo_device *bdev) > } > EXPORT_SYMBOL(ttm_bo_device_release); > > +static void ttm_bo_init_sysman(struct ttm_bo_device *bdev) > +{ > + struct ttm_mem_type_manager *man = &bdev->man[TTM_PL_SYSTEM]; > + > + /* > + * Initialize the system memory buffer type. > + * Other types need to be driver / IOCTL initialized. > + */ > + man->use_tt = true; > + man->available_caching = TTM_PL_MASK_CACHING; > + man->default_caching = TTM_PL_FLAG_CACHED; > + > + ttm_bo_init_mm_base(bdev, man, 0); > + ttm_bo_use_mm(man); > +} > + > int ttm_bo_device_init(struct ttm_bo_device *bdev, > struct ttm_bo_driver *driver, > struct address_space *mapping, > @@ -1664,16 +1680,7 @@ int ttm_bo_device_init(struct ttm_bo_device *bdev, > > memset(bdev->man, 0, sizeof(bdev->man)); > > - /* > - * Initialize the system memory buffer type. > - * Other types need to be driver / IOCTL initialized. > - */ > - bdev->man[TTM_PL_SYSTEM].use_tt = true; > - bdev->man[TTM_PL_SYSTEM].available_caching = TTM_PL_MASK_CACHING; > - bdev->man[TTM_PL_SYSTEM].default_caching = TTM_PL_FLAG_CACHED; > - ret = ttm_bo_init_mm(bdev, TTM_PL_SYSTEM, 0); > - if (unlikely(ret != 0)) > - goto out_no_sys; > + ttm_bo_init_sysman(bdev); > > bdev->vma_manager = vma_manager; > INIT_DELAYED_WORK(&bdev->wq, ttm_bo_delayed_workqueue); > @@ -1685,9 +1692,6 @@ int ttm_bo_device_init(struct ttm_bo_device *bdev, > mutex_unlock(&ttm_global_mutex); > > return 0; > -out_no_sys: > - ttm_bo_global_release(); > - return ret; > } > EXPORT_SYMBOL(ttm_bo_device_init); >
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index a658fd584c6d..476e768c5bd2 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -1644,6 +1644,22 @@ int ttm_bo_device_release(struct ttm_bo_device *bdev) } EXPORT_SYMBOL(ttm_bo_device_release); +static void ttm_bo_init_sysman(struct ttm_bo_device *bdev) +{ + struct ttm_mem_type_manager *man = &bdev->man[TTM_PL_SYSTEM]; + + /* + * Initialize the system memory buffer type. + * Other types need to be driver / IOCTL initialized. + */ + man->use_tt = true; + man->available_caching = TTM_PL_MASK_CACHING; + man->default_caching = TTM_PL_FLAG_CACHED; + + ttm_bo_init_mm_base(bdev, man, 0); + ttm_bo_use_mm(man); +} + int ttm_bo_device_init(struct ttm_bo_device *bdev, struct ttm_bo_driver *driver, struct address_space *mapping, @@ -1664,16 +1680,7 @@ int ttm_bo_device_init(struct ttm_bo_device *bdev, memset(bdev->man, 0, sizeof(bdev->man)); - /* - * Initialize the system memory buffer type. - * Other types need to be driver / IOCTL initialized. - */ - bdev->man[TTM_PL_SYSTEM].use_tt = true; - bdev->man[TTM_PL_SYSTEM].available_caching = TTM_PL_MASK_CACHING; - bdev->man[TTM_PL_SYSTEM].default_caching = TTM_PL_FLAG_CACHED; - ret = ttm_bo_init_mm(bdev, TTM_PL_SYSTEM, 0); - if (unlikely(ret != 0)) - goto out_no_sys; + ttm_bo_init_sysman(bdev); bdev->vma_manager = vma_manager; INIT_DELAYED_WORK(&bdev->wq, ttm_bo_delayed_workqueue); @@ -1685,9 +1692,6 @@ int ttm_bo_device_init(struct ttm_bo_device *bdev, mutex_unlock(&ttm_global_mutex); return 0; -out_no_sys: - ttm_bo_global_release(); - return ret; } EXPORT_SYMBOL(ttm_bo_device_init);