Use reserve region helpers for initializing/reserving stolen_reserved region.

Signed-off-by: Lijo Lazar <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c |  7 ++-----
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 10 ++--------
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h |  4 ----
 3 files changed, 4 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
index 61e8d71dfed5..2bbed5fe5121 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
@@ -1040,9 +1040,6 @@ void amdgpu_gmc_get_vbios_allocations(struct 
amdgpu_device *adev)
         * Some ASICs need to reserve a region of video memory to avoid access
         * from driver
         */
-       adev->mman.stolen_reserved_offset = 0;
-       adev->mman.stolen_reserved_size = 0;
-
        /*
         * TODO:
         * Currently there is a bug where some memory client outside
@@ -1059,8 +1056,8 @@ void amdgpu_gmc_get_vbios_allocations(struct 
amdgpu_device *adev)
                 */
 #ifdef CONFIG_X86
                if (amdgpu_sriov_vf(adev) && 
hypervisor_is_type(X86_HYPER_MS_HYPERV)) {
-                       adev->mman.stolen_reserved_offset = 0x500000;
-                       adev->mman.stolen_reserved_size = 0x200000;
+                       amdgpu_ttm_init_vram_resv(adev, 
AMDGPU_RESV_STOLEN_RESERVED,
+                                                 0x500000, 0x200000, false);
                }
 #endif
                break;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 3c1c4548d280..835f140bfed0 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -2221,11 +2221,7 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
                if (r)
                        return r;
 
-               r = amdgpu_bo_create_kernel_at(adev,
-                                              
adev->mman.stolen_reserved_offset,
-                                              adev->mman.stolen_reserved_size,
-                                              
&adev->mman.stolen_reserved_memory,
-                                              NULL);
+               r = amdgpu_ttm_reserve_vram(adev, AMDGPU_RESV_STOLEN_RESERVED);
                if (r)
                        return r;
        } else {
@@ -2349,9 +2345,7 @@ void amdgpu_ttm_fini(struct amdgpu_device *adev)
                                      NULL);
                amdgpu_bo_free_kernel(&adev->mman.fw_reserved_memory_extend, 
NULL,
                                      NULL);
-               if (adev->mman.stolen_reserved_size)
-                       
amdgpu_bo_free_kernel(&adev->mman.stolen_reserved_memory,
-                                             NULL, NULL);
+               amdgpu_ttm_unreserve_vram(adev, AMDGPU_RESV_STOLEN_RESERVED);
        }
        amdgpu_bo_free_kernel(&adev->mman.sdma_access_bo, NULL,
                                        &adev->mman.sdma_access_ptr);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
index 08c0bf0893d4..206267e95b9b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
@@ -101,10 +101,6 @@ struct amdgpu_mman {
 
        bool                    keep_stolen_vga_memory;
 
-       struct amdgpu_bo        *stolen_reserved_memory;
-       uint64_t                stolen_reserved_offset;
-       uint64_t                stolen_reserved_size;
-
        /* fw reserved memory */
        struct amdgpu_bo                *fw_reserved_memory;
        struct amdgpu_bo                *fw_reserved_memory_extend;
-- 
2.49.0

Reply via email to