mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: add support of bios dump in devcoredump
@ 2024-03-26 14:37 Sunil Khatri
  2024-03-26 16:53 ` Alex Deucher
  0 siblings, 1 reply; 3+ messages in thread
From: Sunil Khatri @ 2024-03-26 14:37 UTC (permalink / raw)
  To: Alex Deucher, Christian König, Shashank Sharma
  Cc: amd-gfx, dri-devel, linux-kernel, Hawking Zhang, Felix Kuehling,
	Lijo Lazar, Sunil Khatri

dump the bios binary in the devcoredump.

Signed-off-by: Sunil Khatri <sunil.khatri@amd.com>
---
 .../gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c  | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c
index 44c5da8aa9ce..f33963d777eb 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c
@@ -132,6 +132,26 @@ amdgpu_devcoredump_read(char *buffer, loff_t offset, size_t count,
 	drm_printf(&p, "Faulty page starting at address: 0x%016llx\n", fault_info->addr);
 	drm_printf(&p, "Protection fault status register: 0x%x\n\n", fault_info->status);
 
+	/* Dump BIOS */
+	if (coredump->adev->bios && coredump->adev->bios_size) {
+		int i = 0;
+
+		drm_printf(&p, "BIOS Binary dump\n");
+		drm_printf(&p, "Valid BIOS  Size:%d bytes type:%s\n",
+			   coredump->adev->bios_size,
+			   coredump->adev->is_atom_fw ?
+			   "Atom bios":"Non Atom Bios");
+
+		while (i < coredump->adev->bios_size) {
+			/* Printing 15 bytes in a line */
+			if (i % 15 == 0)
+				drm_printf(&p, "\n");
+			drm_printf(&p, "0x%x \t", coredump->adev->bios[i]);
+			i++;
+		}
+		drm_printf(&p, "\n");
+	}
+
 	/* Add ring buffer information */
 	drm_printf(&p, "Ring buffer information\n");
 	for (int i = 0; i < coredump->adev->num_rings; i++) {
-- 
2.34.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/amdgpu: add support of bios dump in devcoredump
  2024-03-26 14:37 [PATCH] drm/amdgpu: add support of bios dump in devcoredump Sunil Khatri
@ 2024-03-26 16:53 ` Alex Deucher
  2024-03-26 17:34   ` Khatri, Sunil
  0 siblings, 1 reply; 3+ messages in thread
From: Alex Deucher @ 2024-03-26 16:53 UTC (permalink / raw)
  To: Sunil Khatri
  Cc: Alex Deucher, Christian König, Shashank Sharma, amd-gfx,
	dri-devel, linux-kernel, Hawking Zhang, Felix Kuehling,
	Lijo Lazar

On Tue, Mar 26, 2024 at 10:38 AM Sunil Khatri <sunil.khatri@amd.com> wrote:
>
> dump the bios binary in the devcoredump.
>
> Signed-off-by: Sunil Khatri <sunil.khatri@amd.com>
> ---
>  .../gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c  | 20 +++++++++++++++++++
>  1 file changed, 20 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c
> index 44c5da8aa9ce..f33963d777eb 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c
> @@ -132,6 +132,26 @@ amdgpu_devcoredump_read(char *buffer, loff_t offset, size_t count,
>         drm_printf(&p, "Faulty page starting at address: 0x%016llx\n", fault_info->addr);
>         drm_printf(&p, "Protection fault status register: 0x%x\n\n", fault_info->status);
>
> +       /* Dump BIOS */
> +       if (coredump->adev->bios && coredump->adev->bios_size) {
> +               int i = 0;
> +
> +               drm_printf(&p, "BIOS Binary dump\n");
> +               drm_printf(&p, "Valid BIOS  Size:%d bytes type:%s\n",
> +                          coredump->adev->bios_size,
> +                          coredump->adev->is_atom_fw ?
> +                          "Atom bios":"Non Atom Bios");
> +
> +               while (i < coredump->adev->bios_size) {
> +                       /* Printing 15 bytes in a line */
> +                       if (i % 15 == 0)
> +                               drm_printf(&p, "\n");
> +                       drm_printf(&p, "0x%x \t", coredump->adev->bios[i]);
> +                       i++;
> +               }
> +               drm_printf(&p, "\n");
> +       }

I don't think it's too useful to dump this as text.  I was hoping it
could be a binary.  I guess, we can just get this from debugfs if we
need it if a binary is not possible.

Alex


> +
>         /* Add ring buffer information */
>         drm_printf(&p, "Ring buffer information\n");
>         for (int i = 0; i < coredump->adev->num_rings; i++) {
> --
> 2.34.1
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/amdgpu: add support of bios dump in devcoredump
  2024-03-26 16:53 ` Alex Deucher
@ 2024-03-26 17:34   ` Khatri, Sunil
  0 siblings, 0 replies; 3+ messages in thread
From: Khatri, Sunil @ 2024-03-26 17:34 UTC (permalink / raw)
  To: Alex Deucher, Sunil Khatri
  Cc: Alex Deucher, Christian König, Shashank Sharma, amd-gfx,
	dri-devel, linux-kernel, Hawking Zhang, Felix Kuehling,
	Lijo Lazar


On 3/26/2024 10:23 PM, Alex Deucher wrote:
> On Tue, Mar 26, 2024 at 10:38 AM Sunil Khatri <sunil.khatri@amd.com> wrote:
>> dump the bios binary in the devcoredump.
>>
>> Signed-off-by: Sunil Khatri <sunil.khatri@amd.com>
>> ---
>>   .../gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c  | 20 +++++++++++++++++++
>>   1 file changed, 20 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c
>> index 44c5da8aa9ce..f33963d777eb 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c
>> @@ -132,6 +132,26 @@ amdgpu_devcoredump_read(char *buffer, loff_t offset, size_t count,
>>          drm_printf(&p, "Faulty page starting at address: 0x%016llx\n", fault_info->addr);
>>          drm_printf(&p, "Protection fault status register: 0x%x\n\n", fault_info->status);
>>
>> +       /* Dump BIOS */
>> +       if (coredump->adev->bios && coredump->adev->bios_size) {
>> +               int i = 0;
>> +
>> +               drm_printf(&p, "BIOS Binary dump\n");
>> +               drm_printf(&p, "Valid BIOS  Size:%d bytes type:%s\n",
>> +                          coredump->adev->bios_size,
>> +                          coredump->adev->is_atom_fw ?
>> +                          "Atom bios":"Non Atom Bios");
>> +
>> +               while (i < coredump->adev->bios_size) {
>> +                       /* Printing 15 bytes in a line */
>> +                       if (i % 15 == 0)
>> +                               drm_printf(&p, "\n");
>> +                       drm_printf(&p, "0x%x \t", coredump->adev->bios[i]);
>> +                       i++;
>> +               }
>> +               drm_printf(&p, "\n");
>> +       }
> I don't think it's too useful to dump this as text.  I was hoping it
> could be a binary.  I guess, we can just get this from debugfs if we
> need it if a binary is not possible.


Yes , this dumps in text format only and the binary is already available 
in debugfs. So discarding the patch.

>
> Alex
>
>
>> +
>>          /* Add ring buffer information */
>>          drm_printf(&p, "Ring buffer information\n");
>>          for (int i = 0; i < coredump->adev->num_rings; i++) {
>> --
>> 2.34.1
>>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-03-26 17:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-26 14:37 [PATCH] drm/amdgpu: add support of bios dump in devcoredump Sunil Khatri
2024-03-26 16:53 ` Alex Deucher
2024-03-26 17:34   ` Khatri, Sunil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®