From 295ba06fc80af54595c604ca6bab5f3e9c9ef154 Mon Sep 17 00:00:00 2001
From: Daniel Kolesa <daniel@octaforge.org>
Date: Fri, 29 Jan 2021 22:25:29 +0100
Subject: [PATCH] amd/display: enable dcn30 for ppc64

---
 drivers/gpu/drm/amd/display/Kconfig             |  2 +-
 drivers/gpu/drm/amd/display/dc/clk_mgr/Makefile | 10 ++++++++++
 drivers/gpu/drm/amd/display/dc/dcn30/Makefile   |  2 ++
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/Kconfig b/drivers/gpu/drm/amd/display/Kconfig
index 3c410d2..a749cc7 100644
--- a/drivers/gpu/drm/amd/display/Kconfig
+++ b/drivers/gpu/drm/amd/display/Kconfig
@@ -19,7 +19,7 @@ config DRM_AMD_DC_DCN
 
 config DRM_AMD_DC_DCN3_0
         bool "DCN 3.0 family"
-        depends on DRM_AMD_DC && X86
+        depends on DRM_AMD_DC
         depends on DRM_AMD_DC_DCN
         help
             Choose this option if you want to have
diff --git a/drivers/gpu/drm/amd/display/dc/clk_mgr/Makefile b/drivers/gpu/drm/amd/display/dc/clk_mgr/Makefile
index 52b1ce7..adf3919 100644
--- a/drivers/gpu/drm/amd/display/dc/clk_mgr/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/Makefile
@@ -114,6 +114,16 @@ ifdef CONFIG_DRM_AMD_DC_DCN3_0
 ###############################################################################
 CLK_MGR_DCN30 = dcn30_clk_mgr.o dcn30_clk_mgr_smu_msg.o
 
+# see above
+# technically it should not matter that this file is soft-float since all it
+# does is read doubles from a struct and write them somewhere else; this is not
+# passing between hard-float and soft-float APIs via registers (which would be
+# problematic because of different calling convention), and the memory layout
+# is always the same (IEEE double precision) so the error is probably harmless
+ifdef CONFIG_PPC64
+CFLAGS_$(AMDDALPATH)/dc/clk_mgr/dcn30/dcn30_clk_mgr.o := $(call cc-option,-mno-gnu-attribute)
+endif
+
 AMD_DAL_CLK_MGR_DCN30 = $(addprefix $(AMDDALPATH)/dc/clk_mgr/dcn30/,$(CLK_MGR_DCN30))
 
 AMD_DISPLAY_FILES += $(AMD_DAL_CLK_MGR_DCN30)
diff --git a/drivers/gpu/drm/amd/display/dc/dcn30/Makefile b/drivers/gpu/drm/amd/display/dc/dcn30/Makefile
index bd2a068..248c271 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn30/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/dcn30/Makefile
@@ -52,6 +52,7 @@ IS_OLD_GCC = 1
 endif
 endif
 
+ifdef CONFIG_X86
 ifdef IS_OLD_GCC
 # Stack alignment mismatch, proceed with caution.
 # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
@@ -62,6 +63,7 @@ else
 CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o += -msse2
 CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_optc.o += -msse2
 endif
+endif
 
 AMD_DAL_DCN30 = $(addprefix $(AMDDALPATH)/dc/dcn30/,$(DCN30))
 
-- 
2.30.0

