On Wed, Feb 11, 2026 at 5:28 AM Pierre-Eric Pelloux-Prayer <[email protected]> wrote: > > This is the best way to describe the GPU to a tool loading > the devcoredump. > > Signed-off-by: Pierre-Eric Pelloux-Prayer <[email protected]>
Reviewed-by: Alex Deucher <[email protected]> > --- > .../gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c | 2 + > drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 42 +++++++++++++++++++ > drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.h | 3 ++ > 3 files changed, 47 insertions(+) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c > index 0bb430853a9f..42a969512dcc 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c > @@ -262,6 +262,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 41e63c286912..d7325c23fa53 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c > @@ -1380,6 +1380,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__ */ > -- > 2.43.0 >
