Don't wake the GPU if libdrm queries the mmGB_ADDR_CONFIG register
value during amdgpu_query_gpu_info_init(). Instead, return the already
cached value adev->gfx.config.gb_addr_config.

Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2295
Signed-off-by: Philipp Zabel <philipp.za...@gmail.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index fe1347a4075c4..ed4d7d72f2065 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -883,6 +883,16 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, 
struct drm_file *filp)
 
                alloc_size = info->read_mmr_reg.count * sizeof(*regs);
 
+               if (info->read_mmr_reg.dword_offset == 0x263e &&
+                   info->read_mmr_reg.count == 1) {
+                       /* Return cached value of mmGB_ADDR_CONFIG */
+                       regs[0] = adev->gfx.config.gb_addr_config;
+
+                       n = copy_to_user(out, regs, min(size, alloc_size));
+                       kfree(regs);
+                       return n ? -EFAULT : 0;
+               }
+
                ret = pm_runtime_get_sync(dev->dev);
                if (ret < 0) {
                        pm_runtime_put_autosuspend(dev->dev);

-- 
2.50.1

Reply via email to