arch/arc/kernel/signal.c:77:31: sparse: sparse: incorrect type in argument 1 (different address spaces)

2023-12-08 Thread kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   5e3f5b81de80c98338bcb47c233aebefee5a4801
commit: 96f1b00138cb8f04c742c82d0a7c460b2202e887 ARCv2: save ABI registers 
across signal handling
date:   2 years, 6 months ago
config: arc-randconfig-r111-20231107 
(https://download.01.org/0day-ci/archive/20231208/202312082320.vdn5a9hb-...@intel.com/config)
compiler: arceb-elf-gcc (GCC) 13.2.0
reproduce: 
(https://download.01.org/0day-ci/archive/20231208/202312082320.vdn5a9hb-...@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot 
| Closes: 
https://lore.kernel.org/oe-kbuild-all/202312082320.vdn5a9hb-...@intel.com/

sparse warnings: (new ones prefixed by >>)
>> arch/arc/kernel/signal.c:77:31: sparse: sparse: incorrect type in argument 1 
>> (different address spaces) @@ expected void [noderef] __user *to @@ 
>> got struct user_regs_arcv2 * @@
   arch/arc/kernel/signal.c:77:31: sparse: expected void [noderef] __user 
*to
   arch/arc/kernel/signal.c:77:31: sparse: got struct user_regs_arcv2 *
>> arch/arc/kernel/signal.c:88:41: sparse: sparse: incorrect type in argument 2 
>> (different address spaces) @@ expected void const [noderef] __user *from 
>> @@ got struct user_regs_arcv2 * @@
   arch/arc/kernel/signal.c:88:41: sparse: expected void const [noderef] 
__user *from
   arch/arc/kernel/signal.c:88:41: sparse: got struct user_regs_arcv2 *
>> arch/arc/kernel/signal.c:134:42: sparse: sparse: incorrect type in argument 
>> 1 (different address spaces) @@ expected struct sigcontext *mctx @@ 
>> got struct sigcontext [noderef] __user * @@
   arch/arc/kernel/signal.c:134:42: sparse: expected struct sigcontext *mctx
   arch/arc/kernel/signal.c:134:42: sparse: got struct sigcontext [noderef] 
__user *
   arch/arc/kernel/signal.c:153:45: sparse: sparse: incorrect type in argument 
1 (different address spaces) @@ expected struct sigcontext *mctx @@ got 
struct sigcontext [noderef] __user * @@
   arch/arc/kernel/signal.c:153:45: sparse: expected struct sigcontext *mctx
   arch/arc/kernel/signal.c:153:45: sparse: got struct sigcontext [noderef] 
__user *

vim +77 arch/arc/kernel/signal.c

63  
64  static int save_arcv2_regs(struct sigcontext *mctx, struct pt_regs 
*regs)
65  {
66  int err = 0;
67  #ifndef CONFIG_ISA_ARCOMPACT
68  struct user_regs_arcv2 v2abi;
69  
70  v2abi.r30 = regs->r30;
71  #ifdef CONFIG_ARC_HAS_ACCL_REGS
72  v2abi.r58 = regs->r58;
73  v2abi.r59 = regs->r59;
74  #else
75  v2abi.r58 = v2abi.r59 = 0;
76  #endif
  > 77  err = __copy_to_user(&mctx->v2abi, &v2abi, sizeof(v2abi));
78  #endif
79  return err;
80  }
81  
82  static int restore_arcv2_regs(struct sigcontext *mctx, struct pt_regs 
*regs)
83  {
84  int err = 0;
85  #ifndef CONFIG_ISA_ARCOMPACT
86  struct user_regs_arcv2 v2abi;
87  
  > 88  err = __copy_from_user(&v2abi, &mctx->v2abi, sizeof(v2abi));
89  
90  regs->r30 = v2abi.r30;
91  #ifdef CONFIG_ARC_HAS_ACCL_REGS
92  regs->r58 = v2abi.r58;
93  regs->r59 = v2abi.r59;
94  #endif
95  #endif
96  return err;
97  }
98  
99  static int
   100  stash_usr_regs(struct rt_sigframe __user *sf, struct pt_regs *regs,
   101 sigset_t *set)
   102  {
   103  int err;
   104  struct user_regs_struct uregs;
   105  
   106  uregs.scratch.bta   = regs->bta;
   107  uregs.scratch.lp_start  = regs->lp_start;
   108  uregs.scratch.lp_end= regs->lp_end;
   109  uregs.scratch.lp_count  = regs->lp_count;
   110  uregs.scratch.status32  = regs->status32;
   111  uregs.scratch.ret   = regs->ret;
   112  uregs.scratch.blink = regs->blink;
   113  uregs.scratch.fp= regs->fp;
   114  uregs.scratch.gp= regs->r26;
   115  uregs.scratch.r12   = regs->r12;
   116  uregs.scratch.r11   = regs->r11;
   117  uregs.scratch.r10   = regs->r10;
   118  uregs.scratch.r9= regs->r9;
   119  uregs.scratch.r8= regs->r8;
   120  uregs.scratch.r7= regs->r7;
   121  uregs.scratch.r6= regs->r6;
   122  uregs.scratch.r5= regs->r5;
   123  uregs.scratch.r4= regs->r4;
   124  uregs.scratch.r3= regs->r3;
   125  uregs.scratch.r2= regs->r2;
   126  uregs.scratch.r1

[PATCH 1/5] ARC: entry: SAVE_ABI_CALLEE_REG: ISA/ABI specific helper

2023-12-08 Thread Vineet Gupta
And for ARcompact variant replace the PUSH/POP macros with gas provided
push/pop pseudo-instructions

This allows ISA specific implementation

e.g. Current ARCv2 PUSH/POP could be replaced with STD/LDL to save 2
registers at a time (w/o bothering with SP update each time) or
perhaps use ENTER_S/LEAVE_S to reduce code size

For ARCv3 ABI changed so callee regs are now r14-r26 (vs. r13-r25)
thus would need a different implementation.

Signed-off-by: Vineet Gupta 
---
 arch/arc/include/asm/entry-arcv2.h   | 32 
 arch/arc/include/asm/entry-compact.h | 32 
 arch/arc/include/asm/entry.h | 44 +++-
 arch/arc/include/asm/ptrace.h| 14 +
 4 files changed, 76 insertions(+), 46 deletions(-)

diff --git a/arch/arc/include/asm/entry-arcv2.h 
b/arch/arc/include/asm/entry-arcv2.h
index 4d13320e0c1b..3802a2daaf86 100644
--- a/arch/arc/include/asm/entry-arcv2.h
+++ b/arch/arc/include/asm/entry-arcv2.h
@@ -291,4 +291,36 @@
/* M = 8-1  N = 8 */
 .endm
 
+.macro SAVE_ABI_CALLEE_REGS
+   pushr13
+   pushr14
+   pushr15
+   pushr16
+   pushr17
+   pushr18
+   pushr19
+   pushr20
+   pushr21
+   pushr22
+   pushr23
+   pushr24
+   pushr25
+.endm
+
+.macro RESTORE_ABI_CALLEE_REGS
+   pop r25
+   pop r24
+   pop r23
+   pop r22
+   pop r21
+   pop r20
+   pop r19
+   pop r18
+   pop r17
+   pop r16
+   pop r15
+   pop r14
+   pop r13
+.endm
+
 #endif
diff --git a/arch/arc/include/asm/entry-compact.h 
b/arch/arc/include/asm/entry-compact.h
index a0e760eb35a8..9841f1186417 100644
--- a/arch/arc/include/asm/entry-compact.h
+++ b/arch/arc/include/asm/entry-compact.h
@@ -33,6 +33,38 @@
 #include 
 #include/* For THREAD_SIZE */
 
+.macro SAVE_ABI_CALLEE_REGS
+   pushr13
+   pushr14
+   pushr15
+   pushr16
+   pushr17
+   pushr18
+   pushr19
+   pushr20
+   pushr21
+   pushr22
+   pushr23
+   pushr24
+   pushr25
+.endm
+
+.macro RESTORE_ABI_CALLEE_REGS
+   pop r25
+   pop r24
+   pop r23
+   pop r22
+   pop r21
+   pop r20
+   pop r19
+   pop r18
+   pop r17
+   pop r16
+   pop r15
+   pop r14
+   pop r13
+.endm
+
 /*--
  * Switch to Kernel Mode stack if SP points to User Mode stack
  *
diff --git a/arch/arc/include/asm/entry.h b/arch/arc/include/asm/entry.h
index 49c2e090cb5c..8e4e40d2d54a 100644
--- a/arch/arc/include/asm/entry.h
+++ b/arch/arc/include/asm/entry.h
@@ -87,48 +87,12 @@
 
 .endm
 
-/*--
- * Helpers to save/restore callee-saved regs:
- * used by several macros below
- *-*/
-.macro SAVE_R13_TO_R25
-   PUSHr13
-   PUSHr14
-   PUSHr15
-   PUSHr16
-   PUSHr17
-   PUSHr18
-   PUSHr19
-   PUSHr20
-   PUSHr21
-   PUSHr22
-   PUSHr23
-   PUSHr24
-   PUSHr25
-.endm
-
-.macro RESTORE_R25_TO_R13
-   POP r25
-   POP r24
-   POP r23
-   POP r22
-   POP r21
-   POP r20
-   POP r19
-   POP r18
-   POP r17
-   POP r16
-   POP r15
-   POP r14
-   POP r13
-.endm
-
 /*
  * save user mode callee regs as struct callee_regs
  *  - needed by fork/do_signal/unaligned-access-emulation.
  */
 .macro SAVE_CALLEE_SAVED_USER
-   SAVE_R13_TO_R25
+   SAVE_ABI_CALLEE_REGS
 .endm
 
 /*
@@ -136,18 +100,18 @@
  *  - could have been changed by ptrace tracer or unaligned-access fixup
  */
 .macro RESTORE_CALLEE_SAVED_USER
-   RESTORE_R25_TO_R13
+   RESTORE_ABI_CALLEE_REGS
 .endm
 
 /*
  * save/restore kernel mode callee regs at the time of context switch
  */
 .macro SAVE_CALLEE_SAVED_KERNEL
-   SAVE_R13_TO_R25
+   SAVE_ABI_CALLEE_REGS
 .endm
 
 .macro RESTORE_CALLEE_SAVED_KERNEL
-   RESTORE_R25_TO_R13
+   RESTORE_ABI_CALLEE_REGS
 .endm
 
 /*--
diff --git a/arch/arc/include/asm/ptrace.h b/arch/arc/include/asm/ptrace.h
index 4a2b30fb5a98..00b9318e551e 100644
--- a/arch/arc/include/asm/ptrace.h
+++ b/arch/arc/include/asm/ptrace.h
@@ -54,6 +54,10 @@ struct pt_regs {
ecr_reg ecr;
 };
 
+struct callee_regs {
+   unsigned long r25, r24, r23, r22, r21, r20, r19, r18, r17, r16, r15, 
r14, r13;
+};
+
 #define MAX_REG_OFFSET offsetof(struct pt_regs, ecr)
 
 #else
@@ -92,16 +96,14 @@ struct pt_regs {
unsigned long status32;
 };
 
-#define MAX_REG_OFFSE

[PATCH 4/5] ARC: fix spare error

2023-12-08 Thread Vineet Gupta
Reported-by: kernel test robot 
Closes: 
https://lore.kernel.org/oe-kbuild-all/202312082320.vdn5a9hb-...@intel.com/
Signed-off-by: Vineet Gupta 
---
 arch/arc/kernel/signal.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arc/kernel/signal.c b/arch/arc/kernel/signal.c
index 0b3bb529d246..8f6f4a542964 100644
--- a/arch/arc/kernel/signal.c
+++ b/arch/arc/kernel/signal.c
@@ -62,7 +62,7 @@ struct rt_sigframe {
unsigned int sigret_magic;
 };
 
-static int save_arcv2_regs(struct sigcontext *mctx, struct pt_regs *regs)
+static int save_arcv2_regs(struct sigcontext __user *mctx, struct pt_regs 
*regs)
 {
int err = 0;
 #ifndef CONFIG_ISA_ARCOMPACT
@@ -75,12 +75,12 @@ static int save_arcv2_regs(struct sigcontext *mctx, struct 
pt_regs *regs)
 #else
v2abi.r58 = v2abi.r59 = 0;
 #endif
-   err = __copy_to_user(&mctx->v2abi, &v2abi, sizeof(v2abi));
+   err = __copy_to_user(&mctx->v2abi, (void const *)&v2abi, sizeof(v2abi));
 #endif
return err;
 }
 
-static int restore_arcv2_regs(struct sigcontext *mctx, struct pt_regs *regs)
+static int restore_arcv2_regs(struct sigcontext __user *mctx, struct pt_regs 
*regs)
 {
int err = 0;
 #ifndef CONFIG_ISA_ARCOMPACT
-- 
2.34.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 0/5] ARC updates

2023-12-08 Thread Vineet Gupta
Hi,

A pile of accrued changes, compile tested only.
Please test.

Thx,
-Vineet

Vineet Gupta (5):
  ARC: entry: SAVE_ABI_CALLEE_REG: ISA/ABI specific helper
  ARC: entry: move ARCompact specific bits out of entry.h
  ARC: mm: retire support for aliasing VIPT D$
  ARC: fix spare error
  ARC: fix smatch warning

 arch/arc/Kconfig |   5 -
 arch/arc/include/asm/cacheflush.h|  43 -
 arch/arc/include/asm/entry-arcv2.h   |  32 +++
 arch/arc/include/asm/entry-compact.h |  87 -
 arch/arc/include/asm/entry.h | 110 +-
 arch/arc/include/asm/ptrace.h|  14 +--
 arch/arc/kernel/setup.c  |   4 +-
 arch/arc/kernel/signal.c |   6 +-
 arch/arc/mm/cache.c  | 136 ++-
 arch/arc/mm/mmap.c   |  21 +
 arch/arc/mm/tlb.c|  16 +---
 11 files changed, 148 insertions(+), 326 deletions(-)

-- 
2.34.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 3/5] ARC: mm: retire support for aliasing VIPT D$

2023-12-08 Thread Vineet Gupta
Legacy ARC700 processors (first generation of MMU enabled ARC cores) had
VIPT cached which could be configured such that they could alias.
Corresponding support in kernel (with all the obnoxious cache flush overhead)
was added in ARC port 10 years ago to support 1 silicon. That is long bygone
and we can let it RIP.

Cc: Matthew Wilcox (Oracle) 
Signed-off-by: Vineet Gupta 
---
 arch/arc/Kconfig  |   5 --
 arch/arc/include/asm/cacheflush.h |  43 --
 arch/arc/mm/cache.c   | 136 ++
 arch/arc/mm/mmap.c|  21 +
 arch/arc/mm/tlb.c |  16 ++--
 5 files changed, 14 insertions(+), 207 deletions(-)

diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index 3162db540ee9..1b0483c51cc1 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -49,7 +49,6 @@ config ARC
select OF
select OF_EARLY_FLATTREE
select PCI_SYSCALL if PCI
-   select PERF_USE_VMALLOC if ARC_CACHE_VIPT_ALIASING
select HAVE_ARCH_JUMP_LABEL if ISA_ARCV2 && !CPU_ENDIAN_BE32
select TRACE_IRQFLAGS_SUPPORT
 
@@ -232,10 +231,6 @@ config ARC_CACHE_PAGES
  Note that Global I/D ENABLE + Per Page DISABLE works but corollary
  Global DISABLE + Per Page ENABLE won't work
 
-config ARC_CACHE_VIPT_ALIASING
-   bool "Support VIPT Aliasing D$"
-   depends on ARC_HAS_DCACHE && ISA_ARCOMPACT
-
 endif #ARC_CACHE
 
 config ARC_HAS_ICCM
diff --git a/arch/arc/include/asm/cacheflush.h 
b/arch/arc/include/asm/cacheflush.h
index bd5b1a9a0544..563af3e75f01 100644
--- a/arch/arc/include/asm/cacheflush.h
+++ b/arch/arc/include/asm/cacheflush.h
@@ -44,31 +44,10 @@ void dma_cache_wback(phys_addr_t start, unsigned long sz);
 
 #define flush_cache_dup_mm(mm) /* called on fork (VIVT only) */
 
-#ifndef CONFIG_ARC_CACHE_VIPT_ALIASING
-
 #define flush_cache_mm(mm) /* called on munmap/exit */
 #define flush_cache_range(mm, u_vstart, u_vend)
 #define flush_cache_page(vma, u_vaddr, pfn)/* PF handling/COW-break */
 
-#else  /* VIPT aliasing dcache */
-
-/* To clear out stale userspace mappings */
-void flush_cache_mm(struct mm_struct *mm);
-void flush_cache_range(struct vm_area_struct *vma,
-   unsigned long start,unsigned long end);
-void flush_cache_page(struct vm_area_struct *vma,
-   unsigned long user_addr, unsigned long page);
-
-/*
- * To make sure that userspace mapping is flushed to memory before
- * get_user_pages() uses a kernel mapping to access the page
- */
-#define ARCH_HAS_FLUSH_ANON_PAGE
-void flush_anon_page(struct vm_area_struct *vma,
-   struct page *page, unsigned long u_vaddr);
-
-#endif /* CONFIG_ARC_CACHE_VIPT_ALIASING */
-
 /*
  * A new pagecache page has PG_arch_1 clear - thus dcache dirty by default
  * This works around some PIO based drivers which don't call flush_dcache_page
@@ -76,28 +55,6 @@ void flush_anon_page(struct vm_area_struct *vma,
  */
 #define PG_dc_cleanPG_arch_1
 
-#define CACHE_COLORS_NUM   4
-#define CACHE_COLORS_MSK   (CACHE_COLORS_NUM - 1)
-#define CACHE_COLOR(addr)  (((unsigned long)(addr) >> (PAGE_SHIFT)) & 
CACHE_COLORS_MSK)
-
-/*
- * Simple wrapper over config option
- * Bootup code ensures that hardware matches kernel configuration
- */
-static inline int cache_is_vipt_aliasing(void)
-{
-   return IS_ENABLED(CONFIG_ARC_CACHE_VIPT_ALIASING);
-}
-
-/*
- * checks if two addresses (after page aligning) index into same cache set
- */
-#define addr_not_cache_congruent(addr1, addr2) \
-({ \
-   cache_is_vipt_aliasing() ?  \
-   (CACHE_COLOR(addr1) != CACHE_COLOR(addr2)) : 0; \
-})
-
 #define copy_to_user_page(vma, page, vaddr, dst, src, len) \
 do {   \
memcpy(dst, src, len);  \
diff --git a/arch/arc/mm/cache.c b/arch/arc/mm/cache.c
index f7e05c146637..9106ceac323c 100644
--- a/arch/arc/mm/cache.c
+++ b/arch/arc/mm/cache.c
@@ -145,10 +145,9 @@ int arc_cache_mumbojumbo(int c, char *buf, int len)
p_dc->sz_k = 1 << (dbcr.sz - 1);
 
n += scnprintf(buf + n, len - n,
-   "D-Cache\t\t: %uK, %dway/set, %uB Line, %s%s%s\n",
+   "D-Cache\t\t: %uK, %dway/set, %uB Line, %s%s\n",
p_dc->sz_k, assoc, p_dc->line_len,
vipt ? "VIPT" : "PIPT",
-   p_dc->colors > 1 ? " aliasing" : "",
IS_USED_CFG(CONFIG_ARC_HAS_DCACHE));
 
 slc_chk:
@@ -703,51 +702,10 @@ static inline void arc_slc_enable(void)
  * Exported APIs
  */
 
-/*
- * Handle cache congruency of kernel and userspace mappings of page when kernel
- * writes-to/reads-from
- *
- * The idea is to defer flushing of kernel mapping after a WRITE, possible if:
- *  -dca

[PATCH 2/5] ARC: entry: move ARCompact specific bits out of entry.h

2023-12-08 Thread Vineet Gupta
 - PUSHAUX/POPAUX helpers to ARCompact entry
 - use gas provided "push"/pop pseudo instructions

Signed-off-by: Vineet Gupta 
---
 arch/arc/include/asm/entry-compact.h | 55 ++-
 arch/arc/include/asm/entry.h | 66 
 2 files changed, 54 insertions(+), 67 deletions(-)

diff --git a/arch/arc/include/asm/entry-compact.h 
b/arch/arc/include/asm/entry-compact.h
index 9841f1186417..92c3e9f13252 100644
--- a/arch/arc/include/asm/entry-compact.h
+++ b/arch/arc/include/asm/entry-compact.h
@@ -33,6 +33,59 @@
 #include 
 #include/* For THREAD_SIZE */
 
+/* Note on the LD/ST addr modes with addr reg wback
+ *
+ * LD.a same as LD.aw
+ *
+ * LD.areg1, [reg2, x]  => Pre Incr
+ *  Eff Addr for load = [reg2 + x]
+ *
+ * LD.ab   reg1, [reg2, x]  => Post Incr
+ *  Eff Addr for load = [reg2]
+ */
+
+.macro PUSHAX aux
+   lr  r9, [\aux]
+   pushr9
+.endm
+
+.macro POPAX aux
+   pop r9
+   sr  r9, [\aux]
+.endm
+
+.macro  SAVE_R0_TO_R12
+   pushr0
+   pushr1
+   pushr2
+   pushr3
+   pushr4
+   pushr5
+   pushr6
+   pushr7
+   pushr8
+   pushr9
+   pushr10
+   pushr11
+   pushr12
+.endm
+
+.macro RESTORE_R12_TO_R0
+   pop r12
+   pop r11
+   pop r10
+   pop r9
+   pop r8
+   pop r7
+   pop r6
+   pop r5
+   pop r4
+   pop r3
+   pop r2
+   pop r1
+   pop r0
+.endm
+
 .macro SAVE_ABI_CALLEE_REGS
pushr13
pushr14
@@ -267,7 +320,7 @@
SWITCH_TO_KERNEL_STK
 
 
-   PUSH0x003\LVL\()abcd/* Dummy ECR */
+   st.a0x003\LVL\()abcd, [sp, -4]  /* Dummy ECR */
sub sp, sp, 8   /* skip orig_r0 (not needed)
   skip pt_regs->sp, already saved above */
 
diff --git a/arch/arc/include/asm/entry.h b/arch/arc/include/asm/entry.h
index 8e4e40d2d54a..cf1ba376e992 100644
--- a/arch/arc/include/asm/entry.h
+++ b/arch/arc/include/asm/entry.h
@@ -21,72 +21,6 @@
 #include 
 #endif
 
-/* Note on the LD/ST addr modes with addr reg wback
- *
- * LD.a same as LD.aw
- *
- * LD.areg1, [reg2, x]  => Pre Incr
- *  Eff Addr for load = [reg2 + x]
- *
- * LD.ab   reg1, [reg2, x]  => Post Incr
- *  Eff Addr for load = [reg2]
- */
-
-.macro PUSH reg
-   st.a\reg, [sp, -4]
-.endm
-
-.macro PUSHAX aux
-   lr  r9, [\aux]
-   PUSHr9
-.endm
-
-.macro POP reg
-   ld.ab   \reg, [sp, 4]
-.endm
-
-.macro POPAX aux
-   POP r9
-   sr  r9, [\aux]
-.endm
-
-/*--
- * Helpers to save/restore Scratch Regs:
- * used by Interrupt/Exception Prologue/Epilogue
- *-*/
-.macro  SAVE_R0_TO_R12
-   PUSHr0
-   PUSHr1
-   PUSHr2
-   PUSHr3
-   PUSHr4
-   PUSHr5
-   PUSHr6
-   PUSHr7
-   PUSHr8
-   PUSHr9
-   PUSHr10
-   PUSHr11
-   PUSHr12
-.endm
-
-.macro RESTORE_R12_TO_R0
-   POP r12
-   POP r11
-   POP r10
-   POP r9
-   POP r8
-   POP r7
-   POP r6
-   POP r5
-   POP r4
-   POP r3
-   POP r2
-   POP r1
-   POP r0
-
-.endm
-
 /*
  * save user mode callee regs as struct callee_regs
  *  - needed by fork/do_signal/unaligned-access-emulation.
-- 
2.34.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 5/5] ARC: fix smatch warning

2023-12-08 Thread Vineet Gupta
Reported-by: kernel test robot 
Reported-by: Dan Carpenter 
Closes: https://lore.kernel.org/r/202311280906.vaiweaft-...@intel.com/
Signed-off-by: Vineet Gupta 
---
 arch/arc/kernel/setup.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c
index 4dcf8589b708..d08a5092c2b4 100644
--- a/arch/arc/kernel/setup.c
+++ b/arch/arc/kernel/setup.c
@@ -153,7 +153,7 @@ static int arcv2_mumbojumbo(int c, struct cpuinfo_arc 
*info, char *buf, int len)
 {
int n = 0;
 #ifdef CONFIG_ISA_ARCV2
-   const char *release, *cpu_nm, *isa_nm = "ARCv2";
+   const char *release = "", *cpu_nm = "HS38", *isa_nm = "ARCv2";
int dual_issue = 0, dual_enb = 0, mpy_opt, present;
int bpu_full, bpu_cache, bpu_pred, bpu_ret_stk;
char mpy_nm[16], lpb_nm[32];
@@ -172,8 +172,6 @@ static int arcv2_mumbojumbo(int c, struct cpuinfo_arc 
*info, char *buf, int len)
 * releases only update it.
 */
 
-   cpu_nm = "HS38";
-
if (info->arcver > 0x50 && info->arcver <= 0x53) {
release = arc_hs_rel[info->arcver - 0x51].str;
} else {
-- 
2.34.1


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: arch/arc/kernel/setup.c:203 arcv2_mumbojumbo() error: uninitialized symbol 'release'.

2023-12-08 Thread Vineet Gupta
On 11/27/23 22:22, Dan Carpenter wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
> master
> head:   2cc14f52aeb78ce3f29677c2de1f06c0e91471ab
> commit: fad84e39f116035ae8d550c6020107b8ac113b45 ARC: boot log: eliminate 
> struct cpuinfo_arc #4: boot log per ISA
> config: arc-randconfig-r071-20231128 
> (https://download.01.org/0day-ci/archive/20231128/202311280906.vaiweaft-...@intel.com/config)
> compiler: arceb-elf-gcc (GCC) 13.2.0
> reproduce: 
> (https://download.01.org/0day-ci/archive/20231128/202311280906.vaiweaft-...@intel.com/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version 
> of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot 
> | Reported-by: Dan Carpenter 
> | Closes: https://lore.kernel.org/r/202311280906.vaiweaft-...@intel.com/
>
> New smatch warnings:
> arch/arc/kernel/setup.c:203 arcv2_mumbojumbo() error: uninitialized symbol 
> 'release'.

Thx, I've posted a fix.

> Old smatch warnings:
> arch/arc/include/asm/thread_info.h:62 current_thread_info() error: 
> uninitialized symbol 'sp'.

This seems like a false warning. Its a register variable and thus can't
possibly be initialized.

static inline __attribute_const__ struct thread_info
*current_thread_info(void)
{
    register unsigned long sp asm("sp");
    return (struct thread_info *)(sp & ~(THREAD_SIZE - 1));
}

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: arch/arc/kernel/setup.c:203 arcv2_mumbojumbo() error: uninitialized symbol 'release'.

2023-12-08 Thread Dan Carpenter
On Fri, Dec 08, 2023 at 04:33:44PM -0800, Vineet Gupta wrote:
> On 11/27/23 22:22, Dan Carpenter wrote:
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
> > master
> > head:   2cc14f52aeb78ce3f29677c2de1f06c0e91471ab
> > commit: fad84e39f116035ae8d550c6020107b8ac113b45 ARC: boot log: eliminate 
> > struct cpuinfo_arc #4: boot log per ISA
> > config: arc-randconfig-r071-20231128 
> > (https://download.01.org/0day-ci/archive/20231128/202311280906.vaiweaft-...@intel.com/config)
> > compiler: arceb-elf-gcc (GCC) 13.2.0
> > reproduce: 
> > (https://download.01.org/0day-ci/archive/20231128/202311280906.vaiweaft-...@intel.com/reproduce)
> >
> > If you fix the issue in a separate patch/commit (i.e. not just a new 
> > version of
> > the same patch/commit), kindly add following tags
> > | Reported-by: kernel test robot 
> > | Reported-by: Dan Carpenter 
> > | Closes: https://lore.kernel.org/r/202311280906.vaiweaft-...@intel.com/
> >
> > New smatch warnings:
> > arch/arc/kernel/setup.c:203 arcv2_mumbojumbo() error: uninitialized symbol 
> > 'release'.
> 
> Thx, I've posted a fix.
> 
> > Old smatch warnings:
> > arch/arc/include/asm/thread_info.h:62 current_thread_info() error: 
> > uninitialized symbol 'sp'.
> 
> This seems like a false warning. Its a register variable and thus can't
> possibly be initialized.

Yeah.  Sorry, I normally delete these but I somehow forgot this time.

regards,
dan carpenter


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc