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

Merge branches 'misc' and 'misc-rc6' into for-linus

+455 -139
+9 -4
Documentation/devicetree/bindings/arm/l2c2x0.txt
··· 68 68 disable if zero. 69 69 - arm,prefetch-offset : Override prefetch offset value. Valid values are 70 70 0-7, 15, 23, and 31. 71 - - arm,shared-override : The default behavior of the pl310 cache controller with 72 - respect to the shareable attribute is to transform "normal memory 73 - non-cacheable transactions" into "cacheable no allocate" (for reads) or 74 - "write through no write allocate" (for writes). 71 + - arm,shared-override : The default behavior of the L220 or PL310 cache 72 + controllers with respect to the shareable attribute is to transform "normal 73 + memory non-cacheable transactions" into "cacheable no allocate" (for reads) 74 + or "write through no write allocate" (for writes). 75 75 On systems where this may cause DMA buffer corruption, this property must be 76 76 specified to indicate that such transforms are precluded. 77 + - arm,parity-enable : enable parity checking on the L2 cache (L220 or PL310). 78 + - arm,parity-disable : disable parity checking on the L2 cache (L220 or PL310). 79 + - arm,outer-sync-disable : disable the outer sync operation on the L2 cache. 80 + Some core tiles, especially ARM PB11MPCore have a faulty L220 cache that 81 + will randomly hang unless outer sync operations are disabled. 77 82 - prefetch-data : Data prefetch. Value: <0> (forcibly disable), <1> 78 83 (forcibly enable), property absent (retain settings set by firmware) 79 84 - prefetch-instr : Instruction prefetch. Value: <0> (forcibly disable),
+25 -5
arch/arm/Kconfig
··· 33 33 select HARDIRQS_SW_RESEND 34 34 select HAVE_ARCH_AUDITSYSCALL if (AEABI && !OABI_COMPAT) 35 35 select HAVE_ARCH_BITREVERSE if (CPU_32v7M || CPU_32v7) && !CPU_32v6 36 - select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL && !CPU_ENDIAN_BE32 37 - select HAVE_ARCH_KGDB if !CPU_ENDIAN_BE32 36 + select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL && !CPU_ENDIAN_BE32 && MMU 37 + select HAVE_ARCH_KGDB if !CPU_ENDIAN_BE32 && MMU 38 38 select HAVE_ARCH_SECCOMP_FILTER if (AEABI && !OABI_COMPAT) 39 39 select HAVE_ARCH_TRACEHOOK 40 + select HAVE_ARM_SMCCC if CPU_V7 40 41 select HAVE_BPF_JIT 41 42 select HAVE_CC_STACKPROTECTOR 42 43 select HAVE_CONTEXT_TRACKING ··· 46 45 select HAVE_DMA_API_DEBUG 47 46 select HAVE_DMA_ATTRS 48 47 select HAVE_DMA_CONTIGUOUS if MMU 49 - select HAVE_DYNAMIC_FTRACE if (!XIP_KERNEL) && !CPU_ENDIAN_BE32 48 + select HAVE_DYNAMIC_FTRACE if (!XIP_KERNEL) && !CPU_ENDIAN_BE32 && MMU 50 49 select HAVE_EFFICIENT_UNALIGNED_ACCESS if (CPU_V6 || CPU_V6K || CPU_V7) && MMU 51 50 select HAVE_FTRACE_MCOUNT_RECORD if (!XIP_KERNEL) 52 51 select HAVE_FUNCTION_GRAPH_TRACER if (!THUMB2_KERNEL) ··· 800 799 bool "Dummy Virtual Machine" if ARCH_MULTI_V7 801 800 select ARM_AMBA 802 801 select ARM_GIC 802 + select ARM_GIC_V2M if PCI_MSI 803 803 select ARM_GIC_V3 804 804 select ARM_PSCI 805 805 select HAVE_ARM_ARCH_TIMER ··· 1424 1422 1425 1423 config BL_SWITCHER 1426 1424 bool "big.LITTLE switcher support" 1427 - depends on BIG_LITTLE && MCPM && HOTPLUG_CPU 1425 + depends on BIG_LITTLE && MCPM && HOTPLUG_CPU && ARM_GIC 1428 1426 select ARM_CPU_SUSPEND 1429 1427 select CPU_PM 1430 1428 help ··· 1483 1481 1484 1482 config ARM_PSCI 1485 1483 bool "Support for the ARM Power State Coordination Interface (PSCI)" 1486 - depends on CPU_V7 1484 + depends on HAVE_ARM_SMCCC 1487 1485 select ARM_PSCI_FW 1488 1486 help 1489 1487 Say Y here if you want Linux to communicate with system firmware ··· 1605 1603 1606 1604 config ARM_ASM_UNIFIED 1607 1605 bool 1606 + 1607 + config ARM_PATCH_IDIV 1608 + bool "Runtime patch udiv/sdiv instructions into __aeabi_{u}idiv()" 1609 + depends on CPU_32v7 && !XIP_KERNEL 1610 + default y 1611 + help 1612 + The ARM compiler inserts calls to __aeabi_idiv() and 1613 + __aeabi_uidiv() when it needs to perform division on signed 1614 + and unsigned integers. Some v7 CPUs have support for the sdiv 1615 + and udiv instructions that can be used to implement those 1616 + functions. 1617 + 1618 + Enabling this option allows the kernel to modify itself to 1619 + replace the first two instructions of these library functions 1620 + with the sdiv or udiv plus "bx lr" instructions when the CPU 1621 + it is running on supports them. Typically this will be faster 1622 + and less power intensive than running the original library 1623 + code to do integer division. 1608 1624 1609 1625 config AEABI 1610 1626 bool "Use the ARM EABI to compile the kernel"
+1 -4
arch/arm/include/asm/bug.h
··· 5 5 #include <linux/types.h> 6 6 #include <asm/opcodes.h> 7 7 8 - #ifdef CONFIG_BUG 9 - 10 8 /* 11 9 * Use a suitable undefined instruction to use for ARM/Thumb2 bug handling. 12 10 * We need to be careful not to conflict with those used by other modules and ··· 45 47 unreachable(); \ 46 48 } while (0) 47 49 48 - #else /* not CONFIG_DEBUG_BUGVERBOSE */ 50 + #else 49 51 50 52 #define __BUG(__file, __line, __value) \ 51 53 do { \ ··· 55 57 #endif /* CONFIG_DEBUG_BUGVERBOSE */ 56 58 57 59 #define HAVE_ARCH_BUG 58 - #endif /* CONFIG_BUG */ 59 60 60 61 #include <asm-generic/bug.h> 61 62
+1 -1
arch/arm/include/asm/cpuidle.h
··· 30 30 struct device_node; 31 31 32 32 struct cpuidle_ops { 33 - int (*suspend)(int cpu, unsigned long arg); 33 + int (*suspend)(unsigned long arg); 34 34 int (*init)(struct device_node *, int cpu); 35 35 }; 36 36
+1 -1
arch/arm/include/asm/hardirq.h
··· 5 5 #include <linux/threads.h> 6 6 #include <asm/irq.h> 7 7 8 - #define NR_IPI 8 8 + #define NR_IPI 7 9 9 10 10 typedef struct { 11 11 unsigned int __softirq_pending;
+1 -1
arch/arm/include/asm/psci.h
··· 16 16 17 17 extern struct smp_operations psci_smp_ops; 18 18 19 - #ifdef CONFIG_ARM_PSCI 19 + #if defined(CONFIG_SMP) && defined(CONFIG_ARM_PSCI) 20 20 bool psci_smp_available(void); 21 21 #else 22 22 static inline bool psci_smp_available(void) { return false; }
+6
arch/arm/include/asm/setup.h
··· 25 25 extern void early_print(const char *str, ...); 26 26 extern void dump_machine_table(void); 27 27 28 + #ifdef CONFIG_ATAGS_PROC 29 + extern void save_atags(const struct tag *tags); 30 + #else 31 + static inline void save_atags(const struct tag *tags) { } 32 + #endif 33 + 28 34 #endif
+2 -2
arch/arm/kernel/Makefile
··· 73 73 obj-$(CONFIG_PERF_EVENTS) += perf_regs.o perf_callchain.o 74 74 obj-$(CONFIG_HW_PERF_EVENTS) += perf_event_xscale.o perf_event_v6.o \ 75 75 perf_event_v7.o 76 - CFLAGS_pj4-cp0.o := -marm 77 76 AFLAGS_iwmmxt.o := -Wa,-mcpu=iwmmxt 78 77 obj-$(CONFIG_ARM_CPU_TOPOLOGY) += topology.o 79 78 obj-$(CONFIG_VDSO) += vdso.o ··· 87 88 88 89 obj-$(CONFIG_ARM_VIRT_EXT) += hyp-stub.o 89 90 ifeq ($(CONFIG_ARM_PSCI),y) 90 - obj-y += psci-call.o 91 91 obj-$(CONFIG_SMP) += psci_smp.o 92 92 endif 93 + 94 + obj-$(CONFIG_HAVE_ARM_SMCCC) += smccc-call.o 93 95 94 96 extra-y := $(head-y) vmlinux.lds
+6
arch/arm/kernel/armksyms.c
··· 16 16 #include <linux/syscalls.h> 17 17 #include <linux/uaccess.h> 18 18 #include <linux/io.h> 19 + #include <linux/arm-smccc.h> 19 20 20 21 #include <asm/checksum.h> 21 22 #include <asm/ftrace.h> ··· 175 174 #ifdef CONFIG_ARM_PATCH_PHYS_VIRT 176 175 EXPORT_SYMBOL(__pv_phys_pfn_offset); 177 176 EXPORT_SYMBOL(__pv_offset); 177 + #endif 178 + 179 + #ifdef CONFIG_HAVE_ARM_SMCCC 180 + EXPORT_SYMBOL(arm_smccc_smc); 181 + EXPORT_SYMBOL(arm_smccc_hvc); 178 182 #endif
-6
arch/arm/kernel/atags.h
··· 1 - #ifdef CONFIG_ATAGS_PROC 2 - extern void save_atags(struct tag *tags); 3 - #else 4 - static inline void save_atags(struct tag *tags) { } 5 - #endif 6 - 7 1 void convert_to_tag_list(struct tag *tags); 8 2 9 3 #ifdef CONFIG_ATAGS
+1 -1
arch/arm/kernel/cpuidle.c
··· 56 56 int cpu = smp_processor_id(); 57 57 58 58 if (cpuidle_ops[cpu].suspend) 59 - ret = cpuidle_ops[cpu].suspend(cpu, index); 59 + ret = cpuidle_ops[cpu].suspend(index); 60 60 61 61 return ret; 62 62 }
+1 -1
arch/arm/kernel/entry-v7m.S
··· 88 88 @ execute the pending work, including reschedule 89 89 get_thread_info tsk 90 90 mov why, #0 91 - b ret_to_user 91 + b ret_to_user_from_irq 92 92 ENDPROC(__pendsv_entry) 93 93 94 94 /*
+4
arch/arm/kernel/pj4-cp0.c
··· 66 66 67 67 __asm__ __volatile__ ( 68 68 "mcr p15, 0, %1, c1, c0, 2\n\t" 69 + #ifdef CONFIG_THUMB2_KERNEL 70 + "isb\n\t" 71 + #else 69 72 "mrc p15, 0, %0, c1, c0, 2\n\t" 70 73 "mov %0, %0\n\t" 71 74 "sub pc, pc, #4\n\t" 75 + #endif 72 76 : "=r" (temp) : "r" (value)); 73 77 } 74 78
-31
arch/arm/kernel/psci-call.S
··· 1 - /* 2 - * This program is free software; you can redistribute it and/or modify 3 - * it under the terms of the GNU General Public License version 2 as 4 - * published by the Free Software Foundation. 5 - * 6 - * This program is distributed in the hope that it will be useful, 7 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 8 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 9 - * GNU General Public License for more details. 10 - * 11 - * Copyright (C) 2015 ARM Limited 12 - * 13 - * Author: Mark Rutland <mark.rutland@arm.com> 14 - */ 15 - 16 - #include <linux/linkage.h> 17 - 18 - #include <asm/opcodes-sec.h> 19 - #include <asm/opcodes-virt.h> 20 - 21 - /* int __invoke_psci_fn_hvc(u32 function_id, u32 arg0, u32 arg1, u32 arg2) */ 22 - ENTRY(__invoke_psci_fn_hvc) 23 - __HVC(0) 24 - bx lr 25 - ENDPROC(__invoke_psci_fn_hvc) 26 - 27 - /* int __invoke_psci_fn_smc(u32 function_id, u32 arg0, u32 arg1, u32 arg2) */ 28 - ENTRY(__invoke_psci_fn_smc) 29 - __SMC(0) 30 - bx lr 31 - ENDPROC(__invoke_psci_fn_smc)
+67
arch/arm/kernel/setup.c
··· 375 375 printk("%s", buf); 376 376 } 377 377 378 + #ifdef CONFIG_ARM_PATCH_IDIV 379 + 380 + static inline u32 __attribute_const__ sdiv_instruction(void) 381 + { 382 + if (IS_ENABLED(CONFIG_THUMB2_KERNEL)) { 383 + /* "sdiv r0, r0, r1" */ 384 + u32 insn = __opcode_thumb32_compose(0xfb90, 0xf0f1); 385 + return __opcode_to_mem_thumb32(insn); 386 + } 387 + 388 + /* "sdiv r0, r0, r1" */ 389 + return __opcode_to_mem_arm(0xe710f110); 390 + } 391 + 392 + static inline u32 __attribute_const__ udiv_instruction(void) 393 + { 394 + if (IS_ENABLED(CONFIG_THUMB2_KERNEL)) { 395 + /* "udiv r0, r0, r1" */ 396 + u32 insn = __opcode_thumb32_compose(0xfbb0, 0xf0f1); 397 + return __opcode_to_mem_thumb32(insn); 398 + } 399 + 400 + /* "udiv r0, r0, r1" */ 401 + return __opcode_to_mem_arm(0xe730f110); 402 + } 403 + 404 + static inline u32 __attribute_const__ bx_lr_instruction(void) 405 + { 406 + if (IS_ENABLED(CONFIG_THUMB2_KERNEL)) { 407 + /* "bx lr; nop" */ 408 + u32 insn = __opcode_thumb32_compose(0x4770, 0x46c0); 409 + return __opcode_to_mem_thumb32(insn); 410 + } 411 + 412 + /* "bx lr" */ 413 + return __opcode_to_mem_arm(0xe12fff1e); 414 + } 415 + 416 + static void __init patch_aeabi_idiv(void) 417 + { 418 + extern void __aeabi_uidiv(void); 419 + extern void __aeabi_idiv(void); 420 + uintptr_t fn_addr; 421 + unsigned int mask; 422 + 423 + mask = IS_ENABLED(CONFIG_THUMB2_KERNEL) ? HWCAP_IDIVT : HWCAP_IDIVA; 424 + if (!(elf_hwcap & mask)) 425 + return; 426 + 427 + pr_info("CPU: div instructions available: patching division code\n"); 428 + 429 + fn_addr = ((uintptr_t)&__aeabi_uidiv) & ~1; 430 + ((u32 *)fn_addr)[0] = udiv_instruction(); 431 + ((u32 *)fn_addr)[1] = bx_lr_instruction(); 432 + flush_icache_range(fn_addr, fn_addr + 8); 433 + 434 + fn_addr = ((uintptr_t)&__aeabi_idiv) & ~1; 435 + ((u32 *)fn_addr)[0] = sdiv_instruction(); 436 + ((u32 *)fn_addr)[1] = bx_lr_instruction(); 437 + flush_icache_range(fn_addr, fn_addr + 8); 438 + } 439 + 440 + #else 441 + static inline void patch_aeabi_idiv(void) { } 442 + #endif 443 + 378 444 static void __init cpuid_init_hwcaps(void) 379 445 { 380 446 int block; ··· 708 642 elf_hwcap = list->elf_hwcap; 709 643 710 644 cpuid_init_hwcaps(); 645 + patch_aeabi_idiv(); 711 646 712 647 #ifndef CONFIG_ARM_THUMB 713 648 elf_hwcap &= ~(HWCAP_THUMB | HWCAP_IDIVT);
+62
arch/arm/kernel/smccc-call.S
··· 1 + /* 2 + * Copyright (c) 2015, Linaro Limited 3 + * 4 + * This software is licensed under the terms of the GNU General Public 5 + * License version 2, as published by the Free Software Foundation, and 6 + * may be copied, distributed, and modified under those terms. 7 + * 8 + * This program is distributed in the hope that it will be useful, 9 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 + * GNU General Public License for more details. 12 + * 13 + */ 14 + #include <linux/linkage.h> 15 + 16 + #include <asm/opcodes-sec.h> 17 + #include <asm/opcodes-virt.h> 18 + #include <asm/unwind.h> 19 + 20 + /* 21 + * Wrap c macros in asm macros to delay expansion until after the 22 + * SMCCC asm macro is expanded. 23 + */ 24 + .macro SMCCC_SMC 25 + __SMC(0) 26 + .endm 27 + 28 + .macro SMCCC_HVC 29 + __HVC(0) 30 + .endm 31 + 32 + .macro SMCCC instr 33 + UNWIND( .fnstart) 34 + mov r12, sp 35 + push {r4-r7} 36 + UNWIND( .save {r4-r7}) 37 + ldm r12, {r4-r7} 38 + \instr 39 + pop {r4-r7} 40 + ldr r12, [sp, #(4 * 4)] 41 + stm r12, {r0-r3} 42 + bx lr 43 + UNWIND( .fnend) 44 + .endm 45 + 46 + /* 47 + * void smccc_smc(unsigned long a0, unsigned long a1, unsigned long a2, 48 + * unsigned long a3, unsigned long a4, unsigned long a5, 49 + * unsigned long a6, unsigned long a7, struct arm_smccc_res *res) 50 + */ 51 + ENTRY(arm_smccc_smc) 52 + SMCCC SMCCC_SMC 53 + ENDPROC(arm_smccc_smc) 54 + 55 + /* 56 + * void smccc_hvc(unsigned long a0, unsigned long a1, unsigned long a2, 57 + * unsigned long a3, unsigned long a4, unsigned long a5, 58 + * unsigned long a6, unsigned long a7, struct arm_smccc_res *res) 59 + */ 60 + ENTRY(arm_smccc_hvc) 61 + SMCCC SMCCC_HVC 62 + ENDPROC(arm_smccc_hvc)
+7 -10
arch/arm/kernel/smp.c
··· 69 69 IPI_TIMER, 70 70 IPI_RESCHEDULE, 71 71 IPI_CALL_FUNC, 72 - IPI_CALL_FUNC_SINGLE, 73 72 IPI_CPU_STOP, 74 73 IPI_IRQ_WORK, 75 74 IPI_COMPLETION, 76 - IPI_CPU_BACKTRACE = 15, 75 + IPI_CPU_BACKTRACE, 76 + /* 77 + * SGI8-15 can be reserved by secure firmware, and thus may 78 + * not be usable by the kernel. Please keep the above limited 79 + * to at most 8 entries. 80 + */ 77 81 }; 78 82 79 83 static DECLARE_COMPLETION(cpu_running); ··· 479 475 S(IPI_TIMER, "Timer broadcast interrupts"), 480 476 S(IPI_RESCHEDULE, "Rescheduling interrupts"), 481 477 S(IPI_CALL_FUNC, "Function call interrupts"), 482 - S(IPI_CALL_FUNC_SINGLE, "Single function call interrupts"), 483 478 S(IPI_CPU_STOP, "CPU stop interrupts"), 484 479 S(IPI_IRQ_WORK, "IRQ work interrupts"), 485 480 S(IPI_COMPLETION, "completion interrupts"), ··· 528 525 529 526 void arch_send_call_function_single_ipi(int cpu) 530 527 { 531 - smp_cross_call(cpumask_of(cpu), IPI_CALL_FUNC_SINGLE); 528 + smp_cross_call(cpumask_of(cpu), IPI_CALL_FUNC); 532 529 } 533 530 534 531 #ifdef CONFIG_IRQ_WORK ··· 620 617 case IPI_CALL_FUNC: 621 618 irq_enter(); 622 619 generic_smp_call_function_interrupt(); 623 - irq_exit(); 624 - break; 625 - 626 - case IPI_CALL_FUNC_SINGLE: 627 - irq_enter(); 628 - generic_smp_call_function_single_interrupt(); 629 620 irq_exit(); 630 621 break; 631 622
+1 -1
arch/arm/kernel/vdso.c
··· 224 224 VM_READ | VM_MAYREAD, 225 225 &vdso_data_mapping); 226 226 227 - return IS_ERR(vma) ? PTR_ERR(vma) : 0; 227 + return PTR_ERR_OR_ZERO(vma); 228 228 } 229 229 230 230 /* assumes mmap_sem is write-locked */
+8
arch/arm/lib/lib1funcs.S
··· 205 205 .endm 206 206 207 207 208 + #ifdef CONFIG_ARM_PATCH_IDIV 209 + .align 3 210 + #endif 211 + 208 212 ENTRY(__udivsi3) 209 213 ENTRY(__aeabi_uidiv) 210 214 UNWIND(.fnstart) ··· 256 252 257 253 UNWIND(.fnend) 258 254 ENDPROC(__umodsi3) 255 + 256 + #ifdef CONFIG_ARM_PATCH_IDIV 257 + .align 3 258 + #endif 259 259 260 260 ENTRY(__divsi3) 261 261 ENTRY(__aeabi_idiv)
+11 -1
arch/arm/mach-omap2/board-generic.c
··· 16 16 #include <linux/of_platform.h> 17 17 #include <linux/irqdomain.h> 18 18 19 + #include <asm/setup.h> 19 20 #include <asm/mach/arch.h> 20 21 21 22 #include "common.h" ··· 77 76 NULL, 78 77 }; 79 78 79 + /* Legacy userspace on Nokia N900 needs ATAGS exported in /proc/atags, 80 + * save them while the data is still not overwritten 81 + */ 82 + static void __init rx51_reserve(void) 83 + { 84 + save_atags((const struct tag *)(PAGE_OFFSET + 0x100)); 85 + omap_reserve(); 86 + } 87 + 80 88 DT_MACHINE_START(OMAP3_N900_DT, "Nokia RX-51 board") 81 - .reserve = omap_reserve, 89 + .reserve = rx51_reserve, 82 90 .map_io = omap3_map_io, 83 91 .init_early = omap3430_init_early, 84 92 .init_machine = omap_generic_init,
+30 -3
arch/arm/mm/cache-l2x0.c
··· 790 790 }; 791 791 792 792 static int __init __l2c_init(const struct l2c_init_data *data, 793 - u32 aux_val, u32 aux_mask, u32 cache_id) 793 + u32 aux_val, u32 aux_mask, u32 cache_id, bool nosync) 794 794 { 795 795 struct outer_cache_fns fns; 796 796 unsigned way_size_bits, ways; ··· 866 866 fns.configure = outer_cache.configure; 867 867 if (data->fixup) 868 868 data->fixup(l2x0_base, cache_id, &fns); 869 + if (nosync) { 870 + pr_info("L2C: disabling outer sync\n"); 871 + fns.sync = NULL; 872 + } 869 873 870 874 /* 871 875 * Check if l2x0 controller is already enabled. If we are booting ··· 929 925 if (data->save) 930 926 data->save(l2x0_base); 931 927 932 - __l2c_init(data, aux_val, aux_mask, cache_id); 928 + __l2c_init(data, aux_val, aux_mask, cache_id, false); 933 929 } 934 930 935 931 #ifdef CONFIG_OF ··· 1064 1060 val |= (dirty - 1) << L2X0_AUX_CTRL_DIRTY_LATENCY_SHIFT; 1065 1061 } 1066 1062 1063 + if (of_property_read_bool(np, "arm,parity-enable")) { 1064 + mask &= ~L2C_AUX_CTRL_PARITY_ENABLE; 1065 + val |= L2C_AUX_CTRL_PARITY_ENABLE; 1066 + } else if (of_property_read_bool(np, "arm,parity-disable")) { 1067 + mask &= ~L2C_AUX_CTRL_PARITY_ENABLE; 1068 + } 1069 + 1070 + if (of_property_read_bool(np, "arm,shared-override")) { 1071 + mask &= ~L2C_AUX_CTRL_SHARED_OVERRIDE; 1072 + val |= L2C_AUX_CTRL_SHARED_OVERRIDE; 1073 + } 1074 + 1067 1075 ret = l2x0_cache_size_of_parse(np, aux_val, aux_mask, &assoc, SZ_256K); 1068 1076 if (ret) 1069 1077 return; ··· 1190 1174 if (of_property_read_bool(np, "arm,shared-override")) { 1191 1175 *aux_val |= L2C_AUX_CTRL_SHARED_OVERRIDE; 1192 1176 *aux_mask &= ~L2C_AUX_CTRL_SHARED_OVERRIDE; 1177 + } 1178 + 1179 + if (of_property_read_bool(np, "arm,parity-enable")) { 1180 + *aux_val |= L2C_AUX_CTRL_PARITY_ENABLE; 1181 + *aux_mask &= ~L2C_AUX_CTRL_PARITY_ENABLE; 1182 + } else if (of_property_read_bool(np, "arm,parity-disable")) { 1183 + *aux_val &= ~L2C_AUX_CTRL_PARITY_ENABLE; 1184 + *aux_mask &= ~L2C_AUX_CTRL_PARITY_ENABLE; 1193 1185 } 1194 1186 1195 1187 prefetch = l2x0_saved_regs.prefetch_ctrl; ··· 1728 1704 struct resource res; 1729 1705 u32 cache_id, old_aux; 1730 1706 u32 cache_level = 2; 1707 + bool nosync = false; 1731 1708 1732 1709 np = of_find_matching_node(NULL, l2x0_ids); 1733 1710 if (!np) ··· 1767 1742 if (cache_level != 2) 1768 1743 pr_err("L2C: device tree specifies invalid cache level\n"); 1769 1744 1745 + nosync = of_property_read_bool(np, "arm,outer-sync-disable"); 1746 + 1770 1747 /* Read back current (default) hardware configuration */ 1771 1748 if (data->save) 1772 1749 data->save(l2x0_base); ··· 1783 1756 else 1784 1757 cache_id = readl_relaxed(l2x0_base + L2X0_CACHE_ID); 1785 1758 1786 - return __l2c_init(data, aux_val, aux_mask, cache_id); 1759 + return __l2c_init(data, aux_val, aux_mask, cache_id, nosync); 1787 1760 } 1788 1761 #endif
+1 -12
arch/arm/mm/cache-uniphier.c
··· 377 377 { /* sentinel */ } 378 378 }; 379 379 380 - static struct device_node * __init uniphier_cache_get_next_level_node( 381 - struct device_node *np) 382 - { 383 - u32 phandle; 384 - 385 - if (of_property_read_u32(np, "next-level-cache", &phandle)) 386 - return NULL; 387 - 388 - return of_find_node_by_phandle(phandle); 389 - } 390 - 391 380 static int __init __uniphier_cache_init(struct device_node *np, 392 381 unsigned int *cache_level) 393 382 { ··· 480 491 * next level cache fails because we want to continue with available 481 492 * cache levels. 482 493 */ 483 - next_np = uniphier_cache_get_next_level_node(np); 494 + next_np = of_find_next_cache_node(np); 484 495 if (next_np) { 485 496 (*cache_level)++; 486 497 ret = __uniphier_cache_init(next_np, cache_level);
+1 -1
arch/arm/mm/mmu.c
··· 572 572 * in the Short-descriptor translation table format descriptors. 573 573 */ 574 574 if (cpu_arch == CPU_ARCH_ARMv7 && 575 - (read_cpuid_ext(CPUID_EXT_MMFR0) & 0xF) == 4) { 575 + (read_cpuid_ext(CPUID_EXT_MMFR0) & 0xF) >= 4) { 576 576 user_pmd_table |= PMD_PXNTABLE; 577 577 } 578 578 #endif
+17 -8
arch/arm/mm/proc-v7.S
··· 274 274 __v7_b15mp_setup: 275 275 __v7_ca17mp_setup: 276 276 mov r10, #0 277 - 1: adr r12, __v7_setup_stack @ the local stack 278 - stmia r12, {r0-r5, lr} @ v7_invalidate_l1 touches r0-r6 277 + 1: adr r0, __v7_setup_stack_ptr 278 + ldr r12, [r0] 279 + add r12, r12, r0 @ the local stack 280 + stmia r12, {r1-r6, lr} @ v7_invalidate_l1 touches r0-r6 279 281 bl v7_invalidate_l1 280 - ldmia r12, {r0-r5, lr} 282 + ldmia r12, {r1-r6, lr} 281 283 #ifdef CONFIG_SMP 282 284 ALT_SMP(mrc p15, 0, r0, c1, c0, 1) 283 285 ALT_UP(mov r0, #(1 << 6)) @ fake it for UP ··· 417 415 #endif /* CONFIG_CPU_PJ4B */ 418 416 419 417 __v7_setup: 420 - adr r12, __v7_setup_stack @ the local stack 421 - stmia r12, {r0-r5, lr} @ v7_invalidate_l1 touches r0-r6 418 + adr r0, __v7_setup_stack_ptr 419 + ldr r12, [r0] 420 + add r12, r12, r0 @ the local stack 421 + stmia r12, {r1-r6, lr} @ v7_invalidate_l1 touches r0-r6 422 422 bl v7_invalidate_l1 423 - ldmia r12, {r0-r5, lr} 423 + ldmia r12, {r1-r6, lr} 424 424 425 425 __v7_setup_cont: 426 426 and r0, r9, #0xff000000 @ ARM? ··· 484 480 orr r0, r0, r6 @ set them 485 481 THUMB( orr r0, r0, #1 << 30 ) @ Thumb exceptions 486 482 ret lr @ return to head.S:__ret 487 - ENDPROC(__v7_setup) 488 483 489 484 .align 2 485 + __v7_setup_stack_ptr: 486 + .word __v7_setup_stack - . 487 + ENDPROC(__v7_setup) 488 + 489 + .bss 490 + .align 2 490 491 __v7_setup_stack: 491 - .space 4 * 7 @ 12 registers 492 + .space 4 * 7 @ 7 registers 492 493 493 494 __INITDATA 494 495
+5 -9
arch/arm/mm/proc-v7m.S
··· 12 12 */ 13 13 #include <linux/linkage.h> 14 14 #include <asm/assembler.h> 15 + #include <asm/memory.h> 15 16 #include <asm/v7m.h> 16 17 #include "proc-macros.S" 17 18 ··· 98 97 mov r5, #0x00800000 99 98 str r5, [r0, V7M_SCB_SHPR3] @ set PendSV priority 100 99 101 - @ SVC to run the kernel in this mode 100 + @ SVC to switch to handler mode. Notice that this requires sp to 101 + @ point to writeable memory because the processor saves 102 + @ some registers to the stack. 102 103 badr r1, 1f 103 104 ldr r5, [r12, #11 * 4] @ read the SVC vector entry 104 105 str r1, [r12, #11 * 4] @ write the temporary SVC vector entry 105 106 mov r6, lr @ save LR 106 - mov r7, sp @ save SP 107 - ldr sp, =__v7m_setup_stack_top 107 + ldr sp, =init_thread_union + THREAD_START_SP 108 108 cpsie i 109 109 svc #0 110 110 1: cpsid i 111 111 str r5, [r12, #11 * 4] @ restore the original SVC vector entry 112 112 mov lr, r6 @ restore LR 113 - mov sp, r7 @ restore SP 114 113 115 114 @ Special-purpose control register 116 115 mov r1, #1 ··· 123 122 str r12, [r0, V7M_SCB_CCR] 124 123 ret lr 125 124 ENDPROC(__v7m_setup) 126 - 127 - .align 2 128 - __v7m_setup_stack: 129 - .space 4 * 8 @ 8 registers 130 - __v7m_setup_stack_top: 131 125 132 126 define_processor_functions v7m, dabort=nommu_early_abort, pabort=legacy_pabort, nommu=1 133 127
+1
arch/arm64/Kconfig
··· 92 92 select SPARSE_IRQ 93 93 select SYSCTL_EXCEPTION_TRACE 94 94 select HAVE_CONTEXT_TRACKING 95 + select HAVE_ARM_SMCCC 95 96 help 96 97 ARM 64-bit (AArch64) Linux support. 97 98
+2 -2
arch/arm64/kernel/Makefile
··· 14 14 arm64-obj-y := debug-monitors.o entry.o irq.o fpsimd.o \ 15 15 entry-fpsimd.o process.o ptrace.o setup.o signal.o \ 16 16 sys.o stacktrace.o time.o traps.o io.o vdso.o \ 17 - hyp-stub.o psci.o psci-call.o cpu_ops.o insn.o \ 17 + hyp-stub.o psci.o cpu_ops.o insn.o \ 18 18 return_address.o cpuinfo.o cpu_errata.o \ 19 19 cpufeature.o alternative.o cacheinfo.o \ 20 - smp.o smp_spin_table.o topology.o 20 + smp.o smp_spin_table.o topology.o smccc-call.o 21 21 22 22 extra-$(CONFIG_EFI) := efi-entry.o 23 23
+5
arch/arm64/kernel/arm64ksyms.c
··· 26 26 #include <linux/syscalls.h> 27 27 #include <linux/uaccess.h> 28 28 #include <linux/io.h> 29 + #include <linux/arm-smccc.h> 29 30 30 31 #include <asm/checksum.h> 31 32 ··· 69 68 #ifdef CONFIG_FUNCTION_TRACER 70 69 EXPORT_SYMBOL(_mcount); 71 70 #endif 71 + 72 + /* arm-smccc */ 73 + EXPORT_SYMBOL(arm_smccc_smc); 74 + EXPORT_SYMBOL(arm_smccc_hvc);
+3
arch/arm64/kernel/asm-offsets.c
··· 28 28 #include <asm/suspend.h> 29 29 #include <asm/vdso_datapage.h> 30 30 #include <linux/kbuild.h> 31 + #include <linux/arm-smccc.h> 31 32 32 33 int main(void) 33 34 { ··· 162 161 DEFINE(SLEEP_SAVE_SP_PHYS, offsetof(struct sleep_save_sp, save_ptr_stash_phys)); 163 162 DEFINE(SLEEP_SAVE_SP_VIRT, offsetof(struct sleep_save_sp, save_ptr_stash)); 164 163 #endif 164 + DEFINE(ARM_SMCCC_RES_X0_OFFS, offsetof(struct arm_smccc_res, a0)); 165 + DEFINE(ARM_SMCCC_RES_X2_OFFS, offsetof(struct arm_smccc_res, a2)); 165 166 return 0; 166 167 }
-28
arch/arm64/kernel/psci-call.S
··· 1 - /* 2 - * This program is free software; you can redistribute it and/or modify 3 - * it under the terms of the GNU General Public License version 2 as 4 - * published by the Free Software Foundation. 5 - * 6 - * This program is distributed in the hope that it will be useful, 7 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 8 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 9 - * GNU General Public License for more details. 10 - * 11 - * Copyright (C) 2015 ARM Limited 12 - * 13 - * Author: Will Deacon <will.deacon@arm.com> 14 - */ 15 - 16 - #include <linux/linkage.h> 17 - 18 - /* int __invoke_psci_fn_hvc(u64 function_id, u64 arg0, u64 arg1, u64 arg2) */ 19 - ENTRY(__invoke_psci_fn_hvc) 20 - hvc #0 21 - ret 22 - ENDPROC(__invoke_psci_fn_hvc) 23 - 24 - /* int __invoke_psci_fn_smc(u64 function_id, u64 arg0, u64 arg1, u64 arg2) */ 25 - ENTRY(__invoke_psci_fn_smc) 26 - smc #0 27 - ret 28 - ENDPROC(__invoke_psci_fn_smc)
+43
arch/arm64/kernel/smccc-call.S
··· 1 + /* 2 + * Copyright (c) 2015, Linaro Limited 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 + * This program is distributed in the hope that it will be useful, 9 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 + * GNU General Public License for more details. 12 + * 13 + */ 14 + #include <linux/linkage.h> 15 + #include <asm/asm-offsets.h> 16 + 17 + .macro SMCCC instr 18 + .cfi_startproc 19 + \instr #0 20 + ldr x4, [sp] 21 + stp x0, x1, [x4, #ARM_SMCCC_RES_X0_OFFS] 22 + stp x2, x3, [x4, #ARM_SMCCC_RES_X2_OFFS] 23 + ret 24 + .cfi_endproc 25 + .endm 26 + 27 + /* 28 + * void arm_smccc_smc(unsigned long a0, unsigned long a1, unsigned long a2, 29 + * unsigned long a3, unsigned long a4, unsigned long a5, 30 + * unsigned long a6, unsigned long a7, struct arm_smccc_res *res) 31 + */ 32 + ENTRY(arm_smccc_smc) 33 + SMCCC smc 34 + ENDPROC(arm_smccc_smc) 35 + 36 + /* 37 + * void arm_smccc_hvc(unsigned long a0, unsigned long a1, unsigned long a2, 38 + * unsigned long a3, unsigned long a4, unsigned long a5, 39 + * unsigned long a6, unsigned long a7, struct arm_smccc_res *res) 40 + */ 41 + ENTRY(arm_smccc_hvc) 42 + SMCCC hvc 43 + ENDPROC(arm_smccc_hvc)
+3
drivers/firmware/Kconfig
··· 173 173 def_bool y 174 174 depends on QCOM_SCM && ARM64 175 175 176 + config HAVE_ARM_SMCCC 177 + bool 178 + 176 179 source "drivers/firmware/broadcom/Kconfig" 177 180 source "drivers/firmware/google/Kconfig" 178 181 source "drivers/firmware/efi/Kconfig"
+21 -2
drivers/firmware/psci.c
··· 13 13 14 14 #define pr_fmt(fmt) "psci: " fmt 15 15 16 + #include <linux/arm-smccc.h> 16 17 #include <linux/errno.h> 17 18 #include <linux/linkage.h> 18 19 #include <linux/of.h> ··· 59 58 60 59 typedef unsigned long (psci_fn)(unsigned long, unsigned long, 61 60 unsigned long, unsigned long); 62 - asmlinkage psci_fn __invoke_psci_fn_hvc; 63 - asmlinkage psci_fn __invoke_psci_fn_smc; 64 61 static psci_fn *invoke_psci_fn; 65 62 66 63 enum psci_function { ··· 104 105 PSCI_0_2_POWER_STATE_MASK; 105 106 106 107 return !(state & ~valid_mask); 108 + } 109 + 110 + static unsigned long __invoke_psci_fn_hvc(unsigned long function_id, 111 + unsigned long arg0, unsigned long arg1, 112 + unsigned long arg2) 113 + { 114 + struct arm_smccc_res res; 115 + 116 + arm_smccc_hvc(function_id, arg0, arg1, arg2, 0, 0, 0, 0, &res); 117 + return res.a0; 118 + } 119 + 120 + static unsigned long __invoke_psci_fn_smc(unsigned long function_id, 121 + unsigned long arg0, unsigned long arg1, 122 + unsigned long arg2) 123 + { 124 + struct arm_smccc_res res; 125 + 126 + arm_smccc_smc(function_id, arg0, arg1, arg2, 0, 0, 0, 0, &res); 127 + return res.a0; 107 128 } 108 129 109 130 static int psci_to_linux_errno(int errno)
+5 -5
drivers/soc/qcom/spm.c
··· 116 116 117 117 static DEFINE_PER_CPU(struct spm_driver_data *, cpu_spm_drv); 118 118 119 - typedef int (*idle_fn)(int); 119 + typedef int (*idle_fn)(void); 120 120 static DEFINE_PER_CPU(idle_fn*, qcom_idle_ops); 121 121 122 122 static inline void spm_register_write(struct spm_driver_data *drv, ··· 179 179 return -1; 180 180 } 181 181 182 - static int qcom_cpu_spc(int cpu) 182 + static int qcom_cpu_spc(void) 183 183 { 184 184 int ret; 185 - struct spm_driver_data *drv = per_cpu(cpu_spm_drv, cpu); 185 + struct spm_driver_data *drv = __this_cpu_read(cpu_spm_drv); 186 186 187 187 spm_set_low_power_mode(drv, PM_SLEEP_MODE_SPC); 188 188 ret = cpu_suspend(0, qcom_pm_collapse); ··· 197 197 return ret; 198 198 } 199 199 200 - static int qcom_idle_enter(int cpu, unsigned long index) 200 + static int qcom_idle_enter(unsigned long index) 201 201 { 202 - return per_cpu(qcom_idle_ops, cpu)[index](cpu); 202 + return __this_cpu_read(qcom_idle_ops)[index](); 203 203 } 204 204 205 205 static const struct of_device_id qcom_idle_state_match[] __initconst = {
+104
include/linux/arm-smccc.h
··· 1 + /* 2 + * Copyright (c) 2015, Linaro Limited 3 + * 4 + * This software is licensed under the terms of the GNU General Public 5 + * License version 2, as published by the Free Software Foundation, and 6 + * may be copied, distributed, and modified under those terms. 7 + * 8 + * This program is distributed in the hope that it will be useful, 9 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 + * GNU General Public License for more details. 12 + * 13 + */ 14 + #ifndef __LINUX_ARM_SMCCC_H 15 + #define __LINUX_ARM_SMCCC_H 16 + 17 + #include <linux/linkage.h> 18 + #include <linux/types.h> 19 + 20 + /* 21 + * This file provides common defines for ARM SMC Calling Convention as 22 + * specified in 23 + * http://infocenter.arm.com/help/topic/com.arm.doc.den0028a/index.html 24 + */ 25 + 26 + #define ARM_SMCCC_STD_CALL 0 27 + #define ARM_SMCCC_FAST_CALL 1 28 + #define ARM_SMCCC_TYPE_SHIFT 31 29 + 30 + #define ARM_SMCCC_SMC_32 0 31 + #define ARM_SMCCC_SMC_64 1 32 + #define ARM_SMCCC_CALL_CONV_SHIFT 30 33 + 34 + #define ARM_SMCCC_OWNER_MASK 0x3F 35 + #define ARM_SMCCC_OWNER_SHIFT 24 36 + 37 + #define ARM_SMCCC_FUNC_MASK 0xFFFF 38 + 39 + #define ARM_SMCCC_IS_FAST_CALL(smc_val) \ 40 + ((smc_val) & (ARM_SMCCC_FAST_CALL << ARM_SMCCC_TYPE_SHIFT)) 41 + #define ARM_SMCCC_IS_64(smc_val) \ 42 + ((smc_val) & (ARM_SMCCC_SMC_64 << ARM_SMCCC_CALL_CONV_SHIFT)) 43 + #define ARM_SMCCC_FUNC_NUM(smc_val) ((smc_val) & ARM_SMCCC_FUNC_MASK) 44 + #define ARM_SMCCC_OWNER_NUM(smc_val) \ 45 + (((smc_val) >> ARM_SMCCC_OWNER_SHIFT) & ARM_SMCCC_OWNER_MASK) 46 + 47 + #define ARM_SMCCC_CALL_VAL(type, calling_convention, owner, func_num) \ 48 + (((type) << ARM_SMCCC_TYPE_SHIFT) | \ 49 + ((calling_convention) << ARM_SMCCC_CALL_CONV_SHIFT) | \ 50 + (((owner) & ARM_SMCCC_OWNER_MASK) << ARM_SMCCC_OWNER_SHIFT) | \ 51 + ((func_num) & ARM_SMCCC_FUNC_MASK)) 52 + 53 + #define ARM_SMCCC_OWNER_ARCH 0 54 + #define ARM_SMCCC_OWNER_CPU 1 55 + #define ARM_SMCCC_OWNER_SIP 2 56 + #define ARM_SMCCC_OWNER_OEM 3 57 + #define ARM_SMCCC_OWNER_STANDARD 4 58 + #define ARM_SMCCC_OWNER_TRUSTED_APP 48 59 + #define ARM_SMCCC_OWNER_TRUSTED_APP_END 49 60 + #define ARM_SMCCC_OWNER_TRUSTED_OS 50 61 + #define ARM_SMCCC_OWNER_TRUSTED_OS_END 63 62 + 63 + /** 64 + * struct arm_smccc_res - Result from SMC/HVC call 65 + * @a0-a3 result values from registers 0 to 3 66 + */ 67 + struct arm_smccc_res { 68 + unsigned long a0; 69 + unsigned long a1; 70 + unsigned long a2; 71 + unsigned long a3; 72 + }; 73 + 74 + /** 75 + * arm_smccc_smc() - make SMC calls 76 + * @a0-a7: arguments passed in registers 0 to 7 77 + * @res: result values from registers 0 to 3 78 + * 79 + * This function is used to make SMC calls following SMC Calling Convention. 80 + * The content of the supplied param are copied to registers 0 to 7 prior 81 + * to the SMC instruction. The return values are updated with the content 82 + * from register 0 to 3 on return from the SMC instruction. 83 + */ 84 + asmlinkage void arm_smccc_smc(unsigned long a0, unsigned long a1, 85 + unsigned long a2, unsigned long a3, unsigned long a4, 86 + unsigned long a5, unsigned long a6, unsigned long a7, 87 + struct arm_smccc_res *res); 88 + 89 + /** 90 + * arm_smccc_hvc() - make HVC calls 91 + * @a0-a7: arguments passed in registers 0 to 7 92 + * @res: result values from registers 0 to 3 93 + * 94 + * This function is used to make HVC calls following SMC Calling 95 + * Convention. The content of the supplied param are copied to registers 0 96 + * to 7 prior to the HVC instruction. The return values are updated with 97 + * the content from register 0 to 3 on return from the HVC instruction. 98 + */ 99 + asmlinkage void arm_smccc_hvc(unsigned long a0, unsigned long a1, 100 + unsigned long a2, unsigned long a3, unsigned long a4, 101 + unsigned long a5, unsigned long a6, unsigned long a7, 102 + struct arm_smccc_res *res); 103 + 104 + #endif /*__LINUX_ARM_SMCCC_H*/