diff options
| author | David Daney <david.daney@cavium.com> | 2015-01-15 08:11:15 -0500 |
|---|---|---|
| committer | Ralf Baechle <ralf@linux-mips.org> | 2015-02-20 09:31:59 -0500 |
| commit | 726da2f82a1659da5d4d3473427fdb198ffde370 (patch) | |
| tree | 733b56095f351b340585ab23779a76310dd0e292 | |
| parent | debe6a623d3cdc7f0374124830587fb8d1a04b63 (diff) | |
MIPS: OCTEON: Core-15169 Workaround and general CVMSEG cleanup.
Signed-off-by: David Daney <david.daney@cavium.com>
Signed-off-by: Aleksey Makarov <aleksey.makarov@auriga.com>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/8943/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
| -rw-r--r-- | arch/mips/cavium-octeon/setup.c | 4 | ||||
| -rw-r--r-- | arch/mips/include/asm/mach-cavium-octeon/kernel-entry-init.h | 19 |
2 files changed, 17 insertions, 6 deletions
diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c index 8d2b82327a72..8b6b72a3e3c4 100644 --- a/arch/mips/cavium-octeon/setup.c +++ b/arch/mips/cavium-octeon/setup.c | |||
| @@ -579,12 +579,10 @@ void octeon_user_io_init(void) | |||
| 579 | /* R/W If set, CVMSEG is available for loads/stores in user | 579 | /* R/W If set, CVMSEG is available for loads/stores in user |
| 580 | * mode. */ | 580 | * mode. */ |
| 581 | cvmmemctl.s.cvmsegenau = 0; | 581 | cvmmemctl.s.cvmsegenau = 0; |
| 582 | /* R/W Size of local memory in cache blocks, 54 (6912 bytes) | ||
| 583 | * is max legal value. */ | ||
| 584 | cvmmemctl.s.lmemsz = CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE; | ||
| 585 | 582 | ||
| 586 | write_c0_cvmmemctl(cvmmemctl.u64); | 583 | write_c0_cvmmemctl(cvmmemctl.u64); |
| 587 | 584 | ||
| 585 | /* Setup of CVMSEG is done in kernel-entry-init.h */ | ||
| 588 | if (smp_processor_id() == 0) | 586 | if (smp_processor_id() == 0) |
| 589 | pr_notice("CVMSEG size: %d cache lines (%d bytes)\n", | 587 | pr_notice("CVMSEG size: %d cache lines (%d bytes)\n", |
| 590 | CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE, | 588 | CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE, |
diff --git a/arch/mips/include/asm/mach-cavium-octeon/kernel-entry-init.h b/arch/mips/include/asm/mach-cavium-octeon/kernel-entry-init.h index 21732c306635..c7ce0811657d 100644 --- a/arch/mips/include/asm/mach-cavium-octeon/kernel-entry-init.h +++ b/arch/mips/include/asm/mach-cavium-octeon/kernel-entry-init.h | |||
| @@ -8,11 +8,10 @@ | |||
| 8 | #ifndef __ASM_MACH_CAVIUM_OCTEON_KERNEL_ENTRY_H | 8 | #ifndef __ASM_MACH_CAVIUM_OCTEON_KERNEL_ENTRY_H |
| 9 | #define __ASM_MACH_CAVIUM_OCTEON_KERNEL_ENTRY_H | 9 | #define __ASM_MACH_CAVIUM_OCTEON_KERNEL_ENTRY_H |
| 10 | 10 | ||
| 11 | |||
| 12 | #define CP0_CYCLE_COUNTER $9, 6 | ||
| 13 | #define CP0_CVMCTL_REG $9, 7 | 11 | #define CP0_CVMCTL_REG $9, 7 |
| 14 | #define CP0_CVMMEMCTL_REG $11,7 | 12 | #define CP0_CVMMEMCTL_REG $11,7 |
| 15 | #define CP0_PRID_REG $15, 0 | 13 | #define CP0_PRID_REG $15, 0 |
| 14 | #define CP0_DCACHE_ERR_REG $27, 1 | ||
| 16 | #define CP0_PRID_OCTEON_PASS1 0x000d0000 | 15 | #define CP0_PRID_OCTEON_PASS1 0x000d0000 |
| 17 | #define CP0_PRID_OCTEON_CN30XX 0x000d0200 | 16 | #define CP0_PRID_OCTEON_CN30XX 0x000d0200 |
| 18 | 17 | ||
| @@ -60,7 +59,7 @@ | |||
| 60 | skip: | 59 | skip: |
| 61 | # First clear off CvmCtl[IPPCI] bit and move the performance | 60 | # First clear off CvmCtl[IPPCI] bit and move the performance |
| 62 | # counters interrupt to IRQ 6 | 61 | # counters interrupt to IRQ 6 |
| 63 | li v1, ~(7 << 7) | 62 | dli v1, ~(7 << 7) |
| 64 | and v0, v0, v1 | 63 | and v0, v0, v1 |
| 65 | ori v0, v0, (6 << 7) | 64 | ori v0, v0, (6 << 7) |
| 66 | 65 | ||
| @@ -90,6 +89,20 @@ skip: | |||
| 90 | sync | 89 | sync |
| 91 | # Flush dcache after config change | 90 | # Flush dcache after config change |
| 92 | cache 9, 0($0) | 91 | cache 9, 0($0) |
| 92 | # Zero all of CVMSEG to make sure parity is correct | ||
| 93 | dli v0, CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE | ||
| 94 | dsll v0, 7 | ||
| 95 | beqz v0, 2f | ||
| 96 | 1: dsubu v0, 8 | ||
| 97 | sd $0, -32768(v0) | ||
| 98 | bnez v0, 1b | ||
| 99 | 2: | ||
| 100 | mfc0 v0, CP0_PRID_REG | ||
| 101 | bbit0 v0, 15, 1f | ||
| 102 | # OCTEON II or better have bit 15 set. Clear the error bits. | ||
| 103 | dli v0, 0x27 | ||
| 104 | dmtc0 v0, CP0_DCACHE_ERR_REG | ||
| 105 | 1: | ||
| 93 | # Get my core id | 106 | # Get my core id |
| 94 | rdhwr v0, $0 | 107 | rdhwr v0, $0 |
| 95 | # Jump the master to kernel_entry | 108 | # Jump the master to kernel_entry |
