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

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

Pull ARC updates from Vineet Gupta:

- Support for HSDK board hosting a Quad core HS38x4 based SoC running
@1GHz (and some prerrquisite changes such as ability to scoot the
kernel code/data from start of memory map etc)

- Quite a few updates for EZChip (Mellanox) platform

- Fixes to fault/exception printing

* tag 'arc-4.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc: (26 commits)
ARC: Re-enable MMU upon Machine Check exception
ARC: Show fault information passed to show_kernel_fault_diag()
ARC: [plat-hsdk] initial port for HSDK board
ARC: mm: Decouple RAM base address from kernel link address
ARCv2: IOC: Tighten up the contraints (specifically base / size alignment)
ARC: [plat-axs103] refactor the DT fudging code
ARC: [plat-axs103] use clk driver #2: Add core pll node to DT to manage cpu clk
ARC: [plat-axs103] use clk driver #1: Get rid of platform specific cpu clk setting
ARCv2: SLC: provide a line based flush routine for debugging
ARC: Hardcode ARCH_DMA_MINALIGN to max line length we may have
ARC: [plat-eznps] handle extra aux regs #2: kernel/entry exit
ARC: [plat-eznps] handle extra aux regs #1: save/restore on context switch
ARC: [plat-eznps] avoid toggling of DPC register
ARC: [plat-eznps] Update the init sequence of aux regs per cpu.
ARC: [plat-eznps] new command line argument for HW scheduler at MTM
ARC: set boot print log level to PR_INFO
ARC: [plat-eznps] Handle user memory error same in simulation and silicon
ARC: [plat-eznps] use schd.wft instruction instead of sleep at idle task
ARC: create cpu specific version of arch_cpu_idle()
ARC: [plat-eznps] spinlock aware for MTM
...

+739 -192
+9
Documentation/admin-guide/kernel-parameters.txt
··· 2764 2764 If the dependencies are under your control, you can 2765 2765 turn on cpu0_hotplug. 2766 2766 2767 + nps_mtm_hs_ctr= [KNL,ARC] 2768 + This parameter sets the maximum duration, in 2769 + cycles, each HW thread of the CTOP can run 2770 + without interruptions, before HW switches it. 2771 + The actual maximum duration is 16 times this 2772 + parameter's value. 2773 + Format: integer between 1 and 255 2774 + Default: 255 2775 + 2767 2776 nptcg= [IA-64] Override max number of concurrent global TLB 2768 2777 purges which is reported from either PAL_VM_SUMMARY or 2769 2778 SAL PALO.
+7
Documentation/devicetree/bindings/arc/hsdk.txt
··· 1 + Synopsys DesignWare ARC HS Development Kit Device Tree Bindings 2 + --------------------------------------------------------------------------- 3 + 4 + ARC HSDK Board with quad-core ARC HS38x4 in silicon. 5 + 6 + Required root node properties: 7 + - compatible = "snps,hsdk";
+10 -1
arch/arc/Kconfig
··· 100 100 source "arch/arc/plat-axs10x/Kconfig" 101 101 #New platform adds here 102 102 source "arch/arc/plat-eznps/Kconfig" 103 + source "arch/arc/plat-hsdk/Kconfig" 103 104 104 105 endmenu 105 106 ··· 419 418 endmenu # "ARC CPU Configuration" 420 419 421 420 config LINUX_LINK_BASE 422 - hex "Linux Link Address" 421 + hex "Kernel link address" 423 422 default "0x80000000" 424 423 help 425 424 ARC700 divides the 32 bit phy address space into two equal halves ··· 431 430 Linux needs to be scooted a bit. 432 431 If you don't know what the above means, leave this setting alone. 433 432 This needs to match memory start address specified in Device Tree 433 + 434 + config LINUX_RAM_BASE 435 + hex "RAM base address" 436 + default LINUX_LINK_BASE 437 + help 438 + By default Linux is linked at base of RAM. However in some special 439 + cases (such as HSDK), Linux can't be linked at start of DDR, hence 440 + this option. 434 441 435 442 config HIGHMEM 436 443 bool "High Memory Support"
+1
arch/arc/Makefile
··· 111 111 core-$(CONFIG_ARC_PLAT_TB10X) += arch/arc/plat-tb10x/ 112 112 core-$(CONFIG_ARC_PLAT_AXS10X) += arch/arc/plat-axs10x/ 113 113 core-$(CONFIG_ARC_PLAT_EZNPS) += arch/arc/plat-eznps/ 114 + core-$(CONFIG_ARC_SOC_HSDK) += arch/arc/plat-hsdk/ 114 115 115 116 ifdef CONFIG_ARC_PLAT_EZNPS 116 117 KBUILD_CPPFLAGS += -I$(srctree)/arch/arc/plat-eznps/include
+1 -1
arch/arc/boot/dts/axc001.dtsi
··· 99 99 100 100 memory { 101 101 device_type = "memory"; 102 - /* CONFIG_KERNEL_RAM_BASE_ADDRESS needs to match low mem start */ 102 + /* CONFIG_LINUX_RAM_BASE needs to match low mem start */ 103 103 reg = <0x0 0x80000000 0x0 0x1b000000>; /* (512 - 32) MiB */ 104 104 }; 105 105
+10 -3
arch/arc/boot/dts/axc003.dtsi
··· 24 24 25 25 ranges = <0x00000000 0x0 0xf0000000 0x10000000>; 26 26 27 - core_clk: core_clk { 27 + input_clk: input-clk { 28 28 #clock-cells = <0>; 29 29 compatible = "fixed-clock"; 30 - clock-frequency = <90000000>; 30 + clock-frequency = <33333333>; 31 + }; 32 + 33 + core_clk: core-clk@80 { 34 + compatible = "snps,axs10x-arc-pll-clock"; 35 + reg = <0x80 0x10>, <0x100 0x10>; 36 + #clock-cells = <0>; 37 + clocks = <&input_clk>; 31 38 }; 32 39 33 40 core_intc: archs-intc@cpu { ··· 109 102 110 103 memory { 111 104 device_type = "memory"; 112 - /* CONFIG_KERNEL_RAM_BASE_ADDRESS needs to match low mem start */ 105 + /* CONFIG_LINUX_RAM_BASE needs to match low mem start */ 113 106 reg = <0x0 0x80000000 0x0 0x20000000 /* 512 MiB low mem */ 114 107 0x1 0xc0000000 0x0 0x40000000>; /* 1 GiB highmem */ 115 108 };
+10 -3
arch/arc/boot/dts/axc003_idu.dtsi
··· 24 24 25 25 ranges = <0x00000000 0x0 0xf0000000 0x10000000>; 26 26 27 - core_clk: core_clk { 27 + input_clk: input-clk { 28 28 #clock-cells = <0>; 29 29 compatible = "fixed-clock"; 30 - clock-frequency = <100000000>; 30 + clock-frequency = <33333333>; 31 + }; 32 + 33 + core_clk: core-clk@80 { 34 + compatible = "snps,axs10x-arc-pll-clock"; 35 + reg = <0x80 0x10>, <0x100 0x10>; 36 + #clock-cells = <0>; 37 + clocks = <&input_clk>; 31 38 }; 32 39 33 40 core_intc: archs-intc@cpu { ··· 115 108 116 109 memory { 117 110 device_type = "memory"; 118 - /* CONFIG_KERNEL_RAM_BASE_ADDRESS needs to match low mem start */ 111 + /* CONFIG_LINUX_RAM_BASE needs to match low mem start */ 119 112 reg = <0x0 0x80000000 0x0 0x20000000 /* 512 MiB low mem */ 120 113 0x1 0xc0000000 0x0 0x40000000>; /* 1 GiB highmem */ 121 114 };
+189
arch/arc/boot/dts/hsdk.dts
··· 1 + /* 2 + * Copyright (C) 2017 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 ARC HS Development Kit 11 + */ 12 + /dts-v1/; 13 + 14 + #include <dt-bindings/net/ti-dp83867.h> 15 + 16 + / { 17 + model = "snps,hsdk"; 18 + compatible = "snps,hsdk"; 19 + 20 + #address-cells = <1>; 21 + #size-cells = <1>; 22 + 23 + chosen { 24 + bootargs = "earlycon=uart8250,mmio32,0xf0005000,115200n8 console=ttyS0,115200n8 debug print-fatal-signals=1"; 25 + }; 26 + 27 + cpus { 28 + #address-cells = <1>; 29 + #size-cells = <0>; 30 + 31 + cpu@0 { 32 + device_type = "cpu"; 33 + compatible = "snps,archs38"; 34 + reg = <0>; 35 + clocks = <&core_clk>; 36 + }; 37 + 38 + cpu@1 { 39 + device_type = "cpu"; 40 + compatible = "snps,archs38"; 41 + reg = <1>; 42 + clocks = <&core_clk>; 43 + }; 44 + 45 + cpu@2 { 46 + device_type = "cpu"; 47 + compatible = "snps,archs38"; 48 + reg = <2>; 49 + clocks = <&core_clk>; 50 + }; 51 + 52 + cpu@3 { 53 + device_type = "cpu"; 54 + compatible = "snps,archs38"; 55 + reg = <3>; 56 + clocks = <&core_clk>; 57 + }; 58 + }; 59 + 60 + core_clk: core-clk { 61 + #clock-cells = <0>; 62 + compatible = "fixed-clock"; 63 + clock-frequency = <500000000>; 64 + }; 65 + 66 + cpu_intc: cpu-interrupt-controller { 67 + compatible = "snps,archs-intc"; 68 + interrupt-controller; 69 + #interrupt-cells = <1>; 70 + }; 71 + 72 + idu_intc: idu-interrupt-controller { 73 + compatible = "snps,archs-idu-intc"; 74 + interrupt-controller; 75 + #interrupt-cells = <1>; 76 + interrupt-parent = <&cpu_intc>; 77 + }; 78 + 79 + arcpct: pct { 80 + compatible = "snps,archs-pct"; 81 + }; 82 + 83 + /* TIMER0 with interrupt for clockevent */ 84 + timer { 85 + compatible = "snps,arc-timer"; 86 + interrupts = <16>; 87 + interrupt-parent = <&cpu_intc>; 88 + clocks = <&core_clk>; 89 + }; 90 + 91 + /* 64-bit Global Free Running Counter */ 92 + gfrc { 93 + compatible = "snps,archs-timer-gfrc"; 94 + clocks = <&core_clk>; 95 + }; 96 + 97 + soc { 98 + compatible = "simple-bus"; 99 + #address-cells = <1>; 100 + #size-cells = <1>; 101 + interrupt-parent = <&idu_intc>; 102 + 103 + ranges = <0x00000000 0xf0000000 0x10000000>; 104 + 105 + serial: serial@5000 { 106 + compatible = "snps,dw-apb-uart"; 107 + reg = <0x5000 0x100>; 108 + clock-frequency = <33330000>; 109 + interrupts = <6>; 110 + baud = <115200>; 111 + reg-shift = <2>; 112 + reg-io-width = <4>; 113 + }; 114 + 115 + gmacclk: gmacclk { 116 + compatible = "fixed-clock"; 117 + clock-frequency = <400000000>; 118 + #clock-cells = <0>; 119 + }; 120 + 121 + mmcclk_ciu: mmcclk-ciu { 122 + compatible = "fixed-clock"; 123 + clock-frequency = <100000000>; 124 + #clock-cells = <0>; 125 + }; 126 + 127 + mmcclk_biu: mmcclk-biu { 128 + compatible = "fixed-clock"; 129 + clock-frequency = <400000000>; 130 + #clock-cells = <0>; 131 + }; 132 + 133 + ethernet@8000 { 134 + #interrupt-cells = <1>; 135 + compatible = "snps,dwmac"; 136 + reg = <0x8000 0x2000>; 137 + interrupts = <10>; 138 + interrupt-names = "macirq"; 139 + phy-mode = "rgmii"; 140 + snps,pbl = <32>; 141 + clocks = <&gmacclk>; 142 + clock-names = "stmmaceth"; 143 + phy-handle = <&phy0>; 144 + 145 + mdio { 146 + #address-cells = <1>; 147 + #size-cells = <0>; 148 + compatible = "snps,dwmac-mdio"; 149 + phy0: ethernet-phy@0 { 150 + reg = <0>; 151 + ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_00_NS>; 152 + ti,tx-internal-delay = <DP83867_RGMIIDCTL_2_00_NS>; 153 + ti,fifo-depth = <DP83867_PHYCR_FIFO_DEPTH_4_B_NIB>; 154 + }; 155 + }; 156 + }; 157 + 158 + ohci@60000 { 159 + compatible = "snps,hsdk-v1.0-ohci", "generic-ohci"; 160 + reg = <0x60000 0x100>; 161 + interrupts = <15>; 162 + }; 163 + 164 + ehci@40000 { 165 + compatible = "snps,hsdk-v1.0-ehci", "generic-ehci"; 166 + reg = <0x40000 0x100>; 167 + interrupts = <15>; 168 + }; 169 + 170 + mmc@a000 { 171 + compatible = "altr,socfpga-dw-mshc"; 172 + reg = <0xa000 0x400>; 173 + num-slots = <1>; 174 + fifo-depth = <16>; 175 + card-detect-delay = <200>; 176 + clocks = <&mmcclk_biu>, <&mmcclk_ciu>; 177 + clock-names = "biu", "ciu"; 178 + interrupts = <12>; 179 + bus-width = <4>; 180 + }; 181 + }; 182 + 183 + memory@80000000 { 184 + #address-cells = <1>; 185 + #size-cells = <1>; 186 + device_type = "memory"; 187 + reg = <0x80000000 0x40000000>; /* 1 GiB */ 188 + }; 189 + };
+1 -1
arch/arc/boot/dts/nsim_hs.dts
··· 18 18 19 19 memory { 20 20 device_type = "memory"; 21 - /* CONFIG_LINUX_LINK_BASE needs to match low mem start */ 21 + /* CONFIG_LINUX_RAM_BASE needs to match low mem start */ 22 22 reg = <0x0 0x80000000 0x0 0x20000000 /* 512 MB low mem */ 23 23 0x1 0x00000000 0x0 0x40000000>; /* 1 GB highmem */ 24 24 };
+80
arch/arc/configs/hsdk_defconfig
··· 1 + CONFIG_DEFAULT_HOSTNAME="ARCLinux" 2 + CONFIG_SYSVIPC=y 3 + # CONFIG_CROSS_MEMORY_ATTACH is not set 4 + CONFIG_NO_HZ_IDLE=y 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_EMBEDDED=y 14 + CONFIG_PERF_EVENTS=y 15 + # CONFIG_VM_EVENT_COUNTERS is not set 16 + # CONFIG_COMPAT_BRK is not set 17 + CONFIG_SLAB=y 18 + CONFIG_MODULES=y 19 + CONFIG_MODULE_UNLOAD=y 20 + CONFIG_ARC_SOC_HSDK=y 21 + CONFIG_ISA_ARCV2=y 22 + CONFIG_SMP=y 23 + CONFIG_LINUX_LINK_BASE=0x90000000 24 + CONFIG_LINUX_RAM_BASE=0x80000000 25 + CONFIG_ARC_BUILTIN_DTB_NAME="hsdk" 26 + CONFIG_PREEMPT=y 27 + # CONFIG_COMPACTION is not set 28 + CONFIG_NET=y 29 + CONFIG_PACKET=y 30 + CONFIG_UNIX=y 31 + CONFIG_INET=y 32 + CONFIG_DEVTMPFS=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_SCSI=y 37 + CONFIG_BLK_DEV_SD=y 38 + CONFIG_NETDEVICES=y 39 + CONFIG_STMMAC_ETH=y 40 + CONFIG_MICREL_PHY=y 41 + CONFIG_INPUT_EVDEV=y 42 + # CONFIG_INPUT_KEYBOARD is not set 43 + # CONFIG_INPUT_MOUSE is not set 44 + # CONFIG_SERIO is not set 45 + # CONFIG_LEGACY_PTYS is not set 46 + CONFIG_SERIAL_8250=y 47 + CONFIG_SERIAL_8250_CONSOLE=y 48 + CONFIG_SERIAL_8250_DW=y 49 + CONFIG_SERIAL_OF_PLATFORM=y 50 + # CONFIG_HW_RANDOM is not set 51 + # CONFIG_HWMON is not set 52 + CONFIG_FB=y 53 + CONFIG_FB_UDL=y 54 + CONFIG_FRAMEBUFFER_CONSOLE=y 55 + CONFIG_USB=y 56 + CONFIG_USB_EHCI_HCD=y 57 + CONFIG_USB_EHCI_HCD_PLATFORM=y 58 + CONFIG_USB_OHCI_HCD=y 59 + CONFIG_USB_OHCI_HCD_PLATFORM=y 60 + CONFIG_USB_STORAGE=y 61 + CONFIG_MMC=y 62 + CONFIG_MMC_SDHCI=y 63 + CONFIG_MMC_SDHCI_PLTFM=y 64 + CONFIG_MMC_DW=y 65 + # CONFIG_IOMMU_SUPPORT is not set 66 + CONFIG_EXT3_FS=y 67 + CONFIG_VFAT_FS=y 68 + CONFIG_TMPFS=y 69 + CONFIG_NFS_FS=y 70 + CONFIG_NLS_CODEPAGE_437=y 71 + CONFIG_NLS_ISO8859_1=y 72 + # CONFIG_ENABLE_WARN_DEPRECATED is not set 73 + # CONFIG_ENABLE_MUST_CHECK is not set 74 + CONFIG_STRIP_ASM_SYMS=y 75 + CONFIG_LOCKUP_DETECTOR=y 76 + CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=10 77 + # CONFIG_SCHED_DEBUG is not set 78 + # CONFIG_DEBUG_PREEMPT is not set 79 + # CONFIG_FTRACE is not set 80 + CONFIG_CRYPTO_ECHAINIV=y
+4 -1
arch/arc/include/asm/cache.h
··· 47 47 : "r"(data), "r"(ptr)); \ 48 48 }) 49 49 50 - #define ARCH_DMA_MINALIGN L1_CACHE_BYTES 50 + /* Largest line length for either L1 or L2 is 128 bytes */ 51 + #define ARCH_DMA_MINALIGN 128 51 52 52 53 extern void arc_cache_init(void); 53 54 extern char *arc_cache_mumbojumbo(int cpu_id, char *buf, int len); ··· 96 95 #define ARC_REG_SLC_CTRL 0x903 97 96 #define ARC_REG_SLC_FLUSH 0x904 98 97 #define ARC_REG_SLC_INVALIDATE 0x905 98 + #define ARC_AUX_SLC_IVDL 0x910 99 + #define ARC_AUX_SLC_FLDL 0x912 99 100 #define ARC_REG_SLC_RGN_START 0x914 100 101 #define ARC_REG_SLC_RGN_START1 0x915 101 102 #define ARC_REG_SLC_RGN_END 0x916
+24
arch/arc/include/asm/entry-compact.h
··· 192 192 PUSHAX lp_start 193 193 PUSHAX erbta 194 194 195 + #ifdef CONFIG_ARC_PLAT_EZNPS 196 + .word CTOP_INST_SCHD_RW 197 + PUSHAX CTOP_AUX_GPA1 198 + PUSHAX CTOP_AUX_EFLAGS 199 + #endif 200 + 195 201 lr r9, [ecr] 196 202 st r9, [sp, PT_event] /* EV_Trap expects r9 to have ECR */ 197 203 .endm ··· 214 208 * by hardware and that is not good. 215 209 *-------------------------------------------------------------*/ 216 210 .macro EXCEPTION_EPILOGUE 211 + #ifdef CONFIG_ARC_PLAT_EZNPS 212 + .word CTOP_INST_SCHD_RW 213 + POPAX CTOP_AUX_EFLAGS 214 + POPAX CTOP_AUX_GPA1 215 + #endif 216 + 217 217 POPAX erbta 218 218 POPAX lp_start 219 219 POPAX lp_end ··· 277 265 PUSHAX lp_end 278 266 PUSHAX lp_start 279 267 PUSHAX bta_l\LVL\() 268 + 269 + #ifdef CONFIG_ARC_PLAT_EZNPS 270 + .word CTOP_INST_SCHD_RW 271 + PUSHAX CTOP_AUX_GPA1 272 + PUSHAX CTOP_AUX_EFLAGS 273 + #endif 280 274 .endm 281 275 282 276 /*-------------------------------------------------------------- ··· 295 277 * by hardware and that is not good. 296 278 *-------------------------------------------------------------*/ 297 279 .macro INTERRUPT_EPILOGUE LVL 280 + #ifdef CONFIG_ARC_PLAT_EZNPS 281 + .word CTOP_INST_SCHD_RW 282 + POPAX CTOP_AUX_EFLAGS 283 + POPAX CTOP_AUX_GPA1 284 + #endif 285 + 298 286 POPAX bta_l\LVL\() 299 287 POPAX lp_start 300 288 POPAX lp_end
-3
arch/arc/include/asm/irqflags-arcv2.h
··· 47 47 #define ISA_INIT_STATUS_BITS (STATUS_IE_MASK | STATUS_AD_MASK | \ 48 48 (ARCV2_IRQ_DEF_PRIO << 1)) 49 49 50 - /* SLEEP needs default irq priority (<=) which can interrupt the doze */ 51 - #define ISA_SLEEP_ARG (0x10 | ARCV2_IRQ_DEF_PRIO) 52 - 53 50 #ifndef __ASSEMBLY__ 54 51 55 52 /*
-2
arch/arc/include/asm/irqflags-compact.h
··· 43 43 44 44 #define ISA_INIT_STATUS_BITS STATUS_IE_MASK 45 45 46 - #define ISA_SLEEP_ARG 0x3 47 - 48 46 #ifndef __ASSEMBLY__ 49 47 50 48 /******************************************************************
+1 -1
arch/arc/include/asm/page.h
··· 85 85 */ 86 86 #define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT) 87 87 88 - #define ARCH_PFN_OFFSET virt_to_pfn(CONFIG_LINUX_LINK_BASE) 88 + #define ARCH_PFN_OFFSET virt_to_pfn(CONFIG_LINUX_RAM_BASE) 89 89 90 90 #ifdef CONFIG_FLATMEM 91 91 #define pfn_valid(pfn) (((pfn) - ARCH_PFN_OFFSET) < max_mapnr)
+10
arch/arc/include/asm/processor.h
··· 27 27 }; 28 28 #endif 29 29 30 + #ifdef CONFIG_ARC_PLAT_EZNPS 31 + struct eznps_dp { 32 + unsigned int eflags; 33 + unsigned int gpa1; 34 + }; 35 + #endif 36 + 30 37 /* Arch specific stuff which needs to be saved per task. 31 38 * However these items are not so important so as to earn a place in 32 39 * struct thread_info ··· 44 37 unsigned long fault_address; /* dbls as brkpt holder as well */ 45 38 #ifdef CONFIG_ARC_FPU_SAVE_RESTORE 46 39 struct arc_fpu fpu; 40 + #endif 41 + #ifdef CONFIG_ARC_PLAT_EZNPS 42 + struct eznps_dp dp; 47 43 #endif 48 44 }; 49 45
+5
arch/arc/include/asm/ptrace.h
··· 19 19 #ifdef CONFIG_ISA_ARCOMPACT 20 20 struct pt_regs { 21 21 22 + #ifdef CONFIG_ARC_PLAT_EZNPS 23 + unsigned long eflags; /* Extended FLAGS */ 24 + unsigned long gpa1; /* General Purpose Aux */ 25 + #endif 26 + 22 27 /* Real registers */ 23 28 unsigned long bta; /* bta_l1, bta_l2, erbta */ 24 29
+12
arch/arc/include/asm/spinlock.h
··· 247 247 248 248 __asm__ __volatile__( 249 249 "1: ex %0, [%1] \n" 250 + #ifdef CONFIG_EZNPS_MTM_EXT 251 + " .word %3 \n" 252 + #endif 250 253 " breq %0, %2, 1b \n" 251 254 : "+&r" (val) 252 255 : "r"(&(lock->slock)), "ir"(__ARCH_SPIN_LOCK_LOCKED__) 256 + #ifdef CONFIG_EZNPS_MTM_EXT 257 + , "i"(CTOP_INST_SCHD_RW) 258 + #endif 253 259 : "memory"); 254 260 255 261 /* ··· 297 291 */ 298 292 smp_mb(); 299 293 294 + /* 295 + * EX is not really required here, a simple STore of 0 suffices. 296 + * However this causes tasklist livelocks in SystemC based SMP virtual 297 + * platforms where the systemc core scheduler uses EX as a cue for 298 + * moving to next core. Do a git log of this file for details 299 + */ 300 300 __asm__ __volatile__( 301 301 " ex %0, [%1] \n" 302 302 : "+r" (val)
+9
arch/arc/include/asm/switch_to.h
··· 26 26 27 27 #endif /* !CONFIG_ARC_FPU_SAVE_RESTORE */ 28 28 29 + #ifdef CONFIG_ARC_PLAT_EZNPS 30 + extern void dp_save_restore(struct task_struct *p, struct task_struct *n); 31 + #define ARC_EZNPS_DP_PREV(p, n) dp_save_restore(p, n) 32 + #else 33 + #define ARC_EZNPS_DP_PREV(p, n) 34 + 35 + #endif /* !CONFIG_ARC_PLAT_EZNPS */ 36 + 29 37 struct task_struct *__switch_to(struct task_struct *p, struct task_struct *n); 30 38 31 39 #define switch_to(prev, next, last) \ 32 40 do { \ 41 + ARC_EZNPS_DP_PREV(prev, next); \ 33 42 ARC_FPU_PREV(prev, next); \ 34 43 last = __switch_to(prev, next);\ 35 44 ARC_FPU_NEXT(next); \
+3 -2
arch/arc/kernel/devtree.c
··· 29 29 { 30 30 if (of_flat_dt_is_compatible(dt_root, "abilis,arc-tb10x")) 31 31 arc_base_baud = 166666666; /* Fixed 166.6MHz clk (TB10x) */ 32 - else if (of_flat_dt_is_compatible(dt_root, "snps,arc-sdp")) 33 - arc_base_baud = 33333333; /* Fixed 33MHz clk (AXS10x) */ 32 + else if (of_flat_dt_is_compatible(dt_root, "snps,arc-sdp") || 33 + of_flat_dt_is_compatible(dt_root, "snps,hsdk")) 34 + arc_base_baud = 33333333; /* Fixed 33MHz clk (AXS10x & HSDK) */ 34 35 else if (of_flat_dt_is_compatible(dt_root, "ezchip,arc-nps")) 35 36 arc_base_baud = 800000000; /* Fixed 800MHz clk (NPS) */ 36 37 else
+11 -11
arch/arc/kernel/entry-compact.S
··· 25 25 * 26 26 * vineetg: Nov 2009 (Everything needed for TIF_RESTORE_SIGMASK) 27 27 * -do_signal()invoked upon TIF_RESTORE_SIGMASK as well 28 - * -Wrappers for sys_{,rt_}sigsuspend() nolonger needed as they don't 28 + * -Wrappers for sys_{,rt_}sigsuspend() no longer needed as they don't 29 29 * need ptregs anymore 30 30 * 31 31 * Vineetg: Oct 2009 32 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 33 + * out. Since we don't do FAKE RTIE for Priv-V, CPU exception state remains 34 34 * active (AE bit enabled). This causes a double fault for a subseq valid 35 35 * exception. Thus FAKE RTIE needed in low level Priv-Violation handler. 36 36 * Instr Error could also cause similar scenario, so same there as well. ··· 59 59 */ 60 60 61 61 #include <linux/errno.h> 62 - #include <linux/linkage.h> /* {EXTRY,EXIT} */ 62 + #include <linux/linkage.h> /* {ENTRY,EXIT} */ 63 63 #include <asm/entry.h> 64 64 #include <asm/irqflags.h> 65 65 ··· 80 80 .align 4 81 81 82 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 83 + * across sections (.vector to .text) we are guaranteed that 'j somewhere' 84 + * will use the 'j limm' form of the instruction as long as somewhere is in 85 85 * a section other than .vector. 86 86 */ 87 87 ··· 105 105 106 106 ; ******************** Exceptions ********************** 107 107 VECTOR EV_MachineCheck ; 0x100, Fatal Machine check (0x20) 108 - VECTOR EV_TLBMissI ; 0x108, Intruction TLB miss (0x21) 108 + VECTOR EV_TLBMissI ; 0x108, Instruction TLB miss (0x21) 109 109 VECTOR EV_TLBMissD ; 0x110, Data TLB miss (0x22) 110 110 VECTOR EV_TLBProtV ; 0x118, Protection Violation (0x23) 111 111 ; or Misaligned Access 112 112 VECTOR EV_PrivilegeV ; 0x120, Privilege Violation (0x24) 113 113 VECTOR EV_Trap ; 0x128, Trap exception (0x25) 114 - VECTOR EV_Extension ; 0x130, Extn Intruction Excp (0x26) 114 + VECTOR EV_Extension ; 0x130, Extn Instruction Excp (0x26) 115 115 116 116 .rept 24 117 117 VECTOR reserved ; Reserved Exceptions ··· 199 199 200 200 ; --------------------------------------------- 201 201 ; User Mode Memory Bus Error Interrupt Handler 202 - ; (Kernel mode memory errors handled via seperate exception vectors) 202 + ; (Kernel mode memory errors handled via separate exception vectors) 203 203 ; --------------------------------------------- 204 204 ENTRY(mem_service) 205 205 ··· 273 273 ;------ (5) Type of Protection Violation? ---------- 274 274 ; 275 275 ; ProtV Hardware Exception is triggered for Access Faults of 2 types 276 - ; -Access Violaton : 00_23_(00|01|02|03)_00 276 + ; -Access Violation : 00_23_(00|01|02|03)_00 277 277 ; x r w r+w 278 278 ; -Unaligned Access : 00_23_04_00 279 279 ; ··· 327 327 328 328 .Lrestore_regs: 329 329 330 - # Interrpts are actually disabled from this point on, but will get 330 + # Interrupts are actually disabled from this point on, but will get 331 331 # reenabled after we return from interrupt/exception. 332 332 # But irq tracer needs to be told now... 333 333 TRACE_ASM_IRQ_ENABLE ··· 335 335 lr r10, [status32] 336 336 337 337 ; Restore REG File. In case multiple Events outstanding, 338 - ; use the same priorty as rtie: EXCPN, L2 IRQ, L1 IRQ, None 338 + ; use the same priority as rtie: EXCPN, L2 IRQ, L1 IRQ, None 339 339 ; Note that we use realtime STATUS32 (not pt_regs->status32) to 340 340 ; decide that. 341 341
+6
arch/arc/kernel/entry.S
··· 92 92 lr r0, [efa] 93 93 mov r1, sp 94 94 95 + ; hardware auto-disables MMU, re-enable it to allow kernel vaddr 96 + ; access for say stack unwinding of modules for crash dumps 97 + lr r3, [ARC_REG_PID] 98 + or r3, r3, MMU_ENABLE 99 + sr r3, [ARC_REG_PID] 100 + 95 101 lsr r3, r2, 8 96 102 bmsk r3, r3, 7 97 103 brne r3, ECR_C_MCHK_DUP_TLB, 1f
+31 -2
arch/arc/kernel/process.c
··· 79 79 return uval; 80 80 } 81 81 82 + #ifdef CONFIG_ISA_ARCV2 83 + 82 84 void arch_cpu_idle(void) 83 85 { 84 - /* sleep, but enable all interrupts before committing */ 86 + /* Re-enable interrupts <= default irq priority before commiting SLEEP */ 87 + const unsigned int arg = 0x10 | ARCV2_IRQ_DEF_PRIO; 88 + 85 89 __asm__ __volatile__( 86 90 "sleep %0 \n" 87 91 : 88 - :"I"(ISA_SLEEP_ARG)); /* can't be "r" has to be embedded const */ 92 + :"I"(arg)); /* can't be "r" has to be embedded const */ 89 93 } 94 + 95 + #elif defined(CONFIG_EZNPS_MTM_EXT) /* ARC700 variant in NPS */ 96 + 97 + void arch_cpu_idle(void) 98 + { 99 + /* only the calling HW thread needs to sleep */ 100 + __asm__ __volatile__( 101 + ".word %0 \n" 102 + : 103 + :"i"(CTOP_INST_HWSCHD_WFT_IE12)); 104 + } 105 + 106 + #else /* ARC700 */ 107 + 108 + void arch_cpu_idle(void) 109 + { 110 + /* sleep, but enable both set E1/E2 (levels of interrutps) before committing */ 111 + __asm__ __volatile__("sleep 0x3 \n"); 112 + } 113 + 114 + #endif 90 115 91 116 asmlinkage void ret_from_fork(void); 92 117 ··· 233 208 * Interrupts enabled 234 209 */ 235 210 regs->status32 = STATUS_U_MASK | STATUS_L_MASK | ISA_INIT_STATUS_BITS; 211 + 212 + #ifdef CONFIG_EZNPS_MTM_EXT 213 + regs->eflags = 0; 214 + #endif 236 215 237 216 /* bogus seed values for debugging */ 238 217 regs->lp_start = 0x10;
+3 -3
arch/arc/kernel/setup.c
··· 385 385 read_arc_build_cfg_regs(); 386 386 arc_init_IRQ(); 387 387 388 - printk(arc_cpu_mumbojumbo(cpu_id, str, sizeof(str))); 388 + pr_info("%s", arc_cpu_mumbojumbo(cpu_id, str, sizeof(str))); 389 389 390 390 arc_mmu_init(); 391 391 arc_cache_init(); 392 392 393 - printk(arc_extn_mumbojumbo(cpu_id, str, sizeof(str))); 394 - printk(arc_platform_smp_cpuinfo()); 393 + pr_info("%s", arc_extn_mumbojumbo(cpu_id, str, sizeof(str))); 394 + pr_info("%s", arc_platform_smp_cpuinfo()); 395 395 396 396 arc_chk_core_config(); 397 397 }
+2 -2
arch/arc/kernel/traps.c
··· 80 80 DO_ERROR_INFO(SIGILL, "Priv Op/Disabled Extn", do_privilege_fault, ILL_PRVOPC) 81 81 DO_ERROR_INFO(SIGILL, "Invalid Extn Insn", do_extension_fault, ILL_ILLOPC) 82 82 DO_ERROR_INFO(SIGILL, "Illegal Insn (or Seq)", insterror_is_error, ILL_ILLOPC) 83 - DO_ERROR_INFO(SIGBUS, "Invalid Mem Access", do_memory_error, BUS_ADRERR) 83 + DO_ERROR_INFO(SIGBUS, "Invalid Mem Access", __weak do_memory_error, BUS_ADRERR) 84 84 DO_ERROR_INFO(SIGTRAP, "Breakpoint Set", trap_is_brkpt, TRAP_BRKPT) 85 85 DO_ERROR_INFO(SIGBUS, "Misaligned Access", do_misaligned_error, BUS_ADRALN) 86 86 ··· 103 103 */ 104 104 void do_machine_check_fault(unsigned long address, struct pt_regs *regs) 105 105 { 106 - die("Machine Check Exception", regs, address); 106 + die("Unhandled Machine Check Exception", regs, address); 107 107 } 108 108 109 109
+4 -1
arch/arc/kernel/troubleshoot.c
··· 140 140 } else if (vec == ECR_V_ITLB_MISS) { 141 141 pr_cont("Insn could not be fetched\n"); 142 142 } else if (vec == ECR_V_MACH_CHK) { 143 - pr_cont("%s\n", (cause_code == 0x0) ? 143 + pr_cont("Machine Check (%s)\n", (cause_code == 0x0) ? 144 144 "Double Fault" : "Other Fatal Err"); 145 145 146 146 } else if (vec == ECR_V_PROTV) { ··· 232 232 unsigned long address) 233 233 { 234 234 current->thread.fault_address = address; 235 + 236 + /* Show fault description */ 237 + pr_info("\n%s\n", str); 235 238 236 239 /* Caller and Callee regs */ 237 240 show_regs(regs);
+73 -10
arch/arc/mm/cache.c
··· 652 652 653 653 #endif /* CONFIG_ARC_HAS_ICACHE */ 654 654 655 - noinline void slc_op(phys_addr_t paddr, unsigned long sz, const int op) 655 + noinline void slc_op_rgn(phys_addr_t paddr, unsigned long sz, const int op) 656 656 { 657 657 #ifdef CONFIG_ISA_ARCV2 658 658 /* ··· 714 714 spin_unlock_irqrestore(&lock, flags); 715 715 #endif 716 716 } 717 + 718 + noinline void slc_op_line(phys_addr_t paddr, unsigned long sz, const int op) 719 + { 720 + #ifdef CONFIG_ISA_ARCV2 721 + /* 722 + * SLC is shared between all cores and concurrent aux operations from 723 + * multiple cores need to be serialized using a spinlock 724 + * A concurrent operation can be silently ignored and/or the old/new 725 + * operation can remain incomplete forever (lockup in SLC_CTRL_BUSY loop 726 + * below) 727 + */ 728 + static DEFINE_SPINLOCK(lock); 729 + 730 + const unsigned long SLC_LINE_MASK = ~(l2_line_sz - 1); 731 + unsigned int ctrl, cmd; 732 + unsigned long flags; 733 + int num_lines; 734 + 735 + spin_lock_irqsave(&lock, flags); 736 + 737 + ctrl = read_aux_reg(ARC_REG_SLC_CTRL); 738 + 739 + /* Don't rely on default value of IM bit */ 740 + if (!(op & OP_FLUSH)) /* i.e. OP_INV */ 741 + ctrl &= ~SLC_CTRL_IM; /* clear IM: Disable flush before Inv */ 742 + else 743 + ctrl |= SLC_CTRL_IM; 744 + 745 + write_aux_reg(ARC_REG_SLC_CTRL, ctrl); 746 + 747 + cmd = op & OP_INV ? ARC_AUX_SLC_IVDL : ARC_AUX_SLC_FLDL; 748 + 749 + sz += paddr & ~SLC_LINE_MASK; 750 + paddr &= SLC_LINE_MASK; 751 + 752 + num_lines = DIV_ROUND_UP(sz, l2_line_sz); 753 + 754 + while (num_lines-- > 0) { 755 + write_aux_reg(cmd, paddr); 756 + paddr += l2_line_sz; 757 + } 758 + 759 + /* Make sure "busy" bit reports correct stataus, see STAR 9001165532 */ 760 + read_aux_reg(ARC_REG_SLC_CTRL); 761 + 762 + while (read_aux_reg(ARC_REG_SLC_CTRL) & SLC_CTRL_BUSY); 763 + 764 + spin_unlock_irqrestore(&lock, flags); 765 + #endif 766 + } 767 + 768 + #define slc_op(paddr, sz, op) slc_op_rgn(paddr, sz, op) 717 769 718 770 noinline static void slc_entire_op(const int op) 719 771 { ··· 1147 1095 */ 1148 1096 noinline void __init arc_ioc_setup(void) 1149 1097 { 1150 - unsigned int ap_sz; 1098 + unsigned int ioc_base, mem_sz; 1151 1099 1152 1100 /* Flush + invalidate + disable L1 dcache */ 1153 1101 __dc_disable(); ··· 1156 1104 if (read_aux_reg(ARC_REG_SLC_BCR)) 1157 1105 slc_entire_op(OP_FLUSH_N_INV); 1158 1106 1159 - /* IOC Aperture start: TDB: handle non default CONFIG_LINUX_LINK_BASE */ 1160 - write_aux_reg(ARC_REG_IO_COH_AP0_BASE, 0x80000); 1161 - 1162 1107 /* 1163 - * IOC Aperture size: 1164 - * decoded as 2 ^ (SIZE + 2) KB: so setting 0x11 implies 512M 1108 + * currently IOC Aperture covers entire DDR 1165 1109 * TBD: fix for PGU + 1GB of low mem 1166 1110 * TBD: fix for PAE 1167 1111 */ 1168 - ap_sz = order_base_2(arc_get_mem_sz()/1024) - 2; 1169 - write_aux_reg(ARC_REG_IO_COH_AP0_SIZE, ap_sz); 1112 + mem_sz = arc_get_mem_sz(); 1170 1113 1114 + if (!is_power_of_2(mem_sz) || mem_sz < 4096) 1115 + panic("IOC Aperture size must be power of 2 larger than 4KB"); 1116 + 1117 + /* 1118 + * IOC Aperture size decoded as 2 ^ (SIZE + 2) KB, 1119 + * so setting 0x11 implies 512MB, 0x12 implies 1GB... 1120 + */ 1121 + write_aux_reg(ARC_REG_IO_COH_AP0_SIZE, order_base_2(mem_sz >> 10) - 2); 1122 + 1123 + /* for now assume kernel base is start of IOC aperture */ 1124 + ioc_base = CONFIG_LINUX_RAM_BASE; 1125 + 1126 + if (ioc_base % mem_sz != 0) 1127 + panic("IOC Aperture start must be aligned to the size of the aperture"); 1128 + 1129 + write_aux_reg(ARC_REG_IO_COH_AP0_BASE, ioc_base >> 12); 1171 1130 write_aux_reg(ARC_REG_IO_COH_PARTIAL, 1); 1172 1131 write_aux_reg(ARC_REG_IO_COH_ENABLE, 1); 1173 1132 ··· 1270 1207 unsigned int __maybe_unused cpu = smp_processor_id(); 1271 1208 char str[256]; 1272 1209 1273 - printk(arc_cache_mumbojumbo(0, str, sizeof(str))); 1210 + pr_info("%s", arc_cache_mumbojumbo(0, str, sizeof(str))); 1274 1211 1275 1212 if (!cpu) 1276 1213 arc_cache_init_master();
+1 -1
arch/arc/mm/fault.c
··· 207 207 /* Are we prepared to handle this kernel fault? 208 208 * 209 209 * (The kernel has valid exception-points in the source 210 - * when it acesses user-memory. When it fails in one 210 + * when it accesses user-memory. When it fails in one 211 211 * of those points, we find it in a table and do a jump 212 212 * to some fixup code that loads an appropriate error 213 213 * code)
+3 -3
arch/arc/mm/init.c
··· 26 26 char empty_zero_page[PAGE_SIZE] __aligned(PAGE_SIZE); 27 27 EXPORT_SYMBOL(empty_zero_page); 28 28 29 - static const unsigned long low_mem_start = CONFIG_LINUX_LINK_BASE; 29 + static const unsigned long low_mem_start = CONFIG_LINUX_RAM_BASE; 30 30 static unsigned long low_mem_sz; 31 31 32 32 #ifdef CONFIG_HIGHMEM ··· 63 63 64 64 if (!low_mem_sz) { 65 65 if (base != low_mem_start) 66 - panic("CONFIG_LINUX_LINK_BASE != DT memory { }"); 66 + panic("CONFIG_LINUX_RAM_BASE != DT memory { }"); 67 67 68 68 low_mem_sz = size; 69 69 in_use = 1; ··· 161 161 * We can't use the helper free_area_init(zones[]) because it uses 162 162 * PAGE_OFFSET to compute the @min_low_pfn which would be wrong 163 163 * when our kernel doesn't start at PAGE_OFFSET, i.e. 164 - * PAGE_OFFSET != CONFIG_LINUX_LINK_BASE 164 + * PAGE_OFFSET != CONFIG_LINUX_RAM_BASE 165 165 */ 166 166 free_area_init_node(0, /* node-id */ 167 167 zones_size, /* num pages per zone */
+1 -4
arch/arc/mm/tlb.c
··· 821 821 char str[256]; 822 822 struct cpuinfo_arc_mmu *mmu = &cpuinfo_arc700[smp_processor_id()].mmu; 823 823 824 - printk(arc_mmu_mumbojumbo(0, str, sizeof(str))); 824 + pr_info("%s", arc_mmu_mumbojumbo(0, str, sizeof(str))); 825 825 826 826 /* 827 827 * Can't be done in processor.h due to header include depenedencies ··· 907 907 int set; 908 908 909 909 local_irq_save(flags); 910 - 911 - /* re-enable the MMU */ 912 - write_aux_reg(ARC_REG_PID, MMU_ENABLE | read_aux_reg(ARC_REG_PID)); 913 910 914 911 /* loop thru all sets of TLB */ 915 912 for (set = 0; set < mmu->sets; set++) {
+9
arch/arc/mm/tlbex.S
··· 274 274 .macro COMMIT_ENTRY_TO_MMU 275 275 #if (CONFIG_ARC_MMU_VER < 4) 276 276 277 + #ifdef CONFIG_EZNPS_MTM_EXT 278 + /* verify if entry for this vaddr+ASID already exists */ 279 + sr TLBProbe, [ARC_REG_TLBCOMMAND] 280 + lr r0, [ARC_REG_TLBINDEX] 281 + bbit0 r0, 31, 88f 282 + #endif 283 + 277 284 /* Get free TLB slot: Set = computed from vaddr, way = random */ 278 285 sr TLBGetIndex, [ARC_REG_TLBCOMMAND] 279 286 ··· 294 287 #else 295 288 sr TLBInsertEntry, [ARC_REG_TLBCOMMAND] 296 289 #endif 290 + 291 + 88: 297 292 .endm 298 293 299 294
+19 -129
arch/arc/plat-axs10x/axs10x.c
··· 80 80 iowrite32(1 << MB_TO_GPIO_IRQ, (void __iomem *) GPIO_INTEN); 81 81 } 82 82 83 - static inline void __init 84 - write_cgu_reg(uint32_t value, void __iomem *reg, void __iomem *lock_reg) 85 - { 86 - unsigned int loops = 128 * 1024, ctr; 87 - 88 - iowrite32(value, reg); 89 - 90 - ctr = loops; 91 - while (((ioread32(lock_reg) & 1) == 1) && ctr--) /* wait for unlock */ 92 - cpu_relax(); 93 - 94 - ctr = loops; 95 - while (((ioread32(lock_reg) & 1) == 0) && ctr--) /* wait for re-lock */ 96 - cpu_relax(); 97 - } 98 - 99 83 static void __init axs10x_print_board_ver(unsigned int creg, const char *str) 100 84 { 101 85 union ver { ··· 298 314 299 315 #ifdef CONFIG_AXS103 300 316 301 - #define AXC003_CGU 0xF0000000 302 317 #define AXC003_CREG 0xF0001000 303 318 #define AXC003_MST_AXI_TUNNEL 0 304 319 #define AXC003_MST_HS38 1 ··· 307 324 #define CREG_CPU_TUN_IO_CTRL (AXC003_CREG + 0x494) 308 325 309 326 310 - union pll_reg { 311 - struct { 312 - #ifdef CONFIG_CPU_BIG_ENDIAN 313 - unsigned int pad:17, noupd:1, bypass:1, edge:1, high:6, low:6; 314 - #else 315 - unsigned int low:6, high:6, edge:1, bypass:1, noupd:1, pad:17; 316 - #endif 317 - }; 318 - unsigned int val; 319 - }; 320 - 321 - static unsigned int __init axs103_get_freq(void) 322 - { 323 - union pll_reg idiv, fbdiv, odiv; 324 - unsigned int f = 33333333; 325 - 326 - idiv.val = ioread32((void __iomem *)AXC003_CGU + 0x80 + 0); 327 - fbdiv.val = ioread32((void __iomem *)AXC003_CGU + 0x80 + 4); 328 - odiv.val = ioread32((void __iomem *)AXC003_CGU + 0x80 + 8); 329 - 330 - if (idiv.bypass != 1) 331 - f = f / (idiv.low + idiv.high); 332 - 333 - if (fbdiv.bypass != 1) 334 - f = f * (fbdiv.low + fbdiv.high); 335 - 336 - if (odiv.bypass != 1) 337 - f = f / (odiv.low + odiv.high); 338 - 339 - f = (f + 500000) / 1000000; /* Rounding */ 340 - return f; 341 - } 342 - 343 - static inline unsigned int __init encode_div(unsigned int id, int upd) 344 - { 345 - union pll_reg div; 346 - 347 - div.val = 0; 348 - 349 - div.noupd = !upd; 350 - div.bypass = id == 1 ? 1 : 0; 351 - div.edge = (id%2 == 0) ? 0 : 1; /* 0 = rising */ 352 - div.low = (id%2 == 0) ? id >> 1 : (id >> 1)+1; 353 - div.high = id >> 1; 354 - 355 - return div.val; 356 - } 357 - 358 - noinline static void __init 359 - axs103_set_freq(unsigned int id, unsigned int fd, unsigned int od) 360 - { 361 - write_cgu_reg(encode_div(id, 0), 362 - (void __iomem *)AXC003_CGU + 0x80 + 0, 363 - (void __iomem *)AXC003_CGU + 0x110); 364 - 365 - write_cgu_reg(encode_div(fd, 0), 366 - (void __iomem *)AXC003_CGU + 0x80 + 4, 367 - (void __iomem *)AXC003_CGU + 0x110); 368 - 369 - write_cgu_reg(encode_div(od, 1), 370 - (void __iomem *)AXC003_CGU + 0x80 + 8, 371 - (void __iomem *)AXC003_CGU + 0x110); 372 - } 373 - 374 327 static void __init axs103_early_init(void) 375 328 { 376 - int offset = fdt_path_offset(initial_boot_params, "/cpu_card/core_clk"); 377 - const struct fdt_property *prop = fdt_get_property(initial_boot_params, 378 - offset, 379 - "clock-frequency", 380 - NULL); 381 - u32 freq = be32_to_cpu(*(u32*)(prop->data)) / 1000000, orig = freq; 382 - 329 + #ifdef CONFIG_ARC_MCIP 383 330 /* 384 331 * AXS103 configurations for SMP/QUAD configurations share device tree 385 - * which defaults to 90 MHz. However recent failures of Quad config 332 + * which defaults to 100 MHz. However recent failures of Quad config 386 333 * revealed P&R timing violations so clamp it down to safe 50 MHz 387 334 * Instead of duplicating defconfig/DT for SMP/QUAD, add a small hack 388 - * 389 - * This hack is really hacky as of now. Fix it properly by getting the 390 - * number of cores as return value of platform's early SMP callback 335 + * of fudging the freq in DT 391 336 */ 392 - #ifdef CONFIG_ARC_MCIP 393 337 unsigned int num_cores = (read_aux_reg(ARC_REG_MCIP_BCR) >> 16) & 0x3F; 394 - if (num_cores > 2) 395 - freq = 50; 396 - #endif 397 - 398 - switch (freq) { 399 - case 33: 400 - axs103_set_freq(1, 1, 1); 401 - break; 402 - case 50: 403 - axs103_set_freq(1, 30, 20); 404 - break; 405 - case 75: 406 - axs103_set_freq(2, 45, 10); 407 - break; 408 - case 90: 409 - axs103_set_freq(2, 54, 10); 410 - break; 411 - case 100: 412 - axs103_set_freq(1, 30, 10); 413 - break; 414 - case 125: 415 - axs103_set_freq(2, 45, 6); 416 - break; 417 - default: 338 + if (num_cores > 2) { 339 + u32 freq = 50, orig; 418 340 /* 419 - * In this case, core_frequency derived from 420 - * DT "clock-frequency" might not match with board value. 421 - * Hence update it to match the board value. 341 + * TODO: use cpu node "cpu-freq" param instead of platform-specific 342 + * "/cpu_card/core_clk" as it works only if we use fixed-clock for cpu. 422 343 */ 423 - freq = axs103_get_freq(); 424 - break; 425 - } 344 + int off = fdt_path_offset(initial_boot_params, "/cpu_card/core_clk"); 345 + const struct fdt_property *prop; 426 346 427 - pr_info("Freq is %dMHz\n", freq); 347 + prop = fdt_get_property(initial_boot_params, off, 348 + "clock-frequency", NULL); 349 + orig = be32_to_cpu(*(u32*)(prop->data)) / 1000000; 428 350 429 - /* Patching .dtb in-place with new core clock value */ 430 - if (freq != orig ) { 431 - freq = cpu_to_be32(freq * 1000000); 432 - fdt_setprop_inplace(initial_boot_params, offset, 433 - "clock-frequency", &freq, sizeof(freq)); 351 + /* Patching .dtb in-place with new core clock value */ 352 + if (freq != orig ) { 353 + freq = cpu_to_be32(freq * 1000000); 354 + fdt_setprop_inplace(initial_boot_params, off, 355 + "clock-frequency", &freq, sizeof(freq)); 356 + } 434 357 } 358 + #endif 435 359 436 360 /* Memory maps already config in pre-bootloader */ 437 361
+24 -2
arch/arc/plat-eznps/Kconfig
··· 12 12 help 13 13 Support for EZchip development platforms, 14 14 based on ARC700 cores. 15 - We handle few flavours: 16 - - Hardware Emulator AKA HE which is FPGA based chasis 15 + We handle few flavors: 16 + - Hardware Emulator AKA HE which is FPGA based chassis 17 17 - Simulator based on MetaWare nSIM 18 18 - NPS400 chip based on ASIC 19 19 ··· 32 32 any of them seem like CPU from Linux point of view. 33 33 All threads within same core share the execution unit of the 34 34 core and HW scheduler round robin between them. 35 + 36 + config EZNPS_MEM_ERROR_ALIGN 37 + bool "ARC-EZchip Memory error as an exception" 38 + depends on EZNPS_MTM_EXT 39 + default n 40 + help 41 + On the real chip of the NPS, user memory errors are handled 42 + as a machine check exception, which is fatal, whereas on 43 + simulator platform for NPS, is handled as a Level 2 interrupt 44 + (just a stock ARC700) which is recoverable. This option makes 45 + simulator behave like hardware. 46 + 47 + config EZNPS_SHARED_AUX_REGS 48 + bool "ARC-EZchip Shared Auxiliary Registers Per Core" 49 + depends on ARC_PLAT_EZNPS 50 + default y 51 + help 52 + On the real chip of the NPS, auxiliary registers are shared between 53 + all the cpus of the core, whereas on simulator platform for NPS, 54 + each cpu has a different set of auxiliary registers. Configuration 55 + should be unset if auxiliary registers are not shared between the cpus 56 + of the core, so there will be a need to initialize them per cpu.
+1 -1
arch/arc/plat-eznps/Makefile
··· 2 2 # Makefile for the linux kernel. 3 3 # 4 4 5 - obj-y := entry.o platform.o 5 + obj-y := entry.o platform.o ctop.o 6 6 obj-$(CONFIG_SMP) += smp.o 7 7 obj-$(CONFIG_EZNPS_MTM_EXT) += mtm.o
+32
arch/arc/plat-eznps/ctop.c
··· 1 + /* 2 + * Copyright(c) 2015 EZchip Technologies. 3 + * 4 + * This program is free software; you can redistribute it and/or modify it 5 + * under the terms and conditions of the GNU General Public License, 6 + * version 2, as published by the Free Software Foundation. 7 + * 8 + * This program is distributed in the hope it will be useful, but WITHOUT 9 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 11 + * more details. 12 + * 13 + * The full GNU General Public License is included in this distribution in 14 + * the file called "COPYING". 15 + */ 16 + 17 + #include <linux/sched.h> 18 + #include <asm/processor.h> 19 + #include <plat/ctop.h> 20 + 21 + void dp_save_restore(struct task_struct *prev, struct task_struct *next) 22 + { 23 + struct eznps_dp *prev_task_dp = &prev->thread.dp; 24 + struct eznps_dp *next_task_dp = &next->thread.dp; 25 + 26 + /* Here we save all Data Plane related auxiliary registers */ 27 + prev_task_dp->eflags = read_aux_reg(CTOP_AUX_EFLAGS); 28 + write_aux_reg(CTOP_AUX_EFLAGS, next_task_dp->eflags); 29 + 30 + prev_task_dp->gpa1 = read_aux_reg(CTOP_AUX_GPA1); 31 + write_aux_reg(CTOP_AUX_GPA1, next_task_dp->gpa1); 32 + }
+1 -1
arch/arc/plat-eznps/entry.S
··· 27 27 .align 1024 ; HW requierment for restart first PC 28 28 29 29 ENTRY(res_service) 30 - #ifdef CONFIG_EZNPS_MTM_EXT 30 + #if defined(CONFIG_EZNPS_MTM_EXT) && defined(CONFIG_EZNPS_SHARED_AUX_REGS) 31 31 ; There is no work for HW thread id != 0 32 32 lr r3, [CTOP_AUX_THREAD_ID] 33 33 cmp r3, 0
+2
arch/arc/plat-eznps/include/plat/ctop.h
··· 39 39 #define CTOP_AUX_LOGIC_CORE_ID (CTOP_AUX_BASE + 0x018) 40 40 #define CTOP_AUX_MT_CTRL (CTOP_AUX_BASE + 0x020) 41 41 #define CTOP_AUX_HW_COMPLY (CTOP_AUX_BASE + 0x024) 42 + #define CTOP_AUX_DPC (CTOP_AUX_BASE + 0x02C) 42 43 #define CTOP_AUX_LPC (CTOP_AUX_BASE + 0x030) 43 44 #define CTOP_AUX_EFLAGS (CTOP_AUX_BASE + 0x080) 44 45 #define CTOP_AUX_IACK (CTOP_AUX_BASE + 0x088) ··· 47 46 #define CTOP_AUX_UDMC (CTOP_AUX_BASE + 0x300) 48 47 49 48 /* EZchip core instructions */ 49 + #define CTOP_INST_HWSCHD_WFT_IE12 0x3E6F7344 50 50 #define CTOP_INST_HWSCHD_OFF_R4 0x3C6F00BF 51 51 #define CTOP_INST_HWSCHD_RESTORE_R4 0x3E6F7103 52 52 #define CTOP_INST_SCHD_RW 0x3E6F7004
+46 -4
arch/arc/plat-eznps/mtm.c
··· 21 21 #include <plat/mtm.h> 22 22 #include <plat/smp.h> 23 23 24 - #define MT_CTRL_HS_CNT 0xFF 24 + #define MT_HS_CNT_MIN 0x01 25 + #define MT_HS_CNT_MAX 0xFF 25 26 #define MT_CTRL_ST_CNT 0xF 26 27 #define NPS_NUM_HW_THREADS 0x10 28 + 29 + static int mtm_hs_ctr = MT_HS_CNT_MAX; 30 + 31 + #ifdef CONFIG_EZNPS_MEM_ERROR_ALIGN 32 + int do_memory_error(unsigned long address, struct pt_regs *regs) 33 + { 34 + die("Invalid Mem Access", regs, address); 35 + 36 + return 1; 37 + } 38 + #endif 27 39 28 40 static void mtm_init_nat(int cpu) 29 41 { ··· 110 98 int i; 111 99 struct nps_host_reg_aux_mt_ctrl mt_ctrl; 112 100 struct nps_host_reg_mtm_cfg mtm_cfg; 101 + struct nps_host_reg_aux_dpc dpc; 102 + 103 + /* 104 + * Initializing dpc register in each CPU. 105 + * Overwriting the init value of the DPC 106 + * register so that CMEM and FMT virtual address 107 + * spaces are accessible, and Data Plane HW 108 + * facilities are enabled. 109 + */ 110 + dpc.ien = 1; 111 + dpc.men = 1; 112 + write_aux_reg(CTOP_AUX_DPC, dpc.value); 113 113 114 114 if (NPS_CPU_TO_THREAD_NUM(cpu) != 0) 115 115 return; ··· 142 118 /* Enable HW schedule, stall counter, mtm */ 143 119 mt_ctrl.value = 0; 144 120 mt_ctrl.hsen = 1; 145 - mt_ctrl.hs_cnt = MT_CTRL_HS_CNT; 146 - mt_ctrl.sten = 1; 147 - mt_ctrl.st_cnt = MT_CTRL_ST_CNT; 121 + mt_ctrl.hs_cnt = mtm_hs_ctr; 148 122 mt_ctrl.mten = 1; 149 123 write_aux_reg(CTOP_AUX_MT_CTRL, mt_ctrl.value); 150 124 ··· 153 131 */ 154 132 cpu_relax(); 155 133 } 134 + 135 + /* Verify and set the value of the mtm hs counter */ 136 + static int __init set_mtm_hs_ctr(char *ctr_str) 137 + { 138 + long hs_ctr; 139 + int ret; 140 + 141 + ret = kstrtol(ctr_str, 0, &hs_ctr); 142 + 143 + if (ret || hs_ctr > MT_HS_CNT_MAX || hs_ctr < MT_HS_CNT_MIN) { 144 + pr_err("** Invalid @nps_mtm_hs_ctr [%d] needs to be [%d:%d] (incl)\n", 145 + hs_ctr, MT_HS_CNT_MIN, MT_HS_CNT_MAX); 146 + return -EINVAL; 147 + } 148 + 149 + mtm_hs_ctr = hs_ctr; 150 + 151 + return 0; 152 + } 153 + early_param("nps_mtm_hs_ctr", set_mtm_hs_ctr);
+9
arch/arc/plat-hsdk/Kconfig
··· 1 + # Copyright (C) 2017 Synopsys, Inc. (www.synopsys.com) 2 + # 3 + # This program is free software; you can redistribute it and/or modify 4 + # it under the terms of the GNU General Public License version 2 as 5 + # published by the Free Software Foundation. 6 + # 7 + 8 + menuconfig ARC_SOC_HSDK 9 + bool "ARC HS Development Kit SOC"
+9
arch/arc/plat-hsdk/Makefile
··· 1 + # 2 + # Copyright (C) 2017 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-y := platform.o
+66
arch/arc/plat-hsdk/platform.c
··· 1 + /* 2 + * ARC HSDK Platform support code 3 + * 4 + * Copyright (C) 2017 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/init.h> 12 + #include <linux/smp.h> 13 + #include <asm/arcregs.h> 14 + #include <asm/io.h> 15 + #include <asm/mach_desc.h> 16 + 17 + #define ARC_CCM_UNUSED_ADDR 0x60000000 18 + 19 + static void __init hsdk_init_per_cpu(unsigned int cpu) 20 + { 21 + /* 22 + * By default ICCM is mapped to 0x7z while this area is used for 23 + * kernel virtual mappings, so move it to currently unused area. 24 + */ 25 + if (cpuinfo_arc700[cpu].iccm.sz) 26 + write_aux_reg(ARC_REG_AUX_ICCM, ARC_CCM_UNUSED_ADDR); 27 + 28 + /* 29 + * By default DCCM is mapped to 0x8z while this area is used by kernel, 30 + * so move it to currently unused area. 31 + */ 32 + if (cpuinfo_arc700[cpu].dccm.sz) 33 + write_aux_reg(ARC_REG_AUX_DCCM, ARC_CCM_UNUSED_ADDR); 34 + } 35 + 36 + #define ARC_PERIPHERAL_BASE 0xf0000000 37 + #define CREG_BASE (ARC_PERIPHERAL_BASE + 0x1000) 38 + #define CREG_PAE (CREG_BASE + 0x180) 39 + #define CREG_PAE_UPDATE (CREG_BASE + 0x194) 40 + 41 + static void __init hsdk_init_early(void) 42 + { 43 + /* 44 + * PAE remapping for DMA clients does not work due to an RTL bug, so 45 + * CREG_PAE register must be programmed to all zeroes, otherwise it 46 + * will cause problems with DMA to/from peripherals even if PAE40 is 47 + * not used. 48 + */ 49 + 50 + /* Default is 1, which means "PAE offset = 4GByte" */ 51 + writel_relaxed(0, (void __iomem *) CREG_PAE); 52 + 53 + /* Really apply settings made above */ 54 + writel(1, (void __iomem *) CREG_PAE_UPDATE); 55 + } 56 + 57 + static const char *hsdk_compat[] __initconst = { 58 + "snps,hsdk", 59 + NULL, 60 + }; 61 + 62 + MACHINE_START(SIMULATION, "hsdk") 63 + .dt_compat = hsdk_compat, 64 + .init_early = hsdk_init_early, 65 + .init_per_cpu = hsdk_init_per_cpu, 66 + MACHINE_END