Skip to content

Commit

Permalink
Merge tag 'xtensa-20230627' of https://github.com/jcmvbkbc/linux-xtensa
Browse files Browse the repository at this point in the history
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
  • Loading branch information
torvalds committed Jun 27, 2023
2 parents 0ae6122 + f7667ca commit 8d8026f
Show file tree
Hide file tree
Showing 41 changed files with 467 additions and 326 deletions.
14 changes: 13 additions & 1 deletion arch/xtensa/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ config XTENSA
select ARCH_USE_MEMTEST
select ARCH_USE_QUEUED_RWLOCKS
select ARCH_USE_QUEUED_SPINLOCKS
select ARCH_WANT_FRAME_POINTERS
select ARCH_WANT_IPC_PARSE_VERSION
select BUILDTIME_TABLE_SORT
select CLONE_BACKWARDS
Expand All @@ -35,6 +34,7 @@ config XTENSA
select HAVE_ARCH_KCSAN
select HAVE_ARCH_SECCOMP_FILTER
select HAVE_ARCH_TRACEHOOK
select HAVE_ASM_MODVERSIONS
select HAVE_CONTEXT_TRACKING_USER
select HAVE_DEBUG_KMEMLEAK
select HAVE_DMA_CONTIGUOUS
Expand Down Expand Up @@ -203,6 +203,18 @@ config XTENSA_UNALIGNED_USER

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

config XTENSA_LOAD_STORE
bool "Load/store exception handler for memory only readable with l32"
help
The Xtensa architecture only allows reading memory attached to its
instruction bus with l32r and l32i instructions, all other
instructions raise an exception with the LoadStoreErrorCause code.
This makes it hard to use some configurations, e.g. store string
literals in FLASH memory attached to the instruction bus.

Say Y here to enable exception handler that allows transparent
byte and 2-byte access to memory attached to instruction bus.

config HAVE_SMP
bool "System Supports SMP (MX)"
depends on XTENSA_VARIANT_CUSTOM
Expand Down
8 changes: 8 additions & 0 deletions arch/xtensa/Kconfig.debug
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,11 @@ config PRINT_STACK_DEPTH
help
This option allows you to set the stack depth that the kernel
prints in stack traces.

config PRINT_USER_CODE_ON_UNHANDLED_EXCEPTION
bool "Dump user code around unhandled exception address"
help
Enable this option to display user code around PC of the unhandled
exception (starting at address aligned on 16 byte boundary).
This may simplify finding faulting code in the absence of other
debug facilities.
9 changes: 4 additions & 5 deletions arch/xtensa/boot/boot-redboot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,23 @@

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

LD_ARGS = -T $(srctree)/$(obj)/boot.ld

boot-y := bootstrap.o
targets += $(boot-y)

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

LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)

$(obj)/zImage.o: $(obj)/../vmlinux.bin.gz $(OBJS)
$(Q)$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
--add-section image=$< \
--set-section-flags image=contents,alloc,load,load,data \
$(OBJS) $@

$(obj)/zImage.elf: $(obj)/zImage.o $(LIBS)
$(Q)$(LD) $(LD_ARGS) -o $@ $^ -L/xtensa-elf/lib $(LIBGCC)
$(Q)$(LD) $(KBUILD_LDFLAGS) \
-T $(srctree)/$(obj)/boot.ld \
--build-id=none \
-o $@ $^

$(obj)/../zImage.redboot: $(obj)/zImage.elf
$(Q)$(OBJCOPY) -S -O binary $< $@
Expand Down
29 changes: 29 additions & 0 deletions arch/xtensa/include/asm/asm-prototypes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __ASM_PROTOTYPES_H
#define __ASM_PROTOTYPES_H

#include <asm/cacheflush.h>
#include <asm/checksum.h>
#include <asm/ftrace.h>
#include <asm/page.h>
#include <asm/string.h>
#include <asm/uaccess.h>

#include <asm-generic/asm-prototypes.h>

/*
* gcc internal math functions
*/
long long __ashrdi3(long long, int);
long long __ashldi3(long long, int);
long long __bswapdi2(long long);
int __bswapsi2(int);
long long __lshrdi3(long long, int);
int __divsi3(int, int);
int __modsi3(int, int);
int __mulsi3(int, int);
unsigned int __udivsi3(unsigned int, unsigned int);
unsigned int __umodsi3(unsigned int, unsigned int);
unsigned long long __umulsidi3(unsigned int, unsigned int);

#endif /* __ASM_PROTOTYPES_H */
1 change: 1 addition & 0 deletions arch/xtensa/include/asm/asmmacro.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#ifndef _XTENSA_ASMMACRO_H
#define _XTENSA_ASMMACRO_H

#include <asm-generic/export.h>
#include <asm/core.h>

/*
Expand Down
8 changes: 8 additions & 0 deletions arch/xtensa/include/asm/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@
#define XCHAL_SPANNING_WAY 0
#endif

#ifndef XCHAL_HAVE_TRAX
#define XCHAL_HAVE_TRAX 0
#endif

#ifndef XCHAL_NUM_PERF_COUNTERS
#define XCHAL_NUM_PERF_COUNTERS 0
#endif

#if XCHAL_HAVE_WINDOWED
#if defined(CONFIG_USER_ABI_DEFAULT) || defined(CONFIG_USER_ABI_CALL0_PROBE)
/* Whether windowed ABI is supported in userspace. */
Expand Down
9 changes: 0 additions & 9 deletions arch/xtensa/include/asm/ftrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,8 @@
#include <asm/processor.h>

#ifndef __ASSEMBLY__
#define ftrace_return_address0 ({ unsigned long a0, a1; \
__asm__ __volatile__ ( \
"mov %0, a0\n" \
"mov %1, a1\n" \
: "=r"(a0), "=r"(a1)); \
MAKE_PC_FROM_RA(a0, a1); })

#ifdef CONFIG_FRAME_POINTER
extern unsigned long return_address(unsigned level);
#define ftrace_return_address(n) return_address(n)
#endif
#endif /* __ASSEMBLY__ */

#ifdef CONFIG_FUNCTION_TRACER
Expand Down
20 changes: 0 additions & 20 deletions arch/xtensa/include/asm/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,11 @@ extern void platform_init(bp_tag_t*);
*/
extern void platform_setup (char **);

/*
* platform_restart is called to restart the system.
*/
extern void platform_restart (void);

/*
* platform_halt is called to stop the system and halt.
*/
extern void platform_halt (void);

/*
* platform_power_off is called to stop the system and power it off.
*/
extern void platform_power_off (void);

/*
* platform_idle is called from the idle function.
*/
extern void platform_idle (void);

/*
* platform_heartbeat is called every HZ
*/
extern void platform_heartbeat (void);

/*
* platform_calibrate_ccount calibrates cpu clock freq (CONFIG_XTENSA_CALIBRATE)
*/
Expand Down
3 changes: 0 additions & 3 deletions arch/xtensa/include/asm/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,6 @@ extern void *__memcpy(void *__to, __const__ void *__from, size_t __n);
extern void *memmove(void *__dest, __const__ void *__src, size_t __n);
extern void *__memmove(void *__dest, __const__ void *__src, size_t __n);

/* Don't build bcopy at all ... */
#define __HAVE_ARCH_BCOPY

#if defined(CONFIG_KASAN) && !defined(__SANITIZE_ADDRESS__)

/*
Expand Down
7 changes: 7 additions & 0 deletions arch/xtensa/include/asm/traps.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ __init trap_set_handler(int cause, xtensa_exception_handler *handler);
asmlinkage void fast_illegal_instruction_user(void);
asmlinkage void fast_syscall_user(void);
asmlinkage void fast_alloca(void);
asmlinkage void fast_load_store(void);
asmlinkage void fast_unaligned(void);
asmlinkage void fast_second_level_miss(void);
asmlinkage void fast_store_prohibited(void);
Expand All @@ -64,8 +65,14 @@ void do_unhandled(struct pt_regs *regs);
static inline void __init early_trap_init(void)
{
static struct exc_table init_exc_table __initdata = {
#ifdef CONFIG_XTENSA_LOAD_STORE
.fast_kernel_handler[EXCCAUSE_LOAD_STORE_ERROR] =
fast_load_store,
#endif
#ifdef CONFIG_MMU
.fast_kernel_handler[EXCCAUSE_DTLB_MISS] =
fast_second_level_miss,
#endif
};
xtensa_set_sr(&init_exc_table, excsave1);
}
Expand Down
Loading

0 comments on commit 8d8026f

Please sign in to comment.