rework stolen pre-OS fb allocation handling (v3)
Subsystems (2)
cover rework stolen pre-OS fb allocation handling (v3)
Split the allocations into two so we can still support the S3 workarounds required on some platforms while also avoiding any artifacts when transitioning from bios to driver.
In the future we could integrate handling of the ip discovery data and other vbios allocations into this helper function to consolidate handling of all of the vbios reservations.
v2: Check if bo object is NULL rather than checking size
Move all vbios/firmware allocations into mman structure
v3: Inline fw vram usage structure
Alex Deucher (17):
drm/amdgpu: handle bo size 0 in amdgpu_bo_create_kernel_at (v2) drm/amdgpu: use create_at for the stolen pre-OS buffer drm/amdgpu: use a define for the memory size of the vga emulator drm/amdgpu: move stolen vga bo from amdgpu to amdgpu.gmc drm/amdgpu: move keep stolen memory check into gmc core drm/amdgpu: add support for extended stolen vga memory drm/amdgpu/gmc: add new helper to get the FB size used by pre-OS
console
drm/amdgpu/gmc6: switch to using amdgpu_gmc_get_vbios_allocations drm/amdgpu/gmc7: switch to using amdgpu_gmc_get_vbios_allocations drm/amdgpu/gmc8: switch to using amdgpu_gmc_get_vbios_allocations drm/amdgpu/gmc9: switch to using amdgpu_gmc_get_vbios_allocations drm/amdgpu/gmc10: switch to using amdgpu_gmc_get_vbios_allocations drm/amdgpu: drop the CPU pointers for the stolen vga bos drm/amdgpu/gmc: disable keep_stolen_vga_memory on arcturus drm/amdgpu: move stolen memory from gmc to mman drm/amdgpu: move IP discovery data to mman
drm/amdgpu: move vram usage by vbios to mman (v2)
drivers/gpu/drm/amd/amdgpu/amdgpu.h | 20 +-- drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c | 4 +- .../gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 54 ++++---- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 42 +++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 6 +- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 3 + drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 64 ++++++---- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | 17 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 6 +- drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 57 ++++----- drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 8 +- drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 11 +- drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 11 +- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 119 ++++++------------ 16 files changed, 219 insertions(+), 211 deletions(-)
Signature · 6 lines
2.25.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 1/17 drm/amdgpu: handle bo size 0 in amdgpu_bo_create_kernel_at (v2)
Just return early to match other bo_create functions.
v2: check if the bo_ptr is NULL rather than checking the size.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +3 -0
@@ -374,6 +374,9 @@ int amdgpu_bo_create_kernel_at(struct amdgpu_device *adev,if (r)return r; +if ((*bo_ptr) ==NULL ) +return 0 ; +/* * Remove the original mem node and create a new one at the request * position.
Signature · 6 lines
2.25.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/17 drm/amdgpu: use create_at for the stolen pre-OS buffer
In reply to Alex DeucherShould be functionally the same since nothing else is allocated at that point, but let's be exact.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +4 -4
@@ -1979,10 +1979,10 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)* This is used for VGA emulation and pre-OS scanout buffers to * avoid display artifacts while transitioning between pre-OS * and driver. */ - r =amdgpu_bo_create_kernel (adev, adev->gmc.stolen_size,PAGE_SIZE , -AMDGPU_GEM_DOMAIN_VRAM , - &adev->stolen_vga_memory, -NULL , &stolen_vga_buf); + r =amdgpu_bo_create_kernel_at (adev,0 , adev->gmc.stolen_size, +AMDGPU_GEM_DOMAIN_VRAM , + &adev->stolen_vga_memory, + &stolen_vga_buf);if (r)return r;
Signature · 6 lines
2.25.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/17 drm/amdgpu: use a define for the memory size of the vga emulator
In reply to Alex DeucherRather than open coding it everywhere.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 ++ drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 4 ++-- 6 files changed, 8 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -0
@@ -212,6 +212,8 @@ extern int amdgpu_cik_support;#define AMDGPUFB_CONN_LIMIT 4#define AMDGPU_BIOS_NUM_SCRATCH 16 +#define AMDGPU_VBIOS_VGA_ALLOCATION (9 * 1024 * 1024)/* reserve 8MB for vga emulator and 1 MB for FB */ +/* hard reset data */ #define AMDGPU_ASIC_RESET_DATA 0x39d5e86b
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +1 -1
@@ -707,7 +707,7 @@ static unsigned gmc_v10_0_get_vbios_fb_size(struct amdgpu_device *adev)unsigned size;if (REG_GET_FIELD (d1vga_control,D1VGA_CONTROL ,D1VGA_MODE_ENABLE )) { - size =9 *1024 *1024 ;/* reserve 8MB for vga emulator and 1 MB for FB */ + size =AMDGPU_VBIOS_VGA_ALLOCATION ; }else {u32 viewport;u32 pitch;
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +1 -1
@@ -805,7 +805,7 @@ static unsigned gmc_v6_0_get_vbios_fb_size(struct amdgpu_device *adev)unsigned size;if (REG_GET_FIELD (d1vga_control,D1VGA_CONTROL ,D1VGA_MODE_ENABLE )) { - size =9 *1024 *1024 ;/* reserve 8MB for vga emulator and 1 MB for FB */ + size =AMDGPU_VBIOS_VGA_ALLOCATION ; }else {u32 viewport =RREG32 (mmVIEWPORT_SIZE); size = (REG_GET_FIELD(viewport, VIEWPORT_SIZE, VIEWPORT_HEIGHT) *
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +1 -1
@@ -970,7 +970,7 @@ static unsigned gmc_v7_0_get_vbios_fb_size(struct amdgpu_device *adev)unsigned size;if (REG_GET_FIELD (d1vga_control,D1VGA_CONTROL ,D1VGA_MODE_ENABLE )) { - size =9 *1024 *1024 ;/* reserve 8MB for vga emulator and 1 MB for FB */ + size =AMDGPU_VBIOS_VGA_ALLOCATION ; }else {u32 viewport =RREG32 (mmVIEWPORT_SIZE); size = (REG_GET_FIELD(viewport, VIEWPORT_SIZE, VIEWPORT_HEIGHT) *
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +1 -1
@@ -1087,7 +1087,7 @@ static unsigned gmc_v8_0_get_vbios_fb_size(struct amdgpu_device *adev)unsigned size;if (REG_GET_FIELD (d1vga_control,D1VGA_CONTROL ,D1VGA_MODE_ENABLE )) { - size =9 *1024 *1024 ;/* reserve 8MB for vga emulator and 1 MB for FB */ + size =AMDGPU_VBIOS_VGA_ALLOCATION ; }else {u32 viewport =RREG32 (mmVIEWPORT_SIZE); size = (REG_GET_FIELD(viewport, VIEWPORT_SIZE, VIEWPORT_HEIGHT) *
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +2 -2
@@ -1077,11 +1077,11 @@ static unsigned gmc_v9_0_get_vbios_fb_size(struct amdgpu_device *adev)* Check related code in gmc_v9_0_sw_fini * */ if (gmc_v9_0_keep_stolen_memory (adev)) -return 9 *1024 *1024 ; +return AMDGPU_VBIOS_VGA_ALLOCATION ; d1vga_control =RREG32_SOC15 (DCE ,0 , mmD1VGA_CONTROL);if (REG_GET_FIELD (d1vga_control,D1VGA_CONTROL ,D1VGA_MODE_ENABLE )) { - size =9 *1024 *1024 ;/* reserve 8MB for vga emulator and 1 MB for FB */ + size =AMDGPU_VBIOS_VGA_ALLOCATION ; }else {u32 viewport;
Signature · 6 lines
2.25.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/17 drm/amdgpu: move stolen vga bo from amdgpu to amdgpu.gmc
In reply to Alex DeucherSince that is where we store the other data related to the stolen vga memory.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 - drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 3 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 6 +++--- drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 4 ++-- 8 files changed, 11 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -1
@@ -767,7 +767,6 @@ struct amdgpu_device {bool is_atom_fw;uint8_t *bios;uint32_t bios_size; -struct amdgpu_bo *stolen_vga_memory;uint32_t bios_scratch_reg_offset;uint32_t bios_scratch[AMDGPU_BIOS_NUM_SCRATCH ];
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +2 -1
@@ -213,7 +213,8 @@ struct amdgpu_gmc {uint8_t vram_vendor;uint32_t srbm_soft_reset;bool prt_warning; -uint64_t stolen_size; +uint64_t stolen_vga_size; +struct amdgpu_bo *stolen_vga_memory;uint32_t sdpif_register;/* apertures */ u64 shared_aperture_start;
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +3 -3
@@ -1979,9 +1979,9 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)* This is used for VGA emulation and pre-OS scanout buffers to * avoid display artifacts while transitioning between pre-OS * and driver. */ - r =amdgpu_bo_create_kernel_at (adev,0 , adev->gmc.stolen_size, + r =amdgpu_bo_create_kernel_at (adev,0 , adev->gmc.stolen_vga_size,AMDGPU_GEM_DOMAIN_VRAM , - &adev->stolen_vga_memory, + &adev->gmc.stolen_vga_memory, &stolen_vga_buf);if (r)return r;
@@ -2043,7 +2043,7 @@ void amdgpu_ttm_late_init(struct amdgpu_device *adev) {void *stolen_vga_buf;/* return the VGA stolen memory (if any) back to VRAM */ -amdgpu_bo_free_kernel (&adev->stolen_vga_memory,NULL , &stolen_vga_buf); +amdgpu_bo_free_kernel (&adev->gmc.stolen_vga_memory,NULL , &stolen_vga_buf); }/**
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +1 -1
@@ -812,7 +812,7 @@ static int gmc_v10_0_sw_init(void *handle)if (r)return r; - adev->gmc.stolen_size =gmc_v10_0_get_vbios_fb_size (adev); + adev->gmc.stolen_vga_size =gmc_v10_0_get_vbios_fb_size (adev);/* Memory manager */ r =amdgpu_bo_init (adev);
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +1 -1
@@ -862,7 +862,7 @@ static int gmc_v6_0_sw_init(void *handle)if (r)return r; - adev->gmc.stolen_size =gmc_v6_0_get_vbios_fb_size (adev); + adev->gmc.stolen_vga_size =gmc_v6_0_get_vbios_fb_size (adev); r =amdgpu_bo_init (adev);if (r)
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +1 -1
@@ -1035,7 +1035,7 @@ static int gmc_v7_0_sw_init(void *handle)if (r)return r; - adev->gmc.stolen_size =gmc_v7_0_get_vbios_fb_size (adev); + adev->gmc.stolen_vga_size =gmc_v7_0_get_vbios_fb_size (adev);/* Memory manager */ r =amdgpu_bo_init (adev);
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +1 -1
@@ -1160,7 +1160,7 @@ static int gmc_v8_0_sw_init(void *handle)if (r)return r; - adev->gmc.stolen_size =gmc_v8_0_get_vbios_fb_size (adev); + adev->gmc.stolen_vga_size =gmc_v8_0_get_vbios_fb_size (adev);/* Memory manager */ r =amdgpu_bo_init (adev);
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +2 -2
@@ -1243,7 +1243,7 @@ static int gmc_v9_0_sw_init(void *handle)if (r)return r; - adev->gmc.stolen_size =gmc_v9_0_get_vbios_fb_size (adev); + adev->gmc.stolen_vga_size =gmc_v9_0_get_vbios_fb_size (adev);/* Memory manager */ r =amdgpu_bo_init (adev);
@@ -1282,7 +1282,7 @@ static int gmc_v9_0_sw_fini(void *handle)amdgpu_vm_manager_fini (adev);if (gmc_v9_0_keep_stolen_memory (adev)) -amdgpu_bo_free_kernel (&adev->stolen_vga_memory,NULL , &stolen_vga_buf); +amdgpu_bo_free_kernel (&adev->gmc.stolen_vga_memory,NULL , &stolen_vga_buf);amdgpu_gart_table_vram_free (adev);amdgpu_bo_fini (adev);
Signature · 6 lines
2.25.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 5/17 drm/amdgpu: move keep stolen memory check into gmc core
In reply to Alex DeucherRather than leaving this as a gmc v9 specific hack.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 9 ++++++++- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 11 +++-------- 3 files changed, 12 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +1 -0
@@ -215,6 +215,7 @@ struct amdgpu_gmc {bool prt_warning;uint64_t stolen_vga_size;struct amdgpu_bo *stolen_vga_memory; +bool keep_stolen_vga_memory;uint32_t sdpif_register;/* apertures */ u64 shared_aperture_start;
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +8 -1
@@ -2042,8 +2042,10 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)void amdgpu_ttm_late_init (struct amdgpu_device *adev) {void *stolen_vga_buf; +/* return the VGA stolen memory (if any) back to VRAM */ -amdgpu_bo_free_kernel (&adev->gmc.stolen_vga_memory,NULL , &stolen_vga_buf); +if (!adev->gmc.keep_stolen_vga_memory) +amdgpu_bo_free_kernel (&adev->gmc.stolen_vga_memory,NULL , &stolen_vga_buf); }/**
@@ -2051,10 +2053,15 @@ void amdgpu_ttm_late_init(struct amdgpu_device *adev)*/ void amdgpu_ttm_fini (struct amdgpu_device *adev) { +void *stolen_vga_buf; +if (!adev->mman.initialized)return ;amdgpu_ttm_training_reserve_vram_fini (adev); +/* return the stolen vga memory back to VRAM */ +if (adev->gmc.keep_stolen_vga_memory) +amdgpu_bo_free_kernel (&adev->gmc.stolen_vga_memory,NULL , &stolen_vga_buf);/* return the IP Discovery TMR memory back to VRAM */ amdgpu_bo_free_kernel (&adev->discovery_memory,NULL ,NULL );amdgpu_ttm_fw_reserve_vram_fini (adev);
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +3 -8
@@ -932,8 +932,7 @@ static int gmc_v9_0_late_init(void *handle)struct amdgpu_device *adev = (struct amdgpu_device *)handle;int r; -if (!gmc_v9_0_keep_stolen_memory (adev)) -amdgpu_bo_late_init (adev); +amdgpu_bo_late_init (adev); r =amdgpu_gmc_allocate_vm_inv_eng (adev);if (r)
@@ -1076,7 +1075,7 @@ static unsigned gmc_v9_0_get_vbios_fb_size(struct amdgpu_device *adev)* TODO Remove once GART corruption is resolved * Check related code in gmc_v9_0_sw_fini * */ -if (gmc_v9_0_keep_stolen_memory (adev)) +if (adev->gmc.keep_stolen_vga_memory)return AMDGPU_VBIOS_VGA_ALLOCATION ; d1vga_control =RREG32_SOC15 (DCE ,0 , mmD1VGA_CONTROL);
@@ -1243,6 +1242,7 @@ static int gmc_v9_0_sw_init(void *handle)if (r)return r; + adev->gmc.keep_stolen_vga_memory =gmc_v9_0_keep_stolen_memory (adev); adev->gmc.stolen_vga_size =gmc_v9_0_get_vbios_fb_size (adev);/* Memory manager */
@@ -1275,15 +1275,10 @@ static int gmc_v9_0_sw_init(void *handle)static int gmc_v9_0_sw_fini (void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle; -void *stolen_vga_buf;amdgpu_gmc_ras_fini (adev);amdgpu_gem_force_release (adev);amdgpu_vm_manager_fini (adev); - -if (gmc_v9_0_keep_stolen_memory (adev)) -amdgpu_bo_free_kernel (&adev->gmc.stolen_vga_memory,NULL , &stolen_vga_buf); -amdgpu_gart_table_vram_free (adev);amdgpu_bo_fini (adev);amdgpu_gart_fini (adev);
Signature · 6 lines
2.25.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 6/17 drm/amdgpu: add support for extended stolen vga memory
In reply to Alex DeucherThis will allow us to split the allocation for systems where we have to keep the stolen memory around to avoid S3 issues. This way we don't waste as much memory and still avoid any screen artifacts during the bios to driver transition.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 2 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 13 +++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +2 -0
@@ -215,6 +215,8 @@ struct amdgpu_gmc {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;/* apertures */
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +11 -2
@@ -1915,7 +1915,7 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)uint64_t gtt_size;int r;u64 vis_vram_limit; -void *stolen_vga_buf; +void *stolen_vga_buf, *stolen_extended_buf;mutex_init (&adev->mman.gtt_window_lock);
@@ -1985,6 +1985,13 @@ int amdgpu_ttm_init(struct amdgpu_device *adev) &stolen_vga_buf);if (r)return r; + r =amdgpu_bo_create_kernel_at (adev, adev->gmc.stolen_vga_size, + adev->gmc.stolen_extended_size, +AMDGPU_GEM_DOMAIN_VRAM , + &adev->gmc.stolen_extended_memory, + &stolen_extended_buf); +if (r) +return r;DRM_INFO ("amdgpu: %uM of VRAM memory ready\n" , (unsigned ) (adev->gmc.real_vram_size / (1024 *1024 )));
@@ -2041,11 +2048,13 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)*/ void amdgpu_ttm_late_init (struct amdgpu_device *adev) { -void *stolen_vga_buf; +void *stolen_vga_buf, *stolen_extended_buf;/* return the VGA stolen memory (if any) back to VRAM */ if (!adev->gmc.keep_stolen_vga_memory)amdgpu_bo_free_kernel (&adev->gmc.stolen_vga_memory,NULL , &stolen_vga_buf); +amdgpu_bo_free_kernel (&adev->gmc.stolen_extended_memory,NULL , + &stolen_extended_buf); }/**
Signature · 6 lines
2.25.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 7/17 drm/amdgpu/gmc: add new helper to get the FB size used by pre-OS console
In reply to Alex DeucherThis adds a new gmc callback to get the size reserved by the pre-OS console and provides a helper function for use by gmc IP drivers.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 43 +++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 5 +++ 2 files changed, 48 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +43 -0
@@ -27,6 +27,7 @@#include <linux/io-64-nonatomic-lo-hi.h> #include "amdgpu.h" +#include "amdgpu_gmc.h" #include "amdgpu_ras.h" #include "amdgpu_xgmi.h"
@@ -431,3 +432,45 @@ void amdgpu_gmc_set_vm_fault_masks(struct amdgpu_device *adev, int hub_type,WREG32 (reg, tmp); } } + +void amdgpu_gmc_get_vbios_allocations (struct amdgpu_device *adev) +{ +unsigned size; + +/* +* TODO: +* Currently there is a bug where some memory client outside +* of the driver writes to first 8M of VRAM on S3 resume, +* this overrides GART which by default gets placed in first 8M and +* causes VM_FAULTS once GTT is accessed. +* Keep the stolen memory reservation until the while this is not solved. +*/ +switch (adev->asic_type) { +case CHIP_VEGA10 : +case CHIP_RAVEN : +case CHIP_ARCTURUS : +case CHIP_RENOIR : + adev->gmc.keep_stolen_vga_memory = true; +break ; +default : + adev->gmc.keep_stolen_vga_memory = false; +break ; + } + +if (!amdgpu_device_ip_get_ip_block (adev,AMD_IP_BLOCK_TYPE_DCE )) + size =0 ; +else + size =amdgpu_gmc_get_vbios_fb_size (adev); + +/* set to 0 if the pre-OS buffer uses up most of vram */ +if ((adev->gmc.real_vram_size - size) < (8 *1024 *1024 )) + size =0 ; + +if (size >AMDGPU_VBIOS_VGA_ALLOCATION ) { + adev->gmc.stolen_vga_size =AMDGPU_VBIOS_VGA_ALLOCATION ; + adev->gmc.stolen_extended_size = size - adev->gmc.stolen_vga_size; + }else { + adev->gmc.stolen_vga_size = size; + adev->gmc.stolen_extended_size =0 ; + } +}
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +5 -0
@@ -131,6 +131,8 @@ struct amdgpu_gmc_funcs {void (*get_vm_pte)(struct amdgpu_device *adev,struct amdgpu_bo_va_mapping *mapping,uint64_t *flags); +/* get the amount of memory used by the vbios for pre-OS console */ +unsigned int (*get_vbios_fb_size)(struct amdgpu_device *adev); };struct amdgpu_xgmi {
@@ -253,6 +255,7 @@ struct amdgpu_gmc {#define amdgpu_gmc_map_mtype (adev, flags) (adev)->gmc.gmc_funcs->map_mtype((adev),(flags))#define amdgpu_gmc_get_vm_pde (adev, level, dst, flags) (adev)->gmc.gmc_funcs->get_vm_pde((adev), (level), (dst), (flags))#define amdgpu_gmc_get_vm_pte (adev, mapping, flags) (adev)->gmc.gmc_funcs->get_vm_pte((adev), (mapping), (flags)) +#define amdgpu_gmc_get_vbios_fb_size (adev) (adev)->gmc.gmc_funcs->get_vbios_fb_size((adev))/** * amdgpu_gmc_vram_full_visible - Check if full VRAM is visible through the BAR
@@ -307,4 +310,6 @@ extern void 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); +#endif
Signature · 6 lines
2.25.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 8/17 drm/amdgpu/gmc6: switch to using amdgpu_gmc_get_vbios_allocations
In reply to Alex DeucherThe new helper centralizes the logic in one place.
--- drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +2 -4
@@ -812,9 +812,6 @@ static unsigned gmc_v6_0_get_vbios_fb_size(struct amdgpu_device *adev)REG_GET_FIELD (viewport,VIEWPORT_SIZE ,VIEWPORT_WIDTH ) * 4); } -/* return 0 if the pre-OS buffer uses up most of vram */ -if ((adev->gmc.real_vram_size - size) < (8 *1024 *1024 )) -return 0 ;return size; }
@@ -862,7 +859,7 @@ static int gmc_v6_0_sw_init(void *handle)if (r)return r; - adev->gmc.stolen_vga_size =gmc_v6_0_get_vbios_fb_size (adev); +amdgpu_gmc_get_vbios_allocations (adev); r =amdgpu_bo_init (adev);if (r)
@@ -1136,6 +1133,7 @@ static const struct amdgpu_gmc_funcs gmc_v6_0_gmc_funcs = { .set_prt = gmc_v6_0_set_prt, .get_vm_pde = gmc_v6_0_get_vm_pde, .get_vm_pte = gmc_v6_0_get_vm_pte, + .get_vbios_fb_size = gmc_v6_0_get_vbios_fb_size, };static const struct amdgpu_irq_src_funcs gmc_v6_0_irq_funcs = {
Signature · 6 lines
2.25.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 9/17 drm/amdgpu/gmc7: switch to using amdgpu_gmc_get_vbios_allocations
In reply to Alex DeucherThe new helper centralizes the logic in one place.
--- drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +4 -5
@@ -977,9 +977,7 @@ static unsigned gmc_v7_0_get_vbios_fb_size(struct amdgpu_device *adev)REG_GET_FIELD (viewport,VIEWPORT_SIZE ,VIEWPORT_WIDTH ) * 4); } -/* return 0 if the pre-OS buffer uses up most of vram */ -if ((adev->gmc.real_vram_size - size) < (8 *1024 *1024 )) -return 0 ; +return size; }
@@ -1035,7 +1033,7 @@ static int gmc_v7_0_sw_init(void *handle)if (r)return r; - adev->gmc.stolen_vga_size =gmc_v7_0_get_vbios_fb_size (adev); +amdgpu_gmc_get_vbios_allocations (adev);/* Memory manager */ r =amdgpu_bo_init (adev);
@@ -1372,7 +1370,8 @@ static const struct amdgpu_gmc_funcs gmc_v7_0_gmc_funcs = { .emit_pasid_mapping = gmc_v7_0_emit_pasid_mapping, .set_prt = gmc_v7_0_set_prt, .get_vm_pde = gmc_v7_0_get_vm_pde, - .get_vm_pte = gmc_v7_0_get_vm_pte + .get_vm_pte = gmc_v7_0_get_vm_pte, + .get_vbios_fb_size = gmc_v7_0_get_vbios_fb_size, };static const struct amdgpu_irq_src_funcs gmc_v7_0_irq_funcs = {
Signature · 6 lines
2.25.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 10/17 drm/amdgpu/gmc8: switch to using amdgpu_gmc_get_vbios_allocations
In reply to Alex DeucherThe new helper centralizes the logic in one place.
--- drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +4 -5
@@ -1094,9 +1094,7 @@ static unsigned gmc_v8_0_get_vbios_fb_size(struct amdgpu_device *adev)REG_GET_FIELD (viewport,VIEWPORT_SIZE ,VIEWPORT_WIDTH ) * 4); } -/* return 0 if the pre-OS buffer uses up most of vram */ -if ((adev->gmc.real_vram_size - size) < (8 *1024 *1024 )) -return 0 ; +return size; }
@@ -1160,7 +1158,7 @@ static int gmc_v8_0_sw_init(void *handle)if (r)return r; - adev->gmc.stolen_vga_size =gmc_v8_0_get_vbios_fb_size (adev); +amdgpu_gmc_get_vbios_allocations (adev);/* Memory manager */ r =amdgpu_bo_init (adev);
@@ -1739,7 +1737,8 @@ static const struct amdgpu_gmc_funcs gmc_v8_0_gmc_funcs = { .emit_pasid_mapping = gmc_v8_0_emit_pasid_mapping, .set_prt = gmc_v8_0_set_prt, .get_vm_pde = gmc_v8_0_get_vm_pde, - .get_vm_pte = gmc_v8_0_get_vm_pte + .get_vm_pte = gmc_v8_0_get_vm_pte, + .get_vbios_fb_size = gmc_v8_0_get_vbios_fb_size, };static const struct amdgpu_irq_src_funcs gmc_v8_0_irq_funcs = {
Signature · 6 lines
2.25.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 11/17 drm/amdgpu/gmc9: switch to using amdgpu_gmc_get_vbios_allocations
In reply to Alex DeucherThe new helper centralizes the logic in one place.
--- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 112 +++++++++----------------- 1 file changed, 38 insertions(+), 74 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +38 -74
@@ -827,6 +827,41 @@ static void gmc_v9_0_get_vm_pte(struct amdgpu_device *adev, *flags |=AMDGPU_PTE_SNOOPED ; } +static unsigned gmc_v9_0_get_vbios_fb_size (struct amdgpu_device *adev) +{ +u32 d1vga_control =RREG32_SOC15 (DCE ,0 , mmD1VGA_CONTROL); +unsigned size; + +if (REG_GET_FIELD (d1vga_control,D1VGA_CONTROL ,D1VGA_MODE_ENABLE )) { + size =AMDGPU_VBIOS_VGA_ALLOCATION ; + }else { +u32 viewport; + +switch (adev->asic_type) { +case CHIP_RAVEN : +case CHIP_RENOIR : + viewport =RREG32_SOC15 (DCE ,0 , mmHUBP0_DCSURF_PRI_VIEWPORT_DIMENSION); + size = (REG_GET_FIELD (viewport, +HUBP0_DCSURF_PRI_VIEWPORT_DIMENSION ,PRI_VIEWPORT_HEIGHT ) * +REG_GET_FIELD (viewport, +HUBP0_DCSURF_PRI_VIEWPORT_DIMENSION ,PRI_VIEWPORT_WIDTH ) * +4 ); +break ; +case CHIP_VEGA10 : +case CHIP_VEGA12 : +case CHIP_VEGA20 : +default : + viewport =RREG32_SOC15 (DCE ,0 , mmSCL0_VIEWPORT_SIZE); + size = (REG_GET_FIELD (viewport,SCL0_VIEWPORT_SIZE ,VIEWPORT_HEIGHT ) * +REG_GET_FIELD (viewport,SCL0_VIEWPORT_SIZE ,VIEWPORT_WIDTH ) * +4 ); +break ; + } + } + +return size; +} +static const struct amdgpu_gmc_funcs gmc_v9_0_gmc_funcs = { .flush_gpu_tlb = gmc_v9_0_flush_gpu_tlb, .flush_gpu_tlb_pasid = gmc_v9_0_flush_gpu_tlb_pasid,
@@ -834,7 +869,8 @@ static const struct amdgpu_gmc_funcs gmc_v9_0_gmc_funcs = { .emit_pasid_mapping = gmc_v9_0_emit_pasid_mapping, .map_mtype = gmc_v9_0_map_mtype, .get_vm_pde = gmc_v9_0_get_vm_pde, - .get_vm_pte = gmc_v9_0_get_vm_pte + .get_vm_pte = gmc_v9_0_get_vm_pte, + .get_vbios_fb_size = gmc_v9_0_get_vbios_fb_size, };static void gmc_v9_0_set_gmc_funcs (struct amdgpu_device *adev)
@@ -902,31 +938,6 @@ static int gmc_v9_0_early_init(void *handle)return 0 ; } -static bool gmc_v9_0_keep_stolen_memory (struct amdgpu_device *adev) -{ - -/* -* TODO: -* Currently there is a bug where some memory client outside -* of the driver writes to first 8M of VRAM on S3 resume, -* this overrides GART which by default gets placed in first 8M and -* causes VM_FAULTS once GTT is accessed. -* Keep the stolen memory reservation until the while this is not solved. -* Also check code in gmc_v9_0_get_vbios_fb_size and gmc_v9_0_late_init -*/ -switch (adev->asic_type) { -case CHIP_VEGA10 : -case CHIP_RAVEN : -case CHIP_ARCTURUS : -case CHIP_RENOIR : -return true; -case CHIP_VEGA12 : -case CHIP_VEGA20 : -default : -return false; - } -} -static int gmc_v9_0_late_init (void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -1066,52 +1077,6 @@ static int gmc_v9_0_gart_init(struct amdgpu_device *adev)return amdgpu_gart_table_vram_alloc (adev); } -static unsigned gmc_v9_0_get_vbios_fb_size (struct amdgpu_device *adev) -{ -u32 d1vga_control; -unsigned size; - -/* -* TODO Remove once GART corruption is resolved -* Check related code in gmc_v9_0_sw_fini -* */ -if (adev->gmc.keep_stolen_vga_memory) -return AMDGPU_VBIOS_VGA_ALLOCATION ; - - d1vga_control =RREG32_SOC15 (DCE ,0 , mmD1VGA_CONTROL); -if (REG_GET_FIELD (d1vga_control,D1VGA_CONTROL ,D1VGA_MODE_ENABLE )) { - size =AMDGPU_VBIOS_VGA_ALLOCATION ; - }else { -u32 viewport; - -switch (adev->asic_type) { -case CHIP_RAVEN : -case CHIP_RENOIR : - viewport =RREG32_SOC15 (DCE ,0 , mmHUBP0_DCSURF_PRI_VIEWPORT_DIMENSION); - size = (REG_GET_FIELD (viewport, -HUBP0_DCSURF_PRI_VIEWPORT_DIMENSION ,PRI_VIEWPORT_HEIGHT ) * -REG_GET_FIELD (viewport, -HUBP0_DCSURF_PRI_VIEWPORT_DIMENSION ,PRI_VIEWPORT_WIDTH ) * -4 ); -break ; -case CHIP_VEGA10 : -case CHIP_VEGA12 : -case CHIP_VEGA20 : -default : - viewport =RREG32_SOC15 (DCE ,0 , mmSCL0_VIEWPORT_SIZE); - size = (REG_GET_FIELD (viewport,SCL0_VIEWPORT_SIZE ,VIEWPORT_HEIGHT ) * -REG_GET_FIELD (viewport,SCL0_VIEWPORT_SIZE ,VIEWPORT_WIDTH ) * -4 ); -break ; - } - } -/* return 0 if the pre-OS buffer uses up most of vram */ -if ((adev->gmc.real_vram_size - size) < (8 *1024 *1024 )) -return 0 ; - -return size; -} -static int gmc_v9_0_sw_init (void *handle) {int r, vram_width =0 , vram_type =0 , vram_vendor =0 ;
@@ -1242,8 +1207,7 @@ static int gmc_v9_0_sw_init(void *handle)if (r)return r; - adev->gmc.keep_stolen_vga_memory =gmc_v9_0_keep_stolen_memory (adev); - adev->gmc.stolen_vga_size =gmc_v9_0_get_vbios_fb_size (adev); +amdgpu_gmc_get_vbios_allocations (adev);/* Memory manager */ r =amdgpu_bo_init (adev);
Signature · 6 lines
2.25.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 12/17 drm/amdgpu/gmc10: switch to using amdgpu_gmc_get_vbios_allocations
In reply to Alex DeucherThe new helper centralizes the logic in one place.
--- drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c | 57 +++++++++++--------------- 1 file changed, 25 insertions(+), 32 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c +25 -32
@@ -553,6 +553,28 @@ static void gmc_v10_0_get_vm_pte(struct amdgpu_device *adev, } } +static unsigned gmc_v10_0_get_vbios_fb_size (struct amdgpu_device *adev) +{ +u32 d1vga_control =RREG32_SOC15 (DCE ,0 , mmD1VGA_CONTROL); +unsigned size; + +if (REG_GET_FIELD (d1vga_control,D1VGA_CONTROL ,D1VGA_MODE_ENABLE )) { + size =AMDGPU_VBIOS_VGA_ALLOCATION ; + }else { +u32 viewport; +u32 pitch; + + viewport =RREG32_SOC15 (DCE ,0 , mmHUBP0_DCSURF_PRI_VIEWPORT_DIMENSION); + pitch =RREG32_SOC15 (DCE ,0 , mmHUBPREQ0_DCSURF_SURFACE_PITCH); + size = (REG_GET_FIELD (viewport, +HUBP0_DCSURF_PRI_VIEWPORT_DIMENSION ,PRI_VIEWPORT_HEIGHT ) * +REG_GET_FIELD (pitch,HUBPREQ0_DCSURF_SURFACE_PITCH ,PITCH ) * +4 ); + } + +return size; +} +static const struct amdgpu_gmc_funcs gmc_v10_0_gmc_funcs = { .flush_gpu_tlb = gmc_v10_0_flush_gpu_tlb, .flush_gpu_tlb_pasid = gmc_v10_0_flush_gpu_tlb_pasid,
@@ -560,7 +582,8 @@ static const struct amdgpu_gmc_funcs gmc_v10_0_gmc_funcs = { .emit_pasid_mapping = gmc_v10_0_emit_pasid_mapping, .map_mtype = gmc_v10_0_map_mtype, .get_vm_pde = gmc_v10_0_get_vm_pde, - .get_vm_pte = gmc_v10_0_get_vm_pte + .get_vm_pte = gmc_v10_0_get_vm_pte, + .get_vbios_fb_size = gmc_v10_0_get_vbios_fb_size, };static void gmc_v10_0_set_gmc_funcs (struct amdgpu_device *adev)
@@ -701,36 +724,6 @@ static int gmc_v10_0_gart_init(struct amdgpu_device *adev)return amdgpu_gart_table_vram_alloc (adev); } -static unsigned gmc_v10_0_get_vbios_fb_size (struct amdgpu_device *adev) -{ -u32 d1vga_control =RREG32_SOC15 (DCE ,0 , mmD1VGA_CONTROL); -unsigned size; - -if (REG_GET_FIELD (d1vga_control,D1VGA_CONTROL ,D1VGA_MODE_ENABLE )) { - size =AMDGPU_VBIOS_VGA_ALLOCATION ; - }else { -u32 viewport; -u32 pitch; - - viewport =RREG32_SOC15 (DCE ,0 , mmHUBP0_DCSURF_PRI_VIEWPORT_DIMENSION); - pitch =RREG32_SOC15 (DCE ,0 , mmHUBPREQ0_DCSURF_SURFACE_PITCH); - size = (REG_GET_FIELD (viewport, -HUBP0_DCSURF_PRI_VIEWPORT_DIMENSION ,PRI_VIEWPORT_HEIGHT ) * -REG_GET_FIELD (pitch,HUBPREQ0_DCSURF_SURFACE_PITCH ,PITCH ) * -4 ); - } -/* return 0 if the pre-OS buffer uses up most of vram */ -if ((adev->gmc.real_vram_size - size) < (8 *1024 *1024 )) { -DRM_ERROR ("Warning: pre-OS buffer uses most of vram, \ -be aware of gart table overwrite\n" ); -return 0 ; - } - -return size; -} - - -static int gmc_v10_0_sw_init (void *handle) {int r, vram_width =0 , vram_type =0 , vram_vendor =0 ;
@@ -812,7 +805,7 @@ static int gmc_v10_0_sw_init(void *handle)if (r)return r; - adev->gmc.stolen_vga_size =gmc_v10_0_get_vbios_fb_size (adev); +amdgpu_gmc_get_vbios_allocations (adev);/* Memory manager */ r =amdgpu_bo_init (adev);
Signature · 6 lines
2.25.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 13/17 drm/amdgpu: drop the CPU pointers for the stolen vga bos
In reply to Alex DeucherWe never use them.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +5 -11
@@ -1915,7 +1915,6 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)uint64_t gtt_size;int r;u64 vis_vram_limit; -void *stolen_vga_buf, *stolen_extended_buf;mutex_init (&adev->mman.gtt_window_lock);
@@ -1982,14 +1981,14 @@ int amdgpu_ttm_init(struct amdgpu_device *adev) r =amdgpu_bo_create_kernel_at (adev,0 , adev->gmc.stolen_vga_size,AMDGPU_GEM_DOMAIN_VRAM , &adev->gmc.stolen_vga_memory, - &stolen_vga_buf); +NULL );if (r)return r; r =amdgpu_bo_create_kernel_at (adev, adev->gmc.stolen_vga_size, adev->gmc.stolen_extended_size,AMDGPU_GEM_DOMAIN_VRAM , &adev->gmc.stolen_extended_memory, - &stolen_extended_buf); +NULL );if (r)return r;
@@ -2048,13 +2047,10 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)*/ void amdgpu_ttm_late_init (struct amdgpu_device *adev) { -void *stolen_vga_buf, *stolen_extended_buf; -/* return the VGA stolen memory (if any) back to VRAM */ if (!adev->gmc.keep_stolen_vga_memory) -amdgpu_bo_free_kernel (&adev->gmc.stolen_vga_memory,NULL , &stolen_vga_buf); -amdgpu_bo_free_kernel (&adev->gmc.stolen_extended_memory,NULL , - &stolen_extended_buf); +amdgpu_bo_free_kernel (&adev->gmc.stolen_vga_memory,NULL ,NULL ); +amdgpu_bo_free_kernel (&adev->gmc.stolen_extended_memory,NULL ,NULL ); }/**
@@ -2062,15 +2058,13 @@ void amdgpu_ttm_late_init(struct amdgpu_device *adev)*/ void amdgpu_ttm_fini (struct amdgpu_device *adev) { -void *stolen_vga_buf; -if (!adev->mman.initialized)return ;amdgpu_ttm_training_reserve_vram_fini (adev);/* return the stolen vga memory back to VRAM */ if (adev->gmc.keep_stolen_vga_memory) -amdgpu_bo_free_kernel (&adev->gmc.stolen_vga_memory,NULL , &stolen_vga_buf); +amdgpu_bo_free_kernel (&adev->gmc.stolen_vga_memory,NULL ,NULL );/* return the IP Discovery TMR memory back to VRAM */ amdgpu_bo_free_kernel (&adev->discovery_memory,NULL ,NULL );amdgpu_ttm_fw_reserve_vram_fini (adev);
Signature · 6 lines
2.25.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 14/17 drm/amdgpu/gmc: disable keep_stolen_vga_memory on arcturus
In reply to Alex DeucherI suspect the only reason this was set was to avoid touching the display related registers on arcturus. Someone should double check this on arcturus with S3.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +0 -1
@@ -448,7 +448,6 @@ void amdgpu_gmc_get_vbios_allocations(struct amdgpu_device *adev)switch (adev->asic_type) {case CHIP_VEGA10 :case CHIP_RAVEN : -case CHIP_ARCTURUS :case CHIP_RENOIR : adev->gmc.keep_stolen_vga_memory = true;break ;
Signature · 6 lines
2.25.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 15/17 drm/amdgpu: move stolen memory from gmc to mman
In reply to Alex DeucherIt's more related to memory management than memory controller.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 12 ++++++------ drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 5 ----- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 20 ++++++++++---------- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | 6 ++++++ 4 files changed, 22 insertions(+), 21 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +6 -6
@@ -449,10 +449,10 @@ void amdgpu_gmc_get_vbios_allocations(struct amdgpu_device *adev)case CHIP_VEGA10 :case CHIP_RAVEN :case CHIP_RENOIR : - adev->gmc.keep_stolen_vga_memory = true; + adev->mman.keep_stolen_vga_memory = true;break ;default : - adev->gmc.keep_stolen_vga_memory = false; + adev->mman.keep_stolen_vga_memory = false;break ; }
@@ -466,10 +466,10 @@ void amdgpu_gmc_get_vbios_allocations(struct amdgpu_device *adev) size =0 ;if (size >AMDGPU_VBIOS_VGA_ALLOCATION ) { - adev->gmc.stolen_vga_size =AMDGPU_VBIOS_VGA_ALLOCATION ; - adev->gmc.stolen_extended_size = size - adev->gmc.stolen_vga_size; + adev->mman.stolen_vga_size =AMDGPU_VBIOS_VGA_ALLOCATION ; + adev->mman.stolen_extended_size = size - adev->mman.stolen_vga_size; }else { - adev->gmc.stolen_vga_size = size; - adev->gmc.stolen_extended_size =0 ; + adev->mman.stolen_vga_size = size; + adev->mman.stolen_extended_size =0 ; } }
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h +0 -5
@@ -215,11 +215,6 @@ struct amdgpu_gmc {uint8_t vram_vendor;uint32_t srbm_soft_reset;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;/* apertures */ u64 shared_aperture_start;
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +10 -10
@@ -1978,16 +1978,16 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)* This is used for VGA emulation and pre-OS scanout buffers to * avoid display artifacts while transitioning between pre-OS * 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 , - &adev->gmc.stolen_vga_memory, + &adev->mman.stolen_vga_memory,NULL );if (r)return r; - r =amdgpu_bo_create_kernel_at (adev, adev->gmc.stolen_vga_size, - adev->gmc.stolen_extended_size, + r =amdgpu_bo_create_kernel_at (adev, adev->mman.stolen_vga_size, + adev->mman.stolen_extended_size,AMDGPU_GEM_DOMAIN_VRAM , - &adev->gmc.stolen_extended_memory, + &adev->mman.stolen_extended_memory,NULL );if (r)return r;
@@ -2048,9 +2048,9 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)void amdgpu_ttm_late_init (struct amdgpu_device *adev) {/* return the VGA stolen memory (if any) back to VRAM */ -if (!adev->gmc.keep_stolen_vga_memory) -amdgpu_bo_free_kernel (&adev->gmc.stolen_vga_memory,NULL ,NULL ); -amdgpu_bo_free_kernel (&adev->gmc.stolen_extended_memory,NULL ,NULL ); +if (!adev->mman.keep_stolen_vga_memory) +amdgpu_bo_free_kernel (&adev->mman.stolen_vga_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)amdgpu_ttm_training_reserve_vram_fini (adev);/* return the stolen vga memory back to VRAM */ -if (adev->gmc.keep_stolen_vga_memory) -amdgpu_bo_free_kernel (&adev->gmc.stolen_vga_memory,NULL ,NULL ); +if (adev->mman.keep_stolen_vga_memory) +amdgpu_bo_free_kernel (&adev->mman.stolen_vga_memory,NULL ,NULL );/* return the IP Discovery TMR memory back to VRAM */ amdgpu_bo_free_kernel (&adev->discovery_memory,NULL ,NULL );amdgpu_ttm_fw_reserve_vram_fini (adev);
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h +6 -0
@@ -59,6 +59,12 @@ struct amdgpu_mman {struct mutex gtt_window_lock;/* Scheduler entity for buffer moves */ 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 {
Signature · 6 lines
2.25.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 16/17 drm/amdgpu: move IP discovery data to mman
In reply to Alex DeucherIt's related to the memory manager so move it there.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 5 -- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 54 +++++++++---------- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 20 +++---- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | 5 ++ 5 files changed, 44 insertions(+), 44 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -5
@@ -918,11 +918,6 @@ struct amdgpu_device {/* display related functionality */ struct amdgpu_display_manager dm; -/* discovery */ -uint8_t *discovery_bin; -uint32_t discovery_tmr_size; -struct amdgpu_bo *discovery_memory; -/* mes */ bool enable_mes;struct amdgpu_mes mes;
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -2
@@ -1563,7 +1563,7 @@ static int amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev) adev->firmware.gpu_info_fw =NULL ; -if (adev->discovery_bin) { +if (adev->mman.discovery_bin) {amdgpu_discovery_get_gfx_info (adev);/*
@@ -3415,7 +3415,7 @@ void amdgpu_device_fini(struct amdgpu_device *adev)sysfs_remove_files (&adev->dev->kobj, amdgpu_dev_attributes);if (IS_ENABLED (CONFIG_PERF_EVENTS ))amdgpu_pmu_fini (adev); -if (adev->discovery_bin) +if (adev->mman.discovery_bin)amdgpu_discovery_fini (adev); }
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +27 -27
157 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +10 -10
@@ -1825,7 +1825,7 @@ static void amdgpu_ttm_training_data_block_init(struct amdgpu_device *adev)memset (ctx,0 ,sizeof (*ctx)); ctx->c2p_train_data_offset = -ALIGN ((adev->gmc.mc_vram_size - adev->discovery_tmr_size -SZ_1M ),SZ_1M ); +ALIGN ((adev->gmc.mc_vram_size - adev->mman.discovery_tmr_size -SZ_1M ),SZ_1M ); ctx->p2c_train_data_offset = (adev->gmc.mc_vram_size -GDDR6_MEM_TRAINING_OFFSET ); ctx->train_data_size =
@@ -1864,10 +1864,10 @@ static int amdgpu_ttm_reserve_tmr(struct amdgpu_device *adev)* Otherwise, fallback to legacy approach to check and reserve tmr block for ip * discovery data and G6 memory training data respectively */ - adev->discovery_tmr_size = + adev->mman.discovery_tmr_size =amdgpu_atomfirmware_get_fw_reserved_fb_size (adev); -if (!adev->discovery_tmr_size) - adev->discovery_tmr_size =DISCOVERY_TMR_OFFSET ; +if (!adev->mman.discovery_tmr_size) + adev->mman.discovery_tmr_size =DISCOVERY_TMR_OFFSET ;if (mem_train_support) {/* reserve vram for mem train according to TMR location */
@@ -1887,14 +1887,14 @@ static int amdgpu_ttm_reserve_tmr(struct amdgpu_device *adev) } ret =amdgpu_bo_create_kernel_at (adev, - adev->gmc.real_vram_size - adev->discovery_tmr_size, - adev->discovery_tmr_size, + adev->gmc.real_vram_size - adev->mman.discovery_tmr_size, + adev->mman.discovery_tmr_size,AMDGPU_GEM_DOMAIN_VRAM , - &adev->discovery_memory, + &adev->mman.discovery_memory,NULL );if (ret) {DRM_ERROR ("alloc tmr failed(%d)!\n" , ret); -amdgpu_bo_free_kernel (&adev->discovery_memory,NULL ,NULL ); +amdgpu_bo_free_kernel (&adev->mman.discovery_memory,NULL ,NULL );return ret; }
@@ -1968,7 +1968,7 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)* If IP discovery enabled, a block of memory should be * reserved for IP discovey. */ -if (adev->discovery_bin) { +if (adev->mman.discovery_bin) { r =amdgpu_ttm_reserve_tmr (adev);if (r)return r;
@@ -2066,7 +2066,7 @@ void amdgpu_ttm_fini(struct amdgpu_device *adev)if (adev->mman.keep_stolen_vga_memory)amdgpu_bo_free_kernel (&adev->mman.stolen_vga_memory,NULL ,NULL );/* return the IP Discovery TMR memory back to VRAM */ -amdgpu_bo_free_kernel (&adev->discovery_memory,NULL ,NULL ); +amdgpu_bo_free_kernel (&adev->mman.discovery_memory,NULL ,NULL );amdgpu_ttm_fw_reserve_vram_fini (adev);if (adev->mman.aper_base_kaddr)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h +5 -0
@@ -65,6 +65,11 @@ struct amdgpu_mman {uint64_t stolen_extended_size;struct amdgpu_bo *stolen_extended_memory;bool keep_stolen_vga_memory; + +/* discovery */ +uint8_t *discovery_bin; +uint32_t discovery_tmr_size; +struct amdgpu_bo *discovery_memory; };struct amdgpu_copy_mem {
Signature · 6 lines
2.25.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 17/17 drm/amdgpu: move vram usage by vbios to mman (v2)
In reply to Alex DeucherIt's related to the memory manager so move it there.
v2: inline the structure
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 12 ----------- drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c | 4 ++-- .../gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 20 +++++++++---------- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | 6 ++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 6 +++--- 6 files changed, 23 insertions(+), 29 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -12
@@ -649,16 +649,6 @@ struct amdgpu_atcs {struct amdgpu_atcs_functions functions; }; -/* -* Firmware VRAM reservation -*/ -struct amdgpu_fw_vram_usage { -u64 start_offset; -u64 size; -struct amdgpu_bo *reserved_bo; -void *va; -}; -/* * CGS */
@@ -942,8 +932,6 @@ struct amdgpu_device {struct delayed_work delayed_init_work;struct amdgpu_virt virt; -/* firmware VRAM reservation */ -struct amdgpu_fw_vram_usage fw_vram_usage;/* link all shadow bo */ struct list_head shadow_list;
drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c +2 -2
@@ -1786,9 +1786,9 @@ static int amdgpu_atombios_allocate_fb_scratch(struct amdgpu_device *adev) (uint32_t)(ATOM_VRAM_BLOCK_SRIOV_MSG_SHARE_RESERVATION << ATOM_VRAM_OPERATION_FLAGS_SHIFT)) {/* Firmware request VRAM reservation for SR-IOV */ - adev->fw_vram_usage.start_offset = (start_addr & + adev->mman.fw_vram_usage_start_offset = (start_addr & (~ATOM_VRAM_OPERATION_FLAGS_MASK )) <<10 ; - adev->fw_vram_usage.size = size <<10 ; + adev->mman.fw_vram_usage_size = size <<10 ;/* Use the default scratch size */ usage_bytes =0 ; } else {
drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c +2 -2
@@ -89,9 +89,9 @@ int amdgpu_atomfirmware_allocate_fb_scratch(struct amdgpu_device *adev) (uint32_t)(ATOM_VRAM_BLOCK_SRIOV_MSG_SHARE_RESERVATION << ATOM_VRAM_OPERATION_FLAGS_SHIFT)) {/* Firmware request VRAM reservation for SR-IOV */ - adev->fw_vram_usage.start_offset = (start_addr & + adev->mman.fw_vram_usage_start_offset = (start_addr & (~ATOM_VRAM_OPERATION_FLAGS_MASK )) <<10 ; - adev->fw_vram_usage.size = size <<10 ; + adev->mman.fw_vram_usage_size = size <<10 ;/* Use the default scratch size */ usage_bytes =0 ; } else {
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +10 -10
@@ -1766,8 +1766,8 @@ static struct ttm_bo_driver amdgpu_bo_driver = {*/ static void amdgpu_ttm_fw_reserve_vram_fini (struct amdgpu_device *adev) { -amdgpu_bo_free_kernel (&adev->fw_vram_usage.reserved_bo, -NULL , &adev->fw_vram_usage.va); +amdgpu_bo_free_kernel (&adev->mman.fw_vram_usage_reserved_bo, +NULL , &adev->mman.fw_vram_usage_va); }/**
@@ -1781,19 +1781,19 @@ static int amdgpu_ttm_fw_reserve_vram_init(struct amdgpu_device *adev) {uint64_t vram_size = adev->gmc.visible_vram_size; - adev->fw_vram_usage.va =NULL ; - adev->fw_vram_usage.reserved_bo =NULL ; + adev->mman.fw_vram_usage_va =NULL ; + adev->mman.fw_vram_usage_reserved_bo =NULL ; -if (adev->fw_vram_usage.size ==0 || - adev->fw_vram_usage.size > vram_size) +if (adev->mman.fw_vram_usage_size ==0 || + adev->mman.fw_vram_usage_size > vram_size)return 0 ;return amdgpu_bo_create_kernel_at (adev, - adev->fw_vram_usage.start_offset, - adev->fw_vram_usage.size, + adev->mman.fw_vram_usage_start_offset, + adev->mman.fw_vram_usage_size,AMDGPU_GEM_DOMAIN_VRAM , - &adev->fw_vram_usage.reserved_bo, - &adev->fw_vram_usage.va); + &adev->mman.fw_vram_usage_reserved_bo, + &adev->mman.fw_vram_usage_va); }/*
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h +6 -0
@@ -70,6 +70,12 @@ struct amdgpu_mman {uint8_t *discovery_bin;uint32_t discovery_tmr_size;struct amdgpu_bo *discovery_memory; + +/* firmware VRAM reservation */ +u64 fw_vram_usage_start_offset; +u64 fw_vram_usage_size; +struct amdgpu_bo *fw_vram_usage_reserved_bo; +void *fw_vram_usage_va; };struct amdgpu_copy_mem {
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +3 -3
@@ -401,7 +401,7 @@ static void amdgpu_virt_add_bad_page(struct amdgpu_device *adev,if (bp_block_size) { bp_cnt = bp_block_size /sizeof (uint64_t );for (bp_idx =0 ; bp_idx < bp_cnt; bp_idx++) { - retired_page = *(uint64_t *)(adev->fw_vram_usage.va + + retired_page = *(uint64_t *)(adev->mman.fw_vram_usage_va + bp_block_offset + bp_idx *sizeof (uint64_t )); bp.retired_page = retired_page;
@@ -428,10 +428,10 @@ void amdgpu_virt_init_data_exchange(struct amdgpu_device *adev) adev->virt.fw_reserve.p_pf2vf =NULL ; adev->virt.fw_reserve.p_vf2pf =NULL ; -if (adev->fw_vram_usage.va !=NULL ) { +if (adev->mman.fw_vram_usage_va !=NULL ) { adev->virt.fw_reserve.p_pf2vf = (struct amd_sriov_msg_pf2vf_info_header *)( - adev->fw_vram_usage.va +AMDGIM_DATAEXCHANGE_OFFSET ); + adev->mman.fw_vram_usage_va +AMDGIM_DATAEXCHANGE_OFFSET );AMDGPU_FW_VRAM_PF2VF_READ (adev, header.size, &pf2vf_size);AMDGPU_FW_VRAM_PF2VF_READ (adev, checksum, &checksum);AMDGPU_FW_VRAM_PF2VF_READ (adev, feature_flags, &adev->virt.gim_feature);
Signature · 6 lines
2.25.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 17/17] drm/amdgpu: move vram usage by vbios to mman (v2)
Am 30.07.20 um 22:04 schrieb Alex Deucher:
Quoted 5 lines
It's related to the memory manager so move it there.
v2: inline the structure
Signed-off-by Alex Deucher <[email protected]>
Quoted 147 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 12 ----------- drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c | 4 ++-- .../gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 20 +++++++++---------- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | 6 ++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 6 +++--- 6 files changed, 23 insertions(+), 29 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-12@@ -649,16 +649,6 @@ struct amdgpu_atcs {struct amdgpu_atcs_functions functions; }; -/* -* Firmware VRAM reservation -*/ -struct amdgpu_fw_vram_usage { -u64 start_offset; -u64 size; -struct amdgpu_bo *reserved_bo; -void *va; -}; -/* * CGS */ @@ -942,8 +932,6 @@ struct amdgpu_device {struct delayed_work delayed_init_work;struct amdgpu_virt virt; -/* firmware VRAM reservation */ -struct amdgpu_fw_vram_usage fw_vram_usage;/* link all shadow bo */ struct list_head shadow_list;drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c +2
-2@@ -1786,9 +1786,9 @@ static int amdgpu_atombios_allocate_fb_scratch(struct amdgpu_device *adev) (uint32_t)(ATOM_VRAM_BLOCK_SRIOV_MSG_SHARE_RESERVATION << ATOM_VRAM_OPERATION_FLAGS_SHIFT)) {/* Firmware request VRAM reservation for SR-IOV */ - adev->fw_vram_usage.start_offset = (start_addr & + adev->mman.fw_vram_usage_start_offset = (start_addr & (~ATOM_VRAM_OPERATION_FLAGS_MASK )) <<10 ; - adev->fw_vram_usage.size = size <<10 ; + adev->mman.fw_vram_usage_size = size <<10 ;/* Use the default scratch size */ usage_bytes =0 ; } else {drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c +2
-2@@ -89,9 +89,9 @@ int amdgpu_atomfirmware_allocate_fb_scratch(struct amdgpu_device *adev) (uint32_t)(ATOM_VRAM_BLOCK_SRIOV_MSG_SHARE_RESERVATION << ATOM_VRAM_OPERATION_FLAGS_SHIFT)) {/* Firmware request VRAM reservation for SR-IOV */ - adev->fw_vram_usage.start_offset = (start_addr & + adev->mman.fw_vram_usage_start_offset = (start_addr & (~ATOM_VRAM_OPERATION_FLAGS_MASK )) <<10 ; - adev->fw_vram_usage.size = size <<10 ; + adev->mman.fw_vram_usage_size = size <<10 ;/* Use the default scratch size */ usage_bytes =0 ; } else {drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +10
-10@@ -1766,8 +1766,8 @@ static struct ttm_bo_driver amdgpu_bo_driver = {*/ static void amdgpu_ttm_fw_reserve_vram_fini (struct amdgpu_device *adev) { -amdgpu_bo_free_kernel (&adev->fw_vram_usage.reserved_bo, -NULL , &adev->fw_vram_usage.va); +amdgpu_bo_free_kernel (&adev->mman.fw_vram_usage_reserved_bo, +NULL , &adev->mman.fw_vram_usage_va); }/** @@ -1781,19 +1781,19 @@ static int amdgpu_ttm_fw_reserve_vram_init(struct amdgpu_device *adev) {uint64_t vram_size = adev->gmc.visible_vram_size; - adev->fw_vram_usage.va =NULL ; - adev->fw_vram_usage.reserved_bo =NULL ; + adev->mman.fw_vram_usage_va =NULL ; + adev->mman.fw_vram_usage_reserved_bo =NULL ; -if (adev->fw_vram_usage.size ==0 || - adev->fw_vram_usage.size > vram_size) +if (adev->mman.fw_vram_usage_size ==0 || + adev->mman.fw_vram_usage_size > vram_size)return 0 ;return amdgpu_bo_create_kernel_at (adev, - adev->fw_vram_usage.start_offset, - adev->fw_vram_usage.size, + adev->mman.fw_vram_usage_start_offset, + adev->mman.fw_vram_usage_size,AMDGPU_GEM_DOMAIN_VRAM , - &adev->fw_vram_usage.reserved_bo, - &adev->fw_vram_usage.va); + &adev->mman.fw_vram_usage_reserved_bo, + &adev->mman.fw_vram_usage_va); }/* drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h +6
-0@@ -70,6 +70,12 @@ struct amdgpu_mman {uint8_t *discovery_bin;uint32_t discovery_tmr_size;struct amdgpu_bo *discovery_memory; + +/* firmware VRAM reservation */ +u64 fw_vram_usage_start_offset; +u64 fw_vram_usage_size; +struct amdgpu_bo *fw_vram_usage_reserved_bo; +void *fw_vram_usage_va; };struct amdgpu_copy_mem {drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +1
-1@@ -401,7 +401,7 @@ static void amdgpu_virt_add_bad_page(struct amdgpu_device *adev,if (bp_block_size) { bp_cnt = bp_block_size /sizeof (uint64_t );for (bp_idx =0 ; bp_idx < bp_cnt; bp_idx++) { - retired_page = *(uint64_t *)(adev->fw_vram_usage.va + + retired_page = *(uint64_t *)(adev->mman.fw_vram_usage_va + bp_block_offset + bp_idx *sizeof (uint64_t )); bp.retired_page = retired_page;@@ -428,10 +428,10 @@ void amdgpu_virt_init_data_exchange(struct amdgpu_device *adev) adev->virt.fw_reserve.p_pf2vf =NULL ; adev->virt.fw_reserve.p_vf2pf =NULL ;
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c void amdgpu_virt_init_data_exchange(struct amdgpu_device *adev) · line 437
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +2
-2-if (adev->fw_vram_usage.va !=NULL ) { +if (adev->mman.fw_vram_usage_va !=NULL ) { adev->virt.fw_reserve.p_pf2vf = (struct amd_sriov_msg_pf2vf_info_header *)( - adev->fw_vram_usage.va +AMDGIM_DATAEXCHANGE_OFFSET ); + adev->mman.fw_vram_usage_va +AMDGIM_DATAEXCHANGE_OFFSET );AMDGPU_FW_VRAM_PF2VF_READ (adev, header.size, &pf2vf_size);AMDGPU_FW_VRAM_PF2VF_READ (adev, checksum, &checksum);AMDGPU_FW_VRAM_PF2VF_READ (adev, feature_flags, &adev->virt.gim_feature);
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx