Re: [PATCH] drm/amd/display: Add missing hard-float compile flags for PPC64 builds

From: Guenter Roeck
Date: Thu Jun 30 2022 - 17:34:15 EST


On 6/30/22 14:01, Rodrigo Siqueira Jordao wrote:


On 2022-06-18 19:27, Guenter Roeck wrote:
ppc:allmodconfig builds fail with the following error.

powerpc64-linux-ld:
    drivers/gpu/drm/amd/amdgpu/../display/dc/dml/display_mode_lib.o
        uses hard float,
    drivers/gpu/drm/amd/amdgpu/../display/dc/dcn31/dcn31_resource.o
        uses soft float
powerpc64-linux-ld:
    failed to merge target specific data of file
    drivers/gpu/drm/amd/amdgpu/../display/dc/dcn31/dcn31_resource.o
powerpc64-linux-ld:
    drivers/gpu/drm/amd/amdgpu/../display/dc/dml/display_mode_lib.o
        uses hard float,
    drivers/gpu/drm/amd/amdgpu/../display/dc/dcn315/dcn315_resource.o
        uses soft float
powerpc64-linux-ld:
    failed to merge target specific data of
    file drivers/gpu/drm/amd/amdgpu/../display/dc/dcn315/dcn315_resource.o
powerpc64-linux-ld:
    drivers/gpu/drm/amd/amdgpu/../display/dc/dml/display_mode_lib.o
        uses hard float,
    drivers/gpu/drm/amd/amdgpu/../display/dc/dcn316/dcn316_resource.o
        uses soft float
powerpc64-linux-ld:
    failed to merge target specific data of file
    drivers/gpu/drm/amd/amdgpu/../display/dc/dcn316/dcn316_resource.o

The problem was introduced with commit 41b7a347bf14 ("powerpc: Book3S
64-bit outline-only KASAN support") which adds support for KASAN. This
commit in turn enables DRM_AMD_DC_DCN because KCOV_INSTRUMENT_ALL and
KCOV_ENABLE_COMPARISONS are no longer enabled. As result, new files are
compiled which lack the selection of hard-float.

Fixes: 41b7a347bf14 ("powerpc: Book3S 64-bit outline-only KASAN support")
Cc: Michael Ellerman <mpe@xxxxxxxxxxxxxx>
Cc: Daniel Axtens <dja@xxxxxxxxxx>
Signed-off-by: Guenter Roeck <linux@xxxxxxxxxxxx>
---
  drivers/gpu/drm/amd/display/dc/dcn31/Makefile  | 4 ++++
  drivers/gpu/drm/amd/display/dc/dcn315/Makefile | 4 ++++
  drivers/gpu/drm/amd/display/dc/dcn316/Makefile | 4 ++++
  3 files changed, 12 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn31/Makefile b/drivers/gpu/drm/amd/display/dc/dcn31/Makefile
index ec041e3cda30..74be02114ae4 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn31/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/dcn31/Makefile
@@ -15,6 +15,10 @@ DCN31 = dcn31_resource.o dcn31_hubbub.o dcn31_hwseq.o dcn31_init.o dcn31_hubp.o
      dcn31_apg.o dcn31_hpo_dp_stream_encoder.o dcn31_hpo_dp_link_encoder.o \
      dcn31_afmt.o dcn31_vpg.o
+ifdef CONFIG_PPC64
+CFLAGS_$(AMDDALPATH)/dc/dcn31/dcn31_resource.o := -mhard-float -maltivec
+endif
+
  AMD_DAL_DCN31 = $(addprefix $(AMDDALPATH)/dc/dcn31/,$(DCN31))
  AMD_DISPLAY_FILES += $(AMD_DAL_DCN31)
diff --git a/drivers/gpu/drm/amd/display/dc/dcn315/Makefile b/drivers/gpu/drm/amd/display/dc/dcn315/Makefile
index 59381d24800b..1395c1ced8c5 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn315/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/dcn315/Makefile
@@ -25,6 +25,10 @@
  DCN315 = dcn315_resource.o
+ifdef CONFIG_PPC64
+CFLAGS_$(AMDDALPATH)/dc/dcn315/dcn315_resource.o := -mhard-float -maltivec
+endif
+
  AMD_DAL_DCN315 = $(addprefix $(AMDDALPATH)/dc/dcn315/,$(DCN315))
  AMD_DISPLAY_FILES += $(AMD_DAL_DCN315)
diff --git a/drivers/gpu/drm/amd/display/dc/dcn316/Makefile b/drivers/gpu/drm/amd/display/dc/dcn316/Makefile
index 819d44a9439b..c3d2dd78f1e2 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn316/Makefile
+++ b/drivers/gpu/drm/amd/display/dc/dcn316/Makefile
@@ -25,6 +25,10 @@
  DCN316 = dcn316_resource.o
+ifdef CONFIG_PPC64
+CFLAGS_$(AMDDALPATH)/dc/dcn316/dcn316_resource.o := -mhard-float -maltivec
+endif
+
  AMD_DAL_DCN316 = $(addprefix $(AMDDALPATH)/dc/dcn316/,$(DCN316))
  AMD_DISPLAY_FILES += $(AMD_DAL_DCN316)

Hi,

I don't want to re-introduce those FPU flags for DCN31/DCN314/DCN316 since we fully isolate FPU operations for those ASICs inside the DML folder. Notice that we have the PPC64 in the DML Makefile:

https://gitlab.freedesktop.org/agd5f/linux/-/blob/amd-staging-drm-next/drivers/gpu/drm/amd/display/dc/dml/Makefile


Yes, sure, ppc64 is in dc/dml/Makefile. The problem is that it selects hard-float

ifdef CONFIG_PPC64
dml_ccflags := -mhard-float -maltivec
endif

and dc/{dcn31,dcn315,dcn316} don't.


Could you share what you see without your patch in the amd-staging-drm-next?

You mean linux-next ? Same error.

Building powerpc:allmodconfig ... failed
--------------
Error log:
powerpc64-linux-ld: drivers/gpu/drm/amd/amdgpu/../display/dc/dml/display_mode_lib.o uses hard float, drivers/gpu/drm/amd/amdgpu/../display/dc/dcn31/dcn31_resource.o uses soft float
powerpc64-linux-ld: failed to merge target specific data of file drivers/gpu/drm/amd/amdgpu/../display/dc/dcn31/dcn31_resource.o
powerpc64-linux-ld: drivers/gpu/drm/amd/amdgpu/../display/dc/dml/display_mode_lib.o uses hard float, drivers/gpu/drm/amd/amdgpu/../display/dc/dcn315/dcn315_resource.o uses soft float
powerpc64-linux-ld: failed to merge target specific data of file drivers/gpu/drm/amd/amdgpu/../display/dc/dcn315/dcn315_resource.o
powerpc64-linux-ld: drivers/gpu/drm/amd/amdgpu/../display/dc/dml/display_mode_lib.o uses hard float, drivers/gpu/drm/amd/amdgpu/../display/dc/dcn316/dcn316_resource.o uses soft float
powerpc64-linux-ld: failed to merge target specific data of file drivers/gpu/drm/amd/amdgpu/../display/dc/dcn316/dcn316_resource.o

This isn't really surprising since dc/dml/ does build with hard float, and
dc/{dcn31,dcn315,dcn316} build with soft float. As mentioned above,
the problem is now seen because DRM_AMD_DC_DCN is now enabled which was
previously not the case.

select DRM_AMD_DC_DCN if (X86 || PPC64) && !(KCOV_INSTRUMENT_ALL && KCOV_ENABLE_COMPARISONS)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Up to v5.18, both KCOV_INSTRUMENT_ALL and KCOV_ENABLE_COMPARISONS were enabled
and DRM_AMD_DC_DCN was therefore disabled. Now KCOV_INSTRUMENT_ALL and
KCOV_ENABLE_COMPARISONS are disabled, which results in DRM_AMD_DC_DCN=y.
This in turn results in the hard/soft float inconsistencies and the compile
failure.

Also:
* Are you using cross-compilation? If so, could you share your setup?
* Which GCC/Clang version are you using?

gcc 11.2.0 with binutils 2.36.1, but that really does not make a difference.

Guenter