Thu Oct 15 07:13:50 2015 UTC ()
Setting actlr.bit15=1 (Force in order issue in the branch execution unit)
makes my jetson tk1 stable.  Apply this workaround until we figure out
what the real problem is.


(skrll)
diff -r1.156 -r1.157 src/sys/arch/arm/arm/cpufunc.c
diff -r1.42 -r1.43 src/sys/arch/arm/cortex/a9_mpsubr.S
diff -r1.107 -r1.108 src/sys/arch/arm/include/armreg.h
diff -r1.7 -r1.8 src/sys/arch/evbarm/conf/std.tegra

cvs diff -r1.156 -r1.157 src/sys/arch/arm/arm/cpufunc.c (expand / switch to unified diff)

--- src/sys/arch/arm/arm/cpufunc.c 2015/07/02 08:33:31 1.156
+++ src/sys/arch/arm/arm/cpufunc.c 2015/10/15 07:13:50 1.157
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: cpufunc.c,v 1.156 2015/07/02 08:33:31 skrll Exp $ */ 1/* $NetBSD: cpufunc.c,v 1.157 2015/10/15 07:13:50 skrll Exp $ */
2 2
3/* 3/*
4 * arm7tdmi support code Copyright (c) 2001 John Fremlin 4 * arm7tdmi support code Copyright (c) 2001 John Fremlin
5 * arm8 support code Copyright (c) 1997 ARM Limited 5 * arm8 support code Copyright (c) 1997 ARM Limited
6 * arm8 support code Copyright (c) 1997 Causality Limited 6 * arm8 support code Copyright (c) 1997 Causality Limited
7 * arm9 support code Copyright (C) 2001 ARM Ltd 7 * arm9 support code Copyright (C) 2001 ARM Ltd
8 * arm11 support code Copyright (c) 2007 Microsoft 8 * arm11 support code Copyright (c) 2007 Microsoft
9 * cortexa8 support code Copyright (c) 2008 3am Software Foundry 9 * cortexa8 support code Copyright (c) 2008 3am Software Foundry
10 * cortexa8 improvements Copyright (c) Goeran Weinholt 10 * cortexa8 improvements Copyright (c) Goeran Weinholt
11 * Copyright (c) 1997 Mark Brinicombe. 11 * Copyright (c) 1997 Mark Brinicombe.
12 * Copyright (c) 1997 Causality Limited 12 * Copyright (c) 1997 Causality Limited
13 * All rights reserved. 13 * All rights reserved.
14 * 14 *
@@ -39,27 +39,27 @@ @@ -39,27 +39,27 @@
39 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 39 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
40 * SUCH DAMAGE. 40 * SUCH DAMAGE.
41 * 41 *
42 * RiscBSD kernel project 42 * RiscBSD kernel project
43 * 43 *
44 * cpufuncs.c 44 * cpufuncs.c
45 * 45 *
46 * C functions for supporting CPU / MMU / TLB specific operations. 46 * C functions for supporting CPU / MMU / TLB specific operations.
47 * 47 *
48 * Created : 30/01/97 48 * Created : 30/01/97
49 */ 49 */
50 50
51#include <sys/cdefs.h> 51#include <sys/cdefs.h>
52__KERNEL_RCSID(0, "$NetBSD: cpufunc.c,v 1.156 2015/07/02 08:33:31 skrll Exp $"); 52__KERNEL_RCSID(0, "$NetBSD: cpufunc.c,v 1.157 2015/10/15 07:13:50 skrll Exp $");
53 53
54#include "opt_compat_netbsd.h" 54#include "opt_compat_netbsd.h"
55#include "opt_cpuoptions.h" 55#include "opt_cpuoptions.h"
56#include "opt_perfctrs.h" 56#include "opt_perfctrs.h"
57 57
58#include <sys/types.h> 58#include <sys/types.h>
59#include <sys/param.h> 59#include <sys/param.h>
60#include <sys/pmc.h> 60#include <sys/pmc.h>
61#include <sys/systm.h> 61#include <sys/systm.h>
62#include <machine/cpu.h> 62#include <machine/cpu.h>
63#include <machine/bootconfig.h> 63#include <machine/bootconfig.h>
64#include <arch/arm/arm/disassem.h> 64#include <arch/arm/arm/disassem.h>
65 65
@@ -3155,26 +3155,37 @@ armv7_setup(char *args) @@ -3155,26 +3155,37 @@ armv7_setup(char *args)
3155#endif 3155#endif
3156 | CPU_CONTROL_UNAL_ENABLE; 3156 | CPU_CONTROL_UNAL_ENABLE;
3157 3157
3158 int cpuctrlmask = cpuctrl | CPU_CONTROL_AFLT_ENABLE; 3158 int cpuctrlmask = cpuctrl | CPU_CONTROL_AFLT_ENABLE;
3159 3159
3160 3160
3161 cpuctrl = parse_cpu_options(args, armv7_options, cpuctrl); 3161 cpuctrl = parse_cpu_options(args, armv7_options, cpuctrl);
3162 3162
3163#ifndef ARM_HAS_VBAR 3163#ifndef ARM_HAS_VBAR
3164 if (vector_page == ARM_VECTORS_HIGH) 3164 if (vector_page == ARM_VECTORS_HIGH)
3165 cpuctrl |= CPU_CONTROL_VECRELOC; 3165 cpuctrl |= CPU_CONTROL_VECRELOC;
3166#endif 3166#endif
3167 3167
 3168#ifdef TEGRAK1_PMAP_WORKAROUND
 3169 uint32_t auxctrl = armreg_auxctl_read();
 3170
 3171 // u-boot sets this incorrectly on boot cpu
 3172 auxctrl &= ~CORTEXA15_ACTLR_BTB;
 3173 auxctrl |= CORTEXA15_ACTLR_IOBEU;
 3174
 3175 /* Update auxctlr */
 3176 armreg_auxctl_write(auxctrl);
 3177#endif
 3178
3168 /* Clear out the cache */ 3179 /* Clear out the cache */
3169 cpu_idcache_wbinv_all(); 3180 cpu_idcache_wbinv_all();
3170 3181
3171 /* Set the control register */ 3182 /* Set the control register */
3172 curcpu()->ci_ctrl = cpuctrl; 3183 curcpu()->ci_ctrl = cpuctrl;
3173 cpu_control(cpuctrlmask, cpuctrl); 3184 cpu_control(cpuctrlmask, cpuctrl);
3174} 3185}
3175#endif /* CPU_ARMV7 */ 3186#endif /* CPU_ARMV7 */
3176 3187
3177 3188
3178#if defined(CPU_ARM1136) || defined(CPU_ARM1176) 3189#if defined(CPU_ARM1136) || defined(CPU_ARM1176)
3179void 3190void
3180arm11x6_setup(char *args) 3191arm11x6_setup(char *args)

cvs diff -r1.42 -r1.43 src/sys/arch/arm/cortex/Attic/a9_mpsubr.S (expand / switch to unified diff)

--- src/sys/arch/arm/cortex/Attic/a9_mpsubr.S 2015/06/09 08:08:14 1.42
+++ src/sys/arch/arm/cortex/Attic/a9_mpsubr.S 2015/10/15 07:13:50 1.43
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: a9_mpsubr.S,v 1.42 2015/06/09 08:08:14 skrll Exp $ */ 1/* $NetBSD: a9_mpsubr.S,v 1.43 2015/10/15 07:13:50 skrll Exp $ */
2/*- 2/*-
3 * Copyright (c) 2012 The NetBSD Foundation, Inc. 3 * Copyright (c) 2012 The NetBSD Foundation, Inc.
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * This code is derived from software contributed to The NetBSD Foundation 6 * This code is derived from software contributed to The NetBSD Foundation
7 * by Matt Thomas of 3am Software Foundry. 7 * by Matt Thomas of 3am Software Foundry.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -488,26 +488,30 @@ cortex_init: @@ -488,26 +488,30 @@ cortex_init:
488 // Step 4a, set ACTLR.SMP=1 488 // Step 4a, set ACTLR.SMP=1
489 // 489 //
490 mrc p15, 0, r0, c1, c0, 1 // ACTLR read 490 mrc p15, 0, r0, c1, c0, 1 // ACTLR read
491 orr r0, r0, #CORTEXA9_AUXCTL_SMP // enable SMP 491 orr r0, r0, #CORTEXA9_AUXCTL_SMP // enable SMP
492 492
493#if defined(CPU_CORTEXA15) 493#if defined(CPU_CORTEXA15)
494 // The A15 requires snoop-delayed exclusive handling to be set 494 // The A15 requires snoop-delayed exclusive handling to be set
495 // if there are 3 or more CPUs. 495 // if there are 3 or more CPUs.
496 mrc p15, 1, r2, c9, c0, 2 // L2CTRL read 496 mrc p15, 1, r2, c9, c0, 2 // L2CTRL read
497 ubfx r2, r2, #25, #1 // bit 25 is set when 3+ CPUs 497 ubfx r2, r2, #25, #1 // bit 25 is set when 3+ CPUs
498 bfi r0, r2, #31, #1 // copy it to bit 31 in ACTRL 498 bfi r0, r2, #31, #1 // copy it to bit 31 in ACTRL
499#endif 499#endif
500 500
 501#if defined(TEGRAK1_PMAP_WORKAROUND)
 502 orr r0, r0, #CORTEXA15_ACTLR_IOBEU
 503#endif
 504
501#if defined(CPU_CORTEXA5) || defined(CPU_CORTEXA9) 505#if defined(CPU_CORTEXA5) || defined(CPU_CORTEXA9)
502 // 506 //
503 // Step 4a (continued on A5/A9), ACTLR.FW=1) 507 // Step 4a (continued on A5/A9), ACTLR.FW=1)
504 // 508 //
505 orr r0, r0, #CORTEXA9_AUXCTL_FW // enable cache/tlb/coherency 509 orr r0, r0, #CORTEXA9_AUXCTL_FW // enable cache/tlb/coherency
506#endif /* A5 || A9 */ 510#endif /* A5 || A9 */
507#if defined(CPU_CORTEXA9) 511#if defined(CPU_CORTEXA9)
508 // 512 //
509 // Step 4b (continued on A9), ACTLR.L2PE=1) 513 // Step 4b (continued on A9), ACTLR.L2PE=1)
510 // 514 //
511 orr r0, r0, #CORTEXA9_AUXCTL_L2PE // enable L2 cache prefetch 515 orr r0, r0, #CORTEXA9_AUXCTL_L2PE // enable L2 cache prefetch
512#endif 516#endif
513 517

cvs diff -r1.107 -r1.108 src/sys/arch/arm/include/armreg.h (expand / switch to unified diff)

--- src/sys/arch/arm/include/armreg.h 2015/06/09 08:08:14 1.107
+++ src/sys/arch/arm/include/armreg.h 2015/10/15 07:13:50 1.108
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: armreg.h,v 1.107 2015/06/09 08:08:14 skrll Exp $ */ 1/* $NetBSD: armreg.h,v 1.108 2015/10/15 07:13:50 skrll Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1998, 2001 Ben Harris 4 * Copyright (c) 1998, 2001 Ben Harris
5 * Copyright (c) 1994-1996 Mark Brinicombe. 5 * Copyright (c) 1994-1996 Mark Brinicombe.
6 * Copyright (c) 1994 Brini. 6 * Copyright (c) 1994 Brini.
7 * All rights reserved. 7 * All rights reserved.
8 * 8 *
9 * This code is derived from software written for Brini by Mark Brinicombe 9 * This code is derived from software written for Brini by Mark Brinicombe
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions 12 * modification, are permitted provided that the following conditions
13 * are met: 13 * are met:
14 * 1. Redistributions of source code must retain the above copyright 14 * 1. Redistributions of source code must retain the above copyright
@@ -446,26 +446,31 @@ @@ -446,26 +446,31 @@
446#define PJ4B_AUXFMC0_DCSLFD __BIT(2) /* Disable DC Speculative linefill */ 446#define PJ4B_AUXFMC0_DCSLFD __BIT(2) /* Disable DC Speculative linefill */
447#define PJ4B_AUXFMC0_FW __BIT(8) /* alias of PJ4B_AUXCTL_FW*/ 447#define PJ4B_AUXFMC0_FW __BIT(8) /* alias of PJ4B_AUXCTL_FW*/
448 448
449/* Cortex-A9 Auxiliary Control Register (CP15 register 1, opcode 1) */ 449/* Cortex-A9 Auxiliary Control Register (CP15 register 1, opcode 1) */
450#define CORTEXA9_AUXCTL_FW 0x00000001 /* Cache and TLB updates broadcast */ 450#define CORTEXA9_AUXCTL_FW 0x00000001 /* Cache and TLB updates broadcast */
451#define CORTEXA9_AUXCTL_L2PE 0x00000002 /* Prefetch hint enable */ 451#define CORTEXA9_AUXCTL_L2PE 0x00000002 /* Prefetch hint enable */
452#define CORTEXA9_AUXCTL_L1PE 0x00000004 /* Data prefetch hint enable */ 452#define CORTEXA9_AUXCTL_L1PE 0x00000004 /* Data prefetch hint enable */
453#define CORTEXA9_AUXCTL_WR_ZERO 0x00000008 /* Ena. write full line of 0s mode */ 453#define CORTEXA9_AUXCTL_WR_ZERO 0x00000008 /* Ena. write full line of 0s mode */
454#define CORTEXA9_AUXCTL_SMP 0x00000040 /* Coherency is active */ 454#define CORTEXA9_AUXCTL_SMP 0x00000040 /* Coherency is active */
455#define CORTEXA9_AUXCTL_EXCL 0x00000080 /* Exclusive cache bit */ 455#define CORTEXA9_AUXCTL_EXCL 0x00000080 /* Exclusive cache bit */
456#define CORTEXA9_AUXCTL_ONEWAY 0x00000100 /* Allocate in on cache way only */ 456#define CORTEXA9_AUXCTL_ONEWAY 0x00000100 /* Allocate in on cache way only */
457#define CORTEXA9_AUXCTL_PARITY 0x00000200 /* Support parity checking */ 457#define CORTEXA9_AUXCTL_PARITY 0x00000200 /* Support parity checking */
458 458
 459/* Cortex-A15 Auxiliary Control Register (CP15 register 1, opcode 1) */
 460#define CORTEXA15_ACTLR_BTB __BIT(0) /* Cache and TLB updates broadcast */
 461#define CORTEXA15_ACTLR_SMP __BIT(6) /* SMP */
 462#define CORTEXA15_ACTLR_IOBEU __BIT(15) /* In order issue in Branch Exec UNIT */
 463
459/* Marvell Feroceon Extra Features Register (CP15 register 1, opcode2 0) */ 464/* Marvell Feroceon Extra Features Register (CP15 register 1, opcode2 0) */
460#define FC_DCACHE_REPL_LOCK 0x80000000 /* Replace DCache Lock */ 465#define FC_DCACHE_REPL_LOCK 0x80000000 /* Replace DCache Lock */
461#define FC_DCACHE_STREAM_EN 0x20000000 /* DCache Streaming Switch */ 466#define FC_DCACHE_STREAM_EN 0x20000000 /* DCache Streaming Switch */
462#define FC_WR_ALLOC_EN 0x10000000 /* Enable Write Allocate */ 467#define FC_WR_ALLOC_EN 0x10000000 /* Enable Write Allocate */
463#define FC_L2_PREF_DIS 0x01000000 /* L2 Cache Prefetch Disable */ 468#define FC_L2_PREF_DIS 0x01000000 /* L2 Cache Prefetch Disable */
464#define FC_L2_INV_EVICT_LINE 0x00800000 /* L2 Invalidates Uncorrectable Error Line Eviction */ 469#define FC_L2_INV_EVICT_LINE 0x00800000 /* L2 Invalidates Uncorrectable Error Line Eviction */
465#define FC_L2CACHE_EN 0x00400000 /* L2 enable */ 470#define FC_L2CACHE_EN 0x00400000 /* L2 enable */
466#define FC_ICACHE_REPL_LOCK 0x00080000 /* Replace ICache Lock */ 471#define FC_ICACHE_REPL_LOCK 0x00080000 /* Replace ICache Lock */
467#define FC_GLOB_HIST_REG_EN 0x00040000 /* Branch Global History Register Enable */ 472#define FC_GLOB_HIST_REG_EN 0x00040000 /* Branch Global History Register Enable */
468#define FC_BRANCH_TARG_BUF_DIS 0x00020000 /* Branch Target Buffer Disable */ 473#define FC_BRANCH_TARG_BUF_DIS 0x00020000 /* Branch Target Buffer Disable */
469#define FC_L1_PAR_ERR_EN 0x00010000 /* L1 Parity Error Enable */ 474#define FC_L1_PAR_ERR_EN 0x00010000 /* L1 Parity Error Enable */
470 475
471/* Cache type register definitions 0 */ 476/* Cache type register definitions 0 */

cvs diff -r1.7 -r1.8 src/sys/arch/evbarm/conf/Attic/std.tegra (expand / switch to unified diff)

--- src/sys/arch/evbarm/conf/Attic/std.tegra 2015/05/31 20:04:44 1.7
+++ src/sys/arch/evbarm/conf/Attic/std.tegra 2015/10/15 07:13:50 1.8
@@ -1,29 +1,30 @@ @@ -1,29 +1,30 @@
1# $NetBSD: std.tegra,v 1.7 2015/05/31 20:04:44 jmcneill Exp $ 1# $NetBSD: std.tegra,v 1.8 2015/10/15 07:13:50 skrll Exp $
2# 2#
3 3
4machine evbarm arm 4machine evbarm arm
5include "arch/evbarm/conf/std.evbarm" 5include "arch/evbarm/conf/std.evbarm"
6 6
7include "arch/evbarm/conf/files.tegra" 7include "arch/evbarm/conf/files.tegra"
8 8
9options MODULAR 9options MODULAR
10options MODULAR_DEFAULT_AUTOLOAD 10options MODULAR_DEFAULT_AUTOLOAD
11options __HAVE_CPU_COUNTER 11options __HAVE_CPU_COUNTER
12options CORTEX_PMC 12options CORTEX_PMC
13options __HAVE_FAST_SOFTINTS # should be in types.h 13options __HAVE_FAST_SOFTINTS # should be in types.h
14options ARM_HAS_VBAR 14options ARM_HAS_VBAR
15#options __HAVE_MM_MD_DIRECT_MAPPED_PHYS 15#options __HAVE_MM_MD_DIRECT_MAPPED_PHYS
16#options PMAP_NEED_ALLOC_POOLPAGE 16#options PMAP_NEED_ALLOC_POOLPAGE
17options TPIDRPRW_IS_CURCPU 17options TPIDRPRW_IS_CURCPU
18options KERNEL_BASE_EXT=0x80000000 18options KERNEL_BASE_EXT=0x80000000
19options FPU_VFP 19options FPU_VFP
20options PCI_NETBSD_CONFIGURE 20options PCI_NETBSD_CONFIGURE
21options __HAVE_PCI_CONF_HOOK 21options __HAVE_PCI_CONF_HOOK
 22options TEGRAK1_PMAP_WORKAROUND
22 23
23makeoptions KERNEL_BASE_PHYS="0x81000000" 24makeoptions KERNEL_BASE_PHYS="0x81000000"
24makeoptions KERNEL_BASE_VIRT="0x81000000" 25makeoptions KERNEL_BASE_VIRT="0x81000000"
25makeoptions BOARDTYPE="tegra" 26makeoptions BOARDTYPE="tegra"
26makeoptions BOARDMKFRAG="${THISARM}/conf/mk.tegra" 27makeoptions BOARDMKFRAG="${THISARM}/conf/mk.tegra"
27 28
28options ARM_INTR_IMPL="<arch/arm/nvidia/tegra_intr.h>" 29options ARM_INTR_IMPL="<arch/arm/nvidia/tegra_intr.h>"
29options ARM_GENERIC_TODR 30options ARM_GENERIC_TODR