Commit cacbbe7c authored by Alex Deucher's avatar Alex Deucher

drm/amdgpu: move stolen memory from gmc to mman

It's more related to memory management than memory
controller.
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 7438ae6e
...@@ -449,10 +449,10 @@ void amdgpu_gmc_get_vbios_allocations(struct amdgpu_device *adev) ...@@ -449,10 +449,10 @@ void amdgpu_gmc_get_vbios_allocations(struct amdgpu_device *adev)
case CHIP_VEGA10: case CHIP_VEGA10:
case CHIP_RAVEN: case CHIP_RAVEN:
case CHIP_RENOIR: case CHIP_RENOIR:
adev->gmc.keep_stolen_vga_memory = true; adev->mman.keep_stolen_vga_memory = true;
break; break;
default: default:
adev->gmc.keep_stolen_vga_memory = false; adev->mman.keep_stolen_vga_memory = false;
break; break;
} }
...@@ -466,10 +466,10 @@ void amdgpu_gmc_get_vbios_allocations(struct amdgpu_device *adev) ...@@ -466,10 +466,10 @@ void amdgpu_gmc_get_vbios_allocations(struct amdgpu_device *adev)
size = 0; size = 0;
if (size > AMDGPU_VBIOS_VGA_ALLOCATION) { if (size > AMDGPU_VBIOS_VGA_ALLOCATION) {
adev->gmc.stolen_vga_size = AMDGPU_VBIOS_VGA_ALLOCATION; adev->mman.stolen_vga_size = AMDGPU_VBIOS_VGA_ALLOCATION;
adev->gmc.stolen_extended_size = size - adev->gmc.stolen_vga_size; adev->mman.stolen_extended_size = size - adev->mman.stolen_vga_size;
} else { } else {
adev->gmc.stolen_vga_size = size; adev->mman.stolen_vga_size = size;
adev->gmc.stolen_extended_size = 0; adev->mman.stolen_extended_size = 0;
} }
} }
...@@ -215,11 +215,6 @@ struct amdgpu_gmc { ...@@ -215,11 +215,6 @@ struct amdgpu_gmc {
uint8_t vram_vendor; uint8_t vram_vendor;
uint32_t srbm_soft_reset; uint32_t srbm_soft_reset;
bool prt_warning; bool prt_warning;
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;
uint32_t sdpif_register; uint32_t sdpif_register;
/* apertures */ /* apertures */
u64 shared_aperture_start; u64 shared_aperture_start;
......
...@@ -1978,16 +1978,16 @@ int amdgpu_ttm_init(struct amdgpu_device *adev) ...@@ -1978,16 +1978,16 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
* This is used for VGA emulation and pre-OS scanout buffers to * This is used for VGA emulation and pre-OS scanout buffers to
* avoid display artifacts while transitioning between pre-OS * avoid display artifacts while transitioning between pre-OS
* and driver. */ * and driver. */
r = amdgpu_bo_create_kernel_at(adev, 0, adev->gmc.stolen_vga_size, r = amdgpu_bo_create_kernel_at(adev, 0, adev->mman.stolen_vga_size,
AMDGPU_GEM_DOMAIN_VRAM, AMDGPU_GEM_DOMAIN_VRAM,
&adev->gmc.stolen_vga_memory, &adev->mman.stolen_vga_memory,
NULL); NULL);
if (r) if (r)
return r; return r;
r = amdgpu_bo_create_kernel_at(adev, adev->gmc.stolen_vga_size, r = amdgpu_bo_create_kernel_at(adev, adev->mman.stolen_vga_size,
adev->gmc.stolen_extended_size, adev->mman.stolen_extended_size,
AMDGPU_GEM_DOMAIN_VRAM, AMDGPU_GEM_DOMAIN_VRAM,
&adev->gmc.stolen_extended_memory, &adev->mman.stolen_extended_memory,
NULL); NULL);
if (r) if (r)
return r; return r;
...@@ -2048,9 +2048,9 @@ int amdgpu_ttm_init(struct amdgpu_device *adev) ...@@ -2048,9 +2048,9 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
void amdgpu_ttm_late_init(struct amdgpu_device *adev) void amdgpu_ttm_late_init(struct amdgpu_device *adev)
{ {
/* return the VGA stolen memory (if any) back to VRAM */ /* return the VGA stolen memory (if any) back to VRAM */
if (!adev->gmc.keep_stolen_vga_memory) if (!adev->mman.keep_stolen_vga_memory)
amdgpu_bo_free_kernel(&adev->gmc.stolen_vga_memory, NULL, NULL); amdgpu_bo_free_kernel(&adev->mman.stolen_vga_memory, NULL, NULL);
amdgpu_bo_free_kernel(&adev->gmc.stolen_extended_memory, NULL, NULL); amdgpu_bo_free_kernel(&adev->mman.stolen_extended_memory, NULL, NULL);
} }
/** /**
...@@ -2063,8 +2063,8 @@ void amdgpu_ttm_fini(struct amdgpu_device *adev) ...@@ -2063,8 +2063,8 @@ void amdgpu_ttm_fini(struct amdgpu_device *adev)
amdgpu_ttm_training_reserve_vram_fini(adev); amdgpu_ttm_training_reserve_vram_fini(adev);
/* return the stolen vga memory back to VRAM */ /* return the stolen vga memory back to VRAM */
if (adev->gmc.keep_stolen_vga_memory) if (adev->mman.keep_stolen_vga_memory)
amdgpu_bo_free_kernel(&adev->gmc.stolen_vga_memory, NULL, NULL); amdgpu_bo_free_kernel(&adev->mman.stolen_vga_memory, NULL, NULL);
/* return the IP Discovery TMR memory back to VRAM */ /* return the IP Discovery TMR memory back to VRAM */
amdgpu_bo_free_kernel(&adev->discovery_memory, NULL, NULL); amdgpu_bo_free_kernel(&adev->discovery_memory, NULL, NULL);
amdgpu_ttm_fw_reserve_vram_fini(adev); amdgpu_ttm_fw_reserve_vram_fini(adev);
......
...@@ -59,6 +59,12 @@ struct amdgpu_mman { ...@@ -59,6 +59,12 @@ struct amdgpu_mman {
struct mutex gtt_window_lock; struct mutex gtt_window_lock;
/* Scheduler entity for buffer moves */ /* Scheduler entity for buffer moves */
struct drm_sched_entity entity; struct drm_sched_entity entity;
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;
}; };
struct amdgpu_copy_mem { struct amdgpu_copy_mem {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment