[v2] drm/amd: Add IMU fw version to fw version queries

Alex Deucher alexdeucher at gmail.com
Mon Sep 19 16:08:35 UTC 2022


On Mon, Sep 19, 2022 at 9:42 AM David Francis <David.Francis at amd.com> wrote:
>
> 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
>
> CC: Likun Gao <Likun.Gao at amd.com>
>
> Signed-off-by: David Francis <David.Francis at amd.com>

Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c     | 13 +++++++++++++
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c   |  4 +++-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c    |  1 +
>  drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h |  1 +
>  include/uapi/drm/amdgpu_drm.h               |  2 ++
>  5 files changed, 20 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> index 1369c25448dc..56753c3574b1 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> @@ -328,6 +328,10 @@ static int amdgpu_firmware_info(struct drm_amdgpu_info_firmware *fw_info,
>                 fw_info->ver = adev->psp.cap_fw_version;
>                 fw_info->feature = adev->psp.cap_feature_version;
>                 break;
> +       case AMDGPU_INFO_FW_IMU:
> +               fw_info->ver = adev->gfx.imu_fw_version;
> +               fw_info->feature = 0;
> +               break;
>         default:
>                 return -EINVAL;
>         }
> @@ -1488,6 +1492,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);
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
> index 939c8614f0e3..a576a50fad25 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c
> @@ -630,6 +630,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);
> @@ -651,7 +652,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 = {
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> index e4af40b9a8aa..38c46f09d784 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> @@ -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);
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h b/drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h
> index e78e4c27b62a..6c97148ca0ed 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h
> @@ -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,
> diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h
> index c2c9c674a223..3e00cec47f52 100644
> --- a/include/uapi/drm/amdgpu_drm.h
> +++ b/include/uapi/drm/amdgpu_drm.h
> @@ -755,6 +755,8 @@ struct drm_amdgpu_cs_chunk_data {
>         #define AMDGPU_INFO_FW_TOC              0x15
>         /* Subquery id: Query CAP firmware version */
>         #define AMDGPU_INFO_FW_CAP              0x16
> +       /* Subquery id: Query IMU firmware version */
> +       #define AMDGPU_INFO_FW_IMU              0x17
>
>  /* number of bytes moved for TTM migration */
>  #define AMDGPU_INFO_NUM_BYTES_MOVED            0x0f
> --
> 2.25.1
>


More information about the amd-gfx mailing list