Skip to contentSkip to conversation

drm/amdgpu: add support of bios dump in devcoredump

PATCH In review Sunil Khatri 3 participants 3 messages Mar 26, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: add support of bios dump in devcoredump

dump the bios binary in the devcoredump.

---
 .../gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c  | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c +20 -0
index 44c5da8aa9ce..f33963d777eb 100644
@@ -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++) {
Signature · 1 line
2.34.1
#1 lore raw
Quoted 25 lines · Sunil Khatri

dump the bios binary in the devcoredump.

---
 .../gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c  | 20 +++++++++++++++++++
 1 file changed, 20 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c +9 -0
index 44c5da8aa9ce..f33963d777eb 100644
@@ -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");

drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c amdgpu_devcoredump_read(char *buffer, loff_t offset, size_t count, · line 153

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c +10 -0
+
+               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

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c +1 -1
+
        /* Add ring buffer information */
        drm_printf(&p, "Ring buffer information\n");
        for (int i = 0; i < coredump->adev->num_rings; i++) {
--

2.34.1

#2 lore raw
Quoted 30 lines · Alex Deucher
Quoted 29 lines · Sunil Khatri

dump the bios binary in the devcoredump.

---
  .../gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c  | 20 +++++++++++++++++++
  1 file changed, 20 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c +14 -0
index 44c5da8aa9ce..f33963d777eb 100644
@@ -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");
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c amdgpu_devcoredump_read(char *buffer, loff_t offset, size_t count, · line 153

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c +5 -0
+                       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.

Quoted 11 lines

Alex

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c +1 -1
+
         /* Add ring buffer information */
         drm_printf(&p, "Ring buffer information\n");
         for (int i = 0; i < coredump->adev->num_rings; i++) {
--

2.34.1