diff options
author | David Daney <ddaney@caviumnetworks.com> | 2010-10-07 19:03:53 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2010-10-29 14:08:43 -0400 |
commit | c9941158fd8a539a56b0e8a4740ec1f6beb23ea3 (patch) | |
tree | 73e3868737061e1d5b0b61c182ea443e3ccd94e3 /arch/mips/cavium-octeon/setup.c | |
parent | 468ffde46d429fbd291b0ef43a06afe9c837629f (diff) |
MIPS: Octeon: Apply CN63XXP1 errata workarounds.
The CN63XXP1 needs a couple of workarounds to ensure memory is not written
in unexpected ways.
All PREF with hints in the range 0-4,6-24 are replaced with PREF 28. We
pass a flag to the assembler to cover compiler generated code, and patch
uasm for the dynamically generated code.
The write buffer threshold is reduced to 4.
Signed-off-by: David Daney <ddaney@caviumnetworks.com>
Patchwork: http://patchwork.linux-mips.org/patch/1672/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/cavium-octeon/setup.c')
-rw-r--r-- | arch/mips/cavium-octeon/setup.c | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c index c072b24f4853..b0c3686c96dd 100644 --- a/arch/mips/cavium-octeon/setup.c +++ b/arch/mips/cavium-octeon/setup.c | |||
@@ -356,8 +356,18 @@ void octeon_user_io_init(void) | |||
356 | cvmmemctl.s.wbfltime = 0; | 356 | cvmmemctl.s.wbfltime = 0; |
357 | /* R/W If set, do not put Istream in the L2 cache. */ | 357 | /* R/W If set, do not put Istream in the L2 cache. */ |
358 | cvmmemctl.s.istrnol2 = 0; | 358 | cvmmemctl.s.istrnol2 = 0; |
359 | /* R/W The write buffer threshold. */ | 359 | |
360 | cvmmemctl.s.wbthresh = 10; | 360 | /* |
361 | * R/W The write buffer threshold. As per erratum Core-14752 | ||
362 | * for CN63XX, a sc/scd might fail if the write buffer is | ||
363 | * full. Lowering WBTHRESH greatly lowers the chances of the | ||
364 | * write buffer ever being full and triggering the erratum. | ||
365 | */ | ||
366 | if (OCTEON_IS_MODEL(OCTEON_CN63XX_PASS1_X)) | ||
367 | cvmmemctl.s.wbthresh = 4; | ||
368 | else | ||
369 | cvmmemctl.s.wbthresh = 10; | ||
370 | |||
361 | /* R/W If set, CVMSEG is available for loads/stores in | 371 | /* R/W If set, CVMSEG is available for loads/stores in |
362 | * kernel/debug mode. */ | 372 | * kernel/debug mode. */ |
363 | #if CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE > 0 | 373 | #if CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE > 0 |
@@ -375,14 +385,13 @@ void octeon_user_io_init(void) | |||
375 | * is max legal value. */ | 385 | * is max legal value. */ |
376 | cvmmemctl.s.lmemsz = CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE; | 386 | cvmmemctl.s.lmemsz = CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE; |
377 | 387 | ||
388 | write_c0_cvmmemctl(cvmmemctl.u64); | ||
378 | 389 | ||
379 | if (smp_processor_id() == 0) | 390 | if (smp_processor_id() == 0) |
380 | pr_notice("CVMSEG size: %d cache lines (%d bytes)\n", | 391 | pr_notice("CVMSEG size: %d cache lines (%d bytes)\n", |
381 | CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE, | 392 | CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE, |
382 | CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE * 128); | 393 | CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE * 128); |
383 | 394 | ||
384 | write_c0_cvmmemctl(cvmmemctl.u64); | ||
385 | |||
386 | /* Move the performance counter interrupts to IRQ 6 */ | 395 | /* Move the performance counter interrupts to IRQ 6 */ |
387 | cvmctl = read_c0_cvmctl(); | 396 | cvmctl = read_c0_cvmctl(); |
388 | cvmctl &= ~(7 << 7); | 397 | cvmctl &= ~(7 << 7); |
@@ -758,6 +767,31 @@ EXPORT_SYMBOL(prom_putchar); | |||
758 | 767 | ||
759 | void prom_free_prom_memory(void) | 768 | void prom_free_prom_memory(void) |
760 | { | 769 | { |
770 | if (OCTEON_IS_MODEL(OCTEON_CN63XX_PASS1_X)) { | ||
771 | /* Check for presence of Core-14449 fix. */ | ||
772 | u32 insn; | ||
773 | u32 *foo; | ||
774 | |||
775 | foo = &insn; | ||
776 | |||
777 | asm volatile("# before" : : : "memory"); | ||
778 | prefetch(foo); | ||
779 | asm volatile( | ||
780 | ".set push\n\t" | ||
781 | ".set noreorder\n\t" | ||
782 | "bal 1f\n\t" | ||
783 | "nop\n" | ||
784 | "1:\tlw %0,-12($31)\n\t" | ||
785 | ".set pop\n\t" | ||
786 | : "=r" (insn) : : "$31", "memory"); | ||
787 | |||
788 | if ((insn >> 26) != 0x33) | ||
789 | panic("No PREF instruction at Core-14449 probe point.\n"); | ||
790 | |||
791 | if (((insn >> 16) & 0x1f) != 28) | ||
792 | panic("Core-14449 WAR not in place (%04x).\n" | ||
793 | "Please build kernel with proper options (CONFIG_CAVIUM_CN63XXP1).\n", insn); | ||
794 | } | ||
761 | #ifdef CONFIG_CAVIUM_DECODE_RSL | 795 | #ifdef CONFIG_CAVIUM_DECODE_RSL |
762 | cvmx_interrupt_rsl_enable(); | 796 | cvmx_interrupt_rsl_enable(); |
763 | 797 | ||