[PATCH] drm/amd/display: Explicitly set stack size to 4

Kazlauskas, Nicholas nicholas.kazlauskas at amd.com
Tue Jul 21 16:01:08 UTC 2020


On 2020-07-21 11:38 a.m., Kent Russell wrote:
> In certain kernels using GCC 8.2, we get compilation errors saying:
> -mpreferred-stack-boundary=3 is not between 4 and 12
> Explicitly set -mpreferred-stack-boundary=4 in the Display Makefiles,
> even when SSE2 is enabled
> 
> Change-Id: Ic7c4637e2e521af2d0444d3b5886f710131c80ca
> Signed-off-by: Kent Russell <kent.russell at amd.com>

Seems reasonable to me. I'd imagine we want this anyway since SIMD 
generally wants to be 16-byte aligned anyway and this code has FP in it.

Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas at amd.com>

Regards,
Nicholas Kazlauskas

> ---
>   drivers/gpu/drm/amd/display/dc/calcs/Makefile | 8 ++++----
>   drivers/gpu/drm/amd/display/dc/dcn20/Makefile | 8 ++++----
>   drivers/gpu/drm/amd/display/dc/dcn21/Makefile | 8 ++++----
>   drivers/gpu/drm/amd/display/dc/dcn30/Makefile | 8 ++++----
>   drivers/gpu/drm/amd/display/dc/dml/Makefile   | 9 +++++----
>   drivers/gpu/drm/amd/display/dc/dsc/Makefile   | 8 ++++----
>   6 files changed, 25 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/dc/calcs/Makefile b/drivers/gpu/drm/amd/display/dc/calcs/Makefile
> index 4674aca8f206..5c519cec9039 100644
> --- a/drivers/gpu/drm/amd/display/dc/calcs/Makefile
> +++ b/drivers/gpu/drm/amd/display/dc/calcs/Makefile
> @@ -26,7 +26,9 @@
>   #
>   
>   ifdef CONFIG_X86
> -calcs_ccflags := -mhard-float -msse
> +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it
> +# to 4, even if we enable SSE2
> +calcs_ccflags := -mhard-float -msse -mpreferred-stack-boundary=4
>   endif
>   
>   ifdef CONFIG_PPC64
> @@ -40,12 +42,10 @@ endif
>   endif
>   
>   ifdef CONFIG_X86
> -ifdef IS_OLD_GCC
> +ifndef IS_OLD_GCC
>   # Stack alignment mismatch, proceed with caution.
>   # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
>   # (8B stack alignment).
> -calcs_ccflags += -mpreferred-stack-boundary=4
> -else
>   calcs_ccflags += -msse2
>   endif
>   endif
> diff --git a/drivers/gpu/drm/amd/display/dc/dcn20/Makefile b/drivers/gpu/drm/amd/display/dc/dcn20/Makefile
> index 5fcaf78334ff..78d3e0563a4c 100644
> --- a/drivers/gpu/drm/amd/display/dc/dcn20/Makefile
> +++ b/drivers/gpu/drm/amd/display/dc/dcn20/Makefile
> @@ -10,7 +10,9 @@ DCN20 = dcn20_resource.o dcn20_init.o dcn20_hwseq.o dcn20_dpp.o dcn20_dpp_cm.o d
>   DCN20 += dcn20_dsc.o
>   
>   ifdef CONFIG_X86
> -CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o := -mhard-float -msse
> +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it
> +# to 4, even if we enable SSE2
> +CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o := -mhard-float -msse -mpreferred-stack-boundary=4
>   endif
>   
>   ifdef CONFIG_PPC64
> @@ -24,12 +26,10 @@ endif
>   endif
>   
>   ifdef CONFIG_X86
> -ifdef IS_OLD_GCC
> +ifndef IS_OLD_GCC
>   # Stack alignment mismatch, proceed with caution.
>   # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
>   # (8B stack alignment).
> -CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o += -mpreferred-stack-boundary=4
> -else
>   CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o += -msse2
>   endif
>   endif
> diff --git a/drivers/gpu/drm/amd/display/dc/dcn21/Makefile b/drivers/gpu/drm/amd/display/dc/dcn21/Makefile
> index 07684d3e375a..6183e8f141bb 100644
> --- a/drivers/gpu/drm/amd/display/dc/dcn21/Makefile
> +++ b/drivers/gpu/drm/amd/display/dc/dcn21/Makefile
> @@ -6,7 +6,9 @@ DCN21 = dcn21_init.o dcn21_hubp.o dcn21_hubbub.o dcn21_resource.o \
>   	 dcn21_hwseq.o dcn21_link_encoder.o
>   
>   ifdef CONFIG_X86
> -CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o := -mhard-float -msse
> +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it
> +# to 4, even if we enable SSE2
> +CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o := -mhard-float -msse -mpreferred-stack-boundary=4
>   endif
>   
>   ifdef CONFIG_PPC64
> @@ -20,12 +22,10 @@ endif
>   endif
>   
>   ifdef CONFIG_X86
> -ifdef IS_OLD_GCC
> +ifndef IS_OLD_GCC
>   # Stack alignment mismatch, proceed with caution.
>   # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
>   # (8B stack alignment).
> -CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o += -mpreferred-stack-boundary=4
> -else
>   CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o += -msse2
>   endif
>   endif
> diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/Makefile b/drivers/gpu/drm/amd/display/dc/dcn30/Makefile
> index 025637a83c3b..0d803486e051 100644
> --- a/drivers/gpu/drm/amd/display/dc/dcn30/Makefile
> +++ b/drivers/gpu/drm/amd/display/dc/dcn30/Makefile
> @@ -33,19 +33,19 @@ DCN30 = dcn30_init.o dcn30_hubbub.o dcn30_hubp.o dcn30_dpp.o dcn30_optc.o \
>   
>   CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_optc.o := -mhard-float -msse -mpreferred-stack-boundary=4
>   
> -CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o := -mhard-float -msse
> +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it
> +# to 4, even if we enable SSE2
> +CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o := -mhard-float -msse -mpreferred-stack-boundary=4
>   ifdef CONFIG_CC_IS_GCC
>   ifeq ($(call cc-ifversion, -lt, 0701, y), y)
>   IS_OLD_GCC = 1
>   endif
>   endif
>   
> -ifdef IS_OLD_GCC
> +ifndef IS_OLD_GCC
>   # Stack alignment mismatch, proceed with caution.
>   # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
>   # (8B stack alignment).
> -CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o += -mpreferred-stack-boundary=4
> -else
>   CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o += -msse2
>   endif
>   
> diff --git a/drivers/gpu/drm/amd/display/dc/dml/Makefile b/drivers/gpu/drm/amd/display/dc/dml/Makefile
> index 417331438c30..fc5e304c4dac 100644
> --- a/drivers/gpu/drm/amd/display/dc/dml/Makefile
> +++ b/drivers/gpu/drm/amd/display/dc/dml/Makefile
> @@ -25,8 +25,11 @@
>   # It provides the general basic services required by other DAL
>   # subcomponents.
>   
> +
>   ifdef CONFIG_X86
> -dml_ccflags := -mhard-float -msse
> +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it
> +# to 4, even if we enable SSE2
> +dml_ccflags := -mhard-float -msse -mpreferred-stack-boundary=4
>   endif
>   
>   ifdef CONFIG_PPC64
> @@ -40,12 +43,10 @@ endif
>   endif
>   
>   ifdef CONFIG_X86
> -ifdef IS_OLD_GCC
> +ifndef IS_OLD_GCC
>   # Stack alignment mismatch, proceed with caution.
>   # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
>   # (8B stack alignment).
> -dml_ccflags += -mpreferred-stack-boundary=4
> -else
>   dml_ccflags += -msse2
>   endif
>   endif
> diff --git a/drivers/gpu/drm/amd/display/dc/dsc/Makefile b/drivers/gpu/drm/amd/display/dc/dsc/Makefile
> index ea29cf95d470..98695c66eaf1 100644
> --- a/drivers/gpu/drm/amd/display/dc/dsc/Makefile
> +++ b/drivers/gpu/drm/amd/display/dc/dsc/Makefile
> @@ -3,7 +3,9 @@
>   # Makefile for the 'dsc' sub-component of DAL.
>   
>   ifdef CONFIG_X86
> -dsc_ccflags := -mhard-float -msse
> +# Certain kernels don't compile with -mpreferred-stack-boundary=3, so explicitly set it
> +# to 4, even if we enable SSE2
> +dsc_ccflags := -mhard-float -msse -mpreferred-stack-boundary=4
>   endif
>   
>   ifdef CONFIG_PPC64
> @@ -17,12 +19,10 @@ endif
>   endif
>   
>   ifdef CONFIG_X86
> -ifdef IS_OLD_GCC
> +ifndef IS_OLD_GCC
>   # Stack alignment mismatch, proceed with caution.
>   # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
>   # (8B stack alignment).
> -dsc_ccflags += -mpreferred-stack-boundary=4
> -else
>   dsc_ccflags += -msse2
>   endif
>   endif
> 



More information about the amd-gfx mailing list