Commit 09bf0f19 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'xtensa-20240502' of https://github.com/jcmvbkbc/linux-xtensa

Pull xtensa fixes from Max Filippov:

 - fix unused variable warning caused by empty flush_dcache_page()
   definition

 - fix stack unwinding on windowed noMMU XIP configurations

 - fix Coccinelle warning 'opportunity for min()' in xtensa ISS platform
   code

* tag 'xtensa-20240502' of https://github.com/jcmvbkbc/linux-xtensa:
  xtensa: remove redundant flush_dcache_page and ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE macros
  tty: xtensa/iss: Use min() to fix Coccinelle warning
  xtensa: fix MAKE_PC_FROM_RA second argument
parents 49a73b16 b7cf2a1d
...@@ -100,6 +100,10 @@ void flush_cache_range(struct vm_area_struct*, ulong, ulong); ...@@ -100,6 +100,10 @@ void flush_cache_range(struct vm_area_struct*, ulong, ulong);
void flush_icache_range(unsigned long start, unsigned long end); void flush_icache_range(unsigned long start, unsigned long end);
void flush_cache_page(struct vm_area_struct*, void flush_cache_page(struct vm_area_struct*,
unsigned long, unsigned long); unsigned long, unsigned long);
#define flush_cache_all flush_cache_all
#define flush_cache_range flush_cache_range
#define flush_icache_range flush_icache_range
#define flush_cache_page flush_cache_page
#else #else
#define flush_cache_all local_flush_cache_all #define flush_cache_all local_flush_cache_all
#define flush_cache_range local_flush_cache_range #define flush_cache_range local_flush_cache_range
...@@ -136,20 +140,7 @@ void local_flush_cache_page(struct vm_area_struct *vma, ...@@ -136,20 +140,7 @@ void local_flush_cache_page(struct vm_area_struct *vma,
#else #else
#define flush_cache_all() do { } while (0)
#define flush_cache_mm(mm) do { } while (0)
#define flush_cache_dup_mm(mm) do { } while (0)
#define flush_cache_vmap(start,end) do { } while (0)
#define flush_cache_vmap_early(start,end) do { } while (0)
#define flush_cache_vunmap(start,end) do { } while (0)
#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0
#define flush_dcache_page(page) do { } while (0)
#define flush_icache_range local_flush_icache_range #define flush_icache_range local_flush_icache_range
#define flush_cache_page(vma, addr, pfn) do { } while (0)
#define flush_cache_range(vma, start, end) do { } while (0)
#endif #endif
...@@ -162,15 +153,14 @@ void local_flush_cache_page(struct vm_area_struct *vma, ...@@ -162,15 +153,14 @@ void local_flush_cache_page(struct vm_area_struct *vma,
__invalidate_icache_range(start,(end) - (start)); \ __invalidate_icache_range(start,(end) - (start)); \
} while (0) } while (0)
#define flush_dcache_mmap_lock(mapping) do { } while (0)
#define flush_dcache_mmap_unlock(mapping) do { } while (0)
#if defined(CONFIG_MMU) && (DCACHE_WAY_SIZE > PAGE_SIZE) #if defined(CONFIG_MMU) && (DCACHE_WAY_SIZE > PAGE_SIZE)
extern void copy_to_user_page(struct vm_area_struct*, struct page*, extern void copy_to_user_page(struct vm_area_struct*, struct page*,
unsigned long, void*, const void*, unsigned long); unsigned long, void*, const void*, unsigned long);
extern void copy_from_user_page(struct vm_area_struct*, struct page*, extern void copy_from_user_page(struct vm_area_struct*, struct page*,
unsigned long, void*, const void*, unsigned long); unsigned long, void*, const void*, unsigned long);
#define copy_to_user_page copy_to_user_page
#define copy_from_user_page copy_from_user_page
#else #else
...@@ -186,4 +176,6 @@ extern void copy_from_user_page(struct vm_area_struct*, struct page*, ...@@ -186,4 +176,6 @@ extern void copy_from_user_page(struct vm_area_struct*, struct page*,
#endif #endif
#include <asm-generic/cacheflush.h>
#endif /* _XTENSA_CACHEFLUSH_H */ #endif /* _XTENSA_CACHEFLUSH_H */
...@@ -115,9 +115,9 @@ ...@@ -115,9 +115,9 @@
#define MAKE_RA_FOR_CALL(ra,ws) (((ra) & 0x3fffffff) | (ws) << 30) #define MAKE_RA_FOR_CALL(ra,ws) (((ra) & 0x3fffffff) | (ws) << 30)
/* Convert return address to a valid pc /* Convert return address to a valid pc
* Note: We assume that the stack pointer is in the same 1GB ranges as the ra * Note: 'text' is the address within the same 1GB range as the ra
*/ */
#define MAKE_PC_FROM_RA(ra,sp) (((ra) & 0x3fffffff) | ((sp) & 0xc0000000)) #define MAKE_PC_FROM_RA(ra, text) (((ra) & 0x3fffffff) | ((unsigned long)(text) & 0xc0000000))
#elif defined(__XTENSA_CALL0_ABI__) #elif defined(__XTENSA_CALL0_ABI__)
...@@ -127,9 +127,9 @@ ...@@ -127,9 +127,9 @@
#define MAKE_RA_FOR_CALL(ra, ws) (ra) #define MAKE_RA_FOR_CALL(ra, ws) (ra)
/* Convert return address to a valid pc /* Convert return address to a valid pc
* Note: We assume that the stack pointer is in the same 1GB ranges as the ra * Note: 'text' is not used as 'ra' is always the full address
*/ */
#define MAKE_PC_FROM_RA(ra, sp) (ra) #define MAKE_PC_FROM_RA(ra, text) (ra)
#else #else
#error Unsupported Xtensa ABI #error Unsupported Xtensa ABI
......
...@@ -87,7 +87,7 @@ struct pt_regs { ...@@ -87,7 +87,7 @@ struct pt_regs {
# define user_mode(regs) (((regs)->ps & 0x00000020)!=0) # define user_mode(regs) (((regs)->ps & 0x00000020)!=0)
# define instruction_pointer(regs) ((regs)->pc) # define instruction_pointer(regs) ((regs)->pc)
# define return_pointer(regs) (MAKE_PC_FROM_RA((regs)->areg[0], \ # define return_pointer(regs) (MAKE_PC_FROM_RA((regs)->areg[0], \
(regs)->areg[1])) (regs)->pc))
# ifndef CONFIG_SMP # ifndef CONFIG_SMP
# define profile_pc(regs) instruction_pointer(regs) # define profile_pc(regs) instruction_pointer(regs)
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#include <asm/asm-offsets.h> #include <asm/asm-offsets.h>
#include <asm/regs.h> #include <asm/regs.h>
#include <asm/hw_breakpoint.h> #include <asm/hw_breakpoint.h>
#include <asm/sections.h>
#include <asm/traps.h> #include <asm/traps.h>
extern void ret_from_fork(void); extern void ret_from_fork(void);
...@@ -380,7 +381,7 @@ unsigned long __get_wchan(struct task_struct *p) ...@@ -380,7 +381,7 @@ unsigned long __get_wchan(struct task_struct *p)
int count = 0; int count = 0;
sp = p->thread.sp; sp = p->thread.sp;
pc = MAKE_PC_FROM_RA(p->thread.ra, p->thread.sp); pc = MAKE_PC_FROM_RA(p->thread.ra, _text);
do { do {
if (sp < stack_page + sizeof(struct task_struct) || if (sp < stack_page + sizeof(struct task_struct) ||
...@@ -392,7 +393,7 @@ unsigned long __get_wchan(struct task_struct *p) ...@@ -392,7 +393,7 @@ unsigned long __get_wchan(struct task_struct *p)
/* Stack layout: sp-4: ra, sp-3: sp' */ /* Stack layout: sp-4: ra, sp-3: sp' */
pc = MAKE_PC_FROM_RA(SPILL_SLOT(sp, 0), sp); pc = MAKE_PC_FROM_RA(SPILL_SLOT(sp, 0), _text);
sp = SPILL_SLOT(sp, 1); sp = SPILL_SLOT(sp, 1);
} while (count++ < 16); } while (count++ < 16);
return 0; return 0;
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <linux/stacktrace.h> #include <linux/stacktrace.h>
#include <asm/ftrace.h> #include <asm/ftrace.h>
#include <asm/sections.h>
#include <asm/stacktrace.h> #include <asm/stacktrace.h>
#include <asm/traps.h> #include <asm/traps.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
...@@ -189,7 +190,7 @@ void walk_stackframe(unsigned long *sp, ...@@ -189,7 +190,7 @@ void walk_stackframe(unsigned long *sp,
if (a1 <= (unsigned long)sp) if (a1 <= (unsigned long)sp)
break; break;
frame.pc = MAKE_PC_FROM_RA(a0, a1); frame.pc = MAKE_PC_FROM_RA(a0, _text);
frame.sp = a1; frame.sp = a1;
if (fn(&frame, data)) if (fn(&frame, data))
......
...@@ -166,10 +166,8 @@ late_initcall(rs_init); ...@@ -166,10 +166,8 @@ late_initcall(rs_init);
static void iss_console_write(struct console *co, const char *s, unsigned count) static void iss_console_write(struct console *co, const char *s, unsigned count)
{ {
if (s && *s != 0) { if (s && *s != 0)
int len = strlen(s); simc_write(1, s, min(count, strlen(s)));
simc_write(1, s, count < len ? count : len);
}
} }
static struct tty_driver* iss_console_device(struct console *c, int *index) static struct tty_driver* iss_console_device(struct console *c, int *index)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment