Commit 16a9dea1 authored by Timothy Pearson's avatar Timothy Pearson Committed by Alex Deucher

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: default avatarTimothy Pearson <tpearson@raptorengineering.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 6ca3928d
...@@ -6,7 +6,7 @@ config DRM_AMD_DC ...@@ -6,7 +6,7 @@ config DRM_AMD_DC
bool "AMD DC - Enable new display engine" bool "AMD DC - Enable new display engine"
default y default y
select SND_HDA_COMPONENT if SND_HDA_CORE select SND_HDA_COMPONENT if SND_HDA_CORE
select DRM_AMD_DC_DCN if X86 && !(KCOV_INSTRUMENT_ALL && KCOV_ENABLE_COMPARISONS) select DRM_AMD_DC_DCN if (X86 || PPC64) && !(KCOV_INSTRUMENT_ALL && KCOV_ENABLE_COMPARISONS)
help help
Choose this option if you want to use the new display engine Choose this option if you want to use the new display engine
support for AMDGPU. This adds required support for Vega and support for AMDGPU. This adds required support for Vega and
......
# #
# Copyright 2017 Advanced Micro Devices, Inc. # Copyright 2017 Advanced Micro Devices, Inc.
# Copyright 2019 Raptor Engineering, LLC
# #
# Permission is hereby granted, free of charge, to any person obtaining a # Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"), # copy of this software and associated documentation files (the "Software"),
...@@ -24,7 +25,13 @@ ...@@ -24,7 +25,13 @@
# It calculates Bandwidth and Watermarks values for HW programming # It calculates Bandwidth and Watermarks values for HW programming
# #
ifdef CONFIG_X86
calcs_ccflags := -mhard-float -msse calcs_ccflags := -mhard-float -msse
endif
ifdef CONFIG_PPC64
calcs_ccflags := -mhard-float -maltivec
endif
ifdef CONFIG_CC_IS_GCC ifdef CONFIG_CC_IS_GCC
ifeq ($(call cc-ifversion, -lt, 0701, y), y) ifeq ($(call cc-ifversion, -lt, 0701, y), y)
...@@ -32,6 +39,7 @@ IS_OLD_GCC = 1 ...@@ -32,6 +39,7 @@ IS_OLD_GCC = 1
endif endif
endif endif
ifdef CONFIG_X86
ifdef IS_OLD_GCC ifdef IS_OLD_GCC
# Stack alignment mismatch, proceed with caution. # Stack alignment mismatch, proceed with caution.
# GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3 # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
...@@ -40,6 +48,7 @@ calcs_ccflags += -mpreferred-stack-boundary=4 ...@@ -40,6 +48,7 @@ calcs_ccflags += -mpreferred-stack-boundary=4
else else
calcs_ccflags += -msse2 calcs_ccflags += -msse2
endif endif
endif
CFLAGS_$(AMDDALPATH)/dc/calcs/dcn_calcs.o := $(calcs_ccflags) CFLAGS_$(AMDDALPATH)/dc/calcs/dcn_calcs.o := $(calcs_ccflags)
CFLAGS_$(AMDDALPATH)/dc/calcs/dcn_calc_auto.o := $(calcs_ccflags) CFLAGS_$(AMDDALPATH)/dc/calcs/dcn_calc_auto.o := $(calcs_ccflags)
......
/* /*
* Copyright 2017 Advanced Micro Devices, Inc. * Copyright 2017 Advanced Micro Devices, Inc.
* Copyright 2019 Raptor Engineering, LLC
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
......
...@@ -9,7 +9,13 @@ DCN20 = dcn20_resource.o dcn20_init.o dcn20_hwseq.o dcn20_dpp.o dcn20_dpp_cm.o d ...@@ -9,7 +9,13 @@ DCN20 = dcn20_resource.o dcn20_init.o dcn20_hwseq.o dcn20_dpp.o dcn20_dpp_cm.o d
DCN20 += dcn20_dsc.o DCN20 += dcn20_dsc.o
ifdef CONFIG_X86
CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o := -mhard-float -msse CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o := -mhard-float -msse
endif
ifdef CONFIG_PPC64
CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o := -mhard-float -maltivec
endif
ifdef CONFIG_CC_IS_GCC ifdef CONFIG_CC_IS_GCC
ifeq ($(call cc-ifversion, -lt, 0701, y), y) ifeq ($(call cc-ifversion, -lt, 0701, y), y)
...@@ -17,6 +23,7 @@ IS_OLD_GCC = 1 ...@@ -17,6 +23,7 @@ IS_OLD_GCC = 1
endif endif
endif endif
ifdef CONFIG_X86
ifdef IS_OLD_GCC ifdef IS_OLD_GCC
# Stack alignment mismatch, proceed with caution. # Stack alignment mismatch, proceed with caution.
# GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3 # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
...@@ -25,6 +32,7 @@ CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o += -mpreferred-stack-boundary=4 ...@@ -25,6 +32,7 @@ CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o += -mpreferred-stack-boundary=4
else else
CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o += -msse2 CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o += -msse2
endif endif
endif
AMD_DAL_DCN20 = $(addprefix $(AMDDALPATH)/dc/dcn20/,$(DCN20)) AMD_DAL_DCN20 = $(addprefix $(AMDDALPATH)/dc/dcn20/,$(DCN20))
......
...@@ -5,7 +5,13 @@ ...@@ -5,7 +5,13 @@
DCN21 = dcn21_init.o dcn21_hubp.o dcn21_hubbub.o dcn21_resource.o \ DCN21 = dcn21_init.o dcn21_hubp.o dcn21_hubbub.o dcn21_resource.o \
dcn21_hwseq.o dcn21_link_encoder.o dcn21_hwseq.o dcn21_link_encoder.o
ifdef CONFIG_X86
CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o := -mhard-float -msse CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o := -mhard-float -msse
endif
ifdef CONFIG_PPC64
CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o := -mhard-float -maltivec
endif
ifdef CONFIG_CC_IS_GCC ifdef CONFIG_CC_IS_GCC
ifeq ($(call cc-ifversion, -lt, 0701, y), y) ifeq ($(call cc-ifversion, -lt, 0701, y), y)
...@@ -13,6 +19,7 @@ IS_OLD_GCC = 1 ...@@ -13,6 +19,7 @@ IS_OLD_GCC = 1
endif endif
endif endif
ifdef CONFIG_X86
ifdef IS_OLD_GCC ifdef IS_OLD_GCC
# Stack alignment mismatch, proceed with caution. # Stack alignment mismatch, proceed with caution.
# GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3 # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
...@@ -21,6 +28,7 @@ CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o += -mpreferred-stack-boundary=4 ...@@ -21,6 +28,7 @@ CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o += -mpreferred-stack-boundary=4
else else
CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o += -msse2 CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o += -msse2
endif endif
endif
AMD_DAL_DCN21 = $(addprefix $(AMDDALPATH)/dc/dcn21/,$(DCN21)) AMD_DAL_DCN21 = $(addprefix $(AMDDALPATH)/dc/dcn21/,$(DCN21))
......
# #
# Copyright 2017 Advanced Micro Devices, Inc. # Copyright 2017 Advanced Micro Devices, Inc.
# Copyright 2019 Raptor Engineering, LLC
# #
# Permission is hereby granted, free of charge, to any person obtaining a # Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"), # copy of this software and associated documentation files (the "Software"),
...@@ -24,7 +25,13 @@ ...@@ -24,7 +25,13 @@
# It provides the general basic services required by other DAL # It provides the general basic services required by other DAL
# subcomponents. # subcomponents.
ifdef CONFIG_X86
dml_ccflags := -mhard-float -msse dml_ccflags := -mhard-float -msse
endif
ifdef CONFIG_PPC64
dml_ccflags := -mhard-float -maltivec
endif
ifdef CONFIG_CC_IS_GCC ifdef CONFIG_CC_IS_GCC
ifeq ($(call cc-ifversion, -lt, 0701, y), y) ifeq ($(call cc-ifversion, -lt, 0701, y), y)
...@@ -32,6 +39,7 @@ IS_OLD_GCC = 1 ...@@ -32,6 +39,7 @@ IS_OLD_GCC = 1
endif endif
endif endif
ifdef CONFIG_X86
ifdef IS_OLD_GCC ifdef IS_OLD_GCC
# Stack alignment mismatch, proceed with caution. # Stack alignment mismatch, proceed with caution.
# GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3 # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
...@@ -40,6 +48,7 @@ dml_ccflags += -mpreferred-stack-boundary=4 ...@@ -40,6 +48,7 @@ dml_ccflags += -mpreferred-stack-boundary=4
else else
dml_ccflags += -msse2 dml_ccflags += -msse2
endif endif
endif
CFLAGS_$(AMDDALPATH)/dc/dml/display_mode_lib.o := $(dml_ccflags) CFLAGS_$(AMDDALPATH)/dc/dml/display_mode_lib.o := $(dml_ccflags)
......
...@@ -2,7 +2,13 @@ ...@@ -2,7 +2,13 @@
# #
# Makefile for the 'dsc' sub-component of DAL. # Makefile for the 'dsc' sub-component of DAL.
ifdef CONFIG_X86
dsc_ccflags := -mhard-float -msse dsc_ccflags := -mhard-float -msse
endif
ifdef CONFIG_PPC64
dsc_ccflags := -mhard-float -maltivec
endif
ifdef CONFIG_CC_IS_GCC ifdef CONFIG_CC_IS_GCC
ifeq ($(call cc-ifversion, -lt, 0701, y), y) ifeq ($(call cc-ifversion, -lt, 0701, y), y)
...@@ -10,6 +16,7 @@ IS_OLD_GCC = 1 ...@@ -10,6 +16,7 @@ IS_OLD_GCC = 1
endif endif
endif endif
ifdef CONFIG_X86
ifdef IS_OLD_GCC ifdef IS_OLD_GCC
# Stack alignment mismatch, proceed with caution. # Stack alignment mismatch, proceed with caution.
# GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3 # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
...@@ -18,6 +25,7 @@ dsc_ccflags += -mpreferred-stack-boundary=4 ...@@ -18,6 +25,7 @@ dsc_ccflags += -mpreferred-stack-boundary=4
else else
dsc_ccflags += -msse2 dsc_ccflags += -msse2
endif endif
endif
CFLAGS_$(AMDDALPATH)/dc/dsc/rc_calc.o := $(dsc_ccflags) CFLAGS_$(AMDDALPATH)/dc/dsc/rc_calc.o := $(dsc_ccflags)
CFLAGS_$(AMDDALPATH)/dc/dsc/rc_calc_dpi.o := $(dsc_ccflags) CFLAGS_$(AMDDALPATH)/dc/dsc/rc_calc_dpi.o := $(dsc_ccflags)
......
...@@ -51,9 +51,38 @@ ...@@ -51,9 +51,38 @@
#define dm_error(fmt, ...) DRM_ERROR(fmt, ##__VA_ARGS__) #define dm_error(fmt, ...) DRM_ERROR(fmt, ##__VA_ARGS__)
#if defined(CONFIG_DRM_AMD_DC_DCN) #if defined(CONFIG_DRM_AMD_DC_DCN)
#if defined(CONFIG_X86)
#include <asm/fpu/api.h> #include <asm/fpu/api.h>
#define DC_FP_START() kernel_fpu_begin() #define DC_FP_START() kernel_fpu_begin()
#define DC_FP_END() kernel_fpu_end() #define DC_FP_END() kernel_fpu_end()
#elif defined(CONFIG_PPC64)
#include <asm/switch_to.h>
#include <asm/cputable.h>
#define DC_FP_START() { \
if (cpu_has_feature(CPU_FTR_VSX_COMP)) { \
preempt_disable(); \
enable_kernel_vsx(); \
} else if (cpu_has_feature(CPU_FTR_ALTIVEC_COMP)) { \
preempt_disable(); \
enable_kernel_altivec(); \
} else if (!cpu_has_feature(CPU_FTR_FPU_UNAVAILABLE)) { \
preempt_disable(); \
enable_kernel_fp(); \
} \
}
#define DC_FP_END() { \
if (cpu_has_feature(CPU_FTR_VSX_COMP)) { \
disable_kernel_vsx(); \
preempt_enable(); \
} else if (cpu_has_feature(CPU_FTR_ALTIVEC_COMP)) { \
disable_kernel_altivec(); \
preempt_enable(); \
} else if (!cpu_has_feature(CPU_FTR_FPU_UNAVAILABLE)) { \
disable_kernel_fp(); \
preempt_enable(); \
} \
}
#endif
#endif #endif
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment