Skip to content

Commit 09bf0f1

Browse files
committed
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
2 parents 49a73b1 + b7cf2a1 commit 09bf0f1

File tree

6 files changed

+20
-28
lines changed

6 files changed

+20
-28
lines changed

arch/xtensa/include/asm/cacheflush.h

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ void flush_cache_range(struct vm_area_struct*, ulong, ulong);
100100
void flush_icache_range(unsigned long start, unsigned long end);
101101
void flush_cache_page(struct vm_area_struct*,
102102
unsigned long, unsigned long);
103+
#define flush_cache_all flush_cache_all
104+
#define flush_cache_range flush_cache_range
105+
#define flush_icache_range flush_icache_range
106+
#define flush_cache_page flush_cache_page
103107
#else
104108
#define flush_cache_all local_flush_cache_all
105109
#define flush_cache_range local_flush_cache_range
@@ -136,20 +140,7 @@ void local_flush_cache_page(struct vm_area_struct *vma,
136140

137141
#else
138142

139-
#define flush_cache_all() do { } while (0)
140-
#define flush_cache_mm(mm) do { } while (0)
141-
#define flush_cache_dup_mm(mm) do { } while (0)
142-
143-
#define flush_cache_vmap(start,end) do { } while (0)
144-
#define flush_cache_vmap_early(start,end) do { } while (0)
145-
#define flush_cache_vunmap(start,end) do { } while (0)
146-
147-
#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0
148-
#define flush_dcache_page(page) do { } while (0)
149-
150143
#define flush_icache_range local_flush_icache_range
151-
#define flush_cache_page(vma, addr, pfn) do { } while (0)
152-
#define flush_cache_range(vma, start, end) do { } while (0)
153144

154145
#endif
155146

@@ -162,15 +153,14 @@ void local_flush_cache_page(struct vm_area_struct *vma,
162153
__invalidate_icache_range(start,(end) - (start)); \
163154
} while (0)
164155

165-
#define flush_dcache_mmap_lock(mapping) do { } while (0)
166-
#define flush_dcache_mmap_unlock(mapping) do { } while (0)
167-
168156
#if defined(CONFIG_MMU) && (DCACHE_WAY_SIZE > PAGE_SIZE)
169157

170158
extern void copy_to_user_page(struct vm_area_struct*, struct page*,
171159
unsigned long, void*, const void*, unsigned long);
172160
extern void copy_from_user_page(struct vm_area_struct*, struct page*,
173161
unsigned long, void*, const void*, unsigned long);
162+
#define copy_to_user_page copy_to_user_page
163+
#define copy_from_user_page copy_from_user_page
174164

175165
#else
176166

@@ -186,4 +176,6 @@ extern void copy_from_user_page(struct vm_area_struct*, struct page*,
186176

187177
#endif
188178

179+
#include <asm-generic/cacheflush.h>
180+
189181
#endif /* _XTENSA_CACHEFLUSH_H */

arch/xtensa/include/asm/processor.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@
115115
#define MAKE_RA_FOR_CALL(ra,ws) (((ra) & 0x3fffffff) | (ws) << 30)
116116

117117
/* Convert return address to a valid pc
118-
* Note: We assume that the stack pointer is in the same 1GB ranges as the ra
118+
* Note: 'text' is the address within the same 1GB range as the ra
119119
*/
120-
#define MAKE_PC_FROM_RA(ra,sp) (((ra) & 0x3fffffff) | ((sp) & 0xc0000000))
120+
#define MAKE_PC_FROM_RA(ra, text) (((ra) & 0x3fffffff) | ((unsigned long)(text) & 0xc0000000))
121121

122122
#elif defined(__XTENSA_CALL0_ABI__)
123123

@@ -127,9 +127,9 @@
127127
#define MAKE_RA_FOR_CALL(ra, ws) (ra)
128128

129129
/* Convert return address to a valid pc
130-
* Note: We assume that the stack pointer is in the same 1GB ranges as the ra
130+
* Note: 'text' is not used as 'ra' is always the full address
131131
*/
132-
#define MAKE_PC_FROM_RA(ra, sp) (ra)
132+
#define MAKE_PC_FROM_RA(ra, text) (ra)
133133

134134
#else
135135
#error Unsupported Xtensa ABI

arch/xtensa/include/asm/ptrace.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ struct pt_regs {
8787
# define user_mode(regs) (((regs)->ps & 0x00000020)!=0)
8888
# define instruction_pointer(regs) ((regs)->pc)
8989
# define return_pointer(regs) (MAKE_PC_FROM_RA((regs)->areg[0], \
90-
(regs)->areg[1]))
90+
(regs)->pc))
9191

9292
# ifndef CONFIG_SMP
9393
# define profile_pc(regs) instruction_pointer(regs)

arch/xtensa/kernel/process.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
#include <asm/asm-offsets.h>
4848
#include <asm/regs.h>
4949
#include <asm/hw_breakpoint.h>
50+
#include <asm/sections.h>
5051
#include <asm/traps.h>
5152

5253
extern void ret_from_fork(void);
@@ -380,7 +381,7 @@ unsigned long __get_wchan(struct task_struct *p)
380381
int count = 0;
381382

382383
sp = p->thread.sp;
383-
pc = MAKE_PC_FROM_RA(p->thread.ra, p->thread.sp);
384+
pc = MAKE_PC_FROM_RA(p->thread.ra, _text);
384385

385386
do {
386387
if (sp < stack_page + sizeof(struct task_struct) ||
@@ -392,7 +393,7 @@ unsigned long __get_wchan(struct task_struct *p)
392393

393394
/* Stack layout: sp-4: ra, sp-3: sp' */
394395

395-
pc = MAKE_PC_FROM_RA(SPILL_SLOT(sp, 0), sp);
396+
pc = MAKE_PC_FROM_RA(SPILL_SLOT(sp, 0), _text);
396397
sp = SPILL_SLOT(sp, 1);
397398
} while (count++ < 16);
398399
return 0;

arch/xtensa/kernel/stacktrace.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/stacktrace.h>
1414

1515
#include <asm/ftrace.h>
16+
#include <asm/sections.h>
1617
#include <asm/stacktrace.h>
1718
#include <asm/traps.h>
1819
#include <linux/uaccess.h>
@@ -189,7 +190,7 @@ void walk_stackframe(unsigned long *sp,
189190
if (a1 <= (unsigned long)sp)
190191
break;
191192

192-
frame.pc = MAKE_PC_FROM_RA(a0, a1);
193+
frame.pc = MAKE_PC_FROM_RA(a0, _text);
193194
frame.sp = a1;
194195

195196
if (fn(&frame, data))

arch/xtensa/platforms/iss/console.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,8 @@ late_initcall(rs_init);
166166

167167
static void iss_console_write(struct console *co, const char *s, unsigned count)
168168
{
169-
if (s && *s != 0) {
170-
int len = strlen(s);
171-
simc_write(1, s, count < len ? count : len);
172-
}
169+
if (s && *s != 0)
170+
simc_write(1, s, min(count, strlen(s)));
173171
}
174172

175173
static struct tty_driver* iss_console_device(struct console *c, int *index)

0 commit comments

Comments
 (0)