From 495b190480dc78ad2dd10f8b96dfb5747fa48c4d Mon Sep 17 00:00:00 2001 From: Srinivasan Shanmugam Date: Fri, 5 Dec 2025 16:48:50 +0530 Subject: [PATCH] drm/amdgpu/acpi: Reduce amdgpu_acpi_detect stack usage MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit amdgpu_acpi_detect() calls some helper functions it calls have large local structures. When the compiler inlines these helpers, their local data adds to the amdgpu_acpi_detect() stack frame. Mark the helpers with noinline_for_stack: - amdgpu_atif_verify_interface() - amdgpu_atif_get_notification_params() - amdgpu_atif_query_backlight_caps() - amdgpu_atcs_verify_interface() - amdgpu_acpi_enumerate_xcc() This keeps the large temporary objects inside the helper’s own stack frame instead of being inlined into the caller, preventing the caller from growing beyond the stack limit. Fixes the below with gcc W=1: drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:1403:6: warning: stack frame size (1688) exceeds limit (1024) in 'amdgpu_acpi_detect' [-Wframe-larger-than] Cc: Alex Deucher Cc: Christian König Signed-off-by: Srinivasan Shanmugam Acked-by: Alex Deucher Signed-off-by: Alex Deucher --- drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c index 14de162b46997..ec91c4aa84dd9 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c @@ -241,7 +241,8 @@ static void amdgpu_atif_parse_functions(struct amdgpu_atif_functions *f, u32 mas * (all asics). * returns 0 on success, error on failure. */ -static int amdgpu_atif_verify_interface(struct amdgpu_atif *atif) +static noinline_for_stack +int amdgpu_atif_verify_interface(struct amdgpu_atif *atif) { union acpi_object *info; struct atif_verify_interface output; @@ -286,7 +287,8 @@ out: * where n is specified in the result if a notifier is used. * Returns 0 on success, error on failure. */ -static int amdgpu_atif_get_notification_params(struct amdgpu_atif *atif) +static noinline_for_stack +int amdgpu_atif_get_notification_params(struct amdgpu_atif *atif) { union acpi_object *info; struct amdgpu_atif_notification_cfg *n = &atif->notification_cfg; @@ -354,7 +356,8 @@ out: * * Returns 0 on success, error on failure. */ -static int amdgpu_atif_query_backlight_caps(struct amdgpu_atif *atif) +static noinline_for_stack +int amdgpu_atif_query_backlight_caps(struct amdgpu_atif *atif) { union acpi_object *info; struct atif_qbtc_output characteristics; @@ -600,7 +603,8 @@ static void amdgpu_atcs_parse_functions(struct amdgpu_atcs_functions *f, u32 mas * (all asics). * returns 0 on success, error on failure. */ -static int amdgpu_atcs_verify_interface(struct amdgpu_atcs *atcs) +static noinline_for_stack +int amdgpu_atcs_verify_interface(struct amdgpu_atcs *atcs) { union acpi_object *info; struct atcs_verify_interface output; @@ -1089,7 +1093,8 @@ out: return ret; } -static int amdgpu_acpi_enumerate_xcc(void) +static noinline_for_stack +int amdgpu_acpi_enumerate_xcc(void) { struct amdgpu_acpi_dev_info *dev_info = NULL; struct amdgpu_acpi_xcc_info *xcc_info; -- 2.47.3