Skip to content

Commit a28e4b6

Browse files
SiFiveHollandakpm00
authored andcommitted
drm/amd/display: use ARCH_HAS_KERNEL_FPU_SUPPORT
Now that all previously-supported architectures select ARCH_HAS_KERNEL_FPU_SUPPORT, this code can depend on that symbol instead of the existing list of architectures. It can also take advantage of the common kernel-mode FPU API and method of adjusting CFLAGS. Link: https://lkml.kernel.org/r/20240329072441.591471-14-samuel.holland@sifive.com Signed-off-by: Samuel Holland <samuel.holland@sifive.com> Acked-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Acked-by: Christian König <christian.koenig@amd.com> Cc: Borislav Petkov (AMD) <bp@alien8.de> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: Huacai Chen <chenhuacai@kernel.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Masahiro Yamada <masahiroy@kernel.org> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Nathan Chancellor <nathan@kernel.org> Cc: Nicolas Schier <nicolas@fjasle.eu> Cc: Palmer Dabbelt <palmer@rivosinc.com> Cc: Russell King <linux@armlinux.org.uk> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: WANG Xuerui <git@xen0n.name> Cc: Will Deacon <will@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 06a990b commit a28e4b6

File tree

4 files changed

+7
-94
lines changed

4 files changed

+7
-94
lines changed

drivers/gpu/drm/amd/display/Kconfig

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

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

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

2727
#include "dc_trace.h"
2828

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
29+
#include <linux/fpu.h>
3930

4031
/**
4132
* DOC: DC FPU manipulation overview
@@ -87,16 +78,9 @@ void dc_fpu_begin(const char *function_name, const int line)
8778
WARN_ON_ONCE(!in_task());
8879
preempt_disable();
8980
depth = __this_cpu_inc_return(fpu_recursion_depth);
90-
9181
if (depth == 1) {
92-
#if defined(CONFIG_X86) || defined(CONFIG_LOONGARCH)
82+
BUG_ON(!kernel_fpu_available());
9383
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
10084
}
10185

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

119103
depth = __this_cpu_dec_return(fpu_recursion_depth);
120104
if (depth == 0) {
121-
#if defined(CONFIG_X86) || defined(CONFIG_LOONGARCH)
122105
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
129106
} else {
130107
WARN_ON_ONCE(depth < 0);
131108
}

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

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

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
28+
dml_ccflags := $(CC_FLAGS_FPU)
29+
dml_rcflags := $(CC_FLAGS_NO_FPU)
6230

6331
ifneq ($(CONFIG_FRAME_WARN),0)
6432
ifeq ($(filter y,$(CONFIG_KASAN)$(CONFIG_KCSAN)),y)

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

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

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
27+
dml2_ccflags := $(CC_FLAGS_FPU)
28+
dml2_rcflags := $(CC_FLAGS_NO_FPU)
6129

6230
ifneq ($(CONFIG_FRAME_WARN),0)
6331
ifeq ($(filter y,$(CONFIG_KASAN)$(CONFIG_KCSAN)),y)

0 commit comments

Comments
 (0)