]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
drm/amd: Read IMU FW version from scratch register during hw_init
authorMario Limonciello <mario.limonciello@amd.com>
Fri, 13 Oct 2023 19:26:04 +0000 (14:26 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 19 Oct 2023 22:26:51 +0000 (18:26 -0400)
If the IMU version wasn't discovered from the header, such as when
the firmware was directly loaded by PSP then there is no firmware
version to show to userspace from sysfs or IOCTL.

The IMU F/W stores the version in the first scratch register though,
so fetch it in these cases to let the driver export.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c

index f994508a36ea0c963f4c3fea88b3b5b20023ec8a..fd22943685f7d56c8da49220dddc0b92f6b3a6f8 100644 (file)
@@ -4373,6 +4373,10 @@ static int gfx_v11_0_hw_init(void *handle)
        if (r)
                return r;
 
+       /* get IMU version from HW if it's not set */
+       if (!adev->gfx.imu_fw_version)
+               adev->gfx.imu_fw_version = RREG32_SOC15(GC, 0, regGFX_IMU_SCRATCH_0);
+
        return r;
 }