Skip to content

Commit 2740509

Browse files
ChristianKoenigAMDalexdeucher
authored andcommitted
drm/amdgpu: revert "Implement new dummy vram manager"
This is should be unnecessary since a VRAM manager isn't mandatory in the first place. It could be that we have some missing checks inside AMDGPU or TTM but those should then be fixed instead of worked around like that. Signed-off-by: Christian König <christian.koenig@amd.com> Acked-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent a9273da commit 2740509

2 files changed

Lines changed: 13 additions & 63 deletions

File tree

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1943,11 +1943,13 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
19431943
}
19441944
adev->mman.initialized = true;
19451945

1946-
/* Initialize VRAM pool with all of VRAM divided into pages */
1947-
r = amdgpu_vram_mgr_init(adev);
1948-
if (r) {
1949-
dev_err(adev->dev, "Failed initializing VRAM heap.\n");
1950-
return r;
1946+
if (!adev->gmc.is_app_apu) {
1947+
/* Initialize VRAM pool with all of VRAM divided into pages */
1948+
r = amdgpu_vram_mgr_init(adev);
1949+
if (r) {
1950+
dev_err(adev->dev, "Failed initializing VRAM heap.\n");
1951+
return r;
1952+
}
19511953
}
19521954

19531955
/* Change the size here instead of the init above so only lpfn is affected */
@@ -2162,7 +2164,8 @@ void amdgpu_ttm_fini(struct amdgpu_device *adev)
21622164
drm_dev_exit(idx);
21632165
}
21642166

2165-
amdgpu_vram_mgr_fini(adev);
2167+
if (!adev->gmc.is_app_apu)
2168+
amdgpu_vram_mgr_fini(adev);
21662169
amdgpu_gtt_mgr_fini(adev);
21672170
amdgpu_preempt_mgr_fini(adev);
21682171
amdgpu_doorbell_fini(adev);

drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c

Lines changed: 4 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -425,45 +425,6 @@ int amdgpu_vram_mgr_query_address_block_info(struct amdgpu_vram_mgr *mgr,
425425
return ret;
426426
}
427427

428-
static void amdgpu_dummy_vram_mgr_debug(struct ttm_resource_manager *man,
429-
struct drm_printer *printer)
430-
{
431-
DRM_DEBUG_DRIVER("Dummy vram mgr debug\n");
432-
}
433-
434-
static bool amdgpu_dummy_vram_mgr_compatible(struct ttm_resource_manager *man,
435-
struct ttm_resource *res,
436-
const struct ttm_place *place,
437-
size_t size)
438-
{
439-
DRM_DEBUG_DRIVER("Dummy vram mgr compatible\n");
440-
return false;
441-
}
442-
443-
static bool amdgpu_dummy_vram_mgr_intersects(struct ttm_resource_manager *man,
444-
struct ttm_resource *res,
445-
const struct ttm_place *place,
446-
size_t size)
447-
{
448-
DRM_DEBUG_DRIVER("Dummy vram mgr intersects\n");
449-
return true;
450-
}
451-
452-
static void amdgpu_dummy_vram_mgr_del(struct ttm_resource_manager *man,
453-
struct ttm_resource *res)
454-
{
455-
DRM_DEBUG_DRIVER("Dummy vram mgr deleted\n");
456-
}
457-
458-
static int amdgpu_dummy_vram_mgr_new(struct ttm_resource_manager *man,
459-
struct ttm_buffer_object *tbo,
460-
const struct ttm_place *place,
461-
struct ttm_resource **res)
462-
{
463-
DRM_DEBUG_DRIVER("Dummy vram mgr new\n");
464-
return -ENOSPC;
465-
}
466-
467428
/**
468429
* amdgpu_vram_mgr_new - allocate new ranges
469430
*
@@ -932,14 +893,6 @@ static void amdgpu_vram_mgr_debug(struct ttm_resource_manager *man,
932893
mutex_unlock(&mgr->lock);
933894
}
934895

935-
static const struct ttm_resource_manager_func amdgpu_dummy_vram_mgr_func = {
936-
.alloc = amdgpu_dummy_vram_mgr_new,
937-
.free = amdgpu_dummy_vram_mgr_del,
938-
.intersects = amdgpu_dummy_vram_mgr_intersects,
939-
.compatible = amdgpu_dummy_vram_mgr_compatible,
940-
.debug = amdgpu_dummy_vram_mgr_debug
941-
};
942-
943896
static const struct ttm_resource_manager_func amdgpu_vram_mgr_func = {
944897
.alloc = amdgpu_vram_mgr_new,
945898
.free = amdgpu_vram_mgr_del,
@@ -973,16 +926,10 @@ int amdgpu_vram_mgr_init(struct amdgpu_device *adev)
973926
INIT_LIST_HEAD(&mgr->allocated_vres_list);
974927
mgr->default_page_size = PAGE_SIZE;
975928

976-
if (!adev->gmc.is_app_apu) {
977-
man->func = &amdgpu_vram_mgr_func;
978-
979-
err = drm_buddy_init(&mgr->mm, man->size, PAGE_SIZE);
980-
if (err)
981-
return err;
982-
} else {
983-
man->func = &amdgpu_dummy_vram_mgr_func;
984-
DRM_INFO("Setup dummy vram mgr\n");
985-
}
929+
man->func = &amdgpu_vram_mgr_func;
930+
err = drm_buddy_init(&mgr->mm, man->size, PAGE_SIZE);
931+
if (err)
932+
return err;
986933

987934
ttm_set_driver_manager(&adev->mman.bdev, TTM_PL_VRAM, &mgr->manager);
988935
ttm_resource_manager_set_used(man, true);

0 commit comments

Comments
 (0)