Skip to content

Commit c0b6b72

Browse files
author
Robert Foss
committed
Revert "drm/amd/display: use ARCH_HAS_KERNEL_FPU_SUPPORT"
This reverts commit a28e4b6. JIRA: https://issues.redhat.com/browse/RHEL-53570 Upstream Status: RHEL-only Signed-off-by: Robert Foss <rfoss@redhat.com>
1 parent a04c78e commit c0b6b72

File tree

4 files changed

+94
-7
lines changed

4 files changed

+94
-7
lines changed

drivers/gpu/drm/amd/display/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ config DRM_AMD_DC
1010
depends on BROKEN || !CC_IS_CLANG || ARM64 || RISCV || SPARC64 || X86_64
1111
select SND_HDA_COMPONENT if SND_HDA_CORE
1212
# !CC_IS_CLANG: https://github.com/ClangBuiltLinux/linux/issues/1752
13-
select DRM_AMD_DC_FP if ARCH_HAS_KERNEL_FPU_SUPPORT && !(CC_IS_CLANG && (ARM64 || RISCV))
13+
select DRM_AMD_DC_FP if (X86 || LOONGARCH || (PPC64 && ALTIVEC) || (ARM64 && KERNEL_MODE_NEON && !CC_IS_CLANG))
1414
help
1515
Choose this option if you want to use the new display engine
1616
support for AMDGPU. This adds required support for Vega and

drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,16 @@
2626

2727
#include "dc_trace.h"
2828

29-
#include <linux/fpu.h>
29+
#if defined(CONFIG_X86)
30+
#include <asm/fpu/api.h>
31+
#elif defined(CONFIG_PPC64)
32+
#include <asm/switch_to.h>
33+
#include <asm/cputable.h>
34+
#elif defined(CONFIG_ARM64)
35+
#include <asm/neon.h>
36+
#elif defined(CONFIG_LOONGARCH)
37+
#include <asm/fpu.h>
38+
#endif
3039

3140
/**
3241
* DOC: DC FPU manipulation overview
@@ -78,9 +87,16 @@ void dc_fpu_begin(const char *function_name, const int line)
7887
WARN_ON_ONCE(!in_task());
7988
preempt_disable();
8089
depth = __this_cpu_inc_return(fpu_recursion_depth);
90+
8191
if (depth == 1) {
82-
BUG_ON(!kernel_fpu_available());
92+
#if defined(CONFIG_X86) || defined(CONFIG_LOONGARCH)
8393
kernel_fpu_begin();
94+
#elif defined(CONFIG_PPC64)
95+
if (!cpu_has_feature(CPU_FTR_FPU_UNAVAILABLE))
96+
enable_kernel_fp();
97+
#elif defined(CONFIG_ARM64)
98+
kernel_neon_begin();
99+
#endif
84100
}
85101

86102
TRACE_DCN_FPU(true, function_name, line, depth);
@@ -102,7 +118,14 @@ void dc_fpu_end(const char *function_name, const int line)
102118

103119
depth = __this_cpu_dec_return(fpu_recursion_depth);
104120
if (depth == 0) {
121+
#if defined(CONFIG_X86) || defined(CONFIG_LOONGARCH)
105122
kernel_fpu_end();
123+
#elif defined(CONFIG_PPC64)
124+
if (!cpu_has_feature(CPU_FTR_FPU_UNAVAILABLE))
125+
disable_kernel_fp();
126+
#elif defined(CONFIG_ARM64)
127+
kernel_neon_end();
128+
#endif
106129
} else {
107130
WARN_ON_ONCE(depth < 0);
108131
}

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

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,40 @@
2525
# It provides the general basic services required by other DAL
2626
# subcomponents.
2727

28-
dml_ccflags := $(CC_FLAGS_FPU)
29-
dml_rcflags := $(CC_FLAGS_NO_FPU)
28+
ifdef CONFIG_X86
29+
dml_ccflags-$(CONFIG_CC_IS_GCC) := -mhard-float
30+
dml_ccflags := $(dml_ccflags-y) -msse
31+
endif
32+
33+
ifdef CONFIG_PPC64
34+
dml_ccflags := -mhard-float
35+
endif
36+
37+
ifdef CONFIG_ARM64
38+
dml_rcflags := -mgeneral-regs-only
39+
endif
40+
41+
ifdef CONFIG_LOONGARCH
42+
dml_ccflags := -mfpu=64
43+
dml_rcflags := -msoft-float
44+
endif
45+
46+
ifdef CONFIG_CC_IS_GCC
47+
ifneq ($(call gcc-min-version, 70100),y)
48+
IS_OLD_GCC = 1
49+
endif
50+
endif
51+
52+
ifdef CONFIG_X86
53+
ifdef IS_OLD_GCC
54+
# Stack alignment mismatch, proceed with caution.
55+
# GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
56+
# (8B stack alignment).
57+
dml_ccflags += -mpreferred-stack-boundary=4
58+
else
59+
dml_ccflags += -msse2
60+
endif
61+
endif
3062

3163
ifneq ($(CONFIG_FRAME_WARN),0)
3264
ifeq ($(filter y,$(CONFIG_KASAN)$(CONFIG_KCSAN)),y)

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

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,40 @@
2424
#
2525
# Makefile for dml2.
2626

27-
dml2_ccflags := $(CC_FLAGS_FPU)
28-
dml2_rcflags := $(CC_FLAGS_NO_FPU)
27+
ifdef CONFIG_X86
28+
dml2_ccflags-$(CONFIG_CC_IS_GCC) := -mhard-float
29+
dml2_ccflags := $(dml2_ccflags-y) -msse
30+
endif
31+
32+
ifdef CONFIG_PPC64
33+
dml2_ccflags := -mhard-float
34+
endif
35+
36+
ifdef CONFIG_ARM64
37+
dml2_rcflags := -mgeneral-regs-only
38+
endif
39+
40+
ifdef CONFIG_LOONGARCH
41+
dml2_ccflags := -mfpu=64
42+
dml2_rcflags := -msoft-float
43+
endif
44+
45+
ifdef CONFIG_CC_IS_GCC
46+
ifeq ($(call cc-ifversion, -lt, 0701, y), y)
47+
IS_OLD_GCC = 1
48+
endif
49+
endif
50+
51+
ifdef CONFIG_X86
52+
ifdef IS_OLD_GCC
53+
# Stack alignment mismatch, proceed with caution.
54+
# GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
55+
# (8B stack alignment).
56+
dml2_ccflags += -mpreferred-stack-boundary=4
57+
else
58+
dml2_ccflags += -msse2
59+
endif
60+
endif
2961

3062
ifneq ($(CONFIG_FRAME_WARN),0)
3163
ifeq ($(filter y,$(CONFIG_KASAN)$(CONFIG_KCSAN)),y)

0 commit comments

Comments
 (0)