Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

amdgpu: Enable initial DCN support on POWER

DCN requires floating point support to operate. Add the appropriate
x86/ppc64 guards and FPU / AltiVec / VSX context switches to DCN.

Note that the current DC20 code doesn't contain all required FPU
wrappers on x86 or POWER, so this patch is insufficient to fully
enable DC20 on POWER.

v2: s/X86_64/X86/g to retain previous behavior.

Signed-off-by: Timothy Pearson <tpearson@raptorengineering.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Timothy Pearson and committed by
Alex Deucher
16a9dea1 6ca3928d

+73 -1
+1 -1
drivers/gpu/drm/amd/display/Kconfig
··· 6 6 bool "AMD DC - Enable new display engine" 7 7 default y 8 8 select SND_HDA_COMPONENT if SND_HDA_CORE 9 - select DRM_AMD_DC_DCN if X86 && !(KCOV_INSTRUMENT_ALL && KCOV_ENABLE_COMPARISONS) 9 + select DRM_AMD_DC_DCN if (X86 || PPC64) && !(KCOV_INSTRUMENT_ALL && KCOV_ENABLE_COMPARISONS) 10 10 help 11 11 Choose this option if you want to use the new display engine 12 12 support for AMDGPU. This adds required support for Vega and
+9
drivers/gpu/drm/amd/display/dc/calcs/Makefile
··· 1 1 # 2 2 # Copyright 2017 Advanced Micro Devices, Inc. 3 + # Copyright 2019 Raptor Engineering, LLC 3 4 # 4 5 # Permission is hereby granted, free of charge, to any person obtaining a 5 6 # copy of this software and associated documentation files (the "Software"), ··· 25 24 # It calculates Bandwidth and Watermarks values for HW programming 26 25 # 27 26 27 + ifdef CONFIG_X86 28 28 calcs_ccflags := -mhard-float -msse 29 + endif 30 + 31 + ifdef CONFIG_PPC64 32 + calcs_ccflags := -mhard-float -maltivec 33 + endif 29 34 30 35 ifdef CONFIG_CC_IS_GCC 31 36 ifeq ($(call cc-ifversion, -lt, 0701, y), y) ··· 39 32 endif 40 33 endif 41 34 35 + ifdef CONFIG_X86 42 36 ifdef IS_OLD_GCC 43 37 # Stack alignment mismatch, proceed with caution. 44 38 # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3 ··· 47 39 calcs_ccflags += -mpreferred-stack-boundary=4 48 40 else 49 41 calcs_ccflags += -msse2 42 + endif 50 43 endif 51 44 52 45 CFLAGS_$(AMDDALPATH)/dc/calcs/dcn_calcs.o := $(calcs_ccflags)
+1
drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c
··· 1 1 /* 2 2 * Copyright 2017 Advanced Micro Devices, Inc. 3 + * Copyright 2019 Raptor Engineering, LLC 3 4 * 4 5 * Permission is hereby granted, free of charge, to any person obtaining a 5 6 * copy of this software and associated documentation files (the "Software"),
+8
drivers/gpu/drm/amd/display/dc/dcn20/Makefile
··· 9 9 10 10 DCN20 += dcn20_dsc.o 11 11 12 + ifdef CONFIG_X86 12 13 CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o := -mhard-float -msse 14 + endif 15 + 16 + ifdef CONFIG_PPC64 17 + CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o := -mhard-float -maltivec 18 + endif 13 19 14 20 ifdef CONFIG_CC_IS_GCC 15 21 ifeq ($(call cc-ifversion, -lt, 0701, y), y) ··· 23 17 endif 24 18 endif 25 19 20 + ifdef CONFIG_X86 26 21 ifdef IS_OLD_GCC 27 22 # Stack alignment mismatch, proceed with caution. 28 23 # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3 ··· 31 24 CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o += -mpreferred-stack-boundary=4 32 25 else 33 26 CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o += -msse2 27 + endif 34 28 endif 35 29 36 30 AMD_DAL_DCN20 = $(addprefix $(AMDDALPATH)/dc/dcn20/,$(DCN20))
+8
drivers/gpu/drm/amd/display/dc/dcn21/Makefile
··· 5 5 DCN21 = dcn21_init.o dcn21_hubp.o dcn21_hubbub.o dcn21_resource.o \ 6 6 dcn21_hwseq.o dcn21_link_encoder.o 7 7 8 + ifdef CONFIG_X86 8 9 CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o := -mhard-float -msse 10 + endif 11 + 12 + ifdef CONFIG_PPC64 13 + CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o := -mhard-float -maltivec 14 + endif 9 15 10 16 ifdef CONFIG_CC_IS_GCC 11 17 ifeq ($(call cc-ifversion, -lt, 0701, y), y) ··· 19 13 endif 20 14 endif 21 15 16 + ifdef CONFIG_X86 22 17 ifdef IS_OLD_GCC 23 18 # Stack alignment mismatch, proceed with caution. 24 19 # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3 ··· 27 20 CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o += -mpreferred-stack-boundary=4 28 21 else 29 22 CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o += -msse2 23 + endif 30 24 endif 31 25 32 26 AMD_DAL_DCN21 = $(addprefix $(AMDDALPATH)/dc/dcn21/,$(DCN21))
+9
drivers/gpu/drm/amd/display/dc/dml/Makefile
··· 1 1 # 2 2 # Copyright 2017 Advanced Micro Devices, Inc. 3 + # Copyright 2019 Raptor Engineering, LLC 3 4 # 4 5 # Permission is hereby granted, free of charge, to any person obtaining a 5 6 # copy of this software and associated documentation files (the "Software"), ··· 25 24 # It provides the general basic services required by other DAL 26 25 # subcomponents. 27 26 27 + ifdef CONFIG_X86 28 28 dml_ccflags := -mhard-float -msse 29 + endif 30 + 31 + ifdef CONFIG_PPC64 32 + dml_ccflags := -mhard-float -maltivec 33 + endif 29 34 30 35 ifdef CONFIG_CC_IS_GCC 31 36 ifeq ($(call cc-ifversion, -lt, 0701, y), y) ··· 39 32 endif 40 33 endif 41 34 35 + ifdef CONFIG_X86 42 36 ifdef IS_OLD_GCC 43 37 # Stack alignment mismatch, proceed with caution. 44 38 # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3 ··· 47 39 dml_ccflags += -mpreferred-stack-boundary=4 48 40 else 49 41 dml_ccflags += -msse2 42 + endif 50 43 endif 51 44 52 45 CFLAGS_$(AMDDALPATH)/dc/dml/display_mode_lib.o := $(dml_ccflags)
+8
drivers/gpu/drm/amd/display/dc/dsc/Makefile
··· 2 2 # 3 3 # Makefile for the 'dsc' sub-component of DAL. 4 4 5 + ifdef CONFIG_X86 5 6 dsc_ccflags := -mhard-float -msse 7 + endif 8 + 9 + ifdef CONFIG_PPC64 10 + dsc_ccflags := -mhard-float -maltivec 11 + endif 6 12 7 13 ifdef CONFIG_CC_IS_GCC 8 14 ifeq ($(call cc-ifversion, -lt, 0701, y), y) ··· 16 10 endif 17 11 endif 18 12 13 + ifdef CONFIG_X86 19 14 ifdef IS_OLD_GCC 20 15 # Stack alignment mismatch, proceed with caution. 21 16 # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3 ··· 24 17 dsc_ccflags += -mpreferred-stack-boundary=4 25 18 else 26 19 dsc_ccflags += -msse2 20 + endif 27 21 endif 28 22 29 23 CFLAGS_$(AMDDALPATH)/dc/dsc/rc_calc.o := $(dsc_ccflags)
+29
drivers/gpu/drm/amd/display/dc/os_types.h
··· 51 51 #define dm_error(fmt, ...) DRM_ERROR(fmt, ##__VA_ARGS__) 52 52 53 53 #if defined(CONFIG_DRM_AMD_DC_DCN) 54 + #if defined(CONFIG_X86) 54 55 #include <asm/fpu/api.h> 55 56 #define DC_FP_START() kernel_fpu_begin() 56 57 #define DC_FP_END() kernel_fpu_end() 58 + #elif defined(CONFIG_PPC64) 59 + #include <asm/switch_to.h> 60 + #include <asm/cputable.h> 61 + #define DC_FP_START() { \ 62 + if (cpu_has_feature(CPU_FTR_VSX_COMP)) { \ 63 + preempt_disable(); \ 64 + enable_kernel_vsx(); \ 65 + } else if (cpu_has_feature(CPU_FTR_ALTIVEC_COMP)) { \ 66 + preempt_disable(); \ 67 + enable_kernel_altivec(); \ 68 + } else if (!cpu_has_feature(CPU_FTR_FPU_UNAVAILABLE)) { \ 69 + preempt_disable(); \ 70 + enable_kernel_fp(); \ 71 + } \ 72 + } 73 + #define DC_FP_END() { \ 74 + if (cpu_has_feature(CPU_FTR_VSX_COMP)) { \ 75 + disable_kernel_vsx(); \ 76 + preempt_enable(); \ 77 + } else if (cpu_has_feature(CPU_FTR_ALTIVEC_COMP)) { \ 78 + disable_kernel_altivec(); \ 79 + preempt_enable(); \ 80 + } else if (!cpu_has_feature(CPU_FTR_FPU_UNAVAILABLE)) { \ 81 + disable_kernel_fp(); \ 82 + preempt_enable(); \ 83 + } \ 84 + } 85 + #endif 57 86 #endif 58 87 59 88 /*