Skip to content

Commit 8d8026f

Browse files
committed
Merge tag 'xtensa-20230627' of https://github.com/jcmvbkbc/linux-xtensa
Pull xtensa updates from Max Filippov: - clean up platform_* interface of the xtensa architecture - enable HAVE_ASM_MODVERSIONS - drop ARCH_WANT_FRAME_POINTERS - clean up unaligned access exception handler - provide handler for load/store exceptions - various small fixes and cleanups * tag 'xtensa-20230627' of https://github.com/jcmvbkbc/linux-xtensa: xtensa: dump userspace code around the exception PC xtensa: rearrange show_stack output xtensa: add load/store exception handler xtensa: rearrange unaligned exception handler xtensa: always install slow handler for unaligned access exception xtensa: move early_trap_init from kasan_early_init to init_arch xtensa: drop ARCH_WANT_FRAME_POINTERS xtensa: report trax and perf counters in cpuinfo xtensa: add asm-prototypes.h xtensa: only build __strncpy_user with CONFIG_ARCH_HAS_STRNCPY_FROM_USER xtensa: drop bcopy implementation xtensa: drop EXPORT_SYMBOL for common_exception_return xtensa: boot-redboot: clean up Makefile xtensa: clean up default platform functions xtensa: drop platform_halt and platform_power_off xtensa: drop platform_restart xtensa: drop platform_heartbeat xtensa: xt2000: drop empty platform_init
2 parents 0ae6122 + f7667ca commit 8d8026f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+467
-326
lines changed

arch/xtensa/Kconfig

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ config XTENSA
1616
select ARCH_USE_MEMTEST
1717
select ARCH_USE_QUEUED_RWLOCKS
1818
select ARCH_USE_QUEUED_SPINLOCKS
19-
select ARCH_WANT_FRAME_POINTERS
2019
select ARCH_WANT_IPC_PARSE_VERSION
2120
select BUILDTIME_TABLE_SORT
2221
select CLONE_BACKWARDS
@@ -35,6 +34,7 @@ config XTENSA
3534
select HAVE_ARCH_KCSAN
3635
select HAVE_ARCH_SECCOMP_FILTER
3736
select HAVE_ARCH_TRACEHOOK
37+
select HAVE_ASM_MODVERSIONS
3838
select HAVE_CONTEXT_TRACKING_USER
3939
select HAVE_DEBUG_KMEMLEAK
4040
select HAVE_DMA_CONTIGUOUS
@@ -203,6 +203,18 @@ config XTENSA_UNALIGNED_USER
203203

204204
Say Y here to enable unaligned memory access in user space.
205205

206+
config XTENSA_LOAD_STORE
207+
bool "Load/store exception handler for memory only readable with l32"
208+
help
209+
The Xtensa architecture only allows reading memory attached to its
210+
instruction bus with l32r and l32i instructions, all other
211+
instructions raise an exception with the LoadStoreErrorCause code.
212+
This makes it hard to use some configurations, e.g. store string
213+
literals in FLASH memory attached to the instruction bus.
214+
215+
Say Y here to enable exception handler that allows transparent
216+
byte and 2-byte access to memory attached to instruction bus.
217+
206218
config HAVE_SMP
207219
bool "System Supports SMP (MX)"
208220
depends on XTENSA_VARIANT_CUSTOM

arch/xtensa/Kconfig.debug

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,11 @@ config PRINT_STACK_DEPTH
3838
help
3939
This option allows you to set the stack depth that the kernel
4040
prints in stack traces.
41+
42+
config PRINT_USER_CODE_ON_UNHANDLED_EXCEPTION
43+
bool "Dump user code around unhandled exception address"
44+
help
45+
Enable this option to display user code around PC of the unhandled
46+
exception (starting at address aligned on 16 byte boundary).
47+
This may simplify finding faulting code in the absence of other
48+
debug facilities.

arch/xtensa/boot/boot-redboot/Makefile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,23 @@
66

77
OBJCOPY_ARGS := -O $(if $(CONFIG_CPU_BIG_ENDIAN),elf32-xtensa-be,elf32-xtensa-le)
88

9-
LD_ARGS = -T $(srctree)/$(obj)/boot.ld
10-
119
boot-y := bootstrap.o
1210
targets += $(boot-y)
1311

1412
OBJS := $(addprefix $(obj)/,$(boot-y))
1513
LIBS := arch/xtensa/boot/lib/lib.a arch/xtensa/lib/lib.a
1614

17-
LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
18-
1915
$(obj)/zImage.o: $(obj)/../vmlinux.bin.gz $(OBJS)
2016
$(Q)$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
2117
--add-section image=$< \
2218
--set-section-flags image=contents,alloc,load,load,data \
2319
$(OBJS) $@
2420

2521
$(obj)/zImage.elf: $(obj)/zImage.o $(LIBS)
26-
$(Q)$(LD) $(LD_ARGS) -o $@ $^ -L/xtensa-elf/lib $(LIBGCC)
22+
$(Q)$(LD) $(KBUILD_LDFLAGS) \
23+
-T $(srctree)/$(obj)/boot.ld \
24+
--build-id=none \
25+
-o $@ $^
2726

2827
$(obj)/../zImage.redboot: $(obj)/zImage.elf
2928
$(Q)$(OBJCOPY) -S -O binary $< $@
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
#ifndef __ASM_PROTOTYPES_H
3+
#define __ASM_PROTOTYPES_H
4+
5+
#include <asm/cacheflush.h>
6+
#include <asm/checksum.h>
7+
#include <asm/ftrace.h>
8+
#include <asm/page.h>
9+
#include <asm/string.h>
10+
#include <asm/uaccess.h>
11+
12+
#include <asm-generic/asm-prototypes.h>
13+
14+
/*
15+
* gcc internal math functions
16+
*/
17+
long long __ashrdi3(long long, int);
18+
long long __ashldi3(long long, int);
19+
long long __bswapdi2(long long);
20+
int __bswapsi2(int);
21+
long long __lshrdi3(long long, int);
22+
int __divsi3(int, int);
23+
int __modsi3(int, int);
24+
int __mulsi3(int, int);
25+
unsigned int __udivsi3(unsigned int, unsigned int);
26+
unsigned int __umodsi3(unsigned int, unsigned int);
27+
unsigned long long __umulsidi3(unsigned int, unsigned int);
28+
29+
#endif /* __ASM_PROTOTYPES_H */

arch/xtensa/include/asm/asmmacro.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#ifndef _XTENSA_ASMMACRO_H
1212
#define _XTENSA_ASMMACRO_H
1313

14+
#include <asm-generic/export.h>
1415
#include <asm/core.h>
1516

1617
/*

arch/xtensa/include/asm/core.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@
2626
#define XCHAL_SPANNING_WAY 0
2727
#endif
2828

29+
#ifndef XCHAL_HAVE_TRAX
30+
#define XCHAL_HAVE_TRAX 0
31+
#endif
32+
33+
#ifndef XCHAL_NUM_PERF_COUNTERS
34+
#define XCHAL_NUM_PERF_COUNTERS 0
35+
#endif
36+
2937
#if XCHAL_HAVE_WINDOWED
3038
#if defined(CONFIG_USER_ABI_DEFAULT) || defined(CONFIG_USER_ABI_CALL0_PROBE)
3139
/* Whether windowed ABI is supported in userspace. */

arch/xtensa/include/asm/ftrace.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,8 @@
1313
#include <asm/processor.h>
1414

1515
#ifndef __ASSEMBLY__
16-
#define ftrace_return_address0 ({ unsigned long a0, a1; \
17-
__asm__ __volatile__ ( \
18-
"mov %0, a0\n" \
19-
"mov %1, a1\n" \
20-
: "=r"(a0), "=r"(a1)); \
21-
MAKE_PC_FROM_RA(a0, a1); })
22-
23-
#ifdef CONFIG_FRAME_POINTER
2416
extern unsigned long return_address(unsigned level);
2517
#define ftrace_return_address(n) return_address(n)
26-
#endif
2718
#endif /* __ASSEMBLY__ */
2819

2920
#ifdef CONFIG_FUNCTION_TRACER

arch/xtensa/include/asm/platform.h

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -27,31 +27,11 @@ extern void platform_init(bp_tag_t*);
2727
*/
2828
extern void platform_setup (char **);
2929

30-
/*
31-
* platform_restart is called to restart the system.
32-
*/
33-
extern void platform_restart (void);
34-
35-
/*
36-
* platform_halt is called to stop the system and halt.
37-
*/
38-
extern void platform_halt (void);
39-
40-
/*
41-
* platform_power_off is called to stop the system and power it off.
42-
*/
43-
extern void platform_power_off (void);
44-
4530
/*
4631
* platform_idle is called from the idle function.
4732
*/
4833
extern void platform_idle (void);
4934

50-
/*
51-
* platform_heartbeat is called every HZ
52-
*/
53-
extern void platform_heartbeat (void);
54-
5535
/*
5636
* platform_calibrate_ccount calibrates cpu clock freq (CONFIG_XTENSA_CALIBRATE)
5737
*/

arch/xtensa/include/asm/string.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,6 @@ extern void *__memcpy(void *__to, __const__ void *__from, size_t __n);
118118
extern void *memmove(void *__dest, __const__ void *__src, size_t __n);
119119
extern void *__memmove(void *__dest, __const__ void *__src, size_t __n);
120120

121-
/* Don't build bcopy at all ... */
122-
#define __HAVE_ARCH_BCOPY
123-
124121
#if defined(CONFIG_KASAN) && !defined(__SANITIZE_ADDRESS__)
125122

126123
/*

arch/xtensa/include/asm/traps.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ __init trap_set_handler(int cause, xtensa_exception_handler *handler);
4747
asmlinkage void fast_illegal_instruction_user(void);
4848
asmlinkage void fast_syscall_user(void);
4949
asmlinkage void fast_alloca(void);
50+
asmlinkage void fast_load_store(void);
5051
asmlinkage void fast_unaligned(void);
5152
asmlinkage void fast_second_level_miss(void);
5253
asmlinkage void fast_store_prohibited(void);
@@ -64,8 +65,14 @@ void do_unhandled(struct pt_regs *regs);
6465
static inline void __init early_trap_init(void)
6566
{
6667
static struct exc_table init_exc_table __initdata = {
68+
#ifdef CONFIG_XTENSA_LOAD_STORE
69+
.fast_kernel_handler[EXCCAUSE_LOAD_STORE_ERROR] =
70+
fast_load_store,
71+
#endif
72+
#ifdef CONFIG_MMU
6773
.fast_kernel_handler[EXCCAUSE_DTLB_MISS] =
6874
fast_second_level_miss,
75+
#endif
6976
};
7077
xtensa_set_sr(&init_exc_table, excsave1);
7178
}

0 commit comments

Comments
 (0)