drm/amdgpu: Add debugfs file for VBIOS and version
Subsystems (2)
PATCH v2 1/1 drm/amdgpu: Add debugfs file for VBIOS and version
Add 2 debugfs files, one that contains the VBIOS version, and one that contains the VBIOS itself. These won't change after initialization, so we can add the VBIOS version when we parse the atombios information.
This ensures that we can find out the VBIOS version, even when the dmesg buffer fills up, and makes it easier to associate which VBIOS version is for which GPU on mGPU configurations. Set the size to 20 characters in case of some weird VBIOS version that exceeds the expected 17 character format (3-8-3\0). The VBIOS dump also allows for easy debugging
v2: Move to debugfs, clarify commit message, add VBIOS dump file
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 62 ++++++++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/atom.c | 5 ++- drivers/gpu/drm/amd/amdgpu/atom.h | 1 + 3 files changed, 67 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +62 -0
@@ -66,6 +66,8 @@ MODULE_FIRMWARE("amdgpu/raven_gpu_info.bin");static int amdgpu_debugfs_regs_init (struct amdgpu_device *adev);static void amdgpu_debugfs_regs_cleanup (struct amdgpu_device *adev);static int amdgpu_debugfs_test_ib_ring_init (struct amdgpu_device *adev); +static int amdgpu_debugfs_vbios_dump_init (struct amdgpu_device *adev); +static int amdgpu_debugfs_vbios_version_init (struct amdgpu_device *adev);static const char *amdgpu_asic_name[] = {"TAHITI" ,
@@ -2250,6 +2252,14 @@ int amdgpu_device_init(struct amdgpu_device *adev,if (r)DRM_ERROR ("registering firmware debugfs failed (%d).\n" , r); + r =amdgpu_debugfs_vbios_dump_init (adev); +if (r) +DRM_ERROR ("Creating vbios dump debugfs failed (%d).\n" , r); + + r =amdgpu_debugfs_vbios_version_init (adev); +if (r) +DRM_ERROR ("Creating vbios version debugfs failed (%d).\n" , r); +if ((amdgpu_testing &1 )) {if (adev->accel_working)amdgpu_test_moves (adev);
@@ -3830,6 +3840,50 @@ int amdgpu_debugfs_init(struct drm_minor *minor) {return 0 ; } + +static int amdgpu_debugfs_get_vbios_dump (struct seq_file *m,void *data) +{ +struct drm_info_node *node = (struct drm_info_node *) m->private; +struct drm_device *dev = node->minor->dev; +struct amdgpu_device *adev = dev->dev_private; + +seq_write (m, adev->bios, adev->bios_size); +return 0 ; +} + +static int amdgpu_debugfs_get_vbios_version (struct seq_file *m,void *data) +{ +struct drm_info_node *node = (struct drm_info_node *) m->private; +struct drm_device *dev = node->minor->dev; +struct amdgpu_device *adev = dev->dev_private; +struct atom_context *ctx = adev->mode_info.atom_context; + +seq_printf (m,"%s\n" , ctx->vbios_version); +return 0 ; +} + +static const struct drm_info_list amdgpu_vbios_dump_list[] = { + {"amdgpu_vbios" , + amdgpu_debugfs_get_vbios_dump, +0 ,NULL }, +}; + +static const struct drm_info_list amdgpu_vbios_version_list[] = { + {"amdgpu_vbios_version" , + amdgpu_debugfs_get_vbios_version, +0 ,NULL }, +}; + +static int amdgpu_debugfs_vbios_dump_init (struct amdgpu_device *adev) +{ +return amdgpu_debugfs_add_files (adev, + amdgpu_vbios_dump_list,1 ); +} +static int amdgpu_debugfs_vbios_version_init (struct amdgpu_device *adev) +{ +return amdgpu_debugfs_add_files (adev, + amdgpu_vbios_version_list,1 ); +}#else static int amdgpu_debugfs_test_ib_ring_init (struct amdgpu_device *adev) {
@@ -3839,5 +3893,13 @@ static int amdgpu_debugfs_regs_init(struct amdgpu_device *adev) {return 0 ; } +static int amdgpu_debugfs_vbios_dump_init (struct amdgpu_device *adev) +{ +return 0 ; +} +static int amdgpu_debugfs_vbios_version_init (struct amdgpu_device *adev) +{ +return 0 ; +}static void amdgpu_debugfs_regs_cleanup (struct amdgpu_device *adev) { }#endif
drivers/gpu/drm/amd/amdgpu/atom.c +4 -1
@@ -1343,8 +1343,11 @@ struct atom_context *amdgpu_atom_parse(struct card_info *card, void *bios) idx =0x80 ; str =CSTR (idx); -if (*str !='\0' ) +if (*str !='\0' ) {pr_info ("ATOM BIOS: %s\n" , str); +strlcpy (ctx->vbios_version, str,sizeof (ctx->vbios_version)); + } +return ctx; }
drivers/gpu/drm/amd/amdgpu/atom.h +1 -0
@@ -140,6 +140,7 @@ struct atom_context {int io_mode;uint32_t *scratch;int scratch_size_bytes; +char vbios_version[20 ]; };extern int amdgpu_atom_debug;
Signature · 6 lines
2.7.4 _______________________________________________ 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): 1503583813-5978-1-git-send-email-kent.russell-5C7GfCeVMHo@public.gmane.org
Deucher, Alexander
Reviewed-by Alex DeucherQuoted 18 lines
-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Kent Russell
Sent: Thursday, August 24, 2017 10:10 AM
To: [email protected]
Cc: Russell, Kent
Subject: [PATCH v2] drm/amdgpu: Add debugfs file for VBIOS and versionAdd 2 debugfs files, one that contains the VBIOS version, and one that contains the VBIOS itself. These won't change after initialization, so we can add the VBIOS version when we parse the atombios information.
This ensures that we can find out the VBIOS version, even when the dmesg buffer fills up, and makes it easier to associate which VBIOS version is for which GPU on mGPU configurations. Set the size to 20 characters in case of some weird VBIOS version that exceeds the expected 17 character format (3-8-3\0). The VBIOS dump also allows for easy debugging
Quoted 3 lines
v2: Move to debugfs, clarify commit message, add VBIOS dump file
Signed-off-by Kent Russell <[email protected]>
Quoted 150 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 62 ++++++++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/atom.c | 5 ++- drivers/gpu/drm/amd/amdgpu/atom.h | 1 + 3 files changed, 67 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2
-0@@ -66,6 +66,8 @@ MODULE_FIRMWARE("amdgpu/raven_gpu_info.bin");static int amdgpu_debugfs_regs_init (struct amdgpu_device *adev);static void amdgpu_debugfs_regs_cleanup (struct amdgpu_device *adev);static int amdgpu_debugfs_test_ib_ring_init (struct amdgpu_device *adev); +static int amdgpu_debugfs_vbios_dump_init (struct amdgpu_device *adev); +static int amdgpu_debugfs_vbios_version_init (struct amdgpu_device *adev);static const char *amdgpu_asic_name[] = {
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +7
-0"TAHITI",@@ -2250,6 +2252,14 @@ int amdgpu_device_init(struct amdgpu_device *adev, if (r)DRM_ERROR ("registering firmware debugfs failed (%d).\n" , r); + r =amdgpu_debugfs_vbios_dump_init (adev); +if (r) +DRM_ERROR ("Creating vbios dump debugfs failed (%d).\n" , r); + + r =amdgpu_debugfs_vbios_version_init (adev); +if (r) + DRM_ERROR("Creating vbios version debugfs failed (%d).\n",r);
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +13
-0+if ((amdgpu_testing &1 )) {if (adev->accel_working)amdgpu_test_moves (adev);@@ -3830,6 +3840,50 @@ int amdgpu_debugfs_init(struct drm_minor *minor) {return 0 ; } + +static int amdgpu_debugfs_get_vbios_dump (struct seq_file *m,void *data) +{ +struct drm_info_node *node = (struct drm_info_node *) m- >private; +struct drm_device *dev = node->minor->dev; +struct amdgpu_device *adev = dev->dev_private; + +seq_write (m, adev->bios, adev->bios_size); +return 0 ; +} + +static int amdgpu_debugfs_get_vbios_version(struct seq_file *m, void*data)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2
-0+{ + struct drm_info_node *node = (struct drm_info_node *) m-Quoted 1 line
private;
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +26
-0+struct drm_device *dev = node->minor->dev; +struct amdgpu_device *adev = dev->dev_private; +struct atom_context *ctx = adev->mode_info.atom_context; + +seq_printf (m,"%s\n" , ctx->vbios_version); +return 0 ; +} + +static const struct drm_info_list amdgpu_vbios_dump_list[] = { + {"amdgpu_vbios" , + amdgpu_debugfs_get_vbios_dump, +0 ,NULL }, +}; + +static const struct drm_info_list amdgpu_vbios_version_list[] = { + {"amdgpu_vbios_version" , + amdgpu_debugfs_get_vbios_version, +0 ,NULL }, +}; + +static int amdgpu_debugfs_vbios_dump_init (struct amdgpu_device *adev) +{ +return amdgpu_debugfs_add_files (adev, + amdgpu_vbios_dump_list,1 ); +} +static int amdgpu_debugfs_vbios_version_init(struct amdgpu_device*adev)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +12
-0+{ +return amdgpu_debugfs_add_files (adev, + amdgpu_vbios_version_list,1 ); +}#else static int amdgpu_debugfs_test_ib_ring_init (struct amdgpu_device *adev) {@@ -3839,5 +3893,13 @@ static int amdgpu_debugfs_regs_init(struct amdgpu_device *adev) {return 0 ; } +static int amdgpu_debugfs_vbios_dump_init (struct amdgpu_device *adev) +{ +return 0 ; +} +static int amdgpu_debugfs_vbios_version_init (struct amdgpu_device *adev) +{ +return 0 ; +}static void
amdgpu_debugfs_regs_cleanup(struct amdgpu_device *adev){ } #endifdrivers/gpu/drm/amd/amdgpu/atom.c +4
-1@@ -1343,8 +1343,11 @@ struct atom_context *amdgpu_atom_parse(struct card_info *card, void *bios) idx =0x80 ; str =CSTR (idx); -if (*str !='\0' ) +if (*str !='\0' ) {pr_info ("ATOM BIOS: %s\n" , str); +strlcpy (ctx->vbios_version, str,sizeof (ctx->vbios_version)); + } +return ctx;}
drivers/gpu/drm/amd/amdgpu/atom.h +1
-1@@ -140,6 +140,7 @@ struct atom_context {int io_mode;uint32_t *scratch;int scratch_size_bytes; +char vbios_version[20 ]; };extern int amdgpu_atom_debug; --2.7.4
Quoted 4 lines
_______________________________________________
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
Am 24.08.2017 um 16:10 schrieb Kent Russell:
Quoted 85 lines
Add 2 debugfs files, one that contains the VBIOS version, and one that contains the VBIOS itself. These won't change after initialization, so we can add the VBIOS version when we parse the atombios information.
This ensures that we can find out the VBIOS version, even when the dmesg buffer fills up, and makes it easier to associate which VBIOS version is for which GPU on mGPU configurations. Set the size to 20 characters in case of some weird VBIOS version that exceeds the expected 17 character format (3-8-3\0). The VBIOS dump also allows for easy debugging
v2: Move to debugfs, clarify commit message, add VBIOS dump file
Signed-off-by Kent Russell <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 62 ++++++++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/atom.c | 5 ++- drivers/gpu/drm/amd/amdgpu/atom.h | 1 + 3 files changed, 67 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +44
-0@@ -66,6 +66,8 @@ MODULE_FIRMWARE("amdgpu/raven_gpu_info.bin");static int amdgpu_debugfs_regs_init (struct amdgpu_device *adev);static void amdgpu_debugfs_regs_cleanup (struct amdgpu_device *adev);static int amdgpu_debugfs_test_ib_ring_init (struct amdgpu_device *adev); +static int amdgpu_debugfs_vbios_dump_init (struct amdgpu_device *adev); +static int amdgpu_debugfs_vbios_version_init (struct amdgpu_device *adev);static const char *amdgpu_asic_name[] = {"TAHITI" ,@@ -2250,6 +2252,14 @@ int amdgpu_device_init(struct amdgpu_device *adev,if (r)DRM_ERROR ("registering firmware debugfs failed (%d).\n" , r); + r =amdgpu_debugfs_vbios_dump_init (adev); +if (r) +DRM_ERROR ("Creating vbios dump debugfs failed (%d).\n" , r); + + r =amdgpu_debugfs_vbios_version_init (adev); +if (r) +DRM_ERROR ("Creating vbios version debugfs failed (%d).\n" , r); +if ((amdgpu_testing &1 )) {if (adev->accel_working)amdgpu_test_moves (adev);@@ -3830,6 +3840,50 @@ int amdgpu_debugfs_init(struct drm_minor *minor) {return 0 ; } + +static int amdgpu_debugfs_get_vbios_dump (struct seq_file *m,void *data) +{ +struct drm_info_node *node = (struct drm_info_node *) m->private; +struct drm_device *dev = node->minor->dev; +struct amdgpu_device *adev = dev->dev_private; + +seq_write (m, adev->bios, adev->bios_size); +return 0 ; +} + +static int amdgpu_debugfs_get_vbios_version (struct seq_file *m,void *data) +{ +struct drm_info_node *node = (struct drm_info_node *) m->private; +struct drm_device *dev = node->minor->dev; +struct amdgpu_device *adev = dev->dev_private; +struct atom_context *ctx = adev->mode_info.atom_context; + +seq_printf (m,"%s\n" , ctx->vbios_version); +return 0 ; +} + +static const struct drm_info_list amdgpu_vbios_dump_list[] = { + {"amdgpu_vbios" , + amdgpu_debugfs_get_vbios_dump, +0 ,NULL }, +}; + +static const struct drm_info_list amdgpu_vbios_version_list[] = { + {"amdgpu_vbios_version" , + amdgpu_debugfs_get_vbios_version, +0 ,NULL }, +}; +
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_debugfs_init(struct drm_minor *minor) · line 3886
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +10
-0+static int amdgpu_debugfs_vbios_dump_init (struct amdgpu_device *adev) +{ +return amdgpu_debugfs_add_files (adev, + amdgpu_vbios_dump_list,1 ); +} +static int amdgpu_debugfs_vbios_version_init (struct amdgpu_device *adev) +{ +return amdgpu_debugfs_add_files (adev, + amdgpu_vbios_version_list,1 ); +}
Is there any point in having all those different functions and arrays just for debugfs init?
We should probably just have one of them in amdgpu_device.c.
But that is a different topic, this patch is Reviewed-by: Christian König <[email protected]> anyway.
Regards,
Christian.
Quoted 39 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +8
-0#else static int amdgpu_debugfs_test_ib_ring_init (struct amdgpu_device *adev) {@@ -3839,5 +3893,13 @@ static int amdgpu_debugfs_regs_init(struct amdgpu_device *adev) {return 0 ; } +static int amdgpu_debugfs_vbios_dump_init (struct amdgpu_device *adev) +{ +return 0 ; +} +static int amdgpu_debugfs_vbios_version_init (struct amdgpu_device *adev) +{ +return 0 ; +}static void amdgpu_debugfs_regs_cleanup (struct amdgpu_device *adev) { }#endif drivers/gpu/drm/amd/amdgpu/atom.c +4
-1@@ -1343,8 +1343,11 @@ struct atom_context *amdgpu_atom_parse(struct card_info *card, void *bios) idx =0x80 ; str =CSTR (idx); -if (*str !='\0' ) +if (*str !='\0' ) {pr_info ("ATOM BIOS: %s\n" , str); +strlcpy (ctx->vbios_version, str,sizeof (ctx->vbios_version)); + } +return ctx; }drivers/gpu/drm/amd/amdgpu/atom.h +0
-0
drivers/gpu/drm/amd/amdgpu/atom.h struct atom_context { · line 146
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/atom.h +1
-0@@ -140,6 +140,7 @@ struct atom_context {int io_mode;uint32_t *scratch;int scratch_size_bytes; +char vbios_version[20 ]; };extern int amdgpu_atom_debug;
_______________________________________________
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): 51c0d5d7-c556-3106-fab3-9cdd2f16f733-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org
That would make sense. I was just trying to follow the existing style, to avoid any major confusion or complications when things do get tidied up. Thanks!
Kent
-----Original Message-----
From: Christian König [mailto:[email protected]]
Sent: Thursday, August 24, 2017 10:26 AM
To: Russell, Kent; [email protected]
Subject: Re: [PATCH v2] drm/amdgpu: Add debugfs file for VBIOS and version
Am 24.08.2017 um 16:10 schrieb Kent Russell:
Quoted 89 lines
Add 2 debugfs files, one that contains the VBIOS version, and one that contains the VBIOS itself. These won't change after initialization, so we can add the VBIOS version when we parse the atombios information.
This ensures that we can find out the VBIOS version, even when the dmesg buffer fills up, and makes it easier to associate which VBIOS version is for which GPU on mGPU configurations. Set the size to 20 characters in case of some weird VBIOS version that exceeds the expected 17 character format (3-8-3\0). The VBIOS dump also allows for easy debugging
v2: Move to debugfs, clarify commit message, add VBIOS dump file
Signed-off-by Kent Russell <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 62 ++++++++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/atom.c | 5 ++- drivers/gpu/drm/amd/amdgpu/atom.h | 1 + 3 files changed, 67 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +45
-0@@ -66,6 +66,8 @@ MODULE_FIRMWARE("amdgpu/raven_gpu_info.bin");static int amdgpu_debugfs_regs_init (struct amdgpu_device *adev);static void amdgpu_debugfs_regs_cleanup (struct amdgpu_device *adev);static int amdgpu_debugfs_test_ib_ring_init (struct amdgpu_device *adev); +static int amdgpu_debugfs_vbios_dump_init (struct amdgpu_device +*adev);static int amdgpu_debugfs_vbios_version_init (struct +amdgpu_device *adev);static const char *amdgpu_asic_name[] = {"TAHITI" ,@@ -2250,6 +2252,14 @@ int amdgpu_device_init(struct amdgpu_device *adev,if (r)DRM_ERROR ("registering firmware debugfs failed (%d).\n" , r); + r =amdgpu_debugfs_vbios_dump_init (adev); +if (r) +DRM_ERROR ("Creating vbios dump debugfs failed (%d).\n" , r); + + r =amdgpu_debugfs_vbios_version_init (adev); +if (r) +DRM_ERROR ("Creating vbios version debugfs failed (%d).\n" , r); +if ((amdgpu_testing &1 )) {if (adev->accel_working)amdgpu_test_moves (adev);@@ -3830,6 +3840,50 @@ int amdgpu_debugfs_init(struct drm_minor *minor) {return 0 ; } + +static int amdgpu_debugfs_get_vbios_dump (struct seq_file *m,void +*data) { +struct drm_info_node *node = (struct drm_info_node *) m->private; +struct drm_device *dev = node->minor->dev; +struct amdgpu_device *adev = dev->dev_private; + +seq_write (m, adev->bios, adev->bios_size); +return 0 ; +} + +static int amdgpu_debugfs_get_vbios_version (struct seq_file *m,void +*data) { +struct drm_info_node *node = (struct drm_info_node *) m->private; +struct drm_device *dev = node->minor->dev; +struct amdgpu_device *adev = dev->dev_private; +struct atom_context *ctx = adev->mode_info.atom_context; + +seq_printf (m,"%s\n" , ctx->vbios_version); +return 0 ; +} + +static const struct drm_info_list amdgpu_vbios_dump_list[] = { + {"amdgpu_vbios" , + amdgpu_debugfs_get_vbios_dump, +0 ,NULL }, +}; + +static const struct drm_info_list amdgpu_vbios_version_list[] = { + {"amdgpu_vbios_version" , + amdgpu_debugfs_get_vbios_version, +0 ,NULL }, +}; +
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_debugfs_init(struct drm_minor *minor) · line 3886
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +10
-0+static int amdgpu_debugfs_vbios_dump_init (struct amdgpu_device *adev) +{ +return amdgpu_debugfs_add_files (adev, + amdgpu_vbios_dump_list,1 ); +} +static int amdgpu_debugfs_vbios_version_init (struct amdgpu_device +*adev) { +return amdgpu_debugfs_add_files (adev, + amdgpu_vbios_version_list,1 ); +}
Is there any point in having all those different functions and arrays just for debugfs init?
We should probably just have one of them in amdgpu_device.c.
But that is a different topic, this patch is Reviewed-by: Christian König <[email protected]> anyway.
Regards,
Christian.
Quoted 41 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +8
-0#else static int amdgpu_debugfs_test_ib_ring_init (struct amdgpu_device *adev) {@@ -3839,5 +3893,13 @@ static int amdgpu_debugfs_regs_init(struct amdgpu_device *adev) {return 0 ; } +static int amdgpu_debugfs_vbios_dump_init (struct amdgpu_device *adev) +{ +return 0 ; +} +static int amdgpu_debugfs_vbios_version_init (struct amdgpu_device +*adev) { +return 0 ; +}static void amdgpu_debugfs_regs_cleanup (struct amdgpu_device *adev) { }#endif drivers/gpu/drm/amd/amdgpu/atom.c +4
-1@@ -1343,8 +1343,11 @@ struct atom_context *amdgpu_atom_parse(struct card_info *card, void *bios) idx =0x80 ; str =CSTR (idx); -if (*str !='\0' ) +if (*str !='\0' ) {pr_info ("ATOM BIOS: %s\n" , str); +strlcpy (ctx->vbios_version, str,sizeof (ctx->vbios_version)); + } +return ctx; }drivers/gpu/drm/amd/amdgpu/atom.h +0
-0
drivers/gpu/drm/amd/amdgpu/atom.h struct atom_context { · line 146
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/atom.h +1
-0@@ -140,6 +140,7 @@ struct atom_context {int io_mode;uint32_t *scratch;int scratch_size_bytes; +char vbios_version[20 ]; };extern int amdgpu_atom_debug;
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx