ARC updates
Subsystems (2)
Vineet Gupta
maintainercover ARC updates
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(-)
Signature · 1 line
2.34.1
Vineet Gupta
maintainerPATCH 1/5 ARC: entry: SAVE_ABI_CALLEE_REG: ISA/ABI specific helper
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.
--- 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(-)
arch/arc/include/asm/entry-arcv2.h +32 -0
@@ -291,4 +291,36 @@/* M = 8-1 N = 8 */ .endm +.macro SAVE_ABI_CALLEE_REGS + push r13 + push r14 + push r15 + push r16 + push r17 + push r18 + push r19 + push r20 + push r21 + push r22 + push r23 + push r24 + push r25 +.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
arch/arc/include/asm/entry-compact.h +32 -0
@@ -33,6 +33,38 @@#include <asm/irqflags-compact.h> #include <asm/thread_info.h> /* For THREAD_SIZE */ +.macro SAVE_ABI_CALLEE_REGS + push r13 + push r14 + push r15 + push r16 + push r17 + push r18 + push r19 + push r20 + push r21 + push r22 + push r23 + push r24 + push r25 +.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 *
arch/arc/include/asm/entry.h +4 -40
70 lines not on this page · raw message
arch/arc/include/asm/ptrace.h +8 -6
@@ -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_OFFSET offsetof(struct pt_regs, status32) - -#endif - -/* Callee saved registers - need to be saved only when you are scheduled out */ -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, status32) + +#endif +#define instruction_pointer (regs) ((regs)->ret)#define profile_pc (regs) instruction_pointer(regs)
Signature · 1 line
2.34.1
Vineet Gupta
maintainerPATCH 2/5 ARC: entry: move ARCompact specific bits out of entry.h
In reply to Vineet Gupta - PUSHAUX/POPAUX helpers to ARCompact entry
- use gas provided "push"/pop pseudo instructions
--- arch/arc/include/asm/entry-compact.h | 55 ++++++++++++++++++++++- arch/arc/include/asm/entry.h | 66 ---------------------------- 2 files changed, 54 insertions(+), 67 deletions(-)
arch/arc/include/asm/entry-compact.h +54 -1
@@ -33,6 +33,59 @@#include <asm/irqflags-compact.h> #include <asm/thread_info.h> /* For THREAD_SIZE */ +/* Note on the LD/ST addr modes with addr reg wback +* +* LD.a same as LD.aw +* +* LD.a reg1, [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] + push r9 +.endm + +.macro POPAX aux + pop r9 + sr r9, [\aux] +.endm + +.macro SAVE_R0_TO_R12 + push r0 + push r1 + push r2 + push r3 + push r4 + push r5 + push r6 + push r7 + push r8 + push r9 + push r10 + push r11 + push r12 +.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 push r13 push r14
@@ -267,7 +320,7 @@SWITCH_TO_KERNEL_STK - PUSH 0x003\LVL\()abcd /* Dummy ECR */ + st.a 0x003\LVL\()abcd, [sp, -4] /* Dummy ECR */ sub sp, sp, 8 /* skip orig_r0 (not needed)skip pt_regs->sp, already saved above */
arch/arc/include/asm/entry.h +0 -66
72 lines not on this page · raw message
Signature · 1 line
2.34.1
Vineet Gupta
maintainerPATCH 3/5 ARC: mm: retire support for aliasing VIPT D$
In reply to Vineet GuptaLegacy 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.
--- 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(-)
arch/arc/Kconfig +0 -5
@@ -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
arch/arc/include/asm/cacheflush.h +0 -43
59 lines not on this page · raw message
arch/arc/mm/cache.c +6 -130
174 lines not on this page · raw message
arch/arc/mm/mmap.c +3 -18
@@ -14,10 +14,6 @@#include <asm/cacheflush.h> -#define COLOUR_ALIGN (addr, pgoff) \ - ((((addr) + SHMLBA - 1) & ~(SHMLBA - 1)) + \ - (((pgoff) << PAGE_SHIFT) & (SHMLBA - 1))) -/* * Ensure that shared mappings are correctly aligned to * avoid aliasing issues with VIPT caches.
@@ -31,21 +27,13 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, {struct mm_struct *mm = current->mm;struct vm_area_struct *vma; -int do_align =0 ; -int aliasing =cache_is_vipt_aliasing ();struct vm_unmapped_area_info info; -/* -* We only need to do colour alignment if D cache aliases. -*/ -if (aliasing) - do_align = filp || (flags &MAP_SHARED ); -/* * We enforce the MAP_FIXED case. */ if (flags &MAP_FIXED ) { -if (aliasing && flags &MAP_SHARED && +if (flags &MAP_SHARED && (addr - (pgoff <<PAGE_SHIFT )) & (SHMLBA -1 ))return -EINVAL ;return addr;
@@ -55,10 +43,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,return -ENOMEM ;if (addr) { -if (do_align) - addr =COLOUR_ALIGN (addr, pgoff); -else - addr =PAGE_ALIGN (addr); + addr =PAGE_ALIGN (addr); vma =find_vma (mm, addr); if (TASK_SIZE - len >= addr &&
@@ -70,7 +55,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, info.length = len; info.low_limit = mm->mmap_base; info.high_limit =TASK_SIZE ; - info.align_mask = do_align ? (PAGE_MASK & (SHMLBA -1 )) :0 ; + info.align_mask =0 ; info.align_offset = pgoff <<PAGE_SHIFT ;return vm_unmapped_area (&info); }
arch/arc/mm/tlb.c +5 -11
@@ -478,21 +478,15 @@ void update_mmu_cache_range(struct vm_fault *vmf, struct vm_area_struct *vma,create_tlb (vma, vaddr, ptep); -if (page ==ZERO_PAGE (0 )) { +if (page ==ZERO_PAGE (0 ))return ; - }/* -* Exec page : Independent of aliasing/page-color considerations, -* since icache doesn't snoop dcache on ARC, any dirty -* K-mapping of a code page needs to be wback+inv so that -* icache fetch by userspace sees code correctly. -* !EXEC page: If K-mapping is NOT congruent to U-mapping, flush it -* so userspace sees the right data. -* (Avoids the flush for Non-exec + congruent mapping case) +* For executable pages, since icache doesn't snoop dcache, any +* dirty K-mapping of a code page needs to be wback+inv so that +* icache fetch by userspace sees code correctly. */ -if ((vma->vm_flags &VM_EXEC ) || -addr_not_cache_congruent (paddr, vaddr)) { +if (vma->vm_flags &VM_EXEC ) {struct folio *folio =page_folio (page);int dirty = !test_and_set_bit (PG_dc_clean, &folio->flags);if (dirty) {
Signature · 7 lines
2.34.1 _______________________________________________ linux-snps-arc mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Vineet Gupta
maintainerPATCH 4/5 ARC: fix spare error
In reply to Vineet Gupta--- arch/arc/kernel/signal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arc/kernel/signal.c +3 -3
@@ -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
Signature · 7 lines
2.34.1 _______________________________________________ linux-snps-arc mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Vineet Gupta
maintainerPATCH 5/5 ARC: fix smatch warning
In reply to Vineet Gupta--- arch/arc/kernel/setup.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
arch/arc/kernel/setup.c +1 -3
@@ -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 {
Signature · 7 lines
2.34.1 _______________________________________________ linux-snps-arc mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-snps-arc
Hi Vineet,
Quoted 5 lines
A pile of accrued changes, compile tested only.
Please test.Thx,
-Vineet
I'm testing you patches. At first glance everything is fine, no obvious regressions.
But I've found an ARC build issue with the latest upstream source (tag: v6.7-rc5). It is not linked with your updates. The build issue occurs when the CONFIG_TRANSPARENT_HUGEPAGE option is enabled:
| ../fs/proc/task_mmu.c: In function ‘pagemap_scan_thp_entry’:
| ../fs/proc/task_mmu.c:2115:28: error: ‘HPAGE_SIZE’ undeclared (first use in this function); did you mean ‘PAGE_SIZE’?
| 2115 | if (end != start + HPAGE_SIZE) {
| | ^~~~~~~~~~
| | PAGE_SIZE
| ../fs/proc/task_mmu.c:2115:28: note: each undeclared identifier is reported only once for each function it appears in
| make[4]: *** [../scripts/Makefile.build:243: fs/proc/task_mmu.o] Error 1
| make[3]: *** [../scripts/Makefile.build:480: fs/proc] Error 2May be you could address this issue in your updates too?
Thanks
Pavel
_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc