[PATCH 3/6] drm/amdgpu: update cached GPU addresses for SMU
Samuel Zhang
guoqing.zhang at amd.com
Mon Apr 14 10:46:52 UTC 2025
2 reasons for this change:
1. when pdb0 is enabled, gpu addr from amdgpu_bo_create_kernel() is
based on pdb0, it is not compatible with SMU, it need to updated
to use original gpu address.
2. Since original gpu address will change after switching to new GPU
index after hibernation, it need to be updated after resume.
Signed-off-by: Jiang Liu <gerry at linux.alibaba.com>
Signed-off-by: Samuel Zhang <guoqing.zhang at amd.com>
Change-Id: I5f9586ea156b9d5bb78596bb08681335de109c7b
---
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 30 +++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
index f345c233bc47..72cd4374ca4c 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
@@ -1004,6 +1004,31 @@ static int smu_fini_fb_allocations(struct smu_context *smu)
return 0;
}
+static int smu_resume_fb_allocations(struct smu_context *smu)
+{
+ struct smu_table_context *smu_table = &smu->smu_table;
+ struct smu_table *tables = smu_table->tables;
+ struct smu_table *driver_table = &(smu_table->driver_table);
+
+ if (tables[SMU_TABLE_PMSTATUSLOG].bo)
+ tables[SMU_TABLE_PMSTATUSLOG].mc_address =
+ amdgpu_bo_gpu_offset(tables[SMU_TABLE_PMSTATUSLOG].bo);
+
+ if (driver_table->bo)
+ driver_table->mc_address = amdgpu_bo_gpu_offset(driver_table->bo);
+
+ return 0;
+}
+static void smu_resume_dummy_read_table(struct smu_context *smu)
+{
+ struct smu_table_context *smu_table = &smu->smu_table;
+ struct smu_table *dummy_read_1_table = &smu_table->dummy_read_1_table;
+
+ if (dummy_read_1_table->bo)
+ dummy_read_1_table->mc_address = amdgpu_bo_gpu_offset(dummy_read_1_table->bo);
+}
+
+
/**
* smu_alloc_memory_pool - allocate memory pool in the system memory
*
@@ -1780,6 +1805,11 @@ static int smu_start_smc_engine(struct smu_context *smu)
struct amdgpu_device *adev = smu->adev;
int ret = 0;
+ /* Update cached GPU addresses of BOs, which may get staled. */
+ smu_resume_fb_allocations(smu);
+ smu_resume_dummy_read_table(smu);
+
+
smu->smc_fw_state = SMU_FW_INIT;
if (adev->firmware.load_type != AMDGPU_FW_LOAD_PSP) {
--
2.43.5
More information about the amd-gfx
mailing list