Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'arc-4.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc

Pull ARC architecture updates from Vineet Gupta:

- support for HS38 cores based on ARCv2 ISA

ARCv2 is the next generation ISA from Synopsys and basis for the
HS3{4,6,8} families of processors which retain the traditional ARC mantra of
low power and configurability and are now more performant and feature rich.

HS38x is a 10 stage pipeline core which supports MMU (with huge pages) and
SMP (upto 4 cores) among other features.

+ www.synopsys.com/dw/ipdir.php?ds=arc-hs38-processor
+ http://news.synopsys.com/2014-10-14-New-DesignWare-ARC-HS38-Processor-Doubles-Performance-for-Embedded-Linux-Applications
+ http://www.embedded.com/electronics-news/4435975/Synopsys-ARC-HS38-core-gives-2X-boost-to-Linux-based-apps

- support for ARC SDP (Software Development platform): Main Board + CPU Cards
= AXS101: CPU Card with ARC700 in silicon @ 700 MHz
= AXS103: CPU Card with HS38x in FPGA

- refactoring of ARCompact port to accomodate new ARCv2 ISA

- misc updates/cleanups

* tag 'arc-4.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc: (72 commits)
ARC: Fix build failures for ARCompact in linux-next after ARCv2 support
ARCv2: Allow older gcc to cope with new regime of ARCv2/ARCompact support
ARCv2: [vdk] dts files and defconfig for HS38 VDK
ARCv2: [axs103] Support ARC SDP FPGA platform for HS38x cores
ARC: [axs101] Prepare for AXS103
ARCv2: [nsim*hs*] Support simulation platforms for HS38x cores
ARCv2: All bits in place, allow ARCv2 builds
ARCv2: SLC: Handle explcit flush for DMA ops (w/o IO-coherency)
ARCv2: STAR 9000837815 workaround hardware exclusive transactions livelock
ARC: Reduce bitops lines of code using macros
ARCv2: barriers
arch: conditionally define smp_{mb,rmb,wmb}
ARC: add smp barriers around atomics per Documentation/atomic_ops.txt
ARC: add compiler barrier to LLSC based cmpxchg
ARCv2: SMP: intc: IDU 2nd level intc for dynamic IRQ distribution
ARCv2: SMP: clocksource: Enable Global Real Time counter
ARCv2: SMP: ARConnect debug/robustness
ARCv2: SMP: Support ARConnect (MCIP) for Inter-Core-Interrupts et al
ARC: make plat_smp_ops weak to allow over-rides
ARCv2: clocksource: Introduce 64bit local RTC counter
...

+7059 -2394
+46
Documentation/devicetree/bindings/arc/archs-idu-intc.txt
··· 1 + * ARC-HS Interrupt Distribution Unit 2 + 3 + This optional 2nd level interrupt controller can be used in SMP configurations for 4 + dynamic IRQ routing, load balancing of common/external IRQs towards core intc. 5 + 6 + Properties: 7 + 8 + - compatible: "snps,archs-idu-intc" 9 + - interrupt-controller: This is an interrupt controller. 10 + - interrupt-parent: <reference to parent core intc> 11 + - #interrupt-cells: Must be <2>. 12 + - interrupts: <...> specifies the upstream core irqs 13 + 14 + First cell specifies the "common" IRQ from peripheral to IDU 15 + Second cell specifies the irq distribution mode to cores 16 + 0=Round Robin; 1=cpu0, 2=cpu1, 4=cpu2, 8=cpu3 17 + 18 + intc accessed via the special ARC AUX register interface, hence "reg" property 19 + is not specified. 20 + 21 + Example: 22 + core_intc: core-interrupt-controller { 23 + compatible = "snps,archs-intc"; 24 + interrupt-controller; 25 + #interrupt-cells = <1>; 26 + }; 27 + 28 + idu_intc: idu-interrupt-controller { 29 + compatible = "snps,archs-idu-intc"; 30 + interrupt-controller; 31 + interrupt-parent = <&core_intc>; 32 + 33 + /* 34 + * <hwirq distribution> 35 + * distribution: 0=RR; 1=cpu0, 2=cpu1, 4=cpu2, 8=cpu3 36 + */ 37 + #interrupt-cells = <2>; 38 + 39 + /* upstream core irqs: downstream these are "COMMON" irq 0,1.. */ 40 + interrupts = <24 25 26 27 28 29 30 31>; 41 + }; 42 + 43 + some_device: serial@c0fc1000 { 44 + interrupt-parent = <&idu_intc>; 45 + interrupts = <0 0>; /* upstream idu IRQ #24, Round Robin */ 46 + };
+22
Documentation/devicetree/bindings/arc/archs-intc.txt
··· 1 + * ARC-HS incore Interrupt Controller (Provided by cores implementing ARCv2 ISA) 2 + 3 + Properties: 4 + 5 + - compatible: "snps,archs-intc" 6 + - interrupt-controller: This is an interrupt controller. 7 + - #interrupt-cells: Must be <1>. 8 + 9 + Single Cell "interrupts" property of a device specifies the IRQ number 10 + between 16 to 256 11 + 12 + intc accessed via the special ARC AUX register interface, hence "reg" property 13 + is not specified. 14 + 15 + Example: 16 + 17 + intc: interrupt-controller { 18 + compatible = "snps,archs-intc"; 19 + interrupt-controller; 20 + #interrupt-cells = <1>; 21 + interrupts = <16 17 18 19 20 21 22 23 24 25>; 22 + };
+7
Documentation/devicetree/bindings/arc/axs101.txt
··· 1 + Synopsys DesignWare ARC Software Development Platforms Device Tree Bindings 2 + --------------------------------------------------------------------------- 3 + 4 + SDP Main Board with an AXC001 CPU Card hoisting ARC700 core in silicon 5 + 6 + Required root node properties: 7 + - compatible = "snps,axs101", "snps,arc-sdp";
+8
Documentation/devicetree/bindings/arc/axs103.txt
··· 1 + Synopsys DesignWare ARC Software Development Platforms Device Tree Bindings 2 + --------------------------------------------------------------------------- 3 + 4 + SDP Main Board with an AXC003 FPGA Card which can contain various flavours of 5 + HS38x cores. 6 + 7 + Required root node properties: 8 + - compatible = "snps,axs103", "snps,arc-sdp";
+7
MAINTAINERS
··· 9832 9832 F: Documentation/devicetree/bindings/arc/ 9833 9833 F: drivers/tty/serial/arc_uart.c 9834 9834 9835 + SYNOPSYS ARC SDP platform support 9836 + M: Alexey Brodkin <abrodkin@synopsys.com> 9837 + S: Supported 9838 + F: arch/arc/plat-axs10x 9839 + F: arch/arc/boot/dts/ax* 9840 + F: Documentation/devicetree/bindings/arc/axs10* 9841 + 9835 9842 SYSTEM CONFIGURATION (SYSCON) 9836 9843 M: Lee Jones <lee.jones@linaro.org> 9837 9844 M: Arnd Bergmann <arnd@arndb.de>
+127 -32
arch/arc/Kconfig
··· 81 81 82 82 menu "ARC Platform/SoC/Board" 83 83 84 - source "arch/arc/plat-arcfpga/Kconfig" 84 + source "arch/arc/plat-sim/Kconfig" 85 85 source "arch/arc/plat-tb10x/Kconfig" 86 + source "arch/arc/plat-axs10x/Kconfig" 86 87 #New platform adds here 87 88 88 89 endmenu 90 + 91 + choice 92 + prompt "ARC Instruction Set" 93 + default ISA_ARCOMPACT 94 + 95 + config ISA_ARCOMPACT 96 + bool "ARCompact ISA" 97 + help 98 + The original ARC ISA of ARC600/700 cores 99 + 100 + config ISA_ARCV2 101 + bool "ARC ISA v2" 102 + help 103 + ISA for the Next Generation ARC-HS cores 104 + 105 + endchoice 89 106 90 107 menu "ARC CPU Configuration" 91 108 92 109 choice 93 110 prompt "ARC Core" 94 - default ARC_CPU_770 111 + default ARC_CPU_770 if ISA_ARCOMPACT 112 + default ARC_CPU_HS if ISA_ARCV2 113 + 114 + if ISA_ARCOMPACT 95 115 96 116 config ARC_CPU_750D 97 117 bool "ARC750D" ··· 120 100 121 101 config ARC_CPU_770 122 102 bool "ARC770" 123 - select ARC_CPU_REL_4_10 103 + select ARC_HAS_SWAPE 124 104 help 125 105 Support for ARC770 core introduced with Rel 4.10 (Summer 2011) 126 106 This core has a bunch of cool new features: ··· 128 108 Shared Address Spaces (for sharing TLB entires in MMU) 129 109 -Caches: New Prog Model, Region Flush 130 110 -Insns: endian swap, load-locked/store-conditional, time-stamp-ctr 111 + 112 + endif #ISA_ARCOMPACT 113 + 114 + config ARC_CPU_HS 115 + bool "ARC-HS" 116 + depends on ISA_ARCV2 117 + help 118 + Support for ARC HS38x Cores based on ARCv2 ISA 119 + The notable features are: 120 + - SMP configurations of upto 4 core with coherency 121 + - Optional L2 Cache and IO-Coherency 122 + - Revised Interrupt Architecture (multiple priorites, reg banks, 123 + auto stack switch, auto regfile save/restore) 124 + - MMUv4 (PIPT dcache, Huge Pages) 125 + - Instructions for 126 + * 64bit load/store: LDD, STD 127 + * Hardware assisted divide/remainder: DIV, REM 128 + * Function prologue/epilogue: ENTER_S, LEAVE_S 129 + * IRQ enable/disable: CLRI, SETI 130 + * pop count: FFS, FLS 131 + * SETcc, BMSKN, XBFU... 131 132 132 133 endchoice 133 134 ··· 158 117 help 159 118 Build kernel for Big Endian Mode of ARC CPU 160 119 161 - # If a platform can't work with 0x8000_0000 based dma_addr_t 162 - config ARC_PLAT_NEEDS_CPU_TO_DMA 163 - bool 164 - 165 120 config SMP 166 - bool "Symmetric Multi-Processing (Incomplete)" 121 + bool "Symmetric Multi-Processing" 167 122 default n 123 + select ARC_HAS_COH_CACHES if ISA_ARCV2 124 + select ARC_MCIP if ISA_ARCV2 168 125 help 169 - This enables support for systems with more than one CPU. If you have 170 - a system with only one CPU, say N. If you have a system with more 171 - than one CPU, say Y. 126 + This enables support for systems with more than one CPU. 172 127 173 128 if SMP 174 129 ··· 174 137 config ARC_HAS_REENTRANT_IRQ_LV2 175 138 def_bool n 176 139 177 - endif 140 + config ARC_MCIP 141 + bool "ARConnect Multicore IP (MCIP) Support " 142 + depends on ISA_ARCV2 143 + help 144 + This IP block enables SMP in ARC-HS38 cores. 145 + It provides for cross-core interrupts, multi-core debug 146 + hardware semaphores, shared memory,.... 178 147 179 148 config NR_CPUS 180 149 int "Maximum number of CPUs (2-4096)" 181 150 range 2 4096 182 - depends on SMP 183 - default "2" 151 + default "4" 152 + 153 + endif #SMP 184 154 185 155 menuconfig ARC_CACHE 186 156 bool "Enable Cache Support" ··· 229 185 230 186 config ARC_CACHE_VIPT_ALIASING 231 187 bool "Support VIPT Aliasing D$" 232 - depends on ARC_HAS_DCACHE 188 + depends on ARC_HAS_DCACHE && ISA_ARCOMPACT 233 189 default n 234 190 235 191 endif #ARC_CACHE ··· 270 226 Multipler. Otherwise software multipy lib is used 271 227 272 228 choice 273 - prompt "ARC700 MMU Version" 229 + prompt "MMU Version" 274 230 default ARC_MMU_V3 if ARC_CPU_770 275 231 default ARC_MMU_V2 if ARC_CPU_750D 232 + default ARC_MMU_V4 if ARC_CPU_HS 276 233 277 234 config ARC_MMU_V1 278 235 bool "MMU v1" ··· 293 248 Introduced with ARC700 4.10: New Features 294 249 Variable Page size (1k-16k), var JTLB size 128 x (2 or 4) 295 250 Shared Address Spaces (SASID) 251 + 252 + config ARC_MMU_V4 253 + bool "MMU v4" 254 + depends on ISA_ARCV2 296 255 297 256 endchoice 298 257 ··· 320 271 321 272 endchoice 322 273 274 + if ISA_ARCOMPACT 275 + 323 276 config ARC_COMPACT_IRQ_LEVELS 324 277 bool "ARCompact IRQ Priorities: High(2)/Low(1)" 325 278 default n ··· 341 290 config ARC_IRQ6_LV2 342 291 bool 343 292 344 - endif 293 + endif #ARC_COMPACT_IRQ_LEVELS 345 294 346 295 config ARC_FPU_SAVE_RESTORE 347 296 bool "Enable FPU state persistence across context switch" ··· 354 303 based on actual usage of FPU by a task. Thus our implemn does 355 304 this for all tasks in system. 356 305 306 + endif #ISA_ARCOMPACT 307 + 357 308 config ARC_CANT_LLSC 358 309 def_bool n 359 - 360 - menuconfig ARC_CPU_REL_4_10 361 - bool "Enable support for Rel 4.10 features" 362 - default n 363 - help 364 - -ARC770 (and dependent features) enabled 365 - -ARC750 also shares some of the new features with 770 366 310 367 311 config ARC_HAS_LLSC 368 312 bool "Insn: LLOCK/SCOND (efficient atomic ops)" 369 313 default y 370 - depends on ARC_CPU_770 && !ARC_CANT_LLSC 314 + depends on !ARC_CPU_750D && !ARC_CANT_LLSC 371 315 372 316 config ARC_HAS_SWAPE 373 317 bool "Insn: SWAPE (endian-swap)" 374 318 default y 375 - depends on ARC_CPU_REL_4_10 376 319 377 - config ARC_HAS_RTSC 378 - bool "Insn: RTSC (64-bit r/o cycle counter)" 320 + if ISA_ARCV2 321 + 322 + config ARC_HAS_LL64 323 + bool "Insn: 64bit LDD/STD" 324 + help 325 + Enable gcc to generate 64-bit load/store instructions 326 + ISA mandates even/odd registers to allow encoding of two 327 + dest operands with 2 possible source operands. 379 328 default y 380 - depends on ARC_CPU_REL_4_10 329 + 330 + config ARC_HAS_RTC 331 + bool "Local 64-bit r/o cycle counter" 332 + default n 381 333 depends on !SMP 334 + 335 + config ARC_HAS_GRTC 336 + bool "SMP synchronized 64-bit cycle counter" 337 + default y 338 + depends on SMP 339 + 340 + config ARC_NUMBER_OF_INTERRUPTS 341 + int "Number of interrupts" 342 + range 8 240 343 + default 32 344 + help 345 + This defines the number of interrupts on the ARCv2HS core. 346 + It affects the size of vector table. 347 + The initial 8 IRQs are fixed (Timer, ICI etc) and although configurable 348 + in hardware, it keep things simple for Linux to assume they are always 349 + present. 350 + 351 + endif # ISA_ARCV2 382 352 383 353 endmenu # "ARC CPU Configuration" 384 354 ··· 426 354 427 355 config ARC_EMUL_UNALIGNED 428 356 bool "Emulate unaligned memory access (userspace only)" 357 + default N 429 358 select SYSCTL_ARCH_UNALIGN_NO_WARN 430 359 select SYSCTL_ARCH_UNALIGN_ALLOW 360 + depends on ISA_ARCOMPACT 431 361 help 432 362 This enables misaligned 16 & 32 bit memory access from user space. 433 363 Use ONLY-IF-ABS-NECESSARY as it will be very slow and also can hide ··· 452 378 bool "ARC debugging" 453 379 default y 454 380 381 + if ARC_DBG 382 + 455 383 config ARC_DW2_UNWIND 456 384 bool "Enable DWARF specific kernel stack unwind" 457 - depends on ARC_DBG 458 385 default y 459 386 select KALLSYMS 460 387 help ··· 469 394 470 395 config ARC_DBG_TLB_PARANOIA 471 396 bool "Paranoia Checks in Low Level TLB Handlers" 472 - depends on ARC_DBG 473 397 default n 474 398 475 399 config ARC_DBG_TLB_MISS_COUNT 476 400 bool "Profile TLB Misses" 477 401 default n 478 402 select DEBUG_FS 479 - depends on ARC_DBG 480 403 help 481 404 Counts number of I and D TLB Misses and exports them via Debugfs 482 405 The counters can be cleared via Debugfs as well 406 + 407 + if SMP 408 + 409 + config ARC_IPI_DBG 410 + bool "Debug Inter Core interrupts" 411 + default n 412 + 413 + endif 414 + 415 + endif 416 + 417 + config ARC_UBOOT_SUPPORT 418 + bool "Support uboot arg Handling" 419 + default n 420 + help 421 + ARC Linux by default checks for uboot provided args as pointers to 422 + external cmdline or DTB. This however breaks in absence of uboot, 423 + when booting from Metaware debugger directly, as the registers are 424 + not zeroed out on reset by mdb and/or ARCv2 based cores. The bogus 425 + registers look like uboot args to kernel which then chokes. 426 + So only enable the uboot arg checking/processing if users are sure 427 + of uboot being in play. 483 428 484 429 config ARC_BUILTIN_DTB_NAME 485 430 string "Built in DTB"
+12 -5
arch/arc/Makefile
··· 9 9 UTS_MACHINE := arc 10 10 11 11 ifeq ($(CROSS_COMPILE),) 12 - CROSS_COMPILE := arc-linux-uclibc- 12 + CROSS_COMPILE := arc-linux- 13 13 endif 14 14 15 15 KBUILD_DEFCONFIG := nsim_700_defconfig 16 16 17 - cflags-y += -mA7 -fno-common -pipe -fno-builtin -D__linux__ 17 + cflags-y += -fno-common -pipe -fno-builtin -D__linux__ 18 + cflags-$(CONFIG_ISA_ARCOMPACT) += -mA7 19 + cflags-$(CONFIG_ISA_ARCV2) += -mcpu=archs 18 20 19 21 ifdef CONFIG_ARC_CURR_IN_REG 20 22 # For a global register defintion, make sure it gets passed to every file ··· 35 33 36 34 cflags-$(CONFIG_ARC_HAS_LLSC) += -mlock 37 35 cflags-$(CONFIG_ARC_HAS_SWAPE) += -mswape 38 - cflags-$(CONFIG_ARC_HAS_RTSC) += -mrtsc 36 + 37 + ifndef CONFIG_ARC_HAS_LL64 38 + cflags-$(CONFIG_ISA_ARCV2) += -mno-ll64 39 + endif 40 + 39 41 cflags-$(CONFIG_ARC_DW2_UNWIND) += -fasynchronous-unwind-tables 40 42 41 43 # By default gcc 4.8 generates dwarf4 which kernel unwinder can't grok ··· 87 81 # w/o this dtb won't embed into kernel binary 88 82 core-y += arch/arc/boot/dts/ 89 83 90 - core-$(CONFIG_ARC_PLAT_FPGA_LEGACY) += arch/arc/plat-arcfpga/ 91 - core-$(CONFIG_ARC_PLAT_TB10X) += arch/arc/plat-tb10x/ 84 + core-$(CONFIG_ARC_PLAT_SIM) += arch/arc/plat-sim/ 85 + core-$(CONFIG_ARC_PLAT_TB10X) += arch/arc/plat-tb10x/ 86 + core-$(CONFIG_ARC_PLAT_AXS10X) += arch/arc/plat-axs10x/ 92 87 93 88 drivers-$(CONFIG_OPROFILE) += arch/arc/oprofile/ 94 89
+1 -1
arch/arc/boot/dts/Makefile
··· 1 1 # Built-in dtb 2 - builtindtb-y := angel4 2 + builtindtb-y := nsim_700 3 3 4 4 ifneq ($(CONFIG_ARC_BUILTIN_DTB_NAME),"") 5 5 builtindtb-y := $(patsubst "%",%,$(CONFIG_ARC_BUILTIN_DTB_NAME))
+1 -1
arch/arc/boot/dts/angel4.dts arch/arc/boot/dts/nsim_700.dts
··· 10 10 /include/ "skeleton.dtsi" 11 11 12 12 / { 13 - compatible = "snps,arc-angel4"; 13 + compatible = "snps,nsim"; 14 14 clock-frequency = <80000000>; /* 80 MHZ */ 15 15 #address-cells = <1>; 16 16 #size-cells = <1>;
+100
arch/arc/boot/dts/axc001.dtsi
··· 1 + /* 2 + * Copyright (C) 2013-15 Synopsys, Inc. (www.synopsys.com) 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License version 2 as 6 + * published by the Free Software Foundation. 7 + */ 8 + 9 + /* 10 + * Device tree for AXC001 770D/EM6/AS221 CPU card 11 + * Note that this file only supports the 770D CPU 12 + */ 13 + 14 + / { 15 + compatible = "snps,arc"; 16 + clock-frequency = <750000000>; /* 750 MHZ */ 17 + #address-cells = <1>; 18 + #size-cells = <1>; 19 + 20 + cpu_card { 21 + compatible = "simple-bus"; 22 + #address-cells = <1>; 23 + #size-cells = <1>; 24 + 25 + ranges = <0x00000000 0xf0000000 0x10000000>; 26 + 27 + cpu_intc: arc700-intc@cpu { 28 + compatible = "snps,arc700-intc"; 29 + interrupt-controller; 30 + #interrupt-cells = <1>; 31 + }; 32 + 33 + /* 34 + * this GPIO block ORs all interrupts on CPU card (creg,..) 35 + * to uplink only 1 IRQ to ARC core intc 36 + */ 37 + dw-apb-gpio@0x2000 { 38 + compatible = "snps,dw-apb-gpio"; 39 + reg = < 0x2000 0x80 >; 40 + #address-cells = <1>; 41 + #size-cells = <0>; 42 + 43 + ictl_intc: gpio-controller@0 { 44 + compatible = "snps,dw-apb-gpio-port"; 45 + gpio-controller; 46 + #gpio-cells = <2>; 47 + snps,nr-gpios = <30>; 48 + reg = <0>; 49 + interrupt-controller; 50 + #interrupt-cells = <2>; 51 + interrupt-parent = <&cpu_intc>; 52 + interrupts = <15>; 53 + }; 54 + }; 55 + 56 + debug_uart: dw-apb-uart@0x5000 { 57 + compatible = "snps,dw-apb-uart"; 58 + reg = <0x5000 0x100>; 59 + clock-frequency = <33333000>; 60 + interrupt-parent = <&ictl_intc>; 61 + interrupts = <19 4>; 62 + baud = <115200>; 63 + reg-shift = <2>; 64 + reg-io-width = <4>; 65 + }; 66 + 67 + arcpmu0: pmu { 68 + compatible = "snps,arc700-pct"; 69 + }; 70 + }; 71 + 72 + /* 73 + * This INTC is actually connected to DW APB GPIO 74 + * which acts as a wire between MB INTC and CPU INTC. 75 + * GPIO INTC is configured in platform init code 76 + * and here we mimic direct connection from MB INTC to 77 + * CPU INTC, thus we set "interrupts = <7>" instead of 78 + * "interrupts = <12>" 79 + * 80 + * This intc actually resides on MB, but we move it here to 81 + * avoid duplicating the MB dtsi file given that IRQ from 82 + * this intc to cpu intc are different for axs101 and axs103 83 + */ 84 + mb_intc: dw-apb-ictl@0xe0012000 { 85 + #interrupt-cells = <1>; 86 + compatible = "snps,dw-apb-ictl"; 87 + reg = < 0xe0012000 0x200 >; 88 + interrupt-controller; 89 + interrupt-parent = <&cpu_intc>; 90 + interrupts = < 7 >; 91 + }; 92 + 93 + memory { 94 + #address-cells = <1>; 95 + #size-cells = <1>; 96 + ranges = <0x00000000 0x80000000 0x40000000>; 97 + device_type = "memory"; 98 + reg = <0x00000000 0x20000000>; /* 512MiB */ 99 + }; 100 + };
+102
arch/arc/boot/dts/axc003.dtsi
··· 1 + /* 2 + * Copyright (C) 2014-15 Synopsys, Inc. (www.synopsys.com) 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License version 2 as 6 + * published by the Free Software Foundation. 7 + */ 8 + 9 + /* 10 + * Device tree for AXC003 CPU card: HS38x UP configuration 11 + */ 12 + 13 + / { 14 + compatible = "snps,arc"; 15 + clock-frequency = <75000000>; 16 + #address-cells = <1>; 17 + #size-cells = <1>; 18 + 19 + cpu_card { 20 + compatible = "simple-bus"; 21 + #address-cells = <1>; 22 + #size-cells = <1>; 23 + 24 + ranges = <0x00000000 0xf0000000 0x10000000>; 25 + 26 + cpu_intc: archs-intc@cpu { 27 + compatible = "snps,archs-intc"; 28 + interrupt-controller; 29 + #interrupt-cells = <1>; 30 + }; 31 + 32 + /* 33 + * this GPIO block ORs all interrupts on CPU card (creg,..) 34 + * to uplink only 1 IRQ to ARC core intc 35 + */ 36 + dw-apb-gpio@0x2000 { 37 + compatible = "snps,dw-apb-gpio"; 38 + reg = < 0x2000 0x80 >; 39 + #address-cells = <1>; 40 + #size-cells = <0>; 41 + 42 + ictl_intc: gpio-controller@0 { 43 + compatible = "snps,dw-apb-gpio-port"; 44 + gpio-controller; 45 + #gpio-cells = <2>; 46 + snps,nr-gpios = <30>; 47 + reg = <0>; 48 + interrupt-controller; 49 + #interrupt-cells = <2>; 50 + interrupt-parent = <&cpu_intc>; 51 + interrupts = <25>; 52 + }; 53 + }; 54 + 55 + debug_uart: dw-apb-uart@0x5000 { 56 + compatible = "snps,dw-apb-uart"; 57 + reg = <0x5000 0x100>; 58 + clock-frequency = <33333000>; 59 + interrupt-parent = <&ictl_intc>; 60 + interrupts = <2 4>; 61 + baud = <115200>; 62 + reg-shift = <2>; 63 + reg-io-width = <4>; 64 + }; 65 + 66 + arcpct0: pct { 67 + compatible = "snps,archs-pct"; 68 + #interrupt-cells = <1>; 69 + interrupt-parent = <&cpu_intc>; 70 + interrupts = <20>; 71 + }; 72 + }; 73 + 74 + /* 75 + * This INTC is actually connected to DW APB GPIO 76 + * which acts as a wire between MB INTC and CPU INTC. 77 + * GPIO INTC is configured in platform init code 78 + * and here we mimic direct connection from MB INTC to 79 + * CPU INTC, thus we set "interrupts = <7>" instead of 80 + * "interrupts = <12>" 81 + * 82 + * This intc actually resides on MB, but we move it here to 83 + * avoid duplicating the MB dtsi file given that IRQ from 84 + * this intc to cpu intc are different for axs101 and axs103 85 + */ 86 + mb_intc: dw-apb-ictl@0xe0012000 { 87 + #interrupt-cells = <1>; 88 + compatible = "snps,dw-apb-ictl"; 89 + reg = < 0xe0012000 0x200 >; 90 + interrupt-controller; 91 + interrupt-parent = <&cpu_intc>; 92 + interrupts = < 24 >; 93 + }; 94 + 95 + memory { 96 + #address-cells = <1>; 97 + #size-cells = <1>; 98 + ranges = <0x00000000 0x80000000 0x40000000>; 99 + device_type = "memory"; 100 + reg = <0x00000000 0x20000000>; /* 512MiB */ 101 + }; 102 + };
+126
arch/arc/boot/dts/axc003_idu.dtsi
··· 1 + /* 2 + * Copyright (C) 2014, 2015 Synopsys, Inc. (www.synopsys.com) 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License version 2 as 6 + * published by the Free Software Foundation. 7 + */ 8 + 9 + /* 10 + * Device tree for AXC003 CPU card: HS38x2 (Dual Core) with IDU intc 11 + */ 12 + 13 + / { 14 + compatible = "snps,arc"; 15 + clock-frequency = <75000000>; 16 + #address-cells = <1>; 17 + #size-cells = <1>; 18 + 19 + cpu_card { 20 + compatible = "simple-bus"; 21 + #address-cells = <1>; 22 + #size-cells = <1>; 23 + 24 + ranges = <0x00000000 0xf0000000 0x10000000>; 25 + 26 + cpu_intc: archs-intc@cpu { 27 + compatible = "snps,archs-intc"; 28 + interrupt-controller; 29 + #interrupt-cells = <1>; 30 + }; 31 + 32 + idu_intc: idu-interrupt-controller { 33 + compatible = "snps,archs-idu-intc"; 34 + interrupt-controller; 35 + interrupt-parent = <&cpu_intc>; 36 + 37 + /* 38 + * <hwirq distribution> 39 + * distribution: 0=RR; 1=cpu0, 2=cpu1, 4=cpu2, 8=cpu3 40 + */ 41 + #interrupt-cells = <2>; 42 + 43 + /* 44 + * upstream irqs to core intc - downstream these are 45 + * "COMMON" irq 0,1.. 46 + */ 47 + interrupts = <24 25>; 48 + }; 49 + 50 + /* 51 + * this GPIO block ORs all interrupts on CPU card (creg,..) 52 + * to uplink only 1 IRQ to ARC core intc 53 + */ 54 + dw-apb-gpio@0x2000 { 55 + compatible = "snps,dw-apb-gpio"; 56 + reg = < 0x2000 0x80 >; 57 + #address-cells = <1>; 58 + #size-cells = <0>; 59 + 60 + ictl_intc: gpio-controller@0 { 61 + compatible = "snps,dw-apb-gpio-port"; 62 + gpio-controller; 63 + #gpio-cells = <2>; 64 + snps,nr-gpios = <30>; 65 + reg = <0>; 66 + interrupt-controller; 67 + #interrupt-cells = <2>; 68 + interrupt-parent = <&idu_intc>; 69 + 70 + /* 71 + * cmn irq 1 -> cpu irq 25 72 + * Distribute to cpu0 only 73 + */ 74 + interrupts = <1 1>; 75 + }; 76 + }; 77 + 78 + debug_uart: dw-apb-uart@0x5000 { 79 + compatible = "snps,dw-apb-uart"; 80 + reg = <0x5000 0x100>; 81 + clock-frequency = <33333000>; 82 + interrupt-parent = <&ictl_intc>; 83 + interrupts = <2 4>; 84 + baud = <115200>; 85 + reg-shift = <2>; 86 + reg-io-width = <4>; 87 + }; 88 + 89 + arcpct0: pct { 90 + compatible = "snps,archs-pct"; 91 + #interrupt-cells = <1>; 92 + interrupt-parent = <&cpu_intc>; 93 + interrupts = <20>; 94 + }; 95 + }; 96 + 97 + /* 98 + * This INTC is actually connected to DW APB GPIO 99 + * which acts as a wire between MB INTC and CPU INTC. 100 + * GPIO INTC is configured in platform init code 101 + * and here we mimic direct connection from MB INTC to 102 + * CPU INTC, thus we set "interrupts = <0 1>" instead of 103 + * "interrupts = <12>" 104 + * 105 + * This intc actually resides on MB, but we move it here to 106 + * avoid duplicating the MB dtsi file given that IRQ from 107 + * this intc to cpu intc are different for axs101 and axs103 108 + */ 109 + mb_intc: dw-apb-ictl@0xe0012000 { 110 + #interrupt-cells = <1>; 111 + compatible = "snps,dw-apb-ictl"; 112 + reg = < 0xe0012000 0x200 >; 113 + interrupt-controller; 114 + interrupt-parent = <&idu_intc>; 115 + interrupts = <0 1>; /* cmn irq 0 -> cpu irq 24 116 + distribute to cpu0 only */ 117 + }; 118 + 119 + memory { 120 + #address-cells = <1>; 121 + #size-cells = <1>; 122 + ranges = <0x00000000 0x80000000 0x40000000>; 123 + device_type = "memory"; 124 + reg = <0x00000000 0x20000000>; /* 512MiB */ 125 + }; 126 + };
+21
arch/arc/boot/dts/axs101.dts
··· 1 + /* 2 + * Copyright (C) 2013-15 Synopsys, Inc. (www.synopsys.com) 3 + * 4 + * ARC AXS101 S/W development platform 5 + * 6 + * This program is free software; you can redistribute it and/or modify 7 + * it under the terms of the GNU General Public License version 2 as 8 + * published by the Free Software Foundation. 9 + */ 10 + /dts-v1/; 11 + 12 + /include/ "axc001.dtsi" 13 + /include/ "axs10x_mb.dtsi" 14 + 15 + / { 16 + compatible = "snps,axs101", "snps,arc-sdp"; 17 + 18 + chosen { 19 + bootargs = "earlycon=uart8250,mmio32,0xe0022000,115200n8 console=tty0 console=ttyS3,115200n8 consoleblank=0"; 20 + }; 21 + };
+24
arch/arc/boot/dts/axs103.dts
··· 1 + /* 2 + * Copyright (C) 2014-15 Synopsys, Inc. (www.synopsys.com) 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License version 2 as 6 + * published by the Free Software Foundation. 7 + */ 8 + 9 + /* 10 + * Device Tree for AXS103 SDP with AXS10X Main Board and 11 + * AXC003 FPGA Card (with UP bitfile) 12 + */ 13 + /dts-v1/; 14 + 15 + /include/ "axc003.dtsi" 16 + /include/ "axs10x_mb.dtsi" 17 + 18 + / { 19 + compatible = "snps,axs103", "snps,arc-sdp"; 20 + 21 + chosen { 22 + bootargs = "earlycon=uart8250,mmio32,0xe0022000,115200n8 console=ttyS3,115200n8 debug print-fatal-signals=1"; 23 + }; 24 + };
+24
arch/arc/boot/dts/axs103_idu.dts
··· 1 + /* 2 + * Copyright (C) 2014-15 Synopsys, Inc. (www.synopsys.com) 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License version 2 as 6 + * published by the Free Software Foundation. 7 + */ 8 + 9 + /* 10 + * Device Tree for AXS103 SDP with AXS10X Main Board and 11 + * AXC003 FPGA Card (with SMP bitfile) 12 + */ 13 + /dts-v1/; 14 + 15 + /include/ "axc003_idu.dtsi" 16 + /include/ "axs10x_mb.dtsi" 17 + 18 + / { 19 + compatible = "snps,axs103", "snps,arc-sdp"; 20 + 21 + chosen { 22 + bootargs = "earlycon=uart8250,mmio32,0xe0022000,115200n8 console=ttyS3,115200n8 debug print-fatal-signals=1"; 23 + }; 24 + };
+224
arch/arc/boot/dts/axs10x_mb.dtsi
··· 1 + /* 2 + * Support for peripherals on the AXS10x mainboard 3 + * 4 + * Copyright (C) 2013-15 Synopsys, Inc. (www.synopsys.com) 5 + * 6 + * This program is free software; you can redistribute it and/or modify 7 + * it under the terms of the GNU General Public License version 2 as 8 + * published by the Free Software Foundation. 9 + */ 10 + 11 + / { 12 + axs10x_mb { 13 + compatible = "simple-bus"; 14 + #address-cells = <1>; 15 + #size-cells = <1>; 16 + ranges = <0x00000000 0xe0000000 0x10000000>; 17 + interrupt-parent = <&mb_intc>; 18 + 19 + clocks { 20 + i2cclk: i2cclk { 21 + compatible = "fixed-clock"; 22 + clock-frequency = <50000000>; 23 + #clock-cells = <0>; 24 + }; 25 + 26 + apbclk: apbclk { 27 + compatible = "fixed-clock"; 28 + clock-frequency = <50000000>; 29 + #clock-cells = <0>; 30 + }; 31 + 32 + mmcclk: mmcclk { 33 + compatible = "fixed-clock"; 34 + clock-frequency = <50000000>; 35 + #clock-cells = <0>; 36 + }; 37 + }; 38 + 39 + ethernet@0x18000 { 40 + #interrupt-cells = <1>; 41 + compatible = "snps,dwmac"; 42 + reg = < 0x18000 0x2000 >; 43 + interrupts = < 4 >; 44 + interrupt-names = "macirq"; 45 + phy-mode = "rgmii"; 46 + snps,pbl = < 32 >; 47 + clocks = <&apbclk>; 48 + clock-names = "stmmaceth"; 49 + }; 50 + 51 + ehci@0x40000 { 52 + compatible = "generic-ehci"; 53 + reg = < 0x40000 0x100 >; 54 + interrupts = < 8 >; 55 + }; 56 + 57 + ohci@0x60000 { 58 + compatible = "generic-ohci"; 59 + reg = < 0x60000 0x100 >; 60 + interrupts = < 8 >; 61 + }; 62 + 63 + /* 64 + * According to DW Mobile Storage databook it is required 65 + * to use "Hold Register" if card is enumerated in SDR12 or 66 + * SDR25 modes. 67 + * 68 + * Utilization of "Hold Register" is already implemented via 69 + * dw_mci_pltfm_prepare_command() which in its turn gets 70 + * used through dw_mci_drv_data->prepare_command call-back. 71 + * This call-back is used in Altera Socfpga platform and so 72 + * we may reuse it saying that we're compatible with their 73 + * "altr,socfpga-dw-mshc". 74 + * 75 + * Most probably "Hold Register" utilization is platform- 76 + * independent requirement which means that single unified 77 + * "snps,dw-mshc" should be enough for all users of DW MMC once 78 + * dw_mci_pltfm_prepare_command() is used in generic platform 79 + * code. 80 + */ 81 + mmc@0x15000 { 82 + compatible = "altr,socfpga-dw-mshc"; 83 + reg = < 0x15000 0x400 >; 84 + num-slots = < 1 >; 85 + fifo-depth = < 16 >; 86 + card-detect-delay = < 200 >; 87 + clocks = <&apbclk>, <&mmcclk>; 88 + clock-names = "biu", "ciu"; 89 + interrupts = < 7 >; 90 + bus-width = < 4 >; 91 + }; 92 + 93 + uart@0x20000 { 94 + compatible = "snps,dw-apb-uart"; 95 + reg = <0x20000 0x100>; 96 + clock-frequency = <33333333>; 97 + interrupts = <17>; 98 + baud = <115200>; 99 + reg-shift = <2>; 100 + reg-io-width = <4>; 101 + }; 102 + 103 + uart@0x21000 { 104 + compatible = "snps,dw-apb-uart"; 105 + reg = <0x21000 0x100>; 106 + clock-frequency = <33333333>; 107 + interrupts = <18>; 108 + baud = <115200>; 109 + reg-shift = <2>; 110 + reg-io-width = <4>; 111 + }; 112 + 113 + /* UART muxed with USB data port (ttyS3) */ 114 + uart@0x22000 { 115 + compatible = "snps,dw-apb-uart"; 116 + reg = <0x22000 0x100>; 117 + clock-frequency = <33333333>; 118 + interrupts = <19>; 119 + baud = <115200>; 120 + reg-shift = <2>; 121 + reg-io-width = <4>; 122 + }; 123 + 124 + i2c@0x1d000 { 125 + compatible = "snps,designware-i2c"; 126 + reg = <0x1d000 0x100>; 127 + clock-frequency = <400000>; 128 + clocks = <&i2cclk>; 129 + interrupts = <14>; 130 + }; 131 + 132 + i2c@0x1e000 { 133 + compatible = "snps,designware-i2c"; 134 + reg = <0x1e000 0x100>; 135 + clock-frequency = <400000>; 136 + clocks = <&i2cclk>; 137 + interrupts = <15>; 138 + }; 139 + 140 + i2c@0x1f000 { 141 + compatible = "snps,designware-i2c"; 142 + #address-cells = <1>; 143 + #size-cells = <0>; 144 + reg = <0x1f000 0x100>; 145 + clock-frequency = <400000>; 146 + clocks = <&i2cclk>; 147 + interrupts = <16>; 148 + 149 + eeprom@0x54{ 150 + compatible = "24c01"; 151 + reg = <0x54>; 152 + pagesize = <0x8>; 153 + }; 154 + 155 + eeprom@0x57{ 156 + compatible = "24c04"; 157 + reg = <0x57>; 158 + pagesize = <0x8>; 159 + }; 160 + }; 161 + 162 + gpio0:gpio@13000 { 163 + compatible = "snps,dw-apb-gpio"; 164 + reg = <0x13000 0x1000>; 165 + #address-cells = <1>; 166 + #size-cells = <0>; 167 + 168 + gpio0_banka: gpio-controller@0 { 169 + compatible = "snps,dw-apb-gpio-port"; 170 + gpio-controller; 171 + #gpio-cells = <2>; 172 + snps,nr-gpios = <32>; 173 + reg = <0>; 174 + }; 175 + 176 + gpio0_bankb: gpio-controller@1 { 177 + compatible = "snps,dw-apb-gpio-port"; 178 + gpio-controller; 179 + #gpio-cells = <2>; 180 + snps,nr-gpios = <8>; 181 + reg = <1>; 182 + }; 183 + 184 + gpio0_bankc: gpio-controller@2 { 185 + compatible = "snps,dw-apb-gpio-port"; 186 + gpio-controller; 187 + #gpio-cells = <2>; 188 + snps,nr-gpios = <8>; 189 + reg = <2>; 190 + }; 191 + }; 192 + 193 + gpio1:gpio@14000 { 194 + compatible = "snps,dw-apb-gpio"; 195 + reg = <0x14000 0x1000>; 196 + #address-cells = <1>; 197 + #size-cells = <0>; 198 + 199 + gpio1_banka: gpio-controller@0 { 200 + compatible = "snps,dw-apb-gpio-port"; 201 + gpio-controller; 202 + #gpio-cells = <2>; 203 + snps,nr-gpios = <30>; 204 + reg = <0>; 205 + }; 206 + 207 + gpio1_bankb: gpio-controller@1 { 208 + compatible = "snps,dw-apb-gpio-port"; 209 + gpio-controller; 210 + #gpio-cells = <2>; 211 + snps,nr-gpios = <10>; 212 + reg = <1>; 213 + }; 214 + 215 + gpio1_bankc: gpio-controller@2 { 216 + compatible = "snps,dw-apb-gpio-port"; 217 + gpio-controller; 218 + #gpio-cells = <2>; 219 + snps,nr-gpios = <8>; 220 + reg = <2>; 221 + }; 222 + }; 223 + }; 224 + };
+53
arch/arc/boot/dts/nsim_hs.dts
··· 1 + /* 2 + * Copyright (C) 2014-15 Synopsys, Inc. (www.synopsys.com) 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License version 2 as 6 + * published by the Free Software Foundation. 7 + */ 8 + /dts-v1/; 9 + 10 + /include/ "skeleton.dtsi" 11 + 12 + / { 13 + compatible = "snps,nsim_hs"; 14 + interrupt-parent = <&core_intc>; 15 + 16 + chosen { 17 + bootargs = "earlycon=arc_uart,mmio32,0xc0fc1000,115200n8 console=ttyARC0,115200n8"; 18 + }; 19 + 20 + aliases { 21 + serial0 = &arcuart0; 22 + }; 23 + 24 + fpga { 25 + compatible = "simple-bus"; 26 + #address-cells = <1>; 27 + #size-cells = <1>; 28 + 29 + /* child and parent address space 1:1 mapped */ 30 + ranges; 31 + 32 + core_intc: core-interrupt-controller { 33 + compatible = "snps,archs-intc"; 34 + interrupt-controller; 35 + #interrupt-cells = <1>; 36 + }; 37 + 38 + arcuart0: serial@c0fc1000 { 39 + compatible = "snps,arc-uart"; 40 + reg = <0xc0fc1000 0x100>; 41 + interrupts = <24>; 42 + clock-frequency = <80000000>; 43 + current-speed = <115200>; 44 + status = "okay"; 45 + }; 46 + 47 + arcpct0: pct { 48 + compatible = "snps,archs-pct"; 49 + #interrupt-cells = <1>; 50 + interrupts = <20>; 51 + }; 52 + }; 53 + };
+72
arch/arc/boot/dts/nsim_hs_idu.dts
··· 1 + /* 2 + * Copyright (C) 2014-15 Synopsys, Inc. (www.synopsys.com) 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License version 2 as 6 + * published by the Free Software Foundation. 7 + */ 8 + /dts-v1/; 9 + 10 + /include/ "skeleton.dtsi" 11 + 12 + / { 13 + compatible = "snps,nsim_hs"; 14 + interrupt-parent = <&core_intc>; 15 + 16 + chosen { 17 + bootargs = "earlycon=arc_uart,mmio32,0xc0fc1000,115200n8 console=ttyARC0,115200n8"; 18 + }; 19 + 20 + aliases { 21 + serial0 = &arcuart0; 22 + }; 23 + 24 + fpga { 25 + compatible = "simple-bus"; 26 + #address-cells = <1>; 27 + #size-cells = <1>; 28 + 29 + /* child and parent address space 1:1 mapped */ 30 + ranges; 31 + 32 + core_intc: core-interrupt-controller { 33 + compatible = "snps,archs-intc"; 34 + interrupt-controller; 35 + #interrupt-cells = <1>; 36 + }; 37 + 38 + idu_intc: idu-interrupt-controller { 39 + compatible = "snps,archs-idu-intc"; 40 + interrupt-controller; 41 + interrupt-parent = <&core_intc>; 42 + 43 + /* 44 + * <hwirq distribution> 45 + * distribution: 0=RR; 1=cpu0, 2=cpu1, 4=cpu2, 8=cpu3 46 + */ 47 + #interrupt-cells = <2>; 48 + 49 + /* 50 + * upstream irqs to core intc - downstream these are 51 + * "COMMON" irq 0,1.. 52 + */ 53 + interrupts = <24 25 26 27 28 29 30 31>; 54 + }; 55 + 56 + arcuart0: serial@c0fc1000 { 57 + compatible = "snps,arc-uart"; 58 + reg = <0xc0fc1000 0x100>; 59 + interrupt-parent = <&idu_intc>; 60 + interrupts = <0 0>; 61 + clock-frequency = <80000000>; 62 + current-speed = <115200>; 63 + status = "okay"; 64 + }; 65 + 66 + arcpct0: pct { 67 + compatible = "snps,archs-pct"; 68 + #interrupt-cells = <1>; 69 + interrupts = <20>; 70 + }; 71 + }; 72 + };
+80
arch/arc/boot/dts/nsimosci_hs.dts
··· 1 + /* 2 + * Copyright (C) 2014-15 Synopsys, Inc. (www.synopsys.com) 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License version 2 as 6 + * published by the Free Software Foundation. 7 + */ 8 + /dts-v1/; 9 + 10 + /include/ "skeleton.dtsi" 11 + 12 + / { 13 + compatible = "snps,nsimosci_hs"; 14 + clock-frequency = <20000000>; /* 20 MHZ */ 15 + #address-cells = <1>; 16 + #size-cells = <1>; 17 + interrupt-parent = <&core_intc>; 18 + 19 + chosen { 20 + /* this is for console on PGU */ 21 + /* bootargs = "console=tty0 consoleblank=0"; */ 22 + /* this is for console on serial */ 23 + bootargs = "earlycon=uart8250,mmio32,0xf0000000,115200n8 console=tty0 console=ttyS0,115200n8 consoleblank=0 debug"; 24 + }; 25 + 26 + aliases { 27 + serial0 = &uart0; 28 + }; 29 + 30 + fpga { 31 + compatible = "simple-bus"; 32 + #address-cells = <1>; 33 + #size-cells = <1>; 34 + 35 + /* child and parent address space 1:1 mapped */ 36 + ranges; 37 + 38 + core_intc: core-interrupt-controller { 39 + compatible = "snps,archs-intc"; 40 + interrupt-controller; 41 + #interrupt-cells = <1>; 42 + }; 43 + 44 + uart0: serial@f0000000 { 45 + compatible = "ns8250"; 46 + reg = <0xf0000000 0x2000>; 47 + interrupts = <24>; 48 + clock-frequency = <3686400>; 49 + baud = <115200>; 50 + reg-shift = <2>; 51 + reg-io-width = <4>; 52 + no-loopback-test = <1>; 53 + }; 54 + 55 + pgu0: pgu@f9000000 { 56 + compatible = "snps,arcpgufb"; 57 + reg = <0xf9000000 0x400>; 58 + }; 59 + 60 + ps2: ps2@f9001000 { 61 + compatible = "snps,arc_ps2"; 62 + reg = <0xf9000400 0x14>; 63 + interrupts = <27>; 64 + interrupt-names = "arc_ps2_irq"; 65 + }; 66 + 67 + eth0: ethernet@f0003000 { 68 + compatible = "snps,oscilan"; 69 + reg = <0xf0003000 0x44>; 70 + interrupts = <25>, <26>; 71 + interrupt-names = "rx", "tx"; 72 + }; 73 + 74 + arcpct0: pct { 75 + compatible = "snps,archs-pct"; 76 + #interrupt-cells = <1>; 77 + interrupts = <20>; 78 + }; 79 + }; 80 + };
+101
arch/arc/boot/dts/nsimosci_hs_idu.dts
··· 1 + /* 2 + * Copyright (C) 2014-15 Synopsys, Inc. (www.synopsys.com) 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License version 2 as 6 + * published by the Free Software Foundation. 7 + */ 8 + /dts-v1/; 9 + 10 + /include/ "skeleton.dtsi" 11 + 12 + / { 13 + compatible = "snps,nsimosci_hs"; 14 + clock-frequency = <5000000>; /* 5 MHZ */ 15 + #address-cells = <1>; 16 + #size-cells = <1>; 17 + interrupt-parent = <&core_intc>; 18 + 19 + chosen { 20 + /* this is for console on serial */ 21 + bootargs = "earlycon=uart8250,mmio32,0xf0000000,115200n8 console=tty0 console=ttyS0,115200n8 consoleblan=0 debug"; 22 + }; 23 + 24 + aliases { 25 + serial0 = &uart0; 26 + }; 27 + 28 + fpga { 29 + compatible = "simple-bus"; 30 + #address-cells = <1>; 31 + #size-cells = <1>; 32 + 33 + /* child and parent address space 1:1 mapped */ 34 + ranges; 35 + 36 + core_intc: core-interrupt-controller { 37 + compatible = "snps,archs-intc"; 38 + interrupt-controller; 39 + #interrupt-cells = <1>; 40 + /* interrupts = <16 17 18 19 20 21 22 23 24 25>; */ 41 + }; 42 + 43 + idu_intc: idu-interrupt-controller { 44 + compatible = "snps,archs-idu-intc"; 45 + interrupt-controller; 46 + interrupt-parent = <&core_intc>; 47 + 48 + /* 49 + * <hwirq distribution> 50 + * distribution: 0=RR; 1=cpu0, 2=cpu1, 4=cpu2, 8=cpu3 51 + */ 52 + #interrupt-cells = <2>; 53 + 54 + /* 55 + * upstream irqs to core intc - downstream these are 56 + * "COMMON" irq 0,1.. 57 + */ 58 + interrupts = <24 25 26 27 28 29 30 31>; 59 + }; 60 + 61 + uart0: serial@f0000000 { 62 + compatible = "ns8250"; 63 + reg = <0xf0000000 0x2000>; 64 + interrupt-parent = <&idu_intc>; 65 + interrupts = <0 0>; /* cmn irq 0 -> cpu irq 24 66 + RR distribute to all cpus */ 67 + clock-frequency = <3686400>; 68 + baud = <115200>; 69 + reg-shift = <2>; 70 + reg-io-width = <4>; 71 + no-loopback-test = <1>; 72 + }; 73 + 74 + pgu0: pgu@f9000000 { 75 + compatible = "snps,arcpgufb"; 76 + reg = <0xf9000000 0x400>; 77 + }; 78 + 79 + ps2: ps2@f9001000 { 80 + compatible = "snps,arc_ps2"; 81 + reg = <0xf9000400 0x14>; 82 + interrupts = <3 0>; 83 + interrupt-parent = <&idu_intc>; 84 + interrupt-names = "arc_ps2_irq"; 85 + }; 86 + 87 + eth0: ethernet@f0003000 { 88 + compatible = "snps,oscilan"; 89 + reg = <0xf0003000 0x44>; 90 + interrupt-parent = <&idu_intc>; 91 + interrupts = <1 2>, <2 2>; 92 + interrupt-names = "rx", "tx"; 93 + }; 94 + 95 + arcpct0: pct { 96 + compatible = "snps,archs-pct"; 97 + #interrupt-cells = <1>; 98 + interrupts = <20>; 99 + }; 100 + }; 101 + };
+61
arch/arc/boot/dts/vdk_axc003.dtsi
··· 1 + /* 2 + * Copyright (C) 2013, 2014 Synopsys, Inc. (www.synopsys.com) 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License version 2 as 6 + * published by the Free Software Foundation. 7 + */ 8 + 9 + /* 10 + * Device tree for AXC003 CPU card: HS38x UP configuration (VDK version) 11 + */ 12 + 13 + / { 14 + compatible = "snps,arc"; 15 + clock-frequency = <50000000>; 16 + #address-cells = <1>; 17 + #size-cells = <1>; 18 + 19 + cpu_card { 20 + compatible = "simple-bus"; 21 + #address-cells = <1>; 22 + #size-cells = <1>; 23 + 24 + ranges = <0x00000000 0xf0000000 0x10000000>; 25 + 26 + cpu_intc: archs-intc@cpu { 27 + compatible = "snps,archs-intc"; 28 + interrupt-controller; 29 + #interrupt-cells = <1>; 30 + }; 31 + 32 + debug_uart: dw-apb-uart@0x5000 { 33 + compatible = "snps,dw-apb-uart"; 34 + reg = <0x5000 0x100>; 35 + clock-frequency = <2403200>; 36 + interrupt-parent = <&cpu_intc>; 37 + interrupts = <19>; 38 + baud = <115200>; 39 + reg-shift = <2>; 40 + reg-io-width = <4>; 41 + }; 42 + 43 + }; 44 + 45 + mb_intc: dw-apb-ictl@0xe0012000 { 46 + #interrupt-cells = <1>; 47 + compatible = "snps,dw-apb-ictl"; 48 + reg = < 0xe0012000 0x200 >; 49 + interrupt-controller; 50 + interrupt-parent = <&cpu_intc>; 51 + interrupts = < 18 >; 52 + }; 53 + 54 + memory { 55 + #address-cells = <1>; 56 + #size-cells = <1>; 57 + ranges = <0x00000000 0x80000000 0x40000000>; 58 + device_type = "memory"; 59 + reg = <0x00000000 0x20000000>; /* 512MiB */ 60 + }; 61 + };
+76
arch/arc/boot/dts/vdk_axc003_idu.dtsi
··· 1 + /* 2 + * Copyright (C) 2014, 2015 Synopsys, Inc. (www.synopsys.com) 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License version 2 as 6 + * published by the Free Software Foundation. 7 + */ 8 + 9 + /* 10 + * Device tree for AXC003 CPU card: 11 + * HS38x2 (Dual Core) with IDU intc (VDK version) 12 + */ 13 + 14 + / { 15 + compatible = "snps,arc"; 16 + clock-frequency = <50000000>; 17 + #address-cells = <1>; 18 + #size-cells = <1>; 19 + 20 + cpu_card { 21 + compatible = "simple-bus"; 22 + #address-cells = <1>; 23 + #size-cells = <1>; 24 + 25 + ranges = <0x00000000 0xf0000000 0x10000000>; 26 + 27 + cpu_intc: archs-intc@cpu { 28 + compatible = "snps,archs-intc"; 29 + interrupt-controller; 30 + #interrupt-cells = <1>; 31 + }; 32 + 33 + idu_intc: idu-interrupt-controller { 34 + compatible = "snps,archs-idu-intc"; 35 + interrupt-controller; 36 + interrupt-parent = <&cpu_intc>; 37 + 38 + /* 39 + * <hwirq distribution> 40 + * distribution: 0=RR; 1=cpu0, 2=cpu1, 4=cpu2, 8=cpu3 41 + */ 42 + #interrupt-cells = <2>; 43 + 44 + interrupts = <24 25 26 27>; 45 + }; 46 + 47 + debug_uart: dw-apb-uart@0x5000 { 48 + compatible = "snps,dw-apb-uart"; 49 + reg = <0x5000 0x100>; 50 + clock-frequency = <2403200>; 51 + interrupt-parent = <&idu_intc>; 52 + interrupts = <2 0>; 53 + baud = <115200>; 54 + reg-shift = <2>; 55 + reg-io-width = <4>; 56 + }; 57 + 58 + }; 59 + 60 + mb_intc: dw-apb-ictl@0xe0012000 { 61 + #interrupt-cells = <1>; 62 + compatible = "snps,dw-apb-ictl"; 63 + reg = < 0xe0012000 0x200 >; 64 + interrupt-controller; 65 + interrupt-parent = <&idu_intc>; 66 + interrupts = < 0 0 >; 67 + }; 68 + 69 + memory { 70 + #address-cells = <1>; 71 + #size-cells = <1>; 72 + ranges = <0x00000000 0x80000000 0x40000000>; 73 + device_type = "memory"; 74 + reg = <0x00000000 0x20000000>; /* 512MiB */ 75 + }; 76 + };
+93
arch/arc/boot/dts/vdk_axs10x_mb.dtsi
··· 1 + /* 2 + * Support for peripherals on the AXS10x mainboard (VDK version) 3 + * 4 + * Copyright (C) 2013-15 Synopsys, Inc. (www.synopsys.com) 5 + * 6 + * This program is free software; you can redistribute it and/or modify 7 + * it under the terms of the GNU General Public License version 2 as 8 + * published by the Free Software Foundation. 9 + */ 10 + 11 + / { 12 + axs10x_mb_vdk { 13 + compatible = "simple-bus"; 14 + #address-cells = <1>; 15 + #size-cells = <1>; 16 + ranges = <0x00000000 0xe0000000 0x10000000>; 17 + interrupt-parent = <&mb_intc>; 18 + 19 + clocks { 20 + apbclk: apbclk { 21 + compatible = "fixed-clock"; 22 + clock-frequency = <50000000>; 23 + #clock-cells = <0>; 24 + }; 25 + 26 + }; 27 + 28 + ethernet@0x18000 { 29 + #interrupt-cells = <1>; 30 + compatible = "snps,dwmac"; 31 + reg = < 0x18000 0x2000 >; 32 + interrupts = < 4 >; 33 + interrupt-names = "macirq"; 34 + phy-mode = "rgmii"; 35 + snps,phy-addr = < 0 >; // VDK model phy address is 0 36 + snps,pbl = < 32 >; 37 + clocks = <&apbclk>; 38 + clock-names = "stmmaceth"; 39 + }; 40 + 41 + ehci@0x40000 { 42 + compatible = "generic-ehci"; 43 + reg = < 0x40000 0x100 >; 44 + interrupts = < 8 >; 45 + }; 46 + 47 + uart@0x20000 { 48 + compatible = "snps,dw-apb-uart"; 49 + reg = <0x20000 0x100>; 50 + clock-frequency = <2403200>; 51 + interrupts = <17>; 52 + baud = <115200>; 53 + reg-shift = <2>; 54 + reg-io-width = <4>; 55 + }; 56 + 57 + uart@0x21000 { 58 + compatible = "snps,dw-apb-uart"; 59 + reg = <0x21000 0x100>; 60 + clock-frequency = <2403200>; 61 + interrupts = <18>; 62 + baud = <115200>; 63 + reg-shift = <2>; 64 + reg-io-width = <4>; 65 + }; 66 + 67 + uart@0x22000 { 68 + compatible = "snps,dw-apb-uart"; 69 + reg = <0x22000 0x100>; 70 + clock-frequency = <2403200>; 71 + interrupts = <19>; 72 + baud = <115200>; 73 + reg-shift = <2>; 74 + reg-io-width = <4>; 75 + }; 76 + 77 + /* PGU output directly sent to virtual LCD screen; hdmi controller not modelled */ 78 + pgu@0x17000 { 79 + compatible = "snps,arcpgufb"; 80 + reg = <0x17000 0x400>; 81 + clock-frequency = <51000000>; /* PGU'clock is initated in init function */ 82 + /* interrupts = <5>; PGU interrupts not used, this vector is used for ps2 below */ 83 + }; 84 + 85 + /* VDK has additional ps2 keyboard/mouse interface integrated in LCD screen model */ 86 + ps2: ps2@e0017400 { 87 + compatible = "snps,arc_ps2"; 88 + reg = <0x17400 0x14>; 89 + interrupts = <5>; 90 + interrupt-names = "arc_ps2_irq"; 91 + }; 92 + }; 93 + };
+21
arch/arc/boot/dts/vdk_hs38.dts
··· 1 + /* 2 + * Copyright (C) 2013 Synopsys, Inc. (www.synopsys.com) 3 + * 4 + * ARC HS38 Virtual Development Kit (VDK) 5 + * 6 + * This program is free software; you can redistribute it and/or modify 7 + * it under the terms of the GNU General Public License version 2 as 8 + * published by the Free Software Foundation. 9 + */ 10 + /dts-v1/; 11 + 12 + /include/ "vdk_axc003.dtsi" 13 + /include/ "vdk_axs10x_mb.dtsi" 14 + 15 + / { 16 + compatible = "snps,axs103"; 17 + 18 + chosen { 19 + bootargs = "earlycon=uart8250,mmio32,0xe0022000,115200n8 console=tty0 console=ttyS3,115200n8 consoleblank=0"; 20 + }; 21 + };
+21
arch/arc/boot/dts/vdk_hs38_smp.dts
··· 1 + /* 2 + * Copyright (C) 2013 Synopsys, Inc. (www.synopsys.com) 3 + * 4 + * ARC HS38 Virtual Development Kit, SMP version (VDK) 5 + * 6 + * This program is free software; you can redistribute it and/or modify 7 + * it under the terms of the GNU General Public License version 2 as 8 + * published by the Free Software Foundation. 9 + */ 10 + /dts-v1/; 11 + 12 + /include/ "vdk_axc003_idu.dtsi" 13 + /include/ "vdk_axs10x_mb.dtsi" 14 + 15 + / { 16 + compatible = "snps,axs103"; 17 + 18 + chosen { 19 + bootargs = "earlycon=uart8250,mmio32,0xe0022000,115200n8 console=tty0 console=ttyS3,115200n8 consoleblank=0"; 20 + }; 21 + };
+111
arch/arc/configs/axs101_defconfig
··· 1 + CONFIG_CROSS_COMPILE="arc-linux-uclibc-" 2 + CONFIG_DEFAULT_HOSTNAME="ARCLinux" 3 + # CONFIG_SWAP is not set 4 + CONFIG_SYSVIPC=y 5 + CONFIG_POSIX_MQUEUE=y 6 + # CONFIG_CROSS_MEMORY_ATTACH is not set 7 + CONFIG_NO_HZ_IDLE=y 8 + CONFIG_HIGH_RES_TIMERS=y 9 + CONFIG_IKCONFIG=y 10 + CONFIG_IKCONFIG_PROC=y 11 + CONFIG_NAMESPACES=y 12 + # CONFIG_UTS_NS is not set 13 + # CONFIG_PID_NS is not set 14 + CONFIG_BLK_DEV_INITRD=y 15 + CONFIG_INITRAMFS_SOURCE="../arc_initramfs/" 16 + CONFIG_EMBEDDED=y 17 + CONFIG_PERF_EVENTS=y 18 + # CONFIG_VM_EVENT_COUNTERS is not set 19 + # CONFIG_SLUB_DEBUG is not set 20 + # CONFIG_COMPAT_BRK is not set 21 + CONFIG_MODULES=y 22 + CONFIG_PARTITION_ADVANCED=y 23 + CONFIG_ARC_PLAT_AXS10X=y 24 + CONFIG_AXS101=y 25 + CONFIG_ARC_CACHE_LINE_SHIFT=5 26 + CONFIG_ARC_BUILTIN_DTB_NAME="axs101" 27 + CONFIG_PREEMPT=y 28 + # CONFIG_COMPACTION is not set 29 + CONFIG_NET=y 30 + CONFIG_PACKET=y 31 + CONFIG_UNIX=y 32 + CONFIG_NET_KEY=y 33 + CONFIG_INET=y 34 + CONFIG_IP_PNP=y 35 + CONFIG_IP_PNP_DHCP=y 36 + CONFIG_IP_PNP_BOOTP=y 37 + CONFIG_IP_PNP_RARP=y 38 + # CONFIG_INET_XFRM_MODE_TRANSPORT is not set 39 + # CONFIG_INET_XFRM_MODE_TUNNEL is not set 40 + # CONFIG_INET_XFRM_MODE_BEET is not set 41 + # CONFIG_IPV6 is not set 42 + # CONFIG_STANDALONE is not set 43 + # CONFIG_PREVENT_FIRMWARE_BUILD is not set 44 + # CONFIG_FIRMWARE_IN_KERNEL is not set 45 + CONFIG_SCSI=y 46 + CONFIG_BLK_DEV_SD=y 47 + CONFIG_NETDEVICES=y 48 + # CONFIG_NET_VENDOR_ARC is not set 49 + # CONFIG_NET_VENDOR_BROADCOM is not set 50 + # CONFIG_NET_VENDOR_INTEL is not set 51 + # CONFIG_NET_VENDOR_MARVELL is not set 52 + # CONFIG_NET_VENDOR_MICREL is not set 53 + # CONFIG_NET_VENDOR_NATSEMI is not set 54 + # CONFIG_NET_VENDOR_SEEQ is not set 55 + CONFIG_STMMAC_ETH=y 56 + # CONFIG_NET_VENDOR_VIA is not set 57 + # CONFIG_NET_VENDOR_WIZNET is not set 58 + CONFIG_NATIONAL_PHY=y 59 + # CONFIG_USB_NET_DRIVERS is not set 60 + CONFIG_INPUT_EVDEV=y 61 + CONFIG_MOUSE_PS2_TOUCHKIT=y 62 + CONFIG_MOUSE_SERIAL=y 63 + CONFIG_MOUSE_SYNAPTICS_USB=y 64 + # CONFIG_LEGACY_PTYS is not set 65 + # CONFIG_DEVKMEM is not set 66 + CONFIG_SERIAL_8250=y 67 + CONFIG_SERIAL_8250_CONSOLE=y 68 + CONFIG_SERIAL_8250_DW=y 69 + CONFIG_SERIAL_OF_PLATFORM=y 70 + # CONFIG_HW_RANDOM is not set 71 + CONFIG_I2C=y 72 + CONFIG_I2C_CHARDEV=y 73 + CONFIG_I2C_DESIGNWARE_PLATFORM=y 74 + # CONFIG_HWMON is not set 75 + CONFIG_FB=y 76 + # CONFIG_VGA_CONSOLE is not set 77 + CONFIG_FRAMEBUFFER_CONSOLE=y 78 + CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y 79 + CONFIG_LOGO=y 80 + # CONFIG_LOGO_LINUX_MONO is not set 81 + # CONFIG_LOGO_LINUX_VGA16 is not set 82 + # CONFIG_LOGO_LINUX_CLUT224 is not set 83 + CONFIG_USB_EHCI_HCD=y 84 + CONFIG_USB_EHCI_HCD_PLATFORM=y 85 + CONFIG_USB_OHCI_HCD=y 86 + CONFIG_USB_OHCI_HCD_PLATFORM=y 87 + CONFIG_USB_STORAGE=y 88 + CONFIG_MMC=y 89 + CONFIG_MMC_SDHCI=y 90 + CONFIG_MMC_SDHCI_PLTFM=y 91 + CONFIG_MMC_DW=y 92 + CONFIG_MMC_DW_IDMAC=y 93 + # CONFIG_IOMMU_SUPPORT is not set 94 + CONFIG_EXT3_FS=y 95 + CONFIG_EXT4_FS=y 96 + CONFIG_MSDOS_FS=y 97 + CONFIG_VFAT_FS=y 98 + CONFIG_NTFS_FS=y 99 + CONFIG_TMPFS=y 100 + CONFIG_JFFS2_FS=y 101 + CONFIG_NFS_FS=y 102 + CONFIG_NLS_CODEPAGE_437=y 103 + CONFIG_NLS_ISO8859_1=y 104 + # CONFIG_ENABLE_WARN_DEPRECATED is not set 105 + # CONFIG_ENABLE_MUST_CHECK is not set 106 + CONFIG_STRIP_ASM_SYMS=y 107 + CONFIG_LOCKUP_DETECTOR=y 108 + CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10 109 + # CONFIG_SCHED_DEBUG is not set 110 + # CONFIG_DEBUG_PREEMPT is not set 111 + # CONFIG_FTRACE is not set
+117
arch/arc/configs/axs103_defconfig
··· 1 + CONFIG_CROSS_COMPILE="arc-linux-uclibc-" 2 + CONFIG_DEFAULT_HOSTNAME="ARCLinux" 3 + # CONFIG_SWAP is not set 4 + CONFIG_SYSVIPC=y 5 + CONFIG_POSIX_MQUEUE=y 6 + # CONFIG_CROSS_MEMORY_ATTACH is not set 7 + CONFIG_NO_HZ_IDLE=y 8 + CONFIG_HIGH_RES_TIMERS=y 9 + CONFIG_IKCONFIG=y 10 + CONFIG_IKCONFIG_PROC=y 11 + CONFIG_NAMESPACES=y 12 + # CONFIG_UTS_NS is not set 13 + # CONFIG_PID_NS is not set 14 + CONFIG_BLK_DEV_INITRD=y 15 + CONFIG_INITRAMFS_SOURCE="../../arc_initramfs_hs/" 16 + CONFIG_EMBEDDED=y 17 + CONFIG_PERF_EVENTS=y 18 + # CONFIG_VM_EVENT_COUNTERS is not set 19 + # CONFIG_SLUB_DEBUG is not set 20 + # CONFIG_COMPAT_BRK is not set 21 + CONFIG_MODULES=y 22 + CONFIG_PARTITION_ADVANCED=y 23 + CONFIG_ARC_PLAT_AXS10X=y 24 + CONFIG_AXS103=y 25 + CONFIG_ISA_ARCV2=y 26 + CONFIG_ARC_BUILTIN_DTB_NAME="axs103" 27 + CONFIG_PREEMPT=y 28 + # CONFIG_COMPACTION is not set 29 + CONFIG_NET=y 30 + CONFIG_PACKET=y 31 + CONFIG_UNIX=y 32 + CONFIG_NET_KEY=y 33 + CONFIG_INET=y 34 + CONFIG_IP_PNP=y 35 + CONFIG_IP_PNP_DHCP=y 36 + CONFIG_IP_PNP_BOOTP=y 37 + CONFIG_IP_PNP_RARP=y 38 + # CONFIG_INET_XFRM_MODE_TRANSPORT is not set 39 + # CONFIG_INET_XFRM_MODE_TUNNEL is not set 40 + # CONFIG_INET_XFRM_MODE_BEET is not set 41 + # CONFIG_IPV6 is not set 42 + # CONFIG_STANDALONE is not set 43 + # CONFIG_PREVENT_FIRMWARE_BUILD is not set 44 + # CONFIG_FIRMWARE_IN_KERNEL is not set 45 + CONFIG_MTD=y 46 + CONFIG_MTD_CMDLINE_PARTS=y 47 + CONFIG_MTD_BLOCK=y 48 + CONFIG_MTD_NAND=y 49 + CONFIG_MTD_NAND_AXS=y 50 + CONFIG_SCSI=y 51 + CONFIG_BLK_DEV_SD=y 52 + CONFIG_NETDEVICES=y 53 + # CONFIG_NET_VENDOR_ARC is not set 54 + # CONFIG_NET_VENDOR_BROADCOM is not set 55 + # CONFIG_NET_VENDOR_INTEL is not set 56 + # CONFIG_NET_VENDOR_MARVELL is not set 57 + # CONFIG_NET_VENDOR_MICREL is not set 58 + # CONFIG_NET_VENDOR_NATSEMI is not set 59 + # CONFIG_NET_VENDOR_SEEQ is not set 60 + CONFIG_STMMAC_ETH=y 61 + # CONFIG_NET_VENDOR_VIA is not set 62 + # CONFIG_NET_VENDOR_WIZNET is not set 63 + CONFIG_NATIONAL_PHY=y 64 + # CONFIG_USB_NET_DRIVERS is not set 65 + CONFIG_INPUT_EVDEV=y 66 + CONFIG_MOUSE_PS2_TOUCHKIT=y 67 + CONFIG_MOUSE_SERIAL=y 68 + CONFIG_MOUSE_SYNAPTICS_USB=y 69 + # CONFIG_LEGACY_PTYS is not set 70 + # CONFIG_DEVKMEM is not set 71 + CONFIG_SERIAL_8250=y 72 + CONFIG_SERIAL_8250_CONSOLE=y 73 + CONFIG_SERIAL_8250_DW=y 74 + CONFIG_SERIAL_OF_PLATFORM=y 75 + # CONFIG_HW_RANDOM is not set 76 + CONFIG_I2C=y 77 + CONFIG_I2C_CHARDEV=y 78 + CONFIG_I2C_DESIGNWARE_PLATFORM=y 79 + # CONFIG_HWMON is not set 80 + CONFIG_FB=y 81 + # CONFIG_VGA_CONSOLE is not set 82 + CONFIG_FRAMEBUFFER_CONSOLE=y 83 + CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y 84 + CONFIG_LOGO=y 85 + # CONFIG_LOGO_LINUX_MONO is not set 86 + # CONFIG_LOGO_LINUX_VGA16 is not set 87 + # CONFIG_LOGO_LINUX_CLUT224 is not set 88 + CONFIG_USB=y 89 + CONFIG_USB_EHCI_HCD=y 90 + CONFIG_USB_EHCI_HCD_PLATFORM=y 91 + CONFIG_USB_OHCI_HCD=y 92 + CONFIG_USB_OHCI_HCD_PLATFORM=y 93 + CONFIG_USB_STORAGE=y 94 + CONFIG_MMC=y 95 + CONFIG_MMC_SDHCI=y 96 + CONFIG_MMC_SDHCI_PLTFM=y 97 + CONFIG_MMC_DW=y 98 + CONFIG_MMC_DW_IDMAC=y 99 + # CONFIG_IOMMU_SUPPORT is not set 100 + CONFIG_EXT3_FS=y 101 + CONFIG_EXT4_FS=y 102 + CONFIG_MSDOS_FS=y 103 + CONFIG_VFAT_FS=y 104 + CONFIG_NTFS_FS=y 105 + CONFIG_TMPFS=y 106 + CONFIG_JFFS2_FS=y 107 + CONFIG_NFS_FS=y 108 + CONFIG_NLS_CODEPAGE_437=y 109 + CONFIG_NLS_ISO8859_1=y 110 + # CONFIG_ENABLE_WARN_DEPRECATED is not set 111 + # CONFIG_ENABLE_MUST_CHECK is not set 112 + CONFIG_STRIP_ASM_SYMS=y 113 + CONFIG_LOCKUP_DETECTOR=y 114 + CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10 115 + # CONFIG_SCHED_DEBUG is not set 116 + # CONFIG_DEBUG_PREEMPT is not set 117 + # CONFIG_FTRACE is not set
+118
arch/arc/configs/axs103_smp_defconfig
··· 1 + CONFIG_CROSS_COMPILE="arc-linux-uclibc-" 2 + CONFIG_DEFAULT_HOSTNAME="ARCLinux" 3 + # CONFIG_SWAP is not set 4 + CONFIG_SYSVIPC=y 5 + CONFIG_POSIX_MQUEUE=y 6 + # CONFIG_CROSS_MEMORY_ATTACH is not set 7 + CONFIG_NO_HZ_IDLE=y 8 + CONFIG_HIGH_RES_TIMERS=y 9 + CONFIG_IKCONFIG=y 10 + CONFIG_IKCONFIG_PROC=y 11 + CONFIG_NAMESPACES=y 12 + # CONFIG_UTS_NS is not set 13 + # CONFIG_PID_NS is not set 14 + CONFIG_BLK_DEV_INITRD=y 15 + CONFIG_INITRAMFS_SOURCE="../../arc_initramfs_hs/" 16 + CONFIG_EMBEDDED=y 17 + CONFIG_PERF_EVENTS=y 18 + # CONFIG_VM_EVENT_COUNTERS is not set 19 + # CONFIG_COMPAT_BRK is not set 20 + CONFIG_SLAB=y 21 + CONFIG_MODULES=y 22 + CONFIG_PARTITION_ADVANCED=y 23 + CONFIG_ARC_PLAT_AXS10X=y 24 + CONFIG_AXS103=y 25 + CONFIG_ISA_ARCV2=y 26 + CONFIG_SMP=y 27 + CONFIG_ARC_BUILTIN_DTB_NAME="axs103_idu" 28 + CONFIG_PREEMPT=y 29 + # CONFIG_COMPACTION is not set 30 + CONFIG_NET=y 31 + CONFIG_PACKET=y 32 + CONFIG_UNIX=y 33 + CONFIG_NET_KEY=y 34 + CONFIG_INET=y 35 + CONFIG_IP_PNP=y 36 + CONFIG_IP_PNP_DHCP=y 37 + CONFIG_IP_PNP_BOOTP=y 38 + CONFIG_IP_PNP_RARP=y 39 + # CONFIG_INET_XFRM_MODE_TRANSPORT is not set 40 + # CONFIG_INET_XFRM_MODE_TUNNEL is not set 41 + # CONFIG_INET_XFRM_MODE_BEET is not set 42 + # CONFIG_IPV6 is not set 43 + # CONFIG_STANDALONE is not set 44 + # CONFIG_PREVENT_FIRMWARE_BUILD is not set 45 + # CONFIG_FIRMWARE_IN_KERNEL is not set 46 + CONFIG_MTD=y 47 + CONFIG_MTD_CMDLINE_PARTS=y 48 + CONFIG_MTD_BLOCK=y 49 + CONFIG_MTD_NAND=y 50 + CONFIG_MTD_NAND_AXS=y 51 + CONFIG_SCSI=y 52 + CONFIG_BLK_DEV_SD=y 53 + CONFIG_NETDEVICES=y 54 + # CONFIG_NET_VENDOR_ARC is not set 55 + # CONFIG_NET_VENDOR_BROADCOM is not set 56 + # CONFIG_NET_VENDOR_INTEL is not set 57 + # CONFIG_NET_VENDOR_MARVELL is not set 58 + # CONFIG_NET_VENDOR_MICREL is not set 59 + # CONFIG_NET_VENDOR_NATSEMI is not set 60 + # CONFIG_NET_VENDOR_SEEQ is not set 61 + CONFIG_STMMAC_ETH=y 62 + # CONFIG_NET_VENDOR_VIA is not set 63 + # CONFIG_NET_VENDOR_WIZNET is not set 64 + CONFIG_NATIONAL_PHY=y 65 + # CONFIG_USB_NET_DRIVERS is not set 66 + CONFIG_INPUT_EVDEV=y 67 + CONFIG_MOUSE_PS2_TOUCHKIT=y 68 + CONFIG_MOUSE_SERIAL=y 69 + CONFIG_MOUSE_SYNAPTICS_USB=y 70 + # CONFIG_LEGACY_PTYS is not set 71 + # CONFIG_DEVKMEM is not set 72 + CONFIG_SERIAL_8250=y 73 + CONFIG_SERIAL_8250_CONSOLE=y 74 + CONFIG_SERIAL_8250_DW=y 75 + CONFIG_SERIAL_OF_PLATFORM=y 76 + # CONFIG_HW_RANDOM is not set 77 + CONFIG_I2C=y 78 + CONFIG_I2C_CHARDEV=y 79 + CONFIG_I2C_DESIGNWARE_PLATFORM=y 80 + # CONFIG_HWMON is not set 81 + CONFIG_FB=y 82 + # CONFIG_VGA_CONSOLE is not set 83 + CONFIG_FRAMEBUFFER_CONSOLE=y 84 + CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y 85 + CONFIG_LOGO=y 86 + # CONFIG_LOGO_LINUX_MONO is not set 87 + # CONFIG_LOGO_LINUX_VGA16 is not set 88 + # CONFIG_LOGO_LINUX_CLUT224 is not set 89 + CONFIG_USB=y 90 + CONFIG_USB_EHCI_HCD=y 91 + CONFIG_USB_EHCI_HCD_PLATFORM=y 92 + CONFIG_USB_OHCI_HCD=y 93 + CONFIG_USB_OHCI_HCD_PLATFORM=y 94 + CONFIG_USB_STORAGE=y 95 + CONFIG_MMC=y 96 + CONFIG_MMC_SDHCI=y 97 + CONFIG_MMC_SDHCI_PLTFM=y 98 + CONFIG_MMC_DW=y 99 + CONFIG_MMC_DW_IDMAC=y 100 + # CONFIG_IOMMU_SUPPORT is not set 101 + CONFIG_EXT3_FS=y 102 + CONFIG_EXT4_FS=y 103 + CONFIG_MSDOS_FS=y 104 + CONFIG_VFAT_FS=y 105 + CONFIG_NTFS_FS=y 106 + CONFIG_TMPFS=y 107 + CONFIG_JFFS2_FS=y 108 + CONFIG_NFS_FS=y 109 + CONFIG_NLS_CODEPAGE_437=y 110 + CONFIG_NLS_ISO8859_1=y 111 + # CONFIG_ENABLE_WARN_DEPRECATED is not set 112 + # CONFIG_ENABLE_MUST_CHECK is not set 113 + CONFIG_STRIP_ASM_SYMS=y 114 + CONFIG_LOCKUP_DETECTOR=y 115 + CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10 116 + # CONFIG_SCHED_DEBUG is not set 117 + # CONFIG_DEBUG_PREEMPT is not set 118 + # CONFIG_FTRACE is not set
+3 -4
arch/arc/configs/nsim_700_defconfig
··· 1 - CONFIG_CROSS_COMPILE="arc-linux-uclibc-" 1 + CONFIG_CROSS_COMPILE="arc-linux-" 2 2 # CONFIG_LOCALVERSION_AUTO is not set 3 3 CONFIG_DEFAULT_HOSTNAME="ARCLinux" 4 4 # CONFIG_SWAP is not set ··· 22 22 # CONFIG_BLK_DEV_BSG is not set 23 23 # CONFIG_IOSCHED_DEADLINE is not set 24 24 # CONFIG_IOSCHED_CFQ is not set 25 - CONFIG_ARC_PLAT_FPGA_LEGACY=y 26 - # CONFIG_ARC_HAS_RTSC is not set 27 - CONFIG_ARC_BUILTIN_DTB_NAME="angel4" 25 + CONFIG_ARC_PLAT_SIM=y 26 + CONFIG_ARC_BUILTIN_DTB_NAME="nsim_700" 28 27 CONFIG_PREEMPT=y 29 28 # CONFIG_COMPACTION is not set 30 29 # CONFIG_CROSS_MEMORY_ATTACH is not set
+64
arch/arc/configs/nsim_hs_defconfig
··· 1 + CONFIG_CROSS_COMPILE="arc-linux-uclibc-" 2 + # CONFIG_LOCALVERSION_AUTO is not set 3 + CONFIG_DEFAULT_HOSTNAME="ARCLinux" 4 + # CONFIG_SWAP is not set 5 + CONFIG_SYSVIPC=y 6 + CONFIG_POSIX_MQUEUE=y 7 + # CONFIG_CROSS_MEMORY_ATTACH is not set 8 + CONFIG_HIGH_RES_TIMERS=y 9 + CONFIG_IKCONFIG=y 10 + CONFIG_IKCONFIG_PROC=y 11 + CONFIG_NAMESPACES=y 12 + # CONFIG_UTS_NS is not set 13 + # CONFIG_PID_NS is not set 14 + CONFIG_BLK_DEV_INITRD=y 15 + CONFIG_INITRAMFS_SOURCE="../arc_initramfs_hs/" 16 + CONFIG_KALLSYMS_ALL=y 17 + CONFIG_EMBEDDED=y 18 + # CONFIG_SLUB_DEBUG is not set 19 + # CONFIG_COMPAT_BRK is not set 20 + CONFIG_KPROBES=y 21 + CONFIG_MODULES=y 22 + # CONFIG_LBDAF is not set 23 + # CONFIG_BLK_DEV_BSG is not set 24 + # CONFIG_IOSCHED_DEADLINE is not set 25 + # CONFIG_IOSCHED_CFQ is not set 26 + CONFIG_ARC_PLAT_SIM=y 27 + CONFIG_ISA_ARCV2=y 28 + CONFIG_ARC_BUILTIN_DTB_NAME="nsim_hs" 29 + CONFIG_PREEMPT=y 30 + # CONFIG_COMPACTION is not set 31 + CONFIG_NET=y 32 + CONFIG_PACKET=y 33 + CONFIG_UNIX=y 34 + CONFIG_UNIX_DIAG=y 35 + CONFIG_NET_KEY=y 36 + CONFIG_INET=y 37 + # CONFIG_IPV6 is not set 38 + # CONFIG_STANDALONE is not set 39 + # CONFIG_PREVENT_FIRMWARE_BUILD is not set 40 + # CONFIG_FIRMWARE_IN_KERNEL is not set 41 + # CONFIG_BLK_DEV is not set 42 + # CONFIG_INPUT_MOUSEDEV_PSAUX is not set 43 + # CONFIG_INPUT_KEYBOARD is not set 44 + # CONFIG_INPUT_MOUSE is not set 45 + # CONFIG_SERIO is not set 46 + # CONFIG_LEGACY_PTYS is not set 47 + # CONFIG_DEVKMEM is not set 48 + CONFIG_SERIAL_ARC=y 49 + CONFIG_SERIAL_ARC_CONSOLE=y 50 + # CONFIG_HW_RANDOM is not set 51 + # CONFIG_HWMON is not set 52 + # CONFIG_VGA_CONSOLE is not set 53 + # CONFIG_HID is not set 54 + # CONFIG_USB_SUPPORT is not set 55 + # CONFIG_IOMMU_SUPPORT is not set 56 + CONFIG_EXT2_FS=y 57 + CONFIG_EXT2_FS_XATTR=y 58 + CONFIG_TMPFS=y 59 + # CONFIG_MISC_FILESYSTEMS is not set 60 + CONFIG_NFS_FS=y 61 + # CONFIG_ENABLE_WARN_DEPRECATED is not set 62 + # CONFIG_ENABLE_MUST_CHECK is not set 63 + # CONFIG_DEBUG_PREEMPT is not set 64 + CONFIG_XZ_DEC=y
+63
arch/arc/configs/nsim_hs_smp_defconfig
··· 1 + CONFIG_CROSS_COMPILE="arc-linux-uclibc-" 2 + # CONFIG_LOCALVERSION_AUTO is not set 3 + CONFIG_DEFAULT_HOSTNAME="ARCLinux" 4 + # CONFIG_SWAP is not set 5 + CONFIG_HIGH_RES_TIMERS=y 6 + CONFIG_IKCONFIG=y 7 + CONFIG_IKCONFIG_PROC=y 8 + CONFIG_NAMESPACES=y 9 + # CONFIG_UTS_NS is not set 10 + # CONFIG_PID_NS is not set 11 + CONFIG_BLK_DEV_INITRD=y 12 + CONFIG_INITRAMFS_SOURCE="../arc_initramfs_hs/" 13 + CONFIG_KALLSYMS_ALL=y 14 + CONFIG_EMBEDDED=y 15 + # CONFIG_SLUB_DEBUG is not set 16 + # CONFIG_COMPAT_BRK is not set 17 + CONFIG_KPROBES=y 18 + CONFIG_MODULES=y 19 + # CONFIG_LBDAF is not set 20 + # CONFIG_BLK_DEV_BSG is not set 21 + # CONFIG_IOSCHED_DEADLINE is not set 22 + # CONFIG_IOSCHED_CFQ is not set 23 + CONFIG_ARC_PLAT_SIM=y 24 + CONFIG_ARC_BOARD_ML509=y 25 + CONFIG_ISA_ARCV2=y 26 + CONFIG_SMP=y 27 + CONFIG_ARC_BUILTIN_DTB_NAME="nsim_hs_idu" 28 + CONFIG_PREEMPT=y 29 + # CONFIG_COMPACTION is not set 30 + # CONFIG_CROSS_MEMORY_ATTACH is not set 31 + CONFIG_NET=y 32 + CONFIG_PACKET=y 33 + CONFIG_UNIX=y 34 + CONFIG_UNIX_DIAG=y 35 + CONFIG_NET_KEY=y 36 + CONFIG_INET=y 37 + # CONFIG_IPV6 is not set 38 + # CONFIG_STANDALONE is not set 39 + # CONFIG_PREVENT_FIRMWARE_BUILD is not set 40 + # CONFIG_FIRMWARE_IN_KERNEL is not set 41 + # CONFIG_BLK_DEV is not set 42 + # CONFIG_INPUT_MOUSEDEV_PSAUX is not set 43 + # CONFIG_INPUT_KEYBOARD is not set 44 + # CONFIG_INPUT_MOUSE is not set 45 + # CONFIG_SERIO is not set 46 + # CONFIG_LEGACY_PTYS is not set 47 + # CONFIG_DEVKMEM is not set 48 + CONFIG_SERIAL_ARC=y 49 + CONFIG_SERIAL_ARC_CONSOLE=y 50 + # CONFIG_HW_RANDOM is not set 51 + # CONFIG_HWMON is not set 52 + # CONFIG_VGA_CONSOLE is not set 53 + # CONFIG_HID is not set 54 + # CONFIG_USB_SUPPORT is not set 55 + # CONFIG_IOMMU_SUPPORT is not set 56 + CONFIG_EXT2_FS=y 57 + CONFIG_EXT2_FS_XATTR=y 58 + CONFIG_TMPFS=y 59 + # CONFIG_MISC_FILESYSTEMS is not set 60 + CONFIG_NFS_FS=y 61 + # CONFIG_ENABLE_WARN_DEPRECATED is not set 62 + # CONFIG_ENABLE_MUST_CHECK is not set 63 + CONFIG_XZ_DEC=y
+2 -3
arch/arc/configs/nsimosci_defconfig
··· 1 - CONFIG_CROSS_COMPILE="arc-linux-uclibc-" 1 + CONFIG_CROSS_COMPILE="arc-linux-" 2 2 # CONFIG_LOCALVERSION_AUTO is not set 3 3 CONFIG_DEFAULT_HOSTNAME="ARCLinux" 4 4 # CONFIG_SWAP is not set ··· 23 23 # CONFIG_BLK_DEV_BSG is not set 24 24 # CONFIG_IOSCHED_DEADLINE is not set 25 25 # CONFIG_IOSCHED_CFQ is not set 26 - CONFIG_ARC_PLAT_FPGA_LEGACY=y 27 - # CONFIG_ARC_HAS_RTSC is not set 26 + CONFIG_ARC_PLAT_SIM=y 28 27 CONFIG_ARC_BUILTIN_DTB_NAME="nsimosci" 29 28 # CONFIG_COMPACTION is not set 30 29 CONFIG_NET=y
+73
arch/arc/configs/nsimosci_hs_defconfig
··· 1 + CONFIG_CROSS_COMPILE="arc-linux-uclibc-" 2 + # CONFIG_LOCALVERSION_AUTO is not set 3 + CONFIG_DEFAULT_HOSTNAME="ARCLinux" 4 + # CONFIG_SWAP is not set 5 + CONFIG_SYSVIPC=y 6 + # CONFIG_CROSS_MEMORY_ATTACH is not set 7 + CONFIG_NO_HZ=y 8 + CONFIG_HIGH_RES_TIMERS=y 9 + CONFIG_IKCONFIG=y 10 + CONFIG_IKCONFIG_PROC=y 11 + CONFIG_NAMESPACES=y 12 + # CONFIG_UTS_NS is not set 13 + # CONFIG_PID_NS is not set 14 + CONFIG_BLK_DEV_INITRD=y 15 + CONFIG_INITRAMFS_SOURCE="../arc_initramfs_hs/" 16 + CONFIG_KALLSYMS_ALL=y 17 + CONFIG_EMBEDDED=y 18 + # CONFIG_SLUB_DEBUG is not set 19 + # CONFIG_COMPAT_BRK is not set 20 + CONFIG_KPROBES=y 21 + CONFIG_MODULES=y 22 + # CONFIG_LBDAF is not set 23 + # CONFIG_BLK_DEV_BSG is not set 24 + # CONFIG_IOSCHED_DEADLINE is not set 25 + # CONFIG_IOSCHED_CFQ is not set 26 + CONFIG_ARC_PLAT_SIM=y 27 + CONFIG_ISA_ARCV2=y 28 + CONFIG_ARC_BUILTIN_DTB_NAME="nsimosci_hs" 29 + # CONFIG_COMPACTION is not set 30 + CONFIG_NET=y 31 + CONFIG_PACKET=y 32 + CONFIG_UNIX=y 33 + CONFIG_UNIX_DIAG=y 34 + CONFIG_NET_KEY=y 35 + CONFIG_INET=y 36 + # CONFIG_IPV6 is not set 37 + # CONFIG_STANDALONE is not set 38 + # CONFIG_PREVENT_FIRMWARE_BUILD is not set 39 + # CONFIG_FIRMWARE_IN_KERNEL is not set 40 + # CONFIG_BLK_DEV is not set 41 + CONFIG_NETDEVICES=y 42 + CONFIG_NET_OSCI_LAN=y 43 + CONFIG_INPUT_EVDEV=y 44 + # CONFIG_MOUSE_PS2_ALPS is not set 45 + # CONFIG_MOUSE_PS2_LOGIPS2PP is not set 46 + # CONFIG_MOUSE_PS2_SYNAPTICS is not set 47 + # CONFIG_MOUSE_PS2_TRACKPOINT is not set 48 + CONFIG_MOUSE_PS2_TOUCHKIT=y 49 + # CONFIG_SERIO_SERPORT is not set 50 + CONFIG_SERIO_ARC_PS2=y 51 + # CONFIG_LEGACY_PTYS is not set 52 + # CONFIG_DEVKMEM is not set 53 + CONFIG_SERIAL_8250=y 54 + CONFIG_SERIAL_8250_CONSOLE=y 55 + CONFIG_SERIAL_8250_NR_UARTS=1 56 + CONFIG_SERIAL_8250_RUNTIME_UARTS=1 57 + CONFIG_SERIAL_OF_PLATFORM=y 58 + # CONFIG_HW_RANDOM is not set 59 + # CONFIG_HWMON is not set 60 + CONFIG_FB=y 61 + # CONFIG_VGA_CONSOLE is not set 62 + CONFIG_FRAMEBUFFER_CONSOLE=y 63 + CONFIG_LOGO=y 64 + # CONFIG_HID is not set 65 + # CONFIG_USB_SUPPORT is not set 66 + # CONFIG_IOMMU_SUPPORT is not set 67 + CONFIG_EXT2_FS=y 68 + CONFIG_EXT2_FS_XATTR=y 69 + CONFIG_TMPFS=y 70 + # CONFIG_MISC_FILESYSTEMS is not set 71 + CONFIG_NFS_FS=y 72 + # CONFIG_ENABLE_WARN_DEPRECATED is not set 73 + # CONFIG_ENABLE_MUST_CHECK is not set
+93
arch/arc/configs/nsimosci_hs_smp_defconfig
··· 1 + CONFIG_CROSS_COMPILE="arc-linux-uclibc-" 2 + CONFIG_DEFAULT_HOSTNAME="ARCLinux" 3 + # CONFIG_SWAP is not set 4 + CONFIG_SYSVIPC=y 5 + CONFIG_NO_HZ=y 6 + CONFIG_HIGH_RES_TIMERS=y 7 + CONFIG_IKCONFIG=y 8 + CONFIG_IKCONFIG_PROC=y 9 + # CONFIG_UTS_NS is not set 10 + # CONFIG_PID_NS is not set 11 + CONFIG_BLK_DEV_INITRD=y 12 + CONFIG_INITRAMFS_SOURCE="../arc_initramfs_hs/" 13 + # CONFIG_COMPAT_BRK is not set 14 + CONFIG_KPROBES=y 15 + CONFIG_MODULES=y 16 + # CONFIG_LBDAF is not set 17 + # CONFIG_BLK_DEV_BSG is not set 18 + # CONFIG_IOSCHED_DEADLINE is not set 19 + # CONFIG_IOSCHED_CFQ is not set 20 + CONFIG_ARC_PLAT_SIM=y 21 + CONFIG_ARC_BOARD_ML509=y 22 + CONFIG_ISA_ARCV2=y 23 + CONFIG_SMP=y 24 + CONFIG_ARC_HAS_LL64=y 25 + # CONFIG_ARC_HAS_RTSC is not set 26 + CONFIG_ARC_BUILTIN_DTB_NAME="nsimosci_hs_idu" 27 + CONFIG_PREEMPT=y 28 + # CONFIG_COMPACTION is not set 29 + # CONFIG_CROSS_MEMORY_ATTACH is not set 30 + CONFIG_NET=y 31 + CONFIG_PACKET=y 32 + CONFIG_PACKET_DIAG=y 33 + CONFIG_UNIX=y 34 + CONFIG_UNIX_DIAG=y 35 + CONFIG_NET_KEY=y 36 + CONFIG_INET=y 37 + # CONFIG_INET_XFRM_MODE_TRANSPORT is not set 38 + # CONFIG_INET_XFRM_MODE_TUNNEL is not set 39 + # CONFIG_INET_XFRM_MODE_BEET is not set 40 + # CONFIG_INET_LRO is not set 41 + # CONFIG_IPV6 is not set 42 + # CONFIG_WIRELESS is not set 43 + # CONFIG_STANDALONE is not set 44 + # CONFIG_PREVENT_FIRMWARE_BUILD is not set 45 + # CONFIG_FIRMWARE_IN_KERNEL is not set 46 + # CONFIG_BLK_DEV is not set 47 + CONFIG_NETDEVICES=y 48 + # CONFIG_NET_VENDOR_ARC is not set 49 + # CONFIG_NET_CADENCE is not set 50 + # CONFIG_NET_VENDOR_BROADCOM is not set 51 + # CONFIG_NET_VENDOR_INTEL is not set 52 + # CONFIG_NET_VENDOR_MARVELL is not set 53 + # CONFIG_NET_VENDOR_MICREL is not set 54 + # CONFIG_NET_VENDOR_NATSEMI is not set 55 + # CONFIG_NET_VENDOR_SEEQ is not set 56 + # CONFIG_NET_VENDOR_STMICRO is not set 57 + # CONFIG_NET_VENDOR_VIA is not set 58 + # CONFIG_NET_VENDOR_WIZNET is not set 59 + CONFIG_NET_OSCI_LAN=y 60 + # CONFIG_WLAN is not set 61 + CONFIG_INPUT_EVDEV=y 62 + CONFIG_MOUSE_PS2_TOUCHKIT=y 63 + # CONFIG_SERIO_SERPORT is not set 64 + CONFIG_SERIO_LIBPS2=y 65 + CONFIG_SERIO_ARC_PS2=y 66 + CONFIG_VT_HW_CONSOLE_BINDING=y 67 + # CONFIG_LEGACY_PTYS is not set 68 + # CONFIG_DEVKMEM is not set 69 + CONFIG_SERIAL_8250=y 70 + CONFIG_SERIAL_8250_CONSOLE=y 71 + CONFIG_SERIAL_8250_NR_UARTS=1 72 + CONFIG_SERIAL_8250_RUNTIME_UARTS=1 73 + CONFIG_SERIAL_8250_DW=y 74 + CONFIG_SERIAL_OF_PLATFORM=y 75 + # CONFIG_HW_RANDOM is not set 76 + # CONFIG_HWMON is not set 77 + CONFIG_FB=y 78 + CONFIG_ARCPGU_RGB888=y 79 + CONFIG_ARCPGU_DISPTYPE=0 80 + # CONFIG_VGA_CONSOLE is not set 81 + CONFIG_FRAMEBUFFER_CONSOLE=y 82 + CONFIG_LOGO=y 83 + # CONFIG_HID is not set 84 + # CONFIG_USB_SUPPORT is not set 85 + # CONFIG_IOMMU_SUPPORT is not set 86 + CONFIG_EXT2_FS=y 87 + CONFIG_EXT2_FS_XATTR=y 88 + CONFIG_TMPFS=y 89 + # CONFIG_MISC_FILESYSTEMS is not set 90 + CONFIG_NFS_FS=y 91 + # CONFIG_ENABLE_WARN_DEPRECATED is not set 92 + # CONFIG_ENABLE_MUST_CHECK is not set 93 + CONFIG_FTRACE=y
+1 -2
arch/arc/configs/tb10x_defconfig
··· 1 - CONFIG_CROSS_COMPILE="arc-linux-uclibc-" 1 + CONFIG_CROSS_COMPILE="arc-linux-" 2 2 # CONFIG_LOCALVERSION_AUTO is not set 3 3 CONFIG_DEFAULT_HOSTNAME="tb10x" 4 4 CONFIG_SYSVIPC=y ··· 26 26 # CONFIG_BLOCK is not set 27 27 CONFIG_ARC_PLAT_TB10X=y 28 28 CONFIG_ARC_CACHE_LINE_SHIFT=5 29 - # CONFIG_ARC_HAS_RTSC is not set 30 29 CONFIG_ARC_STACK_NONEXEC=y 31 30 CONFIG_HZ=250 32 31 CONFIG_ARC_BUILTIN_DTB_NAME="abilis_tb100_dvk"
+102
arch/arc/configs/vdk_hs38_defconfig
··· 1 + CONFIG_CROSS_COMPILE="arc-linux-uclibc-" 2 + # CONFIG_LOCALVERSION_AUTO is not set 3 + CONFIG_DEFAULT_HOSTNAME="ARCLinux" 4 + # CONFIG_CROSS_MEMORY_ATTACH is not set 5 + CONFIG_HIGH_RES_TIMERS=y 6 + CONFIG_IKCONFIG=y 7 + CONFIG_IKCONFIG_PROC=y 8 + CONFIG_BLK_DEV_INITRD=y 9 + CONFIG_EMBEDDED=y 10 + CONFIG_PERF_EVENTS=y 11 + # CONFIG_VM_EVENT_COUNTERS is not set 12 + # CONFIG_SLUB_DEBUG is not set 13 + # CONFIG_COMPAT_BRK is not set 14 + CONFIG_PARTITION_ADVANCED=y 15 + CONFIG_ARC_PLAT_AXS10X=y 16 + CONFIG_AXS103=y 17 + CONFIG_ISA_ARCV2=y 18 + CONFIG_ARC_UBOOT_SUPPORT=y 19 + CONFIG_ARC_BUILTIN_DTB_NAME="vdk_hs38" 20 + CONFIG_PREEMPT=y 21 + CONFIG_NET=y 22 + CONFIG_PACKET=y 23 + CONFIG_UNIX=y 24 + CONFIG_NET_KEY=y 25 + CONFIG_INET=y 26 + CONFIG_IP_PNP=y 27 + CONFIG_IP_PNP_DHCP=y 28 + CONFIG_IP_PNP_BOOTP=y 29 + CONFIG_IP_PNP_RARP=y 30 + # CONFIG_IPV6 is not set 31 + CONFIG_DEVTMPFS=y 32 + CONFIG_DEVTMPFS_MOUNT=y 33 + # CONFIG_STANDALONE is not set 34 + # CONFIG_PREVENT_FIRMWARE_BUILD is not set 35 + # CONFIG_FIRMWARE_IN_KERNEL is not set 36 + CONFIG_MTD=y 37 + CONFIG_MTD_CMDLINE_PARTS=y 38 + CONFIG_MTD_BLOCK=y 39 + CONFIG_MTD_SLRAM=y 40 + CONFIG_BLK_DEV_RAM=y 41 + CONFIG_SCSI=y 42 + CONFIG_BLK_DEV_SD=y 43 + CONFIG_NETDEVICES=y 44 + # CONFIG_NET_VENDOR_ARC is not set 45 + # CONFIG_NET_VENDOR_BROADCOM is not set 46 + # CONFIG_NET_VENDOR_INTEL is not set 47 + # CONFIG_NET_VENDOR_MARVELL is not set 48 + # CONFIG_NET_VENDOR_MICREL is not set 49 + # CONFIG_NET_VENDOR_NATSEMI is not set 50 + # CONFIG_NET_VENDOR_SEEQ is not set 51 + CONFIG_STMMAC_ETH=y 52 + # CONFIG_NET_VENDOR_VIA is not set 53 + # CONFIG_NET_VENDOR_WIZNET is not set 54 + CONFIG_NATIONAL_PHY=y 55 + CONFIG_MOUSE_PS2_TOUCHKIT=y 56 + CONFIG_SERIO_ARC_PS2=y 57 + # CONFIG_LEGACY_PTYS is not set 58 + # CONFIG_DEVKMEM is not set 59 + CONFIG_SERIAL_8250=y 60 + CONFIG_SERIAL_8250_CONSOLE=y 61 + CONFIG_SERIAL_8250_DW=y 62 + CONFIG_SERIAL_OF_PLATFORM=y 63 + # CONFIG_HW_RANDOM is not set 64 + # CONFIG_HWMON is not set 65 + CONFIG_FB=y 66 + CONFIG_ARCPGU_RGB888=y 67 + CONFIG_ARCPGU_DISPTYPE=0 68 + # CONFIG_VGA_CONSOLE is not set 69 + CONFIG_FRAMEBUFFER_CONSOLE=y 70 + CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y 71 + CONFIG_LOGO=y 72 + # CONFIG_LOGO_LINUX_MONO is not set 73 + # CONFIG_LOGO_LINUX_VGA16 is not set 74 + # CONFIG_LOGO_LINUX_CLUT224 is not set 75 + CONFIG_USB=y 76 + CONFIG_USB_EHCI_HCD=y 77 + # CONFIG_USB_EHCI_TT_NEWSCHED is not set 78 + CONFIG_USB_EHCI_HCD_PLATFORM=y 79 + CONFIG_USB_OHCI_HCD=y 80 + CONFIG_USB_OHCI_HCD_PLATFORM=y 81 + CONFIG_USB_STORAGE=y 82 + CONFIG_USB_SERIAL=y 83 + # CONFIG_IOMMU_SUPPORT is not set 84 + CONFIG_EXT3_FS=y 85 + CONFIG_EXT4_FS=y 86 + CONFIG_MSDOS_FS=y 87 + CONFIG_VFAT_FS=y 88 + CONFIG_NTFS_FS=y 89 + CONFIG_TMPFS=y 90 + CONFIG_JFFS2_FS=y 91 + CONFIG_NFS_FS=y 92 + CONFIG_NLS_CODEPAGE_437=y 93 + CONFIG_NLS_ISO8859_1=y 94 + # CONFIG_ENABLE_WARN_DEPRECATED is not set 95 + # CONFIG_ENABLE_MUST_CHECK is not set 96 + CONFIG_STRIP_ASM_SYMS=y 97 + CONFIG_DEBUG_SHIRQ=y 98 + CONFIG_LOCKUP_DETECTOR=y 99 + CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10 100 + # CONFIG_SCHED_DEBUG is not set 101 + # CONFIG_DEBUG_PREEMPT is not set 102 + # CONFIG_FTRACE is not set
+104
arch/arc/configs/vdk_hs38_smp_defconfig
··· 1 + CONFIG_CROSS_COMPILE="arc-linux-uclibc-" 2 + # CONFIG_LOCALVERSION_AUTO is not set 3 + CONFIG_DEFAULT_HOSTNAME="ARCLinux" 4 + # CONFIG_CROSS_MEMORY_ATTACH is not set 5 + CONFIG_HIGH_RES_TIMERS=y 6 + CONFIG_IKCONFIG=y 7 + CONFIG_IKCONFIG_PROC=y 8 + CONFIG_BLK_DEV_INITRD=y 9 + CONFIG_EMBEDDED=y 10 + CONFIG_PERF_EVENTS=y 11 + # CONFIG_VM_EVENT_COUNTERS is not set 12 + # CONFIG_SLUB_DEBUG is not set 13 + # CONFIG_COMPAT_BRK is not set 14 + CONFIG_PARTITION_ADVANCED=y 15 + CONFIG_ARC_PLAT_AXS10X=y 16 + CONFIG_AXS103=y 17 + CONFIG_ISA_ARCV2=y 18 + CONFIG_SMP=y 19 + # CONFIG_ARC_HAS_GRTC is not set 20 + CONFIG_ARC_UBOOT_SUPPORT=y 21 + CONFIG_ARC_BUILTIN_DTB_NAME="vdk_hs38_smp" 22 + CONFIG_PREEMPT=y 23 + CONFIG_NET=y 24 + CONFIG_PACKET=y 25 + CONFIG_UNIX=y 26 + CONFIG_NET_KEY=y 27 + CONFIG_INET=y 28 + CONFIG_IP_PNP=y 29 + CONFIG_IP_PNP_DHCP=y 30 + CONFIG_IP_PNP_BOOTP=y 31 + CONFIG_IP_PNP_RARP=y 32 + # CONFIG_IPV6 is not set 33 + CONFIG_DEVTMPFS=y 34 + CONFIG_DEVTMPFS_MOUNT=y 35 + # CONFIG_STANDALONE is not set 36 + # CONFIG_PREVENT_FIRMWARE_BUILD is not set 37 + # CONFIG_FIRMWARE_IN_KERNEL is not set 38 + CONFIG_MTD=y 39 + CONFIG_MTD_CMDLINE_PARTS=y 40 + CONFIG_MTD_BLOCK=y 41 + CONFIG_MTD_SLRAM=y 42 + CONFIG_BLK_DEV_RAM=y 43 + CONFIG_SCSI=y 44 + CONFIG_BLK_DEV_SD=y 45 + CONFIG_NETDEVICES=y 46 + # CONFIG_NET_VENDOR_ARC is not set 47 + # CONFIG_NET_VENDOR_BROADCOM is not set 48 + # CONFIG_NET_VENDOR_INTEL is not set 49 + # CONFIG_NET_VENDOR_MARVELL is not set 50 + # CONFIG_NET_VENDOR_MICREL is not set 51 + # CONFIG_NET_VENDOR_NATSEMI is not set 52 + # CONFIG_NET_VENDOR_SEEQ is not set 53 + CONFIG_STMMAC_ETH=y 54 + # CONFIG_NET_VENDOR_VIA is not set 55 + # CONFIG_NET_VENDOR_WIZNET is not set 56 + CONFIG_NATIONAL_PHY=y 57 + CONFIG_MOUSE_PS2_TOUCHKIT=y 58 + CONFIG_SERIO_ARC_PS2=y 59 + # CONFIG_LEGACY_PTYS is not set 60 + # CONFIG_DEVKMEM is not set 61 + CONFIG_SERIAL_8250=y 62 + CONFIG_SERIAL_8250_CONSOLE=y 63 + CONFIG_SERIAL_8250_DW=y 64 + CONFIG_SERIAL_OF_PLATFORM=y 65 + # CONFIG_HW_RANDOM is not set 66 + # CONFIG_HWMON is not set 67 + CONFIG_FB=y 68 + CONFIG_ARCPGU_RGB888=y 69 + CONFIG_ARCPGU_DISPTYPE=0 70 + # CONFIG_VGA_CONSOLE is not set 71 + CONFIG_FRAMEBUFFER_CONSOLE=y 72 + CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y 73 + CONFIG_LOGO=y 74 + # CONFIG_LOGO_LINUX_MONO is not set 75 + # CONFIG_LOGO_LINUX_VGA16 is not set 76 + # CONFIG_LOGO_LINUX_CLUT224 is not set 77 + CONFIG_USB=y 78 + CONFIG_USB_EHCI_HCD=y 79 + # CONFIG_USB_EHCI_TT_NEWSCHED is not set 80 + CONFIG_USB_EHCI_HCD_PLATFORM=y 81 + CONFIG_USB_OHCI_HCD=y 82 + CONFIG_USB_OHCI_HCD_PLATFORM=y 83 + CONFIG_USB_STORAGE=y 84 + CONFIG_USB_SERIAL=y 85 + # CONFIG_IOMMU_SUPPORT is not set 86 + CONFIG_EXT3_FS=y 87 + CONFIG_EXT4_FS=y 88 + CONFIG_MSDOS_FS=y 89 + CONFIG_VFAT_FS=y 90 + CONFIG_NTFS_FS=y 91 + CONFIG_TMPFS=y 92 + CONFIG_JFFS2_FS=y 93 + CONFIG_NFS_FS=y 94 + CONFIG_NLS_CODEPAGE_437=y 95 + CONFIG_NLS_ISO8859_1=y 96 + # CONFIG_ENABLE_WARN_DEPRECATED is not set 97 + # CONFIG_ENABLE_MUST_CHECK is not set 98 + CONFIG_STRIP_ASM_SYMS=y 99 + CONFIG_DEBUG_SHIRQ=y 100 + CONFIG_LOCKUP_DETECTOR=y 101 + CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10 102 + # CONFIG_SCHED_DEBUG is not set 103 + # CONFIG_DEBUG_PREEMPT is not set 104 + # CONFIG_FTRACE is not set
-1
arch/arc/include/asm/Kbuild
··· 1 1 generic-y += auxvec.h 2 - generic-y += barrier.h 3 2 generic-y += bitsperlong.h 4 3 generic-y += bugs.h 5 4 generic-y += clkdev.h
+55 -11
arch/arc/include/asm/arcregs.h
··· 16 16 #define ARC_REG_PERIBASE_BCR 0x69 17 17 #define ARC_REG_FP_BCR 0x6B /* ARCompact: Single-Precision FPU */ 18 18 #define ARC_REG_DPFP_BCR 0x6C /* ARCompact: Dbl Precision FPU */ 19 + #define ARC_REG_FP_V2_BCR 0xc8 /* ARCv2 FPU */ 20 + #define ARC_REG_SLC_BCR 0xce 19 21 #define ARC_REG_DCCM_BCR 0x74 /* DCCM Present + SZ */ 20 22 #define ARC_REG_TIMERS_BCR 0x75 21 23 #define ARC_REG_AP_BCR 0x76 ··· 33 31 #define ARC_REG_BPU_BCR 0xc0 34 32 #define ARC_REG_ISA_CFG_BCR 0xc1 35 33 #define ARC_REG_RTT_BCR 0xF2 34 + #define ARC_REG_IRQ_BCR 0xF3 36 35 #define ARC_REG_SMART_BCR 0xFF 37 36 38 37 /* status32 Bits Positions */ ··· 54 51 * [15: 8] = Exception Cause Code 55 52 * [ 7: 0] = Exception Parameters (for certain types only) 56 53 */ 54 + #ifdef CONFIG_ISA_ARCOMPACT 57 55 #define ECR_V_MEM_ERR 0x01 58 56 #define ECR_V_INSN_ERR 0x02 59 57 #define ECR_V_MACH_CHK 0x20 ··· 62 58 #define ECR_V_DTLB_MISS 0x22 63 59 #define ECR_V_PROTV 0x23 64 60 #define ECR_V_TRAP 0x25 61 + #else 62 + #define ECR_V_MEM_ERR 0x01 63 + #define ECR_V_INSN_ERR 0x02 64 + #define ECR_V_MACH_CHK 0x03 65 + #define ECR_V_ITLB_MISS 0x04 66 + #define ECR_V_DTLB_MISS 0x05 67 + #define ECR_V_PROTV 0x06 68 + #define ECR_V_TRAP 0x09 69 + #endif 65 70 66 71 /* DTLB Miss and Protection Violation Cause Codes */ 67 72 ··· 89 76 #define ECR_C_BIT_DTLB_LD_MISS 8 90 77 #define ECR_C_BIT_DTLB_ST_MISS 9 91 78 92 - /* Dummy ECR values for Interrupts */ 93 - #define event_IRQ1 0x0031abcd 94 - #define event_IRQ2 0x0032abcd 95 79 96 80 /* Auxiliary registers */ 97 81 #define AUX_IDENTITY 4 ··· 214 204 215 205 struct bcr_isa { 216 206 #ifdef CONFIG_CPU_BIG_ENDIAN 217 - unsigned int pad1:23, atomic1:1, ver:8; 207 + unsigned int div_rem:4, pad2:4, ldd:1, unalign:1, atomic:1, be:1, 208 + pad1:11, atomic1:1, ver:8; 218 209 #else 219 - unsigned int ver:8, atomic1:1, pad1:23; 210 + unsigned int ver:8, atomic1:1, pad1:11, be:1, atomic:1, unalign:1, 211 + ldd:1, pad2:4, div_rem:4; 220 212 #endif 221 213 }; 222 214 ··· 281 269 #endif 282 270 }; 283 271 272 + struct bcr_fp_arcv2 { 273 + #ifdef CONFIG_CPU_BIG_ENDIAN 274 + unsigned int pad2:15, dp:1, pad1:7, sp:1, ver:8; 275 + #else 276 + unsigned int ver:8, sp:1, pad1:7, dp:1, pad2:15; 277 + #endif 278 + }; 279 + 284 280 struct bcr_timer { 285 281 #ifdef CONFIG_CPU_BIG_ENDIAN 286 - unsigned int pad2:15, rtsc:1, pad1:6, t1:1, t0:1, ver:8; 282 + unsigned int pad2:15, rtsc:1, pad1:5, rtc:1, t1:1, t0:1, ver:8; 287 283 #else 288 - unsigned int ver:8, t0:1, t1:1, pad1:6, rtsc:1, pad2:15; 284 + unsigned int ver:8, t0:1, t1:1, rtc:1, pad1:5, rtsc:1, pad2:15; 289 285 #endif 290 286 }; 291 287 ··· 302 282 unsigned int pad2:19, fam:1, pad:2, ent:2, ver:8; 303 283 #else 304 284 unsigned int ver:8, ent:2, pad:2, fam:1, pad2:19; 285 + #endif 286 + }; 287 + 288 + struct bcr_bpu_arcv2 { 289 + #ifdef CONFIG_CPU_BIG_ENDIAN 290 + unsigned int pad:6, fbe:2, tqe:2, ts:4, ft:1, rse:2, pte:3, bce:3, ver:8; 291 + #else 292 + unsigned int ver:8, bce:3, pte:3, rse:2, ft:1, ts:4, tqe:2, fbe:2, pad:6; 305 293 #endif 306 294 }; 307 295 ··· 327 299 */ 328 300 329 301 struct cpuinfo_arc_mmu { 330 - unsigned int ver, pg_sz, sets, ways, u_dtlb, u_itlb, num_tlb; 302 + unsigned int ver:4, pg_sz_k:8, s_pg_sz_m:8, u_dtlb:6, u_itlb:6; 303 + unsigned int num_tlb:16, sets:12, ways:4; 331 304 }; 332 305 333 306 struct cpuinfo_arc_cache { 334 - unsigned int sz_k:8, line_len:8, assoc:4, ver:4, alias:1, vipt:1, pad:6; 307 + unsigned int sz_k:14, line_len:8, assoc:4, ver:4, alias:1, vipt:1; 335 308 }; 336 309 337 310 struct cpuinfo_arc_bpu { ··· 344 315 }; 345 316 346 317 struct cpuinfo_arc { 347 - struct cpuinfo_arc_cache icache, dcache; 318 + struct cpuinfo_arc_cache icache, dcache, slc; 348 319 struct cpuinfo_arc_mmu mmu; 349 320 struct cpuinfo_arc_bpu bpu; 350 321 struct bcr_identity core; 351 322 struct bcr_isa isa; 352 323 struct bcr_timer timers; 353 324 unsigned int vec_base; 354 - unsigned int uncached_base; 355 325 struct cpuinfo_arc_ccm iccm, dccm; 356 326 struct { 357 327 unsigned int swap:1, norm:1, minmax:1, barrel:1, crc:1, pad1:3, ··· 363 335 }; 364 336 365 337 extern struct cpuinfo_arc cpuinfo_arc700[]; 338 + 339 + static inline int is_isa_arcv2(void) 340 + { 341 + return IS_ENABLED(CONFIG_ISA_ARCV2); 342 + } 343 + 344 + static inline int is_isa_arcompact(void) 345 + { 346 + return IS_ENABLED(CONFIG_ISA_ARCOMPACT); 347 + } 348 + 349 + #if defined(CONFIG_ISA_ARCOMPACT) && !defined(_CPU_DEFAULT_A7) 350 + #error "Toolchain not configured for ARCompact builds" 351 + #elif defined(CONFIG_ISA_ARCV2) && !defined(_CPU_DEFAULT_HS) 352 + #error "Toolchain not configured for ARCv2 builds" 353 + #endif 366 354 367 355 #endif /* __ASEMBLY__ */ 368 356
+33 -2
arch/arc/include/asm/atomic.h
··· 23 23 24 24 #define atomic_set(v, i) (((v)->counter) = (i)) 25 25 26 + #ifdef CONFIG_ISA_ARCV2 27 + #define PREFETCHW " prefetchw [%1] \n" 28 + #else 29 + #define PREFETCHW 30 + #endif 31 + 26 32 #define ATOMIC_OP(op, c_op, asm_op) \ 27 33 static inline void atomic_##op(int i, atomic_t *v) \ 28 34 { \ 29 35 unsigned int temp; \ 30 36 \ 31 37 __asm__ __volatile__( \ 32 - "1: llock %0, [%1] \n" \ 38 + "1: \n" \ 39 + PREFETCHW \ 40 + " llock %0, [%1] \n" \ 33 41 " " #asm_op " %0, %0, %2 \n" \ 34 42 " scond %0, [%1] \n" \ 35 43 " bnz 1b \n" \ ··· 51 43 { \ 52 44 unsigned int temp; \ 53 45 \ 46 + /* \ 47 + * Explicit full memory barrier needed before/after as \ 48 + * LLOCK/SCOND thmeselves don't provide any such semantics \ 49 + */ \ 50 + smp_mb(); \ 51 + \ 54 52 __asm__ __volatile__( \ 55 - "1: llock %0, [%1] \n" \ 53 + "1: \n" \ 54 + PREFETCHW \ 55 + " llock %0, [%1] \n" \ 56 56 " " #asm_op " %0, %0, %2 \n" \ 57 57 " scond %0, [%1] \n" \ 58 58 " bnz 1b \n" \ 59 59 : "=&r"(temp) \ 60 60 : "r"(&v->counter), "ir"(i) \ 61 61 : "cc"); \ 62 + \ 63 + smp_mb(); \ 62 64 \ 63 65 return temp; \ 64 66 } ··· 123 105 unsigned long flags; \ 124 106 unsigned long temp; \ 125 107 \ 108 + /* \ 109 + * spin lock/unlock provides the needed smp_mb() before/after \ 110 + */ \ 126 111 atomic_ops_lock(flags); \ 127 112 temp = v->counter; \ 128 113 temp c_op i; \ ··· 163 142 #define __atomic_add_unless(v, a, u) \ 164 143 ({ \ 165 144 int c, old; \ 145 + \ 146 + /* \ 147 + * Explicit full memory barrier needed before/after as \ 148 + * LLOCK/SCOND thmeselves don't provide any such semantics \ 149 + */ \ 150 + smp_mb(); \ 151 + \ 166 152 c = atomic_read(v); \ 167 153 while (c != (u) && (old = atomic_cmpxchg((v), c, c + (a))) != c)\ 168 154 c = old; \ 155 + \ 156 + smp_mb(); \ 157 + \ 169 158 c; \ 170 159 }) 171 160
+48
arch/arc/include/asm/barrier.h
··· 1 + /* 2 + * Copyright (C) 2014-15 Synopsys, Inc. (www.synopsys.com) 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License version 2 as 6 + * published by the Free Software Foundation. 7 + */ 8 + 9 + #ifndef __ASM_BARRIER_H 10 + #define __ASM_BARRIER_H 11 + 12 + #ifdef CONFIG_ISA_ARCV2 13 + 14 + /* 15 + * ARCv2 based HS38 cores are in-order issue, but still weakly ordered 16 + * due to micro-arch buffering/queuing of load/store, cache hit vs. miss ... 17 + * 18 + * Explicit barrier provided by DMB instruction 19 + * - Operand supports fine grained load/store/load+store semantics 20 + * - Ensures that selected memory operation issued before it will complete 21 + * before any subsequent memory operation of same type 22 + * - DMB guarantees SMP as well as local barrier semantics 23 + * (asm-generic/barrier.h ensures sane smp_*mb if not defined here, i.e. 24 + * UP: barrier(), SMP: smp_*mb == *mb) 25 + * - DSYNC provides DMB+completion_of_cache_bpu_maintenance_ops hence not needed 26 + * in the general case. Plus it only provides full barrier. 27 + */ 28 + 29 + #define mb() asm volatile("dmb 3\n" : : : "memory") 30 + #define rmb() asm volatile("dmb 1\n" : : : "memory") 31 + #define wmb() asm volatile("dmb 2\n" : : : "memory") 32 + 33 + #endif 34 + 35 + #ifdef CONFIG_ISA_ARCOMPACT 36 + 37 + /* 38 + * ARCompact based cores (ARC700) only have SYNC instruction which is super 39 + * heavy weight as it flushes the pipeline as well. 40 + * There are no real SMP implementations of such cores. 41 + */ 42 + 43 + #define mb() asm volatile("sync\n" : : : "memory") 44 + #endif 45 + 46 + #include <asm-generic/barrier.h> 47 + 48 + #endif
+214 -313
arch/arc/include/asm/bitops.h
··· 18 18 #include <linux/types.h> 19 19 #include <linux/compiler.h> 20 20 #include <asm/barrier.h> 21 + #ifndef CONFIG_ARC_HAS_LLSC 22 + #include <asm/smp.h> 23 + #endif 21 24 22 - /* 23 - * Hardware assisted read-modify-write using ARC700 LLOCK/SCOND insns. 24 - * The Kconfig glue ensures that in SMP, this is only set if the container 25 - * SoC/platform has cross-core coherent LLOCK/SCOND 26 - */ 27 25 #if defined(CONFIG_ARC_HAS_LLSC) 28 26 29 - static inline void set_bit(unsigned long nr, volatile unsigned long *m) 30 - { 31 - unsigned int temp; 27 + /* 28 + * Hardware assisted Atomic-R-M-W 29 + */ 32 30 33 - m += nr >> 5; 34 - 35 - /* 36 - * ARC ISA micro-optimization: 37 - * 38 - * Instructions dealing with bitpos only consider lower 5 bits (0-31) 39 - * e.g (x << 33) is handled like (x << 1) by ASL instruction 40 - * (mem pointer still needs adjustment to point to next word) 41 - * 42 - * Hence the masking to clamp @nr arg can be elided in general. 43 - * 44 - * However if @nr is a constant (above assumed it in a register), 45 - * and greater than 31, gcc can optimize away (x << 33) to 0, 46 - * as overflow, given the 32-bit ISA. Thus masking needs to be done 47 - * for constant @nr, but no code is generated due to const prop. 48 - */ 49 - if (__builtin_constant_p(nr)) 50 - nr &= 0x1f; 51 - 52 - __asm__ __volatile__( 53 - "1: llock %0, [%1] \n" 54 - " bset %0, %0, %2 \n" 55 - " scond %0, [%1] \n" 56 - " bnz 1b \n" 57 - : "=&r"(temp) 58 - : "r"(m), "ir"(nr) 59 - : "cc"); 60 - } 61 - 62 - static inline void clear_bit(unsigned long nr, volatile unsigned long *m) 63 - { 64 - unsigned int temp; 65 - 66 - m += nr >> 5; 67 - 68 - if (__builtin_constant_p(nr)) 69 - nr &= 0x1f; 70 - 71 - __asm__ __volatile__( 72 - "1: llock %0, [%1] \n" 73 - " bclr %0, %0, %2 \n" 74 - " scond %0, [%1] \n" 75 - " bnz 1b \n" 76 - : "=&r"(temp) 77 - : "r"(m), "ir"(nr) 78 - : "cc"); 79 - } 80 - 81 - static inline void change_bit(unsigned long nr, volatile unsigned long *m) 82 - { 83 - unsigned int temp; 84 - 85 - m += nr >> 5; 86 - 87 - if (__builtin_constant_p(nr)) 88 - nr &= 0x1f; 89 - 90 - __asm__ __volatile__( 91 - "1: llock %0, [%1] \n" 92 - " bxor %0, %0, %2 \n" 93 - " scond %0, [%1] \n" 94 - " bnz 1b \n" 95 - : "=&r"(temp) 96 - : "r"(m), "ir"(nr) 97 - : "cc"); 31 + #define BIT_OP(op, c_op, asm_op) \ 32 + static inline void op##_bit(unsigned long nr, volatile unsigned long *m)\ 33 + { \ 34 + unsigned int temp; \ 35 + \ 36 + m += nr >> 5; \ 37 + \ 38 + /* \ 39 + * ARC ISA micro-optimization: \ 40 + * \ 41 + * Instructions dealing with bitpos only consider lower 5 bits \ 42 + * e.g (x << 33) is handled like (x << 1) by ASL instruction \ 43 + * (mem pointer still needs adjustment to point to next word) \ 44 + * \ 45 + * Hence the masking to clamp @nr arg can be elided in general. \ 46 + * \ 47 + * However if @nr is a constant (above assumed in a register), \ 48 + * and greater than 31, gcc can optimize away (x << 33) to 0, \ 49 + * as overflow, given the 32-bit ISA. Thus masking needs to be \ 50 + * done for const @nr, but no code is generated due to gcc \ 51 + * const prop. \ 52 + */ \ 53 + if (__builtin_constant_p(nr)) \ 54 + nr &= 0x1f; \ 55 + \ 56 + __asm__ __volatile__( \ 57 + "1: llock %0, [%1] \n" \ 58 + " " #asm_op " %0, %0, %2 \n" \ 59 + " scond %0, [%1] \n" \ 60 + " bnz 1b \n" \ 61 + : "=&r"(temp) /* Early clobber, to prevent reg reuse */ \ 62 + : "r"(m), /* Not "m": llock only supports reg direct addr mode */ \ 63 + "ir"(nr) \ 64 + : "cc"); \ 98 65 } 99 66 100 67 /* ··· 75 108 * Since ARC lacks a equivalent h/w primitive, the bit is set unconditionally 76 109 * and the old value of bit is returned 77 110 */ 78 - static inline int test_and_set_bit(unsigned long nr, volatile unsigned long *m) 79 - { 80 - unsigned long old, temp; 81 - 82 - m += nr >> 5; 83 - 84 - if (__builtin_constant_p(nr)) 85 - nr &= 0x1f; 86 - 87 - __asm__ __volatile__( 88 - "1: llock %0, [%2] \n" 89 - " bset %1, %0, %3 \n" 90 - " scond %1, [%2] \n" 91 - " bnz 1b \n" 92 - : "=&r"(old), "=&r"(temp) 93 - : "r"(m), "ir"(nr) 94 - : "cc"); 95 - 96 - return (old & (1 << nr)) != 0; 97 - } 98 - 99 - static inline int 100 - test_and_clear_bit(unsigned long nr, volatile unsigned long *m) 101 - { 102 - unsigned int old, temp; 103 - 104 - m += nr >> 5; 105 - 106 - if (__builtin_constant_p(nr)) 107 - nr &= 0x1f; 108 - 109 - __asm__ __volatile__( 110 - "1: llock %0, [%2] \n" 111 - " bclr %1, %0, %3 \n" 112 - " scond %1, [%2] \n" 113 - " bnz 1b \n" 114 - : "=&r"(old), "=&r"(temp) 115 - : "r"(m), "ir"(nr) 116 - : "cc"); 117 - 118 - return (old & (1 << nr)) != 0; 119 - } 120 - 121 - static inline int 122 - test_and_change_bit(unsigned long nr, volatile unsigned long *m) 123 - { 124 - unsigned int old, temp; 125 - 126 - m += nr >> 5; 127 - 128 - if (__builtin_constant_p(nr)) 129 - nr &= 0x1f; 130 - 131 - __asm__ __volatile__( 132 - "1: llock %0, [%2] \n" 133 - " bxor %1, %0, %3 \n" 134 - " scond %1, [%2] \n" 135 - " bnz 1b \n" 136 - : "=&r"(old), "=&r"(temp) 137 - : "r"(m), "ir"(nr) 138 - : "cc"); 139 - 140 - return (old & (1 << nr)) != 0; 111 + #define TEST_N_BIT_OP(op, c_op, asm_op) \ 112 + static inline int test_and_##op##_bit(unsigned long nr, volatile unsigned long *m)\ 113 + { \ 114 + unsigned long old, temp; \ 115 + \ 116 + m += nr >> 5; \ 117 + \ 118 + if (__builtin_constant_p(nr)) \ 119 + nr &= 0x1f; \ 120 + \ 121 + /* \ 122 + * Explicit full memory barrier needed before/after as \ 123 + * LLOCK/SCOND themselves don't provide any such smenatic \ 124 + */ \ 125 + smp_mb(); \ 126 + \ 127 + __asm__ __volatile__( \ 128 + "1: llock %0, [%2] \n" \ 129 + " " #asm_op " %1, %0, %3 \n" \ 130 + " scond %1, [%2] \n" \ 131 + " bnz 1b \n" \ 132 + : "=&r"(old), "=&r"(temp) \ 133 + : "r"(m), "ir"(nr) \ 134 + : "cc"); \ 135 + \ 136 + smp_mb(); \ 137 + \ 138 + return (old & (1 << nr)) != 0; \ 141 139 } 142 140 143 141 #else /* !CONFIG_ARC_HAS_LLSC */ 144 - 145 - #include <asm/smp.h> 146 142 147 143 /* 148 144 * Non hardware assisted Atomic-R-M-W ··· 123 193 * at compile time) 124 194 */ 125 195 126 - static inline void set_bit(unsigned long nr, volatile unsigned long *m) 127 - { 128 - unsigned long temp, flags; 129 - m += nr >> 5; 130 - 131 - if (__builtin_constant_p(nr)) 132 - nr &= 0x1f; 133 - 134 - bitops_lock(flags); 135 - 136 - temp = *m; 137 - *m = temp | (1UL << nr); 138 - 139 - bitops_unlock(flags); 196 + #define BIT_OP(op, c_op, asm_op) \ 197 + static inline void op##_bit(unsigned long nr, volatile unsigned long *m)\ 198 + { \ 199 + unsigned long temp, flags; \ 200 + m += nr >> 5; \ 201 + \ 202 + if (__builtin_constant_p(nr)) \ 203 + nr &= 0x1f; \ 204 + \ 205 + /* \ 206 + * spin lock/unlock provide the needed smp_mb() before/after \ 207 + */ \ 208 + bitops_lock(flags); \ 209 + \ 210 + temp = *m; \ 211 + *m = temp c_op (1UL << nr); \ 212 + \ 213 + bitops_unlock(flags); \ 140 214 } 141 215 142 - static inline void clear_bit(unsigned long nr, volatile unsigned long *m) 143 - { 144 - unsigned long temp, flags; 145 - m += nr >> 5; 146 - 147 - if (__builtin_constant_p(nr)) 148 - nr &= 0x1f; 149 - 150 - bitops_lock(flags); 151 - 152 - temp = *m; 153 - *m = temp & ~(1UL << nr); 154 - 155 - bitops_unlock(flags); 156 - } 157 - 158 - static inline void change_bit(unsigned long nr, volatile unsigned long *m) 159 - { 160 - unsigned long temp, flags; 161 - m += nr >> 5; 162 - 163 - if (__builtin_constant_p(nr)) 164 - nr &= 0x1f; 165 - 166 - bitops_lock(flags); 167 - 168 - temp = *m; 169 - *m = temp ^ (1UL << nr); 170 - 171 - bitops_unlock(flags); 172 - } 173 - 174 - static inline int test_and_set_bit(unsigned long nr, volatile unsigned long *m) 175 - { 176 - unsigned long old, flags; 177 - m += nr >> 5; 178 - 179 - if (__builtin_constant_p(nr)) 180 - nr &= 0x1f; 181 - 182 - bitops_lock(flags); 183 - 184 - old = *m; 185 - *m = old | (1 << nr); 186 - 187 - bitops_unlock(flags); 188 - 189 - return (old & (1 << nr)) != 0; 190 - } 191 - 192 - static inline int 193 - test_and_clear_bit(unsigned long nr, volatile unsigned long *m) 194 - { 195 - unsigned long old, flags; 196 - m += nr >> 5; 197 - 198 - if (__builtin_constant_p(nr)) 199 - nr &= 0x1f; 200 - 201 - bitops_lock(flags); 202 - 203 - old = *m; 204 - *m = old & ~(1 << nr); 205 - 206 - bitops_unlock(flags); 207 - 208 - return (old & (1 << nr)) != 0; 209 - } 210 - 211 - static inline int 212 - test_and_change_bit(unsigned long nr, volatile unsigned long *m) 213 - { 214 - unsigned long old, flags; 215 - m += nr >> 5; 216 - 217 - if (__builtin_constant_p(nr)) 218 - nr &= 0x1f; 219 - 220 - bitops_lock(flags); 221 - 222 - old = *m; 223 - *m = old ^ (1 << nr); 224 - 225 - bitops_unlock(flags); 226 - 227 - return (old & (1 << nr)) != 0; 216 + #define TEST_N_BIT_OP(op, c_op, asm_op) \ 217 + static inline int test_and_##op##_bit(unsigned long nr, volatile unsigned long *m)\ 218 + { \ 219 + unsigned long old, flags; \ 220 + m += nr >> 5; \ 221 + \ 222 + if (__builtin_constant_p(nr)) \ 223 + nr &= 0x1f; \ 224 + \ 225 + bitops_lock(flags); \ 226 + \ 227 + old = *m; \ 228 + *m = old c_op (1 << nr); \ 229 + \ 230 + bitops_unlock(flags); \ 231 + \ 232 + return (old & (1 << nr)) != 0; \ 228 233 } 229 234 230 235 #endif /* CONFIG_ARC_HAS_LLSC */ ··· 168 303 * Non atomic variants 169 304 **************************************/ 170 305 171 - static inline void __set_bit(unsigned long nr, volatile unsigned long *m) 172 - { 173 - unsigned long temp; 174 - m += nr >> 5; 175 - 176 - if (__builtin_constant_p(nr)) 177 - nr &= 0x1f; 178 - 179 - temp = *m; 180 - *m = temp | (1UL << nr); 306 + #define __BIT_OP(op, c_op, asm_op) \ 307 + static inline void __##op##_bit(unsigned long nr, volatile unsigned long *m) \ 308 + { \ 309 + unsigned long temp; \ 310 + m += nr >> 5; \ 311 + \ 312 + if (__builtin_constant_p(nr)) \ 313 + nr &= 0x1f; \ 314 + \ 315 + temp = *m; \ 316 + *m = temp c_op (1UL << nr); \ 181 317 } 182 318 183 - static inline void __clear_bit(unsigned long nr, volatile unsigned long *m) 184 - { 185 - unsigned long temp; 186 - m += nr >> 5; 187 - 188 - if (__builtin_constant_p(nr)) 189 - nr &= 0x1f; 190 - 191 - temp = *m; 192 - *m = temp & ~(1UL << nr); 319 + #define __TEST_N_BIT_OP(op, c_op, asm_op) \ 320 + static inline int __test_and_##op##_bit(unsigned long nr, volatile unsigned long *m)\ 321 + { \ 322 + unsigned long old; \ 323 + m += nr >> 5; \ 324 + \ 325 + if (__builtin_constant_p(nr)) \ 326 + nr &= 0x1f; \ 327 + \ 328 + old = *m; \ 329 + *m = old c_op (1 << nr); \ 330 + \ 331 + return (old & (1 << nr)) != 0; \ 193 332 } 194 333 195 - static inline void __change_bit(unsigned long nr, volatile unsigned long *m) 196 - { 197 - unsigned long temp; 198 - m += nr >> 5; 334 + #define BIT_OPS(op, c_op, asm_op) \ 335 + \ 336 + /* set_bit(), clear_bit(), change_bit() */ \ 337 + BIT_OP(op, c_op, asm_op) \ 338 + \ 339 + /* test_and_set_bit(), test_and_clear_bit(), test_and_change_bit() */\ 340 + TEST_N_BIT_OP(op, c_op, asm_op) \ 341 + \ 342 + /* __set_bit(), __clear_bit(), __change_bit() */ \ 343 + __BIT_OP(op, c_op, asm_op) \ 344 + \ 345 + /* __test_and_set_bit(), __test_and_clear_bit(), __test_and_change_bit() */\ 346 + __TEST_N_BIT_OP(op, c_op, asm_op) 199 347 200 - if (__builtin_constant_p(nr)) 201 - nr &= 0x1f; 202 - 203 - temp = *m; 204 - *m = temp ^ (1UL << nr); 205 - } 206 - 207 - static inline int 208 - __test_and_set_bit(unsigned long nr, volatile unsigned long *m) 209 - { 210 - unsigned long old; 211 - m += nr >> 5; 212 - 213 - if (__builtin_constant_p(nr)) 214 - nr &= 0x1f; 215 - 216 - old = *m; 217 - *m = old | (1 << nr); 218 - 219 - return (old & (1 << nr)) != 0; 220 - } 221 - 222 - static inline int 223 - __test_and_clear_bit(unsigned long nr, volatile unsigned long *m) 224 - { 225 - unsigned long old; 226 - m += nr >> 5; 227 - 228 - if (__builtin_constant_p(nr)) 229 - nr &= 0x1f; 230 - 231 - old = *m; 232 - *m = old & ~(1 << nr); 233 - 234 - return (old & (1 << nr)) != 0; 235 - } 236 - 237 - static inline int 238 - __test_and_change_bit(unsigned long nr, volatile unsigned long *m) 239 - { 240 - unsigned long old; 241 - m += nr >> 5; 242 - 243 - if (__builtin_constant_p(nr)) 244 - nr &= 0x1f; 245 - 246 - old = *m; 247 - *m = old ^ (1 << nr); 248 - 249 - return (old & (1 << nr)) != 0; 250 - } 348 + BIT_OPS(set, |, bset) 349 + BIT_OPS(clear, & ~, bclr) 350 + BIT_OPS(change, ^, bxor) 251 351 252 352 /* 253 353 * This routine doesn't need to be atomic. ··· 231 401 232 402 return ((mask & *addr) != 0); 233 403 } 404 + 405 + #ifdef CONFIG_ISA_ARCOMPACT 234 406 235 407 /* 236 408 * Count the number of zeros, starting from MSB ··· 325 493 326 494 return ffs(word) - 1; 327 495 } 496 + 497 + #else /* CONFIG_ISA_ARCV2 */ 498 + 499 + /* 500 + * fls = Find Last Set in word 501 + * @result: [1-32] 502 + * fls(1) = 1, fls(0x80000000) = 32, fls(0) = 0 503 + */ 504 + static inline __attribute__ ((const)) int fls(unsigned long x) 505 + { 506 + int n; 507 + 508 + asm volatile( 509 + " fls.f %0, %1 \n" /* 0:31; 0(Z) if src 0 */ 510 + " add.nz %0, %0, 1 \n" /* 0:31 -> 1:32 */ 511 + : "=r"(n) /* Early clobber not needed */ 512 + : "r"(x) 513 + : "cc"); 514 + 515 + return n; 516 + } 517 + 518 + /* 519 + * __fls: Similar to fls, but zero based (0-31). Also 0 if no bit set 520 + */ 521 + static inline __attribute__ ((const)) int __fls(unsigned long x) 522 + { 523 + /* FLS insn has exactly same semantics as the API */ 524 + return __builtin_arc_fls(x); 525 + } 526 + 527 + /* 528 + * ffs = Find First Set in word (LSB to MSB) 529 + * @result: [1-32], 0 if all 0's 530 + */ 531 + static inline __attribute__ ((const)) int ffs(unsigned long x) 532 + { 533 + int n; 534 + 535 + asm volatile( 536 + " ffs.f %0, %1 \n" /* 0:31; 31(Z) if src 0 */ 537 + " add.nz %0, %0, 1 \n" /* 0:31 -> 1:32 */ 538 + " mov.z %0, 0 \n" /* 31(Z)-> 0 */ 539 + : "=r"(n) /* Early clobber not needed */ 540 + : "r"(x) 541 + : "cc"); 542 + 543 + return n; 544 + } 545 + 546 + /* 547 + * __ffs: Similar to ffs, but zero based (0-31) 548 + */ 549 + static inline __attribute__ ((const)) int __ffs(unsigned long x) 550 + { 551 + int n; 552 + 553 + asm volatile( 554 + " ffs.f %0, %1 \n" /* 0:31; 31(Z) if src 0 */ 555 + " mov.z %0, 0 \n" /* 31(Z)-> 0 */ 556 + : "=r"(n) 557 + : "r"(x) 558 + : "cc"); 559 + 560 + return n; 561 + 562 + } 563 + 564 + #endif /* CONFIG_ISA_ARCOMPACT */ 328 565 329 566 /* 330 567 * ffz = Find First Zero in word.
+15 -3
arch/arc/include/asm/cache.h
··· 60 60 #define ARC_REG_IC_IVIC 0x10 61 61 #define ARC_REG_IC_CTRL 0x11 62 62 #define ARC_REG_IC_IVIL 0x19 63 - #if defined(CONFIG_ARC_MMU_V3) 63 + #if defined(CONFIG_ARC_MMU_V3) || defined(CONFIG_ARC_MMU_V4) 64 64 #define ARC_REG_IC_PTAG 0x1E 65 65 #endif 66 66 ··· 74 74 #define ARC_REG_DC_IVDL 0x4A 75 75 #define ARC_REG_DC_FLSH 0x4B 76 76 #define ARC_REG_DC_FLDL 0x4C 77 - #if defined(CONFIG_ARC_MMU_V3) 78 77 #define ARC_REG_DC_PTAG 0x5C 79 - #endif 80 78 81 79 /* Bit val in DC_CTRL */ 82 80 #define DC_CTRL_INV_MODE_FLUSH 0x40 83 81 #define DC_CTRL_FLUSH_STATUS 0x100 82 + 83 + /*System-level cache (L2 cache) related Auxiliary registers */ 84 + #define ARC_REG_SLC_CFG 0x901 85 + #define ARC_REG_SLC_CTRL 0x903 86 + #define ARC_REG_SLC_FLUSH 0x904 87 + #define ARC_REG_SLC_INVALIDATE 0x905 88 + #define ARC_REG_SLC_RGN_START 0x914 89 + #define ARC_REG_SLC_RGN_END 0x916 90 + 91 + /* Bit val in SLC_CONTROL */ 92 + #define SLC_CTRL_IM 0x040 93 + #define SLC_CTRL_DISABLE 0x001 94 + #define SLC_CTRL_BUSY 0x100 95 + #define SLC_CTRL_RGN_OP_INV 0x200 84 96 85 97 #endif /* _ASM_CACHE_H */
+1 -3
arch/arc/include/asm/cacheflush.h
··· 34 34 void flush_icache_range(unsigned long start, unsigned long end); 35 35 void __sync_icache_dcache(unsigned long paddr, unsigned long vaddr, int len); 36 36 void __inv_icache_page(unsigned long paddr, unsigned long vaddr); 37 - void ___flush_dcache_page(unsigned long paddr, unsigned long vaddr); 38 - #define __flush_dcache_page(p, v) \ 39 - ___flush_dcache_page((unsigned long)p, (unsigned long)v) 37 + void __flush_dcache_page(unsigned long paddr, unsigned long vaddr); 40 38 41 39 #define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 42 40
+22 -4
arch/arc/include/asm/cmpxchg.h
··· 10 10 #define __ASM_ARC_CMPXCHG_H 11 11 12 12 #include <linux/types.h> 13 + 14 + #include <asm/barrier.h> 13 15 #include <asm/smp.h> 14 16 15 17 #ifdef CONFIG_ARC_HAS_LLSC ··· 21 19 { 22 20 unsigned long prev; 23 21 22 + /* 23 + * Explicit full memory barrier needed before/after as 24 + * LLOCK/SCOND thmeselves don't provide any such semantics 25 + */ 26 + smp_mb(); 27 + 24 28 __asm__ __volatile__( 25 29 "1: llock %0, [%1] \n" 26 30 " brne %0, %2, 2f \n" 27 31 " scond %3, [%1] \n" 28 32 " bnz 1b \n" 29 33 "2: \n" 30 - : "=&r"(prev) 31 - : "r"(ptr), "ir"(expected), 32 - "r"(new) /* can't be "ir". scond can't take limm for "b" */ 33 - : "cc"); 34 + : "=&r"(prev) /* Early clobber, to prevent reg reuse */ 35 + : "r"(ptr), /* Not "m": llock only supports reg direct addr mode */ 36 + "ir"(expected), 37 + "r"(new) /* can't be "ir". scond can't take LIMM for "b" */ 38 + : "cc", "memory"); /* so that gcc knows memory is being written here */ 39 + 40 + smp_mb(); 34 41 35 42 return prev; 36 43 } ··· 53 42 int prev; 54 43 volatile unsigned long *p = ptr; 55 44 45 + /* 46 + * spin lock/unlock provide the needed smp_mb() before/after 47 + */ 56 48 atomic_ops_lock(flags); 57 49 prev = *p; 58 50 if (prev == expected) ··· 91 77 92 78 switch (size) { 93 79 case 4: 80 + smp_mb(); 81 + 94 82 __asm__ __volatile__( 95 83 " ex %0, [%1] \n" 96 84 : "+r"(val) 97 85 : "r"(ptr) 98 86 : "memory"); 87 + 88 + smp_mb(); 99 89 100 90 return val; 101 91 }
+4 -5
arch/arc/include/asm/delay.h
··· 22 22 static inline void __delay(unsigned long loops) 23 23 { 24 24 __asm__ __volatile__( 25 - "1: sub.f %0, %0, 1 \n" 26 - " jpnz 1b \n" 27 - : "+r"(loops) 28 - : 29 - : "cc"); 25 + " lp 1f \n" 26 + " nop \n" 27 + "1: \n" 28 + : "+l"(loops)); 30 29 } 31 30 32 31 extern void __bad_udelay(void);
+5 -26
arch/arc/include/asm/dma-mapping.h
··· 14 14 #include <asm-generic/dma-coherent.h> 15 15 #include <asm/cacheflush.h> 16 16 17 - #ifndef CONFIG_ARC_PLAT_NEEDS_CPU_TO_DMA 18 - /* 19 - * dma_map_* API take cpu addresses, which is kernel logical address in the 20 - * untranslated address space (0x8000_0000) based. The dma address (bus addr) 21 - * ideally needs to be 0x0000_0000 based hence these glue routines. 22 - * However given that intermediate bus bridges can ignore the high bit, we can 23 - * do with these routines being no-ops. 24 - * If a platform/device comes up which sriclty requires 0 based bus addr 25 - * (e.g. AHB-PCI bridge on Angel4 board), then it can provide it's own versions 26 - */ 27 - #define plat_dma_addr_to_kernel(dev, addr) ((unsigned long)(addr)) 28 - #define plat_kernel_addr_to_dma(dev, ptr) ((dma_addr_t)(ptr)) 29 - 30 - #else 31 - #include <plat/dma_addr.h> 32 - #endif 33 - 34 17 void *dma_alloc_noncoherent(struct device *dev, size_t size, 35 18 dma_addr_t *dma_handle, gfp_t gfp); 36 19 ··· 77 94 enum dma_data_direction dir) 78 95 { 79 96 _dma_cache_sync((unsigned long)cpu_addr, size, dir); 80 - return plat_kernel_addr_to_dma(dev, cpu_addr); 97 + return (dma_addr_t)cpu_addr; 81 98 } 82 99 83 100 static inline void ··· 130 147 dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, 131 148 size_t size, enum dma_data_direction dir) 132 149 { 133 - _dma_cache_sync(plat_dma_addr_to_kernel(dev, dma_handle), size, 134 - DMA_FROM_DEVICE); 150 + _dma_cache_sync(dma_handle, size, DMA_FROM_DEVICE); 135 151 } 136 152 137 153 static inline void 138 154 dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, 139 155 size_t size, enum dma_data_direction dir) 140 156 { 141 - _dma_cache_sync(plat_dma_addr_to_kernel(dev, dma_handle), size, 142 - DMA_TO_DEVICE); 157 + _dma_cache_sync(dma_handle, size, DMA_TO_DEVICE); 143 158 } 144 159 145 160 static inline void ··· 145 164 unsigned long offset, size_t size, 146 165 enum dma_data_direction direction) 147 166 { 148 - _dma_cache_sync(plat_dma_addr_to_kernel(dev, dma_handle) + offset, 149 - size, DMA_FROM_DEVICE); 167 + _dma_cache_sync(dma_handle + offset, size, DMA_FROM_DEVICE); 150 168 } 151 169 152 170 static inline void ··· 153 173 unsigned long offset, size_t size, 154 174 enum dma_data_direction direction) 155 175 { 156 - _dma_cache_sync(plat_dma_addr_to_kernel(dev, dma_handle) + offset, 157 - size, DMA_TO_DEVICE); 176 + _dma_cache_sync(dma_handle + offset, size, DMA_TO_DEVICE); 158 177 } 159 178 160 179 static inline void
+5
arch/arc/include/asm/elf.h
··· 15 15 /* These ELF defines belong to uapi but libc elf.h already defines them */ 16 16 #define EM_ARCOMPACT 93 17 17 18 + #define EM_ARCV2 195 /* ARCv2 Cores */ 19 + 20 + #define EM_ARC_INUSE (IS_ENABLED(CONFIG_ISA_ARCOMPACT) ? \ 21 + EM_ARCOMPACT : EM_ARCV2) 22 + 18 23 /* ARC Relocations (kernel Modules only) */ 19 24 #define R_ARC_32 0x4 20 25 #define R_ARC_32_ME 0x1B
+190
arch/arc/include/asm/entry-arcv2.h
··· 1 + 2 + #ifndef __ASM_ARC_ENTRY_ARCV2_H 3 + #define __ASM_ARC_ENTRY_ARCV2_H 4 + 5 + #include <asm/asm-offsets.h> 6 + #include <asm/irqflags-arcv2.h> 7 + #include <asm/thread_info.h> /* For THREAD_SIZE */ 8 + 9 + /*------------------------------------------------------------------------*/ 10 + .macro INTERRUPT_PROLOGUE called_from 11 + 12 + ; Before jumping to Interrupt Vector, hardware micro-ops did following: 13 + ; 1. SP auto-switched to kernel mode stack 14 + ; 2. STATUS32.Z flag set to U mode at time of interrupt (U:1, K:0) 15 + ; 3. Auto saved: r0-r11, blink, LPE,LPS,LPC, JLI,LDI,EI, PC, STAT32 16 + ; 17 + ; Now manually save: r12, sp, fp, gp, r25 18 + 19 + PUSH r12 20 + 21 + ; Saving pt_regs->sp correctly requires some extra work due to the way 22 + ; Auto stack switch works 23 + ; - U mode: retrieve it from AUX_USER_SP 24 + ; - K mode: add the offset from current SP where H/w starts auto push 25 + ; 26 + ; Utilize the fact that Z bit is set if Intr taken in U mode 27 + mov.nz r9, sp 28 + add.nz r9, r9, SZ_PT_REGS - PT_sp - 4 29 + bnz 1f 30 + 31 + lr r9, [AUX_USER_SP] 32 + 1: 33 + PUSH r9 ; SP 34 + 35 + PUSH fp 36 + PUSH gp 37 + 38 + #ifdef CONFIG_ARC_CURR_IN_REG 39 + PUSH r25 ; user_r25 40 + GET_CURR_TASK_ON_CPU r25 41 + #else 42 + sub sp, sp, 4 43 + #endif 44 + 45 + .ifnc \called_from, exception 46 + sub sp, sp, 12 ; BTA/ECR/orig_r0 placeholder per pt_regs 47 + .endif 48 + 49 + .endm 50 + 51 + /*------------------------------------------------------------------------*/ 52 + .macro INTERRUPT_EPILOGUE called_from 53 + 54 + .ifnc \called_from, exception 55 + add sp, sp, 12 ; skip BTA/ECR/orig_r0 placeholderss 56 + .endif 57 + 58 + #ifdef CONFIG_ARC_CURR_IN_REG 59 + POP r25 60 + #else 61 + add sp, sp, 4 62 + #endif 63 + 64 + POP gp 65 + POP fp 66 + 67 + ; Don't touch AUX_USER_SP if returning to K mode (Z bit set) 68 + ; (Z bit set on K mode is inverse of INTERRUPT_PROLOGUE) 69 + add.z sp, sp, 4 70 + bz 1f 71 + 72 + POPAX AUX_USER_SP 73 + 1: 74 + POP r12 75 + 76 + .endm 77 + 78 + /*------------------------------------------------------------------------*/ 79 + .macro EXCEPTION_PROLOGUE 80 + 81 + ; Before jumping to Exception Vector, hardware micro-ops did following: 82 + ; 1. SP auto-switched to kernel mode stack 83 + ; 2. STATUS32.Z flag set to U mode at time of interrupt (U:1,K:0) 84 + ; 85 + ; Now manually save the complete reg file 86 + 87 + PUSH r9 ; freeup a register: slot of erstatus 88 + 89 + PUSHAX eret 90 + sub sp, sp, 12 ; skip JLI, LDI, EI 91 + PUSH lp_count 92 + PUSHAX lp_start 93 + PUSHAX lp_end 94 + PUSH blink 95 + 96 + PUSH r11 97 + PUSH r10 98 + 99 + ld.as r9, [sp, 10] ; load stashed r9 (status32 stack slot) 100 + lr r10, [erstatus] 101 + st.as r10, [sp, 10] ; save status32 at it's right stack slot 102 + 103 + PUSH r9 104 + PUSH r8 105 + PUSH r7 106 + PUSH r6 107 + PUSH r5 108 + PUSH r4 109 + PUSH r3 110 + PUSH r2 111 + PUSH r1 112 + PUSH r0 113 + 114 + ; -- for interrupts, regs above are auto-saved by h/w in that order -- 115 + ; Now do what ISR prologue does (manually save r12, sp, fp, gp, r25) 116 + ; 117 + ; Set Z flag if this was from U mode (expected by INTERRUPT_PROLOGUE) 118 + ; Although H/w exception micro-ops do set Z flag for U mode (just like 119 + ; for interrupts), it could get clobbered in case we soft land here from 120 + ; a TLB Miss exception handler (tlbex.S) 121 + 122 + and r10, r10, STATUS_U_MASK 123 + xor.f 0, r10, STATUS_U_MASK 124 + 125 + INTERRUPT_PROLOGUE exception 126 + 127 + PUSHAX erbta 128 + PUSHAX ecr ; r9 contains ECR, expected by EV_Trap 129 + 130 + PUSH r0 ; orig_r0 131 + .endm 132 + 133 + /*------------------------------------------------------------------------*/ 134 + .macro EXCEPTION_EPILOGUE 135 + 136 + ; Assumes r0 has PT_status32 137 + btst r0, STATUS_U_BIT ; Z flag set if K, used in INTERRUPT_EPILOGUE 138 + 139 + add sp, sp, 8 ; orig_r0/ECR don't need restoring 140 + POPAX erbta 141 + 142 + INTERRUPT_EPILOGUE exception 143 + 144 + POP r0 145 + POP r1 146 + POP r2 147 + POP r3 148 + POP r4 149 + POP r5 150 + POP r6 151 + POP r7 152 + POP r8 153 + POP r9 154 + POP r10 155 + POP r11 156 + 157 + POP blink 158 + POPAX lp_end 159 + POPAX lp_start 160 + 161 + POP r9 162 + mov lp_count, r9 163 + 164 + add sp, sp, 12 ; skip JLI, LDI, EI 165 + POPAX eret 166 + POPAX erstatus 167 + 168 + ld.as r9, [sp, -12] ; reload r9 which got clobbered 169 + .endm 170 + 171 + .macro FAKE_RET_FROM_EXCPN 172 + lr r9, [status32] 173 + bic r9, r9, (STATUS_U_MASK|STATUS_DE_MASK|STATUS_AE_MASK) 174 + or r9, r9, (STATUS_L_MASK|STATUS_IE_MASK) 175 + kflag r9 176 + .endm 177 + 178 + /* Get thread_info of "current" tsk */ 179 + .macro GET_CURR_THR_INFO_FROM_SP reg 180 + bmskn \reg, sp, THREAD_SHIFT - 1 181 + .endm 182 + 183 + /* Get CPU-ID of this core */ 184 + .macro GET_CPU_ID reg 185 + lr \reg, [identity] 186 + xbfu \reg, \reg, 0xE8 /* 00111 01000 */ 187 + /* M = 8-1 N = 8 */ 188 + .endm 189 + 190 + #endif
+307
arch/arc/include/asm/entry-compact.h
··· 1 + /* 2 + * Copyright (C) 2014-15 Synopsys, Inc. (www.synopsys.com) 3 + * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com) 4 + * 5 + * This program is free software; you can redistribute it and/or modify 6 + * it under the terms of the GNU General Public License version 2 as 7 + * published by the Free Software Foundation. 8 + * 9 + * Vineetg: March 2009 (Supporting 2 levels of Interrupts) 10 + * Stack switching code can no longer reliably rely on the fact that 11 + * if we are NOT in user mode, stack is switched to kernel mode. 12 + * e.g. L2 IRQ interrupted a L1 ISR which had not yet completed 13 + * it's prologue including stack switching from user mode 14 + * 15 + * Vineetg: Aug 28th 2008: Bug #94984 16 + * -Zero Overhead Loop Context shd be cleared when entering IRQ/EXcp/Trap 17 + * Normally CPU does this automatically, however when doing FAKE rtie, 18 + * we also need to explicitly do this. The problem in macros 19 + * FAKE_RET_FROM_EXCPN and FAKE_RET_FROM_EXCPN_LOCK_IRQ was that this bit 20 + * was being "CLEARED" rather then "SET". Actually "SET" clears ZOL context 21 + * 22 + * Vineetg: May 5th 2008 23 + * -Modified CALLEE_REG save/restore macros to handle the fact that 24 + * r25 contains the kernel current task ptr 25 + * - Defined Stack Switching Macro to be reused in all intr/excp hdlrs 26 + * - Shaved off 11 instructions from RESTORE_ALL_INT1 by using the 27 + * address Write back load ld.ab instead of seperate ld/add instn 28 + * 29 + * Amit Bhor, Sameer Dhavale: Codito Technologies 2004 30 + */ 31 + 32 + #ifndef __ASM_ARC_ENTRY_COMPACT_H 33 + #define __ASM_ARC_ENTRY_COMPACT_H 34 + 35 + #include <asm/asm-offsets.h> 36 + #include <asm/irqflags-compact.h> 37 + #include <asm/thread_info.h> /* For THREAD_SIZE */ 38 + 39 + /*-------------------------------------------------------------- 40 + * Switch to Kernel Mode stack if SP points to User Mode stack 41 + * 42 + * Entry : r9 contains pre-IRQ/exception/trap status32 43 + * Exit : SP set to K mode stack 44 + * SP at the time of entry (K/U) saved @ pt_regs->sp 45 + * Clobbers: r9 46 + *-------------------------------------------------------------*/ 47 + 48 + .macro SWITCH_TO_KERNEL_STK 49 + 50 + /* User Mode when this happened ? Yes: Proceed to switch stack */ 51 + bbit1 r9, STATUS_U_BIT, 88f 52 + 53 + /* OK we were already in kernel mode when this event happened, thus can 54 + * assume SP is kernel mode SP. _NO_ need to do any stack switching 55 + */ 56 + 57 + #ifdef CONFIG_ARC_COMPACT_IRQ_LEVELS 58 + /* However.... 59 + * If Level 2 Interrupts enabled, we may end up with a corner case: 60 + * 1. User Task executing 61 + * 2. L1 IRQ taken, ISR starts (CPU auto-switched to KERNEL mode) 62 + * 3. But before it could switch SP from USER to KERNEL stack 63 + * a L2 IRQ "Interrupts" L1 64 + * Thay way although L2 IRQ happened in Kernel mode, stack is still 65 + * not switched. 66 + * To handle this, we may need to switch stack even if in kernel mode 67 + * provided SP has values in range of USER mode stack ( < 0x7000_0000 ) 68 + */ 69 + brlo sp, VMALLOC_START, 88f 70 + 71 + /* TODO: vineetg: 72 + * We need to be a bit more cautious here. What if a kernel bug in 73 + * L1 ISR, caused SP to go whaco (some small value which looks like 74 + * USER stk) and then we take L2 ISR. 75 + * Above brlo alone would treat it as a valid L1-L2 sceanrio 76 + * instead of shouting alound 77 + * The only feasible way is to make sure this L2 happened in 78 + * L1 prelogue ONLY i.e. ilink2 is less than a pre-set marker in 79 + * L1 ISR before it switches stack 80 + */ 81 + 82 + #endif 83 + 84 + /*------Intr/Ecxp happened in kernel mode, SP already setup ------ */ 85 + /* save it nevertheless @ pt_regs->sp for uniformity */ 86 + 87 + b.d 66f 88 + st sp, [sp, PT_sp - SZ_PT_REGS] 89 + 90 + 88: /*------Intr/Ecxp happened in user mode, "switch" stack ------ */ 91 + 92 + GET_CURR_TASK_ON_CPU r9 93 + 94 + /* With current tsk in r9, get it's kernel mode stack base */ 95 + GET_TSK_STACK_BASE r9, r9 96 + 97 + /* save U mode SP @ pt_regs->sp */ 98 + st sp, [r9, PT_sp - SZ_PT_REGS] 99 + 100 + /* final SP switch */ 101 + mov sp, r9 102 + 66: 103 + .endm 104 + 105 + /*------------------------------------------------------------ 106 + * "FAKE" a rtie to return from CPU Exception context 107 + * This is to re-enable Exceptions within exception 108 + * Look at EV_ProtV to see how this is actually used 109 + *-------------------------------------------------------------*/ 110 + 111 + .macro FAKE_RET_FROM_EXCPN 112 + 113 + ld r9, [sp, PT_status32] 114 + bic r9, r9, (STATUS_U_MASK|STATUS_DE_MASK) 115 + bset r9, r9, STATUS_L_BIT 116 + sr r9, [erstatus] 117 + mov r9, 55f 118 + sr r9, [eret] 119 + 120 + rtie 121 + 55: 122 + .endm 123 + 124 + /*-------------------------------------------------------------- 125 + * For early Exception/ISR Prologue, a core reg is temporarily needed to 126 + * code the rest of prolog (stack switching). This is done by stashing 127 + * it to memory (non-SMP case) or SCRATCH0 Aux Reg (SMP). 128 + * 129 + * Before saving the full regfile - this reg is restored back, only 130 + * to be saved again on kernel mode stack, as part of pt_regs. 131 + *-------------------------------------------------------------*/ 132 + .macro PROLOG_FREEUP_REG reg, mem 133 + #ifdef CONFIG_SMP 134 + sr \reg, [ARC_REG_SCRATCH_DATA0] 135 + #else 136 + st \reg, [\mem] 137 + #endif 138 + .endm 139 + 140 + .macro PROLOG_RESTORE_REG reg, mem 141 + #ifdef CONFIG_SMP 142 + lr \reg, [ARC_REG_SCRATCH_DATA0] 143 + #else 144 + ld \reg, [\mem] 145 + #endif 146 + .endm 147 + 148 + /*-------------------------------------------------------------- 149 + * Exception Entry prologue 150 + * -Switches stack to K mode (if not already) 151 + * -Saves the register file 152 + * 153 + * After this it is safe to call the "C" handlers 154 + *-------------------------------------------------------------*/ 155 + .macro EXCEPTION_PROLOGUE 156 + 157 + /* Need at least 1 reg to code the early exception prologue */ 158 + PROLOG_FREEUP_REG r9, @ex_saved_reg1 159 + 160 + /* U/K mode at time of exception (stack not switched if already K) */ 161 + lr r9, [erstatus] 162 + 163 + /* ARC700 doesn't provide auto-stack switching */ 164 + SWITCH_TO_KERNEL_STK 165 + 166 + #ifdef CONFIG_ARC_CURR_IN_REG 167 + /* Treat r25 as scratch reg (save on stack) and load with "current" */ 168 + PUSH r25 169 + GET_CURR_TASK_ON_CPU r25 170 + #else 171 + sub sp, sp, 4 172 + #endif 173 + 174 + st.a r0, [sp, -8] /* orig_r0 needed for syscall (skip ECR slot) */ 175 + sub sp, sp, 4 /* skip pt_regs->sp, already saved above */ 176 + 177 + /* Restore r9 used to code the early prologue */ 178 + PROLOG_RESTORE_REG r9, @ex_saved_reg1 179 + 180 + /* now we are ready to save the regfile */ 181 + SAVE_R0_TO_R12 182 + PUSH gp 183 + PUSH fp 184 + PUSH blink 185 + PUSHAX eret 186 + PUSHAX erstatus 187 + PUSH lp_count 188 + PUSHAX lp_end 189 + PUSHAX lp_start 190 + PUSHAX erbta 191 + 192 + lr r9, [ecr] 193 + st r9, [sp, PT_event] /* EV_Trap expects r9 to have ECR */ 194 + .endm 195 + 196 + /*-------------------------------------------------------------- 197 + * Restore all registers used by system call or Exceptions 198 + * SP should always be pointing to the next free stack element 199 + * when entering this macro. 200 + * 201 + * NOTE: 202 + * 203 + * It is recommended that lp_count/ilink1/ilink2 not be used as a dest reg 204 + * for memory load operations. If used in that way interrupts are deffered 205 + * by hardware and that is not good. 206 + *-------------------------------------------------------------*/ 207 + .macro EXCEPTION_EPILOGUE 208 + POPAX erbta 209 + POPAX lp_start 210 + POPAX lp_end 211 + 212 + POP r9 213 + mov lp_count, r9 ;LD to lp_count is not allowed 214 + 215 + POPAX erstatus 216 + POPAX eret 217 + POP blink 218 + POP fp 219 + POP gp 220 + RESTORE_R12_TO_R0 221 + 222 + ld sp, [sp] /* restore original sp */ 223 + /* orig_r0, ECR, user_r25 skipped automatically */ 224 + .endm 225 + 226 + /* Dummy ECR values for Interrupts */ 227 + #define event_IRQ1 0x0031abcd 228 + #define event_IRQ2 0x0032abcd 229 + 230 + .macro INTERRUPT_PROLOGUE LVL 231 + 232 + /* free up r9 as scratchpad */ 233 + PROLOG_FREEUP_REG r9, @int\LVL\()_saved_reg 234 + 235 + /* Which mode (user/kernel) was the system in when intr occured */ 236 + lr r9, [status32_l\LVL\()] 237 + 238 + SWITCH_TO_KERNEL_STK 239 + 240 + #ifdef CONFIG_ARC_CURR_IN_REG 241 + /* Treat r25 as scratch reg (save on stack) and load with "current" */ 242 + PUSH r25 243 + GET_CURR_TASK_ON_CPU r25 244 + #else 245 + sub sp, sp, 4 246 + #endif 247 + 248 + PUSH 0x003\LVL\()abcd /* Dummy ECR */ 249 + sub sp, sp, 8 /* skip orig_r0 (not needed) 250 + skip pt_regs->sp, already saved above */ 251 + 252 + /* Restore r9 used to code the early prologue */ 253 + PROLOG_RESTORE_REG r9, @int\LVL\()_saved_reg 254 + 255 + SAVE_R0_TO_R12 256 + PUSH gp 257 + PUSH fp 258 + PUSH blink 259 + PUSH ilink\LVL\() 260 + PUSHAX status32_l\LVL\() 261 + PUSH lp_count 262 + PUSHAX lp_end 263 + PUSHAX lp_start 264 + PUSHAX bta_l\LVL\() 265 + .endm 266 + 267 + /*-------------------------------------------------------------- 268 + * Restore all registers used by interrupt handlers. 269 + * 270 + * NOTE: 271 + * 272 + * It is recommended that lp_count/ilink1/ilink2 not be used as a dest reg 273 + * for memory load operations. If used in that way interrupts are deffered 274 + * by hardware and that is not good. 275 + *-------------------------------------------------------------*/ 276 + .macro INTERRUPT_EPILOGUE LVL 277 + POPAX bta_l\LVL\() 278 + POPAX lp_start 279 + POPAX lp_end 280 + 281 + POP r9 282 + mov lp_count, r9 ;LD to lp_count is not allowed 283 + 284 + POPAX status32_l\LVL\() 285 + POP ilink\LVL\() 286 + POP blink 287 + POP fp 288 + POP gp 289 + RESTORE_R12_TO_R0 290 + 291 + ld sp, [sp] /* restore original sp */ 292 + /* orig_r0, ECR, user_r25 skipped automatically */ 293 + .endm 294 + 295 + /* Get thread_info of "current" tsk */ 296 + .macro GET_CURR_THR_INFO_FROM_SP reg 297 + bic \reg, sp, (THREAD_SIZE - 1) 298 + .endm 299 + 300 + /* Get CPU-ID of this core */ 301 + .macro GET_CPU_ID reg 302 + lr \reg, [identity] 303 + lsr \reg, \reg, 8 304 + bmsk \reg, \reg, 7 305 + .endm 306 + 307 + #endif /* __ASM_ARC_ENTRY_COMPACT_H */
+17 -361
arch/arc/include/asm/entry.h
··· 1 1 /* 2 + * Copyright (C) 2014-15 Synopsys, Inc. (www.synopsys.com) 2 3 * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com) 3 4 * 4 5 * This program is free software; you can redistribute it and/or modify 5 6 * it under the terms of the GNU General Public License version 2 as 6 7 * published by the Free Software Foundation. 7 - * 8 - * Vineetg: March 2009 (Supporting 2 levels of Interrupts) 9 - * Stack switching code can no longer reliably rely on the fact that 10 - * if we are NOT in user mode, stack is switched to kernel mode. 11 - * e.g. L2 IRQ interrupted a L1 ISR which had not yet completed 12 - * it's prologue including stack switching from user mode 13 - * 14 - * Vineetg: Aug 28th 2008: Bug #94984 15 - * -Zero Overhead Loop Context shd be cleared when entering IRQ/EXcp/Trap 16 - * Normally CPU does this automatically, however when doing FAKE rtie, 17 - * we also need to explicitly do this. The problem in macros 18 - * FAKE_RET_FROM_EXCPN and FAKE_RET_FROM_EXCPN_LOCK_IRQ was that this bit 19 - * was being "CLEARED" rather then "SET". Actually "SET" clears ZOL context 20 - * 21 - * Vineetg: May 5th 2008 22 - * -Modified CALLEE_REG save/restore macros to handle the fact that 23 - * r25 contains the kernel current task ptr 24 - * - Defined Stack Switching Macro to be reused in all intr/excp hdlrs 25 - * - Shaved off 11 instructions from RESTORE_ALL_INT1 by using the 26 - * address Write back load ld.ab instead of seperate ld/add instn 27 - * 28 - * Amit Bhor, Sameer Dhavale: Codito Technologies 2004 29 8 */ 30 9 31 10 #ifndef __ASM_ARC_ENTRY_H 32 11 #define __ASM_ARC_ENTRY_H 33 12 34 - #ifdef __ASSEMBLY__ 35 13 #include <asm/unistd.h> /* For NR_syscalls defination */ 36 - #include <asm/asm-offsets.h> 37 14 #include <asm/arcregs.h> 38 15 #include <asm/ptrace.h> 39 16 #include <asm/processor.h> /* For VMALLOC_START */ 40 - #include <asm/thread_info.h> /* For THREAD_SIZE */ 41 17 #include <asm/mmu.h> 18 + 19 + #ifdef CONFIG_ISA_ARCOMPACT 20 + #include <asm/entry-compact.h> /* ISA specific bits */ 21 + #else 22 + #include <asm/entry-arcv2.h> 23 + #endif 42 24 43 25 /* Note on the LD/ST addr modes with addr reg wback 44 26 * ··· 125 143 POP r13 126 144 .endm 127 145 128 - #define OFF_USER_R25_FROM_R24 (SZ_CALLEE_REGS + SZ_PT_REGS - 8)/4 129 - 130 146 /*-------------------------------------------------------------- 131 147 * Collect User Mode callee regs as struct callee_regs - needed by 132 148 * fork/do_signal/unaligned-access-emulation. ··· 137 157 *-------------------------------------------------------------*/ 138 158 .macro SAVE_CALLEE_SAVED_USER 139 159 160 + mov r12, sp ; save SP as ref to pt_regs 140 161 SAVE_R13_TO_R24 141 162 142 163 #ifdef CONFIG_ARC_CURR_IN_REG 143 - ; Retrieve orig r25 and save it on stack 144 - ld.as r12, [sp, OFF_USER_R25_FROM_R24] 145 - st.a r12, [sp, -4] 164 + ; Retrieve orig r25 and save it with rest of callee_regs 165 + ld.as r12, [r12, PT_user_r25] 166 + PUSH r12 146 167 #else 147 168 PUSH r25 148 169 #endif ··· 190 209 .macro RESTORE_CALLEE_SAVED_USER 191 210 192 211 #ifdef CONFIG_ARC_CURR_IN_REG 193 - ld.ab r12, [sp, 4] 194 - st.as r12, [sp, OFF_USER_R25_FROM_R24] 212 + POP r12 195 213 #else 196 214 POP r25 197 215 #endif 198 216 RESTORE_R24_TO_R13 217 + 218 + ; SP is back to start of pt_regs 219 + #ifdef CONFIG_ARC_CURR_IN_REG 220 + st.as r12, [sp, PT_user_r25] 221 + #endif 199 222 .endm 200 223 201 224 /*-------------------------------------------------------------- ··· 225 240 226 241 .endm 227 242 228 - /*-------------------------------------------------------------- 229 - * Switch to Kernel Mode stack if SP points to User Mode stack 230 - * 231 - * Entry : r9 contains pre-IRQ/exception/trap status32 232 - * Exit : SP is set to kernel mode stack pointer 233 - * If CURR_IN_REG, r25 set to "current" task pointer 234 - * Clobbers: r9 235 - *-------------------------------------------------------------*/ 236 - 237 - .macro SWITCH_TO_KERNEL_STK 238 - 239 - /* User Mode when this happened ? Yes: Proceed to switch stack */ 240 - bbit1 r9, STATUS_U_BIT, 88f 241 - 242 - /* OK we were already in kernel mode when this event happened, thus can 243 - * assume SP is kernel mode SP. _NO_ need to do any stack switching 244 - */ 245 - 246 - #ifdef CONFIG_ARC_COMPACT_IRQ_LEVELS 247 - /* However.... 248 - * If Level 2 Interrupts enabled, we may end up with a corner case: 249 - * 1. User Task executing 250 - * 2. L1 IRQ taken, ISR starts (CPU auto-switched to KERNEL mode) 251 - * 3. But before it could switch SP from USER to KERNEL stack 252 - * a L2 IRQ "Interrupts" L1 253 - * Thay way although L2 IRQ happened in Kernel mode, stack is still 254 - * not switched. 255 - * To handle this, we may need to switch stack even if in kernel mode 256 - * provided SP has values in range of USER mode stack ( < 0x7000_0000 ) 257 - */ 258 - brlo sp, VMALLOC_START, 88f 259 - 260 - /* TODO: vineetg: 261 - * We need to be a bit more cautious here. What if a kernel bug in 262 - * L1 ISR, caused SP to go whaco (some small value which looks like 263 - * USER stk) and then we take L2 ISR. 264 - * Above brlo alone would treat it as a valid L1-L2 sceanrio 265 - * instead of shouting alound 266 - * The only feasible way is to make sure this L2 happened in 267 - * L1 prelogue ONLY i.e. ilink2 is less than a pre-set marker in 268 - * L1 ISR before it switches stack 269 - */ 270 - 271 - #endif 272 - 273 - /* Save Pre Intr/Exception KERNEL MODE SP on kernel stack 274 - * safe-keeping not really needed, but it keeps the epilogue code 275 - * (SP restore) simpler/uniform. 276 - */ 277 - b.d 66f 278 - mov r9, sp 279 - 280 - 88: /*------Intr/Ecxp happened in user mode, "switch" stack ------ */ 281 - 282 - GET_CURR_TASK_ON_CPU r9 283 - 284 - /* With current tsk in r9, get it's kernel mode stack base */ 285 - GET_TSK_STACK_BASE r9, r9 286 - 287 - 66: 288 - #ifdef CONFIG_ARC_CURR_IN_REG 289 - /* 290 - * Treat r25 as scratch reg, save it on stack first 291 - * Load it with current task pointer 292 - */ 293 - st r25, [r9, -4] 294 - GET_CURR_TASK_ON_CPU r25 295 - #endif 296 - 297 - /* Save Pre Intr/Exception User SP on kernel stack */ 298 - st.a sp, [r9, -16] ; Make room for orig_r0, ECR, user_r25 299 - 300 - /* CAUTION: 301 - * SP should be set at the very end when we are done with everything 302 - * In case of 2 levels of interrupt we depend on value of SP to assume 303 - * that everything else is done (loading r25 etc) 304 - */ 305 - 306 - /* set SP to point to kernel mode stack */ 307 - mov sp, r9 308 - 309 - /* ----- Stack Switched to kernel Mode, Now save REG FILE ----- */ 310 - 311 - .endm 312 - 313 - /*------------------------------------------------------------ 314 - * "FAKE" a rtie to return from CPU Exception context 315 - * This is to re-enable Exceptions within exception 316 - * Look at EV_ProtV to see how this is actually used 317 - *-------------------------------------------------------------*/ 318 - 319 - .macro FAKE_RET_FROM_EXCPN reg 320 - 321 - ld \reg, [sp, PT_status32] 322 - bic \reg, \reg, (STATUS_U_MASK|STATUS_DE_MASK) 323 - bset \reg, \reg, STATUS_L_BIT 324 - sr \reg, [erstatus] 325 - mov \reg, 55f 326 - sr \reg, [eret] 327 - 328 - rtie 329 - 55: 330 - .endm 331 - 332 - /* 333 - * @reg [OUT] &thread_info of "current" 334 - */ 335 - .macro GET_CURR_THR_INFO_FROM_SP reg 336 - bic \reg, sp, (THREAD_SIZE - 1) 337 - .endm 338 - 339 243 /* 340 244 * @reg [OUT] thread_info->flags of "current" 341 245 */ 342 246 .macro GET_CURR_THR_INFO_FLAGS reg 343 247 GET_CURR_THR_INFO_FROM_SP \reg 344 248 ld \reg, [\reg, THREAD_INFO_FLAGS] 345 - .endm 346 - 347 - /*-------------------------------------------------------------- 348 - * For early Exception Prologue, a core reg is temporarily needed to 349 - * code the rest of prolog (stack switching). This is done by stashing 350 - * it to memory (non-SMP case) or SCRATCH0 Aux Reg (SMP). 351 - * 352 - * Before saving the full regfile - this reg is restored back, only 353 - * to be saved again on kernel mode stack, as part of pt_regs. 354 - *-------------------------------------------------------------*/ 355 - .macro EXCPN_PROLOG_FREEUP_REG reg 356 - #ifdef CONFIG_SMP 357 - sr \reg, [ARC_REG_SCRATCH_DATA0] 358 - #else 359 - st \reg, [@ex_saved_reg1] 360 - #endif 361 - .endm 362 - 363 - .macro EXCPN_PROLOG_RESTORE_REG reg 364 - #ifdef CONFIG_SMP 365 - lr \reg, [ARC_REG_SCRATCH_DATA0] 366 - #else 367 - ld \reg, [@ex_saved_reg1] 368 - #endif 369 - .endm 370 - 371 - /*-------------------------------------------------------------- 372 - * Exception Entry prologue 373 - * -Switches stack to K mode (if not already) 374 - * -Saves the register file 375 - * 376 - * After this it is safe to call the "C" handlers 377 - *-------------------------------------------------------------*/ 378 - .macro EXCEPTION_PROLOGUE 379 - 380 - /* Need at least 1 reg to code the early exception prologue */ 381 - EXCPN_PROLOG_FREEUP_REG r9 382 - 383 - /* U/K mode at time of exception (stack not switched if already K) */ 384 - lr r9, [erstatus] 385 - 386 - /* ARC700 doesn't provide auto-stack switching */ 387 - SWITCH_TO_KERNEL_STK 388 - 389 - /* save the regfile */ 390 - SAVE_ALL_SYS 391 - .endm 392 - 393 - /*-------------------------------------------------------------- 394 - * Save all registers used by Exceptions (TLB Miss, Prot-V, Mem err etc) 395 - * Requires SP to be already switched to kernel mode Stack 396 - * sp points to the next free element on the stack at exit of this macro. 397 - * Registers are pushed / popped in the order defined in struct ptregs 398 - * in asm/ptrace.h 399 - * Note that syscalls are implemented via TRAP which is also a exception 400 - * from CPU's point of view 401 - *-------------------------------------------------------------*/ 402 - .macro SAVE_ALL_SYS 403 - 404 - lr r9, [ecr] 405 - st r9, [sp, 8] /* ECR */ 406 - st r0, [sp, 4] /* orig_r0, needed only for sys calls */ 407 - 408 - /* Restore r9 used to code the early prologue */ 409 - EXCPN_PROLOG_RESTORE_REG r9 410 - 411 - SAVE_R0_TO_R12 412 - PUSH gp 413 - PUSH fp 414 - PUSH blink 415 - PUSHAX eret 416 - PUSHAX erstatus 417 - PUSH lp_count 418 - PUSHAX lp_end 419 - PUSHAX lp_start 420 - PUSHAX erbta 421 - .endm 422 - 423 - /*-------------------------------------------------------------- 424 - * Restore all registers used by system call or Exceptions 425 - * SP should always be pointing to the next free stack element 426 - * when entering this macro. 427 - * 428 - * NOTE: 429 - * 430 - * It is recommended that lp_count/ilink1/ilink2 not be used as a dest reg 431 - * for memory load operations. If used in that way interrupts are deffered 432 - * by hardware and that is not good. 433 - *-------------------------------------------------------------*/ 434 - .macro RESTORE_ALL_SYS 435 - POPAX erbta 436 - POPAX lp_start 437 - POPAX lp_end 438 - 439 - POP r9 440 - mov lp_count, r9 ;LD to lp_count is not allowed 441 - 442 - POPAX erstatus 443 - POPAX eret 444 - POP blink 445 - POP fp 446 - POP gp 447 - RESTORE_R12_TO_R0 448 - 449 - ld sp, [sp] /* restore original sp */ 450 - /* orig_r0, ECR, user_r25 skipped automatically */ 451 - .endm 452 - 453 - 454 - /*-------------------------------------------------------------- 455 - * Save all registers used by interrupt handlers. 456 - *-------------------------------------------------------------*/ 457 - .macro SAVE_ALL_INT1 458 - 459 - /* restore original r9 to be saved as part of reg-file */ 460 - #ifdef CONFIG_SMP 461 - lr r9, [ARC_REG_SCRATCH_DATA0] 462 - #else 463 - ld r9, [@int1_saved_reg] 464 - #endif 465 - 466 - /* now we are ready to save the remaining context :) */ 467 - st event_IRQ1, [sp, 8] /* Dummy ECR */ 468 - st 0, [sp, 4] /* orig_r0 , N/A for IRQ */ 469 - 470 - SAVE_R0_TO_R12 471 - PUSH gp 472 - PUSH fp 473 - PUSH blink 474 - PUSH ilink1 475 - PUSHAX status32_l1 476 - PUSH lp_count 477 - PUSHAX lp_end 478 - PUSHAX lp_start 479 - PUSHAX bta_l1 480 - .endm 481 - 482 - .macro SAVE_ALL_INT2 483 - 484 - /* TODO-vineetg: SMP we can't use global nor can we use 485 - * SCRATCH0 as we do for int1 because while int1 is using 486 - * it, int2 can come 487 - */ 488 - /* retsore original r9 , saved in sys_saved_r9 */ 489 - ld r9, [@int2_saved_reg] 490 - 491 - /* now we are ready to save the remaining context :) */ 492 - st event_IRQ2, [sp, 8] /* Dummy ECR */ 493 - st 0, [sp, 4] /* orig_r0 , N/A for IRQ */ 494 - 495 - SAVE_R0_TO_R12 496 - PUSH gp 497 - PUSH fp 498 - PUSH blink 499 - PUSH ilink2 500 - PUSHAX status32_l2 501 - PUSH lp_count 502 - PUSHAX lp_end 503 - PUSHAX lp_start 504 - PUSHAX bta_l2 505 - .endm 506 - 507 - /*-------------------------------------------------------------- 508 - * Restore all registers used by interrupt handlers. 509 - * 510 - * NOTE: 511 - * 512 - * It is recommended that lp_count/ilink1/ilink2 not be used as a dest reg 513 - * for memory load operations. If used in that way interrupts are deffered 514 - * by hardware and that is not good. 515 - *-------------------------------------------------------------*/ 516 - 517 - .macro RESTORE_ALL_INT1 518 - POPAX bta_l1 519 - POPAX lp_start 520 - POPAX lp_end 521 - 522 - POP r9 523 - mov lp_count, r9 ;LD to lp_count is not allowed 524 - 525 - POPAX status32_l1 526 - POP ilink1 527 - POP blink 528 - POP fp 529 - POP gp 530 - RESTORE_R12_TO_R0 531 - 532 - ld sp, [sp] /* restore original sp */ 533 - /* orig_r0, ECR, user_r25 skipped automatically */ 534 - .endm 535 - 536 - .macro RESTORE_ALL_INT2 537 - POPAX bta_l2 538 - POPAX lp_start 539 - POPAX lp_end 540 - 541 - POP r9 542 - mov lp_count, r9 ;LD to lp_count is not allowed 543 - 544 - POPAX status32_l2 545 - POP ilink2 546 - POP blink 547 - POP fp 548 - POP gp 549 - RESTORE_R12_TO_R0 550 - 551 - ld sp, [sp] /* restore original sp */ 552 - /* orig_r0, ECR, user_r25 skipped automatically */ 553 - .endm 554 - 555 - 556 - /* Get CPU-ID of this core */ 557 - .macro GET_CPU_ID reg 558 - lr \reg, [identity] 559 - lsr \reg, \reg, 8 560 - bmsk \reg, \reg, 7 561 249 .endm 562 250 563 251 #ifdef CONFIG_SMP ··· 300 642 .endm 301 643 302 644 #endif /* CONFIG_ARC_CURR_IN_REG */ 303 - 304 - #endif /* __ASSEMBLY__ */ 305 645 306 646 #endif /* __ASM_ARC_ENTRY_H */
+39 -3
arch/arc/include/asm/io.h
··· 99 99 100 100 } 101 101 102 - #define readb_relaxed readb 103 - #define readw_relaxed readw 104 - #define readl_relaxed readl 102 + #ifdef CONFIG_ISA_ARCV2 103 + #include <asm/barrier.h> 104 + #define __iormb() rmb() 105 + #define __iowmb() wmb() 106 + #else 107 + #define __iormb() do { } while (0) 108 + #define __iowmb() do { } while (0) 109 + #endif 110 + 111 + /* 112 + * MMIO can also get buffered/optimized in micro-arch, so barriers needed 113 + * Based on ARM model for the typical use case 114 + * 115 + * <ST [DMA buffer]> 116 + * <writel MMIO "go" reg> 117 + * or: 118 + * <readl MMIO "status" reg> 119 + * <LD [DMA buffer]> 120 + * 121 + * http://lkml.kernel.org/r/20150622133656.GG1583@arm.com 122 + */ 123 + #define readb(c) ({ u8 __v = readb_relaxed(c); __iormb(); __v; }) 124 + #define readw(c) ({ u16 __v = readw_relaxed(c); __iormb(); __v; }) 125 + #define readl(c) ({ u32 __v = readl_relaxed(c); __iormb(); __v; }) 126 + 127 + #define writeb(v,c) ({ __iowmb(); writeb_relaxed(v,c); }) 128 + #define writew(v,c) ({ __iowmb(); writew_relaxed(v,c); }) 129 + #define writel(v,c) ({ __iowmb(); writel_relaxed(v,c); }) 130 + 131 + /* 132 + * Relaxed API for drivers which can handle any ordering themselves 133 + */ 134 + #define readb_relaxed(c) __raw_readb(c) 135 + #define readw_relaxed(c) __raw_readw(c) 136 + #define readl_relaxed(c) __raw_readl(c) 137 + 138 + #define writeb_relaxed(v,c) __raw_writeb(v,c) 139 + #define writew_relaxed(v,c) __raw_writew(v,c) 140 + #define writel_relaxed(v,c) __raw_writel(v,c) 105 141 106 142 #include <asm-generic/io.h> 107 143
+6
arch/arc/include/asm/irq.h
··· 13 13 #define NR_IRQS 128 /* allow some CPU external IRQ handling */ 14 14 15 15 /* Platform Independent IRQs */ 16 + #ifdef CONFIG_ISA_ARCOMPACT 16 17 #define TIMER0_IRQ 3 17 18 #define TIMER1_IRQ 4 19 + #else 20 + #define TIMER0_IRQ 16 21 + #define TIMER1_IRQ 17 22 + #define IPI_IRQ 19 23 + #endif 18 24 19 25 #include <linux/interrupt.h> 20 26 #include <asm-generic/irq.h>
+124
arch/arc/include/asm/irqflags-arcv2.h
··· 1 + /* 2 + * Copyright (C) 2014-15 Synopsys, Inc. (www.synopsys.com) 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License version 2 as 6 + * published by the Free Software Foundation. 7 + */ 8 + 9 + #ifndef __ASM_IRQFLAGS_ARCV2_H 10 + #define __ASM_IRQFLAGS_ARCV2_H 11 + 12 + #include <asm/arcregs.h> 13 + 14 + /* status32 Bits */ 15 + #define STATUS_AD_BIT 19 /* Disable Align chk: core supports non-aligned */ 16 + #define STATUS_IE_BIT 31 17 + 18 + #define STATUS_AD_MASK (1<<STATUS_AD_BIT) 19 + #define STATUS_IE_MASK (1<<STATUS_IE_BIT) 20 + 21 + #define AUX_USER_SP 0x00D 22 + #define AUX_IRQ_CTRL 0x00E 23 + #define AUX_IRQ_ACT 0x043 /* Active Intr across all levels */ 24 + #define AUX_IRQ_LVL_PEND 0x200 /* Pending Intr across all levels */ 25 + #define AUX_IRQ_PRIORITY 0x206 26 + #define ICAUSE 0x40a 27 + #define AUX_IRQ_SELECT 0x40b 28 + #define AUX_IRQ_ENABLE 0x40c 29 + 30 + /* Was Intr taken in User Mode */ 31 + #define AUX_IRQ_ACT_BIT_U 31 32 + 33 + /* 0 is highest level, but taken by FIRQs, if present in design */ 34 + #define ARCV2_IRQ_DEF_PRIO 0 35 + 36 + /* seed value for status register */ 37 + #define ISA_INIT_STATUS_BITS (STATUS_IE_MASK | STATUS_AD_MASK | \ 38 + (ARCV2_IRQ_DEF_PRIO << 1)) 39 + 40 + #ifndef __ASSEMBLY__ 41 + 42 + /* 43 + * Save IRQ state and disable IRQs 44 + */ 45 + static inline long arch_local_irq_save(void) 46 + { 47 + unsigned long flags; 48 + 49 + __asm__ __volatile__(" clri %0 \n" : "=r" (flags) : : "memory"); 50 + 51 + return flags; 52 + } 53 + 54 + /* 55 + * restore saved IRQ state 56 + */ 57 + static inline void arch_local_irq_restore(unsigned long flags) 58 + { 59 + __asm__ __volatile__(" seti %0 \n" : : "r" (flags) : "memory"); 60 + } 61 + 62 + /* 63 + * Unconditionally Enable IRQs 64 + */ 65 + static inline void arch_local_irq_enable(void) 66 + { 67 + unsigned int irqact = read_aux_reg(AUX_IRQ_ACT); 68 + 69 + if (irqact & 0xffff) 70 + write_aux_reg(AUX_IRQ_ACT, irqact & ~0xffff); 71 + 72 + __asm__ __volatile__(" seti \n" : : : "memory"); 73 + } 74 + 75 + /* 76 + * Unconditionally Disable IRQs 77 + */ 78 + static inline void arch_local_irq_disable(void) 79 + { 80 + __asm__ __volatile__(" clri \n" : : : "memory"); 81 + } 82 + 83 + /* 84 + * save IRQ state 85 + */ 86 + static inline long arch_local_save_flags(void) 87 + { 88 + unsigned long temp; 89 + 90 + __asm__ __volatile__( 91 + " lr %0, [status32] \n" 92 + : "=&r"(temp) 93 + : 94 + : "memory"); 95 + 96 + return temp; 97 + } 98 + 99 + /* 100 + * Query IRQ state 101 + */ 102 + static inline int arch_irqs_disabled_flags(unsigned long flags) 103 + { 104 + return !(flags & (STATUS_IE_MASK)); 105 + } 106 + 107 + static inline int arch_irqs_disabled(void) 108 + { 109 + return arch_irqs_disabled_flags(arch_local_save_flags()); 110 + } 111 + 112 + #else 113 + 114 + .macro IRQ_DISABLE scratch 115 + clri 116 + .endm 117 + 118 + .macro IRQ_ENABLE scratch 119 + seti 120 + .endm 121 + 122 + #endif /* __ASSEMBLY__ */ 123 + 124 + #endif
+183
arch/arc/include/asm/irqflags-compact.h
··· 1 + /* 2 + * Copyright (C) 2014-15 Synopsys, Inc. (www.synopsys.com) 3 + * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com) 4 + * 5 + * This program is free software; you can redistribute it and/or modify 6 + * it under the terms of the GNU General Public License version 2 as 7 + * published by the Free Software Foundation. 8 + */ 9 + 10 + #ifndef __ASM_IRQFLAGS_ARCOMPACT_H 11 + #define __ASM_IRQFLAGS_ARCOMPACT_H 12 + 13 + /* vineetg: March 2010 : local_irq_save( ) optimisation 14 + * -Remove explicit mov of current status32 into reg, that is not needed 15 + * -Use BIC insn instead of INVERTED + AND 16 + * -Conditionally disable interrupts (if they are not enabled, don't disable) 17 + */ 18 + 19 + #include <asm/arcregs.h> 20 + 21 + /* status32 Reg bits related to Interrupt Handling */ 22 + #define STATUS_E1_BIT 1 /* Int 1 enable */ 23 + #define STATUS_E2_BIT 2 /* Int 2 enable */ 24 + #define STATUS_A1_BIT 3 /* Int 1 active */ 25 + #define STATUS_A2_BIT 4 /* Int 2 active */ 26 + 27 + #define STATUS_E1_MASK (1<<STATUS_E1_BIT) 28 + #define STATUS_E2_MASK (1<<STATUS_E2_BIT) 29 + #define STATUS_A1_MASK (1<<STATUS_A1_BIT) 30 + #define STATUS_A2_MASK (1<<STATUS_A2_BIT) 31 + #define STATUS_IE_MASK (STATUS_E1_MASK | STATUS_E2_MASK) 32 + 33 + /* Other Interrupt Handling related Aux regs */ 34 + #define AUX_IRQ_LEV 0x200 /* IRQ Priority: L1 or L2 */ 35 + #define AUX_IRQ_HINT 0x201 /* For generating Soft Interrupts */ 36 + #define AUX_IRQ_LV12 0x43 /* interrupt level register */ 37 + 38 + #define AUX_IENABLE 0x40c 39 + #define AUX_ITRIGGER 0x40d 40 + #define AUX_IPULSE 0x415 41 + 42 + #define ISA_INIT_STATUS_BITS STATUS_IE_MASK 43 + 44 + #ifndef __ASSEMBLY__ 45 + 46 + /****************************************************************** 47 + * IRQ Control Macros 48 + * 49 + * All of them have "memory" clobber (compiler barrier) which is needed to 50 + * ensure that LD/ST requiring irq safetly (R-M-W when LLSC is not available) 51 + * are redone after IRQs are re-enabled (and gcc doesn't reuse stale register) 52 + * 53 + * Noted at the time of Abilis Timer List corruption 54 + * Orig Bug + Rejected solution : https://lkml.org/lkml/2013/3/29/67 55 + * Reasoning : https://lkml.org/lkml/2013/4/8/15 56 + * 57 + ******************************************************************/ 58 + 59 + /* 60 + * Save IRQ state and disable IRQs 61 + */ 62 + static inline long arch_local_irq_save(void) 63 + { 64 + unsigned long temp, flags; 65 + 66 + __asm__ __volatile__( 67 + " lr %1, [status32] \n" 68 + " bic %0, %1, %2 \n" 69 + " and.f 0, %1, %2 \n" 70 + " flag.nz %0 \n" 71 + : "=r"(temp), "=r"(flags) 72 + : "n"((STATUS_E1_MASK | STATUS_E2_MASK)) 73 + : "memory", "cc"); 74 + 75 + return flags; 76 + } 77 + 78 + /* 79 + * restore saved IRQ state 80 + */ 81 + static inline void arch_local_irq_restore(unsigned long flags) 82 + { 83 + 84 + __asm__ __volatile__( 85 + " flag %0 \n" 86 + : 87 + : "r"(flags) 88 + : "memory"); 89 + } 90 + 91 + /* 92 + * Unconditionally Enable IRQs 93 + */ 94 + extern void arch_local_irq_enable(void); 95 + 96 + /* 97 + * Unconditionally Disable IRQs 98 + */ 99 + static inline void arch_local_irq_disable(void) 100 + { 101 + unsigned long temp; 102 + 103 + __asm__ __volatile__( 104 + " lr %0, [status32] \n" 105 + " and %0, %0, %1 \n" 106 + " flag %0 \n" 107 + : "=&r"(temp) 108 + : "n"(~(STATUS_E1_MASK | STATUS_E2_MASK)) 109 + : "memory"); 110 + } 111 + 112 + /* 113 + * save IRQ state 114 + */ 115 + static inline long arch_local_save_flags(void) 116 + { 117 + unsigned long temp; 118 + 119 + __asm__ __volatile__( 120 + " lr %0, [status32] \n" 121 + : "=&r"(temp) 122 + : 123 + : "memory"); 124 + 125 + return temp; 126 + } 127 + 128 + /* 129 + * Query IRQ state 130 + */ 131 + static inline int arch_irqs_disabled_flags(unsigned long flags) 132 + { 133 + return !(flags & (STATUS_E1_MASK 134 + #ifdef CONFIG_ARC_COMPACT_IRQ_LEVELS 135 + | STATUS_E2_MASK 136 + #endif 137 + )); 138 + } 139 + 140 + static inline int arch_irqs_disabled(void) 141 + { 142 + return arch_irqs_disabled_flags(arch_local_save_flags()); 143 + } 144 + 145 + #else 146 + 147 + #ifdef CONFIG_TRACE_IRQFLAGS 148 + 149 + .macro TRACE_ASM_IRQ_DISABLE 150 + bl trace_hardirqs_off 151 + .endm 152 + 153 + .macro TRACE_ASM_IRQ_ENABLE 154 + bl trace_hardirqs_on 155 + .endm 156 + 157 + #else 158 + 159 + .macro TRACE_ASM_IRQ_DISABLE 160 + .endm 161 + 162 + .macro TRACE_ASM_IRQ_ENABLE 163 + .endm 164 + 165 + #endif 166 + 167 + .macro IRQ_DISABLE scratch 168 + lr \scratch, [status32] 169 + bic \scratch, \scratch, (STATUS_E1_MASK | STATUS_E2_MASK) 170 + flag \scratch 171 + TRACE_ASM_IRQ_DISABLE 172 + .endm 173 + 174 + .macro IRQ_ENABLE scratch 175 + lr \scratch, [status32] 176 + or \scratch, \scratch, (STATUS_E1_MASK | STATUS_E2_MASK) 177 + flag \scratch 178 + TRACE_ASM_IRQ_ENABLE 179 + .endm 180 + 181 + #endif /* __ASSEMBLY__ */ 182 + 183 + #endif
+4 -164
arch/arc/include/asm/irqflags.h
··· 1 1 /* 2 + * Copyright (C) 2014-15 Synopsys, Inc. (www.synopsys.com) 2 3 * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com) 3 4 * 4 5 * This program is free software; you can redistribute it and/or modify ··· 10 9 #ifndef __ASM_ARC_IRQFLAGS_H 11 10 #define __ASM_ARC_IRQFLAGS_H 12 11 13 - /* vineetg: March 2010 : local_irq_save( ) optimisation 14 - * -Remove explicit mov of current status32 into reg, that is not needed 15 - * -Use BIC insn instead of INVERTED + AND 16 - * -Conditionally disable interrupts (if they are not enabled, don't disable) 17 - */ 18 - 19 - #include <asm/arcregs.h> 20 - 21 - /* status32 Reg bits related to Interrupt Handling */ 22 - #define STATUS_E1_BIT 1 /* Int 1 enable */ 23 - #define STATUS_E2_BIT 2 /* Int 2 enable */ 24 - #define STATUS_A1_BIT 3 /* Int 1 active */ 25 - #define STATUS_A2_BIT 4 /* Int 2 active */ 26 - 27 - #define STATUS_E1_MASK (1<<STATUS_E1_BIT) 28 - #define STATUS_E2_MASK (1<<STATUS_E2_BIT) 29 - #define STATUS_A1_MASK (1<<STATUS_A1_BIT) 30 - #define STATUS_A2_MASK (1<<STATUS_A2_BIT) 31 - 32 - /* Other Interrupt Handling related Aux regs */ 33 - #define AUX_IRQ_LEV 0x200 /* IRQ Priority: L1 or L2 */ 34 - #define AUX_IRQ_HINT 0x201 /* For generating Soft Interrupts */ 35 - #define AUX_IRQ_LV12 0x43 /* interrupt level register */ 36 - 37 - #define AUX_IENABLE 0x40c 38 - #define AUX_ITRIGGER 0x40d 39 - #define AUX_IPULSE 0x415 40 - 41 - #ifndef __ASSEMBLY__ 42 - 43 - /****************************************************************** 44 - * IRQ Control Macros 45 - * 46 - * All of them have "memory" clobber (compiler barrier) which is needed to 47 - * ensure that LD/ST requiring irq safetly (R-M-W when LLSC is not available) 48 - * are redone after IRQs are re-enabled (and gcc doesn't reuse stale register) 49 - * 50 - * Noted at the time of Abilis Timer List corruption 51 - * Orig Bug + Rejected solution : https://lkml.org/lkml/2013/3/29/67 52 - * Reasoning : https://lkml.org/lkml/2013/4/8/15 53 - * 54 - ******************************************************************/ 55 - 56 - /* 57 - * Save IRQ state and disable IRQs 58 - */ 59 - static inline long arch_local_irq_save(void) 60 - { 61 - unsigned long temp, flags; 62 - 63 - __asm__ __volatile__( 64 - " lr %1, [status32] \n" 65 - " bic %0, %1, %2 \n" 66 - " and.f 0, %1, %2 \n" 67 - " flag.nz %0 \n" 68 - : "=r"(temp), "=r"(flags) 69 - : "n"((STATUS_E1_MASK | STATUS_E2_MASK)) 70 - : "memory", "cc"); 71 - 72 - return flags; 73 - } 74 - 75 - /* 76 - * restore saved IRQ state 77 - */ 78 - static inline void arch_local_irq_restore(unsigned long flags) 79 - { 80 - 81 - __asm__ __volatile__( 82 - " flag %0 \n" 83 - : 84 - : "r"(flags) 85 - : "memory"); 86 - } 87 - 88 - /* 89 - * Unconditionally Enable IRQs 90 - */ 91 - extern void arch_local_irq_enable(void); 92 - 93 - /* 94 - * Unconditionally Disable IRQs 95 - */ 96 - static inline void arch_local_irq_disable(void) 97 - { 98 - unsigned long temp; 99 - 100 - __asm__ __volatile__( 101 - " lr %0, [status32] \n" 102 - " and %0, %0, %1 \n" 103 - " flag %0 \n" 104 - : "=&r"(temp) 105 - : "n"(~(STATUS_E1_MASK | STATUS_E2_MASK)) 106 - : "memory"); 107 - } 108 - 109 - /* 110 - * save IRQ state 111 - */ 112 - static inline long arch_local_save_flags(void) 113 - { 114 - unsigned long temp; 115 - 116 - __asm__ __volatile__( 117 - " lr %0, [status32] \n" 118 - : "=&r"(temp) 119 - : 120 - : "memory"); 121 - 122 - return temp; 123 - } 124 - 125 - /* 126 - * Query IRQ state 127 - */ 128 - static inline int arch_irqs_disabled_flags(unsigned long flags) 129 - { 130 - return !(flags & (STATUS_E1_MASK 131 - #ifdef CONFIG_ARC_COMPACT_IRQ_LEVELS 132 - | STATUS_E2_MASK 133 - #endif 134 - )); 135 - } 136 - 137 - static inline int arch_irqs_disabled(void) 138 - { 139 - return arch_irqs_disabled_flags(arch_local_save_flags()); 140 - } 141 - 12 + #ifdef CONFIG_ISA_ARCOMPACT 13 + #include <asm/irqflags-compact.h> 142 14 #else 143 - 144 - #ifdef CONFIG_TRACE_IRQFLAGS 145 - 146 - .macro TRACE_ASM_IRQ_DISABLE 147 - bl trace_hardirqs_off 148 - .endm 149 - 150 - .macro TRACE_ASM_IRQ_ENABLE 151 - bl trace_hardirqs_on 152 - .endm 153 - 154 - #else 155 - 156 - .macro TRACE_ASM_IRQ_DISABLE 157 - .endm 158 - 159 - .macro TRACE_ASM_IRQ_ENABLE 160 - .endm 161 - 15 + #include <asm/irqflags-arcv2.h> 162 16 #endif 163 - 164 - .macro IRQ_DISABLE scratch 165 - lr \scratch, [status32] 166 - bic \scratch, \scratch, (STATUS_E1_MASK | STATUS_E2_MASK) 167 - flag \scratch 168 - TRACE_ASM_IRQ_DISABLE 169 - .endm 170 - 171 - .macro IRQ_ENABLE scratch 172 - lr \scratch, [status32] 173 - or \scratch, \scratch, (STATUS_E1_MASK | STATUS_E2_MASK) 174 - flag \scratch 175 - TRACE_ASM_IRQ_ENABLE 176 - .endm 177 - 178 - #endif /* __ASSEMBLY__ */ 179 17 180 18 #endif
+94
arch/arc/include/asm/mcip.h
··· 1 + /* 2 + * ARConnect IP Support (Multi core enabler: Cross core IPI, RTC ...) 3 + * 4 + * Copyright (C) 2014-15 Synopsys, Inc. (www.synopsys.com) 5 + * 6 + * This program is free software; you can redistribute it and/or modify 7 + * it under the terms of the GNU General Public License version 2 as 8 + * published by the Free Software Foundation. 9 + */ 10 + 11 + #ifndef __ASM_MCIP_H 12 + #define __ASM_MCIP_H 13 + 14 + #ifdef CONFIG_ISA_ARCV2 15 + 16 + #include <asm/arcregs.h> 17 + 18 + #define ARC_REG_MCIP_BCR 0x0d0 19 + #define ARC_REG_MCIP_CMD 0x600 20 + #define ARC_REG_MCIP_WDATA 0x601 21 + #define ARC_REG_MCIP_READBACK 0x602 22 + 23 + struct mcip_cmd { 24 + #ifdef CONFIG_CPU_BIG_ENDIAN 25 + unsigned int pad:8, param:16, cmd:8; 26 + #else 27 + unsigned int cmd:8, param:16, pad:8; 28 + #endif 29 + 30 + #define CMD_INTRPT_GENERATE_IRQ 0x01 31 + #define CMD_INTRPT_GENERATE_ACK 0x02 32 + #define CMD_INTRPT_READ_STATUS 0x03 33 + #define CMD_INTRPT_CHECK_SOURCE 0x04 34 + 35 + /* Semaphore Commands */ 36 + #define CMD_SEMA_CLAIM_AND_READ 0x11 37 + #define CMD_SEMA_RELEASE 0x12 38 + 39 + #define CMD_DEBUG_SET_MASK 0x34 40 + #define CMD_DEBUG_SET_SELECT 0x36 41 + 42 + #define CMD_GRTC_READ_LO 0x42 43 + #define CMD_GRTC_READ_HI 0x43 44 + 45 + #define CMD_IDU_ENABLE 0x71 46 + #define CMD_IDU_DISABLE 0x72 47 + #define CMD_IDU_SET_MODE 0x74 48 + #define CMD_IDU_SET_DEST 0x76 49 + #define CMD_IDU_SET_MASK 0x7C 50 + 51 + #define IDU_M_TRIG_LEVEL 0x0 52 + #define IDU_M_TRIG_EDGE 0x1 53 + 54 + #define IDU_M_DISTRI_RR 0x0 55 + #define IDU_M_DISTRI_DEST 0x2 56 + }; 57 + 58 + /* 59 + * MCIP programming model 60 + * 61 + * - Simple commands write {cmd:8,param:16} to MCIP_CMD aux reg 62 + * (param could be irq, common_irq, core_id ...) 63 + * - More involved commands setup MCIP_WDATA with cmd specific data 64 + * before invoking the simple command 65 + */ 66 + static inline void __mcip_cmd(unsigned int cmd, unsigned int param) 67 + { 68 + struct mcip_cmd buf; 69 + 70 + buf.pad = 0; 71 + buf.cmd = cmd; 72 + buf.param = param; 73 + 74 + WRITE_AUX(ARC_REG_MCIP_CMD, buf); 75 + } 76 + 77 + /* 78 + * Setup additional data for a cmd 79 + * Callers need to lock to ensure atomicity 80 + */ 81 + static inline void __mcip_cmd_data(unsigned int cmd, unsigned int param, 82 + unsigned int data) 83 + { 84 + write_aux_reg(ARC_REG_MCIP_WDATA, data); 85 + 86 + __mcip_cmd(cmd, param); 87 + } 88 + 89 + extern void mcip_init_early_smp(void); 90 + extern void mcip_init_smp(unsigned int cpu); 91 + 92 + #endif 93 + 94 + #endif
+23 -1
arch/arc/include/asm/mmu.h
··· 15 15 #define CONFIG_ARC_MMU_VER 2 16 16 #elif defined(CONFIG_ARC_MMU_V3) 17 17 #define CONFIG_ARC_MMU_VER 3 18 + #elif defined(CONFIG_ARC_MMU_V4) 19 + #define CONFIG_ARC_MMU_VER 4 18 20 #endif 19 21 20 22 /* MMU Management regs */ 21 23 #define ARC_REG_MMU_BCR 0x06f 24 + #if (CONFIG_ARC_MMU_VER < 4) 22 25 #define ARC_REG_TLBPD0 0x405 23 26 #define ARC_REG_TLBPD1 0x406 24 27 #define ARC_REG_TLBINDEX 0x407 25 28 #define ARC_REG_TLBCOMMAND 0x408 26 29 #define ARC_REG_PID 0x409 27 30 #define ARC_REG_SCRATCH_DATA0 0x418 31 + #else 32 + #define ARC_REG_TLBPD0 0x460 33 + #define ARC_REG_TLBPD1 0x461 34 + #define ARC_REG_TLBINDEX 0x464 35 + #define ARC_REG_TLBCOMMAND 0x465 36 + #define ARC_REG_PID 0x468 37 + #define ARC_REG_SCRATCH_DATA0 0x46c 38 + #endif 28 39 29 40 /* Bits in MMU PID register */ 30 - #define MMU_ENABLE (1 << 31) /* Enable MMU for process */ 41 + #define __TLB_ENABLE (1 << 31) 42 + #define __PROG_ENABLE (1 << 30) 43 + #define MMU_ENABLE (__TLB_ENABLE | __PROG_ENABLE) 31 44 32 45 /* Error code if probe fails */ 33 46 #define TLB_LKUP_ERR 0x80000000 34 47 48 + #if (CONFIG_ARC_MMU_VER < 4) 35 49 #define TLB_DUP_ERR (TLB_LKUP_ERR | 0x00000001) 50 + #else 51 + #define TLB_DUP_ERR (TLB_LKUP_ERR | 0x40000000) 52 + #endif 36 53 37 54 /* TLB Commands */ 38 55 #define TLBWrite 0x1 ··· 60 43 #if (CONFIG_ARC_MMU_VER >= 2) 61 44 #define TLBWriteNI 0x5 /* write JTLB without inv uTLBs */ 62 45 #define TLBIVUTLB 0x6 /* explicitly inv uTLBs */ 46 + #endif 47 + 48 + #if (CONFIG_ARC_MMU_VER >= 4) 49 + #define TLBInsertEntry 0x7 50 + #define TLBDeleteEntry 0x8 63 51 #endif 64 52 65 53 #ifndef __ASSEMBLY__
+10
arch/arc/include/asm/pgtable.h
··· 72 72 #define _PAGE_READ (1<<3) /* Page has user read perm (H) */ 73 73 #define _PAGE_ACCESSED (1<<4) /* Page is accessed (S) */ 74 74 #define _PAGE_MODIFIED (1<<5) /* Page modified (dirty) (S) */ 75 + 76 + #if (CONFIG_ARC_MMU_VER >= 4) 77 + #define _PAGE_WTHRU (1<<7) /* Page cache mode write-thru (H) */ 78 + #endif 79 + 75 80 #define _PAGE_GLOBAL (1<<8) /* Page is global (H) */ 76 81 #define _PAGE_PRESENT (1<<9) /* TLB entry is valid (H) */ 82 + 83 + #if (CONFIG_ARC_MMU_VER >= 4) 84 + #define _PAGE_SZ (1<<10) /* Page Size indicator (H) */ 85 + #endif 86 + 77 87 #define _PAGE_SHARED_CODE (1<<11) /* Shared Code page with cmn vaddr 78 88 usable for shared TLB entries (H) */ 79 89 #endif
+17 -20
arch/arc/include/asm/processor.h
··· 77 77 */ 78 78 #define TSK_K_ESP(tsk) (tsk->thread.ksp) 79 79 80 - #define TSK_K_REG(tsk, off) (*((unsigned int *)(TSK_K_ESP(tsk) + \ 80 + #define TSK_K_REG(tsk, off) (*((unsigned long *)(TSK_K_ESP(tsk) + \ 81 81 sizeof(struct callee_regs) + off))) 82 82 83 83 #define TSK_K_BLINK(tsk) TSK_K_REG(tsk, 4) ··· 100 100 101 101 #endif /* !__ASSEMBLY__ */ 102 102 103 - /* Kernels Virtual memory area. 104 - * Unlike other architectures(MIPS, sh, cris ) ARC 700 does not have a 105 - * "kernel translated" region (like KSEG2 in MIPS). So we use a upper part 106 - * of the translated bottom 2GB for kernel virtual memory and protect 107 - * these pages from user accesses by disabling Ru, Eu and Wu. 103 + /* 104 + * System Memory Map on ARC 105 + * 106 + * ---------------------------- (lower 2G, Translated) ------------------------- 107 + * 0x0000_0000 0x5FFF_FFFF (user vaddr: TASK_SIZE) 108 + * 0x6000_0000 0x6FFF_FFFF (reserved gutter between U/K) 109 + * 0x7000_0000 0x7FFF_FFFF (kvaddr: vmalloc/modules/pkmap..) 110 + * 111 + * PAGE_OFFSET ---------------- (Upper 2G, Untranslated) ----------------------- 112 + * 0x8000_0000 0xBFFF_FFFF (kernel direct mapped) 113 + * 0xC000_0000 0xFFFF_FFFF (peripheral uncached space) 114 + * ----------------------------------------------------------------------------- 108 115 */ 109 - #define VMALLOC_SIZE (0x10000000) /* 256M */ 110 - #define VMALLOC_START (PAGE_OFFSET - VMALLOC_SIZE) 111 - #define VMALLOC_END (PAGE_OFFSET) 116 + #define VMALLOC_START 0x70000000 117 + #define VMALLOC_SIZE (PAGE_OFFSET - VMALLOC_START) 118 + #define VMALLOC_END (VMALLOC_START + VMALLOC_SIZE) 112 119 113 - /* Most of the architectures seem to be keeping some kind of padding between 114 - * userspace TASK_SIZE and PAGE_OFFSET. i.e TASK_SIZE != PAGE_OFFSET. 115 - */ 116 120 #define USER_KERNEL_GUTTER 0x10000000 117 121 118 - /* User address space: 119 - * On ARC700, CPU allows the entire lower half of 32 bit address space to be 120 - * translated. Thus potentially 2G (0:0x7FFF_FFFF) could be User vaddr space. 121 - * However we steal 256M for kernel addr (0x7000_0000:0x7FFF_FFFF) and another 122 - * 256M (0x6000_0000:0x6FFF_FFFF) is gutter between user/kernel spaces 123 - * Thus total User vaddr space is (0:0x5FFF_FFFF) 124 - */ 125 - #define TASK_SIZE (PAGE_OFFSET - VMALLOC_SIZE - USER_KERNEL_GUTTER) 122 + #define TASK_SIZE (VMALLOC_START - USER_KERNEL_GUTTER) 126 123 127 124 #define STACK_TOP TASK_SIZE 128 125 #define STACK_TOP_MAX STACK_TOP
+43
arch/arc/include/asm/ptrace.h
··· 16 16 17 17 /* THE pt_regs: Defines how regs are saved during entry into kernel */ 18 18 19 + #ifdef CONFIG_ISA_ARCOMPACT 19 20 struct pt_regs { 20 21 21 22 /* Real registers */ ··· 57 56 58 57 long user_r25; 59 58 }; 59 + #else 60 + 61 + struct pt_regs { 62 + 63 + long orig_r0; 64 + 65 + union { 66 + struct { 67 + #ifdef CONFIG_CPU_BIG_ENDIAN 68 + unsigned long state:8, ecr_vec:8, 69 + ecr_cause:8, ecr_param:8; 70 + #else 71 + unsigned long ecr_param:8, ecr_cause:8, 72 + ecr_vec:8, state:8; 73 + #endif 74 + }; 75 + unsigned long event; 76 + }; 77 + 78 + long bta; /* bta_l1, bta_l2, erbta */ 79 + 80 + long user_r25; 81 + 82 + long r26; /* gp */ 83 + long fp; 84 + long sp; /* user/kernel sp depending on where we came from */ 85 + 86 + long r12; 87 + 88 + /*------- Below list auto saved by h/w -----------*/ 89 + long r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11; 90 + 91 + long blink; 92 + long lp_end, lp_start, lp_count; 93 + 94 + long ei, ldi, jli; 95 + 96 + long ret; 97 + long status32; 98 + }; 99 + 100 + #endif 60 101 61 102 /* Callee saved registers - need to be saved only when you are scheduled out */ 62 103
+32
arch/arc/include/asm/spinlock.h
··· 22 22 { 23 23 unsigned int tmp = __ARCH_SPIN_LOCK_LOCKED__; 24 24 25 + /* 26 + * This smp_mb() is technically superfluous, we only need the one 27 + * after the lock for providing the ACQUIRE semantics. 28 + * However doing the "right" thing was regressing hackbench 29 + * so keeping this, pending further investigation 30 + */ 31 + smp_mb(); 32 + 25 33 __asm__ __volatile__( 26 34 "1: ex %0, [%1] \n" 27 35 " breq %0, %2, 1b \n" 28 36 : "+&r" (tmp) 29 37 : "r"(&(lock->slock)), "ir"(__ARCH_SPIN_LOCK_LOCKED__) 30 38 : "memory"); 39 + 40 + /* 41 + * ACQUIRE barrier to ensure load/store after taking the lock 42 + * don't "bleed-up" out of the critical section (leak-in is allowed) 43 + * http://www.spinics.net/lists/kernel/msg2010409.html 44 + * 45 + * ARCv2 only has load-load, store-store and all-all barrier 46 + * thus need the full all-all barrier 47 + */ 48 + smp_mb(); 31 49 } 32 50 33 51 static inline int arch_spin_trylock(arch_spinlock_t *lock) 34 52 { 35 53 unsigned int tmp = __ARCH_SPIN_LOCK_LOCKED__; 36 54 55 + smp_mb(); 56 + 37 57 __asm__ __volatile__( 38 58 "1: ex %0, [%1] \n" 39 59 : "+r" (tmp) 40 60 : "r"(&(lock->slock)) 41 61 : "memory"); 62 + 63 + smp_mb(); 42 64 43 65 return (tmp == __ARCH_SPIN_LOCK_UNLOCKED__); 44 66 } ··· 69 47 { 70 48 unsigned int tmp = __ARCH_SPIN_LOCK_UNLOCKED__; 71 49 50 + /* 51 + * RELEASE barrier: given the instructions avail on ARCv2, full barrier 52 + * is the only option 53 + */ 54 + smp_mb(); 55 + 72 56 __asm__ __volatile__( 73 57 " ex %0, [%1] \n" 74 58 : "+r" (tmp) 75 59 : "r"(&(lock->slock)) 76 60 : "memory"); 77 61 62 + /* 63 + * superfluous, but keeping for now - see pairing version in 64 + * arch_spin_lock above 65 + */ 78 66 smp_mb(); 79 67 } 80 68
+1
arch/arc/include/asm/thread_info.h
··· 25 25 #endif 26 26 27 27 #define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER) 28 + #define THREAD_SHIFT (PAGE_SHIFT << THREAD_SIZE_ORDER) 28 29 29 30 #ifndef __ASSEMBLY__ 30 31
+8 -9
arch/arc/include/asm/uaccess.h
··· 659 659 static inline long 660 660 __arc_strncpy_from_user(char *dst, const char __user *src, long count) 661 661 { 662 - long res = count; 662 + long res = 0; 663 663 char val; 664 - unsigned int hw_count; 665 664 666 665 if (count == 0) 667 666 return 0; 668 667 669 668 __asm__ __volatile__( 670 - " lp 2f \n" 669 + " lp 3f \n" 671 670 "1: ldb.ab %3, [%2, 1] \n" 672 - " breq.d %3, 0, 2f \n" 671 + " breq.d %3, 0, 3f \n" 673 672 " stb.ab %3, [%1, 1] \n" 674 - "2: sub %0, %6, %4 \n" 675 - "3: ;nop \n" 673 + " add %0, %0, 1 # Num of NON NULL bytes copied \n" 674 + "3: \n" 676 675 " .section .fixup, \"ax\" \n" 677 676 " .align 4 \n" 678 - "4: mov %0, %5 \n" 677 + "4: mov %0, %4 # sets @res as -EFAULT \n" 679 678 " j 3b \n" 680 679 " .previous \n" 681 680 " .section __ex_table, \"a\" \n" 682 681 " .align 4 \n" 683 682 " .word 1b, 4b \n" 684 683 " .previous \n" 685 - : "=r"(res), "+r"(dst), "+r"(src), "=&r"(val), "=l"(hw_count) 686 - : "g"(-EFAULT), "ir"(count), "4"(count) /* this "4" seeds lp_count */ 684 + : "+r"(res), "+r"(dst), "+r"(src), "=r"(val) 685 + : "g"(-EFAULT), "l"(count) 687 686 : "memory"); 688 687 689 688 return res;
+1 -1
arch/arc/include/uapi/asm/page.h
··· 30 30 #define PAGE_OFFSET (0x80000000) 31 31 #else 32 32 #define PAGE_SIZE (1UL << PAGE_SHIFT) /* Default 8K */ 33 - #define PAGE_OFFSET (0x80000000UL) /* Kernel starts at 2G onwards */ 33 + #define PAGE_OFFSET (0x80000000UL) /* Kernel starts at 2G onwards */ 34 34 #endif 35 35 36 36 #define PAGE_MASK (~(PAGE_SIZE-1))
+4 -2
arch/arc/kernel/Makefile
··· 8 8 # Pass UTS_MACHINE for user_regset definition 9 9 CFLAGS_ptrace.o += -DUTS_MACHINE='"$(UTS_MACHINE)"' 10 10 11 - obj-y := arcksyms.o setup.o irq.o time.o reset.o ptrace.o entry.o process.o 11 + obj-y := arcksyms.o setup.o irq.o time.o reset.o ptrace.o process.o devtree.o 12 12 obj-y += signal.o traps.o sys.o troubleshoot.o stacktrace.o disasm.o clk.o 13 - obj-y += devtree.o 13 + obj-$(CONFIG_ISA_ARCOMPACT) += entry-compact.o intc-compact.o 14 + obj-$(CONFIG_ISA_ARCV2) += entry-arcv2.o intc-arcv2.o 14 15 15 16 obj-$(CONFIG_MODULES) += arcksyms.o module.o 16 17 obj-$(CONFIG_SMP) += smp.o 18 + obj-$(CONFIG_ARC_MCIP) += mcip.o 17 19 obj-$(CONFIG_ARC_DW2_UNWIND) += unwind.o 18 20 obj-$(CONFIG_KPROBES) += kprobes.o 19 21 obj-$(CONFIG_ARC_EMUL_UNALIGNED) += unaligned.o
+5
arch/arc/kernel/asm-offsets.c
··· 37 37 38 38 DEFINE(TASK_ACT_MM, offsetof(struct task_struct, active_mm)); 39 39 DEFINE(TASK_TGID, offsetof(struct task_struct, tgid)); 40 + DEFINE(TASK_PID, offsetof(struct task_struct, pid)); 41 + DEFINE(TASK_COMM, offsetof(struct task_struct, comm)); 40 42 41 43 DEFINE(MM_CTXT, offsetof(struct mm_struct, context)); 42 44 DEFINE(MM_PGD, offsetof(struct mm_struct, pgd)); ··· 58 56 DEFINE(PT_r5, offsetof(struct pt_regs, r5)); 59 57 DEFINE(PT_r6, offsetof(struct pt_regs, r6)); 60 58 DEFINE(PT_r7, offsetof(struct pt_regs, r7)); 59 + DEFINE(PT_ret, offsetof(struct pt_regs, ret)); 61 60 62 61 DEFINE(SZ_CALLEE_REGS, sizeof(struct callee_regs)); 63 62 DEFINE(SZ_PT_REGS, sizeof(struct pt_regs)); 63 + DEFINE(PT_user_r25, offsetof(struct pt_regs, user_r25)); 64 + 64 65 return 0; 65 66 }
+2
arch/arc/kernel/devtree.c
··· 32 32 33 33 if (of_flat_dt_is_compatible(dt_root, "abilis,arc-tb10x")) 34 34 arc_base_baud = core_clk/3; 35 + else if (of_flat_dt_is_compatible(dt_root, "snps,arc-sdp")) 36 + arc_base_baud = 33333333; /* Fixed 33MHz clk (AXS10x) */ 35 37 else 36 38 arc_base_baud = core_clk; 37 39 }
+239
arch/arc/kernel/entry-arcv2.S
··· 1 + /* 2 + * ARCv2 ISA based core Low Level Intr/Traps/Exceptions(non-TLB) Handling 3 + * 4 + * Copyright (C) 2013 Synopsys, Inc. (www.synopsys.com) 5 + * 6 + * This program is free software; you can redistribute it and/or modify 7 + * it under the terms of the GNU General Public License version 2 as 8 + * published by the Free Software Foundation. 9 + */ 10 + 11 + #include <linux/linkage.h> /* ARC_{EXTRY,EXIT} */ 12 + #include <asm/entry.h> /* SAVE_ALL_{INT1,INT2,TRAP...} */ 13 + #include <asm/errno.h> 14 + #include <asm/arcregs.h> 15 + #include <asm/irqflags.h> 16 + 17 + .cpu HS 18 + 19 + #define VECTOR .word 20 + 21 + ;############################ Vector Table ################################# 22 + 23 + .section .vector,"a",@progbits 24 + .align 4 25 + 26 + # Initial 16 slots are Exception Vectors 27 + VECTOR stext ; Restart Vector (jump to entry point) 28 + VECTOR mem_service ; Mem exception 29 + VECTOR instr_service ; Instrn Error 30 + VECTOR EV_MachineCheck ; Fatal Machine check 31 + VECTOR EV_TLBMissI ; Intruction TLB miss 32 + VECTOR EV_TLBMissD ; Data TLB miss 33 + VECTOR EV_TLBProtV ; Protection Violation 34 + VECTOR EV_PrivilegeV ; Privilege Violation 35 + VECTOR EV_SWI ; Software Breakpoint 36 + VECTOR EV_Trap ; Trap exception 37 + VECTOR EV_Extension ; Extn Instruction Exception 38 + VECTOR EV_DivZero ; Divide by Zero 39 + VECTOR EV_DCError ; Data Cache Error 40 + VECTOR EV_Misaligned ; Misaligned Data Access 41 + VECTOR reserved ; Reserved slots 42 + VECTOR reserved ; Reserved slots 43 + 44 + # Begin Interrupt Vectors 45 + VECTOR handle_interrupt ; (16) Timer0 46 + VECTOR handle_interrupt ; unused (Timer1) 47 + VECTOR handle_interrupt ; unused (WDT) 48 + VECTOR handle_interrupt ; (19) ICI (inter core interrupt) 49 + VECTOR handle_interrupt 50 + VECTOR handle_interrupt 51 + VECTOR handle_interrupt 52 + VECTOR handle_interrupt ; (23) End of fixed IRQs 53 + 54 + .rept CONFIG_ARC_NUMBER_OF_INTERRUPTS - 8 55 + VECTOR handle_interrupt 56 + .endr 57 + 58 + .section .text, "ax",@progbits 59 + 60 + res_service: ; processor restart 61 + flag 0x1 ; not implemented 62 + nop 63 + nop 64 + 65 + reserved: ; processor restart 66 + rtie ; jump to processor initializations 67 + 68 + ;##################### Interrupt Handling ############################## 69 + 70 + ENTRY(handle_interrupt) 71 + 72 + INTERRUPT_PROLOGUE irq 73 + 74 + clri ; To make status32.IE agree with CPU internal state 75 + 76 + lr r0, [ICAUSE] 77 + 78 + mov blink, ret_from_exception 79 + 80 + b.d arch_do_IRQ 81 + mov r1, sp 82 + 83 + END(handle_interrupt) 84 + 85 + ;################### Non TLB Exception Handling ############################# 86 + 87 + ENTRY(EV_SWI) 88 + flag 1 89 + END(EV_SWI) 90 + 91 + ENTRY(EV_DivZero) 92 + flag 1 93 + END(EV_DivZero) 94 + 95 + ENTRY(EV_DCError) 96 + flag 1 97 + END(EV_DCError) 98 + 99 + ENTRY(EV_Misaligned) 100 + 101 + EXCEPTION_PROLOGUE 102 + 103 + lr r0, [efa] ; Faulting Data address 104 + mov r1, sp 105 + 106 + FAKE_RET_FROM_EXCPN 107 + 108 + SAVE_CALLEE_SAVED_USER 109 + mov r2, sp ; callee_regs 110 + 111 + bl do_misaligned_access 112 + 113 + ; TBD: optimize - do this only if a callee reg was involved 114 + ; either a dst of emulated LD/ST or src with address-writeback 115 + RESTORE_CALLEE_SAVED_USER 116 + 117 + b ret_from_exception 118 + END(EV_Misaligned) 119 + 120 + ; --------------------------------------------- 121 + ; Protection Violation Exception Handler 122 + ; --------------------------------------------- 123 + 124 + ENTRY(EV_TLBProtV) 125 + 126 + EXCEPTION_PROLOGUE 127 + 128 + lr r0, [efa] ; Faulting Data address 129 + mov r1, sp ; pt_regs 130 + 131 + FAKE_RET_FROM_EXCPN 132 + 133 + mov blink, ret_from_exception 134 + b do_page_fault 135 + 136 + END(EV_TLBProtV) 137 + 138 + ; From Linux standpoint Slow Path I/D TLB Miss is same a ProtV as they 139 + ; need to call do_page_fault(). 140 + ; ECR in pt_regs provides whether access was R/W/X 141 + 142 + .global call_do_page_fault 143 + .set call_do_page_fault, EV_TLBProtV 144 + 145 + ;############# Common Handlers for ARCompact and ARCv2 ############## 146 + 147 + #include "entry.S" 148 + 149 + ;############# Return from Intr/Excp/Trap (ARCv2 ISA Specifics) ############## 150 + ; 151 + ; Restore the saved sys context (common exit-path for EXCPN/IRQ/Trap) 152 + ; IRQ shd definitely not happen between now and rtie 153 + ; All 2 entry points to here already disable interrupts 154 + 155 + .Lrestore_regs: 156 + 157 + ld r0, [sp, PT_status32] ; U/K mode at time of entry 158 + lr r10, [AUX_IRQ_ACT] 159 + 160 + bmsk r11, r10, 15 ; AUX_IRQ_ACT.ACTIVE 161 + breq r11, 0, .Lexcept_ret ; No intr active, ret from Exception 162 + 163 + ;####### Return from Intr ####### 164 + 165 + debug_marker_l1: 166 + bbit1.nt r0, STATUS_DE_BIT, .Lintr_ret_to_delay_slot 167 + 168 + .Lisr_ret_fast_path: 169 + ; Handle special case #1: (Entry via Exception, Return via IRQ) 170 + ; 171 + ; Exception in U mode, preempted in kernel, Intr taken (K mode), orig 172 + ; task now returning to U mode (riding the Intr) 173 + ; AUX_IRQ_ACTIVE won't have U bit set (since intr in K mode), hence SP 174 + ; won't be switched to correct U mode value (from AUX_SP) 175 + ; So force AUX_IRQ_ACT.U for such a case 176 + 177 + btst r0, STATUS_U_BIT ; Z flag set if K (Z clear for U) 178 + bset.nz r11, r11, AUX_IRQ_ACT_BIT_U ; NZ means U 179 + sr r11, [AUX_IRQ_ACT] 180 + 181 + INTERRUPT_EPILOGUE irq 182 + rtie 183 + 184 + ;####### Return from Exception / pure kernel mode ####### 185 + 186 + .Lexcept_ret: ; Expects r0 has PT_status32 187 + 188 + debug_marker_syscall: 189 + EXCEPTION_EPILOGUE 190 + rtie 191 + 192 + ;####### Return from Intr to insn in delay slot ####### 193 + 194 + ; Handle special case #2: (Entry via Exception in Delay Slot, Return via IRQ) 195 + ; 196 + ; Intr returning to a Delay Slot (DS) insn 197 + ; (since IRQ NOT allowed in DS in ARCv2, this can only happen if orig 198 + ; entry was via Exception in DS which got preempted in kernel). 199 + ; 200 + ; IRQ RTIE won't reliably restore DE bit and/or BTA, needs handling 201 + .Lintr_ret_to_delay_slot: 202 + debug_marker_ds: 203 + 204 + ld r2, [@intr_to_DE_cnt] 205 + add r2, r2, 1 206 + st r2, [@intr_to_DE_cnt] 207 + 208 + ld r2, [sp, PT_ret] 209 + ld r3, [sp, PT_status32] 210 + 211 + bic r0, r3, STATUS_U_MASK|STATUS_DE_MASK|STATUS_IE_MASK|STATUS_L_MASK 212 + st r0, [sp, PT_status32] 213 + 214 + mov r1, .Lintr_ret_to_delay_slot_2 215 + st r1, [sp, PT_ret] 216 + 217 + st r2, [sp, 0] 218 + st r3, [sp, 4] 219 + 220 + b .Lisr_ret_fast_path 221 + 222 + .Lintr_ret_to_delay_slot_2: 223 + sub sp, sp, SZ_PT_REGS 224 + st r9, [sp, -4] 225 + 226 + ld r9, [sp, 0] 227 + sr r9, [eret] 228 + 229 + ld r9, [sp, 4] 230 + sr r9, [erstatus] 231 + 232 + ld r9, [sp, 8] 233 + sr r9, [erbta] 234 + 235 + ld r9, [sp, -4] 236 + add sp, sp, SZ_PT_REGS 237 + rtie 238 + 239 + END(ret_from_exception)
+393
arch/arc/kernel/entry-compact.S
··· 1 + /* 2 + * Low Level Interrupts/Traps/Exceptions(non-TLB) Handling for ARCompact ISA 3 + * 4 + * Copyright (C) 2014-15 Synopsys, Inc. (www.synopsys.com) 5 + * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com) 6 + * 7 + * This program is free software; you can redistribute it and/or modify 8 + * it under the terms of the GNU General Public License version 2 as 9 + * published by the Free Software Foundation. 10 + * 11 + * vineetg: May 2011 12 + * -Userspace unaligned access emulation 13 + * 14 + * vineetg: Feb 2011 (ptrace low level code fixes) 15 + * -traced syscall return code (r0) was not saved into pt_regs for restoring 16 + * into user reg-file when traded task rets to user space. 17 + * -syscalls needing arch-wrappers (mainly for passing sp as pt_regs) 18 + * were not invoking post-syscall trace hook (jumping directly into 19 + * ret_from_system_call) 20 + * 21 + * vineetg: Nov 2010: 22 + * -Vector table jumps (@8 bytes) converted into branches (@4 bytes) 23 + * -To maintain the slot size of 8 bytes/vector, added nop, which is 24 + * not executed at runtime. 25 + * 26 + * vineetg: Nov 2009 (Everything needed for TIF_RESTORE_SIGMASK) 27 + * -do_signal()invoked upon TIF_RESTORE_SIGMASK as well 28 + * -Wrappers for sys_{,rt_}sigsuspend() nolonger needed as they don't 29 + * need ptregs anymore 30 + * 31 + * Vineetg: Oct 2009 32 + * -In a rare scenario, Process gets a Priv-V exception and gets scheduled 33 + * out. Since we don't do FAKE RTIE for Priv-V, CPU excpetion state remains 34 + * active (AE bit enabled). This causes a double fault for a subseq valid 35 + * exception. Thus FAKE RTIE needed in low level Priv-Violation handler. 36 + * Instr Error could also cause similar scenario, so same there as well. 37 + * 38 + * Vineetg: March 2009 (Supporting 2 levels of Interrupts) 39 + * 40 + * Vineetg: Aug 28th 2008: Bug #94984 41 + * -Zero Overhead Loop Context shd be cleared when entering IRQ/EXcp/Trap 42 + * Normally CPU does this automatically, however when doing FAKE rtie, 43 + * we need to explicitly do this. The problem in macros 44 + * FAKE_RET_FROM_EXCPN and FAKE_RET_FROM_EXCPN_LOCK_IRQ was that this bit 45 + * was being "CLEARED" rather then "SET". Since it is Loop INHIBIT Bit, 46 + * setting it and not clearing it clears ZOL context 47 + * 48 + * Vineetg: May 16th, 2008 49 + * - r25 now contains the Current Task when in kernel 50 + * 51 + * Vineetg: Dec 22, 2007 52 + * Minor Surgery of Low Level ISR to make it SMP safe 53 + * - MMU_SCRATCH0 Reg used for freeing up r9 in Level 1 ISR 54 + * - _current_task is made an array of NR_CPUS 55 + * - Access of _current_task wrapped inside a macro so that if hardware 56 + * team agrees for a dedicated reg, no other code is touched 57 + * 58 + * Amit Bhor, Rahul Trivedi, Kanika Nema, Sameer Dhavale : Codito Tech 2004 59 + */ 60 + 61 + #include <linux/errno.h> 62 + #include <linux/linkage.h> /* {EXTRY,EXIT} */ 63 + #include <asm/entry.h> 64 + #include <asm/irqflags.h> 65 + 66 + .cpu A7 67 + 68 + ;############################ Vector Table ################################# 69 + 70 + .macro VECTOR lbl 71 + #if 1 /* Just in case, build breaks */ 72 + j \lbl 73 + #else 74 + b \lbl 75 + nop 76 + #endif 77 + .endm 78 + 79 + .section .vector, "ax",@progbits 80 + .align 4 81 + 82 + /* Each entry in the vector table must occupy 2 words. Since it is a jump 83 + * across sections (.vector to .text) we are gauranteed that 'j somewhere' 84 + * will use the 'j limm' form of the intrsuction as long as somewhere is in 85 + * a section other than .vector. 86 + */ 87 + 88 + ; ********* Critical System Events ********************** 89 + VECTOR res_service ; 0x0, Restart Vector (0x0) 90 + VECTOR mem_service ; 0x8, Mem exception (0x1) 91 + VECTOR instr_service ; 0x10, Instrn Error (0x2) 92 + 93 + ; ******************** Device ISRs ********************** 94 + #ifdef CONFIG_ARC_IRQ3_LV2 95 + VECTOR handle_interrupt_level2 96 + #else 97 + VECTOR handle_interrupt_level1 98 + #endif 99 + 100 + VECTOR handle_interrupt_level1 101 + 102 + #ifdef CONFIG_ARC_IRQ5_LV2 103 + VECTOR handle_interrupt_level2 104 + #else 105 + VECTOR handle_interrupt_level1 106 + #endif 107 + 108 + #ifdef CONFIG_ARC_IRQ6_LV2 109 + VECTOR handle_interrupt_level2 110 + #else 111 + VECTOR handle_interrupt_level1 112 + #endif 113 + 114 + .rept 25 115 + VECTOR handle_interrupt_level1 ; Other devices 116 + .endr 117 + 118 + /* FOR ARC600: timer = 0x3, uart = 0x8, emac = 0x10 */ 119 + 120 + ; ******************** Exceptions ********************** 121 + VECTOR EV_MachineCheck ; 0x100, Fatal Machine check (0x20) 122 + VECTOR EV_TLBMissI ; 0x108, Intruction TLB miss (0x21) 123 + VECTOR EV_TLBMissD ; 0x110, Data TLB miss (0x22) 124 + VECTOR EV_TLBProtV ; 0x118, Protection Violation (0x23) 125 + ; or Misaligned Access 126 + VECTOR EV_PrivilegeV ; 0x120, Privilege Violation (0x24) 127 + VECTOR EV_Trap ; 0x128, Trap exception (0x25) 128 + VECTOR EV_Extension ; 0x130, Extn Intruction Excp (0x26) 129 + 130 + .rept 24 131 + VECTOR reserved ; Reserved Exceptions 132 + .endr 133 + 134 + 135 + ;##################### Scratch Mem for IRQ stack switching ############# 136 + 137 + ARCFP_DATA int1_saved_reg 138 + .align 32 139 + .type int1_saved_reg, @object 140 + .size int1_saved_reg, 4 141 + int1_saved_reg: 142 + .zero 4 143 + 144 + /* Each Interrupt level needs its own scratch */ 145 + #ifdef CONFIG_ARC_COMPACT_IRQ_LEVELS 146 + 147 + ARCFP_DATA int2_saved_reg 148 + .type int2_saved_reg, @object 149 + .size int2_saved_reg, 4 150 + int2_saved_reg: 151 + .zero 4 152 + 153 + #endif 154 + 155 + ; --------------------------------------------- 156 + .section .text, "ax",@progbits 157 + 158 + res_service: ; processor restart 159 + flag 0x1 ; not implemented 160 + nop 161 + nop 162 + 163 + reserved: ; processor restart 164 + rtie ; jump to processor initializations 165 + 166 + ;##################### Interrupt Handling ############################## 167 + 168 + #ifdef CONFIG_ARC_COMPACT_IRQ_LEVELS 169 + ; --------------------------------------------- 170 + ; Level 2 ISR: Can interrupt a Level 1 ISR 171 + ; --------------------------------------------- 172 + ENTRY(handle_interrupt_level2) 173 + 174 + INTERRUPT_PROLOGUE 2 175 + 176 + ;------------------------------------------------------ 177 + ; if L2 IRQ interrupted a L1 ISR, disable preemption 178 + ;------------------------------------------------------ 179 + 180 + ld r9, [sp, PT_status32] ; get statu32_l2 (saved in pt_regs) 181 + bbit0 r9, STATUS_A1_BIT, 1f ; L1 not active when L2 IRQ, so normal 182 + 183 + ; A1 is set in status32_l2 184 + ; bump thread_info->preempt_count (Disable preemption) 185 + GET_CURR_THR_INFO_FROM_SP r10 186 + ld r9, [r10, THREAD_INFO_PREEMPT_COUNT] 187 + add r9, r9, 1 188 + st r9, [r10, THREAD_INFO_PREEMPT_COUNT] 189 + 190 + 1: 191 + ;------------------------------------------------------ 192 + ; setup params for Linux common ISR and invoke it 193 + ;------------------------------------------------------ 194 + lr r0, [icause2] 195 + and r0, r0, 0x1f 196 + 197 + bl.d @arch_do_IRQ 198 + mov r1, sp 199 + 200 + mov r8,0x2 201 + sr r8, [AUX_IRQ_LV12] ; clear bit in Sticky Status Reg 202 + 203 + b ret_from_exception 204 + 205 + END(handle_interrupt_level2) 206 + 207 + #endif 208 + 209 + ; --------------------------------------------- 210 + ; Level 1 ISR 211 + ; --------------------------------------------- 212 + ENTRY(handle_interrupt_level1) 213 + 214 + INTERRUPT_PROLOGUE 1 215 + 216 + lr r0, [icause1] 217 + and r0, r0, 0x1f 218 + 219 + #ifdef CONFIG_TRACE_IRQFLAGS 220 + ; icause1 needs to be read early, before calling tracing, which 221 + ; can clobber scratch regs, hence use of stack to stash it 222 + push r0 223 + TRACE_ASM_IRQ_DISABLE 224 + pop r0 225 + #endif 226 + 227 + bl.d @arch_do_IRQ 228 + mov r1, sp 229 + 230 + mov r8,0x1 231 + sr r8, [AUX_IRQ_LV12] ; clear bit in Sticky Status Reg 232 + 233 + b ret_from_exception 234 + END(handle_interrupt_level1) 235 + 236 + ;################### Non TLB Exception Handling ############################# 237 + 238 + ; --------------------------------------------- 239 + ; Protection Violation Exception Handler 240 + ; --------------------------------------------- 241 + 242 + ENTRY(EV_TLBProtV) 243 + 244 + EXCEPTION_PROLOGUE 245 + 246 + lr r2, [ecr] 247 + lr r0, [efa] ; Faulting Data address (not part of pt_regs saved above) 248 + 249 + ; Exception auto-disables further Intr/exceptions. 250 + ; Re-enable them by pretending to return from exception 251 + ; (so rest of handler executes in pure K mode) 252 + 253 + FAKE_RET_FROM_EXCPN 254 + 255 + mov r1, sp ; Handle to pt_regs 256 + 257 + ;------ (5) Type of Protection Violation? ---------- 258 + ; 259 + ; ProtV Hardware Exception is triggered for Access Faults of 2 types 260 + ; -Access Violaton : 00_23_(00|01|02|03)_00 261 + ; x r w r+w 262 + ; -Unaligned Access : 00_23_04_00 263 + ; 264 + bbit1 r2, ECR_C_BIT_PROTV_MISALIG_DATA, 4f 265 + 266 + ;========= (6a) Access Violation Processing ======== 267 + bl do_page_fault 268 + b ret_from_exception 269 + 270 + ;========== (6b) Non aligned access ============ 271 + 4: 272 + 273 + SAVE_CALLEE_SAVED_USER 274 + mov r2, sp ; callee_regs 275 + 276 + bl do_misaligned_access 277 + 278 + ; TBD: optimize - do this only if a callee reg was involved 279 + ; either a dst of emulated LD/ST or src with address-writeback 280 + RESTORE_CALLEE_SAVED_USER 281 + 282 + b ret_from_exception 283 + 284 + END(EV_TLBProtV) 285 + 286 + ; Wrapper for Linux page fault handler called from EV_TLBMiss* 287 + ; Very similar to ProtV handler case (6a) above, but avoids the extra checks 288 + ; for Misaligned access 289 + ; 290 + ENTRY(call_do_page_fault) 291 + 292 + EXCEPTION_PROLOGUE 293 + lr r0, [efa] ; Faulting Data address 294 + mov r1, sp 295 + FAKE_RET_FROM_EXCPN 296 + 297 + mov blink, ret_from_exception 298 + b do_page_fault 299 + 300 + END(call_do_page_fault) 301 + 302 + ;############# Common Handlers for ARCompact and ARCv2 ############## 303 + 304 + #include "entry.S" 305 + 306 + ;############# Return from Intr/Excp/Trap (ARC Specifics) ############## 307 + ; 308 + ; Restore the saved sys context (common exit-path for EXCPN/IRQ/Trap) 309 + ; IRQ shd definitely not happen between now and rtie 310 + ; All 2 entry points to here already disable interrupts 311 + 312 + .Lrestore_regs: 313 + 314 + TRACE_ASM_IRQ_ENABLE 315 + 316 + lr r10, [status32] 317 + 318 + ; Restore REG File. In case multiple Events outstanding, 319 + ; use the same priorty as rtie: EXCPN, L2 IRQ, L1 IRQ, None 320 + ; Note that we use realtime STATUS32 (not pt_regs->status32) to 321 + ; decide that. 322 + 323 + ; if Returning from Exception 324 + btst r10, STATUS_AE_BIT 325 + bnz .Lexcep_ret 326 + 327 + ; Not Exception so maybe Interrupts (Level 1 or 2) 328 + 329 + #ifdef CONFIG_ARC_COMPACT_IRQ_LEVELS 330 + 331 + ; Level 2 interrupt return Path - from hardware standpoint 332 + bbit0 r10, STATUS_A2_BIT, not_level2_interrupt 333 + 334 + ;------------------------------------------------------------------ 335 + ; However the context returning might not have taken L2 intr itself 336 + ; e.g. Task'A' user-code -> L2 intr -> schedule -> 'B' user-code ret 337 + ; Special considerations needed for the context which took L2 intr 338 + 339 + ld r9, [sp, PT_event] ; Ensure this is L2 intr context 340 + brne r9, event_IRQ2, 149f 341 + 342 + ;------------------------------------------------------------------ 343 + ; if L2 IRQ interrupted an L1 ISR, we'd disabled preemption earlier 344 + ; so that sched doesn't move to new task, causing L1 to be delayed 345 + ; undeterministically. Now that we've achieved that, let's reset 346 + ; things to what they were, before returning from L2 context 347 + ;---------------------------------------------------------------- 348 + 349 + ld r9, [sp, PT_status32] ; get statu32_l2 (saved in pt_regs) 350 + bbit0 r9, STATUS_A1_BIT, 149f ; L1 not active when L2 IRQ, so normal 351 + 352 + ; decrement thread_info->preempt_count (re-enable preemption) 353 + GET_CURR_THR_INFO_FROM_SP r10 354 + ld r9, [r10, THREAD_INFO_PREEMPT_COUNT] 355 + 356 + ; paranoid check, given A1 was active when A2 happened, preempt count 357 + ; must not be 0 because we would have incremented it. 358 + ; If this does happen we simply HALT as it means a BUG !!! 359 + cmp r9, 0 360 + bnz 2f 361 + flag 1 362 + 363 + 2: 364 + sub r9, r9, 1 365 + st r9, [r10, THREAD_INFO_PREEMPT_COUNT] 366 + 367 + 149: 368 + ;return from level 2 369 + INTERRUPT_EPILOGUE 2 370 + debug_marker_l2: 371 + rtie 372 + 373 + not_level2_interrupt: 374 + 375 + #endif 376 + 377 + bbit0 r10, STATUS_A1_BIT, .Lpure_k_mode_ret 378 + 379 + ;return from level 1 380 + INTERRUPT_EPILOGUE 1 381 + debug_marker_l1: 382 + rtie 383 + 384 + .Lexcep_ret: 385 + .Lpure_k_mode_ret: 386 + 387 + ;this case is for syscalls or Exceptions or pure kernel mode 388 + 389 + EXCEPTION_EPILOGUE 390 + debug_marker_syscall: 391 + rtie 392 + 393 + END(ret_from_exception)
+71 -456
arch/arc/kernel/entry.S
··· 1 1 /* 2 - * Low Level Interrupts/Traps/Exceptions(non-TLB) Handling for ARC 2 + * Common Low Level Interrupts/Traps/Exceptions(non-TLB) Handling for ARC 3 + * (included from entry-<isa>.S 3 4 * 5 + * Copyright (C) 2014-15 Synopsys, Inc. (www.synopsys.com) 4 6 * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com) 5 7 * 6 8 * This program is free software; you can redistribute it and/or modify 7 9 * it under the terms of the GNU General Public License version 2 as 8 10 * published by the Free Software Foundation. 9 - * 10 - * vineetg: May 2011 11 - * -Userspace unaligned access emulation 12 - * 13 - * vineetg: Feb 2011 (ptrace low level code fixes) 14 - * -traced syscall return code (r0) was not saved into pt_regs for restoring 15 - * into user reg-file when traded task rets to user space. 16 - * -syscalls needing arch-wrappers (mainly for passing sp as pt_regs) 17 - * were not invoking post-syscall trace hook (jumping directly into 18 - * ret_from_system_call) 19 - * 20 - * vineetg: Nov 2010: 21 - * -Vector table jumps (@8 bytes) converted into branches (@4 bytes) 22 - * -To maintain the slot size of 8 bytes/vector, added nop, which is 23 - * not executed at runtime. 24 - * 25 - * vineetg: Nov 2009 (Everything needed for TIF_RESTORE_SIGMASK) 26 - * -do_signal()invoked upon TIF_RESTORE_SIGMASK as well 27 - * -Wrappers for sys_{,rt_}sigsuspend() nolonger needed as they don't 28 - * need ptregs anymore 29 - * 30 - * Vineetg: Oct 2009 31 - * -In a rare scenario, Process gets a Priv-V exception and gets scheduled 32 - * out. Since we don't do FAKE RTIE for Priv-V, CPU excpetion state remains 33 - * active (AE bit enabled). This causes a double fault for a subseq valid 34 - * exception. Thus FAKE RTIE needed in low level Priv-Violation handler. 35 - * Instr Error could also cause similar scenario, so same there as well. 36 - * 37 - * Vineetg: March 2009 (Supporting 2 levels of Interrupts) 38 - * 39 - * Vineetg: Aug 28th 2008: Bug #94984 40 - * -Zero Overhead Loop Context shd be cleared when entering IRQ/EXcp/Trap 41 - * Normally CPU does this automatically, however when doing FAKE rtie, 42 - * we need to explicitly do this. The problem in macros 43 - * FAKE_RET_FROM_EXCPN and FAKE_RET_FROM_EXCPN_LOCK_IRQ was that this bit 44 - * was being "CLEARED" rather then "SET". Since it is Loop INHIBIT Bit, 45 - * setting it and not clearing it clears ZOL context 46 - * 47 - * Vineetg: May 16th, 2008 48 - * - r25 now contains the Current Task when in kernel 49 - * 50 - * Vineetg: Dec 22, 2007 51 - * Minor Surgery of Low Level ISR to make it SMP safe 52 - * - MMU_SCRATCH0 Reg used for freeing up r9 in Level 1 ISR 53 - * - _current_task is made an array of NR_CPUS 54 - * - Access of _current_task wrapped inside a macro so that if hardware 55 - * team agrees for a dedicated reg, no other code is touched 56 - * 57 - * Amit Bhor, Rahul Trivedi, Kanika Nema, Sameer Dhavale : Codito Tech 2004 58 11 */ 59 12 60 13 /*------------------------------------------------------------------ ··· 20 67 * Global Pointer (gp) r26 21 68 * Frame Pointer (fp) r27 22 69 * Stack Pointer (sp) r28 23 - * Interrupt link register (ilink1) r29 24 - * Interrupt link register (ilink2) r30 25 70 * Branch link register (blink) r31 26 71 *------------------------------------------------------------------ 27 72 */ 28 73 29 - .cpu A7 74 + ;################### Special Sys Call Wrappers ########################## 30 75 31 - ;############################ Vector Table ################################# 76 + ENTRY(sys_clone_wrapper) 77 + SAVE_CALLEE_SAVED_USER 78 + bl @sys_clone 79 + DISCARD_CALLEE_SAVED_USER 32 80 33 - .macro VECTOR lbl 34 - #if 1 /* Just in case, build breaks */ 35 - j \lbl 36 - #else 37 - b \lbl 38 - nop 39 - #endif 40 - .endm 81 + GET_CURR_THR_INFO_FLAGS r10 82 + btst r10, TIF_SYSCALL_TRACE 83 + bnz tracesys_exit 41 84 42 - .section .vector, "ax",@progbits 43 - .align 4 85 + b ret_from_system_call 86 + END(sys_clone_wrapper) 44 87 45 - /* Each entry in the vector table must occupy 2 words. Since it is a jump 46 - * across sections (.vector to .text) we are gauranteed that 'j somewhere' 47 - * will use the 'j limm' form of the intrsuction as long as somewhere is in 48 - * a section other than .vector. 49 - */ 88 + ENTRY(ret_from_fork) 89 + ; when the forked child comes here from the __switch_to function 90 + ; r0 has the last task pointer. 91 + ; put last task in scheduler queue 92 + bl @schedule_tail 50 93 51 - ; ********* Critical System Events ********************** 52 - VECTOR res_service ; 0x0, Restart Vector (0x0) 53 - VECTOR mem_service ; 0x8, Mem exception (0x1) 54 - VECTOR instr_service ; 0x10, Instrn Error (0x2) 94 + ld r9, [sp, PT_status32] 95 + brne r9, 0, 1f 55 96 56 - ; ******************** Device ISRs ********************** 57 - #ifdef CONFIG_ARC_IRQ3_LV2 58 - VECTOR handle_interrupt_level2 59 - #else 60 - VECTOR handle_interrupt_level1 61 - #endif 62 - 63 - VECTOR handle_interrupt_level1 64 - 65 - #ifdef CONFIG_ARC_IRQ5_LV2 66 - VECTOR handle_interrupt_level2 67 - #else 68 - VECTOR handle_interrupt_level1 69 - #endif 70 - 71 - #ifdef CONFIG_ARC_IRQ6_LV2 72 - VECTOR handle_interrupt_level2 73 - #else 74 - VECTOR handle_interrupt_level1 75 - #endif 76 - 77 - .rept 25 78 - VECTOR handle_interrupt_level1 ; Other devices 79 - .endr 80 - 81 - /* FOR ARC600: timer = 0x3, uart = 0x8, emac = 0x10 */ 82 - 83 - ; ******************** Exceptions ********************** 84 - VECTOR EV_MachineCheck ; 0x100, Fatal Machine check (0x20) 85 - VECTOR EV_TLBMissI ; 0x108, Intruction TLB miss (0x21) 86 - VECTOR EV_TLBMissD ; 0x110, Data TLB miss (0x22) 87 - VECTOR EV_TLBProtV ; 0x118, Protection Violation (0x23) 88 - ; or Misaligned Access 89 - VECTOR EV_PrivilegeV ; 0x120, Privilege Violation (0x24) 90 - VECTOR EV_Trap ; 0x128, Trap exception (0x25) 91 - VECTOR EV_Extension ; 0x130, Extn Intruction Excp (0x26) 92 - 93 - .rept 24 94 - VECTOR reserved ; Reserved Exceptions 95 - .endr 96 - 97 - #include <linux/linkage.h> /* {EXTRY,EXIT} */ 98 - #include <asm/entry.h> /* SAVE_ALL_{INT1,INT2,SYS...} */ 99 - #include <asm/errno.h> 100 - #include <asm/arcregs.h> 101 - #include <asm/irqflags.h> 102 - 103 - ;##################### Scratch Mem for IRQ stack switching ############# 104 - 105 - ARCFP_DATA int1_saved_reg 106 - .align 32 107 - .type int1_saved_reg, @object 108 - .size int1_saved_reg, 4 109 - int1_saved_reg: 110 - .zero 4 111 - 112 - /* Each Interrupt level needs its own scratch */ 113 - #ifdef CONFIG_ARC_COMPACT_IRQ_LEVELS 114 - 115 - ARCFP_DATA int2_saved_reg 116 - .type int2_saved_reg, @object 117 - .size int2_saved_reg, 4 118 - int2_saved_reg: 119 - .zero 4 120 - 121 - #endif 122 - 123 - ; --------------------------------------------- 124 - .section .text, "ax",@progbits 125 - 126 - res_service: ; processor restart 127 - flag 0x1 ; not implemented 128 - nop 129 - nop 130 - 131 - reserved: ; processor restart 132 - rtie ; jump to processor initializations 133 - 134 - ;##################### Interrupt Handling ############################## 135 - 136 - #ifdef CONFIG_ARC_COMPACT_IRQ_LEVELS 137 - ; --------------------------------------------- 138 - ; Level 2 ISR: Can interrupt a Level 1 ISR 139 - ; --------------------------------------------- 140 - ENTRY(handle_interrupt_level2) 141 - 142 - ; TODO-vineetg for SMP this wont work 143 - ; free up r9 as scratchpad 144 - st r9, [@int2_saved_reg] 145 - 146 - ;Which mode (user/kernel) was the system in when intr occured 147 - lr r9, [status32_l2] 148 - 149 - SWITCH_TO_KERNEL_STK 150 - SAVE_ALL_INT2 151 - 152 - ;------------------------------------------------------ 153 - ; if L2 IRQ interrupted a L1 ISR, disable preemption 154 - ;------------------------------------------------------ 155 - 156 - ld r9, [sp, PT_status32] ; get statu32_l2 (saved in pt_regs) 157 - bbit0 r9, STATUS_A1_BIT, 1f ; L1 not active when L2 IRQ, so normal 158 - 159 - ; A1 is set in status32_l2 160 - ; bump thread_info->preempt_count (Disable preemption) 161 - GET_CURR_THR_INFO_FROM_SP r10 162 - ld r9, [r10, THREAD_INFO_PREEMPT_COUNT] 163 - add r9, r9, 1 164 - st r9, [r10, THREAD_INFO_PREEMPT_COUNT] 97 + jl.d [r14] ; kernel thread entry point 98 + mov r0, r13 ; (see PF_KTHREAD block in copy_thread) 165 99 166 100 1: 167 - ;------------------------------------------------------ 168 - ; setup params for Linux common ISR and invoke it 169 - ;------------------------------------------------------ 170 - lr r0, [icause2] 171 - and r0, r0, 0x1f 101 + ; Return to user space 102 + ; 1. Any forked task (Reach here via BRne above) 103 + ; 2. First ever init task (Reach here via return from JL above) 104 + ; This is the historic "kernel_execve" use-case, to return to init 105 + ; user mode, in a round about way since that is always done from 106 + ; a kernel thread which is executed via JL above but always returns 107 + ; out whenever kernel_execve (now inline do_fork()) is involved 108 + b ret_from_exception 109 + END(ret_from_fork) 172 110 173 - bl.d @arch_do_IRQ 174 - mov r1, sp 111 + #ifdef CONFIG_ARC_DW2_UNWIND 112 + ; Workaround for bug 94179 (STAR ): 113 + ; Despite -fasynchronous-unwind-tables, linker is not making dwarf2 unwinder 114 + ; section (.debug_frame) as loadable. So we force it here. 115 + ; This also fixes STAR 9000487933 where the prev-workaround (objcopy --setflag) 116 + ; would not work after a clean build due to kernel build system dependencies. 117 + .section .debug_frame, "wa",@progbits 175 118 176 - mov r8,0x2 177 - sr r8, [AUX_IRQ_LV12] ; clear bit in Sticky Status Reg 178 - 179 - b ret_from_exception 180 - 181 - END(handle_interrupt_level2) 182 - 119 + ; Reset to .text as this file is included in entry-<isa>.S 120 + .section .text, "ax",@progbits 183 121 #endif 184 - 185 - ; --------------------------------------------- 186 - ; Level 1 ISR 187 - ; --------------------------------------------- 188 - ENTRY(handle_interrupt_level1) 189 - 190 - /* free up r9 as scratchpad */ 191 - #ifdef CONFIG_SMP 192 - sr r9, [ARC_REG_SCRATCH_DATA0] 193 - #else 194 - st r9, [@int1_saved_reg] 195 - #endif 196 - 197 - ;Which mode (user/kernel) was the system in when intr occured 198 - lr r9, [status32_l1] 199 - 200 - SWITCH_TO_KERNEL_STK 201 - SAVE_ALL_INT1 202 - 203 - lr r0, [icause1] 204 - and r0, r0, 0x1f 205 - 206 - #ifdef CONFIG_TRACE_IRQFLAGS 207 - ; icause1 needs to be read early, before calling tracing, which 208 - ; can clobber scratch regs, hence use of stack to stash it 209 - push r0 210 - TRACE_ASM_IRQ_DISABLE 211 - pop r0 212 - #endif 213 - 214 - bl.d @arch_do_IRQ 215 - mov r1, sp 216 - 217 - mov r8,0x1 218 - sr r8, [AUX_IRQ_LV12] ; clear bit in Sticky Status Reg 219 - 220 - b ret_from_exception 221 - END(handle_interrupt_level1) 222 122 223 123 ;################### Non TLB Exception Handling ############################# 224 124 ··· 86 280 lr r0, [efa] 87 281 mov r1, sp 88 282 89 - FAKE_RET_FROM_EXCPN r9 283 + FAKE_RET_FROM_EXCPN 90 284 91 285 bl do_insterror_or_kprobe 92 286 b ret_from_exception ··· 103 297 lr r0, [efa] 104 298 mov r1, sp 105 299 106 - FAKE_RET_FROM_EXCPN r9 300 + FAKE_RET_FROM_EXCPN 107 301 108 302 bl do_memory_error 109 303 b ret_from_exception ··· 140 334 END(EV_MachineCheck) 141 335 142 336 ; --------------------------------------------- 143 - ; Protection Violation Exception Handler 144 - ; --------------------------------------------- 145 - 146 - ENTRY(EV_TLBProtV) 147 - 148 - EXCEPTION_PROLOGUE 149 - 150 - ;---------(3) Save some more regs----------------- 151 - ; vineetg: Mar 6th: Random Seg Fault issue #1 152 - ; ecr and efa were not saved in case an Intr sneaks in 153 - ; after fake rtie 154 - 155 - lr r2, [ecr] 156 - lr r0, [efa] ; Faulting Data address 157 - 158 - ; --------(4) Return from CPU Exception Mode --------- 159 - ; Fake a rtie, but rtie to next label 160 - ; That way, subsequently, do_page_fault ( ) executes in pure kernel 161 - ; mode with further Exceptions enabled 162 - 163 - FAKE_RET_FROM_EXCPN r9 164 - 165 - mov r1, sp 166 - 167 - ;------ (5) Type of Protection Violation? ---------- 168 - ; 169 - ; ProtV Hardware Exception is triggered for Access Faults of 2 types 170 - ; -Access Violaton : 00_23_(00|01|02|03)_00 171 - ; x r w r+w 172 - ; -Unaligned Access : 00_23_04_00 173 - ; 174 - bbit1 r2, ECR_C_BIT_PROTV_MISALIG_DATA, 4f 175 - 176 - ;========= (6a) Access Violation Processing ======== 177 - bl do_page_fault 178 - b ret_from_exception 179 - 180 - ;========== (6b) Non aligned access ============ 181 - 4: 182 - 183 - SAVE_CALLEE_SAVED_USER 184 - mov r2, sp ; callee_regs 185 - 186 - bl do_misaligned_access 187 - 188 - ; TBD: optimize - do this only if a callee reg was involved 189 - ; either a dst of emulated LD/ST or src with address-writeback 190 - RESTORE_CALLEE_SAVED_USER 191 - 192 - b ret_from_exception 193 - 194 - END(EV_TLBProtV) 195 - 196 - ; --------------------------------------------- 197 337 ; Privilege Violation Exception Handler 198 338 ; --------------------------------------------- 199 339 ENTRY(EV_PrivilegeV) ··· 149 397 lr r0, [efa] 150 398 mov r1, sp 151 399 152 - FAKE_RET_FROM_EXCPN r9 400 + FAKE_RET_FROM_EXCPN 153 401 154 402 bl do_privilege_fault 155 403 b ret_from_exception ··· 165 413 lr r0, [efa] 166 414 mov r1, sp 167 415 168 - FAKE_RET_FROM_EXCPN r9 416 + FAKE_RET_FROM_EXCPN 169 417 170 418 bl do_extension_fault 171 419 b ret_from_exception 172 420 END(EV_Extension) 173 421 174 - ;######################### System Call Tracing ######################### 422 + ;################ Trap Handling (Syscall, Breakpoint) ################## 175 423 424 + ; --------------------------------------------- 425 + ; syscall Tracing 426 + ; --------------------------------------------- 176 427 tracesys: 177 428 ; save EFA in case tracer wants the PC of traced task 178 429 ; using ERET won't work since next-PC has already committed ··· 218 463 b ret_from_exception ; NOT ret_from_system_call at is saves r0 which 219 464 ; we'd done before calling post hook above 220 465 221 - ;################### Break Point TRAP ########################## 222 - 223 - ; ======= (5b) Trap is due to Break-Point ========= 224 - 466 + ; --------------------------------------------- 467 + ; Breakpoint TRAP 468 + ; --------------------------------------------- 225 469 trap_with_param: 226 470 227 471 ; stop_pc info by gdb needs this info ··· 229 475 230 476 ; Now that we have read EFA, it is safe to do "fake" rtie 231 477 ; and get out of CPU exception mode 232 - FAKE_RET_FROM_EXCPN r11 478 + FAKE_RET_FROM_EXCPN 233 479 234 480 ; Save callee regs in case gdb wants to have a look 235 481 ; SP will grow up by size of CALLEE Reg-File ··· 248 494 249 495 b ret_from_exception 250 496 251 - ;##################### Trap Handling ############################## 252 - ; 253 - ; EV_Trap caused by TRAP_S and TRAP0 instructions. 254 - ;------------------------------------------------------------------ 255 - ; (1) System Calls 256 - ; :parameters in r0-r7. 257 - ; :r8 has the system call number 258 - ; (2) Break Points 259 - ;------------------------------------------------------------------ 497 + ; --------------------------------------------- 498 + ; syscall TRAP 499 + ; ABI: (r0-r7) upto 8 args, (r8) syscall number 500 + ; --------------------------------------------- 260 501 261 502 ENTRY(EV_Trap) 262 503 263 504 EXCEPTION_PROLOGUE 264 505 265 - ;------- (4) What caused the Trap -------------- 266 - lr r12, [ecr] 267 - bmsk.f 0, r12, 7 506 + ;============ TRAP 1 :breakpoints 507 + ; Check ECR for trap with arg (PROLOGUE ensures r9 has ECR) 508 + bmsk.f 0, r9, 7 268 509 bnz trap_with_param 269 510 270 - ; ======= (5a) Trap is due to System Call ======== 511 + ;============ TRAP (no param): syscall top level 271 512 272 - ; Before doing anything, return from CPU Exception Mode 273 - FAKE_RET_FROM_EXCPN r11 513 + ; First return from Exception to pure K mode (Exception/IRQs renabled) 514 + FAKE_RET_FROM_EXCPN 274 515 275 - ; If syscall tracing ongoing, invoke pre-pos-hooks 516 + ; If syscall tracing ongoing, invoke pre-post-hooks 276 517 GET_CURR_THR_INFO_FLAGS r10 277 518 btst r10, TIF_SYSCALL_TRACE 278 519 bnz tracesys ; this never comes back 279 520 280 - ;============ This is normal System Call case ========== 281 - ; Sys-call num shd not exceed the total system calls avail 521 + ;============ Normal syscall case 522 + 523 + ; syscall num shd not exceed the total system calls avail 282 524 cmp r8, NR_syscalls 283 525 mov.hi r0, -ENOSYS 284 526 bhi ret_from_system_call ··· 315 565 ; Fast Path return to user mode if no pending work 316 566 GET_CURR_THR_INFO_FLAGS r9 317 567 and.f 0, r9, _TIF_WORK_MASK 318 - bz restore_regs 568 + bz .Lrestore_regs 319 569 320 570 ; --- (Slow Path #1) task preemption --- 321 571 bbit0 r9, TIF_NEED_RESCHED, .Lchk_pend_signals ··· 374 624 ; Can't preempt if preemption disabled 375 625 GET_CURR_THR_INFO_FROM_SP r10 376 626 ld r8, [r10, THREAD_INFO_PREEMPT_COUNT] 377 - brne r8, 0, restore_regs 627 + brne r8, 0, .Lrestore_regs 378 628 379 629 ; check if this task's NEED_RESCHED flag set 380 630 ld r9, [r10, THREAD_INFO_FLAGS] 381 - bbit0 r9, TIF_NEED_RESCHED, restore_regs 631 + bbit0 r9, TIF_NEED_RESCHED, .Lrestore_regs 382 632 383 633 ; Invoke PREEMPTION 384 634 bl preempt_schedule_irq ··· 386 636 ; preempt_schedule_irq() always returns with IRQ disabled 387 637 #endif 388 638 389 - ; fall through 639 + b .Lrestore_regs 390 640 391 - ;############# Return from Intr/Excp/Trap (ARC Specifics) ############## 392 - ; 393 - ; Restore the saved sys context (common exit-path for EXCPN/IRQ/Trap) 394 - ; IRQ shd definitely not happen between now and rtie 395 - ; All 2 entry points to here already disable interrupts 641 + ##### DONT ADD CODE HERE - .Lrestore_regs actually follows in entry-<isa>.S 396 642 397 - restore_regs : 398 - 399 - TRACE_ASM_IRQ_ENABLE 400 - 401 - lr r10, [status32] 402 - 403 - ; Restore REG File. In case multiple Events outstanding, 404 - ; use the same priorty as rtie: EXCPN, L2 IRQ, L1 IRQ, None 405 - ; Note that we use realtime STATUS32 (not pt_regs->status32) to 406 - ; decide that. 407 - 408 - ; if Returning from Exception 409 - bbit0 r10, STATUS_AE_BIT, not_exception 410 - RESTORE_ALL_SYS 411 - rtie 412 - 413 - ; Not Exception so maybe Interrupts (Level 1 or 2) 414 - 415 - not_exception: 416 - 417 - #ifdef CONFIG_ARC_COMPACT_IRQ_LEVELS 418 - 419 - ; Level 2 interrupt return Path - from hardware standpoint 420 - bbit0 r10, STATUS_A2_BIT, not_level2_interrupt 421 - 422 - ;------------------------------------------------------------------ 423 - ; However the context returning might not have taken L2 intr itself 424 - ; e.g. Task'A' user-code -> L2 intr -> schedule -> 'B' user-code ret 425 - ; Special considerations needed for the context which took L2 intr 426 - 427 - ld r9, [sp, PT_event] ; Ensure this is L2 intr context 428 - brne r9, event_IRQ2, 149f 429 - 430 - ;------------------------------------------------------------------ 431 - ; if L2 IRQ interrupted an L1 ISR, we'd disabled preemption earlier 432 - ; so that sched doesn't move to new task, causing L1 to be delayed 433 - ; undeterministically. Now that we've achieved that, let's reset 434 - ; things to what they were, before returning from L2 context 435 - ;---------------------------------------------------------------- 436 - 437 - ld r9, [sp, PT_status32] ; get statu32_l2 (saved in pt_regs) 438 - bbit0 r9, STATUS_A1_BIT, 149f ; L1 not active when L2 IRQ, so normal 439 - 440 - ; decrement thread_info->preempt_count (re-enable preemption) 441 - GET_CURR_THR_INFO_FROM_SP r10 442 - ld r9, [r10, THREAD_INFO_PREEMPT_COUNT] 443 - 444 - ; paranoid check, given A1 was active when A2 happened, preempt count 445 - ; must not be 0 because we would have incremented it. 446 - ; If this does happen we simply HALT as it means a BUG !!! 447 - cmp r9, 0 448 - bnz 2f 449 - flag 1 450 - 451 - 2: 452 - sub r9, r9, 1 453 - st r9, [r10, THREAD_INFO_PREEMPT_COUNT] 454 - 455 - 149: 456 - ;return from level 2 457 - RESTORE_ALL_INT2 458 - debug_marker_l2: 459 - rtie 460 - 461 - not_level2_interrupt: 462 - 463 - #endif 464 - 465 - bbit0 r10, STATUS_A1_BIT, not_level1_interrupt 466 - 467 - ;return from level 1 468 - 469 - RESTORE_ALL_INT1 470 - debug_marker_l1: 471 - rtie 472 - 473 - not_level1_interrupt: 474 - 475 - ;this case is for syscalls or Exceptions (with fake rtie) 476 - 477 - RESTORE_ALL_SYS 478 - debug_marker_syscall: 479 - rtie 480 - 481 - END(ret_from_exception) 482 - 483 - ENTRY(ret_from_fork) 484 - ; when the forked child comes here from the __switch_to function 485 - ; r0 has the last task pointer. 486 - ; put last task in scheduler queue 487 - bl @schedule_tail 488 - 489 - ld r9, [sp, PT_status32] 490 - brne r9, 0, 1f 491 - 492 - jl.d [r14] ; kernel thread entry point 493 - mov r0, r13 ; (see PF_KTHREAD block in copy_thread) 494 - 495 - 1: 496 - ; Return to user space 497 - ; 1. Any forked task (Reach here via BRne above) 498 - ; 2. First ever init task (Reach here via return from JL above) 499 - ; This is the historic "kernel_execve" use-case, to return to init 500 - ; user mode, in a round about way since that is always done from 501 - ; a kernel thread which is executed via JL above but always returns 502 - ; out whenever kernel_execve (now inline do_fork()) is involved 503 - b ret_from_exception 504 - END(ret_from_fork) 505 - 506 - ;################### Special Sys Call Wrappers ########################## 507 - 508 - ENTRY(sys_clone_wrapper) 509 - SAVE_CALLEE_SAVED_USER 510 - bl @sys_clone 511 - DISCARD_CALLEE_SAVED_USER 512 - 513 - GET_CURR_THR_INFO_FLAGS r10 514 - btst r10, TIF_SYSCALL_TRACE 515 - bnz tracesys_exit 516 - 517 - b ret_from_system_call 518 - END(sys_clone_wrapper) 519 - 520 - #ifdef CONFIG_ARC_DW2_UNWIND 521 - ; Workaround for bug 94179 (STAR ): 522 - ; Despite -fasynchronous-unwind-tables, linker is not making dwarf2 unwinder 523 - ; section (.debug_frame) as loadable. So we force it here. 524 - ; This also fixes STAR 9000487933 where the prev-workaround (objcopy --setflag) 525 - ; would not work after a clean build due to kernel build system dependencies. 526 - .section .debug_frame, "wa",@progbits 527 - #endif
+2 -2
arch/arc/kernel/head.S
··· 49 49 1: 50 50 .endm 51 51 52 - .cpu A7 53 - 54 52 .section .init.text, "ax",@progbits 55 53 .type stext, @function 56 54 .globl stext ··· 81 83 st.ab 0, [r5, 4] 82 84 1: 83 85 86 + #ifdef CONFIG_ARC_UBOOT_SUPPORT 84 87 ; Uboot - kernel ABI 85 88 ; r0 = [0] No uboot interaction, [1] cmdline in r2, [2] DTB in r2 86 89 ; r1 = magic number (board identity, unused as of now ··· 89 90 ; These are handled later in setup_arch() 90 91 st r0, [@uboot_tag] 91 92 st r2, [@uboot_arg] 93 + #endif 92 94 93 95 ; setup "current" tsk and optionally cache it in dedicated r25 94 96 mov r9, @init_task
+143
arch/arc/kernel/intc-arcv2.c
··· 1 + /* 2 + * Copyright (C) 2014 Synopsys, Inc. (www.synopsys.com) 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License version 2 as 6 + * published by the Free Software Foundation. 7 + * 8 + */ 9 + 10 + #include <linux/interrupt.h> 11 + #include <linux/module.h> 12 + #include <linux/of.h> 13 + #include <linux/irqdomain.h> 14 + #include <linux/irqchip.h> 15 + #include "../../drivers/irqchip/irqchip.h" 16 + #include <asm/irq.h> 17 + 18 + /* 19 + * Early Hardware specific Interrupt setup 20 + * -Called very early (start_kernel -> setup_arch -> setup_processor) 21 + * -Platform Independent (must for any ARC Core) 22 + * -Needed for each CPU (hence not foldable into init_IRQ) 23 + */ 24 + void arc_init_IRQ(void) 25 + { 26 + unsigned int tmp; 27 + 28 + struct aux_irq_ctrl { 29 + #ifdef CONFIG_CPU_BIG_ENDIAN 30 + unsigned int res3:18, save_idx_regs:1, res2:1, 31 + save_u_to_u:1, save_lp_regs:1, save_blink:1, 32 + res:4, save_nr_gpr_pairs:5; 33 + #else 34 + unsigned int save_nr_gpr_pairs:5, res:4, 35 + save_blink:1, save_lp_regs:1, save_u_to_u:1, 36 + res2:1, save_idx_regs:1, res3:18; 37 + #endif 38 + } ictrl; 39 + 40 + *(unsigned int *)&ictrl = 0; 41 + 42 + ictrl.save_nr_gpr_pairs = 6; /* r0 to r11 (r12 saved manually) */ 43 + ictrl.save_blink = 1; 44 + ictrl.save_lp_regs = 1; /* LP_COUNT, LP_START, LP_END */ 45 + ictrl.save_u_to_u = 0; /* user ctxt saved on kernel stack */ 46 + ictrl.save_idx_regs = 1; /* JLI, LDI, EI */ 47 + 48 + WRITE_AUX(AUX_IRQ_CTRL, ictrl); 49 + 50 + /* setup status32, don't enable intr yet as kernel doesn't want */ 51 + tmp = read_aux_reg(0xa); 52 + tmp |= ISA_INIT_STATUS_BITS; 53 + tmp &= ~STATUS_IE_MASK; 54 + asm volatile("flag %0 \n"::"r"(tmp)); 55 + 56 + /* 57 + * ARCv2 core intc provides multiple interrupt priorities (upto 16). 58 + * Typical builds though have only two levels (0-high, 1-low) 59 + * Linux by default uses lower prio 1 for most irqs, reserving 0 for 60 + * NMI style interrupts in future (say perf) 61 + * 62 + * Read the intc BCR to confirm that Linux default priority is avail 63 + * in h/w 64 + * 65 + * Note: 66 + * IRQ_BCR[27..24] contains N-1 (for N priority levels) and prio level 67 + * is 0 based. 68 + */ 69 + tmp = (read_aux_reg(ARC_REG_IRQ_BCR) >> 24 ) & 0xF; 70 + if (ARCV2_IRQ_DEF_PRIO > tmp) 71 + panic("Linux default irq prio incorrect\n"); 72 + } 73 + 74 + static void arcv2_irq_mask(struct irq_data *data) 75 + { 76 + write_aux_reg(AUX_IRQ_SELECT, data->irq); 77 + write_aux_reg(AUX_IRQ_ENABLE, 0); 78 + } 79 + 80 + static void arcv2_irq_unmask(struct irq_data *data) 81 + { 82 + write_aux_reg(AUX_IRQ_SELECT, data->irq); 83 + write_aux_reg(AUX_IRQ_ENABLE, 1); 84 + } 85 + 86 + void arcv2_irq_enable(struct irq_data *data) 87 + { 88 + /* set default priority */ 89 + write_aux_reg(AUX_IRQ_SELECT, data->irq); 90 + write_aux_reg(AUX_IRQ_PRIORITY, ARCV2_IRQ_DEF_PRIO); 91 + 92 + /* 93 + * hw auto enables (linux unmask) all by default 94 + * So no need to do IRQ_ENABLE here 95 + * XXX: However OSCI LAN need it 96 + */ 97 + write_aux_reg(AUX_IRQ_ENABLE, 1); 98 + } 99 + 100 + static struct irq_chip arcv2_irq_chip = { 101 + .name = "ARCv2 core Intc", 102 + .irq_mask = arcv2_irq_mask, 103 + .irq_unmask = arcv2_irq_unmask, 104 + .irq_enable = arcv2_irq_enable 105 + }; 106 + 107 + static int arcv2_irq_map(struct irq_domain *d, unsigned int irq, 108 + irq_hw_number_t hw) 109 + { 110 + if (irq == TIMER0_IRQ || irq == IPI_IRQ) 111 + irq_set_chip_and_handler(irq, &arcv2_irq_chip, handle_percpu_irq); 112 + else 113 + irq_set_chip_and_handler(irq, &arcv2_irq_chip, handle_level_irq); 114 + 115 + return 0; 116 + } 117 + 118 + static const struct irq_domain_ops arcv2_irq_ops = { 119 + .xlate = irq_domain_xlate_onecell, 120 + .map = arcv2_irq_map, 121 + }; 122 + 123 + static struct irq_domain *root_domain; 124 + 125 + static int __init 126 + init_onchip_IRQ(struct device_node *intc, struct device_node *parent) 127 + { 128 + if (parent) 129 + panic("DeviceTree incore intc not a root irq controller\n"); 130 + 131 + root_domain = irq_domain_add_legacy(intc, NR_CPU_IRQS, 0, 0, 132 + &arcv2_irq_ops, NULL); 133 + 134 + if (!root_domain) 135 + panic("root irq domain not avail\n"); 136 + 137 + /* with this we don't need to export root_domain */ 138 + irq_set_default_host(root_domain); 139 + 140 + return 0; 141 + } 142 + 143 + IRQCHIP_DECLARE(arc_intc, "snps,archs-intc", init_onchip_IRQ);
+226
arch/arc/kernel/intc-compact.c
··· 1 + /* 2 + * Copyright (C) 2011-12 Synopsys, Inc. (www.synopsys.com) 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License version 2 as 6 + * published by the Free Software Foundation. 7 + * 8 + */ 9 + 10 + #include <linux/interrupt.h> 11 + #include <linux/module.h> 12 + #include <linux/of.h> 13 + #include <linux/irqdomain.h> 14 + #include <linux/irqchip.h> 15 + #include "../../drivers/irqchip/irqchip.h" 16 + #include <asm/irq.h> 17 + 18 + /* 19 + * Early Hardware specific Interrupt setup 20 + * -Platform independent, needed for each CPU (not foldable into init_IRQ) 21 + * -Called very early (start_kernel -> setup_arch -> setup_processor) 22 + * 23 + * what it does ? 24 + * -Optionally, setup the High priority Interrupts as Level 2 IRQs 25 + */ 26 + void arc_init_IRQ(void) 27 + { 28 + int level_mask = 0; 29 + 30 + /* setup any high priority Interrupts (Level2 in ARCompact jargon) */ 31 + level_mask |= IS_ENABLED(CONFIG_ARC_IRQ3_LV2) << 3; 32 + level_mask |= IS_ENABLED(CONFIG_ARC_IRQ5_LV2) << 5; 33 + level_mask |= IS_ENABLED(CONFIG_ARC_IRQ6_LV2) << 6; 34 + 35 + /* 36 + * Write to register, even if no LV2 IRQs configured to reset it 37 + * in case bootloader had mucked with it 38 + */ 39 + write_aux_reg(AUX_IRQ_LEV, level_mask); 40 + 41 + if (level_mask) 42 + pr_info("Level-2 interrupts bitset %x\n", level_mask); 43 + } 44 + 45 + /* 46 + * ARC700 core includes a simple on-chip intc supporting 47 + * -per IRQ enable/disable 48 + * -2 levels of interrupts (high/low) 49 + * -all interrupts being level triggered 50 + * 51 + * To reduce platform code, we assume all IRQs directly hooked-up into intc. 52 + * Platforms with external intc, hence cascaded IRQs, are free to over-ride 53 + * below, per IRQ. 54 + */ 55 + 56 + static void arc_irq_mask(struct irq_data *data) 57 + { 58 + unsigned int ienb; 59 + 60 + ienb = read_aux_reg(AUX_IENABLE); 61 + ienb &= ~(1 << data->irq); 62 + write_aux_reg(AUX_IENABLE, ienb); 63 + } 64 + 65 + static void arc_irq_unmask(struct irq_data *data) 66 + { 67 + unsigned int ienb; 68 + 69 + ienb = read_aux_reg(AUX_IENABLE); 70 + ienb |= (1 << data->irq); 71 + write_aux_reg(AUX_IENABLE, ienb); 72 + } 73 + 74 + static struct irq_chip onchip_intc = { 75 + .name = "ARC In-core Intc", 76 + .irq_mask = arc_irq_mask, 77 + .irq_unmask = arc_irq_unmask, 78 + }; 79 + 80 + static int arc_intc_domain_map(struct irq_domain *d, unsigned int irq, 81 + irq_hw_number_t hw) 82 + { 83 + /* 84 + * XXX: the IPI IRQ needs to be handled like TIMER too. However ARC core 85 + * code doesn't own it (like TIMER0). ISS IDU / ezchip define it 86 + * in platform header which can't be included here as it goes 87 + * against multi-platform image philisophy 88 + */ 89 + if (irq == TIMER0_IRQ) 90 + irq_set_chip_and_handler(irq, &onchip_intc, handle_percpu_irq); 91 + else 92 + irq_set_chip_and_handler(irq, &onchip_intc, handle_level_irq); 93 + 94 + return 0; 95 + } 96 + 97 + static const struct irq_domain_ops arc_intc_domain_ops = { 98 + .xlate = irq_domain_xlate_onecell, 99 + .map = arc_intc_domain_map, 100 + }; 101 + 102 + static struct irq_domain *root_domain; 103 + 104 + static int __init 105 + init_onchip_IRQ(struct device_node *intc, struct device_node *parent) 106 + { 107 + if (parent) 108 + panic("DeviceTree incore intc not a root irq controller\n"); 109 + 110 + root_domain = irq_domain_add_legacy(intc, NR_CPU_IRQS, 0, 0, 111 + &arc_intc_domain_ops, NULL); 112 + 113 + if (!root_domain) 114 + panic("root irq domain not avail\n"); 115 + 116 + /* with this we don't need to export root_domain */ 117 + irq_set_default_host(root_domain); 118 + 119 + return 0; 120 + } 121 + 122 + IRQCHIP_DECLARE(arc_intc, "snps,arc700-intc", init_onchip_IRQ); 123 + 124 + /* 125 + * arch_local_irq_enable - Enable interrupts. 126 + * 127 + * 1. Explicitly called to re-enable interrupts 128 + * 2. Implicitly called from spin_unlock_irq, write_unlock_irq etc 129 + * which maybe in hard ISR itself 130 + * 131 + * Semantics of this function change depending on where it is called from: 132 + * 133 + * -If called from hard-ISR, it must not invert interrupt priorities 134 + * e.g. suppose TIMER is high priority (Level 2) IRQ 135 + * Time hard-ISR, timer_interrupt( ) calls spin_unlock_irq several times. 136 + * Here local_irq_enable( ) shd not re-enable lower priority interrupts 137 + * -If called from soft-ISR, it must re-enable all interrupts 138 + * soft ISR are low prioity jobs which can be very slow, thus all IRQs 139 + * must be enabled while they run. 140 + * Now hardware context wise we may still be in L2 ISR (not done rtie) 141 + * still we must re-enable both L1 and L2 IRQs 142 + * Another twist is prev scenario with flow being 143 + * L1 ISR ==> interrupted by L2 ISR ==> L2 soft ISR 144 + * here we must not re-enable Ll as prev Ll Interrupt's h/w context will get 145 + * over-written (this is deficiency in ARC700 Interrupt mechanism) 146 + */ 147 + 148 + #ifdef CONFIG_ARC_COMPACT_IRQ_LEVELS /* Complex version for 2 IRQ levels */ 149 + 150 + void arch_local_irq_enable(void) 151 + { 152 + 153 + unsigned long flags = arch_local_save_flags(); 154 + 155 + /* Allow both L1 and L2 at the onset */ 156 + flags |= (STATUS_E1_MASK | STATUS_E2_MASK); 157 + 158 + /* Called from hard ISR (between irq_enter and irq_exit) */ 159 + if (in_irq()) { 160 + 161 + /* If in L2 ISR, don't re-enable any further IRQs as this can 162 + * cause IRQ priorities to get upside down. e.g. it could allow 163 + * L1 be taken while in L2 hard ISR which is wrong not only in 164 + * theory, it can also cause the dreaded L1-L2-L1 scenario 165 + */ 166 + if (flags & STATUS_A2_MASK) 167 + flags &= ~(STATUS_E1_MASK | STATUS_E2_MASK); 168 + 169 + /* Even if in L1 ISR, allowe Higher prio L2 IRQs */ 170 + else if (flags & STATUS_A1_MASK) 171 + flags &= ~(STATUS_E1_MASK); 172 + } 173 + 174 + /* called from soft IRQ, ideally we want to re-enable all levels */ 175 + 176 + else if (in_softirq()) { 177 + 178 + /* However if this is case of L1 interrupted by L2, 179 + * re-enabling both may cause whaco L1-L2-L1 scenario 180 + * because ARC700 allows level 1 to interrupt an active L2 ISR 181 + * Thus we disable both 182 + * However some code, executing in soft ISR wants some IRQs 183 + * to be enabled so we re-enable L2 only 184 + * 185 + * How do we determine L1 intr by L2 186 + * -A2 is set (means in L2 ISR) 187 + * -E1 is set in this ISR's pt_regs->status32 which is 188 + * saved copy of status32_l2 when l2 ISR happened 189 + */ 190 + struct pt_regs *pt = get_irq_regs(); 191 + 192 + if ((flags & STATUS_A2_MASK) && pt && 193 + (pt->status32 & STATUS_A1_MASK)) { 194 + /*flags &= ~(STATUS_E1_MASK | STATUS_E2_MASK); */ 195 + flags &= ~(STATUS_E1_MASK); 196 + } 197 + } 198 + 199 + arch_local_irq_restore(flags); 200 + } 201 + 202 + #else /* ! CONFIG_ARC_COMPACT_IRQ_LEVELS */ 203 + 204 + /* 205 + * Simpler version for only 1 level of interrupt 206 + * Here we only Worry about Level 1 Bits 207 + */ 208 + void arch_local_irq_enable(void) 209 + { 210 + unsigned long flags; 211 + 212 + /* 213 + * ARC IDE Drivers tries to re-enable interrupts from hard-isr 214 + * context which is simply wrong 215 + */ 216 + if (in_irq()) { 217 + WARN_ONCE(1, "IRQ enabled from hard-isr"); 218 + return; 219 + } 220 + 221 + flags = arch_local_save_flags(); 222 + flags |= (STATUS_E1_MASK | STATUS_E2_MASK); 223 + arch_local_irq_restore(flags); 224 + } 225 + #endif 226 + EXPORT_SYMBOL(arch_local_irq_enable);
-210
arch/arc/kernel/irq.c
··· 8 8 */ 9 9 10 10 #include <linux/interrupt.h> 11 - #include <linux/module.h> 12 - #include <linux/of.h> 13 - #include <linux/irqdomain.h> 14 11 #include <linux/irqchip.h> 15 - #include "../../drivers/irqchip/irqchip.h" 16 - #include <asm/sections.h> 17 - #include <asm/irq.h> 18 12 #include <asm/mach_desc.h> 19 - 20 - /* 21 - * Early Hardware specific Interrupt setup 22 - * -Platform independent, needed for each CPU (not foldable into init_IRQ) 23 - * -Called very early (start_kernel -> setup_arch -> setup_processor) 24 - * 25 - * what it does ? 26 - * -Optionally, setup the High priority Interrupts as Level 2 IRQs 27 - */ 28 - void arc_init_IRQ(void) 29 - { 30 - int level_mask = 0; 31 - 32 - /* setup any high priority Interrupts (Level2 in ARCompact jargon) */ 33 - level_mask |= IS_ENABLED(CONFIG_ARC_IRQ3_LV2) << 3; 34 - level_mask |= IS_ENABLED(CONFIG_ARC_IRQ5_LV2) << 5; 35 - level_mask |= IS_ENABLED(CONFIG_ARC_IRQ6_LV2) << 6; 36 - 37 - /* 38 - * Write to register, even if no LV2 IRQs configured to reset it 39 - * in case bootloader had mucked with it 40 - */ 41 - write_aux_reg(AUX_IRQ_LEV, level_mask); 42 - 43 - if (level_mask) 44 - pr_info("Level-2 interrupts bitset %x\n", level_mask); 45 - } 46 - 47 - /* 48 - * ARC700 core includes a simple on-chip intc supporting 49 - * -per IRQ enable/disable 50 - * -2 levels of interrupts (high/low) 51 - * -all interrupts being level triggered 52 - * 53 - * To reduce platform code, we assume all IRQs directly hooked-up into intc. 54 - * Platforms with external intc, hence cascaded IRQs, are free to over-ride 55 - * below, per IRQ. 56 - */ 57 - 58 - static void arc_irq_mask(struct irq_data *data) 59 - { 60 - unsigned int ienb; 61 - 62 - ienb = read_aux_reg(AUX_IENABLE); 63 - ienb &= ~(1 << data->irq); 64 - write_aux_reg(AUX_IENABLE, ienb); 65 - } 66 - 67 - static void arc_irq_unmask(struct irq_data *data) 68 - { 69 - unsigned int ienb; 70 - 71 - ienb = read_aux_reg(AUX_IENABLE); 72 - ienb |= (1 << data->irq); 73 - write_aux_reg(AUX_IENABLE, ienb); 74 - } 75 - 76 - static struct irq_chip onchip_intc = { 77 - .name = "ARC In-core Intc", 78 - .irq_mask = arc_irq_mask, 79 - .irq_unmask = arc_irq_unmask, 80 - }; 81 - 82 - static int arc_intc_domain_map(struct irq_domain *d, unsigned int irq, 83 - irq_hw_number_t hw) 84 - { 85 - if (irq == TIMER0_IRQ) 86 - irq_set_chip_and_handler(irq, &onchip_intc, handle_percpu_irq); 87 - else 88 - irq_set_chip_and_handler(irq, &onchip_intc, handle_level_irq); 89 - 90 - return 0; 91 - } 92 - 93 - static const struct irq_domain_ops arc_intc_domain_ops = { 94 - .xlate = irq_domain_xlate_onecell, 95 - .map = arc_intc_domain_map, 96 - }; 97 - 98 - static struct irq_domain *root_domain; 99 - 100 - static int __init 101 - init_onchip_IRQ(struct device_node *intc, struct device_node *parent) 102 - { 103 - if (parent) 104 - panic("DeviceTree incore intc not a root irq controller\n"); 105 - 106 - root_domain = irq_domain_add_legacy(intc, NR_CPU_IRQS, 0, 0, 107 - &arc_intc_domain_ops, NULL); 108 - 109 - if (!root_domain) 110 - panic("root irq domain not avail\n"); 111 - 112 - /* with this we don't need to export root_domain */ 113 - irq_set_default_host(root_domain); 114 - 115 - return 0; 116 - } 117 - 118 - IRQCHIP_DECLARE(arc_intc, "snps,arc700-intc", init_onchip_IRQ); 119 13 120 14 /* 121 15 * Late Interrupt system init called from start_kernel for Boot CPU only ··· 72 178 73 179 enable_percpu_irq(irq, 0); 74 180 } 75 - 76 - /* 77 - * arch_local_irq_enable - Enable interrupts. 78 - * 79 - * 1. Explicitly called to re-enable interrupts 80 - * 2. Implicitly called from spin_unlock_irq, write_unlock_irq etc 81 - * which maybe in hard ISR itself 82 - * 83 - * Semantics of this function change depending on where it is called from: 84 - * 85 - * -If called from hard-ISR, it must not invert interrupt priorities 86 - * e.g. suppose TIMER is high priority (Level 2) IRQ 87 - * Time hard-ISR, timer_interrupt( ) calls spin_unlock_irq several times. 88 - * Here local_irq_enable( ) shd not re-enable lower priority interrupts 89 - * -If called from soft-ISR, it must re-enable all interrupts 90 - * soft ISR are low prioity jobs which can be very slow, thus all IRQs 91 - * must be enabled while they run. 92 - * Now hardware context wise we may still be in L2 ISR (not done rtie) 93 - * still we must re-enable both L1 and L2 IRQs 94 - * Another twist is prev scenario with flow being 95 - * L1 ISR ==> interrupted by L2 ISR ==> L2 soft ISR 96 - * here we must not re-enable Ll as prev Ll Interrupt's h/w context will get 97 - * over-written (this is deficiency in ARC700 Interrupt mechanism) 98 - */ 99 - 100 - #ifdef CONFIG_ARC_COMPACT_IRQ_LEVELS /* Complex version for 2 IRQ levels */ 101 - 102 - void arch_local_irq_enable(void) 103 - { 104 - 105 - unsigned long flags; 106 - flags = arch_local_save_flags(); 107 - 108 - /* Allow both L1 and L2 at the onset */ 109 - flags |= (STATUS_E1_MASK | STATUS_E2_MASK); 110 - 111 - /* Called from hard ISR (between irq_enter and irq_exit) */ 112 - if (in_irq()) { 113 - 114 - /* If in L2 ISR, don't re-enable any further IRQs as this can 115 - * cause IRQ priorities to get upside down. e.g. it could allow 116 - * L1 be taken while in L2 hard ISR which is wrong not only in 117 - * theory, it can also cause the dreaded L1-L2-L1 scenario 118 - */ 119 - if (flags & STATUS_A2_MASK) 120 - flags &= ~(STATUS_E1_MASK | STATUS_E2_MASK); 121 - 122 - /* Even if in L1 ISR, allowe Higher prio L2 IRQs */ 123 - else if (flags & STATUS_A1_MASK) 124 - flags &= ~(STATUS_E1_MASK); 125 - } 126 - 127 - /* called from soft IRQ, ideally we want to re-enable all levels */ 128 - 129 - else if (in_softirq()) { 130 - 131 - /* However if this is case of L1 interrupted by L2, 132 - * re-enabling both may cause whaco L1-L2-L1 scenario 133 - * because ARC700 allows level 1 to interrupt an active L2 ISR 134 - * Thus we disable both 135 - * However some code, executing in soft ISR wants some IRQs 136 - * to be enabled so we re-enable L2 only 137 - * 138 - * How do we determine L1 intr by L2 139 - * -A2 is set (means in L2 ISR) 140 - * -E1 is set in this ISR's pt_regs->status32 which is 141 - * saved copy of status32_l2 when l2 ISR happened 142 - */ 143 - struct pt_regs *pt = get_irq_regs(); 144 - if ((flags & STATUS_A2_MASK) && pt && 145 - (pt->status32 & STATUS_A1_MASK)) { 146 - /*flags &= ~(STATUS_E1_MASK | STATUS_E2_MASK); */ 147 - flags &= ~(STATUS_E1_MASK); 148 - } 149 - } 150 - 151 - arch_local_irq_restore(flags); 152 - } 153 - 154 - #else /* ! CONFIG_ARC_COMPACT_IRQ_LEVELS */ 155 - 156 - /* 157 - * Simpler version for only 1 level of interrupt 158 - * Here we only Worry about Level 1 Bits 159 - */ 160 - void arch_local_irq_enable(void) 161 - { 162 - unsigned long flags; 163 - 164 - /* 165 - * ARC IDE Drivers tries to re-enable interrupts from hard-isr 166 - * context which is simply wrong 167 - */ 168 - if (in_irq()) { 169 - WARN_ONCE(1, "IRQ enabled from hard-isr"); 170 - return; 171 - } 172 - 173 - flags = arch_local_save_flags(); 174 - flags |= (STATUS_E1_MASK | STATUS_E2_MASK); 175 - arch_local_irq_restore(flags); 176 - } 177 - #endif 178 - EXPORT_SYMBOL(arch_local_irq_enable);
+341
arch/arc/kernel/mcip.c
··· 1 + /* 2 + * ARC ARConnect (MultiCore IP) support (formerly known as MCIP) 3 + * 4 + * Copyright (C) 2013 Synopsys, Inc. (www.synopsys.com) 5 + * 6 + * This program is free software; you can redistribute it and/or modify 7 + * it under the terms of the GNU General Public License version 2 as 8 + * published by the Free Software Foundation. 9 + */ 10 + 11 + #include <linux/smp.h> 12 + #include <linux/irq.h> 13 + #include <linux/spinlock.h> 14 + #include <asm/mcip.h> 15 + 16 + static char smp_cpuinfo_buf[128]; 17 + static int idu_detected; 18 + 19 + static DEFINE_RAW_SPINLOCK(mcip_lock); 20 + 21 + /* 22 + * Any SMP specific init any CPU does when it comes up. 23 + * Here we setup the CPU to enable Inter-Processor-Interrupts 24 + * Called for each CPU 25 + * -Master : init_IRQ() 26 + * -Other(s) : start_kernel_secondary() 27 + */ 28 + void mcip_init_smp(unsigned int cpu) 29 + { 30 + smp_ipi_irq_setup(cpu, IPI_IRQ); 31 + } 32 + 33 + static void mcip_ipi_send(int cpu) 34 + { 35 + unsigned long flags; 36 + int ipi_was_pending; 37 + 38 + /* 39 + * NOTE: We must spin here if the other cpu hasn't yet 40 + * serviced a previous message. This can burn lots 41 + * of time, but we MUST follows this protocol or 42 + * ipi messages can be lost!!! 43 + * Also, we must release the lock in this loop because 44 + * the other side may get to this same loop and not 45 + * be able to ack -- thus causing deadlock. 46 + */ 47 + 48 + do { 49 + raw_spin_lock_irqsave(&mcip_lock, flags); 50 + __mcip_cmd(CMD_INTRPT_READ_STATUS, cpu); 51 + ipi_was_pending = read_aux_reg(ARC_REG_MCIP_READBACK); 52 + if (ipi_was_pending == 0) 53 + break; /* break out but keep lock */ 54 + raw_spin_unlock_irqrestore(&mcip_lock, flags); 55 + } while (1); 56 + 57 + __mcip_cmd(CMD_INTRPT_GENERATE_IRQ, cpu); 58 + raw_spin_unlock_irqrestore(&mcip_lock, flags); 59 + 60 + #ifdef CONFIG_ARC_IPI_DBG 61 + if (ipi_was_pending) 62 + pr_info("IPI ACK delayed from cpu %d\n", cpu); 63 + #endif 64 + } 65 + 66 + static void mcip_ipi_clear(int irq) 67 + { 68 + unsigned int cpu, c; 69 + unsigned long flags; 70 + unsigned int __maybe_unused copy; 71 + 72 + raw_spin_lock_irqsave(&mcip_lock, flags); 73 + 74 + /* Who sent the IPI */ 75 + __mcip_cmd(CMD_INTRPT_CHECK_SOURCE, 0); 76 + 77 + copy = cpu = read_aux_reg(ARC_REG_MCIP_READBACK); /* 1,2,4,8... */ 78 + 79 + /* 80 + * In rare case, multiple concurrent IPIs sent to same target can 81 + * possibly be coalesced by MCIP into 1 asserted IRQ, so @cpus can be 82 + * "vectored" (multiple bits sets) as opposed to typical single bit 83 + */ 84 + do { 85 + c = __ffs(cpu); /* 0,1,2,3 */ 86 + __mcip_cmd(CMD_INTRPT_GENERATE_ACK, c); 87 + cpu &= ~(1U << c); 88 + } while (cpu); 89 + 90 + raw_spin_unlock_irqrestore(&mcip_lock, flags); 91 + 92 + #ifdef CONFIG_ARC_IPI_DBG 93 + if (c != __ffs(copy)) 94 + pr_info("IPIs from %x coalesced to %x\n", 95 + copy, raw_smp_processor_id()); 96 + #endif 97 + } 98 + 99 + volatile int wake_flag; 100 + 101 + static void mcip_wakeup_cpu(int cpu, unsigned long pc) 102 + { 103 + BUG_ON(cpu == 0); 104 + wake_flag = cpu; 105 + } 106 + 107 + void arc_platform_smp_wait_to_boot(int cpu) 108 + { 109 + while (wake_flag != cpu) 110 + ; 111 + 112 + wake_flag = 0; 113 + __asm__ __volatile__("j @first_lines_of_secondary \n"); 114 + } 115 + 116 + struct plat_smp_ops plat_smp_ops = { 117 + .info = smp_cpuinfo_buf, 118 + .cpu_kick = mcip_wakeup_cpu, 119 + .ipi_send = mcip_ipi_send, 120 + .ipi_clear = mcip_ipi_clear, 121 + }; 122 + 123 + void mcip_init_early_smp(void) 124 + { 125 + #define IS_AVAIL1(var, str) ((var) ? str : "") 126 + 127 + struct mcip_bcr { 128 + #ifdef CONFIG_CPU_BIG_ENDIAN 129 + unsigned int pad3:8, 130 + idu:1, llm:1, num_cores:6, 131 + iocoh:1, grtc:1, dbg:1, pad2:1, 132 + msg:1, sem:1, ipi:1, pad:1, 133 + ver:8; 134 + #else 135 + unsigned int ver:8, 136 + pad:1, ipi:1, sem:1, msg:1, 137 + pad2:1, dbg:1, grtc:1, iocoh:1, 138 + num_cores:6, llm:1, idu:1, 139 + pad3:8; 140 + #endif 141 + } mp; 142 + 143 + READ_BCR(ARC_REG_MCIP_BCR, mp); 144 + 145 + sprintf(smp_cpuinfo_buf, 146 + "Extn [SMP]\t: ARConnect (v%d): %d cores with %s%s%s%s\n", 147 + mp.ver, mp.num_cores, 148 + IS_AVAIL1(mp.ipi, "IPI "), 149 + IS_AVAIL1(mp.idu, "IDU "), 150 + IS_AVAIL1(mp.dbg, "DEBUG "), 151 + IS_AVAIL1(mp.grtc, "GRTC")); 152 + 153 + idu_detected = mp.idu; 154 + 155 + if (mp.dbg) { 156 + __mcip_cmd_data(CMD_DEBUG_SET_SELECT, 0, 0xf); 157 + __mcip_cmd_data(CMD_DEBUG_SET_MASK, 0xf, 0xf); 158 + } 159 + 160 + if (IS_ENABLED(CONFIG_ARC_HAS_GRTC) && !mp.grtc) 161 + panic("kernel trying to use non-existent GRTC\n"); 162 + } 163 + 164 + /*************************************************************************** 165 + * ARCv2 Interrupt Distribution Unit (IDU) 166 + * 167 + * Connects external "COMMON" IRQs to core intc, providing: 168 + * -dynamic routing (IRQ affinity) 169 + * -load balancing (Round Robin interrupt distribution) 170 + * -1:N distribution 171 + * 172 + * It physically resides in the MCIP hw block 173 + */ 174 + 175 + #include <linux/irqchip.h> 176 + #include <linux/of.h> 177 + #include <linux/of_irq.h> 178 + #include "../../drivers/irqchip/irqchip.h" 179 + 180 + /* 181 + * Set the DEST for @cmn_irq to @cpu_mask (1 bit per core) 182 + */ 183 + static void idu_set_dest(unsigned int cmn_irq, unsigned int cpu_mask) 184 + { 185 + __mcip_cmd_data(CMD_IDU_SET_DEST, cmn_irq, cpu_mask); 186 + } 187 + 188 + static void idu_set_mode(unsigned int cmn_irq, unsigned int lvl, 189 + unsigned int distr) 190 + { 191 + union { 192 + unsigned int word; 193 + struct { 194 + unsigned int distr:2, pad:2, lvl:1, pad2:27; 195 + }; 196 + } data; 197 + 198 + data.distr = distr; 199 + data.lvl = lvl; 200 + __mcip_cmd_data(CMD_IDU_SET_MODE, cmn_irq, data.word); 201 + } 202 + 203 + static void idu_irq_mask(struct irq_data *data) 204 + { 205 + unsigned long flags; 206 + 207 + raw_spin_lock_irqsave(&mcip_lock, flags); 208 + __mcip_cmd_data(CMD_IDU_SET_MASK, data->hwirq, 1); 209 + raw_spin_unlock_irqrestore(&mcip_lock, flags); 210 + } 211 + 212 + static void idu_irq_unmask(struct irq_data *data) 213 + { 214 + unsigned long flags; 215 + 216 + raw_spin_lock_irqsave(&mcip_lock, flags); 217 + __mcip_cmd_data(CMD_IDU_SET_MASK, data->hwirq, 0); 218 + raw_spin_unlock_irqrestore(&mcip_lock, flags); 219 + } 220 + 221 + static int 222 + idu_irq_set_affinity(struct irq_data *d, const struct cpumask *cpumask, bool f) 223 + { 224 + return IRQ_SET_MASK_OK; 225 + } 226 + 227 + static struct irq_chip idu_irq_chip = { 228 + .name = "MCIP IDU Intc", 229 + .irq_mask = idu_irq_mask, 230 + .irq_unmask = idu_irq_unmask, 231 + #ifdef CONFIG_SMP 232 + .irq_set_affinity = idu_irq_set_affinity, 233 + #endif 234 + 235 + }; 236 + 237 + static int idu_first_irq; 238 + 239 + static void idu_cascade_isr(unsigned int core_irq, struct irq_desc *desc) 240 + { 241 + struct irq_domain *domain = irq_desc_get_handler_data(desc); 242 + unsigned int idu_irq; 243 + 244 + idu_irq = core_irq - idu_first_irq; 245 + generic_handle_irq(irq_find_mapping(domain, idu_irq)); 246 + } 247 + 248 + static int idu_irq_map(struct irq_domain *d, unsigned int virq, irq_hw_number_t hwirq) 249 + { 250 + irq_set_chip_and_handler(virq, &idu_irq_chip, handle_level_irq); 251 + irq_set_status_flags(virq, IRQ_MOVE_PCNTXT); 252 + 253 + return 0; 254 + } 255 + 256 + static int idu_irq_xlate(struct irq_domain *d, struct device_node *n, 257 + const u32 *intspec, unsigned int intsize, 258 + irq_hw_number_t *out_hwirq, unsigned int *out_type) 259 + { 260 + irq_hw_number_t hwirq = *out_hwirq = intspec[0]; 261 + int distri = intspec[1]; 262 + unsigned long flags; 263 + 264 + *out_type = IRQ_TYPE_NONE; 265 + 266 + /* XXX: validate distribution scheme again online cpu mask */ 267 + if (distri == 0) { 268 + /* 0 - Round Robin to all cpus, otherwise 1 bit per core */ 269 + raw_spin_lock_irqsave(&mcip_lock, flags); 270 + idu_set_dest(hwirq, BIT(num_online_cpus()) - 1); 271 + idu_set_mode(hwirq, IDU_M_TRIG_LEVEL, IDU_M_DISTRI_RR); 272 + raw_spin_unlock_irqrestore(&mcip_lock, flags); 273 + } else { 274 + /* 275 + * DEST based distribution for Level Triggered intr can only 276 + * have 1 CPU, so generalize it to always contain 1 cpu 277 + */ 278 + int cpu = ffs(distri); 279 + 280 + if (cpu != fls(distri)) 281 + pr_warn("IDU irq %lx distri mode set to cpu %x\n", 282 + hwirq, cpu); 283 + 284 + raw_spin_lock_irqsave(&mcip_lock, flags); 285 + idu_set_dest(hwirq, cpu); 286 + idu_set_mode(hwirq, IDU_M_TRIG_LEVEL, IDU_M_DISTRI_DEST); 287 + raw_spin_unlock_irqrestore(&mcip_lock, flags); 288 + } 289 + 290 + return 0; 291 + } 292 + 293 + static const struct irq_domain_ops idu_irq_ops = { 294 + .xlate = idu_irq_xlate, 295 + .map = idu_irq_map, 296 + }; 297 + 298 + /* 299 + * [16, 23]: Statically assigned always private-per-core (Timers, WDT, IPI) 300 + * [24, 23+C]: If C > 0 then "C" common IRQs 301 + * [24+C, N]: Not statically assigned, private-per-core 302 + */ 303 + 304 + 305 + static int __init 306 + idu_of_init(struct device_node *intc, struct device_node *parent) 307 + { 308 + struct irq_domain *domain; 309 + /* Read IDU BCR to confirm nr_irqs */ 310 + int nr_irqs = of_irq_count(intc); 311 + int i, irq; 312 + 313 + if (!idu_detected) 314 + panic("IDU not detected, but DeviceTree using it"); 315 + 316 + pr_info("MCIP: IDU referenced from Devicetree %d irqs\n", nr_irqs); 317 + 318 + domain = irq_domain_add_linear(intc, nr_irqs, &idu_irq_ops, NULL); 319 + 320 + /* Parent interrupts (core-intc) are already mapped */ 321 + 322 + for (i = 0; i < nr_irqs; i++) { 323 + /* 324 + * Return parent uplink IRQs (towards core intc) 24,25,..... 325 + * this step has been done before already 326 + * however we need it to get the parent virq and set IDU handler 327 + * as first level isr 328 + */ 329 + irq = irq_of_parse_and_map(intc, i); 330 + if (!i) 331 + idu_first_irq = irq; 332 + 333 + irq_set_handler_data(irq, domain); 334 + irq_set_chained_handler(irq, idu_cascade_isr); 335 + } 336 + 337 + __mcip_cmd(CMD_IDU_ENABLE, 0); 338 + 339 + return 0; 340 + } 341 + IRQCHIP_DECLARE(arcv2_idu_intc, "snps,archs-idu-intc", idu_of_init);
+2 -5
arch/arc/kernel/perf_event.c
··· 266 266 267 267 static int arc_pmu_device_probe(struct platform_device *pdev) 268 268 { 269 - struct arc_pmu *arc_pmu; 270 269 struct arc_reg_pct_build pct_bcr; 271 270 struct arc_reg_cc_build cc_bcr; 272 - int i, j, ret; 271 + int i, j; 273 272 274 273 union cc_name { 275 274 struct { ··· 335 336 /* ARC 700 PMU does not support sampling events */ 336 337 arc_pmu->pmu.capabilities |= PERF_PMU_CAP_NO_INTERRUPT; 337 338 338 - ret = perf_pmu_register(&arc_pmu->pmu, pdev->name, PERF_TYPE_RAW); 339 - 340 - return ret; 339 + return perf_pmu_register(&arc_pmu->pmu, pdev->name, PERF_TYPE_RAW); 341 340 } 342 341 343 342 #ifdef CONFIG_OF
+10 -4
arch/arc/kernel/process.c
··· 44 44 void arch_cpu_idle(void) 45 45 { 46 46 /* sleep, but enable all interrupts before committing */ 47 - __asm__("sleep 0x3"); 47 + if (is_isa_arcompact()) { 48 + __asm__("sleep 0x3"); 49 + } else { 50 + __asm__("sleep 0x10"); 51 + } 48 52 } 49 53 50 54 asmlinkage void ret_from_fork(void); ··· 170 166 * [L] ZOL loop inhibited to begin with - cleared by a LP insn 171 167 * Interrupts enabled 172 168 */ 173 - regs->status32 = STATUS_U_MASK | STATUS_L_MASK | 174 - STATUS_E1_MASK | STATUS_E2_MASK; 169 + regs->status32 = STATUS_U_MASK | STATUS_L_MASK | ISA_INIT_STATUS_BITS; 175 170 176 171 /* bogus seed values for debugging */ 177 172 regs->lp_start = 0x10; ··· 200 197 { 201 198 unsigned int eflags; 202 199 203 - if (x->e_machine != EM_ARCOMPACT) 200 + if (x->e_machine != EM_ARC_INUSE) { 201 + pr_err("ELF not built for %s ISA\n", 202 + is_isa_arcompact() ? "ARCompact":"ARCv2"); 204 203 return 0; 204 + } 205 205 206 206 eflags = x->e_flags; 207 207 if ((eflags & EF_ARC_OSABI_MSK) < EF_ARC_OSABI_CURRENT) {
+84 -8
arch/arc/kernel/ptrace.c
··· 47 47 offsetof(struct user_regs_struct, LOC) + 4); 48 48 49 49 REG_O_ZERO(pad); 50 - REG_O_CHUNK(scratch, callee, ptregs); 50 + REG_O_ONE(scratch.bta, &ptregs->bta); 51 + REG_O_ONE(scratch.lp_start, &ptregs->lp_start); 52 + REG_O_ONE(scratch.lp_end, &ptregs->lp_end); 53 + REG_O_ONE(scratch.lp_count, &ptregs->lp_count); 54 + REG_O_ONE(scratch.status32, &ptregs->status32); 55 + REG_O_ONE(scratch.ret, &ptregs->ret); 56 + REG_O_ONE(scratch.blink, &ptregs->blink); 57 + REG_O_ONE(scratch.fp, &ptregs->fp); 58 + REG_O_ONE(scratch.gp, &ptregs->r26); 59 + REG_O_ONE(scratch.r12, &ptregs->r12); 60 + REG_O_ONE(scratch.r11, &ptregs->r11); 61 + REG_O_ONE(scratch.r10, &ptregs->r10); 62 + REG_O_ONE(scratch.r9, &ptregs->r9); 63 + REG_O_ONE(scratch.r8, &ptregs->r8); 64 + REG_O_ONE(scratch.r7, &ptregs->r7); 65 + REG_O_ONE(scratch.r6, &ptregs->r6); 66 + REG_O_ONE(scratch.r5, &ptregs->r5); 67 + REG_O_ONE(scratch.r4, &ptregs->r4); 68 + REG_O_ONE(scratch.r3, &ptregs->r3); 69 + REG_O_ONE(scratch.r2, &ptregs->r2); 70 + REG_O_ONE(scratch.r1, &ptregs->r1); 71 + REG_O_ONE(scratch.r0, &ptregs->r0); 72 + REG_O_ONE(scratch.sp, &ptregs->sp); 73 + 51 74 REG_O_ZERO(pad2); 52 - REG_O_CHUNK(callee, efa, cregs); 53 - REG_O_CHUNK(efa, stop_pc, &target->thread.fault_address); 75 + 76 + REG_O_ONE(callee.r25, &cregs->r25); 77 + REG_O_ONE(callee.r24, &cregs->r24); 78 + REG_O_ONE(callee.r23, &cregs->r23); 79 + REG_O_ONE(callee.r22, &cregs->r22); 80 + REG_O_ONE(callee.r21, &cregs->r21); 81 + REG_O_ONE(callee.r20, &cregs->r20); 82 + REG_O_ONE(callee.r19, &cregs->r19); 83 + REG_O_ONE(callee.r18, &cregs->r18); 84 + REG_O_ONE(callee.r17, &cregs->r17); 85 + REG_O_ONE(callee.r16, &cregs->r16); 86 + REG_O_ONE(callee.r15, &cregs->r15); 87 + REG_O_ONE(callee.r14, &cregs->r14); 88 + REG_O_ONE(callee.r13, &cregs->r13); 89 + 90 + REG_O_ONE(efa, &target->thread.fault_address); 54 91 55 92 if (!ret) { 56 93 if (in_brkpt_trap(ptregs)) { ··· 134 97 offsetof(struct user_regs_struct, LOC) + 4); 135 98 136 99 REG_IGNORE_ONE(pad); 137 - /* TBD: disallow updates to STATUS32 etc*/ 138 - REG_IN_CHUNK(scratch, pad2, ptregs); /* pt_regs[bta..sp] */ 100 + 101 + REG_IN_ONE(scratch.bta, &ptregs->bta); 102 + REG_IN_ONE(scratch.lp_start, &ptregs->lp_start); 103 + REG_IN_ONE(scratch.lp_end, &ptregs->lp_end); 104 + REG_IN_ONE(scratch.lp_count, &ptregs->lp_count); 105 + 106 + REG_IGNORE_ONE(scratch.status32); 107 + 108 + REG_IN_ONE(scratch.ret, &ptregs->ret); 109 + REG_IN_ONE(scratch.blink, &ptregs->blink); 110 + REG_IN_ONE(scratch.fp, &ptregs->fp); 111 + REG_IN_ONE(scratch.gp, &ptregs->r26); 112 + REG_IN_ONE(scratch.r12, &ptregs->r12); 113 + REG_IN_ONE(scratch.r11, &ptregs->r11); 114 + REG_IN_ONE(scratch.r10, &ptregs->r10); 115 + REG_IN_ONE(scratch.r9, &ptregs->r9); 116 + REG_IN_ONE(scratch.r8, &ptregs->r8); 117 + REG_IN_ONE(scratch.r7, &ptregs->r7); 118 + REG_IN_ONE(scratch.r6, &ptregs->r6); 119 + REG_IN_ONE(scratch.r5, &ptregs->r5); 120 + REG_IN_ONE(scratch.r4, &ptregs->r4); 121 + REG_IN_ONE(scratch.r3, &ptregs->r3); 122 + REG_IN_ONE(scratch.r2, &ptregs->r2); 123 + REG_IN_ONE(scratch.r1, &ptregs->r1); 124 + REG_IN_ONE(scratch.r0, &ptregs->r0); 125 + REG_IN_ONE(scratch.sp, &ptregs->sp); 126 + 139 127 REG_IGNORE_ONE(pad2); 140 - REG_IN_CHUNK(callee, efa, cregs); /* callee_regs[r25..r13] */ 128 + 129 + REG_IN_ONE(callee.r25, &cregs->r25); 130 + REG_IN_ONE(callee.r24, &cregs->r24); 131 + REG_IN_ONE(callee.r23, &cregs->r23); 132 + REG_IN_ONE(callee.r22, &cregs->r22); 133 + REG_IN_ONE(callee.r21, &cregs->r21); 134 + REG_IN_ONE(callee.r20, &cregs->r20); 135 + REG_IN_ONE(callee.r19, &cregs->r19); 136 + REG_IN_ONE(callee.r18, &cregs->r18); 137 + REG_IN_ONE(callee.r17, &cregs->r17); 138 + REG_IN_ONE(callee.r16, &cregs->r16); 139 + REG_IN_ONE(callee.r15, &cregs->r15); 140 + REG_IN_ONE(callee.r14, &cregs->r14); 141 + REG_IN_ONE(callee.r13, &cregs->r13); 142 + 141 143 REG_IGNORE_ONE(efa); /* efa update invalid */ 142 - REG_IGNORE_ONE(stop_pc); /* PC updated via @ret */ 144 + REG_IGNORE_ONE(stop_pc); /* PC updated via @ret */ 143 145 144 146 return ret; 145 147 } ··· 200 124 201 125 static const struct user_regset_view user_arc_view = { 202 126 .name = UTS_MACHINE, 203 - .e_machine = EM_ARCOMPACT, 127 + .e_machine = EM_ARC_INUSE, 204 128 .regsets = arc_regsets, 205 129 .n = ARRAY_SIZE(arc_regsets) 206 130 };
+52 -11
arch/arc/kernel/setup.c
··· 30 30 31 31 #define FIX_PTR(x) __asm__ __volatile__(";" : "+r"(x)) 32 32 33 + unsigned int intr_to_DE_cnt; 34 + 33 35 /* Part of U-boot ABI: see head.S */ 34 36 int __initdata uboot_tag; 35 37 char __initdata *uboot_arg; ··· 56 54 cpu->vec_base = read_aux_reg(AUX_INTR_VEC_BASE); 57 55 58 56 READ_BCR(ARC_REG_D_UNCACH_BCR, uncached_space); 59 - cpu->uncached_base = uncached_space.start << 24; 57 + BUG_ON((uncached_space.start << 24) != ARC_UNCACHED_ADDR_SPACE); 60 58 61 59 READ_BCR(ARC_REG_MUL_BCR, cpu->extn_mpy); 62 60 ··· 98 96 read_decode_mmu_bcr(); 99 97 read_decode_cache_bcr(); 100 98 101 - { 99 + if (is_isa_arcompact()) { 102 100 struct bcr_fp_arcompact sp, dp; 103 101 struct bcr_bpu_arcompact bpu; 104 102 ··· 114 112 cpu->bpu.num_cache = 256 << (bpu.ent - 1); 115 113 cpu->bpu.num_pred = 256 << (bpu.ent - 1); 116 114 } 115 + } else { 116 + struct bcr_fp_arcv2 spdp; 117 + struct bcr_bpu_arcv2 bpu; 118 + 119 + READ_BCR(ARC_REG_FP_V2_BCR, spdp); 120 + cpu->extn.fpu_sp = spdp.sp ? 1 : 0; 121 + cpu->extn.fpu_dp = spdp.dp ? 1 : 0; 122 + 123 + READ_BCR(ARC_REG_BPU_BCR, bpu); 124 + cpu->bpu.ver = bpu.ver; 125 + cpu->bpu.full = bpu.ft; 126 + cpu->bpu.num_cache = 256 << bpu.bce; 127 + cpu->bpu.num_pred = 2048 << bpu.pte; 117 128 } 118 129 119 130 READ_BCR(ARC_REG_AP_BCR, bcr); ··· 146 131 { {0x30, "ARC 700" }, 0x33}, 147 132 { {0x34, "ARC 700 R4.10"}, 0x34}, 148 133 { {0x35, "ARC 700 R4.11"}, 0x35}, 134 + { {0x50, "ARC HS38" }, 0x51}, 149 135 { {0x00, NULL } } 150 136 }; 151 137 ··· 165 149 166 150 FIX_PTR(cpu); 167 151 168 - { 152 + if (is_isa_arcompact()) { 169 153 isa_nm = "ARCompact"; 170 154 be = IS_ENABLED(CONFIG_CPU_BIG_ENDIAN); 171 155 172 156 atomic = cpu->isa.atomic1; 173 157 if (!cpu->isa.ver) /* ISA BCR absent, use Kconfig info */ 174 158 atomic = IS_ENABLED(CONFIG_ARC_HAS_LLSC); 159 + } else { 160 + isa_nm = "ARCv2"; 161 + be = cpu->isa.be; 162 + atomic = cpu->isa.atomic; 175 163 } 176 164 177 165 n += scnprintf(buf + n, len - n, ··· 203 183 n += scnprintf(buf + n, len - n, "Timers\t\t: %s%s%s%s\nISA Extn\t: ", 204 184 IS_AVAIL1(cpu->timers.t0, "Timer0 "), 205 185 IS_AVAIL1(cpu->timers.t1, "Timer1 "), 206 - IS_AVAIL2(cpu->timers.rtsc, "64-bit RTSC ", CONFIG_ARC_HAS_RTSC)); 186 + IS_AVAIL2(cpu->timers.rtc, "64-bit RTC ", 187 + CONFIG_ARC_HAS_RTC)); 207 188 208 - n += i = scnprintf(buf + n, len - n, "%s%s", 209 - IS_AVAIL2(atomic, "atomic ", CONFIG_ARC_HAS_LLSC)); 189 + n += i = scnprintf(buf + n, len - n, "%s%s%s%s%s", 190 + IS_AVAIL2(atomic, "atomic ", CONFIG_ARC_HAS_LLSC), 191 + IS_AVAIL2(cpu->isa.ldd, "ll64 ", CONFIG_ARC_HAS_LL64), 192 + IS_AVAIL1(cpu->isa.unalign, "unalign (not used)")); 210 193 211 194 if (i) 212 195 n += scnprintf(buf + n, len - n, "\n\t\t: "); 213 196 197 + if (cpu->extn_mpy.ver) { 198 + if (cpu->extn_mpy.ver <= 0x2) { /* ARCompact */ 199 + n += scnprintf(buf + n, len - n, "mpy "); 200 + } else { 201 + int opt = 2; /* stock MPY/MPYH */ 202 + 203 + if (cpu->extn_mpy.dsp) /* OPT 7-9 */ 204 + opt = cpu->extn_mpy.dsp + 6; 205 + 206 + n += scnprintf(buf + n, len - n, "mpy[opt %d] ", opt); 207 + } 208 + n += scnprintf(buf + n, len - n, "%s", 209 + IS_USED(CONFIG_ARC_HAS_HW_MPY)); 210 + } 211 + 214 212 n += scnprintf(buf + n, len - n, "%s%s%s%s%s%s%s%s\n", 215 - IS_AVAIL1(cpu->extn_mpy.ver, "mpy "), 213 + IS_AVAIL1(cpu->isa.div_rem, "div_rem "), 216 214 IS_AVAIL1(cpu->extn.norm, "norm "), 217 215 IS_AVAIL1(cpu->extn.barrel, "barrel-shift "), 218 216 IS_AVAIL1(cpu->extn.swap, "swap "), ··· 257 219 258 220 n += scnprintf(buf + n, len - n, 259 221 "Vector Table\t: %#x\nUncached Base\t: %#x\n", 260 - cpu->vec_base, cpu->uncached_base); 222 + cpu->vec_base, ARC_UNCACHED_ADDR_SPACE); 261 223 262 224 if (cpu->extn.fpu_sp || cpu->extn.fpu_dp) 263 225 n += scnprintf(buf + n, len - n, "FPU\t\t: %s%s\n", ··· 292 254 if (!cpu->timers.t1) 293 255 panic("Timer1 is not present!\n"); 294 256 295 - if (IS_ENABLED(CONFIG_ARC_HAS_RTSC) && !cpu->timers.rtsc) 296 - panic("RTSC is not present\n"); 257 + if (IS_ENABLED(CONFIG_ARC_HAS_RTC) && !cpu->timers.rtc) 258 + panic("RTC is not present\n"); 297 259 298 260 #ifdef CONFIG_ARC_HAS_DCCM 299 261 /* ··· 361 323 362 324 void __init setup_arch(char **cmdline_p) 363 325 { 326 + #ifdef CONFIG_ARC_UBOOT_SUPPORT 364 327 /* make sure that uboot passed pointer to cmdline/dtb is valid */ 365 328 if (uboot_tag && is_kernel((unsigned long)uboot_arg)) 366 329 panic("Invalid uboot arg\n"); 367 330 368 331 /* See if u-boot passed an external Device Tree blob */ 369 332 machine_desc = setup_machine_fdt(uboot_arg); /* uboot_tag == 2 */ 370 - if (!machine_desc) { 333 + if (!machine_desc) 334 + #endif 335 + { 371 336 /* No, so try the embedded one */ 372 337 machine_desc = setup_machine_fdt(__dtb_start); 373 338 if (!machine_desc)
+57 -5
arch/arc/kernel/signal.c
··· 67 67 sigset_t *set) 68 68 { 69 69 int err; 70 - err = __copy_to_user(&(sf->uc.uc_mcontext.regs.scratch), regs, 70 + struct user_regs_struct uregs; 71 + 72 + uregs.scratch.bta = regs->bta; 73 + uregs.scratch.lp_start = regs->lp_start; 74 + uregs.scratch.lp_end = regs->lp_end; 75 + uregs.scratch.lp_count = regs->lp_count; 76 + uregs.scratch.status32 = regs->status32; 77 + uregs.scratch.ret = regs->ret; 78 + uregs.scratch.blink = regs->blink; 79 + uregs.scratch.fp = regs->fp; 80 + uregs.scratch.gp = regs->r26; 81 + uregs.scratch.r12 = regs->r12; 82 + uregs.scratch.r11 = regs->r11; 83 + uregs.scratch.r10 = regs->r10; 84 + uregs.scratch.r9 = regs->r9; 85 + uregs.scratch.r8 = regs->r8; 86 + uregs.scratch.r7 = regs->r7; 87 + uregs.scratch.r6 = regs->r6; 88 + uregs.scratch.r5 = regs->r5; 89 + uregs.scratch.r4 = regs->r4; 90 + uregs.scratch.r3 = regs->r3; 91 + uregs.scratch.r2 = regs->r2; 92 + uregs.scratch.r1 = regs->r1; 93 + uregs.scratch.r0 = regs->r0; 94 + uregs.scratch.sp = regs->sp; 95 + 96 + err = __copy_to_user(&(sf->uc.uc_mcontext.regs.scratch), &uregs.scratch, 71 97 sizeof(sf->uc.uc_mcontext.regs.scratch)); 72 98 err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(sigset_t)); 73 99 ··· 104 78 { 105 79 sigset_t set; 106 80 int err; 81 + struct user_regs_struct uregs; 107 82 108 83 err = __copy_from_user(&set, &sf->uc.uc_sigmask, sizeof(set)); 109 84 if (!err) 110 85 set_current_blocked(&set); 111 86 112 - err |= __copy_from_user(regs, &(sf->uc.uc_mcontext.regs.scratch), 87 + err |= __copy_from_user(&uregs.scratch, 88 + &(sf->uc.uc_mcontext.regs.scratch), 113 89 sizeof(sf->uc.uc_mcontext.regs.scratch)); 90 + 91 + regs->bta = uregs.scratch.bta; 92 + regs->lp_start = uregs.scratch.lp_start; 93 + regs->lp_end = uregs.scratch.lp_end; 94 + regs->lp_count = uregs.scratch.lp_count; 95 + regs->status32 = uregs.scratch.status32; 96 + regs->ret = uregs.scratch.ret; 97 + regs->blink = uregs.scratch.blink; 98 + regs->fp = uregs.scratch.fp; 99 + regs->r26 = uregs.scratch.gp; 100 + regs->r12 = uregs.scratch.r12; 101 + regs->r11 = uregs.scratch.r11; 102 + regs->r10 = uregs.scratch.r10; 103 + regs->r9 = uregs.scratch.r9; 104 + regs->r8 = uregs.scratch.r8; 105 + regs->r7 = uregs.scratch.r7; 106 + regs->r6 = uregs.scratch.r6; 107 + regs->r5 = uregs.scratch.r5; 108 + regs->r4 = uregs.scratch.r4; 109 + regs->r3 = uregs.scratch.r3; 110 + regs->r2 = uregs.scratch.r2; 111 + regs->r1 = uregs.scratch.r1; 112 + regs->r0 = uregs.scratch.r0; 113 + regs->sp = uregs.scratch.sp; 114 114 115 115 return err; 116 116 } ··· 336 284 * their orig user space value when we ret from kernel 337 285 */ 338 286 regs->r0 = regs->orig_r0; 339 - regs->ret -= 4; 287 + regs->ret -= is_isa_arcv2() ? 2 : 4; 340 288 break; 341 289 } 342 290 } ··· 377 325 if (regs->r0 == -ERESTARTNOHAND || 378 326 regs->r0 == -ERESTARTSYS || regs->r0 == -ERESTARTNOINTR) { 379 327 regs->r0 = regs->orig_r0; 380 - regs->ret -= 4; 328 + regs->ret -= is_isa_arcv2() ? 2 : 4; 381 329 } else if (regs->r0 == -ERESTART_RESTARTBLOCK) { 382 330 regs->r8 = __NR_restart_syscall; 383 - regs->ret -= 4; 331 + regs->ret -= is_isa_arcv2() ? 2 : 4; 384 332 } 385 333 syscall_wont_restart(regs); /* No more restarts */ 386 334 }
+18 -6
arch/arc/kernel/smp.c
··· 31 31 arch_spinlock_t smp_bitops_lock = __ARCH_SPIN_LOCK_UNLOCKED; 32 32 #endif 33 33 34 - struct plat_smp_ops plat_smp_ops; 34 + struct plat_smp_ops __weak plat_smp_ops; 35 35 36 36 /* XXX: per cpu ? Only needed once in early seconday boot */ 37 37 struct task_struct *secondary_idle_tsk; ··· 182 182 /* 183 183 * not supported here 184 184 */ 185 - int __init setup_profiling_timer(unsigned int multiplier) 185 + int setup_profiling_timer(unsigned int multiplier) 186 186 { 187 187 return -EINVAL; 188 188 } ··· 278 278 machine_halt(); 279 279 } 280 280 281 - static inline void __do_IPI(unsigned long msg) 281 + static inline int __do_IPI(unsigned long msg) 282 282 { 283 + int rc = 0; 284 + 283 285 switch (msg) { 284 286 case IPI_RESCHEDULE: 285 287 scheduler_ipi(); ··· 296 294 break; 297 295 298 296 default: 299 - pr_warn("IPI with unexpected msg %ld\n", msg); 297 + rc = 1; 300 298 } 299 + 300 + return rc; 301 301 } 302 302 303 303 /* ··· 309 305 irqreturn_t do_IPI(int irq, void *dev_id) 310 306 { 311 307 unsigned long pending; 308 + unsigned long __maybe_unused copy; 312 309 313 310 pr_debug("IPI [%ld] received on cpu %d\n", 314 311 *this_cpu_ptr(&ipi_data), smp_processor_id()); ··· 321 316 * "dequeue" the msg corresponding to this IPI (and possibly other 322 317 * piggybacked msg from elided IPIs: see ipi_send_msg_one() above) 323 318 */ 324 - pending = xchg(this_cpu_ptr(&ipi_data), 0); 319 + copy = pending = xchg(this_cpu_ptr(&ipi_data), 0); 325 320 326 321 do { 327 322 unsigned long msg = __ffs(pending); 328 - __do_IPI(msg); 323 + int rc; 324 + 325 + rc = __do_IPI(msg); 326 + #ifdef CONFIG_ARC_IPI_DBG 327 + /* IPI received but no valid @msg */ 328 + if (rc) 329 + pr_info("IPI with bogus msg %ld in %ld\n", msg, copy); 330 + #endif 329 331 pending &= ~(1U << msg); 330 332 } while (pending); 331 333
+8 -10
arch/arc/kernel/stacktrace.c
··· 122 122 while (1) { 123 123 address = UNW_PC(&frame_info); 124 124 125 - if (address && __kernel_text_address(address)) { 126 - if (consumer_fn(address, arg) == -1) 127 - break; 128 - } 125 + if (!address || !__kernel_text_address(address)) 126 + break; 127 + 128 + if (consumer_fn(address, arg) == -1) 129 + break; 129 130 130 131 ret = arc_unwind(&frame_info); 131 - 132 - if (ret == 0) { 133 - frame_info.regs.r63 = frame_info.regs.r31; 134 - continue; 135 - } else { 132 + if (ret) 136 133 break; 137 - } 134 + 135 + frame_info.regs.r63 = frame_info.regs.r31; 138 136 } 139 137 140 138 return address; /* return the last address it saw */
+67 -27
arch/arc/kernel/time.c
··· 26 26 * while TIMER1 for free running (clocksource) 27 27 * 28 28 * Newer ARC700 cores have 64bit clk fetching RTSC insn, preferred over TIMER1 29 + * which however is currently broken 29 30 */ 30 31 31 32 #include <linux/spinlock.h> ··· 45 44 #include <asm/clk.h> 46 45 #include <asm/mach_desc.h> 47 46 47 + #include <asm/mcip.h> 48 + 48 49 /* Timer related Aux registers */ 49 50 #define ARC_REG_TIMER0_LIMIT 0x23 /* timer 0 limit */ 50 51 #define ARC_REG_TIMER0_CTRL 0x22 /* timer 0 control */ ··· 62 59 63 60 /********** Clock Source Device *********/ 64 61 65 - #ifdef CONFIG_ARC_HAS_RTSC 62 + #ifdef CONFIG_ARC_HAS_GRTC 66 63 67 - int arc_counter_setup(void) 64 + static int arc_counter_setup(void) 68 65 { 69 - /* 70 - * For SMP this needs to be 0. However Kconfig glue doesn't 71 - * enable this option for SMP configs 72 - */ 73 66 return 1; 74 67 } 75 68 76 69 static cycle_t arc_counter_read(struct clocksource *cs) 77 70 { 78 71 unsigned long flags; 72 + union { 73 + #ifdef CONFIG_CPU_BIG_ENDIAN 74 + struct { u32 h, l; }; 75 + #else 76 + struct { u32 l, h; }; 77 + #endif 78 + cycle_t full; 79 + } stamp; 80 + 81 + local_irq_save(flags); 82 + 83 + __mcip_cmd(CMD_GRTC_READ_LO, 0); 84 + stamp.l = read_aux_reg(ARC_REG_MCIP_READBACK); 85 + 86 + __mcip_cmd(CMD_GRTC_READ_HI, 0); 87 + stamp.h = read_aux_reg(ARC_REG_MCIP_READBACK); 88 + 89 + local_irq_restore(flags); 90 + 91 + return stamp.full; 92 + } 93 + 94 + static struct clocksource arc_counter = { 95 + .name = "ARConnect GRTC", 96 + .rating = 400, 97 + .read = arc_counter_read, 98 + .mask = CLOCKSOURCE_MASK(64), 99 + .flags = CLOCK_SOURCE_IS_CONTINUOUS, 100 + }; 101 + 102 + #else 103 + 104 + #ifdef CONFIG_ARC_HAS_RTC 105 + 106 + #define AUX_RTC_CTRL 0x103 107 + #define AUX_RTC_LOW 0x104 108 + #define AUX_RTC_HIGH 0x105 109 + 110 + int arc_counter_setup(void) 111 + { 112 + write_aux_reg(AUX_RTC_CTRL, 1); 113 + 114 + /* Not usable in SMP */ 115 + return !IS_ENABLED(CONFIG_SMP); 116 + } 117 + 118 + static cycle_t arc_counter_read(struct clocksource *cs) 119 + { 120 + unsigned long status; 79 121 union { 80 122 #ifdef CONFIG_CPU_BIG_ENDIAN 81 123 struct { u32 high, low; }; ··· 130 82 cycle_t full; 131 83 } stamp; 132 84 133 - flags = arch_local_irq_save(); 134 85 135 86 __asm__ __volatile( 136 - " .extCoreRegister tsch, 58, r, cannot_shortcut \n" 137 - " rtsc %0, 0 \n" 138 - " mov %1, 0 \n" 139 - : "=r" (stamp.low), "=r" (stamp.high)); 140 - 141 - arch_local_irq_restore(flags); 87 + "1: \n" 88 + " lr %0, [AUX_RTC_LOW] \n" 89 + " lr %1, [AUX_RTC_HIGH] \n" 90 + " lr %2, [AUX_RTC_CTRL] \n" 91 + " bbit0.nt %2, 31, 1b \n" 92 + : "=r" (stamp.low), "=r" (stamp.high), "=r" (status)); 142 93 143 94 return stamp.full; 144 95 } 145 96 146 97 static struct clocksource arc_counter = { 147 - .name = "ARC RTSC", 148 - .rating = 300, 98 + .name = "ARCv2 RTC", 99 + .rating = 350, 149 100 .read = arc_counter_read, 150 - .mask = CLOCKSOURCE_MASK(32), 101 + .mask = CLOCKSOURCE_MASK(64), 151 102 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 152 103 }; 153 104 154 - #else /* !CONFIG_ARC_HAS_RTSC */ 155 - 156 - static bool is_usable_as_clocksource(void) 157 - { 158 - #ifdef CONFIG_SMP 159 - return 0; 160 - #else 161 - return 1; 162 - #endif 163 - } 105 + #else /* !CONFIG_ARC_HAS_RTC */ 164 106 165 107 /* 166 108 * set 32bit TIMER1 to keep counting monotonically and wraparound ··· 161 123 write_aux_reg(ARC_REG_TIMER1_CNT, 0); 162 124 write_aux_reg(ARC_REG_TIMER1_CTRL, TIMER_CTRL_NH); 163 125 164 - return is_usable_as_clocksource(); 126 + /* Not usable in SMP */ 127 + return !IS_ENABLED(CONFIG_SMP); 165 128 } 166 129 167 130 static cycle_t arc_counter_read(struct clocksource *cs) ··· 178 139 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 179 140 }; 180 141 142 + #endif 181 143 #endif 182 144 183 145 /********** Clock Event Device *********/
+27 -6
arch/arc/kernel/troubleshoot.c
··· 14 14 #include <linux/proc_fs.h> 15 15 #include <linux/file.h> 16 16 #include <asm/arcregs.h> 17 + #include <asm/irqflags.h> 17 18 18 19 /* 19 20 * Common routine to print scratch regs (r0-r12) or callee regs (r13-r25) ··· 35 34 n += scnprintf(buf + n, len - n, "\n"); 36 35 37 36 /* because pt_regs has regs reversed: r12..r0, r25..r13 */ 38 - reg_rev--; 37 + if (is_isa_arcv2() && start_num == 0) 38 + reg_rev++; 39 + else 40 + reg_rev--; 39 41 } 40 42 41 43 if (start_num != 0) ··· 156 152 ((cause_code == 0x02) ? "Write" : "EX")); 157 153 } else if (vec == ECR_V_INSN_ERR) { 158 154 pr_cont("Illegal Insn\n"); 155 + #ifdef CONFIG_ISA_ARCV2 156 + } else if (vec == ECR_V_MEM_ERR) { 157 + if (cause_code == 0x00) 158 + pr_cont("Bus Error from Insn Mem\n"); 159 + else if (cause_code == 0x10) 160 + pr_cont("Bus Error from Data Mem\n"); 161 + else 162 + pr_cont("Bus Error, check PRM\n"); 163 + #endif 159 164 } else { 160 165 pr_cont("Check Programmer's Manual\n"); 161 166 } ··· 198 185 199 186 pr_info("[STAT32]: 0x%08lx", regs->status32); 200 187 201 - #define STS_BIT(r, bit) r->status32 & STATUS_##bit##_MASK ? #bit : "" 202 - if (!user_mode(regs)) 203 - pr_cont(" : %2s %2s %2s %2s %2s\n", 204 - STS_BIT(regs, AE), STS_BIT(regs, A2), STS_BIT(regs, A1), 205 - STS_BIT(regs, E2), STS_BIT(regs, E1)); 188 + #define STS_BIT(r, bit) r->status32 & STATUS_##bit##_MASK ? #bit" " : "" 206 189 190 + #ifdef CONFIG_ISA_ARCOMPACT 191 + pr_cont(" : %2s%2s%2s%2s%2s%2s%2s\n", 192 + (regs->status32 & STATUS_U_MASK) ? "U " : "K ", 193 + STS_BIT(regs, DE), STS_BIT(regs, AE), 194 + STS_BIT(regs, A2), STS_BIT(regs, A1), 195 + STS_BIT(regs, E2), STS_BIT(regs, E1)); 196 + #else 197 + pr_cont(" : %2s%2s%2s%2s\n", 198 + STS_BIT(regs, IE), 199 + (regs->status32 & STATUS_U_MASK) ? "U " : "K ", 200 + STS_BIT(regs, DE), STS_BIT(regs, AE)); 201 + #endif 207 202 pr_info("BTA: 0x%08lx\t SP: 0x%08lx\t FP: 0x%08lx\n", 208 203 regs->bta, regs->sp, regs->fp); 209 204 pr_info("LPS: 0x%08lx\tLPE: 0x%08lx\tLPC: 0x%08lx\n",
+4 -2
arch/arc/lib/Makefile
··· 5 5 # it under the terms of the GNU General Public License version 2 as 6 6 # published by the Free Software Foundation. 7 7 8 - lib-y := strchr-700.o strcmp.o strcpy-700.o strlen.o 9 - lib-y += memcmp.o memcpy-700.o memset.o 8 + lib-y := strchr-700.o strcpy-700.o strlen.o memcmp.o 9 + 10 + lib-$(CONFIG_ISA_ARCOMPACT) += memcpy-700.o memset.o strcmp.o 11 + lib-$(CONFIG_ISA_ARCV2) += memcpy-archs.o memset-archs.o strcmp-archs.o
+29 -1
arch/arc/lib/memcmp.S
··· 24 24 ld r4,[r0,0] 25 25 ld r5,[r1,0] 26 26 lsr.f lp_count,r3,3 27 + #ifdef CONFIG_ISA_ARCV2 28 + /* In ARCv2 a branch can't be the last instruction in a zero overhead 29 + * loop. 30 + * So we move the branch to the start of the loop, duplicate it 31 + * after the end, and set up r12 so that the branch isn't taken 32 + * initially. 33 + */ 34 + mov_s r12,WORD2 35 + lpne .Loop_end 36 + brne WORD2,r12,.Lodd 37 + ld WORD2,[r0,4] 38 + #else 27 39 lpne .Loop_end 28 40 ld_s WORD2,[r0,4] 41 + #endif 29 42 ld_s r12,[r1,4] 30 43 brne r4,r5,.Leven 31 44 ld.a r4,[r0,8] 32 45 ld.a r5,[r1,8] 46 + #ifdef CONFIG_ISA_ARCV2 47 + .Loop_end: 48 + brne WORD2,r12,.Lodd 49 + #else 33 50 brne WORD2,r12,.Lodd 34 51 .Loop_end: 52 + #endif 35 53 asl_s SHIFT,SHIFT,3 36 54 bhs_s .Last_cmp 37 55 brne r4,r5,.Leven ··· 107 89 bset.cs r0,r0,31 108 90 .Lodd: 109 91 cmp_s WORD2,r12 110 - 111 92 mov_s r0,1 112 93 j_s.d [blink] 113 94 bset.cs r0,r0,31 ··· 117 100 ldb r4,[r0,0] 118 101 ldb r5,[r1,0] 119 102 lsr.f lp_count,r3 103 + #ifdef CONFIG_ISA_ARCV2 104 + mov r12,r3 120 105 lpne .Lbyte_end 106 + brne r3,r12,.Lbyte_odd 107 + #else 108 + lpne .Lbyte_end 109 + #endif 121 110 ldb_s r3,[r0,1] 122 111 ldb r12,[r1,1] 123 112 brne r4,r5,.Lbyte_even 124 113 ldb.a r4,[r0,2] 125 114 ldb.a r5,[r1,2] 115 + #ifdef CONFIG_ISA_ARCV2 116 + .Lbyte_end: 117 + brne r3,r12,.Lbyte_odd 118 + #else 126 119 brne r3,r12,.Lbyte_odd 127 120 .Lbyte_end: 121 + #endif 128 122 bcc .Lbyte_even 129 123 brne r4,r5,.Lbyte_even 130 124 ldb_s r3,[r0,1]
+236
arch/arc/lib/memcpy-archs.S
··· 1 + /* 2 + * Copyright (C) 2014-15 Synopsys, Inc. (www.synopsys.com) 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License version 2 as 6 + * published by the Free Software Foundation. 7 + */ 8 + 9 + #include <linux/linkage.h> 10 + 11 + #ifdef __LITTLE_ENDIAN__ 12 + # define SHIFT_1(RX,RY,IMM) asl RX, RY, IMM ; << 13 + # define SHIFT_2(RX,RY,IMM) lsr RX, RY, IMM ; >> 14 + # define MERGE_1(RX,RY,IMM) asl RX, RY, IMM 15 + # define MERGE_2(RX,RY,IMM) 16 + # define EXTRACT_1(RX,RY,IMM) and RX, RY, 0xFFFF 17 + # define EXTRACT_2(RX,RY,IMM) lsr RX, RY, IMM 18 + #else 19 + # define SHIFT_1(RX,RY,IMM) lsr RX, RY, IMM ; >> 20 + # define SHIFT_2(RX,RY,IMM) asl RX, RY, IMM ; << 21 + # define MERGE_1(RX,RY,IMM) asl RX, RY, IMM ; << 22 + # define MERGE_2(RX,RY,IMM) asl RX, RY, IMM ; << 23 + # define EXTRACT_1(RX,RY,IMM) lsr RX, RY, IMM 24 + # define EXTRACT_2(RX,RY,IMM) lsr RX, RY, 0x08 25 + #endif 26 + 27 + #ifdef CONFIG_ARC_HAS_LL64 28 + # define PREFETCH_READ(RX) prefetch [RX, 56] 29 + # define PREFETCH_WRITE(RX) prefetchw [RX, 64] 30 + # define LOADX(DST,RX) ldd.ab DST, [RX, 8] 31 + # define STOREX(SRC,RX) std.ab SRC, [RX, 8] 32 + # define ZOLSHFT 5 33 + # define ZOLAND 0x1F 34 + #else 35 + # define PREFETCH_READ(RX) prefetch [RX, 28] 36 + # define PREFETCH_WRITE(RX) prefetchw [RX, 32] 37 + # define LOADX(DST,RX) ld.ab DST, [RX, 4] 38 + # define STOREX(SRC,RX) st.ab SRC, [RX, 4] 39 + # define ZOLSHFT 4 40 + # define ZOLAND 0xF 41 + #endif 42 + 43 + ENTRY(memcpy) 44 + prefetch [r1] ; Prefetch the read location 45 + prefetchw [r0] ; Prefetch the write location 46 + mov.f 0, r2 47 + ;;; if size is zero 48 + jz.d [blink] 49 + mov r3, r0 ; don;t clobber ret val 50 + 51 + ;;; if size <= 8 52 + cmp r2, 8 53 + bls.d @smallchunk 54 + mov.f lp_count, r2 55 + 56 + and.f r4, r0, 0x03 57 + rsub lp_count, r4, 4 58 + lpnz @aligndestination 59 + ;; LOOP BEGIN 60 + ldb.ab r5, [r1,1] 61 + sub r2, r2, 1 62 + stb.ab r5, [r3,1] 63 + aligndestination: 64 + 65 + ;;; Check the alignment of the source 66 + and.f r4, r1, 0x03 67 + bnz.d @sourceunaligned 68 + 69 + ;;; CASE 0: Both source and destination are 32bit aligned 70 + ;;; Convert len to Dwords, unfold x4 71 + lsr.f lp_count, r2, ZOLSHFT 72 + lpnz @copy32_64bytes 73 + ;; LOOP START 74 + LOADX (r6, r1) 75 + PREFETCH_READ (r1) 76 + PREFETCH_WRITE (r3) 77 + LOADX (r8, r1) 78 + LOADX (r10, r1) 79 + LOADX (r4, r1) 80 + STOREX (r6, r3) 81 + STOREX (r8, r3) 82 + STOREX (r10, r3) 83 + STOREX (r4, r3) 84 + copy32_64bytes: 85 + 86 + and.f lp_count, r2, ZOLAND ;Last remaining 31 bytes 87 + smallchunk: 88 + lpnz @copyremainingbytes 89 + ;; LOOP START 90 + ldb.ab r5, [r1,1] 91 + stb.ab r5, [r3,1] 92 + copyremainingbytes: 93 + 94 + j [blink] 95 + ;;; END CASE 0 96 + 97 + sourceunaligned: 98 + cmp r4, 2 99 + beq.d @unalignedOffby2 100 + sub r2, r2, 1 101 + 102 + bhi.d @unalignedOffby3 103 + ldb.ab r5, [r1, 1] 104 + 105 + ;;; CASE 1: The source is unaligned, off by 1 106 + ;; Hence I need to read 1 byte for a 16bit alignment 107 + ;; and 2bytes to reach 32bit alignment 108 + ldh.ab r6, [r1, 2] 109 + sub r2, r2, 2 110 + ;; Convert to words, unfold x2 111 + lsr.f lp_count, r2, 3 112 + MERGE_1 (r6, r6, 8) 113 + MERGE_2 (r5, r5, 24) 114 + or r5, r5, r6 115 + 116 + ;; Both src and dst are aligned 117 + lpnz @copy8bytes_1 118 + ;; LOOP START 119 + ld.ab r6, [r1, 4] 120 + prefetch [r1, 28] ;Prefetch the next read location 121 + ld.ab r8, [r1,4] 122 + prefetchw [r3, 32] ;Prefetch the next write location 123 + 124 + SHIFT_1 (r7, r6, 24) 125 + or r7, r7, r5 126 + SHIFT_2 (r5, r6, 8) 127 + 128 + SHIFT_1 (r9, r8, 24) 129 + or r9, r9, r5 130 + SHIFT_2 (r5, r8, 8) 131 + 132 + st.ab r7, [r3, 4] 133 + st.ab r9, [r3, 4] 134 + copy8bytes_1: 135 + 136 + ;; Write back the remaining 16bits 137 + EXTRACT_1 (r6, r5, 16) 138 + sth.ab r6, [r3, 2] 139 + ;; Write back the remaining 8bits 140 + EXTRACT_2 (r5, r5, 16) 141 + stb.ab r5, [r3, 1] 142 + 143 + and.f lp_count, r2, 0x07 ;Last 8bytes 144 + lpnz @copybytewise_1 145 + ;; LOOP START 146 + ldb.ab r6, [r1,1] 147 + stb.ab r6, [r3,1] 148 + copybytewise_1: 149 + j [blink] 150 + 151 + unalignedOffby2: 152 + ;;; CASE 2: The source is unaligned, off by 2 153 + ldh.ab r5, [r1, 2] 154 + sub r2, r2, 1 155 + 156 + ;; Both src and dst are aligned 157 + ;; Convert to words, unfold x2 158 + lsr.f lp_count, r2, 3 159 + #ifdef __BIG_ENDIAN__ 160 + asl.nz r5, r5, 16 161 + #endif 162 + lpnz @copy8bytes_2 163 + ;; LOOP START 164 + ld.ab r6, [r1, 4] 165 + prefetch [r1, 28] ;Prefetch the next read location 166 + ld.ab r8, [r1,4] 167 + prefetchw [r3, 32] ;Prefetch the next write location 168 + 169 + SHIFT_1 (r7, r6, 16) 170 + or r7, r7, r5 171 + SHIFT_2 (r5, r6, 16) 172 + 173 + SHIFT_1 (r9, r8, 16) 174 + or r9, r9, r5 175 + SHIFT_2 (r5, r8, 16) 176 + 177 + st.ab r7, [r3, 4] 178 + st.ab r9, [r3, 4] 179 + copy8bytes_2: 180 + 181 + #ifdef __BIG_ENDIAN__ 182 + lsr.nz r5, r5, 16 183 + #endif 184 + sth.ab r5, [r3, 2] 185 + 186 + and.f lp_count, r2, 0x07 ;Last 8bytes 187 + lpnz @copybytewise_2 188 + ;; LOOP START 189 + ldb.ab r6, [r1,1] 190 + stb.ab r6, [r3,1] 191 + copybytewise_2: 192 + j [blink] 193 + 194 + unalignedOffby3: 195 + ;;; CASE 3: The source is unaligned, off by 3 196 + ;;; Hence, I need to read 1byte for achieve the 32bit alignment 197 + 198 + ;; Both src and dst are aligned 199 + ;; Convert to words, unfold x2 200 + lsr.f lp_count, r2, 3 201 + #ifdef __BIG_ENDIAN__ 202 + asl.ne r5, r5, 24 203 + #endif 204 + lpnz @copy8bytes_3 205 + ;; LOOP START 206 + ld.ab r6, [r1, 4] 207 + prefetch [r1, 28] ;Prefetch the next read location 208 + ld.ab r8, [r1,4] 209 + prefetch [r3, 32] ;Prefetch the next write location 210 + 211 + SHIFT_1 (r7, r6, 8) 212 + or r7, r7, r5 213 + SHIFT_2 (r5, r6, 24) 214 + 215 + SHIFT_1 (r9, r8, 8) 216 + or r9, r9, r5 217 + SHIFT_2 (r5, r8, 24) 218 + 219 + st.ab r7, [r3, 4] 220 + st.ab r9, [r3, 4] 221 + copy8bytes_3: 222 + 223 + #ifdef __BIG_ENDIAN__ 224 + lsr.nz r5, r5, 24 225 + #endif 226 + stb.ab r5, [r3, 1] 227 + 228 + and.f lp_count, r2, 0x07 ;Last 8bytes 229 + lpnz @copybytewise_3 230 + ;; LOOP START 231 + ldb.ab r6, [r1,1] 232 + stb.ab r6, [r3,1] 233 + copybytewise_3: 234 + j [blink] 235 + 236 + END(memcpy)
+93
arch/arc/lib/memset-archs.S
··· 1 + /* 2 + * Copyright (C) 2014-15 Synopsys, Inc. (www.synopsys.com) 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License version 2 as 6 + * published by the Free Software Foundation. 7 + */ 8 + 9 + #include <linux/linkage.h> 10 + 11 + #undef PREALLOC_NOT_AVAIL 12 + 13 + #ifdef PREALLOC_NOT_AVAIL 14 + #define PREWRITE(A,B) prefetchw [(A),(B)] 15 + #else 16 + #define PREWRITE(A,B) prealloc [(A),(B)] 17 + #endif 18 + 19 + ENTRY(memset) 20 + prefetchw [r0] ; Prefetch the write location 21 + mov.f 0, r2 22 + ;;; if size is zero 23 + jz.d [blink] 24 + mov r3, r0 ; don't clobber ret val 25 + 26 + ;;; if length < 8 27 + brls.d.nt r2, 8, .Lsmallchunk 28 + mov.f lp_count,r2 29 + 30 + and.f r4, r0, 0x03 31 + rsub lp_count, r4, 4 32 + lpnz @.Laligndestination 33 + ;; LOOP BEGIN 34 + stb.ab r1, [r3,1] 35 + sub r2, r2, 1 36 + .Laligndestination: 37 + 38 + ;;; Destination is aligned 39 + and r1, r1, 0xFF 40 + asl r4, r1, 8 41 + or r4, r4, r1 42 + asl r5, r4, 16 43 + or r5, r5, r4 44 + mov r4, r5 45 + 46 + sub3 lp_count, r2, 8 47 + cmp r2, 64 48 + bmsk.hi r2, r2, 5 49 + mov.ls lp_count, 0 50 + add3.hi r2, r2, 8 51 + 52 + ;;; Convert len to Dwords, unfold x8 53 + lsr.f lp_count, lp_count, 6 54 + lpnz @.Lset64bytes 55 + ;; LOOP START 56 + PREWRITE(r3, 64) ;Prefetch the next write location 57 + std.ab r4, [r3, 8] 58 + std.ab r4, [r3, 8] 59 + std.ab r4, [r3, 8] 60 + std.ab r4, [r3, 8] 61 + std.ab r4, [r3, 8] 62 + std.ab r4, [r3, 8] 63 + std.ab r4, [r3, 8] 64 + std.ab r4, [r3, 8] 65 + .Lset64bytes: 66 + 67 + lsr.f lp_count, r2, 5 ;Last remaining max 124 bytes 68 + lpnz .Lset32bytes 69 + ;; LOOP START 70 + prefetchw [r3, 32] ;Prefetch the next write location 71 + std.ab r4, [r3, 8] 72 + std.ab r4, [r3, 8] 73 + std.ab r4, [r3, 8] 74 + std.ab r4, [r3, 8] 75 + .Lset32bytes: 76 + 77 + and.f lp_count, r2, 0x1F ;Last remaining 31 bytes 78 + .Lsmallchunk: 79 + lpnz .Lcopy3bytes 80 + ;; LOOP START 81 + stb.ab r1, [r3, 1] 82 + .Lcopy3bytes: 83 + 84 + j [blink] 85 + 86 + END(memset) 87 + 88 + ENTRY(memzero) 89 + ; adjust bzero args to memset args 90 + mov r2, r1 91 + b.d memset ;tail call so need to tinker with blink 92 + mov r1, 0 93 + END(memzero)
+78
arch/arc/lib/strcmp-archs.S
··· 1 + /* 2 + * Copyright (C) 2014-15 Synopsys, Inc. (www.synopsys.com) 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License version 2 as 6 + * published by the Free Software Foundation. 7 + */ 8 + 9 + #include <linux/linkage.h> 10 + 11 + ENTRY(strcmp) 12 + or r2, r0, r1 13 + bmsk_s r2, r2, 1 14 + brne r2, 0, @.Lcharloop 15 + 16 + ;;; s1 and s2 are word aligned 17 + ld.ab r2, [r0, 4] 18 + 19 + mov_s r12, 0x01010101 20 + ror r11, r12 21 + .align 4 22 + .LwordLoop: 23 + ld.ab r3, [r1, 4] 24 + ;; Detect NULL char in str1 25 + sub r4, r2, r12 26 + ld.ab r5, [r0, 4] 27 + bic r4, r4, r2 28 + and r4, r4, r11 29 + brne.d.nt r4, 0, .LfoundNULL 30 + ;; Check if the read locations are the same 31 + cmp r2, r3 32 + beq.d .LwordLoop 33 + mov.eq r2, r5 34 + 35 + ;; A match is found, spot it out 36 + #ifdef __LITTLE_ENDIAN__ 37 + swape r3, r3 38 + mov_s r0, 1 39 + swape r2, r2 40 + #else 41 + mov_s r0, 1 42 + #endif 43 + cmp_s r2, r3 44 + j_s.d [blink] 45 + bset.lo r0, r0, 31 46 + 47 + .align 4 48 + .LfoundNULL: 49 + #ifdef __BIG_ENDIAN__ 50 + swape r4, r4 51 + swape r2, r2 52 + swape r3, r3 53 + #endif 54 + ;; Find null byte 55 + ffs r0, r4 56 + bmsk r2, r2, r0 57 + bmsk r3, r3, r0 58 + swape r2, r2 59 + swape r3, r3 60 + ;; make the return value 61 + sub.f r0, r2, r3 62 + mov.hi r0, 1 63 + j_s.d [blink] 64 + bset.lo r0, r0, 31 65 + 66 + .align 4 67 + .Lcharloop: 68 + ldb.ab r2, [r0, 1] 69 + ldb.ab r3, [r1, 1] 70 + nop 71 + breq r2, 0, .Lcmpend 72 + breq r2, r3, .Lcharloop 73 + 74 + .align 4 75 + .Lcmpend: 76 + j_s.d [blink] 77 + sub r0, r2, r3 78 + END(strcmp)
+1 -1
arch/arc/mm/Makefile
··· 7 7 # 8 8 9 9 obj-y := extable.o ioremap.o dma.o fault.o init.o 10 - obj-y += tlb.o tlbex.o cache_arc700.o mmap.o 10 + obj-y += tlb.o tlbex.o cache.o mmap.o
+395 -275
arch/arc/mm/cache_arc700.c arch/arc/mm/cache.c
··· 1 1 /* 2 - * ARC700 VIPT Cache Management 2 + * ARC Cache Management 3 3 * 4 + * Copyright (C) 2014-15 Synopsys, Inc. (www.synopsys.com) 4 5 * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com) 5 6 * 6 7 * This program is free software; you can redistribute it and/or modify 7 8 * it under the terms of the GNU General Public License version 2 as 8 9 * published by the Free Software Foundation. 9 - * 10 - * vineetg: May 2011: for Non-aliasing VIPT D-cache following can be NOPs 11 - * -flush_cache_dup_mm (fork) 12 - * -likewise for flush_cache_mm (exit/execve) 13 - * -likewise for flush_cache_range,flush_cache_page (munmap, exit, COW-break) 14 - * 15 - * vineetg: Apr 2011 16 - * -Now that MMU can support larger pg sz (16K), the determiniation of 17 - * aliasing shd not be based on assumption of 8k pg 18 - * 19 - * vineetg: Mar 2011 20 - * -optimised version of flush_icache_range( ) for making I/D coherent 21 - * when vaddr is available (agnostic of num of aliases) 22 - * 23 - * vineetg: Mar 2011 24 - * -Added documentation about I-cache aliasing on ARC700 and the way it 25 - * was handled up until MMU V2. 26 - * -Spotted a three year old bug when killing the 4 aliases, which needs 27 - * bottom 2 bits, so we need to do paddr | {0x00, 0x01, 0x02, 0x03} 28 - * instead of paddr | {0x00, 0x01, 0x10, 0x11} 29 - * (Rajesh you owe me one now) 30 - * 31 - * vineetg: Dec 2010 32 - * -Off-by-one error when computing num_of_lines to flush 33 - * This broke signal handling with bionic which uses synthetic sigret stub 34 - * 35 - * vineetg: Mar 2010 36 - * -GCC can't generate ZOL for core cache flush loops. 37 - * Conv them into iterations based as opposed to while (start < end) types 38 - * 39 - * Vineetg: July 2009 40 - * -In I-cache flush routine we used to chk for aliasing for every line INV. 41 - * Instead now we setup routines per cache geometry and invoke them 42 - * via function pointers. 43 - * 44 - * Vineetg: Jan 2009 45 - * -Cache Line flush routines used to flush an extra line beyond end addr 46 - * because check was while (end >= start) instead of (end > start) 47 - * =Some call sites had to work around by doing -1, -4 etc to end param 48 - * =Some callers didnt care. This was spec bad in case of INV routines 49 - * which would discard valid data (cause of the horrible ext2 bug 50 - * in ARC IDE driver) 51 - * 52 - * vineetg: June 11th 2008: Fixed flush_icache_range( ) 53 - * -Since ARC700 caches are not coherent (I$ doesnt snoop D$) both need 54 - * to be flushed, which it was not doing. 55 - * -load_module( ) passes vmalloc addr (Kernel Virtual Addr) to the API, 56 - * however ARC cache maintenance OPs require PHY addr. Thus need to do 57 - * vmalloc_to_phy. 58 - * -Also added optimisation there, that for range > PAGE SIZE we flush the 59 - * entire cache in one shot rather than line by line. For e.g. a module 60 - * with Code sz 600k, old code flushed 600k worth of cache (line-by-line), 61 - * while cache is only 16 or 32k. 62 10 */ 63 11 64 12 #include <linux/module.h> ··· 21 73 #include <asm/cachectl.h> 22 74 #include <asm/setup.h> 23 75 76 + static int l2_line_sz; 77 + 78 + void (*_cache_line_loop_ic_fn)(unsigned long paddr, unsigned long vaddr, 79 + unsigned long sz, const int cacheop); 80 + 24 81 char *arc_cache_mumbojumbo(int c, char *buf, int len) 25 82 { 26 83 int n = 0; 84 + struct cpuinfo_arc_cache *p; 27 85 28 86 #define PR_CACHE(p, cfg, str) \ 29 87 if (!(p)->ver) \ ··· 45 91 PR_CACHE(&cpuinfo_arc700[c].icache, CONFIG_ARC_HAS_ICACHE, "I-Cache"); 46 92 PR_CACHE(&cpuinfo_arc700[c].dcache, CONFIG_ARC_HAS_DCACHE, "D-Cache"); 47 93 94 + p = &cpuinfo_arc700[c].slc; 95 + if (p->ver) 96 + n += scnprintf(buf + n, len - n, 97 + "SLC\t\t: %uK, %uB Line\n", p->sz_k, p->line_len); 98 + 48 99 return buf; 49 100 } 50 101 ··· 60 101 */ 61 102 void read_decode_cache_bcr(void) 62 103 { 63 - struct cpuinfo_arc_cache *p_ic, *p_dc; 104 + struct cpuinfo_arc_cache *p_ic, *p_dc, *p_slc; 64 105 unsigned int cpu = smp_processor_id(); 65 106 struct bcr_cache { 66 107 #ifdef CONFIG_CPU_BIG_ENDIAN ··· 70 111 #endif 71 112 } ibcr, dbcr; 72 113 114 + struct bcr_generic sbcr; 115 + 116 + struct bcr_slc_cfg { 117 + #ifdef CONFIG_CPU_BIG_ENDIAN 118 + unsigned int pad:24, way:2, lsz:2, sz:4; 119 + #else 120 + unsigned int sz:4, lsz:2, way:2, pad:24; 121 + #endif 122 + } slc_cfg; 123 + 73 124 p_ic = &cpuinfo_arc700[cpu].icache; 74 125 READ_BCR(ARC_REG_IC_BCR, ibcr); 75 126 76 127 if (!ibcr.ver) 77 128 goto dc_chk; 78 129 79 - BUG_ON(ibcr.config != 3); 80 - p_ic->assoc = 2; /* Fixed to 2w set assoc */ 130 + if (ibcr.ver <= 3) { 131 + BUG_ON(ibcr.config != 3); 132 + p_ic->assoc = 2; /* Fixed to 2w set assoc */ 133 + } else if (ibcr.ver >= 4) { 134 + p_ic->assoc = 1 << ibcr.config; /* 1,2,4,8 */ 135 + } 136 + 81 137 p_ic->line_len = 8 << ibcr.line_len; 82 138 p_ic->sz_k = 1 << (ibcr.sz - 1); 83 139 p_ic->ver = ibcr.ver; ··· 104 130 READ_BCR(ARC_REG_DC_BCR, dbcr); 105 131 106 132 if (!dbcr.ver) 107 - return; 133 + goto slc_chk; 108 134 109 - BUG_ON(dbcr.config != 2); 110 - p_dc->assoc = 4; /* Fixed to 4w set assoc */ 135 + if (dbcr.ver <= 3) { 136 + BUG_ON(dbcr.config != 2); 137 + p_dc->assoc = 4; /* Fixed to 4w set assoc */ 138 + p_dc->vipt = 1; 139 + p_dc->alias = p_dc->sz_k/p_dc->assoc/TO_KB(PAGE_SIZE) > 1; 140 + } else if (dbcr.ver >= 4) { 141 + p_dc->assoc = 1 << dbcr.config; /* 1,2,4,8 */ 142 + p_dc->vipt = 0; 143 + p_dc->alias = 0; /* PIPT so can't VIPT alias */ 144 + } 145 + 111 146 p_dc->line_len = 16 << dbcr.line_len; 112 147 p_dc->sz_k = 1 << (dbcr.sz - 1); 113 148 p_dc->ver = dbcr.ver; 114 - p_dc->vipt = 1; 115 - p_dc->alias = p_dc->sz_k/p_dc->assoc/TO_KB(PAGE_SIZE) > 1; 149 + 150 + slc_chk: 151 + if (!is_isa_arcv2()) 152 + return; 153 + 154 + p_slc = &cpuinfo_arc700[cpu].slc; 155 + READ_BCR(ARC_REG_SLC_BCR, sbcr); 156 + if (sbcr.ver) { 157 + READ_BCR(ARC_REG_SLC_CFG, slc_cfg); 158 + p_slc->ver = sbcr.ver; 159 + p_slc->sz_k = 128 << slc_cfg.sz; 160 + l2_line_sz = p_slc->line_len = (slc_cfg.lsz == 0) ? 128 : 64; 161 + } 116 162 } 117 163 118 164 /* 119 - * 1. Validate the Cache Geomtery (compile time config matches hardware) 120 - * 2. If I-cache suffers from aliasing, setup work arounds (difft flush rtn) 121 - * (aliasing D-cache configurations are not supported YET) 122 - * 3. Enable the Caches, setup default flush mode for D-Cache 123 - * 3. Calculate the SHMLBA used by user space 165 + * Line Operation on {I,D}-Cache 124 166 */ 125 - void arc_cache_init(void) 126 - { 127 - unsigned int __maybe_unused cpu = smp_processor_id(); 128 - char str[256]; 129 - 130 - printk(arc_cache_mumbojumbo(0, str, sizeof(str))); 131 - 132 - if (IS_ENABLED(CONFIG_ARC_HAS_ICACHE)) { 133 - struct cpuinfo_arc_cache *ic = &cpuinfo_arc700[cpu].icache; 134 - 135 - if (!ic->ver) 136 - panic("cache support enabled but non-existent cache\n"); 137 - 138 - if (ic->line_len != L1_CACHE_BYTES) 139 - panic("ICache line [%d] != kernel Config [%d]", 140 - ic->line_len, L1_CACHE_BYTES); 141 - 142 - if (ic->ver != CONFIG_ARC_MMU_VER) 143 - panic("Cache ver [%d] doesn't match MMU ver [%d]\n", 144 - ic->ver, CONFIG_ARC_MMU_VER); 145 - } 146 - 147 - if (IS_ENABLED(CONFIG_ARC_HAS_DCACHE)) { 148 - struct cpuinfo_arc_cache *dc = &cpuinfo_arc700[cpu].dcache; 149 - int handled; 150 - 151 - if (!dc->ver) 152 - panic("cache support enabled but non-existent cache\n"); 153 - 154 - if (dc->line_len != L1_CACHE_BYTES) 155 - panic("DCache line [%d] != kernel Config [%d]", 156 - dc->line_len, L1_CACHE_BYTES); 157 - 158 - /* check for D-Cache aliasing */ 159 - handled = IS_ENABLED(CONFIG_ARC_CACHE_VIPT_ALIASING); 160 - 161 - if (dc->alias && !handled) 162 - panic("Enable CONFIG_ARC_CACHE_VIPT_ALIASING\n"); 163 - else if (!dc->alias && handled) 164 - panic("Don't need CONFIG_ARC_CACHE_VIPT_ALIASING\n"); 165 - } 166 - } 167 167 168 168 #define OP_INV 0x1 169 169 #define OP_FLUSH 0x2 ··· 145 197 #define OP_INV_IC 0x4 146 198 147 199 /* 148 - * Common Helper for Line Operations on {I,D}-Cache 149 - */ 150 - static inline void __cache_line_loop(unsigned long paddr, unsigned long vaddr, 151 - unsigned long sz, const int cacheop) 152 - { 153 - unsigned int aux_cmd, aux_tag; 154 - int num_lines; 155 - const int full_page_op = __builtin_constant_p(sz) && sz == PAGE_SIZE; 156 - 157 - if (cacheop == OP_INV_IC) { 158 - aux_cmd = ARC_REG_IC_IVIL; 159 - #if (CONFIG_ARC_MMU_VER > 2) 160 - aux_tag = ARC_REG_IC_PTAG; 161 - #endif 162 - } 163 - else { 164 - /* d$ cmd: INV (discard or wback-n-discard) OR FLUSH (wback) */ 165 - aux_cmd = cacheop & OP_INV ? ARC_REG_DC_IVDL : ARC_REG_DC_FLDL; 166 - #if (CONFIG_ARC_MMU_VER > 2) 167 - aux_tag = ARC_REG_DC_PTAG; 168 - #endif 169 - } 170 - 171 - /* Ensure we properly floor/ceil the non-line aligned/sized requests 172 - * and have @paddr - aligned to cache line and integral @num_lines. 173 - * This however can be avoided for page sized since: 174 - * -@paddr will be cache-line aligned already (being page aligned) 175 - * -@sz will be integral multiple of line size (being page sized). 176 - */ 177 - if (!full_page_op) { 178 - sz += paddr & ~CACHE_LINE_MASK; 179 - paddr &= CACHE_LINE_MASK; 180 - vaddr &= CACHE_LINE_MASK; 181 - } 182 - 183 - num_lines = DIV_ROUND_UP(sz, L1_CACHE_BYTES); 184 - 185 - #if (CONFIG_ARC_MMU_VER <= 2) 186 - /* MMUv2 and before: paddr contains stuffed vaddrs bits */ 187 - paddr |= (vaddr >> PAGE_SHIFT) & 0x1F; 188 - #else 189 - /* if V-P const for loop, PTAG can be written once outside loop */ 190 - if (full_page_op) 191 - write_aux_reg(aux_tag, paddr); 192 - #endif 193 - 194 - while (num_lines-- > 0) { 195 - #if (CONFIG_ARC_MMU_VER > 2) 196 - /* MMUv3, cache ops require paddr seperately */ 197 - if (!full_page_op) { 198 - write_aux_reg(aux_tag, paddr); 199 - paddr += L1_CACHE_BYTES; 200 - } 201 - 202 - write_aux_reg(aux_cmd, vaddr); 203 - vaddr += L1_CACHE_BYTES; 204 - #else 205 - write_aux_reg(aux_cmd, paddr); 206 - paddr += L1_CACHE_BYTES; 207 - #endif 208 - } 209 - } 210 - 211 - #ifdef CONFIG_ARC_HAS_DCACHE 212 - 213 - /*************************************************************** 214 - * Machine specific helpers for Entire D-Cache or Per Line ops 215 - */ 216 - 217 - static inline unsigned int __before_dc_op(const int op) 218 - { 219 - unsigned int reg = reg; 220 - 221 - if (op == OP_FLUSH_N_INV) { 222 - /* Dcache provides 2 cmd: FLUSH or INV 223 - * INV inturn has sub-modes: DISCARD or FLUSH-BEFORE 224 - * flush-n-inv is achieved by INV cmd but with IM=1 225 - * So toggle INV sub-mode depending on op request and default 226 - */ 227 - reg = read_aux_reg(ARC_REG_DC_CTRL); 228 - write_aux_reg(ARC_REG_DC_CTRL, reg | DC_CTRL_INV_MODE_FLUSH) 229 - ; 230 - } 231 - 232 - return reg; 233 - } 234 - 235 - static inline void __after_dc_op(const int op, unsigned int reg) 236 - { 237 - if (op & OP_FLUSH) /* flush / flush-n-inv both wait */ 238 - while (read_aux_reg(ARC_REG_DC_CTRL) & DC_CTRL_FLUSH_STATUS); 239 - 240 - /* Switch back to default Invalidate mode */ 241 - if (op == OP_FLUSH_N_INV) 242 - write_aux_reg(ARC_REG_DC_CTRL, reg & ~DC_CTRL_INV_MODE_FLUSH); 243 - } 244 - 245 - /* 246 - * Operation on Entire D-Cache 247 - * @cacheop = {OP_INV, OP_FLUSH, OP_FLUSH_N_INV} 248 - * Note that constant propagation ensures all the checks are gone 249 - * in generated code 250 - */ 251 - static inline void __dc_entire_op(const int cacheop) 252 - { 253 - unsigned int ctrl_reg; 254 - int aux; 255 - 256 - ctrl_reg = __before_dc_op(cacheop); 257 - 258 - if (cacheop & OP_INV) /* Inv or flush-n-inv use same cmd reg */ 259 - aux = ARC_REG_DC_IVDC; 260 - else 261 - aux = ARC_REG_DC_FLSH; 262 - 263 - write_aux_reg(aux, 0x1); 264 - 265 - __after_dc_op(cacheop, ctrl_reg); 266 - } 267 - 268 - /* For kernel mappings cache operation: index is same as paddr */ 269 - #define __dc_line_op_k(p, sz, op) __dc_line_op(p, p, sz, op) 270 - 271 - /* 272 - * D-Cache : Per Line INV (discard or wback+discard) or FLUSH (wback) 273 - */ 274 - static inline void __dc_line_op(unsigned long paddr, unsigned long vaddr, 275 - unsigned long sz, const int cacheop) 276 - { 277 - unsigned long flags; 278 - unsigned int ctrl_reg; 279 - 280 - local_irq_save(flags); 281 - 282 - ctrl_reg = __before_dc_op(cacheop); 283 - 284 - __cache_line_loop(paddr, vaddr, sz, cacheop); 285 - 286 - __after_dc_op(cacheop, ctrl_reg); 287 - 288 - local_irq_restore(flags); 289 - } 290 - 291 - #else 292 - 293 - #define __dc_entire_op(cacheop) 294 - #define __dc_line_op(paddr, vaddr, sz, cacheop) 295 - #define __dc_line_op_k(paddr, sz, cacheop) 296 - 297 - #endif /* CONFIG_ARC_HAS_DCACHE */ 298 - 299 - 300 - #ifdef CONFIG_ARC_HAS_ICACHE 301 - 302 - /* 303 - * I-Cache Aliasing in ARC700 VIPT caches 200 + * I-Cache Aliasing in ARC700 VIPT caches (MMU v1-v3) 304 201 * 305 202 * ARC VIPT I-cache uses vaddr to index into cache and paddr to match the tag. 306 203 * The orig Cache Management Module "CDU" only required paddr to invalidate a ··· 186 393 * "tag" bits are provided in PTAG, index bits in existing IVIL/IVDL/FLDL regs 187 394 */ 188 395 189 - /*********************************************************** 190 - * Machine specific helper for per line I-Cache invalidate. 396 + static inline 397 + void __cache_line_loop_v2(unsigned long paddr, unsigned long vaddr, 398 + unsigned long sz, const int op) 399 + { 400 + unsigned int aux_cmd; 401 + int num_lines; 402 + const int full_page = __builtin_constant_p(sz) && sz == PAGE_SIZE; 403 + 404 + if (op == OP_INV_IC) { 405 + aux_cmd = ARC_REG_IC_IVIL; 406 + } else { 407 + /* d$ cmd: INV (discard or wback-n-discard) OR FLUSH (wback) */ 408 + aux_cmd = op & OP_INV ? ARC_REG_DC_IVDL : ARC_REG_DC_FLDL; 409 + } 410 + 411 + /* Ensure we properly floor/ceil the non-line aligned/sized requests 412 + * and have @paddr - aligned to cache line and integral @num_lines. 413 + * This however can be avoided for page sized since: 414 + * -@paddr will be cache-line aligned already (being page aligned) 415 + * -@sz will be integral multiple of line size (being page sized). 416 + */ 417 + if (!full_page) { 418 + sz += paddr & ~CACHE_LINE_MASK; 419 + paddr &= CACHE_LINE_MASK; 420 + vaddr &= CACHE_LINE_MASK; 421 + } 422 + 423 + num_lines = DIV_ROUND_UP(sz, L1_CACHE_BYTES); 424 + 425 + /* MMUv2 and before: paddr contains stuffed vaddrs bits */ 426 + paddr |= (vaddr >> PAGE_SHIFT) & 0x1F; 427 + 428 + while (num_lines-- > 0) { 429 + write_aux_reg(aux_cmd, paddr); 430 + paddr += L1_CACHE_BYTES; 431 + } 432 + } 433 + 434 + static inline 435 + void __cache_line_loop_v3(unsigned long paddr, unsigned long vaddr, 436 + unsigned long sz, const int op) 437 + { 438 + unsigned int aux_cmd, aux_tag; 439 + int num_lines; 440 + const int full_page = __builtin_constant_p(sz) && sz == PAGE_SIZE; 441 + 442 + if (op == OP_INV_IC) { 443 + aux_cmd = ARC_REG_IC_IVIL; 444 + aux_tag = ARC_REG_IC_PTAG; 445 + } else { 446 + aux_cmd = op & OP_INV ? ARC_REG_DC_IVDL : ARC_REG_DC_FLDL; 447 + aux_tag = ARC_REG_DC_PTAG; 448 + } 449 + 450 + /* Ensure we properly floor/ceil the non-line aligned/sized requests 451 + * and have @paddr - aligned to cache line and integral @num_lines. 452 + * This however can be avoided for page sized since: 453 + * -@paddr will be cache-line aligned already (being page aligned) 454 + * -@sz will be integral multiple of line size (being page sized). 455 + */ 456 + if (!full_page) { 457 + sz += paddr & ~CACHE_LINE_MASK; 458 + paddr &= CACHE_LINE_MASK; 459 + vaddr &= CACHE_LINE_MASK; 460 + } 461 + num_lines = DIV_ROUND_UP(sz, L1_CACHE_BYTES); 462 + 463 + /* 464 + * MMUv3, cache ops require paddr in PTAG reg 465 + * if V-P const for loop, PTAG can be written once outside loop 466 + */ 467 + if (full_page) 468 + write_aux_reg(aux_tag, paddr); 469 + 470 + while (num_lines-- > 0) { 471 + if (!full_page) { 472 + write_aux_reg(aux_tag, paddr); 473 + paddr += L1_CACHE_BYTES; 474 + } 475 + 476 + write_aux_reg(aux_cmd, vaddr); 477 + vaddr += L1_CACHE_BYTES; 478 + } 479 + } 480 + 481 + /* 482 + * In HS38x (MMU v4), although icache is VIPT, only paddr is needed for cache 483 + * maintenance ops (in IVIL reg), as long as icache doesn't alias. 484 + * 485 + * For Aliasing icache, vaddr is also needed (in IVIL), while paddr is 486 + * specified in PTAG (similar to MMU v3) 191 487 */ 488 + static inline 489 + void __cache_line_loop_v4(unsigned long paddr, unsigned long vaddr, 490 + unsigned long sz, const int cacheop) 491 + { 492 + unsigned int aux_cmd; 493 + int num_lines; 494 + const int full_page_op = __builtin_constant_p(sz) && sz == PAGE_SIZE; 495 + 496 + if (cacheop == OP_INV_IC) { 497 + aux_cmd = ARC_REG_IC_IVIL; 498 + } else { 499 + /* d$ cmd: INV (discard or wback-n-discard) OR FLUSH (wback) */ 500 + aux_cmd = cacheop & OP_INV ? ARC_REG_DC_IVDL : ARC_REG_DC_FLDL; 501 + } 502 + 503 + /* Ensure we properly floor/ceil the non-line aligned/sized requests 504 + * and have @paddr - aligned to cache line and integral @num_lines. 505 + * This however can be avoided for page sized since: 506 + * -@paddr will be cache-line aligned already (being page aligned) 507 + * -@sz will be integral multiple of line size (being page sized). 508 + */ 509 + if (!full_page_op) { 510 + sz += paddr & ~CACHE_LINE_MASK; 511 + paddr &= CACHE_LINE_MASK; 512 + } 513 + 514 + num_lines = DIV_ROUND_UP(sz, L1_CACHE_BYTES); 515 + 516 + while (num_lines-- > 0) { 517 + write_aux_reg(aux_cmd, paddr); 518 + paddr += L1_CACHE_BYTES; 519 + } 520 + } 521 + 522 + #if (CONFIG_ARC_MMU_VER < 3) 523 + #define __cache_line_loop __cache_line_loop_v2 524 + #elif (CONFIG_ARC_MMU_VER == 3) 525 + #define __cache_line_loop __cache_line_loop_v3 526 + #elif (CONFIG_ARC_MMU_VER > 3) 527 + #define __cache_line_loop __cache_line_loop_v4 528 + #endif 529 + 530 + #ifdef CONFIG_ARC_HAS_DCACHE 531 + 532 + /*************************************************************** 533 + * Machine specific helpers for Entire D-Cache or Per Line ops 534 + */ 535 + 536 + static inline void __before_dc_op(const int op) 537 + { 538 + if (op == OP_FLUSH_N_INV) { 539 + /* Dcache provides 2 cmd: FLUSH or INV 540 + * INV inturn has sub-modes: DISCARD or FLUSH-BEFORE 541 + * flush-n-inv is achieved by INV cmd but with IM=1 542 + * So toggle INV sub-mode depending on op request and default 543 + */ 544 + const unsigned int ctl = ARC_REG_DC_CTRL; 545 + write_aux_reg(ctl, read_aux_reg(ctl) | DC_CTRL_INV_MODE_FLUSH); 546 + } 547 + } 548 + 549 + static inline void __after_dc_op(const int op) 550 + { 551 + if (op & OP_FLUSH) { 552 + const unsigned int ctl = ARC_REG_DC_CTRL; 553 + unsigned int reg; 554 + 555 + /* flush / flush-n-inv both wait */ 556 + while ((reg = read_aux_reg(ctl)) & DC_CTRL_FLUSH_STATUS) 557 + ; 558 + 559 + /* Switch back to default Invalidate mode */ 560 + if (op == OP_FLUSH_N_INV) 561 + write_aux_reg(ctl, reg & ~DC_CTRL_INV_MODE_FLUSH); 562 + } 563 + } 564 + 565 + /* 566 + * Operation on Entire D-Cache 567 + * @op = {OP_INV, OP_FLUSH, OP_FLUSH_N_INV} 568 + * Note that constant propagation ensures all the checks are gone 569 + * in generated code 570 + */ 571 + static inline void __dc_entire_op(const int op) 572 + { 573 + int aux; 574 + 575 + __before_dc_op(op); 576 + 577 + if (op & OP_INV) /* Inv or flush-n-inv use same cmd reg */ 578 + aux = ARC_REG_DC_IVDC; 579 + else 580 + aux = ARC_REG_DC_FLSH; 581 + 582 + write_aux_reg(aux, 0x1); 583 + 584 + __after_dc_op(op); 585 + } 586 + 587 + /* For kernel mappings cache operation: index is same as paddr */ 588 + #define __dc_line_op_k(p, sz, op) __dc_line_op(p, p, sz, op) 589 + 590 + /* 591 + * D-Cache Line ops: Per Line INV (discard or wback+discard) or FLUSH (wback) 592 + */ 593 + static inline void __dc_line_op(unsigned long paddr, unsigned long vaddr, 594 + unsigned long sz, const int op) 595 + { 596 + unsigned long flags; 597 + 598 + local_irq_save(flags); 599 + 600 + __before_dc_op(op); 601 + 602 + __cache_line_loop(paddr, vaddr, sz, op); 603 + 604 + __after_dc_op(op); 605 + 606 + local_irq_restore(flags); 607 + } 608 + 609 + #else 610 + 611 + #define __dc_entire_op(op) 612 + #define __dc_line_op(paddr, vaddr, sz, op) 613 + #define __dc_line_op_k(paddr, sz, op) 614 + 615 + #endif /* CONFIG_ARC_HAS_DCACHE */ 616 + 617 + #ifdef CONFIG_ARC_HAS_ICACHE 192 618 193 619 static inline void __ic_entire_inv(void) 194 620 { ··· 422 410 unsigned long flags; 423 411 424 412 local_irq_save(flags); 425 - __cache_line_loop(paddr, vaddr, sz, OP_INV_IC); 413 + (*_cache_line_loop_ic_fn)(paddr, vaddr, sz, OP_INV_IC); 426 414 local_irq_restore(flags); 427 415 } 428 416 ··· 465 453 466 454 #endif /* CONFIG_ARC_HAS_ICACHE */ 467 455 456 + noinline void slc_op(unsigned long paddr, unsigned long sz, const int op) 457 + { 458 + #ifdef CONFIG_ISA_ARCV2 459 + unsigned long flags; 460 + unsigned int ctrl; 461 + 462 + local_irq_save(flags); 463 + 464 + /* 465 + * The Region Flush operation is specified by CTRL.RGN_OP[11..9] 466 + * - b'000 (default) is Flush, 467 + * - b'001 is Invalidate if CTRL.IM == 0 468 + * - b'001 is Flush-n-Invalidate if CTRL.IM == 1 469 + */ 470 + ctrl = read_aux_reg(ARC_REG_SLC_CTRL); 471 + 472 + /* Don't rely on default value of IM bit */ 473 + if (!(op & OP_FLUSH)) /* i.e. OP_INV */ 474 + ctrl &= ~SLC_CTRL_IM; /* clear IM: Disable flush before Inv */ 475 + else 476 + ctrl |= SLC_CTRL_IM; 477 + 478 + if (op & OP_INV) 479 + ctrl |= SLC_CTRL_RGN_OP_INV; /* Inv or flush-n-inv */ 480 + else 481 + ctrl &= ~SLC_CTRL_RGN_OP_INV; 482 + 483 + write_aux_reg(ARC_REG_SLC_CTRL, ctrl); 484 + 485 + /* 486 + * Lower bits are ignored, no need to clip 487 + * END needs to be setup before START (latter triggers the operation) 488 + * END can't be same as START, so add (l2_line_sz - 1) to sz 489 + */ 490 + write_aux_reg(ARC_REG_SLC_RGN_END, (paddr + sz + l2_line_sz - 1)); 491 + write_aux_reg(ARC_REG_SLC_RGN_START, paddr); 492 + 493 + while (read_aux_reg(ARC_REG_SLC_CTRL) & SLC_CTRL_BUSY); 494 + 495 + local_irq_restore(flags); 496 + #endif 497 + } 498 + 499 + static inline int need_slc_flush(void) 500 + { 501 + return is_isa_arcv2() && l2_line_sz; 502 + } 468 503 469 504 /*********************************************************** 470 505 * Exported APIs ··· 552 493 } else if (page_mapped(page)) { 553 494 554 495 /* kernel reading from page with U-mapping */ 555 - void *paddr = page_address(page); 496 + unsigned long paddr = (unsigned long)page_address(page); 556 497 unsigned long vaddr = page->index << PAGE_CACHE_SHIFT; 557 498 558 499 if (addr_not_cache_congruent(paddr, vaddr)) ··· 561 502 } 562 503 EXPORT_SYMBOL(flush_dcache_page); 563 504 564 - 565 505 void dma_cache_wback_inv(unsigned long start, unsigned long sz) 566 506 { 567 507 __dc_line_op_k(start, sz, OP_FLUSH_N_INV); 508 + 509 + if (need_slc_flush()) 510 + slc_op(start, sz, OP_FLUSH_N_INV); 568 511 } 569 512 EXPORT_SYMBOL(dma_cache_wback_inv); 570 513 571 514 void dma_cache_inv(unsigned long start, unsigned long sz) 572 515 { 573 516 __dc_line_op_k(start, sz, OP_INV); 517 + 518 + if (need_slc_flush()) 519 + slc_op(start, sz, OP_INV); 574 520 } 575 521 EXPORT_SYMBOL(dma_cache_inv); 576 522 577 523 void dma_cache_wback(unsigned long start, unsigned long sz) 578 524 { 579 525 __dc_line_op_k(start, sz, OP_FLUSH); 526 + 527 + if (need_slc_flush()) 528 + slc_op(start, sz, OP_FLUSH); 580 529 } 581 530 EXPORT_SYMBOL(dma_cache_wback); 582 531 ··· 672 605 * wrapper to clearout kernel or userspace mappings of a page 673 606 * For kernel mappings @vaddr == @paddr 674 607 */ 675 - void ___flush_dcache_page(unsigned long paddr, unsigned long vaddr) 608 + void __flush_dcache_page(unsigned long paddr, unsigned long vaddr) 676 609 { 677 610 __dc_line_op(paddr, vaddr & PAGE_MASK, PAGE_SIZE, OP_FLUSH_N_INV); 678 611 } ··· 704 637 705 638 u_vaddr &= PAGE_MASK; 706 639 707 - ___flush_dcache_page(paddr, u_vaddr); 640 + __flush_dcache_page(paddr, u_vaddr); 708 641 709 642 if (vma->vm_flags & VM_EXEC) 710 643 __inv_icache_page(paddr, u_vaddr); ··· 730 663 void copy_user_highpage(struct page *to, struct page *from, 731 664 unsigned long u_vaddr, struct vm_area_struct *vma) 732 665 { 733 - void *kfrom = page_address(from); 734 - void *kto = page_address(to); 666 + unsigned long kfrom = (unsigned long)page_address(from); 667 + unsigned long kto = (unsigned long)page_address(to); 735 668 int clean_src_k_mappings = 0; 736 669 737 670 /* ··· 747 680 clean_src_k_mappings = 1; 748 681 } 749 682 750 - copy_page(kto, kfrom); 683 + copy_page((void *)kto, (void *)kfrom); 751 684 752 685 /* 753 686 * Mark DST page K-mapping as dirty for a later finalization by ··· 787 720 /* TBD: optimize this */ 788 721 flush_cache_all(); 789 722 return 0; 723 + } 724 + 725 + void arc_cache_init(void) 726 + { 727 + unsigned int __maybe_unused cpu = smp_processor_id(); 728 + char str[256]; 729 + 730 + printk(arc_cache_mumbojumbo(0, str, sizeof(str))); 731 + 732 + if (IS_ENABLED(CONFIG_ARC_HAS_ICACHE)) { 733 + struct cpuinfo_arc_cache *ic = &cpuinfo_arc700[cpu].icache; 734 + 735 + if (!ic->ver) 736 + panic("cache support enabled but non-existent cache\n"); 737 + 738 + if (ic->line_len != L1_CACHE_BYTES) 739 + panic("ICache line [%d] != kernel Config [%d]", 740 + ic->line_len, L1_CACHE_BYTES); 741 + 742 + if (ic->ver != CONFIG_ARC_MMU_VER) 743 + panic("Cache ver [%d] doesn't match MMU ver [%d]\n", 744 + ic->ver, CONFIG_ARC_MMU_VER); 745 + 746 + /* 747 + * In MMU v4 (HS38x) the alising icache config uses IVIL/PTAG 748 + * pair to provide vaddr/paddr respectively, just as in MMU v3 749 + */ 750 + if (is_isa_arcv2() && ic->alias) 751 + _cache_line_loop_ic_fn = __cache_line_loop_v3; 752 + else 753 + _cache_line_loop_ic_fn = __cache_line_loop; 754 + } 755 + 756 + if (IS_ENABLED(CONFIG_ARC_HAS_DCACHE)) { 757 + struct cpuinfo_arc_cache *dc = &cpuinfo_arc700[cpu].dcache; 758 + 759 + if (!dc->ver) 760 + panic("cache support enabled but non-existent cache\n"); 761 + 762 + if (dc->line_len != L1_CACHE_BYTES) 763 + panic("DCache line [%d] != kernel Config [%d]", 764 + dc->line_len, L1_CACHE_BYTES); 765 + 766 + /* check for D-Cache aliasing on ARCompact: ARCv2 has PIPT */ 767 + if (is_isa_arcompact()) { 768 + int handled = IS_ENABLED(CONFIG_ARC_CACHE_VIPT_ALIASING); 769 + 770 + if (dc->alias && !handled) 771 + panic("Enable CONFIG_ARC_CACHE_VIPT_ALIASING\n"); 772 + else if (!dc->alias && handled) 773 + panic("Disable CONFIG_ARC_CACHE_VIPT_ALIASING\n"); 774 + } 775 + } 790 776 }
+16 -8
arch/arc/mm/dma.c
··· 14 14 * Cache bit off in the TLB entry. 15 15 * 16 16 * The default DMA address == Phy address which is 0x8000_0000 based. 17 - * A platform/device can make it zero based, by over-riding 18 - * plat_{dma,kernel}_addr_to_{kernel,dma} 19 17 */ 20 18 21 19 #include <linux/dma-mapping.h> ··· 35 37 return NULL; 36 38 37 39 /* This is bus address, platform dependent */ 38 - *dma_handle = plat_kernel_addr_to_dma(dev, paddr); 40 + *dma_handle = (dma_addr_t)paddr; 39 41 40 42 return paddr; 41 43 } ··· 44 46 void dma_free_noncoherent(struct device *dev, size_t size, void *vaddr, 45 47 dma_addr_t dma_handle) 46 48 { 47 - free_pages_exact((void *)plat_dma_addr_to_kernel(dev, dma_handle), 48 - size); 49 + free_pages_exact((void *)dma_handle, size); 49 50 } 50 51 EXPORT_SYMBOL(dma_free_noncoherent); 51 52 ··· 64 67 memset(kvaddr, 0, size); 65 68 66 69 /* This is bus address, platform dependent */ 67 - *dma_handle = plat_kernel_addr_to_dma(dev, paddr); 70 + *dma_handle = (dma_addr_t)paddr; 71 + 72 + /* 73 + * Evict any existing L1 and/or L2 lines for the backing page 74 + * in case it was used earlier as a normal "cached" page. 75 + * Yeah this bit us - STAR 9000898266 76 + * 77 + * Although core does call flush_cache_vmap(), it gets kvaddr hence 78 + * can't be used to efficiently flush L1 and/or L2 which need paddr 79 + * Currently flush_cache_vmap nukes the L1 cache completely which 80 + * will be optimized as a separate commit 81 + */ 82 + dma_cache_wback_inv((unsigned long)paddr, size); 68 83 69 84 return kvaddr; 70 85 } ··· 87 78 { 88 79 iounmap((void __force __iomem *)kvaddr); 89 80 90 - free_pages_exact((void *)plat_dma_addr_to_kernel(dev, dma_handle), 91 - size); 81 + free_pages_exact((void *)dma_handle, size); 92 82 } 93 83 EXPORT_SYMBOL(dma_free_coherent); 94 84
+54 -6
arch/arc/mm/tlb.c
··· 113 113 write_aux_reg(ARC_REG_TLBCOMMAND, TLBWrite); 114 114 } 115 115 116 + #if (CONFIG_ARC_MMU_VER < 4) 117 + 116 118 static inline unsigned int tlb_entry_lkup(unsigned long vaddr_n_asid) 117 119 { 118 120 unsigned int idx; ··· 211 209 */ 212 210 write_aux_reg(ARC_REG_TLBCOMMAND, TLBWrite); 213 211 } 212 + 213 + #else /* CONFIG_ARC_MMU_VER >= 4) */ 214 + 215 + static void utlb_invalidate(void) 216 + { 217 + /* No need since uTLB is always in sync with JTLB */ 218 + } 219 + 220 + static void tlb_entry_erase(unsigned int vaddr_n_asid) 221 + { 222 + write_aux_reg(ARC_REG_TLBPD0, vaddr_n_asid | _PAGE_PRESENT); 223 + write_aux_reg(ARC_REG_TLBCOMMAND, TLBDeleteEntry); 224 + } 225 + 226 + static void tlb_entry_insert(unsigned int pd0, unsigned int pd1) 227 + { 228 + write_aux_reg(ARC_REG_TLBPD0, pd0); 229 + write_aux_reg(ARC_REG_TLBPD1, pd1); 230 + write_aux_reg(ARC_REG_TLBCOMMAND, TLBInsertEntry); 231 + } 232 + 233 + #endif 214 234 215 235 /* 216 236 * Un-conditionally (without lookup) erase the entire MMU contents ··· 606 582 #endif 607 583 } *mmu3; 608 584 585 + struct bcr_mmu_4 { 586 + #ifdef CONFIG_CPU_BIG_ENDIAN 587 + unsigned int ver:8, sasid:1, sz1:4, sz0:4, res:2, pae:1, 588 + n_ways:2, n_entry:2, n_super:2, u_itlb:3, u_dtlb:3; 589 + #else 590 + /* DTLB ITLB JES JE JA */ 591 + unsigned int u_dtlb:3, u_itlb:3, n_super:2, n_entry:2, n_ways:2, 592 + pae:1, res:2, sz0:4, sz1:4, sasid:1, ver:8; 593 + #endif 594 + } *mmu4; 595 + 609 596 tmp = read_aux_reg(ARC_REG_MMU_BCR); 610 597 mmu->ver = (tmp >> 24); 611 598 612 599 if (mmu->ver <= 2) { 613 600 mmu2 = (struct bcr_mmu_1_2 *)&tmp; 614 - mmu->pg_sz = PAGE_SIZE; 601 + mmu->pg_sz_k = TO_KB(PAGE_SIZE); 615 602 mmu->sets = 1 << mmu2->sets; 616 603 mmu->ways = 1 << mmu2->ways; 617 604 mmu->u_dtlb = mmu2->u_dtlb; 618 605 mmu->u_itlb = mmu2->u_itlb; 619 - } else { 606 + } else if (mmu->ver == 3) { 620 607 mmu3 = (struct bcr_mmu_3 *)&tmp; 621 - mmu->pg_sz = 512 << mmu3->pg_sz; 608 + mmu->pg_sz_k = 1 << (mmu3->pg_sz - 1); 622 609 mmu->sets = 1 << mmu3->sets; 623 610 mmu->ways = 1 << mmu3->ways; 624 611 mmu->u_dtlb = mmu3->u_dtlb; 625 612 mmu->u_itlb = mmu3->u_itlb; 613 + } else { 614 + mmu4 = (struct bcr_mmu_4 *)&tmp; 615 + mmu->pg_sz_k = 1 << (mmu4->sz0 - 1); 616 + mmu->s_pg_sz_m = 1 << (mmu4->sz1 - 11); 617 + mmu->sets = 64 << mmu4->n_entry; 618 + mmu->ways = mmu4->n_ways * 2; 619 + mmu->u_dtlb = mmu4->u_dtlb * 4; 620 + mmu->u_itlb = mmu4->u_itlb * 4; 626 621 } 627 622 628 623 mmu->num_tlb = mmu->sets * mmu->ways; ··· 651 608 { 652 609 int n = 0; 653 610 struct cpuinfo_arc_mmu *p_mmu = &cpuinfo_arc700[cpu_id].mmu; 611 + char super_pg[64] = ""; 612 + 613 + if (p_mmu->s_pg_sz_m) 614 + scnprintf(super_pg, 64, "%dM Super Page%s, ", 615 + p_mmu->s_pg_sz_m, " (not used)"); 654 616 655 617 n += scnprintf(buf + n, len - n, 656 - "MMU [v%x]\t: %dk PAGE, JTLB %d (%dx%d), uDTLB %d, uITLB %d %s\n", 657 - p_mmu->ver, TO_KB(p_mmu->pg_sz), 618 + "MMU [v%x]\t: %dk PAGE, %sJTLB %d (%dx%d), uDTLB %d, uITLB %d %s\n", 619 + p_mmu->ver, p_mmu->pg_sz_k, super_pg, 658 620 p_mmu->num_tlb, p_mmu->sets, p_mmu->ways, 659 621 p_mmu->u_dtlb, p_mmu->u_itlb, 660 622 IS_ENABLED(CONFIG_ARC_MMU_SASID) ? ",SASID" : ""); ··· 687 639 mmu->ver, CONFIG_ARC_MMU_VER); 688 640 } 689 641 690 - if (mmu->pg_sz != PAGE_SIZE) 642 + if (mmu->pg_sz_k != TO_KB(PAGE_SIZE)) 691 643 panic("MMU pg size != PAGE_SIZE (%luk)\n", TO_KB(PAGE_SIZE)); 692 644 693 645 /* Enable the MMU */
+27 -17
arch/arc/mm/tlbex.S
··· 35 35 * Rahul Trivedi, Amit Bhor: Codito Technologies 2004 36 36 */ 37 37 38 - .cpu A7 39 - 40 38 #include <linux/linkage.h> 41 39 #include <asm/entry.h> 42 40 #include <asm/mmu.h> ··· 44 46 #include <asm/processor.h> 45 47 #include <asm/tlb-mmu1.h> 46 48 49 + #ifdef CONFIG_ISA_ARCOMPACT 47 50 ;----------------------------------------------------------------- 48 51 ; ARC700 Exception Handling doesn't auto-switch stack and it only provides 49 52 ; ONE scratch AUX reg "ARC_REG_SCRATCH_DATA0" ··· 121 122 ld_s r0, [r0] 122 123 #endif 123 124 .endm 125 + 126 + #else /* ARCv2 */ 127 + 128 + .macro TLBMISS_FREEUP_REGS 129 + PUSH r0 130 + PUSH r1 131 + PUSH r2 132 + PUSH r3 133 + .endm 134 + 135 + .macro TLBMISS_RESTORE_REGS 136 + POP r3 137 + POP r2 138 + POP r1 139 + POP r0 140 + .endm 141 + 142 + #endif 124 143 125 144 ;============================================================================ 126 145 ; Troubleshooting Stuff ··· 258 241 ; Commit the TLB entry into MMU 259 242 260 243 .macro COMMIT_ENTRY_TO_MMU 244 + #if (CONFIG_ARC_MMU_VER < 4) 261 245 262 246 /* Get free TLB slot: Set = computed from vaddr, way = random */ 263 247 sr TLBGetIndex, [ARC_REG_TLBCOMMAND] ··· 268 250 sr TLBWriteNI, [ARC_REG_TLBCOMMAND] 269 251 #else 270 252 sr TLBWrite, [ARC_REG_TLBCOMMAND] 253 + #endif 254 + 255 + #else 256 + sr TLBInsertEntry, [ARC_REG_TLBCOMMAND] 271 257 #endif 272 258 .endm 273 259 ··· 313 291 CONV_PTE_TO_TLB 314 292 COMMIT_ENTRY_TO_MMU 315 293 TLBMISS_RESTORE_REGS 294 + EV_TLBMissI_fast_ret: ; additional label for VDK OS-kit instrumentation 316 295 rtie 317 296 318 297 END(EV_TLBMissI) ··· 379 356 380 357 COMMIT_ENTRY_TO_MMU 381 358 TLBMISS_RESTORE_REGS 359 + EV_TLBMissD_fast_ret: ; additional label for VDK OS-kit instrumentation 382 360 rtie 383 361 384 362 ;-------- Common routine to call Linux Page Fault Handler ----------- ··· 390 366 391 367 ; Slow path TLB Miss handled as a regular ARC Exception 392 368 ; (stack switching / save the complete reg-file). 393 - EXCEPTION_PROLOGUE 394 - 395 - ; ------- setup args for Linux Page fault Hanlder --------- 396 - mov_s r1, sp 397 - lr r0, [efa] 398 - 399 - ; We don't want exceptions to be disabled while the fault is handled. 400 - ; Now that we have saved the context we return from exception hence 401 - ; exceptions get re-enable 402 - 403 - FAKE_RET_FROM_EXCPN r9 404 - 405 - bl do_page_fault 406 - b ret_from_exception 407 - 369 + b call_do_page_fault 408 370 END(EV_TLBMissD)
-33
arch/arc/plat-arcfpga/Kconfig
··· 1 - # 2 - # Copyright (C) 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com) 3 - # 4 - # This program is free software; you can redistribute it and/or modify 5 - # it under the terms of the GNU General Public License version 2 as 6 - # published by the Free Software Foundation. 7 - # 8 - 9 - menuconfig ARC_PLAT_FPGA_LEGACY 10 - bool "\"Legacy\" ARC FPGA dev Boards" 11 - select ARC_HAS_COH_CACHES if SMP 12 - help 13 - Support for ARC development boards, provided by Synopsys. 14 - These are based on FPGA or ISS. e.g. 15 - - ARCAngel4 16 - - ML509 17 - - MetaWare ISS 18 - 19 - if ARC_PLAT_FPGA_LEGACY 20 - 21 - config ISS_SMP_EXTN 22 - bool "ARC SMP Extensions (ISS Models only)" 23 - default n 24 - depends on SMP 25 - help 26 - SMP Extensions to ARC700, in a "simulation only" Model, supported in 27 - ARC ISS (Instruction Set Simulator). 28 - The SMP extensions include: 29 - -IDU (Interrupt Distribution Unit) 30 - -XTL (To enable CPU start/stop/set-PC for another CPU) 31 - It doesn't provide coherent Caches and/or Atomic Ops (LLOCK/SCOND) 32 - 33 - endif
-3
arch/arc/plat-arcfpga/Makefile arch/arc/plat-sim/Makefile
··· 6 6 # published by the Free Software Foundation. 7 7 # 8 8 9 - KBUILD_CFLAGS += -Iarch/arc/plat-arcfpga/include 10 - 11 9 obj-y := platform.o 12 - obj-$(CONFIG_ISS_SMP_EXTN) += smp.o
-118
arch/arc/plat-arcfpga/include/plat/smp.h
··· 1 - /* 2 - * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com) 3 - * 4 - * This program is free software; you can redistribute it and/or modify 5 - * it under the terms of the GNU General Public License version 2 as 6 - * published by the Free Software Foundation. 7 - * 8 - * Rajeshwar Ranga: Interrupt Distribution Unit API's 9 - */ 10 - 11 - #ifndef __PLAT_ARCFPGA_SMP_H 12 - #define __PLAT_ARCFPGA_SMP_H 13 - 14 - #ifdef CONFIG_SMP 15 - 16 - #include <linux/types.h> 17 - #include <asm/arcregs.h> 18 - 19 - #define ARC_AUX_IDU_REG_CMD 0x2000 20 - #define ARC_AUX_IDU_REG_PARAM 0x2001 21 - 22 - #define ARC_AUX_XTL_REG_CMD 0x2002 23 - #define ARC_AUX_XTL_REG_PARAM 0x2003 24 - 25 - #define ARC_REG_MP_BCR 0x2021 26 - 27 - #define ARC_XTL_CMD_WRITE_PC 0x04 28 - #define ARC_XTL_CMD_CLEAR_HALT 0x02 29 - 30 - /* 31 - * Build Configuration Register which identifies the sub-components 32 - */ 33 - struct bcr_mp { 34 - #ifdef CONFIG_CPU_BIG_ENDIAN 35 - unsigned int mp_arch:16, pad:5, sdu:1, idu:1, scu:1, ver:8; 36 - #else 37 - unsigned int ver:8, scu:1, idu:1, sdu:1, pad:5, mp_arch:16; 38 - #endif 39 - }; 40 - 41 - /* IDU supports 256 common interrupts */ 42 - #define NR_IDU_IRQS 256 43 - 44 - /* 45 - * The Aux Regs layout is same bit-by-bit in both BE/LE modes. 46 - * However when casted as a bitfield encoded "C" struct, gcc treats it as 47 - * memory, generating different code for BE/LE, requiring strcture adj (see 48 - * include/asm/arcregs.h) 49 - * 50 - * However when manually "carving" the value for a Aux, no special handling 51 - * of BE is needed because of the property discribed above 52 - */ 53 - #define IDU_SET_COMMAND(irq, cmd) \ 54 - do { \ 55 - uint32_t __val; \ 56 - __val = (((irq & 0xFF) << 8) | (cmd & 0xFF)); \ 57 - write_aux_reg(ARC_AUX_IDU_REG_CMD, __val); \ 58 - } while (0) 59 - 60 - #define IDU_SET_PARAM(par) write_aux_reg(ARC_AUX_IDU_REG_PARAM, par) 61 - #define IDU_GET_PARAM() read_aux_reg(ARC_AUX_IDU_REG_PARAM) 62 - 63 - /* IDU Commands */ 64 - #define IDU_DISABLE 0x00 65 - #define IDU_ENABLE 0x01 66 - #define IDU_IRQ_CLEAR 0x02 67 - #define IDU_IRQ_ASSERT 0x03 68 - #define IDU_IRQ_WMODE 0x04 69 - #define IDU_IRQ_STATUS 0x05 70 - #define IDU_IRQ_ACK 0x06 71 - #define IDU_IRQ_PEND 0x07 72 - #define IDU_IRQ_RMODE 0x08 73 - #define IDU_IRQ_WBITMASK 0x09 74 - #define IDU_IRQ_RBITMASK 0x0A 75 - 76 - #define idu_enable() IDU_SET_COMMAND(0, IDU_ENABLE) 77 - #define idu_disable() IDU_SET_COMMAND(0, IDU_DISABLE) 78 - 79 - #define idu_irq_assert(irq) IDU_SET_COMMAND((irq), IDU_IRQ_ASSERT) 80 - #define idu_irq_clear(irq) IDU_SET_COMMAND((irq), IDU_IRQ_CLEAR) 81 - 82 - /* IDU Interrupt Mode - Destination Encoding */ 83 - #define IDU_IRQ_MOD_DISABLE 0x00 84 - #define IDU_IRQ_MOD_ROUND_RECP 0x01 85 - #define IDU_IRQ_MOD_TCPU_FIRSTRECP 0x02 86 - #define IDU_IRQ_MOD_TCPU_ALLRECP 0x03 87 - 88 - /* IDU Interrupt Mode - Triggering Mode */ 89 - #define IDU_IRQ_MODE_LEVEL_TRIG 0x00 90 - #define IDU_IRQ_MODE_PULSE_TRIG 0x01 91 - 92 - #define IDU_IRQ_MODE_PARAM(dest_mode, trig_mode) \ 93 - (((trig_mode & 0x01) << 15) | (dest_mode & 0xFF)) 94 - 95 - struct idu_irq_config { 96 - uint8_t irq; 97 - uint8_t dest_mode; 98 - uint8_t trig_mode; 99 - }; 100 - 101 - struct idu_irq_status { 102 - uint8_t irq; 103 - bool enabled; 104 - bool status; 105 - bool ack; 106 - bool pend; 107 - uint8_t next_rr; 108 - }; 109 - 110 - extern void idu_irq_set_tgtcpu(uint8_t irq, uint32_t mask); 111 - extern void idu_irq_set_mode(uint8_t irq, uint8_t dest_mode, uint8_t trig_mode); 112 - 113 - extern void iss_model_init_smp(unsigned int cpu); 114 - extern void iss_model_init_early_smp(void); 115 - 116 - #endif /* CONFIG_SMP */ 117 - 118 - #endif
+8 -16
arch/arc/plat-arcfpga/platform.c arch/arc/plat-sim/platform.c
··· 1 1 /* 2 - * ARC FPGA Platform support code 2 + * ARC simulation Platform support code 3 3 * 4 4 * Copyright (C) 2012 Synopsys, Inc. (www.synopsys.com) 5 5 * ··· 10 10 11 11 #include <linux/init.h> 12 12 #include <asm/mach_desc.h> 13 - #include <plat/smp.h> 13 + #include <asm/mcip.h> 14 14 15 15 /*----------------------- Machine Descriptions ------------------------------ 16 16 * ··· 20 20 * callback set, by matching the DT compatible name. 21 21 */ 22 22 23 - static const char *legacy_fpga_compat[] __initconst = { 24 - "snps,arc-angel4", 25 - "snps,arc-ml509", 26 - NULL, 27 - }; 28 - 29 - MACHINE_START(LEGACY_FPGA, "legacy_fpga") 30 - .dt_compat = legacy_fpga_compat, 31 - #ifdef CONFIG_ISS_SMP_EXTN 32 - .init_early = iss_model_init_early_smp, 33 - .init_smp = iss_model_init_smp, 34 - #endif 35 - MACHINE_END 36 - 37 23 static const char *simulation_compat[] __initconst = { 38 24 "snps,nsim", 25 + "snps,nsim_hs", 39 26 "snps,nsimosci", 27 + "snps,nsimosci_hs", 40 28 NULL, 41 29 }; 42 30 43 31 MACHINE_START(SIMULATION, "simulation") 44 32 .dt_compat = simulation_compat, 33 + #ifdef CONFIG_ARC_MCIP 34 + .init_early = mcip_init_early_smp, 35 + .init_smp = mcip_init_smp, 36 + #endif 45 37 MACHINE_END
-186
arch/arc/plat-arcfpga/smp.c
··· 1 - /* 2 - * ARC700 Simulation-only Extensions for SMP 3 - * 4 - * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com) 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License version 2 as 8 - * published by the Free Software Foundation. 9 - * 10 - * Vineet Gupta - 2012 : split off arch common and plat specific SMP 11 - * Rajeshwar Ranga - 2007 : Interrupt Distribution Unit API's 12 - */ 13 - 14 - #include <linux/smp.h> 15 - #include <linux/irq.h> 16 - #include <plat/smp.h> 17 - 18 - #define IDU_INTERRUPT_0 16 19 - 20 - static char smp_cpuinfo_buf[128]; 21 - 22 - /* 23 - *------------------------------------------------------------------- 24 - * Platform specific callbacks expected by arch SMP code 25 - *------------------------------------------------------------------- 26 - */ 27 - 28 - /* 29 - * Master kick starting another CPU 30 - */ 31 - static void iss_model_smp_wakeup_cpu(int cpu, unsigned long pc) 32 - { 33 - /* setup the start PC */ 34 - write_aux_reg(ARC_AUX_XTL_REG_PARAM, pc); 35 - 36 - /* Trigger WRITE_PC cmd for this cpu */ 37 - write_aux_reg(ARC_AUX_XTL_REG_CMD, 38 - (ARC_XTL_CMD_WRITE_PC | (cpu << 8))); 39 - 40 - /* Take the cpu out of Halt */ 41 - write_aux_reg(ARC_AUX_XTL_REG_CMD, 42 - (ARC_XTL_CMD_CLEAR_HALT | (cpu << 8))); 43 - 44 - } 45 - 46 - static inline int get_hw_config_num_irq(void) 47 - { 48 - uint32_t val = read_aux_reg(ARC_REG_VECBASE_BCR); 49 - 50 - switch (val & 0x03) { 51 - case 0: 52 - return 16; 53 - case 1: 54 - return 32; 55 - case 2: 56 - return 8; 57 - default: 58 - return 0; 59 - } 60 - 61 - return 0; 62 - } 63 - 64 - /* 65 - * Any SMP specific init any CPU does when it comes up. 66 - * Here we setup the CPU to enable Inter-Processor-Interrupts 67 - * Called for each CPU 68 - * -Master : init_IRQ() 69 - * -Other(s) : start_kernel_secondary() 70 - */ 71 - void iss_model_init_smp(unsigned int cpu) 72 - { 73 - /* Check if CPU is configured for more than 16 interrupts */ 74 - if (NR_IRQS <= 16 || get_hw_config_num_irq() <= 16) 75 - panic("[arcfpga] IRQ system can't support IDU IPI\n"); 76 - 77 - idu_disable(); 78 - 79 - /**************************************************************** 80 - * IDU provides a set of Common IRQs, each of which can be dynamically 81 - * attached to (1|many|all) CPUs. 82 - * The Common IRQs [0-15] are mapped as CPU pvt [16-31] 83 - * 84 - * Here we use a simple 1:1 mapping: 85 - * A CPU 'x' is wired to Common IRQ 'x'. 86 - * So an IDU ASSERT on IRQ 'x' will trigger Interupt on CPU 'x', which 87 - * makes up for our simple IPI plumbing. 88 - * 89 - * TBD: Have a dedicated multicast IRQ for sending IPIs to all CPUs 90 - * w/o having to do one-at-a-time 91 - ******************************************************************/ 92 - 93 - /* 94 - * Claim an IRQ which would trigger IPI on this CPU. 95 - * In IDU parlance it involves setting up a cpu bitmask for the IRQ 96 - * The bitmap here contains only 1 CPU (self). 97 - */ 98 - idu_irq_set_tgtcpu(cpu, 0x1 << cpu); 99 - 100 - /* Set the IRQ destination to use the bitmask above */ 101 - idu_irq_set_mode(cpu, 7, /* XXX: IDU_IRQ_MOD_TCPU_ALLRECP: ISS bug */ 102 - IDU_IRQ_MODE_PULSE_TRIG); 103 - 104 - idu_enable(); 105 - 106 - /* Attach the arch-common IPI ISR to our IDU IRQ */ 107 - smp_ipi_irq_setup(cpu, IDU_INTERRUPT_0 + cpu); 108 - } 109 - 110 - static void iss_model_ipi_send(int cpu) 111 - { 112 - idu_irq_assert(cpu); 113 - } 114 - 115 - static void iss_model_ipi_clear(int irq) 116 - { 117 - idu_irq_clear(IDU_INTERRUPT_0 + smp_processor_id()); 118 - } 119 - 120 - void iss_model_init_early_smp(void) 121 - { 122 - #define IS_AVAIL1(var, str) ((var) ? str : "") 123 - 124 - struct bcr_mp mp; 125 - 126 - READ_BCR(ARC_REG_MP_BCR, mp); 127 - 128 - sprintf(smp_cpuinfo_buf, "Extn [ISS-SMP]: v%d, arch(%d) %s %s %s\n", 129 - mp.ver, mp.mp_arch, IS_AVAIL1(mp.scu, "SCU"), 130 - IS_AVAIL1(mp.idu, "IDU"), IS_AVAIL1(mp.sdu, "SDU")); 131 - 132 - plat_smp_ops.info = smp_cpuinfo_buf; 133 - 134 - plat_smp_ops.cpu_kick = iss_model_smp_wakeup_cpu; 135 - plat_smp_ops.ipi_send = iss_model_ipi_send; 136 - plat_smp_ops.ipi_clear = iss_model_ipi_clear; 137 - } 138 - 139 - /* 140 - *------------------------------------------------------------------- 141 - * Low level Platform IPI Providers 142 - *------------------------------------------------------------------- 143 - */ 144 - 145 - /* Set the Mode for the Common IRQ */ 146 - void idu_irq_set_mode(uint8_t irq, uint8_t dest_mode, uint8_t trig_mode) 147 - { 148 - uint32_t par = IDU_IRQ_MODE_PARAM(dest_mode, trig_mode); 149 - 150 - IDU_SET_PARAM(par); 151 - IDU_SET_COMMAND(irq, IDU_IRQ_WMODE); 152 - } 153 - 154 - /* Set the target cpu Bitmask for Common IRQ */ 155 - void idu_irq_set_tgtcpu(uint8_t irq, uint32_t mask) 156 - { 157 - IDU_SET_PARAM(mask); 158 - IDU_SET_COMMAND(irq, IDU_IRQ_WBITMASK); 159 - } 160 - 161 - /* Get the Interrupt Acknowledged status for IRQ (as CPU Bitmask) */ 162 - bool idu_irq_get_ack(uint8_t irq) 163 - { 164 - uint32_t val; 165 - 166 - IDU_SET_COMMAND(irq, IDU_IRQ_ACK); 167 - val = IDU_GET_PARAM(); 168 - 169 - return val & (1 << irq); 170 - } 171 - 172 - /* 173 - * Get the Interrupt Pending status for IRQ (as CPU Bitmask) 174 - * -Pending means CPU has not yet noticed the IRQ (e.g. disabled) 175 - * -After Interrupt has been taken, the IPI expcitily needs to be 176 - * cleared, to be acknowledged. 177 - */ 178 - bool idu_irq_get_pend(uint8_t irq) 179 - { 180 - uint32_t val; 181 - 182 - IDU_SET_COMMAND(irq, IDU_IRQ_PEND); 183 - val = IDU_GET_PARAM(); 184 - 185 - return val & (1 << irq); 186 - }
+46
arch/arc/plat-axs10x/Kconfig
··· 1 + # 2 + # Copyright (C) 2013-15 Synopsys, Inc. (www.synopsys.com) 3 + # 4 + # This program is free software; you can redistribute it and/or modify 5 + # it under the terms of the GNU General Public License version 2 as 6 + # published by the Free Software Foundation. 7 + # 8 + 9 + menuconfig ARC_PLAT_AXS10X 10 + bool "Synopsys ARC AXS10x Software Development Platforms" 11 + select DW_APB_ICTL 12 + select GPIO_DWAPB 13 + select OF_GPIO 14 + select GENERIC_IRQ_CHIP 15 + select ARCH_REQUIRE_GPIOLIB 16 + help 17 + Support for the ARC AXS10x Software Development Platforms. 18 + 19 + The AXS10x Platforms consist of a mainboard with peripherals, 20 + on which several daughter cards can be placed. The daughter cards 21 + typically contain a CPU and memory. 22 + 23 + if ARC_PLAT_AXS10X 24 + 25 + config AXS101 26 + depends on ISA_ARCOMPACT 27 + bool "AXS101 with AXC001 CPU Card (ARC 770D/EM6/AS221)" 28 + help 29 + This adds support for the 770D/EM6/AS221 CPU Card. Only the ARC 30 + 770D is supported in Linux. 31 + 32 + The AXS101 Platform consists of an AXS10x mainboard with 33 + this daughtercard. Please use the axs101.dts device tree 34 + with this configuration. 35 + 36 + config AXS103 37 + bool "AXS103 with AXC003 CPU Card (ARC HS38x)" 38 + depends on ISA_ARCV2 39 + help 40 + This adds support for the HS38x CPU Card. 41 + 42 + The AXS103 Platform consists of an AXS10x mainboard with 43 + this daughtercard. Please use the axs103.dts device tree 44 + with this configuration. 45 + 46 + endif
+9
arch/arc/plat-axs10x/Makefile
··· 1 + # 2 + # Copyright (C) 2013-15 Synopsys, Inc. (www.synopsys.com) 3 + # 4 + # This program is free software; you can redistribute it and/or modify 5 + # it under the terms of the GNU General Public License version 2 as 6 + # published by the Free Software Foundation. 7 + # 8 + 9 + obj-$(CONFIG_ARC_PLAT_AXS10X) += axs10x.o
+484
arch/arc/plat-axs10x/axs10x.c
··· 1 + /* 2 + * AXS101/AXS103 Software Development Platform 3 + * 4 + * Copyright (C) 2013-15 Synopsys, Inc. (www.synopsys.com) 5 + * 6 + * This program is free software; you can redistribute it and/or modify 7 + * it under the terms of the GNU General Public License version 2 as 8 + * published by the Free Software Foundation. 9 + * 10 + * This program is distributed in the hope that it will be useful, 11 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 + * GNU General Public License for more details. 14 + * 15 + */ 16 + 17 + #include <linux/of_platform.h> 18 + 19 + #include <asm/asm-offsets.h> 20 + #include <asm/clk.h> 21 + #include <asm/io.h> 22 + #include <asm/mach_desc.h> 23 + #include <asm/mcip.h> 24 + 25 + #define AXS_MB_CGU 0xE0010000 26 + #define AXS_MB_CREG 0xE0011000 27 + 28 + #define CREG_MB_IRQ_MUX (AXS_MB_CREG + 0x214) 29 + #define CREG_MB_SW_RESET (AXS_MB_CREG + 0x220) 30 + #define CREG_MB_VER (AXS_MB_CREG + 0x230) 31 + #define CREG_MB_CONFIG (AXS_MB_CREG + 0x234) 32 + 33 + #define AXC001_CREG 0xF0001000 34 + #define AXC001_GPIO_INTC 0xF0003000 35 + 36 + static void __init axs10x_enable_gpio_intc_wire(void) 37 + { 38 + /* 39 + * Peripherals on CPU Card and Mother Board are wired to cpu intc via 40 + * intermediate DW APB GPIO blocks (mainly for debouncing) 41 + * 42 + * --------------------- 43 + * | snps,arc700-intc | 44 + * --------------------- 45 + * | #7 | #15 46 + * ------------------- ------------------- 47 + * | snps,dw-apb-gpio | | snps,dw-apb-gpio | 48 + * ------------------- ------------------- 49 + * | | 50 + * | [ Debug UART on cpu card ] 51 + * | 52 + * ------------------------ 53 + * | snps,dw-apb-intc (MB)| 54 + * ------------------------ 55 + * | | | | 56 + * [eth] [uart] [... other perip on Main Board] 57 + * 58 + * Current implementation of "irq-dw-apb-ictl" driver doesn't work well 59 + * with stacked INTCs. In particular problem happens if its master INTC 60 + * not yet instantiated. See discussion here - 61 + * https://lkml.org/lkml/2015/3/4/755 62 + * 63 + * So setup the first gpio block as a passive pass thru and hide it from 64 + * DT hardware topology - connect MB intc directly to cpu intc 65 + * The GPIO "wire" needs to be init nevertheless (here) 66 + * 67 + * One side adv is that peripheral interrupt handling avoids one nested 68 + * intc ISR hop 69 + */ 70 + #define GPIO_INTEN (AXC001_GPIO_INTC + 0x30) 71 + #define GPIO_INTMASK (AXC001_GPIO_INTC + 0x34) 72 + #define GPIO_INTTYPE_LEVEL (AXC001_GPIO_INTC + 0x38) 73 + #define GPIO_INT_POLARITY (AXC001_GPIO_INTC + 0x3c) 74 + #define MB_TO_GPIO_IRQ 12 75 + 76 + iowrite32(~(1 << MB_TO_GPIO_IRQ), (void __iomem *) GPIO_INTMASK); 77 + iowrite32(0, (void __iomem *) GPIO_INTTYPE_LEVEL); 78 + iowrite32(~0, (void __iomem *) GPIO_INT_POLARITY); 79 + iowrite32(1 << MB_TO_GPIO_IRQ, (void __iomem *) GPIO_INTEN); 80 + } 81 + 82 + static inline void __init 83 + write_cgu_reg(uint32_t value, void __iomem *reg, void __iomem *lock_reg) 84 + { 85 + unsigned int loops = 128 * 1024, ctr; 86 + 87 + iowrite32(value, reg); 88 + 89 + ctr = loops; 90 + while (((ioread32(lock_reg) & 1) == 1) && ctr--) /* wait for unlock */ 91 + cpu_relax(); 92 + 93 + ctr = loops; 94 + while (((ioread32(lock_reg) & 1) == 0) && ctr--) /* wait for re-lock */ 95 + cpu_relax(); 96 + } 97 + 98 + static void __init axs10x_print_board_ver(unsigned int creg, const char *str) 99 + { 100 + union ver { 101 + struct { 102 + #ifdef CONFIG_CPU_BIG_ENDIAN 103 + unsigned int pad:11, y:12, m:4, d:5; 104 + #else 105 + unsigned int d:5, m:4, y:12, pad:11; 106 + #endif 107 + }; 108 + unsigned int val; 109 + } board; 110 + 111 + board.val = ioread32((void __iomem *)creg); 112 + pr_info("AXS: %s FPGA Date: %u-%u-%u\n", str, board.d, board.m, 113 + board.y); 114 + } 115 + 116 + static void __init axs10x_early_init(void) 117 + { 118 + int mb_rev; 119 + char mb[32]; 120 + 121 + /* Determine motherboard version */ 122 + if (ioread32((void __iomem *) CREG_MB_CONFIG) & (1 << 28)) 123 + mb_rev = 3; /* HT-3 (rev3.0) */ 124 + else 125 + mb_rev = 2; /* HT-2 (rev2.0) */ 126 + 127 + axs10x_enable_gpio_intc_wire(); 128 + 129 + scnprintf(mb, 32, "MainBoard v%d", mb_rev); 130 + axs10x_print_board_ver(CREG_MB_VER, mb); 131 + } 132 + 133 + #ifdef CONFIG_AXS101 134 + 135 + #define CREG_CPU_ADDR_770 (AXC001_CREG + 0x20) 136 + #define CREG_CPU_ADDR_TUNN (AXC001_CREG + 0x60) 137 + #define CREG_CPU_ADDR_770_UPD (AXC001_CREG + 0x34) 138 + #define CREG_CPU_ADDR_TUNN_UPD (AXC001_CREG + 0x74) 139 + 140 + #define CREG_CPU_ARC770_IRQ_MUX (AXC001_CREG + 0x114) 141 + #define CREG_CPU_GPIO_UART_MUX (AXC001_CREG + 0x120) 142 + 143 + /* 144 + * Set up System Memory Map for ARC cpu / peripherals controllers 145 + * 146 + * Each AXI master has a 4GB memory map specified as 16 apertures of 256MB, each 147 + * of which maps to a corresponding 256MB aperture in Target slave memory map. 148 + * 149 + * e.g. ARC cpu AXI Master's aperture 8 (0x8000_0000) is mapped to aperture 0 150 + * (0x0000_0000) of DDR Port 0 (slave #1) 151 + * 152 + * Access from cpu to MB controllers such as GMAC is setup using AXI Tunnel: 153 + * which has master/slaves on both ends. 154 + * e.g. aperture 14 (0xE000_0000) of ARC cpu is mapped to aperture 14 155 + * (0xE000_0000) of CPU Card AXI Tunnel slave (slave #3) which is mapped to 156 + * MB AXI Tunnel Master, which also has a mem map setup 157 + * 158 + * In the reverse direction, MB AXI Masters (e.g. GMAC) mem map is setup 159 + * to map to MB AXI Tunnel slave which connects to CPU Card AXI Tunnel Master 160 + */ 161 + struct aperture { 162 + unsigned int slave_sel:4, slave_off:4, pad:24; 163 + }; 164 + 165 + /* CPU Card target slaves */ 166 + #define AXC001_SLV_NONE 0 167 + #define AXC001_SLV_DDR_PORT0 1 168 + #define AXC001_SLV_SRAM 2 169 + #define AXC001_SLV_AXI_TUNNEL 3 170 + #define AXC001_SLV_AXI2APB 6 171 + #define AXC001_SLV_DDR_PORT1 7 172 + 173 + /* MB AXI Target slaves */ 174 + #define AXS_MB_SLV_NONE 0 175 + #define AXS_MB_SLV_AXI_TUNNEL_CPU 1 176 + #define AXS_MB_SLV_AXI_TUNNEL_HAPS 2 177 + #define AXS_MB_SLV_SRAM 3 178 + #define AXS_MB_SLV_CONTROL 4 179 + 180 + /* MB AXI masters */ 181 + #define AXS_MB_MST_TUNNEL_CPU 0 182 + #define AXS_MB_MST_USB_OHCI 10 183 + 184 + /* 185 + * memmap for ARC core on CPU Card 186 + */ 187 + static const struct aperture axc001_memmap[16] = { 188 + {AXC001_SLV_AXI_TUNNEL, 0x0}, 189 + {AXC001_SLV_AXI_TUNNEL, 0x1}, 190 + {AXC001_SLV_SRAM, 0x0}, /* 0x2000_0000: Local SRAM */ 191 + {AXC001_SLV_NONE, 0x0}, 192 + {AXC001_SLV_NONE, 0x0}, 193 + {AXC001_SLV_NONE, 0x0}, 194 + {AXC001_SLV_NONE, 0x0}, 195 + {AXC001_SLV_NONE, 0x0}, 196 + {AXC001_SLV_DDR_PORT0, 0x0}, /* 0x8000_0000: DDR 0..256M */ 197 + {AXC001_SLV_DDR_PORT0, 0x1}, /* 0x9000_0000: DDR 256..512M */ 198 + {AXC001_SLV_DDR_PORT0, 0x2}, 199 + {AXC001_SLV_DDR_PORT0, 0x3}, 200 + {AXC001_SLV_NONE, 0x0}, 201 + {AXC001_SLV_AXI_TUNNEL, 0xD}, 202 + {AXC001_SLV_AXI_TUNNEL, 0xE}, /* MB: CREG, CGU... */ 203 + {AXC001_SLV_AXI2APB, 0x0}, /* CPU Card local CREG, CGU... */ 204 + }; 205 + 206 + /* 207 + * memmap for CPU Card AXI Tunnel Master (for access by MB controllers) 208 + * GMAC (MB) -> MB AXI Tunnel slave -> CPU Card AXI Tunnel Master -> DDR 209 + */ 210 + static const struct aperture axc001_axi_tunnel_memmap[16] = { 211 + {AXC001_SLV_AXI_TUNNEL, 0x0}, 212 + {AXC001_SLV_AXI_TUNNEL, 0x1}, 213 + {AXC001_SLV_SRAM, 0x0}, 214 + {AXC001_SLV_NONE, 0x0}, 215 + {AXC001_SLV_NONE, 0x0}, 216 + {AXC001_SLV_NONE, 0x0}, 217 + {AXC001_SLV_NONE, 0x0}, 218 + {AXC001_SLV_NONE, 0x0}, 219 + {AXC001_SLV_DDR_PORT1, 0x0}, 220 + {AXC001_SLV_DDR_PORT1, 0x1}, 221 + {AXC001_SLV_DDR_PORT1, 0x2}, 222 + {AXC001_SLV_DDR_PORT1, 0x3}, 223 + {AXC001_SLV_NONE, 0x0}, 224 + {AXC001_SLV_AXI_TUNNEL, 0xD}, 225 + {AXC001_SLV_AXI_TUNNEL, 0xE}, 226 + {AXC001_SLV_AXI2APB, 0x0}, 227 + }; 228 + 229 + /* 230 + * memmap for MB AXI Masters 231 + * Same mem map for all perip controllers as well as MB AXI Tunnel Master 232 + */ 233 + static const struct aperture axs_mb_memmap[16] = { 234 + {AXS_MB_SLV_SRAM, 0x0}, 235 + {AXS_MB_SLV_SRAM, 0x0}, 236 + {AXS_MB_SLV_NONE, 0x0}, 237 + {AXS_MB_SLV_NONE, 0x0}, 238 + {AXS_MB_SLV_NONE, 0x0}, 239 + {AXS_MB_SLV_NONE, 0x0}, 240 + {AXS_MB_SLV_NONE, 0x0}, 241 + {AXS_MB_SLV_NONE, 0x0}, 242 + {AXS_MB_SLV_AXI_TUNNEL_CPU, 0x8}, /* DDR on CPU Card */ 243 + {AXS_MB_SLV_AXI_TUNNEL_CPU, 0x9}, /* DDR on CPU Card */ 244 + {AXS_MB_SLV_AXI_TUNNEL_CPU, 0xA}, 245 + {AXS_MB_SLV_AXI_TUNNEL_CPU, 0xB}, 246 + {AXS_MB_SLV_NONE, 0x0}, 247 + {AXS_MB_SLV_AXI_TUNNEL_HAPS, 0xD}, 248 + {AXS_MB_SLV_CONTROL, 0x0}, /* MB Local CREG, CGU... */ 249 + {AXS_MB_SLV_AXI_TUNNEL_CPU, 0xF}, 250 + }; 251 + 252 + static noinline void __init 253 + axs101_set_memmap(void __iomem *base, const struct aperture map[16]) 254 + { 255 + unsigned int slave_select, slave_offset; 256 + int i; 257 + 258 + slave_select = slave_offset = 0; 259 + for (i = 0; i < 8; i++) { 260 + slave_select |= map[i].slave_sel << (i << 2); 261 + slave_offset |= map[i].slave_off << (i << 2); 262 + } 263 + 264 + iowrite32(slave_select, base + 0x0); /* SLV0 */ 265 + iowrite32(slave_offset, base + 0x8); /* OFFSET0 */ 266 + 267 + slave_select = slave_offset = 0; 268 + for (i = 0; i < 8; i++) { 269 + slave_select |= map[i+8].slave_sel << (i << 2); 270 + slave_offset |= map[i+8].slave_off << (i << 2); 271 + } 272 + 273 + iowrite32(slave_select, base + 0x4); /* SLV1 */ 274 + iowrite32(slave_offset, base + 0xC); /* OFFSET1 */ 275 + } 276 + 277 + static void __init axs101_early_init(void) 278 + { 279 + int i; 280 + 281 + /* ARC 770D memory view */ 282 + axs101_set_memmap((void __iomem *) CREG_CPU_ADDR_770, axc001_memmap); 283 + iowrite32(1, (void __iomem *) CREG_CPU_ADDR_770_UPD); 284 + 285 + /* AXI tunnel memory map (incoming traffic from MB into CPU Card */ 286 + axs101_set_memmap((void __iomem *) CREG_CPU_ADDR_TUNN, 287 + axc001_axi_tunnel_memmap); 288 + iowrite32(1, (void __iomem *) CREG_CPU_ADDR_TUNN_UPD); 289 + 290 + /* MB peripherals memory map */ 291 + for (i = AXS_MB_MST_TUNNEL_CPU; i <= AXS_MB_MST_USB_OHCI; i++) 292 + axs101_set_memmap((void __iomem *) AXS_MB_CREG + (i << 4), 293 + axs_mb_memmap); 294 + 295 + iowrite32(0x3ff, (void __iomem *) AXS_MB_CREG + 0x100); /* Update */ 296 + 297 + /* GPIO pins 18 and 19 are used as UART rx and tx, respectively. */ 298 + iowrite32(0x01, (void __iomem *) CREG_CPU_GPIO_UART_MUX); 299 + 300 + /* Set up the MB interrupt system: mux interrupts to GPIO7) */ 301 + iowrite32(0x01, (void __iomem *) CREG_MB_IRQ_MUX); 302 + 303 + /* reset ethernet and ULPI interfaces */ 304 + iowrite32(0x18, (void __iomem *) CREG_MB_SW_RESET); 305 + 306 + /* map GPIO 14:10 to ARC 9:5 (IRQ mux change for MB v2 onwards) */ 307 + iowrite32(0x52, (void __iomem *) CREG_CPU_ARC770_IRQ_MUX); 308 + 309 + axs10x_early_init(); 310 + } 311 + 312 + #endif /* CONFIG_AXS101 */ 313 + 314 + #ifdef CONFIG_AXS103 315 + 316 + #define AXC003_CGU 0xF0000000 317 + #define AXC003_CREG 0xF0001000 318 + #define AXC003_MST_AXI_TUNNEL 0 319 + #define AXC003_MST_HS38 1 320 + 321 + #define CREG_CPU_AXI_M0_IRQ_MUX (AXC003_CREG + 0x440) 322 + #define CREG_CPU_GPIO_UART_MUX (AXC003_CREG + 0x480) 323 + #define CREG_CPU_TUN_IO_CTRL (AXC003_CREG + 0x494) 324 + 325 + 326 + union pll_reg { 327 + struct { 328 + #ifdef CONFIG_CPU_BIG_ENDIAN 329 + unsigned int pad:17, noupd:1, bypass:1, edge:1, high:6, low:6; 330 + #else 331 + unsigned int low:6, high:6, edge:1, bypass:1, noupd:1, pad:17; 332 + #endif 333 + }; 334 + unsigned int val; 335 + }; 336 + 337 + static unsigned int __init axs103_get_freq(void) 338 + { 339 + union pll_reg idiv, fbdiv, odiv; 340 + unsigned int f = 33333333; 341 + 342 + idiv.val = ioread32((void __iomem *)AXC003_CGU + 0x80 + 0); 343 + fbdiv.val = ioread32((void __iomem *)AXC003_CGU + 0x80 + 4); 344 + odiv.val = ioread32((void __iomem *)AXC003_CGU + 0x80 + 8); 345 + 346 + if (idiv.bypass != 1) 347 + f = f / (idiv.low + idiv.high); 348 + 349 + if (fbdiv.bypass != 1) 350 + f = f * (fbdiv.low + fbdiv.high); 351 + 352 + if (odiv.bypass != 1) 353 + f = f / (odiv.low + odiv.high); 354 + 355 + f = (f + 500000) / 1000000; /* Rounding */ 356 + return f; 357 + } 358 + 359 + static inline unsigned int __init encode_div(unsigned int id, int upd) 360 + { 361 + union pll_reg div; 362 + 363 + div.val = 0; 364 + 365 + div.noupd = !upd; 366 + div.bypass = id == 1 ? 1 : 0; 367 + div.edge = (id%2 == 0) ? 0 : 1; /* 0 = rising */ 368 + div.low = (id%2 == 0) ? id >> 1 : (id >> 1)+1; 369 + div.high = id >> 1; 370 + 371 + return div.val; 372 + } 373 + 374 + noinline static void __init 375 + axs103_set_freq(unsigned int id, unsigned int fd, unsigned int od) 376 + { 377 + write_cgu_reg(encode_div(id, 0), 378 + (void __iomem *)AXC003_CGU + 0x80 + 0, 379 + (void __iomem *)AXC003_CGU + 0x110); 380 + 381 + write_cgu_reg(encode_div(fd, 0), 382 + (void __iomem *)AXC003_CGU + 0x80 + 4, 383 + (void __iomem *)AXC003_CGU + 0x110); 384 + 385 + write_cgu_reg(encode_div(od, 1), 386 + (void __iomem *)AXC003_CGU + 0x80 + 8, 387 + (void __iomem *)AXC003_CGU + 0x110); 388 + } 389 + 390 + static void __init axs103_early_init(void) 391 + { 392 + switch (arc_get_core_freq()/1000000) { 393 + case 33: 394 + axs103_set_freq(1, 1, 1); 395 + break; 396 + case 50: 397 + axs103_set_freq(1, 30, 20); 398 + break; 399 + case 75: 400 + axs103_set_freq(2, 45, 10); 401 + break; 402 + case 90: 403 + axs103_set_freq(2, 54, 10); 404 + break; 405 + case 100: 406 + axs103_set_freq(1, 30, 10); 407 + break; 408 + case 125: 409 + axs103_set_freq(2, 45, 6); 410 + break; 411 + default: 412 + /* 413 + * In this case, core_frequency derived from 414 + * DT "clock-frequency" might not match with board value. 415 + * Hence update it to match the board value. 416 + */ 417 + arc_set_core_freq(axs103_get_freq() * 1000000); 418 + break; 419 + } 420 + 421 + pr_info("Freq is %dMHz\n", axs103_get_freq()); 422 + 423 + /* Memory maps already config in pre-bootloader */ 424 + 425 + /* set GPIO mux to UART */ 426 + iowrite32(0x01, (void __iomem *) CREG_CPU_GPIO_UART_MUX); 427 + 428 + iowrite32((0x00100000U | 0x000C0000U | 0x00003322U), 429 + (void __iomem *) CREG_CPU_TUN_IO_CTRL); 430 + 431 + /* Set up the AXS_MB interrupt system.*/ 432 + iowrite32(12, (void __iomem *) (CREG_CPU_AXI_M0_IRQ_MUX 433 + + (AXC003_MST_HS38 << 2))); 434 + 435 + /* connect ICTL - Main Board with GPIO line */ 436 + iowrite32(0x01, (void __iomem *) CREG_MB_IRQ_MUX); 437 + 438 + axs10x_print_board_ver(AXC003_CREG + 4088, "AXC003 CPU Card"); 439 + 440 + axs10x_early_init(); 441 + 442 + #ifdef CONFIG_ARC_MCIP 443 + /* No Hardware init, but filling the smp ops callbacks */ 444 + mcip_init_early_smp(); 445 + #endif 446 + } 447 + #endif 448 + 449 + #ifdef CONFIG_AXS101 450 + 451 + static const char *axs101_compat[] __initconst = { 452 + "snps,axs101", 453 + NULL, 454 + }; 455 + 456 + MACHINE_START(AXS101, "axs101") 457 + .dt_compat = axs101_compat, 458 + .init_early = axs101_early_init, 459 + MACHINE_END 460 + 461 + #endif /* CONFIG_AXS101 */ 462 + 463 + #ifdef CONFIG_AXS103 464 + 465 + static const char *axs103_compat[] __initconst = { 466 + "snps,axs103", 467 + NULL, 468 + }; 469 + 470 + MACHINE_START(AXS103, "axs103") 471 + .dt_compat = axs103_compat, 472 + .init_early = axs103_early_init, 473 + #ifdef CONFIG_ARC_MCIP 474 + .init_smp = mcip_init_smp, 475 + #endif 476 + MACHINE_END 477 + 478 + /* 479 + * For the VDK OS-kit, to get the offset to pid and command fields 480 + */ 481 + char coware_swa_pid_offset[TASK_PID]; 482 + char coware_swa_comm_offset[TASK_COMM]; 483 + 484 + #endif /* CONFIG_AXS103 */
+14
arch/arc/plat-sim/Kconfig
··· 1 + # 2 + # Copyright (C) 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com) 3 + # 4 + # This program is free software; you can redistribute it and/or modify 5 + # it under the terms of the GNU General Public License version 2 as 6 + # published by the Free Software Foundation. 7 + # 8 + 9 + menuconfig ARC_PLAT_SIM 10 + bool "ARC nSIM based simulation virtual platforms" 11 + select ARC_HAS_COH_CACHES if SMP 12 + help 13 + Support for nSIM based ARC simulation platforms 14 + This includes the standalone nSIM (uart only) vs. System C OSCI VP
+27 -1
include/asm-generic/barrier.h
··· 55 55 #endif 56 56 57 57 #ifdef CONFIG_SMP 58 + 59 + #ifndef smp_mb 58 60 #define smp_mb() mb() 61 + #endif 62 + 63 + #ifndef smp_rmb 59 64 #define smp_rmb() rmb() 65 + #endif 66 + 67 + #ifndef smp_wmb 60 68 #define smp_wmb() wmb() 69 + #endif 70 + 71 + #ifndef smp_read_barrier_depends 61 72 #define smp_read_barrier_depends() read_barrier_depends() 62 - #else 73 + #endif 74 + 75 + #else /* !CONFIG_SMP */ 76 + 77 + #ifndef smp_mb 63 78 #define smp_mb() barrier() 79 + #endif 80 + 81 + #ifndef smp_rmb 64 82 #define smp_rmb() barrier() 83 + #endif 84 + 85 + #ifndef smp_wmb 65 86 #define smp_wmb() barrier() 87 + #endif 88 + 89 + #ifndef smp_read_barrier_depends 66 90 #define smp_read_barrier_depends() do { } while (0) 67 91 #endif 92 + 93 + #endif /* CONFIG_SMP */ 68 94 69 95 #ifndef smp_store_mb 70 96 #define smp_store_mb(var, value) do { WRITE_ONCE(var, value); mb(); } while (0)
+5
scripts/sortextable.c
··· 47 47 #define EM_MICROBLAZE 189 48 48 #endif 49 49 50 + #ifndef EM_ARCV2 51 + #define EM_ARCV2 195 52 + #endif 53 + 50 54 static int fd_map; /* File descriptor for file being modified. */ 51 55 static int mmap_failed; /* Boolean flag. */ 52 56 static void *ehdr_curr; /* current ElfXX_Ehdr * for resource cleanup */ ··· 285 281 custom_sort = sort_relative_table; 286 282 break; 287 283 case EM_ARCOMPACT: 284 + case EM_ARCV2: 288 285 case EM_ARM: 289 286 case EM_AARCH64: 290 287 case EM_MICROBLAZE: