diff options
| author | Jayachandran C <jchandra@broadcom.com> | 2014-05-09 07:05:14 -0400 |
|---|---|---|
| committer | Ralf Baechle <ralf@linux-mips.org> | 2014-05-30 10:47:56 -0400 |
| commit | a3deecfaa36662ca2e2104be3c305236cf03efcc (patch) | |
| tree | 64c90d95f734fc75ded54103e9c94ab23e35bc71 | |
| parent | 2e240ddd09d41645e928a19a3ff3290a0f546834 (diff) | |
MIPS: Netlogic: Reduce size of reset code
Update thread wakeup function to use scratch registers for saving SP and
RA. Move the register restore code needed for thread 0 to the calling
function. This reduces the size of code copied to the reset vector.
Signed-off-by: Jayachandran C <jchandra@broadcom.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6910/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
| -rw-r--r-- | arch/mips/netlogic/common/reset.S | 15 | ||||
| -rw-r--r-- | arch/mips/netlogic/common/smpboot.S | 12 |
2 files changed, 16 insertions, 11 deletions
diff --git a/arch/mips/netlogic/common/reset.S b/arch/mips/netlogic/common/reset.S index b231fe1e7a09..fda772a8595b 100644 --- a/arch/mips/netlogic/common/reset.S +++ b/arch/mips/netlogic/common/reset.S | |||
| @@ -197,6 +197,9 @@ FEXPORT(nlm_reset_entry) | |||
| 197 | EXPORT(nlm_boot_siblings) | 197 | EXPORT(nlm_boot_siblings) |
| 198 | /* core L1D flush before enable threads */ | 198 | /* core L1D flush before enable threads */ |
| 199 | xlp_flush_l1_dcache | 199 | xlp_flush_l1_dcache |
| 200 | /* save ra and sp, will be used later (only for boot cpu) */ | ||
| 201 | dmtc0 ra, $22, 6 | ||
| 202 | dmtc0 sp, $22, 7 | ||
| 200 | /* Enable hw threads by writing to MAP_THREADMODE of the core */ | 203 | /* Enable hw threads by writing to MAP_THREADMODE of the core */ |
| 201 | li t0, CKSEG1ADDR(RESET_DATA_PHYS) | 204 | li t0, CKSEG1ADDR(RESET_DATA_PHYS) |
| 202 | lw t1, BOOT_THREAD_MODE(t0) /* t1 <- thread mode */ | 205 | lw t1, BOOT_THREAD_MODE(t0) /* t1 <- thread mode */ |
| @@ -238,14 +241,12 @@ EXPORT(nlm_boot_siblings) | |||
| 238 | nop | 241 | nop |
| 239 | 242 | ||
| 240 | /* | 243 | /* |
| 241 | * For the boot CPU, we have to restore registers and | 244 | * For the boot CPU, we have to restore ra and sp and return, rest |
| 242 | * return | 245 | * of the registers will be restored by the caller |
| 243 | */ | 246 | */ |
| 244 | 4: dmfc0 t0, $4, 2 /* restore SP from UserLocal */ | 247 | 4: |
| 245 | li t1, 0xfadebeef | 248 | dmfc0 ra, $22, 6 |
| 246 | dmtc0 t1, $4, 2 /* restore SP from UserLocal */ | 249 | dmfc0 sp, $22, 7 |
| 247 | PTR_SUBU sp, t0, PT_SIZE | ||
| 248 | RESTORE_ALL | ||
| 249 | jr ra | 250 | jr ra |
| 250 | nop | 251 | nop |
| 251 | EXPORT(nlm_reset_entry_end) | 252 | EXPORT(nlm_reset_entry_end) |
diff --git a/arch/mips/netlogic/common/smpboot.S b/arch/mips/netlogic/common/smpboot.S index 8597657c27fc..805355b0bd05 100644 --- a/arch/mips/netlogic/common/smpboot.S +++ b/arch/mips/netlogic/common/smpboot.S | |||
| @@ -54,8 +54,9 @@ | |||
| 54 | .set noat | 54 | .set noat |
| 55 | .set arch=xlr /* for mfcr/mtcr, XLR is sufficient */ | 55 | .set arch=xlr /* for mfcr/mtcr, XLR is sufficient */ |
| 56 | 56 | ||
| 57 | FEXPORT(xlp_boot_core0_siblings) /* "Master" cpu starts from here */ | 57 | /* Called by the boot cpu to wake up its sibling threads */ |
| 58 | dmtc0 sp, $4, 2 /* SP saved in UserLocal */ | 58 | NESTED(xlp_boot_core0_siblings, PT_SIZE, sp) |
| 59 | /* CPU register contents lost when enabling threads, save them first */ | ||
| 59 | SAVE_ALL | 60 | SAVE_ALL |
| 60 | sync | 61 | sync |
| 61 | /* find the location to which nlm_boot_siblings was relocated */ | 62 | /* find the location to which nlm_boot_siblings was relocated */ |
| @@ -65,9 +66,12 @@ FEXPORT(xlp_boot_core0_siblings) /* "Master" cpu starts from here */ | |||
| 65 | dsubu t2, t1 | 66 | dsubu t2, t1 |
| 66 | daddu t2, t0 | 67 | daddu t2, t0 |
| 67 | /* call it */ | 68 | /* call it */ |
| 68 | jr t2 | 69 | jalr t2 |
| 69 | nop | 70 | nop |
| 70 | /* not reached */ | 71 | RESTORE_ALL |
| 72 | jr ra | ||
| 73 | nop | ||
| 74 | END(xlp_boot_core0_siblings) | ||
| 71 | 75 | ||
| 72 | NESTED(nlm_boot_secondary_cpus, 16, sp) | 76 | NESTED(nlm_boot_secondary_cpus, 16, sp) |
| 73 | /* Initialize CP0 Status */ | 77 | /* Initialize CP0 Status */ |
