Skip to content

Commit 5e5948e

Browse files
committed
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
2 parents a3f53e8 + f1f99ad commit 5e5948e

File tree

12 files changed

+258
-14
lines changed

12 files changed

+258
-14
lines changed

arch/hexagon/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ LDFLAGS_vmlinux += -G0
1010
# Do not use single-byte enums; these will overflow.
1111
KBUILD_CFLAGS += -fno-short-enums
1212

13+
# We must use long-calls:
14+
KBUILD_CFLAGS += -mlong-calls
15+
1316
# Modules must use either long-calls, or use pic/plt.
1417
# Use long-calls for now, it's easier. And faster.
1518
# KBUILD_CFLAGS_MODULE += -fPIC
@@ -30,9 +33,6 @@ TIR_NAME := r19
3033
KBUILD_CFLAGS += -ffixed-$(TIR_NAME) -DTHREADINFO_REG=$(TIR_NAME) -D__linux__
3134
KBUILD_AFLAGS += -DTHREADINFO_REG=$(TIR_NAME)
3235

33-
LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name 2>/dev/null)
34-
libs-y += $(LIBGCC)
35-
3636
head-y := arch/hexagon/kernel/head.o
3737

3838
core-y += arch/hexagon/kernel/ \

arch/hexagon/configs/comet_defconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,3 @@ CONFIG_FRAME_WARN=0
8181
CONFIG_MAGIC_SYSRQ=y
8282
CONFIG_DEBUG_FS=y
8383
# CONFIG_SCHED_DEBUG is not set
84-
CONFIG_DEBUG_INFO=y

arch/hexagon/include/asm/futex.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"3:\n" \
2222
".section .fixup,\"ax\"\n" \
2323
"4: %1 = #%5;\n" \
24-
" jump 3b\n" \
24+
" jump ##3b\n" \
2525
".previous\n" \
2626
".section __ex_table,\"a\"\n" \
2727
".long 1b,4b,2b,4b\n" \
@@ -90,7 +90,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, u32 oldval,
9090
"3:\n"
9191
".section .fixup,\"ax\"\n"
9292
"4: %0 = #%6\n"
93-
" jump 3b\n"
93+
" jump ##3b\n"
9494
".previous\n"
9595
".section __ex_table,\"a\"\n"
9696
".long 1b,4b,2b,4b\n"

arch/hexagon/include/asm/timex.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include <asm-generic/timex.h>
1010
#include <asm/timer-regs.h>
11+
#include <asm/hexagon_vm.h>
1112

1213
/* Using TCX0 as our clock. CLOCK_TICK_RATE scheduled to be removed. */
1314
#define CLOCK_TICK_RATE TCX0_CLK_RATE
@@ -16,7 +17,7 @@
1617

1718
static inline int read_current_timer(unsigned long *timer_val)
1819
{
19-
*timer_val = (unsigned long) __vmgettime();
20+
*timer_val = __vmgettime();
2021
return 0;
2122
}
2223

arch/hexagon/kernel/hexagon_ksyms.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ EXPORT_SYMBOL(_dflt_cache_att);
3535
DECLARE_EXPORT(__hexagon_memcpy_likely_aligned_min32bytes_mult8bytes);
3636

3737
/* Additional functions */
38-
DECLARE_EXPORT(__divsi3);
39-
DECLARE_EXPORT(__modsi3);
40-
DECLARE_EXPORT(__udivsi3);
41-
DECLARE_EXPORT(__umodsi3);
38+
DECLARE_EXPORT(__hexagon_divsi3);
39+
DECLARE_EXPORT(__hexagon_modsi3);
40+
DECLARE_EXPORT(__hexagon_udivsi3);
41+
DECLARE_EXPORT(__hexagon_umodsi3);
4242
DECLARE_EXPORT(csum_tcpudp_magic);

arch/hexagon/kernel/ptrace.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void user_disable_single_step(struct task_struct *child)
3535

3636
static int genregs_get(struct task_struct *target,
3737
const struct user_regset *regset,
38-
srtuct membuf to)
38+
struct membuf to)
3939
{
4040
struct pt_regs *regs = task_pt_regs(target);
4141

@@ -54,7 +54,7 @@ static int genregs_get(struct task_struct *target,
5454
membuf_store(&to, regs->m0);
5555
membuf_store(&to, regs->m1);
5656
membuf_store(&to, regs->usr);
57-
membuf_store(&to, regs->p3_0);
57+
membuf_store(&to, regs->preds);
5858
membuf_store(&to, regs->gp);
5959
membuf_store(&to, regs->ugp);
6060
membuf_store(&to, pt_elr(regs)); // pc

arch/hexagon/lib/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
#
33
# Makefile for hexagon-specific library files.
44
#
5-
obj-y = checksum.o io.o memcpy.o memset.o
5+
obj-y = checksum.o io.o memcpy.o memset.o memcpy_likely_aligned.o \
6+
divsi3.o modsi3.o udivsi3.o umodsi3.o

arch/hexagon/lib/divsi3.S

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/* SPDX-License-Identifier: GPL-2.0-only */
2+
/*
3+
* Copyright (c) 2021, The Linux Foundation. All rights reserved.
4+
*/
5+
6+
#include <linux/linkage.h>
7+
8+
SYM_FUNC_START(__hexagon_divsi3)
9+
{
10+
p0 = cmp.gt(r0,#-1)
11+
p1 = cmp.gt(r1,#-1)
12+
r3:2 = vabsw(r1:0)
13+
}
14+
{
15+
p3 = xor(p0,p1)
16+
r4 = sub(r2,r3)
17+
r6 = cl0(r2)
18+
p0 = cmp.gtu(r3,r2)
19+
}
20+
{
21+
r0 = mux(p3,#-1,#1)
22+
r7 = cl0(r3)
23+
p1 = cmp.gtu(r3,r4)
24+
}
25+
{
26+
r0 = mux(p0,#0,r0)
27+
p0 = or(p0,p1)
28+
if (p0.new) jumpr:nt r31
29+
r6 = sub(r7,r6)
30+
}
31+
{
32+
r7 = r6
33+
r5:4 = combine(#1,r3)
34+
r6 = add(#1,lsr(r6,#1))
35+
p0 = cmp.gtu(r6,#4)
36+
}
37+
{
38+
r5:4 = vaslw(r5:4,r7)
39+
if (!p0) r6 = #3
40+
}
41+
{
42+
loop0(1f,r6)
43+
r7:6 = vlsrw(r5:4,#1)
44+
r1:0 = #0
45+
}
46+
.falign
47+
1:
48+
{
49+
r5:4 = vlsrw(r5:4,#2)
50+
if (!p0.new) r0 = add(r0,r5)
51+
if (!p0.new) r2 = sub(r2,r4)
52+
p0 = cmp.gtu(r4,r2)
53+
}
54+
{
55+
r7:6 = vlsrw(r7:6,#2)
56+
if (!p0.new) r0 = add(r0,r7)
57+
if (!p0.new) r2 = sub(r2,r6)
58+
p0 = cmp.gtu(r6,r2)
59+
}:endloop0
60+
{
61+
if (!p0) r0 = add(r0,r7)
62+
}
63+
{
64+
if (p3) r0 = sub(r1,r0)
65+
jumpr r31
66+
}
67+
SYM_FUNC_END(__hexagon_divsi3)
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/* SPDX-License-Identifier: GPL-2.0-only */
2+
/*
3+
* Copyright (c) 2021, The Linux Foundation. All rights reserved.
4+
*/
5+
6+
#include <linux/linkage.h>
7+
8+
SYM_FUNC_START(__hexagon_memcpy_likely_aligned_min32bytes_mult8bytes)
9+
{
10+
p0 = bitsclr(r1,#7)
11+
p0 = bitsclr(r0,#7)
12+
if (p0.new) r5:4 = memd(r1)
13+
if (p0.new) r7:6 = memd(r1+#8)
14+
}
15+
{
16+
if (!p0) jump:nt .Lmemcpy_call
17+
if (p0) r9:8 = memd(r1+#16)
18+
if (p0) r11:10 = memd(r1+#24)
19+
p0 = cmp.gtu(r2,#64)
20+
}
21+
{
22+
if (p0) jump:nt .Lmemcpy_call
23+
if (!p0) memd(r0) = r5:4
24+
if (!p0) memd(r0+#8) = r7:6
25+
p0 = cmp.gtu(r2,#32)
26+
}
27+
{
28+
p1 = cmp.gtu(r2,#40)
29+
p2 = cmp.gtu(r2,#48)
30+
if (p0) r13:12 = memd(r1+#32)
31+
if (p1.new) r15:14 = memd(r1+#40)
32+
}
33+
{
34+
memd(r0+#16) = r9:8
35+
memd(r0+#24) = r11:10
36+
}
37+
{
38+
if (p0) memd(r0+#32) = r13:12
39+
if (p1) memd(r0+#40) = r15:14
40+
if (!p2) jumpr:t r31
41+
}
42+
{
43+
p0 = cmp.gtu(r2,#56)
44+
r5:4 = memd(r1+#48)
45+
if (p0.new) r7:6 = memd(r1+#56)
46+
}
47+
{
48+
memd(r0+#48) = r5:4
49+
if (p0) memd(r0+#56) = r7:6
50+
jumpr r31
51+
}
52+
53+
.Lmemcpy_call:
54+
jump memcpy
55+
56+
SYM_FUNC_END(__hexagon_memcpy_likely_aligned_min32bytes_mult8bytes)

arch/hexagon/lib/modsi3.S

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/* SPDX-License-Identifier: GPL-2.0-only */
2+
/*
3+
* Copyright (c) 2021, The Linux Foundation. All rights reserved.
4+
*/
5+
6+
#include <linux/linkage.h>
7+
8+
SYM_FUNC_START(__hexagon_modsi3)
9+
{
10+
p2 = cmp.ge(r0,#0)
11+
r2 = abs(r0)
12+
r1 = abs(r1)
13+
}
14+
{
15+
r3 = cl0(r2)
16+
r4 = cl0(r1)
17+
p0 = cmp.gtu(r1,r2)
18+
}
19+
{
20+
r3 = sub(r4,r3)
21+
if (p0) jumpr r31
22+
}
23+
{
24+
p1 = cmp.eq(r3,#0)
25+
loop0(1f,r3)
26+
r0 = r2
27+
r2 = lsl(r1,r3)
28+
}
29+
.falign
30+
1:
31+
{
32+
p0 = cmp.gtu(r2,r0)
33+
if (!p0.new) r0 = sub(r0,r2)
34+
r2 = lsr(r2,#1)
35+
if (p1) r1 = #0
36+
}:endloop0
37+
{
38+
p0 = cmp.gtu(r2,r0)
39+
if (!p0.new) r0 = sub(r0,r1)
40+
if (p2) jumpr r31
41+
}
42+
{
43+
r0 = neg(r0)
44+
jumpr r31
45+
}
46+
SYM_FUNC_END(__hexagon_modsi3)

arch/hexagon/lib/udivsi3.S

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/* SPDX-License-Identifier: GPL-2.0-only */
2+
/*
3+
* Copyright (c) 2021, The Linux Foundation. All rights reserved.
4+
*/
5+
6+
#include <linux/linkage.h>
7+
8+
SYM_FUNC_START(__hexagon_udivsi3)
9+
{
10+
r2 = cl0(r0)
11+
r3 = cl0(r1)
12+
r5:4 = combine(#1,#0)
13+
p0 = cmp.gtu(r1,r0)
14+
}
15+
{
16+
r6 = sub(r3,r2)
17+
r4 = r1
18+
r1:0 = combine(r0,r4)
19+
if (p0) jumpr r31
20+
}
21+
{
22+
r3:2 = vlslw(r5:4,r6)
23+
loop0(1f,r6)
24+
}
25+
.falign
26+
1:
27+
{
28+
p0 = cmp.gtu(r2,r1)
29+
if (!p0.new) r1 = sub(r1,r2)
30+
if (!p0.new) r0 = add(r0,r3)
31+
r3:2 = vlsrw(r3:2,#1)
32+
}:endloop0
33+
{
34+
p0 = cmp.gtu(r2,r1)
35+
if (!p0.new) r0 = add(r0,r3)
36+
jumpr r31
37+
}
38+
SYM_FUNC_END(__hexagon_udivsi3)

arch/hexagon/lib/umodsi3.S

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/* SPDX-License-Identifier: GPL-2.0-only */
2+
/*
3+
* Copyright (c) 2021, The Linux Foundation. All rights reserved.
4+
*/
5+
6+
#include <linux/linkage.h>
7+
8+
SYM_FUNC_START(__hexagon_umodsi3)
9+
{
10+
r2 = cl0(r0)
11+
r3 = cl0(r1)
12+
p0 = cmp.gtu(r1,r0)
13+
}
14+
{
15+
r2 = sub(r3,r2)
16+
if (p0) jumpr r31
17+
}
18+
{
19+
loop0(1f,r2)
20+
p1 = cmp.eq(r2,#0)
21+
r2 = lsl(r1,r2)
22+
}
23+
.falign
24+
1:
25+
{
26+
p0 = cmp.gtu(r2,r0)
27+
if (!p0.new) r0 = sub(r0,r2)
28+
r2 = lsr(r2,#1)
29+
if (p1) r1 = #0
30+
}:endloop0
31+
{
32+
p0 = cmp.gtu(r2,r0)
33+
if (!p0.new) r0 = sub(r0,r1)
34+
jumpr r31
35+
}
36+
SYM_FUNC_END(__hexagon_umodsi3)

0 commit comments

Comments
 (0)