summaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>2025-12-02 14:27:24 +0100
committerAlex Deucher <alexander.deucher@amd.com>2026-03-06 16:33:32 -0500
commite81eff80aad6c04ff1d7c1bf6412de17e717bd76 (patch)
tree10495b5de22b5235a4e97a008e04f1b0e77c66f7 /drivers/gpu
parent4e22a5fe6ea6e0b057e7f246df4ac3ff8bfbc46a (diff)
downloadlinux-e81eff80aad6c04ff1d7c1bf6412de17e717bd76.tar.gz
linux-e81eff80aad6c04ff1d7c1bf6412de17e717bd76.zip
drm/amdgpu: include ip discovery data in devcoredump
This is the best way to describe the GPU to a tool loading the devcoredump. Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c42
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.h3
3 files changed, 47 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c
index c38e7371bafc..160f0704d1d3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c
@@ -261,6 +261,8 @@ amdgpu_devcoredump_read(char *buffer, loff_t offset, size_t count,
}
}
+ amdgpu_discovery_dump(coredump->adev, &p);
+
/* IP firmware information */
drm_printf(&p, "\nIP Firmwares\n");
amdgpu_devcoredump_fw_info(coredump->adev, &p);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
index 6c8b3c2687dc..c4ae1ce52a0f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
@@ -1379,6 +1379,48 @@ static void amdgpu_discovery_sysfs_fini(struct amdgpu_device *adev)
kobject_put(&ip_top->kobj);
}
+/* devcoredump support */
+void amdgpu_discovery_dump(struct amdgpu_device *adev, struct drm_printer *p)
+{
+ struct ip_discovery_top *ip_top = adev->discovery.ip_top;
+ struct ip_die_entry *ip_die_entry;
+ struct list_head *el_die, *el_hw_id, *el_hw_inst;
+ struct ip_hw_id *hw_id;
+ struct kset *die_kset;
+ struct ip_hw_instance *ip_inst;
+ int i = 0, j;
+
+ die_kset = &ip_top->die_kset;
+
+ drm_printf(p, "\nHW IP Discovery\n");
+ spin_lock(&die_kset->list_lock);
+ list_for_each(el_die, &die_kset->list) {
+ drm_printf(p, "die %d\n", i++);
+ ip_die_entry = to_ip_die_entry(list_to_kobj(el_die));
+
+ list_for_each(el_hw_id, &ip_die_entry->ip_kset.list) {
+ hw_id = to_ip_hw_id(list_to_kobj(el_hw_id));
+ drm_printf(p, "hw_id %d %s\n", hw_id->hw_id, hw_id_names[hw_id->hw_id]);
+
+ list_for_each(el_hw_inst, &hw_id->hw_id_kset.list) {
+ ip_inst = to_ip_hw_instance(list_to_kobj(el_hw_inst));
+ drm_printf(p, "\tinstance %d\n", ip_inst->num_instance);
+ drm_printf(p, "\tmajor %d\n", ip_inst->major);
+ drm_printf(p, "\tminor %d\n", ip_inst->minor);
+ drm_printf(p, "\trevision %d\n", ip_inst->revision);
+ drm_printf(p, "\tharvest 0x%01X\n", ip_inst->harvest);
+ drm_printf(p, "\tnum_base_addresses %d\n",
+ ip_inst->num_base_addresses);
+ for (j = 0; j < ip_inst->num_base_addresses; j++)
+ drm_printf(p, "\tbase_addr[%d] 0x%08X\n",
+ j, ip_inst->base_addr[j]);
+ }
+ }
+ }
+ spin_unlock(&die_kset->list_lock);
+}
+
+
/* ================================================== */
static int amdgpu_discovery_reg_base_init(struct amdgpu_device *adev)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.h
index 4ce04486cc31..c8242992c912 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.h
@@ -30,6 +30,7 @@
#define DISCOVERY_TMR_OFFSET (64 << 10)
struct ip_discovery_top;
+struct drm_printer;
struct amdgpu_discovery_info {
struct debugfs_blob_wrapper debugfs_blob;
@@ -47,4 +48,6 @@ int amdgpu_discovery_get_nps_info(struct amdgpu_device *adev,
struct amdgpu_gmc_memrange **ranges,
int *range_cnt, bool refresh);
+void amdgpu_discovery_dump(struct amdgpu_device *adev, struct drm_printer *p);
+
#endif /* __AMDGPU_DISCOVERY__ */