public inbox for drm-ai-reviews@public-inbox.freedesktop.org
 help / color / mirror / Atom feed
* [REGRESSION][PATCH] drm/amd/display: Fix uninitialized variable which breaks full LTO
@ 2026-03-10  4:24 Calvin Owens
  2026-03-10  5:54 ` Calvin Owens
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Calvin Owens @ 2026-03-10  4:24 UTC (permalink / raw)
  To: linux-kernel
  Cc: dri-devel, amd-gfx, Charlene Liu, Ovidiu Bunea, Alex Hung,
	Dan Wheeler, Alex Deucher, Harry Wentland, Leo Li,
	Rodrigo Siqueira, Christian Koenig, David Airlie, Simona Vetter,
	llvm

Commit e1b385726f7f ("drm/amd/display: Add additional checks for PSP
footer size") introduced a use of an uninitialized stack variable
in dm_dmub_sw_init() (region_params.bss_data_size).

Interestingly, this seems to cause no issue on normal kernels. But when
full LTO is enabled, it causes the compiler to "optimize" out huge
swaths of amdgpu initialization code, and the driver is unusable:

    amdgpu 0000:03:00.0: [drm] Loading DMUB firmware via PSP: version=0x07002F00
    amdgpu 0000:03:00.0: sw_init of IP block <dm> failed 5
    amdgpu 0000:03:00.0: amdgpu_device_ip_init failed
    amdgpu 0000:03:00.0: Fatal error during GPU init

It surprises me that neither gcc nor clang emit a warning about this: I
only found it by bisecting the LTO breakage.

Fix by using the old value for region_params.bss_data_size in place of
the uninitialized reference, which makes amdgpu work with LTO again.

Fixes: e1b385726f7f ("drm/amd/display: Add additional checks for PSP footer size")
Signed-off-by: Calvin Owens <calvin@wbinvd.org>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index b3d6f2cd8ab6..e69e61163ae9 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -2554,7 +2554,7 @@ static int dm_dmub_sw_init(struct amdgpu_device *adev)
 	fw_meta_info_params.fw_inst_const = adev->dm.dmub_fw->data +
 					    le32_to_cpu(hdr->header.ucode_array_offset_bytes) +
 					    PSP_HEADER_BYTES_256;
-	fw_meta_info_params.fw_bss_data = region_params.bss_data_size ? adev->dm.dmub_fw->data +
+	fw_meta_info_params.fw_bss_data = le32_to_cpu(hdr->bss_data_bytes) ? adev->dm.dmub_fw->data +
 					  le32_to_cpu(hdr->header.ucode_array_offset_bytes) +
 					  le32_to_cpu(hdr->inst_const_bytes) : NULL;
 	fw_meta_info_params.custom_psp_footer_size = 0;
-- 
2.47.3


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

end of thread, other threads:[~2026-03-13  3:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-10  4:24 [REGRESSION][PATCH] drm/amd/display: Fix uninitialized variable which breaks full LTO Calvin Owens
2026-03-10  5:54 ` Calvin Owens
2026-03-12  8:02 ` Nathan Chancellor
2026-03-12 16:15   ` Calvin Owens
2026-03-12 17:13 ` [PATCH v2] drm/amd/display: Fix uninitialized variable use " Calvin Owens
2026-03-12 20:31   ` Harry Wentland
2026-03-12 20:37   ` Nathan Chancellor
2026-03-13  3:56 ` Claude review: [PATCH] drm/amd/display: Fix uninitialized variable " Claude Code Review Bot
2026-03-13  3:56 ` Claude Code Review Bot

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