mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-29 22:14:41 +08:00
Hexagon architecture build fixes + builtins
Small build fixes applied: - use -mlong-calls to build - extend jumps in futex_atomic_* - etc Also, for convenience and portability, the hexagon compiler builtin functions like memcpy etc have been added to the kernel -- following the idiom used by other architectures. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAABCAAGBQJgktBuAAoJEBpUr7jlZGwyPYAP+gPT+ttC6V635Un2hQbenG96 IIkeD+xsbJHEGWm3OInnn6koKAi+Z8hd3yxgZX6Z4FAsv6bdifoHb70yGPNVTskN TFaBb4C3OYuX3JUshtGKzlaCaixAvvZfKQGALJ3YkANCOnkOyC1TJKitGB5OhQaR GRlFRhwpaTD5jbT/tAtSMdf5tNnZoOCwLEvnMbnALj4Fva7okz102CH7UyaxFjxv LsBSyOTjPDEd1LVmXJK+IFFNLZJw2f064zl4t4Q8y+p6jbrpbPpXsP9rYBqKJoKG n+ZMFe2Z7madDPhVfYi64EaZZnziC1YPNMa+rAvcHrlPEDIiecFTg3dfeskwXgOB 04S7eS/A/UNAwFi3SPzbPVeBh9IkZO71EBGbGsOKuSUKngYzZ9/Jq0tqmXld1Hx2 MOLa9BrjNulO016uAoqoWgHKimS73umYSE8Bub/ldrtq70//PkjprqOqir4kkM3K LvZEh+f5bIm+n2SBDIOg80b7hOLU4yzmndczySFESy/Gxnkbzsh66B/bUQiiy13C l3v8YFlgYQUCAlkY48MsPELkBK2T2DwQGlUCbOzaQ01LwltbpcNWss+VgrQU//9w 42uHxTwVaS2Og+yTnnmvOczIl8B+wptsfAqYb9GqOviXSU+Dqysr8fMgaxeKuvKj +ly8M+F3quQjDYN1wfi2 =j0Vp -----END PGP SIGNATURE----- Merge tag 'hexagon-5.13-0' of git://git.kernel.org/pub/scm/linux/kernel/git/bcain/linux Pull Hexagon updates from Brian Cain: "Hexagon architecture build fixes + builtins Small build fixes applied: - use -mlong-calls to build - extend jumps in futex_atomic_* - etc Also, for convenience and portability, the hexagon compiler builtin functions like memcpy etc have been added to the kernel -- following the idiom used by other architectures" * tag 'hexagon-5.13-0' of git://git.kernel.org/pub/scm/linux/kernel/git/bcain/linux: Hexagon: add target builtins to kernel Hexagon: remove DEBUG from comet config Hexagon: change jumps to must-extend in futex_atomic_* Hexagon: fix build errors
This commit is contained in:
commit
5e5948e57e
@ -10,6 +10,9 @@ LDFLAGS_vmlinux += -G0
|
||||
# Do not use single-byte enums; these will overflow.
|
||||
KBUILD_CFLAGS += -fno-short-enums
|
||||
|
||||
# We must use long-calls:
|
||||
KBUILD_CFLAGS += -mlong-calls
|
||||
|
||||
# Modules must use either long-calls, or use pic/plt.
|
||||
# Use long-calls for now, it's easier. And faster.
|
||||
# KBUILD_CFLAGS_MODULE += -fPIC
|
||||
@ -30,9 +33,6 @@ TIR_NAME := r19
|
||||
KBUILD_CFLAGS += -ffixed-$(TIR_NAME) -DTHREADINFO_REG=$(TIR_NAME) -D__linux__
|
||||
KBUILD_AFLAGS += -DTHREADINFO_REG=$(TIR_NAME)
|
||||
|
||||
LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name 2>/dev/null)
|
||||
libs-y += $(LIBGCC)
|
||||
|
||||
head-y := arch/hexagon/kernel/head.o
|
||||
|
||||
core-y += arch/hexagon/kernel/ \
|
||||
|
@ -81,4 +81,3 @@ CONFIG_FRAME_WARN=0
|
||||
CONFIG_MAGIC_SYSRQ=y
|
||||
CONFIG_DEBUG_FS=y
|
||||
# CONFIG_SCHED_DEBUG is not set
|
||||
CONFIG_DEBUG_INFO=y
|
||||
|
@ -21,7 +21,7 @@
|
||||
"3:\n" \
|
||||
".section .fixup,\"ax\"\n" \
|
||||
"4: %1 = #%5;\n" \
|
||||
" jump 3b\n" \
|
||||
" jump ##3b\n" \
|
||||
".previous\n" \
|
||||
".section __ex_table,\"a\"\n" \
|
||||
".long 1b,4b,2b,4b\n" \
|
||||
@ -90,7 +90,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, u32 oldval,
|
||||
"3:\n"
|
||||
".section .fixup,\"ax\"\n"
|
||||
"4: %0 = #%6\n"
|
||||
" jump 3b\n"
|
||||
" jump ##3b\n"
|
||||
".previous\n"
|
||||
".section __ex_table,\"a\"\n"
|
||||
".long 1b,4b,2b,4b\n"
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include <asm-generic/timex.h>
|
||||
#include <asm/timer-regs.h>
|
||||
#include <asm/hexagon_vm.h>
|
||||
|
||||
/* Using TCX0 as our clock. CLOCK_TICK_RATE scheduled to be removed. */
|
||||
#define CLOCK_TICK_RATE TCX0_CLK_RATE
|
||||
@ -16,7 +17,7 @@
|
||||
|
||||
static inline int read_current_timer(unsigned long *timer_val)
|
||||
{
|
||||
*timer_val = (unsigned long) __vmgettime();
|
||||
*timer_val = __vmgettime();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -35,8 +35,8 @@ EXPORT_SYMBOL(_dflt_cache_att);
|
||||
DECLARE_EXPORT(__hexagon_memcpy_likely_aligned_min32bytes_mult8bytes);
|
||||
|
||||
/* Additional functions */
|
||||
DECLARE_EXPORT(__divsi3);
|
||||
DECLARE_EXPORT(__modsi3);
|
||||
DECLARE_EXPORT(__udivsi3);
|
||||
DECLARE_EXPORT(__umodsi3);
|
||||
DECLARE_EXPORT(__hexagon_divsi3);
|
||||
DECLARE_EXPORT(__hexagon_modsi3);
|
||||
DECLARE_EXPORT(__hexagon_udivsi3);
|
||||
DECLARE_EXPORT(__hexagon_umodsi3);
|
||||
DECLARE_EXPORT(csum_tcpudp_magic);
|
||||
|
@ -35,7 +35,7 @@ void user_disable_single_step(struct task_struct *child)
|
||||
|
||||
static int genregs_get(struct task_struct *target,
|
||||
const struct user_regset *regset,
|
||||
srtuct membuf to)
|
||||
struct membuf to)
|
||||
{
|
||||
struct pt_regs *regs = task_pt_regs(target);
|
||||
|
||||
@ -54,7 +54,7 @@ static int genregs_get(struct task_struct *target,
|
||||
membuf_store(&to, regs->m0);
|
||||
membuf_store(&to, regs->m1);
|
||||
membuf_store(&to, regs->usr);
|
||||
membuf_store(&to, regs->p3_0);
|
||||
membuf_store(&to, regs->preds);
|
||||
membuf_store(&to, regs->gp);
|
||||
membuf_store(&to, regs->ugp);
|
||||
membuf_store(&to, pt_elr(regs)); // pc
|
||||
|
@ -2,4 +2,5 @@
|
||||
#
|
||||
# Makefile for hexagon-specific library files.
|
||||
#
|
||||
obj-y = checksum.o io.o memcpy.o memset.o
|
||||
obj-y = checksum.o io.o memcpy.o memset.o memcpy_likely_aligned.o \
|
||||
divsi3.o modsi3.o udivsi3.o umodsi3.o
|
||||
|
67
arch/hexagon/lib/divsi3.S
Normal file
67
arch/hexagon/lib/divsi3.S
Normal file
@ -0,0 +1,67 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2021, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/linkage.h>
|
||||
|
||||
SYM_FUNC_START(__hexagon_divsi3)
|
||||
{
|
||||
p0 = cmp.gt(r0,#-1)
|
||||
p1 = cmp.gt(r1,#-1)
|
||||
r3:2 = vabsw(r1:0)
|
||||
}
|
||||
{
|
||||
p3 = xor(p0,p1)
|
||||
r4 = sub(r2,r3)
|
||||
r6 = cl0(r2)
|
||||
p0 = cmp.gtu(r3,r2)
|
||||
}
|
||||
{
|
||||
r0 = mux(p3,#-1,#1)
|
||||
r7 = cl0(r3)
|
||||
p1 = cmp.gtu(r3,r4)
|
||||
}
|
||||
{
|
||||
r0 = mux(p0,#0,r0)
|
||||
p0 = or(p0,p1)
|
||||
if (p0.new) jumpr:nt r31
|
||||
r6 = sub(r7,r6)
|
||||
}
|
||||
{
|
||||
r7 = r6
|
||||
r5:4 = combine(#1,r3)
|
||||
r6 = add(#1,lsr(r6,#1))
|
||||
p0 = cmp.gtu(r6,#4)
|
||||
}
|
||||
{
|
||||
r5:4 = vaslw(r5:4,r7)
|
||||
if (!p0) r6 = #3
|
||||
}
|
||||
{
|
||||
loop0(1f,r6)
|
||||
r7:6 = vlsrw(r5:4,#1)
|
||||
r1:0 = #0
|
||||
}
|
||||
.falign
|
||||
1:
|
||||
{
|
||||
r5:4 = vlsrw(r5:4,#2)
|
||||
if (!p0.new) r0 = add(r0,r5)
|
||||
if (!p0.new) r2 = sub(r2,r4)
|
||||
p0 = cmp.gtu(r4,r2)
|
||||
}
|
||||
{
|
||||
r7:6 = vlsrw(r7:6,#2)
|
||||
if (!p0.new) r0 = add(r0,r7)
|
||||
if (!p0.new) r2 = sub(r2,r6)
|
||||
p0 = cmp.gtu(r6,r2)
|
||||
}:endloop0
|
||||
{
|
||||
if (!p0) r0 = add(r0,r7)
|
||||
}
|
||||
{
|
||||
if (p3) r0 = sub(r1,r0)
|
||||
jumpr r31
|
||||
}
|
||||
SYM_FUNC_END(__hexagon_divsi3)
|
56
arch/hexagon/lib/memcpy_likely_aligned.S
Normal file
56
arch/hexagon/lib/memcpy_likely_aligned.S
Normal file
@ -0,0 +1,56 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2021, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/linkage.h>
|
||||
|
||||
SYM_FUNC_START(__hexagon_memcpy_likely_aligned_min32bytes_mult8bytes)
|
||||
{
|
||||
p0 = bitsclr(r1,#7)
|
||||
p0 = bitsclr(r0,#7)
|
||||
if (p0.new) r5:4 = memd(r1)
|
||||
if (p0.new) r7:6 = memd(r1+#8)
|
||||
}
|
||||
{
|
||||
if (!p0) jump:nt .Lmemcpy_call
|
||||
if (p0) r9:8 = memd(r1+#16)
|
||||
if (p0) r11:10 = memd(r1+#24)
|
||||
p0 = cmp.gtu(r2,#64)
|
||||
}
|
||||
{
|
||||
if (p0) jump:nt .Lmemcpy_call
|
||||
if (!p0) memd(r0) = r5:4
|
||||
if (!p0) memd(r0+#8) = r7:6
|
||||
p0 = cmp.gtu(r2,#32)
|
||||
}
|
||||
{
|
||||
p1 = cmp.gtu(r2,#40)
|
||||
p2 = cmp.gtu(r2,#48)
|
||||
if (p0) r13:12 = memd(r1+#32)
|
||||
if (p1.new) r15:14 = memd(r1+#40)
|
||||
}
|
||||
{
|
||||
memd(r0+#16) = r9:8
|
||||
memd(r0+#24) = r11:10
|
||||
}
|
||||
{
|
||||
if (p0) memd(r0+#32) = r13:12
|
||||
if (p1) memd(r0+#40) = r15:14
|
||||
if (!p2) jumpr:t r31
|
||||
}
|
||||
{
|
||||
p0 = cmp.gtu(r2,#56)
|
||||
r5:4 = memd(r1+#48)
|
||||
if (p0.new) r7:6 = memd(r1+#56)
|
||||
}
|
||||
{
|
||||
memd(r0+#48) = r5:4
|
||||
if (p0) memd(r0+#56) = r7:6
|
||||
jumpr r31
|
||||
}
|
||||
|
||||
.Lmemcpy_call:
|
||||
jump memcpy
|
||||
|
||||
SYM_FUNC_END(__hexagon_memcpy_likely_aligned_min32bytes_mult8bytes)
|
46
arch/hexagon/lib/modsi3.S
Normal file
46
arch/hexagon/lib/modsi3.S
Normal file
@ -0,0 +1,46 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2021, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/linkage.h>
|
||||
|
||||
SYM_FUNC_START(__hexagon_modsi3)
|
||||
{
|
||||
p2 = cmp.ge(r0,#0)
|
||||
r2 = abs(r0)
|
||||
r1 = abs(r1)
|
||||
}
|
||||
{
|
||||
r3 = cl0(r2)
|
||||
r4 = cl0(r1)
|
||||
p0 = cmp.gtu(r1,r2)
|
||||
}
|
||||
{
|
||||
r3 = sub(r4,r3)
|
||||
if (p0) jumpr r31
|
||||
}
|
||||
{
|
||||
p1 = cmp.eq(r3,#0)
|
||||
loop0(1f,r3)
|
||||
r0 = r2
|
||||
r2 = lsl(r1,r3)
|
||||
}
|
||||
.falign
|
||||
1:
|
||||
{
|
||||
p0 = cmp.gtu(r2,r0)
|
||||
if (!p0.new) r0 = sub(r0,r2)
|
||||
r2 = lsr(r2,#1)
|
||||
if (p1) r1 = #0
|
||||
}:endloop0
|
||||
{
|
||||
p0 = cmp.gtu(r2,r0)
|
||||
if (!p0.new) r0 = sub(r0,r1)
|
||||
if (p2) jumpr r31
|
||||
}
|
||||
{
|
||||
r0 = neg(r0)
|
||||
jumpr r31
|
||||
}
|
||||
SYM_FUNC_END(__hexagon_modsi3)
|
38
arch/hexagon/lib/udivsi3.S
Normal file
38
arch/hexagon/lib/udivsi3.S
Normal file
@ -0,0 +1,38 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2021, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/linkage.h>
|
||||
|
||||
SYM_FUNC_START(__hexagon_udivsi3)
|
||||
{
|
||||
r2 = cl0(r0)
|
||||
r3 = cl0(r1)
|
||||
r5:4 = combine(#1,#0)
|
||||
p0 = cmp.gtu(r1,r0)
|
||||
}
|
||||
{
|
||||
r6 = sub(r3,r2)
|
||||
r4 = r1
|
||||
r1:0 = combine(r0,r4)
|
||||
if (p0) jumpr r31
|
||||
}
|
||||
{
|
||||
r3:2 = vlslw(r5:4,r6)
|
||||
loop0(1f,r6)
|
||||
}
|
||||
.falign
|
||||
1:
|
||||
{
|
||||
p0 = cmp.gtu(r2,r1)
|
||||
if (!p0.new) r1 = sub(r1,r2)
|
||||
if (!p0.new) r0 = add(r0,r3)
|
||||
r3:2 = vlsrw(r3:2,#1)
|
||||
}:endloop0
|
||||
{
|
||||
p0 = cmp.gtu(r2,r1)
|
||||
if (!p0.new) r0 = add(r0,r3)
|
||||
jumpr r31
|
||||
}
|
||||
SYM_FUNC_END(__hexagon_udivsi3)
|
36
arch/hexagon/lib/umodsi3.S
Normal file
36
arch/hexagon/lib/umodsi3.S
Normal file
@ -0,0 +1,36 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2021, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/linkage.h>
|
||||
|
||||
SYM_FUNC_START(__hexagon_umodsi3)
|
||||
{
|
||||
r2 = cl0(r0)
|
||||
r3 = cl0(r1)
|
||||
p0 = cmp.gtu(r1,r0)
|
||||
}
|
||||
{
|
||||
r2 = sub(r3,r2)
|
||||
if (p0) jumpr r31
|
||||
}
|
||||
{
|
||||
loop0(1f,r2)
|
||||
p1 = cmp.eq(r2,#0)
|
||||
r2 = lsl(r1,r2)
|
||||
}
|
||||
.falign
|
||||
1:
|
||||
{
|
||||
p0 = cmp.gtu(r2,r0)
|
||||
if (!p0.new) r0 = sub(r0,r2)
|
||||
r2 = lsr(r2,#1)
|
||||
if (p1) r1 = #0
|
||||
}:endloop0
|
||||
{
|
||||
p0 = cmp.gtu(r2,r0)
|
||||
if (!p0.new) r0 = sub(r0,r1)
|
||||
jumpr r31
|
||||
}
|
||||
SYM_FUNC_END(__hexagon_umodsi3)
|
Loading…
Reference in New Issue
Block a user