[PATCH RFC 5/6] drm/amdgpu: don't wake up the GPU for mmGB_ADDR_CONFIG register read
Alex Deucher
alexdeucher at gmail.com
Fri Aug 1 15:27:00 UTC 2025
On Fri, Aug 1, 2025 at 2:11 AM Philipp Zabel <philipp.zabel at gmail.com> wrote:
>
> On Thu, Jul 31, 2025 at 9:38 PM Alex Deucher <alexdeucher at gmail.com> wrote:
>>
>> On Thu, Jul 31, 2025 at 3:33 AM Philipp Zabel <philipp.zabel at gmail.com> wrote:
>> >
>> > Don't wake the GPU if libdrm queries the mmGB_ADDR_CONFIG register
>> > value during amdgpu_query_gpu_info_init(). Instead, return the already
>> > cached value adev->gfx.config.gb_addr_config.
>> >
>> > Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2295
>> > Signed-off-by: Philipp Zabel <philipp.zabel at gmail.com>
>> > ---
>> > drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 10 ++++++++++
>> > 1 file changed, 10 insertions(+)
>> >
>> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
>> > index fe1347a4075c4..ed4d7d72f2065 100644
>> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
>> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
>> > @@ -883,6 +883,16 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
>> >
>> > alloc_size = info->read_mmr_reg.count * sizeof(*regs);
>> >
>> > + if (info->read_mmr_reg.dword_offset == 0x263e &&
>>
>> I think the offset of this register varies across chip families.
>> You'll need some way to determine what the offset is for each family.
>
>
> Thank you. This workaround was specifically intended for the following call in libdrm [1]:
>
> r = amdgpu_read_mm_registers(dev, 0x263e, 1, 0xffffffff, 0,
> &dev->info.gb_addr_cfg);
>
> [1] https://gitlab.freedesktop.org/mesa/libdrm/-/blob/9ea8a8e93d542fe61d82716d1a721e8d1d257405/amdgpu/amdgpu_gpu_info.c#L215-216
>
> which also seem to hard-code the dword_offset?
>
> The same is now copied into Mesa [2] as:
>
> r = ac_drm_read_mm_registers(dev, 0x263e, 1, 0xffffffff, 0, &info->gb_addr_cfg);
>
> [2] https://gitlab.freedesktop.org/mesa/mesa/-/blob/c64c6a0c31f9cb1339bc700d236932171f7444a3/src/amd/common/ac_linux_drm.c#L722
Nevermind, it's at the same absolute offset on all chips right now.
The relative offsets are just different.
Alex
More information about the amd-gfx
mailing list