Skip to content

Commit 16a9dea

Browse files
madscientist159alexdeucher
authored andcommitted
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>
1 parent 6ca3928 commit 16a9dea

File tree

8 files changed

+73
-1
lines changed

8 files changed

+73
-1
lines changed

drivers/gpu/drm/amd/display/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ config DRM_AMD_DC
66
bool "AMD DC - Enable new display engine"
77
default y
88
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)
1010
help
1111
Choose this option if you want to use the new display engine
1212
support for AMDGPU. This adds required support for Vega and

drivers/gpu/drm/amd/display/dc/calcs/Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#
22
# Copyright 2017 Advanced Micro Devices, Inc.
3+
# Copyright 2019 Raptor Engineering, LLC
34
#
45
# Permission is hereby granted, free of charge, to any person obtaining a
56
# copy of this software and associated documentation files (the "Software"),
@@ -24,14 +25,21 @@
2425
# It calculates Bandwidth and Watermarks values for HW programming
2526
#
2627

28+
ifdef CONFIG_X86
2729
calcs_ccflags := -mhard-float -msse
30+
endif
31+
32+
ifdef CONFIG_PPC64
33+
calcs_ccflags := -mhard-float -maltivec
34+
endif
2835

2936
ifdef CONFIG_CC_IS_GCC
3037
ifeq ($(call cc-ifversion, -lt, 0701, y), y)
3138
IS_OLD_GCC = 1
3239
endif
3340
endif
3441

42+
ifdef CONFIG_X86
3543
ifdef IS_OLD_GCC
3644
# Stack alignment mismatch, proceed with caution.
3745
# GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
@@ -40,6 +48,7 @@ calcs_ccflags += -mpreferred-stack-boundary=4
4048
else
4149
calcs_ccflags += -msse2
4250
endif
51+
endif
4352

4453
CFLAGS_$(AMDDALPATH)/dc/calcs/dcn_calcs.o := $(calcs_ccflags)
4554
CFLAGS_$(AMDDALPATH)/dc/calcs/dcn_calc_auto.o := $(calcs_ccflags)

drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
22
* Copyright 2017 Advanced Micro Devices, Inc.
3+
* Copyright 2019 Raptor Engineering, LLC
34
*
45
* Permission is hereby granted, free of charge, to any person obtaining a
56
* copy of this software and associated documentation files (the "Software"),

drivers/gpu/drm/amd/display/dc/dcn20/Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,21 @@ DCN20 = dcn20_resource.o dcn20_init.o dcn20_hwseq.o dcn20_dpp.o dcn20_dpp_cm.o d
99

1010
DCN20 += dcn20_dsc.o
1111

12+
ifdef CONFIG_X86
1213
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
1319

1420
ifdef CONFIG_CC_IS_GCC
1521
ifeq ($(call cc-ifversion, -lt, 0701, y), y)
1622
IS_OLD_GCC = 1
1723
endif
1824
endif
1925

26+
ifdef CONFIG_X86
2027
ifdef IS_OLD_GCC
2128
# Stack alignment mismatch, proceed with caution.
2229
# 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
2532
else
2633
CFLAGS_$(AMDDALPATH)/dc/dcn20/dcn20_resource.o += -msse2
2734
endif
35+
endif
2836

2937
AMD_DAL_DCN20 = $(addprefix $(AMDDALPATH)/dc/dcn20/,$(DCN20))
3038

drivers/gpu/drm/amd/display/dc/dcn21/Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,21 @@
55
DCN21 = dcn21_init.o dcn21_hubp.o dcn21_hubbub.o dcn21_resource.o \
66
dcn21_hwseq.o dcn21_link_encoder.o
77

8+
ifdef CONFIG_X86
89
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
915

1016
ifdef CONFIG_CC_IS_GCC
1117
ifeq ($(call cc-ifversion, -lt, 0701, y), y)
1218
IS_OLD_GCC = 1
1319
endif
1420
endif
1521

22+
ifdef CONFIG_X86
1623
ifdef IS_OLD_GCC
1724
# Stack alignment mismatch, proceed with caution.
1825
# 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
2128
else
2229
CFLAGS_$(AMDDALPATH)/dc/dcn21/dcn21_resource.o += -msse2
2330
endif
31+
endif
2432

2533
AMD_DAL_DCN21 = $(addprefix $(AMDDALPATH)/dc/dcn21/,$(DCN21))
2634

drivers/gpu/drm/amd/display/dc/dml/Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#
22
# Copyright 2017 Advanced Micro Devices, Inc.
3+
# Copyright 2019 Raptor Engineering, LLC
34
#
45
# Permission is hereby granted, free of charge, to any person obtaining a
56
# copy of this software and associated documentation files (the "Software"),
@@ -24,14 +25,21 @@
2425
# It provides the general basic services required by other DAL
2526
# subcomponents.
2627

28+
ifdef CONFIG_X86
2729
dml_ccflags := -mhard-float -msse
30+
endif
31+
32+
ifdef CONFIG_PPC64
33+
dml_ccflags := -mhard-float -maltivec
34+
endif
2835

2936
ifdef CONFIG_CC_IS_GCC
3037
ifeq ($(call cc-ifversion, -lt, 0701, y), y)
3138
IS_OLD_GCC = 1
3239
endif
3340
endif
3441

42+
ifdef CONFIG_X86
3543
ifdef IS_OLD_GCC
3644
# Stack alignment mismatch, proceed with caution.
3745
# GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
@@ -40,6 +48,7 @@ dml_ccflags += -mpreferred-stack-boundary=4
4048
else
4149
dml_ccflags += -msse2
4250
endif
51+
endif
4352

4453
CFLAGS_$(AMDDALPATH)/dc/dml/display_mode_lib.o := $(dml_ccflags)
4554

drivers/gpu/drm/amd/display/dc/dsc/Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,21 @@
22
#
33
# Makefile for the 'dsc' sub-component of DAL.
44

5+
ifdef CONFIG_X86
56
dsc_ccflags := -mhard-float -msse
7+
endif
8+
9+
ifdef CONFIG_PPC64
10+
dsc_ccflags := -mhard-float -maltivec
11+
endif
612

713
ifdef CONFIG_CC_IS_GCC
814
ifeq ($(call cc-ifversion, -lt, 0701, y), y)
915
IS_OLD_GCC = 1
1016
endif
1117
endif
1218

19+
ifdef CONFIG_X86
1320
ifdef IS_OLD_GCC
1421
# Stack alignment mismatch, proceed with caution.
1522
# GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
@@ -18,6 +25,7 @@ dsc_ccflags += -mpreferred-stack-boundary=4
1825
else
1926
dsc_ccflags += -msse2
2027
endif
28+
endif
2129

2230
CFLAGS_$(AMDDALPATH)/dc/dsc/rc_calc.o := $(dsc_ccflags)
2331
CFLAGS_$(AMDDALPATH)/dc/dsc/rc_calc_dpi.o := $(dsc_ccflags)

drivers/gpu/drm/amd/display/dc/os_types.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,38 @@
5151
#define dm_error(fmt, ...) DRM_ERROR(fmt, ##__VA_ARGS__)
5252

5353
#if defined(CONFIG_DRM_AMD_DC_DCN)
54+
#if defined(CONFIG_X86)
5455
#include <asm/fpu/api.h>
5556
#define DC_FP_START() kernel_fpu_begin()
5657
#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
5786
#endif
5887

5988
/*

0 commit comments

Comments
 (0)