drm/amd/pm: Add smu vram copy function

Add a wrapper function for copying data/to from vram. This additionally
checks for any RAS fatal error. Copy cannot be trusted if any RAS fatal
error happened as VRAM becomes inaccessible.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Asad Kamal <asad.kamal@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Lijo Lazar
2026-03-27 13:13:00 +05:30
committed by Alex Deucher
parent 1d0a26cf37
commit f2275ea90b
2 changed files with 15 additions and 0 deletions

View File

@@ -1104,6 +1104,18 @@ int smu_cmn_update_table(struct smu_context *smu,
return 0;
}
int smu_cmn_vram_cpy(struct smu_context *smu, void *dst, const void *src,
size_t len)
{
memcpy(dst, src, len);
/* Don't trust the copy operation if RAS fatal error happened. */
if (amdgpu_ras_get_fed_status(smu->adev))
return -EHWPOISON;
return 0;
}
int smu_cmn_write_watermarks_table(struct smu_context *smu)
{
void *watermarks_table = smu->smu_table.watermarks_table;

View File

@@ -174,6 +174,9 @@ int smu_cmn_update_table(struct smu_context *smu,
void *table_data,
bool drv2smu);
int smu_cmn_vram_cpy(struct smu_context *smu, void *dst,
const void *src, size_t len);
int smu_cmn_write_watermarks_table(struct smu_context *smu);
int smu_cmn_write_pptable(struct smu_context *smu);