Commit 4ce032d6 authored by Christian König's avatar Christian König
Browse files

drm/ttm: nuke ttm_bo_evict_mm and rename mgr function v3



Make it more clear what the resource manager function
does and nuke the wrapper function.

v2: nuke the wrapper
v3: fix typo in radeon, rebased

Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> (v2)
Link: https://patchwork.freedesktop.org/patch/393914/
parent 3b53d304
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -1319,6 +1319,7 @@ static int amdgpu_debugfs_evict_gtt(struct seq_file *m, void *data)
	struct drm_info_node *node = (struct drm_info_node *)m->private;
	struct drm_device *dev = node->minor->dev;
	struct amdgpu_device *adev = drm_to_adev(dev);
	struct ttm_resource_manager *man;
	int r;

	r = pm_runtime_get_sync(dev->dev);
@@ -1327,7 +1328,9 @@ static int amdgpu_debugfs_evict_gtt(struct seq_file *m, void *data)
		return r;
	}

	seq_printf(m, "(%d)\n", ttm_bo_evict_mm(&adev->mman.bdev, TTM_PL_TT));
	man = ttm_manager_type(&adev->mman.bdev, TTM_PL_TT);
	r = ttm_resource_manager_evict_all(&adev->mman.bdev, man);
	seq_printf(m, "(%d)\n", r);

	pm_runtime_mark_last_busy(dev->dev);
	pm_runtime_put_autosuspend(dev->dev);
+1 −1
Original line number Diff line number Diff line
@@ -136,7 +136,7 @@ void amdgpu_gtt_mgr_fini(struct amdgpu_device *adev)

	ttm_resource_manager_set_used(man, false);

	ret = ttm_resource_manager_force_list_clean(&adev->mman.bdev, man);
	ret = ttm_resource_manager_evict_all(&adev->mman.bdev, man);
	if (ret)
		return;

+5 −1
Original line number Diff line number Diff line
@@ -1029,6 +1029,8 @@ void amdgpu_bo_unpin(struct amdgpu_bo *bo)
 */
int amdgpu_bo_evict_vram(struct amdgpu_device *adev)
{
	struct ttm_resource_manager *man;

	/* late 2.6.33 fix IGP hibernate - we need pm ops to do this correct */
#ifndef CONFIG_HIBERNATION
	if (adev->flags & AMD_IS_APU) {
@@ -1036,7 +1038,9 @@ int amdgpu_bo_evict_vram(struct amdgpu_device *adev)
		return 0;
	}
#endif
	return ttm_bo_evict_mm(&adev->mman.bdev, TTM_PL_VRAM);

	man = ttm_manager_type(&adev->mman.bdev, TTM_PL_VRAM);
	return ttm_resource_manager_evict_all(&adev->mman.bdev, man);
}

static const char *amdgpu_vram_names[] = {
+1 −1
Original line number Diff line number Diff line
@@ -212,7 +212,7 @@ void amdgpu_vram_mgr_fini(struct amdgpu_device *adev)

	ttm_resource_manager_set_used(man, false);

	ret = ttm_resource_manager_force_list_clean(&adev->mman.bdev, man);
	ret = ttm_resource_manager_evict_all(&adev->mman.bdev, man);
	if (ret)
		return;

+4 −1
Original line number Diff line number Diff line
@@ -820,6 +820,7 @@ static int
nouveau_do_suspend(struct drm_device *dev, bool runtime)
{
	struct nouveau_drm *drm = nouveau_drm(dev);
	struct ttm_resource_manager *man;
	int ret;

	nouveau_svm_suspend(drm);
@@ -836,7 +837,9 @@ nouveau_do_suspend(struct drm_device *dev, bool runtime)
	}

	NV_DEBUG(drm, "evicting buffers...\n");
	ttm_bo_evict_mm(&drm->ttm.bdev, TTM_PL_VRAM);

	man = ttm_manager_type(&drm->ttm.bdev, TTM_PL_VRAM);
	ttm_resource_manager_evict_all(&drm->ttm.bdev, man);

	NV_DEBUG(drm, "waiting for kernel channels to go idle...\n");
	if (drm->cechan) {
Loading