]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amdgpu: Add stolen vga reserve-region
authorLijo Lazar <lijo.lazar@amd.com>
Wed, 25 Mar 2026 11:30:31 +0000 (17:00 +0530)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 3 Apr 2026 17:49:36 +0000 (13:49 -0400)
Use reserve region helpers for initializing/reserving stolen vga region.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

index ec74f3971732d82f05f289f1290ea208994d744a..2d7e5c137902303cf6fe534fb57af6dddc57f058 100644 (file)
@@ -1099,10 +1099,12 @@ void amdgpu_gmc_get_vbios_allocations(struct amdgpu_device *adev)
                size = 0;
 
        if (size > AMDGPU_VBIOS_VGA_ALLOCATION) {
-               adev->mman.stolen_vga_size = AMDGPU_VBIOS_VGA_ALLOCATION;
-               adev->mman.stolen_extended_size = size - adev->mman.stolen_vga_size;
+               amdgpu_ttm_init_vram_resv(adev, AMDGPU_RESV_STOLEN_VGA,
+                                         0, AMDGPU_VBIOS_VGA_ALLOCATION, false);
+               adev->mman.stolen_extended_size = size - AMDGPU_VBIOS_VGA_ALLOCATION;
        } else {
-               adev->mman.stolen_vga_size = size;
+               amdgpu_ttm_init_vram_resv(adev, AMDGPU_RESV_STOLEN_VGA,
+                                         0, size, false);
                adev->mman.stolen_extended_size = 0;
        }
 }
index 8f0b13a39b61f75cdf44423e825f64ae370644a3..57804625702f7564e6463ebd14dc96ecbd25410e 100644 (file)
@@ -2206,14 +2206,12 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
         * and driver.
         */
        if (!adev->gmc.is_app_apu) {
-               r = amdgpu_bo_create_kernel_at(adev, 0,
-                                              adev->mman.stolen_vga_size,
-                                              &adev->mman.stolen_vga_memory,
-                                              NULL);
+               r = amdgpu_ttm_mark_vram_reserved(adev, AMDGPU_RESV_STOLEN_VGA);
                if (r)
                        return r;
 
-               r = amdgpu_bo_create_kernel_at(adev, adev->mman.stolen_vga_size,
+               r = amdgpu_bo_create_kernel_at(adev,
+                                              adev->mman.resv_region[AMDGPU_RESV_STOLEN_VGA].size,
                                               adev->mman.stolen_extended_size,
                                               &adev->mman.stolen_extended_memory,
                                               NULL);
@@ -2342,7 +2340,7 @@ void amdgpu_ttm_fini(struct amdgpu_device *adev)
        amdgpu_ttm_training_reserve_vram_fini(adev);
        /* return the stolen vga memory back to VRAM */
        if (!adev->gmc.is_app_apu) {
-               amdgpu_bo_free_kernel(&adev->mman.stolen_vga_memory, NULL, NULL);
+               amdgpu_ttm_unmark_vram_reserved(adev, AMDGPU_RESV_STOLEN_VGA);
                amdgpu_bo_free_kernel(&adev->mman.stolen_extended_memory, NULL, NULL);
                /* return the FW reserved memory back to VRAM */
                amdgpu_bo_free_kernel(&adev->mman.fw_reserved_memory, NULL,
index 7c49fe56a1dfac4b12ee80f099f4f7050631360c..826db85d133eed7ba2750270cccad5a2738a6e55 100644 (file)
@@ -103,8 +103,6 @@ struct amdgpu_mman {
        struct amdgpu_gtt_mgr gtt_mgr;
        struct ttm_resource_manager preempt_mgr;
 
-       uint64_t                stolen_vga_size;
-       struct amdgpu_bo        *stolen_vga_memory;
        uint64_t                stolen_extended_size;
        struct amdgpu_bo        *stolen_extended_memory;
        bool                    keep_stolen_vga_memory;
index 824ee93c991124a18a682b06b78a24cfbfde489b..19d8a5fc5def0dabb29593abf9d14f977f51a71f 100644 (file)
@@ -11199,7 +11199,7 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
        if (!adev->in_suspend) {
                /* return the stolen vga memory back to VRAM */
                if (!adev->mman.keep_stolen_vga_memory)
-                       amdgpu_bo_free_kernel(&adev->mman.stolen_vga_memory, NULL, NULL);
+                       amdgpu_ttm_unmark_vram_reserved(adev, AMDGPU_RESV_STOLEN_VGA);
                amdgpu_bo_free_kernel(&adev->mman.stolen_extended_memory, NULL, NULL);
        }