Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
137 changes: 137 additions & 0 deletions amd/amdgpu/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1084,6 +1084,143 @@ CFLAGS.rc_calc.c= ${FPUFLAGS} -mstack-alignment=4
CFLAGS.rc_calc_dpi.c= ${FPUFLAGS} -mstack-alignment=4
CFLAGS.rc_calc_fpu.c= ${FPUFLAGS} -mstack-alignment=4

.if ${MACHINE_ARCH} == "aarch64"
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost all of those files below use "double" as a type, i.e. clang blames ABI:

requires 'double' type support, but ABI 'aapcs' does not support it

but it's probably misleading diagnostics: llvm/llvm-project#90001


dcn_calcs.o: dcn_calcs.c
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we avoid these duplicate rules? This is to remove -mgeneral-regs-only from all of these?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess so. I decided to act safely and removed -mgeneral-regs-only from those file clang complained about + dcn302_fpu.c as a special case explained above.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean just arrange to have CFLAGS set appropriately rather than repeating the rules. I suspect that all of these correspond to the ${FPUFLAGS} additions for x86 above, like

CFLAGS.dcn_calcs.c= ${FPUFLAGS} -mstack-alignment=4

E.g. is there -mno-general-regs-only that we could set in ${FPUFLAGS} on arm64 to override -mgeneral-regs-only? Or something along those lines.

${CC} ${STATIC_CFLAGS} ${CFLAGS:N-mgeneral-regs-only} -c ${.IMPSRC} \
-o ${.TARGET}
dcn_calc_auto.o: dcn_calc_auto.c
${CC} ${STATIC_CFLAGS} ${CFLAGS:N-mgeneral-regs-only} -c ${.IMPSRC} \
-o ${.TARGET}
dcn_calc_math.o: dcn_calc_math.c
${CC} ${STATIC_CFLAGS} ${CFLAGS:N-mgeneral-regs-only} -c ${.IMPSRC} \
-o ${.TARGET}
dcn20_fpu.o: dcn20_fpu.c
${CC} ${STATIC_CFLAGS} ${CFLAGS:N-mgeneral-regs-only} -c ${.IMPSRC} \
-o ${.TARGET}
dcn20_resource.o: dcn20_resource.c
${CC} ${STATIC_CFLAGS} ${CFLAGS:N-mgeneral-regs-only} -c ${.IMPSRC} \
-o ${.TARGET}
dcn21_resource.o: dcn21_resource.c
${CC} ${STATIC_CFLAGS} ${CFLAGS:N-mgeneral-regs-only} -c ${.IMPSRC} \
-o ${.TARGET}
dcn30_fpu.o: dcn30_fpu.c
${CC} ${STATIC_CFLAGS} ${CFLAGS:N-mgeneral-regs-only} -c ${.IMPSRC} \
-o ${.TARGET}
dcn30_resource.o: dcn30_resource.c
${CC} ${STATIC_CFLAGS} ${CFLAGS:N-mgeneral-regs-only} -c ${.IMPSRC} \
-o ${.TARGET}
dcn301_fpu.o: dcn301_fpu.c
${CC} ${STATIC_CFLAGS} ${CFLAGS:N-mgeneral-regs-only} -c ${.IMPSRC} \
-o ${.TARGET}
dcn302_fpu.o: dcn302_fpu.c
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compiling this one with -mgeneral-regs-only causes clang to produce machine code which requires __floatundidf to convert integer to double if I understand correctly, i.e.

kldload amdgpu

complains early about the undefined symbol.

${CC} ${STATIC_CFLAGS} ${CFLAGS:N-mgeneral-regs-only} -c ${.IMPSRC} \
-o ${.TARGET}
dcn301_resource.o: dcn301_resource.c
${CC} ${STATIC_CFLAGS} ${CFLAGS:N-mgeneral-regs-only} -c ${.IMPSRC} \
-o ${.TARGET}
dcn303_fpu.o: dcn303_fpu.c
${CC} ${STATIC_CFLAGS} ${CFLAGS:N-mgeneral-regs-only} -c ${.IMPSRC} \
-o ${.TARGET}
dcn31_fpu.o: dcn31_fpu.c
${CC} ${STATIC_CFLAGS} ${CFLAGS:N-mgeneral-regs-only} -c ${.IMPSRC} \
-o ${.TARGET}
dcn31_resource.o: dcn31_resource.c
${CC} ${STATIC_CFLAGS} ${CFLAGS:N-mgeneral-regs-only} -c ${.IMPSRC} \
-o ${.TARGET}
dcn314_fpu.o: dcn314_fpu.c
${CC} ${STATIC_CFLAGS} ${CFLAGS:N-mgeneral-regs-only} -c ${.IMPSRC} \
-o ${.TARGET}
dcn32_fpu.o: dcn32_fpu.c
${CC} ${STATIC_CFLAGS} ${CFLAGS:N-mgeneral-regs-only} -c ${.IMPSRC} \
-o ${.TARGET}
dcn32_resource.o: dcn32_resource.c
${CC} ${STATIC_CFLAGS} ${CFLAGS:N-mgeneral-regs-only} -c ${.IMPSRC} \
-o ${.TARGET}
dcn32_resource_helpers.o: dcn32_resource_helpers.c
${CC} ${STATIC_CFLAGS} ${CFLAGS:N-mgeneral-regs-only} -c ${.IMPSRC} \
-o ${.TARGET}
dcn321_fpu.o: dcn321_fpu.c
${CC} ${STATIC_CFLAGS} ${CFLAGS:N-mgeneral-regs-only} -c ${.IMPSRC} \
-o ${.TARGET}

display_mode_lib.o: display_mode_lib.c
${CC} ${STATIC_CFLAGS} ${CFLAGS:N-mgeneral-regs-only} -c ${.IMPSRC} \
-o ${.TARGET}
display_mode_vba.o: display_mode_vba.c
${CC} ${STATIC_CFLAGS} ${CFLAGS:N-mgeneral-regs-only} -c ${.IMPSRC} \
-o ${.TARGET}
display_mode_vba_20.o: display_mode_vba_20.c
${CC} ${STATIC_CFLAGS} ${CFLAGS:N-mgeneral-regs-only} -c ${.IMPSRC} \
-o ${.TARGET}
display_mode_vba_21.o: display_mode_vba_21.c
${CC} ${STATIC_CFLAGS} ${CFLAGS:N-mgeneral-regs-only} -c ${.IMPSRC} \
-o ${.TARGET}
display_mode_vba_30.o: display_mode_vba_30.c
${CC} ${STATIC_CFLAGS} ${CFLAGS:N-mgeneral-regs-only} -c ${.IMPSRC} \
-o ${.TARGET}
display_mode_vba_31.o: display_mode_vba_31.c
${CC} ${STATIC_CFLAGS} ${CFLAGS:N-mgeneral-regs-only} -c ${.IMPSRC} \
-o ${.TARGET}
display_mode_vba_314.o: display_mode_vba_314.c
${CC} ${STATIC_CFLAGS} ${CFLAGS:N-mgeneral-regs-only} -c ${.IMPSRC} \
-o ${.TARGET}
display_mode_vba_32.o: display_mode_vba_32.c
${CC} ${STATIC_CFLAGS} ${CFLAGS:N-mgeneral-regs-only} -c ${.IMPSRC} \
-o ${.TARGET}
display_mode_vba_util_32.o: display_mode_vba_util_32.c
${CC} ${STATIC_CFLAGS} ${CFLAGS:N-mgeneral-regs-only} -c ${.IMPSRC} \
-o ${.TARGET}
display_pipe_clocks.o: display_pipe_clocks.c
${CC} ${STATIC_CFLAGS} ${CFLAGS:N-mgeneral-regs-only} -c ${.IMPSRC} \
-o ${.TARGET}
dml1_display_rq_dlg_calc.o: dml1_display_rq_dlg_calc.c
${CC} ${STATIC_CFLAGS} ${CFLAGS:N-mgeneral-regs-only} -c ${.IMPSRC} \
-o ${.TARGET}
display_rq_dlg_helpers.o: display_rq_dlg_helpers.c
${CC} ${STATIC_CFLAGS} ${CFLAGS:N-mgeneral-regs-only} -c ${.IMPSRC} \
-o ${.TARGET}
display_rq_dlg_calc_20.o: display_rq_dlg_calc_20.c
${CC} ${STATIC_CFLAGS} ${CFLAGS:N-mgeneral-regs-only} -c ${.IMPSRC} \
-o ${.TARGET}
display_rq_dlg_calc_21.o: display_rq_dlg_calc_21.c
${CC} ${STATIC_CFLAGS} ${CFLAGS:N-mgeneral-regs-only} -c ${.IMPSRC} \
-o ${.TARGET}
display_rq_dlg_calc_314.o: display_rq_dlg_calc_314.c
${CC} ${STATIC_CFLAGS} ${CFLAGS:N-mgeneral-regs-only} -c ${.IMPSRC} \
-o ${.TARGET}
display_rq_dlg_calc_32.o: display_rq_dlg_calc_32.c
${CC} ${STATIC_CFLAGS} ${CFLAGS:N-mgeneral-regs-only} -c ${.IMPSRC} \
-o ${.TARGET}
soc_bounding_box.o: soc_bounding_box.c
${CC} ${STATIC_CFLAGS} ${CFLAGS:N-mgeneral-regs-only} -c ${.IMPSRC} \
-o ${.TARGET}

display_rq_dlg_calc_20v2.o: display_rq_dlg_calc_20v2.c
${CC} ${STATIC_CFLAGS} ${CFLAGS:N-mgeneral-regs-only} -c ${.IMPSRC} \
-o ${.TARGET}
display_mode_vba_20v2.o: display_mode_vba_20v2.c
${CC} ${STATIC_CFLAGS} ${CFLAGS:N-mgeneral-regs-only} -c ${.IMPSRC} \
-o ${.TARGET}
display_rq_dlg_calc_30.o: display_rq_dlg_calc_30.c
${CC} ${STATIC_CFLAGS} ${CFLAGS:N-mgeneral-regs-only} -c ${.IMPSRC} \
-o ${.TARGET}
display_rq_dlg_calc_31.o: display_rq_dlg_calc_31.c
${CC} ${STATIC_CFLAGS} ${CFLAGS:N-mgeneral-regs-only} -c ${.IMPSRC} \
-o ${.TARGET}

rc_calc.o: rc_calc.c
${CC} ${STATIC_CFLAGS} ${CFLAGS:N-mgeneral-regs-only} -c ${.IMPSRC} \
-o ${.TARGET}
rc_calc_dpi.o: rc_calc_dpi.c
${CC} ${STATIC_CFLAGS} ${CFLAGS:N-mgeneral-regs-only} -c ${.IMPSRC} \
-o ${.TARGET}
rc_calc_fpu.o: rc_calc_fpu.c
${CC} ${STATIC_CFLAGS} ${CFLAGS:N-mgeneral-regs-only} -c ${.IMPSRC} \
-o ${.TARGET}

.endif

.if ${MACHINE_CPUARCH} != "powerpc"
CWARNFLAGS+= -Wno-expansion-to-defined
.endif
Expand Down
2 changes: 0 additions & 2 deletions drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,6 @@ static inline bool is_virtual_machine(void)
{
#if defined(CONFIG_X86)
return boot_cpu_has(X86_FEATURE_HYPERVISOR);
#elif defined(CONFIG_ARM64)
return !is_kernel_in_hyp_mode();
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is_kernel_in_hyp_mode isn't available in the LinuxKPI. I didn't know how to substitute it properly and removed for now. Any suggestions are welcome.

#else
return false;
#endif
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/amd/display/amdgpu_dm/dc_fpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
*/

#include "dc_trace.h"
#include "dc_fpu.h"

#if defined(CONFIG_X86)
#include <asm/fpu/api.h>
Expand Down
5 changes: 5 additions & 0 deletions drivers/gpu/drm/drm_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
#include <linux/iosys-map.h>
#include <xen/xen.h>

/* XXX-DSL: For FreeBSD and LinuxKPI only! */
#if defined(CONFIG_ARM64)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be even more strict than "CONFIG_ARM64", I guess. I'm not sure.

#include <linux/preempt.h>
#endif

#include <drm/drm_cache.h>

/* A small bounce buffer that fits on the stack. */
Expand Down
3 changes: 3 additions & 0 deletions kconfig.mk
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ KCONFIG+= ARCH_HAVE_NMI_SAFE_CMPXCHG \
.if ${MACHINE_CPUARCH} == "aarch64"
KCONFIG+= 64BIT \
ACPI \
COMPAT \
ARM64

KCONFIG+= DRM_AMD_DC_FP
.endif

.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
Expand Down