···20202121 /* Real registers */2222 long bta; /* bta_l1, bta_l2, erbta */2323- long lp_start;2424- long lp_end;2525- long lp_count;2323+2424+ long lp_start, lp_end, lp_count;2525+2626 long status32; /* status32_l1, status32_l2, erstatus */2727 long ret; /* ilink1, ilink2 or eret */2828 long blink;2929 long fp;3030 long r26; /* gp */3131- long r12;3232- long r11;3333- long r10;3434- long r9;3535- long r8;3636- long r7;3737- long r6;3838- long r5;3939- long r4;4040- long r3;4141- long r2;4242- long r1;4343- long r0;3131+3232+ long r12, r11, r10, r9, r8, r7, r6, r5, r4, r3, r2, r1, r0;3333+4434 long sp; /* user/kernel sp depending on where we came from */4535 long orig_r0;4636···6070/* Callee saved registers - need to be saved only when you are scheduled out */61716272struct callee_regs {6363- long r25;6464- long r24;6565- long r23;6666- long r22;6767- long r21;6868- long r20;6969- long r19;7070- long r18;7171- long r17;7272- long r16;7373- long r15;7474- long r14;7575- long r13;7373+ long r25, r24, r23, r22, r21, r20, r19, r18, r17, r16, r15, r14, r13;7674};77757876#define instruction_pointer(regs) ((regs)->ret)
+3-3
arch/arc/include/asm/spinlock_types.h
···2020#define __ARCH_SPIN_LOCK_LOCKED { __ARCH_SPIN_LOCK_LOCKED__ }21212222/*2323- * Unlocked: 0x01_00_00_002424- * Read lock(s): 0x00_FF_00_00 to say 0x012525- * Write lock: 0x0, but only possible if prior value "unlocked" 0x0100_00002323+ * Unlocked : 0x0100_00002424+ * Read lock(s) : 0x00FF_FFFF to 0x01 (Multiple Readers decrement it)2525+ * Write lock : 0x0, but only if prior value is "unlocked" 0x0100_00002626 */2727typedef struct {2828 volatile unsigned int counter;
+4-4
arch/arc/mm/cache_arc700.c
···622622/*623623 * General purpose helper to make I and D cache lines consistent.624624 * @paddr is phy addr of region625625- * @vaddr is typically user or kernel vaddr (vmalloc)626626- * Howver in one instance, flush_icache_range() by kprobe (for a breakpt in625625+ * @vaddr is typically user vaddr (breakpoint) or kernel vaddr (vmalloc)626626+ * However in one instance, when called by kprobe (for a breakpt in627627 * builtin kernel code) @vaddr will be paddr only, meaning CDU operation will628628 * use a paddr to index the cache (despite VIPT). This is fine since since a629629- * built-in kernel page will not have any virtual mappings (not even kernel)630630- * kprobe on loadable module is different as it will have kvaddr.629629+ * builtin kernel page will not have any virtual mappings.630630+ * kprobe on loadable module will be kernel vaddr.631631 */632632void __sync_icache_dcache(unsigned long paddr, unsigned long vaddr, int len)633633{
+63-68
arch/arc/mm/tlbex.S
···4444#include <asm/arcregs.h>4545#include <asm/cache.h>4646#include <asm/processor.h>4747-#if (CONFIG_ARC_MMU_VER == 1)4847#include <asm/tlb-mmu1.h>4949-#endif50485151-;--------------------------------------------------------------------------5252-; scratch memory to save the registers (r0-r3) used to code TLB refill Handler5353-; For details refer to comments before TLBMISS_FREEUP_REGS below4949+;-----------------------------------------------------------------5050+; ARC700 Exception Handling doesn't auto-switch stack and it only provides5151+; ONE scratch AUX reg "ARC_REG_SCRATCH_DATA0"5252+;5353+; For Non-SMP, the scratch AUX reg is repurposed to cache task PGD, so a5454+; "global" is used to free-up FIRST core reg to be able to code the rest of5555+; exception prologue (IRQ auto-disabled on Exceptions, so it's IRQ-safe).5656+; Since the Fast Path TLB Miss handler is coded with 4 regs, the remaining 35757+; need to be saved as well by extending the "global" to be 4 words. Hence5858+; ".size ex_saved_reg1, 16"5959+; [All of this dance is to avoid stack switching for each TLB Miss, since we6060+; only need to save only a handful of regs, as opposed to complete reg file]6161+;6262+; For ARC700 SMP, the "global" obviously can't be used for free up the FIRST6363+; core reg as it will not be SMP safe.6464+; Thus scratch AUX reg is used (and no longer used to cache task PGD).6565+; To save the rest of 3 regs - per cpu, the global is made "per-cpu".6666+; Epilogue thus has to locate the "per-cpu" storage for regs.6767+; To avoid cache line bouncing the per-cpu global is aligned/sized per6868+; L1_CACHE_SHIFT, despite fundamentally needing to be 12 bytes only. Hence6969+; ".size ex_saved_reg1, (CONFIG_NR_CPUS << L1_CACHE_SHIFT)"7070+7171+; As simple as that....5472;--------------------------------------------------------------------------55737474+; scratch memory to save [r0-r3] used to code TLB refill Handler5675ARCFP_DATA ex_saved_reg15757- .align 1 << L1_CACHE_SHIFT ; IMP: Must be Cache Line aligned7676+ .align 1 << L1_CACHE_SHIFT5877 .type ex_saved_reg1, @object5978#ifdef CONFIG_SMP6079 .size ex_saved_reg1, (CONFIG_NR_CPUS << L1_CACHE_SHIFT)···8465ex_saved_reg1:8566 .zero 168667#endif6868+6969+.macro TLBMISS_FREEUP_REGS7070+#ifdef CONFIG_SMP7171+ sr r0, [ARC_REG_SCRATCH_DATA0] ; freeup r0 to code with7272+ GET_CPU_ID r0 ; get to per cpu scratch mem,7373+ lsl r0, r0, L1_CACHE_SHIFT ; cache line wide per cpu7474+ add r0, @ex_saved_reg1, r07575+#else7676+ st r0, [@ex_saved_reg1]7777+ mov_s r0, @ex_saved_reg17878+#endif7979+ st_s r1, [r0, 4]8080+ st_s r2, [r0, 8]8181+ st_s r3, [r0, 12]8282+8383+ ; VERIFY if the ASID in MMU-PID Reg is same as8484+ ; one in Linux data structures8585+8686+ DBG_ASID_MISMATCH8787+.endm8888+8989+.macro TLBMISS_RESTORE_REGS9090+#ifdef CONFIG_SMP9191+ GET_CPU_ID r0 ; get to per cpu scratch mem9292+ lsl r0, r0, L1_CACHE_SHIFT ; each is cache line wide9393+ add r0, @ex_saved_reg1, r09494+ ld_s r3, [r0,12]9595+ ld_s r2, [r0, 8]9696+ ld_s r1, [r0, 4]9797+ lr r0, [ARC_REG_SCRATCH_DATA0]9898+#else9999+ mov_s r0, @ex_saved_reg1100100+ ld_s r3, [r0,12]101101+ ld_s r2, [r0, 8]102102+ ld_s r1, [r0, 4]103103+ ld_s r0, [r0]104104+#endif105105+.endm8710688107;============================================================================89108; Troubleshooting Stuff···248191#endif249192.endm250193251251-;-----------------------------------------------------------------252252-; ARC700 Exception Handling doesn't auto-switch stack and it only provides253253-; ONE scratch AUX reg "ARC_REG_SCRATCH_DATA0"254254-;255255-; For Non-SMP, the scratch AUX reg is repurposed to cache task PGD, so a256256-; "global" is used to free-up FIRST core reg to be able to code the rest of257257-; exception prologue (IRQ auto-disabled on Exceptions, so it's IRQ-safe).258258-; Since the Fast Path TLB Miss handler is coded with 4 regs, the remaining 3259259-; need to be saved as well by extending the "global" to be 4 words. Hence260260-; ".size ex_saved_reg1, 16"261261-; [All of this dance is to avoid stack switching for each TLB Miss, since we262262-; only need to save only a handful of regs, as opposed to complete reg file]263263-;264264-; For ARC700 SMP, the "global" obviously can't be used for free up the FIRST265265-; core reg as it will not be SMP safe.266266-; Thus scratch AUX reg is used (and no longer used to cache task PGD).267267-; To save the rest of 3 regs - per cpu, the global is made "per-cpu".268268-; Epilogue thus has to locate the "per-cpu" storage for regs.269269-; To avoid cache line bouncing the per-cpu global is aligned/sized per270270-; L1_CACHE_SHIFT, despite fundamentally needing to be 12 bytes only. Hence271271-; ".size ex_saved_reg1, (CONFIG_NR_CPUS << L1_CACHE_SHIFT)"272272-273273-; As simple as that....274274-275275-.macro TLBMISS_FREEUP_REGS276276-#ifdef CONFIG_SMP277277- sr r0, [ARC_REG_SCRATCH_DATA0] ; freeup r0 to code with278278- GET_CPU_ID r0 ; get to per cpu scratch mem,279279- lsl r0, r0, L1_CACHE_SHIFT ; cache line wide per cpu280280- add r0, @ex_saved_reg1, r0281281-#else282282- st r0, [@ex_saved_reg1]283283- mov_s r0, @ex_saved_reg1284284-#endif285285- st_s r1, [r0, 4]286286- st_s r2, [r0, 8]287287- st_s r3, [r0, 12]288288-289289- ; VERIFY if the ASID in MMU-PID Reg is same as290290- ; one in Linux data structures291291-292292- DBG_ASID_MISMATCH293293-.endm294294-295295-;-----------------------------------------------------------------296296-.macro TLBMISS_RESTORE_REGS297297-#ifdef CONFIG_SMP298298- GET_CPU_ID r0 ; get to per cpu scratch mem299299- lsl r0, r0, L1_CACHE_SHIFT ; each is cache line wide300300- add r0, @ex_saved_reg1, r0301301- ld_s r3, [r0,12]302302- ld_s r2, [r0, 8]303303- ld_s r1, [r0, 4]304304- lr r0, [ARC_REG_SCRATCH_DATA0]305305-#else306306- mov_s r0, @ex_saved_reg1307307- ld_s r3, [r0,12]308308- ld_s r2, [r0, 8]309309- ld_s r1, [r0, 4]310310- ld_s r0, [r0]311311-#endif312312-.endm313194314195ARCFP_CODE ;Fast Path Code, candidate for ICCM315196