Xtensa fixes for v6.9:

- 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
 -----BEGIN PGP SIGNATURE-----
 
 iQJHBAABCgAxFiEEK2eFS5jlMn3N6xfYUfnMkfg/oEQFAmYzg8gTHGpjbXZia2Jj
 QGdtYWlsLmNvbQAKCRBR+cyR+D+gRKD2D/9IAjvtl7FCj8GerGCuzZY5QY3ut/jx
 jnH9hyO2Clw1ZwREOP6CcTD7ppR59ZH8Yi8h4c/0j5hhDHlLUdPxgJNzBFiDKhTD
 l7LWaWF3D4ZnqMPKkNbN8BTu3U23+/PenT7na0NruLBLLVgIPcSGXWHCCpr4PLDX
 oZ4daDjgju7R/vGXhrsb4g+1/t65RKwmP5eBCvWw9dY5iT5ItTuxh2ONsAaRmkEG
 aBZwlMez7jhnCHix5IgzEkaqg+BxQ/Db6ZFjrq17nCMereq8mQRZmQQTwH89Q37B
 Vs3HkMqwRpp2Xn1FxNClW4/x5qHaczPH3o3ga1ZJlvnD6gUzHeyMdAGn+1Lixrwk
 4SEf6Lefsjkv6jIHyrc+rSr7bBW0pkvdJrZJEsg4PvhL1AW34oN9YNEuaYVLaoPH
 MjRYF59mT4k6prpuTe2umGbitqgcXqzYSIo/CUdEUIxZQg/7rnW+xSwgOXa681M0
 ZnSKvPftB1On/6N9bwM48rOl1DufOMp65iqMD99ms1FsKk2n79Pw6Py1mjyWQw+X
 Bc73C+O4MLw/NgKel5f3Ez+tVefM6RBCw81ot2WFGpS3xcT1FyWno82+QvmyB1jJ
 9H+fHlbTDt6jm1h5jdm5M5vLxt0ScL1VHcYnPeLwpplM1+aMTLt7zljnZc7Mu4yz
 7vo+KrAUsHJKUg==
 =GG+I
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2024-05-02 10:41:28 -07:00
commit 09bf0f196f
6 changed files with 20 additions and 28 deletions

View File

@ -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_cache_page(struct vm_area_struct*,
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
#define flush_cache_all local_flush_cache_all
#define flush_cache_range local_flush_cache_range
@ -136,20 +140,7 @@ void local_flush_cache_page(struct vm_area_struct *vma,
#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_cache_page(vma, addr, pfn) do { } while (0)
#define flush_cache_range(vma, start, end) do { } while (0)
#endif
@ -162,15 +153,14 @@ void local_flush_cache_page(struct vm_area_struct *vma,
__invalidate_icache_range(start,(end) - (start)); \
} 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)
extern void copy_to_user_page(struct vm_area_struct*, struct page*,
unsigned long, void*, const void*, unsigned long);
extern void copy_from_user_page(struct vm_area_struct*, struct page*,
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
@ -186,4 +176,6 @@ extern void copy_from_user_page(struct vm_area_struct*, struct page*,
#endif
#include <asm-generic/cacheflush.h>
#endif /* _XTENSA_CACHEFLUSH_H */

View File

@ -115,9 +115,9 @@
#define MAKE_RA_FOR_CALL(ra,ws) (((ra) & 0x3fffffff) | (ws) << 30)
/* 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__)
@ -127,9 +127,9 @@
#define MAKE_RA_FOR_CALL(ra, ws) (ra)
/* 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
#error Unsupported Xtensa ABI

View File

@ -87,7 +87,7 @@ struct pt_regs {
# define user_mode(regs) (((regs)->ps & 0x00000020)!=0)
# define instruction_pointer(regs) ((regs)->pc)
# define return_pointer(regs) (MAKE_PC_FROM_RA((regs)->areg[0], \
(regs)->areg[1]))
(regs)->pc))
# ifndef CONFIG_SMP
# define profile_pc(regs) instruction_pointer(regs)

View File

@ -47,6 +47,7 @@
#include <asm/asm-offsets.h>
#include <asm/regs.h>
#include <asm/hw_breakpoint.h>
#include <asm/sections.h>
#include <asm/traps.h>
extern void ret_from_fork(void);
@ -380,7 +381,7 @@ unsigned long __get_wchan(struct task_struct *p)
int count = 0;
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 {
if (sp < stack_page + sizeof(struct task_struct) ||
@ -392,7 +393,7 @@ unsigned long __get_wchan(struct task_struct *p)
/* 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);
} while (count++ < 16);
return 0;

View File

@ -13,6 +13,7 @@
#include <linux/stacktrace.h>
#include <asm/ftrace.h>
#include <asm/sections.h>
#include <asm/stacktrace.h>
#include <asm/traps.h>
#include <linux/uaccess.h>
@ -189,7 +190,7 @@ void walk_stackframe(unsigned long *sp,
if (a1 <= (unsigned long)sp)
break;
frame.pc = MAKE_PC_FROM_RA(a0, a1);
frame.pc = MAKE_PC_FROM_RA(a0, _text);
frame.sp = a1;
if (fn(&frame, data))

View File

@ -166,10 +166,8 @@ late_initcall(rs_init);
static void iss_console_write(struct console *co, const char *s, unsigned count)
{
if (s && *s != 0) {
int len = strlen(s);
simc_write(1, s, count < len ? count : len);
}
if (s && *s != 0)
simc_write(1, s, min(count, strlen(s)));
}
static struct tty_driver* iss_console_device(struct console *c, int *index)