drm/amdgpu: Report firmware versions with sysfs
Subsystems (2)
PATCH 1/1 drm/amdgpu: Report firmware versions with sysfs
Firmware versions can be found as separate sysfs files at:/sys/class/drm/cardX/device/ (where X is the card number) The firmware versions are displayed in hexadecimal.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 71 ++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h | 2 + 3 files changed, 78 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -0
@@ -2701,6 +2701,10 @@ int amdgpu_device_init(struct amdgpu_device *adev,if (r)DRM_ERROR ("registering pm debugfs failed (%d).\n" , r); + r =amdgpu_ucode_sysfs_init (adev); +if (r) +DRM_ERROR ("Creating firmware sysfs failed (%d).\n" , r); + r =amdgpu_debugfs_gem_init (adev);if (r)DRM_ERROR ("registering gem debugfs failed (%d).\n" , r);
@@ -2813,6 +2817,7 @@ void amdgpu_device_fini(struct amdgpu_device *adev)amdgpu_device_doorbell_fini (adev);amdgpu_debugfs_regs_cleanup (adev);device_remove_file (adev->dev, &dev_attr_pcie_replay_count); +amdgpu_ucode_sysfs_fini (adev); }
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +71 -0
77 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +2 -0
@@ -291,7 +291,9 @@ bool amdgpu_ucode_hdr_version(union amdgpu_firmware_header *hdr,int amdgpu_ucode_init_bo (struct amdgpu_device *adev);int amdgpu_ucode_create_bo (struct amdgpu_device *adev); +int amdgpu_ucode_sysfs_init (struct amdgpu_device *adev);void amdgpu_ucode_free_bo (struct amdgpu_device *adev); +void amdgpu_ucode_sysfs_fini (struct amdgpu_device *adev);enum amdgpu_firmware_load_type amdgpu_ucode_get_load_type (struct amdgpu_device *adev,int load_type);
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20190507173003.20565-1-Ori.Messinger-5C7GfCeVMHo@public.gmane.org
Am 07.05.19 um 19:30 schrieb Messinger, Ori:
Quoted 6 lines
Firmware versions can be found as separate sysfs files at:
/sys/class/drm/cardX/device/(where X is the card number) The firmware versions are displayed in hexadecimal.Change-Id I10cae4c0ca6f1b6a9ced07da143426e1d011e203Signed-off-by Ori Messinger <[email protected]>
Well that looks like a really nice one, patch is Reviewed-by: Christian König <[email protected]>
Could we remove the debugfs interface now or should we keep it?
Christian.
Quoted 116 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 71 ++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h | 2 + 3 files changed, 78 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5
-0@@ -2701,6 +2701,10 @@ int amdgpu_device_init(struct amdgpu_device *adev,if (r)DRM_ERROR ("registering pm debugfs failed (%d).\n" , r); + r =amdgpu_ucode_sysfs_init (adev); +if (r) +DRM_ERROR ("Creating firmware sysfs failed (%d).\n" , r); + r =amdgpu_debugfs_gem_init (adev);if (r)DRM_ERROR ("registering gem debugfs failed (%d).\n" , r);@@ -2813,6 +2817,7 @@ void amdgpu_device_fini(struct amdgpu_device *adev)amdgpu_device_doorbell_fini (adev);amdgpu_debugfs_regs_cleanup (adev);device_remove_file (adev->dev, &dev_attr_pcie_replay_count); +amdgpu_ucode_sysfs_fini (adev); }drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +71
-0@@ -313,6 +313,77 @@ amdgpu_ucode_get_load_type(struct amdgpu_device *adev, int load_type)return AMDGPU_FW_LOAD_DIRECT ; } +#define FW_VERSION_ATTR (name, mode, field) \ +static ssize_t show_##name(struct device *dev, \ + struct device_attribute *attr, \ + char *buf) \ +{ \ + struct drm_device *ddev = dev_get_drvdata(dev); \ + struct amdgpu_device *adev = ddev->dev_private; \ + \ + return snprintf(buf, PAGE_SIZE, "0x%08x\n", adev->field); \ +} \ +static DEVICE_ATTR(name, mode, show_##name, NULL) + +FW_VERSION_ATTR (vce_fw_version,0444 , vce.fw_version); +FW_VERSION_ATTR (uvd_fw_version,0444 , uvd.fw_version); +FW_VERSION_ATTR (mc_fw_version,0444 , gmc.fw_version); +FW_VERSION_ATTR (me_fw_version,0444 , gfx.me_fw_version); +FW_VERSION_ATTR (pfp_fw_version,0444 , gfx.pfp_fw_version); +FW_VERSION_ATTR (ce_fw_version,0444 , gfx.ce_fw_version); +FW_VERSION_ATTR (rlc_fw_version,0444 , gfx.rlc_fw_version); +FW_VERSION_ATTR (rlc_srlc_fw_version,0444 , gfx.rlc_srlc_fw_version); +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 (sos_fw_version,0444 , psp.sos_fw_version); +FW_VERSION_ATTR (asd_fw_version,0444 , psp.asd_fw_version); +FW_VERSION_ATTR (ta_ras_fw_version,0444 , psp.ta_fw_version); +FW_VERSION_ATTR (ta_xgmi_fw_version,0444 , psp.ta_fw_version); +FW_VERSION_ATTR (smc_fw_version,0444 , pm.fw_version); +FW_VERSION_ATTR (sdma_fw_version,0444 , sdma.instance[0 ].fw_version); +FW_VERSION_ATTR (sdma2_fw_version,0444 , sdma.instance[1 ].fw_version); +FW_VERSION_ATTR (vcn_fw_version,0444 , vcn.fw_version); +FW_VERSION_ATTR (dmcu_fw_version,0444 , dm.dmcu_fw_version); + +static struct device_attribute *dev_fw_attr[] = { + &dev_attr_vce_fw_version, &dev_attr_uvd_fw_version, + &dev_attr_mc_fw_version, &dev_attr_me_fw_version, + &dev_attr_pfp_fw_version, &dev_attr_ce_fw_version, + &dev_attr_rlc_fw_version, &dev_attr_rlc_srlc_fw_version, + &dev_attr_rlc_srlg_fw_version, &dev_attr_rlc_srls_fw_version, + &dev_attr_mec_fw_version, &dev_attr_mec2_fw_version, + &dev_attr_sos_fw_version, &dev_attr_asd_fw_version, + &dev_attr_ta_ras_fw_version, &dev_attr_ta_xgmi_fw_version, + &dev_attr_smc_fw_version, &dev_attr_sdma_fw_version, + &dev_attr_sdma2_fw_version, &dev_attr_vcn_fw_version, + &dev_attr_dmcu_fw_version +}; + +void amdgpu_ucode_sysfs_fini (struct amdgpu_device *adev) +{ +int i; + +for (i =0 ; i <ARRAY_SIZE (dev_fw_attr); i++) +device_remove_file (adev->dev, dev_fw_attr[i]); +} + +int amdgpu_ucode_sysfs_init (struct amdgpu_device *adev) +{ +int i, ret; + +for (i =0 ; i <ARRAY_SIZE (dev_fw_attr); i++) { + ret =device_create_file (adev->dev, dev_fw_attr[i]); +if (ret) { +DRM_ERROR ("Failed to create %s\n" , + dev_fw_attr[i]->attr.name); +return ret; + } + } +return 0 ; +} +static int amdgpu_ucode_init_single_fw (struct amdgpu_device *adev,struct amdgpu_firmware_info *ucode,uint64_t mc_addr,void *kptr)drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h bool amdgpu_ucode_hdr_version(union amdgpu_firmware_header *hdr, · line 299
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +2
-0@@ -291,7 +291,9 @@ bool amdgpu_ucode_hdr_version(union amdgpu_firmware_header *hdr,int amdgpu_ucode_init_bo (struct amdgpu_device *adev);int amdgpu_ucode_create_bo (struct amdgpu_device *adev); +int amdgpu_ucode_sysfs_init (struct amdgpu_device *adev);void amdgpu_ucode_free_bo (struct amdgpu_device *adev); +void amdgpu_ucode_sysfs_fini (struct amdgpu_device *adev);enum amdgpu_firmware_load_type amdgpu_ucode_get_load_type (struct amdgpu_device *adev,int load_type);
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 5c91589d-3515-6b96-d4fd-fc24e2dd40ae-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
The debugfs won't have anything in it that this interface won't provide. It does FW+VBIOS, and there will be separate files for each of those components.
From a housekeeping standpoint, should we make a subfolder called fw_version to dump the files into, or are they fine in the base sysfs tree?
Kent
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Christian König
Sent: Tuesday, May 7, 2019 1:35 PM
To: Messinger, Ori <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amdgpu: Report firmware versions with sysfs
[CAUTION: External Email]
Am 07.05.19 um 19:30 schrieb Messinger, Ori:
Quoted 6 lines
Firmware versions can be found as separate sysfs files at:
/sys/class/drm/cardX/device/(where X is the card number) The firmware versions are displayed in hexadecimal.Change-Id I10cae4c0ca6f1b6a9ced07da143426e1d011e203Signed-off-by Ori Messinger <[email protected]>
Well that looks like a really nice one, patch is Reviewed-by: Christian König <[email protected]>
Could we remove the debugfs interface now or should we keep it?
Christian.
Quoted 125 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 71 ++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h | 2 + 3 files changed, 78 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5
-0@@ -2701,6 +2701,10 @@ int amdgpu_device_init(struct amdgpu_device *adev,if (r)DRM_ERROR ("registering pm debugfs failed (%d).\n" , r); + r =amdgpu_ucode_sysfs_init (adev); +if (r) +DRM_ERROR ("Creating firmware sysfs failed (%d).\n" , r); + r =amdgpu_debugfs_gem_init (adev);if (r)DRM_ERROR ("registering gem debugfs failed (%d).\n" , r);@@ -2813,6 +2817,7 @@ void amdgpu_device_fini(struct amdgpu_device *adev)amdgpu_device_doorbell_fini (adev);amdgpu_debugfs_regs_cleanup (adev);device_remove_file (adev->dev, &dev_attr_pcie_replay_count); +amdgpu_ucode_sysfs_fini (adev); }drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +68
-0@@ -313,6 +313,77 @@ amdgpu_ucode_get_load_type(struct amdgpu_device *adev, int load_type)return AMDGPU_FW_LOAD_DIRECT ; } +#define FW_VERSION_ATTR (name, mode, field) \ +static ssize_t show_##name(struct device *dev, \ + struct device_attribute *attr, \ + char *buf) \ +{ \ + struct drm_device *ddev = dev_get_drvdata(dev); \ + struct amdgpu_device *adev = ddev->dev_private; \ + \ + return snprintf(buf, PAGE_SIZE, "0x%08x\n", adev->field); \ +} \ +static DEVICE_ATTR(name, mode, show_##name, NULL) + +FW_VERSION_ATTR (vce_fw_version,0444 , vce.fw_version); +FW_VERSION_ATTR (uvd_fw_version,0444 , uvd.fw_version); +FW_VERSION_ATTR (mc_fw_version,0444 , gmc.fw_version); +FW_VERSION_ATTR (me_fw_version,0444 , gfx.me_fw_version); +FW_VERSION_ATTR (pfp_fw_version,0444 , gfx.pfp_fw_version); +FW_VERSION_ATTR (ce_fw_version,0444 , gfx.ce_fw_version); +FW_VERSION_ATTR (rlc_fw_version,0444 , gfx.rlc_fw_version); +FW_VERSION_ATTR (rlc_srlc_fw_version,0444 , gfx.rlc_srlc_fw_version); +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 (sos_fw_version,0444 , psp.sos_fw_version); +FW_VERSION_ATTR (asd_fw_version,0444 , psp.asd_fw_version); +FW_VERSION_ATTR (ta_ras_fw_version,0444 , psp.ta_fw_version); +FW_VERSION_ATTR (ta_xgmi_fw_version,0444 , psp.ta_fw_version); +FW_VERSION_ATTR (smc_fw_version,0444 , pm.fw_version); +FW_VERSION_ATTR (sdma_fw_version,0444 , sdma.instance[0 ].fw_version); +FW_VERSION_ATTR (sdma2_fw_version,0444 , sdma.instance[1 ].fw_version); +FW_VERSION_ATTR (vcn_fw_version,0444 , vcn.fw_version); +FW_VERSION_ATTR (dmcu_fw_version,0444 , dm.dmcu_fw_version); + +static struct device_attribute *dev_fw_attr[] = { + &dev_attr_vce_fw_version, &dev_attr_uvd_fw_version, + &dev_attr_mc_fw_version, &dev_attr_me_fw_version, + &dev_attr_pfp_fw_version, &dev_attr_ce_fw_version, + &dev_attr_rlc_fw_version, &dev_attr_rlc_srlc_fw_version, + &dev_attr_rlc_srlg_fw_version, &dev_attr_rlc_srls_fw_version, + &dev_attr_mec_fw_version, &dev_attr_mec2_fw_version, + &dev_attr_sos_fw_version, &dev_attr_asd_fw_version, + &dev_attr_ta_ras_fw_version, &dev_attr_ta_xgmi_fw_version, + &dev_attr_smc_fw_version, &dev_attr_sdma_fw_version, + &dev_attr_sdma2_fw_version, &dev_attr_vcn_fw_version, + &dev_attr_dmcu_fw_version +}; + +void amdgpu_ucode_sysfs_fini (struct amdgpu_device *adev) { +int i; + +for (i =0 ; i <ARRAY_SIZE (dev_fw_attr); i++) +device_remove_file (adev->dev, dev_fw_attr[i]); } + +int amdgpu_ucode_sysfs_init (struct amdgpu_device *adev) { +int i, ret; + +for (i =0 ; i <ARRAY_SIZE (dev_fw_attr); i++) { + ret =device_create_file (adev->dev, dev_fw_attr[i]); +if (ret) { +DRM_ERROR ("Failed to create %s\n" , + dev_fw_attr[i]->attr.name); +return ret; + } + } +return 0 ; +} +static int amdgpu_ucode_init_single_fw (struct amdgpu_device *adev,struct amdgpu_firmware_info *ucode,uint64_t mc_addr,void *kptr)drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +2
-0@@ -291,7 +291,9 @@ bool amdgpu_ucode_hdr_version(unionamdgpu_firmware_header *hdr, int amdgpu_ucode_init_bo(struct amdgpu_device *adev);int amdgpu_ucode_create_bo (struct amdgpu_device *adev); +int amdgpu_ucode_sysfs_init (struct amdgpu_device *adev);void amdgpu_ucode_free_bo (struct amdgpu_device *adev); +void amdgpu_ucode_sysfs_fini (struct amdgpu_device *adev);enum amdgpu_firmware_load_type
Quoted 2 lines
amdgpu_ucode_get_load_type(struct
amdgpu_device*adev, intload_type);
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): BN6PR12MB161893A9521D2797F54021DF85310-/b2+HYfkarRqaFUXYJa4HgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org
Hi Christian,
Are you worried about him putting them in a fw_version subfolder like the ras* files are, or are they fine in the regular sysfs pool?
Kent
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Russell, Kent
Sent: Tuesday, May 7, 2019 1:53 PM
To: Koenig, Christian <[email protected]>; Messinger, Ori <[email protected]>; [email protected]
Subject: RE: [PATCH] drm/amdgpu: Report firmware versions with sysfs
[CAUTION: External Email]
The debugfs won't have anything in it that this interface won't provide. It does FW+VBIOS, and there will be separate files for each of those components.
From a housekeeping standpoint, should we make a subfolder called fw_version to dump the files into, or are they fine in the base sysfs tree?
Kent
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Christian König
Sent: Tuesday, May 7, 2019 1:35 PM
To: Messinger, Ori <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amdgpu: Report firmware versions with sysfs
[CAUTION: External Email]
Am 07.05.19 um 19:30 schrieb Messinger, Ori:
Quoted 6 lines
Firmware versions can be found as separate sysfs files at:
/sys/class/drm/cardX/device/(where X is the card number) The firmware versions are displayed in hexadecimal.Change-Id I10cae4c0ca6f1b6a9ced07da143426e1d011e203Signed-off-by Ori Messinger <[email protected]>
Well that looks like a really nice one, patch is Reviewed-by: Christian König <[email protected]>
Could we remove the debugfs interface now or should we keep it?
Christian.
Quoted 125 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 71 ++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h | 2 + 3 files changed, 78 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5
-0@@ -2701,6 +2701,10 @@ int amdgpu_device_init(struct amdgpu_device *adev,if (r)DRM_ERROR ("registering pm debugfs failed (%d).\n" , r); + r =amdgpu_ucode_sysfs_init (adev); +if (r) +DRM_ERROR ("Creating firmware sysfs failed (%d).\n" , r); + r =amdgpu_debugfs_gem_init (adev);if (r)DRM_ERROR ("registering gem debugfs failed (%d).\n" , r);@@ -2813,6 +2817,7 @@ void amdgpu_device_fini(struct amdgpu_device *adev)amdgpu_device_doorbell_fini (adev);amdgpu_debugfs_regs_cleanup (adev);device_remove_file (adev->dev, &dev_attr_pcie_replay_count); +amdgpu_ucode_sysfs_fini (adev); }drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +68
-0@@ -313,6 +313,77 @@ amdgpu_ucode_get_load_type(struct amdgpu_device *adev, int load_type)return AMDGPU_FW_LOAD_DIRECT ; } +#define FW_VERSION_ATTR (name, mode, field) \ +static ssize_t show_##name(struct device *dev, \ + struct device_attribute *attr, \ + char *buf) \ +{ \ + struct drm_device *ddev = dev_get_drvdata(dev); \ + struct amdgpu_device *adev = ddev->dev_private; \ + \ + return snprintf(buf, PAGE_SIZE, "0x%08x\n", adev->field); \ +} \ +static DEVICE_ATTR(name, mode, show_##name, NULL) + +FW_VERSION_ATTR (vce_fw_version,0444 , vce.fw_version); +FW_VERSION_ATTR (uvd_fw_version,0444 , uvd.fw_version); +FW_VERSION_ATTR (mc_fw_version,0444 , gmc.fw_version); +FW_VERSION_ATTR (me_fw_version,0444 , gfx.me_fw_version); +FW_VERSION_ATTR (pfp_fw_version,0444 , gfx.pfp_fw_version); +FW_VERSION_ATTR (ce_fw_version,0444 , gfx.ce_fw_version); +FW_VERSION_ATTR (rlc_fw_version,0444 , gfx.rlc_fw_version); +FW_VERSION_ATTR (rlc_srlc_fw_version,0444 , gfx.rlc_srlc_fw_version); +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 (sos_fw_version,0444 , psp.sos_fw_version); +FW_VERSION_ATTR (asd_fw_version,0444 , psp.asd_fw_version); +FW_VERSION_ATTR (ta_ras_fw_version,0444 , psp.ta_fw_version); +FW_VERSION_ATTR (ta_xgmi_fw_version,0444 , psp.ta_fw_version); +FW_VERSION_ATTR (smc_fw_version,0444 , pm.fw_version); +FW_VERSION_ATTR (sdma_fw_version,0444 , sdma.instance[0 ].fw_version); +FW_VERSION_ATTR (sdma2_fw_version,0444 , sdma.instance[1 ].fw_version); +FW_VERSION_ATTR (vcn_fw_version,0444 , vcn.fw_version); +FW_VERSION_ATTR (dmcu_fw_version,0444 , dm.dmcu_fw_version); + +static struct device_attribute *dev_fw_attr[] = { + &dev_attr_vce_fw_version, &dev_attr_uvd_fw_version, + &dev_attr_mc_fw_version, &dev_attr_me_fw_version, + &dev_attr_pfp_fw_version, &dev_attr_ce_fw_version, + &dev_attr_rlc_fw_version, &dev_attr_rlc_srlc_fw_version, + &dev_attr_rlc_srlg_fw_version, &dev_attr_rlc_srls_fw_version, + &dev_attr_mec_fw_version, &dev_attr_mec2_fw_version, + &dev_attr_sos_fw_version, &dev_attr_asd_fw_version, + &dev_attr_ta_ras_fw_version, &dev_attr_ta_xgmi_fw_version, + &dev_attr_smc_fw_version, &dev_attr_sdma_fw_version, + &dev_attr_sdma2_fw_version, &dev_attr_vcn_fw_version, + &dev_attr_dmcu_fw_version +}; + +void amdgpu_ucode_sysfs_fini (struct amdgpu_device *adev) { +int i; + +for (i =0 ; i <ARRAY_SIZE (dev_fw_attr); i++) +device_remove_file (adev->dev, dev_fw_attr[i]); } + +int amdgpu_ucode_sysfs_init (struct amdgpu_device *adev) { +int i, ret; + +for (i =0 ; i <ARRAY_SIZE (dev_fw_attr); i++) { + ret =device_create_file (adev->dev, dev_fw_attr[i]); +if (ret) { +DRM_ERROR ("Failed to create %s\n" , + dev_fw_attr[i]->attr.name); +return ret; + } + } +return 0 ; +} +static int amdgpu_ucode_init_single_fw (struct amdgpu_device *adev,struct amdgpu_firmware_info *ucode,uint64_t mc_addr,void *kptr)drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +2
-0@@ -291,7 +291,9 @@ bool amdgpu_ucode_hdr_version(unionamdgpu_firmware_header *hdr, int amdgpu_ucode_init_bo(struct amdgpu_device *adev);int amdgpu_ucode_create_bo (struct amdgpu_device *adev); +int amdgpu_ucode_sysfs_init (struct amdgpu_device *adev);void amdgpu_ucode_free_bo (struct amdgpu_device *adev); +void amdgpu_ucode_sysfs_fini (struct amdgpu_device *adev);enum amdgpu_firmware_load_type
Quoted 2 lines
amdgpu_ucode_get_load_type(struct
amdgpu_device*adev, intload_type);
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): BN6PR12MB1618168C8A50146B69C9A19F85320-/b2+HYfkarRqaFUXYJa4HgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org
Hi Kent,
not strong opinion on that and I agree that from a housekeeping point of view we should probably create an own directory for the files.
Christian.
Am 08.05.19 um 19:11 schrieb Russell, Kent:
Quoted 165 lines
Hi Christian,
Are you worried about him putting them in a
fw_versionsubfolder like the ras* files are, or are they fine in the regular sysfs pool?Kent
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Russell, Kent
Sent: Tuesday, May 7, 2019 1:53 PM
To: Koenig, Christian <[email protected]>; Messinger, Ori <[email protected]>; [email protected]
Subject: RE: [PATCH] drm/amdgpu: Report firmware versions with sysfs[CAUTION: External Email]
The debugfs won't have anything in it that this interface won't provide. It does FW+VBIOS, and there will be separate files for each of those components.
From a housekeeping standpoint, should we make a subfolder called
fw_versionto dump the files into, or are they fine in the base sysfs tree?Kent
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Christian König
Sent: Tuesday, May 7, 2019 1:35 PM
To: Messinger, Ori <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amdgpu: Report firmware versions with sysfs[CAUTION: External Email]
Am 07.05.19 um 19:30 schrieb Messinger, Ori:
Quoted 6 lines
Firmware versions can be found as separate sysfs files at:
/sys/class/drm/cardX/device/(where X is the card number) The firmware versions are displayed in hexadecimal.Change-Id I10cae4c0ca6f1b6a9ced07da143426e1d011e203Signed-off-by Ori Messinger <[email protected]>Well that looks like a really nice one, patch is Reviewed-by: Christian König <[email protected]>
Could we remove the debugfs interface now or should we keep it?
Christian.
Quoted 124 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 71 ++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h | 2 + 3 files changed, 78 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5
-0@@ -2701,6 +2701,10 @@ int amdgpu_device_init(struct amdgpu_device *adev,if (r)DRM_ERROR ("registering pm debugfs failed (%d).\n" , r); + r =amdgpu_ucode_sysfs_init (adev); +if (r) +DRM_ERROR ("Creating firmware sysfs failed (%d).\n" , r); + r =amdgpu_debugfs_gem_init (adev);if (r)DRM_ERROR ("registering gem debugfs failed (%d).\n" , r);@@ -2813,6 +2817,7 @@ void amdgpu_device_fini(struct amdgpu_device *adev)amdgpu_device_doorbell_fini (adev);amdgpu_debugfs_regs_cleanup (adev);device_remove_file (adev->dev, &dev_attr_pcie_replay_count); +amdgpu_ucode_sysfs_fini (adev); }drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +68
-0@@ -313,6 +313,77 @@ amdgpu_ucode_get_load_type(struct amdgpu_device *adev, int load_type)return AMDGPU_FW_LOAD_DIRECT ; } +#define FW_VERSION_ATTR (name, mode, field) \ +static ssize_t show_##name(struct device *dev, \ + struct device_attribute *attr, \ + char *buf) \ +{ \ + struct drm_device *ddev = dev_get_drvdata(dev); \ + struct amdgpu_device *adev = ddev->dev_private; \ + \ + return snprintf(buf, PAGE_SIZE, "0x%08x\n", adev->field); \ +} \ +static DEVICE_ATTR(name, mode, show_##name, NULL) + +FW_VERSION_ATTR (vce_fw_version,0444 , vce.fw_version); +FW_VERSION_ATTR (uvd_fw_version,0444 , uvd.fw_version); +FW_VERSION_ATTR (mc_fw_version,0444 , gmc.fw_version); +FW_VERSION_ATTR (me_fw_version,0444 , gfx.me_fw_version); +FW_VERSION_ATTR (pfp_fw_version,0444 , gfx.pfp_fw_version); +FW_VERSION_ATTR (ce_fw_version,0444 , gfx.ce_fw_version); +FW_VERSION_ATTR (rlc_fw_version,0444 , gfx.rlc_fw_version); +FW_VERSION_ATTR (rlc_srlc_fw_version,0444 , gfx.rlc_srlc_fw_version); +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 (sos_fw_version,0444 , psp.sos_fw_version); +FW_VERSION_ATTR (asd_fw_version,0444 , psp.asd_fw_version); +FW_VERSION_ATTR (ta_ras_fw_version,0444 , psp.ta_fw_version); +FW_VERSION_ATTR (ta_xgmi_fw_version,0444 , psp.ta_fw_version); +FW_VERSION_ATTR (smc_fw_version,0444 , pm.fw_version); +FW_VERSION_ATTR (sdma_fw_version,0444 , sdma.instance[0 ].fw_version); +FW_VERSION_ATTR (sdma2_fw_version,0444 , sdma.instance[1 ].fw_version); +FW_VERSION_ATTR (vcn_fw_version,0444 , vcn.fw_version); +FW_VERSION_ATTR (dmcu_fw_version,0444 , dm.dmcu_fw_version); + +static struct device_attribute *dev_fw_attr[] = { + &dev_attr_vce_fw_version, &dev_attr_uvd_fw_version, + &dev_attr_mc_fw_version, &dev_attr_me_fw_version, + &dev_attr_pfp_fw_version, &dev_attr_ce_fw_version, + &dev_attr_rlc_fw_version, &dev_attr_rlc_srlc_fw_version, + &dev_attr_rlc_srlg_fw_version, &dev_attr_rlc_srls_fw_version, + &dev_attr_mec_fw_version, &dev_attr_mec2_fw_version, + &dev_attr_sos_fw_version, &dev_attr_asd_fw_version, + &dev_attr_ta_ras_fw_version, &dev_attr_ta_xgmi_fw_version, + &dev_attr_smc_fw_version, &dev_attr_sdma_fw_version, + &dev_attr_sdma2_fw_version, &dev_attr_vcn_fw_version, + &dev_attr_dmcu_fw_version +}; + +void amdgpu_ucode_sysfs_fini (struct amdgpu_device *adev) { +int i; + +for (i =0 ; i <ARRAY_SIZE (dev_fw_attr); i++) +device_remove_file (adev->dev, dev_fw_attr[i]); } + +int amdgpu_ucode_sysfs_init (struct amdgpu_device *adev) { +int i, ret; + +for (i =0 ; i <ARRAY_SIZE (dev_fw_attr); i++) { + ret =device_create_file (adev->dev, dev_fw_attr[i]); +if (ret) { +DRM_ERROR ("Failed to create %s\n" , + dev_fw_attr[i]->attr.name); +return ret; + } + } +return 0 ; +} +static int amdgpu_ucode_init_single_fw (struct amdgpu_device *adev,struct amdgpu_firmware_info *ucode,uint64_t mc_addr,void *kptr)drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +2
-0@@ -291,7 +291,9 @@ bool amdgpu_ucode_hdr_version(unionamdgpu_firmware_header *hdr, int amdgpu_ucode_init_bo(struct amdgpu_device *adev);int amdgpu_ucode_create_bo (struct amdgpu_device *adev); +int amdgpu_ucode_sysfs_init (struct amdgpu_device *adev);void amdgpu_ucode_free_bo (struct amdgpu_device *adev); +void amdgpu_ucode_sysfs_fini (struct amdgpu_device *adev);
Quoted 11 lines
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +0
-0enum amdgpu_firmware_load_type amdgpu_ucode_get_load_type(struct
amdgpu_device*adev, intload_type);_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx