From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B0C6DFCC9AF for ; Tue, 10 Mar 2026 04:25:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E8DBB10E1E0; Tue, 10 Mar 2026 04:25:10 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; secure) header.d=wbinvd.org header.i=@wbinvd.org header.b="BrHblYvC"; dkim-atps=neutral Received: from mail-dl1-f41.google.com (mail-dl1-f41.google.com [74.125.82.41]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5221410E642 for ; Tue, 10 Mar 2026 04:25:09 +0000 (UTC) Received: by mail-dl1-f41.google.com with SMTP id a92af1059eb24-1271195d2a7so547114c88.0 for ; Mon, 09 Mar 2026 21:25:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wbinvd.org; s=wbinvd; t=1773116708; x=1773721508; darn=lists.freedesktop.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=hPa4uc736wUZG7p1hT7+UQGgiHHzlxFbUs+tG5i8A9g=; b=BrHblYvCrGiQ+N8sf235pJQDsA800Z9iX46a0K/bjhX2cD5lV5J7jXgTNyF5CLyBBr WmlPamjuMD16IGecT1QRNgVG3jiVkQqH5B9ybftqVPa4cFK1ih9SJZiAoHNSqzVwAnHa 7gPuLdlSHHC64RJJHG4zMWkc1MlZ27GDfX70ftFYh/fWQ1gdBuEfiX4m97zLD81qkt99 hFjsRQ/YTxqPhxEzjwPBKsBZCeu20AdwUfwH/yuIR4fwVsKJiBzcBlOlx8seDjXNSwrh Ntmbii2AyFeGzPOd0UxvTy1TeoZ6uHODucT5i5ZrVkHE2x901aSLSRePVar+goeESadB J/fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773116708; x=1773721508; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=hPa4uc736wUZG7p1hT7+UQGgiHHzlxFbUs+tG5i8A9g=; b=XHeOCBht7a5NZ/woMUPBByFoq+NB9BG6LmntACpVDT+tNxOV7AwYSFtjwN2fYwIUn0 Cpvop9bruZTVf1O+zyAzkoSGjAYPmpEprSEksehBgjiMrdjPZYF5V7736xi5SVvc8YAt 1HnNCm8VUb4VY6zjBcMIzODvsPFAnf7Y6nbAgAeTCTIY7iDj/KHFALU3j6xyJr0fKH4W mH0rfUQ8jOOVuDJUXe5zPpWKc1YCFcS9zO/jOP8Mba5/PNlqeRSUG+uEPsuWWf5KA8mT +jW0Vghsw4YfqGCv1xdVKOclUE0gtE8NsvMMz/R7FF7hTHWXEZxOI0VBx6mkXGfmtw+p XrAg== X-Gm-Message-State: AOJu0Yw8cWFKgPtx2tUWxDI/ni2Zyjdi7jNppf+yEshSglEr7OYxihuN vAxDP/ZpBHCEQ2FFiQgKhuMSXKjWONwKBLwYCoMaIeiGkvYyY2Kllx2Havj3zIaNcjph5haIxpc O+O1f9O0vGA== X-Gm-Gg: ATEYQzyNMXo0W9AhQZZQUS4qAw53UuXgws56nurNnJfXQa/Bfn9WtDvtWUKhYjSuTcJ 3l1a4nOT6cSsYaUyhdCY4H24YRLVOHW2+eZJHg8iAaM6naC7zXk0Qw2aFTHefsdcLEHGrEulPu+ VPjWV8ox9EL+EkQv8DwGQcJXwrLCE9f/QW5w5oTu2lAOfHFWS1YbYitmdVkuBTxPvgORLUHMqif BOKXl90Vi3WaZ2eKWruz5JbVja7FIIGSzsbwnjit/CBt+ylXcImYub+luamY229lZjkig+TOVHN IXt8q2MkyrjIuHGdjrDG5I35tpbhj9oGo9GS1uqZkn4dO1s7/sVvVpuCx3ogRYA8mbGSwN4aHDa kNfp/rklaVhqM0ksn6sqeO85LKvIsW0edg+PTsRTYGpLQ+r41fvoLlnQ5V4K6B5VrMLOcFFykiv s3a2lbFQfEAtaWNiod/RX1wadvUQ== X-Received: by 2002:a05:7022:6081:b0:128:dbbf:fd35 with SMTP id a92af1059eb24-128dbbffee6mr1751213c88.28.1773116708236; Mon, 09 Mar 2026 21:25:08 -0700 (PDT) Received: from mozart.vkv.me ([2001:5a8:468b:d015:eea6:1f6d:5163:10ae]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2be4f984cf5sm12925551eec.33.2026.03.09.21.25.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Mar 2026 21:25:07 -0700 (PDT) From: Calvin Owens To: linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Charlene Liu , Ovidiu Bunea , Alex Hung , Dan Wheeler , Alex Deucher , Harry Wentland , Leo Li , Rodrigo Siqueira , Christian Koenig , David Airlie , Simona Vetter , llvm@lists.linux.dev Subject: [REGRESSION][PATCH] drm/amd/display: Fix uninitialized variable which breaks full LTO Date: Mon, 9 Mar 2026 21:24:57 -0700 Message-ID: X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 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 --- 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