From: Yang Wang <[email protected]> ASP 15.0.3 stores the PSP runtime database at a fixed 64KB offset from the IP discovery table, not at the legacy offset from the end of VRAM.
Signed-off-by: Yang Wang <[email protected]> Reviewed-By: Frank Min <[email protected]> Signed-off-by: Alex Deucher <[email protected]> --- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 18 +++++++++++++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h | 1 + 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c index fcf7ce0e971b4..0b5e8373855aa 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c @@ -383,6 +383,22 @@ static int psp_memory_training_init(struct psp_context *psp) return ret; } +static uint64_t psp_get_runtime_db_header_pos(struct amdgpu_device *adev) +{ + uint64_t pos; + + switch (amdgpu_ip_version(adev, MP0_HWIP, 0)) { + case IP_VERSION(15, 0, 3): + pos = adev->discovery.offset + PSP_RUNTIME_DB_OFFSET_FROM_IP_DISCOVERY_TABLE; + break; + default: + pos = adev->gmc.mc_vram_size - PSP_RUNTIME_DB_OFFSET; + break; + } + + return pos; +} + /* * Helper funciton to query psp runtime database entry * @@ -415,7 +431,7 @@ static bool psp_get_runtime_db_entry(struct amdgpu_device *adev, amdgpu_ip_version(adev, MP0_HWIP, 0) == IP_VERSION(13, 0, 15)) return false; - db_header_pos = adev->gmc.mc_vram_size - PSP_RUNTIME_DB_OFFSET; + db_header_pos = psp_get_runtime_db_header_pos(adev); db_dir_pos = db_header_pos + sizeof(struct psp_runtime_data_header); /* read runtime db header from vram */ diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h index e9822e03e6190..a4ec60f6c3170 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h @@ -296,6 +296,7 @@ struct psp_memory_training_context { #define PSP_RUNTIME_DB_COOKIE_ID 0x0ed5 #define PSP_RUNTIME_DB_VER_1 0x0100 #define PSP_RUNTIME_DB_DIAG_ENTRY_MAX_COUNT 0x40 +#define PSP_RUNTIME_DB_OFFSET_FROM_IP_DISCOVERY_TABLE 0x10000 enum psp_runtime_entry_type { PSP_RUNTIME_ENTRY_TYPE_INVALID = 0x0, -- 2.55.0
