drm/amdgpu: Merge get_reserved_allocation to get_vbios_allocations.
Subsystems (2)
PATCH 1/2 drm/amdgpu: Merge get_reserved_allocation to get_vbios_allocations.
Some ASICs need reserved memory for firmware or other components, which is not allowed to be used by driver. amdgpu_gmc_get_reserved_allocation is to handle additional areas. To avoid any missing calling,
merged amdgpu_gmc_get_reserved_allocation to amdgpu_gmc_get_vbios_allocations.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 32 ++++++++++--------------- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 1 - drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 1 - 3 files changed, 13 insertions(+), 21 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +13 -19
@@ -626,6 +626,13 @@ void amdgpu_gmc_get_vbios_allocations(struct amdgpu_device *adev) {unsigned size; +/* +* 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
@@ -640,6 +647,12 @@ void amdgpu_gmc_get_vbios_allocations(struct amdgpu_device *adev)case CHIP_RENOIR : adev->mman.keep_stolen_vga_memory = true;break ; +case CHIP_YELLOW_CARP : +if (amdgpu_discovery ==0 ) { + adev->mman.stolen_reserved_offset =0x1ffb0000 ; + adev->mman.stolen_reserved_size =64 *PAGE_SIZE ; + } +break ;default : adev->mman.keep_stolen_vga_memory = false;break ;
@@ -760,25 +773,6 @@ uint64_t amdgpu_gmc_vram_cpu_pa(struct amdgpu_device *adev, struct amdgpu_bo *boreturn amdgpu_bo_gpu_offset (bo) - adev->gmc.vram_start + adev->gmc.aper_base; } -void amdgpu_gmc_get_reserved_allocation (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 ; - -switch (adev->asic_type) { -case CHIP_YELLOW_CARP : -if (amdgpu_discovery ==0 ) { - adev->mman.stolen_reserved_offset =0x1ffb0000 ; - adev->mman.stolen_reserved_size =64 *PAGE_SIZE ; - } -break ; -default : -break ; - } -} -int amdgpu_gmc_vram_checking (struct amdgpu_device *adev) {struct amdgpu_bo *vram_bo =NULL ;
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +0 -1
@@ -331,7 +331,6 @@ amdgpu_gmc_set_vm_fault_masks(struct amdgpu_device *adev, int hub_type, bool enable);void amdgpu_gmc_get_vbios_allocations (struct amdgpu_device *adev); -void amdgpu_gmc_get_reserved_allocation (struct amdgpu_device *adev);void amdgpu_gmc_init_pdb0 (struct amdgpu_device *adev);uint64_t amdgpu_gmc_vram_mc2pa (struct amdgpu_device *adev,uint64_t mc_addr);
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +0 -1
@@ -948,7 +948,6 @@ static int gmc_v10_0_sw_init(void *handle)return r;amdgpu_gmc_get_vbios_allocations (adev); -amdgpu_gmc_get_reserved_allocation (adev);/* Memory manager */ r =amdgpu_bo_init (adev);
Signature · 1 line
2.25.1
PATCH 2/2 drm/amdgpu: Add stolen reserved memory for MI25 SRIOV.
MI25 SRIOV guest driver loading failed due to allocated memory overlaps with firmware reserved area.
Allocate stolen reserved memory for MI25 SRIOV specifically to avoid the memory overlap.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +9 -0
@@ -643,6 +643,15 @@ void amdgpu_gmc_get_vbios_allocations(struct amdgpu_device *adev)*/ switch (adev->asic_type) {case CHIP_VEGA10 : + adev->mman.keep_stolen_vga_memory = true; +/* +* VEGA10 SRIOV VF needs some firmware reserved area. +*/ +if (amdgpu_sriov_vf (adev)) { + adev->mman.stolen_reserved_offset =0x100000 ; + adev->mman.stolen_reserved_size =0x600000 ; + } +break ;case CHIP_RAVEN :case CHIP_RENOIR : adev->mman.keep_stolen_vga_memory = true;
Signature · 1 line
2.25.1
Re: [PATCH 2/2] drm/amdgpu: Add stolen reserved memory for MI25 SRIOV.
[Public]
Series is:
________________________________
From: Sun, Yongqiang <[email protected]>
Sent: Tuesday, March 15, 2022 10:11 AM
To: [email protected] <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Sun, Yongqiang <[email protected]>
Subject: [PATCH 2/2] drm/amdgpu: Add stolen reserved memory for MI25 SRIOV.
MI25 SRIOV guest driver loading failed due to allocated memory overlaps with firmware reserved area.
Allocate stolen reserved memory for MI25 SRIOV specifically to avoid the memory overlap.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +9 -0
@@ -643,6 +643,15 @@ void amdgpu_gmc_get_vbios_allocations(struct amdgpu_device *adev)*/ switch (adev->asic_type) {case CHIP_VEGA10 : + adev->mman.keep_stolen_vga_memory = true; +/* +* VEGA10 SRIOV VF needs some firmware reserved area. +*/ +if (amdgpu_sriov_vf (adev)) { + adev->mman.stolen_reserved_offset =0x100000 ; + adev->mman.stolen_reserved_size =0x600000 ; + } +break ;case CHIP_RAVEN :case CHIP_RENOIR : adev->mman.keep_stolen_vga_memory = true;
--
2.25.1
Am 15.03.22 um 15:11 schrieb Yongqiang Sun:
Quoted 9 lines
Some ASICs need reserved memory for firmware or other components, which is not allowed to be used by driver.
amdgpu_gmc_get_reserved_allocationis to handle additional areas. To avoid any missing calling,
mergedamdgpu_gmc_get_reserved_allocationtoamdgpu_gmc_get_vbios_allocations.Signed-off-by Yongqiang Sun <[email protected]>Change-Id I142127513047a3e81573eb983c510d763b548a24
Quoted 87 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 32 ++++++++++--------------- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 1 - drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 1 - 3 files changed, 13 insertions(+), 21 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +13
-19@@ -626,6 +626,13 @@ void amdgpu_gmc_get_vbios_allocations(struct amdgpu_device *adev) {unsigned size; +/* +* 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 @@ -640,6 +647,12 @@ void amdgpu_gmc_get_vbios_allocations(struct amdgpu_device *adev)case CHIP_RENOIR : adev->mman.keep_stolen_vga_memory = true;break ; +case CHIP_YELLOW_CARP : +if (amdgpu_discovery ==0 ) { + adev->mman.stolen_reserved_offset =0x1ffb0000 ; + adev->mman.stolen_reserved_size =64 *PAGE_SIZE ; + } +break ;default : adev->mman.keep_stolen_vga_memory = false;break ;@@ -760,25 +773,6 @@ uint64_t amdgpu_gmc_vram_cpu_pa(struct amdgpu_device *adev, struct amdgpu_bo *boreturn amdgpu_bo_gpu_offset (bo) - adev->gmc.vram_start + adev->gmc.aper_base; } -void amdgpu_gmc_get_reserved_allocation (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 ; - -switch (adev->asic_type) { -case CHIP_YELLOW_CARP : -if (amdgpu_discovery ==0 ) { - adev->mman.stolen_reserved_offset =0x1ffb0000 ; - adev->mman.stolen_reserved_size =64 *PAGE_SIZE ; - } -break ; -default : -break ; - } -} -int amdgpu_gmc_vram_checking (struct amdgpu_device *adev) {struct amdgpu_bo *vram_bo =NULL ;drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +0
-1@@ -331,7 +331,6 @@ amdgpu_gmc_set_vm_fault_masks(struct amdgpu_device *adev, int hub_type, bool enable);void amdgpu_gmc_get_vbios_allocations (struct amdgpu_device *adev); -void amdgpu_gmc_get_reserved_allocation (struct amdgpu_device *adev);void amdgpu_gmc_init_pdb0 (struct amdgpu_device *adev);uint64_t amdgpu_gmc_vram_mc2pa (struct amdgpu_device *adev,uint64_t mc_addr);drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +0
-1@@ -948,7 +948,6 @@ static int gmc_v10_0_sw_init(void *handle)return r;amdgpu_gmc_get_vbios_allocations (adev); -amdgpu_gmc_get_reserved_allocation (adev);/* Memory manager */ r =amdgpu_bo_init (adev);