drm/amd: Add IMU fw version to fw version queries
authorDavid Francis <David.Francis@amd.com>
Fri, 16 Sep 2022 15:15:01 +0000 (11:15 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 24 Oct 2022 18:34:47 +0000 (14:34 -0400)
IMU is a new firmware for GFX11.

There are four means by which firmware version can be queried
from the driver: device attributes, vf2pf, debugfs,
and the AMDGPU_INFO_FW_VERSION option in the amdgpu info ioctl.

Add IMU as an option for those four methods.

V2: Added debugfs

Reviewed-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: David Francis <David.Francis@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h
include/uapi/drm/amdgpu_drm.h

index fe23e09..bf1ff8f 100644 (file)
@@ -344,6 +344,10 @@ static int amdgpu_firmware_info(struct drm_amdgpu_info_firmware *fw_info,
                fw_info->ver = adev->mes.ucode_fw_version[1];
                fw_info->feature = 0;
                break;
+       case AMDGPU_INFO_FW_IMU:
+               fw_info->ver = adev->gfx.imu_fw_version;
+               fw_info->feature = 0;
+               break;
        default:
                return -EINVAL;
        }
@@ -1520,6 +1524,15 @@ static int amdgpu_debugfs_firmware_info_show(struct seq_file *m, void *unused)
                           fw_info.feature, fw_info.ver);
        }
 
+       /* IMU */
+       query_fw.fw_type = AMDGPU_INFO_FW_IMU;
+       query_fw.index = 0;
+       ret = amdgpu_firmware_info(&fw_info, &query_fw, adev);
+       if (ret)
+               return ret;
+       seq_printf(m, "IMU feature version: %u, firmware version: 0x%08x\n",
+                  fw_info.feature, fw_info.ver);
+
        /* PSP SOS */
        query_fw.fw_type = AMDGPU_INFO_FW_SOS;
        ret = amdgpu_firmware_info(&fw_info, &query_fw, adev);
index dd0bc64..5cb62e6 100644 (file)
@@ -698,6 +698,7 @@ FW_VERSION_ATTR(rlc_srlg_fw_version, 0444, gfx.rlc_srlg_fw_version);
 FW_VERSION_ATTR(rlc_srls_fw_version, 0444, gfx.rlc_srls_fw_version);
 FW_VERSION_ATTR(mec_fw_version, 0444, gfx.mec_fw_version);
 FW_VERSION_ATTR(mec2_fw_version, 0444, gfx.mec2_fw_version);
+FW_VERSION_ATTR(imu_fw_version, 0444, gfx.imu_fw_version);
 FW_VERSION_ATTR(sos_fw_version, 0444, psp.sos.fw_version);
 FW_VERSION_ATTR(asd_fw_version, 0444, psp.asd_context.bin_desc.fw_version);
 FW_VERSION_ATTR(ta_ras_fw_version, 0444, psp.ras_context.context.bin_desc.fw_version);
@@ -719,7 +720,8 @@ static struct attribute *fw_attrs[] = {
        &dev_attr_ta_ras_fw_version.attr, &dev_attr_ta_xgmi_fw_version.attr,
        &dev_attr_smc_fw_version.attr, &dev_attr_sdma_fw_version.attr,
        &dev_attr_sdma2_fw_version.attr, &dev_attr_vcn_fw_version.attr,
-       &dev_attr_dmcu_fw_version.attr, NULL
+       &dev_attr_dmcu_fw_version.attr, &dev_attr_imu_fw_version.attr,
+       NULL
 };
 
 static const struct attribute_group fw_attr_group = {
index 9c765b0..c73abe5 100644 (file)
@@ -547,6 +547,7 @@ static void amdgpu_virt_populate_vf2pf_ucode_info(struct amdgpu_device *adev)
        POPULATE_UCODE_INFO(vf2pf_info, AMD_SRIOV_UCODE_ID_RLC_SRLS, adev->gfx.rlc_srls_fw_version);
        POPULATE_UCODE_INFO(vf2pf_info, AMD_SRIOV_UCODE_ID_MEC,      adev->gfx.mec_fw_version);
        POPULATE_UCODE_INFO(vf2pf_info, AMD_SRIOV_UCODE_ID_MEC2,     adev->gfx.mec2_fw_version);
+       POPULATE_UCODE_INFO(vf2pf_info, AMD_SRIOV_UCODE_ID_IMU,      adev->gfx.imu_fw_version);
        POPULATE_UCODE_INFO(vf2pf_info, AMD_SRIOV_UCODE_ID_SOS,      adev->psp.sos.fw_version);
        POPULATE_UCODE_INFO(vf2pf_info, AMD_SRIOV_UCODE_ID_ASD,
                            adev->psp.asd_context.bin_desc.fw_version);
index e78e4c2..6c97148 100644 (file)
@@ -70,6 +70,7 @@ enum amd_sriov_ucode_engine_id {
        AMD_SRIOV_UCODE_ID_RLC_SRLS,
        AMD_SRIOV_UCODE_ID_MEC,
        AMD_SRIOV_UCODE_ID_MEC2,
+       AMD_SRIOV_UCODE_ID_IMU,
        AMD_SRIOV_UCODE_ID_SOS,
        AMD_SRIOV_UCODE_ID_ASD,
        AMD_SRIOV_UCODE_ID_TA_RAS,
index 7ee65c0..0d93ec1 100644 (file)
@@ -763,6 +763,8 @@ struct drm_amdgpu_cs_chunk_data {
        #define AMDGPU_INFO_FW_MES_KIQ          0x19
        /* Subquery id: Query MES firmware version */
        #define AMDGPU_INFO_FW_MES              0x1a
+       /* Subquery id: Query IMU firmware version */
+       #define AMDGPU_INFO_FW_IMU              0x1b
 
 /* number of bytes moved for TTM migration */
 #define AMDGPU_INFO_NUM_BYTES_MOVED            0x0f