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
Unified · Split
| @@ -100,6 +100,10 @@ void flush_cache_range(struct vm_area_struct*, ulong, ulong); · 99 unmodified lines | |||
| 100 | void flush_icache_range(unsigned long start, unsigned long end); | 100 | void flush_icache_range(unsigned long start, unsigned long end); |
| 101 | void flush_cache_page(struct vm_area_struct*, | 101 | void flush_cache_page(struct vm_area_struct*, |
| 102 | unsigned long, unsigned long); | 102 | 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 | ||
| 103 | #else | 107 | #else |
| 104 | #define flush_cache_all local_flush_cache_all | 108 | #define flush_cache_all local_flush_cache_all |
| 105 | #define flush_cache_range local_flush_cache_range | 109 | #define flush_cache_range local_flush_cache_range |
| @@ -136,20 +140,7 @@ void local_flush_cache_page(struct vm_area_struct *vma, · 30 unmodified lines | |||
| 136 | 140 | ||
| 137 | #else | 141 | #else |
| 138 | 142 | ||
| 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 | |||
| 150 | #define flush_icache_range local_flush_icache_range | 143 | #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) | ||
| 153 | 144 | ||
| 154 | #endif | 145 | #endif |
| 155 | 146 | ||
| @@ -162,15 +153,14 @@ void local_flush_cache_page(struct vm_area_struct *vma, · 6 unmodified lines | |||
| 162 | __invalidate_icache_range(start,(end) - (start)); \ | 153 | __invalidate_icache_range(start,(end) - (start)); \ |
| 163 | } while (0) | 154 | } while (0) |
| 164 | 155 | ||
| 165 | #define flush_dcache_mmap_lock(mapping) do { } while (0) | ||
| 166 | #define flush_dcache_mmap_unlock(mapping) do { } while (0) | ||
| 167 | |||
| 168 | #if defined(CONFIG_MMU) && (DCACHE_WAY_SIZE > PAGE_SIZE) | 156 | #if defined(CONFIG_MMU) && (DCACHE_WAY_SIZE > PAGE_SIZE) |
| 169 | 157 | ||
| 170 | extern void copy_to_user_page(struct vm_area_struct*, struct page*, | 158 | extern void copy_to_user_page(struct vm_area_struct*, struct page*, |
| 171 | unsigned long, void*, const void*, unsigned long); | 159 | unsigned long, void*, const void*, unsigned long); |
| 172 | extern void copy_from_user_page(struct vm_area_struct*, struct page*, | 160 | extern void copy_from_user_page(struct vm_area_struct*, struct page*, |
| 173 | unsigned long, void*, const void*, unsigned long); | 161 | 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 | ||
| 174 | 164 | ||
| 175 | #else | 165 | #else |
| 176 | 166 | ||
| @@ -186,4 +176,6 @@ extern void copy_from_user_page(struct vm_area_struct*, struct page*, · 9 unmodified lines | |||
| 186 | 176 | ||
| 187 | #endif | 177 | #endif |
| 188 | 178 | ||
| 179 | #include <asm-generic/cacheflush.h> | ||
| 180 | |||
| 189 | #endif /* _XTENSA_CACHEFLUSH_H */ | 181 | #endif /* _XTENSA_CACHEFLUSH_H */ |
| @@ -115,9 +115,9 @@ · 114 unmodified lines | |||
| 115 | #define MAKE_RA_FOR_CALL(ra,ws) (((ra) & 0x3fffffff) | (ws) << 30) | 115 | #define MAKE_RA_FOR_CALL(ra,ws) (((ra) & 0x3fffffff) | (ws) << 30) |
| 116 | 116 | ||
| 117 | /* Convert return address to a valid pc | 117 | /* 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 |
| 119 | */ | 119 | */ |
| 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)) |
| 121 | 121 | ||
| 122 | #elif defined(__XTENSA_CALL0_ABI__) | 122 | #elif defined(__XTENSA_CALL0_ABI__) |
| 123 | 123 | ||
| @@ -127,9 +127,9 @@ · 3 unmodified lines | |||
| 127 | #define MAKE_RA_FOR_CALL(ra, ws) (ra) | 127 | #define MAKE_RA_FOR_CALL(ra, ws) (ra) |
| 128 | 128 | ||
| 129 | /* Convert return address to a valid pc | 129 | /* 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 |
| 131 | */ | 131 | */ |
| 132 | #define MAKE_PC_FROM_RA(ra, sp) (ra) | 132 | #define MAKE_PC_FROM_RA(ra, text) (ra) |
| 133 | 133 | ||
| 134 | #else | 134 | #else |
| 135 | #error Unsupported Xtensa ABI | 135 | #error Unsupported Xtensa ABI |
| @@ -87,7 +87,7 @@ struct pt_regs { · 86 unmodified lines | |||
| 87 | # define user_mode(regs) (((regs)->ps & 0x00000020)!=0) | 87 | # define user_mode(regs) (((regs)->ps & 0x00000020)!=0) |
| 88 | # define instruction_pointer(regs) ((regs)->pc) | 88 | # define instruction_pointer(regs) ((regs)->pc) |
| 89 | # define return_pointer(regs) (MAKE_PC_FROM_RA((regs)->areg[0], \ | 89 | # define return_pointer(regs) (MAKE_PC_FROM_RA((regs)->areg[0], \ |
| 90 | (regs)->areg[1])) | 90 | (regs)->pc)) |
| 91 | 91 | ||
| 92 | # ifndef CONFIG_SMP | 92 | # ifndef CONFIG_SMP |
| 93 | # define profile_pc(regs) instruction_pointer(regs) | 93 | # define profile_pc(regs) instruction_pointer(regs) |
| @@ -47,6 +47,7 @@ · 46 unmodified lines | |||
| 47 | #include <asm/asm-offsets.h> | 47 | #include <asm/asm-offsets.h> |
| 48 | #include <asm/regs.h> | 48 | #include <asm/regs.h> |
| 49 | #include <asm/hw_breakpoint.h> | 49 | #include <asm/hw_breakpoint.h> |
| 50 | #include <asm/sections.h> | ||
| 50 | #include <asm/traps.h> | 51 | #include <asm/traps.h> |
| 51 | 52 | ||
| 52 | extern void ret_from_fork(void); | 53 | extern void ret_from_fork(void); |
| @@ -380,7 +381,7 @@ unsigned long __get_wchan(struct task_struct *p) · 327 unmodified lines | |||
| 380 | int count = 0; | 381 | int count = 0; |
| 381 | 382 | ||
| 382 | sp = p->thread.sp; | 383 | 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); |
| 384 | 385 | ||
| 385 | do { | 386 | do { |
| 386 | if (sp < stack_page + sizeof(struct task_struct) || | 387 | if (sp < stack_page + sizeof(struct task_struct) || |
| @@ -392,7 +393,7 @@ unsigned long __get_wchan(struct task_struct *p) · 5 unmodified lines | |||
| 392 | 393 | ||
| 393 | /* Stack layout: sp-4: ra, sp-3: sp' */ | 394 | /* Stack layout: sp-4: ra, sp-3: sp' */ |
| 394 | 395 | ||
| 395 | pc = MAKE_PC_FROM_RA(SPILL_SLOT(sp, 0), sp); | 396 | pc = MAKE_PC_FROM_RA(SPILL_SLOT(sp, 0), _text); |
| 396 | sp = SPILL_SLOT(sp, 1); | 397 | sp = SPILL_SLOT(sp, 1); |
| 397 | } while (count++ < 16); | 398 | } while (count++ < 16); |
| 398 | return 0; | 399 | return 0; |
| @@ -13,6 +13,7 @@ · 12 unmodified lines | |||
| 13 | #include <linux/stacktrace.h> | 13 | #include <linux/stacktrace.h> |
| 14 | 14 | ||
| 15 | #include <asm/ftrace.h> | 15 | #include <asm/ftrace.h> |
| 16 | #include <asm/sections.h> | ||
| 16 | #include <asm/stacktrace.h> | 17 | #include <asm/stacktrace.h> |
| 17 | #include <asm/traps.h> | 18 | #include <asm/traps.h> |
| 18 | #include <linux/uaccess.h> | 19 | #include <linux/uaccess.h> |
| @@ -189,7 +190,7 @@ void walk_stackframe(unsigned long *sp, · 170 unmodified lines | |||
| 189 | if (a1 <= (unsigned long)sp) | 190 | if (a1 <= (unsigned long)sp) |
| 190 | break; | 191 | break; |
| 191 | 192 | ||
| 192 | frame.pc = MAKE_PC_FROM_RA(a0, a1); | 193 | frame.pc = MAKE_PC_FROM_RA(a0, _text); |
| 193 | frame.sp = a1; | 194 | frame.sp = a1; |
| 194 | 195 | ||
| 195 | if (fn(&frame, data)) | 196 | if (fn(&frame, data)) |
| @@ -166,10 +166,8 @@ late_initcall(rs_init); · 165 unmodified lines | |||
| 166 | 166 | ||
| 167 | static void iss_console_write(struct console *co, const char *s, unsigned count) | 167 | static void iss_console_write(struct console *co, const char *s, unsigned count) |
| 168 | { | 168 | { |
| 169 | if (s && *s != 0) { | 169 | if (s && *s != 0) |
| 170 | int len = strlen(s); | 170 | simc_write(1, s, min(count, strlen(s))); |
| 171 | simc_write(1, s, count < len ? count : len); | ||
| 172 | } | ||
| 173 | } | 171 | } |
| 174 | 172 | ||
| 175 | static struct tty_driver* iss_console_device(struct console *c, int *index) | 173 | static struct tty_driver* iss_console_device(struct console *c, int *index) |