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 97F69106ACCD for ; Thu, 12 Mar 2026 17:13:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B002610E105; Thu, 12 Mar 2026 17:13:39 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; secure) header.d=wbinvd.org header.i=@wbinvd.org header.b="CzTEz6iN"; dkim-atps=neutral Received: from mail-dl1-f47.google.com (mail-dl1-f47.google.com [74.125.82.47]) by gabe.freedesktop.org (Postfix) with ESMTPS id 496D810E105 for ; Thu, 12 Mar 2026 17:13:38 +0000 (UTC) Received: by mail-dl1-f47.google.com with SMTP id a92af1059eb24-12732e6a123so128464c88.1 for ; Thu, 12 Mar 2026 10:13:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wbinvd.org; s=wbinvd; t=1773335617; x=1773940417; darn=lists.freedesktop.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=P2G1AlBOtI0pVNQJ415mQN+VxqBlOoCSVpFjY0Duwoo=; b=CzTEz6iNgR4+UeF4zGvZBnFkWDA4goliYp1MeBontdJ+rK7kErUfGJPGnDPQ5xoo3L nPDgZMngmQlpoVgKq1uxqLWekIv1EQ4+WWIASbIC2h/4V2qDWY9eoYQ2dlsyAsHPZATp beO3lYkppahbX5D7xRIeNiXDMo8Rx7bAdhzkQIAHjUHiwqjnaDLFECDJUCD25QwPPrT3 NzKt578DgZeq2wBWK32fBNWBNEj01pW0OvI6iVHyh+cT+bvzcgR+87o/b7oYmYvr1fXa X3JFn9lUVLs6oRQ1MzztulbWJGSz4jEC0i7QLzUK8ncn2U4idAyB+lg+cHf8e0Ni2wzu a0/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773335617; x=1773940417; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=P2G1AlBOtI0pVNQJ415mQN+VxqBlOoCSVpFjY0Duwoo=; b=hlLRVlIhJFQWvzTVoqikPQto9lfqSV9iBMT6fq3cRlb8Hx3xWDk5VS3N2l3Y/TW3HL s2Lp4pspsnZgvSBpbulY7qsdV8jj49OELc+Byj7Y7/SF/V6MqUyOp41BQ2T1fMRYHu91 Mk9LCQE5pvxCG9c8kClkz0+Ke/s7a+C/plVCc5RevrfZTPrXKkIffdwKe4Dj9jfyudlr sTSi5R4ObBeNkeVYMTfvi7NCrYmj+OkvRGb9BwWt1jClyFI0jCMl7k+OddwCn3MIkK3m B2gVpZ6pN9Eopu04aFRVENSXU4EiGDglEEdJlPadNw88TECeEFecfCTiSvP6uVwuldQ+ 1dAg== X-Gm-Message-State: AOJu0YwIDa4uzQeH7gl+VfMfHS3Tvp0BOPt8mkho/ogCA+mK9q4xZ8N+ NdX3tdafZcmQV9zk5H9bPIsdMhIoj45pjlS+bXJ2r4zMA3dV6yR2PIntxjwSc+jEwEc= X-Gm-Gg: ATEYQzwuMOhGNiCIzX0AvFcBdZFSuhbFqGKm79uozI1wcZKswzf4W258+3vlMs8Nk6Q nF236H1b7L58AHPwQLXpv+Ih0QERAeiRPD8WIC3IsUCaEG5YsjiNDEZukInRqfoDkvWIdShN1mu 8mqsaBW6NLWUa6AjAoqER8Vvx+TDW0oYv5KmvK+wJnpQE8P4GBjjxMAE7fx2RuFDBsXMJWOvFo/ zYF8uOdwTNcQVfcXBNeEGWF8CMcKY6uYIYHMNOzP+IMtZCf0HZTYDyeRq0UfGMp95A2F6zM1gYG aprp4Ca00biOXFA9eS9z7gRfJ1vhh29pj5bw9yiFR7rvsTglAuK+RozqUBGz5zkRyZT7MVUS10p AojfDKkTFxix9TU3z+ZiVMO9DYTOwck0RVPJR3a5CERF4hv6UqWZhxB8+a/2YUfY8HRC4TGK0iU 60/CAqAbKcuyP33iLvj1FwJqx0 X-Received: by 2002:a05:7022:4397:b0:127:345c:439c with SMTP id a92af1059eb24-128f3e29d9dmr154759c88.45.1773335617192; Thu, 12 Mar 2026 10:13:37 -0700 (PDT) Received: from mozart.vkv.me ([2001:5a8:468b:d015:b160:d8b0:a73a:3f1]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-128e7ce52aasm9466780c88.15.2026.03.12.10.13.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Mar 2026 10:13:36 -0700 (PDT) Date: Thu, 12 Mar 2026 10:13:34 -0700 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: [PATCH v2] drm/amd/display: Fix uninitialized variable use which breaks full LTO Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: 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 bss_data_size field from fw_meta_info_params, as was presumably intended. Fixes: e1b385726f7f ("drm/amd/display: Add additional checks for PSP footer size") Signed-off-by: Calvin Owens --- Changes in v2: * Use fw_meta_info_params.bss_data_size instead of repeating the load from the payload header field [Nathan] 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..0d1c772ef713 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -2553,9 +2553,9 @@ static int dm_dmub_sw_init(struct amdgpu_device *adev) fw_meta_info_params.bss_data_size = le32_to_cpu(hdr->bss_data_bytes); 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 = fw_meta_info_params.bss_data_size ? 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