Skip to content

Commit

Permalink
drm/amd/display: Support DRM_AMD_DC_FP on RISC-V
Browse files Browse the repository at this point in the history
RISC-V uses kernel_fpu_begin()/kernel_fpu_end() like several other
architectures. Enabling hardware FP requires overriding the ISA string
for the relevant compilation units.

Signed-off-by: Samuel Holland <[email protected]>
Signed-off-by: Icenowy Zheng <[email protected]>
Signed-off-by: Han Gao <[email protected]>
  • Loading branch information
xingxg2022 authored and opsiff committed Sep 13, 2024
1 parent be0d120 commit 15557da
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions drivers/gpu/drm/amd/display/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ config DRM_AMD_DC
select SND_HDA_COMPONENT if SND_HDA_CORE
# !CC_IS_CLANG: https://github.com/ClangBuiltLinux/linux/issues/1752
select DRM_AMD_DC_FP if (X86 || LOONGARCH || (PPC64 && ALTIVEC) || (ARM64 && KERNEL_MODE_NEON && !CC_IS_CLANG))
select DRM_AMD_DC_DCN if RISCV && FPU
help
Choose this option if you want to use the new display engine
support for AMDGPU. This adds required support for Vega and
Expand Down
6 changes: 4 additions & 2 deletions drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
#include <asm/neon.h>
#elif defined(CONFIG_LOONGARCH)
#include <asm/fpu.h>
#elif defined(CONFIG_RISCV)
#include <asm/switch_to.h>
#endif

/**
Expand Down Expand Up @@ -90,7 +92,7 @@ void dc_fpu_begin(const char *function_name, const int line)
*pcpu += 1;

if (*pcpu == 1) {
#if defined(CONFIG_X86) || defined(CONFIG_LOONGARCH)
#if defined(CONFIG_X86) || defined(CONFIG_LOONGARCH) || defined(CONFIG_RISCV)
migrate_disable();
kernel_fpu_begin();
#elif defined(CONFIG_PPC64)
Expand Down Expand Up @@ -130,7 +132,7 @@ void dc_fpu_end(const char *function_name, const int line)
pcpu = get_cpu_ptr(&fpu_recursion_depth);
*pcpu -= 1;
if (*pcpu <= 0) {
#if defined(CONFIG_X86) || defined(CONFIG_LOONGARCH)
#if defined(CONFIG_X86) || defined(CONFIG_LOONGARCH) || defined(CONFIG_RISCV)
kernel_fpu_end();
migrate_enable();
#elif defined(CONFIG_PPC64)
Expand Down
6 changes: 6 additions & 0 deletions drivers/gpu/drm/amd/display/dc/dml/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ dml_ccflags := -mfpu=64
dml_rcflags := -msoft-float
endif

ifdef CONFIG_RISCV
include $(srctree)/arch/riscv/Makefile.isa
# Remove V from the ISA string, like in arch/riscv/Makefile, but keep F and D.
dml_ccflags := -march=$(subst v,,$(riscv-march-y))
endif

ifdef CONFIG_CC_IS_GCC
ifneq ($(call gcc-min-version, 70100),y)
IS_OLD_GCC = 1
Expand Down

0 comments on commit 15557da

Please sign in to comment.