diff options
Diffstat (limited to 'arch')
291 files changed, 2386 insertions, 1118 deletions
diff --git a/arch/alpha/include/asm/irq.h b/arch/alpha/include/asm/irq.h index 4d17cacd1462..432402c8e47f 100644 --- a/arch/alpha/include/asm/irq.h +++ b/arch/alpha/include/asm/irq.h | |||
| @@ -56,15 +56,15 @@ | |||
| 56 | 56 | ||
| 57 | #elif defined(CONFIG_ALPHA_DP264) || \ | 57 | #elif defined(CONFIG_ALPHA_DP264) || \ |
| 58 | defined(CONFIG_ALPHA_LYNX) || \ | 58 | defined(CONFIG_ALPHA_LYNX) || \ |
| 59 | defined(CONFIG_ALPHA_SHARK) || \ | 59 | defined(CONFIG_ALPHA_SHARK) |
| 60 | defined(CONFIG_ALPHA_EIGER) | ||
| 61 | # define NR_IRQS 64 | 60 | # define NR_IRQS 64 |
| 62 | 61 | ||
| 63 | #elif defined(CONFIG_ALPHA_TITAN) | 62 | #elif defined(CONFIG_ALPHA_TITAN) |
| 64 | #define NR_IRQS 80 | 63 | #define NR_IRQS 80 |
| 65 | 64 | ||
| 66 | #elif defined(CONFIG_ALPHA_RAWHIDE) || \ | 65 | #elif defined(CONFIG_ALPHA_RAWHIDE) || \ |
| 67 | defined(CONFIG_ALPHA_TAKARA) | 66 | defined(CONFIG_ALPHA_TAKARA) || \ |
| 67 | defined(CONFIG_ALPHA_EIGER) | ||
| 68 | # define NR_IRQS 128 | 68 | # define NR_IRQS 128 |
| 69 | 69 | ||
| 70 | #elif defined(CONFIG_ALPHA_WILDFIRE) | 70 | #elif defined(CONFIG_ALPHA_WILDFIRE) |
diff --git a/arch/alpha/mm/fault.c b/arch/alpha/mm/fault.c index d73dc473fbb9..188fc9256baf 100644 --- a/arch/alpha/mm/fault.c +++ b/arch/alpha/mm/fault.c | |||
| @@ -78,7 +78,7 @@ __load_new_mm_context(struct mm_struct *next_mm) | |||
| 78 | /* Macro for exception fixup code to access integer registers. */ | 78 | /* Macro for exception fixup code to access integer registers. */ |
| 79 | #define dpf_reg(r) \ | 79 | #define dpf_reg(r) \ |
| 80 | (((unsigned long *)regs)[(r) <= 8 ? (r) : (r) <= 15 ? (r)-16 : \ | 80 | (((unsigned long *)regs)[(r) <= 8 ? (r) : (r) <= 15 ? (r)-16 : \ |
| 81 | (r) <= 18 ? (r)+8 : (r)-10]) | 81 | (r) <= 18 ? (r)+10 : (r)-10]) |
| 82 | 82 | ||
| 83 | asmlinkage void | 83 | asmlinkage void |
| 84 | do_page_fault(unsigned long address, unsigned long mmcsr, | 84 | do_page_fault(unsigned long address, unsigned long mmcsr, |
diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig index 376366a7db81..d750b302d5ab 100644 --- a/arch/arc/Kconfig +++ b/arch/arc/Kconfig | |||
| @@ -191,7 +191,6 @@ config NR_CPUS | |||
| 191 | 191 | ||
| 192 | config ARC_SMP_HALT_ON_RESET | 192 | config ARC_SMP_HALT_ON_RESET |
| 193 | bool "Enable Halt-on-reset boot mode" | 193 | bool "Enable Halt-on-reset boot mode" |
| 194 | default y if ARC_UBOOT_SUPPORT | ||
| 195 | help | 194 | help |
| 196 | In SMP configuration cores can be configured as Halt-on-reset | 195 | In SMP configuration cores can be configured as Halt-on-reset |
| 197 | or they could all start at same time. For Halt-on-reset, non | 196 | or they could all start at same time. For Halt-on-reset, non |
| @@ -407,6 +406,14 @@ config ARC_HAS_ACCL_REGS | |||
| 407 | (also referred to as r58:r59). These can also be used by gcc as GPR so | 406 | (also referred to as r58:r59). These can also be used by gcc as GPR so |
| 408 | kernel needs to save/restore per process | 407 | kernel needs to save/restore per process |
| 409 | 408 | ||
| 409 | config ARC_IRQ_NO_AUTOSAVE | ||
| 410 | bool "Disable hardware autosave regfile on interrupts" | ||
| 411 | default n | ||
| 412 | help | ||
| 413 | On HS cores, taken interrupt auto saves the regfile on stack. | ||
| 414 | This is programmable and can be optionally disabled in which case | ||
| 415 | software INTERRUPT_PROLOGUE/EPILGUE do the needed work | ||
| 416 | |||
| 410 | endif # ISA_ARCV2 | 417 | endif # ISA_ARCV2 |
| 411 | 418 | ||
| 412 | endmenu # "ARC CPU Configuration" | 419 | endmenu # "ARC CPU Configuration" |
| @@ -515,17 +522,6 @@ config ARC_DBG_TLB_PARANOIA | |||
| 515 | 522 | ||
| 516 | endif | 523 | endif |
| 517 | 524 | ||
| 518 | config ARC_UBOOT_SUPPORT | ||
| 519 | bool "Support uboot arg Handling" | ||
| 520 | help | ||
| 521 | ARC Linux by default checks for uboot provided args as pointers to | ||
| 522 | external cmdline or DTB. This however breaks in absence of uboot, | ||
| 523 | when booting from Metaware debugger directly, as the registers are | ||
| 524 | not zeroed out on reset by mdb and/or ARCv2 based cores. The bogus | ||
| 525 | registers look like uboot args to kernel which then chokes. | ||
| 526 | So only enable the uboot arg checking/processing if users are sure | ||
| 527 | of uboot being in play. | ||
| 528 | |||
| 529 | config ARC_BUILTIN_DTB_NAME | 525 | config ARC_BUILTIN_DTB_NAME |
| 530 | string "Built in DTB" | 526 | string "Built in DTB" |
| 531 | help | 527 | help |
diff --git a/arch/arc/configs/nps_defconfig b/arch/arc/configs/nps_defconfig index 6e84060e7c90..621f59407d76 100644 --- a/arch/arc/configs/nps_defconfig +++ b/arch/arc/configs/nps_defconfig | |||
| @@ -31,7 +31,6 @@ CONFIG_ARC_CACHE_LINE_SHIFT=5 | |||
| 31 | # CONFIG_ARC_HAS_LLSC is not set | 31 | # CONFIG_ARC_HAS_LLSC is not set |
| 32 | CONFIG_ARC_KVADDR_SIZE=402 | 32 | CONFIG_ARC_KVADDR_SIZE=402 |
| 33 | CONFIG_ARC_EMUL_UNALIGNED=y | 33 | CONFIG_ARC_EMUL_UNALIGNED=y |
| 34 | CONFIG_ARC_UBOOT_SUPPORT=y | ||
| 35 | CONFIG_PREEMPT=y | 34 | CONFIG_PREEMPT=y |
| 36 | CONFIG_NET=y | 35 | CONFIG_NET=y |
| 37 | CONFIG_UNIX=y | 36 | CONFIG_UNIX=y |
diff --git a/arch/arc/configs/vdk_hs38_defconfig b/arch/arc/configs/vdk_hs38_defconfig index 1e59a2e9c602..e447ace6fa1c 100644 --- a/arch/arc/configs/vdk_hs38_defconfig +++ b/arch/arc/configs/vdk_hs38_defconfig | |||
| @@ -13,7 +13,6 @@ CONFIG_PARTITION_ADVANCED=y | |||
| 13 | CONFIG_ARC_PLAT_AXS10X=y | 13 | CONFIG_ARC_PLAT_AXS10X=y |
| 14 | CONFIG_AXS103=y | 14 | CONFIG_AXS103=y |
| 15 | CONFIG_ISA_ARCV2=y | 15 | CONFIG_ISA_ARCV2=y |
| 16 | CONFIG_ARC_UBOOT_SUPPORT=y | ||
| 17 | CONFIG_ARC_BUILTIN_DTB_NAME="vdk_hs38" | 16 | CONFIG_ARC_BUILTIN_DTB_NAME="vdk_hs38" |
| 18 | CONFIG_PREEMPT=y | 17 | CONFIG_PREEMPT=y |
| 19 | CONFIG_NET=y | 18 | CONFIG_NET=y |
diff --git a/arch/arc/configs/vdk_hs38_smp_defconfig b/arch/arc/configs/vdk_hs38_smp_defconfig index b5c3f6c54b03..c82cdb10aaf4 100644 --- a/arch/arc/configs/vdk_hs38_smp_defconfig +++ b/arch/arc/configs/vdk_hs38_smp_defconfig | |||
| @@ -15,8 +15,6 @@ CONFIG_AXS103=y | |||
| 15 | CONFIG_ISA_ARCV2=y | 15 | CONFIG_ISA_ARCV2=y |
| 16 | CONFIG_SMP=y | 16 | CONFIG_SMP=y |
| 17 | # CONFIG_ARC_TIMERS_64BIT is not set | 17 | # CONFIG_ARC_TIMERS_64BIT is not set |
| 18 | # CONFIG_ARC_SMP_HALT_ON_RESET is not set | ||
| 19 | CONFIG_ARC_UBOOT_SUPPORT=y | ||
| 20 | CONFIG_ARC_BUILTIN_DTB_NAME="vdk_hs38_smp" | 18 | CONFIG_ARC_BUILTIN_DTB_NAME="vdk_hs38_smp" |
| 21 | CONFIG_PREEMPT=y | 19 | CONFIG_PREEMPT=y |
| 22 | CONFIG_NET=y | 20 | CONFIG_NET=y |
diff --git a/arch/arc/include/asm/Kbuild b/arch/arc/include/asm/Kbuild index feed50ce89fa..caa270261521 100644 --- a/arch/arc/include/asm/Kbuild +++ b/arch/arc/include/asm/Kbuild | |||
| @@ -3,23 +3,19 @@ generic-y += bugs.h | |||
| 3 | generic-y += compat.h | 3 | generic-y += compat.h |
| 4 | generic-y += device.h | 4 | generic-y += device.h |
| 5 | generic-y += div64.h | 5 | generic-y += div64.h |
| 6 | generic-y += dma-mapping.h | ||
| 7 | generic-y += emergency-restart.h | 6 | generic-y += emergency-restart.h |
| 8 | generic-y += extable.h | 7 | generic-y += extable.h |
| 9 | generic-y += fb.h | ||
| 10 | generic-y += ftrace.h | 8 | generic-y += ftrace.h |
| 11 | generic-y += hardirq.h | 9 | generic-y += hardirq.h |
| 12 | generic-y += hw_irq.h | 10 | generic-y += hw_irq.h |
| 13 | generic-y += irq_regs.h | 11 | generic-y += irq_regs.h |
| 14 | generic-y += irq_work.h | 12 | generic-y += irq_work.h |
| 15 | generic-y += kmap_types.h | ||
| 16 | generic-y += local.h | 13 | generic-y += local.h |
| 17 | generic-y += local64.h | 14 | generic-y += local64.h |
| 18 | generic-y += mcs_spinlock.h | 15 | generic-y += mcs_spinlock.h |
| 19 | generic-y += mm-arch-hooks.h | 16 | generic-y += mm-arch-hooks.h |
| 20 | generic-y += msi.h | 17 | generic-y += msi.h |
| 21 | generic-y += parport.h | 18 | generic-y += parport.h |
| 22 | generic-y += pci.h | ||
| 23 | generic-y += percpu.h | 19 | generic-y += percpu.h |
| 24 | generic-y += preempt.h | 20 | generic-y += preempt.h |
| 25 | generic-y += topology.h | 21 | generic-y += topology.h |
diff --git a/arch/arc/include/asm/arcregs.h b/arch/arc/include/asm/arcregs.h index 49bfbd879caa..a27eafdc8260 100644 --- a/arch/arc/include/asm/arcregs.h +++ b/arch/arc/include/asm/arcregs.h | |||
| @@ -151,6 +151,14 @@ struct bcr_isa_arcv2 { | |||
| 151 | #endif | 151 | #endif |
| 152 | }; | 152 | }; |
| 153 | 153 | ||
| 154 | struct bcr_uarch_build_arcv2 { | ||
| 155 | #ifdef CONFIG_CPU_BIG_ENDIAN | ||
| 156 | unsigned int pad:8, prod:8, maj:8, min:8; | ||
| 157 | #else | ||
| 158 | unsigned int min:8, maj:8, prod:8, pad:8; | ||
| 159 | #endif | ||
| 160 | }; | ||
| 161 | |||
| 154 | struct bcr_mpy { | 162 | struct bcr_mpy { |
| 155 | #ifdef CONFIG_CPU_BIG_ENDIAN | 163 | #ifdef CONFIG_CPU_BIG_ENDIAN |
| 156 | unsigned int pad:8, x1616:8, dsp:4, cycles:2, type:2, ver:8; | 164 | unsigned int pad:8, x1616:8, dsp:4, cycles:2, type:2, ver:8; |
| @@ -216,6 +224,14 @@ struct bcr_fp_arcv2 { | |||
| 216 | #endif | 224 | #endif |
| 217 | }; | 225 | }; |
| 218 | 226 | ||
| 227 | struct bcr_actionpoint { | ||
| 228 | #ifdef CONFIG_CPU_BIG_ENDIAN | ||
| 229 | unsigned int pad:21, min:1, num:2, ver:8; | ||
| 230 | #else | ||
| 231 | unsigned int ver:8, num:2, min:1, pad:21; | ||
| 232 | #endif | ||
| 233 | }; | ||
| 234 | |||
| 219 | #include <soc/arc/timers.h> | 235 | #include <soc/arc/timers.h> |
| 220 | 236 | ||
| 221 | struct bcr_bpu_arcompact { | 237 | struct bcr_bpu_arcompact { |
| @@ -283,7 +299,7 @@ struct cpuinfo_arc_cache { | |||
| 283 | }; | 299 | }; |
| 284 | 300 | ||
| 285 | struct cpuinfo_arc_bpu { | 301 | struct cpuinfo_arc_bpu { |
| 286 | unsigned int ver, full, num_cache, num_pred; | 302 | unsigned int ver, full, num_cache, num_pred, ret_stk; |
| 287 | }; | 303 | }; |
| 288 | 304 | ||
| 289 | struct cpuinfo_arc_ccm { | 305 | struct cpuinfo_arc_ccm { |
| @@ -302,7 +318,7 @@ struct cpuinfo_arc { | |||
| 302 | struct { | 318 | struct { |
| 303 | unsigned int swap:1, norm:1, minmax:1, barrel:1, crc:1, swape:1, pad1:2, | 319 | unsigned int swap:1, norm:1, minmax:1, barrel:1, crc:1, swape:1, pad1:2, |
| 304 | fpu_sp:1, fpu_dp:1, dual:1, dual_enb:1, pad2:4, | 320 | fpu_sp:1, fpu_dp:1, dual:1, dual_enb:1, pad2:4, |
| 305 | debug:1, ap:1, smart:1, rtt:1, pad3:4, | 321 | ap_num:4, ap_full:1, smart:1, rtt:1, pad3:1, |
| 306 | timer0:1, timer1:1, rtc:1, gfrc:1, pad4:4; | 322 | timer0:1, timer1:1, rtc:1, gfrc:1, pad4:4; |
| 307 | } extn; | 323 | } extn; |
| 308 | struct bcr_mpy extn_mpy; | 324 | struct bcr_mpy extn_mpy; |
diff --git a/arch/arc/include/asm/bitops.h b/arch/arc/include/asm/bitops.h index ee9246184033..202b74c339f0 100644 --- a/arch/arc/include/asm/bitops.h +++ b/arch/arc/include/asm/bitops.h | |||
| @@ -340,7 +340,7 @@ static inline __attribute__ ((const)) int __fls(unsigned long x) | |||
| 340 | /* | 340 | /* |
| 341 | * __ffs: Similar to ffs, but zero based (0-31) | 341 | * __ffs: Similar to ffs, but zero based (0-31) |
| 342 | */ | 342 | */ |
| 343 | static inline __attribute__ ((const)) int __ffs(unsigned long word) | 343 | static inline __attribute__ ((const)) unsigned long __ffs(unsigned long word) |
| 344 | { | 344 | { |
| 345 | if (!word) | 345 | if (!word) |
| 346 | return word; | 346 | return word; |
| @@ -400,9 +400,9 @@ static inline __attribute__ ((const)) int ffs(unsigned long x) | |||
| 400 | /* | 400 | /* |
| 401 | * __ffs: Similar to ffs, but zero based (0-31) | 401 | * __ffs: Similar to ffs, but zero based (0-31) |
| 402 | */ | 402 | */ |
| 403 | static inline __attribute__ ((const)) int __ffs(unsigned long x) | 403 | static inline __attribute__ ((const)) unsigned long __ffs(unsigned long x) |
| 404 | { | 404 | { |
| 405 | int n; | 405 | unsigned long n; |
| 406 | 406 | ||
| 407 | asm volatile( | 407 | asm volatile( |
| 408 | " ffs.f %0, %1 \n" /* 0:31; 31(Z) if src 0 */ | 408 | " ffs.f %0, %1 \n" /* 0:31; 31(Z) if src 0 */ |
diff --git a/arch/arc/include/asm/cache.h b/arch/arc/include/asm/cache.h index f393b663413e..2ad77fb43639 100644 --- a/arch/arc/include/asm/cache.h +++ b/arch/arc/include/asm/cache.h | |||
| @@ -52,6 +52,17 @@ | |||
| 52 | #define cache_line_size() SMP_CACHE_BYTES | 52 | #define cache_line_size() SMP_CACHE_BYTES |
| 53 | #define ARCH_DMA_MINALIGN SMP_CACHE_BYTES | 53 | #define ARCH_DMA_MINALIGN SMP_CACHE_BYTES |
| 54 | 54 | ||
| 55 | /* | ||
| 56 | * Make sure slab-allocated buffers are 64-bit aligned when atomic64_t uses | ||
| 57 | * ARCv2 64-bit atomics (LLOCKD/SCONDD). This guarantess runtime 64-bit | ||
| 58 | * alignment for any atomic64_t embedded in buffer. | ||
| 59 | * Default ARCH_SLAB_MINALIGN is __alignof__(long long) which has a relaxed | ||
| 60 | * value of 4 (and not 8) in ARC ABI. | ||
| 61 | */ | ||
| 62 | #if defined(CONFIG_ARC_HAS_LL64) && defined(CONFIG_ARC_HAS_LLSC) | ||
| 63 | #define ARCH_SLAB_MINALIGN 8 | ||
| 64 | #endif | ||
| 65 | |||
| 55 | extern void arc_cache_init(void); | 66 | extern void arc_cache_init(void); |
| 56 | extern char *arc_cache_mumbojumbo(int cpu_id, char *buf, int len); | 67 | extern char *arc_cache_mumbojumbo(int cpu_id, char *buf, int len); |
| 57 | extern void read_decode_cache_bcr(void); | 68 | extern void read_decode_cache_bcr(void); |
diff --git a/arch/arc/include/asm/entry-arcv2.h b/arch/arc/include/asm/entry-arcv2.h index 309f4e6721b3..225e7df2d8ed 100644 --- a/arch/arc/include/asm/entry-arcv2.h +++ b/arch/arc/include/asm/entry-arcv2.h | |||
| @@ -17,6 +17,33 @@ | |||
| 17 | ; | 17 | ; |
| 18 | ; Now manually save: r12, sp, fp, gp, r25 | 18 | ; Now manually save: r12, sp, fp, gp, r25 |
| 19 | 19 | ||
| 20 | #ifdef CONFIG_ARC_IRQ_NO_AUTOSAVE | ||
| 21 | .ifnc \called_from, exception | ||
| 22 | st.as r9, [sp, -10] ; save r9 in it's final stack slot | ||
| 23 | sub sp, sp, 12 ; skip JLI, LDI, EI | ||
| 24 | |||
| 25 | PUSH lp_count | ||
| 26 | PUSHAX lp_start | ||
| 27 | PUSHAX lp_end | ||
| 28 | PUSH blink | ||
| 29 | |||
| 30 | PUSH r11 | ||
| 31 | PUSH r10 | ||
| 32 | |||
| 33 | sub sp, sp, 4 ; skip r9 | ||
| 34 | |||
| 35 | PUSH r8 | ||
| 36 | PUSH r7 | ||
| 37 | PUSH r6 | ||
| 38 | PUSH r5 | ||
| 39 | PUSH r4 | ||
| 40 | PUSH r3 | ||
| 41 | PUSH r2 | ||
| 42 | PUSH r1 | ||
| 43 | PUSH r0 | ||
| 44 | .endif | ||
| 45 | #endif | ||
| 46 | |||
| 20 | #ifdef CONFIG_ARC_HAS_ACCL_REGS | 47 | #ifdef CONFIG_ARC_HAS_ACCL_REGS |
| 21 | PUSH r59 | 48 | PUSH r59 |
| 22 | PUSH r58 | 49 | PUSH r58 |
| @@ -86,6 +113,33 @@ | |||
| 86 | POP r59 | 113 | POP r59 |
| 87 | #endif | 114 | #endif |
| 88 | 115 | ||
| 116 | #ifdef CONFIG_ARC_IRQ_NO_AUTOSAVE | ||
| 117 | .ifnc \called_from, exception | ||
| 118 | POP r0 | ||
| 119 | POP r1 | ||
| 120 | POP r2 | ||
| 121 | POP r3 | ||
| 122 | POP r4 | ||
| 123 | POP r5 | ||
| 124 | POP r6 | ||
| 125 | POP r7 | ||
| 126 | POP r8 | ||
| 127 | POP r9 | ||
| 128 | POP r10 | ||
| 129 | POP r11 | ||
| 130 | |||
| 131 | POP blink | ||
| 132 | POPAX lp_end | ||
| 133 | POPAX lp_start | ||
| 134 | |||
| 135 | POP r9 | ||
| 136 | mov lp_count, r9 | ||
| 137 | |||
| 138 | add sp, sp, 12 ; skip JLI, LDI, EI | ||
| 139 | ld.as r9, [sp, -10] ; reload r9 which got clobbered | ||
| 140 | .endif | ||
| 141 | #endif | ||
| 142 | |||
| 89 | .endm | 143 | .endm |
| 90 | 144 | ||
| 91 | /*------------------------------------------------------------------------*/ | 145 | /*------------------------------------------------------------------------*/ |
diff --git a/arch/arc/include/asm/perf_event.h b/arch/arc/include/asm/perf_event.h index 9185541035cc..6958545390f0 100644 --- a/arch/arc/include/asm/perf_event.h +++ b/arch/arc/include/asm/perf_event.h | |||
| @@ -103,7 +103,8 @@ static const char * const arc_pmu_ev_hw_map[] = { | |||
| 103 | 103 | ||
| 104 | /* counts condition */ | 104 | /* counts condition */ |
| 105 | [PERF_COUNT_HW_INSTRUCTIONS] = "iall", | 105 | [PERF_COUNT_HW_INSTRUCTIONS] = "iall", |
| 106 | [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = "ijmp", /* Excludes ZOL jumps */ | 106 | /* All jump instructions that are taken */ |
| 107 | [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = "ijmptak", | ||
| 107 | [PERF_COUNT_ARC_BPOK] = "bpok", /* NP-NT, PT-T, PNT-NT */ | 108 | [PERF_COUNT_ARC_BPOK] = "bpok", /* NP-NT, PT-T, PNT-NT */ |
| 108 | #ifdef CONFIG_ISA_ARCV2 | 109 | #ifdef CONFIG_ISA_ARCV2 |
| 109 | [PERF_COUNT_HW_BRANCH_MISSES] = "bpmp", | 110 | [PERF_COUNT_HW_BRANCH_MISSES] = "bpmp", |
diff --git a/arch/arc/include/asm/uaccess.h b/arch/arc/include/asm/uaccess.h index c9173c02081c..eabc3efa6c6d 100644 --- a/arch/arc/include/asm/uaccess.h +++ b/arch/arc/include/asm/uaccess.h | |||
| @@ -207,7 +207,7 @@ raw_copy_from_user(void *to, const void __user *from, unsigned long n) | |||
| 207 | */ | 207 | */ |
| 208 | "=&r" (tmp), "+r" (to), "+r" (from) | 208 | "=&r" (tmp), "+r" (to), "+r" (from) |
| 209 | : | 209 | : |
| 210 | : "lp_count", "lp_start", "lp_end", "memory"); | 210 | : "lp_count", "memory"); |
| 211 | 211 | ||
| 212 | return n; | 212 | return n; |
| 213 | } | 213 | } |
| @@ -433,7 +433,7 @@ raw_copy_to_user(void __user *to, const void *from, unsigned long n) | |||
| 433 | */ | 433 | */ |
| 434 | "=&r" (tmp), "+r" (to), "+r" (from) | 434 | "=&r" (tmp), "+r" (to), "+r" (from) |
| 435 | : | 435 | : |
| 436 | : "lp_count", "lp_start", "lp_end", "memory"); | 436 | : "lp_count", "memory"); |
| 437 | 437 | ||
| 438 | return n; | 438 | return n; |
| 439 | } | 439 | } |
| @@ -653,7 +653,7 @@ static inline unsigned long __arc_clear_user(void __user *to, unsigned long n) | |||
| 653 | " .previous \n" | 653 | " .previous \n" |
| 654 | : "+r"(d_char), "+r"(res) | 654 | : "+r"(d_char), "+r"(res) |
| 655 | : "i"(0) | 655 | : "i"(0) |
| 656 | : "lp_count", "lp_start", "lp_end", "memory"); | 656 | : "lp_count", "memory"); |
| 657 | 657 | ||
| 658 | return res; | 658 | return res; |
| 659 | } | 659 | } |
| @@ -686,7 +686,7 @@ __arc_strncpy_from_user(char *dst, const char __user *src, long count) | |||
| 686 | " .previous \n" | 686 | " .previous \n" |
| 687 | : "+r"(res), "+r"(dst), "+r"(src), "=r"(val) | 687 | : "+r"(res), "+r"(dst), "+r"(src), "=r"(val) |
| 688 | : "g"(-EFAULT), "r"(count) | 688 | : "g"(-EFAULT), "r"(count) |
| 689 | : "lp_count", "lp_start", "lp_end", "memory"); | 689 | : "lp_count", "memory"); |
| 690 | 690 | ||
| 691 | return res; | 691 | return res; |
| 692 | } | 692 | } |
diff --git a/arch/arc/kernel/entry-arcv2.S b/arch/arc/kernel/entry-arcv2.S index cc558a25b8fa..562089d62d9d 100644 --- a/arch/arc/kernel/entry-arcv2.S +++ b/arch/arc/kernel/entry-arcv2.S | |||
| @@ -209,7 +209,9 @@ restore_regs: | |||
| 209 | ;####### Return from Intr ####### | 209 | ;####### Return from Intr ####### |
| 210 | 210 | ||
| 211 | debug_marker_l1: | 211 | debug_marker_l1: |
| 212 | bbit1.nt r0, STATUS_DE_BIT, .Lintr_ret_to_delay_slot | 212 | ; bbit1.nt r0, STATUS_DE_BIT, .Lintr_ret_to_delay_slot |
| 213 | btst r0, STATUS_DE_BIT ; Z flag set if bit clear | ||
| 214 | bnz .Lintr_ret_to_delay_slot ; branch if STATUS_DE_BIT set | ||
| 213 | 215 | ||
| 214 | .Lisr_ret_fast_path: | 216 | .Lisr_ret_fast_path: |
| 215 | ; Handle special case #1: (Entry via Exception, Return via IRQ) | 217 | ; Handle special case #1: (Entry via Exception, Return via IRQ) |
diff --git a/arch/arc/kernel/head.S b/arch/arc/kernel/head.S index 8b90d25a15cc..30e090625916 100644 --- a/arch/arc/kernel/head.S +++ b/arch/arc/kernel/head.S | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | #include <asm/entry.h> | 17 | #include <asm/entry.h> |
| 18 | #include <asm/arcregs.h> | 18 | #include <asm/arcregs.h> |
| 19 | #include <asm/cache.h> | 19 | #include <asm/cache.h> |
| 20 | #include <asm/irqflags.h> | ||
| 20 | 21 | ||
| 21 | .macro CPU_EARLY_SETUP | 22 | .macro CPU_EARLY_SETUP |
| 22 | 23 | ||
| @@ -47,6 +48,15 @@ | |||
| 47 | sr r5, [ARC_REG_DC_CTRL] | 48 | sr r5, [ARC_REG_DC_CTRL] |
| 48 | 49 | ||
| 49 | 1: | 50 | 1: |
| 51 | |||
| 52 | #ifdef CONFIG_ISA_ARCV2 | ||
| 53 | ; Unaligned access is disabled at reset, so re-enable early as | ||
| 54 | ; gcc 7.3.1 (ARC GNU 2018.03) onwards generates unaligned access | ||
| 55 | ; by default | ||
| 56 | lr r5, [status32] | ||
| 57 | bset r5, r5, STATUS_AD_BIT | ||
| 58 | kflag r5 | ||
| 59 | #endif | ||
| 50 | .endm | 60 | .endm |
| 51 | 61 | ||
| 52 | .section .init.text, "ax",@progbits | 62 | .section .init.text, "ax",@progbits |
| @@ -90,15 +100,13 @@ ENTRY(stext) | |||
| 90 | st.ab 0, [r5, 4] | 100 | st.ab 0, [r5, 4] |
| 91 | 1: | 101 | 1: |
| 92 | 102 | ||
| 93 | #ifdef CONFIG_ARC_UBOOT_SUPPORT | ||
| 94 | ; Uboot - kernel ABI | 103 | ; Uboot - kernel ABI |
| 95 | ; r0 = [0] No uboot interaction, [1] cmdline in r2, [2] DTB in r2 | 104 | ; r0 = [0] No uboot interaction, [1] cmdline in r2, [2] DTB in r2 |
| 96 | ; r1 = magic number (board identity, unused as of now | 105 | ; r1 = magic number (always zero as of now) |
| 97 | ; r2 = pointer to uboot provided cmdline or external DTB in mem | 106 | ; r2 = pointer to uboot provided cmdline or external DTB in mem |
| 98 | ; These are handled later in setup_arch() | 107 | ; These are handled later in handle_uboot_args() |
| 99 | st r0, [@uboot_tag] | 108 | st r0, [@uboot_tag] |
| 100 | st r2, [@uboot_arg] | 109 | st r2, [@uboot_arg] |
| 101 | #endif | ||
| 102 | 110 | ||
| 103 | ; setup "current" tsk and optionally cache it in dedicated r25 | 111 | ; setup "current" tsk and optionally cache it in dedicated r25 |
| 104 | mov r9, @init_task | 112 | mov r9, @init_task |
diff --git a/arch/arc/kernel/intc-arcv2.c b/arch/arc/kernel/intc-arcv2.c index 067ea362fb3e..cf18b3e5a934 100644 --- a/arch/arc/kernel/intc-arcv2.c +++ b/arch/arc/kernel/intc-arcv2.c | |||
| @@ -49,11 +49,13 @@ void arc_init_IRQ(void) | |||
| 49 | 49 | ||
| 50 | *(unsigned int *)&ictrl = 0; | 50 | *(unsigned int *)&ictrl = 0; |
| 51 | 51 | ||
| 52 | #ifndef CONFIG_ARC_IRQ_NO_AUTOSAVE | ||
| 52 | ictrl.save_nr_gpr_pairs = 6; /* r0 to r11 (r12 saved manually) */ | 53 | ictrl.save_nr_gpr_pairs = 6; /* r0 to r11 (r12 saved manually) */ |
| 53 | ictrl.save_blink = 1; | 54 | ictrl.save_blink = 1; |
| 54 | ictrl.save_lp_regs = 1; /* LP_COUNT, LP_START, LP_END */ | 55 | ictrl.save_lp_regs = 1; /* LP_COUNT, LP_START, LP_END */ |
| 55 | ictrl.save_u_to_u = 0; /* user ctxt saved on kernel stack */ | 56 | ictrl.save_u_to_u = 0; /* user ctxt saved on kernel stack */ |
| 56 | ictrl.save_idx_regs = 1; /* JLI, LDI, EI */ | 57 | ictrl.save_idx_regs = 1; /* JLI, LDI, EI */ |
| 58 | #endif | ||
| 57 | 59 | ||
| 58 | WRITE_AUX(AUX_IRQ_CTRL, ictrl); | 60 | WRITE_AUX(AUX_IRQ_CTRL, ictrl); |
| 59 | 61 | ||
diff --git a/arch/arc/kernel/perf_event.c b/arch/arc/kernel/perf_event.c index 8aec462d90fb..861a8aea51f9 100644 --- a/arch/arc/kernel/perf_event.c +++ b/arch/arc/kernel/perf_event.c | |||
| @@ -1,15 +1,10 @@ | |||
| 1 | /* | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | * Linux performance counter support for ARC700 series | 2 | // |
| 3 | * | 3 | // Linux performance counter support for ARC CPUs. |
| 4 | * Copyright (C) 2013-2015 Synopsys, Inc. (www.synopsys.com) | 4 | // This code is inspired by the perf support of various other architectures. |
| 5 | * | 5 | // |
| 6 | * This code is inspired by the perf support of various other architectures. | 6 | // Copyright (C) 2013-2018 Synopsys, Inc. (www.synopsys.com) |
| 7 | * | 7 | |
| 8 | * This program is free software; you can redistribute it and/or modify | ||
| 9 | * it under the terms of the GNU General Public License version 2 as | ||
| 10 | * published by the Free Software Foundation. | ||
| 11 | * | ||
| 12 | */ | ||
| 13 | #include <linux/errno.h> | 8 | #include <linux/errno.h> |
| 14 | #include <linux/interrupt.h> | 9 | #include <linux/interrupt.h> |
| 15 | #include <linux/module.h> | 10 | #include <linux/module.h> |
| @@ -19,12 +14,31 @@ | |||
| 19 | #include <asm/arcregs.h> | 14 | #include <asm/arcregs.h> |
| 20 | #include <asm/stacktrace.h> | 15 | #include <asm/stacktrace.h> |
| 21 | 16 | ||
| 17 | /* HW holds 8 symbols + one for null terminator */ | ||
| 18 | #define ARCPMU_EVENT_NAME_LEN 9 | ||
| 19 | |||
| 20 | enum arc_pmu_attr_groups { | ||
| 21 | ARCPMU_ATTR_GR_EVENTS, | ||
| 22 | ARCPMU_ATTR_GR_FORMATS, | ||
| 23 | ARCPMU_NR_ATTR_GR | ||
| 24 | }; | ||
| 25 | |||
| 26 | struct arc_pmu_raw_event_entry { | ||
| 27 | char name[ARCPMU_EVENT_NAME_LEN]; | ||
| 28 | }; | ||
| 29 | |||
| 22 | struct arc_pmu { | 30 | struct arc_pmu { |
| 23 | struct pmu pmu; | 31 | struct pmu pmu; |
| 24 | unsigned int irq; | 32 | unsigned int irq; |
| 25 | int n_counters; | 33 | int n_counters; |
| 34 | int n_events; | ||
| 26 | u64 max_period; | 35 | u64 max_period; |
| 27 | int ev_hw_idx[PERF_COUNT_ARC_HW_MAX]; | 36 | int ev_hw_idx[PERF_COUNT_ARC_HW_MAX]; |
| 37 | |||
| 38 | struct arc_pmu_raw_event_entry *raw_entry; | ||
| 39 | struct attribute **attrs; | ||
| 40 | struct perf_pmu_events_attr *attr; | ||
| 41 | const struct attribute_group *attr_groups[ARCPMU_NR_ATTR_GR + 1]; | ||
| 28 | }; | 42 | }; |
| 29 | 43 | ||
| 30 | struct arc_pmu_cpu { | 44 | struct arc_pmu_cpu { |
| @@ -49,6 +63,7 @@ static int callchain_trace(unsigned int addr, void *data) | |||
| 49 | { | 63 | { |
| 50 | struct arc_callchain_trace *ctrl = data; | 64 | struct arc_callchain_trace *ctrl = data; |
| 51 | struct perf_callchain_entry_ctx *entry = ctrl->perf_stuff; | 65 | struct perf_callchain_entry_ctx *entry = ctrl->perf_stuff; |
| 66 | |||
| 52 | perf_callchain_store(entry, addr); | 67 | perf_callchain_store(entry, addr); |
| 53 | 68 | ||
| 54 | if (ctrl->depth++ < 3) | 69 | if (ctrl->depth++ < 3) |
| @@ -57,8 +72,8 @@ static int callchain_trace(unsigned int addr, void *data) | |||
| 57 | return -1; | 72 | return -1; |
| 58 | } | 73 | } |
| 59 | 74 | ||
| 60 | void | 75 | void perf_callchain_kernel(struct perf_callchain_entry_ctx *entry, |
| 61 | perf_callchain_kernel(struct perf_callchain_entry_ctx *entry, struct pt_regs *regs) | 76 | struct pt_regs *regs) |
| 62 | { | 77 | { |
| 63 | struct arc_callchain_trace ctrl = { | 78 | struct arc_callchain_trace ctrl = { |
| 64 | .depth = 0, | 79 | .depth = 0, |
| @@ -68,8 +83,8 @@ perf_callchain_kernel(struct perf_callchain_entry_ctx *entry, struct pt_regs *re | |||
| 68 | arc_unwind_core(NULL, regs, callchain_trace, &ctrl); | 83 | arc_unwind_core(NULL, regs, callchain_trace, &ctrl); |
| 69 | } | 84 | } |
| 70 | 85 | ||
| 71 | void | 86 | void perf_callchain_user(struct perf_callchain_entry_ctx *entry, |
| 72 | perf_callchain_user(struct perf_callchain_entry_ctx *entry, struct pt_regs *regs) | 87 | struct pt_regs *regs) |
| 73 | { | 88 | { |
| 74 | /* | 89 | /* |
| 75 | * User stack can't be unwound trivially with kernel dwarf unwinder | 90 | * User stack can't be unwound trivially with kernel dwarf unwinder |
| @@ -82,10 +97,10 @@ static struct arc_pmu *arc_pmu; | |||
| 82 | static DEFINE_PER_CPU(struct arc_pmu_cpu, arc_pmu_cpu); | 97 | static DEFINE_PER_CPU(struct arc_pmu_cpu, arc_pmu_cpu); |
| 83 | 98 | ||
| 84 | /* read counter #idx; note that counter# != event# on ARC! */ | 99 | /* read counter #idx; note that counter# != event# on ARC! */ |
| 85 | static uint64_t arc_pmu_read_counter(int idx) | 100 | static u64 arc_pmu_read_counter(int idx) |
| 86 | { | 101 | { |
| 87 | uint32_t tmp; | 102 | u32 tmp; |
| 88 | uint64_t result; | 103 | u64 result; |
| 89 | 104 | ||
| 90 | /* | 105 | /* |
| 91 | * ARC supports making 'snapshots' of the counters, so we don't | 106 | * ARC supports making 'snapshots' of the counters, so we don't |
| @@ -94,7 +109,7 @@ static uint64_t arc_pmu_read_counter(int idx) | |||
| 94 | write_aux_reg(ARC_REG_PCT_INDEX, idx); | 109 | write_aux_reg(ARC_REG_PCT_INDEX, idx); |
| 95 | tmp = read_aux_reg(ARC_REG_PCT_CONTROL); | 110 | tmp = read_aux_reg(ARC_REG_PCT_CONTROL); |
| 96 | write_aux_reg(ARC_REG_PCT_CONTROL, tmp | ARC_REG_PCT_CONTROL_SN); | 111 | write_aux_reg(ARC_REG_PCT_CONTROL, tmp | ARC_REG_PCT_CONTROL_SN); |
| 97 | result = (uint64_t) (read_aux_reg(ARC_REG_PCT_SNAPH)) << 32; | 112 | result = (u64) (read_aux_reg(ARC_REG_PCT_SNAPH)) << 32; |
| 98 | result |= read_aux_reg(ARC_REG_PCT_SNAPL); | 113 | result |= read_aux_reg(ARC_REG_PCT_SNAPL); |
| 99 | 114 | ||
| 100 | return result; | 115 | return result; |
| @@ -103,9 +118,9 @@ static uint64_t arc_pmu_read_counter(int idx) | |||
| 103 | static void arc_perf_event_update(struct perf_event *event, | 118 | static void arc_perf_event_update(struct perf_event *event, |
| 104 | struct hw_perf_event *hwc, int idx) | 119 | struct hw_perf_event *hwc, int idx) |
| 105 | { | 120 | { |
| 106 | uint64_t prev_raw_count = local64_read(&hwc->prev_count); | 121 | u64 prev_raw_count = local64_read(&hwc->prev_count); |
| 107 | uint64_t new_raw_count = arc_pmu_read_counter(idx); | 122 | u64 new_raw_count = arc_pmu_read_counter(idx); |
| 108 | int64_t delta = new_raw_count - prev_raw_count; | 123 | s64 delta = new_raw_count - prev_raw_count; |
| 109 | 124 | ||
| 110 | /* | 125 | /* |
| 111 | * We aren't afraid of hwc->prev_count changing beneath our feet | 126 | * We aren't afraid of hwc->prev_count changing beneath our feet |
| @@ -155,7 +170,7 @@ static int arc_pmu_event_init(struct perf_event *event) | |||
| 155 | int ret; | 170 | int ret; |
| 156 | 171 | ||
| 157 | if (!is_sampling_event(event)) { | 172 | if (!is_sampling_event(event)) { |
| 158 | hwc->sample_period = arc_pmu->max_period; | 173 | hwc->sample_period = arc_pmu->max_period; |
| 159 | hwc->last_period = hwc->sample_period; | 174 | hwc->last_period = hwc->sample_period; |
| 160 | local64_set(&hwc->period_left, hwc->sample_period); | 175 | local64_set(&hwc->period_left, hwc->sample_period); |
| 161 | } | 176 | } |
| @@ -192,6 +207,18 @@ static int arc_pmu_event_init(struct perf_event *event) | |||
| 192 | pr_debug("init cache event with h/w %08x \'%s\'\n", | 207 | pr_debug("init cache event with h/w %08x \'%s\'\n", |
| 193 | (int)hwc->config, arc_pmu_ev_hw_map[ret]); | 208 | (int)hwc->config, arc_pmu_ev_hw_map[ret]); |
| 194 | return 0; | 209 | return 0; |
| 210 | |||
| 211 | case PERF_TYPE_RAW: | ||
| 212 | if (event->attr.config >= arc_pmu->n_events) | ||
| 213 | return -ENOENT; | ||
| 214 | |||
| 215 | hwc->config |= event->attr.config; | ||
| 216 | pr_debug("init raw event with idx %lld \'%s\'\n", | ||
| 217 | event->attr.config, | ||
| 218 | arc_pmu->raw_entry[event->attr.config].name); | ||
| 219 | |||
| 220 | return 0; | ||
| 221 | |||
| 195 | default: | 222 | default: |
| 196 | return -ENOENT; | 223 | return -ENOENT; |
| 197 | } | 224 | } |
| @@ -200,7 +227,7 @@ static int arc_pmu_event_init(struct perf_event *event) | |||
| 200 | /* starts all counters */ | 227 | /* starts all counters */ |
| 201 | static void arc_pmu_enable(struct pmu *pmu) | 228 | static void arc_pmu_enable(struct pmu *pmu) |
| 202 | { | 229 | { |
| 203 | uint32_t tmp; | 230 | u32 tmp; |
| 204 | tmp = read_aux_reg(ARC_REG_PCT_CONTROL); | 231 | tmp = read_aux_reg(ARC_REG_PCT_CONTROL); |
| 205 | write_aux_reg(ARC_REG_PCT_CONTROL, (tmp & 0xffff0000) | 0x1); | 232 | write_aux_reg(ARC_REG_PCT_CONTROL, (tmp & 0xffff0000) | 0x1); |
| 206 | } | 233 | } |
| @@ -208,7 +235,7 @@ static void arc_pmu_enable(struct pmu *pmu) | |||
| 208 | /* stops all counters */ | 235 | /* stops all counters */ |
| 209 | static void arc_pmu_disable(struct pmu *pmu) | 236 | static void arc_pmu_disable(struct pmu *pmu) |
| 210 | { | 237 | { |
| 211 | uint32_t tmp; | 238 | u32 tmp; |
| 212 | tmp = read_aux_reg(ARC_REG_PCT_CONTROL); | 239 | tmp = read_aux_reg(ARC_REG_PCT_CONTROL); |
| 213 | write_aux_reg(ARC_REG_PCT_CONTROL, (tmp & 0xffff0000) | 0x0); | 240 | write_aux_reg(ARC_REG_PCT_CONTROL, (tmp & 0xffff0000) | 0x0); |
| 214 | } | 241 | } |
| @@ -228,7 +255,7 @@ static int arc_pmu_event_set_period(struct perf_event *event) | |||
| 228 | local64_set(&hwc->period_left, left); | 255 | local64_set(&hwc->period_left, left); |
| 229 | hwc->last_period = period; | 256 | hwc->last_period = period; |
| 230 | overflow = 1; | 257 | overflow = 1; |
| 231 | } else if (unlikely(left <= 0)) { | 258 | } else if (unlikely(left <= 0)) { |
| 232 | /* left underflowed by less than period. */ | 259 | /* left underflowed by less than period. */ |
| 233 | left += period; | 260 | left += period; |
| 234 | local64_set(&hwc->period_left, left); | 261 | local64_set(&hwc->period_left, left); |
| @@ -246,8 +273,8 @@ static int arc_pmu_event_set_period(struct perf_event *event) | |||
| 246 | write_aux_reg(ARC_REG_PCT_INDEX, idx); | 273 | write_aux_reg(ARC_REG_PCT_INDEX, idx); |
| 247 | 274 | ||
| 248 | /* Write value */ | 275 | /* Write value */ |
| 249 | write_aux_reg(ARC_REG_PCT_COUNTL, (u32)value); | 276 | write_aux_reg(ARC_REG_PCT_COUNTL, lower_32_bits(value)); |
| 250 | write_aux_reg(ARC_REG_PCT_COUNTH, (value >> 32)); | 277 | write_aux_reg(ARC_REG_PCT_COUNTH, upper_32_bits(value)); |
| 251 | 278 | ||
| 252 | perf_event_update_userpage(event); | 279 | perf_event_update_userpage(event); |
| 253 | 280 | ||
| @@ -277,7 +304,7 @@ static void arc_pmu_start(struct perf_event *event, int flags) | |||
| 277 | /* Enable interrupt for this counter */ | 304 | /* Enable interrupt for this counter */ |
| 278 | if (is_sampling_event(event)) | 305 | if (is_sampling_event(event)) |
| 279 | write_aux_reg(ARC_REG_PCT_INT_CTRL, | 306 | write_aux_reg(ARC_REG_PCT_INT_CTRL, |
| 280 | read_aux_reg(ARC_REG_PCT_INT_CTRL) | (1 << idx)); | 307 | read_aux_reg(ARC_REG_PCT_INT_CTRL) | BIT(idx)); |
| 281 | 308 | ||
| 282 | /* enable ARC pmu here */ | 309 | /* enable ARC pmu here */ |
| 283 | write_aux_reg(ARC_REG_PCT_INDEX, idx); /* counter # */ | 310 | write_aux_reg(ARC_REG_PCT_INDEX, idx); /* counter # */ |
| @@ -295,9 +322,9 @@ static void arc_pmu_stop(struct perf_event *event, int flags) | |||
| 295 | * Reset interrupt flag by writing of 1. This is required | 322 | * Reset interrupt flag by writing of 1. This is required |
| 296 | * to make sure pending interrupt was not left. | 323 | * to make sure pending interrupt was not left. |
| 297 | */ | 324 | */ |
| 298 | write_aux_reg(ARC_REG_PCT_INT_ACT, 1 << idx); | 325 | write_aux_reg(ARC_REG_PCT_INT_ACT, BIT(idx)); |
| 299 | write_aux_reg(ARC_REG_PCT_INT_CTRL, | 326 | write_aux_reg(ARC_REG_PCT_INT_CTRL, |
| 300 | read_aux_reg(ARC_REG_PCT_INT_CTRL) & ~(1 << idx)); | 327 | read_aux_reg(ARC_REG_PCT_INT_CTRL) & ~BIT(idx)); |
| 301 | } | 328 | } |
| 302 | 329 | ||
| 303 | if (!(event->hw.state & PERF_HES_STOPPED)) { | 330 | if (!(event->hw.state & PERF_HES_STOPPED)) { |
| @@ -349,9 +376,10 @@ static int arc_pmu_add(struct perf_event *event, int flags) | |||
| 349 | 376 | ||
| 350 | if (is_sampling_event(event)) { | 377 | if (is_sampling_event(event)) { |
| 351 | /* Mimic full counter overflow as other arches do */ | 378 | /* Mimic full counter overflow as other arches do */ |
| 352 | write_aux_reg(ARC_REG_PCT_INT_CNTL, (u32)arc_pmu->max_period); | 379 | write_aux_reg(ARC_REG_PCT_INT_CNTL, |
| 380 | lower_32_bits(arc_pmu->max_period)); | ||
| 353 | write_aux_reg(ARC_REG_PCT_INT_CNTH, | 381 | write_aux_reg(ARC_REG_PCT_INT_CNTH, |
| 354 | (arc_pmu->max_period >> 32)); | 382 | upper_32_bits(arc_pmu->max_period)); |
| 355 | } | 383 | } |
| 356 | 384 | ||
| 357 | write_aux_reg(ARC_REG_PCT_CONFIG, 0); | 385 | write_aux_reg(ARC_REG_PCT_CONFIG, 0); |
| @@ -392,7 +420,7 @@ static irqreturn_t arc_pmu_intr(int irq, void *dev) | |||
| 392 | idx = __ffs(active_ints); | 420 | idx = __ffs(active_ints); |
| 393 | 421 | ||
| 394 | /* Reset interrupt flag by writing of 1 */ | 422 | /* Reset interrupt flag by writing of 1 */ |
| 395 | write_aux_reg(ARC_REG_PCT_INT_ACT, 1 << idx); | 423 | write_aux_reg(ARC_REG_PCT_INT_ACT, BIT(idx)); |
| 396 | 424 | ||
| 397 | /* | 425 | /* |
| 398 | * On reset of "interrupt active" bit corresponding | 426 | * On reset of "interrupt active" bit corresponding |
| @@ -400,7 +428,7 @@ static irqreturn_t arc_pmu_intr(int irq, void *dev) | |||
| 400 | * Now we need to re-enable interrupt for the counter. | 428 | * Now we need to re-enable interrupt for the counter. |
| 401 | */ | 429 | */ |
| 402 | write_aux_reg(ARC_REG_PCT_INT_CTRL, | 430 | write_aux_reg(ARC_REG_PCT_INT_CTRL, |
| 403 | read_aux_reg(ARC_REG_PCT_INT_CTRL) | (1 << idx)); | 431 | read_aux_reg(ARC_REG_PCT_INT_CTRL) | BIT(idx)); |
| 404 | 432 | ||
| 405 | event = pmu_cpu->act_counter[idx]; | 433 | event = pmu_cpu->act_counter[idx]; |
| 406 | hwc = &event->hw; | 434 | hwc = &event->hw; |
| @@ -414,7 +442,7 @@ static irqreturn_t arc_pmu_intr(int irq, void *dev) | |||
| 414 | arc_pmu_stop(event, 0); | 442 | arc_pmu_stop(event, 0); |
| 415 | } | 443 | } |
| 416 | 444 | ||
| 417 | active_ints &= ~(1U << idx); | 445 | active_ints &= ~BIT(idx); |
| 418 | } while (active_ints); | 446 | } while (active_ints); |
| 419 | 447 | ||
| 420 | done: | 448 | done: |
| @@ -441,19 +469,108 @@ static void arc_cpu_pmu_irq_init(void *data) | |||
| 441 | write_aux_reg(ARC_REG_PCT_INT_ACT, 0xffffffff); | 469 | write_aux_reg(ARC_REG_PCT_INT_ACT, 0xffffffff); |
| 442 | } | 470 | } |
| 443 | 471 | ||
| 472 | /* Event field occupies the bottom 15 bits of our config field */ | ||
| 473 | PMU_FORMAT_ATTR(event, "config:0-14"); | ||
| 474 | static struct attribute *arc_pmu_format_attrs[] = { | ||
| 475 | &format_attr_event.attr, | ||
| 476 | NULL, | ||
| 477 | }; | ||
| 478 | |||
| 479 | static struct attribute_group arc_pmu_format_attr_gr = { | ||
| 480 | .name = "format", | ||
| 481 | .attrs = arc_pmu_format_attrs, | ||
| 482 | }; | ||
| 483 | |||
| 484 | static ssize_t arc_pmu_events_sysfs_show(struct device *dev, | ||
| 485 | struct device_attribute *attr, | ||
| 486 | char *page) | ||
| 487 | { | ||
| 488 | struct perf_pmu_events_attr *pmu_attr; | ||
| 489 | |||
| 490 | pmu_attr = container_of(attr, struct perf_pmu_events_attr, attr); | ||
| 491 | return sprintf(page, "event=0x%04llx\n", pmu_attr->id); | ||
| 492 | } | ||
| 493 | |||
| 494 | /* | ||
| 495 | * We don't add attrs here as we don't have pre-defined list of perf events. | ||
| 496 | * We will generate and add attrs dynamically in probe() after we read HW | ||
| 497 | * configuration. | ||
| 498 | */ | ||
| 499 | static struct attribute_group arc_pmu_events_attr_gr = { | ||
| 500 | .name = "events", | ||
| 501 | }; | ||
| 502 | |||
| 503 | static void arc_pmu_add_raw_event_attr(int j, char *str) | ||
| 504 | { | ||
| 505 | memmove(arc_pmu->raw_entry[j].name, str, ARCPMU_EVENT_NAME_LEN - 1); | ||
| 506 | arc_pmu->attr[j].attr.attr.name = arc_pmu->raw_entry[j].name; | ||
| 507 | arc_pmu->attr[j].attr.attr.mode = VERIFY_OCTAL_PERMISSIONS(0444); | ||
| 508 | arc_pmu->attr[j].attr.show = arc_pmu_events_sysfs_show; | ||
| 509 | arc_pmu->attr[j].id = j; | ||
| 510 | arc_pmu->attrs[j] = &(arc_pmu->attr[j].attr.attr); | ||
| 511 | } | ||
| 512 | |||
| 513 | static int arc_pmu_raw_alloc(struct device *dev) | ||
| 514 | { | ||
| 515 | arc_pmu->attr = devm_kmalloc_array(dev, arc_pmu->n_events + 1, | ||
| 516 | sizeof(*arc_pmu->attr), GFP_KERNEL | __GFP_ZERO); | ||
| 517 | if (!arc_pmu->attr) | ||
| 518 | return -ENOMEM; | ||
| 519 | |||
| 520 | arc_pmu->attrs = devm_kmalloc_array(dev, arc_pmu->n_events + 1, | ||
| 521 | sizeof(*arc_pmu->attrs), GFP_KERNEL | __GFP_ZERO); | ||
| 522 | if (!arc_pmu->attrs) | ||
| 523 | return -ENOMEM; | ||
| 524 | |||
| 525 | arc_pmu->raw_entry = devm_kmalloc_array(dev, arc_pmu->n_events, | ||
| 526 | sizeof(*arc_pmu->raw_entry), GFP_KERNEL | __GFP_ZERO); | ||
| 527 | if (!arc_pmu->raw_entry) | ||
| 528 | return -ENOMEM; | ||
| 529 | |||
| 530 | return 0; | ||
| 531 | } | ||
| 532 | |||
| 533 | static inline bool event_in_hw_event_map(int i, char *name) | ||
| 534 | { | ||
| 535 | if (!arc_pmu_ev_hw_map[i]) | ||
| 536 | return false; | ||
| 537 | |||
| 538 | if (!strlen(arc_pmu_ev_hw_map[i])) | ||
| 539 | return false; | ||
| 540 | |||
| 541 | if (strcmp(arc_pmu_ev_hw_map[i], name)) | ||
| 542 | return false; | ||
| 543 | |||
| 544 | return true; | ||
| 545 | } | ||
| 546 | |||
| 547 | static void arc_pmu_map_hw_event(int j, char *str) | ||
| 548 | { | ||
| 549 | int i; | ||
| 550 | |||
| 551 | /* See if HW condition has been mapped to a perf event_id */ | ||
| 552 | for (i = 0; i < ARRAY_SIZE(arc_pmu_ev_hw_map); i++) { | ||
| 553 | if (event_in_hw_event_map(i, str)) { | ||
| 554 | pr_debug("mapping perf event %2d to h/w event \'%8s\' (idx %d)\n", | ||
| 555 | i, str, j); | ||
| 556 | arc_pmu->ev_hw_idx[i] = j; | ||
| 557 | } | ||
| 558 | } | ||
| 559 | } | ||
| 560 | |||
| 444 | static int arc_pmu_device_probe(struct platform_device *pdev) | 561 | static int arc_pmu_device_probe(struct platform_device *pdev) |
| 445 | { | 562 | { |
| 446 | struct arc_reg_pct_build pct_bcr; | 563 | struct arc_reg_pct_build pct_bcr; |
| 447 | struct arc_reg_cc_build cc_bcr; | 564 | struct arc_reg_cc_build cc_bcr; |
| 448 | int i, j, has_interrupts; | 565 | int i, has_interrupts; |
| 449 | int counter_size; /* in bits */ | 566 | int counter_size; /* in bits */ |
| 450 | 567 | ||
| 451 | union cc_name { | 568 | union cc_name { |
| 452 | struct { | 569 | struct { |
| 453 | uint32_t word0, word1; | 570 | u32 word0, word1; |
| 454 | char sentinel; | 571 | char sentinel; |
| 455 | } indiv; | 572 | } indiv; |
| 456 | char str[9]; | 573 | char str[ARCPMU_EVENT_NAME_LEN]; |
| 457 | } cc_name; | 574 | } cc_name; |
| 458 | 575 | ||
| 459 | 576 | ||
| @@ -463,15 +580,22 @@ static int arc_pmu_device_probe(struct platform_device *pdev) | |||
| 463 | return -ENODEV; | 580 | return -ENODEV; |
| 464 | } | 581 | } |
| 465 | BUILD_BUG_ON(ARC_PERF_MAX_COUNTERS > 32); | 582 | BUILD_BUG_ON(ARC_PERF_MAX_COUNTERS > 32); |
| 466 | BUG_ON(pct_bcr.c > ARC_PERF_MAX_COUNTERS); | 583 | if (WARN_ON(pct_bcr.c > ARC_PERF_MAX_COUNTERS)) |
| 584 | return -EINVAL; | ||
| 467 | 585 | ||
| 468 | READ_BCR(ARC_REG_CC_BUILD, cc_bcr); | 586 | READ_BCR(ARC_REG_CC_BUILD, cc_bcr); |
| 469 | BUG_ON(!cc_bcr.v); /* Counters exist but No countable conditions ? */ | 587 | if (WARN(!cc_bcr.v, "Counters exist but No countable conditions?")) |
| 588 | return -EINVAL; | ||
| 470 | 589 | ||
| 471 | arc_pmu = devm_kzalloc(&pdev->dev, sizeof(struct arc_pmu), GFP_KERNEL); | 590 | arc_pmu = devm_kzalloc(&pdev->dev, sizeof(struct arc_pmu), GFP_KERNEL); |
| 472 | if (!arc_pmu) | 591 | if (!arc_pmu) |
| 473 | return -ENOMEM; | 592 | return -ENOMEM; |
| 474 | 593 | ||
| 594 | arc_pmu->n_events = cc_bcr.c; | ||
| 595 | |||
| 596 | if (arc_pmu_raw_alloc(&pdev->dev)) | ||
| 597 | return -ENOMEM; | ||
| 598 | |||
| 475 | has_interrupts = is_isa_arcv2() ? pct_bcr.i : 0; | 599 | has_interrupts = is_isa_arcv2() ? pct_bcr.i : 0; |
| 476 | 600 | ||
| 477 | arc_pmu->n_counters = pct_bcr.c; | 601 | arc_pmu->n_counters = pct_bcr.c; |
| @@ -481,30 +605,26 @@ static int arc_pmu_device_probe(struct platform_device *pdev) | |||
| 481 | 605 | ||
| 482 | pr_info("ARC perf\t: %d counters (%d bits), %d conditions%s\n", | 606 | pr_info("ARC perf\t: %d counters (%d bits), %d conditions%s\n", |
| 483 | arc_pmu->n_counters, counter_size, cc_bcr.c, | 607 | arc_pmu->n_counters, counter_size, cc_bcr.c, |
| 484 | has_interrupts ? ", [overflow IRQ support]":""); | 608 | has_interrupts ? ", [overflow IRQ support]" : ""); |
| 485 | 609 | ||
| 486 | cc_name.str[8] = 0; | 610 | cc_name.str[ARCPMU_EVENT_NAME_LEN - 1] = 0; |
| 487 | for (i = 0; i < PERF_COUNT_ARC_HW_MAX; i++) | 611 | for (i = 0; i < PERF_COUNT_ARC_HW_MAX; i++) |
| 488 | arc_pmu->ev_hw_idx[i] = -1; | 612 | arc_pmu->ev_hw_idx[i] = -1; |
| 489 | 613 | ||
| 490 | /* loop thru all available h/w condition indexes */ | 614 | /* loop thru all available h/w condition indexes */ |
| 491 | for (j = 0; j < cc_bcr.c; j++) { | 615 | for (i = 0; i < cc_bcr.c; i++) { |
| 492 | write_aux_reg(ARC_REG_CC_INDEX, j); | 616 | write_aux_reg(ARC_REG_CC_INDEX, i); |
| 493 | cc_name.indiv.word0 = read_aux_reg(ARC_REG_CC_NAME0); | 617 | cc_name.indiv.word0 = read_aux_reg(ARC_REG_CC_NAME0); |
| 494 | cc_name.indiv.word1 = read_aux_reg(ARC_REG_CC_NAME1); | 618 | cc_name.indiv.word1 = read_aux_reg(ARC_REG_CC_NAME1); |
| 495 | 619 | ||
| 496 | /* See if it has been mapped to a perf event_id */ | 620 | arc_pmu_map_hw_event(i, cc_name.str); |
| 497 | for (i = 0; i < ARRAY_SIZE(arc_pmu_ev_hw_map); i++) { | 621 | arc_pmu_add_raw_event_attr(i, cc_name.str); |
| 498 | if (arc_pmu_ev_hw_map[i] && | ||
| 499 | !strcmp(arc_pmu_ev_hw_map[i], cc_name.str) && | ||
| 500 | strlen(arc_pmu_ev_hw_map[i])) { | ||
| 501 | pr_debug("mapping perf event %2d to h/w event \'%8s\' (idx %d)\n", | ||
| 502 | i, cc_name.str, j); | ||
| 503 | arc_pmu->ev_hw_idx[i] = j; | ||
| 504 | } | ||
| 505 | } | ||
| 506 | } | 622 | } |
| 507 | 623 | ||
| 624 | arc_pmu_events_attr_gr.attrs = arc_pmu->attrs; | ||
| 625 | arc_pmu->attr_groups[ARCPMU_ATTR_GR_EVENTS] = &arc_pmu_events_attr_gr; | ||
| 626 | arc_pmu->attr_groups[ARCPMU_ATTR_GR_FORMATS] = &arc_pmu_format_attr_gr; | ||
| 627 | |||
| 508 | arc_pmu->pmu = (struct pmu) { | 628 | arc_pmu->pmu = (struct pmu) { |
| 509 | .pmu_enable = arc_pmu_enable, | 629 | .pmu_enable = arc_pmu_enable, |
| 510 | .pmu_disable = arc_pmu_disable, | 630 | .pmu_disable = arc_pmu_disable, |
| @@ -514,6 +634,7 @@ static int arc_pmu_device_probe(struct platform_device *pdev) | |||
| 514 | .start = arc_pmu_start, | 634 | .start = arc_pmu_start, |
| 515 | .stop = arc_pmu_stop, | 635 | .stop = arc_pmu_stop, |
| 516 | .read = arc_pmu_read, | 636 | .read = arc_pmu_read, |
| 637 | .attr_groups = arc_pmu->attr_groups, | ||
| 517 | }; | 638 | }; |
| 518 | 639 | ||
| 519 | if (has_interrupts) { | 640 | if (has_interrupts) { |
| @@ -535,17 +656,19 @@ static int arc_pmu_device_probe(struct platform_device *pdev) | |||
| 535 | } else | 656 | } else |
| 536 | arc_pmu->pmu.capabilities |= PERF_PMU_CAP_NO_INTERRUPT; | 657 | arc_pmu->pmu.capabilities |= PERF_PMU_CAP_NO_INTERRUPT; |
| 537 | 658 | ||
| 538 | return perf_pmu_register(&arc_pmu->pmu, pdev->name, PERF_TYPE_RAW); | 659 | /* |
| 660 | * perf parser doesn't really like '-' symbol in events name, so let's | ||
| 661 | * use '_' in arc pct name as it goes to kernel PMU event prefix. | ||
| 662 | */ | ||
| 663 | return perf_pmu_register(&arc_pmu->pmu, "arc_pct", PERF_TYPE_RAW); | ||
| 539 | } | 664 | } |
| 540 | 665 | ||
| 541 | #ifdef CONFIG_OF | ||
| 542 | static const struct of_device_id arc_pmu_match[] = { | 666 | static const struct of_device_id arc_pmu_match[] = { |
| 543 | { .compatible = "snps,arc700-pct" }, | 667 | { .compatible = "snps,arc700-pct" }, |
| 544 | { .compatible = "snps,archs-pct" }, | 668 | { .compatible = "snps,archs-pct" }, |
| 545 | {}, | 669 | {}, |
| 546 | }; | 670 | }; |
| 547 | MODULE_DEVICE_TABLE(of, arc_pmu_match); | 671 | MODULE_DEVICE_TABLE(of, arc_pmu_match); |
| 548 | #endif | ||
| 549 | 672 | ||
| 550 | static struct platform_driver arc_pmu_driver = { | 673 | static struct platform_driver arc_pmu_driver = { |
| 551 | .driver = { | 674 | .driver = { |
diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c index 2e018b8c2e19..7b2340996cf8 100644 --- a/arch/arc/kernel/setup.c +++ b/arch/arc/kernel/setup.c | |||
| @@ -123,6 +123,7 @@ static void read_arc_build_cfg_regs(void) | |||
| 123 | struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()]; | 123 | struct cpuinfo_arc *cpu = &cpuinfo_arc700[smp_processor_id()]; |
| 124 | const struct id_to_str *tbl; | 124 | const struct id_to_str *tbl; |
| 125 | struct bcr_isa_arcv2 isa; | 125 | struct bcr_isa_arcv2 isa; |
| 126 | struct bcr_actionpoint ap; | ||
| 126 | 127 | ||
| 127 | FIX_PTR(cpu); | 128 | FIX_PTR(cpu); |
| 128 | 129 | ||
| @@ -195,20 +196,40 @@ static void read_arc_build_cfg_regs(void) | |||
| 195 | cpu->bpu.full = bpu.ft; | 196 | cpu->bpu.full = bpu.ft; |
| 196 | cpu->bpu.num_cache = 256 << bpu.bce; | 197 | cpu->bpu.num_cache = 256 << bpu.bce; |
| 197 | cpu->bpu.num_pred = 2048 << bpu.pte; | 198 | cpu->bpu.num_pred = 2048 << bpu.pte; |
| 199 | cpu->bpu.ret_stk = 4 << bpu.rse; | ||
| 198 | 200 | ||
| 199 | if (cpu->core.family >= 0x54) { | 201 | if (cpu->core.family >= 0x54) { |
| 200 | unsigned int exec_ctrl; | ||
| 201 | 202 | ||
| 202 | READ_BCR(AUX_EXEC_CTRL, exec_ctrl); | 203 | struct bcr_uarch_build_arcv2 uarch; |
| 203 | cpu->extn.dual_enb = !(exec_ctrl & 1); | ||
| 204 | 204 | ||
| 205 | /* dual issue always present for this core */ | 205 | /* |
| 206 | cpu->extn.dual = 1; | 206 | * The first 0x54 core (uarch maj:min 0:1 or 0:2) was |
| 207 | * dual issue only (HS4x). But next uarch rev (1:0) | ||
| 208 | * allows it be configured for single issue (HS3x) | ||
| 209 | * Ensure we fiddle with dual issue only on HS4x | ||
| 210 | */ | ||
| 211 | READ_BCR(ARC_REG_MICRO_ARCH_BCR, uarch); | ||
| 212 | |||
| 213 | if (uarch.prod == 4) { | ||
| 214 | unsigned int exec_ctrl; | ||
| 215 | |||
| 216 | /* dual issue hardware always present */ | ||
| 217 | cpu->extn.dual = 1; | ||
| 218 | |||
| 219 | READ_BCR(AUX_EXEC_CTRL, exec_ctrl); | ||
| 220 | |||
| 221 | /* dual issue hardware enabled ? */ | ||
| 222 | cpu->extn.dual_enb = !(exec_ctrl & 1); | ||
| 223 | |||
| 224 | } | ||
| 207 | } | 225 | } |
| 208 | } | 226 | } |
| 209 | 227 | ||
| 210 | READ_BCR(ARC_REG_AP_BCR, bcr); | 228 | READ_BCR(ARC_REG_AP_BCR, ap); |
| 211 | cpu->extn.ap = bcr.ver ? 1 : 0; | 229 | if (ap.ver) { |
| 230 | cpu->extn.ap_num = 2 << ap.num; | ||
| 231 | cpu->extn.ap_full = !ap.min; | ||
| 232 | } | ||
| 212 | 233 | ||
| 213 | READ_BCR(ARC_REG_SMART_BCR, bcr); | 234 | READ_BCR(ARC_REG_SMART_BCR, bcr); |
| 214 | cpu->extn.smart = bcr.ver ? 1 : 0; | 235 | cpu->extn.smart = bcr.ver ? 1 : 0; |
| @@ -216,8 +237,6 @@ static void read_arc_build_cfg_regs(void) | |||
| 216 | READ_BCR(ARC_REG_RTT_BCR, bcr); | 237 | READ_BCR(ARC_REG_RTT_BCR, bcr); |
| 217 | cpu->extn.rtt = bcr.ver ? 1 : 0; | 238 | cpu->extn.rtt = bcr.ver ? 1 : 0; |
| 218 | 239 | ||
| 219 | cpu->extn.debug = cpu->extn.ap | cpu->extn.smart | cpu->extn.rtt; | ||
| 220 | |||
| 221 | READ_BCR(ARC_REG_ISA_CFG_BCR, isa); | 240 | READ_BCR(ARC_REG_ISA_CFG_BCR, isa); |
| 222 | 241 | ||
| 223 | /* some hacks for lack of feature BCR info in old ARC700 cores */ | 242 | /* some hacks for lack of feature BCR info in old ARC700 cores */ |
| @@ -299,10 +318,10 @@ static char *arc_cpu_mumbojumbo(int cpu_id, char *buf, int len) | |||
| 299 | 318 | ||
| 300 | if (cpu->bpu.ver) | 319 | if (cpu->bpu.ver) |
| 301 | n += scnprintf(buf + n, len - n, | 320 | n += scnprintf(buf + n, len - n, |
| 302 | "BPU\t\t: %s%s match, cache:%d, Predict Table:%d", | 321 | "BPU\t\t: %s%s match, cache:%d, Predict Table:%d Return stk: %d", |
| 303 | IS_AVAIL1(cpu->bpu.full, "full"), | 322 | IS_AVAIL1(cpu->bpu.full, "full"), |
| 304 | IS_AVAIL1(!cpu->bpu.full, "partial"), | 323 | IS_AVAIL1(!cpu->bpu.full, "partial"), |
| 305 | cpu->bpu.num_cache, cpu->bpu.num_pred); | 324 | cpu->bpu.num_cache, cpu->bpu.num_pred, cpu->bpu.ret_stk); |
| 306 | 325 | ||
| 307 | if (is_isa_arcv2()) { | 326 | if (is_isa_arcv2()) { |
| 308 | struct bcr_lpb lpb; | 327 | struct bcr_lpb lpb; |
| @@ -336,11 +355,17 @@ static char *arc_extn_mumbojumbo(int cpu_id, char *buf, int len) | |||
| 336 | IS_AVAIL1(cpu->extn.fpu_sp, "SP "), | 355 | IS_AVAIL1(cpu->extn.fpu_sp, "SP "), |
| 337 | IS_AVAIL1(cpu->extn.fpu_dp, "DP ")); | 356 | IS_AVAIL1(cpu->extn.fpu_dp, "DP ")); |
| 338 | 357 | ||
| 339 | if (cpu->extn.debug) | 358 | if (cpu->extn.ap_num | cpu->extn.smart | cpu->extn.rtt) { |
| 340 | n += scnprintf(buf + n, len - n, "DEBUG\t\t: %s%s%s\n", | 359 | n += scnprintf(buf + n, len - n, "DEBUG\t\t: %s%s", |
| 341 | IS_AVAIL1(cpu->extn.ap, "ActionPoint "), | ||
| 342 | IS_AVAIL1(cpu->extn.smart, "smaRT "), | 360 | IS_AVAIL1(cpu->extn.smart, "smaRT "), |
| 343 | IS_AVAIL1(cpu->extn.rtt, "RTT ")); | 361 | IS_AVAIL1(cpu->extn.rtt, "RTT ")); |
| 362 | if (cpu->extn.ap_num) { | ||
| 363 | n += scnprintf(buf + n, len - n, "ActionPoint %d/%s", | ||
| 364 | cpu->extn.ap_num, | ||
| 365 | cpu->extn.ap_full ? "full":"min"); | ||
| 366 | } | ||
| 367 | n += scnprintf(buf + n, len - n, "\n"); | ||
| 368 | } | ||
| 344 | 369 | ||
| 345 | if (cpu->dccm.sz || cpu->iccm.sz) | 370 | if (cpu->dccm.sz || cpu->iccm.sz) |
| 346 | n += scnprintf(buf + n, len - n, "Extn [CCM]\t: DCCM @ %x, %d KB / ICCM: @ %x, %d KB\n", | 371 | n += scnprintf(buf + n, len - n, "Extn [CCM]\t: DCCM @ %x, %d KB / ICCM: @ %x, %d KB\n", |
| @@ -453,43 +478,78 @@ void setup_processor(void) | |||
| 453 | arc_chk_core_config(); | 478 | arc_chk_core_config(); |
| 454 | } | 479 | } |
| 455 | 480 | ||
| 456 | static inline int is_kernel(unsigned long addr) | 481 | static inline bool uboot_arg_invalid(unsigned long addr) |
| 457 | { | 482 | { |
| 458 | if (addr >= (unsigned long)_stext && addr <= (unsigned long)_end) | 483 | /* |
| 459 | return 1; | 484 | * Check that it is a untranslated address (although MMU is not enabled |
| 460 | return 0; | 485 | * yet, it being a high address ensures this is not by fluke) |
| 486 | */ | ||
| 487 | if (addr < PAGE_OFFSET) | ||
| 488 | return true; | ||
| 489 | |||
| 490 | /* Check that address doesn't clobber resident kernel image */ | ||
| 491 | return addr >= (unsigned long)_stext && addr <= (unsigned long)_end; | ||
| 461 | } | 492 | } |
| 462 | 493 | ||
| 463 | void __init setup_arch(char **cmdline_p) | 494 | #define IGNORE_ARGS "Ignore U-boot args: " |
| 495 | |||
| 496 | /* uboot_tag values for U-boot - kernel ABI revision 0; see head.S */ | ||
| 497 | #define UBOOT_TAG_NONE 0 | ||
| 498 | #define UBOOT_TAG_CMDLINE 1 | ||
| 499 | #define UBOOT_TAG_DTB 2 | ||
| 500 | |||
| 501 | void __init handle_uboot_args(void) | ||
| 464 | { | 502 | { |
| 465 | #ifdef CONFIG_ARC_UBOOT_SUPPORT | 503 | bool use_embedded_dtb = true; |
| 466 | /* make sure that uboot passed pointer to cmdline/dtb is valid */ | 504 | bool append_cmdline = false; |
| 467 | if (uboot_tag && is_kernel((unsigned long)uboot_arg)) | 505 | |
| 468 | panic("Invalid uboot arg\n"); | 506 | /* check that we know this tag */ |
| 469 | 507 | if (uboot_tag != UBOOT_TAG_NONE && | |
| 470 | /* See if u-boot passed an external Device Tree blob */ | 508 | uboot_tag != UBOOT_TAG_CMDLINE && |
| 471 | machine_desc = setup_machine_fdt(uboot_arg); /* uboot_tag == 2 */ | 509 | uboot_tag != UBOOT_TAG_DTB) { |
| 472 | if (!machine_desc) | 510 | pr_warn(IGNORE_ARGS "invalid uboot tag: '%08x'\n", uboot_tag); |
| 473 | #endif | 511 | goto ignore_uboot_args; |
| 474 | { | 512 | } |
| 475 | /* No, so try the embedded one */ | 513 | |
| 514 | if (uboot_tag != UBOOT_TAG_NONE && | ||
| 515 | uboot_arg_invalid((unsigned long)uboot_arg)) { | ||
| 516 | pr_warn(IGNORE_ARGS "invalid uboot arg: '%px'\n", uboot_arg); | ||
| 517 | goto ignore_uboot_args; | ||
| 518 | } | ||
| 519 | |||
| 520 | /* see if U-boot passed an external Device Tree blob */ | ||
| 521 | if (uboot_tag == UBOOT_TAG_DTB) { | ||
| 522 | machine_desc = setup_machine_fdt((void *)uboot_arg); | ||
| 523 | |||
| 524 | /* external Device Tree blob is invalid - use embedded one */ | ||
| 525 | use_embedded_dtb = !machine_desc; | ||
| 526 | } | ||
| 527 | |||
| 528 | if (uboot_tag == UBOOT_TAG_CMDLINE) | ||
| 529 | append_cmdline = true; | ||
| 530 | |||
| 531 | ignore_uboot_args: | ||
| 532 | |||
| 533 | if (use_embedded_dtb) { | ||
| 476 | machine_desc = setup_machine_fdt(__dtb_start); | 534 | machine_desc = setup_machine_fdt(__dtb_start); |
| 477 | if (!machine_desc) | 535 | if (!machine_desc) |
| 478 | panic("Embedded DT invalid\n"); | 536 | panic("Embedded DT invalid\n"); |
| 537 | } | ||
| 479 | 538 | ||
| 480 | /* | 539 | /* |
| 481 | * If we are here, it is established that @uboot_arg didn't | 540 | * NOTE: @boot_command_line is populated by setup_machine_fdt() so this |
| 482 | * point to DT blob. Instead if u-boot says it is cmdline, | 541 | * append processing can only happen after. |
| 483 | * append to embedded DT cmdline. | 542 | */ |
| 484 | * setup_machine_fdt() would have populated @boot_command_line | 543 | if (append_cmdline) { |
| 485 | */ | 544 | /* Ensure a whitespace between the 2 cmdlines */ |
| 486 | if (uboot_tag == 1) { | 545 | strlcat(boot_command_line, " ", COMMAND_LINE_SIZE); |
| 487 | /* Ensure a whitespace between the 2 cmdlines */ | 546 | strlcat(boot_command_line, uboot_arg, COMMAND_LINE_SIZE); |
| 488 | strlcat(boot_command_line, " ", COMMAND_LINE_SIZE); | ||
| 489 | strlcat(boot_command_line, uboot_arg, | ||
| 490 | COMMAND_LINE_SIZE); | ||
| 491 | } | ||
| 492 | } | 547 | } |
| 548 | } | ||
| 549 | |||
| 550 | void __init setup_arch(char **cmdline_p) | ||
| 551 | { | ||
| 552 | handle_uboot_args(); | ||
| 493 | 553 | ||
| 494 | /* Save unparsed command line copy for /proc/cmdline */ | 554 | /* Save unparsed command line copy for /proc/cmdline */ |
| 495 | *cmdline_p = boot_command_line; | 555 | *cmdline_p = boot_command_line; |
diff --git a/arch/arc/kernel/troubleshoot.c b/arch/arc/kernel/troubleshoot.c index e8d9fb452346..215f515442e0 100644 --- a/arch/arc/kernel/troubleshoot.c +++ b/arch/arc/kernel/troubleshoot.c | |||
| @@ -18,6 +18,8 @@ | |||
| 18 | #include <asm/arcregs.h> | 18 | #include <asm/arcregs.h> |
| 19 | #include <asm/irqflags.h> | 19 | #include <asm/irqflags.h> |
| 20 | 20 | ||
| 21 | #define ARC_PATH_MAX 256 | ||
| 22 | |||
| 21 | /* | 23 | /* |
| 22 | * Common routine to print scratch regs (r0-r12) or callee regs (r13-r25) | 24 | * Common routine to print scratch regs (r0-r12) or callee regs (r13-r25) |
| 23 | * -Prints 3 regs per line and a CR. | 25 | * -Prints 3 regs per line and a CR. |
| @@ -58,11 +60,12 @@ static void show_callee_regs(struct callee_regs *cregs) | |||
| 58 | print_reg_file(&(cregs->r13), 13); | 60 | print_reg_file(&(cregs->r13), 13); |
| 59 | } | 61 | } |
| 60 | 62 | ||
| 61 | static void print_task_path_n_nm(struct task_struct *tsk, char *buf) | 63 | static void print_task_path_n_nm(struct task_struct *tsk) |
| 62 | { | 64 | { |
| 63 | char *path_nm = NULL; | 65 | char *path_nm = NULL; |
| 64 | struct mm_struct *mm; | 66 | struct mm_struct *mm; |
| 65 | struct file *exe_file; | 67 | struct file *exe_file; |
| 68 | char buf[ARC_PATH_MAX]; | ||
| 66 | 69 | ||
| 67 | mm = get_task_mm(tsk); | 70 | mm = get_task_mm(tsk); |
| 68 | if (!mm) | 71 | if (!mm) |
| @@ -72,7 +75,7 @@ static void print_task_path_n_nm(struct task_struct *tsk, char *buf) | |||
| 72 | mmput(mm); | 75 | mmput(mm); |
| 73 | 76 | ||
| 74 | if (exe_file) { | 77 | if (exe_file) { |
| 75 | path_nm = file_path(exe_file, buf, 255); | 78 | path_nm = file_path(exe_file, buf, ARC_PATH_MAX-1); |
| 76 | fput(exe_file); | 79 | fput(exe_file); |
| 77 | } | 80 | } |
| 78 | 81 | ||
| @@ -80,10 +83,9 @@ done: | |||
| 80 | pr_info("Path: %s\n", !IS_ERR(path_nm) ? path_nm : "?"); | 83 | pr_info("Path: %s\n", !IS_ERR(path_nm) ? path_nm : "?"); |
| 81 | } | 84 | } |
| 82 | 85 | ||
| 83 | static void show_faulting_vma(unsigned long address, char *buf) | 86 | static void show_faulting_vma(unsigned long address) |
| 84 | { | 87 | { |
| 85 | struct vm_area_struct *vma; | 88 | struct vm_area_struct *vma; |
| 86 | char *nm = buf; | ||
| 87 | struct mm_struct *active_mm = current->active_mm; | 89 | struct mm_struct *active_mm = current->active_mm; |
| 88 | 90 | ||
| 89 | /* can't use print_vma_addr() yet as it doesn't check for | 91 | /* can't use print_vma_addr() yet as it doesn't check for |
| @@ -96,8 +98,11 @@ static void show_faulting_vma(unsigned long address, char *buf) | |||
| 96 | * if the container VMA is not found | 98 | * if the container VMA is not found |
| 97 | */ | 99 | */ |
| 98 | if (vma && (vma->vm_start <= address)) { | 100 | if (vma && (vma->vm_start <= address)) { |
| 101 | char buf[ARC_PATH_MAX]; | ||
| 102 | char *nm = "?"; | ||
| 103 | |||
| 99 | if (vma->vm_file) { | 104 | if (vma->vm_file) { |
| 100 | nm = file_path(vma->vm_file, buf, PAGE_SIZE - 1); | 105 | nm = file_path(vma->vm_file, buf, ARC_PATH_MAX-1); |
| 101 | if (IS_ERR(nm)) | 106 | if (IS_ERR(nm)) |
| 102 | nm = "?"; | 107 | nm = "?"; |
| 103 | } | 108 | } |
| @@ -173,13 +178,14 @@ void show_regs(struct pt_regs *regs) | |||
| 173 | { | 178 | { |
| 174 | struct task_struct *tsk = current; | 179 | struct task_struct *tsk = current; |
| 175 | struct callee_regs *cregs; | 180 | struct callee_regs *cregs; |
| 176 | char *buf; | ||
| 177 | 181 | ||
| 178 | buf = (char *)__get_free_page(GFP_KERNEL); | 182 | /* |
| 179 | if (!buf) | 183 | * generic code calls us with preemption disabled, but some calls |
| 180 | return; | 184 | * here could sleep, so re-enable to avoid lockdep splat |
| 185 | */ | ||
| 186 | preempt_enable(); | ||
| 181 | 187 | ||
| 182 | print_task_path_n_nm(tsk, buf); | 188 | print_task_path_n_nm(tsk); |
| 183 | show_regs_print_info(KERN_INFO); | 189 | show_regs_print_info(KERN_INFO); |
| 184 | 190 | ||
| 185 | show_ecr_verbose(regs); | 191 | show_ecr_verbose(regs); |
| @@ -189,7 +195,7 @@ void show_regs(struct pt_regs *regs) | |||
| 189 | (void *)regs->blink, (void *)regs->ret); | 195 | (void *)regs->blink, (void *)regs->ret); |
| 190 | 196 | ||
| 191 | if (user_mode(regs)) | 197 | if (user_mode(regs)) |
| 192 | show_faulting_vma(regs->ret, buf); /* faulting code, not data */ | 198 | show_faulting_vma(regs->ret); /* faulting code, not data */ |
| 193 | 199 | ||
| 194 | pr_info("[STAT32]: 0x%08lx", regs->status32); | 200 | pr_info("[STAT32]: 0x%08lx", regs->status32); |
| 195 | 201 | ||
| @@ -222,7 +228,7 @@ void show_regs(struct pt_regs *regs) | |||
| 222 | if (cregs) | 228 | if (cregs) |
| 223 | show_callee_regs(cregs); | 229 | show_callee_regs(cregs); |
| 224 | 230 | ||
| 225 | free_page((unsigned long)buf); | 231 | preempt_disable(); |
| 226 | } | 232 | } |
| 227 | 233 | ||
| 228 | void show_kernel_fault_diag(const char *str, struct pt_regs *regs, | 234 | void show_kernel_fault_diag(const char *str, struct pt_regs *regs, |
diff --git a/arch/arc/lib/memcpy-archs.S b/arch/arc/lib/memcpy-archs.S index d61044dd8b58..ea14b0bf3116 100644 --- a/arch/arc/lib/memcpy-archs.S +++ b/arch/arc/lib/memcpy-archs.S | |||
| @@ -25,15 +25,11 @@ | |||
| 25 | #endif | 25 | #endif |
| 26 | 26 | ||
| 27 | #ifdef CONFIG_ARC_HAS_LL64 | 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] | 28 | # define LOADX(DST,RX) ldd.ab DST, [RX, 8] |
| 31 | # define STOREX(SRC,RX) std.ab SRC, [RX, 8] | 29 | # define STOREX(SRC,RX) std.ab SRC, [RX, 8] |
| 32 | # define ZOLSHFT 5 | 30 | # define ZOLSHFT 5 |
| 33 | # define ZOLAND 0x1F | 31 | # define ZOLAND 0x1F |
| 34 | #else | 32 | #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] | 33 | # define LOADX(DST,RX) ld.ab DST, [RX, 4] |
| 38 | # define STOREX(SRC,RX) st.ab SRC, [RX, 4] | 34 | # define STOREX(SRC,RX) st.ab SRC, [RX, 4] |
| 39 | # define ZOLSHFT 4 | 35 | # define ZOLSHFT 4 |
| @@ -41,8 +37,6 @@ | |||
| 41 | #endif | 37 | #endif |
| 42 | 38 | ||
| 43 | ENTRY_CFI(memcpy) | 39 | ENTRY_CFI(memcpy) |
| 44 | prefetch [r1] ; Prefetch the read location | ||
| 45 | prefetchw [r0] ; Prefetch the write location | ||
| 46 | mov.f 0, r2 | 40 | mov.f 0, r2 |
| 47 | ;;; if size is zero | 41 | ;;; if size is zero |
| 48 | jz.d [blink] | 42 | jz.d [blink] |
| @@ -72,8 +66,6 @@ ENTRY_CFI(memcpy) | |||
| 72 | lpnz @.Lcopy32_64bytes | 66 | lpnz @.Lcopy32_64bytes |
| 73 | ;; LOOP START | 67 | ;; LOOP START |
| 74 | LOADX (r6, r1) | 68 | LOADX (r6, r1) |
| 75 | PREFETCH_READ (r1) | ||
| 76 | PREFETCH_WRITE (r3) | ||
| 77 | LOADX (r8, r1) | 69 | LOADX (r8, r1) |
| 78 | LOADX (r10, r1) | 70 | LOADX (r10, r1) |
| 79 | LOADX (r4, r1) | 71 | LOADX (r4, r1) |
| @@ -117,9 +109,7 @@ ENTRY_CFI(memcpy) | |||
| 117 | lpnz @.Lcopy8bytes_1 | 109 | lpnz @.Lcopy8bytes_1 |
| 118 | ;; LOOP START | 110 | ;; LOOP START |
| 119 | ld.ab r6, [r1, 4] | 111 | ld.ab r6, [r1, 4] |
| 120 | prefetch [r1, 28] ;Prefetch the next read location | ||
| 121 | ld.ab r8, [r1,4] | 112 | ld.ab r8, [r1,4] |
| 122 | prefetchw [r3, 32] ;Prefetch the next write location | ||
| 123 | 113 | ||
| 124 | SHIFT_1 (r7, r6, 24) | 114 | SHIFT_1 (r7, r6, 24) |
| 125 | or r7, r7, r5 | 115 | or r7, r7, r5 |
| @@ -162,9 +152,7 @@ ENTRY_CFI(memcpy) | |||
| 162 | lpnz @.Lcopy8bytes_2 | 152 | lpnz @.Lcopy8bytes_2 |
| 163 | ;; LOOP START | 153 | ;; LOOP START |
| 164 | ld.ab r6, [r1, 4] | 154 | ld.ab r6, [r1, 4] |
| 165 | prefetch [r1, 28] ;Prefetch the next read location | ||
| 166 | ld.ab r8, [r1,4] | 155 | ld.ab r8, [r1,4] |
| 167 | prefetchw [r3, 32] ;Prefetch the next write location | ||
| 168 | 156 | ||
| 169 | SHIFT_1 (r7, r6, 16) | 157 | SHIFT_1 (r7, r6, 16) |
| 170 | or r7, r7, r5 | 158 | or r7, r7, r5 |
| @@ -204,9 +192,7 @@ ENTRY_CFI(memcpy) | |||
| 204 | lpnz @.Lcopy8bytes_3 | 192 | lpnz @.Lcopy8bytes_3 |
| 205 | ;; LOOP START | 193 | ;; LOOP START |
| 206 | ld.ab r6, [r1, 4] | 194 | ld.ab r6, [r1, 4] |
| 207 | prefetch [r1, 28] ;Prefetch the next read location | ||
| 208 | ld.ab r8, [r1,4] | 195 | ld.ab r8, [r1,4] |
| 209 | prefetchw [r3, 32] ;Prefetch the next write location | ||
| 210 | 196 | ||
| 211 | SHIFT_1 (r7, r6, 8) | 197 | SHIFT_1 (r7, r6, 8) |
| 212 | or r7, r7, r5 | 198 | or r7, r7, r5 |
diff --git a/arch/arc/lib/memset-archs.S b/arch/arc/lib/memset-archs.S index 62ad4bcb841a..f230bb7092fd 100644 --- a/arch/arc/lib/memset-archs.S +++ b/arch/arc/lib/memset-archs.S | |||
| @@ -7,11 +7,39 @@ | |||
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | #include <linux/linkage.h> | 9 | #include <linux/linkage.h> |
| 10 | #include <asm/cache.h> | ||
| 10 | 11 | ||
| 11 | #undef PREALLOC_NOT_AVAIL | 12 | /* |
| 13 | * The memset implementation below is optimized to use prefetchw and prealloc | ||
| 14 | * instruction in case of CPU with 64B L1 data cache line (L1_CACHE_SHIFT == 6) | ||
| 15 | * If you want to implement optimized memset for other possible L1 data cache | ||
| 16 | * line lengths (32B and 128B) you should rewrite code carefully checking | ||
| 17 | * we don't call any prefetchw/prealloc instruction for L1 cache lines which | ||
| 18 | * don't belongs to memset area. | ||
| 19 | */ | ||
| 20 | |||
| 21 | #if L1_CACHE_SHIFT == 6 | ||
| 22 | |||
| 23 | .macro PREALLOC_INSTR reg, off | ||
| 24 | prealloc [\reg, \off] | ||
| 25 | .endm | ||
| 26 | |||
| 27 | .macro PREFETCHW_INSTR reg, off | ||
| 28 | prefetchw [\reg, \off] | ||
| 29 | .endm | ||
| 30 | |||
| 31 | #else | ||
| 32 | |||
| 33 | .macro PREALLOC_INSTR | ||
| 34 | .endm | ||
| 35 | |||
| 36 | .macro PREFETCHW_INSTR | ||
| 37 | .endm | ||
| 38 | |||
| 39 | #endif | ||
| 12 | 40 | ||
| 13 | ENTRY_CFI(memset) | 41 | ENTRY_CFI(memset) |
| 14 | prefetchw [r0] ; Prefetch the write location | 42 | PREFETCHW_INSTR r0, 0 ; Prefetch the first write location |
| 15 | mov.f 0, r2 | 43 | mov.f 0, r2 |
| 16 | ;;; if size is zero | 44 | ;;; if size is zero |
| 17 | jz.d [blink] | 45 | jz.d [blink] |
| @@ -48,11 +76,8 @@ ENTRY_CFI(memset) | |||
| 48 | 76 | ||
| 49 | lpnz @.Lset64bytes | 77 | lpnz @.Lset64bytes |
| 50 | ;; LOOP START | 78 | ;; LOOP START |
| 51 | #ifdef PREALLOC_NOT_AVAIL | 79 | PREALLOC_INSTR r3, 64 ; alloc next line w/o fetching |
| 52 | prefetchw [r3, 64] ;Prefetch the next write location | 80 | |
| 53 | #else | ||
| 54 | prealloc [r3, 64] | ||
| 55 | #endif | ||
| 56 | #ifdef CONFIG_ARC_HAS_LL64 | 81 | #ifdef CONFIG_ARC_HAS_LL64 |
| 57 | std.ab r4, [r3, 8] | 82 | std.ab r4, [r3, 8] |
| 58 | std.ab r4, [r3, 8] | 83 | std.ab r4, [r3, 8] |
| @@ -85,7 +110,6 @@ ENTRY_CFI(memset) | |||
| 85 | lsr.f lp_count, r2, 5 ;Last remaining max 124 bytes | 110 | lsr.f lp_count, r2, 5 ;Last remaining max 124 bytes |
| 86 | lpnz .Lset32bytes | 111 | lpnz .Lset32bytes |
| 87 | ;; LOOP START | 112 | ;; LOOP START |
| 88 | prefetchw [r3, 32] ;Prefetch the next write location | ||
| 89 | #ifdef CONFIG_ARC_HAS_LL64 | 113 | #ifdef CONFIG_ARC_HAS_LL64 |
| 90 | std.ab r4, [r3, 8] | 114 | std.ab r4, [r3, 8] |
| 91 | std.ab r4, [r3, 8] | 115 | std.ab r4, [r3, 8] |
diff --git a/arch/arc/mm/fault.c b/arch/arc/mm/fault.c index a1d723197084..8df1638259f3 100644 --- a/arch/arc/mm/fault.c +++ b/arch/arc/mm/fault.c | |||
| @@ -141,12 +141,17 @@ good_area: | |||
| 141 | */ | 141 | */ |
| 142 | fault = handle_mm_fault(vma, address, flags); | 142 | fault = handle_mm_fault(vma, address, flags); |
| 143 | 143 | ||
| 144 | /* If Pagefault was interrupted by SIGKILL, exit page fault "early" */ | ||
| 145 | if (fatal_signal_pending(current)) { | 144 | if (fatal_signal_pending(current)) { |
| 146 | if ((fault & VM_FAULT_ERROR) && !(fault & VM_FAULT_RETRY)) | 145 | |
| 147 | up_read(&mm->mmap_sem); | 146 | /* |
| 148 | if (user_mode(regs)) | 147 | * if fault retry, mmap_sem already relinquished by core mm |
| 148 | * so OK to return to user mode (with signal handled first) | ||
| 149 | */ | ||
| 150 | if (fault & VM_FAULT_RETRY) { | ||
| 151 | if (!user_mode(regs)) | ||
| 152 | goto no_context; | ||
| 149 | return; | 153 | return; |
| 154 | } | ||
| 150 | } | 155 | } |
| 151 | 156 | ||
| 152 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address); | 157 | perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, address); |
diff --git a/arch/arc/mm/init.c b/arch/arc/mm/init.c index 43bf4c3a1290..e1ab2d7f1d64 100644 --- a/arch/arc/mm/init.c +++ b/arch/arc/mm/init.c | |||
| @@ -119,7 +119,8 @@ void __init setup_arch_memory(void) | |||
| 119 | */ | 119 | */ |
| 120 | 120 | ||
| 121 | memblock_add_node(low_mem_start, low_mem_sz, 0); | 121 | memblock_add_node(low_mem_start, low_mem_sz, 0); |
| 122 | memblock_reserve(low_mem_start, __pa(_end) - low_mem_start); | 122 | memblock_reserve(CONFIG_LINUX_LINK_BASE, |
| 123 | __pa(_end) - CONFIG_LINUX_LINK_BASE); | ||
| 123 | 124 | ||
| 124 | #ifdef CONFIG_BLK_DEV_INITRD | 125 | #ifdef CONFIG_BLK_DEV_INITRD |
| 125 | if (phys_initrd_size) { | 126 | if (phys_initrd_size) { |
diff --git a/arch/arc/plat-hsdk/Kconfig b/arch/arc/plat-hsdk/Kconfig index f25c085b9874..23e00216e5a5 100644 --- a/arch/arc/plat-hsdk/Kconfig +++ b/arch/arc/plat-hsdk/Kconfig | |||
| @@ -9,6 +9,7 @@ menuconfig ARC_SOC_HSDK | |||
| 9 | bool "ARC HS Development Kit SOC" | 9 | bool "ARC HS Development Kit SOC" |
| 10 | depends on ISA_ARCV2 | 10 | depends on ISA_ARCV2 |
| 11 | select ARC_HAS_ACCL_REGS | 11 | select ARC_HAS_ACCL_REGS |
| 12 | select ARC_IRQ_NO_AUTOSAVE | ||
| 12 | select CLK_HSDK | 13 | select CLK_HSDK |
| 13 | select RESET_HSDK | 14 | select RESET_HSDK |
| 14 | select HAVE_PCI | 15 | select HAVE_PCI |
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 664e918e2624..26524b75970a 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
| @@ -1400,6 +1400,7 @@ config NR_CPUS | |||
| 1400 | config HOTPLUG_CPU | 1400 | config HOTPLUG_CPU |
| 1401 | bool "Support for hot-pluggable CPUs" | 1401 | bool "Support for hot-pluggable CPUs" |
| 1402 | depends on SMP | 1402 | depends on SMP |
| 1403 | select GENERIC_IRQ_MIGRATION | ||
| 1403 | help | 1404 | help |
| 1404 | Say Y here to experiment with turning CPUs off and on. CPUs | 1405 | Say Y here to experiment with turning CPUs off and on. CPUs |
| 1405 | can be controlled through /sys/devices/system/cpu. | 1406 | can be controlled through /sys/devices/system/cpu. |
diff --git a/arch/arm/boot/dts/am335x-evm.dts b/arch/arm/boot/dts/am335x-evm.dts index b67f5fee1469..dce5be5df97b 100644 --- a/arch/arm/boot/dts/am335x-evm.dts +++ b/arch/arm/boot/dts/am335x-evm.dts | |||
| @@ -729,7 +729,7 @@ | |||
| 729 | 729 | ||
| 730 | &cpsw_emac0 { | 730 | &cpsw_emac0 { |
| 731 | phy-handle = <ðphy0>; | 731 | phy-handle = <ðphy0>; |
| 732 | phy-mode = "rgmii-txid"; | 732 | phy-mode = "rgmii-id"; |
| 733 | }; | 733 | }; |
| 734 | 734 | ||
| 735 | &tscadc { | 735 | &tscadc { |
diff --git a/arch/arm/boot/dts/am335x-evmsk.dts b/arch/arm/boot/dts/am335x-evmsk.dts index 172c0224e7f6..b128998097ce 100644 --- a/arch/arm/boot/dts/am335x-evmsk.dts +++ b/arch/arm/boot/dts/am335x-evmsk.dts | |||
| @@ -651,13 +651,13 @@ | |||
| 651 | 651 | ||
| 652 | &cpsw_emac0 { | 652 | &cpsw_emac0 { |
| 653 | phy-handle = <ðphy0>; | 653 | phy-handle = <ðphy0>; |
| 654 | phy-mode = "rgmii-txid"; | 654 | phy-mode = "rgmii-id"; |
| 655 | dual_emac_res_vlan = <1>; | 655 | dual_emac_res_vlan = <1>; |
| 656 | }; | 656 | }; |
| 657 | 657 | ||
| 658 | &cpsw_emac1 { | 658 | &cpsw_emac1 { |
| 659 | phy-handle = <ðphy1>; | 659 | phy-handle = <ðphy1>; |
| 660 | phy-mode = "rgmii-txid"; | 660 | phy-mode = "rgmii-id"; |
| 661 | dual_emac_res_vlan = <2>; | 661 | dual_emac_res_vlan = <2>; |
| 662 | }; | 662 | }; |
| 663 | 663 | ||
diff --git a/arch/arm/boot/dts/am335x-shc.dts b/arch/arm/boot/dts/am335x-shc.dts index d0fd68873689..5b250060f6dd 100644 --- a/arch/arm/boot/dts/am335x-shc.dts +++ b/arch/arm/boot/dts/am335x-shc.dts | |||
| @@ -215,7 +215,7 @@ | |||
| 215 | pinctrl-names = "default"; | 215 | pinctrl-names = "default"; |
| 216 | pinctrl-0 = <&mmc1_pins>; | 216 | pinctrl-0 = <&mmc1_pins>; |
| 217 | bus-width = <0x4>; | 217 | bus-width = <0x4>; |
| 218 | cd-gpios = <&gpio0 6 GPIO_ACTIVE_HIGH>; | 218 | cd-gpios = <&gpio0 6 GPIO_ACTIVE_LOW>; |
| 219 | cd-inverted; | 219 | cd-inverted; |
| 220 | max-frequency = <26000000>; | 220 | max-frequency = <26000000>; |
| 221 | vmmc-supply = <&vmmcsd_fixed>; | 221 | vmmc-supply = <&vmmcsd_fixed>; |
diff --git a/arch/arm/boot/dts/armada-xp-db.dts b/arch/arm/boot/dts/armada-xp-db.dts index f3ac7483afed..5d04dc68cf57 100644 --- a/arch/arm/boot/dts/armada-xp-db.dts +++ b/arch/arm/boot/dts/armada-xp-db.dts | |||
| @@ -144,30 +144,32 @@ | |||
| 144 | status = "okay"; | 144 | status = "okay"; |
| 145 | }; | 145 | }; |
| 146 | 146 | ||
| 147 | nand@d0000 { | 147 | nand-controller@d0000 { |
| 148 | status = "okay"; | 148 | status = "okay"; |
| 149 | label = "pxa3xx_nand-0"; | ||
| 150 | num-cs = <1>; | ||
| 151 | marvell,nand-keep-config; | ||
| 152 | nand-on-flash-bbt; | ||
| 153 | |||
| 154 | partitions { | ||
| 155 | compatible = "fixed-partitions"; | ||
| 156 | #address-cells = <1>; | ||
| 157 | #size-cells = <1>; | ||
| 158 | |||
| 159 | partition@0 { | ||
| 160 | label = "U-Boot"; | ||
| 161 | reg = <0 0x800000>; | ||
| 162 | }; | ||
| 163 | partition@800000 { | ||
| 164 | label = "Linux"; | ||
| 165 | reg = <0x800000 0x800000>; | ||
| 166 | }; | ||
| 167 | partition@1000000 { | ||
| 168 | label = "Filesystem"; | ||
| 169 | reg = <0x1000000 0x3f000000>; | ||
| 170 | 149 | ||
| 150 | nand@0 { | ||
| 151 | reg = <0>; | ||
| 152 | label = "pxa3xx_nand-0"; | ||
| 153 | nand-rb = <0>; | ||
| 154 | nand-on-flash-bbt; | ||
| 155 | |||
| 156 | partitions { | ||
| 157 | compatible = "fixed-partitions"; | ||
| 158 | #address-cells = <1>; | ||
| 159 | #size-cells = <1>; | ||
| 160 | |||
| 161 | partition@0 { | ||
| 162 | label = "U-Boot"; | ||
| 163 | reg = <0 0x800000>; | ||
| 164 | }; | ||
| 165 | partition@800000 { | ||
| 166 | label = "Linux"; | ||
| 167 | reg = <0x800000 0x800000>; | ||
| 168 | }; | ||
| 169 | partition@1000000 { | ||
| 170 | label = "Filesystem"; | ||
| 171 | reg = <0x1000000 0x3f000000>; | ||
| 172 | }; | ||
| 171 | }; | 173 | }; |
| 172 | }; | 174 | }; |
| 173 | }; | 175 | }; |
diff --git a/arch/arm/boot/dts/armada-xp-gp.dts b/arch/arm/boot/dts/armada-xp-gp.dts index 1139e9469a83..b4cca507cf13 100644 --- a/arch/arm/boot/dts/armada-xp-gp.dts +++ b/arch/arm/boot/dts/armada-xp-gp.dts | |||
| @@ -160,12 +160,15 @@ | |||
| 160 | status = "okay"; | 160 | status = "okay"; |
| 161 | }; | 161 | }; |
| 162 | 162 | ||
| 163 | nand@d0000 { | 163 | nand-controller@d0000 { |
| 164 | status = "okay"; | 164 | status = "okay"; |
| 165 | label = "pxa3xx_nand-0"; | 165 | |
| 166 | num-cs = <1>; | 166 | nand@0 { |
| 167 | marvell,nand-keep-config; | 167 | reg = <0>; |
| 168 | nand-on-flash-bbt; | 168 | label = "pxa3xx_nand-0"; |
| 169 | nand-rb = <0>; | ||
| 170 | nand-on-flash-bbt; | ||
| 171 | }; | ||
| 169 | }; | 172 | }; |
| 170 | }; | 173 | }; |
| 171 | 174 | ||
diff --git a/arch/arm/boot/dts/armada-xp-lenovo-ix4-300d.dts b/arch/arm/boot/dts/armada-xp-lenovo-ix4-300d.dts index bbbb38888bb8..87dcb502f72d 100644 --- a/arch/arm/boot/dts/armada-xp-lenovo-ix4-300d.dts +++ b/arch/arm/boot/dts/armada-xp-lenovo-ix4-300d.dts | |||
| @@ -81,49 +81,52 @@ | |||
| 81 | 81 | ||
| 82 | }; | 82 | }; |
| 83 | 83 | ||
| 84 | nand@d0000 { | 84 | nand-controller@d0000 { |
| 85 | status = "okay"; | 85 | status = "okay"; |
| 86 | label = "pxa3xx_nand-0"; | ||
| 87 | num-cs = <1>; | ||
| 88 | marvell,nand-keep-config; | ||
| 89 | nand-on-flash-bbt; | ||
| 90 | |||
| 91 | partitions { | ||
| 92 | compatible = "fixed-partitions"; | ||
| 93 | #address-cells = <1>; | ||
| 94 | #size-cells = <1>; | ||
| 95 | |||
| 96 | partition@0 { | ||
| 97 | label = "u-boot"; | ||
| 98 | reg = <0x00000000 0x000e0000>; | ||
| 99 | read-only; | ||
| 100 | }; | ||
| 101 | |||
| 102 | partition@e0000 { | ||
| 103 | label = "u-boot-env"; | ||
| 104 | reg = <0x000e0000 0x00020000>; | ||
| 105 | read-only; | ||
| 106 | }; | ||
| 107 | |||
| 108 | partition@100000 { | ||
| 109 | label = "u-boot-env2"; | ||
| 110 | reg = <0x00100000 0x00020000>; | ||
| 111 | read-only; | ||
| 112 | }; | ||
| 113 | |||
| 114 | partition@120000 { | ||
| 115 | label = "zImage"; | ||
| 116 | reg = <0x00120000 0x00400000>; | ||
| 117 | }; | ||
| 118 | |||
| 119 | partition@520000 { | ||
| 120 | label = "initrd"; | ||
| 121 | reg = <0x00520000 0x00400000>; | ||
| 122 | }; | ||
| 123 | 86 | ||
| 124 | partition@e00000 { | 87 | nand@0 { |
| 125 | label = "boot"; | 88 | reg = <0>; |
| 126 | reg = <0x00e00000 0x3f200000>; | 89 | label = "pxa3xx_nand-0"; |
| 90 | nand-rb = <0>; | ||
| 91 | nand-on-flash-bbt; | ||
| 92 | |||
| 93 | partitions { | ||
| 94 | compatible = "fixed-partitions"; | ||
| 95 | #address-cells = <1>; | ||
| 96 | #size-cells = <1>; | ||
| 97 | |||
| 98 | partition@0 { | ||
| 99 | label = "u-boot"; | ||
| 100 | reg = <0x00000000 0x000e0000>; | ||
| 101 | read-only; | ||
| 102 | }; | ||
| 103 | |||
| 104 | partition@e0000 { | ||
| 105 | label = "u-boot-env"; | ||
| 106 | reg = <0x000e0000 0x00020000>; | ||
| 107 | read-only; | ||
| 108 | }; | ||
| 109 | |||
| 110 | partition@100000 { | ||
| 111 | label = "u-boot-env2"; | ||
| 112 | reg = <0x00100000 0x00020000>; | ||
| 113 | read-only; | ||
| 114 | }; | ||
| 115 | |||
| 116 | partition@120000 { | ||
| 117 | label = "zImage"; | ||
| 118 | reg = <0x00120000 0x00400000>; | ||
| 119 | }; | ||
| 120 | |||
| 121 | partition@520000 { | ||
| 122 | label = "initrd"; | ||
| 123 | reg = <0x00520000 0x00400000>; | ||
| 124 | }; | ||
| 125 | |||
| 126 | partition@e00000 { | ||
| 127 | label = "boot"; | ||
| 128 | reg = <0x00e00000 0x3f200000>; | ||
| 129 | }; | ||
| 127 | }; | 130 | }; |
| 128 | }; | 131 | }; |
| 129 | }; | 132 | }; |
diff --git a/arch/arm/boot/dts/da850-evm.dts b/arch/arm/boot/dts/da850-evm.dts index a3c9b346721d..f04bc3e15332 100644 --- a/arch/arm/boot/dts/da850-evm.dts +++ b/arch/arm/boot/dts/da850-evm.dts | |||
| @@ -94,6 +94,28 @@ | |||
| 94 | regulator-boot-on; | 94 | regulator-boot-on; |
| 95 | }; | 95 | }; |
| 96 | 96 | ||
| 97 | baseboard_3v3: fixedregulator-3v3 { | ||
| 98 | /* TPS73701DCQ */ | ||
| 99 | compatible = "regulator-fixed"; | ||
| 100 | regulator-name = "baseboard_3v3"; | ||
| 101 | regulator-min-microvolt = <3300000>; | ||
| 102 | regulator-max-microvolt = <3300000>; | ||
| 103 | vin-supply = <&vbat>; | ||
| 104 | regulator-always-on; | ||
| 105 | regulator-boot-on; | ||
| 106 | }; | ||
| 107 | |||
| 108 | baseboard_1v8: fixedregulator-1v8 { | ||
| 109 | /* TPS73701DCQ */ | ||
| 110 | compatible = "regulator-fixed"; | ||
| 111 | regulator-name = "baseboard_1v8"; | ||
| 112 | regulator-min-microvolt = <1800000>; | ||
| 113 | regulator-max-microvolt = <1800000>; | ||
| 114 | vin-supply = <&vbat>; | ||
| 115 | regulator-always-on; | ||
| 116 | regulator-boot-on; | ||
| 117 | }; | ||
| 118 | |||
| 97 | backlight_lcd: backlight-regulator { | 119 | backlight_lcd: backlight-regulator { |
| 98 | compatible = "regulator-fixed"; | 120 | compatible = "regulator-fixed"; |
| 99 | regulator-name = "lcd_backlight_pwr"; | 121 | regulator-name = "lcd_backlight_pwr"; |
| @@ -105,7 +127,7 @@ | |||
| 105 | 127 | ||
| 106 | sound { | 128 | sound { |
| 107 | compatible = "simple-audio-card"; | 129 | compatible = "simple-audio-card"; |
| 108 | simple-audio-card,name = "DA850/OMAP-L138 EVM"; | 130 | simple-audio-card,name = "DA850-OMAPL138 EVM"; |
| 109 | simple-audio-card,widgets = | 131 | simple-audio-card,widgets = |
| 110 | "Line", "Line In", | 132 | "Line", "Line In", |
| 111 | "Line", "Line Out"; | 133 | "Line", "Line Out"; |
| @@ -210,10 +232,9 @@ | |||
| 210 | 232 | ||
| 211 | /* Regulators */ | 233 | /* Regulators */ |
| 212 | IOVDD-supply = <&vdcdc2_reg>; | 234 | IOVDD-supply = <&vdcdc2_reg>; |
| 213 | /* Derived from VBAT: Baseboard 3.3V / 1.8V */ | 235 | AVDD-supply = <&baseboard_3v3>; |
| 214 | AVDD-supply = <&vbat>; | 236 | DRVDD-supply = <&baseboard_3v3>; |
| 215 | DRVDD-supply = <&vbat>; | 237 | DVDD-supply = <&baseboard_1v8>; |
| 216 | DVDD-supply = <&vbat>; | ||
| 217 | }; | 238 | }; |
| 218 | tca6416: gpio@20 { | 239 | tca6416: gpio@20 { |
| 219 | compatible = "ti,tca6416"; | 240 | compatible = "ti,tca6416"; |
diff --git a/arch/arm/boot/dts/da850-lcdk.dts b/arch/arm/boot/dts/da850-lcdk.dts index 0177e3ed20fe..3a2fa6e035a3 100644 --- a/arch/arm/boot/dts/da850-lcdk.dts +++ b/arch/arm/boot/dts/da850-lcdk.dts | |||
| @@ -39,9 +39,39 @@ | |||
| 39 | }; | 39 | }; |
| 40 | }; | 40 | }; |
| 41 | 41 | ||
| 42 | vcc_5vd: fixedregulator-vcc_5vd { | ||
| 43 | compatible = "regulator-fixed"; | ||
| 44 | regulator-name = "vcc_5vd"; | ||
| 45 | regulator-min-microvolt = <5000000>; | ||
| 46 | regulator-max-microvolt = <5000000>; | ||
| 47 | regulator-boot-on; | ||
| 48 | }; | ||
| 49 | |||
| 50 | vcc_3v3d: fixedregulator-vcc_3v3d { | ||
| 51 | /* TPS650250 - VDCDC1 */ | ||
| 52 | compatible = "regulator-fixed"; | ||
| 53 | regulator-name = "vcc_3v3d"; | ||
| 54 | regulator-min-microvolt = <3300000>; | ||
| 55 | regulator-max-microvolt = <3300000>; | ||
| 56 | vin-supply = <&vcc_5vd>; | ||
| 57 | regulator-always-on; | ||
| 58 | regulator-boot-on; | ||
| 59 | }; | ||
| 60 | |||
| 61 | vcc_1v8d: fixedregulator-vcc_1v8d { | ||
| 62 | /* TPS650250 - VDCDC2 */ | ||
| 63 | compatible = "regulator-fixed"; | ||
| 64 | regulator-name = "vcc_1v8d"; | ||
| 65 | regulator-min-microvolt = <1800000>; | ||
| 66 | regulator-max-microvolt = <1800000>; | ||
| 67 | vin-supply = <&vcc_5vd>; | ||
| 68 | regulator-always-on; | ||
| 69 | regulator-boot-on; | ||
| 70 | }; | ||
| 71 | |||
| 42 | sound { | 72 | sound { |
| 43 | compatible = "simple-audio-card"; | 73 | compatible = "simple-audio-card"; |
| 44 | simple-audio-card,name = "DA850/OMAP-L138 LCDK"; | 74 | simple-audio-card,name = "DA850-OMAPL138 LCDK"; |
| 45 | simple-audio-card,widgets = | 75 | simple-audio-card,widgets = |
| 46 | "Line", "Line In", | 76 | "Line", "Line In", |
| 47 | "Line", "Line Out"; | 77 | "Line", "Line Out"; |
| @@ -221,6 +251,12 @@ | |||
| 221 | compatible = "ti,tlv320aic3106"; | 251 | compatible = "ti,tlv320aic3106"; |
| 222 | reg = <0x18>; | 252 | reg = <0x18>; |
| 223 | status = "okay"; | 253 | status = "okay"; |
| 254 | |||
| 255 | /* Regulators */ | ||
| 256 | IOVDD-supply = <&vcc_3v3d>; | ||
| 257 | AVDD-supply = <&vcc_3v3d>; | ||
| 258 | DRVDD-supply = <&vcc_3v3d>; | ||
| 259 | DVDD-supply = <&vcc_1v8d>; | ||
| 224 | }; | 260 | }; |
| 225 | }; | 261 | }; |
| 226 | 262 | ||
diff --git a/arch/arm/boot/dts/da850.dtsi b/arch/arm/boot/dts/da850.dtsi index 47aa53ba6b92..559659b399d0 100644 --- a/arch/arm/boot/dts/da850.dtsi +++ b/arch/arm/boot/dts/da850.dtsi | |||
| @@ -476,7 +476,7 @@ | |||
| 476 | clocksource: timer@20000 { | 476 | clocksource: timer@20000 { |
| 477 | compatible = "ti,da830-timer"; | 477 | compatible = "ti,da830-timer"; |
| 478 | reg = <0x20000 0x1000>; | 478 | reg = <0x20000 0x1000>; |
| 479 | interrupts = <12>, <13>; | 479 | interrupts = <21>, <22>; |
| 480 | interrupt-names = "tint12", "tint34"; | 480 | interrupt-names = "tint12", "tint34"; |
| 481 | clocks = <&pll0_auxclk>; | 481 | clocks = <&pll0_auxclk>; |
| 482 | }; | 482 | }; |
diff --git a/arch/arm/boot/dts/imx6q-pistachio.dts b/arch/arm/boot/dts/imx6q-pistachio.dts index 5edf858c8b86..a31b17eaf51c 100644 --- a/arch/arm/boot/dts/imx6q-pistachio.dts +++ b/arch/arm/boot/dts/imx6q-pistachio.dts | |||
| @@ -103,7 +103,7 @@ | |||
| 103 | power { | 103 | power { |
| 104 | label = "Power Button"; | 104 | label = "Power Button"; |
| 105 | gpios = <&gpio2 12 GPIO_ACTIVE_LOW>; | 105 | gpios = <&gpio2 12 GPIO_ACTIVE_LOW>; |
| 106 | gpio-key,wakeup; | 106 | wakeup-source; |
| 107 | linux,code = <KEY_POWER>; | 107 | linux,code = <KEY_POWER>; |
| 108 | }; | 108 | }; |
| 109 | }; | 109 | }; |
diff --git a/arch/arm/boot/dts/imx6sll-evk.dts b/arch/arm/boot/dts/imx6sll-evk.dts index d8163705363e..4a31a415f88e 100644 --- a/arch/arm/boot/dts/imx6sll-evk.dts +++ b/arch/arm/boot/dts/imx6sll-evk.dts | |||
| @@ -309,7 +309,7 @@ | |||
| 309 | pinctrl-2 = <&pinctrl_usdhc3_200mhz>; | 309 | pinctrl-2 = <&pinctrl_usdhc3_200mhz>; |
| 310 | cd-gpios = <&gpio3 22 GPIO_ACTIVE_LOW>; | 310 | cd-gpios = <&gpio3 22 GPIO_ACTIVE_LOW>; |
| 311 | keep-power-in-suspend; | 311 | keep-power-in-suspend; |
| 312 | enable-sdio-wakeup; | 312 | wakeup-source; |
| 313 | vmmc-supply = <®_sd3_vmmc>; | 313 | vmmc-supply = <®_sd3_vmmc>; |
| 314 | status = "okay"; | 314 | status = "okay"; |
| 315 | }; | 315 | }; |
diff --git a/arch/arm/boot/dts/imx6sx.dtsi b/arch/arm/boot/dts/imx6sx.dtsi index 272ff6133ec1..d1375d3650fd 100644 --- a/arch/arm/boot/dts/imx6sx.dtsi +++ b/arch/arm/boot/dts/imx6sx.dtsi | |||
| @@ -467,7 +467,7 @@ | |||
| 467 | }; | 467 | }; |
| 468 | 468 | ||
| 469 | gpt: gpt@2098000 { | 469 | gpt: gpt@2098000 { |
| 470 | compatible = "fsl,imx6sx-gpt", "fsl,imx31-gpt"; | 470 | compatible = "fsl,imx6sx-gpt", "fsl,imx6dl-gpt"; |
| 471 | reg = <0x02098000 0x4000>; | 471 | reg = <0x02098000 0x4000>; |
| 472 | interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>; | 472 | interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>; |
| 473 | clocks = <&clks IMX6SX_CLK_GPT_BUS>, | 473 | clocks = <&clks IMX6SX_CLK_GPT_BUS>, |
diff --git a/arch/arm/boot/dts/kirkwood-dnskw.dtsi b/arch/arm/boot/dts/kirkwood-dnskw.dtsi index cbaf06f2f78e..eb917462b219 100644 --- a/arch/arm/boot/dts/kirkwood-dnskw.dtsi +++ b/arch/arm/boot/dts/kirkwood-dnskw.dtsi | |||
| @@ -36,8 +36,8 @@ | |||
| 36 | compatible = "gpio-fan"; | 36 | compatible = "gpio-fan"; |
| 37 | pinctrl-0 = <&pmx_fan_high_speed &pmx_fan_low_speed>; | 37 | pinctrl-0 = <&pmx_fan_high_speed &pmx_fan_low_speed>; |
| 38 | pinctrl-names = "default"; | 38 | pinctrl-names = "default"; |
| 39 | gpios = <&gpio1 14 GPIO_ACTIVE_LOW | 39 | gpios = <&gpio1 14 GPIO_ACTIVE_HIGH |
| 40 | &gpio1 13 GPIO_ACTIVE_LOW>; | 40 | &gpio1 13 GPIO_ACTIVE_HIGH>; |
| 41 | gpio-fan,speed-map = <0 0 | 41 | gpio-fan,speed-map = <0 0 |
| 42 | 3000 1 | 42 | 3000 1 |
| 43 | 6000 2>; | 43 | 6000 2>; |
diff --git a/arch/arm/boot/dts/meson.dtsi b/arch/arm/boot/dts/meson.dtsi index e4645f612712..2ab74860d962 100644 --- a/arch/arm/boot/dts/meson.dtsi +++ b/arch/arm/boot/dts/meson.dtsi | |||
| @@ -274,7 +274,7 @@ | |||
| 274 | compatible = "amlogic,meson6-dwmac", "snps,dwmac"; | 274 | compatible = "amlogic,meson6-dwmac", "snps,dwmac"; |
| 275 | reg = <0xc9410000 0x10000 | 275 | reg = <0xc9410000 0x10000 |
| 276 | 0xc1108108 0x4>; | 276 | 0xc1108108 0x4>; |
| 277 | interrupts = <GIC_SPI 8 IRQ_TYPE_EDGE_RISING>; | 277 | interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>; |
| 278 | interrupt-names = "macirq"; | 278 | interrupt-names = "macirq"; |
| 279 | status = "disabled"; | 279 | status = "disabled"; |
| 280 | }; | 280 | }; |
diff --git a/arch/arm/boot/dts/meson8b-ec100.dts b/arch/arm/boot/dts/meson8b-ec100.dts index 0872f6e3abf5..d50fc2f60fa3 100644 --- a/arch/arm/boot/dts/meson8b-ec100.dts +++ b/arch/arm/boot/dts/meson8b-ec100.dts | |||
| @@ -205,8 +205,7 @@ | |||
| 205 | cap-sd-highspeed; | 205 | cap-sd-highspeed; |
| 206 | disable-wp; | 206 | disable-wp; |
| 207 | 207 | ||
| 208 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 208 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
| 209 | cd-inverted; | ||
| 210 | 209 | ||
| 211 | vmmc-supply = <&vcc_3v3>; | 210 | vmmc-supply = <&vcc_3v3>; |
| 212 | }; | 211 | }; |
diff --git a/arch/arm/boot/dts/meson8b-odroidc1.dts b/arch/arm/boot/dts/meson8b-odroidc1.dts index 58669abda259..0f0a46ddf3ff 100644 --- a/arch/arm/boot/dts/meson8b-odroidc1.dts +++ b/arch/arm/boot/dts/meson8b-odroidc1.dts | |||
| @@ -221,7 +221,6 @@ | |||
| 221 | /* Realtek RTL8211F (0x001cc916) */ | 221 | /* Realtek RTL8211F (0x001cc916) */ |
| 222 | eth_phy: ethernet-phy@0 { | 222 | eth_phy: ethernet-phy@0 { |
| 223 | reg = <0>; | 223 | reg = <0>; |
| 224 | eee-broken-1000t; | ||
| 225 | interrupt-parent = <&gpio_intc>; | 224 | interrupt-parent = <&gpio_intc>; |
| 226 | /* GPIOH_3 */ | 225 | /* GPIOH_3 */ |
| 227 | interrupts = <17 IRQ_TYPE_LEVEL_LOW>; | 226 | interrupts = <17 IRQ_TYPE_LEVEL_LOW>; |
| @@ -273,8 +272,7 @@ | |||
| 273 | cap-sd-highspeed; | 272 | cap-sd-highspeed; |
| 274 | disable-wp; | 273 | disable-wp; |
| 275 | 274 | ||
| 276 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 275 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
| 277 | cd-inverted; | ||
| 278 | 276 | ||
| 279 | vmmc-supply = <&tflash_vdd>; | 277 | vmmc-supply = <&tflash_vdd>; |
| 280 | vqmmc-supply = <&tf_io>; | 278 | vqmmc-supply = <&tf_io>; |
diff --git a/arch/arm/boot/dts/meson8m2-mxiii-plus.dts b/arch/arm/boot/dts/meson8m2-mxiii-plus.dts index f5853610b20b..6ac02beb5fa7 100644 --- a/arch/arm/boot/dts/meson8m2-mxiii-plus.dts +++ b/arch/arm/boot/dts/meson8m2-mxiii-plus.dts | |||
| @@ -206,8 +206,7 @@ | |||
| 206 | cap-sd-highspeed; | 206 | cap-sd-highspeed; |
| 207 | disable-wp; | 207 | disable-wp; |
| 208 | 208 | ||
| 209 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 209 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
| 210 | cd-inverted; | ||
| 211 | 210 | ||
| 212 | vmmc-supply = <&vcc_3v3>; | 211 | vmmc-supply = <&vcc_3v3>; |
| 213 | }; | 212 | }; |
diff --git a/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi b/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi index ddc7a7bb33c0..f57acf8f66b9 100644 --- a/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi +++ b/arch/arm/boot/dts/motorola-cpcap-mapphone.dtsi | |||
| @@ -105,7 +105,7 @@ | |||
| 105 | interrupts-extended = < | 105 | interrupts-extended = < |
| 106 | &cpcap 15 0 &cpcap 14 0 &cpcap 28 0 &cpcap 19 0 | 106 | &cpcap 15 0 &cpcap 14 0 &cpcap 28 0 &cpcap 19 0 |
| 107 | &cpcap 18 0 &cpcap 17 0 &cpcap 16 0 &cpcap 49 0 | 107 | &cpcap 18 0 &cpcap 17 0 &cpcap 16 0 &cpcap 49 0 |
| 108 | &cpcap 48 1 | 108 | &cpcap 48 0 |
| 109 | >; | 109 | >; |
| 110 | interrupt-names = | 110 | interrupt-names = |
| 111 | "id_ground", "id_float", "se0conn", "vbusvld", | 111 | "id_ground", "id_float", "se0conn", "vbusvld", |
diff --git a/arch/arm/boot/dts/omap3-gta04.dtsi b/arch/arm/boot/dts/omap3-gta04.dtsi index e53d32691308..93b420934e8e 100644 --- a/arch/arm/boot/dts/omap3-gta04.dtsi +++ b/arch/arm/boot/dts/omap3-gta04.dtsi | |||
| @@ -714,11 +714,7 @@ | |||
| 714 | 714 | ||
| 715 | vdda-supply = <&vdac>; | 715 | vdda-supply = <&vdac>; |
| 716 | 716 | ||
| 717 | #address-cells = <1>; | ||
| 718 | #size-cells = <0>; | ||
| 719 | |||
| 720 | port { | 717 | port { |
| 721 | reg = <0>; | ||
| 722 | venc_out: endpoint { | 718 | venc_out: endpoint { |
| 723 | remote-endpoint = <&opa_in>; | 719 | remote-endpoint = <&opa_in>; |
| 724 | ti,channels = <1>; | 720 | ti,channels = <1>; |
diff --git a/arch/arm/boot/dts/omap3-n900.dts b/arch/arm/boot/dts/omap3-n900.dts index 182a53991c90..826920e6b878 100644 --- a/arch/arm/boot/dts/omap3-n900.dts +++ b/arch/arm/boot/dts/omap3-n900.dts | |||
| @@ -814,7 +814,7 @@ | |||
| 814 | /* For debugging, it is often good idea to remove this GPIO. | 814 | /* For debugging, it is often good idea to remove this GPIO. |
| 815 | It means you can remove back cover (to reboot by removing | 815 | It means you can remove back cover (to reboot by removing |
| 816 | battery) and still use the MMC card. */ | 816 | battery) and still use the MMC card. */ |
| 817 | cd-gpios = <&gpio6 0 GPIO_ACTIVE_HIGH>; /* 160 */ | 817 | cd-gpios = <&gpio6 0 GPIO_ACTIVE_LOW>; /* 160 */ |
| 818 | }; | 818 | }; |
| 819 | 819 | ||
| 820 | /* most boards use vaux3, only some old versions use vmmc2 instead */ | 820 | /* most boards use vaux3, only some old versions use vmmc2 instead */ |
diff --git a/arch/arm/boot/dts/omap3-n950-n9.dtsi b/arch/arm/boot/dts/omap3-n950-n9.dtsi index 0d9b85317529..e142e6c70a59 100644 --- a/arch/arm/boot/dts/omap3-n950-n9.dtsi +++ b/arch/arm/boot/dts/omap3-n950-n9.dtsi | |||
| @@ -370,6 +370,19 @@ | |||
| 370 | compatible = "ti,omap2-onenand"; | 370 | compatible = "ti,omap2-onenand"; |
| 371 | reg = <0 0 0x20000>; /* CS0, offset 0, IO size 128K */ | 371 | reg = <0 0 0x20000>; /* CS0, offset 0, IO size 128K */ |
| 372 | 372 | ||
| 373 | /* | ||
| 374 | * These timings are based on CONFIG_OMAP_GPMC_DEBUG=y reported | ||
| 375 | * bootloader set values when booted with v4.19 using both N950 | ||
| 376 | * and N9 devices (OneNAND Manufacturer: Samsung): | ||
| 377 | * | ||
| 378 | * gpmc cs0 before gpmc_cs_program_settings: | ||
| 379 | * cs0 GPMC_CS_CONFIG1: 0xfd001202 | ||
| 380 | * cs0 GPMC_CS_CONFIG2: 0x00181800 | ||
| 381 | * cs0 GPMC_CS_CONFIG3: 0x00030300 | ||
| 382 | * cs0 GPMC_CS_CONFIG4: 0x18001804 | ||
| 383 | * cs0 GPMC_CS_CONFIG5: 0x03171d1d | ||
| 384 | * cs0 GPMC_CS_CONFIG6: 0x97080000 | ||
| 385 | */ | ||
| 373 | gpmc,sync-read; | 386 | gpmc,sync-read; |
| 374 | gpmc,sync-write; | 387 | gpmc,sync-write; |
| 375 | gpmc,burst-length = <16>; | 388 | gpmc,burst-length = <16>; |
| @@ -379,26 +392,27 @@ | |||
| 379 | gpmc,device-width = <2>; | 392 | gpmc,device-width = <2>; |
| 380 | gpmc,mux-add-data = <2>; | 393 | gpmc,mux-add-data = <2>; |
| 381 | gpmc,cs-on-ns = <0>; | 394 | gpmc,cs-on-ns = <0>; |
| 382 | gpmc,cs-rd-off-ns = <87>; | 395 | gpmc,cs-rd-off-ns = <122>; |
| 383 | gpmc,cs-wr-off-ns = <87>; | 396 | gpmc,cs-wr-off-ns = <122>; |
| 384 | gpmc,adv-on-ns = <0>; | 397 | gpmc,adv-on-ns = <0>; |
| 385 | gpmc,adv-rd-off-ns = <10>; | 398 | gpmc,adv-rd-off-ns = <15>; |
| 386 | gpmc,adv-wr-off-ns = <10>; | 399 | gpmc,adv-wr-off-ns = <15>; |
| 387 | gpmc,oe-on-ns = <15>; | 400 | gpmc,oe-on-ns = <20>; |
| 388 | gpmc,oe-off-ns = <87>; | 401 | gpmc,oe-off-ns = <122>; |
| 389 | gpmc,we-on-ns = <0>; | 402 | gpmc,we-on-ns = <0>; |
| 390 | gpmc,we-off-ns = <87>; | 403 | gpmc,we-off-ns = <122>; |
| 391 | gpmc,rd-cycle-ns = <112>; | 404 | gpmc,rd-cycle-ns = <148>; |
| 392 | gpmc,wr-cycle-ns = <112>; | 405 | gpmc,wr-cycle-ns = <148>; |
| 393 | gpmc,access-ns = <81>; | 406 | gpmc,access-ns = <117>; |
| 394 | gpmc,page-burst-access-ns = <15>; | 407 | gpmc,page-burst-access-ns = <15>; |
| 395 | gpmc,bus-turnaround-ns = <0>; | 408 | gpmc,bus-turnaround-ns = <0>; |
| 396 | gpmc,cycle2cycle-delay-ns = <0>; | 409 | gpmc,cycle2cycle-delay-ns = <0>; |
| 397 | gpmc,wait-monitoring-ns = <0>; | 410 | gpmc,wait-monitoring-ns = <0>; |
| 398 | gpmc,clk-activation-ns = <5>; | 411 | gpmc,clk-activation-ns = <10>; |
| 399 | gpmc,wr-data-mux-bus-ns = <30>; | 412 | gpmc,wr-data-mux-bus-ns = <40>; |
| 400 | gpmc,wr-access-ns = <81>; | 413 | gpmc,wr-access-ns = <117>; |
| 401 | gpmc,sync-clk-ps = <15000>; | 414 | |
| 415 | gpmc,sync-clk-ps = <15000>; /* TBC; Where this value came? */ | ||
| 402 | 416 | ||
| 403 | /* | 417 | /* |
| 404 | * MTD partition table corresponding to Nokia's MeeGo 1.2 | 418 | * MTD partition table corresponding to Nokia's MeeGo 1.2 |
diff --git a/arch/arm/boot/dts/omap4-droid4-xt894.dts b/arch/arm/boot/dts/omap4-droid4-xt894.dts index 04758a2a87f0..67d77eee9433 100644 --- a/arch/arm/boot/dts/omap4-droid4-xt894.dts +++ b/arch/arm/boot/dts/omap4-droid4-xt894.dts | |||
| @@ -644,6 +644,17 @@ | |||
| 644 | }; | 644 | }; |
| 645 | }; | 645 | }; |
| 646 | 646 | ||
| 647 | /* Configure pwm clock source for timers 8 & 9 */ | ||
| 648 | &timer8 { | ||
| 649 | assigned-clocks = <&abe_clkctrl OMAP4_TIMER8_CLKCTRL 24>; | ||
| 650 | assigned-clock-parents = <&sys_clkin_ck>; | ||
| 651 | }; | ||
| 652 | |||
| 653 | &timer9 { | ||
| 654 | assigned-clocks = <&l4_per_clkctrl OMAP4_TIMER9_CLKCTRL 24>; | ||
| 655 | assigned-clock-parents = <&sys_clkin_ck>; | ||
| 656 | }; | ||
| 657 | |||
| 647 | /* | 658 | /* |
| 648 | * As uart1 is wired to mdm6600 with rts and cts, we can use the cts pin for | 659 | * As uart1 is wired to mdm6600 with rts and cts, we can use the cts pin for |
| 649 | * uart1 wakeirq. | 660 | * uart1 wakeirq. |
diff --git a/arch/arm/boot/dts/omap5-board-common.dtsi b/arch/arm/boot/dts/omap5-board-common.dtsi index bc853ebeda22..61a06f6add3c 100644 --- a/arch/arm/boot/dts/omap5-board-common.dtsi +++ b/arch/arm/boot/dts/omap5-board-common.dtsi | |||
| @@ -317,7 +317,8 @@ | |||
| 317 | 317 | ||
| 318 | palmas_sys_nirq_pins: pinmux_palmas_sys_nirq_pins { | 318 | palmas_sys_nirq_pins: pinmux_palmas_sys_nirq_pins { |
| 319 | pinctrl-single,pins = < | 319 | pinctrl-single,pins = < |
| 320 | OMAP5_IOPAD(0x068, PIN_INPUT_PULLUP | MUX_MODE0) /* sys_nirq1 */ | 320 | /* sys_nirq1 is pulled down as the SoC is inverting it for GIC */ |
| 321 | OMAP5_IOPAD(0x068, PIN_INPUT_PULLUP | MUX_MODE0) | ||
| 321 | >; | 322 | >; |
| 322 | }; | 323 | }; |
| 323 | 324 | ||
| @@ -385,7 +386,8 @@ | |||
| 385 | 386 | ||
| 386 | palmas: palmas@48 { | 387 | palmas: palmas@48 { |
| 387 | compatible = "ti,palmas"; | 388 | compatible = "ti,palmas"; |
| 388 | interrupts = <GIC_SPI 7 IRQ_TYPE_NONE>; /* IRQ_SYS_1N */ | 389 | /* sys_nirq/ext_sys_irq pins get inverted at mpuss wakeupgen */ |
| 390 | interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_LOW>; | ||
| 389 | reg = <0x48>; | 391 | reg = <0x48>; |
| 390 | interrupt-controller; | 392 | interrupt-controller; |
| 391 | #interrupt-cells = <2>; | 393 | #interrupt-cells = <2>; |
| @@ -651,7 +653,8 @@ | |||
| 651 | pinctrl-names = "default"; | 653 | pinctrl-names = "default"; |
| 652 | pinctrl-0 = <&twl6040_pins>; | 654 | pinctrl-0 = <&twl6040_pins>; |
| 653 | 655 | ||
| 654 | interrupts = <GIC_SPI 119 IRQ_TYPE_NONE>; /* IRQ_SYS_2N cascaded to gic */ | 656 | /* sys_nirq/ext_sys_irq pins get inverted at mpuss wakeupgen */ |
| 657 | interrupts = <GIC_SPI 119 IRQ_TYPE_LEVEL_LOW>; | ||
| 655 | 658 | ||
| 656 | /* audpwron gpio defined in the board specific dts */ | 659 | /* audpwron gpio defined in the board specific dts */ |
| 657 | 660 | ||
diff --git a/arch/arm/boot/dts/omap5-cm-t54.dts b/arch/arm/boot/dts/omap5-cm-t54.dts index 5e21fb430a65..e78d3718f145 100644 --- a/arch/arm/boot/dts/omap5-cm-t54.dts +++ b/arch/arm/boot/dts/omap5-cm-t54.dts | |||
| @@ -181,6 +181,13 @@ | |||
| 181 | OMAP5_IOPAD(0x0042, PIN_INPUT_PULLDOWN | MUX_MODE6) /* llib_wakereqin.gpio1_wk15 */ | 181 | OMAP5_IOPAD(0x0042, PIN_INPUT_PULLDOWN | MUX_MODE6) /* llib_wakereqin.gpio1_wk15 */ |
| 182 | >; | 182 | >; |
| 183 | }; | 183 | }; |
| 184 | |||
| 185 | palmas_sys_nirq_pins: pinmux_palmas_sys_nirq_pins { | ||
| 186 | pinctrl-single,pins = < | ||
| 187 | /* sys_nirq1 is pulled down as the SoC is inverting it for GIC */ | ||
| 188 | OMAP5_IOPAD(0x068, PIN_INPUT_PULLUP | MUX_MODE0) | ||
| 189 | >; | ||
| 190 | }; | ||
| 184 | }; | 191 | }; |
| 185 | 192 | ||
| 186 | &omap5_pmx_core { | 193 | &omap5_pmx_core { |
| @@ -414,8 +421,11 @@ | |||
| 414 | 421 | ||
| 415 | palmas: palmas@48 { | 422 | palmas: palmas@48 { |
| 416 | compatible = "ti,palmas"; | 423 | compatible = "ti,palmas"; |
| 417 | interrupts = <GIC_SPI 7 IRQ_TYPE_NONE>; /* IRQ_SYS_1N */ | ||
| 418 | reg = <0x48>; | 424 | reg = <0x48>; |
| 425 | pinctrl-0 = <&palmas_sys_nirq_pins>; | ||
| 426 | pinctrl-names = "default"; | ||
| 427 | /* sys_nirq/ext_sys_irq pins get inverted at mpuss wakeupgen */ | ||
| 428 | interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_LOW>; | ||
| 419 | interrupt-controller; | 429 | interrupt-controller; |
| 420 | #interrupt-cells = <2>; | 430 | #interrupt-cells = <2>; |
| 421 | ti,system-power-controller; | 431 | ti,system-power-controller; |
diff --git a/arch/arm/boot/dts/omap5-l4.dtsi b/arch/arm/boot/dts/omap5-l4.dtsi index 9c7e309d9c2c..0960348002ad 100644 --- a/arch/arm/boot/dts/omap5-l4.dtsi +++ b/arch/arm/boot/dts/omap5-l4.dtsi | |||
| @@ -1046,8 +1046,6 @@ | |||
| 1046 | <SYSC_IDLE_SMART>, | 1046 | <SYSC_IDLE_SMART>, |
| 1047 | <SYSC_IDLE_SMART_WKUP>; | 1047 | <SYSC_IDLE_SMART_WKUP>; |
| 1048 | ti,syss-mask = <1>; | 1048 | ti,syss-mask = <1>; |
| 1049 | ti,no-reset-on-init; | ||
| 1050 | ti,no-idle-on-init; | ||
| 1051 | /* Domains (V, P, C): core, core_pwrdm, l4per_clkdm */ | 1049 | /* Domains (V, P, C): core, core_pwrdm, l4per_clkdm */ |
| 1052 | clocks = <&l4per_clkctrl OMAP5_UART3_CLKCTRL 0>; | 1050 | clocks = <&l4per_clkctrl OMAP5_UART3_CLKCTRL 0>; |
| 1053 | clock-names = "fck"; | 1051 | clock-names = "fck"; |
diff --git a/arch/arm/boot/dts/r8a7743.dtsi b/arch/arm/boot/dts/r8a7743.dtsi index 3cc33f7ff7fe..3adc158a40bb 100644 --- a/arch/arm/boot/dts/r8a7743.dtsi +++ b/arch/arm/boot/dts/r8a7743.dtsi | |||
| @@ -1681,15 +1681,12 @@ | |||
| 1681 | 1681 | ||
| 1682 | du: display@feb00000 { | 1682 | du: display@feb00000 { |
| 1683 | compatible = "renesas,du-r8a7743"; | 1683 | compatible = "renesas,du-r8a7743"; |
| 1684 | reg = <0 0xfeb00000 0 0x40000>, | 1684 | reg = <0 0xfeb00000 0 0x40000>; |
| 1685 | <0 0xfeb90000 0 0x1c>; | ||
| 1686 | reg-names = "du", "lvds.0"; | ||
| 1687 | interrupts = <GIC_SPI 256 IRQ_TYPE_LEVEL_HIGH>, | 1685 | interrupts = <GIC_SPI 256 IRQ_TYPE_LEVEL_HIGH>, |
| 1688 | <GIC_SPI 268 IRQ_TYPE_LEVEL_HIGH>; | 1686 | <GIC_SPI 268 IRQ_TYPE_LEVEL_HIGH>; |
| 1689 | clocks = <&cpg CPG_MOD 724>, | 1687 | clocks = <&cpg CPG_MOD 724>, |
| 1690 | <&cpg CPG_MOD 723>, | 1688 | <&cpg CPG_MOD 723>; |
| 1691 | <&cpg CPG_MOD 726>; | 1689 | clock-names = "du.0", "du.1"; |
| 1692 | clock-names = "du.0", "du.1", "lvds.0"; | ||
| 1693 | status = "disabled"; | 1690 | status = "disabled"; |
| 1694 | 1691 | ||
| 1695 | ports { | 1692 | ports { |
| @@ -1704,6 +1701,33 @@ | |||
| 1704 | port@1 { | 1701 | port@1 { |
| 1705 | reg = <1>; | 1702 | reg = <1>; |
| 1706 | du_out_lvds0: endpoint { | 1703 | du_out_lvds0: endpoint { |
| 1704 | remote-endpoint = <&lvds0_in>; | ||
| 1705 | }; | ||
| 1706 | }; | ||
| 1707 | }; | ||
| 1708 | }; | ||
| 1709 | |||
| 1710 | lvds0: lvds@feb90000 { | ||
| 1711 | compatible = "renesas,r8a7743-lvds"; | ||
| 1712 | reg = <0 0xfeb90000 0 0x1c>; | ||
| 1713 | clocks = <&cpg CPG_MOD 726>; | ||
| 1714 | power-domains = <&sysc R8A7743_PD_ALWAYS_ON>; | ||
| 1715 | resets = <&cpg 726>; | ||
| 1716 | status = "disabled"; | ||
| 1717 | |||
| 1718 | ports { | ||
| 1719 | #address-cells = <1>; | ||
| 1720 | #size-cells = <0>; | ||
| 1721 | |||
| 1722 | port@0 { | ||
| 1723 | reg = <0>; | ||
| 1724 | lvds0_in: endpoint { | ||
| 1725 | remote-endpoint = <&du_out_lvds0>; | ||
| 1726 | }; | ||
| 1727 | }; | ||
| 1728 | port@1 { | ||
| 1729 | reg = <1>; | ||
| 1730 | lvds0_out: endpoint { | ||
| 1707 | }; | 1731 | }; |
| 1708 | }; | 1732 | }; |
| 1709 | }; | 1733 | }; |
diff --git a/arch/arm/boot/dts/rk3188.dtsi b/arch/arm/boot/dts/rk3188.dtsi index 4acb501dd3f8..3ed49898f4b2 100644 --- a/arch/arm/boot/dts/rk3188.dtsi +++ b/arch/arm/boot/dts/rk3188.dtsi | |||
| @@ -719,7 +719,6 @@ | |||
| 719 | pm_qos = <&qos_lcdc0>, | 719 | pm_qos = <&qos_lcdc0>, |
| 720 | <&qos_lcdc1>, | 720 | <&qos_lcdc1>, |
| 721 | <&qos_cif0>, | 721 | <&qos_cif0>, |
| 722 | <&qos_cif1>, | ||
| 723 | <&qos_ipp>, | 722 | <&qos_ipp>, |
| 724 | <&qos_rga>; | 723 | <&qos_rga>; |
| 725 | }; | 724 | }; |
diff --git a/arch/arm/boot/dts/sun6i-a31.dtsi b/arch/arm/boot/dts/sun6i-a31.dtsi index 353d90f99b40..13304b8c5139 100644 --- a/arch/arm/boot/dts/sun6i-a31.dtsi +++ b/arch/arm/boot/dts/sun6i-a31.dtsi | |||
| @@ -216,6 +216,7 @@ | |||
| 216 | #clock-cells = <0>; | 216 | #clock-cells = <0>; |
| 217 | compatible = "fixed-clock"; | 217 | compatible = "fixed-clock"; |
| 218 | clock-frequency = <24000000>; | 218 | clock-frequency = <24000000>; |
| 219 | clock-output-names = "osc24M"; | ||
| 219 | }; | 220 | }; |
| 220 | 221 | ||
| 221 | osc32k: clk-32k { | 222 | osc32k: clk-32k { |
diff --git a/arch/arm/boot/dts/sun8i-h3-beelink-x2.dts b/arch/arm/boot/dts/sun8i-h3-beelink-x2.dts index 5d23667dc2d2..25540b7694d5 100644 --- a/arch/arm/boot/dts/sun8i-h3-beelink-x2.dts +++ b/arch/arm/boot/dts/sun8i-h3-beelink-x2.dts | |||
| @@ -53,7 +53,7 @@ | |||
| 53 | 53 | ||
| 54 | aliases { | 54 | aliases { |
| 55 | serial0 = &uart0; | 55 | serial0 = &uart0; |
| 56 | /* ethernet0 is the H3 emac, defined in sun8i-h3.dtsi */ | 56 | ethernet0 = &emac; |
| 57 | ethernet1 = &sdiowifi; | 57 | ethernet1 = &sdiowifi; |
| 58 | }; | 58 | }; |
| 59 | 59 | ||
diff --git a/arch/arm/boot/dts/tegra124-nyan.dtsi b/arch/arm/boot/dts/tegra124-nyan.dtsi index d5f11d6d987e..bc85b6a166c7 100644 --- a/arch/arm/boot/dts/tegra124-nyan.dtsi +++ b/arch/arm/boot/dts/tegra124-nyan.dtsi | |||
| @@ -13,10 +13,25 @@ | |||
| 13 | stdout-path = "serial0:115200n8"; | 13 | stdout-path = "serial0:115200n8"; |
| 14 | }; | 14 | }; |
| 15 | 15 | ||
| 16 | memory@80000000 { | 16 | /* |
| 17 | * Note that recent version of the device tree compiler (starting with | ||
| 18 | * version 1.4.2) warn about this node containing a reg property, but | ||
| 19 | * missing a unit-address. However, the bootloader on these Chromebook | ||
| 20 | * devices relies on the full name of this node to be exactly /memory. | ||
| 21 | * Adding the unit-address causes the bootloader to create a /memory | ||
| 22 | * node and write the memory bank configuration to that node, which in | ||
| 23 | * turn leads the kernel to believe that the device has 2 GiB of | ||
| 24 | * memory instead of the amount detected by the bootloader. | ||
| 25 | * | ||
| 26 | * The name of this node is effectively ABI and must not be changed. | ||
| 27 | */ | ||
| 28 | memory { | ||
| 29 | device_type = "memory"; | ||
| 17 | reg = <0x0 0x80000000 0x0 0x80000000>; | 30 | reg = <0x0 0x80000000 0x0 0x80000000>; |
| 18 | }; | 31 | }; |
| 19 | 32 | ||
| 33 | /delete-node/ memory@80000000; | ||
| 34 | |||
| 20 | host1x@50000000 { | 35 | host1x@50000000 { |
| 21 | hdmi@54280000 { | 36 | hdmi@54280000 { |
| 22 | status = "okay"; | 37 | status = "okay"; |
diff --git a/arch/arm/boot/dts/vf610-bk4.dts b/arch/arm/boot/dts/vf610-bk4.dts index 689c8930dce3..b08d561d6748 100644 --- a/arch/arm/boot/dts/vf610-bk4.dts +++ b/arch/arm/boot/dts/vf610-bk4.dts | |||
| @@ -110,11 +110,11 @@ | |||
| 110 | bus-num = <3>; | 110 | bus-num = <3>; |
| 111 | status = "okay"; | 111 | status = "okay"; |
| 112 | spi-slave; | 112 | spi-slave; |
| 113 | #address-cells = <0>; | ||
| 113 | 114 | ||
| 114 | slave@0 { | 115 | slave { |
| 115 | compatible = "lwn,bk4"; | 116 | compatible = "lwn,bk4"; |
| 116 | spi-max-frequency = <30000000>; | 117 | spi-max-frequency = <30000000>; |
| 117 | reg = <0>; | ||
| 118 | }; | 118 | }; |
| 119 | }; | 119 | }; |
| 120 | 120 | ||
diff --git a/arch/arm/include/asm/irq.h b/arch/arm/include/asm/irq.h index c883fcbe93b6..46d41140df27 100644 --- a/arch/arm/include/asm/irq.h +++ b/arch/arm/include/asm/irq.h | |||
| @@ -25,7 +25,6 @@ | |||
| 25 | #ifndef __ASSEMBLY__ | 25 | #ifndef __ASSEMBLY__ |
| 26 | struct irqaction; | 26 | struct irqaction; |
| 27 | struct pt_regs; | 27 | struct pt_regs; |
| 28 | extern void migrate_irqs(void); | ||
| 29 | 28 | ||
| 30 | extern void asm_do_IRQ(unsigned int, struct pt_regs *); | 29 | extern void asm_do_IRQ(unsigned int, struct pt_regs *); |
| 31 | void handle_IRQ(unsigned int, struct pt_regs *); | 30 | void handle_IRQ(unsigned int, struct pt_regs *); |
diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h index ca56537b61bc..50e89869178a 100644 --- a/arch/arm/include/asm/kvm_host.h +++ b/arch/arm/include/asm/kvm_host.h | |||
| @@ -48,6 +48,7 @@ | |||
| 48 | #define KVM_REQ_SLEEP \ | 48 | #define KVM_REQ_SLEEP \ |
| 49 | KVM_ARCH_REQ_FLAGS(0, KVM_REQUEST_WAIT | KVM_REQUEST_NO_WAKEUP) | 49 | KVM_ARCH_REQ_FLAGS(0, KVM_REQUEST_WAIT | KVM_REQUEST_NO_WAKEUP) |
| 50 | #define KVM_REQ_IRQ_PENDING KVM_ARCH_REQ(1) | 50 | #define KVM_REQ_IRQ_PENDING KVM_ARCH_REQ(1) |
| 51 | #define KVM_REQ_VCPU_RESET KVM_ARCH_REQ(2) | ||
| 51 | 52 | ||
| 52 | DECLARE_STATIC_KEY_FALSE(userspace_irqchip_in_use); | 53 | DECLARE_STATIC_KEY_FALSE(userspace_irqchip_in_use); |
| 53 | 54 | ||
| @@ -147,6 +148,13 @@ struct kvm_cpu_context { | |||
| 147 | 148 | ||
| 148 | typedef struct kvm_cpu_context kvm_cpu_context_t; | 149 | typedef struct kvm_cpu_context kvm_cpu_context_t; |
| 149 | 150 | ||
| 151 | struct vcpu_reset_state { | ||
| 152 | unsigned long pc; | ||
| 153 | unsigned long r0; | ||
| 154 | bool be; | ||
| 155 | bool reset; | ||
| 156 | }; | ||
| 157 | |||
| 150 | struct kvm_vcpu_arch { | 158 | struct kvm_vcpu_arch { |
| 151 | struct kvm_cpu_context ctxt; | 159 | struct kvm_cpu_context ctxt; |
| 152 | 160 | ||
| @@ -186,6 +194,8 @@ struct kvm_vcpu_arch { | |||
| 186 | /* Cache some mmu pages needed inside spinlock regions */ | 194 | /* Cache some mmu pages needed inside spinlock regions */ |
| 187 | struct kvm_mmu_memory_cache mmu_page_cache; | 195 | struct kvm_mmu_memory_cache mmu_page_cache; |
| 188 | 196 | ||
| 197 | struct vcpu_reset_state reset_state; | ||
| 198 | |||
| 189 | /* Detect first run of a vcpu */ | 199 | /* Detect first run of a vcpu */ |
| 190 | bool has_run_once; | 200 | bool has_run_once; |
| 191 | }; | 201 | }; |
diff --git a/arch/arm/include/asm/stage2_pgtable.h b/arch/arm/include/asm/stage2_pgtable.h index c4b1d4fb1797..de2089501b8b 100644 --- a/arch/arm/include/asm/stage2_pgtable.h +++ b/arch/arm/include/asm/stage2_pgtable.h | |||
| @@ -76,4 +76,9 @@ static inline bool kvm_stage2_has_pud(struct kvm *kvm) | |||
| 76 | #define S2_PMD_MASK PMD_MASK | 76 | #define S2_PMD_MASK PMD_MASK |
| 77 | #define S2_PMD_SIZE PMD_SIZE | 77 | #define S2_PMD_SIZE PMD_SIZE |
| 78 | 78 | ||
| 79 | static inline bool kvm_stage2_has_pmd(struct kvm *kvm) | ||
| 80 | { | ||
| 81 | return true; | ||
| 82 | } | ||
| 83 | |||
| 79 | #endif /* __ARM_S2_PGTABLE_H_ */ | 84 | #endif /* __ARM_S2_PGTABLE_H_ */ |
diff --git a/arch/arm/include/asm/xen/page-coherent.h b/arch/arm/include/asm/xen/page-coherent.h index b3ef061d8b74..2c403e7c782d 100644 --- a/arch/arm/include/asm/xen/page-coherent.h +++ b/arch/arm/include/asm/xen/page-coherent.h | |||
| @@ -1 +1,95 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | #ifndef _ASM_ARM_XEN_PAGE_COHERENT_H | ||
| 3 | #define _ASM_ARM_XEN_PAGE_COHERENT_H | ||
| 4 | |||
| 5 | #include <linux/dma-mapping.h> | ||
| 6 | #include <asm/page.h> | ||
| 1 | #include <xen/arm/page-coherent.h> | 7 | #include <xen/arm/page-coherent.h> |
| 8 | |||
| 9 | static inline const struct dma_map_ops *xen_get_dma_ops(struct device *dev) | ||
| 10 | { | ||
| 11 | if (dev && dev->archdata.dev_dma_ops) | ||
| 12 | return dev->archdata.dev_dma_ops; | ||
| 13 | return get_arch_dma_ops(NULL); | ||
| 14 | } | ||
| 15 | |||
| 16 | static inline void *xen_alloc_coherent_pages(struct device *hwdev, size_t size, | ||
| 17 | dma_addr_t *dma_handle, gfp_t flags, unsigned long attrs) | ||
| 18 | { | ||
| 19 | return xen_get_dma_ops(hwdev)->alloc(hwdev, size, dma_handle, flags, attrs); | ||
| 20 | } | ||
| 21 | |||
| 22 | static inline void xen_free_coherent_pages(struct device *hwdev, size_t size, | ||
| 23 | void *cpu_addr, dma_addr_t dma_handle, unsigned long attrs) | ||
| 24 | { | ||
| 25 | xen_get_dma_ops(hwdev)->free(hwdev, size, cpu_addr, dma_handle, attrs); | ||
| 26 | } | ||
| 27 | |||
| 28 | static inline void xen_dma_map_page(struct device *hwdev, struct page *page, | ||
| 29 | dma_addr_t dev_addr, unsigned long offset, size_t size, | ||
| 30 | enum dma_data_direction dir, unsigned long attrs) | ||
| 31 | { | ||
| 32 | unsigned long page_pfn = page_to_xen_pfn(page); | ||
| 33 | unsigned long dev_pfn = XEN_PFN_DOWN(dev_addr); | ||
| 34 | unsigned long compound_pages = | ||
| 35 | (1<<compound_order(page)) * XEN_PFN_PER_PAGE; | ||
| 36 | bool local = (page_pfn <= dev_pfn) && | ||
| 37 | (dev_pfn - page_pfn < compound_pages); | ||
| 38 | |||
| 39 | /* | ||
| 40 | * Dom0 is mapped 1:1, while the Linux page can span across | ||
| 41 | * multiple Xen pages, it's not possible for it to contain a | ||
| 42 | * mix of local and foreign Xen pages. So if the first xen_pfn | ||
| 43 | * == mfn the page is local otherwise it's a foreign page | ||
| 44 | * grant-mapped in dom0. If the page is local we can safely | ||
| 45 | * call the native dma_ops function, otherwise we call the xen | ||
| 46 | * specific function. | ||
| 47 | */ | ||
| 48 | if (local) | ||
| 49 | xen_get_dma_ops(hwdev)->map_page(hwdev, page, offset, size, dir, attrs); | ||
| 50 | else | ||
| 51 | __xen_dma_map_page(hwdev, page, dev_addr, offset, size, dir, attrs); | ||
| 52 | } | ||
| 53 | |||
| 54 | static inline void xen_dma_unmap_page(struct device *hwdev, dma_addr_t handle, | ||
| 55 | size_t size, enum dma_data_direction dir, unsigned long attrs) | ||
| 56 | { | ||
| 57 | unsigned long pfn = PFN_DOWN(handle); | ||
| 58 | /* | ||
| 59 | * Dom0 is mapped 1:1, while the Linux page can be spanned accross | ||
| 60 | * multiple Xen page, it's not possible to have a mix of local and | ||
| 61 | * foreign Xen page. Dom0 is mapped 1:1, so calling pfn_valid on a | ||
| 62 | * foreign mfn will always return false. If the page is local we can | ||
| 63 | * safely call the native dma_ops function, otherwise we call the xen | ||
| 64 | * specific function. | ||
| 65 | */ | ||
| 66 | if (pfn_valid(pfn)) { | ||
| 67 | if (xen_get_dma_ops(hwdev)->unmap_page) | ||
| 68 | xen_get_dma_ops(hwdev)->unmap_page(hwdev, handle, size, dir, attrs); | ||
| 69 | } else | ||
| 70 | __xen_dma_unmap_page(hwdev, handle, size, dir, attrs); | ||
| 71 | } | ||
| 72 | |||
| 73 | static inline void xen_dma_sync_single_for_cpu(struct device *hwdev, | ||
| 74 | dma_addr_t handle, size_t size, enum dma_data_direction dir) | ||
| 75 | { | ||
| 76 | unsigned long pfn = PFN_DOWN(handle); | ||
| 77 | if (pfn_valid(pfn)) { | ||
| 78 | if (xen_get_dma_ops(hwdev)->sync_single_for_cpu) | ||
| 79 | xen_get_dma_ops(hwdev)->sync_single_for_cpu(hwdev, handle, size, dir); | ||
| 80 | } else | ||
| 81 | __xen_dma_sync_single_for_cpu(hwdev, handle, size, dir); | ||
| 82 | } | ||
| 83 | |||
| 84 | static inline void xen_dma_sync_single_for_device(struct device *hwdev, | ||
| 85 | dma_addr_t handle, size_t size, enum dma_data_direction dir) | ||
| 86 | { | ||
| 87 | unsigned long pfn = PFN_DOWN(handle); | ||
| 88 | if (pfn_valid(pfn)) { | ||
| 89 | if (xen_get_dma_ops(hwdev)->sync_single_for_device) | ||
| 90 | xen_get_dma_ops(hwdev)->sync_single_for_device(hwdev, handle, size, dir); | ||
| 91 | } else | ||
| 92 | __xen_dma_sync_single_for_device(hwdev, handle, size, dir); | ||
| 93 | } | ||
| 94 | |||
| 95 | #endif /* _ASM_ARM_XEN_PAGE_COHERENT_H */ | ||
diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c index 9908dacf9229..844861368cd5 100644 --- a/arch/arm/kernel/irq.c +++ b/arch/arm/kernel/irq.c | |||
| @@ -31,7 +31,6 @@ | |||
| 31 | #include <linux/smp.h> | 31 | #include <linux/smp.h> |
| 32 | #include <linux/init.h> | 32 | #include <linux/init.h> |
| 33 | #include <linux/seq_file.h> | 33 | #include <linux/seq_file.h> |
| 34 | #include <linux/ratelimit.h> | ||
| 35 | #include <linux/errno.h> | 34 | #include <linux/errno.h> |
| 36 | #include <linux/list.h> | 35 | #include <linux/list.h> |
| 37 | #include <linux/kallsyms.h> | 36 | #include <linux/kallsyms.h> |
| @@ -109,64 +108,3 @@ int __init arch_probe_nr_irqs(void) | |||
| 109 | return nr_irqs; | 108 | return nr_irqs; |
| 110 | } | 109 | } |
| 111 | #endif | 110 | #endif |
| 112 | |||
| 113 | #ifdef CONFIG_HOTPLUG_CPU | ||
| 114 | static bool migrate_one_irq(struct irq_desc *desc) | ||
| 115 | { | ||
| 116 | struct irq_data *d = irq_desc_get_irq_data(desc); | ||
| 117 | const struct cpumask *affinity = irq_data_get_affinity_mask(d); | ||
| 118 | struct irq_chip *c; | ||
| 119 | bool ret = false; | ||
| 120 | |||
| 121 | /* | ||
| 122 | * If this is a per-CPU interrupt, or the affinity does not | ||
| 123 | * include this CPU, then we have nothing to do. | ||
| 124 | */ | ||
| 125 | if (irqd_is_per_cpu(d) || !cpumask_test_cpu(smp_processor_id(), affinity)) | ||
| 126 | return false; | ||
| 127 | |||
| 128 | if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) { | ||
| 129 | affinity = cpu_online_mask; | ||
| 130 | ret = true; | ||
| 131 | } | ||
| 132 | |||
| 133 | c = irq_data_get_irq_chip(d); | ||
| 134 | if (!c->irq_set_affinity) | ||
| 135 | pr_debug("IRQ%u: unable to set affinity\n", d->irq); | ||
| 136 | else if (c->irq_set_affinity(d, affinity, false) == IRQ_SET_MASK_OK && ret) | ||
| 137 | cpumask_copy(irq_data_get_affinity_mask(d), affinity); | ||
| 138 | |||
| 139 | return ret; | ||
| 140 | } | ||
| 141 | |||
| 142 | /* | ||
| 143 | * The current CPU has been marked offline. Migrate IRQs off this CPU. | ||
| 144 | * If the affinity settings do not allow other CPUs, force them onto any | ||
| 145 | * available CPU. | ||
| 146 | * | ||
| 147 | * Note: we must iterate over all IRQs, whether they have an attached | ||
| 148 | * action structure or not, as we need to get chained interrupts too. | ||
| 149 | */ | ||
| 150 | void migrate_irqs(void) | ||
| 151 | { | ||
| 152 | unsigned int i; | ||
| 153 | struct irq_desc *desc; | ||
| 154 | unsigned long flags; | ||
| 155 | |||
| 156 | local_irq_save(flags); | ||
| 157 | |||
| 158 | for_each_irq_desc(i, desc) { | ||
| 159 | bool affinity_broken; | ||
| 160 | |||
| 161 | raw_spin_lock(&desc->lock); | ||
| 162 | affinity_broken = migrate_one_irq(desc); | ||
| 163 | raw_spin_unlock(&desc->lock); | ||
| 164 | |||
| 165 | if (affinity_broken) | ||
| 166 | pr_warn_ratelimited("IRQ%u no longer affine to CPU%u\n", | ||
| 167 | i, smp_processor_id()); | ||
| 168 | } | ||
| 169 | |||
| 170 | local_irq_restore(flags); | ||
| 171 | } | ||
| 172 | #endif /* CONFIG_HOTPLUG_CPU */ | ||
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index 3bf82232b1be..1d6f5ea522f4 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c | |||
| @@ -254,7 +254,7 @@ int __cpu_disable(void) | |||
| 254 | /* | 254 | /* |
| 255 | * OK - migrate IRQs away from this CPU | 255 | * OK - migrate IRQs away from this CPU |
| 256 | */ | 256 | */ |
| 257 | migrate_irqs(); | 257 | irq_migrate_all_off_this_cpu(); |
| 258 | 258 | ||
| 259 | /* | 259 | /* |
| 260 | * Flush user cache and TLB mappings, and then remove this CPU | 260 | * Flush user cache and TLB mappings, and then remove this CPU |
diff --git a/arch/arm/kvm/coproc.c b/arch/arm/kvm/coproc.c index 222c1635bc7a..e8bd288fd5be 100644 --- a/arch/arm/kvm/coproc.c +++ b/arch/arm/kvm/coproc.c | |||
| @@ -1450,6 +1450,6 @@ void kvm_reset_coprocs(struct kvm_vcpu *vcpu) | |||
| 1450 | reset_coproc_regs(vcpu, table, num); | 1450 | reset_coproc_regs(vcpu, table, num); |
| 1451 | 1451 | ||
| 1452 | for (num = 1; num < NR_CP15_REGS; num++) | 1452 | for (num = 1; num < NR_CP15_REGS; num++) |
| 1453 | if (vcpu_cp15(vcpu, num) == 0x42424242) | 1453 | WARN(vcpu_cp15(vcpu, num) == 0x42424242, |
| 1454 | panic("Didn't reset vcpu_cp15(vcpu, %zi)", num); | 1454 | "Didn't reset vcpu_cp15(vcpu, %zi)", num); |
| 1455 | } | 1455 | } |
diff --git a/arch/arm/kvm/reset.c b/arch/arm/kvm/reset.c index 5ed0c3ee33d6..e53327912adc 100644 --- a/arch/arm/kvm/reset.c +++ b/arch/arm/kvm/reset.c | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | #include <asm/cputype.h> | 26 | #include <asm/cputype.h> |
| 27 | #include <asm/kvm_arm.h> | 27 | #include <asm/kvm_arm.h> |
| 28 | #include <asm/kvm_coproc.h> | 28 | #include <asm/kvm_coproc.h> |
| 29 | #include <asm/kvm_emulate.h> | ||
| 29 | 30 | ||
| 30 | #include <kvm/arm_arch_timer.h> | 31 | #include <kvm/arm_arch_timer.h> |
| 31 | 32 | ||
| @@ -69,6 +70,29 @@ int kvm_reset_vcpu(struct kvm_vcpu *vcpu) | |||
| 69 | /* Reset CP15 registers */ | 70 | /* Reset CP15 registers */ |
| 70 | kvm_reset_coprocs(vcpu); | 71 | kvm_reset_coprocs(vcpu); |
| 71 | 72 | ||
| 73 | /* | ||
| 74 | * Additional reset state handling that PSCI may have imposed on us. | ||
| 75 | * Must be done after all the sys_reg reset. | ||
| 76 | */ | ||
| 77 | if (READ_ONCE(vcpu->arch.reset_state.reset)) { | ||
| 78 | unsigned long target_pc = vcpu->arch.reset_state.pc; | ||
| 79 | |||
| 80 | /* Gracefully handle Thumb2 entry point */ | ||
| 81 | if (target_pc & 1) { | ||
| 82 | target_pc &= ~1UL; | ||
| 83 | vcpu_set_thumb(vcpu); | ||
| 84 | } | ||
| 85 | |||
| 86 | /* Propagate caller endianness */ | ||
| 87 | if (vcpu->arch.reset_state.be) | ||
| 88 | kvm_vcpu_set_be(vcpu); | ||
| 89 | |||
| 90 | *vcpu_pc(vcpu) = target_pc; | ||
| 91 | vcpu_set_reg(vcpu, 0, vcpu->arch.reset_state.r0); | ||
| 92 | |||
| 93 | vcpu->arch.reset_state.reset = false; | ||
| 94 | } | ||
| 95 | |||
| 72 | /* Reset arch_timer context */ | 96 | /* Reset arch_timer context */ |
| 73 | return kvm_timer_vcpu_reset(vcpu); | 97 | return kvm_timer_vcpu_reset(vcpu); |
| 74 | } | 98 | } |
diff --git a/arch/arm/mach-cns3xxx/pcie.c b/arch/arm/mach-cns3xxx/pcie.c index 318394ed5c7a..95a11d5b3587 100644 --- a/arch/arm/mach-cns3xxx/pcie.c +++ b/arch/arm/mach-cns3xxx/pcie.c | |||
| @@ -83,7 +83,7 @@ static void __iomem *cns3xxx_pci_map_bus(struct pci_bus *bus, | |||
| 83 | } else /* remote PCI bus */ | 83 | } else /* remote PCI bus */ |
| 84 | base = cnspci->cfg1_regs + ((busno & 0xf) << 20); | 84 | base = cnspci->cfg1_regs + ((busno & 0xf) << 20); |
| 85 | 85 | ||
| 86 | return base + (where & 0xffc) + (devfn << 12); | 86 | return base + where + (devfn << 12); |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | static int cns3xxx_pci_read_config(struct pci_bus *bus, unsigned int devfn, | 89 | static int cns3xxx_pci_read_config(struct pci_bus *bus, unsigned int devfn, |
| @@ -93,7 +93,7 @@ static int cns3xxx_pci_read_config(struct pci_bus *bus, unsigned int devfn, | |||
| 93 | u32 mask = (0x1ull << (size * 8)) - 1; | 93 | u32 mask = (0x1ull << (size * 8)) - 1; |
| 94 | int shift = (where % 4) * 8; | 94 | int shift = (where % 4) * 8; |
| 95 | 95 | ||
| 96 | ret = pci_generic_config_read32(bus, devfn, where, size, val); | 96 | ret = pci_generic_config_read(bus, devfn, where, size, val); |
| 97 | 97 | ||
| 98 | if (ret == PCIBIOS_SUCCESSFUL && !bus->number && !devfn && | 98 | if (ret == PCIBIOS_SUCCESSFUL && !bus->number && !devfn && |
| 99 | (where & 0xffc) == PCI_CLASS_REVISION) | 99 | (where & 0xffc) == PCI_CLASS_REVISION) |
diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c index e52ec1619b70..c4da635ee4ce 100644 --- a/arch/arm/mach-davinci/board-da830-evm.c +++ b/arch/arm/mach-davinci/board-da830-evm.c | |||
| @@ -208,9 +208,9 @@ static struct gpiod_lookup_table mmc_gpios_table = { | |||
| 208 | .dev_id = "da830-mmc.0", | 208 | .dev_id = "da830-mmc.0", |
| 209 | .table = { | 209 | .table = { |
| 210 | /* gpio chip 1 contains gpio range 32-63 */ | 210 | /* gpio chip 1 contains gpio range 32-63 */ |
| 211 | GPIO_LOOKUP("davinci_gpio.0", DA830_MMCSD_CD_PIN, "cd", | 211 | GPIO_LOOKUP("davinci_gpio", DA830_MMCSD_CD_PIN, "cd", |
| 212 | GPIO_ACTIVE_LOW), | 212 | GPIO_ACTIVE_LOW), |
| 213 | GPIO_LOOKUP("davinci_gpio.0", DA830_MMCSD_WP_PIN, "wp", | 213 | GPIO_LOOKUP("davinci_gpio", DA830_MMCSD_WP_PIN, "wp", |
| 214 | GPIO_ACTIVE_LOW), | 214 | GPIO_ACTIVE_LOW), |
| 215 | }, | 215 | }, |
| 216 | }; | 216 | }; |
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c index 6a29baf0a289..44bca048dfd0 100644 --- a/arch/arm/mach-davinci/board-da850-evm.c +++ b/arch/arm/mach-davinci/board-da850-evm.c | |||
| @@ -805,9 +805,9 @@ static struct gpiod_lookup_table mmc_gpios_table = { | |||
| 805 | .dev_id = "da830-mmc.0", | 805 | .dev_id = "da830-mmc.0", |
| 806 | .table = { | 806 | .table = { |
| 807 | /* gpio chip 2 contains gpio range 64-95 */ | 807 | /* gpio chip 2 contains gpio range 64-95 */ |
| 808 | GPIO_LOOKUP("davinci_gpio.0", DA850_MMCSD_CD_PIN, "cd", | 808 | GPIO_LOOKUP("davinci_gpio", DA850_MMCSD_CD_PIN, "cd", |
| 809 | GPIO_ACTIVE_LOW), | 809 | GPIO_ACTIVE_LOW), |
| 810 | GPIO_LOOKUP("davinci_gpio.0", DA850_MMCSD_WP_PIN, "wp", | 810 | GPIO_LOOKUP("davinci_gpio", DA850_MMCSD_WP_PIN, "wp", |
| 811 | GPIO_ACTIVE_HIGH), | 811 | GPIO_ACTIVE_HIGH), |
| 812 | }, | 812 | }, |
| 813 | }; | 813 | }; |
diff --git a/arch/arm/mach-davinci/board-dm355-evm.c b/arch/arm/mach-davinci/board-dm355-evm.c index f53a461a606f..f7fa960c23e3 100644 --- a/arch/arm/mach-davinci/board-dm355-evm.c +++ b/arch/arm/mach-davinci/board-dm355-evm.c | |||
| @@ -117,9 +117,9 @@ static struct platform_device davinci_nand_device = { | |||
| 117 | static struct gpiod_lookup_table i2c_recovery_gpiod_table = { | 117 | static struct gpiod_lookup_table i2c_recovery_gpiod_table = { |
| 118 | .dev_id = "i2c_davinci.1", | 118 | .dev_id = "i2c_davinci.1", |
| 119 | .table = { | 119 | .table = { |
| 120 | GPIO_LOOKUP("davinci_gpio.0", DM355_I2C_SDA_PIN, "sda", | 120 | GPIO_LOOKUP("davinci_gpio", DM355_I2C_SDA_PIN, "sda", |
| 121 | GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN), | 121 | GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN), |
| 122 | GPIO_LOOKUP("davinci_gpio.0", DM355_I2C_SCL_PIN, "scl", | 122 | GPIO_LOOKUP("davinci_gpio", DM355_I2C_SCL_PIN, "scl", |
| 123 | GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN), | 123 | GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN), |
| 124 | }, | 124 | }, |
| 125 | }; | 125 | }; |
diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c index e1428115067f..b80c4ee76217 100644 --- a/arch/arm/mach-davinci/board-dm644x-evm.c +++ b/arch/arm/mach-davinci/board-dm644x-evm.c | |||
| @@ -660,9 +660,9 @@ static struct i2c_board_info __initdata i2c_info[] = { | |||
| 660 | static struct gpiod_lookup_table i2c_recovery_gpiod_table = { | 660 | static struct gpiod_lookup_table i2c_recovery_gpiod_table = { |
| 661 | .dev_id = "i2c_davinci.1", | 661 | .dev_id = "i2c_davinci.1", |
| 662 | .table = { | 662 | .table = { |
| 663 | GPIO_LOOKUP("davinci_gpio.0", DM644X_I2C_SDA_PIN, "sda", | 663 | GPIO_LOOKUP("davinci_gpio", DM644X_I2C_SDA_PIN, "sda", |
| 664 | GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN), | 664 | GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN), |
| 665 | GPIO_LOOKUP("davinci_gpio.0", DM644X_I2C_SCL_PIN, "scl", | 665 | GPIO_LOOKUP("davinci_gpio", DM644X_I2C_SCL_PIN, "scl", |
| 666 | GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN), | 666 | GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN), |
| 667 | }, | 667 | }, |
| 668 | }; | 668 | }; |
diff --git a/arch/arm/mach-davinci/board-omapl138-hawk.c b/arch/arm/mach-davinci/board-omapl138-hawk.c index 8e8d51f4a276..94c4f126ef86 100644 --- a/arch/arm/mach-davinci/board-omapl138-hawk.c +++ b/arch/arm/mach-davinci/board-omapl138-hawk.c | |||
| @@ -134,9 +134,9 @@ static const short hawk_mmcsd0_pins[] = { | |||
| 134 | static struct gpiod_lookup_table mmc_gpios_table = { | 134 | static struct gpiod_lookup_table mmc_gpios_table = { |
| 135 | .dev_id = "da830-mmc.0", | 135 | .dev_id = "da830-mmc.0", |
| 136 | .table = { | 136 | .table = { |
| 137 | GPIO_LOOKUP("davinci_gpio.0", DA850_HAWK_MMCSD_CD_PIN, "cd", | 137 | GPIO_LOOKUP("davinci_gpio", DA850_HAWK_MMCSD_CD_PIN, "cd", |
| 138 | GPIO_ACTIVE_LOW), | 138 | GPIO_ACTIVE_LOW), |
| 139 | GPIO_LOOKUP("davinci_gpio.0", DA850_HAWK_MMCSD_WP_PIN, "wp", | 139 | GPIO_LOOKUP("davinci_gpio", DA850_HAWK_MMCSD_WP_PIN, "wp", |
| 140 | GPIO_ACTIVE_LOW), | 140 | GPIO_ACTIVE_LOW), |
| 141 | }, | 141 | }, |
| 142 | }; | 142 | }; |
diff --git a/arch/arm/mach-integrator/impd1.c b/arch/arm/mach-integrator/impd1.c index a109f6482413..8dfad012dfae 100644 --- a/arch/arm/mach-integrator/impd1.c +++ b/arch/arm/mach-integrator/impd1.c | |||
| @@ -390,10 +390,14 @@ static int __ref impd1_probe(struct lm_device *dev) | |||
| 390 | char *mmciname; | 390 | char *mmciname; |
| 391 | 391 | ||
| 392 | lookup = devm_kzalloc(&dev->dev, | 392 | lookup = devm_kzalloc(&dev->dev, |
| 393 | sizeof(*lookup) + 3 * sizeof(struct gpiod_lookup), | 393 | struct_size(lookup, table, 3), |
| 394 | GFP_KERNEL); | 394 | GFP_KERNEL); |
| 395 | chipname = devm_kstrdup(&dev->dev, devname, GFP_KERNEL); | 395 | chipname = devm_kstrdup(&dev->dev, devname, GFP_KERNEL); |
| 396 | mmciname = kasprintf(GFP_KERNEL, "lm%x:00700", dev->id); | 396 | mmciname = devm_kasprintf(&dev->dev, GFP_KERNEL, |
| 397 | "lm%x:00700", dev->id); | ||
| 398 | if (!lookup || !chipname || !mmciname) | ||
| 399 | return -ENOMEM; | ||
| 400 | |||
| 397 | lookup->dev_id = mmciname; | 401 | lookup->dev_id = mmciname; |
| 398 | /* | 402 | /* |
| 399 | * Offsets on GPIO block 1: | 403 | * Offsets on GPIO block 1: |
diff --git a/arch/arm/mach-iop32x/n2100.c b/arch/arm/mach-iop32x/n2100.c index 3b73813c6b04..23e8c93515d4 100644 --- a/arch/arm/mach-iop32x/n2100.c +++ b/arch/arm/mach-iop32x/n2100.c | |||
| @@ -75,8 +75,7 @@ void __init n2100_map_io(void) | |||
| 75 | /* | 75 | /* |
| 76 | * N2100 PCI. | 76 | * N2100 PCI. |
| 77 | */ | 77 | */ |
| 78 | static int __init | 78 | static int n2100_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) |
| 79 | n2100_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) | ||
| 80 | { | 79 | { |
| 81 | int irq; | 80 | int irq; |
| 82 | 81 | ||
diff --git a/arch/arm/mach-omap2/cpuidle44xx.c b/arch/arm/mach-omap2/cpuidle44xx.c index a8b291f00109..dae514c8276a 100644 --- a/arch/arm/mach-omap2/cpuidle44xx.c +++ b/arch/arm/mach-omap2/cpuidle44xx.c | |||
| @@ -152,6 +152,10 @@ static int omap_enter_idle_coupled(struct cpuidle_device *dev, | |||
| 152 | mpuss_can_lose_context = (cx->mpu_state == PWRDM_POWER_RET) && | 152 | mpuss_can_lose_context = (cx->mpu_state == PWRDM_POWER_RET) && |
| 153 | (cx->mpu_logic_state == PWRDM_POWER_OFF); | 153 | (cx->mpu_logic_state == PWRDM_POWER_OFF); |
| 154 | 154 | ||
| 155 | /* Enter broadcast mode for periodic timers */ | ||
| 156 | tick_broadcast_enable(); | ||
| 157 | |||
| 158 | /* Enter broadcast mode for one-shot timers */ | ||
| 155 | tick_broadcast_enter(); | 159 | tick_broadcast_enter(); |
| 156 | 160 | ||
| 157 | /* | 161 | /* |
| @@ -218,15 +222,6 @@ fail: | |||
| 218 | return index; | 222 | return index; |
| 219 | } | 223 | } |
| 220 | 224 | ||
| 221 | /* | ||
| 222 | * For each cpu, setup the broadcast timer because local timers | ||
| 223 | * stops for the states above C1. | ||
| 224 | */ | ||
| 225 | static void omap_setup_broadcast_timer(void *arg) | ||
| 226 | { | ||
| 227 | tick_broadcast_enable(); | ||
| 228 | } | ||
| 229 | |||
| 230 | static struct cpuidle_driver omap4_idle_driver = { | 225 | static struct cpuidle_driver omap4_idle_driver = { |
| 231 | .name = "omap4_idle", | 226 | .name = "omap4_idle", |
| 232 | .owner = THIS_MODULE, | 227 | .owner = THIS_MODULE, |
| @@ -319,8 +314,5 @@ int __init omap4_idle_init(void) | |||
| 319 | if (!cpu_clkdm[0] || !cpu_clkdm[1]) | 314 | if (!cpu_clkdm[0] || !cpu_clkdm[1]) |
| 320 | return -ENODEV; | 315 | return -ENODEV; |
| 321 | 316 | ||
| 322 | /* Configure the broadcast timer on each cpu */ | ||
| 323 | on_each_cpu(omap_setup_broadcast_timer, NULL, 1); | ||
| 324 | |||
| 325 | return cpuidle_register(idle_driver, cpu_online_mask); | 317 | return cpuidle_register(idle_driver, cpu_online_mask); |
| 326 | } | 318 | } |
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c index f86b72d1d59e..1444b4b4bd9f 100644 --- a/arch/arm/mach-omap2/display.c +++ b/arch/arm/mach-omap2/display.c | |||
| @@ -83,6 +83,7 @@ static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes) | |||
| 83 | u32 enable_mask, enable_shift; | 83 | u32 enable_mask, enable_shift; |
| 84 | u32 pipd_mask, pipd_shift; | 84 | u32 pipd_mask, pipd_shift; |
| 85 | u32 reg; | 85 | u32 reg; |
| 86 | int ret; | ||
| 86 | 87 | ||
| 87 | if (dsi_id == 0) { | 88 | if (dsi_id == 0) { |
| 88 | enable_mask = OMAP4_DSI1_LANEENABLE_MASK; | 89 | enable_mask = OMAP4_DSI1_LANEENABLE_MASK; |
| @@ -98,7 +99,11 @@ static int omap4_dsi_mux_pads(int dsi_id, unsigned lanes) | |||
| 98 | return -ENODEV; | 99 | return -ENODEV; |
| 99 | } | 100 | } |
| 100 | 101 | ||
| 101 | regmap_read(omap4_dsi_mux_syscon, OMAP4_DSIPHY_SYSCON_OFFSET, ®); | 102 | ret = regmap_read(omap4_dsi_mux_syscon, |
| 103 | OMAP4_DSIPHY_SYSCON_OFFSET, | ||
| 104 | ®); | ||
| 105 | if (ret) | ||
| 106 | return ret; | ||
| 102 | 107 | ||
| 103 | reg &= ~enable_mask; | 108 | reg &= ~enable_mask; |
| 104 | reg &= ~pipd_mask; | 109 | reg &= ~pipd_mask; |
diff --git a/arch/arm/mach-omap2/omap-wakeupgen.c b/arch/arm/mach-omap2/omap-wakeupgen.c index fc5fb776a710..17558be4bf0a 100644 --- a/arch/arm/mach-omap2/omap-wakeupgen.c +++ b/arch/arm/mach-omap2/omap-wakeupgen.c | |||
| @@ -50,6 +50,9 @@ | |||
| 50 | #define OMAP4_NR_BANKS 4 | 50 | #define OMAP4_NR_BANKS 4 |
| 51 | #define OMAP4_NR_IRQS 128 | 51 | #define OMAP4_NR_IRQS 128 |
| 52 | 52 | ||
| 53 | #define SYS_NIRQ1_EXT_SYS_IRQ_1 7 | ||
| 54 | #define SYS_NIRQ2_EXT_SYS_IRQ_2 119 | ||
| 55 | |||
| 53 | static void __iomem *wakeupgen_base; | 56 | static void __iomem *wakeupgen_base; |
| 54 | static void __iomem *sar_base; | 57 | static void __iomem *sar_base; |
| 55 | static DEFINE_RAW_SPINLOCK(wakeupgen_lock); | 58 | static DEFINE_RAW_SPINLOCK(wakeupgen_lock); |
| @@ -153,6 +156,37 @@ static void wakeupgen_unmask(struct irq_data *d) | |||
| 153 | irq_chip_unmask_parent(d); | 156 | irq_chip_unmask_parent(d); |
| 154 | } | 157 | } |
| 155 | 158 | ||
| 159 | /* | ||
| 160 | * The sys_nirq pins bypass peripheral modules and are wired directly | ||
| 161 | * to MPUSS wakeupgen. They get automatically inverted for GIC. | ||
| 162 | */ | ||
| 163 | static int wakeupgen_irq_set_type(struct irq_data *d, unsigned int type) | ||
| 164 | { | ||
| 165 | bool inverted = false; | ||
| 166 | |||
| 167 | switch (type) { | ||
| 168 | case IRQ_TYPE_LEVEL_LOW: | ||
| 169 | type &= ~IRQ_TYPE_LEVEL_MASK; | ||
| 170 | type |= IRQ_TYPE_LEVEL_HIGH; | ||
| 171 | inverted = true; | ||
| 172 | break; | ||
| 173 | case IRQ_TYPE_EDGE_FALLING: | ||
| 174 | type &= ~IRQ_TYPE_EDGE_BOTH; | ||
| 175 | type |= IRQ_TYPE_EDGE_RISING; | ||
| 176 | inverted = true; | ||
| 177 | break; | ||
| 178 | default: | ||
| 179 | break; | ||
| 180 | } | ||
| 181 | |||
| 182 | if (inverted && d->hwirq != SYS_NIRQ1_EXT_SYS_IRQ_1 && | ||
| 183 | d->hwirq != SYS_NIRQ2_EXT_SYS_IRQ_2) | ||
| 184 | pr_warn("wakeupgen: irq%li polarity inverted in dts\n", | ||
| 185 | d->hwirq); | ||
| 186 | |||
| 187 | return irq_chip_set_type_parent(d, type); | ||
| 188 | } | ||
| 189 | |||
| 156 | #ifdef CONFIG_HOTPLUG_CPU | 190 | #ifdef CONFIG_HOTPLUG_CPU |
| 157 | static DEFINE_PER_CPU(u32 [MAX_NR_REG_BANKS], irqmasks); | 191 | static DEFINE_PER_CPU(u32 [MAX_NR_REG_BANKS], irqmasks); |
| 158 | 192 | ||
| @@ -446,7 +480,7 @@ static struct irq_chip wakeupgen_chip = { | |||
| 446 | .irq_mask = wakeupgen_mask, | 480 | .irq_mask = wakeupgen_mask, |
| 447 | .irq_unmask = wakeupgen_unmask, | 481 | .irq_unmask = wakeupgen_unmask, |
| 448 | .irq_retrigger = irq_chip_retrigger_hierarchy, | 482 | .irq_retrigger = irq_chip_retrigger_hierarchy, |
| 449 | .irq_set_type = irq_chip_set_type_parent, | 483 | .irq_set_type = wakeupgen_irq_set_type, |
| 450 | .flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MASK_ON_SUSPEND, | 484 | .flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MASK_ON_SUSPEND, |
| 451 | #ifdef CONFIG_SMP | 485 | #ifdef CONFIG_SMP |
| 452 | .irq_set_affinity = irq_chip_set_affinity_parent, | 486 | .irq_set_affinity = irq_chip_set_affinity_parent, |
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index b5531dd3ae9c..3a04c73ac03c 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c | |||
| @@ -1002,8 +1002,10 @@ static int _enable_clocks(struct omap_hwmod *oh) | |||
| 1002 | clk_enable(oh->_clk); | 1002 | clk_enable(oh->_clk); |
| 1003 | 1003 | ||
| 1004 | list_for_each_entry(os, &oh->slave_ports, node) { | 1004 | list_for_each_entry(os, &oh->slave_ports, node) { |
| 1005 | if (os->_clk && (os->flags & OCPIF_SWSUP_IDLE)) | 1005 | if (os->_clk && (os->flags & OCPIF_SWSUP_IDLE)) { |
| 1006 | omap2_clk_deny_idle(os->_clk); | ||
| 1006 | clk_enable(os->_clk); | 1007 | clk_enable(os->_clk); |
| 1008 | } | ||
| 1007 | } | 1009 | } |
| 1008 | 1010 | ||
| 1009 | /* The opt clocks are controlled by the device driver. */ | 1011 | /* The opt clocks are controlled by the device driver. */ |
| @@ -1055,8 +1057,10 @@ static int _disable_clocks(struct omap_hwmod *oh) | |||
| 1055 | clk_disable(oh->_clk); | 1057 | clk_disable(oh->_clk); |
| 1056 | 1058 | ||
| 1057 | list_for_each_entry(os, &oh->slave_ports, node) { | 1059 | list_for_each_entry(os, &oh->slave_ports, node) { |
| 1058 | if (os->_clk && (os->flags & OCPIF_SWSUP_IDLE)) | 1060 | if (os->_clk && (os->flags & OCPIF_SWSUP_IDLE)) { |
| 1059 | clk_disable(os->_clk); | 1061 | clk_disable(os->_clk); |
| 1062 | omap2_clk_allow_idle(os->_clk); | ||
| 1063 | } | ||
| 1060 | } | 1064 | } |
| 1061 | 1065 | ||
| 1062 | if (oh->flags & HWMOD_OPT_CLKS_NEEDED) | 1066 | if (oh->flags & HWMOD_OPT_CLKS_NEEDED) |
| @@ -2436,9 +2440,13 @@ static void _setup_iclk_autoidle(struct omap_hwmod *oh) | |||
| 2436 | continue; | 2440 | continue; |
| 2437 | 2441 | ||
| 2438 | if (os->flags & OCPIF_SWSUP_IDLE) { | 2442 | if (os->flags & OCPIF_SWSUP_IDLE) { |
| 2439 | /* XXX omap_iclk_deny_idle(c); */ | 2443 | /* |
| 2444 | * we might have multiple users of one iclk with | ||
| 2445 | * different requirements, disable autoidle when | ||
| 2446 | * the module is enabled, e.g. dss iclk | ||
| 2447 | */ | ||
| 2440 | } else { | 2448 | } else { |
| 2441 | /* XXX omap_iclk_allow_idle(c); */ | 2449 | /* we are enabling autoidle afterwards anyways */ |
| 2442 | clk_enable(os->_clk); | 2450 | clk_enable(os->_clk); |
| 2443 | } | 2451 | } |
| 2444 | } | 2452 | } |
diff --git a/arch/arm/mach-socfpga/socfpga.c b/arch/arm/mach-socfpga/socfpga.c index 5fb6f79059a8..afd98971d903 100644 --- a/arch/arm/mach-socfpga/socfpga.c +++ b/arch/arm/mach-socfpga/socfpga.c | |||
| @@ -32,6 +32,8 @@ void __iomem *rst_manager_base_addr; | |||
| 32 | void __iomem *sdr_ctl_base_addr; | 32 | void __iomem *sdr_ctl_base_addr; |
| 33 | unsigned long socfpga_cpu1start_addr; | 33 | unsigned long socfpga_cpu1start_addr; |
| 34 | 34 | ||
| 35 | extern void __init socfpga_reset_init(void); | ||
| 36 | |||
| 35 | static void __init socfpga_sysmgr_init(void) | 37 | static void __init socfpga_sysmgr_init(void) |
| 36 | { | 38 | { |
| 37 | struct device_node *np; | 39 | struct device_node *np; |
| @@ -64,6 +66,7 @@ static void __init socfpga_init_irq(void) | |||
| 64 | 66 | ||
| 65 | if (IS_ENABLED(CONFIG_EDAC_ALTERA_OCRAM)) | 67 | if (IS_ENABLED(CONFIG_EDAC_ALTERA_OCRAM)) |
| 66 | socfpga_init_ocram_ecc(); | 68 | socfpga_init_ocram_ecc(); |
| 69 | socfpga_reset_init(); | ||
| 67 | } | 70 | } |
| 68 | 71 | ||
| 69 | static void __init socfpga_arria10_init_irq(void) | 72 | static void __init socfpga_arria10_init_irq(void) |
| @@ -74,6 +77,7 @@ static void __init socfpga_arria10_init_irq(void) | |||
| 74 | socfpga_init_arria10_l2_ecc(); | 77 | socfpga_init_arria10_l2_ecc(); |
| 75 | if (IS_ENABLED(CONFIG_EDAC_ALTERA_OCRAM)) | 78 | if (IS_ENABLED(CONFIG_EDAC_ALTERA_OCRAM)) |
| 76 | socfpga_init_arria10_ocram_ecc(); | 79 | socfpga_init_arria10_ocram_ecc(); |
| 80 | socfpga_reset_init(); | ||
| 77 | } | 81 | } |
| 78 | 82 | ||
| 79 | static void socfpga_cyclone5_restart(enum reboot_mode mode, const char *cmd) | 83 | static void socfpga_cyclone5_restart(enum reboot_mode mode, const char *cmd) |
diff --git a/arch/arm/mach-tango/pm.c b/arch/arm/mach-tango/pm.c index 028e50c6383f..a32c3b631484 100644 --- a/arch/arm/mach-tango/pm.c +++ b/arch/arm/mach-tango/pm.c | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | #include <linux/suspend.h> | 3 | #include <linux/suspend.h> |
| 4 | #include <asm/suspend.h> | 4 | #include <asm/suspend.h> |
| 5 | #include "smc.h" | 5 | #include "smc.h" |
| 6 | #include "pm.h" | ||
| 6 | 7 | ||
| 7 | static int tango_pm_powerdown(unsigned long arg) | 8 | static int tango_pm_powerdown(unsigned long arg) |
| 8 | { | 9 | { |
| @@ -24,10 +25,7 @@ static const struct platform_suspend_ops tango_pm_ops = { | |||
| 24 | .valid = suspend_valid_only_mem, | 25 | .valid = suspend_valid_only_mem, |
| 25 | }; | 26 | }; |
| 26 | 27 | ||
| 27 | static int __init tango_pm_init(void) | 28 | void __init tango_pm_init(void) |
| 28 | { | 29 | { |
| 29 | suspend_set_ops(&tango_pm_ops); | 30 | suspend_set_ops(&tango_pm_ops); |
| 30 | return 0; | ||
| 31 | } | 31 | } |
| 32 | |||
| 33 | late_initcall(tango_pm_init); | ||
diff --git a/arch/arm/mach-tango/pm.h b/arch/arm/mach-tango/pm.h new file mode 100644 index 000000000000..35ea705a0ee2 --- /dev/null +++ b/arch/arm/mach-tango/pm.h | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | |||
| 3 | #ifdef CONFIG_SUSPEND | ||
| 4 | void __init tango_pm_init(void); | ||
| 5 | #else | ||
| 6 | #define tango_pm_init NULL | ||
| 7 | #endif | ||
diff --git a/arch/arm/mach-tango/setup.c b/arch/arm/mach-tango/setup.c index 677dd7b5efd9..824f90737b04 100644 --- a/arch/arm/mach-tango/setup.c +++ b/arch/arm/mach-tango/setup.c | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | #include <asm/mach/arch.h> | 2 | #include <asm/mach/arch.h> |
| 3 | #include <asm/hardware/cache-l2x0.h> | 3 | #include <asm/hardware/cache-l2x0.h> |
| 4 | #include "smc.h" | 4 | #include "smc.h" |
| 5 | #include "pm.h" | ||
| 5 | 6 | ||
| 6 | static void tango_l2c_write(unsigned long val, unsigned int reg) | 7 | static void tango_l2c_write(unsigned long val, unsigned int reg) |
| 7 | { | 8 | { |
| @@ -15,4 +16,5 @@ DT_MACHINE_START(TANGO_DT, "Sigma Tango DT") | |||
| 15 | .dt_compat = tango_dt_compat, | 16 | .dt_compat = tango_dt_compat, |
| 16 | .l2c_aux_mask = ~0, | 17 | .l2c_aux_mask = ~0, |
| 17 | .l2c_write_sec = tango_l2c_write, | 18 | .l2c_write_sec = tango_l2c_write, |
| 19 | .init_late = tango_pm_init, | ||
| 18 | MACHINE_END | 20 | MACHINE_END |
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index f1e2922e447c..1e3e08a1c456 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c | |||
| @@ -2390,4 +2390,6 @@ void arch_teardown_dma_ops(struct device *dev) | |||
| 2390 | return; | 2390 | return; |
| 2391 | 2391 | ||
| 2392 | arm_teardown_iommu_dma_ops(dev); | 2392 | arm_teardown_iommu_dma_ops(dev); |
| 2393 | /* Let arch_setup_dma_ops() start again from scratch upon re-probe */ | ||
| 2394 | set_dma_ops(dev, NULL); | ||
| 2393 | } | 2395 | } |
diff --git a/arch/arm/plat-pxa/ssp.c b/arch/arm/plat-pxa/ssp.c index ed36dcab80f1..f51919974183 100644 --- a/arch/arm/plat-pxa/ssp.c +++ b/arch/arm/plat-pxa/ssp.c | |||
| @@ -190,8 +190,6 @@ static int pxa_ssp_remove(struct platform_device *pdev) | |||
| 190 | if (ssp == NULL) | 190 | if (ssp == NULL) |
| 191 | return -ENODEV; | 191 | return -ENODEV; |
| 192 | 192 | ||
| 193 | iounmap(ssp->mmio_base); | ||
| 194 | |||
| 195 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 193 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 196 | release_mem_region(res->start, resource_size(res)); | 194 | release_mem_region(res->start, resource_size(res)); |
| 197 | 195 | ||
| @@ -201,7 +199,6 @@ static int pxa_ssp_remove(struct platform_device *pdev) | |||
| 201 | list_del(&ssp->node); | 199 | list_del(&ssp->node); |
| 202 | mutex_unlock(&ssp_lock); | 200 | mutex_unlock(&ssp_lock); |
| 203 | 201 | ||
| 204 | kfree(ssp); | ||
| 205 | return 0; | 202 | return 0; |
| 206 | } | 203 | } |
| 207 | 204 | ||
diff --git a/arch/arm/probes/kprobes/opt-arm.c b/arch/arm/probes/kprobes/opt-arm.c index 2c118a6ab358..0dc23fc227ed 100644 --- a/arch/arm/probes/kprobes/opt-arm.c +++ b/arch/arm/probes/kprobes/opt-arm.c | |||
| @@ -247,7 +247,7 @@ int arch_prepare_optimized_kprobe(struct optimized_kprobe *op, struct kprobe *or | |||
| 247 | } | 247 | } |
| 248 | 248 | ||
| 249 | /* Copy arch-dep-instance from template. */ | 249 | /* Copy arch-dep-instance from template. */ |
| 250 | memcpy(code, (unsigned char *)optprobe_template_entry, | 250 | memcpy(code, (unsigned long *)&optprobe_template_entry, |
| 251 | TMPL_END_IDX * sizeof(kprobe_opcode_t)); | 251 | TMPL_END_IDX * sizeof(kprobe_opcode_t)); |
| 252 | 252 | ||
| 253 | /* Adjust buffer according to instruction. */ | 253 | /* Adjust buffer according to instruction. */ |
diff --git a/arch/arm/xen/mm.c b/arch/arm/xen/mm.c index cb44aa290e73..e1d44b903dfc 100644 --- a/arch/arm/xen/mm.c +++ b/arch/arm/xen/mm.c | |||
| @@ -7,7 +7,6 @@ | |||
| 7 | #include <linux/of_address.h> | 7 | #include <linux/of_address.h> |
| 8 | #include <linux/slab.h> | 8 | #include <linux/slab.h> |
| 9 | #include <linux/types.h> | 9 | #include <linux/types.h> |
| 10 | #include <linux/dma-mapping.h> | ||
| 11 | #include <linux/vmalloc.h> | 10 | #include <linux/vmalloc.h> |
| 12 | #include <linux/swiotlb.h> | 11 | #include <linux/swiotlb.h> |
| 13 | 12 | ||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts index b0c64f75792c..8974b5a1d3b1 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts | |||
| @@ -188,6 +188,7 @@ | |||
| 188 | reg = <0x3a3>; | 188 | reg = <0x3a3>; |
| 189 | interrupt-parent = <&r_intc>; | 189 | interrupt-parent = <&r_intc>; |
| 190 | interrupts = <0 IRQ_TYPE_LEVEL_LOW>; | 190 | interrupts = <0 IRQ_TYPE_LEVEL_LOW>; |
| 191 | x-powers,drive-vbus-en; /* set N_VBUSEN as output pin */ | ||
| 191 | }; | 192 | }; |
| 192 | }; | 193 | }; |
| 193 | 194 | ||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi index 837a03dee875..2abb335145a6 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | |||
| @@ -390,7 +390,7 @@ | |||
| 390 | }; | 390 | }; |
| 391 | 391 | ||
| 392 | video-codec@1c0e000 { | 392 | video-codec@1c0e000 { |
| 393 | compatible = "allwinner,sun50i-h5-video-engine"; | 393 | compatible = "allwinner,sun50i-a64-video-engine"; |
| 394 | reg = <0x01c0e000 0x1000>; | 394 | reg = <0x01c0e000 0x1000>; |
| 395 | clocks = <&ccu CLK_BUS_VE>, <&ccu CLK_VE>, | 395 | clocks = <&ccu CLK_BUS_VE>, <&ccu CLK_VE>, |
| 396 | <&ccu CLK_DRAM_VE>; | 396 | <&ccu CLK_DRAM_VE>; |
diff --git a/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi b/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi index e14e0ce7e89f..016641a41694 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-gx-p23x-q20x.dtsi | |||
| @@ -187,8 +187,7 @@ | |||
| 187 | max-frequency = <100000000>; | 187 | max-frequency = <100000000>; |
| 188 | disable-wp; | 188 | disable-wp; |
| 189 | 189 | ||
| 190 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 190 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
| 191 | cd-inverted; | ||
| 192 | 191 | ||
| 193 | vmmc-supply = <&vddao_3v3>; | 192 | vmmc-supply = <&vddao_3v3>; |
| 194 | vqmmc-supply = <&vddio_boot>; | 193 | vqmmc-supply = <&vddio_boot>; |
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts index 8cd50b75171d..ade2ee09ae96 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts | |||
| @@ -305,8 +305,7 @@ | |||
| 305 | max-frequency = <200000000>; | 305 | max-frequency = <200000000>; |
| 306 | disable-wp; | 306 | disable-wp; |
| 307 | 307 | ||
| 308 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 308 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
| 309 | cd-inverted; | ||
| 310 | 309 | ||
| 311 | vmmc-supply = <&vddio_ao3v3>; | 310 | vmmc-supply = <&vddio_ao3v3>; |
| 312 | vqmmc-supply = <&vddio_tf>; | 311 | vqmmc-supply = <&vddio_tf>; |
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts index 4cf7f6e80c6a..25105ac96d55 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts | |||
| @@ -238,8 +238,7 @@ | |||
| 238 | max-frequency = <100000000>; | 238 | max-frequency = <100000000>; |
| 239 | disable-wp; | 239 | disable-wp; |
| 240 | 240 | ||
| 241 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 241 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
| 242 | cd-inverted; | ||
| 243 | 242 | ||
| 244 | vmmc-supply = <&vddao_3v3>; | 243 | vmmc-supply = <&vddao_3v3>; |
| 245 | vqmmc-supply = <&vddio_card>; | 244 | vqmmc-supply = <&vddio_card>; |
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts index 2e1cd5e3a246..1cc9dc68ef00 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts | |||
| @@ -258,8 +258,7 @@ | |||
| 258 | max-frequency = <100000000>; | 258 | max-frequency = <100000000>; |
| 259 | disable-wp; | 259 | disable-wp; |
| 260 | 260 | ||
| 261 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 261 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
| 262 | cd-inverted; | ||
| 263 | 262 | ||
| 264 | vmmc-supply = <&tflash_vdd>; | 263 | vmmc-supply = <&tflash_vdd>; |
| 265 | vqmmc-supply = <&tf_io>; | 264 | vqmmc-supply = <&tf_io>; |
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi index ce862266b9aa..0be0f2a5d2fe 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-p20x.dtsi | |||
| @@ -196,8 +196,7 @@ | |||
| 196 | max-frequency = <100000000>; | 196 | max-frequency = <100000000>; |
| 197 | disable-wp; | 197 | disable-wp; |
| 198 | 198 | ||
| 199 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 199 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
| 200 | cd-inverted; | ||
| 201 | 200 | ||
| 202 | vmmc-supply = <&vddao_3v3>; | 201 | vmmc-supply = <&vddao_3v3>; |
| 203 | vqmmc-supply = <&vddio_card>; | 202 | vqmmc-supply = <&vddio_card>; |
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi index 93a4acf2c46c..ad4d50bd9d77 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi | |||
| @@ -154,8 +154,7 @@ | |||
| 154 | max-frequency = <100000000>; | 154 | max-frequency = <100000000>; |
| 155 | disable-wp; | 155 | disable-wp; |
| 156 | 156 | ||
| 157 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 157 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
| 158 | cd-inverted; | ||
| 159 | 158 | ||
| 160 | vmmc-supply = <&vcc_3v3>; | 159 | vmmc-supply = <&vcc_3v3>; |
| 161 | }; | 160 | }; |
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi index ec09bb5792b7..2d2db783c44c 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi | |||
| @@ -211,8 +211,7 @@ | |||
| 211 | max-frequency = <100000000>; | 211 | max-frequency = <100000000>; |
| 212 | disable-wp; | 212 | disable-wp; |
| 213 | 213 | ||
| 214 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 214 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
| 215 | cd-inverted; | ||
| 216 | 215 | ||
| 217 | vmmc-supply = <&vddao_3v3>; | 216 | vmmc-supply = <&vddao_3v3>; |
| 218 | vqmmc-supply = <&vcc_3v3>; | 217 | vqmmc-supply = <&vcc_3v3>; |
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-hwacom-amazetv.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-hwacom-amazetv.dts index f1c410e2da2b..796baea7a0bf 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-hwacom-amazetv.dts +++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-hwacom-amazetv.dts | |||
| @@ -131,8 +131,7 @@ | |||
| 131 | max-frequency = <100000000>; | 131 | max-frequency = <100000000>; |
| 132 | disable-wp; | 132 | disable-wp; |
| 133 | 133 | ||
| 134 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 134 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
| 135 | cd-inverted; | ||
| 136 | 135 | ||
| 137 | vmmc-supply = <&vddao_3v3>; | 136 | vmmc-supply = <&vddao_3v3>; |
| 138 | vqmmc-supply = <&vddio_card>; | 137 | vqmmc-supply = <&vddio_card>; |
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts index db293440e4ca..255cede7b447 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts +++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts | |||
| @@ -238,8 +238,7 @@ | |||
| 238 | max-frequency = <100000000>; | 238 | max-frequency = <100000000>; |
| 239 | disable-wp; | 239 | disable-wp; |
| 240 | 240 | ||
| 241 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 241 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
| 242 | cd-inverted; | ||
| 243 | 242 | ||
| 244 | vmmc-supply = <&vcc_3v3>; | 243 | vmmc-supply = <&vcc_3v3>; |
| 245 | vqmmc-supply = <&vcc_card>; | 244 | vqmmc-supply = <&vcc_card>; |
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-nexbox-a95x.dts b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-nexbox-a95x.dts index 6739697be1de..9cbdb85fb591 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-nexbox-a95x.dts +++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-nexbox-a95x.dts | |||
| @@ -183,8 +183,7 @@ | |||
| 183 | max-frequency = <100000000>; | 183 | max-frequency = <100000000>; |
| 184 | disable-wp; | 184 | disable-wp; |
| 185 | 185 | ||
| 186 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 186 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
| 187 | cd-inverted; | ||
| 188 | 187 | ||
| 189 | vmmc-supply = <&vddao_3v3>; | 188 | vmmc-supply = <&vddao_3v3>; |
| 190 | vqmmc-supply = <&vddio_card>; | 189 | vqmmc-supply = <&vddio_card>; |
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dtsi b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dtsi index a1b31013ab6e..bc811a2faf42 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dtsi | |||
| @@ -137,8 +137,7 @@ | |||
| 137 | max-frequency = <100000000>; | 137 | max-frequency = <100000000>; |
| 138 | disable-wp; | 138 | disable-wp; |
| 139 | 139 | ||
| 140 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 140 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
| 141 | cd-inverted; | ||
| 142 | 141 | ||
| 143 | vmmc-supply = <&vddao_3v3>; | 142 | vmmc-supply = <&vddao_3v3>; |
| 144 | vqmmc-supply = <&vddio_boot>; | 143 | vqmmc-supply = <&vddio_boot>; |
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts index 3c3a667a8df8..3f086ed7de05 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts +++ b/arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts | |||
| @@ -356,8 +356,7 @@ | |||
| 356 | max-frequency = <100000000>; | 356 | max-frequency = <100000000>; |
| 357 | disable-wp; | 357 | disable-wp; |
| 358 | 358 | ||
| 359 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 359 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
| 360 | cd-inverted; | ||
| 361 | 360 | ||
| 362 | vmmc-supply = <&vddao_3v3>; | 361 | vmmc-supply = <&vddao_3v3>; |
| 363 | vqmmc-supply = <&vddio_boot>; | 362 | vqmmc-supply = <&vddio_boot>; |
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts index f7a1cffab4a8..8acfd40090d2 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts +++ b/arch/arm64/boot/dts/amlogic/meson-gxm-nexbox-a1.dts | |||
| @@ -147,8 +147,7 @@ | |||
| 147 | max-frequency = <100000000>; | 147 | max-frequency = <100000000>; |
| 148 | disable-wp; | 148 | disable-wp; |
| 149 | 149 | ||
| 150 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 150 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
| 151 | cd-inverted; | ||
| 152 | 151 | ||
| 153 | vmmc-supply = <&vddao_3v3>; | 152 | vmmc-supply = <&vddao_3v3>; |
| 154 | vqmmc-supply = <&vddio_boot>; | 153 | vqmmc-supply = <&vddio_boot>; |
diff --git a/arch/arm64/boot/dts/amlogic/meson-gxm-rbox-pro.dts b/arch/arm64/boot/dts/amlogic/meson-gxm-rbox-pro.dts index 7212dc4531e4..7fa20a8ede17 100644 --- a/arch/arm64/boot/dts/amlogic/meson-gxm-rbox-pro.dts +++ b/arch/arm64/boot/dts/amlogic/meson-gxm-rbox-pro.dts | |||
| @@ -170,8 +170,7 @@ | |||
| 170 | max-frequency = <100000000>; | 170 | max-frequency = <100000000>; |
| 171 | disable-wp; | 171 | disable-wp; |
| 172 | 172 | ||
| 173 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>; | 173 | cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; |
| 174 | cd-inverted; | ||
| 175 | 174 | ||
| 176 | vmmc-supply = <&vddao_3v3>; | 175 | vmmc-supply = <&vddao_3v3>; |
| 177 | vqmmc-supply = <&vddio_boot>; | 176 | vqmmc-supply = <&vddio_boot>; |
diff --git a/arch/arm64/boot/dts/freescale/imx8mq-evk.dts b/arch/arm64/boot/dts/freescale/imx8mq-evk.dts index 64acccc4bfcb..f74b13aa5aa5 100644 --- a/arch/arm64/boot/dts/freescale/imx8mq-evk.dts +++ b/arch/arm64/boot/dts/freescale/imx8mq-evk.dts | |||
| @@ -227,34 +227,34 @@ | |||
| 227 | 227 | ||
| 228 | pinctrl_usdhc1_100mhz: usdhc1-100grp { | 228 | pinctrl_usdhc1_100mhz: usdhc1-100grp { |
| 229 | fsl,pins = < | 229 | fsl,pins = < |
| 230 | MX8MQ_IOMUXC_SD1_CLK_USDHC1_CLK 0x85 | 230 | MX8MQ_IOMUXC_SD1_CLK_USDHC1_CLK 0x8d |
| 231 | MX8MQ_IOMUXC_SD1_CMD_USDHC1_CMD 0xc5 | 231 | MX8MQ_IOMUXC_SD1_CMD_USDHC1_CMD 0xcd |
| 232 | MX8MQ_IOMUXC_SD1_DATA0_USDHC1_DATA0 0xc5 | 232 | MX8MQ_IOMUXC_SD1_DATA0_USDHC1_DATA0 0xcd |
| 233 | MX8MQ_IOMUXC_SD1_DATA1_USDHC1_DATA1 0xc5 | 233 | MX8MQ_IOMUXC_SD1_DATA1_USDHC1_DATA1 0xcd |
| 234 | MX8MQ_IOMUXC_SD1_DATA2_USDHC1_DATA2 0xc5 | 234 | MX8MQ_IOMUXC_SD1_DATA2_USDHC1_DATA2 0xcd |
| 235 | MX8MQ_IOMUXC_SD1_DATA3_USDHC1_DATA3 0xc5 | 235 | MX8MQ_IOMUXC_SD1_DATA3_USDHC1_DATA3 0xcd |
| 236 | MX8MQ_IOMUXC_SD1_DATA4_USDHC1_DATA4 0xc5 | 236 | MX8MQ_IOMUXC_SD1_DATA4_USDHC1_DATA4 0xcd |
| 237 | MX8MQ_IOMUXC_SD1_DATA5_USDHC1_DATA5 0xc5 | 237 | MX8MQ_IOMUXC_SD1_DATA5_USDHC1_DATA5 0xcd |
| 238 | MX8MQ_IOMUXC_SD1_DATA6_USDHC1_DATA6 0xc5 | 238 | MX8MQ_IOMUXC_SD1_DATA6_USDHC1_DATA6 0xcd |
| 239 | MX8MQ_IOMUXC_SD1_DATA7_USDHC1_DATA7 0xc5 | 239 | MX8MQ_IOMUXC_SD1_DATA7_USDHC1_DATA7 0xcd |
| 240 | MX8MQ_IOMUXC_SD1_STROBE_USDHC1_STROBE 0x85 | 240 | MX8MQ_IOMUXC_SD1_STROBE_USDHC1_STROBE 0x8d |
| 241 | MX8MQ_IOMUXC_SD1_RESET_B_USDHC1_RESET_B 0xc1 | 241 | MX8MQ_IOMUXC_SD1_RESET_B_USDHC1_RESET_B 0xc1 |
| 242 | >; | 242 | >; |
| 243 | }; | 243 | }; |
| 244 | 244 | ||
| 245 | pinctrl_usdhc1_200mhz: usdhc1-200grp { | 245 | pinctrl_usdhc1_200mhz: usdhc1-200grp { |
| 246 | fsl,pins = < | 246 | fsl,pins = < |
| 247 | MX8MQ_IOMUXC_SD1_CLK_USDHC1_CLK 0x87 | 247 | MX8MQ_IOMUXC_SD1_CLK_USDHC1_CLK 0x9f |
| 248 | MX8MQ_IOMUXC_SD1_CMD_USDHC1_CMD 0xc7 | 248 | MX8MQ_IOMUXC_SD1_CMD_USDHC1_CMD 0xdf |
| 249 | MX8MQ_IOMUXC_SD1_DATA0_USDHC1_DATA0 0xc7 | 249 | MX8MQ_IOMUXC_SD1_DATA0_USDHC1_DATA0 0xdf |
| 250 | MX8MQ_IOMUXC_SD1_DATA1_USDHC1_DATA1 0xc7 | 250 | MX8MQ_IOMUXC_SD1_DATA1_USDHC1_DATA1 0xdf |
| 251 | MX8MQ_IOMUXC_SD1_DATA2_USDHC1_DATA2 0xc7 | 251 | MX8MQ_IOMUXC_SD1_DATA2_USDHC1_DATA2 0xdf |
| 252 | MX8MQ_IOMUXC_SD1_DATA3_USDHC1_DATA3 0xc7 | 252 | MX8MQ_IOMUXC_SD1_DATA3_USDHC1_DATA3 0xdf |
| 253 | MX8MQ_IOMUXC_SD1_DATA4_USDHC1_DATA4 0xc7 | 253 | MX8MQ_IOMUXC_SD1_DATA4_USDHC1_DATA4 0xdf |
| 254 | MX8MQ_IOMUXC_SD1_DATA5_USDHC1_DATA5 0xc7 | 254 | MX8MQ_IOMUXC_SD1_DATA5_USDHC1_DATA5 0xdf |
| 255 | MX8MQ_IOMUXC_SD1_DATA6_USDHC1_DATA6 0xc7 | 255 | MX8MQ_IOMUXC_SD1_DATA6_USDHC1_DATA6 0xdf |
| 256 | MX8MQ_IOMUXC_SD1_DATA7_USDHC1_DATA7 0xc7 | 256 | MX8MQ_IOMUXC_SD1_DATA7_USDHC1_DATA7 0xdf |
| 257 | MX8MQ_IOMUXC_SD1_STROBE_USDHC1_STROBE 0x87 | 257 | MX8MQ_IOMUXC_SD1_STROBE_USDHC1_STROBE 0x9f |
| 258 | MX8MQ_IOMUXC_SD1_RESET_B_USDHC1_RESET_B 0xc1 | 258 | MX8MQ_IOMUXC_SD1_RESET_B_USDHC1_RESET_B 0xc1 |
| 259 | >; | 259 | >; |
| 260 | }; | 260 | }; |
diff --git a/arch/arm64/boot/dts/freescale/imx8mq.dtsi b/arch/arm64/boot/dts/freescale/imx8mq.dtsi index 8e9d6d5ed7b2..b6d31499fb43 100644 --- a/arch/arm64/boot/dts/freescale/imx8mq.dtsi +++ b/arch/arm64/boot/dts/freescale/imx8mq.dtsi | |||
| @@ -360,6 +360,8 @@ | |||
| 360 | <&clk IMX8MQ_CLK_NAND_USDHC_BUS>, | 360 | <&clk IMX8MQ_CLK_NAND_USDHC_BUS>, |
| 361 | <&clk IMX8MQ_CLK_USDHC1_ROOT>; | 361 | <&clk IMX8MQ_CLK_USDHC1_ROOT>; |
| 362 | clock-names = "ipg", "ahb", "per"; | 362 | clock-names = "ipg", "ahb", "per"; |
| 363 | assigned-clocks = <&clk IMX8MQ_CLK_USDHC1>; | ||
| 364 | assigned-clock-rates = <400000000>; | ||
| 363 | fsl,tuning-start-tap = <20>; | 365 | fsl,tuning-start-tap = <20>; |
| 364 | fsl,tuning-step = <2>; | 366 | fsl,tuning-step = <2>; |
| 365 | bus-width = <4>; | 367 | bus-width = <4>; |
diff --git a/arch/arm64/boot/dts/marvell/armada-8040-clearfog-gt-8k.dts b/arch/arm64/boot/dts/marvell/armada-8040-clearfog-gt-8k.dts index 5b4a9609e31f..2468762283a5 100644 --- a/arch/arm64/boot/dts/marvell/armada-8040-clearfog-gt-8k.dts +++ b/arch/arm64/boot/dts/marvell/armada-8040-clearfog-gt-8k.dts | |||
| @@ -351,7 +351,7 @@ | |||
| 351 | reg = <0>; | 351 | reg = <0>; |
| 352 | pinctrl-names = "default"; | 352 | pinctrl-names = "default"; |
| 353 | pinctrl-0 = <&cp0_copper_eth_phy_reset>; | 353 | pinctrl-0 = <&cp0_copper_eth_phy_reset>; |
| 354 | reset-gpios = <&cp1_gpio1 11 GPIO_ACTIVE_LOW>; | 354 | reset-gpios = <&cp0_gpio2 11 GPIO_ACTIVE_LOW>; |
| 355 | reset-assert-us = <10000>; | 355 | reset-assert-us = <10000>; |
| 356 | }; | 356 | }; |
| 357 | 357 | ||
diff --git a/arch/arm64/boot/dts/marvell/armada-8040-mcbin.dtsi b/arch/arm64/boot/dts/marvell/armada-8040-mcbin.dtsi index 29ea7e81ec4c..329f8ceeebea 100644 --- a/arch/arm64/boot/dts/marvell/armada-8040-mcbin.dtsi +++ b/arch/arm64/boot/dts/marvell/armada-8040-mcbin.dtsi | |||
| @@ -183,7 +183,7 @@ | |||
| 183 | pinctrl-0 = <&cp0_pcie_pins>; | 183 | pinctrl-0 = <&cp0_pcie_pins>; |
| 184 | num-lanes = <4>; | 184 | num-lanes = <4>; |
| 185 | num-viewport = <8>; | 185 | num-viewport = <8>; |
| 186 | reset-gpio = <&cp0_gpio1 20 GPIO_ACTIVE_LOW>; | 186 | reset-gpios = <&cp0_gpio2 20 GPIO_ACTIVE_LOW>; |
| 187 | status = "okay"; | 187 | status = "okay"; |
| 188 | }; | 188 | }; |
| 189 | 189 | ||
diff --git a/arch/arm64/boot/dts/marvell/armada-ap806.dtsi b/arch/arm64/boot/dts/marvell/armada-ap806.dtsi index 7d94c1fa592a..7f799cb5668e 100644 --- a/arch/arm64/boot/dts/marvell/armada-ap806.dtsi +++ b/arch/arm64/boot/dts/marvell/armada-ap806.dtsi | |||
| @@ -28,6 +28,23 @@ | |||
| 28 | method = "smc"; | 28 | method = "smc"; |
| 29 | }; | 29 | }; |
| 30 | 30 | ||
| 31 | reserved-memory { | ||
| 32 | #address-cells = <2>; | ||
| 33 | #size-cells = <2>; | ||
| 34 | ranges; | ||
| 35 | |||
| 36 | /* | ||
| 37 | * This area matches the mapping done with a | ||
| 38 | * mainline U-Boot, and should be updated by the | ||
| 39 | * bootloader. | ||
| 40 | */ | ||
| 41 | |||
| 42 | psci-area@4000000 { | ||
| 43 | reg = <0x0 0x4000000 0x0 0x200000>; | ||
| 44 | no-map; | ||
| 45 | }; | ||
| 46 | }; | ||
| 47 | |||
| 31 | ap806 { | 48 | ap806 { |
| 32 | #address-cells = <2>; | 49 | #address-cells = <2>; |
| 33 | #size-cells = <2>; | 50 | #size-cells = <2>; |
diff --git a/arch/arm64/boot/dts/qcom/msm8996.dtsi b/arch/arm64/boot/dts/qcom/msm8996.dtsi index 99b7495455a6..838e32cc14c9 100644 --- a/arch/arm64/boot/dts/qcom/msm8996.dtsi +++ b/arch/arm64/boot/dts/qcom/msm8996.dtsi | |||
| @@ -404,7 +404,7 @@ | |||
| 404 | }; | 404 | }; |
| 405 | 405 | ||
| 406 | intc: interrupt-controller@9bc0000 { | 406 | intc: interrupt-controller@9bc0000 { |
| 407 | compatible = "arm,gic-v3"; | 407 | compatible = "qcom,msm8996-gic-v3", "arm,gic-v3"; |
| 408 | #interrupt-cells = <3>; | 408 | #interrupt-cells = <3>; |
| 409 | interrupt-controller; | 409 | interrupt-controller; |
| 410 | #redistributor-regions = <1>; | 410 | #redistributor-regions = <1>; |
diff --git a/arch/arm64/boot/dts/renesas/r8a774a1.dtsi b/arch/arm64/boot/dts/renesas/r8a774a1.dtsi index 20745a8528c5..719ed9d9067d 100644 --- a/arch/arm64/boot/dts/renesas/r8a774a1.dtsi +++ b/arch/arm64/boot/dts/renesas/r8a774a1.dtsi | |||
| @@ -1011,6 +1011,9 @@ | |||
| 1011 | <&cpg CPG_CORE R8A774A1_CLK_S3D1>, | 1011 | <&cpg CPG_CORE R8A774A1_CLK_S3D1>, |
| 1012 | <&scif_clk>; | 1012 | <&scif_clk>; |
| 1013 | clock-names = "fck", "brg_int", "scif_clk"; | 1013 | clock-names = "fck", "brg_int", "scif_clk"; |
| 1014 | dmas = <&dmac1 0x13>, <&dmac1 0x12>, | ||
| 1015 | <&dmac2 0x13>, <&dmac2 0x12>; | ||
| 1016 | dma-names = "tx", "rx", "tx", "rx"; | ||
| 1014 | power-domains = <&sysc R8A774A1_PD_ALWAYS_ON>; | 1017 | power-domains = <&sysc R8A774A1_PD_ALWAYS_ON>; |
| 1015 | resets = <&cpg 310>; | 1018 | resets = <&cpg 310>; |
| 1016 | status = "disabled"; | 1019 | status = "disabled"; |
diff --git a/arch/arm64/boot/dts/renesas/r8a7796.dtsi b/arch/arm64/boot/dts/renesas/r8a7796.dtsi index afedbf5728ec..0648d12778ed 100644 --- a/arch/arm64/boot/dts/renesas/r8a7796.dtsi +++ b/arch/arm64/boot/dts/renesas/r8a7796.dtsi | |||
| @@ -1262,6 +1262,9 @@ | |||
| 1262 | <&cpg CPG_CORE R8A7796_CLK_S3D1>, | 1262 | <&cpg CPG_CORE R8A7796_CLK_S3D1>, |
| 1263 | <&scif_clk>; | 1263 | <&scif_clk>; |
| 1264 | clock-names = "fck", "brg_int", "scif_clk"; | 1264 | clock-names = "fck", "brg_int", "scif_clk"; |
| 1265 | dmas = <&dmac1 0x13>, <&dmac1 0x12>, | ||
| 1266 | <&dmac2 0x13>, <&dmac2 0x12>; | ||
| 1267 | dma-names = "tx", "rx", "tx", "rx"; | ||
| 1265 | power-domains = <&sysc R8A7796_PD_ALWAYS_ON>; | 1268 | power-domains = <&sysc R8A7796_PD_ALWAYS_ON>; |
| 1266 | resets = <&cpg 310>; | 1269 | resets = <&cpg 310>; |
| 1267 | status = "disabled"; | 1270 | status = "disabled"; |
diff --git a/arch/arm64/boot/dts/renesas/r8a77965.dtsi b/arch/arm64/boot/dts/renesas/r8a77965.dtsi index 6dc9b1fef830..4b3730f640ef 100644 --- a/arch/arm64/boot/dts/renesas/r8a77965.dtsi +++ b/arch/arm64/boot/dts/renesas/r8a77965.dtsi | |||
| @@ -1068,6 +1068,9 @@ | |||
| 1068 | <&cpg CPG_CORE R8A77965_CLK_S3D1>, | 1068 | <&cpg CPG_CORE R8A77965_CLK_S3D1>, |
| 1069 | <&scif_clk>; | 1069 | <&scif_clk>; |
| 1070 | clock-names = "fck", "brg_int", "scif_clk"; | 1070 | clock-names = "fck", "brg_int", "scif_clk"; |
| 1071 | dmas = <&dmac1 0x13>, <&dmac1 0x12>, | ||
| 1072 | <&dmac2 0x13>, <&dmac2 0x12>; | ||
| 1073 | dma-names = "tx", "rx", "tx", "rx"; | ||
| 1071 | power-domains = <&sysc R8A77965_PD_ALWAYS_ON>; | 1074 | power-domains = <&sysc R8A77965_PD_ALWAYS_ON>; |
| 1072 | resets = <&cpg 310>; | 1075 | resets = <&cpg 310>; |
| 1073 | status = "disabled"; | 1076 | status = "disabled"; |
diff --git a/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts b/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts index bd937d68ca3b..040b36ef0dd2 100644 --- a/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts +++ b/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts | |||
| @@ -40,6 +40,7 @@ | |||
| 40 | pinctrl-0 = <&usb30_host_drv>; | 40 | pinctrl-0 = <&usb30_host_drv>; |
| 41 | regulator-name = "vcc_host_5v"; | 41 | regulator-name = "vcc_host_5v"; |
| 42 | regulator-always-on; | 42 | regulator-always-on; |
| 43 | regulator-boot-on; | ||
| 43 | vin-supply = <&vcc_sys>; | 44 | vin-supply = <&vcc_sys>; |
| 44 | }; | 45 | }; |
| 45 | 46 | ||
| @@ -51,6 +52,7 @@ | |||
| 51 | pinctrl-0 = <&usb20_host_drv>; | 52 | pinctrl-0 = <&usb20_host_drv>; |
| 52 | regulator-name = "vcc_host1_5v"; | 53 | regulator-name = "vcc_host1_5v"; |
| 53 | regulator-always-on; | 54 | regulator-always-on; |
| 55 | regulator-boot-on; | ||
| 54 | vin-supply = <&vcc_sys>; | 56 | vin-supply = <&vcc_sys>; |
| 55 | }; | 57 | }; |
| 56 | 58 | ||
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-gru-bob.dts b/arch/arm64/boot/dts/rockchip/rk3399-gru-bob.dts index 1ee0dc0d9f10..d1cf404b8708 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399-gru-bob.dts +++ b/arch/arm64/boot/dts/rockchip/rk3399-gru-bob.dts | |||
| @@ -22,7 +22,7 @@ | |||
| 22 | backlight = <&backlight>; | 22 | backlight = <&backlight>; |
| 23 | power-supply = <&pp3300_disp>; | 23 | power-supply = <&pp3300_disp>; |
| 24 | 24 | ||
| 25 | ports { | 25 | port { |
| 26 | panel_in_edp: endpoint { | 26 | panel_in_edp: endpoint { |
| 27 | remote-endpoint = <&edp_out_panel>; | 27 | remote-endpoint = <&edp_out_panel>; |
| 28 | }; | 28 | }; |
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-gru-kevin.dts b/arch/arm64/boot/dts/rockchip/rk3399-gru-kevin.dts index 81e73103fa78..15e254a77391 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399-gru-kevin.dts +++ b/arch/arm64/boot/dts/rockchip/rk3399-gru-kevin.dts | |||
| @@ -43,7 +43,7 @@ | |||
| 43 | backlight = <&backlight>; | 43 | backlight = <&backlight>; |
| 44 | power-supply = <&pp3300_disp>; | 44 | power-supply = <&pp3300_disp>; |
| 45 | 45 | ||
| 46 | ports { | 46 | port { |
| 47 | panel_in_edp: endpoint { | 47 | panel_in_edp: endpoint { |
| 48 | remote-endpoint = <&edp_out_panel>; | 48 | remote-endpoint = <&edp_out_panel>; |
| 49 | }; | 49 | }; |
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-sapphire-excavator.dts b/arch/arm64/boot/dts/rockchip/rk3399-sapphire-excavator.dts index 0b8f1edbd746..b48a63c3efc3 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399-sapphire-excavator.dts +++ b/arch/arm64/boot/dts/rockchip/rk3399-sapphire-excavator.dts | |||
| @@ -91,7 +91,7 @@ | |||
| 91 | pinctrl-0 = <&lcd_panel_reset>; | 91 | pinctrl-0 = <&lcd_panel_reset>; |
| 92 | power-supply = <&vcc3v3_s0>; | 92 | power-supply = <&vcc3v3_s0>; |
| 93 | 93 | ||
| 94 | ports { | 94 | port { |
| 95 | panel_in_edp: endpoint { | 95 | panel_in_edp: endpoint { |
| 96 | remote-endpoint = <&edp_out_panel>; | 96 | remote-endpoint = <&edp_out_panel>; |
| 97 | }; | 97 | }; |
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig index 3ef443cfbab6..c8432e24207e 100644 --- a/arch/arm64/configs/defconfig +++ b/arch/arm64/configs/defconfig | |||
| @@ -506,11 +506,15 @@ CONFIG_SND_SOC_ROCKCHIP=m | |||
| 506 | CONFIG_SND_SOC_ROCKCHIP_SPDIF=m | 506 | CONFIG_SND_SOC_ROCKCHIP_SPDIF=m |
| 507 | CONFIG_SND_SOC_ROCKCHIP_RT5645=m | 507 | CONFIG_SND_SOC_ROCKCHIP_RT5645=m |
| 508 | CONFIG_SND_SOC_RK3399_GRU_SOUND=m | 508 | CONFIG_SND_SOC_RK3399_GRU_SOUND=m |
| 509 | CONFIG_SND_MESON_AXG_SOUND_CARD=m | ||
| 509 | CONFIG_SND_SOC_SAMSUNG=y | 510 | CONFIG_SND_SOC_SAMSUNG=y |
| 510 | CONFIG_SND_SOC_RCAR=m | 511 | CONFIG_SND_SOC_RCAR=m |
| 511 | CONFIG_SND_SOC_AK4613=m | 512 | CONFIG_SND_SOC_AK4613=m |
| 512 | CONFIG_SND_SIMPLE_CARD=m | 513 | CONFIG_SND_SIMPLE_CARD=m |
| 513 | CONFIG_SND_AUDIO_GRAPH_CARD=m | 514 | CONFIG_SND_AUDIO_GRAPH_CARD=m |
| 515 | CONFIG_SND_SOC_ES7134=m | ||
| 516 | CONFIG_SND_SOC_ES7241=m | ||
| 517 | CONFIG_SND_SOC_TAS571X=m | ||
| 514 | CONFIG_I2C_HID=m | 518 | CONFIG_I2C_HID=m |
| 515 | CONFIG_USB=y | 519 | CONFIG_USB=y |
| 516 | CONFIG_USB_OTG=y | 520 | CONFIG_USB_OTG=y |
diff --git a/arch/arm64/include/asm/asm-prototypes.h b/arch/arm64/include/asm/asm-prototypes.h index 2173ad32d550..1c9a3a0c5fa5 100644 --- a/arch/arm64/include/asm/asm-prototypes.h +++ b/arch/arm64/include/asm/asm-prototypes.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | #ifndef __ASM_PROTOTYPES_H | 2 | #ifndef __ASM_PROTOTYPES_H |
| 3 | #define __ASM_PROTOTYPES_H | 3 | #define __ASM_PROTOTYPES_H |
| 4 | /* | 4 | /* |
| 5 | * CONFIG_MODEVERIONS requires a C declaration to generate the appropriate CRC | 5 | * CONFIG_MODVERSIONS requires a C declaration to generate the appropriate CRC |
| 6 | * for each symbol. Since commit: | 6 | * for each symbol. Since commit: |
| 7 | * | 7 | * |
| 8 | * 4efca4ed05cbdfd1 ("kbuild: modversions for EXPORT_SYMBOL() for asm") | 8 | * 4efca4ed05cbdfd1 ("kbuild: modversions for EXPORT_SYMBOL() for asm") |
diff --git a/arch/arm64/include/asm/cache.h b/arch/arm64/include/asm/cache.h index 13dd42c3ad4e..926434f413fa 100644 --- a/arch/arm64/include/asm/cache.h +++ b/arch/arm64/include/asm/cache.h | |||
| @@ -58,6 +58,10 @@ | |||
| 58 | */ | 58 | */ |
| 59 | #define ARCH_DMA_MINALIGN (128) | 59 | #define ARCH_DMA_MINALIGN (128) |
| 60 | 60 | ||
| 61 | #ifdef CONFIG_KASAN_SW_TAGS | ||
| 62 | #define ARCH_SLAB_MINALIGN (1ULL << KASAN_SHADOW_SCALE_SHIFT) | ||
| 63 | #endif | ||
| 64 | |||
| 61 | #ifndef __ASSEMBLY__ | 65 | #ifndef __ASSEMBLY__ |
| 62 | 66 | ||
| 63 | #include <linux/bitops.h> | 67 | #include <linux/bitops.h> |
diff --git a/arch/arm64/include/asm/device.h b/arch/arm64/include/asm/device.h index 3dd3d664c5c5..4658c937e173 100644 --- a/arch/arm64/include/asm/device.h +++ b/arch/arm64/include/asm/device.h | |||
| @@ -20,9 +20,6 @@ struct dev_archdata { | |||
| 20 | #ifdef CONFIG_IOMMU_API | 20 | #ifdef CONFIG_IOMMU_API |
| 21 | void *iommu; /* private IOMMU data */ | 21 | void *iommu; /* private IOMMU data */ |
| 22 | #endif | 22 | #endif |
| 23 | #ifdef CONFIG_XEN | ||
| 24 | const struct dma_map_ops *dev_dma_ops; | ||
| 25 | #endif | ||
| 26 | }; | 23 | }; |
| 27 | 24 | ||
| 28 | struct pdev_archdata { | 25 | struct pdev_archdata { |
diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h index 7732d0ba4e60..da3fc7324d68 100644 --- a/arch/arm64/include/asm/kvm_host.h +++ b/arch/arm64/include/asm/kvm_host.h | |||
| @@ -48,6 +48,7 @@ | |||
| 48 | #define KVM_REQ_SLEEP \ | 48 | #define KVM_REQ_SLEEP \ |
| 49 | KVM_ARCH_REQ_FLAGS(0, KVM_REQUEST_WAIT | KVM_REQUEST_NO_WAKEUP) | 49 | KVM_ARCH_REQ_FLAGS(0, KVM_REQUEST_WAIT | KVM_REQUEST_NO_WAKEUP) |
| 50 | #define KVM_REQ_IRQ_PENDING KVM_ARCH_REQ(1) | 50 | #define KVM_REQ_IRQ_PENDING KVM_ARCH_REQ(1) |
| 51 | #define KVM_REQ_VCPU_RESET KVM_ARCH_REQ(2) | ||
| 51 | 52 | ||
| 52 | DECLARE_STATIC_KEY_FALSE(userspace_irqchip_in_use); | 53 | DECLARE_STATIC_KEY_FALSE(userspace_irqchip_in_use); |
| 53 | 54 | ||
| @@ -208,6 +209,13 @@ struct kvm_cpu_context { | |||
| 208 | 209 | ||
| 209 | typedef struct kvm_cpu_context kvm_cpu_context_t; | 210 | typedef struct kvm_cpu_context kvm_cpu_context_t; |
| 210 | 211 | ||
| 212 | struct vcpu_reset_state { | ||
| 213 | unsigned long pc; | ||
| 214 | unsigned long r0; | ||
| 215 | bool be; | ||
| 216 | bool reset; | ||
| 217 | }; | ||
| 218 | |||
| 211 | struct kvm_vcpu_arch { | 219 | struct kvm_vcpu_arch { |
| 212 | struct kvm_cpu_context ctxt; | 220 | struct kvm_cpu_context ctxt; |
| 213 | 221 | ||
| @@ -297,6 +305,9 @@ struct kvm_vcpu_arch { | |||
| 297 | /* Virtual SError ESR to restore when HCR_EL2.VSE is set */ | 305 | /* Virtual SError ESR to restore when HCR_EL2.VSE is set */ |
| 298 | u64 vsesr_el2; | 306 | u64 vsesr_el2; |
| 299 | 307 | ||
| 308 | /* Additional reset state */ | ||
| 309 | struct vcpu_reset_state reset_state; | ||
| 310 | |||
| 300 | /* True when deferrable sysregs are loaded on the physical CPU, | 311 | /* True when deferrable sysregs are loaded on the physical CPU, |
| 301 | * see kvm_vcpu_load_sysregs and kvm_vcpu_put_sysregs. */ | 312 | * see kvm_vcpu_load_sysregs and kvm_vcpu_put_sysregs. */ |
| 302 | bool sysregs_loaded_on_cpu; | 313 | bool sysregs_loaded_on_cpu; |
diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h index e1ec947e7c0c..0c656850eeea 100644 --- a/arch/arm64/include/asm/memory.h +++ b/arch/arm64/include/asm/memory.h | |||
| @@ -332,6 +332,17 @@ static inline void *phys_to_virt(phys_addr_t x) | |||
| 332 | #define virt_addr_valid(kaddr) \ | 332 | #define virt_addr_valid(kaddr) \ |
| 333 | (_virt_addr_is_linear(kaddr) && _virt_addr_valid(kaddr)) | 333 | (_virt_addr_is_linear(kaddr) && _virt_addr_valid(kaddr)) |
| 334 | 334 | ||
| 335 | /* | ||
| 336 | * Given that the GIC architecture permits ITS implementations that can only be | ||
| 337 | * configured with a LPI table address once, GICv3 systems with many CPUs may | ||
| 338 | * end up reserving a lot of different regions after a kexec for their LPI | ||
| 339 | * tables (one per CPU), as we are forced to reuse the same memory after kexec | ||
| 340 | * (and thus reserve it persistently with EFI beforehand) | ||
| 341 | */ | ||
| 342 | #if defined(CONFIG_EFI) && defined(CONFIG_ARM_GIC_V3_ITS) | ||
| 343 | # define INIT_MEMBLOCK_RESERVED_REGIONS (INIT_MEMBLOCK_REGIONS + NR_CPUS + 1) | ||
| 344 | #endif | ||
| 345 | |||
| 335 | #include <asm-generic/memory_model.h> | 346 | #include <asm-generic/memory_model.h> |
| 336 | 347 | ||
| 337 | #endif | 348 | #endif |
diff --git a/arch/arm64/include/asm/mmu.h b/arch/arm64/include/asm/mmu.h index 7689c7aa1d77..3e8063f4f9d3 100644 --- a/arch/arm64/include/asm/mmu.h +++ b/arch/arm64/include/asm/mmu.h | |||
| @@ -16,6 +16,8 @@ | |||
| 16 | #ifndef __ASM_MMU_H | 16 | #ifndef __ASM_MMU_H |
| 17 | #define __ASM_MMU_H | 17 | #define __ASM_MMU_H |
| 18 | 18 | ||
| 19 | #include <asm/cputype.h> | ||
| 20 | |||
| 19 | #define MMCF_AARCH32 0x1 /* mm context flag for AArch32 executables */ | 21 | #define MMCF_AARCH32 0x1 /* mm context flag for AArch32 executables */ |
| 20 | #define USER_ASID_BIT 48 | 22 | #define USER_ASID_BIT 48 |
| 21 | #define USER_ASID_FLAG (UL(1) << USER_ASID_BIT) | 23 | #define USER_ASID_FLAG (UL(1) << USER_ASID_BIT) |
| @@ -44,6 +46,48 @@ static inline bool arm64_kernel_unmapped_at_el0(void) | |||
| 44 | cpus_have_const_cap(ARM64_UNMAP_KERNEL_AT_EL0); | 46 | cpus_have_const_cap(ARM64_UNMAP_KERNEL_AT_EL0); |
| 45 | } | 47 | } |
| 46 | 48 | ||
| 49 | static inline bool arm64_kernel_use_ng_mappings(void) | ||
| 50 | { | ||
| 51 | bool tx1_bug; | ||
| 52 | |||
| 53 | /* What's a kpti? Use global mappings if we don't know. */ | ||
| 54 | if (!IS_ENABLED(CONFIG_UNMAP_KERNEL_AT_EL0)) | ||
| 55 | return false; | ||
| 56 | |||
| 57 | /* | ||
| 58 | * Note: this function is called before the CPU capabilities have | ||
| 59 | * been configured, so our early mappings will be global. If we | ||
| 60 | * later determine that kpti is required, then | ||
| 61 | * kpti_install_ng_mappings() will make them non-global. | ||
| 62 | */ | ||
| 63 | if (arm64_kernel_unmapped_at_el0()) | ||
| 64 | return true; | ||
| 65 | |||
| 66 | if (!IS_ENABLED(CONFIG_RANDOMIZE_BASE)) | ||
| 67 | return false; | ||
| 68 | |||
| 69 | /* | ||
| 70 | * KASLR is enabled so we're going to be enabling kpti on non-broken | ||
| 71 | * CPUs regardless of their susceptibility to Meltdown. Rather | ||
| 72 | * than force everybody to go through the G -> nG dance later on, | ||
| 73 | * just put down non-global mappings from the beginning. | ||
| 74 | */ | ||
| 75 | if (!IS_ENABLED(CONFIG_CAVIUM_ERRATUM_27456)) { | ||
| 76 | tx1_bug = false; | ||
| 77 | #ifndef MODULE | ||
| 78 | } else if (!static_branch_likely(&arm64_const_caps_ready)) { | ||
| 79 | extern const struct midr_range cavium_erratum_27456_cpus[]; | ||
| 80 | |||
| 81 | tx1_bug = is_midr_in_range_list(read_cpuid_id(), | ||
| 82 | cavium_erratum_27456_cpus); | ||
| 83 | #endif | ||
| 84 | } else { | ||
| 85 | tx1_bug = __cpus_have_const_cap(ARM64_WORKAROUND_CAVIUM_27456); | ||
| 86 | } | ||
| 87 | |||
| 88 | return !tx1_bug && kaslr_offset() > 0; | ||
| 89 | } | ||
| 90 | |||
| 47 | typedef void (*bp_hardening_cb_t)(void); | 91 | typedef void (*bp_hardening_cb_t)(void); |
| 48 | 92 | ||
| 49 | struct bp_hardening_data { | 93 | struct bp_hardening_data { |
diff --git a/arch/arm64/include/asm/neon-intrinsics.h b/arch/arm64/include/asm/neon-intrinsics.h index 2ba6c6b9541f..71abfc7612b2 100644 --- a/arch/arm64/include/asm/neon-intrinsics.h +++ b/arch/arm64/include/asm/neon-intrinsics.h | |||
| @@ -36,4 +36,8 @@ | |||
| 36 | #include <arm_neon.h> | 36 | #include <arm_neon.h> |
| 37 | #endif | 37 | #endif |
| 38 | 38 | ||
| 39 | #ifdef CONFIG_CC_IS_CLANG | ||
| 40 | #pragma clang diagnostic ignored "-Wincompatible-pointer-types" | ||
| 41 | #endif | ||
| 42 | |||
| 39 | #endif /* __ASM_NEON_INTRINSICS_H */ | 43 | #endif /* __ASM_NEON_INTRINSICS_H */ |
diff --git a/arch/arm64/include/asm/pgtable-prot.h b/arch/arm64/include/asm/pgtable-prot.h index 78b942c1bea4..986e41c4c32b 100644 --- a/arch/arm64/include/asm/pgtable-prot.h +++ b/arch/arm64/include/asm/pgtable-prot.h | |||
| @@ -37,8 +37,8 @@ | |||
| 37 | #define _PROT_DEFAULT (PTE_TYPE_PAGE | PTE_AF | PTE_SHARED) | 37 | #define _PROT_DEFAULT (PTE_TYPE_PAGE | PTE_AF | PTE_SHARED) |
| 38 | #define _PROT_SECT_DEFAULT (PMD_TYPE_SECT | PMD_SECT_AF | PMD_SECT_S) | 38 | #define _PROT_SECT_DEFAULT (PMD_TYPE_SECT | PMD_SECT_AF | PMD_SECT_S) |
| 39 | 39 | ||
| 40 | #define PTE_MAYBE_NG (arm64_kernel_unmapped_at_el0() ? PTE_NG : 0) | 40 | #define PTE_MAYBE_NG (arm64_kernel_use_ng_mappings() ? PTE_NG : 0) |
| 41 | #define PMD_MAYBE_NG (arm64_kernel_unmapped_at_el0() ? PMD_SECT_NG : 0) | 41 | #define PMD_MAYBE_NG (arm64_kernel_use_ng_mappings() ? PMD_SECT_NG : 0) |
| 42 | 42 | ||
| 43 | #define PROT_DEFAULT (_PROT_DEFAULT | PTE_MAYBE_NG) | 43 | #define PROT_DEFAULT (_PROT_DEFAULT | PTE_MAYBE_NG) |
| 44 | #define PROT_SECT_DEFAULT (_PROT_SECT_DEFAULT | PMD_MAYBE_NG) | 44 | #define PROT_SECT_DEFAULT (_PROT_SECT_DEFAULT | PMD_MAYBE_NG) |
diff --git a/arch/arm64/include/asm/xen/page-coherent.h b/arch/arm64/include/asm/xen/page-coherent.h index b3ef061d8b74..d88e56b90b93 100644 --- a/arch/arm64/include/asm/xen/page-coherent.h +++ b/arch/arm64/include/asm/xen/page-coherent.h | |||
| @@ -1 +1,77 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | #ifndef _ASM_ARM64_XEN_PAGE_COHERENT_H | ||
| 3 | #define _ASM_ARM64_XEN_PAGE_COHERENT_H | ||
| 4 | |||
| 5 | #include <linux/dma-mapping.h> | ||
| 6 | #include <asm/page.h> | ||
| 1 | #include <xen/arm/page-coherent.h> | 7 | #include <xen/arm/page-coherent.h> |
| 8 | |||
| 9 | static inline void *xen_alloc_coherent_pages(struct device *hwdev, size_t size, | ||
| 10 | dma_addr_t *dma_handle, gfp_t flags, unsigned long attrs) | ||
| 11 | { | ||
| 12 | return dma_direct_alloc(hwdev, size, dma_handle, flags, attrs); | ||
| 13 | } | ||
| 14 | |||
| 15 | static inline void xen_free_coherent_pages(struct device *hwdev, size_t size, | ||
| 16 | void *cpu_addr, dma_addr_t dma_handle, unsigned long attrs) | ||
| 17 | { | ||
| 18 | dma_direct_free(hwdev, size, cpu_addr, dma_handle, attrs); | ||
| 19 | } | ||
| 20 | |||
| 21 | static inline void xen_dma_sync_single_for_cpu(struct device *hwdev, | ||
| 22 | dma_addr_t handle, size_t size, enum dma_data_direction dir) | ||
| 23 | { | ||
| 24 | unsigned long pfn = PFN_DOWN(handle); | ||
| 25 | |||
| 26 | if (pfn_valid(pfn)) | ||
| 27 | dma_direct_sync_single_for_cpu(hwdev, handle, size, dir); | ||
| 28 | else | ||
| 29 | __xen_dma_sync_single_for_cpu(hwdev, handle, size, dir); | ||
| 30 | } | ||
| 31 | |||
| 32 | static inline void xen_dma_sync_single_for_device(struct device *hwdev, | ||
| 33 | dma_addr_t handle, size_t size, enum dma_data_direction dir) | ||
| 34 | { | ||
| 35 | unsigned long pfn = PFN_DOWN(handle); | ||
| 36 | if (pfn_valid(pfn)) | ||
| 37 | dma_direct_sync_single_for_device(hwdev, handle, size, dir); | ||
| 38 | else | ||
| 39 | __xen_dma_sync_single_for_device(hwdev, handle, size, dir); | ||
| 40 | } | ||
| 41 | |||
| 42 | static inline void xen_dma_map_page(struct device *hwdev, struct page *page, | ||
| 43 | dma_addr_t dev_addr, unsigned long offset, size_t size, | ||
| 44 | enum dma_data_direction dir, unsigned long attrs) | ||
| 45 | { | ||
| 46 | unsigned long page_pfn = page_to_xen_pfn(page); | ||
| 47 | unsigned long dev_pfn = XEN_PFN_DOWN(dev_addr); | ||
| 48 | unsigned long compound_pages = | ||
| 49 | (1<<compound_order(page)) * XEN_PFN_PER_PAGE; | ||
| 50 | bool local = (page_pfn <= dev_pfn) && | ||
| 51 | (dev_pfn - page_pfn < compound_pages); | ||
| 52 | |||
| 53 | if (local) | ||
| 54 | dma_direct_map_page(hwdev, page, offset, size, dir, attrs); | ||
| 55 | else | ||
| 56 | __xen_dma_map_page(hwdev, page, dev_addr, offset, size, dir, attrs); | ||
| 57 | } | ||
| 58 | |||
| 59 | static inline void xen_dma_unmap_page(struct device *hwdev, dma_addr_t handle, | ||
| 60 | size_t size, enum dma_data_direction dir, unsigned long attrs) | ||
| 61 | { | ||
| 62 | unsigned long pfn = PFN_DOWN(handle); | ||
| 63 | /* | ||
| 64 | * Dom0 is mapped 1:1, while the Linux page can be spanned accross | ||
| 65 | * multiple Xen page, it's not possible to have a mix of local and | ||
| 66 | * foreign Xen page. Dom0 is mapped 1:1, so calling pfn_valid on a | ||
| 67 | * foreign mfn will always return false. If the page is local we can | ||
| 68 | * safely call the native dma_ops function, otherwise we call the xen | ||
| 69 | * specific function. | ||
| 70 | */ | ||
| 71 | if (pfn_valid(pfn)) | ||
| 72 | dma_direct_unmap_page(hwdev, handle, size, dir, attrs); | ||
| 73 | else | ||
| 74 | __xen_dma_unmap_page(hwdev, handle, size, dir, attrs); | ||
| 75 | } | ||
| 76 | |||
| 77 | #endif /* _ASM_ARM64_XEN_PAGE_COHERENT_H */ | ||
diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c index 09ac548c9d44..9950bb0cbd52 100644 --- a/arch/arm64/kernel/cpu_errata.c +++ b/arch/arm64/kernel/cpu_errata.c | |||
| @@ -553,7 +553,7 @@ static const struct midr_range arm64_repeat_tlbi_cpus[] = { | |||
| 553 | #endif | 553 | #endif |
| 554 | 554 | ||
| 555 | #ifdef CONFIG_CAVIUM_ERRATUM_27456 | 555 | #ifdef CONFIG_CAVIUM_ERRATUM_27456 |
| 556 | static const struct midr_range cavium_erratum_27456_cpus[] = { | 556 | const struct midr_range cavium_erratum_27456_cpus[] = { |
| 557 | /* Cavium ThunderX, T88 pass 1.x - 2.1 */ | 557 | /* Cavium ThunderX, T88 pass 1.x - 2.1 */ |
| 558 | MIDR_RANGE(MIDR_THUNDERX, 0, 0, 1, 1), | 558 | MIDR_RANGE(MIDR_THUNDERX, 0, 0, 1, 1), |
| 559 | /* Cavium ThunderX, T81 pass 1.0 */ | 559 | /* Cavium ThunderX, T81 pass 1.0 */ |
diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index 4f272399de89..f6d84e2c92fe 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c | |||
| @@ -983,7 +983,7 @@ static bool unmap_kernel_at_el0(const struct arm64_cpu_capabilities *entry, | |||
| 983 | 983 | ||
| 984 | /* Useful for KASLR robustness */ | 984 | /* Useful for KASLR robustness */ |
| 985 | if (IS_ENABLED(CONFIG_RANDOMIZE_BASE)) | 985 | if (IS_ENABLED(CONFIG_RANDOMIZE_BASE)) |
| 986 | return true; | 986 | return kaslr_offset() > 0; |
| 987 | 987 | ||
| 988 | /* Don't force KPTI for CPUs that are not vulnerable */ | 988 | /* Don't force KPTI for CPUs that are not vulnerable */ |
| 989 | if (is_midr_in_range_list(read_cpuid_id(), kpti_safe_list)) | 989 | if (is_midr_in_range_list(read_cpuid_id(), kpti_safe_list)) |
| @@ -1003,7 +1003,12 @@ kpti_install_ng_mappings(const struct arm64_cpu_capabilities *__unused) | |||
| 1003 | static bool kpti_applied = false; | 1003 | static bool kpti_applied = false; |
| 1004 | int cpu = smp_processor_id(); | 1004 | int cpu = smp_processor_id(); |
| 1005 | 1005 | ||
| 1006 | if (kpti_applied) | 1006 | /* |
| 1007 | * We don't need to rewrite the page-tables if either we've done | ||
| 1008 | * it already or we have KASLR enabled and therefore have not | ||
| 1009 | * created any global mappings at all. | ||
| 1010 | */ | ||
| 1011 | if (kpti_applied || kaslr_offset() > 0) | ||
| 1007 | return; | 1012 | return; |
| 1008 | 1013 | ||
| 1009 | remap_fn = (void *)__pa_symbol(idmap_kpti_install_ng_mappings); | 1014 | remap_fn = (void *)__pa_symbol(idmap_kpti_install_ng_mappings); |
diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S index c7213674cb24..eecf7927dab0 100644 --- a/arch/arm64/kernel/head.S +++ b/arch/arm64/kernel/head.S | |||
| @@ -475,6 +475,7 @@ ENDPROC(__primary_switched) | |||
| 475 | 475 | ||
| 476 | ENTRY(kimage_vaddr) | 476 | ENTRY(kimage_vaddr) |
| 477 | .quad _text - TEXT_OFFSET | 477 | .quad _text - TEXT_OFFSET |
| 478 | EXPORT_SYMBOL(kimage_vaddr) | ||
| 478 | 479 | ||
| 479 | /* | 480 | /* |
| 480 | * If we're fortunate enough to boot at EL2, ensure that the world is | 481 | * If we're fortunate enough to boot at EL2, ensure that the world is |
| @@ -538,8 +539,7 @@ set_hcr: | |||
| 538 | /* GICv3 system register access */ | 539 | /* GICv3 system register access */ |
| 539 | mrs x0, id_aa64pfr0_el1 | 540 | mrs x0, id_aa64pfr0_el1 |
| 540 | ubfx x0, x0, #24, #4 | 541 | ubfx x0, x0, #24, #4 |
| 541 | cmp x0, #1 | 542 | cbz x0, 3f |
| 542 | b.ne 3f | ||
| 543 | 543 | ||
| 544 | mrs_s x0, SYS_ICC_SRE_EL2 | 544 | mrs_s x0, SYS_ICC_SRE_EL2 |
| 545 | orr x0, x0, #ICC_SRE_EL2_SRE // Set ICC_SRE_EL2.SRE==1 | 545 | orr x0, x0, #ICC_SRE_EL2_SRE // Set ICC_SRE_EL2.SRE==1 |
diff --git a/arch/arm64/kernel/hibernate.c b/arch/arm64/kernel/hibernate.c index 29cdc99688f3..9859e1178e6b 100644 --- a/arch/arm64/kernel/hibernate.c +++ b/arch/arm64/kernel/hibernate.c | |||
| @@ -299,8 +299,10 @@ int swsusp_arch_suspend(void) | |||
| 299 | dcache_clean_range(__idmap_text_start, __idmap_text_end); | 299 | dcache_clean_range(__idmap_text_start, __idmap_text_end); |
| 300 | 300 | ||
| 301 | /* Clean kvm setup code to PoC? */ | 301 | /* Clean kvm setup code to PoC? */ |
| 302 | if (el2_reset_needed()) | 302 | if (el2_reset_needed()) { |
| 303 | dcache_clean_range(__hyp_idmap_text_start, __hyp_idmap_text_end); | 303 | dcache_clean_range(__hyp_idmap_text_start, __hyp_idmap_text_end); |
| 304 | dcache_clean_range(__hyp_text_start, __hyp_text_end); | ||
| 305 | } | ||
| 304 | 306 | ||
| 305 | /* make the crash dump kernel image protected again */ | 307 | /* make the crash dump kernel image protected again */ |
| 306 | crash_post_resume(); | 308 | crash_post_resume(); |
diff --git a/arch/arm64/kernel/hyp-stub.S b/arch/arm64/kernel/hyp-stub.S index e1261fbaa374..17f325ba831e 100644 --- a/arch/arm64/kernel/hyp-stub.S +++ b/arch/arm64/kernel/hyp-stub.S | |||
| @@ -28,6 +28,8 @@ | |||
| 28 | #include <asm/virt.h> | 28 | #include <asm/virt.h> |
| 29 | 29 | ||
| 30 | .text | 30 | .text |
| 31 | .pushsection .hyp.text, "ax" | ||
| 32 | |||
| 31 | .align 11 | 33 | .align 11 |
| 32 | 34 | ||
| 33 | ENTRY(__hyp_stub_vectors) | 35 | ENTRY(__hyp_stub_vectors) |
diff --git a/arch/arm64/kernel/kaslr.c b/arch/arm64/kernel/kaslr.c index f0e6ab8abe9c..b09b6f75f759 100644 --- a/arch/arm64/kernel/kaslr.c +++ b/arch/arm64/kernel/kaslr.c | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | #include <linux/sched.h> | 14 | #include <linux/sched.h> |
| 15 | #include <linux/types.h> | 15 | #include <linux/types.h> |
| 16 | 16 | ||
| 17 | #include <asm/cacheflush.h> | ||
| 17 | #include <asm/fixmap.h> | 18 | #include <asm/fixmap.h> |
| 18 | #include <asm/kernel-pgtable.h> | 19 | #include <asm/kernel-pgtable.h> |
| 19 | #include <asm/memory.h> | 20 | #include <asm/memory.h> |
| @@ -43,7 +44,7 @@ static __init u64 get_kaslr_seed(void *fdt) | |||
| 43 | return ret; | 44 | return ret; |
| 44 | } | 45 | } |
| 45 | 46 | ||
| 46 | static __init const u8 *get_cmdline(void *fdt) | 47 | static __init const u8 *kaslr_get_cmdline(void *fdt) |
| 47 | { | 48 | { |
| 48 | static __initconst const u8 default_cmdline[] = CONFIG_CMDLINE; | 49 | static __initconst const u8 default_cmdline[] = CONFIG_CMDLINE; |
| 49 | 50 | ||
| @@ -87,6 +88,7 @@ u64 __init kaslr_early_init(u64 dt_phys) | |||
| 87 | * we end up running with module randomization disabled. | 88 | * we end up running with module randomization disabled. |
| 88 | */ | 89 | */ |
| 89 | module_alloc_base = (u64)_etext - MODULES_VSIZE; | 90 | module_alloc_base = (u64)_etext - MODULES_VSIZE; |
| 91 | __flush_dcache_area(&module_alloc_base, sizeof(module_alloc_base)); | ||
| 90 | 92 | ||
| 91 | /* | 93 | /* |
| 92 | * Try to map the FDT early. If this fails, we simply bail, | 94 | * Try to map the FDT early. If this fails, we simply bail, |
| @@ -109,7 +111,7 @@ u64 __init kaslr_early_init(u64 dt_phys) | |||
| 109 | * Check if 'nokaslr' appears on the command line, and | 111 | * Check if 'nokaslr' appears on the command line, and |
| 110 | * return 0 if that is the case. | 112 | * return 0 if that is the case. |
| 111 | */ | 113 | */ |
| 112 | cmdline = get_cmdline(fdt); | 114 | cmdline = kaslr_get_cmdline(fdt); |
| 113 | str = strstr(cmdline, "nokaslr"); | 115 | str = strstr(cmdline, "nokaslr"); |
| 114 | if (str == cmdline || (str > cmdline && *(str - 1) == ' ')) | 116 | if (str == cmdline || (str > cmdline && *(str - 1) == ' ')) |
| 115 | return 0; | 117 | return 0; |
| @@ -169,5 +171,8 @@ u64 __init kaslr_early_init(u64 dt_phys) | |||
| 169 | module_alloc_base += (module_range * (seed & ((1 << 21) - 1))) >> 21; | 171 | module_alloc_base += (module_range * (seed & ((1 << 21) - 1))) >> 21; |
| 170 | module_alloc_base &= PAGE_MASK; | 172 | module_alloc_base &= PAGE_MASK; |
| 171 | 173 | ||
| 174 | __flush_dcache_area(&module_alloc_base, sizeof(module_alloc_base)); | ||
| 175 | __flush_dcache_area(&memstart_offset_seed, sizeof(memstart_offset_seed)); | ||
| 176 | |||
| 172 | return offset; | 177 | return offset; |
| 173 | } | 178 | } |
diff --git a/arch/arm64/kernel/machine_kexec_file.c b/arch/arm64/kernel/machine_kexec_file.c index 10e33860e47a..58871333737a 100644 --- a/arch/arm64/kernel/machine_kexec_file.c +++ b/arch/arm64/kernel/machine_kexec_file.c | |||
| @@ -87,7 +87,9 @@ static int setup_dtb(struct kimage *image, | |||
| 87 | 87 | ||
| 88 | /* add kaslr-seed */ | 88 | /* add kaslr-seed */ |
| 89 | ret = fdt_delprop(dtb, off, FDT_PROP_KASLR_SEED); | 89 | ret = fdt_delprop(dtb, off, FDT_PROP_KASLR_SEED); |
| 90 | if (ret && (ret != -FDT_ERR_NOTFOUND)) | 90 | if (ret == -FDT_ERR_NOTFOUND) |
| 91 | ret = 0; | ||
| 92 | else if (ret) | ||
| 91 | goto out; | 93 | goto out; |
| 92 | 94 | ||
| 93 | if (rng_is_initialized()) { | 95 | if (rng_is_initialized()) { |
| @@ -118,10 +120,12 @@ static int create_dtb(struct kimage *image, | |||
| 118 | { | 120 | { |
| 119 | void *buf; | 121 | void *buf; |
| 120 | size_t buf_size; | 122 | size_t buf_size; |
| 123 | size_t cmdline_len; | ||
| 121 | int ret; | 124 | int ret; |
| 122 | 125 | ||
| 126 | cmdline_len = cmdline ? strlen(cmdline) : 0; | ||
| 123 | buf_size = fdt_totalsize(initial_boot_params) | 127 | buf_size = fdt_totalsize(initial_boot_params) |
| 124 | + strlen(cmdline) + DTB_EXTRA_SPACE; | 128 | + cmdline_len + DTB_EXTRA_SPACE; |
| 125 | 129 | ||
| 126 | for (;;) { | 130 | for (;;) { |
| 127 | buf = vmalloc(buf_size); | 131 | buf = vmalloc(buf_size); |
diff --git a/arch/arm64/kernel/probes/kprobes.c b/arch/arm64/kernel/probes/kprobes.c index 2a5b338b2542..f17afb99890c 100644 --- a/arch/arm64/kernel/probes/kprobes.c +++ b/arch/arm64/kernel/probes/kprobes.c | |||
| @@ -478,13 +478,13 @@ bool arch_within_kprobe_blacklist(unsigned long addr) | |||
| 478 | addr < (unsigned long)__entry_text_end) || | 478 | addr < (unsigned long)__entry_text_end) || |
| 479 | (addr >= (unsigned long)__idmap_text_start && | 479 | (addr >= (unsigned long)__idmap_text_start && |
| 480 | addr < (unsigned long)__idmap_text_end) || | 480 | addr < (unsigned long)__idmap_text_end) || |
| 481 | (addr >= (unsigned long)__hyp_text_start && | ||
| 482 | addr < (unsigned long)__hyp_text_end) || | ||
| 481 | !!search_exception_tables(addr)) | 483 | !!search_exception_tables(addr)) |
| 482 | return true; | 484 | return true; |
| 483 | 485 | ||
| 484 | if (!is_kernel_in_hyp_mode()) { | 486 | if (!is_kernel_in_hyp_mode()) { |
| 485 | if ((addr >= (unsigned long)__hyp_text_start && | 487 | if ((addr >= (unsigned long)__hyp_idmap_text_start && |
| 486 | addr < (unsigned long)__hyp_text_end) || | ||
| 487 | (addr >= (unsigned long)__hyp_idmap_text_start && | ||
| 488 | addr < (unsigned long)__hyp_idmap_text_end)) | 488 | addr < (unsigned long)__hyp_idmap_text_end)) |
| 489 | return true; | 489 | return true; |
| 490 | } | 490 | } |
diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c index 9dce33b0e260..ddaea0fd2fa4 100644 --- a/arch/arm64/kernel/ptrace.c +++ b/arch/arm64/kernel/ptrace.c | |||
| @@ -1702,19 +1702,20 @@ void syscall_trace_exit(struct pt_regs *regs) | |||
| 1702 | } | 1702 | } |
| 1703 | 1703 | ||
| 1704 | /* | 1704 | /* |
| 1705 | * SPSR_ELx bits which are always architecturally RES0 per ARM DDI 0487C.a | 1705 | * SPSR_ELx bits which are always architecturally RES0 per ARM DDI 0487D.a. |
| 1706 | * We also take into account DIT (bit 24), which is not yet documented, and | 1706 | * We permit userspace to set SSBS (AArch64 bit 12, AArch32 bit 23) which is |
| 1707 | * treat PAN and UAO as RES0 bits, as they are meaningless at EL0, and may be | 1707 | * not described in ARM DDI 0487D.a. |
| 1708 | * allocated an EL0 meaning in future. | 1708 | * We treat PAN and UAO as RES0 bits, as they are meaningless at EL0, and may |
| 1709 | * be allocated an EL0 meaning in future. | ||
| 1709 | * Userspace cannot use these until they have an architectural meaning. | 1710 | * Userspace cannot use these until they have an architectural meaning. |
| 1710 | * Note that this follows the SPSR_ELx format, not the AArch32 PSR format. | 1711 | * Note that this follows the SPSR_ELx format, not the AArch32 PSR format. |
| 1711 | * We also reserve IL for the kernel; SS is handled dynamically. | 1712 | * We also reserve IL for the kernel; SS is handled dynamically. |
| 1712 | */ | 1713 | */ |
| 1713 | #define SPSR_EL1_AARCH64_RES0_BITS \ | 1714 | #define SPSR_EL1_AARCH64_RES0_BITS \ |
| 1714 | (GENMASK_ULL(63,32) | GENMASK_ULL(27, 25) | GENMASK_ULL(23, 22) | \ | 1715 | (GENMASK_ULL(63, 32) | GENMASK_ULL(27, 25) | GENMASK_ULL(23, 22) | \ |
| 1715 | GENMASK_ULL(20, 10) | GENMASK_ULL(5, 5)) | 1716 | GENMASK_ULL(20, 13) | GENMASK_ULL(11, 10) | GENMASK_ULL(5, 5)) |
| 1716 | #define SPSR_EL1_AARCH32_RES0_BITS \ | 1717 | #define SPSR_EL1_AARCH32_RES0_BITS \ |
| 1717 | (GENMASK_ULL(63,32) | GENMASK_ULL(23, 22) | GENMASK_ULL(20,20)) | 1718 | (GENMASK_ULL(63, 32) | GENMASK_ULL(22, 22) | GENMASK_ULL(20, 20)) |
| 1718 | 1719 | ||
| 1719 | static int valid_compat_regs(struct user_pt_regs *regs) | 1720 | static int valid_compat_regs(struct user_pt_regs *regs) |
| 1720 | { | 1721 | { |
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c index 4b0e1231625c..009849328289 100644 --- a/arch/arm64/kernel/setup.c +++ b/arch/arm64/kernel/setup.c | |||
| @@ -313,7 +313,6 @@ void __init setup_arch(char **cmdline_p) | |||
| 313 | arm64_memblock_init(); | 313 | arm64_memblock_init(); |
| 314 | 314 | ||
| 315 | paging_init(); | 315 | paging_init(); |
| 316 | efi_apply_persistent_mem_reservations(); | ||
| 317 | 316 | ||
| 318 | acpi_table_upgrade(); | 317 | acpi_table_upgrade(); |
| 319 | 318 | ||
| @@ -340,6 +339,9 @@ void __init setup_arch(char **cmdline_p) | |||
| 340 | smp_init_cpus(); | 339 | smp_init_cpus(); |
| 341 | smp_build_mpidr_hash(); | 340 | smp_build_mpidr_hash(); |
| 342 | 341 | ||
| 342 | /* Init percpu seeds for random tags after cpus are set up. */ | ||
| 343 | kasan_init_tags(); | ||
| 344 | |||
| 343 | #ifdef CONFIG_ARM64_SW_TTBR0_PAN | 345 | #ifdef CONFIG_ARM64_SW_TTBR0_PAN |
| 344 | /* | 346 | /* |
| 345 | * Make sure init_thread_info.ttbr0 always generates translation | 347 | * Make sure init_thread_info.ttbr0 always generates translation |
diff --git a/arch/arm64/kvm/hyp/switch.c b/arch/arm64/kvm/hyp/switch.c index b0b1478094b4..421ebf6f7086 100644 --- a/arch/arm64/kvm/hyp/switch.c +++ b/arch/arm64/kvm/hyp/switch.c | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #include <kvm/arm_psci.h> | 23 | #include <kvm/arm_psci.h> |
| 24 | 24 | ||
| 25 | #include <asm/cpufeature.h> | 25 | #include <asm/cpufeature.h> |
| 26 | #include <asm/kprobes.h> | ||
| 26 | #include <asm/kvm_asm.h> | 27 | #include <asm/kvm_asm.h> |
| 27 | #include <asm/kvm_emulate.h> | 28 | #include <asm/kvm_emulate.h> |
| 28 | #include <asm/kvm_host.h> | 29 | #include <asm/kvm_host.h> |
| @@ -107,6 +108,7 @@ static void activate_traps_vhe(struct kvm_vcpu *vcpu) | |||
| 107 | 108 | ||
| 108 | write_sysreg(kvm_get_hyp_vector(), vbar_el1); | 109 | write_sysreg(kvm_get_hyp_vector(), vbar_el1); |
| 109 | } | 110 | } |
| 111 | NOKPROBE_SYMBOL(activate_traps_vhe); | ||
| 110 | 112 | ||
| 111 | static void __hyp_text __activate_traps_nvhe(struct kvm_vcpu *vcpu) | 113 | static void __hyp_text __activate_traps_nvhe(struct kvm_vcpu *vcpu) |
| 112 | { | 114 | { |
| @@ -154,6 +156,7 @@ static void deactivate_traps_vhe(void) | |||
| 154 | write_sysreg(CPACR_EL1_DEFAULT, cpacr_el1); | 156 | write_sysreg(CPACR_EL1_DEFAULT, cpacr_el1); |
| 155 | write_sysreg(vectors, vbar_el1); | 157 | write_sysreg(vectors, vbar_el1); |
| 156 | } | 158 | } |
| 159 | NOKPROBE_SYMBOL(deactivate_traps_vhe); | ||
| 157 | 160 | ||
| 158 | static void __hyp_text __deactivate_traps_nvhe(void) | 161 | static void __hyp_text __deactivate_traps_nvhe(void) |
| 159 | { | 162 | { |
| @@ -513,6 +516,7 @@ int kvm_vcpu_run_vhe(struct kvm_vcpu *vcpu) | |||
| 513 | 516 | ||
| 514 | return exit_code; | 517 | return exit_code; |
| 515 | } | 518 | } |
| 519 | NOKPROBE_SYMBOL(kvm_vcpu_run_vhe); | ||
| 516 | 520 | ||
| 517 | /* Switch to the guest for legacy non-VHE systems */ | 521 | /* Switch to the guest for legacy non-VHE systems */ |
| 518 | int __hyp_text __kvm_vcpu_run_nvhe(struct kvm_vcpu *vcpu) | 522 | int __hyp_text __kvm_vcpu_run_nvhe(struct kvm_vcpu *vcpu) |
| @@ -620,6 +624,7 @@ static void __hyp_call_panic_vhe(u64 spsr, u64 elr, u64 par, | |||
| 620 | read_sysreg_el2(esr), read_sysreg_el2(far), | 624 | read_sysreg_el2(esr), read_sysreg_el2(far), |
| 621 | read_sysreg(hpfar_el2), par, vcpu); | 625 | read_sysreg(hpfar_el2), par, vcpu); |
| 622 | } | 626 | } |
| 627 | NOKPROBE_SYMBOL(__hyp_call_panic_vhe); | ||
| 623 | 628 | ||
| 624 | void __hyp_text __noreturn hyp_panic(struct kvm_cpu_context *host_ctxt) | 629 | void __hyp_text __noreturn hyp_panic(struct kvm_cpu_context *host_ctxt) |
| 625 | { | 630 | { |
diff --git a/arch/arm64/kvm/hyp/sysreg-sr.c b/arch/arm64/kvm/hyp/sysreg-sr.c index 68d6f7c3b237..b426e2cf973c 100644 --- a/arch/arm64/kvm/hyp/sysreg-sr.c +++ b/arch/arm64/kvm/hyp/sysreg-sr.c | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #include <linux/compiler.h> | 18 | #include <linux/compiler.h> |
| 19 | #include <linux/kvm_host.h> | 19 | #include <linux/kvm_host.h> |
| 20 | 20 | ||
| 21 | #include <asm/kprobes.h> | ||
| 21 | #include <asm/kvm_asm.h> | 22 | #include <asm/kvm_asm.h> |
| 22 | #include <asm/kvm_emulate.h> | 23 | #include <asm/kvm_emulate.h> |
| 23 | #include <asm/kvm_hyp.h> | 24 | #include <asm/kvm_hyp.h> |
| @@ -98,12 +99,14 @@ void sysreg_save_host_state_vhe(struct kvm_cpu_context *ctxt) | |||
| 98 | { | 99 | { |
| 99 | __sysreg_save_common_state(ctxt); | 100 | __sysreg_save_common_state(ctxt); |
| 100 | } | 101 | } |
| 102 | NOKPROBE_SYMBOL(sysreg_save_host_state_vhe); | ||
| 101 | 103 | ||
| 102 | void sysreg_save_guest_state_vhe(struct kvm_cpu_context *ctxt) | 104 | void sysreg_save_guest_state_vhe(struct kvm_cpu_context *ctxt) |
| 103 | { | 105 | { |
| 104 | __sysreg_save_common_state(ctxt); | 106 | __sysreg_save_common_state(ctxt); |
| 105 | __sysreg_save_el2_return_state(ctxt); | 107 | __sysreg_save_el2_return_state(ctxt); |
| 106 | } | 108 | } |
| 109 | NOKPROBE_SYMBOL(sysreg_save_guest_state_vhe); | ||
| 107 | 110 | ||
| 108 | static void __hyp_text __sysreg_restore_common_state(struct kvm_cpu_context *ctxt) | 111 | static void __hyp_text __sysreg_restore_common_state(struct kvm_cpu_context *ctxt) |
| 109 | { | 112 | { |
| @@ -188,12 +191,14 @@ void sysreg_restore_host_state_vhe(struct kvm_cpu_context *ctxt) | |||
| 188 | { | 191 | { |
| 189 | __sysreg_restore_common_state(ctxt); | 192 | __sysreg_restore_common_state(ctxt); |
| 190 | } | 193 | } |
| 194 | NOKPROBE_SYMBOL(sysreg_restore_host_state_vhe); | ||
| 191 | 195 | ||
| 192 | void sysreg_restore_guest_state_vhe(struct kvm_cpu_context *ctxt) | 196 | void sysreg_restore_guest_state_vhe(struct kvm_cpu_context *ctxt) |
| 193 | { | 197 | { |
| 194 | __sysreg_restore_common_state(ctxt); | 198 | __sysreg_restore_common_state(ctxt); |
| 195 | __sysreg_restore_el2_return_state(ctxt); | 199 | __sysreg_restore_el2_return_state(ctxt); |
| 196 | } | 200 | } |
| 201 | NOKPROBE_SYMBOL(sysreg_restore_guest_state_vhe); | ||
| 197 | 202 | ||
| 198 | void __hyp_text __sysreg32_save_state(struct kvm_vcpu *vcpu) | 203 | void __hyp_text __sysreg32_save_state(struct kvm_vcpu *vcpu) |
| 199 | { | 204 | { |
diff --git a/arch/arm64/kvm/reset.c b/arch/arm64/kvm/reset.c index b72a3dd56204..f16a5f8ff2b4 100644 --- a/arch/arm64/kvm/reset.c +++ b/arch/arm64/kvm/reset.c | |||
| @@ -32,6 +32,7 @@ | |||
| 32 | #include <asm/kvm_arm.h> | 32 | #include <asm/kvm_arm.h> |
| 33 | #include <asm/kvm_asm.h> | 33 | #include <asm/kvm_asm.h> |
| 34 | #include <asm/kvm_coproc.h> | 34 | #include <asm/kvm_coproc.h> |
| 35 | #include <asm/kvm_emulate.h> | ||
| 35 | #include <asm/kvm_mmu.h> | 36 | #include <asm/kvm_mmu.h> |
| 36 | 37 | ||
| 37 | /* Maximum phys_shift supported for any VM on this host */ | 38 | /* Maximum phys_shift supported for any VM on this host */ |
| @@ -105,16 +106,33 @@ int kvm_arch_vm_ioctl_check_extension(struct kvm *kvm, long ext) | |||
| 105 | * This function finds the right table above and sets the registers on | 106 | * This function finds the right table above and sets the registers on |
| 106 | * the virtual CPU struct to their architecturally defined reset | 107 | * the virtual CPU struct to their architecturally defined reset |
| 107 | * values. | 108 | * values. |
| 109 | * | ||
| 110 | * Note: This function can be called from two paths: The KVM_ARM_VCPU_INIT | ||
| 111 | * ioctl or as part of handling a request issued by another VCPU in the PSCI | ||
| 112 | * handling code. In the first case, the VCPU will not be loaded, and in the | ||
| 113 | * second case the VCPU will be loaded. Because this function operates purely | ||
| 114 | * on the memory-backed valus of system registers, we want to do a full put if | ||
| 115 | * we were loaded (handling a request) and load the values back at the end of | ||
| 116 | * the function. Otherwise we leave the state alone. In both cases, we | ||
| 117 | * disable preemption around the vcpu reset as we would otherwise race with | ||
| 118 | * preempt notifiers which also call put/load. | ||
| 108 | */ | 119 | */ |
| 109 | int kvm_reset_vcpu(struct kvm_vcpu *vcpu) | 120 | int kvm_reset_vcpu(struct kvm_vcpu *vcpu) |
| 110 | { | 121 | { |
| 111 | const struct kvm_regs *cpu_reset; | 122 | const struct kvm_regs *cpu_reset; |
| 123 | int ret = -EINVAL; | ||
| 124 | bool loaded; | ||
| 125 | |||
| 126 | preempt_disable(); | ||
| 127 | loaded = (vcpu->cpu != -1); | ||
| 128 | if (loaded) | ||
| 129 | kvm_arch_vcpu_put(vcpu); | ||
| 112 | 130 | ||
| 113 | switch (vcpu->arch.target) { | 131 | switch (vcpu->arch.target) { |
| 114 | default: | 132 | default: |
| 115 | if (test_bit(KVM_ARM_VCPU_EL1_32BIT, vcpu->arch.features)) { | 133 | if (test_bit(KVM_ARM_VCPU_EL1_32BIT, vcpu->arch.features)) { |
| 116 | if (!cpu_has_32bit_el1()) | 134 | if (!cpu_has_32bit_el1()) |
| 117 | return -EINVAL; | 135 | goto out; |
| 118 | cpu_reset = &default_regs_reset32; | 136 | cpu_reset = &default_regs_reset32; |
| 119 | } else { | 137 | } else { |
| 120 | cpu_reset = &default_regs_reset; | 138 | cpu_reset = &default_regs_reset; |
| @@ -129,6 +147,29 @@ int kvm_reset_vcpu(struct kvm_vcpu *vcpu) | |||
| 129 | /* Reset system registers */ | 147 | /* Reset system registers */ |
| 130 | kvm_reset_sys_regs(vcpu); | 148 | kvm_reset_sys_regs(vcpu); |
| 131 | 149 | ||
| 150 | /* | ||
| 151 | * Additional reset state handling that PSCI may have imposed on us. | ||
| 152 | * Must be done after all the sys_reg reset. | ||
| 153 | */ | ||
| 154 | if (vcpu->arch.reset_state.reset) { | ||
| 155 | unsigned long target_pc = vcpu->arch.reset_state.pc; | ||
| 156 | |||
| 157 | /* Gracefully handle Thumb2 entry point */ | ||
| 158 | if (vcpu_mode_is_32bit(vcpu) && (target_pc & 1)) { | ||
| 159 | target_pc &= ~1UL; | ||
| 160 | vcpu_set_thumb(vcpu); | ||
| 161 | } | ||
| 162 | |||
| 163 | /* Propagate caller endianness */ | ||
| 164 | if (vcpu->arch.reset_state.be) | ||
| 165 | kvm_vcpu_set_be(vcpu); | ||
| 166 | |||
| 167 | *vcpu_pc(vcpu) = target_pc; | ||
| 168 | vcpu_set_reg(vcpu, 0, vcpu->arch.reset_state.r0); | ||
| 169 | |||
| 170 | vcpu->arch.reset_state.reset = false; | ||
| 171 | } | ||
| 172 | |||
| 132 | /* Reset PMU */ | 173 | /* Reset PMU */ |
| 133 | kvm_pmu_vcpu_reset(vcpu); | 174 | kvm_pmu_vcpu_reset(vcpu); |
| 134 | 175 | ||
| @@ -137,7 +178,12 @@ int kvm_reset_vcpu(struct kvm_vcpu *vcpu) | |||
| 137 | vcpu->arch.workaround_flags |= VCPU_WORKAROUND_2_FLAG; | 178 | vcpu->arch.workaround_flags |= VCPU_WORKAROUND_2_FLAG; |
| 138 | 179 | ||
| 139 | /* Reset timer */ | 180 | /* Reset timer */ |
| 140 | return kvm_timer_vcpu_reset(vcpu); | 181 | ret = kvm_timer_vcpu_reset(vcpu); |
| 182 | out: | ||
| 183 | if (loaded) | ||
| 184 | kvm_arch_vcpu_load(vcpu, smp_processor_id()); | ||
| 185 | preempt_enable(); | ||
| 186 | return ret; | ||
| 141 | } | 187 | } |
| 142 | 188 | ||
| 143 | void kvm_set_ipa_limit(void) | 189 | void kvm_set_ipa_limit(void) |
diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c index e3e37228ae4e..c936aa40c3f4 100644 --- a/arch/arm64/kvm/sys_regs.c +++ b/arch/arm64/kvm/sys_regs.c | |||
| @@ -314,12 +314,29 @@ static bool trap_raz_wi(struct kvm_vcpu *vcpu, | |||
| 314 | return read_zero(vcpu, p); | 314 | return read_zero(vcpu, p); |
| 315 | } | 315 | } |
| 316 | 316 | ||
| 317 | static bool trap_undef(struct kvm_vcpu *vcpu, | 317 | /* |
| 318 | struct sys_reg_params *p, | 318 | * ARMv8.1 mandates at least a trivial LORegion implementation, where all the |
| 319 | const struct sys_reg_desc *r) | 319 | * RW registers are RES0 (which we can implement as RAZ/WI). On an ARMv8.0 |
| 320 | * system, these registers should UNDEF. LORID_EL1 being a RO register, we | ||
| 321 | * treat it separately. | ||
| 322 | */ | ||
| 323 | static bool trap_loregion(struct kvm_vcpu *vcpu, | ||
| 324 | struct sys_reg_params *p, | ||
| 325 | const struct sys_reg_desc *r) | ||
| 320 | { | 326 | { |
| 321 | kvm_inject_undefined(vcpu); | 327 | u64 val = read_sanitised_ftr_reg(SYS_ID_AA64MMFR1_EL1); |
| 322 | return false; | 328 | u32 sr = sys_reg((u32)r->Op0, (u32)r->Op1, |
| 329 | (u32)r->CRn, (u32)r->CRm, (u32)r->Op2); | ||
| 330 | |||
| 331 | if (!(val & (0xfUL << ID_AA64MMFR1_LOR_SHIFT))) { | ||
| 332 | kvm_inject_undefined(vcpu); | ||
| 333 | return false; | ||
| 334 | } | ||
| 335 | |||
| 336 | if (p->is_write && sr == SYS_LORID_EL1) | ||
| 337 | return write_to_read_only(vcpu, p, r); | ||
| 338 | |||
| 339 | return trap_raz_wi(vcpu, p, r); | ||
| 323 | } | 340 | } |
| 324 | 341 | ||
| 325 | static bool trap_oslsr_el1(struct kvm_vcpu *vcpu, | 342 | static bool trap_oslsr_el1(struct kvm_vcpu *vcpu, |
| @@ -1048,11 +1065,6 @@ static u64 read_id_reg(struct sys_reg_desc const *r, bool raz) | |||
| 1048 | if (val & ptrauth_mask) | 1065 | if (val & ptrauth_mask) |
| 1049 | kvm_debug("ptrauth unsupported for guests, suppressing\n"); | 1066 | kvm_debug("ptrauth unsupported for guests, suppressing\n"); |
| 1050 | val &= ~ptrauth_mask; | 1067 | val &= ~ptrauth_mask; |
| 1051 | } else if (id == SYS_ID_AA64MMFR1_EL1) { | ||
| 1052 | if (val & (0xfUL << ID_AA64MMFR1_LOR_SHIFT)) | ||
| 1053 | kvm_debug("LORegions unsupported for guests, suppressing\n"); | ||
| 1054 | |||
| 1055 | val &= ~(0xfUL << ID_AA64MMFR1_LOR_SHIFT); | ||
| 1056 | } | 1068 | } |
| 1057 | 1069 | ||
| 1058 | return val; | 1070 | return val; |
| @@ -1338,11 +1350,11 @@ static const struct sys_reg_desc sys_reg_descs[] = { | |||
| 1338 | { SYS_DESC(SYS_MAIR_EL1), access_vm_reg, reset_unknown, MAIR_EL1 }, | 1350 | { SYS_DESC(SYS_MAIR_EL1), access_vm_reg, reset_unknown, MAIR_EL1 }, |
| 1339 | { SYS_DESC(SYS_AMAIR_EL1), access_vm_reg, reset_amair_el1, AMAIR_EL1 }, | 1351 | { SYS_DESC(SYS_AMAIR_EL1), access_vm_reg, reset_amair_el1, AMAIR_EL1 }, |
| 1340 | 1352 | ||
| 1341 | { SYS_DESC(SYS_LORSA_EL1), trap_undef }, | 1353 | { SYS_DESC(SYS_LORSA_EL1), trap_loregion }, |
| 1342 | { SYS_DESC(SYS_LOREA_EL1), trap_undef }, | 1354 | { SYS_DESC(SYS_LOREA_EL1), trap_loregion }, |
| 1343 | { SYS_DESC(SYS_LORN_EL1), trap_undef }, | 1355 | { SYS_DESC(SYS_LORN_EL1), trap_loregion }, |
| 1344 | { SYS_DESC(SYS_LORC_EL1), trap_undef }, | 1356 | { SYS_DESC(SYS_LORC_EL1), trap_loregion }, |
| 1345 | { SYS_DESC(SYS_LORID_EL1), trap_undef }, | 1357 | { SYS_DESC(SYS_LORID_EL1), trap_loregion }, |
| 1346 | 1358 | ||
| 1347 | { SYS_DESC(SYS_VBAR_EL1), NULL, reset_val, VBAR_EL1, 0 }, | 1359 | { SYS_DESC(SYS_VBAR_EL1), NULL, reset_val, VBAR_EL1, 0 }, |
| 1348 | { SYS_DESC(SYS_DISR_EL1), NULL, reset_val, DISR_EL1, 0 }, | 1360 | { SYS_DESC(SYS_DISR_EL1), NULL, reset_val, DISR_EL1, 0 }, |
| @@ -2596,7 +2608,9 @@ void kvm_reset_sys_regs(struct kvm_vcpu *vcpu) | |||
| 2596 | table = get_target_table(vcpu->arch.target, true, &num); | 2608 | table = get_target_table(vcpu->arch.target, true, &num); |
| 2597 | reset_sys_reg_descs(vcpu, table, num); | 2609 | reset_sys_reg_descs(vcpu, table, num); |
| 2598 | 2610 | ||
| 2599 | for (num = 1; num < NR_SYS_REGS; num++) | 2611 | for (num = 1; num < NR_SYS_REGS; num++) { |
| 2600 | if (__vcpu_sys_reg(vcpu, num) == 0x4242424242424242) | 2612 | if (WARN(__vcpu_sys_reg(vcpu, num) == 0x4242424242424242, |
| 2601 | panic("Didn't reset __vcpu_sys_reg(%zi)", num); | 2613 | "Didn't reset __vcpu_sys_reg(%zi)\n", num)) |
| 2614 | break; | ||
| 2615 | } | ||
| 2602 | } | 2616 | } |
diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c index fb0908456a1f..78c0a72f822c 100644 --- a/arch/arm64/mm/dma-mapping.c +++ b/arch/arm64/mm/dma-mapping.c | |||
| @@ -466,9 +466,7 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, | |||
| 466 | __iommu_setup_dma_ops(dev, dma_base, size, iommu); | 466 | __iommu_setup_dma_ops(dev, dma_base, size, iommu); |
| 467 | 467 | ||
| 468 | #ifdef CONFIG_XEN | 468 | #ifdef CONFIG_XEN |
| 469 | if (xen_initial_domain()) { | 469 | if (xen_initial_domain()) |
| 470 | dev->archdata.dev_dma_ops = dev->dma_ops; | ||
| 471 | dev->dma_ops = xen_dma_ops; | 470 | dev->dma_ops = xen_dma_ops; |
| 472 | } | ||
| 473 | #endif | 471 | #endif |
| 474 | } | 472 | } |
diff --git a/arch/arm64/mm/dump.c b/arch/arm64/mm/dump.c index fcb1f2a6d7c6..99bb8facb5cb 100644 --- a/arch/arm64/mm/dump.c +++ b/arch/arm64/mm/dump.c | |||
| @@ -286,74 +286,73 @@ static void note_page(struct pg_state *st, unsigned long addr, unsigned level, | |||
| 286 | 286 | ||
| 287 | } | 287 | } |
| 288 | 288 | ||
| 289 | static void walk_pte(struct pg_state *st, pmd_t *pmdp, unsigned long start) | 289 | static void walk_pte(struct pg_state *st, pmd_t *pmdp, unsigned long start, |
| 290 | unsigned long end) | ||
| 290 | { | 291 | { |
| 291 | pte_t *ptep = pte_offset_kernel(pmdp, 0UL); | 292 | unsigned long addr = start; |
| 292 | unsigned long addr; | 293 | pte_t *ptep = pte_offset_kernel(pmdp, start); |
| 293 | unsigned i; | ||
| 294 | 294 | ||
| 295 | for (i = 0; i < PTRS_PER_PTE; i++, ptep++) { | 295 | do { |
| 296 | addr = start + i * PAGE_SIZE; | ||
| 297 | note_page(st, addr, 4, READ_ONCE(pte_val(*ptep))); | 296 | note_page(st, addr, 4, READ_ONCE(pte_val(*ptep))); |
| 298 | } | 297 | } while (ptep++, addr += PAGE_SIZE, addr != end); |
| 299 | } | 298 | } |
| 300 | 299 | ||
| 301 | static void walk_pmd(struct pg_state *st, pud_t *pudp, unsigned long start) | 300 | static void walk_pmd(struct pg_state *st, pud_t *pudp, unsigned long start, |
| 301 | unsigned long end) | ||
| 302 | { | 302 | { |
| 303 | pmd_t *pmdp = pmd_offset(pudp, 0UL); | 303 | unsigned long next, addr = start; |
| 304 | unsigned long addr; | 304 | pmd_t *pmdp = pmd_offset(pudp, start); |
| 305 | unsigned i; | ||
| 306 | 305 | ||
| 307 | for (i = 0; i < PTRS_PER_PMD; i++, pmdp++) { | 306 | do { |
| 308 | pmd_t pmd = READ_ONCE(*pmdp); | 307 | pmd_t pmd = READ_ONCE(*pmdp); |
| 308 | next = pmd_addr_end(addr, end); | ||
| 309 | 309 | ||
| 310 | addr = start + i * PMD_SIZE; | ||
| 311 | if (pmd_none(pmd) || pmd_sect(pmd)) { | 310 | if (pmd_none(pmd) || pmd_sect(pmd)) { |
| 312 | note_page(st, addr, 3, pmd_val(pmd)); | 311 | note_page(st, addr, 3, pmd_val(pmd)); |
| 313 | } else { | 312 | } else { |
| 314 | BUG_ON(pmd_bad(pmd)); | 313 | BUG_ON(pmd_bad(pmd)); |
| 315 | walk_pte(st, pmdp, addr); | 314 | walk_pte(st, pmdp, addr, next); |
| 316 | } | 315 | } |
| 317 | } | 316 | } while (pmdp++, addr = next, addr != end); |
| 318 | } | 317 | } |
| 319 | 318 | ||
| 320 | static void walk_pud(struct pg_state *st, pgd_t *pgdp, unsigned long start) | 319 | static void walk_pud(struct pg_state *st, pgd_t *pgdp, unsigned long start, |
| 320 | unsigned long end) | ||
| 321 | { | 321 | { |
| 322 | pud_t *pudp = pud_offset(pgdp, 0UL); | 322 | unsigned long next, addr = start; |
| 323 | unsigned long addr; | 323 | pud_t *pudp = pud_offset(pgdp, start); |
| 324 | unsigned i; | ||
| 325 | 324 | ||
| 326 | for (i = 0; i < PTRS_PER_PUD; i++, pudp++) { | 325 | do { |
| 327 | pud_t pud = READ_ONCE(*pudp); | 326 | pud_t pud = READ_ONCE(*pudp); |
| 327 | next = pud_addr_end(addr, end); | ||
| 328 | 328 | ||
| 329 | addr = start + i * PUD_SIZE; | ||
| 330 | if (pud_none(pud) || pud_sect(pud)) { | 329 | if (pud_none(pud) || pud_sect(pud)) { |
| 331 | note_page(st, addr, 2, pud_val(pud)); | 330 | note_page(st, addr, 2, pud_val(pud)); |
| 332 | } else { | 331 | } else { |
| 333 | BUG_ON(pud_bad(pud)); | 332 | BUG_ON(pud_bad(pud)); |
| 334 | walk_pmd(st, pudp, addr); | 333 | walk_pmd(st, pudp, addr, next); |
| 335 | } | 334 | } |
| 336 | } | 335 | } while (pudp++, addr = next, addr != end); |
| 337 | } | 336 | } |
| 338 | 337 | ||
| 339 | static void walk_pgd(struct pg_state *st, struct mm_struct *mm, | 338 | static void walk_pgd(struct pg_state *st, struct mm_struct *mm, |
| 340 | unsigned long start) | 339 | unsigned long start) |
| 341 | { | 340 | { |
| 342 | pgd_t *pgdp = pgd_offset(mm, 0UL); | 341 | unsigned long end = (start < TASK_SIZE_64) ? TASK_SIZE_64 : 0; |
| 343 | unsigned i; | 342 | unsigned long next, addr = start; |
| 344 | unsigned long addr; | 343 | pgd_t *pgdp = pgd_offset(mm, start); |
| 345 | 344 | ||
| 346 | for (i = 0; i < PTRS_PER_PGD; i++, pgdp++) { | 345 | do { |
| 347 | pgd_t pgd = READ_ONCE(*pgdp); | 346 | pgd_t pgd = READ_ONCE(*pgdp); |
| 347 | next = pgd_addr_end(addr, end); | ||
| 348 | 348 | ||
| 349 | addr = start + i * PGDIR_SIZE; | ||
| 350 | if (pgd_none(pgd)) { | 349 | if (pgd_none(pgd)) { |
| 351 | note_page(st, addr, 1, pgd_val(pgd)); | 350 | note_page(st, addr, 1, pgd_val(pgd)); |
| 352 | } else { | 351 | } else { |
| 353 | BUG_ON(pgd_bad(pgd)); | 352 | BUG_ON(pgd_bad(pgd)); |
| 354 | walk_pud(st, pgdp, addr); | 353 | walk_pud(st, pgdp, addr, next); |
| 355 | } | 354 | } |
| 356 | } | 355 | } while (pgdp++, addr = next, addr != end); |
| 357 | } | 356 | } |
| 358 | 357 | ||
| 359 | void ptdump_walk_pgd(struct seq_file *m, struct ptdump_info *info) | 358 | void ptdump_walk_pgd(struct seq_file *m, struct ptdump_info *info) |
diff --git a/arch/arm64/mm/flush.c b/arch/arm64/mm/flush.c index 30695a868107..5c9073bace83 100644 --- a/arch/arm64/mm/flush.c +++ b/arch/arm64/mm/flush.c | |||
| @@ -33,7 +33,11 @@ void sync_icache_aliases(void *kaddr, unsigned long len) | |||
| 33 | __clean_dcache_area_pou(kaddr, len); | 33 | __clean_dcache_area_pou(kaddr, len); |
| 34 | __flush_icache_all(); | 34 | __flush_icache_all(); |
| 35 | } else { | 35 | } else { |
| 36 | flush_icache_range(addr, addr + len); | 36 | /* |
| 37 | * Don't issue kick_all_cpus_sync() after I-cache invalidation | ||
| 38 | * for user mappings. | ||
| 39 | */ | ||
| 40 | __flush_icache_range(addr, addr + len); | ||
| 37 | } | 41 | } |
| 38 | } | 42 | } |
| 39 | 43 | ||
diff --git a/arch/arm64/mm/kasan_init.c b/arch/arm64/mm/kasan_init.c index 4b55b15707a3..f37a86d2a69d 100644 --- a/arch/arm64/mm/kasan_init.c +++ b/arch/arm64/mm/kasan_init.c | |||
| @@ -252,8 +252,6 @@ void __init kasan_init(void) | |||
| 252 | memset(kasan_early_shadow_page, KASAN_SHADOW_INIT, PAGE_SIZE); | 252 | memset(kasan_early_shadow_page, KASAN_SHADOW_INIT, PAGE_SIZE); |
| 253 | cpu_replace_ttbr1(lm_alias(swapper_pg_dir)); | 253 | cpu_replace_ttbr1(lm_alias(swapper_pg_dir)); |
| 254 | 254 | ||
| 255 | kasan_init_tags(); | ||
| 256 | |||
| 257 | /* At this point kasan is fully initialized. Enable error messages */ | 255 | /* At this point kasan is fully initialized. Enable error messages */ |
| 258 | init_task.kasan_depth = 0; | 256 | init_task.kasan_depth = 0; |
| 259 | pr_info("KernelAddressSanitizer initialized\n"); | 257 | pr_info("KernelAddressSanitizer initialized\n"); |
diff --git a/arch/c6x/include/asm/Kbuild b/arch/c6x/include/asm/Kbuild index 33a2c94fed0d..63b4a1705182 100644 --- a/arch/c6x/include/asm/Kbuild +++ b/arch/c6x/include/asm/Kbuild | |||
| @@ -30,6 +30,7 @@ generic-y += pgalloc.h | |||
| 30 | generic-y += preempt.h | 30 | generic-y += preempt.h |
| 31 | generic-y += segment.h | 31 | generic-y += segment.h |
| 32 | generic-y += serial.h | 32 | generic-y += serial.h |
| 33 | generic-y += shmparam.h | ||
| 33 | generic-y += tlbflush.h | 34 | generic-y += tlbflush.h |
| 34 | generic-y += topology.h | 35 | generic-y += topology.h |
| 35 | generic-y += trace_clock.h | 36 | generic-y += trace_clock.h |
diff --git a/arch/csky/include/asm/io.h b/arch/csky/include/asm/io.h index ecae6b358f95..c1dfa9c10e36 100644 --- a/arch/csky/include/asm/io.h +++ b/arch/csky/include/asm/io.h | |||
| @@ -15,6 +15,31 @@ extern void iounmap(void *addr); | |||
| 15 | extern int remap_area_pages(unsigned long address, phys_addr_t phys_addr, | 15 | extern int remap_area_pages(unsigned long address, phys_addr_t phys_addr, |
| 16 | size_t size, unsigned long flags); | 16 | size_t size, unsigned long flags); |
| 17 | 17 | ||
| 18 | /* | ||
| 19 | * I/O memory access primitives. Reads are ordered relative to any | ||
| 20 | * following Normal memory access. Writes are ordered relative to any prior | ||
| 21 | * Normal memory access. | ||
| 22 | * | ||
| 23 | * For CACHEV1 (807, 810), store instruction could fast retire, so we need | ||
| 24 | * another mb() to prevent st fast retire. | ||
| 25 | * | ||
| 26 | * For CACHEV2 (860), store instruction with PAGE_ATTR_NO_BUFFERABLE won't | ||
| 27 | * fast retire. | ||
| 28 | */ | ||
| 29 | #define readb(c) ({ u8 __v = readb_relaxed(c); rmb(); __v; }) | ||
| 30 | #define readw(c) ({ u16 __v = readw_relaxed(c); rmb(); __v; }) | ||
| 31 | #define readl(c) ({ u32 __v = readl_relaxed(c); rmb(); __v; }) | ||
| 32 | |||
| 33 | #ifdef CONFIG_CPU_HAS_CACHEV2 | ||
| 34 | #define writeb(v,c) ({ wmb(); writeb_relaxed((v),(c)); }) | ||
| 35 | #define writew(v,c) ({ wmb(); writew_relaxed((v),(c)); }) | ||
| 36 | #define writel(v,c) ({ wmb(); writel_relaxed((v),(c)); }) | ||
| 37 | #else | ||
| 38 | #define writeb(v,c) ({ wmb(); writeb_relaxed((v),(c)); mb(); }) | ||
| 39 | #define writew(v,c) ({ wmb(); writew_relaxed((v),(c)); mb(); }) | ||
| 40 | #define writel(v,c) ({ wmb(); writel_relaxed((v),(c)); mb(); }) | ||
| 41 | #endif | ||
| 42 | |||
| 18 | #define ioremap_nocache(phy, sz) ioremap(phy, sz) | 43 | #define ioremap_nocache(phy, sz) ioremap(phy, sz) |
| 19 | #define ioremap_wc ioremap_nocache | 44 | #define ioremap_wc ioremap_nocache |
| 20 | #define ioremap_wt ioremap_nocache | 45 | #define ioremap_wt ioremap_nocache |
diff --git a/arch/csky/include/asm/pgalloc.h b/arch/csky/include/asm/pgalloc.h index bf4f4a0e140e..d213bb47b717 100644 --- a/arch/csky/include/asm/pgalloc.h +++ b/arch/csky/include/asm/pgalloc.h | |||
| @@ -24,41 +24,34 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, | |||
| 24 | 24 | ||
| 25 | extern void pgd_init(unsigned long *p); | 25 | extern void pgd_init(unsigned long *p); |
| 26 | 26 | ||
| 27 | static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, | 27 | static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm) |
| 28 | unsigned long address) | ||
| 29 | { | 28 | { |
| 30 | pte_t *pte; | 29 | pte_t *pte; |
| 31 | unsigned long *kaddr, i; | 30 | unsigned long i; |
| 32 | 31 | ||
| 33 | pte = (pte_t *) __get_free_pages(GFP_KERNEL | __GFP_RETRY_MAYFAIL, | 32 | pte = (pte_t *) __get_free_page(GFP_KERNEL); |
| 34 | PTE_ORDER); | 33 | if (!pte) |
| 35 | kaddr = (unsigned long *)pte; | 34 | return NULL; |
| 36 | if (address & 0x80000000) | 35 | |
| 37 | for (i = 0; i < (PAGE_SIZE/4); i++) | 36 | for (i = 0; i < PAGE_SIZE/sizeof(pte_t); i++) |
| 38 | *(kaddr + i) = 0x1; | 37 | (pte + i)->pte_low = _PAGE_GLOBAL; |
| 39 | else | ||
| 40 | clear_page(kaddr); | ||
| 41 | 38 | ||
| 42 | return pte; | 39 | return pte; |
| 43 | } | 40 | } |
| 44 | 41 | ||
| 45 | static inline struct page *pte_alloc_one(struct mm_struct *mm, | 42 | static inline struct page *pte_alloc_one(struct mm_struct *mm) |
| 46 | unsigned long address) | ||
| 47 | { | 43 | { |
| 48 | struct page *pte; | 44 | struct page *pte; |
| 49 | unsigned long *kaddr, i; | 45 | |
| 50 | 46 | pte = alloc_pages(GFP_KERNEL | __GFP_ZERO, 0); | |
| 51 | pte = alloc_pages(GFP_KERNEL | __GFP_RETRY_MAYFAIL, PTE_ORDER); | 47 | if (!pte) |
| 52 | if (pte) { | 48 | return NULL; |
| 53 | kaddr = kmap_atomic(pte); | 49 | |
| 54 | if (address & 0x80000000) { | 50 | if (!pgtable_page_ctor(pte)) { |
| 55 | for (i = 0; i < (PAGE_SIZE/4); i++) | 51 | __free_page(pte); |
| 56 | *(kaddr + i) = 0x1; | 52 | return NULL; |
| 57 | } else | ||
| 58 | clear_page(kaddr); | ||
| 59 | kunmap_atomic(kaddr); | ||
| 60 | pgtable_page_ctor(pte); | ||
| 61 | } | 53 | } |
| 54 | |||
| 62 | return pte; | 55 | return pte; |
| 63 | } | 56 | } |
| 64 | 57 | ||
diff --git a/arch/csky/include/asm/pgtable.h b/arch/csky/include/asm/pgtable.h index edfcbb25fd9f..dcea277c09ae 100644 --- a/arch/csky/include/asm/pgtable.h +++ b/arch/csky/include/asm/pgtable.h | |||
| @@ -45,8 +45,8 @@ | |||
| 45 | ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset_t(address)) | 45 | ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset_t(address)) |
| 46 | #define pmd_page(pmd) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT)) | 46 | #define pmd_page(pmd) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT)) |
| 47 | #define pte_clear(mm, addr, ptep) set_pte((ptep), \ | 47 | #define pte_clear(mm, addr, ptep) set_pte((ptep), \ |
| 48 | (((unsigned int)addr&0x80000000)?__pte(1):__pte(0))) | 48 | (((unsigned int) addr & PAGE_OFFSET) ? __pte(_PAGE_GLOBAL) : __pte(0))) |
| 49 | #define pte_none(pte) (!(pte_val(pte)&0xfffffffe)) | 49 | #define pte_none(pte) (!(pte_val(pte) & ~_PAGE_GLOBAL)) |
| 50 | #define pte_present(pte) (pte_val(pte) & _PAGE_PRESENT) | 50 | #define pte_present(pte) (pte_val(pte) & _PAGE_PRESENT) |
| 51 | #define pte_pfn(x) ((unsigned long)((x).pte_low >> PAGE_SHIFT)) | 51 | #define pte_pfn(x) ((unsigned long)((x).pte_low >> PAGE_SHIFT)) |
| 52 | #define pfn_pte(pfn, prot) __pte(((unsigned long long)(pfn) << PAGE_SHIFT) \ | 52 | #define pfn_pte(pfn, prot) __pte(((unsigned long long)(pfn) << PAGE_SHIFT) \ |
| @@ -241,6 +241,11 @@ static inline pte_t pte_mkyoung(pte_t pte) | |||
| 241 | 241 | ||
| 242 | #define pgd_index(address) ((address) >> PGDIR_SHIFT) | 242 | #define pgd_index(address) ((address) >> PGDIR_SHIFT) |
| 243 | 243 | ||
| 244 | #define __HAVE_PHYS_MEM_ACCESS_PROT | ||
| 245 | struct file; | ||
| 246 | extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn, | ||
| 247 | unsigned long size, pgprot_t vma_prot); | ||
| 248 | |||
| 244 | /* | 249 | /* |
| 245 | * Macro to make mark a page protection value as "uncacheable". Note | 250 | * Macro to make mark a page protection value as "uncacheable". Note |
| 246 | * that "protection" is really a misnomer here as the protection value | 251 | * that "protection" is really a misnomer here as the protection value |
diff --git a/arch/csky/include/asm/processor.h b/arch/csky/include/asm/processor.h index 8f454810514f..21e0bd5293dd 100644 --- a/arch/csky/include/asm/processor.h +++ b/arch/csky/include/asm/processor.h | |||
| @@ -49,7 +49,7 @@ struct thread_struct { | |||
| 49 | }; | 49 | }; |
| 50 | 50 | ||
| 51 | #define INIT_THREAD { \ | 51 | #define INIT_THREAD { \ |
| 52 | .ksp = (unsigned long) init_thread_union.stack + THREAD_SIZE, \ | 52 | .ksp = sizeof(init_stack) + (unsigned long) &init_stack, \ |
| 53 | .sr = DEFAULT_PSR_VALUE, \ | 53 | .sr = DEFAULT_PSR_VALUE, \ |
| 54 | } | 54 | } |
| 55 | 55 | ||
| @@ -95,7 +95,7 @@ unsigned long get_wchan(struct task_struct *p); | |||
| 95 | #define KSTK_ESP(tsk) (task_pt_regs(tsk)->usp) | 95 | #define KSTK_ESP(tsk) (task_pt_regs(tsk)->usp) |
| 96 | 96 | ||
| 97 | #define task_pt_regs(p) \ | 97 | #define task_pt_regs(p) \ |
| 98 | ((struct pt_regs *)(THREAD_SIZE + p->stack) - 1) | 98 | ((struct pt_regs *)(THREAD_SIZE + task_stack_page(p)) - 1) |
| 99 | 99 | ||
| 100 | #define cpu_relax() barrier() | 100 | #define cpu_relax() barrier() |
| 101 | 101 | ||
diff --git a/arch/csky/kernel/dumpstack.c b/arch/csky/kernel/dumpstack.c index 659253e9989c..d67f9777cfd9 100644 --- a/arch/csky/kernel/dumpstack.c +++ b/arch/csky/kernel/dumpstack.c | |||
| @@ -38,7 +38,11 @@ void show_stack(struct task_struct *task, unsigned long *stack) | |||
| 38 | if (task) | 38 | if (task) |
| 39 | stack = (unsigned long *)thread_saved_fp(task); | 39 | stack = (unsigned long *)thread_saved_fp(task); |
| 40 | else | 40 | else |
| 41 | #ifdef CONFIG_STACKTRACE | ||
| 42 | asm volatile("mov %0, r8\n":"=r"(stack)::"memory"); | ||
| 43 | #else | ||
| 41 | stack = (unsigned long *)&stack; | 44 | stack = (unsigned long *)&stack; |
| 45 | #endif | ||
| 42 | } | 46 | } |
| 43 | 47 | ||
| 44 | show_trace(stack); | 48 | show_trace(stack); |
diff --git a/arch/csky/kernel/module.c b/arch/csky/kernel/module.c index 65abab0c7a47..b5ad7d9de18c 100644 --- a/arch/csky/kernel/module.c +++ b/arch/csky/kernel/module.c | |||
| @@ -12,7 +12,7 @@ | |||
| 12 | #include <linux/spinlock.h> | 12 | #include <linux/spinlock.h> |
| 13 | #include <asm/pgtable.h> | 13 | #include <asm/pgtable.h> |
| 14 | 14 | ||
| 15 | #if defined(__CSKYABIV2__) | 15 | #ifdef CONFIG_CPU_CK810 |
| 16 | #define IS_BSR32(hi16, lo16) (((hi16) & 0xFC00) == 0xE000) | 16 | #define IS_BSR32(hi16, lo16) (((hi16) & 0xFC00) == 0xE000) |
| 17 | #define IS_JSRI32(hi16, lo16) ((hi16) == 0xEAE0) | 17 | #define IS_JSRI32(hi16, lo16) ((hi16) == 0xEAE0) |
| 18 | 18 | ||
| @@ -25,6 +25,26 @@ | |||
| 25 | *(uint16_t *)(addr) = 0xE8Fa; \ | 25 | *(uint16_t *)(addr) = 0xE8Fa; \ |
| 26 | *((uint16_t *)(addr) + 1) = 0x0000; \ | 26 | *((uint16_t *)(addr) + 1) = 0x0000; \ |
| 27 | } while (0) | 27 | } while (0) |
| 28 | |||
| 29 | static void jsri_2_lrw_jsr(uint32_t *location) | ||
| 30 | { | ||
| 31 | uint16_t *location_tmp = (uint16_t *)location; | ||
| 32 | |||
| 33 | if (IS_BSR32(*location_tmp, *(location_tmp + 1))) | ||
| 34 | return; | ||
| 35 | |||
| 36 | if (IS_JSRI32(*location_tmp, *(location_tmp + 1))) { | ||
| 37 | /* jsri 0x... --> lrw r26, 0x... */ | ||
| 38 | CHANGE_JSRI_TO_LRW(location); | ||
| 39 | /* lsli r0, r0 --> jsr r26 */ | ||
| 40 | SET_JSR32_R26(location + 1); | ||
| 41 | } | ||
| 42 | } | ||
| 43 | #else | ||
| 44 | static void inline jsri_2_lrw_jsr(uint32_t *location) | ||
| 45 | { | ||
| 46 | return; | ||
| 47 | } | ||
| 28 | #endif | 48 | #endif |
| 29 | 49 | ||
| 30 | int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab, | 50 | int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab, |
| @@ -35,9 +55,6 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab, | |||
| 35 | Elf32_Sym *sym; | 55 | Elf32_Sym *sym; |
| 36 | uint32_t *location; | 56 | uint32_t *location; |
| 37 | short *temp; | 57 | short *temp; |
| 38 | #if defined(__CSKYABIV2__) | ||
| 39 | uint16_t *location_tmp; | ||
| 40 | #endif | ||
| 41 | 58 | ||
| 42 | for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { | 59 | for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { |
| 43 | /* This is where to make the change */ | 60 | /* This is where to make the change */ |
| @@ -59,18 +76,7 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab, | |||
| 59 | case R_CSKY_PCRELJSR_IMM11BY2: | 76 | case R_CSKY_PCRELJSR_IMM11BY2: |
| 60 | break; | 77 | break; |
| 61 | case R_CSKY_PCRELJSR_IMM26BY2: | 78 | case R_CSKY_PCRELJSR_IMM26BY2: |
| 62 | #if defined(__CSKYABIV2__) | 79 | jsri_2_lrw_jsr(location); |
| 63 | location_tmp = (uint16_t *)location; | ||
| 64 | if (IS_BSR32(*location_tmp, *(location_tmp + 1))) | ||
| 65 | break; | ||
| 66 | |||
| 67 | if (IS_JSRI32(*location_tmp, *(location_tmp + 1))) { | ||
| 68 | /* jsri 0x... --> lrw r26, 0x... */ | ||
| 69 | CHANGE_JSRI_TO_LRW(location); | ||
| 70 | /* lsli r0, r0 --> jsr r26 */ | ||
| 71 | SET_JSR32_R26(location + 1); | ||
| 72 | } | ||
| 73 | #endif | ||
| 74 | break; | 80 | break; |
| 75 | case R_CSKY_ADDR_HI16: | 81 | case R_CSKY_ADDR_HI16: |
| 76 | temp = ((short *)location) + 1; | 82 | temp = ((short *)location) + 1; |
diff --git a/arch/csky/kernel/ptrace.c b/arch/csky/kernel/ptrace.c index 57f1afe19a52..f2f12fff36f7 100644 --- a/arch/csky/kernel/ptrace.c +++ b/arch/csky/kernel/ptrace.c | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | #include <linux/ptrace.h> | 8 | #include <linux/ptrace.h> |
| 9 | #include <linux/regset.h> | 9 | #include <linux/regset.h> |
| 10 | #include <linux/sched.h> | 10 | #include <linux/sched.h> |
| 11 | #include <linux/sched/task_stack.h> | ||
| 11 | #include <linux/signal.h> | 12 | #include <linux/signal.h> |
| 12 | #include <linux/smp.h> | 13 | #include <linux/smp.h> |
| 13 | #include <linux/uaccess.h> | 14 | #include <linux/uaccess.h> |
| @@ -159,7 +160,7 @@ static int fpr_set(struct task_struct *target, | |||
| 159 | static const struct user_regset csky_regsets[] = { | 160 | static const struct user_regset csky_regsets[] = { |
| 160 | [REGSET_GPR] = { | 161 | [REGSET_GPR] = { |
| 161 | .core_note_type = NT_PRSTATUS, | 162 | .core_note_type = NT_PRSTATUS, |
| 162 | .n = ELF_NGREG, | 163 | .n = sizeof(struct pt_regs) / sizeof(u32), |
| 163 | .size = sizeof(u32), | 164 | .size = sizeof(u32), |
| 164 | .align = sizeof(u32), | 165 | .align = sizeof(u32), |
| 165 | .get = &gpr_get, | 166 | .get = &gpr_get, |
diff --git a/arch/csky/kernel/smp.c b/arch/csky/kernel/smp.c index ddc4dd79f282..b07a534b3062 100644 --- a/arch/csky/kernel/smp.c +++ b/arch/csky/kernel/smp.c | |||
| @@ -160,7 +160,8 @@ int __cpu_up(unsigned int cpu, struct task_struct *tidle) | |||
| 160 | { | 160 | { |
| 161 | unsigned long mask = 1 << cpu; | 161 | unsigned long mask = 1 << cpu; |
| 162 | 162 | ||
| 163 | secondary_stack = (unsigned int)tidle->stack + THREAD_SIZE - 8; | 163 | secondary_stack = |
| 164 | (unsigned int) task_stack_page(tidle) + THREAD_SIZE - 8; | ||
| 164 | secondary_hint = mfcr("cr31"); | 165 | secondary_hint = mfcr("cr31"); |
| 165 | secondary_ccr = mfcr("cr18"); | 166 | secondary_ccr = mfcr("cr18"); |
| 166 | 167 | ||
diff --git a/arch/csky/mm/ioremap.c b/arch/csky/mm/ioremap.c index cb7c03e5cd21..8473b6bdf512 100644 --- a/arch/csky/mm/ioremap.c +++ b/arch/csky/mm/ioremap.c | |||
| @@ -46,3 +46,17 @@ void iounmap(void __iomem *addr) | |||
| 46 | vunmap((void *)((unsigned long)addr & PAGE_MASK)); | 46 | vunmap((void *)((unsigned long)addr & PAGE_MASK)); |
| 47 | } | 47 | } |
| 48 | EXPORT_SYMBOL(iounmap); | 48 | EXPORT_SYMBOL(iounmap); |
| 49 | |||
| 50 | pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn, | ||
| 51 | unsigned long size, pgprot_t vma_prot) | ||
| 52 | { | ||
| 53 | if (!pfn_valid(pfn)) { | ||
| 54 | vma_prot.pgprot |= _PAGE_SO; | ||
| 55 | return pgprot_noncached(vma_prot); | ||
| 56 | } else if (file->f_flags & O_SYNC) { | ||
| 57 | return pgprot_noncached(vma_prot); | ||
| 58 | } | ||
| 59 | |||
| 60 | return vma_prot; | ||
| 61 | } | ||
| 62 | EXPORT_SYMBOL(phys_mem_access_prot); | ||
diff --git a/arch/h8300/Makefile b/arch/h8300/Makefile index 4003ddc616e1..f801f3708a89 100644 --- a/arch/h8300/Makefile +++ b/arch/h8300/Makefile | |||
| @@ -37,8 +37,6 @@ libs-y += arch/$(ARCH)/lib/ | |||
| 37 | 37 | ||
| 38 | boot := arch/h8300/boot | 38 | boot := arch/h8300/boot |
| 39 | 39 | ||
| 40 | archmrproper: | ||
| 41 | |||
| 42 | archclean: | 40 | archclean: |
| 43 | $(Q)$(MAKE) $(clean)=$(boot) | 41 | $(Q)$(MAKE) $(clean)=$(boot) |
| 44 | 42 | ||
diff --git a/arch/h8300/include/asm/Kbuild b/arch/h8300/include/asm/Kbuild index cd400d353d18..961c1dc064e1 100644 --- a/arch/h8300/include/asm/Kbuild +++ b/arch/h8300/include/asm/Kbuild | |||
| @@ -40,6 +40,7 @@ generic-y += preempt.h | |||
| 40 | generic-y += scatterlist.h | 40 | generic-y += scatterlist.h |
| 41 | generic-y += sections.h | 41 | generic-y += sections.h |
| 42 | generic-y += serial.h | 42 | generic-y += serial.h |
| 43 | generic-y += shmparam.h | ||
| 43 | generic-y += sizes.h | 44 | generic-y += sizes.h |
| 44 | generic-y += spinlock.h | 45 | generic-y += spinlock.h |
| 45 | generic-y += timex.h | 46 | generic-y += timex.h |
diff --git a/arch/hexagon/include/asm/Kbuild b/arch/hexagon/include/asm/Kbuild index 47c4da3d64a4..b25fd42aa0f4 100644 --- a/arch/hexagon/include/asm/Kbuild +++ b/arch/hexagon/include/asm/Kbuild | |||
| @@ -30,6 +30,7 @@ generic-y += rwsem.h | |||
| 30 | generic-y += sections.h | 30 | generic-y += sections.h |
| 31 | generic-y += segment.h | 31 | generic-y += segment.h |
| 32 | generic-y += serial.h | 32 | generic-y += serial.h |
| 33 | generic-y += shmparam.h | ||
| 33 | generic-y += sizes.h | 34 | generic-y += sizes.h |
| 34 | generic-y += topology.h | 35 | generic-y += topology.h |
| 35 | generic-y += trace_clock.h | 36 | generic-y += trace_clock.h |
diff --git a/arch/ia64/Makefile b/arch/ia64/Makefile index 320d86f192ee..171290f9f1de 100644 --- a/arch/ia64/Makefile +++ b/arch/ia64/Makefile | |||
| @@ -16,8 +16,6 @@ KBUILD_DEFCONFIG := generic_defconfig | |||
| 16 | NM := $(CROSS_COMPILE)nm -B | 16 | NM := $(CROSS_COMPILE)nm -B |
| 17 | READELF := $(CROSS_COMPILE)readelf | 17 | READELF := $(CROSS_COMPILE)readelf |
| 18 | 18 | ||
| 19 | export AWK | ||
| 20 | |||
| 21 | CHECKFLAGS += -D__ia64=1 -D__ia64__=1 -D_LP64 -D__LP64__ | 19 | CHECKFLAGS += -D__ia64=1 -D__ia64__=1 -D_LP64 -D__LP64__ |
| 22 | 20 | ||
| 23 | OBJCOPYFLAGS := --strip-all | 21 | OBJCOPYFLAGS := --strip-all |
diff --git a/arch/m68k/emu/nfblock.c b/arch/m68k/emu/nfblock.c index 38049357d6d3..40712e49381b 100644 --- a/arch/m68k/emu/nfblock.c +++ b/arch/m68k/emu/nfblock.c | |||
| @@ -155,18 +155,22 @@ out: | |||
| 155 | static int __init nfhd_init(void) | 155 | static int __init nfhd_init(void) |
| 156 | { | 156 | { |
| 157 | u32 blocks, bsize; | 157 | u32 blocks, bsize; |
| 158 | int ret; | ||
| 158 | int i; | 159 | int i; |
| 159 | 160 | ||
| 160 | nfhd_id = nf_get_id("XHDI"); | 161 | nfhd_id = nf_get_id("XHDI"); |
| 161 | if (!nfhd_id) | 162 | if (!nfhd_id) |
| 162 | return -ENODEV; | 163 | return -ENODEV; |
| 163 | 164 | ||
| 164 | major_num = register_blkdev(major_num, "nfhd"); | 165 | ret = register_blkdev(major_num, "nfhd"); |
| 165 | if (major_num <= 0) { | 166 | if (ret < 0) { |
| 166 | pr_warn("nfhd: unable to get major number\n"); | 167 | pr_warn("nfhd: unable to get major number\n"); |
| 167 | return major_num; | 168 | return ret; |
| 168 | } | 169 | } |
| 169 | 170 | ||
| 171 | if (!major_num) | ||
| 172 | major_num = ret; | ||
| 173 | |||
| 170 | for (i = NFHD_DEV_OFFSET; i < 24; i++) { | 174 | for (i = NFHD_DEV_OFFSET; i < 24; i++) { |
| 171 | if (nfhd_get_capacity(i, 0, &blocks, &bsize)) | 175 | if (nfhd_get_capacity(i, 0, &blocks, &bsize)) |
| 172 | continue; | 176 | continue; |
diff --git a/arch/m68k/include/asm/Kbuild b/arch/m68k/include/asm/Kbuild index 9f1dd26903e3..95f8f631c4df 100644 --- a/arch/m68k/include/asm/Kbuild +++ b/arch/m68k/include/asm/Kbuild | |||
| @@ -20,6 +20,7 @@ generic-y += mm-arch-hooks.h | |||
| 20 | generic-y += percpu.h | 20 | generic-y += percpu.h |
| 21 | generic-y += preempt.h | 21 | generic-y += preempt.h |
| 22 | generic-y += sections.h | 22 | generic-y += sections.h |
| 23 | generic-y += shmparam.h | ||
| 23 | generic-y += spinlock.h | 24 | generic-y += spinlock.h |
| 24 | generic-y += topology.h | 25 | generic-y += topology.h |
| 25 | generic-y += trace_clock.h | 26 | generic-y += trace_clock.h |
diff --git a/arch/microblaze/include/asm/Kbuild b/arch/microblaze/include/asm/Kbuild index 9c7d1d25bf3d..791cc8d54d0a 100644 --- a/arch/microblaze/include/asm/Kbuild +++ b/arch/microblaze/include/asm/Kbuild | |||
| @@ -26,6 +26,7 @@ generic-y += parport.h | |||
| 26 | generic-y += percpu.h | 26 | generic-y += percpu.h |
| 27 | generic-y += preempt.h | 27 | generic-y += preempt.h |
| 28 | generic-y += serial.h | 28 | generic-y += serial.h |
| 29 | generic-y += shmparam.h | ||
| 29 | generic-y += syscalls.h | 30 | generic-y += syscalls.h |
| 30 | generic-y += topology.h | 31 | generic-y += topology.h |
| 31 | generic-y += trace_clock.h | 32 | generic-y += trace_clock.h |
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 787290781b8c..a84c24d894aa 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
| @@ -1403,6 +1403,21 @@ config LOONGSON3_ENHANCEMENT | |||
| 1403 | please say 'N' here. If you want a high-performance kernel to run on | 1403 | please say 'N' here. If you want a high-performance kernel to run on |
| 1404 | new Loongson 3 machines only, please say 'Y' here. | 1404 | new Loongson 3 machines only, please say 'Y' here. |
| 1405 | 1405 | ||
| 1406 | config CPU_LOONGSON3_WORKAROUNDS | ||
| 1407 | bool "Old Loongson 3 LLSC Workarounds" | ||
| 1408 | default y if SMP | ||
| 1409 | depends on CPU_LOONGSON3 | ||
| 1410 | help | ||
| 1411 | Loongson 3 processors have the llsc issues which require workarounds. | ||
| 1412 | Without workarounds the system may hang unexpectedly. | ||
| 1413 | |||
| 1414 | Newer Loongson 3 will fix these issues and no workarounds are needed. | ||
| 1415 | The workarounds have no significant side effect on them but may | ||
| 1416 | decrease the performance of the system so this option should be | ||
| 1417 | disabled unless the kernel is intended to be run on old systems. | ||
| 1418 | |||
| 1419 | If unsure, please say Y. | ||
| 1420 | |||
| 1406 | config CPU_LOONGSON2E | 1421 | config CPU_LOONGSON2E |
| 1407 | bool "Loongson 2E" | 1422 | bool "Loongson 2E" |
| 1408 | depends on SYS_HAS_CPU_LOONGSON2E | 1423 | depends on SYS_HAS_CPU_LOONGSON2E |
| @@ -3155,6 +3170,7 @@ config MIPS32_O32 | |||
| 3155 | config MIPS32_N32 | 3170 | config MIPS32_N32 |
| 3156 | bool "Kernel support for n32 binaries" | 3171 | bool "Kernel support for n32 binaries" |
| 3157 | depends on 64BIT | 3172 | depends on 64BIT |
| 3173 | select ARCH_WANT_COMPAT_IPC_PARSE_VERSION | ||
| 3158 | select COMPAT | 3174 | select COMPAT |
| 3159 | select MIPS32_COMPAT | 3175 | select MIPS32_COMPAT |
| 3160 | select SYSVIPC_COMPAT if SYSVIPC | 3176 | select SYSVIPC_COMPAT if SYSVIPC |
diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c index 6054d49e608e..fe3773539eff 100644 --- a/arch/mips/bcm47xx/setup.c +++ b/arch/mips/bcm47xx/setup.c | |||
| @@ -173,6 +173,31 @@ void __init plat_mem_setup(void) | |||
| 173 | pm_power_off = bcm47xx_machine_halt; | 173 | pm_power_off = bcm47xx_machine_halt; |
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | #ifdef CONFIG_BCM47XX_BCMA | ||
| 177 | static struct device * __init bcm47xx_setup_device(void) | ||
| 178 | { | ||
| 179 | struct device *dev; | ||
| 180 | int err; | ||
| 181 | |||
| 182 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); | ||
| 183 | if (!dev) | ||
| 184 | return NULL; | ||
| 185 | |||
| 186 | err = dev_set_name(dev, "bcm47xx_soc"); | ||
| 187 | if (err) { | ||
| 188 | pr_err("Failed to set SoC device name: %d\n", err); | ||
| 189 | kfree(dev); | ||
| 190 | return NULL; | ||
| 191 | } | ||
| 192 | |||
| 193 | err = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(32)); | ||
| 194 | if (err) | ||
| 195 | pr_err("Failed to set SoC DMA mask: %d\n", err); | ||
| 196 | |||
| 197 | return dev; | ||
| 198 | } | ||
| 199 | #endif | ||
| 200 | |||
| 176 | /* | 201 | /* |
| 177 | * This finishes bus initialization doing things that were not possible without | 202 | * This finishes bus initialization doing things that were not possible without |
| 178 | * kmalloc. Make sure to call it late enough (after mm_init). | 203 | * kmalloc. Make sure to call it late enough (after mm_init). |
| @@ -183,6 +208,10 @@ void __init bcm47xx_bus_setup(void) | |||
| 183 | if (bcm47xx_bus_type == BCM47XX_BUS_TYPE_BCMA) { | 208 | if (bcm47xx_bus_type == BCM47XX_BUS_TYPE_BCMA) { |
| 184 | int err; | 209 | int err; |
| 185 | 210 | ||
| 211 | bcm47xx_bus.bcma.dev = bcm47xx_setup_device(); | ||
| 212 | if (!bcm47xx_bus.bcma.dev) | ||
| 213 | panic("Failed to setup SoC device\n"); | ||
| 214 | |||
| 186 | err = bcma_host_soc_init(&bcm47xx_bus.bcma); | 215 | err = bcma_host_soc_init(&bcm47xx_bus.bcma); |
| 187 | if (err) | 216 | if (err) |
| 188 | panic("Failed to initialize BCMA bus (err %d)", err); | 217 | panic("Failed to initialize BCMA bus (err %d)", err); |
| @@ -235,6 +264,8 @@ static int __init bcm47xx_register_bus_complete(void) | |||
| 235 | #endif | 264 | #endif |
| 236 | #ifdef CONFIG_BCM47XX_BCMA | 265 | #ifdef CONFIG_BCM47XX_BCMA |
| 237 | case BCM47XX_BUS_TYPE_BCMA: | 266 | case BCM47XX_BUS_TYPE_BCMA: |
| 267 | if (device_register(bcm47xx_bus.bcma.dev)) | ||
| 268 | pr_err("Failed to register SoC device\n"); | ||
| 238 | bcma_bus_register(&bcm47xx_bus.bcma.bus); | 269 | bcma_bus_register(&bcm47xx_bus.bcma.bus); |
| 239 | break; | 270 | break; |
| 240 | #endif | 271 | #endif |
diff --git a/arch/mips/boot/dts/ingenic/ci20.dts b/arch/mips/boot/dts/ingenic/ci20.dts index 50cff3cbcc6d..4f7b1fa31cf5 100644 --- a/arch/mips/boot/dts/ingenic/ci20.dts +++ b/arch/mips/boot/dts/ingenic/ci20.dts | |||
| @@ -76,7 +76,7 @@ | |||
| 76 | status = "okay"; | 76 | status = "okay"; |
| 77 | 77 | ||
| 78 | pinctrl-names = "default"; | 78 | pinctrl-names = "default"; |
| 79 | pinctrl-0 = <&pins_uart2>; | 79 | pinctrl-0 = <&pins_uart3>; |
| 80 | }; | 80 | }; |
| 81 | 81 | ||
| 82 | &uart4 { | 82 | &uart4 { |
| @@ -196,9 +196,9 @@ | |||
| 196 | bias-disable; | 196 | bias-disable; |
| 197 | }; | 197 | }; |
| 198 | 198 | ||
| 199 | pins_uart2: uart2 { | 199 | pins_uart3: uart3 { |
| 200 | function = "uart2"; | 200 | function = "uart3"; |
| 201 | groups = "uart2-data", "uart2-hwflow"; | 201 | groups = "uart3-data", "uart3-hwflow"; |
| 202 | bias-disable; | 202 | bias-disable; |
| 203 | }; | 203 | }; |
| 204 | 204 | ||
diff --git a/arch/mips/boot/dts/ingenic/jz4740.dtsi b/arch/mips/boot/dts/ingenic/jz4740.dtsi index 6fb16fd24035..2beb78a62b7d 100644 --- a/arch/mips/boot/dts/ingenic/jz4740.dtsi +++ b/arch/mips/boot/dts/ingenic/jz4740.dtsi | |||
| @@ -161,7 +161,7 @@ | |||
| 161 | #dma-cells = <2>; | 161 | #dma-cells = <2>; |
| 162 | 162 | ||
| 163 | interrupt-parent = <&intc>; | 163 | interrupt-parent = <&intc>; |
| 164 | interrupts = <29>; | 164 | interrupts = <20>; |
| 165 | 165 | ||
| 166 | clocks = <&cgu JZ4740_CLK_DMA>; | 166 | clocks = <&cgu JZ4740_CLK_DMA>; |
| 167 | 167 | ||
diff --git a/arch/mips/boot/dts/xilfpga/nexys4ddr.dts b/arch/mips/boot/dts/xilfpga/nexys4ddr.dts index 2152b7ba65fb..cc8dbea0911f 100644 --- a/arch/mips/boot/dts/xilfpga/nexys4ddr.dts +++ b/arch/mips/boot/dts/xilfpga/nexys4ddr.dts | |||
| @@ -90,11 +90,11 @@ | |||
| 90 | interrupts = <0>; | 90 | interrupts = <0>; |
| 91 | }; | 91 | }; |
| 92 | 92 | ||
| 93 | axi_i2c: i2c@10A00000 { | 93 | axi_i2c: i2c@10a00000 { |
| 94 | compatible = "xlnx,xps-iic-2.00.a"; | 94 | compatible = "xlnx,xps-iic-2.00.a"; |
| 95 | interrupt-parent = <&axi_intc>; | 95 | interrupt-parent = <&axi_intc>; |
| 96 | interrupts = <4>; | 96 | interrupts = <4>; |
| 97 | reg = < 0x10A00000 0x10000 >; | 97 | reg = < 0x10a00000 0x10000 >; |
| 98 | clocks = <&ext>; | 98 | clocks = <&ext>; |
| 99 | xlnx,clk-freq = <0x5f5e100>; | 99 | xlnx,clk-freq = <0x5f5e100>; |
| 100 | xlnx,family = "Artix7"; | 100 | xlnx,family = "Artix7"; |
| @@ -106,9 +106,9 @@ | |||
| 106 | #address-cells = <1>; | 106 | #address-cells = <1>; |
| 107 | #size-cells = <0>; | 107 | #size-cells = <0>; |
| 108 | 108 | ||
| 109 | ad7420@4B { | 109 | ad7420@4b { |
| 110 | compatible = "adi,adt7420"; | 110 | compatible = "adi,adt7420"; |
| 111 | reg = <0x4B>; | 111 | reg = <0x4b>; |
| 112 | }; | 112 | }; |
| 113 | } ; | 113 | } ; |
| 114 | }; | 114 | }; |
diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c index 2c79ab52977a..8bf43c5a7bc7 100644 --- a/arch/mips/cavium-octeon/setup.c +++ b/arch/mips/cavium-octeon/setup.c | |||
| @@ -98,7 +98,7 @@ static void octeon_kexec_smp_down(void *ignored) | |||
| 98 | " sync \n" | 98 | " sync \n" |
| 99 | " synci ($0) \n"); | 99 | " synci ($0) \n"); |
| 100 | 100 | ||
| 101 | relocated_kexec_smp_wait(NULL); | 101 | kexec_reboot(); |
| 102 | } | 102 | } |
| 103 | #endif | 103 | #endif |
| 104 | 104 | ||
diff --git a/arch/mips/configs/ath79_defconfig b/arch/mips/configs/ath79_defconfig index 4e4ec779f182..6f981af67826 100644 --- a/arch/mips/configs/ath79_defconfig +++ b/arch/mips/configs/ath79_defconfig | |||
| @@ -66,6 +66,7 @@ CONFIG_SERIAL_8250_CONSOLE=y | |||
| 66 | # CONFIG_SERIAL_8250_PCI is not set | 66 | # CONFIG_SERIAL_8250_PCI is not set |
| 67 | CONFIG_SERIAL_8250_NR_UARTS=1 | 67 | CONFIG_SERIAL_8250_NR_UARTS=1 |
| 68 | CONFIG_SERIAL_8250_RUNTIME_UARTS=1 | 68 | CONFIG_SERIAL_8250_RUNTIME_UARTS=1 |
| 69 | CONFIG_SERIAL_OF_PLATFORM=y | ||
| 69 | CONFIG_SERIAL_AR933X=y | 70 | CONFIG_SERIAL_AR933X=y |
| 70 | CONFIG_SERIAL_AR933X_CONSOLE=y | 71 | CONFIG_SERIAL_AR933X_CONSOLE=y |
| 71 | # CONFIG_HW_RANDOM is not set | 72 | # CONFIG_HW_RANDOM is not set |
diff --git a/arch/mips/include/asm/atomic.h b/arch/mips/include/asm/atomic.h index 43fcd35e2957..94096299fc56 100644 --- a/arch/mips/include/asm/atomic.h +++ b/arch/mips/include/asm/atomic.h | |||
| @@ -58,6 +58,7 @@ static __inline__ void atomic_##op(int i, atomic_t * v) \ | |||
| 58 | if (kernel_uses_llsc) { \ | 58 | if (kernel_uses_llsc) { \ |
| 59 | int temp; \ | 59 | int temp; \ |
| 60 | \ | 60 | \ |
| 61 | loongson_llsc_mb(); \ | ||
| 61 | __asm__ __volatile__( \ | 62 | __asm__ __volatile__( \ |
| 62 | " .set push \n" \ | 63 | " .set push \n" \ |
| 63 | " .set "MIPS_ISA_LEVEL" \n" \ | 64 | " .set "MIPS_ISA_LEVEL" \n" \ |
| @@ -85,6 +86,7 @@ static __inline__ int atomic_##op##_return_relaxed(int i, atomic_t * v) \ | |||
| 85 | if (kernel_uses_llsc) { \ | 86 | if (kernel_uses_llsc) { \ |
| 86 | int temp; \ | 87 | int temp; \ |
| 87 | \ | 88 | \ |
| 89 | loongson_llsc_mb(); \ | ||
| 88 | __asm__ __volatile__( \ | 90 | __asm__ __volatile__( \ |
| 89 | " .set push \n" \ | 91 | " .set push \n" \ |
| 90 | " .set "MIPS_ISA_LEVEL" \n" \ | 92 | " .set "MIPS_ISA_LEVEL" \n" \ |
| @@ -118,6 +120,7 @@ static __inline__ int atomic_fetch_##op##_relaxed(int i, atomic_t * v) \ | |||
| 118 | if (kernel_uses_llsc) { \ | 120 | if (kernel_uses_llsc) { \ |
| 119 | int temp; \ | 121 | int temp; \ |
| 120 | \ | 122 | \ |
| 123 | loongson_llsc_mb(); \ | ||
| 121 | __asm__ __volatile__( \ | 124 | __asm__ __volatile__( \ |
| 122 | " .set push \n" \ | 125 | " .set push \n" \ |
| 123 | " .set "MIPS_ISA_LEVEL" \n" \ | 126 | " .set "MIPS_ISA_LEVEL" \n" \ |
| @@ -256,6 +259,7 @@ static __inline__ void atomic64_##op(long i, atomic64_t * v) \ | |||
| 256 | if (kernel_uses_llsc) { \ | 259 | if (kernel_uses_llsc) { \ |
| 257 | long temp; \ | 260 | long temp; \ |
| 258 | \ | 261 | \ |
| 262 | loongson_llsc_mb(); \ | ||
| 259 | __asm__ __volatile__( \ | 263 | __asm__ __volatile__( \ |
| 260 | " .set push \n" \ | 264 | " .set push \n" \ |
| 261 | " .set "MIPS_ISA_LEVEL" \n" \ | 265 | " .set "MIPS_ISA_LEVEL" \n" \ |
| @@ -283,6 +287,7 @@ static __inline__ long atomic64_##op##_return_relaxed(long i, atomic64_t * v) \ | |||
| 283 | if (kernel_uses_llsc) { \ | 287 | if (kernel_uses_llsc) { \ |
| 284 | long temp; \ | 288 | long temp; \ |
| 285 | \ | 289 | \ |
| 290 | loongson_llsc_mb(); \ | ||
| 286 | __asm__ __volatile__( \ | 291 | __asm__ __volatile__( \ |
| 287 | " .set push \n" \ | 292 | " .set push \n" \ |
| 288 | " .set "MIPS_ISA_LEVEL" \n" \ | 293 | " .set "MIPS_ISA_LEVEL" \n" \ |
| @@ -316,6 +321,7 @@ static __inline__ long atomic64_fetch_##op##_relaxed(long i, atomic64_t * v) \ | |||
| 316 | if (kernel_uses_llsc) { \ | 321 | if (kernel_uses_llsc) { \ |
| 317 | long temp; \ | 322 | long temp; \ |
| 318 | \ | 323 | \ |
| 324 | loongson_llsc_mb(); \ | ||
| 319 | __asm__ __volatile__( \ | 325 | __asm__ __volatile__( \ |
| 320 | " .set push \n" \ | 326 | " .set push \n" \ |
| 321 | " .set "MIPS_ISA_LEVEL" \n" \ | 327 | " .set "MIPS_ISA_LEVEL" \n" \ |
diff --git a/arch/mips/include/asm/barrier.h b/arch/mips/include/asm/barrier.h index a5eb1bb199a7..b7f6ac5e513c 100644 --- a/arch/mips/include/asm/barrier.h +++ b/arch/mips/include/asm/barrier.h | |||
| @@ -222,6 +222,42 @@ | |||
| 222 | #define __smp_mb__before_atomic() __smp_mb__before_llsc() | 222 | #define __smp_mb__before_atomic() __smp_mb__before_llsc() |
| 223 | #define __smp_mb__after_atomic() smp_llsc_mb() | 223 | #define __smp_mb__after_atomic() smp_llsc_mb() |
| 224 | 224 | ||
| 225 | /* | ||
| 226 | * Some Loongson 3 CPUs have a bug wherein execution of a memory access (load, | ||
| 227 | * store or pref) in between an ll & sc can cause the sc instruction to | ||
| 228 | * erroneously succeed, breaking atomicity. Whilst it's unusual to write code | ||
| 229 | * containing such sequences, this bug bites harder than we might otherwise | ||
| 230 | * expect due to reordering & speculation: | ||
| 231 | * | ||
| 232 | * 1) A memory access appearing prior to the ll in program order may actually | ||
| 233 | * be executed after the ll - this is the reordering case. | ||
| 234 | * | ||
| 235 | * In order to avoid this we need to place a memory barrier (ie. a sync | ||
| 236 | * instruction) prior to every ll instruction, in between it & any earlier | ||
| 237 | * memory access instructions. Many of these cases are already covered by | ||
| 238 | * smp_mb__before_llsc() but for the remaining cases, typically ones in | ||
| 239 | * which multiple CPUs may operate on a memory location but ordering is not | ||
| 240 | * usually guaranteed, we use loongson_llsc_mb() below. | ||
| 241 | * | ||
| 242 | * This reordering case is fixed by 3A R2 CPUs, ie. 3A2000 models and later. | ||
| 243 | * | ||
| 244 | * 2) If a conditional branch exists between an ll & sc with a target outside | ||
| 245 | * of the ll-sc loop, for example an exit upon value mismatch in cmpxchg() | ||
| 246 | * or similar, then misprediction of the branch may allow speculative | ||
| 247 | * execution of memory accesses from outside of the ll-sc loop. | ||
| 248 | * | ||
| 249 | * In order to avoid this we need a memory barrier (ie. a sync instruction) | ||
| 250 | * at each affected branch target, for which we also use loongson_llsc_mb() | ||
| 251 | * defined below. | ||
| 252 | * | ||
| 253 | * This case affects all current Loongson 3 CPUs. | ||
| 254 | */ | ||
| 255 | #ifdef CONFIG_CPU_LOONGSON3_WORKAROUNDS /* Loongson-3's LLSC workaround */ | ||
| 256 | #define loongson_llsc_mb() __asm__ __volatile__(__WEAK_LLSC_MB : : :"memory") | ||
| 257 | #else | ||
| 258 | #define loongson_llsc_mb() do { } while (0) | ||
| 259 | #endif | ||
| 260 | |||
| 225 | #include <asm-generic/barrier.h> | 261 | #include <asm-generic/barrier.h> |
| 226 | 262 | ||
| 227 | #endif /* __ASM_BARRIER_H */ | 263 | #endif /* __ASM_BARRIER_H */ |
diff --git a/arch/mips/include/asm/bitops.h b/arch/mips/include/asm/bitops.h index c4675957b21b..830c93a010c3 100644 --- a/arch/mips/include/asm/bitops.h +++ b/arch/mips/include/asm/bitops.h | |||
| @@ -69,6 +69,7 @@ static inline void set_bit(unsigned long nr, volatile unsigned long *addr) | |||
| 69 | : "ir" (1UL << bit), GCC_OFF_SMALL_ASM() (*m)); | 69 | : "ir" (1UL << bit), GCC_OFF_SMALL_ASM() (*m)); |
| 70 | #if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR6) | 70 | #if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR6) |
| 71 | } else if (kernel_uses_llsc && __builtin_constant_p(bit)) { | 71 | } else if (kernel_uses_llsc && __builtin_constant_p(bit)) { |
| 72 | loongson_llsc_mb(); | ||
| 72 | do { | 73 | do { |
| 73 | __asm__ __volatile__( | 74 | __asm__ __volatile__( |
| 74 | " " __LL "%0, %1 # set_bit \n" | 75 | " " __LL "%0, %1 # set_bit \n" |
| @@ -79,6 +80,7 @@ static inline void set_bit(unsigned long nr, volatile unsigned long *addr) | |||
| 79 | } while (unlikely(!temp)); | 80 | } while (unlikely(!temp)); |
| 80 | #endif /* CONFIG_CPU_MIPSR2 || CONFIG_CPU_MIPSR6 */ | 81 | #endif /* CONFIG_CPU_MIPSR2 || CONFIG_CPU_MIPSR6 */ |
| 81 | } else if (kernel_uses_llsc) { | 82 | } else if (kernel_uses_llsc) { |
| 83 | loongson_llsc_mb(); | ||
| 82 | do { | 84 | do { |
| 83 | __asm__ __volatile__( | 85 | __asm__ __volatile__( |
| 84 | " .set push \n" | 86 | " .set push \n" |
| @@ -123,6 +125,7 @@ static inline void clear_bit(unsigned long nr, volatile unsigned long *addr) | |||
| 123 | : "ir" (~(1UL << bit))); | 125 | : "ir" (~(1UL << bit))); |
| 124 | #if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR6) | 126 | #if defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_CPU_MIPSR6) |
| 125 | } else if (kernel_uses_llsc && __builtin_constant_p(bit)) { | 127 | } else if (kernel_uses_llsc && __builtin_constant_p(bit)) { |
| 128 | loongson_llsc_mb(); | ||
| 126 | do { | 129 | do { |
| 127 | __asm__ __volatile__( | 130 | __asm__ __volatile__( |
| 128 | " " __LL "%0, %1 # clear_bit \n" | 131 | " " __LL "%0, %1 # clear_bit \n" |
| @@ -133,6 +136,7 @@ static inline void clear_bit(unsigned long nr, volatile unsigned long *addr) | |||
| 133 | } while (unlikely(!temp)); | 136 | } while (unlikely(!temp)); |
| 134 | #endif /* CONFIG_CPU_MIPSR2 || CONFIG_CPU_MIPSR6 */ | 137 | #endif /* CONFIG_CPU_MIPSR2 || CONFIG_CPU_MIPSR6 */ |
| 135 | } else if (kernel_uses_llsc) { | 138 | } else if (kernel_uses_llsc) { |
| 139 | loongson_llsc_mb(); | ||
| 136 | do { | 140 | do { |
| 137 | __asm__ __volatile__( | 141 | __asm__ __volatile__( |
| 138 | " .set push \n" | 142 | " .set push \n" |
| @@ -193,6 +197,7 @@ static inline void change_bit(unsigned long nr, volatile unsigned long *addr) | |||
| 193 | unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG); | 197 | unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG); |
| 194 | unsigned long temp; | 198 | unsigned long temp; |
| 195 | 199 | ||
| 200 | loongson_llsc_mb(); | ||
| 196 | do { | 201 | do { |
| 197 | __asm__ __volatile__( | 202 | __asm__ __volatile__( |
| 198 | " .set push \n" | 203 | " .set push \n" |
diff --git a/arch/mips/include/asm/futex.h b/arch/mips/include/asm/futex.h index c14d798f3888..b83b0397462d 100644 --- a/arch/mips/include/asm/futex.h +++ b/arch/mips/include/asm/futex.h | |||
| @@ -50,6 +50,7 @@ | |||
| 50 | "i" (-EFAULT) \ | 50 | "i" (-EFAULT) \ |
| 51 | : "memory"); \ | 51 | : "memory"); \ |
| 52 | } else if (cpu_has_llsc) { \ | 52 | } else if (cpu_has_llsc) { \ |
| 53 | loongson_llsc_mb(); \ | ||
| 53 | __asm__ __volatile__( \ | 54 | __asm__ __volatile__( \ |
| 54 | " .set push \n" \ | 55 | " .set push \n" \ |
| 55 | " .set noat \n" \ | 56 | " .set noat \n" \ |
| @@ -163,6 +164,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, | |||
| 163 | "i" (-EFAULT) | 164 | "i" (-EFAULT) |
| 164 | : "memory"); | 165 | : "memory"); |
| 165 | } else if (cpu_has_llsc) { | 166 | } else if (cpu_has_llsc) { |
| 167 | loongson_llsc_mb(); | ||
| 166 | __asm__ __volatile__( | 168 | __asm__ __volatile__( |
| 167 | "# futex_atomic_cmpxchg_inatomic \n" | 169 | "# futex_atomic_cmpxchg_inatomic \n" |
| 168 | " .set push \n" | 170 | " .set push \n" |
| @@ -192,6 +194,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, | |||
| 192 | : GCC_OFF_SMALL_ASM() (*uaddr), "Jr" (oldval), "Jr" (newval), | 194 | : GCC_OFF_SMALL_ASM() (*uaddr), "Jr" (oldval), "Jr" (newval), |
| 193 | "i" (-EFAULT) | 195 | "i" (-EFAULT) |
| 194 | : "memory"); | 196 | : "memory"); |
| 197 | loongson_llsc_mb(); | ||
| 195 | } else | 198 | } else |
| 196 | return -ENOSYS; | 199 | return -ENOSYS; |
| 197 | 200 | ||
diff --git a/arch/mips/include/asm/mach-lantiq/falcon/falcon_irq.h b/arch/mips/include/asm/mach-lantiq/falcon/falcon_irq.h index c6b63a409641..6dd8ad2409dc 100644 --- a/arch/mips/include/asm/mach-lantiq/falcon/falcon_irq.h +++ b/arch/mips/include/asm/mach-lantiq/falcon/falcon_irq.h | |||
| @@ -18,8 +18,6 @@ | |||
| 18 | #define INT_NUM_EXTRA_START (INT_NUM_IM4_IRL0 + 32) | 18 | #define INT_NUM_EXTRA_START (INT_NUM_IM4_IRL0 + 32) |
| 19 | #define INT_NUM_IM_OFFSET (INT_NUM_IM1_IRL0 - INT_NUM_IM0_IRL0) | 19 | #define INT_NUM_IM_OFFSET (INT_NUM_IM1_IRL0 - INT_NUM_IM0_IRL0) |
| 20 | 20 | ||
| 21 | #define MIPS_CPU_TIMER_IRQ 7 | ||
| 22 | |||
| 23 | #define MAX_IM 5 | 21 | #define MAX_IM 5 |
| 24 | 22 | ||
| 25 | #endif /* _FALCON_IRQ__ */ | 23 | #endif /* _FALCON_IRQ__ */ |
diff --git a/arch/mips/include/asm/mach-lantiq/xway/lantiq_irq.h b/arch/mips/include/asm/mach-lantiq/xway/lantiq_irq.h index 141076325307..0b424214a5e9 100644 --- a/arch/mips/include/asm/mach-lantiq/xway/lantiq_irq.h +++ b/arch/mips/include/asm/mach-lantiq/xway/lantiq_irq.h | |||
| @@ -19,8 +19,6 @@ | |||
| 19 | 19 | ||
| 20 | #define LTQ_DMA_CH0_INT (INT_NUM_IM2_IRL0) | 20 | #define LTQ_DMA_CH0_INT (INT_NUM_IM2_IRL0) |
| 21 | 21 | ||
| 22 | #define MIPS_CPU_TIMER_IRQ 7 | ||
| 23 | |||
| 24 | #define MAX_IM 5 | 22 | #define MAX_IM 5 |
| 25 | 23 | ||
| 26 | #endif | 24 | #endif |
diff --git a/arch/mips/include/asm/pgtable.h b/arch/mips/include/asm/pgtable.h index 57933fc8fd98..910851c62db3 100644 --- a/arch/mips/include/asm/pgtable.h +++ b/arch/mips/include/asm/pgtable.h | |||
| @@ -228,6 +228,7 @@ static inline void set_pte(pte_t *ptep, pte_t pteval) | |||
| 228 | : [buddy] "+m" (buddy->pte), [tmp] "=&r" (tmp) | 228 | : [buddy] "+m" (buddy->pte), [tmp] "=&r" (tmp) |
| 229 | : [global] "r" (page_global)); | 229 | : [global] "r" (page_global)); |
| 230 | } else if (kernel_uses_llsc) { | 230 | } else if (kernel_uses_llsc) { |
| 231 | loongson_llsc_mb(); | ||
| 231 | __asm__ __volatile__ ( | 232 | __asm__ __volatile__ ( |
| 232 | " .set push \n" | 233 | " .set push \n" |
| 233 | " .set "MIPS_ISA_ARCH_LEVEL" \n" | 234 | " .set "MIPS_ISA_ARCH_LEVEL" \n" |
| @@ -242,6 +243,7 @@ static inline void set_pte(pte_t *ptep, pte_t pteval) | |||
| 242 | " .set pop \n" | 243 | " .set pop \n" |
| 243 | : [buddy] "+m" (buddy->pte), [tmp] "=&r" (tmp) | 244 | : [buddy] "+m" (buddy->pte), [tmp] "=&r" (tmp) |
| 244 | : [global] "r" (page_global)); | 245 | : [global] "r" (page_global)); |
| 246 | loongson_llsc_mb(); | ||
| 245 | } | 247 | } |
| 246 | #else /* !CONFIG_SMP */ | 248 | #else /* !CONFIG_SMP */ |
| 247 | if (pte_none(*buddy)) | 249 | if (pte_none(*buddy)) |
diff --git a/arch/mips/jazz/jazzdma.c b/arch/mips/jazz/jazzdma.c index 6256d35dbf4d..bedb5047aff3 100644 --- a/arch/mips/jazz/jazzdma.c +++ b/arch/mips/jazz/jazzdma.c | |||
| @@ -74,14 +74,15 @@ static int __init vdma_init(void) | |||
| 74 | get_order(VDMA_PGTBL_SIZE)); | 74 | get_order(VDMA_PGTBL_SIZE)); |
| 75 | BUG_ON(!pgtbl); | 75 | BUG_ON(!pgtbl); |
| 76 | dma_cache_wback_inv((unsigned long)pgtbl, VDMA_PGTBL_SIZE); | 76 | dma_cache_wback_inv((unsigned long)pgtbl, VDMA_PGTBL_SIZE); |
| 77 | pgtbl = (VDMA_PGTBL_ENTRY *)KSEG1ADDR(pgtbl); | 77 | pgtbl = (VDMA_PGTBL_ENTRY *)CKSEG1ADDR((unsigned long)pgtbl); |
| 78 | 78 | ||
| 79 | /* | 79 | /* |
| 80 | * Clear the R4030 translation table | 80 | * Clear the R4030 translation table |
| 81 | */ | 81 | */ |
| 82 | vdma_pgtbl_init(); | 82 | vdma_pgtbl_init(); |
| 83 | 83 | ||
| 84 | r4030_write_reg32(JAZZ_R4030_TRSTBL_BASE, CPHYSADDR(pgtbl)); | 84 | r4030_write_reg32(JAZZ_R4030_TRSTBL_BASE, |
| 85 | CPHYSADDR((unsigned long)pgtbl)); | ||
| 85 | r4030_write_reg32(JAZZ_R4030_TRSTBL_LIM, VDMA_PGTBL_SIZE); | 86 | r4030_write_reg32(JAZZ_R4030_TRSTBL_LIM, VDMA_PGTBL_SIZE); |
| 86 | r4030_write_reg32(JAZZ_R4030_TRSTBL_INV, 0); | 87 | r4030_write_reg32(JAZZ_R4030_TRSTBL_INV, 0); |
| 87 | 88 | ||
diff --git a/arch/mips/kernel/mips-cm.c b/arch/mips/kernel/mips-cm.c index 8f5bd04f320a..7f3f136572de 100644 --- a/arch/mips/kernel/mips-cm.c +++ b/arch/mips/kernel/mips-cm.c | |||
| @@ -457,5 +457,5 @@ void mips_cm_error_report(void) | |||
| 457 | } | 457 | } |
| 458 | 458 | ||
| 459 | /* reprime cause register */ | 459 | /* reprime cause register */ |
| 460 | write_gcr_error_cause(0); | 460 | write_gcr_error_cause(cm_error); |
| 461 | } | 461 | } |
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c index 6829a064aac8..339870ed92f7 100644 --- a/arch/mips/kernel/process.c +++ b/arch/mips/kernel/process.c | |||
| @@ -371,7 +371,7 @@ static inline int is_sp_move_ins(union mips_instruction *ip, int *frame_size) | |||
| 371 | static int get_frame_info(struct mips_frame_info *info) | 371 | static int get_frame_info(struct mips_frame_info *info) |
| 372 | { | 372 | { |
| 373 | bool is_mmips = IS_ENABLED(CONFIG_CPU_MICROMIPS); | 373 | bool is_mmips = IS_ENABLED(CONFIG_CPU_MICROMIPS); |
| 374 | union mips_instruction insn, *ip, *ip_end; | 374 | union mips_instruction insn, *ip; |
| 375 | const unsigned int max_insns = 128; | 375 | const unsigned int max_insns = 128; |
| 376 | unsigned int last_insn_size = 0; | 376 | unsigned int last_insn_size = 0; |
| 377 | unsigned int i; | 377 | unsigned int i; |
| @@ -384,10 +384,9 @@ static int get_frame_info(struct mips_frame_info *info) | |||
| 384 | if (!ip) | 384 | if (!ip) |
| 385 | goto err; | 385 | goto err; |
| 386 | 386 | ||
| 387 | ip_end = (void *)ip + info->func_size; | 387 | for (i = 0; i < max_insns; i++) { |
| 388 | |||
| 389 | for (i = 0; i < max_insns && ip < ip_end; i++) { | ||
| 390 | ip = (void *)ip + last_insn_size; | 388 | ip = (void *)ip + last_insn_size; |
| 389 | |||
| 391 | if (is_mmips && mm_insn_16bit(ip->halfword[0])) { | 390 | if (is_mmips && mm_insn_16bit(ip->halfword[0])) { |
| 392 | insn.word = ip->halfword[0] << 16; | 391 | insn.word = ip->halfword[0] << 16; |
| 393 | last_insn_size = 2; | 392 | last_insn_size = 2; |
diff --git a/arch/mips/lantiq/irq.c b/arch/mips/lantiq/irq.c index f0bc3312ed11..6549499eb202 100644 --- a/arch/mips/lantiq/irq.c +++ b/arch/mips/lantiq/irq.c | |||
| @@ -224,9 +224,11 @@ static struct irq_chip ltq_eiu_type = { | |||
| 224 | .irq_set_type = ltq_eiu_settype, | 224 | .irq_set_type = ltq_eiu_settype, |
| 225 | }; | 225 | }; |
| 226 | 226 | ||
| 227 | static void ltq_hw_irqdispatch(int module) | 227 | static void ltq_hw_irq_handler(struct irq_desc *desc) |
| 228 | { | 228 | { |
| 229 | int module = irq_desc_get_irq(desc) - 2; | ||
| 229 | u32 irq; | 230 | u32 irq; |
| 231 | int hwirq; | ||
| 230 | 232 | ||
| 231 | irq = ltq_icu_r32(module, LTQ_ICU_IM0_IOSR); | 233 | irq = ltq_icu_r32(module, LTQ_ICU_IM0_IOSR); |
| 232 | if (irq == 0) | 234 | if (irq == 0) |
| @@ -237,7 +239,8 @@ static void ltq_hw_irqdispatch(int module) | |||
| 237 | * other bits might be bogus | 239 | * other bits might be bogus |
| 238 | */ | 240 | */ |
| 239 | irq = __fls(irq); | 241 | irq = __fls(irq); |
| 240 | do_IRQ((int)irq + MIPS_CPU_IRQ_CASCADE + (INT_NUM_IM_OFFSET * module)); | 242 | hwirq = irq + MIPS_CPU_IRQ_CASCADE + (INT_NUM_IM_OFFSET * module); |
| 243 | generic_handle_irq(irq_linear_revmap(ltq_domain, hwirq)); | ||
| 241 | 244 | ||
| 242 | /* if this is a EBU irq, we need to ack it or get a deadlock */ | 245 | /* if this is a EBU irq, we need to ack it or get a deadlock */ |
| 243 | if ((irq == LTQ_ICU_EBU_IRQ) && (module == 0) && LTQ_EBU_PCC_ISTAT) | 246 | if ((irq == LTQ_ICU_EBU_IRQ) && (module == 0) && LTQ_EBU_PCC_ISTAT) |
| @@ -245,49 +248,6 @@ static void ltq_hw_irqdispatch(int module) | |||
| 245 | LTQ_EBU_PCC_ISTAT); | 248 | LTQ_EBU_PCC_ISTAT); |
| 246 | } | 249 | } |
| 247 | 250 | ||
| 248 | #define DEFINE_HWx_IRQDISPATCH(x) \ | ||
| 249 | static void ltq_hw ## x ## _irqdispatch(void) \ | ||
| 250 | { \ | ||
| 251 | ltq_hw_irqdispatch(x); \ | ||
| 252 | } | ||
| 253 | DEFINE_HWx_IRQDISPATCH(0) | ||
| 254 | DEFINE_HWx_IRQDISPATCH(1) | ||
| 255 | DEFINE_HWx_IRQDISPATCH(2) | ||
| 256 | DEFINE_HWx_IRQDISPATCH(3) | ||
| 257 | DEFINE_HWx_IRQDISPATCH(4) | ||
| 258 | |||
| 259 | #if MIPS_CPU_TIMER_IRQ == 7 | ||
| 260 | static void ltq_hw5_irqdispatch(void) | ||
| 261 | { | ||
| 262 | do_IRQ(MIPS_CPU_TIMER_IRQ); | ||
| 263 | } | ||
| 264 | #else | ||
| 265 | DEFINE_HWx_IRQDISPATCH(5) | ||
| 266 | #endif | ||
| 267 | |||
| 268 | static void ltq_hw_irq_handler(struct irq_desc *desc) | ||
| 269 | { | ||
| 270 | ltq_hw_irqdispatch(irq_desc_get_irq(desc) - 2); | ||
| 271 | } | ||
| 272 | |||
| 273 | asmlinkage void plat_irq_dispatch(void) | ||
| 274 | { | ||
| 275 | unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM; | ||
| 276 | int irq; | ||
| 277 | |||
| 278 | if (!pending) { | ||
| 279 | spurious_interrupt(); | ||
| 280 | return; | ||
| 281 | } | ||
| 282 | |||
| 283 | pending >>= CAUSEB_IP; | ||
| 284 | while (pending) { | ||
| 285 | irq = fls(pending) - 1; | ||
| 286 | do_IRQ(MIPS_CPU_IRQ_BASE + irq); | ||
| 287 | pending &= ~BIT(irq); | ||
| 288 | } | ||
| 289 | } | ||
| 290 | |||
| 291 | static int icu_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw) | 251 | static int icu_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw) |
| 292 | { | 252 | { |
| 293 | struct irq_chip *chip = <q_irq_type; | 253 | struct irq_chip *chip = <q_irq_type; |
| @@ -343,38 +303,13 @@ int __init icu_of_init(struct device_node *node, struct device_node *parent) | |||
| 343 | for (i = 0; i < MAX_IM; i++) | 303 | for (i = 0; i < MAX_IM; i++) |
| 344 | irq_set_chained_handler(i + 2, ltq_hw_irq_handler); | 304 | irq_set_chained_handler(i + 2, ltq_hw_irq_handler); |
| 345 | 305 | ||
| 346 | if (cpu_has_vint) { | ||
| 347 | pr_info("Setting up vectored interrupts\n"); | ||
| 348 | set_vi_handler(2, ltq_hw0_irqdispatch); | ||
| 349 | set_vi_handler(3, ltq_hw1_irqdispatch); | ||
| 350 | set_vi_handler(4, ltq_hw2_irqdispatch); | ||
| 351 | set_vi_handler(5, ltq_hw3_irqdispatch); | ||
| 352 | set_vi_handler(6, ltq_hw4_irqdispatch); | ||
| 353 | set_vi_handler(7, ltq_hw5_irqdispatch); | ||
| 354 | } | ||
| 355 | |||
| 356 | ltq_domain = irq_domain_add_linear(node, | 306 | ltq_domain = irq_domain_add_linear(node, |
| 357 | (MAX_IM * INT_NUM_IM_OFFSET) + MIPS_CPU_IRQ_CASCADE, | 307 | (MAX_IM * INT_NUM_IM_OFFSET) + MIPS_CPU_IRQ_CASCADE, |
| 358 | &irq_domain_ops, 0); | 308 | &irq_domain_ops, 0); |
| 359 | 309 | ||
| 360 | #ifndef CONFIG_MIPS_MT_SMP | ||
| 361 | set_c0_status(IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | | ||
| 362 | IE_IRQ3 | IE_IRQ4 | IE_IRQ5); | ||
| 363 | #else | ||
| 364 | set_c0_status(IE_SW0 | IE_SW1 | IE_IRQ0 | IE_IRQ1 | | ||
| 365 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4 | IE_IRQ5); | ||
| 366 | #endif | ||
| 367 | |||
| 368 | /* tell oprofile which irq to use */ | 310 | /* tell oprofile which irq to use */ |
| 369 | ltq_perfcount_irq = irq_create_mapping(ltq_domain, LTQ_PERF_IRQ); | 311 | ltq_perfcount_irq = irq_create_mapping(ltq_domain, LTQ_PERF_IRQ); |
| 370 | 312 | ||
| 371 | /* | ||
| 372 | * if the timer irq is not one of the mips irqs we need to | ||
| 373 | * create a mapping | ||
| 374 | */ | ||
| 375 | if (MIPS_CPU_TIMER_IRQ != 7) | ||
| 376 | irq_create_mapping(ltq_domain, MIPS_CPU_TIMER_IRQ); | ||
| 377 | |||
| 378 | /* the external interrupts are optional and xway only */ | 313 | /* the external interrupts are optional and xway only */ |
| 379 | eiu_node = of_find_compatible_node(NULL, NULL, "lantiq,eiu-xway"); | 314 | eiu_node = of_find_compatible_node(NULL, NULL, "lantiq,eiu-xway"); |
| 380 | if (eiu_node && !of_address_to_resource(eiu_node, 0, &res)) { | 315 | if (eiu_node && !of_address_to_resource(eiu_node, 0, &res)) { |
| @@ -411,7 +346,7 @@ EXPORT_SYMBOL_GPL(get_c0_perfcount_int); | |||
| 411 | 346 | ||
| 412 | unsigned int get_c0_compare_int(void) | 347 | unsigned int get_c0_compare_int(void) |
| 413 | { | 348 | { |
| 414 | return MIPS_CPU_TIMER_IRQ; | 349 | return CP0_LEGACY_COMPARE_IRQ; |
| 415 | } | 350 | } |
| 416 | 351 | ||
| 417 | static struct of_device_id __initdata of_irq_ids[] = { | 352 | static struct of_device_id __initdata of_irq_ids[] = { |
diff --git a/arch/mips/lantiq/xway/dma.c b/arch/mips/lantiq/xway/dma.c index 982859f2b2a3..5e6a1a45cbd2 100644 --- a/arch/mips/lantiq/xway/dma.c +++ b/arch/mips/lantiq/xway/dma.c | |||
| @@ -129,9 +129,9 @@ ltq_dma_alloc(struct ltq_dma_channel *ch) | |||
| 129 | unsigned long flags; | 129 | unsigned long flags; |
| 130 | 130 | ||
| 131 | ch->desc = 0; | 131 | ch->desc = 0; |
| 132 | ch->desc_base = dma_zalloc_coherent(ch->dev, | 132 | ch->desc_base = dma_alloc_coherent(ch->dev, |
| 133 | LTQ_DESC_NUM * LTQ_DESC_SIZE, | 133 | LTQ_DESC_NUM * LTQ_DESC_SIZE, |
| 134 | &ch->phys, GFP_ATOMIC); | 134 | &ch->phys, GFP_ATOMIC); |
| 135 | 135 | ||
| 136 | spin_lock_irqsave(<q_dma_lock, flags); | 136 | spin_lock_irqsave(<q_dma_lock, flags); |
| 137 | ltq_dma_w32(ch->nr, LTQ_DMA_CS); | 137 | ltq_dma_w32(ch->nr, LTQ_DMA_CS); |
diff --git a/arch/mips/loongson64/Platform b/arch/mips/loongson64/Platform index 0fce4608aa88..c1a4d4dc4665 100644 --- a/arch/mips/loongson64/Platform +++ b/arch/mips/loongson64/Platform | |||
| @@ -23,6 +23,29 @@ ifdef CONFIG_CPU_LOONGSON2F_WORKAROUNDS | |||
| 23 | endif | 23 | endif |
| 24 | 24 | ||
| 25 | cflags-$(CONFIG_CPU_LOONGSON3) += -Wa,--trap | 25 | cflags-$(CONFIG_CPU_LOONGSON3) += -Wa,--trap |
| 26 | |||
| 27 | # | ||
| 28 | # Some versions of binutils, not currently mainline as of 2019/02/04, support | ||
| 29 | # an -mfix-loongson3-llsc flag which emits a sync prior to each ll instruction | ||
| 30 | # to work around a CPU bug (see loongson_llsc_mb() in asm/barrier.h for a | ||
| 31 | # description). | ||
| 32 | # | ||
| 33 | # We disable this in order to prevent the assembler meddling with the | ||
| 34 | # instruction that labels refer to, ie. if we label an ll instruction: | ||
| 35 | # | ||
| 36 | # 1: ll v0, 0(a0) | ||
| 37 | # | ||
| 38 | # ...then with the assembler fix applied the label may actually point at a sync | ||
| 39 | # instruction inserted by the assembler, and if we were using the label in an | ||
| 40 | # exception table the table would no longer contain the address of the ll | ||
| 41 | # instruction. | ||
| 42 | # | ||
| 43 | # Avoid this by explicitly disabling that assembler behaviour. If upstream | ||
| 44 | # binutils does not merge support for the flag then we can revisit & remove | ||
| 45 | # this later - for now it ensures vendor toolchains don't cause problems. | ||
| 46 | # | ||
| 47 | cflags-$(CONFIG_CPU_LOONGSON3) += $(call as-option,-Wa$(comma)-mno-fix-loongson3-llsc,) | ||
| 48 | |||
| 26 | # | 49 | # |
| 27 | # binutils from v2.25 on and gcc starting from v4.9.0 treat -march=loongson3a | 50 | # binutils from v2.25 on and gcc starting from v4.9.0 treat -march=loongson3a |
| 28 | # as MIPS64 R2; older versions as just R1. This leaves the possibility open | 51 | # as MIPS64 R2; older versions as just R1. This leaves the possibility open |
diff --git a/arch/mips/loongson64/common/reset.c b/arch/mips/loongson64/common/reset.c index a60715e11306..b26892ce871c 100644 --- a/arch/mips/loongson64/common/reset.c +++ b/arch/mips/loongson64/common/reset.c | |||
| @@ -59,7 +59,12 @@ static void loongson_poweroff(void) | |||
| 59 | { | 59 | { |
| 60 | #ifndef CONFIG_LEFI_FIRMWARE_INTERFACE | 60 | #ifndef CONFIG_LEFI_FIRMWARE_INTERFACE |
| 61 | mach_prepare_shutdown(); | 61 | mach_prepare_shutdown(); |
| 62 | unreachable(); | 62 | |
| 63 | /* | ||
| 64 | * It needs a wait loop here, but mips/kernel/reset.c already calls | ||
| 65 | * a generic delay loop, machine_hang(), so simply return. | ||
| 66 | */ | ||
| 67 | return; | ||
| 63 | #else | 68 | #else |
| 64 | void (*fw_poweroff)(void) = (void *)loongson_sysconf.poweroff_addr; | 69 | void (*fw_poweroff)(void) = (void *)loongson_sysconf.poweroff_addr; |
| 65 | 70 | ||
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c index 37b1cb246332..65b6e85447b1 100644 --- a/arch/mips/mm/tlbex.c +++ b/arch/mips/mm/tlbex.c | |||
| @@ -932,6 +932,8 @@ build_get_pgd_vmalloc64(u32 **p, struct uasm_label **l, struct uasm_reloc **r, | |||
| 932 | * to mimic that here by taking a load/istream page | 932 | * to mimic that here by taking a load/istream page |
| 933 | * fault. | 933 | * fault. |
| 934 | */ | 934 | */ |
| 935 | if (IS_ENABLED(CONFIG_CPU_LOONGSON3_WORKAROUNDS)) | ||
| 936 | uasm_i_sync(p, 0); | ||
| 935 | UASM_i_LA(p, ptr, (unsigned long)tlb_do_page_fault_0); | 937 | UASM_i_LA(p, ptr, (unsigned long)tlb_do_page_fault_0); |
| 936 | uasm_i_jr(p, ptr); | 938 | uasm_i_jr(p, ptr); |
| 937 | 939 | ||
| @@ -1646,6 +1648,8 @@ static void | |||
| 1646 | iPTE_LW(u32 **p, unsigned int pte, unsigned int ptr) | 1648 | iPTE_LW(u32 **p, unsigned int pte, unsigned int ptr) |
| 1647 | { | 1649 | { |
| 1648 | #ifdef CONFIG_SMP | 1650 | #ifdef CONFIG_SMP |
| 1651 | if (IS_ENABLED(CONFIG_CPU_LOONGSON3_WORKAROUNDS)) | ||
| 1652 | uasm_i_sync(p, 0); | ||
| 1649 | # ifdef CONFIG_PHYS_ADDR_T_64BIT | 1653 | # ifdef CONFIG_PHYS_ADDR_T_64BIT |
| 1650 | if (cpu_has_64bits) | 1654 | if (cpu_has_64bits) |
| 1651 | uasm_i_lld(p, pte, 0, ptr); | 1655 | uasm_i_lld(p, pte, 0, ptr); |
| @@ -2259,6 +2263,8 @@ static void build_r4000_tlb_load_handler(void) | |||
| 2259 | #endif | 2263 | #endif |
| 2260 | 2264 | ||
| 2261 | uasm_l_nopage_tlbl(&l, p); | 2265 | uasm_l_nopage_tlbl(&l, p); |
| 2266 | if (IS_ENABLED(CONFIG_CPU_LOONGSON3_WORKAROUNDS)) | ||
| 2267 | uasm_i_sync(&p, 0); | ||
| 2262 | build_restore_work_registers(&p); | 2268 | build_restore_work_registers(&p); |
| 2263 | #ifdef CONFIG_CPU_MICROMIPS | 2269 | #ifdef CONFIG_CPU_MICROMIPS |
| 2264 | if ((unsigned long)tlb_do_page_fault_0 & 1) { | 2270 | if ((unsigned long)tlb_do_page_fault_0 & 1) { |
| @@ -2313,6 +2319,8 @@ static void build_r4000_tlb_store_handler(void) | |||
| 2313 | #endif | 2319 | #endif |
| 2314 | 2320 | ||
| 2315 | uasm_l_nopage_tlbs(&l, p); | 2321 | uasm_l_nopage_tlbs(&l, p); |
| 2322 | if (IS_ENABLED(CONFIG_CPU_LOONGSON3_WORKAROUNDS)) | ||
| 2323 | uasm_i_sync(&p, 0); | ||
| 2316 | build_restore_work_registers(&p); | 2324 | build_restore_work_registers(&p); |
| 2317 | #ifdef CONFIG_CPU_MICROMIPS | 2325 | #ifdef CONFIG_CPU_MICROMIPS |
| 2318 | if ((unsigned long)tlb_do_page_fault_1 & 1) { | 2326 | if ((unsigned long)tlb_do_page_fault_1 & 1) { |
| @@ -2368,6 +2376,8 @@ static void build_r4000_tlb_modify_handler(void) | |||
| 2368 | #endif | 2376 | #endif |
| 2369 | 2377 | ||
| 2370 | uasm_l_nopage_tlbm(&l, p); | 2378 | uasm_l_nopage_tlbm(&l, p); |
| 2379 | if (IS_ENABLED(CONFIG_CPU_LOONGSON3_WORKAROUNDS)) | ||
| 2380 | uasm_i_sync(&p, 0); | ||
| 2371 | build_restore_work_registers(&p); | 2381 | build_restore_work_registers(&p); |
| 2372 | #ifdef CONFIG_CPU_MICROMIPS | 2382 | #ifdef CONFIG_CPU_MICROMIPS |
| 2373 | if ((unsigned long)tlb_do_page_fault_1 & 1) { | 2383 | if ((unsigned long)tlb_do_page_fault_1 & 1) { |
diff --git a/arch/mips/net/ebpf_jit.c b/arch/mips/net/ebpf_jit.c index b16710a8a9e7..76e9bf88d3b9 100644 --- a/arch/mips/net/ebpf_jit.c +++ b/arch/mips/net/ebpf_jit.c | |||
| @@ -79,8 +79,6 @@ enum reg_val_type { | |||
| 79 | REG_64BIT_32BIT, | 79 | REG_64BIT_32BIT, |
| 80 | /* 32-bit compatible, need truncation for 64-bit ops. */ | 80 | /* 32-bit compatible, need truncation for 64-bit ops. */ |
| 81 | REG_32BIT, | 81 | REG_32BIT, |
| 82 | /* 32-bit zero extended. */ | ||
| 83 | REG_32BIT_ZERO_EX, | ||
| 84 | /* 32-bit no sign/zero extension needed. */ | 82 | /* 32-bit no sign/zero extension needed. */ |
| 85 | REG_32BIT_POS | 83 | REG_32BIT_POS |
| 86 | }; | 84 | }; |
| @@ -343,12 +341,15 @@ static int build_int_epilogue(struct jit_ctx *ctx, int dest_reg) | |||
| 343 | const struct bpf_prog *prog = ctx->skf; | 341 | const struct bpf_prog *prog = ctx->skf; |
| 344 | int stack_adjust = ctx->stack_size; | 342 | int stack_adjust = ctx->stack_size; |
| 345 | int store_offset = stack_adjust - 8; | 343 | int store_offset = stack_adjust - 8; |
| 344 | enum reg_val_type td; | ||
| 346 | int r0 = MIPS_R_V0; | 345 | int r0 = MIPS_R_V0; |
| 347 | 346 | ||
| 348 | if (dest_reg == MIPS_R_RA && | 347 | if (dest_reg == MIPS_R_RA) { |
| 349 | get_reg_val_type(ctx, prog->len, BPF_REG_0) == REG_32BIT_ZERO_EX) | ||
| 350 | /* Don't let zero extended value escape. */ | 348 | /* Don't let zero extended value escape. */ |
| 351 | emit_instr(ctx, sll, r0, r0, 0); | 349 | td = get_reg_val_type(ctx, prog->len, BPF_REG_0); |
| 350 | if (td == REG_64BIT) | ||
| 351 | emit_instr(ctx, sll, r0, r0, 0); | ||
| 352 | } | ||
| 352 | 353 | ||
| 353 | if (ctx->flags & EBPF_SAVE_RA) { | 354 | if (ctx->flags & EBPF_SAVE_RA) { |
| 354 | emit_instr(ctx, ld, MIPS_R_RA, store_offset, MIPS_R_SP); | 355 | emit_instr(ctx, ld, MIPS_R_RA, store_offset, MIPS_R_SP); |
| @@ -692,7 +693,7 @@ static int build_one_insn(const struct bpf_insn *insn, struct jit_ctx *ctx, | |||
| 692 | if (dst < 0) | 693 | if (dst < 0) |
| 693 | return dst; | 694 | return dst; |
| 694 | td = get_reg_val_type(ctx, this_idx, insn->dst_reg); | 695 | td = get_reg_val_type(ctx, this_idx, insn->dst_reg); |
| 695 | if (td == REG_64BIT || td == REG_32BIT_ZERO_EX) { | 696 | if (td == REG_64BIT) { |
| 696 | /* sign extend */ | 697 | /* sign extend */ |
| 697 | emit_instr(ctx, sll, dst, dst, 0); | 698 | emit_instr(ctx, sll, dst, dst, 0); |
| 698 | } | 699 | } |
| @@ -707,7 +708,7 @@ static int build_one_insn(const struct bpf_insn *insn, struct jit_ctx *ctx, | |||
| 707 | if (dst < 0) | 708 | if (dst < 0) |
| 708 | return dst; | 709 | return dst; |
| 709 | td = get_reg_val_type(ctx, this_idx, insn->dst_reg); | 710 | td = get_reg_val_type(ctx, this_idx, insn->dst_reg); |
| 710 | if (td == REG_64BIT || td == REG_32BIT_ZERO_EX) { | 711 | if (td == REG_64BIT) { |
| 711 | /* sign extend */ | 712 | /* sign extend */ |
| 712 | emit_instr(ctx, sll, dst, dst, 0); | 713 | emit_instr(ctx, sll, dst, dst, 0); |
| 713 | } | 714 | } |
| @@ -721,7 +722,7 @@ static int build_one_insn(const struct bpf_insn *insn, struct jit_ctx *ctx, | |||
| 721 | if (dst < 0) | 722 | if (dst < 0) |
| 722 | return dst; | 723 | return dst; |
| 723 | td = get_reg_val_type(ctx, this_idx, insn->dst_reg); | 724 | td = get_reg_val_type(ctx, this_idx, insn->dst_reg); |
| 724 | if (td == REG_64BIT || td == REG_32BIT_ZERO_EX) | 725 | if (td == REG_64BIT) |
| 725 | /* sign extend */ | 726 | /* sign extend */ |
| 726 | emit_instr(ctx, sll, dst, dst, 0); | 727 | emit_instr(ctx, sll, dst, dst, 0); |
| 727 | if (insn->imm == 1) { | 728 | if (insn->imm == 1) { |
| @@ -860,13 +861,13 @@ static int build_one_insn(const struct bpf_insn *insn, struct jit_ctx *ctx, | |||
| 860 | if (src < 0 || dst < 0) | 861 | if (src < 0 || dst < 0) |
| 861 | return -EINVAL; | 862 | return -EINVAL; |
| 862 | td = get_reg_val_type(ctx, this_idx, insn->dst_reg); | 863 | td = get_reg_val_type(ctx, this_idx, insn->dst_reg); |
| 863 | if (td == REG_64BIT || td == REG_32BIT_ZERO_EX) { | 864 | if (td == REG_64BIT) { |
| 864 | /* sign extend */ | 865 | /* sign extend */ |
| 865 | emit_instr(ctx, sll, dst, dst, 0); | 866 | emit_instr(ctx, sll, dst, dst, 0); |
| 866 | } | 867 | } |
| 867 | did_move = false; | 868 | did_move = false; |
| 868 | ts = get_reg_val_type(ctx, this_idx, insn->src_reg); | 869 | ts = get_reg_val_type(ctx, this_idx, insn->src_reg); |
| 869 | if (ts == REG_64BIT || ts == REG_32BIT_ZERO_EX) { | 870 | if (ts == REG_64BIT) { |
| 870 | int tmp_reg = MIPS_R_AT; | 871 | int tmp_reg = MIPS_R_AT; |
| 871 | 872 | ||
| 872 | if (bpf_op == BPF_MOV) { | 873 | if (bpf_op == BPF_MOV) { |
| @@ -1254,8 +1255,7 @@ jeq_common: | |||
| 1254 | if (insn->imm == 64 && td == REG_32BIT) | 1255 | if (insn->imm == 64 && td == REG_32BIT) |
| 1255 | emit_instr(ctx, dinsu, dst, MIPS_R_ZERO, 32, 32); | 1256 | emit_instr(ctx, dinsu, dst, MIPS_R_ZERO, 32, 32); |
| 1256 | 1257 | ||
| 1257 | if (insn->imm != 64 && | 1258 | if (insn->imm != 64 && td == REG_64BIT) { |
| 1258 | (td == REG_64BIT || td == REG_32BIT_ZERO_EX)) { | ||
| 1259 | /* sign extend */ | 1259 | /* sign extend */ |
| 1260 | emit_instr(ctx, sll, dst, dst, 0); | 1260 | emit_instr(ctx, sll, dst, dst, 0); |
| 1261 | } | 1261 | } |
diff --git a/arch/mips/pci/msi-octeon.c b/arch/mips/pci/msi-octeon.c index 2a5bb849b10e..288b58b00dc8 100644 --- a/arch/mips/pci/msi-octeon.c +++ b/arch/mips/pci/msi-octeon.c | |||
| @@ -369,7 +369,9 @@ int __init octeon_msi_initialize(void) | |||
| 369 | int irq; | 369 | int irq; |
| 370 | struct irq_chip *msi; | 370 | struct irq_chip *msi; |
| 371 | 371 | ||
| 372 | if (octeon_dma_bar_type == OCTEON_DMA_BAR_TYPE_PCIE) { | 372 | if (octeon_dma_bar_type == OCTEON_DMA_BAR_TYPE_INVALID) { |
| 373 | return 0; | ||
| 374 | } else if (octeon_dma_bar_type == OCTEON_DMA_BAR_TYPE_PCIE) { | ||
| 373 | msi_rcv_reg[0] = CVMX_PEXP_NPEI_MSI_RCV0; | 375 | msi_rcv_reg[0] = CVMX_PEXP_NPEI_MSI_RCV0; |
| 374 | msi_rcv_reg[1] = CVMX_PEXP_NPEI_MSI_RCV1; | 376 | msi_rcv_reg[1] = CVMX_PEXP_NPEI_MSI_RCV1; |
| 375 | msi_rcv_reg[2] = CVMX_PEXP_NPEI_MSI_RCV2; | 377 | msi_rcv_reg[2] = CVMX_PEXP_NPEI_MSI_RCV2; |
diff --git a/arch/mips/pci/pci-octeon.c b/arch/mips/pci/pci-octeon.c index 5017d5843c5a..fc29b85cfa92 100644 --- a/arch/mips/pci/pci-octeon.c +++ b/arch/mips/pci/pci-octeon.c | |||
| @@ -568,6 +568,11 @@ static int __init octeon_pci_setup(void) | |||
| 568 | if (octeon_has_feature(OCTEON_FEATURE_PCIE)) | 568 | if (octeon_has_feature(OCTEON_FEATURE_PCIE)) |
| 569 | return 0; | 569 | return 0; |
| 570 | 570 | ||
| 571 | if (!octeon_is_pci_host()) { | ||
| 572 | pr_notice("Not in host mode, PCI Controller not initialized\n"); | ||
| 573 | return 0; | ||
| 574 | } | ||
| 575 | |||
| 571 | /* Point pcibios_map_irq() to the PCI version of it */ | 576 | /* Point pcibios_map_irq() to the PCI version of it */ |
| 572 | octeon_pcibios_map_irq = octeon_pci_pcibios_map_irq; | 577 | octeon_pcibios_map_irq = octeon_pci_pcibios_map_irq; |
| 573 | 578 | ||
| @@ -579,11 +584,6 @@ static int __init octeon_pci_setup(void) | |||
| 579 | else | 584 | else |
| 580 | octeon_dma_bar_type = OCTEON_DMA_BAR_TYPE_BIG; | 585 | octeon_dma_bar_type = OCTEON_DMA_BAR_TYPE_BIG; |
| 581 | 586 | ||
| 582 | if (!octeon_is_pci_host()) { | ||
| 583 | pr_notice("Not in host mode, PCI Controller not initialized\n"); | ||
| 584 | return 0; | ||
| 585 | } | ||
| 586 | |||
| 587 | /* PCI I/O and PCI MEM values */ | 587 | /* PCI I/O and PCI MEM values */ |
| 588 | set_io_port_base(OCTEON_PCI_IOSPACE_BASE); | 588 | set_io_port_base(OCTEON_PCI_IOSPACE_BASE); |
| 589 | ioport_resource.start = 0; | 589 | ioport_resource.start = 0; |
diff --git a/arch/mips/vdso/Makefile b/arch/mips/vdso/Makefile index f6fd340e39c2..0ede4deb8181 100644 --- a/arch/mips/vdso/Makefile +++ b/arch/mips/vdso/Makefile | |||
| @@ -8,6 +8,7 @@ ccflags-vdso := \ | |||
| 8 | $(filter -E%,$(KBUILD_CFLAGS)) \ | 8 | $(filter -E%,$(KBUILD_CFLAGS)) \ |
| 9 | $(filter -mmicromips,$(KBUILD_CFLAGS)) \ | 9 | $(filter -mmicromips,$(KBUILD_CFLAGS)) \ |
| 10 | $(filter -march=%,$(KBUILD_CFLAGS)) \ | 10 | $(filter -march=%,$(KBUILD_CFLAGS)) \ |
| 11 | $(filter -m%-float,$(KBUILD_CFLAGS)) \ | ||
| 11 | -D__VDSO__ | 12 | -D__VDSO__ |
| 12 | 13 | ||
| 13 | ifdef CONFIG_CC_IS_CLANG | 14 | ifdef CONFIG_CC_IS_CLANG |
| @@ -129,7 +130,7 @@ $(obj)/%-o32.o: $(src)/%.c FORCE | |||
| 129 | $(call cmd,force_checksrc) | 130 | $(call cmd,force_checksrc) |
| 130 | $(call if_changed_rule,cc_o_c) | 131 | $(call if_changed_rule,cc_o_c) |
| 131 | 132 | ||
| 132 | $(obj)/vdso-o32.lds: KBUILD_CPPFLAGS := -mabi=32 | 133 | $(obj)/vdso-o32.lds: KBUILD_CPPFLAGS := $(ccflags-vdso) -mabi=32 |
| 133 | $(obj)/vdso-o32.lds: $(src)/vdso.lds.S FORCE | 134 | $(obj)/vdso-o32.lds: $(src)/vdso.lds.S FORCE |
| 134 | $(call if_changed_dep,cpp_lds_S) | 135 | $(call if_changed_dep,cpp_lds_S) |
| 135 | 136 | ||
| @@ -169,7 +170,7 @@ $(obj)/%-n32.o: $(src)/%.c FORCE | |||
| 169 | $(call cmd,force_checksrc) | 170 | $(call cmd,force_checksrc) |
| 170 | $(call if_changed_rule,cc_o_c) | 171 | $(call if_changed_rule,cc_o_c) |
| 171 | 172 | ||
| 172 | $(obj)/vdso-n32.lds: KBUILD_CPPFLAGS := -mabi=n32 | 173 | $(obj)/vdso-n32.lds: KBUILD_CPPFLAGS := $(ccflags-vdso) -mabi=n32 |
| 173 | $(obj)/vdso-n32.lds: $(src)/vdso.lds.S FORCE | 174 | $(obj)/vdso-n32.lds: $(src)/vdso.lds.S FORCE |
| 174 | $(call if_changed_dep,cpp_lds_S) | 175 | $(call if_changed_dep,cpp_lds_S) |
| 175 | 176 | ||
diff --git a/arch/nds32/Makefile b/arch/nds32/Makefile index 0a935c136ec2..ac3482882cf9 100644 --- a/arch/nds32/Makefile +++ b/arch/nds32/Makefile | |||
| @@ -3,9 +3,6 @@ OBJCOPYFLAGS := -O binary -R .note -R .note.gnu.build-id -R .comment -S | |||
| 3 | 3 | ||
| 4 | KBUILD_DEFCONFIG := defconfig | 4 | KBUILD_DEFCONFIG := defconfig |
| 5 | 5 | ||
| 6 | comma = , | ||
| 7 | |||
| 8 | |||
| 9 | ifdef CONFIG_FUNCTION_TRACER | 6 | ifdef CONFIG_FUNCTION_TRACER |
| 10 | arch-y += -malways-save-lp -mno-relax | 7 | arch-y += -malways-save-lp -mno-relax |
| 11 | endif | 8 | endif |
| @@ -54,8 +51,6 @@ endif | |||
| 54 | boot := arch/nds32/boot | 51 | boot := arch/nds32/boot |
| 55 | core-y += $(boot)/dts/ | 52 | core-y += $(boot)/dts/ |
| 56 | 53 | ||
| 57 | .PHONY: FORCE | ||
| 58 | |||
| 59 | Image: vmlinux | 54 | Image: vmlinux |
| 60 | $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ | 55 | $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ |
| 61 | 56 | ||
| @@ -68,9 +63,6 @@ prepare: vdso_prepare | |||
| 68 | vdso_prepare: prepare0 | 63 | vdso_prepare: prepare0 |
| 69 | $(Q)$(MAKE) $(build)=arch/nds32/kernel/vdso include/generated/vdso-offsets.h | 64 | $(Q)$(MAKE) $(build)=arch/nds32/kernel/vdso include/generated/vdso-offsets.h |
| 70 | 65 | ||
| 71 | CLEAN_FILES += include/asm-nds32/constants.h* | ||
| 72 | |||
| 73 | # We use MRPROPER_FILES and CLEAN_FILES now | ||
| 74 | archclean: | 66 | archclean: |
| 75 | $(Q)$(MAKE) $(clean)=$(boot) | 67 | $(Q)$(MAKE) $(clean)=$(boot) |
| 76 | 68 | ||
diff --git a/arch/openrisc/Makefile b/arch/openrisc/Makefile index 70e06d34006c..bf10141c7426 100644 --- a/arch/openrisc/Makefile +++ b/arch/openrisc/Makefile | |||
| @@ -20,7 +20,6 @@ | |||
| 20 | KBUILD_DEFCONFIG := or1ksim_defconfig | 20 | KBUILD_DEFCONFIG := or1ksim_defconfig |
| 21 | 21 | ||
| 22 | OBJCOPYFLAGS := -O binary -R .note -R .comment -S | 22 | OBJCOPYFLAGS := -O binary -R .note -R .comment -S |
| 23 | LDFLAGS_vmlinux := | ||
| 24 | LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) | 23 | LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) |
| 25 | 24 | ||
| 26 | KBUILD_CFLAGS += -pipe -ffixed-r10 -D__linux__ | 25 | KBUILD_CFLAGS += -pipe -ffixed-r10 -D__linux__ |
| @@ -50,5 +49,3 @@ else | |||
| 50 | BUILTIN_DTB := n | 49 | BUILTIN_DTB := n |
| 51 | endif | 50 | endif |
| 52 | core-$(BUILTIN_DTB) += arch/openrisc/boot/dts/ | 51 | core-$(BUILTIN_DTB) += arch/openrisc/boot/dts/ |
| 53 | |||
| 54 | all: vmlinux | ||
diff --git a/arch/openrisc/include/asm/Kbuild b/arch/openrisc/include/asm/Kbuild index eb87cd8327c8..1f04844b6b82 100644 --- a/arch/openrisc/include/asm/Kbuild +++ b/arch/openrisc/include/asm/Kbuild | |||
| @@ -34,6 +34,7 @@ generic-y += qrwlock_types.h | |||
| 34 | generic-y += qrwlock.h | 34 | generic-y += qrwlock.h |
| 35 | generic-y += sections.h | 35 | generic-y += sections.h |
| 36 | generic-y += segment.h | 36 | generic-y += segment.h |
| 37 | generic-y += shmparam.h | ||
| 37 | generic-y += string.h | 38 | generic-y += string.h |
| 38 | generic-y += switch_to.h | 39 | generic-y += switch_to.h |
| 39 | generic-y += topology.h | 40 | generic-y += topology.h |
diff --git a/arch/openrisc/include/asm/uaccess.h b/arch/openrisc/include/asm/uaccess.h index bc8191a34db7..a44682c8adc3 100644 --- a/arch/openrisc/include/asm/uaccess.h +++ b/arch/openrisc/include/asm/uaccess.h | |||
| @@ -58,8 +58,12 @@ | |||
| 58 | /* Ensure that addr is below task's addr_limit */ | 58 | /* Ensure that addr is below task's addr_limit */ |
| 59 | #define __addr_ok(addr) ((unsigned long) addr < get_fs()) | 59 | #define __addr_ok(addr) ((unsigned long) addr < get_fs()) |
| 60 | 60 | ||
| 61 | #define access_ok(addr, size) \ | 61 | #define access_ok(addr, size) \ |
| 62 | __range_ok((unsigned long)addr, (unsigned long)size) | 62 | ({ \ |
| 63 | unsigned long __ao_addr = (unsigned long)(addr); \ | ||
| 64 | unsigned long __ao_size = (unsigned long)(size); \ | ||
| 65 | __range_ok(__ao_addr, __ao_size); \ | ||
| 66 | }) | ||
| 63 | 67 | ||
| 64 | /* | 68 | /* |
| 65 | * These are the main single-value transfer routines. They automatically | 69 | * These are the main single-value transfer routines. They automatically |
diff --git a/arch/parisc/kernel/ptrace.c b/arch/parisc/kernel/ptrace.c index 2582df1c529b..0964c236e3e5 100644 --- a/arch/parisc/kernel/ptrace.c +++ b/arch/parisc/kernel/ptrace.c | |||
| @@ -308,15 +308,29 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request, | |||
| 308 | 308 | ||
| 309 | long do_syscall_trace_enter(struct pt_regs *regs) | 309 | long do_syscall_trace_enter(struct pt_regs *regs) |
| 310 | { | 310 | { |
| 311 | if (test_thread_flag(TIF_SYSCALL_TRACE) && | 311 | if (test_thread_flag(TIF_SYSCALL_TRACE)) { |
| 312 | tracehook_report_syscall_entry(regs)) { | 312 | int rc = tracehook_report_syscall_entry(regs); |
| 313 | |||
| 313 | /* | 314 | /* |
| 314 | * Tracing decided this syscall should not happen or the | 315 | * As tracesys_next does not set %r28 to -ENOSYS |
| 315 | * debugger stored an invalid system call number. Skip | 316 | * when %r20 is set to -1, initialize it here. |
| 316 | * the system call and the system call restart handling. | ||
| 317 | */ | 317 | */ |
| 318 | regs->gr[20] = -1UL; | 318 | regs->gr[28] = -ENOSYS; |
| 319 | goto out; | 319 | |
| 320 | if (rc) { | ||
| 321 | /* | ||
| 322 | * A nonzero return code from | ||
| 323 | * tracehook_report_syscall_entry() tells us | ||
| 324 | * to prevent the syscall execution. Skip | ||
| 325 | * the syscall call and the syscall restart handling. | ||
| 326 | * | ||
| 327 | * Note that the tracer may also just change | ||
| 328 | * regs->gr[20] to an invalid syscall number, | ||
| 329 | * that is handled by tracesys_next. | ||
| 330 | */ | ||
| 331 | regs->gr[20] = -1UL; | ||
| 332 | return -1; | ||
| 333 | } | ||
| 320 | } | 334 | } |
| 321 | 335 | ||
| 322 | /* Do the secure computing check after ptrace. */ | 336 | /* Do the secure computing check after ptrace. */ |
| @@ -340,7 +354,6 @@ long do_syscall_trace_enter(struct pt_regs *regs) | |||
| 340 | regs->gr[24] & 0xffffffff, | 354 | regs->gr[24] & 0xffffffff, |
| 341 | regs->gr[23] & 0xffffffff); | 355 | regs->gr[23] & 0xffffffff); |
| 342 | 356 | ||
| 343 | out: | ||
| 344 | /* | 357 | /* |
| 345 | * Sign extend the syscall number to 64bit since it may have been | 358 | * Sign extend the syscall number to 64bit since it may have been |
| 346 | * modified by a compat ptrace call | 359 | * modified by a compat ptrace call |
diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h index 2e6ada28da64..d8c8d7c9df15 100644 --- a/arch/powerpc/include/asm/book3s/64/pgtable.h +++ b/arch/powerpc/include/asm/book3s/64/pgtable.h | |||
| @@ -904,7 +904,7 @@ static inline int pud_none(pud_t pud) | |||
| 904 | 904 | ||
| 905 | static inline int pud_present(pud_t pud) | 905 | static inline int pud_present(pud_t pud) |
| 906 | { | 906 | { |
| 907 | return (pud_raw(pud) & cpu_to_be64(_PAGE_PRESENT)); | 907 | return !!(pud_raw(pud) & cpu_to_be64(_PAGE_PRESENT)); |
| 908 | } | 908 | } |
| 909 | 909 | ||
| 910 | extern struct page *pud_page(pud_t pud); | 910 | extern struct page *pud_page(pud_t pud); |
| @@ -951,7 +951,7 @@ static inline int pgd_none(pgd_t pgd) | |||
| 951 | 951 | ||
| 952 | static inline int pgd_present(pgd_t pgd) | 952 | static inline int pgd_present(pgd_t pgd) |
| 953 | { | 953 | { |
| 954 | return (pgd_raw(pgd) & cpu_to_be64(_PAGE_PRESENT)); | 954 | return !!(pgd_raw(pgd) & cpu_to_be64(_PAGE_PRESENT)); |
| 955 | } | 955 | } |
| 956 | 956 | ||
| 957 | static inline pte_t pgd_pte(pgd_t pgd) | 957 | static inline pte_t pgd_pte(pgd_t pgd) |
| @@ -1258,21 +1258,13 @@ extern pmd_t pmdp_invalidate(struct vm_area_struct *vma, unsigned long address, | |||
| 1258 | 1258 | ||
| 1259 | #define pmd_move_must_withdraw pmd_move_must_withdraw | 1259 | #define pmd_move_must_withdraw pmd_move_must_withdraw |
| 1260 | struct spinlock; | 1260 | struct spinlock; |
| 1261 | static inline int pmd_move_must_withdraw(struct spinlock *new_pmd_ptl, | 1261 | extern int pmd_move_must_withdraw(struct spinlock *new_pmd_ptl, |
| 1262 | struct spinlock *old_pmd_ptl, | 1262 | struct spinlock *old_pmd_ptl, |
| 1263 | struct vm_area_struct *vma) | 1263 | struct vm_area_struct *vma); |
| 1264 | { | 1264 | /* |
| 1265 | if (radix_enabled()) | 1265 | * Hash translation mode use the deposited table to store hash pte |
| 1266 | return false; | 1266 | * slot information. |
| 1267 | /* | 1267 | */ |
| 1268 | * Archs like ppc64 use pgtable to store per pmd | ||
| 1269 | * specific information. So when we switch the pmd, | ||
| 1270 | * we should also withdraw and deposit the pgtable | ||
| 1271 | */ | ||
| 1272 | return true; | ||
| 1273 | } | ||
| 1274 | |||
| 1275 | |||
| 1276 | #define arch_needs_pgtable_deposit arch_needs_pgtable_deposit | 1268 | #define arch_needs_pgtable_deposit arch_needs_pgtable_deposit |
| 1277 | static inline bool arch_needs_pgtable_deposit(void) | 1269 | static inline bool arch_needs_pgtable_deposit(void) |
| 1278 | { | 1270 | { |
diff --git a/arch/powerpc/include/uapi/asm/perf_regs.h b/arch/powerpc/include/uapi/asm/perf_regs.h index ff91192407d1..f599064dd8dc 100644 --- a/arch/powerpc/include/uapi/asm/perf_regs.h +++ b/arch/powerpc/include/uapi/asm/perf_regs.h | |||
| @@ -47,6 +47,7 @@ enum perf_event_powerpc_regs { | |||
| 47 | PERF_REG_POWERPC_DAR, | 47 | PERF_REG_POWERPC_DAR, |
| 48 | PERF_REG_POWERPC_DSISR, | 48 | PERF_REG_POWERPC_DSISR, |
| 49 | PERF_REG_POWERPC_SIER, | 49 | PERF_REG_POWERPC_SIER, |
| 50 | PERF_REG_POWERPC_MMCRA, | ||
| 50 | PERF_REG_POWERPC_MAX, | 51 | PERF_REG_POWERPC_MAX, |
| 51 | }; | 52 | }; |
| 52 | #endif /* _UAPI_ASM_POWERPC_PERF_REGS_H */ | 53 | #endif /* _UAPI_ASM_POWERPC_PERF_REGS_H */ |
diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S index 57deb1e9ffea..20cc816b3508 100644 --- a/arch/powerpc/kernel/head_8xx.S +++ b/arch/powerpc/kernel/head_8xx.S | |||
| @@ -852,11 +852,12 @@ start_here: | |||
| 852 | 852 | ||
| 853 | /* set up the PTE pointers for the Abatron bdiGDB. | 853 | /* set up the PTE pointers for the Abatron bdiGDB. |
| 854 | */ | 854 | */ |
| 855 | tovirt(r6,r6) | ||
| 856 | lis r5, abatron_pteptrs@h | 855 | lis r5, abatron_pteptrs@h |
| 857 | ori r5, r5, abatron_pteptrs@l | 856 | ori r5, r5, abatron_pteptrs@l |
| 858 | stw r5, 0xf0(0) /* Must match your Abatron config file */ | 857 | stw r5, 0xf0(0) /* Must match your Abatron config file */ |
| 859 | tophys(r5,r5) | 858 | tophys(r5,r5) |
| 859 | lis r6, swapper_pg_dir@h | ||
| 860 | ori r6, r6, swapper_pg_dir@l | ||
| 860 | stw r6, 0(r5) | 861 | stw r6, 0(r5) |
| 861 | 862 | ||
| 862 | /* Now turn on the MMU for real! */ | 863 | /* Now turn on the MMU for real! */ |
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c index bd5e6834ca69..6794466f6420 100644 --- a/arch/powerpc/kernel/signal_64.c +++ b/arch/powerpc/kernel/signal_64.c | |||
| @@ -755,11 +755,12 @@ SYSCALL_DEFINE0(rt_sigreturn) | |||
| 755 | if (restore_tm_sigcontexts(current, &uc->uc_mcontext, | 755 | if (restore_tm_sigcontexts(current, &uc->uc_mcontext, |
| 756 | &uc_transact->uc_mcontext)) | 756 | &uc_transact->uc_mcontext)) |
| 757 | goto badframe; | 757 | goto badframe; |
| 758 | } | 758 | } else |
| 759 | #endif | 759 | #endif |
| 760 | /* Fall through, for non-TM restore */ | 760 | { |
| 761 | if (!MSR_TM_ACTIVE(msr)) { | ||
| 762 | /* | 761 | /* |
| 762 | * Fall through, for non-TM restore | ||
| 763 | * | ||
| 763 | * Unset MSR[TS] on the thread regs since MSR from user | 764 | * Unset MSR[TS] on the thread regs since MSR from user |
| 764 | * context does not have MSR active, and recheckpoint was | 765 | * context does not have MSR active, and recheckpoint was |
| 765 | * not called since restore_tm_sigcontexts() was not called | 766 | * not called since restore_tm_sigcontexts() was not called |
diff --git a/arch/powerpc/kernel/trace/ftrace.c b/arch/powerpc/kernel/trace/ftrace.c index 29746dc28df5..517662a56bdc 100644 --- a/arch/powerpc/kernel/trace/ftrace.c +++ b/arch/powerpc/kernel/trace/ftrace.c | |||
| @@ -967,13 +967,6 @@ out: | |||
| 967 | } | 967 | } |
| 968 | #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ | 968 | #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ |
| 969 | 969 | ||
| 970 | #if defined(CONFIG_FTRACE_SYSCALLS) && defined(CONFIG_PPC64) | ||
| 971 | unsigned long __init arch_syscall_addr(int nr) | ||
| 972 | { | ||
| 973 | return sys_call_table[nr*2]; | ||
| 974 | } | ||
| 975 | #endif /* CONFIG_FTRACE_SYSCALLS && CONFIG_PPC64 */ | ||
| 976 | |||
| 977 | #ifdef PPC64_ELF_ABI_v1 | 970 | #ifdef PPC64_ELF_ABI_v1 |
| 978 | char *arch_ftrace_match_adjust(char *str, const char *search) | 971 | char *arch_ftrace_match_adjust(char *str, const char *search) |
| 979 | { | 972 | { |
diff --git a/arch/powerpc/mm/pgtable-book3s64.c b/arch/powerpc/mm/pgtable-book3s64.c index f3c31f5e1026..ecd31569a120 100644 --- a/arch/powerpc/mm/pgtable-book3s64.c +++ b/arch/powerpc/mm/pgtable-book3s64.c | |||
| @@ -400,3 +400,25 @@ void arch_report_meminfo(struct seq_file *m) | |||
| 400 | atomic_long_read(&direct_pages_count[MMU_PAGE_1G]) << 20); | 400 | atomic_long_read(&direct_pages_count[MMU_PAGE_1G]) << 20); |
| 401 | } | 401 | } |
| 402 | #endif /* CONFIG_PROC_FS */ | 402 | #endif /* CONFIG_PROC_FS */ |
| 403 | |||
| 404 | /* | ||
| 405 | * For hash translation mode, we use the deposited table to store hash slot | ||
| 406 | * information and they are stored at PTRS_PER_PMD offset from related pmd | ||
| 407 | * location. Hence a pmd move requires deposit and withdraw. | ||
| 408 | * | ||
| 409 | * For radix translation with split pmd ptl, we store the deposited table in the | ||
| 410 | * pmd page. Hence if we have different pmd page we need to withdraw during pmd | ||
| 411 | * move. | ||
| 412 | * | ||
| 413 | * With hash we use deposited table always irrespective of anon or not. | ||
| 414 | * With radix we use deposited table only for anonymous mapping. | ||
| 415 | */ | ||
| 416 | int pmd_move_must_withdraw(struct spinlock *new_pmd_ptl, | ||
| 417 | struct spinlock *old_pmd_ptl, | ||
| 418 | struct vm_area_struct *vma) | ||
| 419 | { | ||
| 420 | if (radix_enabled()) | ||
| 421 | return (new_pmd_ptl != old_pmd_ptl) && vma_is_anonymous(vma); | ||
| 422 | |||
| 423 | return true; | ||
| 424 | } | ||
diff --git a/arch/powerpc/perf/perf_regs.c b/arch/powerpc/perf/perf_regs.c index 5c36b3a8d47a..3349f3f8fe84 100644 --- a/arch/powerpc/perf/perf_regs.c +++ b/arch/powerpc/perf/perf_regs.c | |||
| @@ -70,6 +70,7 @@ static unsigned int pt_regs_offset[PERF_REG_POWERPC_MAX] = { | |||
| 70 | PT_REGS_OFFSET(PERF_REG_POWERPC_DAR, dar), | 70 | PT_REGS_OFFSET(PERF_REG_POWERPC_DAR, dar), |
| 71 | PT_REGS_OFFSET(PERF_REG_POWERPC_DSISR, dsisr), | 71 | PT_REGS_OFFSET(PERF_REG_POWERPC_DSISR, dsisr), |
| 72 | PT_REGS_OFFSET(PERF_REG_POWERPC_SIER, dar), | 72 | PT_REGS_OFFSET(PERF_REG_POWERPC_SIER, dar), |
| 73 | PT_REGS_OFFSET(PERF_REG_POWERPC_MMCRA, dsisr), | ||
| 73 | }; | 74 | }; |
| 74 | 75 | ||
| 75 | u64 perf_reg_value(struct pt_regs *regs, int idx) | 76 | u64 perf_reg_value(struct pt_regs *regs, int idx) |
| @@ -83,6 +84,11 @@ u64 perf_reg_value(struct pt_regs *regs, int idx) | |||
| 83 | !is_sier_available())) | 84 | !is_sier_available())) |
| 84 | return 0; | 85 | return 0; |
| 85 | 86 | ||
| 87 | if (idx == PERF_REG_POWERPC_MMCRA && | ||
| 88 | (IS_ENABLED(CONFIG_FSL_EMB_PERF_EVENT) || | ||
| 89 | IS_ENABLED(CONFIG_PPC32))) | ||
| 90 | return 0; | ||
| 91 | |||
| 86 | return regs_get_register(regs, pt_regs_offset[idx]); | 92 | return regs_get_register(regs, pt_regs_offset[idx]); |
| 87 | } | 93 | } |
| 88 | 94 | ||
diff --git a/arch/powerpc/platforms/4xx/ocm.c b/arch/powerpc/platforms/4xx/ocm.c index a1aaa1569d7c..f0e488d97567 100644 --- a/arch/powerpc/platforms/4xx/ocm.c +++ b/arch/powerpc/platforms/4xx/ocm.c | |||
| @@ -237,12 +237,12 @@ static int ocm_debugfs_show(struct seq_file *m, void *v) | |||
| 237 | continue; | 237 | continue; |
| 238 | 238 | ||
| 239 | seq_printf(m, "PPC4XX OCM : %d\n", ocm->index); | 239 | seq_printf(m, "PPC4XX OCM : %d\n", ocm->index); |
| 240 | seq_printf(m, "PhysAddr : %pa[p]\n", &(ocm->phys)); | 240 | seq_printf(m, "PhysAddr : %pa\n", &(ocm->phys)); |
| 241 | seq_printf(m, "MemTotal : %d Bytes\n", ocm->memtotal); | 241 | seq_printf(m, "MemTotal : %d Bytes\n", ocm->memtotal); |
| 242 | seq_printf(m, "MemTotal(NC) : %d Bytes\n", ocm->nc.memtotal); | 242 | seq_printf(m, "MemTotal(NC) : %d Bytes\n", ocm->nc.memtotal); |
| 243 | seq_printf(m, "MemTotal(C) : %d Bytes\n\n", ocm->c.memtotal); | 243 | seq_printf(m, "MemTotal(C) : %d Bytes\n\n", ocm->c.memtotal); |
| 244 | 244 | ||
| 245 | seq_printf(m, "NC.PhysAddr : %pa[p]\n", &(ocm->nc.phys)); | 245 | seq_printf(m, "NC.PhysAddr : %pa\n", &(ocm->nc.phys)); |
| 246 | seq_printf(m, "NC.VirtAddr : 0x%p\n", ocm->nc.virt); | 246 | seq_printf(m, "NC.VirtAddr : 0x%p\n", ocm->nc.virt); |
| 247 | seq_printf(m, "NC.MemTotal : %d Bytes\n", ocm->nc.memtotal); | 247 | seq_printf(m, "NC.MemTotal : %d Bytes\n", ocm->nc.memtotal); |
| 248 | seq_printf(m, "NC.MemFree : %d Bytes\n", ocm->nc.memfree); | 248 | seq_printf(m, "NC.MemFree : %d Bytes\n", ocm->nc.memfree); |
| @@ -252,7 +252,7 @@ static int ocm_debugfs_show(struct seq_file *m, void *v) | |||
| 252 | blk->size, blk->owner); | 252 | blk->size, blk->owner); |
| 253 | } | 253 | } |
| 254 | 254 | ||
| 255 | seq_printf(m, "\nC.PhysAddr : %pa[p]\n", &(ocm->c.phys)); | 255 | seq_printf(m, "\nC.PhysAddr : %pa\n", &(ocm->c.phys)); |
| 256 | seq_printf(m, "C.VirtAddr : 0x%p\n", ocm->c.virt); | 256 | seq_printf(m, "C.VirtAddr : 0x%p\n", ocm->c.virt); |
| 257 | seq_printf(m, "C.MemTotal : %d Bytes\n", ocm->c.memtotal); | 257 | seq_printf(m, "C.MemTotal : %d Bytes\n", ocm->c.memtotal); |
| 258 | seq_printf(m, "C.MemFree : %d Bytes\n", ocm->c.memfree); | 258 | seq_printf(m, "C.MemFree : %d Bytes\n", ocm->c.memfree); |
diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c index e66644e0fb40..9438fa0fc355 100644 --- a/arch/powerpc/platforms/chrp/setup.c +++ b/arch/powerpc/platforms/chrp/setup.c | |||
| @@ -538,8 +538,7 @@ static void __init chrp_init_IRQ(void) | |||
| 538 | /* see if there is a keyboard in the device tree | 538 | /* see if there is a keyboard in the device tree |
| 539 | with a parent of type "adb" */ | 539 | with a parent of type "adb" */ |
| 540 | for_each_node_by_name(kbd, "keyboard") | 540 | for_each_node_by_name(kbd, "keyboard") |
| 541 | if (kbd->parent && kbd->parent->type | 541 | if (of_node_is_type(kbd->parent, "adb")) |
| 542 | && strcmp(kbd->parent->type, "adb") == 0) | ||
| 543 | break; | 542 | break; |
| 544 | of_node_put(kbd); | 543 | of_node_put(kbd); |
| 545 | if (kbd) | 544 | if (kbd) |
diff --git a/arch/powerpc/platforms/pasemi/dma_lib.c b/arch/powerpc/platforms/pasemi/dma_lib.c index d18d16489a15..bdf9b716e848 100644 --- a/arch/powerpc/platforms/pasemi/dma_lib.c +++ b/arch/powerpc/platforms/pasemi/dma_lib.c | |||
| @@ -255,7 +255,7 @@ int pasemi_dma_alloc_ring(struct pasemi_dmachan *chan, int ring_size) | |||
| 255 | 255 | ||
| 256 | chan->ring_size = ring_size; | 256 | chan->ring_size = ring_size; |
| 257 | 257 | ||
| 258 | chan->ring_virt = dma_zalloc_coherent(&dma_pdev->dev, | 258 | chan->ring_virt = dma_alloc_coherent(&dma_pdev->dev, |
| 259 | ring_size * sizeof(u64), | 259 | ring_size * sizeof(u64), |
| 260 | &chan->ring_dma, GFP_KERNEL); | 260 | &chan->ring_dma, GFP_KERNEL); |
| 261 | 261 | ||
diff --git a/arch/powerpc/platforms/powernv/npu-dma.c b/arch/powerpc/platforms/powernv/npu-dma.c index d7f742ed48ba..3f58c7dbd581 100644 --- a/arch/powerpc/platforms/powernv/npu-dma.c +++ b/arch/powerpc/platforms/powernv/npu-dma.c | |||
| @@ -564,7 +564,7 @@ struct iommu_table_group *pnv_try_setup_npu_table_group(struct pnv_ioda_pe *pe) | |||
| 564 | } | 564 | } |
| 565 | } else { | 565 | } else { |
| 566 | /* Create a group for 1 GPU and attached NPUs for POWER8 */ | 566 | /* Create a group for 1 GPU and attached NPUs for POWER8 */ |
| 567 | pe->npucomp = kzalloc(sizeof(pe->npucomp), GFP_KERNEL); | 567 | pe->npucomp = kzalloc(sizeof(*pe->npucomp), GFP_KERNEL); |
| 568 | table_group = &pe->npucomp->table_group; | 568 | table_group = &pe->npucomp->table_group; |
| 569 | table_group->ops = &pnv_npu_peers_ops; | 569 | table_group->ops = &pnv_npu_peers_ops; |
| 570 | iommu_register_group(table_group, hose->global_number, | 570 | iommu_register_group(table_group, hose->global_number, |
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index 1d6406a051f1..145373f0e5dc 100644 --- a/arch/powerpc/platforms/powernv/pci-ioda.c +++ b/arch/powerpc/platforms/powernv/pci-ioda.c | |||
| @@ -1593,6 +1593,8 @@ static void pnv_ioda_setup_vf_PE(struct pci_dev *pdev, u16 num_vfs) | |||
| 1593 | 1593 | ||
| 1594 | pnv_pci_ioda2_setup_dma_pe(phb, pe); | 1594 | pnv_pci_ioda2_setup_dma_pe(phb, pe); |
| 1595 | #ifdef CONFIG_IOMMU_API | 1595 | #ifdef CONFIG_IOMMU_API |
| 1596 | iommu_register_group(&pe->table_group, | ||
| 1597 | pe->phb->hose->global_number, pe->pe_number); | ||
| 1596 | pnv_ioda_setup_bus_iommu_group(pe, &pe->table_group, NULL); | 1598 | pnv_ioda_setup_bus_iommu_group(pe, &pe->table_group, NULL); |
| 1597 | #endif | 1599 | #endif |
| 1598 | } | 1600 | } |
| @@ -2681,7 +2683,8 @@ static void pnv_pci_ioda_setup_iommu_api(void) | |||
| 2681 | list_for_each_entry(hose, &hose_list, list_node) { | 2683 | list_for_each_entry(hose, &hose_list, list_node) { |
| 2682 | phb = hose->private_data; | 2684 | phb = hose->private_data; |
| 2683 | 2685 | ||
| 2684 | if (phb->type == PNV_PHB_NPU_NVLINK) | 2686 | if (phb->type == PNV_PHB_NPU_NVLINK || |
| 2687 | phb->type == PNV_PHB_NPU_OCAPI) | ||
| 2685 | continue; | 2688 | continue; |
| 2686 | 2689 | ||
| 2687 | list_for_each_entry(pe, &phb->ioda.pe_list, list) { | 2690 | list_for_each_entry(pe, &phb->ioda.pe_list, list) { |
diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c index 45fb70b4bfa7..ef9448a907c6 100644 --- a/arch/powerpc/platforms/powernv/pci.c +++ b/arch/powerpc/platforms/powernv/pci.c | |||
| @@ -1147,6 +1147,8 @@ static int pnv_tce_iommu_bus_notifier(struct notifier_block *nb, | |||
| 1147 | return 0; | 1147 | return 0; |
| 1148 | 1148 | ||
| 1149 | pe = &phb->ioda.pe_array[pdn->pe_number]; | 1149 | pe = &phb->ioda.pe_array[pdn->pe_number]; |
| 1150 | if (!pe->table_group.group) | ||
| 1151 | return 0; | ||
| 1150 | iommu_add_device(&pe->table_group, dev); | 1152 | iommu_add_device(&pe->table_group, dev); |
| 1151 | return 0; | 1153 | return 0; |
| 1152 | case BUS_NOTIFY_DEL_DEVICE: | 1154 | case BUS_NOTIFY_DEL_DEVICE: |
diff --git a/arch/powerpc/platforms/pseries/papr_scm.c b/arch/powerpc/platforms/pseries/papr_scm.c index 7d6457ab5d34..bba281b1fe1b 100644 --- a/arch/powerpc/platforms/pseries/papr_scm.c +++ b/arch/powerpc/platforms/pseries/papr_scm.c | |||
| @@ -43,6 +43,7 @@ static int drc_pmem_bind(struct papr_scm_priv *p) | |||
| 43 | { | 43 | { |
| 44 | unsigned long ret[PLPAR_HCALL_BUFSIZE]; | 44 | unsigned long ret[PLPAR_HCALL_BUFSIZE]; |
| 45 | uint64_t rc, token; | 45 | uint64_t rc, token; |
| 46 | uint64_t saved = 0; | ||
| 46 | 47 | ||
| 47 | /* | 48 | /* |
| 48 | * When the hypervisor cannot map all the requested memory in a single | 49 | * When the hypervisor cannot map all the requested memory in a single |
| @@ -56,6 +57,8 @@ static int drc_pmem_bind(struct papr_scm_priv *p) | |||
| 56 | rc = plpar_hcall(H_SCM_BIND_MEM, ret, p->drc_index, 0, | 57 | rc = plpar_hcall(H_SCM_BIND_MEM, ret, p->drc_index, 0, |
| 57 | p->blocks, BIND_ANY_ADDR, token); | 58 | p->blocks, BIND_ANY_ADDR, token); |
| 58 | token = ret[0]; | 59 | token = ret[0]; |
| 60 | if (!saved) | ||
| 61 | saved = ret[1]; | ||
| 59 | cond_resched(); | 62 | cond_resched(); |
| 60 | } while (rc == H_BUSY); | 63 | } while (rc == H_BUSY); |
| 61 | 64 | ||
| @@ -64,7 +67,7 @@ static int drc_pmem_bind(struct papr_scm_priv *p) | |||
| 64 | return -ENXIO; | 67 | return -ENXIO; |
| 65 | } | 68 | } |
| 66 | 69 | ||
| 67 | p->bound_addr = ret[1]; | 70 | p->bound_addr = saved; |
| 68 | 71 | ||
| 69 | dev_dbg(&p->pdev->dev, "bound drc %x to %pR\n", p->drc_index, &p->res); | 72 | dev_dbg(&p->pdev->dev, "bound drc %x to %pR\n", p->drc_index, &p->res); |
| 70 | 73 | ||
diff --git a/arch/powerpc/platforms/pseries/pci.c b/arch/powerpc/platforms/pseries/pci.c index 7725825d887d..37a77e57893e 100644 --- a/arch/powerpc/platforms/pseries/pci.c +++ b/arch/powerpc/platforms/pseries/pci.c | |||
| @@ -264,7 +264,9 @@ void __init pSeries_final_fixup(void) | |||
| 264 | if (!of_device_is_compatible(nvdn->parent, | 264 | if (!of_device_is_compatible(nvdn->parent, |
| 265 | "ibm,power9-npu")) | 265 | "ibm,power9-npu")) |
| 266 | continue; | 266 | continue; |
| 267 | #ifdef CONFIG_PPC_POWERNV | ||
| 267 | WARN_ON_ONCE(pnv_npu2_init(hose)); | 268 | WARN_ON_ONCE(pnv_npu2_init(hose)); |
| 269 | #endif | ||
| 268 | break; | 270 | break; |
| 269 | } | 271 | } |
| 270 | } | 272 | } |
diff --git a/arch/powerpc/sysdev/fsl_rmu.c b/arch/powerpc/sysdev/fsl_rmu.c index 8b0ebf3940d2..ebed46f80254 100644 --- a/arch/powerpc/sysdev/fsl_rmu.c +++ b/arch/powerpc/sysdev/fsl_rmu.c | |||
| @@ -756,9 +756,10 @@ fsl_open_outb_mbox(struct rio_mport *mport, void *dev_id, int mbox, int entries) | |||
| 756 | } | 756 | } |
| 757 | 757 | ||
| 758 | /* Initialize outbound message descriptor ring */ | 758 | /* Initialize outbound message descriptor ring */ |
| 759 | rmu->msg_tx_ring.virt = dma_zalloc_coherent(priv->dev, | 759 | rmu->msg_tx_ring.virt = dma_alloc_coherent(priv->dev, |
| 760 | rmu->msg_tx_ring.size * RIO_MSG_DESC_SIZE, | 760 | rmu->msg_tx_ring.size * RIO_MSG_DESC_SIZE, |
| 761 | &rmu->msg_tx_ring.phys, GFP_KERNEL); | 761 | &rmu->msg_tx_ring.phys, |
| 762 | GFP_KERNEL); | ||
| 762 | if (!rmu->msg_tx_ring.virt) { | 763 | if (!rmu->msg_tx_ring.virt) { |
| 763 | rc = -ENOMEM; | 764 | rc = -ENOMEM; |
| 764 | goto out_dma; | 765 | goto out_dma; |
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index e0d7d61779a6..515fc3cc9687 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig | |||
| @@ -28,11 +28,13 @@ config RISCV | |||
| 28 | select GENERIC_STRNLEN_USER | 28 | select GENERIC_STRNLEN_USER |
| 29 | select GENERIC_SMP_IDLE_THREAD | 29 | select GENERIC_SMP_IDLE_THREAD |
| 30 | select GENERIC_ATOMIC64 if !64BIT || !RISCV_ISA_A | 30 | select GENERIC_ATOMIC64 if !64BIT || !RISCV_ISA_A |
| 31 | select HAVE_ARCH_AUDITSYSCALL | ||
| 31 | select HAVE_MEMBLOCK_NODE_MAP | 32 | select HAVE_MEMBLOCK_NODE_MAP |
| 32 | select HAVE_DMA_CONTIGUOUS | 33 | select HAVE_DMA_CONTIGUOUS |
| 33 | select HAVE_FUTEX_CMPXCHG if FUTEX | 34 | select HAVE_FUTEX_CMPXCHG if FUTEX |
| 34 | select HAVE_GENERIC_DMA_COHERENT | 35 | select HAVE_GENERIC_DMA_COHERENT |
| 35 | select HAVE_PERF_EVENTS | 36 | select HAVE_PERF_EVENTS |
| 37 | select HAVE_SYSCALL_TRACEPOINTS | ||
| 36 | select IRQ_DOMAIN | 38 | select IRQ_DOMAIN |
| 37 | select RISCV_ISA_A if SMP | 39 | select RISCV_ISA_A if SMP |
| 38 | select SPARSE_IRQ | 40 | select SPARSE_IRQ |
| @@ -40,6 +42,7 @@ config RISCV | |||
| 40 | select HAVE_ARCH_TRACEHOOK | 42 | select HAVE_ARCH_TRACEHOOK |
| 41 | select HAVE_PCI | 43 | select HAVE_PCI |
| 42 | select MODULES_USE_ELF_RELA if MODULES | 44 | select MODULES_USE_ELF_RELA if MODULES |
| 45 | select MODULE_SECTIONS if MODULES | ||
| 43 | select THREAD_INFO_IN_TASK | 46 | select THREAD_INFO_IN_TASK |
| 44 | select PCI_DOMAINS_GENERIC if PCI | 47 | select PCI_DOMAINS_GENERIC if PCI |
| 45 | select PCI_MSI if PCI | 48 | select PCI_MSI if PCI |
| @@ -100,7 +103,7 @@ choice | |||
| 100 | prompt "Base ISA" | 103 | prompt "Base ISA" |
| 101 | default ARCH_RV64I | 104 | default ARCH_RV64I |
| 102 | help | 105 | help |
| 103 | This selects the base ISA that this kernel will traget and must match | 106 | This selects the base ISA that this kernel will target and must match |
| 104 | the target platform. | 107 | the target platform. |
| 105 | 108 | ||
| 106 | config ARCH_RV32I | 109 | config ARCH_RV32I |
| @@ -152,7 +155,6 @@ choice | |||
| 152 | bool "2GiB" | 155 | bool "2GiB" |
| 153 | config MAXPHYSMEM_128GB | 156 | config MAXPHYSMEM_128GB |
| 154 | depends on 64BIT && CMODEL_MEDANY | 157 | depends on 64BIT && CMODEL_MEDANY |
| 155 | select MODULE_SECTIONS if MODULES | ||
| 156 | bool "128GiB" | 158 | bool "128GiB" |
| 157 | endchoice | 159 | endchoice |
| 158 | 160 | ||
diff --git a/arch/riscv/configs/defconfig b/arch/riscv/configs/defconfig index f399659d3b8d..2fd3461e50ab 100644 --- a/arch/riscv/configs/defconfig +++ b/arch/riscv/configs/defconfig | |||
| @@ -13,8 +13,6 @@ CONFIG_BLK_DEV_INITRD=y | |||
| 13 | CONFIG_EXPERT=y | 13 | CONFIG_EXPERT=y |
| 14 | CONFIG_BPF_SYSCALL=y | 14 | CONFIG_BPF_SYSCALL=y |
| 15 | CONFIG_SMP=y | 15 | CONFIG_SMP=y |
| 16 | CONFIG_PCI=y | ||
| 17 | CONFIG_PCIE_XILINX=y | ||
| 18 | CONFIG_MODULES=y | 16 | CONFIG_MODULES=y |
| 19 | CONFIG_MODULE_UNLOAD=y | 17 | CONFIG_MODULE_UNLOAD=y |
| 20 | CONFIG_NET=y | 18 | CONFIG_NET=y |
| @@ -28,6 +26,10 @@ CONFIG_IP_PNP_DHCP=y | |||
| 28 | CONFIG_IP_PNP_BOOTP=y | 26 | CONFIG_IP_PNP_BOOTP=y |
| 29 | CONFIG_IP_PNP_RARP=y | 27 | CONFIG_IP_PNP_RARP=y |
| 30 | CONFIG_NETLINK_DIAG=y | 28 | CONFIG_NETLINK_DIAG=y |
| 29 | CONFIG_PCI=y | ||
| 30 | CONFIG_PCIEPORTBUS=y | ||
| 31 | CONFIG_PCI_HOST_GENERIC=y | ||
| 32 | CONFIG_PCIE_XILINX=y | ||
| 31 | CONFIG_DEVTMPFS=y | 33 | CONFIG_DEVTMPFS=y |
| 32 | CONFIG_BLK_DEV_LOOP=y | 34 | CONFIG_BLK_DEV_LOOP=y |
| 33 | CONFIG_VIRTIO_BLK=y | 35 | CONFIG_VIRTIO_BLK=y |
| @@ -63,7 +65,6 @@ CONFIG_USB_STORAGE=y | |||
| 63 | CONFIG_USB_UAS=y | 65 | CONFIG_USB_UAS=y |
| 64 | CONFIG_VIRTIO_MMIO=y | 66 | CONFIG_VIRTIO_MMIO=y |
| 65 | CONFIG_SIFIVE_PLIC=y | 67 | CONFIG_SIFIVE_PLIC=y |
| 66 | CONFIG_RAS=y | ||
| 67 | CONFIG_EXT4_FS=y | 68 | CONFIG_EXT4_FS=y |
| 68 | CONFIG_EXT4_FS_POSIX_ACL=y | 69 | CONFIG_EXT4_FS_POSIX_ACL=y |
| 69 | CONFIG_AUTOFS4_FS=y | 70 | CONFIG_AUTOFS4_FS=y |
| @@ -77,5 +78,6 @@ CONFIG_NFS_V4_1=y | |||
| 77 | CONFIG_NFS_V4_2=y | 78 | CONFIG_NFS_V4_2=y |
| 78 | CONFIG_ROOT_NFS=y | 79 | CONFIG_ROOT_NFS=y |
| 79 | CONFIG_CRYPTO_USER_API_HASH=y | 80 | CONFIG_CRYPTO_USER_API_HASH=y |
| 81 | CONFIG_CRYPTO_DEV_VIRTIO=y | ||
| 80 | CONFIG_PRINTK_TIME=y | 82 | CONFIG_PRINTK_TIME=y |
| 81 | # CONFIG_RCU_TRACE is not set | 83 | # CONFIG_RCU_TRACE is not set |
diff --git a/arch/riscv/include/asm/module.h b/arch/riscv/include/asm/module.h index cd2af4b013e3..46202dad365d 100644 --- a/arch/riscv/include/asm/module.h +++ b/arch/riscv/include/asm/module.h | |||
| @@ -9,12 +9,12 @@ | |||
| 9 | #define MODULE_ARCH_VERMAGIC "riscv" | 9 | #define MODULE_ARCH_VERMAGIC "riscv" |
| 10 | 10 | ||
| 11 | struct module; | 11 | struct module; |
| 12 | u64 module_emit_got_entry(struct module *mod, u64 val); | 12 | unsigned long module_emit_got_entry(struct module *mod, unsigned long val); |
| 13 | u64 module_emit_plt_entry(struct module *mod, u64 val); | 13 | unsigned long module_emit_plt_entry(struct module *mod, unsigned long val); |
| 14 | 14 | ||
| 15 | #ifdef CONFIG_MODULE_SECTIONS | 15 | #ifdef CONFIG_MODULE_SECTIONS |
| 16 | struct mod_section { | 16 | struct mod_section { |
| 17 | struct elf64_shdr *shdr; | 17 | Elf_Shdr *shdr; |
| 18 | int num_entries; | 18 | int num_entries; |
| 19 | int max_entries; | 19 | int max_entries; |
| 20 | }; | 20 | }; |
| @@ -26,18 +26,18 @@ struct mod_arch_specific { | |||
| 26 | }; | 26 | }; |
| 27 | 27 | ||
| 28 | struct got_entry { | 28 | struct got_entry { |
| 29 | u64 symbol_addr; /* the real variable address */ | 29 | unsigned long symbol_addr; /* the real variable address */ |
| 30 | }; | 30 | }; |
| 31 | 31 | ||
| 32 | static inline struct got_entry emit_got_entry(u64 val) | 32 | static inline struct got_entry emit_got_entry(unsigned long val) |
| 33 | { | 33 | { |
| 34 | return (struct got_entry) {val}; | 34 | return (struct got_entry) {val}; |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | static inline struct got_entry *get_got_entry(u64 val, | 37 | static inline struct got_entry *get_got_entry(unsigned long val, |
| 38 | const struct mod_section *sec) | 38 | const struct mod_section *sec) |
| 39 | { | 39 | { |
| 40 | struct got_entry *got = (struct got_entry *)sec->shdr->sh_addr; | 40 | struct got_entry *got = (struct got_entry *)(sec->shdr->sh_addr); |
| 41 | int i; | 41 | int i; |
| 42 | for (i = 0; i < sec->num_entries; i++) { | 42 | for (i = 0; i < sec->num_entries; i++) { |
| 43 | if (got[i].symbol_addr == val) | 43 | if (got[i].symbol_addr == val) |
| @@ -62,7 +62,9 @@ struct plt_entry { | |||
| 62 | #define REG_T0 0x5 | 62 | #define REG_T0 0x5 |
| 63 | #define REG_T1 0x6 | 63 | #define REG_T1 0x6 |
| 64 | 64 | ||
| 65 | static inline struct plt_entry emit_plt_entry(u64 val, u64 plt, u64 got_plt) | 65 | static inline struct plt_entry emit_plt_entry(unsigned long val, |
| 66 | unsigned long plt, | ||
| 67 | unsigned long got_plt) | ||
| 66 | { | 68 | { |
| 67 | /* | 69 | /* |
| 68 | * U-Type encoding: | 70 | * U-Type encoding: |
| @@ -76,7 +78,7 @@ static inline struct plt_entry emit_plt_entry(u64 val, u64 plt, u64 got_plt) | |||
| 76 | * +------------+------------+--------+----------+----------+ | 78 | * +------------+------------+--------+----------+----------+ |
| 77 | * | 79 | * |
| 78 | */ | 80 | */ |
| 79 | u64 offset = got_plt - plt; | 81 | unsigned long offset = got_plt - plt; |
| 80 | u32 hi20 = (offset + 0x800) & 0xfffff000; | 82 | u32 hi20 = (offset + 0x800) & 0xfffff000; |
| 81 | u32 lo12 = (offset - hi20); | 83 | u32 lo12 = (offset - hi20); |
| 82 | return (struct plt_entry) { | 84 | return (struct plt_entry) { |
| @@ -86,7 +88,7 @@ static inline struct plt_entry emit_plt_entry(u64 val, u64 plt, u64 got_plt) | |||
| 86 | }; | 88 | }; |
| 87 | } | 89 | } |
| 88 | 90 | ||
| 89 | static inline int get_got_plt_idx(u64 val, const struct mod_section *sec) | 91 | static inline int get_got_plt_idx(unsigned long val, const struct mod_section *sec) |
| 90 | { | 92 | { |
| 91 | struct got_entry *got_plt = (struct got_entry *)sec->shdr->sh_addr; | 93 | struct got_entry *got_plt = (struct got_entry *)sec->shdr->sh_addr; |
| 92 | int i; | 94 | int i; |
| @@ -97,9 +99,9 @@ static inline int get_got_plt_idx(u64 val, const struct mod_section *sec) | |||
| 97 | return -1; | 99 | return -1; |
| 98 | } | 100 | } |
| 99 | 101 | ||
| 100 | static inline struct plt_entry *get_plt_entry(u64 val, | 102 | static inline struct plt_entry *get_plt_entry(unsigned long val, |
| 101 | const struct mod_section *sec_plt, | 103 | const struct mod_section *sec_plt, |
| 102 | const struct mod_section *sec_got_plt) | 104 | const struct mod_section *sec_got_plt) |
| 103 | { | 105 | { |
| 104 | struct plt_entry *plt = (struct plt_entry *)sec_plt->shdr->sh_addr; | 106 | struct plt_entry *plt = (struct plt_entry *)sec_plt->shdr->sh_addr; |
| 105 | int got_plt_idx = get_got_plt_idx(val, sec_got_plt); | 107 | int got_plt_idx = get_got_plt_idx(val, sec_got_plt); |
diff --git a/arch/riscv/include/asm/page.h b/arch/riscv/include/asm/page.h index 06cfbb3aacbb..2a546a52f02a 100644 --- a/arch/riscv/include/asm/page.h +++ b/arch/riscv/include/asm/page.h | |||
| @@ -80,7 +80,7 @@ typedef struct page *pgtable_t; | |||
| 80 | #define __pgd(x) ((pgd_t) { (x) }) | 80 | #define __pgd(x) ((pgd_t) { (x) }) |
| 81 | #define __pgprot(x) ((pgprot_t) { (x) }) | 81 | #define __pgprot(x) ((pgprot_t) { (x) }) |
| 82 | 82 | ||
| 83 | #ifdef CONFIG_64BITS | 83 | #ifdef CONFIG_64BIT |
| 84 | #define PTE_FMT "%016lx" | 84 | #define PTE_FMT "%016lx" |
| 85 | #else | 85 | #else |
| 86 | #define PTE_FMT "%08lx" | 86 | #define PTE_FMT "%08lx" |
diff --git a/arch/riscv/include/asm/pgtable-bits.h b/arch/riscv/include/asm/pgtable-bits.h index 2fa2942be221..470755cb7558 100644 --- a/arch/riscv/include/asm/pgtable-bits.h +++ b/arch/riscv/include/asm/pgtable-bits.h | |||
| @@ -35,6 +35,12 @@ | |||
| 35 | #define _PAGE_SPECIAL _PAGE_SOFT | 35 | #define _PAGE_SPECIAL _PAGE_SOFT |
| 36 | #define _PAGE_TABLE _PAGE_PRESENT | 36 | #define _PAGE_TABLE _PAGE_PRESENT |
| 37 | 37 | ||
| 38 | /* | ||
| 39 | * _PAGE_PROT_NONE is set on not-present pages (and ignored by the hardware) to | ||
| 40 | * distinguish them from swapped out pages | ||
| 41 | */ | ||
| 42 | #define _PAGE_PROT_NONE _PAGE_READ | ||
| 43 | |||
| 38 | #define _PAGE_PFN_SHIFT 10 | 44 | #define _PAGE_PFN_SHIFT 10 |
| 39 | 45 | ||
| 40 | /* Set of bits to preserve across pte_modify() */ | 46 | /* Set of bits to preserve across pte_modify() */ |
diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h index 16301966d65b..a8179a8c1491 100644 --- a/arch/riscv/include/asm/pgtable.h +++ b/arch/riscv/include/asm/pgtable.h | |||
| @@ -44,7 +44,7 @@ | |||
| 44 | /* Page protection bits */ | 44 | /* Page protection bits */ |
| 45 | #define _PAGE_BASE (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_USER) | 45 | #define _PAGE_BASE (_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_USER) |
| 46 | 46 | ||
| 47 | #define PAGE_NONE __pgprot(0) | 47 | #define PAGE_NONE __pgprot(_PAGE_PROT_NONE) |
| 48 | #define PAGE_READ __pgprot(_PAGE_BASE | _PAGE_READ) | 48 | #define PAGE_READ __pgprot(_PAGE_BASE | _PAGE_READ) |
| 49 | #define PAGE_WRITE __pgprot(_PAGE_BASE | _PAGE_READ | _PAGE_WRITE) | 49 | #define PAGE_WRITE __pgprot(_PAGE_BASE | _PAGE_READ | _PAGE_WRITE) |
| 50 | #define PAGE_EXEC __pgprot(_PAGE_BASE | _PAGE_EXEC) | 50 | #define PAGE_EXEC __pgprot(_PAGE_BASE | _PAGE_EXEC) |
| @@ -98,7 +98,7 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)]; | |||
| 98 | 98 | ||
| 99 | static inline int pmd_present(pmd_t pmd) | 99 | static inline int pmd_present(pmd_t pmd) |
| 100 | { | 100 | { |
| 101 | return (pmd_val(pmd) & _PAGE_PRESENT); | 101 | return (pmd_val(pmd) & (_PAGE_PRESENT | _PAGE_PROT_NONE)); |
| 102 | } | 102 | } |
| 103 | 103 | ||
| 104 | static inline int pmd_none(pmd_t pmd) | 104 | static inline int pmd_none(pmd_t pmd) |
| @@ -178,7 +178,7 @@ static inline pte_t *pte_offset_kernel(pmd_t *pmd, unsigned long addr) | |||
| 178 | 178 | ||
| 179 | static inline int pte_present(pte_t pte) | 179 | static inline int pte_present(pte_t pte) |
| 180 | { | 180 | { |
| 181 | return (pte_val(pte) & _PAGE_PRESENT); | 181 | return (pte_val(pte) & (_PAGE_PRESENT | _PAGE_PROT_NONE)); |
| 182 | } | 182 | } |
| 183 | 183 | ||
| 184 | static inline int pte_none(pte_t pte) | 184 | static inline int pte_none(pte_t pte) |
| @@ -380,7 +380,7 @@ static inline int ptep_clear_flush_young(struct vm_area_struct *vma, | |||
| 380 | * | 380 | * |
| 381 | * Format of swap PTE: | 381 | * Format of swap PTE: |
| 382 | * bit 0: _PAGE_PRESENT (zero) | 382 | * bit 0: _PAGE_PRESENT (zero) |
| 383 | * bit 1: reserved for future use (zero) | 383 | * bit 1: _PAGE_PROT_NONE (zero) |
| 384 | * bits 2 to 6: swap type | 384 | * bits 2 to 6: swap type |
| 385 | * bits 7 to XLEN-1: swap offset | 385 | * bits 7 to XLEN-1: swap offset |
| 386 | */ | 386 | */ |
diff --git a/arch/riscv/include/asm/processor.h b/arch/riscv/include/asm/processor.h index 0531f49af5c3..ce70bceb8872 100644 --- a/arch/riscv/include/asm/processor.h +++ b/arch/riscv/include/asm/processor.h | |||
| @@ -22,7 +22,7 @@ | |||
| 22 | * This decides where the kernel will search for a free chunk of vm | 22 | * This decides where the kernel will search for a free chunk of vm |
| 23 | * space during mmap's. | 23 | * space during mmap's. |
| 24 | */ | 24 | */ |
| 25 | #define TASK_UNMAPPED_BASE PAGE_ALIGN(TASK_SIZE >> 1) | 25 | #define TASK_UNMAPPED_BASE PAGE_ALIGN(TASK_SIZE / 3) |
| 26 | 26 | ||
| 27 | #define STACK_TOP TASK_SIZE | 27 | #define STACK_TOP TASK_SIZE |
| 28 | #define STACK_TOP_MAX STACK_TOP | 28 | #define STACK_TOP_MAX STACK_TOP |
diff --git a/arch/riscv/include/asm/ptrace.h b/arch/riscv/include/asm/ptrace.h index bbe1862e8f80..d35ec2f41381 100644 --- a/arch/riscv/include/asm/ptrace.h +++ b/arch/riscv/include/asm/ptrace.h | |||
| @@ -113,6 +113,11 @@ static inline void frame_pointer_set(struct pt_regs *regs, | |||
| 113 | SET_FP(regs, val); | 113 | SET_FP(regs, val); |
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | static inline unsigned long regs_return_value(struct pt_regs *regs) | ||
| 117 | { | ||
| 118 | return regs->a0; | ||
| 119 | } | ||
| 120 | |||
| 116 | #endif /* __ASSEMBLY__ */ | 121 | #endif /* __ASSEMBLY__ */ |
| 117 | 122 | ||
| 118 | #endif /* _ASM_RISCV_PTRACE_H */ | 123 | #endif /* _ASM_RISCV_PTRACE_H */ |
diff --git a/arch/riscv/include/asm/syscall.h b/arch/riscv/include/asm/syscall.h index 8d25f8904c00..bba3da6ef157 100644 --- a/arch/riscv/include/asm/syscall.h +++ b/arch/riscv/include/asm/syscall.h | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #ifndef _ASM_RISCV_SYSCALL_H | 18 | #ifndef _ASM_RISCV_SYSCALL_H |
| 19 | #define _ASM_RISCV_SYSCALL_H | 19 | #define _ASM_RISCV_SYSCALL_H |
| 20 | 20 | ||
| 21 | #include <uapi/linux/audit.h> | ||
| 21 | #include <linux/sched.h> | 22 | #include <linux/sched.h> |
| 22 | #include <linux/err.h> | 23 | #include <linux/err.h> |
| 23 | 24 | ||
| @@ -99,4 +100,13 @@ static inline void syscall_set_arguments(struct task_struct *task, | |||
| 99 | memcpy(®s->a1 + i * sizeof(regs->a1), args, n * sizeof(regs->a0)); | 100 | memcpy(®s->a1 + i * sizeof(regs->a1), args, n * sizeof(regs->a0)); |
| 100 | } | 101 | } |
| 101 | 102 | ||
| 103 | static inline int syscall_get_arch(void) | ||
| 104 | { | ||
| 105 | #ifdef CONFIG_64BIT | ||
| 106 | return AUDIT_ARCH_RISCV64; | ||
| 107 | #else | ||
| 108 | return AUDIT_ARCH_RISCV32; | ||
| 109 | #endif | ||
| 110 | } | ||
| 111 | |||
| 102 | #endif /* _ASM_RISCV_SYSCALL_H */ | 112 | #endif /* _ASM_RISCV_SYSCALL_H */ |
diff --git a/arch/riscv/include/asm/thread_info.h b/arch/riscv/include/asm/thread_info.h index f8fa1cd2dad9..1c9cc8389928 100644 --- a/arch/riscv/include/asm/thread_info.h +++ b/arch/riscv/include/asm/thread_info.h | |||
| @@ -80,13 +80,19 @@ struct thread_info { | |||
| 80 | #define TIF_RESTORE_SIGMASK 4 /* restore signal mask in do_signal() */ | 80 | #define TIF_RESTORE_SIGMASK 4 /* restore signal mask in do_signal() */ |
| 81 | #define TIF_MEMDIE 5 /* is terminating due to OOM killer */ | 81 | #define TIF_MEMDIE 5 /* is terminating due to OOM killer */ |
| 82 | #define TIF_SYSCALL_TRACEPOINT 6 /* syscall tracepoint instrumentation */ | 82 | #define TIF_SYSCALL_TRACEPOINT 6 /* syscall tracepoint instrumentation */ |
| 83 | #define TIF_SYSCALL_AUDIT 7 /* syscall auditing */ | ||
| 83 | 84 | ||
| 84 | #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) | 85 | #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) |
| 85 | #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) | 86 | #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) |
| 86 | #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) | 87 | #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) |
| 87 | #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) | 88 | #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) |
| 89 | #define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT) | ||
| 90 | #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) | ||
| 88 | 91 | ||
| 89 | #define _TIF_WORK_MASK \ | 92 | #define _TIF_WORK_MASK \ |
| 90 | (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING | _TIF_NEED_RESCHED) | 93 | (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING | _TIF_NEED_RESCHED) |
| 91 | 94 | ||
| 95 | #define _TIF_SYSCALL_WORK \ | ||
| 96 | (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_TRACEPOINT | _TIF_SYSCALL_AUDIT) | ||
| 97 | |||
| 92 | #endif /* _ASM_RISCV_THREAD_INFO_H */ | 98 | #endif /* _ASM_RISCV_THREAD_INFO_H */ |
diff --git a/arch/riscv/include/asm/unistd.h b/arch/riscv/include/asm/unistd.h index fef96f117b4d..073ee80fdf74 100644 --- a/arch/riscv/include/asm/unistd.h +++ b/arch/riscv/include/asm/unistd.h | |||
| @@ -19,3 +19,5 @@ | |||
| 19 | #define __ARCH_WANT_SYS_CLONE | 19 | #define __ARCH_WANT_SYS_CLONE |
| 20 | 20 | ||
| 21 | #include <uapi/asm/unistd.h> | 21 | #include <uapi/asm/unistd.h> |
| 22 | |||
| 23 | #define NR_syscalls (__NR_syscalls) | ||
diff --git a/arch/riscv/kernel/asm-offsets.c b/arch/riscv/kernel/asm-offsets.c index 6a92a2fe198e..dac98348c6a3 100644 --- a/arch/riscv/kernel/asm-offsets.c +++ b/arch/riscv/kernel/asm-offsets.c | |||
| @@ -39,6 +39,7 @@ void asm_offsets(void) | |||
| 39 | OFFSET(TASK_STACK, task_struct, stack); | 39 | OFFSET(TASK_STACK, task_struct, stack); |
| 40 | OFFSET(TASK_TI, task_struct, thread_info); | 40 | OFFSET(TASK_TI, task_struct, thread_info); |
| 41 | OFFSET(TASK_TI_FLAGS, task_struct, thread_info.flags); | 41 | OFFSET(TASK_TI_FLAGS, task_struct, thread_info.flags); |
| 42 | OFFSET(TASK_TI_PREEMPT_COUNT, task_struct, thread_info.preempt_count); | ||
| 42 | OFFSET(TASK_TI_KERNEL_SP, task_struct, thread_info.kernel_sp); | 43 | OFFSET(TASK_TI_KERNEL_SP, task_struct, thread_info.kernel_sp); |
| 43 | OFFSET(TASK_TI_USER_SP, task_struct, thread_info.user_sp); | 44 | OFFSET(TASK_TI_USER_SP, task_struct, thread_info.user_sp); |
| 44 | OFFSET(TASK_TI_CPU, task_struct, thread_info.cpu); | 45 | OFFSET(TASK_TI_CPU, task_struct, thread_info.cpu); |
diff --git a/arch/riscv/kernel/entry.S b/arch/riscv/kernel/entry.S index 13d4826ab2a1..fd9b57c8b4ce 100644 --- a/arch/riscv/kernel/entry.S +++ b/arch/riscv/kernel/entry.S | |||
| @@ -144,6 +144,10 @@ _save_context: | |||
| 144 | REG_L x2, PT_SP(sp) | 144 | REG_L x2, PT_SP(sp) |
| 145 | .endm | 145 | .endm |
| 146 | 146 | ||
| 147 | #if !IS_ENABLED(CONFIG_PREEMPT) | ||
| 148 | .set resume_kernel, restore_all | ||
| 149 | #endif | ||
| 150 | |||
| 147 | ENTRY(handle_exception) | 151 | ENTRY(handle_exception) |
| 148 | SAVE_ALL | 152 | SAVE_ALL |
| 149 | 153 | ||
| @@ -201,7 +205,7 @@ handle_syscall: | |||
| 201 | REG_S s2, PT_SEPC(sp) | 205 | REG_S s2, PT_SEPC(sp) |
| 202 | /* Trace syscalls, but only if requested by the user. */ | 206 | /* Trace syscalls, but only if requested by the user. */ |
| 203 | REG_L t0, TASK_TI_FLAGS(tp) | 207 | REG_L t0, TASK_TI_FLAGS(tp) |
| 204 | andi t0, t0, _TIF_SYSCALL_TRACE | 208 | andi t0, t0, _TIF_SYSCALL_WORK |
| 205 | bnez t0, handle_syscall_trace_enter | 209 | bnez t0, handle_syscall_trace_enter |
| 206 | check_syscall_nr: | 210 | check_syscall_nr: |
| 207 | /* Check to make sure we don't jump to a bogus syscall number. */ | 211 | /* Check to make sure we don't jump to a bogus syscall number. */ |
| @@ -221,14 +225,14 @@ ret_from_syscall: | |||
| 221 | REG_S a0, PT_A0(sp) | 225 | REG_S a0, PT_A0(sp) |
| 222 | /* Trace syscalls, but only if requested by the user. */ | 226 | /* Trace syscalls, but only if requested by the user. */ |
| 223 | REG_L t0, TASK_TI_FLAGS(tp) | 227 | REG_L t0, TASK_TI_FLAGS(tp) |
| 224 | andi t0, t0, _TIF_SYSCALL_TRACE | 228 | andi t0, t0, _TIF_SYSCALL_WORK |
| 225 | bnez t0, handle_syscall_trace_exit | 229 | bnez t0, handle_syscall_trace_exit |
| 226 | 230 | ||
| 227 | ret_from_exception: | 231 | ret_from_exception: |
| 228 | REG_L s0, PT_SSTATUS(sp) | 232 | REG_L s0, PT_SSTATUS(sp) |
| 229 | csrc sstatus, SR_SIE | 233 | csrc sstatus, SR_SIE |
| 230 | andi s0, s0, SR_SPP | 234 | andi s0, s0, SR_SPP |
| 231 | bnez s0, restore_all | 235 | bnez s0, resume_kernel |
| 232 | 236 | ||
| 233 | resume_userspace: | 237 | resume_userspace: |
| 234 | /* Interrupts must be disabled here so flags are checked atomically */ | 238 | /* Interrupts must be disabled here so flags are checked atomically */ |
| @@ -250,6 +254,18 @@ restore_all: | |||
| 250 | RESTORE_ALL | 254 | RESTORE_ALL |
| 251 | sret | 255 | sret |
| 252 | 256 | ||
| 257 | #if IS_ENABLED(CONFIG_PREEMPT) | ||
| 258 | resume_kernel: | ||
| 259 | REG_L s0, TASK_TI_PREEMPT_COUNT(tp) | ||
| 260 | bnez s0, restore_all | ||
| 261 | need_resched: | ||
| 262 | REG_L s0, TASK_TI_FLAGS(tp) | ||
| 263 | andi s0, s0, _TIF_NEED_RESCHED | ||
| 264 | beqz s0, restore_all | ||
| 265 | call preempt_schedule_irq | ||
| 266 | j need_resched | ||
| 267 | #endif | ||
| 268 | |||
| 253 | work_pending: | 269 | work_pending: |
| 254 | /* Enter slow path for supplementary processing */ | 270 | /* Enter slow path for supplementary processing */ |
| 255 | la ra, ret_from_exception | 271 | la ra, ret_from_exception |
diff --git a/arch/riscv/kernel/module-sections.c b/arch/riscv/kernel/module-sections.c index bbbd26e19bfd..c9ae48333114 100644 --- a/arch/riscv/kernel/module-sections.c +++ b/arch/riscv/kernel/module-sections.c | |||
| @@ -9,14 +9,14 @@ | |||
| 9 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
| 10 | #include <linux/module.h> | 10 | #include <linux/module.h> |
| 11 | 11 | ||
| 12 | u64 module_emit_got_entry(struct module *mod, u64 val) | 12 | unsigned long module_emit_got_entry(struct module *mod, unsigned long val) |
| 13 | { | 13 | { |
| 14 | struct mod_section *got_sec = &mod->arch.got; | 14 | struct mod_section *got_sec = &mod->arch.got; |
| 15 | int i = got_sec->num_entries; | 15 | int i = got_sec->num_entries; |
| 16 | struct got_entry *got = get_got_entry(val, got_sec); | 16 | struct got_entry *got = get_got_entry(val, got_sec); |
| 17 | 17 | ||
| 18 | if (got) | 18 | if (got) |
| 19 | return (u64)got; | 19 | return (unsigned long)got; |
| 20 | 20 | ||
| 21 | /* There is no duplicate entry, create a new one */ | 21 | /* There is no duplicate entry, create a new one */ |
| 22 | got = (struct got_entry *)got_sec->shdr->sh_addr; | 22 | got = (struct got_entry *)got_sec->shdr->sh_addr; |
| @@ -25,10 +25,10 @@ u64 module_emit_got_entry(struct module *mod, u64 val) | |||
| 25 | got_sec->num_entries++; | 25 | got_sec->num_entries++; |
| 26 | BUG_ON(got_sec->num_entries > got_sec->max_entries); | 26 | BUG_ON(got_sec->num_entries > got_sec->max_entries); |
| 27 | 27 | ||
| 28 | return (u64)&got[i]; | 28 | return (unsigned long)&got[i]; |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | u64 module_emit_plt_entry(struct module *mod, u64 val) | 31 | unsigned long module_emit_plt_entry(struct module *mod, unsigned long val) |
| 32 | { | 32 | { |
| 33 | struct mod_section *got_plt_sec = &mod->arch.got_plt; | 33 | struct mod_section *got_plt_sec = &mod->arch.got_plt; |
| 34 | struct got_entry *got_plt; | 34 | struct got_entry *got_plt; |
| @@ -37,27 +37,29 @@ u64 module_emit_plt_entry(struct module *mod, u64 val) | |||
| 37 | int i = plt_sec->num_entries; | 37 | int i = plt_sec->num_entries; |
| 38 | 38 | ||
| 39 | if (plt) | 39 | if (plt) |
| 40 | return (u64)plt; | 40 | return (unsigned long)plt; |
| 41 | 41 | ||
| 42 | /* There is no duplicate entry, create a new one */ | 42 | /* There is no duplicate entry, create a new one */ |
| 43 | got_plt = (struct got_entry *)got_plt_sec->shdr->sh_addr; | 43 | got_plt = (struct got_entry *)got_plt_sec->shdr->sh_addr; |
| 44 | got_plt[i] = emit_got_entry(val); | 44 | got_plt[i] = emit_got_entry(val); |
| 45 | plt = (struct plt_entry *)plt_sec->shdr->sh_addr; | 45 | plt = (struct plt_entry *)plt_sec->shdr->sh_addr; |
| 46 | plt[i] = emit_plt_entry(val, (u64)&plt[i], (u64)&got_plt[i]); | 46 | plt[i] = emit_plt_entry(val, |
| 47 | (unsigned long)&plt[i], | ||
| 48 | (unsigned long)&got_plt[i]); | ||
| 47 | 49 | ||
| 48 | plt_sec->num_entries++; | 50 | plt_sec->num_entries++; |
| 49 | got_plt_sec->num_entries++; | 51 | got_plt_sec->num_entries++; |
| 50 | BUG_ON(plt_sec->num_entries > plt_sec->max_entries); | 52 | BUG_ON(plt_sec->num_entries > plt_sec->max_entries); |
| 51 | 53 | ||
| 52 | return (u64)&plt[i]; | 54 | return (unsigned long)&plt[i]; |
| 53 | } | 55 | } |
| 54 | 56 | ||
| 55 | static int is_rela_equal(const Elf64_Rela *x, const Elf64_Rela *y) | 57 | static int is_rela_equal(const Elf_Rela *x, const Elf_Rela *y) |
| 56 | { | 58 | { |
| 57 | return x->r_info == y->r_info && x->r_addend == y->r_addend; | 59 | return x->r_info == y->r_info && x->r_addend == y->r_addend; |
| 58 | } | 60 | } |
| 59 | 61 | ||
| 60 | static bool duplicate_rela(const Elf64_Rela *rela, int idx) | 62 | static bool duplicate_rela(const Elf_Rela *rela, int idx) |
| 61 | { | 63 | { |
| 62 | int i; | 64 | int i; |
| 63 | for (i = 0; i < idx; i++) { | 65 | for (i = 0; i < idx; i++) { |
| @@ -67,13 +69,13 @@ static bool duplicate_rela(const Elf64_Rela *rela, int idx) | |||
| 67 | return false; | 69 | return false; |
| 68 | } | 70 | } |
| 69 | 71 | ||
| 70 | static void count_max_entries(Elf64_Rela *relas, int num, | 72 | static void count_max_entries(Elf_Rela *relas, int num, |
| 71 | unsigned int *plts, unsigned int *gots) | 73 | unsigned int *plts, unsigned int *gots) |
| 72 | { | 74 | { |
| 73 | unsigned int type, i; | 75 | unsigned int type, i; |
| 74 | 76 | ||
| 75 | for (i = 0; i < num; i++) { | 77 | for (i = 0; i < num; i++) { |
| 76 | type = ELF64_R_TYPE(relas[i].r_info); | 78 | type = ELF_RISCV_R_TYPE(relas[i].r_info); |
| 77 | if (type == R_RISCV_CALL_PLT) { | 79 | if (type == R_RISCV_CALL_PLT) { |
| 78 | if (!duplicate_rela(relas, i)) | 80 | if (!duplicate_rela(relas, i)) |
| 79 | (*plts)++; | 81 | (*plts)++; |
| @@ -118,9 +120,9 @@ int module_frob_arch_sections(Elf_Ehdr *ehdr, Elf_Shdr *sechdrs, | |||
| 118 | 120 | ||
| 119 | /* Calculate the maxinum number of entries */ | 121 | /* Calculate the maxinum number of entries */ |
| 120 | for (i = 0; i < ehdr->e_shnum; i++) { | 122 | for (i = 0; i < ehdr->e_shnum; i++) { |
| 121 | Elf64_Rela *relas = (void *)ehdr + sechdrs[i].sh_offset; | 123 | Elf_Rela *relas = (void *)ehdr + sechdrs[i].sh_offset; |
| 122 | int num_rela = sechdrs[i].sh_size / sizeof(Elf64_Rela); | 124 | int num_rela = sechdrs[i].sh_size / sizeof(Elf_Rela); |
| 123 | Elf64_Shdr *dst_sec = sechdrs + sechdrs[i].sh_info; | 125 | Elf_Shdr *dst_sec = sechdrs + sechdrs[i].sh_info; |
| 124 | 126 | ||
| 125 | if (sechdrs[i].sh_type != SHT_RELA) | 127 | if (sechdrs[i].sh_type != SHT_RELA) |
| 126 | continue; | 128 | continue; |
diff --git a/arch/riscv/kernel/ptrace.c b/arch/riscv/kernel/ptrace.c index 60f1e02eed36..2ae5e0284f56 100644 --- a/arch/riscv/kernel/ptrace.c +++ b/arch/riscv/kernel/ptrace.c | |||
| @@ -18,12 +18,15 @@ | |||
| 18 | #include <asm/ptrace.h> | 18 | #include <asm/ptrace.h> |
| 19 | #include <asm/syscall.h> | 19 | #include <asm/syscall.h> |
| 20 | #include <asm/thread_info.h> | 20 | #include <asm/thread_info.h> |
| 21 | #include <linux/audit.h> | ||
| 21 | #include <linux/ptrace.h> | 22 | #include <linux/ptrace.h> |
| 22 | #include <linux/elf.h> | 23 | #include <linux/elf.h> |
| 23 | #include <linux/regset.h> | 24 | #include <linux/regset.h> |
| 24 | #include <linux/sched.h> | 25 | #include <linux/sched.h> |
| 25 | #include <linux/sched/task_stack.h> | 26 | #include <linux/sched/task_stack.h> |
| 26 | #include <linux/tracehook.h> | 27 | #include <linux/tracehook.h> |
| 28 | |||
| 29 | #define CREATE_TRACE_POINTS | ||
| 27 | #include <trace/events/syscalls.h> | 30 | #include <trace/events/syscalls.h> |
| 28 | 31 | ||
| 29 | enum riscv_regset { | 32 | enum riscv_regset { |
| @@ -163,15 +166,19 @@ void do_syscall_trace_enter(struct pt_regs *regs) | |||
| 163 | if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) | 166 | if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) |
| 164 | trace_sys_enter(regs, syscall_get_nr(current, regs)); | 167 | trace_sys_enter(regs, syscall_get_nr(current, regs)); |
| 165 | #endif | 168 | #endif |
| 169 | |||
| 170 | audit_syscall_entry(regs->a7, regs->a0, regs->a1, regs->a2, regs->a3); | ||
| 166 | } | 171 | } |
| 167 | 172 | ||
| 168 | void do_syscall_trace_exit(struct pt_regs *regs) | 173 | void do_syscall_trace_exit(struct pt_regs *regs) |
| 169 | { | 174 | { |
| 175 | audit_syscall_exit(regs); | ||
| 176 | |||
| 170 | if (test_thread_flag(TIF_SYSCALL_TRACE)) | 177 | if (test_thread_flag(TIF_SYSCALL_TRACE)) |
| 171 | tracehook_report_syscall_exit(regs, 0); | 178 | tracehook_report_syscall_exit(regs, 0); |
| 172 | 179 | ||
| 173 | #ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS | 180 | #ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS |
| 174 | if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) | 181 | if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) |
| 175 | trace_sys_exit(regs, regs->regs[0]); | 182 | trace_sys_exit(regs, regs_return_value(regs)); |
| 176 | #endif | 183 | #endif |
| 177 | } | 184 | } |
diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c index fc8006a042eb..77564310235f 100644 --- a/arch/riscv/kernel/setup.c +++ b/arch/riscv/kernel/setup.c | |||
| @@ -149,7 +149,14 @@ asmlinkage void __init setup_vm(void) | |||
| 149 | 149 | ||
| 150 | void __init parse_dtb(unsigned int hartid, void *dtb) | 150 | void __init parse_dtb(unsigned int hartid, void *dtb) |
| 151 | { | 151 | { |
| 152 | early_init_dt_scan(__va(dtb)); | 152 | if (!early_init_dt_scan(__va(dtb))) |
| 153 | return; | ||
| 154 | |||
| 155 | pr_err("No DTB passed to the kernel\n"); | ||
| 156 | #ifdef CONFIG_CMDLINE_FORCE | ||
| 157 | strlcpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE); | ||
| 158 | pr_info("Forcing kernel command line to: %s\n", boot_command_line); | ||
| 159 | #endif | ||
| 153 | } | 160 | } |
| 154 | 161 | ||
| 155 | static void __init setup_bootmem(void) | 162 | static void __init setup_bootmem(void) |
| @@ -174,7 +181,7 @@ static void __init setup_bootmem(void) | |||
| 174 | BUG_ON(mem_size == 0); | 181 | BUG_ON(mem_size == 0); |
| 175 | 182 | ||
| 176 | set_max_mapnr(PFN_DOWN(mem_size)); | 183 | set_max_mapnr(PFN_DOWN(mem_size)); |
| 177 | max_low_pfn = memblock_end_of_DRAM(); | 184 | max_low_pfn = PFN_DOWN(memblock_end_of_DRAM()); |
| 178 | 185 | ||
| 179 | #ifdef CONFIG_BLK_DEV_INITRD | 186 | #ifdef CONFIG_BLK_DEV_INITRD |
| 180 | setup_initrd(); | 187 | setup_initrd(); |
diff --git a/arch/riscv/kernel/smp.c b/arch/riscv/kernel/smp.c index 57b1383e5ef7..246635eac7bb 100644 --- a/arch/riscv/kernel/smp.c +++ b/arch/riscv/kernel/smp.c | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #include <linux/smp.h> | 23 | #include <linux/smp.h> |
| 24 | #include <linux/sched.h> | 24 | #include <linux/sched.h> |
| 25 | #include <linux/seq_file.h> | 25 | #include <linux/seq_file.h> |
| 26 | #include <linux/delay.h> | ||
| 26 | 27 | ||
| 27 | #include <asm/sbi.h> | 28 | #include <asm/sbi.h> |
| 28 | #include <asm/tlbflush.h> | 29 | #include <asm/tlbflush.h> |
| @@ -31,6 +32,7 @@ | |||
| 31 | enum ipi_message_type { | 32 | enum ipi_message_type { |
| 32 | IPI_RESCHEDULE, | 33 | IPI_RESCHEDULE, |
| 33 | IPI_CALL_FUNC, | 34 | IPI_CALL_FUNC, |
| 35 | IPI_CPU_STOP, | ||
| 34 | IPI_MAX | 36 | IPI_MAX |
| 35 | }; | 37 | }; |
| 36 | 38 | ||
| @@ -66,6 +68,13 @@ int setup_profiling_timer(unsigned int multiplier) | |||
| 66 | return -EINVAL; | 68 | return -EINVAL; |
| 67 | } | 69 | } |
| 68 | 70 | ||
| 71 | static void ipi_stop(void) | ||
| 72 | { | ||
| 73 | set_cpu_online(smp_processor_id(), false); | ||
| 74 | while (1) | ||
| 75 | wait_for_interrupt(); | ||
| 76 | } | ||
| 77 | |||
| 69 | void riscv_software_interrupt(void) | 78 | void riscv_software_interrupt(void) |
| 70 | { | 79 | { |
| 71 | unsigned long *pending_ipis = &ipi_data[smp_processor_id()].bits; | 80 | unsigned long *pending_ipis = &ipi_data[smp_processor_id()].bits; |
| @@ -94,6 +103,11 @@ void riscv_software_interrupt(void) | |||
| 94 | generic_smp_call_function_interrupt(); | 103 | generic_smp_call_function_interrupt(); |
| 95 | } | 104 | } |
| 96 | 105 | ||
| 106 | if (ops & (1 << IPI_CPU_STOP)) { | ||
| 107 | stats[IPI_CPU_STOP]++; | ||
| 108 | ipi_stop(); | ||
| 109 | } | ||
| 110 | |||
| 97 | BUG_ON((ops >> IPI_MAX) != 0); | 111 | BUG_ON((ops >> IPI_MAX) != 0); |
| 98 | 112 | ||
| 99 | /* Order data access and bit testing. */ | 113 | /* Order data access and bit testing. */ |
| @@ -121,6 +135,7 @@ send_ipi_message(const struct cpumask *to_whom, enum ipi_message_type operation) | |||
| 121 | static const char * const ipi_names[] = { | 135 | static const char * const ipi_names[] = { |
| 122 | [IPI_RESCHEDULE] = "Rescheduling interrupts", | 136 | [IPI_RESCHEDULE] = "Rescheduling interrupts", |
| 123 | [IPI_CALL_FUNC] = "Function call interrupts", | 137 | [IPI_CALL_FUNC] = "Function call interrupts", |
| 138 | [IPI_CPU_STOP] = "CPU stop interrupts", | ||
| 124 | }; | 139 | }; |
| 125 | 140 | ||
| 126 | void show_ipi_stats(struct seq_file *p, int prec) | 141 | void show_ipi_stats(struct seq_file *p, int prec) |
| @@ -146,15 +161,29 @@ void arch_send_call_function_single_ipi(int cpu) | |||
| 146 | send_ipi_message(cpumask_of(cpu), IPI_CALL_FUNC); | 161 | send_ipi_message(cpumask_of(cpu), IPI_CALL_FUNC); |
| 147 | } | 162 | } |
| 148 | 163 | ||
| 149 | static void ipi_stop(void *unused) | ||
| 150 | { | ||
| 151 | while (1) | ||
| 152 | wait_for_interrupt(); | ||
| 153 | } | ||
| 154 | |||
| 155 | void smp_send_stop(void) | 164 | void smp_send_stop(void) |
| 156 | { | 165 | { |
| 157 | on_each_cpu(ipi_stop, NULL, 1); | 166 | unsigned long timeout; |
| 167 | |||
| 168 | if (num_online_cpus() > 1) { | ||
| 169 | cpumask_t mask; | ||
| 170 | |||
| 171 | cpumask_copy(&mask, cpu_online_mask); | ||
| 172 | cpumask_clear_cpu(smp_processor_id(), &mask); | ||
| 173 | |||
| 174 | if (system_state <= SYSTEM_RUNNING) | ||
| 175 | pr_crit("SMP: stopping secondary CPUs\n"); | ||
| 176 | send_ipi_message(&mask, IPI_CPU_STOP); | ||
| 177 | } | ||
| 178 | |||
| 179 | /* Wait up to one second for other CPUs to stop */ | ||
| 180 | timeout = USEC_PER_SEC; | ||
| 181 | while (num_online_cpus() > 1 && timeout--) | ||
| 182 | udelay(1); | ||
| 183 | |||
| 184 | if (num_online_cpus() > 1) | ||
| 185 | pr_warn("SMP: failed to stop secondary CPUs %*pbl\n", | ||
| 186 | cpumask_pr_args(cpu_online_mask)); | ||
| 158 | } | 187 | } |
| 159 | 188 | ||
| 160 | void smp_send_reschedule(int cpu) | 189 | void smp_send_reschedule(int cpu) |
diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c index fc185ecabb0a..18cda0e8cf94 100644 --- a/arch/riscv/kernel/smpboot.c +++ b/arch/riscv/kernel/smpboot.c | |||
| @@ -57,15 +57,12 @@ void __init setup_smp(void) | |||
| 57 | 57 | ||
| 58 | while ((dn = of_find_node_by_type(dn, "cpu"))) { | 58 | while ((dn = of_find_node_by_type(dn, "cpu"))) { |
| 59 | hart = riscv_of_processor_hartid(dn); | 59 | hart = riscv_of_processor_hartid(dn); |
| 60 | if (hart < 0) { | 60 | if (hart < 0) |
| 61 | of_node_put(dn); | ||
| 62 | continue; | 61 | continue; |
| 63 | } | ||
| 64 | 62 | ||
| 65 | if (hart == cpuid_to_hartid_map(0)) { | 63 | if (hart == cpuid_to_hartid_map(0)) { |
| 66 | BUG_ON(found_boot_cpu); | 64 | BUG_ON(found_boot_cpu); |
| 67 | found_boot_cpu = 1; | 65 | found_boot_cpu = 1; |
| 68 | of_node_put(dn); | ||
| 69 | continue; | 66 | continue; |
| 70 | } | 67 | } |
| 71 | 68 | ||
| @@ -73,7 +70,6 @@ void __init setup_smp(void) | |||
| 73 | set_cpu_possible(cpuid, true); | 70 | set_cpu_possible(cpuid, true); |
| 74 | set_cpu_present(cpuid, true); | 71 | set_cpu_present(cpuid, true); |
| 75 | cpuid++; | 72 | cpuid++; |
| 76 | of_node_put(dn); | ||
| 77 | } | 73 | } |
| 78 | 74 | ||
| 79 | BUG_ON(!found_boot_cpu); | 75 | BUG_ON(!found_boot_cpu); |
diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c index 1d9bfaff60bc..658ebf645f42 100644 --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c | |||
| @@ -28,7 +28,8 @@ static void __init zone_sizes_init(void) | |||
| 28 | unsigned long max_zone_pfns[MAX_NR_ZONES] = { 0, }; | 28 | unsigned long max_zone_pfns[MAX_NR_ZONES] = { 0, }; |
| 29 | 29 | ||
| 30 | #ifdef CONFIG_ZONE_DMA32 | 30 | #ifdef CONFIG_ZONE_DMA32 |
| 31 | max_zone_pfns[ZONE_DMA32] = PFN_DOWN(min(4UL * SZ_1G, max_low_pfn)); | 31 | max_zone_pfns[ZONE_DMA32] = PFN_DOWN(min(4UL * SZ_1G, |
| 32 | (unsigned long) PFN_PHYS(max_low_pfn))); | ||
| 32 | #endif | 33 | #endif |
| 33 | max_zone_pfns[ZONE_NORMAL] = max_low_pfn; | 34 | max_zone_pfns[ZONE_NORMAL] = max_low_pfn; |
| 34 | 35 | ||
diff --git a/arch/s390/include/asm/mmu_context.h b/arch/s390/include/asm/mmu_context.h index ccbb53e22024..8d04e6f3f796 100644 --- a/arch/s390/include/asm/mmu_context.h +++ b/arch/s390/include/asm/mmu_context.h | |||
| @@ -25,7 +25,7 @@ static inline int init_new_context(struct task_struct *tsk, | |||
| 25 | atomic_set(&mm->context.flush_count, 0); | 25 | atomic_set(&mm->context.flush_count, 0); |
| 26 | mm->context.gmap_asce = 0; | 26 | mm->context.gmap_asce = 0; |
| 27 | mm->context.flush_mm = 0; | 27 | mm->context.flush_mm = 0; |
| 28 | mm->context.compat_mm = 0; | 28 | mm->context.compat_mm = test_thread_flag(TIF_31BIT); |
| 29 | #ifdef CONFIG_PGSTE | 29 | #ifdef CONFIG_PGSTE |
| 30 | mm->context.alloc_pgste = page_table_allocate_pgste || | 30 | mm->context.alloc_pgste = page_table_allocate_pgste || |
| 31 | test_thread_flag(TIF_PGSTE) || | 31 | test_thread_flag(TIF_PGSTE) || |
| @@ -90,8 +90,6 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, | |||
| 90 | { | 90 | { |
| 91 | int cpu = smp_processor_id(); | 91 | int cpu = smp_processor_id(); |
| 92 | 92 | ||
| 93 | if (prev == next) | ||
| 94 | return; | ||
| 95 | S390_lowcore.user_asce = next->context.asce; | 93 | S390_lowcore.user_asce = next->context.asce; |
| 96 | cpumask_set_cpu(cpu, &next->context.cpu_attach_mask); | 94 | cpumask_set_cpu(cpu, &next->context.cpu_attach_mask); |
| 97 | /* Clear previous user-ASCE from CR1 and CR7 */ | 95 | /* Clear previous user-ASCE from CR1 and CR7 */ |
| @@ -103,7 +101,8 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, | |||
| 103 | __ctl_load(S390_lowcore.vdso_asce, 7, 7); | 101 | __ctl_load(S390_lowcore.vdso_asce, 7, 7); |
| 104 | clear_cpu_flag(CIF_ASCE_SECONDARY); | 102 | clear_cpu_flag(CIF_ASCE_SECONDARY); |
| 105 | } | 103 | } |
| 106 | cpumask_clear_cpu(cpu, &prev->context.cpu_attach_mask); | 104 | if (prev != next) |
| 105 | cpumask_clear_cpu(cpu, &prev->context.cpu_attach_mask); | ||
| 107 | } | 106 | } |
| 108 | 107 | ||
| 109 | #define finish_arch_post_lock_switch finish_arch_post_lock_switch | 108 | #define finish_arch_post_lock_switch finish_arch_post_lock_switch |
diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c index af5c2b3f7065..a8c7789b246b 100644 --- a/arch/s390/kernel/early.c +++ b/arch/s390/kernel/early.c | |||
| @@ -63,10 +63,10 @@ static noinline __init void detect_machine_type(void) | |||
| 63 | if (stsi(vmms, 3, 2, 2) || !vmms->count) | 63 | if (stsi(vmms, 3, 2, 2) || !vmms->count) |
| 64 | return; | 64 | return; |
| 65 | 65 | ||
| 66 | /* Running under KVM? If not we assume z/VM */ | 66 | /* Detect known hypervisors */ |
| 67 | if (!memcmp(vmms->vm[0].cpi, "\xd2\xe5\xd4", 3)) | 67 | if (!memcmp(vmms->vm[0].cpi, "\xd2\xe5\xd4", 3)) |
| 68 | S390_lowcore.machine_flags |= MACHINE_FLAG_KVM; | 68 | S390_lowcore.machine_flags |= MACHINE_FLAG_KVM; |
| 69 | else | 69 | else if (!memcmp(vmms->vm[0].cpi, "\xa9\x61\xe5\xd4", 4)) |
| 70 | S390_lowcore.machine_flags |= MACHINE_FLAG_VM; | 70 | S390_lowcore.machine_flags |= MACHINE_FLAG_VM; |
| 71 | } | 71 | } |
| 72 | 72 | ||
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index 72dd23ef771b..7ed90a759135 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c | |||
| @@ -1006,6 +1006,8 @@ void __init setup_arch(char **cmdline_p) | |||
| 1006 | pr_info("Linux is running under KVM in 64-bit mode\n"); | 1006 | pr_info("Linux is running under KVM in 64-bit mode\n"); |
| 1007 | else if (MACHINE_IS_LPAR) | 1007 | else if (MACHINE_IS_LPAR) |
| 1008 | pr_info("Linux is running natively in 64-bit mode\n"); | 1008 | pr_info("Linux is running natively in 64-bit mode\n"); |
| 1009 | else | ||
| 1010 | pr_info("Linux is running as a guest in 64-bit mode\n"); | ||
| 1009 | 1011 | ||
| 1010 | /* Have one command line that is parsed and saved in /proc/cmdline */ | 1012 | /* Have one command line that is parsed and saved in /proc/cmdline */ |
| 1011 | /* boot_command_line has been already set up in early.c */ | 1013 | /* boot_command_line has been already set up in early.c */ |
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c index f82b3d3c36e2..b198ece2aad6 100644 --- a/arch/s390/kernel/smp.c +++ b/arch/s390/kernel/smp.c | |||
| @@ -381,8 +381,13 @@ void smp_call_online_cpu(void (*func)(void *), void *data) | |||
| 381 | */ | 381 | */ |
| 382 | void smp_call_ipl_cpu(void (*func)(void *), void *data) | 382 | void smp_call_ipl_cpu(void (*func)(void *), void *data) |
| 383 | { | 383 | { |
| 384 | struct lowcore *lc = pcpu_devices->lowcore; | ||
| 385 | |||
| 386 | if (pcpu_devices[0].address == stap()) | ||
| 387 | lc = &S390_lowcore; | ||
| 388 | |||
| 384 | pcpu_delegate(&pcpu_devices[0], func, data, | 389 | pcpu_delegate(&pcpu_devices[0], func, data, |
| 385 | pcpu_devices->lowcore->nodat_stack); | 390 | lc->nodat_stack); |
| 386 | } | 391 | } |
| 387 | 392 | ||
| 388 | int smp_find_processor_id(u16 address) | 393 | int smp_find_processor_id(u16 address) |
| @@ -1166,7 +1171,11 @@ static ssize_t __ref rescan_store(struct device *dev, | |||
| 1166 | { | 1171 | { |
| 1167 | int rc; | 1172 | int rc; |
| 1168 | 1173 | ||
| 1174 | rc = lock_device_hotplug_sysfs(); | ||
| 1175 | if (rc) | ||
| 1176 | return rc; | ||
| 1169 | rc = smp_rescan_cpus(); | 1177 | rc = smp_rescan_cpus(); |
| 1178 | unlock_device_hotplug(); | ||
| 1170 | return rc ? rc : count; | 1179 | return rc ? rc : count; |
| 1171 | } | 1180 | } |
| 1172 | static DEVICE_ATTR_WO(rescan); | 1181 | static DEVICE_ATTR_WO(rescan); |
diff --git a/arch/s390/kernel/swsusp.S b/arch/s390/kernel/swsusp.S index 537f97fde37f..b6796e616812 100644 --- a/arch/s390/kernel/swsusp.S +++ b/arch/s390/kernel/swsusp.S | |||
| @@ -30,10 +30,10 @@ | |||
| 30 | .section .text | 30 | .section .text |
| 31 | ENTRY(swsusp_arch_suspend) | 31 | ENTRY(swsusp_arch_suspend) |
| 32 | lg %r1,__LC_NODAT_STACK | 32 | lg %r1,__LC_NODAT_STACK |
| 33 | aghi %r1,-STACK_FRAME_OVERHEAD | ||
| 34 | stmg %r6,%r15,__SF_GPRS(%r1) | 33 | stmg %r6,%r15,__SF_GPRS(%r1) |
| 34 | aghi %r1,-STACK_FRAME_OVERHEAD | ||
| 35 | stg %r15,__SF_BACKCHAIN(%r1) | 35 | stg %r15,__SF_BACKCHAIN(%r1) |
| 36 | lgr %r1,%r15 | 36 | lgr %r15,%r1 |
| 37 | 37 | ||
| 38 | /* Store FPU registers */ | 38 | /* Store FPU registers */ |
| 39 | brasl %r14,save_fpu_regs | 39 | brasl %r14,save_fpu_regs |
diff --git a/arch/s390/kernel/vdso.c b/arch/s390/kernel/vdso.c index ebe748a9f472..4ff354887db4 100644 --- a/arch/s390/kernel/vdso.c +++ b/arch/s390/kernel/vdso.c | |||
| @@ -224,10 +224,9 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp) | |||
| 224 | 224 | ||
| 225 | vdso_pages = vdso64_pages; | 225 | vdso_pages = vdso64_pages; |
| 226 | #ifdef CONFIG_COMPAT | 226 | #ifdef CONFIG_COMPAT |
| 227 | if (is_compat_task()) { | 227 | mm->context.compat_mm = is_compat_task(); |
| 228 | if (mm->context.compat_mm) | ||
| 228 | vdso_pages = vdso32_pages; | 229 | vdso_pages = vdso32_pages; |
| 229 | mm->context.compat_mm = 1; | ||
| 230 | } | ||
| 231 | #endif | 230 | #endif |
| 232 | /* | 231 | /* |
| 233 | * vDSO has a problem and was disabled, just don't "enable" it for | 232 | * vDSO has a problem and was disabled, just don't "enable" it for |
diff --git a/arch/s390/kvm/vsie.c b/arch/s390/kvm/vsie.c index a153257bf7d9..d62fa148558b 100644 --- a/arch/s390/kvm/vsie.c +++ b/arch/s390/kvm/vsie.c | |||
| @@ -297,7 +297,7 @@ static int shadow_crycb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page) | |||
| 297 | scb_s->crycbd = 0; | 297 | scb_s->crycbd = 0; |
| 298 | 298 | ||
| 299 | apie_h = vcpu->arch.sie_block->eca & ECA_APIE; | 299 | apie_h = vcpu->arch.sie_block->eca & ECA_APIE; |
| 300 | if (!apie_h && !key_msk) | 300 | if (!apie_h && (!key_msk || fmt_o == CRYCB_FORMAT0)) |
| 301 | return 0; | 301 | return 0; |
| 302 | 302 | ||
| 303 | if (!crycb_addr) | 303 | if (!crycb_addr) |
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c index a966d7bfac57..4266a4de3160 100644 --- a/arch/s390/pci/pci.c +++ b/arch/s390/pci/pci.c | |||
| @@ -382,7 +382,9 @@ static void zpci_irq_handler(struct airq_struct *airq) | |||
| 382 | if (ai == -1UL) | 382 | if (ai == -1UL) |
| 383 | break; | 383 | break; |
| 384 | inc_irq_stat(IRQIO_MSI); | 384 | inc_irq_stat(IRQIO_MSI); |
| 385 | airq_iv_lock(aibv, ai); | ||
| 385 | generic_handle_irq(airq_iv_get_data(aibv, ai)); | 386 | generic_handle_irq(airq_iv_get_data(aibv, ai)); |
| 387 | airq_iv_unlock(aibv, ai); | ||
| 386 | } | 388 | } |
| 387 | } | 389 | } |
| 388 | } | 390 | } |
| @@ -408,7 +410,7 @@ int arch_setup_msi_irqs(struct pci_dev *pdev, int nvec, int type) | |||
| 408 | zdev->aisb = aisb; | 410 | zdev->aisb = aisb; |
| 409 | 411 | ||
| 410 | /* Create adapter interrupt vector */ | 412 | /* Create adapter interrupt vector */ |
| 411 | zdev->aibv = airq_iv_create(msi_vecs, AIRQ_IV_DATA); | 413 | zdev->aibv = airq_iv_create(msi_vecs, AIRQ_IV_DATA | AIRQ_IV_BITLOCK); |
| 412 | if (!zdev->aibv) | 414 | if (!zdev->aibv) |
| 413 | return -ENOMEM; | 415 | return -ENOMEM; |
| 414 | 416 | ||
diff --git a/arch/sh/boot/dts/Makefile b/arch/sh/boot/dts/Makefile index 01d0f7fb14cc..2563d1e532e2 100644 --- a/arch/sh/boot/dts/Makefile +++ b/arch/sh/boot/dts/Makefile | |||
| @@ -1,3 +1,3 @@ | |||
| 1 | ifneq ($(CONFIG_BUILTIN_DTB_SOURCE),"") | 1 | ifneq ($(CONFIG_BUILTIN_DTB_SOURCE),"") |
| 2 | obj-y += $(patsubst "%",%,$(CONFIG_BUILTIN_DTB_SOURCE)).dtb.o | 2 | obj-$(CONFIG_USE_BUILTIN_DTB) += $(patsubst "%",%,$(CONFIG_BUILTIN_DTB_SOURCE)).dtb.o |
| 3 | endif | 3 | endif |
diff --git a/arch/unicore32/include/asm/Kbuild b/arch/unicore32/include/asm/Kbuild index 1372553dc0a9..1d1544b6ca74 100644 --- a/arch/unicore32/include/asm/Kbuild +++ b/arch/unicore32/include/asm/Kbuild | |||
| @@ -28,6 +28,7 @@ generic-y += preempt.h | |||
| 28 | generic-y += sections.h | 28 | generic-y += sections.h |
| 29 | generic-y += segment.h | 29 | generic-y += segment.h |
| 30 | generic-y += serial.h | 30 | generic-y += serial.h |
| 31 | generic-y += shmparam.h | ||
| 31 | generic-y += sizes.h | 32 | generic-y += sizes.h |
| 32 | generic-y += syscalls.h | 33 | generic-y += syscalls.h |
| 33 | generic-y += topology.h | 34 | generic-y += topology.h |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 6185d4f33296..68261430fe6e 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
| @@ -198,7 +198,7 @@ config X86 | |||
| 198 | select IRQ_FORCED_THREADING | 198 | select IRQ_FORCED_THREADING |
| 199 | select NEED_SG_DMA_LENGTH | 199 | select NEED_SG_DMA_LENGTH |
| 200 | select PCI_DOMAINS if PCI | 200 | select PCI_DOMAINS if PCI |
| 201 | select PCI_LOCKLESS_CONFIG | 201 | select PCI_LOCKLESS_CONFIG if PCI |
| 202 | select PERF_EVENTS | 202 | select PERF_EVENTS |
| 203 | select RTC_LIB | 203 | select RTC_LIB |
| 204 | select RTC_MC146818_LIB | 204 | select RTC_MC146818_LIB |
| @@ -446,12 +446,12 @@ config RETPOLINE | |||
| 446 | branches. Requires a compiler with -mindirect-branch=thunk-extern | 446 | branches. Requires a compiler with -mindirect-branch=thunk-extern |
| 447 | support for full protection. The kernel may run slower. | 447 | support for full protection. The kernel may run slower. |
| 448 | 448 | ||
| 449 | config RESCTRL | 449 | config X86_CPU_RESCTRL |
| 450 | bool "Resource Control support" | 450 | bool "x86 CPU resource control support" |
| 451 | depends on X86 && (CPU_SUP_INTEL || CPU_SUP_AMD) | 451 | depends on X86 && (CPU_SUP_INTEL || CPU_SUP_AMD) |
| 452 | select KERNFS | 452 | select KERNFS |
| 453 | help | 453 | help |
| 454 | Enable Resource Control support. | 454 | Enable x86 CPU resource control support. |
| 455 | 455 | ||
| 456 | Provide support for the allocation and monitoring of system resources | 456 | Provide support for the allocation and monitoring of system resources |
| 457 | usage by the CPU. | 457 | usage by the CPU. |
| @@ -617,7 +617,7 @@ config X86_INTEL_QUARK | |||
| 617 | 617 | ||
| 618 | config X86_INTEL_LPSS | 618 | config X86_INTEL_LPSS |
| 619 | bool "Intel Low Power Subsystem Support" | 619 | bool "Intel Low Power Subsystem Support" |
| 620 | depends on X86 && ACPI | 620 | depends on X86 && ACPI && PCI |
| 621 | select COMMON_CLK | 621 | select COMMON_CLK |
| 622 | select PINCTRL | 622 | select PINCTRL |
| 623 | select IOSF_MBI | 623 | select IOSF_MBI |
diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S index 64037895b085..f62e347862cc 100644 --- a/arch/x86/boot/compressed/head_64.S +++ b/arch/x86/boot/compressed/head_64.S | |||
| @@ -600,6 +600,16 @@ ENTRY(trampoline_32bit_src) | |||
| 600 | leal TRAMPOLINE_32BIT_PGTABLE_OFFSET(%ecx), %eax | 600 | leal TRAMPOLINE_32BIT_PGTABLE_OFFSET(%ecx), %eax |
| 601 | movl %eax, %cr3 | 601 | movl %eax, %cr3 |
| 602 | 3: | 602 | 3: |
| 603 | /* Set EFER.LME=1 as a precaution in case hypervsior pulls the rug */ | ||
| 604 | pushl %ecx | ||
| 605 | pushl %edx | ||
| 606 | movl $MSR_EFER, %ecx | ||
| 607 | rdmsr | ||
| 608 | btsl $_EFER_LME, %eax | ||
| 609 | wrmsr | ||
| 610 | popl %edx | ||
| 611 | popl %ecx | ||
| 612 | |||
| 603 | /* Enable PAE and LA57 (if required) paging modes */ | 613 | /* Enable PAE and LA57 (if required) paging modes */ |
| 604 | movl $X86_CR4_PAE, %eax | 614 | movl $X86_CR4_PAE, %eax |
| 605 | cmpl $0, %edx | 615 | cmpl $0, %edx |
diff --git a/arch/x86/boot/compressed/pgtable.h b/arch/x86/boot/compressed/pgtable.h index 91f75638f6e6..6ff7e81b5628 100644 --- a/arch/x86/boot/compressed/pgtable.h +++ b/arch/x86/boot/compressed/pgtable.h | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | #define TRAMPOLINE_32BIT_PGTABLE_OFFSET 0 | 6 | #define TRAMPOLINE_32BIT_PGTABLE_OFFSET 0 |
| 7 | 7 | ||
| 8 | #define TRAMPOLINE_32BIT_CODE_OFFSET PAGE_SIZE | 8 | #define TRAMPOLINE_32BIT_CODE_OFFSET PAGE_SIZE |
| 9 | #define TRAMPOLINE_32BIT_CODE_SIZE 0x60 | 9 | #define TRAMPOLINE_32BIT_CODE_SIZE 0x70 |
| 10 | 10 | ||
| 11 | #define TRAMPOLINE_32BIT_STACK_END TRAMPOLINE_32BIT_SIZE | 11 | #define TRAMPOLINE_32BIT_STACK_END TRAMPOLINE_32BIT_SIZE |
| 12 | 12 | ||
diff --git a/arch/x86/entry/entry_64_compat.S b/arch/x86/entry/entry_64_compat.S index 8eaf8952c408..39913770a44d 100644 --- a/arch/x86/entry/entry_64_compat.S +++ b/arch/x86/entry/entry_64_compat.S | |||
| @@ -361,7 +361,8 @@ ENTRY(entry_INT80_compat) | |||
| 361 | 361 | ||
| 362 | /* Need to switch before accessing the thread stack. */ | 362 | /* Need to switch before accessing the thread stack. */ |
| 363 | SWITCH_TO_KERNEL_CR3 scratch_reg=%rdi | 363 | SWITCH_TO_KERNEL_CR3 scratch_reg=%rdi |
| 364 | movq %rsp, %rdi | 364 | /* In the Xen PV case we already run on the thread stack. */ |
| 365 | ALTERNATIVE "movq %rsp, %rdi", "jmp .Lint80_keep_stack", X86_FEATURE_XENPV | ||
| 365 | movq PER_CPU_VAR(cpu_current_top_of_stack), %rsp | 366 | movq PER_CPU_VAR(cpu_current_top_of_stack), %rsp |
| 366 | 367 | ||
| 367 | pushq 6*8(%rdi) /* regs->ss */ | 368 | pushq 6*8(%rdi) /* regs->ss */ |
| @@ -370,8 +371,9 @@ ENTRY(entry_INT80_compat) | |||
| 370 | pushq 3*8(%rdi) /* regs->cs */ | 371 | pushq 3*8(%rdi) /* regs->cs */ |
| 371 | pushq 2*8(%rdi) /* regs->ip */ | 372 | pushq 2*8(%rdi) /* regs->ip */ |
| 372 | pushq 1*8(%rdi) /* regs->orig_ax */ | 373 | pushq 1*8(%rdi) /* regs->orig_ax */ |
| 373 | |||
| 374 | pushq (%rdi) /* pt_regs->di */ | 374 | pushq (%rdi) /* pt_regs->di */ |
| 375 | .Lint80_keep_stack: | ||
| 376 | |||
| 375 | pushq %rsi /* pt_regs->si */ | 377 | pushq %rsi /* pt_regs->si */ |
| 376 | xorl %esi, %esi /* nospec si */ | 378 | xorl %esi, %esi /* nospec si */ |
| 377 | pushq %rdx /* pt_regs->dx */ | 379 | pushq %rdx /* pt_regs->dx */ |
diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c index 374a19712e20..b684f0294f35 100644 --- a/arch/x86/events/core.c +++ b/arch/x86/events/core.c | |||
| @@ -2278,6 +2278,19 @@ void perf_check_microcode(void) | |||
| 2278 | x86_pmu.check_microcode(); | 2278 | x86_pmu.check_microcode(); |
| 2279 | } | 2279 | } |
| 2280 | 2280 | ||
| 2281 | static int x86_pmu_check_period(struct perf_event *event, u64 value) | ||
| 2282 | { | ||
| 2283 | if (x86_pmu.check_period && x86_pmu.check_period(event, value)) | ||
| 2284 | return -EINVAL; | ||
| 2285 | |||
| 2286 | if (value && x86_pmu.limit_period) { | ||
| 2287 | if (x86_pmu.limit_period(event, value) > value) | ||
| 2288 | return -EINVAL; | ||
| 2289 | } | ||
| 2290 | |||
| 2291 | return 0; | ||
| 2292 | } | ||
| 2293 | |||
| 2281 | static struct pmu pmu = { | 2294 | static struct pmu pmu = { |
| 2282 | .pmu_enable = x86_pmu_enable, | 2295 | .pmu_enable = x86_pmu_enable, |
| 2283 | .pmu_disable = x86_pmu_disable, | 2296 | .pmu_disable = x86_pmu_disable, |
| @@ -2302,6 +2315,7 @@ static struct pmu pmu = { | |||
| 2302 | .event_idx = x86_pmu_event_idx, | 2315 | .event_idx = x86_pmu_event_idx, |
| 2303 | .sched_task = x86_pmu_sched_task, | 2316 | .sched_task = x86_pmu_sched_task, |
| 2304 | .task_ctx_size = sizeof(struct x86_perf_task_context), | 2317 | .task_ctx_size = sizeof(struct x86_perf_task_context), |
| 2318 | .check_period = x86_pmu_check_period, | ||
| 2305 | }; | 2319 | }; |
| 2306 | 2320 | ||
| 2307 | void arch_perf_update_userpage(struct perf_event *event, | 2321 | void arch_perf_update_userpage(struct perf_event *event, |
diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c index 40e12cfc87f6..730978dff63f 100644 --- a/arch/x86/events/intel/core.c +++ b/arch/x86/events/intel/core.c | |||
| @@ -3559,6 +3559,14 @@ static void free_excl_cntrs(int cpu) | |||
| 3559 | 3559 | ||
| 3560 | static void intel_pmu_cpu_dying(int cpu) | 3560 | static void intel_pmu_cpu_dying(int cpu) |
| 3561 | { | 3561 | { |
| 3562 | fini_debug_store_on_cpu(cpu); | ||
| 3563 | |||
| 3564 | if (x86_pmu.counter_freezing) | ||
| 3565 | disable_counter_freeze(); | ||
| 3566 | } | ||
| 3567 | |||
| 3568 | static void intel_pmu_cpu_dead(int cpu) | ||
| 3569 | { | ||
| 3562 | struct cpu_hw_events *cpuc = &per_cpu(cpu_hw_events, cpu); | 3570 | struct cpu_hw_events *cpuc = &per_cpu(cpu_hw_events, cpu); |
| 3563 | struct intel_shared_regs *pc; | 3571 | struct intel_shared_regs *pc; |
| 3564 | 3572 | ||
| @@ -3570,11 +3578,6 @@ static void intel_pmu_cpu_dying(int cpu) | |||
| 3570 | } | 3578 | } |
| 3571 | 3579 | ||
| 3572 | free_excl_cntrs(cpu); | 3580 | free_excl_cntrs(cpu); |
| 3573 | |||
| 3574 | fini_debug_store_on_cpu(cpu); | ||
| 3575 | |||
| 3576 | if (x86_pmu.counter_freezing) | ||
| 3577 | disable_counter_freeze(); | ||
| 3578 | } | 3581 | } |
| 3579 | 3582 | ||
| 3580 | static void intel_pmu_sched_task(struct perf_event_context *ctx, | 3583 | static void intel_pmu_sched_task(struct perf_event_context *ctx, |
| @@ -3584,6 +3587,11 @@ static void intel_pmu_sched_task(struct perf_event_context *ctx, | |||
| 3584 | intel_pmu_lbr_sched_task(ctx, sched_in); | 3587 | intel_pmu_lbr_sched_task(ctx, sched_in); |
| 3585 | } | 3588 | } |
| 3586 | 3589 | ||
| 3590 | static int intel_pmu_check_period(struct perf_event *event, u64 value) | ||
| 3591 | { | ||
| 3592 | return intel_pmu_has_bts_period(event, value) ? -EINVAL : 0; | ||
| 3593 | } | ||
| 3594 | |||
| 3587 | PMU_FORMAT_ATTR(offcore_rsp, "config1:0-63"); | 3595 | PMU_FORMAT_ATTR(offcore_rsp, "config1:0-63"); |
| 3588 | 3596 | ||
| 3589 | PMU_FORMAT_ATTR(ldlat, "config1:0-15"); | 3597 | PMU_FORMAT_ATTR(ldlat, "config1:0-15"); |
| @@ -3663,6 +3671,9 @@ static __initconst const struct x86_pmu core_pmu = { | |||
| 3663 | .cpu_prepare = intel_pmu_cpu_prepare, | 3671 | .cpu_prepare = intel_pmu_cpu_prepare, |
| 3664 | .cpu_starting = intel_pmu_cpu_starting, | 3672 | .cpu_starting = intel_pmu_cpu_starting, |
| 3665 | .cpu_dying = intel_pmu_cpu_dying, | 3673 | .cpu_dying = intel_pmu_cpu_dying, |
| 3674 | .cpu_dead = intel_pmu_cpu_dead, | ||
| 3675 | |||
| 3676 | .check_period = intel_pmu_check_period, | ||
| 3666 | }; | 3677 | }; |
| 3667 | 3678 | ||
| 3668 | static struct attribute *intel_pmu_attrs[]; | 3679 | static struct attribute *intel_pmu_attrs[]; |
| @@ -3703,8 +3714,12 @@ static __initconst const struct x86_pmu intel_pmu = { | |||
| 3703 | .cpu_prepare = intel_pmu_cpu_prepare, | 3714 | .cpu_prepare = intel_pmu_cpu_prepare, |
| 3704 | .cpu_starting = intel_pmu_cpu_starting, | 3715 | .cpu_starting = intel_pmu_cpu_starting, |
| 3705 | .cpu_dying = intel_pmu_cpu_dying, | 3716 | .cpu_dying = intel_pmu_cpu_dying, |
| 3717 | .cpu_dead = intel_pmu_cpu_dead, | ||
| 3718 | |||
| 3706 | .guest_get_msrs = intel_guest_get_msrs, | 3719 | .guest_get_msrs = intel_guest_get_msrs, |
| 3707 | .sched_task = intel_pmu_sched_task, | 3720 | .sched_task = intel_pmu_sched_task, |
| 3721 | |||
| 3722 | .check_period = intel_pmu_check_period, | ||
| 3708 | }; | 3723 | }; |
| 3709 | 3724 | ||
| 3710 | static __init void intel_clovertown_quirk(void) | 3725 | static __init void intel_clovertown_quirk(void) |
diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c index c07bee31abe8..b10e04387f38 100644 --- a/arch/x86/events/intel/uncore_snbep.c +++ b/arch/x86/events/intel/uncore_snbep.c | |||
| @@ -1222,6 +1222,8 @@ static struct pci_driver snbep_uncore_pci_driver = { | |||
| 1222 | .id_table = snbep_uncore_pci_ids, | 1222 | .id_table = snbep_uncore_pci_ids, |
| 1223 | }; | 1223 | }; |
| 1224 | 1224 | ||
| 1225 | #define NODE_ID_MASK 0x7 | ||
| 1226 | |||
| 1225 | /* | 1227 | /* |
| 1226 | * build pci bus to socket mapping | 1228 | * build pci bus to socket mapping |
| 1227 | */ | 1229 | */ |
| @@ -1243,7 +1245,7 @@ static int snbep_pci2phy_map_init(int devid, int nodeid_loc, int idmap_loc, bool | |||
| 1243 | err = pci_read_config_dword(ubox_dev, nodeid_loc, &config); | 1245 | err = pci_read_config_dword(ubox_dev, nodeid_loc, &config); |
| 1244 | if (err) | 1246 | if (err) |
| 1245 | break; | 1247 | break; |
| 1246 | nodeid = config; | 1248 | nodeid = config & NODE_ID_MASK; |
| 1247 | /* get the Node ID mapping */ | 1249 | /* get the Node ID mapping */ |
| 1248 | err = pci_read_config_dword(ubox_dev, idmap_loc, &config); | 1250 | err = pci_read_config_dword(ubox_dev, idmap_loc, &config); |
| 1249 | if (err) | 1251 | if (err) |
diff --git a/arch/x86/events/perf_event.h b/arch/x86/events/perf_event.h index 78d7b7031bfc..d46fd6754d92 100644 --- a/arch/x86/events/perf_event.h +++ b/arch/x86/events/perf_event.h | |||
| @@ -646,6 +646,11 @@ struct x86_pmu { | |||
| 646 | * Intel host/guest support (KVM) | 646 | * Intel host/guest support (KVM) |
| 647 | */ | 647 | */ |
| 648 | struct perf_guest_switch_msr *(*guest_get_msrs)(int *nr); | 648 | struct perf_guest_switch_msr *(*guest_get_msrs)(int *nr); |
| 649 | |||
| 650 | /* | ||
| 651 | * Check period value for PERF_EVENT_IOC_PERIOD ioctl. | ||
| 652 | */ | ||
| 653 | int (*check_period) (struct perf_event *event, u64 period); | ||
| 649 | }; | 654 | }; |
| 650 | 655 | ||
| 651 | struct x86_perf_task_context { | 656 | struct x86_perf_task_context { |
| @@ -857,7 +862,7 @@ static inline int amd_pmu_init(void) | |||
| 857 | 862 | ||
| 858 | #ifdef CONFIG_CPU_SUP_INTEL | 863 | #ifdef CONFIG_CPU_SUP_INTEL |
| 859 | 864 | ||
| 860 | static inline bool intel_pmu_has_bts(struct perf_event *event) | 865 | static inline bool intel_pmu_has_bts_period(struct perf_event *event, u64 period) |
| 861 | { | 866 | { |
| 862 | struct hw_perf_event *hwc = &event->hw; | 867 | struct hw_perf_event *hwc = &event->hw; |
| 863 | unsigned int hw_event, bts_event; | 868 | unsigned int hw_event, bts_event; |
| @@ -868,7 +873,14 @@ static inline bool intel_pmu_has_bts(struct perf_event *event) | |||
| 868 | hw_event = hwc->config & INTEL_ARCH_EVENT_MASK; | 873 | hw_event = hwc->config & INTEL_ARCH_EVENT_MASK; |
| 869 | bts_event = x86_pmu.event_map(PERF_COUNT_HW_BRANCH_INSTRUCTIONS); | 874 | bts_event = x86_pmu.event_map(PERF_COUNT_HW_BRANCH_INSTRUCTIONS); |
| 870 | 875 | ||
| 871 | return hw_event == bts_event && hwc->sample_period == 1; | 876 | return hw_event == bts_event && period == 1; |
| 877 | } | ||
| 878 | |||
| 879 | static inline bool intel_pmu_has_bts(struct perf_event *event) | ||
| 880 | { | ||
| 881 | struct hw_perf_event *hwc = &event->hw; | ||
| 882 | |||
| 883 | return intel_pmu_has_bts_period(event, hwc->sample_period); | ||
| 872 | } | 884 | } |
| 873 | 885 | ||
| 874 | int intel_pmu_save_and_restart(struct perf_event *event); | 886 | int intel_pmu_save_and_restart(struct perf_event *event); |
diff --git a/arch/x86/ia32/ia32_aout.c b/arch/x86/ia32/ia32_aout.c index f65b78d32f5e..7dbbe9ffda17 100644 --- a/arch/x86/ia32/ia32_aout.c +++ b/arch/x86/ia32/ia32_aout.c | |||
| @@ -51,7 +51,7 @@ static unsigned long get_dr(int n) | |||
| 51 | /* | 51 | /* |
| 52 | * fill in the user structure for a core dump.. | 52 | * fill in the user structure for a core dump.. |
| 53 | */ | 53 | */ |
| 54 | static void dump_thread32(struct pt_regs *regs, struct user32 *dump) | 54 | static void fill_dump(struct pt_regs *regs, struct user32 *dump) |
| 55 | { | 55 | { |
| 56 | u32 fs, gs; | 56 | u32 fs, gs; |
| 57 | memset(dump, 0, sizeof(*dump)); | 57 | memset(dump, 0, sizeof(*dump)); |
| @@ -157,10 +157,12 @@ static int aout_core_dump(struct coredump_params *cprm) | |||
| 157 | fs = get_fs(); | 157 | fs = get_fs(); |
| 158 | set_fs(KERNEL_DS); | 158 | set_fs(KERNEL_DS); |
| 159 | has_dumped = 1; | 159 | has_dumped = 1; |
| 160 | |||
| 161 | fill_dump(cprm->regs, &dump); | ||
| 162 | |||
| 160 | strncpy(dump.u_comm, current->comm, sizeof(current->comm)); | 163 | strncpy(dump.u_comm, current->comm, sizeof(current->comm)); |
| 161 | dump.u_ar0 = offsetof(struct user32, regs); | 164 | dump.u_ar0 = offsetof(struct user32, regs); |
| 162 | dump.signal = cprm->siginfo->si_signo; | 165 | dump.signal = cprm->siginfo->si_signo; |
| 163 | dump_thread32(cprm->regs, &dump); | ||
| 164 | 166 | ||
| 165 | /* | 167 | /* |
| 166 | * If the size of the dump file exceeds the rlimit, then see | 168 | * If the size of the dump file exceeds the rlimit, then see |
diff --git a/arch/x86/include/asm/intel-family.h b/arch/x86/include/asm/intel-family.h index 0dd6b0f4000e..9f15384c504a 100644 --- a/arch/x86/include/asm/intel-family.h +++ b/arch/x86/include/asm/intel-family.h | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | * "Big Core" Processors (Branded as Core, Xeon, etc...) | 6 | * "Big Core" Processors (Branded as Core, Xeon, etc...) |
| 7 | * | 7 | * |
| 8 | * The "_X" parts are generally the EP and EX Xeons, or the | 8 | * The "_X" parts are generally the EP and EX Xeons, or the |
| 9 | * "Extreme" ones, like Broadwell-E. | 9 | * "Extreme" ones, like Broadwell-E, or Atom microserver. |
| 10 | * | 10 | * |
| 11 | * While adding a new CPUID for a new microarchitecture, add a new | 11 | * While adding a new CPUID for a new microarchitecture, add a new |
| 12 | * group to keep logically sorted out in chronological order. Within | 12 | * group to keep logically sorted out in chronological order. Within |
| @@ -52,6 +52,8 @@ | |||
| 52 | 52 | ||
| 53 | #define INTEL_FAM6_CANNONLAKE_MOBILE 0x66 | 53 | #define INTEL_FAM6_CANNONLAKE_MOBILE 0x66 |
| 54 | 54 | ||
| 55 | #define INTEL_FAM6_ICELAKE_MOBILE 0x7E | ||
| 56 | |||
| 55 | /* "Small Core" Processors (Atom) */ | 57 | /* "Small Core" Processors (Atom) */ |
| 56 | 58 | ||
| 57 | #define INTEL_FAM6_ATOM_BONNELL 0x1C /* Diamondville, Pineview */ | 59 | #define INTEL_FAM6_ATOM_BONNELL 0x1C /* Diamondville, Pineview */ |
| @@ -71,6 +73,7 @@ | |||
| 71 | #define INTEL_FAM6_ATOM_GOLDMONT 0x5C /* Apollo Lake */ | 73 | #define INTEL_FAM6_ATOM_GOLDMONT 0x5C /* Apollo Lake */ |
| 72 | #define INTEL_FAM6_ATOM_GOLDMONT_X 0x5F /* Denverton */ | 74 | #define INTEL_FAM6_ATOM_GOLDMONT_X 0x5F /* Denverton */ |
| 73 | #define INTEL_FAM6_ATOM_GOLDMONT_PLUS 0x7A /* Gemini Lake */ | 75 | #define INTEL_FAM6_ATOM_GOLDMONT_PLUS 0x7A /* Gemini Lake */ |
| 76 | #define INTEL_FAM6_ATOM_TREMONT_X 0x86 /* Jacobsville */ | ||
| 74 | 77 | ||
| 75 | /* Xeon Phi */ | 78 | /* Xeon Phi */ |
| 76 | 79 | ||
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 4660ce90de7f..180373360e34 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h | |||
| @@ -299,6 +299,7 @@ union kvm_mmu_extended_role { | |||
| 299 | unsigned int cr4_smap:1; | 299 | unsigned int cr4_smap:1; |
| 300 | unsigned int cr4_smep:1; | 300 | unsigned int cr4_smep:1; |
| 301 | unsigned int cr4_la57:1; | 301 | unsigned int cr4_la57:1; |
| 302 | unsigned int maxphyaddr:6; | ||
| 302 | }; | 303 | }; |
| 303 | }; | 304 | }; |
| 304 | 305 | ||
| @@ -397,6 +398,7 @@ struct kvm_mmu { | |||
| 397 | void (*update_pte)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp, | 398 | void (*update_pte)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp, |
| 398 | u64 *spte, const void *pte); | 399 | u64 *spte, const void *pte); |
| 399 | hpa_t root_hpa; | 400 | hpa_t root_hpa; |
| 401 | gpa_t root_cr3; | ||
| 400 | union kvm_mmu_role mmu_role; | 402 | union kvm_mmu_role mmu_role; |
| 401 | u8 root_level; | 403 | u8 root_level; |
| 402 | u8 shadow_root_level; | 404 | u8 shadow_root_level; |
diff --git a/arch/x86/include/asm/mmu_context.h b/arch/x86/include/asm/mmu_context.h index 0ca50611e8ce..19d18fae6ec6 100644 --- a/arch/x86/include/asm/mmu_context.h +++ b/arch/x86/include/asm/mmu_context.h | |||
| @@ -178,6 +178,10 @@ static inline void switch_ldt(struct mm_struct *prev, struct mm_struct *next) | |||
| 178 | 178 | ||
| 179 | void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk); | 179 | void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk); |
| 180 | 180 | ||
| 181 | /* | ||
| 182 | * Init a new mm. Used on mm copies, like at fork() | ||
| 183 | * and on mm's that are brand-new, like at execve(). | ||
| 184 | */ | ||
| 181 | static inline int init_new_context(struct task_struct *tsk, | 185 | static inline int init_new_context(struct task_struct *tsk, |
| 182 | struct mm_struct *mm) | 186 | struct mm_struct *mm) |
| 183 | { | 187 | { |
| @@ -228,8 +232,22 @@ do { \ | |||
| 228 | } while (0) | 232 | } while (0) |
| 229 | #endif | 233 | #endif |
| 230 | 234 | ||
| 235 | static inline void arch_dup_pkeys(struct mm_struct *oldmm, | ||
| 236 | struct mm_struct *mm) | ||
| 237 | { | ||
| 238 | #ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS | ||
| 239 | if (!cpu_feature_enabled(X86_FEATURE_OSPKE)) | ||
| 240 | return; | ||
| 241 | |||
| 242 | /* Duplicate the oldmm pkey state in mm: */ | ||
| 243 | mm->context.pkey_allocation_map = oldmm->context.pkey_allocation_map; | ||
| 244 | mm->context.execute_only_pkey = oldmm->context.execute_only_pkey; | ||
| 245 | #endif | ||
| 246 | } | ||
| 247 | |||
| 231 | static inline int arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm) | 248 | static inline int arch_dup_mmap(struct mm_struct *oldmm, struct mm_struct *mm) |
| 232 | { | 249 | { |
| 250 | arch_dup_pkeys(oldmm, mm); | ||
| 233 | paravirt_arch_dup_mmap(oldmm, mm); | 251 | paravirt_arch_dup_mmap(oldmm, mm); |
| 234 | return ldt_dup_context(oldmm, mm); | 252 | return ldt_dup_context(oldmm, mm); |
| 235 | } | 253 | } |
diff --git a/arch/x86/include/asm/page_64_types.h b/arch/x86/include/asm/page_64_types.h index 8f657286d599..0ce558a8150d 100644 --- a/arch/x86/include/asm/page_64_types.h +++ b/arch/x86/include/asm/page_64_types.h | |||
| @@ -7,7 +7,11 @@ | |||
| 7 | #endif | 7 | #endif |
| 8 | 8 | ||
| 9 | #ifdef CONFIG_KASAN | 9 | #ifdef CONFIG_KASAN |
| 10 | #ifdef CONFIG_KASAN_EXTRA | ||
| 11 | #define KASAN_STACK_ORDER 2 | ||
| 12 | #else | ||
| 10 | #define KASAN_STACK_ORDER 1 | 13 | #define KASAN_STACK_ORDER 1 |
| 14 | #endif | ||
| 11 | #else | 15 | #else |
| 12 | #define KASAN_STACK_ORDER 0 | 16 | #define KASAN_STACK_ORDER 0 |
| 13 | #endif | 17 | #endif |
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index 40616e805292..2779ace16d23 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h | |||
| @@ -1065,7 +1065,7 @@ static inline void native_set_pte_at(struct mm_struct *mm, unsigned long addr, | |||
| 1065 | static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr, | 1065 | static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr, |
| 1066 | pmd_t *pmdp, pmd_t pmd) | 1066 | pmd_t *pmdp, pmd_t pmd) |
| 1067 | { | 1067 | { |
| 1068 | native_set_pmd(pmdp, pmd); | 1068 | set_pmd(pmdp, pmd); |
| 1069 | } | 1069 | } |
| 1070 | 1070 | ||
| 1071 | static inline void set_pud_at(struct mm_struct *mm, unsigned long addr, | 1071 | static inline void set_pud_at(struct mm_struct *mm, unsigned long addr, |
diff --git a/arch/x86/include/asm/resctrl_sched.h b/arch/x86/include/asm/resctrl_sched.h index 54990fe2a3ae..f6b7fe2833cc 100644 --- a/arch/x86/include/asm/resctrl_sched.h +++ b/arch/x86/include/asm/resctrl_sched.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | #ifndef _ASM_X86_RESCTRL_SCHED_H | 2 | #ifndef _ASM_X86_RESCTRL_SCHED_H |
| 3 | #define _ASM_X86_RESCTRL_SCHED_H | 3 | #define _ASM_X86_RESCTRL_SCHED_H |
| 4 | 4 | ||
| 5 | #ifdef CONFIG_RESCTRL | 5 | #ifdef CONFIG_X86_CPU_RESCTRL |
| 6 | 6 | ||
| 7 | #include <linux/sched.h> | 7 | #include <linux/sched.h> |
| 8 | #include <linux/jump_label.h> | 8 | #include <linux/jump_label.h> |
| @@ -88,6 +88,6 @@ static inline void resctrl_sched_in(void) | |||
| 88 | 88 | ||
| 89 | static inline void resctrl_sched_in(void) {} | 89 | static inline void resctrl_sched_in(void) {} |
| 90 | 90 | ||
| 91 | #endif /* CONFIG_RESCTRL */ | 91 | #endif /* CONFIG_X86_CPU_RESCTRL */ |
| 92 | 92 | ||
| 93 | #endif /* _ASM_X86_RESCTRL_SCHED_H */ | 93 | #endif /* _ASM_X86_RESCTRL_SCHED_H */ |
diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h index a77445d1b034..780f2b42c8ef 100644 --- a/arch/x86/include/asm/uaccess.h +++ b/arch/x86/include/asm/uaccess.h | |||
| @@ -711,7 +711,7 @@ static __must_check inline bool user_access_begin(const void __user *ptr, size_t | |||
| 711 | { | 711 | { |
| 712 | if (unlikely(!access_ok(ptr,len))) | 712 | if (unlikely(!access_ok(ptr,len))) |
| 713 | return 0; | 713 | return 0; |
| 714 | __uaccess_begin(); | 714 | __uaccess_begin_nospec(); |
| 715 | return 1; | 715 | return 1; |
| 716 | } | 716 | } |
| 717 | #define user_access_begin(a,b) user_access_begin(a,b) | 717 | #define user_access_begin(a,b) user_access_begin(a,b) |
diff --git a/arch/x86/include/asm/uv/bios.h b/arch/x86/include/asm/uv/bios.h index e652a7cc6186..3f697a9e3f59 100644 --- a/arch/x86/include/asm/uv/bios.h +++ b/arch/x86/include/asm/uv/bios.h | |||
| @@ -48,7 +48,8 @@ enum { | |||
| 48 | BIOS_STATUS_SUCCESS = 0, | 48 | BIOS_STATUS_SUCCESS = 0, |
| 49 | BIOS_STATUS_UNIMPLEMENTED = -ENOSYS, | 49 | BIOS_STATUS_UNIMPLEMENTED = -ENOSYS, |
| 50 | BIOS_STATUS_EINVAL = -EINVAL, | 50 | BIOS_STATUS_EINVAL = -EINVAL, |
| 51 | BIOS_STATUS_UNAVAIL = -EBUSY | 51 | BIOS_STATUS_UNAVAIL = -EBUSY, |
| 52 | BIOS_STATUS_ABORT = -EINTR, | ||
| 52 | }; | 53 | }; |
| 53 | 54 | ||
| 54 | /* Address map parameters */ | 55 | /* Address map parameters */ |
| @@ -167,4 +168,9 @@ extern long system_serial_number; | |||
| 167 | 168 | ||
| 168 | extern struct kobject *sgi_uv_kobj; /* /sys/firmware/sgi_uv */ | 169 | extern struct kobject *sgi_uv_kobj; /* /sys/firmware/sgi_uv */ |
| 169 | 170 | ||
| 171 | /* | ||
| 172 | * EFI runtime lock; cf. firmware/efi/runtime-wrappers.c for details | ||
| 173 | */ | ||
| 174 | extern struct semaphore __efi_uv_runtime_lock; | ||
| 175 | |||
| 170 | #endif /* _ASM_X86_UV_BIOS_H */ | 176 | #endif /* _ASM_X86_UV_BIOS_H */ |
diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile index ac78f90aea56..cfd24f9f7614 100644 --- a/arch/x86/kernel/cpu/Makefile +++ b/arch/x86/kernel/cpu/Makefile | |||
| @@ -39,7 +39,7 @@ obj-$(CONFIG_CPU_SUP_UMC_32) += umc.o | |||
| 39 | obj-$(CONFIG_X86_MCE) += mce/ | 39 | obj-$(CONFIG_X86_MCE) += mce/ |
| 40 | obj-$(CONFIG_MTRR) += mtrr/ | 40 | obj-$(CONFIG_MTRR) += mtrr/ |
| 41 | obj-$(CONFIG_MICROCODE) += microcode/ | 41 | obj-$(CONFIG_MICROCODE) += microcode/ |
| 42 | obj-$(CONFIG_RESCTRL) += resctrl/ | 42 | obj-$(CONFIG_X86_CPU_RESCTRL) += resctrl/ |
| 43 | 43 | ||
| 44 | obj-$(CONFIG_X86_LOCAL_APIC) += perfctr-watchdog.o | 44 | obj-$(CONFIG_X86_LOCAL_APIC) += perfctr-watchdog.o |
| 45 | 45 | ||
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index 8654b8b0c848..01874d54f4fd 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c | |||
| @@ -71,7 +71,7 @@ void __init check_bugs(void) | |||
| 71 | * identify_boot_cpu() initialized SMT support information, let the | 71 | * identify_boot_cpu() initialized SMT support information, let the |
| 72 | * core code know. | 72 | * core code know. |
| 73 | */ | 73 | */ |
| 74 | cpu_smt_check_topology_early(); | 74 | cpu_smt_check_topology(); |
| 75 | 75 | ||
| 76 | if (!IS_ENABLED(CONFIG_SMP)) { | 76 | if (!IS_ENABLED(CONFIG_SMP)) { |
| 77 | pr_info("CPU: "); | 77 | pr_info("CPU: "); |
| @@ -215,7 +215,7 @@ static enum spectre_v2_mitigation spectre_v2_enabled __ro_after_init = | |||
| 215 | static enum spectre_v2_user_mitigation spectre_v2_user __ro_after_init = | 215 | static enum spectre_v2_user_mitigation spectre_v2_user __ro_after_init = |
| 216 | SPECTRE_V2_USER_NONE; | 216 | SPECTRE_V2_USER_NONE; |
| 217 | 217 | ||
| 218 | #ifdef RETPOLINE | 218 | #ifdef CONFIG_RETPOLINE |
| 219 | static bool spectre_v2_bad_module; | 219 | static bool spectre_v2_bad_module; |
| 220 | 220 | ||
| 221 | bool retpoline_module_ok(bool has_retpoline) | 221 | bool retpoline_module_ok(bool has_retpoline) |
diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c index 672c7225cb1b..6ce290c506d9 100644 --- a/arch/x86/kernel/cpu/mce/core.c +++ b/arch/x86/kernel/cpu/mce/core.c | |||
| @@ -784,6 +784,7 @@ static int mce_no_way_out(struct mce *m, char **msg, unsigned long *validp, | |||
| 784 | quirk_no_way_out(i, m, regs); | 784 | quirk_no_way_out(i, m, regs); |
| 785 | 785 | ||
| 786 | if (mce_severity(m, mca_cfg.tolerant, &tmp, true) >= MCE_PANIC_SEVERITY) { | 786 | if (mce_severity(m, mca_cfg.tolerant, &tmp, true) >= MCE_PANIC_SEVERITY) { |
| 787 | m->bank = i; | ||
| 787 | mce_read_aux(m, i); | 788 | mce_read_aux(m, i); |
| 788 | *msg = tmp; | 789 | *msg = tmp; |
| 789 | return 1; | 790 | return 1; |
diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c index 51adde0a0f1a..e1f3ba19ba54 100644 --- a/arch/x86/kernel/cpu/microcode/amd.c +++ b/arch/x86/kernel/cpu/microcode/amd.c | |||
| @@ -855,7 +855,7 @@ load_microcode_amd(bool save, u8 family, const u8 *data, size_t size) | |||
| 855 | if (!p) { | 855 | if (!p) { |
| 856 | return ret; | 856 | return ret; |
| 857 | } else { | 857 | } else { |
| 858 | if (boot_cpu_data.microcode == p->patch_id) | 858 | if (boot_cpu_data.microcode >= p->patch_id) |
| 859 | return ret; | 859 | return ret; |
| 860 | 860 | ||
| 861 | ret = UCODE_NEW; | 861 | ret = UCODE_NEW; |
diff --git a/arch/x86/kernel/cpu/resctrl/Makefile b/arch/x86/kernel/cpu/resctrl/Makefile index 6895049ceef7..4a06c37b9cf1 100644 --- a/arch/x86/kernel/cpu/resctrl/Makefile +++ b/arch/x86/kernel/cpu/resctrl/Makefile | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0 | 1 | # SPDX-License-Identifier: GPL-2.0 |
| 2 | obj-$(CONFIG_RESCTRL) += core.o rdtgroup.o monitor.o | 2 | obj-$(CONFIG_X86_CPU_RESCTRL) += core.o rdtgroup.o monitor.o |
| 3 | obj-$(CONFIG_RESCTRL) += ctrlmondata.o pseudo_lock.o | 3 | obj-$(CONFIG_X86_CPU_RESCTRL) += ctrlmondata.o pseudo_lock.o |
| 4 | CFLAGS_pseudo_lock.o = -I$(src) | 4 | CFLAGS_pseudo_lock.o = -I$(src) |
diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c index c8b07d8ea5a2..17ffc869cab8 100644 --- a/arch/x86/kernel/crash.c +++ b/arch/x86/kernel/crash.c | |||
| @@ -470,6 +470,7 @@ int crash_load_segments(struct kimage *image) | |||
| 470 | 470 | ||
| 471 | kbuf.memsz = kbuf.bufsz; | 471 | kbuf.memsz = kbuf.bufsz; |
| 472 | kbuf.buf_align = ELF_CORE_HEADER_ALIGN; | 472 | kbuf.buf_align = ELF_CORE_HEADER_ALIGN; |
| 473 | kbuf.mem = KEXEC_BUF_MEM_UNKNOWN; | ||
| 473 | ret = kexec_add_buffer(&kbuf); | 474 | ret = kexec_add_buffer(&kbuf); |
| 474 | if (ret) { | 475 | if (ret) { |
| 475 | vfree((void *)image->arch.elf_headers); | 476 | vfree((void *)image->arch.elf_headers); |
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c index b0acb22e5a46..dfd3aca82c61 100644 --- a/arch/x86/kernel/hpet.c +++ b/arch/x86/kernel/hpet.c | |||
| @@ -21,10 +21,6 @@ | |||
| 21 | 21 | ||
| 22 | #define HPET_MASK CLOCKSOURCE_MASK(32) | 22 | #define HPET_MASK CLOCKSOURCE_MASK(32) |
| 23 | 23 | ||
| 24 | /* FSEC = 10^-15 | ||
| 25 | NSEC = 10^-9 */ | ||
| 26 | #define FSEC_PER_NSEC 1000000L | ||
| 27 | |||
| 28 | #define HPET_DEV_USED_BIT 2 | 24 | #define HPET_DEV_USED_BIT 2 |
| 29 | #define HPET_DEV_USED (1 << HPET_DEV_USED_BIT) | 25 | #define HPET_DEV_USED (1 << HPET_DEV_USED_BIT) |
| 30 | #define HPET_DEV_VALID 0x8 | 26 | #define HPET_DEV_VALID 0x8 |
diff --git a/arch/x86/kernel/kexec-bzimage64.c b/arch/x86/kernel/kexec-bzimage64.c index 278cd07228dd..53917a3ebf94 100644 --- a/arch/x86/kernel/kexec-bzimage64.c +++ b/arch/x86/kernel/kexec-bzimage64.c | |||
| @@ -167,6 +167,9 @@ setup_efi_state(struct boot_params *params, unsigned long params_load_addr, | |||
| 167 | struct efi_info *current_ei = &boot_params.efi_info; | 167 | struct efi_info *current_ei = &boot_params.efi_info; |
| 168 | struct efi_info *ei = ¶ms->efi_info; | 168 | struct efi_info *ei = ¶ms->efi_info; |
| 169 | 169 | ||
| 170 | if (!efi_enabled(EFI_RUNTIME_SERVICES)) | ||
| 171 | return 0; | ||
| 172 | |||
| 170 | if (!current_ei->efi_memmap_size) | 173 | if (!current_ei->efi_memmap_size) |
| 171 | return 0; | 174 | return 0; |
| 172 | 175 | ||
| @@ -434,6 +437,7 @@ static void *bzImage64_load(struct kimage *image, char *kernel, | |||
| 434 | kbuf.memsz = PAGE_ALIGN(header->init_size); | 437 | kbuf.memsz = PAGE_ALIGN(header->init_size); |
| 435 | kbuf.buf_align = header->kernel_alignment; | 438 | kbuf.buf_align = header->kernel_alignment; |
| 436 | kbuf.buf_min = MIN_KERNEL_LOAD_ADDR; | 439 | kbuf.buf_min = MIN_KERNEL_LOAD_ADDR; |
| 440 | kbuf.mem = KEXEC_BUF_MEM_UNKNOWN; | ||
| 437 | ret = kexec_add_buffer(&kbuf); | 441 | ret = kexec_add_buffer(&kbuf); |
| 438 | if (ret) | 442 | if (ret) |
| 439 | goto out_free_params; | 443 | goto out_free_params; |
| @@ -448,6 +452,7 @@ static void *bzImage64_load(struct kimage *image, char *kernel, | |||
| 448 | kbuf.bufsz = kbuf.memsz = initrd_len; | 452 | kbuf.bufsz = kbuf.memsz = initrd_len; |
| 449 | kbuf.buf_align = PAGE_SIZE; | 453 | kbuf.buf_align = PAGE_SIZE; |
| 450 | kbuf.buf_min = MIN_INITRD_LOAD_ADDR; | 454 | kbuf.buf_min = MIN_INITRD_LOAD_ADDR; |
| 455 | kbuf.mem = KEXEC_BUF_MEM_UNKNOWN; | ||
| 451 | ret = kexec_add_buffer(&kbuf); | 456 | ret = kexec_add_buffer(&kbuf); |
| 452 | if (ret) | 457 | if (ret) |
| 453 | goto out_free_params; | 458 | goto out_free_params; |
diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c index ba4bfb7f6a36..5c93a65ee1e5 100644 --- a/arch/x86/kernel/kvm.c +++ b/arch/x86/kernel/kvm.c | |||
| @@ -457,6 +457,7 @@ static void __send_ipi_mask(const struct cpumask *mask, int vector) | |||
| 457 | #else | 457 | #else |
| 458 | u64 ipi_bitmap = 0; | 458 | u64 ipi_bitmap = 0; |
| 459 | #endif | 459 | #endif |
| 460 | long ret; | ||
| 460 | 461 | ||
| 461 | if (cpumask_empty(mask)) | 462 | if (cpumask_empty(mask)) |
| 462 | return; | 463 | return; |
| @@ -482,8 +483,9 @@ static void __send_ipi_mask(const struct cpumask *mask, int vector) | |||
| 482 | } else if (apic_id < min + KVM_IPI_CLUSTER_SIZE) { | 483 | } else if (apic_id < min + KVM_IPI_CLUSTER_SIZE) { |
| 483 | max = apic_id < max ? max : apic_id; | 484 | max = apic_id < max ? max : apic_id; |
| 484 | } else { | 485 | } else { |
| 485 | kvm_hypercall4(KVM_HC_SEND_IPI, (unsigned long)ipi_bitmap, | 486 | ret = kvm_hypercall4(KVM_HC_SEND_IPI, (unsigned long)ipi_bitmap, |
| 486 | (unsigned long)(ipi_bitmap >> BITS_PER_LONG), min, icr); | 487 | (unsigned long)(ipi_bitmap >> BITS_PER_LONG), min, icr); |
| 488 | WARN_ONCE(ret < 0, "KVM: failed to send PV IPI: %ld", ret); | ||
| 487 | min = max = apic_id; | 489 | min = max = apic_id; |
| 488 | ipi_bitmap = 0; | 490 | ipi_bitmap = 0; |
| 489 | } | 491 | } |
| @@ -491,8 +493,9 @@ static void __send_ipi_mask(const struct cpumask *mask, int vector) | |||
| 491 | } | 493 | } |
| 492 | 494 | ||
| 493 | if (ipi_bitmap) { | 495 | if (ipi_bitmap) { |
| 494 | kvm_hypercall4(KVM_HC_SEND_IPI, (unsigned long)ipi_bitmap, | 496 | ret = kvm_hypercall4(KVM_HC_SEND_IPI, (unsigned long)ipi_bitmap, |
| 495 | (unsigned long)(ipi_bitmap >> BITS_PER_LONG), min, icr); | 497 | (unsigned long)(ipi_bitmap >> BITS_PER_LONG), min, icr); |
| 498 | WARN_ONCE(ret < 0, "KVM: failed to send PV IPI: %ld", ret); | ||
| 496 | } | 499 | } |
| 497 | 500 | ||
| 498 | local_irq_restore(flags); | 501 | local_irq_restore(flags); |
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index e9f777bfed40..3fae23834069 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c | |||
| @@ -297,15 +297,16 @@ static int __init tsc_setup(char *str) | |||
| 297 | 297 | ||
| 298 | __setup("tsc=", tsc_setup); | 298 | __setup("tsc=", tsc_setup); |
| 299 | 299 | ||
| 300 | #define MAX_RETRIES 5 | 300 | #define MAX_RETRIES 5 |
| 301 | #define SMI_TRESHOLD 50000 | 301 | #define TSC_DEFAULT_THRESHOLD 0x20000 |
| 302 | 302 | ||
| 303 | /* | 303 | /* |
| 304 | * Read TSC and the reference counters. Take care of SMI disturbance | 304 | * Read TSC and the reference counters. Take care of any disturbances |
| 305 | */ | 305 | */ |
| 306 | static u64 tsc_read_refs(u64 *p, int hpet) | 306 | static u64 tsc_read_refs(u64 *p, int hpet) |
| 307 | { | 307 | { |
| 308 | u64 t1, t2; | 308 | u64 t1, t2; |
| 309 | u64 thresh = tsc_khz ? tsc_khz >> 5 : TSC_DEFAULT_THRESHOLD; | ||
| 309 | int i; | 310 | int i; |
| 310 | 311 | ||
| 311 | for (i = 0; i < MAX_RETRIES; i++) { | 312 | for (i = 0; i < MAX_RETRIES; i++) { |
| @@ -315,7 +316,7 @@ static u64 tsc_read_refs(u64 *p, int hpet) | |||
| 315 | else | 316 | else |
| 316 | *p = acpi_pm_read_early(); | 317 | *p = acpi_pm_read_early(); |
| 317 | t2 = get_cycles(); | 318 | t2 = get_cycles(); |
| 318 | if ((t2 - t1) < SMI_TRESHOLD) | 319 | if ((t2 - t1) < thresh) |
| 319 | return t2; | 320 | return t2; |
| 320 | } | 321 | } |
| 321 | return ULLONG_MAX; | 322 | return ULLONG_MAX; |
| @@ -703,15 +704,15 @@ static unsigned long pit_hpet_ptimer_calibrate_cpu(void) | |||
| 703 | * zero. In each wait loop iteration we read the TSC and check | 704 | * zero. In each wait loop iteration we read the TSC and check |
| 704 | * the delta to the previous read. We keep track of the min | 705 | * the delta to the previous read. We keep track of the min |
| 705 | * and max values of that delta. The delta is mostly defined | 706 | * and max values of that delta. The delta is mostly defined |
| 706 | * by the IO time of the PIT access, so we can detect when a | 707 | * by the IO time of the PIT access, so we can detect when |
| 707 | * SMI/SMM disturbance happened between the two reads. If the | 708 | * any disturbance happened between the two reads. If the |
| 708 | * maximum time is significantly larger than the minimum time, | 709 | * maximum time is significantly larger than the minimum time, |
| 709 | * then we discard the result and have another try. | 710 | * then we discard the result and have another try. |
| 710 | * | 711 | * |
| 711 | * 2) Reference counter. If available we use the HPET or the | 712 | * 2) Reference counter. If available we use the HPET or the |
| 712 | * PMTIMER as a reference to check the sanity of that value. | 713 | * PMTIMER as a reference to check the sanity of that value. |
| 713 | * We use separate TSC readouts and check inside of the | 714 | * We use separate TSC readouts and check inside of the |
| 714 | * reference read for a SMI/SMM disturbance. We dicard | 715 | * reference read for any possible disturbance. We dicard |
| 715 | * disturbed values here as well. We do that around the PIT | 716 | * disturbed values here as well. We do that around the PIT |
| 716 | * calibration delay loop as we have to wait for a certain | 717 | * calibration delay loop as we have to wait for a certain |
| 717 | * amount of time anyway. | 718 | * amount of time anyway. |
| @@ -744,7 +745,7 @@ static unsigned long pit_hpet_ptimer_calibrate_cpu(void) | |||
| 744 | if (ref1 == ref2) | 745 | if (ref1 == ref2) |
| 745 | continue; | 746 | continue; |
| 746 | 747 | ||
| 747 | /* Check, whether the sampling was disturbed by an SMI */ | 748 | /* Check, whether the sampling was disturbed */ |
| 748 | if (tsc1 == ULLONG_MAX || tsc2 == ULLONG_MAX) | 749 | if (tsc1 == ULLONG_MAX || tsc2 == ULLONG_MAX) |
| 749 | continue; | 750 | continue; |
| 750 | 751 | ||
| @@ -1268,7 +1269,7 @@ static DECLARE_DELAYED_WORK(tsc_irqwork, tsc_refine_calibration_work); | |||
| 1268 | */ | 1269 | */ |
| 1269 | static void tsc_refine_calibration_work(struct work_struct *work) | 1270 | static void tsc_refine_calibration_work(struct work_struct *work) |
| 1270 | { | 1271 | { |
| 1271 | static u64 tsc_start = -1, ref_start; | 1272 | static u64 tsc_start = ULLONG_MAX, ref_start; |
| 1272 | static int hpet; | 1273 | static int hpet; |
| 1273 | u64 tsc_stop, ref_stop, delta; | 1274 | u64 tsc_stop, ref_stop, delta; |
| 1274 | unsigned long freq; | 1275 | unsigned long freq; |
| @@ -1283,14 +1284,15 @@ static void tsc_refine_calibration_work(struct work_struct *work) | |||
| 1283 | * delayed the first time we expire. So set the workqueue | 1284 | * delayed the first time we expire. So set the workqueue |
| 1284 | * again once we know timers are working. | 1285 | * again once we know timers are working. |
| 1285 | */ | 1286 | */ |
| 1286 | if (tsc_start == -1) { | 1287 | if (tsc_start == ULLONG_MAX) { |
| 1288 | restart: | ||
| 1287 | /* | 1289 | /* |
| 1288 | * Only set hpet once, to avoid mixing hardware | 1290 | * Only set hpet once, to avoid mixing hardware |
| 1289 | * if the hpet becomes enabled later. | 1291 | * if the hpet becomes enabled later. |
| 1290 | */ | 1292 | */ |
| 1291 | hpet = is_hpet_enabled(); | 1293 | hpet = is_hpet_enabled(); |
| 1292 | schedule_delayed_work(&tsc_irqwork, HZ); | ||
| 1293 | tsc_start = tsc_read_refs(&ref_start, hpet); | 1294 | tsc_start = tsc_read_refs(&ref_start, hpet); |
| 1295 | schedule_delayed_work(&tsc_irqwork, HZ); | ||
| 1294 | return; | 1296 | return; |
| 1295 | } | 1297 | } |
| 1296 | 1298 | ||
| @@ -1300,9 +1302,9 @@ static void tsc_refine_calibration_work(struct work_struct *work) | |||
| 1300 | if (ref_start == ref_stop) | 1302 | if (ref_start == ref_stop) |
| 1301 | goto out; | 1303 | goto out; |
| 1302 | 1304 | ||
| 1303 | /* Check, whether the sampling was disturbed by an SMI */ | 1305 | /* Check, whether the sampling was disturbed */ |
| 1304 | if (tsc_start == ULLONG_MAX || tsc_stop == ULLONG_MAX) | 1306 | if (tsc_stop == ULLONG_MAX) |
| 1305 | goto out; | 1307 | goto restart; |
| 1306 | 1308 | ||
| 1307 | delta = tsc_stop - tsc_start; | 1309 | delta = tsc_stop - tsc_start; |
| 1308 | delta *= 1000000LL; | 1310 | delta *= 1000000LL; |
diff --git a/arch/x86/kvm/Makefile b/arch/x86/kvm/Makefile index 69b3a7c30013..31ecf7a76d5a 100644 --- a/arch/x86/kvm/Makefile +++ b/arch/x86/kvm/Makefile | |||
| @@ -2,10 +2,6 @@ | |||
| 2 | 2 | ||
| 3 | ccflags-y += -Iarch/x86/kvm | 3 | ccflags-y += -Iarch/x86/kvm |
| 4 | 4 | ||
| 5 | CFLAGS_x86.o := -I. | ||
| 6 | CFLAGS_svm.o := -I. | ||
| 7 | CFLAGS_vmx.o := -I. | ||
| 8 | |||
| 9 | KVM := ../../../virt/kvm | 5 | KVM := ../../../virt/kvm |
| 10 | 6 | ||
| 11 | kvm-y += $(KVM)/kvm_main.o $(KVM)/coalesced_mmio.o \ | 7 | kvm-y += $(KVM)/kvm_main.o $(KVM)/coalesced_mmio.o \ |
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c index bbffa6c54697..c07958b59f50 100644 --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c | |||
| @@ -335,6 +335,7 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function, | |||
| 335 | unsigned f_xsaves = kvm_x86_ops->xsaves_supported() ? F(XSAVES) : 0; | 335 | unsigned f_xsaves = kvm_x86_ops->xsaves_supported() ? F(XSAVES) : 0; |
| 336 | unsigned f_umip = kvm_x86_ops->umip_emulated() ? F(UMIP) : 0; | 336 | unsigned f_umip = kvm_x86_ops->umip_emulated() ? F(UMIP) : 0; |
| 337 | unsigned f_intel_pt = kvm_x86_ops->pt_supported() ? F(INTEL_PT) : 0; | 337 | unsigned f_intel_pt = kvm_x86_ops->pt_supported() ? F(INTEL_PT) : 0; |
| 338 | unsigned f_la57 = 0; | ||
| 338 | 339 | ||
| 339 | /* cpuid 1.edx */ | 340 | /* cpuid 1.edx */ |
| 340 | const u32 kvm_cpuid_1_edx_x86_features = | 341 | const u32 kvm_cpuid_1_edx_x86_features = |
| @@ -489,7 +490,10 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function, | |||
| 489 | // TSC_ADJUST is emulated | 490 | // TSC_ADJUST is emulated |
| 490 | entry->ebx |= F(TSC_ADJUST); | 491 | entry->ebx |= F(TSC_ADJUST); |
| 491 | entry->ecx &= kvm_cpuid_7_0_ecx_x86_features; | 492 | entry->ecx &= kvm_cpuid_7_0_ecx_x86_features; |
| 493 | f_la57 = entry->ecx & F(LA57); | ||
| 492 | cpuid_mask(&entry->ecx, CPUID_7_ECX); | 494 | cpuid_mask(&entry->ecx, CPUID_7_ECX); |
| 495 | /* Set LA57 based on hardware capability. */ | ||
| 496 | entry->ecx |= f_la57; | ||
| 493 | entry->ecx |= f_umip; | 497 | entry->ecx |= f_umip; |
| 494 | /* PKU is not yet implemented for shadow paging. */ | 498 | /* PKU is not yet implemented for shadow paging. */ |
| 495 | if (!tdp_enabled || !boot_cpu_has(X86_FEATURE_OSPKE)) | 499 | if (!tdp_enabled || !boot_cpu_has(X86_FEATURE_OSPKE)) |
diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c index c90a5352d158..89d20ed1d2e8 100644 --- a/arch/x86/kvm/hyperv.c +++ b/arch/x86/kvm/hyperv.c | |||
| @@ -1636,7 +1636,7 @@ int kvm_hv_hypercall(struct kvm_vcpu *vcpu) | |||
| 1636 | ret = kvm_hvcall_signal_event(vcpu, fast, ingpa); | 1636 | ret = kvm_hvcall_signal_event(vcpu, fast, ingpa); |
| 1637 | if (ret != HV_STATUS_INVALID_PORT_ID) | 1637 | if (ret != HV_STATUS_INVALID_PORT_ID) |
| 1638 | break; | 1638 | break; |
| 1639 | /* maybe userspace knows this conn_id: fall through */ | 1639 | /* fall through - maybe userspace knows this conn_id. */ |
| 1640 | case HVCALL_POST_MESSAGE: | 1640 | case HVCALL_POST_MESSAGE: |
| 1641 | /* don't bother userspace if it has no way to handle it */ | 1641 | /* don't bother userspace if it has no way to handle it */ |
| 1642 | if (unlikely(rep || !vcpu_to_synic(vcpu)->active)) { | 1642 | if (unlikely(rep || !vcpu_to_synic(vcpu)->active)) { |
| @@ -1832,7 +1832,6 @@ int kvm_vcpu_ioctl_get_hv_cpuid(struct kvm_vcpu *vcpu, struct kvm_cpuid2 *cpuid, | |||
| 1832 | ent->eax |= HV_X64_MSR_VP_INDEX_AVAILABLE; | 1832 | ent->eax |= HV_X64_MSR_VP_INDEX_AVAILABLE; |
| 1833 | ent->eax |= HV_X64_MSR_RESET_AVAILABLE; | 1833 | ent->eax |= HV_X64_MSR_RESET_AVAILABLE; |
| 1834 | ent->eax |= HV_MSR_REFERENCE_TSC_AVAILABLE; | 1834 | ent->eax |= HV_MSR_REFERENCE_TSC_AVAILABLE; |
| 1835 | ent->eax |= HV_X64_MSR_GUEST_IDLE_AVAILABLE; | ||
| 1836 | ent->eax |= HV_X64_ACCESS_FREQUENCY_MSRS; | 1835 | ent->eax |= HV_X64_ACCESS_FREQUENCY_MSRS; |
| 1837 | ent->eax |= HV_X64_ACCESS_REENLIGHTENMENT; | 1836 | ent->eax |= HV_X64_ACCESS_REENLIGHTENMENT; |
| 1838 | 1837 | ||
| @@ -1848,11 +1847,11 @@ int kvm_vcpu_ioctl_get_hv_cpuid(struct kvm_vcpu *vcpu, struct kvm_cpuid2 *cpuid, | |||
| 1848 | case HYPERV_CPUID_ENLIGHTMENT_INFO: | 1847 | case HYPERV_CPUID_ENLIGHTMENT_INFO: |
| 1849 | ent->eax |= HV_X64_REMOTE_TLB_FLUSH_RECOMMENDED; | 1848 | ent->eax |= HV_X64_REMOTE_TLB_FLUSH_RECOMMENDED; |
| 1850 | ent->eax |= HV_X64_APIC_ACCESS_RECOMMENDED; | 1849 | ent->eax |= HV_X64_APIC_ACCESS_RECOMMENDED; |
| 1851 | ent->eax |= HV_X64_SYSTEM_RESET_RECOMMENDED; | ||
| 1852 | ent->eax |= HV_X64_RELAXED_TIMING_RECOMMENDED; | 1850 | ent->eax |= HV_X64_RELAXED_TIMING_RECOMMENDED; |
| 1853 | ent->eax |= HV_X64_CLUSTER_IPI_RECOMMENDED; | 1851 | ent->eax |= HV_X64_CLUSTER_IPI_RECOMMENDED; |
| 1854 | ent->eax |= HV_X64_EX_PROCESSOR_MASKS_RECOMMENDED; | 1852 | ent->eax |= HV_X64_EX_PROCESSOR_MASKS_RECOMMENDED; |
| 1855 | ent->eax |= HV_X64_ENLIGHTENED_VMCS_RECOMMENDED; | 1853 | if (evmcs_ver) |
| 1854 | ent->eax |= HV_X64_ENLIGHTENED_VMCS_RECOMMENDED; | ||
| 1856 | 1855 | ||
| 1857 | /* | 1856 | /* |
| 1858 | * Default number of spinlock retry attempts, matches | 1857 | * Default number of spinlock retry attempts, matches |
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 9f089e2e09d0..4b6c2da7265c 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c | |||
| @@ -1035,6 +1035,7 @@ static int __apic_accept_irq(struct kvm_lapic *apic, int delivery_mode, | |||
| 1035 | switch (delivery_mode) { | 1035 | switch (delivery_mode) { |
| 1036 | case APIC_DM_LOWEST: | 1036 | case APIC_DM_LOWEST: |
| 1037 | vcpu->arch.apic_arb_prio++; | 1037 | vcpu->arch.apic_arb_prio++; |
| 1038 | /* fall through */ | ||
| 1038 | case APIC_DM_FIXED: | 1039 | case APIC_DM_FIXED: |
| 1039 | if (unlikely(trig_mode && !level)) | 1040 | if (unlikely(trig_mode && !level)) |
| 1040 | break; | 1041 | break; |
| @@ -1874,6 +1875,7 @@ int kvm_lapic_reg_write(struct kvm_lapic *apic, u32 reg, u32 val) | |||
| 1874 | 1875 | ||
| 1875 | case APIC_LVT0: | 1876 | case APIC_LVT0: |
| 1876 | apic_manage_nmi_watchdog(apic, val); | 1877 | apic_manage_nmi_watchdog(apic, val); |
| 1878 | /* fall through */ | ||
| 1877 | case APIC_LVTTHMR: | 1879 | case APIC_LVTTHMR: |
| 1878 | case APIC_LVTPC: | 1880 | case APIC_LVTPC: |
| 1879 | case APIC_LVT1: | 1881 | case APIC_LVT1: |
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index ce770b446238..f2d1d230d5b8 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
| @@ -3555,6 +3555,7 @@ void kvm_mmu_free_roots(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, | |||
| 3555 | &invalid_list); | 3555 | &invalid_list); |
| 3556 | mmu->root_hpa = INVALID_PAGE; | 3556 | mmu->root_hpa = INVALID_PAGE; |
| 3557 | } | 3557 | } |
| 3558 | mmu->root_cr3 = 0; | ||
| 3558 | } | 3559 | } |
| 3559 | 3560 | ||
| 3560 | kvm_mmu_commit_zap_page(vcpu->kvm, &invalid_list); | 3561 | kvm_mmu_commit_zap_page(vcpu->kvm, &invalid_list); |
| @@ -3610,6 +3611,7 @@ static int mmu_alloc_direct_roots(struct kvm_vcpu *vcpu) | |||
| 3610 | vcpu->arch.mmu->root_hpa = __pa(vcpu->arch.mmu->pae_root); | 3611 | vcpu->arch.mmu->root_hpa = __pa(vcpu->arch.mmu->pae_root); |
| 3611 | } else | 3612 | } else |
| 3612 | BUG(); | 3613 | BUG(); |
| 3614 | vcpu->arch.mmu->root_cr3 = vcpu->arch.mmu->get_cr3(vcpu); | ||
| 3613 | 3615 | ||
| 3614 | return 0; | 3616 | return 0; |
| 3615 | } | 3617 | } |
| @@ -3618,10 +3620,11 @@ static int mmu_alloc_shadow_roots(struct kvm_vcpu *vcpu) | |||
| 3618 | { | 3620 | { |
| 3619 | struct kvm_mmu_page *sp; | 3621 | struct kvm_mmu_page *sp; |
| 3620 | u64 pdptr, pm_mask; | 3622 | u64 pdptr, pm_mask; |
| 3621 | gfn_t root_gfn; | 3623 | gfn_t root_gfn, root_cr3; |
| 3622 | int i; | 3624 | int i; |
| 3623 | 3625 | ||
| 3624 | root_gfn = vcpu->arch.mmu->get_cr3(vcpu) >> PAGE_SHIFT; | 3626 | root_cr3 = vcpu->arch.mmu->get_cr3(vcpu); |
| 3627 | root_gfn = root_cr3 >> PAGE_SHIFT; | ||
| 3625 | 3628 | ||
| 3626 | if (mmu_check_root(vcpu, root_gfn)) | 3629 | if (mmu_check_root(vcpu, root_gfn)) |
| 3627 | return 1; | 3630 | return 1; |
| @@ -3646,7 +3649,7 @@ static int mmu_alloc_shadow_roots(struct kvm_vcpu *vcpu) | |||
| 3646 | ++sp->root_count; | 3649 | ++sp->root_count; |
| 3647 | spin_unlock(&vcpu->kvm->mmu_lock); | 3650 | spin_unlock(&vcpu->kvm->mmu_lock); |
| 3648 | vcpu->arch.mmu->root_hpa = root; | 3651 | vcpu->arch.mmu->root_hpa = root; |
| 3649 | return 0; | 3652 | goto set_root_cr3; |
| 3650 | } | 3653 | } |
| 3651 | 3654 | ||
| 3652 | /* | 3655 | /* |
| @@ -3712,6 +3715,9 @@ static int mmu_alloc_shadow_roots(struct kvm_vcpu *vcpu) | |||
| 3712 | vcpu->arch.mmu->root_hpa = __pa(vcpu->arch.mmu->lm_root); | 3715 | vcpu->arch.mmu->root_hpa = __pa(vcpu->arch.mmu->lm_root); |
| 3713 | } | 3716 | } |
| 3714 | 3717 | ||
| 3718 | set_root_cr3: | ||
| 3719 | vcpu->arch.mmu->root_cr3 = root_cr3; | ||
| 3720 | |||
| 3715 | return 0; | 3721 | return 0; |
| 3716 | } | 3722 | } |
| 3717 | 3723 | ||
| @@ -4163,7 +4169,7 @@ static bool cached_root_available(struct kvm_vcpu *vcpu, gpa_t new_cr3, | |||
| 4163 | struct kvm_mmu_root_info root; | 4169 | struct kvm_mmu_root_info root; |
| 4164 | struct kvm_mmu *mmu = vcpu->arch.mmu; | 4170 | struct kvm_mmu *mmu = vcpu->arch.mmu; |
| 4165 | 4171 | ||
| 4166 | root.cr3 = mmu->get_cr3(vcpu); | 4172 | root.cr3 = mmu->root_cr3; |
| 4167 | root.hpa = mmu->root_hpa; | 4173 | root.hpa = mmu->root_hpa; |
| 4168 | 4174 | ||
| 4169 | for (i = 0; i < KVM_MMU_NUM_PREV_ROOTS; i++) { | 4175 | for (i = 0; i < KVM_MMU_NUM_PREV_ROOTS; i++) { |
| @@ -4176,6 +4182,7 @@ static bool cached_root_available(struct kvm_vcpu *vcpu, gpa_t new_cr3, | |||
| 4176 | } | 4182 | } |
| 4177 | 4183 | ||
| 4178 | mmu->root_hpa = root.hpa; | 4184 | mmu->root_hpa = root.hpa; |
| 4185 | mmu->root_cr3 = root.cr3; | ||
| 4179 | 4186 | ||
| 4180 | return i < KVM_MMU_NUM_PREV_ROOTS; | 4187 | return i < KVM_MMU_NUM_PREV_ROOTS; |
| 4181 | } | 4188 | } |
| @@ -4371,6 +4378,7 @@ __reset_rsvds_bits_mask(struct kvm_vcpu *vcpu, | |||
| 4371 | rsvd_bits(maxphyaddr, 51); | 4378 | rsvd_bits(maxphyaddr, 51); |
| 4372 | rsvd_check->rsvd_bits_mask[1][4] = | 4379 | rsvd_check->rsvd_bits_mask[1][4] = |
| 4373 | rsvd_check->rsvd_bits_mask[0][4]; | 4380 | rsvd_check->rsvd_bits_mask[0][4]; |
| 4381 | /* fall through */ | ||
| 4374 | case PT64_ROOT_4LEVEL: | 4382 | case PT64_ROOT_4LEVEL: |
| 4375 | rsvd_check->rsvd_bits_mask[0][3] = exb_bit_rsvd | | 4383 | rsvd_check->rsvd_bits_mask[0][3] = exb_bit_rsvd | |
| 4376 | nonleaf_bit8_rsvd | rsvd_bits(7, 7) | | 4384 | nonleaf_bit8_rsvd | rsvd_bits(7, 7) | |
| @@ -4769,6 +4777,7 @@ static union kvm_mmu_extended_role kvm_calc_mmu_role_ext(struct kvm_vcpu *vcpu) | |||
| 4769 | ext.cr4_pse = !!is_pse(vcpu); | 4777 | ext.cr4_pse = !!is_pse(vcpu); |
| 4770 | ext.cr4_pke = !!kvm_read_cr4_bits(vcpu, X86_CR4_PKE); | 4778 | ext.cr4_pke = !!kvm_read_cr4_bits(vcpu, X86_CR4_PKE); |
| 4771 | ext.cr4_la57 = !!kvm_read_cr4_bits(vcpu, X86_CR4_LA57); | 4779 | ext.cr4_la57 = !!kvm_read_cr4_bits(vcpu, X86_CR4_LA57); |
| 4780 | ext.maxphyaddr = cpuid_maxphyaddr(vcpu); | ||
| 4772 | 4781 | ||
| 4773 | ext.valid = 1; | 4782 | ext.valid = 1; |
| 4774 | 4783 | ||
| @@ -5515,11 +5524,13 @@ int kvm_mmu_create(struct kvm_vcpu *vcpu) | |||
| 5515 | vcpu->arch.walk_mmu = &vcpu->arch.root_mmu; | 5524 | vcpu->arch.walk_mmu = &vcpu->arch.root_mmu; |
| 5516 | 5525 | ||
| 5517 | vcpu->arch.root_mmu.root_hpa = INVALID_PAGE; | 5526 | vcpu->arch.root_mmu.root_hpa = INVALID_PAGE; |
| 5527 | vcpu->arch.root_mmu.root_cr3 = 0; | ||
| 5518 | vcpu->arch.root_mmu.translate_gpa = translate_gpa; | 5528 | vcpu->arch.root_mmu.translate_gpa = translate_gpa; |
| 5519 | for (i = 0; i < KVM_MMU_NUM_PREV_ROOTS; i++) | 5529 | for (i = 0; i < KVM_MMU_NUM_PREV_ROOTS; i++) |
| 5520 | vcpu->arch.root_mmu.prev_roots[i] = KVM_MMU_ROOT_INFO_INVALID; | 5530 | vcpu->arch.root_mmu.prev_roots[i] = KVM_MMU_ROOT_INFO_INVALID; |
| 5521 | 5531 | ||
| 5522 | vcpu->arch.guest_mmu.root_hpa = INVALID_PAGE; | 5532 | vcpu->arch.guest_mmu.root_hpa = INVALID_PAGE; |
| 5533 | vcpu->arch.guest_mmu.root_cr3 = 0; | ||
| 5523 | vcpu->arch.guest_mmu.translate_gpa = translate_gpa; | 5534 | vcpu->arch.guest_mmu.translate_gpa = translate_gpa; |
| 5524 | for (i = 0; i < KVM_MMU_NUM_PREV_ROOTS; i++) | 5535 | for (i = 0; i < KVM_MMU_NUM_PREV_ROOTS; i++) |
| 5525 | vcpu->arch.guest_mmu.prev_roots[i] = KVM_MMU_ROOT_INFO_INVALID; | 5536 | vcpu->arch.guest_mmu.prev_roots[i] = KVM_MMU_ROOT_INFO_INVALID; |
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 307e5bddb6d9..f13a3a24d360 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
| @@ -3414,6 +3414,14 @@ static int nested_svm_vmexit(struct vcpu_svm *svm) | |||
| 3414 | kvm_mmu_reset_context(&svm->vcpu); | 3414 | kvm_mmu_reset_context(&svm->vcpu); |
| 3415 | kvm_mmu_load(&svm->vcpu); | 3415 | kvm_mmu_load(&svm->vcpu); |
| 3416 | 3416 | ||
| 3417 | /* | ||
| 3418 | * Drop what we picked up for L2 via svm_complete_interrupts() so it | ||
| 3419 | * doesn't end up in L1. | ||
| 3420 | */ | ||
| 3421 | svm->vcpu.arch.nmi_injected = false; | ||
| 3422 | kvm_clear_exception_queue(&svm->vcpu); | ||
| 3423 | kvm_clear_interrupt_queue(&svm->vcpu); | ||
| 3424 | |||
| 3417 | return 0; | 3425 | return 0; |
| 3418 | } | 3426 | } |
| 3419 | 3427 | ||
| @@ -4395,7 +4403,7 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr) | |||
| 4395 | case MSR_IA32_APICBASE: | 4403 | case MSR_IA32_APICBASE: |
| 4396 | if (kvm_vcpu_apicv_active(vcpu)) | 4404 | if (kvm_vcpu_apicv_active(vcpu)) |
| 4397 | avic_update_vapic_bar(to_svm(vcpu), data); | 4405 | avic_update_vapic_bar(to_svm(vcpu), data); |
| 4398 | /* Follow through */ | 4406 | /* Fall through */ |
| 4399 | default: | 4407 | default: |
| 4400 | return kvm_set_msr_common(vcpu, msr); | 4408 | return kvm_set_msr_common(vcpu, msr); |
| 4401 | } | 4409 | } |
| @@ -4504,28 +4512,19 @@ static int avic_incomplete_ipi_interception(struct vcpu_svm *svm) | |||
| 4504 | kvm_lapic_reg_write(apic, APIC_ICR, icrl); | 4512 | kvm_lapic_reg_write(apic, APIC_ICR, icrl); |
| 4505 | break; | 4513 | break; |
| 4506 | case AVIC_IPI_FAILURE_TARGET_NOT_RUNNING: { | 4514 | case AVIC_IPI_FAILURE_TARGET_NOT_RUNNING: { |
| 4507 | int i; | ||
| 4508 | struct kvm_vcpu *vcpu; | ||
| 4509 | struct kvm *kvm = svm->vcpu.kvm; | ||
| 4510 | struct kvm_lapic *apic = svm->vcpu.arch.apic; | 4515 | struct kvm_lapic *apic = svm->vcpu.arch.apic; |
| 4511 | 4516 | ||
| 4512 | /* | 4517 | /* |
| 4513 | * At this point, we expect that the AVIC HW has already | 4518 | * Update ICR high and low, then emulate sending IPI, |
| 4514 | * set the appropriate IRR bits on the valid target | 4519 | * which is handled when writing APIC_ICR. |
| 4515 | * vcpus. So, we just need to kick the appropriate vcpu. | ||
| 4516 | */ | 4520 | */ |
| 4517 | kvm_for_each_vcpu(i, vcpu, kvm) { | 4521 | kvm_lapic_reg_write(apic, APIC_ICR2, icrh); |
| 4518 | bool m = kvm_apic_match_dest(vcpu, apic, | 4522 | kvm_lapic_reg_write(apic, APIC_ICR, icrl); |
| 4519 | icrl & KVM_APIC_SHORT_MASK, | ||
| 4520 | GET_APIC_DEST_FIELD(icrh), | ||
| 4521 | icrl & KVM_APIC_DEST_MASK); | ||
| 4522 | |||
| 4523 | if (m && !avic_vcpu_is_running(vcpu)) | ||
| 4524 | kvm_vcpu_wake_up(vcpu); | ||
| 4525 | } | ||
| 4526 | break; | 4523 | break; |
| 4527 | } | 4524 | } |
| 4528 | case AVIC_IPI_FAILURE_INVALID_TARGET: | 4525 | case AVIC_IPI_FAILURE_INVALID_TARGET: |
| 4526 | WARN_ONCE(1, "Invalid IPI target: index=%u, vcpu=%d, icr=%#0x:%#0x\n", | ||
| 4527 | index, svm->vcpu.vcpu_id, icrh, icrl); | ||
| 4529 | break; | 4528 | break; |
| 4530 | case AVIC_IPI_FAILURE_INVALID_BACKING_PAGE: | 4529 | case AVIC_IPI_FAILURE_INVALID_BACKING_PAGE: |
| 4531 | WARN_ONCE(1, "Invalid backing page\n"); | 4530 | WARN_ONCE(1, "Invalid backing page\n"); |
| @@ -6278,6 +6277,9 @@ static int sev_guest_init(struct kvm *kvm, struct kvm_sev_cmd *argp) | |||
| 6278 | int asid, ret; | 6277 | int asid, ret; |
| 6279 | 6278 | ||
| 6280 | ret = -EBUSY; | 6279 | ret = -EBUSY; |
| 6280 | if (unlikely(sev->active)) | ||
| 6281 | return ret; | ||
| 6282 | |||
| 6281 | asid = sev_asid_new(); | 6283 | asid = sev_asid_new(); |
| 6282 | if (asid < 0) | 6284 | if (asid < 0) |
| 6283 | return ret; | 6285 | return ret; |
diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h index 705f40ae2532..6432d08c7de7 100644 --- a/arch/x86/kvm/trace.h +++ b/arch/x86/kvm/trace.h | |||
| @@ -1465,7 +1465,7 @@ TRACE_EVENT(kvm_hv_send_ipi_ex, | |||
| 1465 | #endif /* _TRACE_KVM_H */ | 1465 | #endif /* _TRACE_KVM_H */ |
| 1466 | 1466 | ||
| 1467 | #undef TRACE_INCLUDE_PATH | 1467 | #undef TRACE_INCLUDE_PATH |
| 1468 | #define TRACE_INCLUDE_PATH arch/x86/kvm | 1468 | #define TRACE_INCLUDE_PATH ../../arch/x86/kvm |
| 1469 | #undef TRACE_INCLUDE_FILE | 1469 | #undef TRACE_INCLUDE_FILE |
| 1470 | #define TRACE_INCLUDE_FILE trace | 1470 | #define TRACE_INCLUDE_FILE trace |
| 1471 | 1471 | ||
diff --git a/arch/x86/kvm/vmx/evmcs.c b/arch/x86/kvm/vmx/evmcs.c index 95bc2247478d..5466c6d85cf3 100644 --- a/arch/x86/kvm/vmx/evmcs.c +++ b/arch/x86/kvm/vmx/evmcs.c | |||
| @@ -332,16 +332,17 @@ int nested_enable_evmcs(struct kvm_vcpu *vcpu, | |||
| 332 | uint16_t *vmcs_version) | 332 | uint16_t *vmcs_version) |
| 333 | { | 333 | { |
| 334 | struct vcpu_vmx *vmx = to_vmx(vcpu); | 334 | struct vcpu_vmx *vmx = to_vmx(vcpu); |
| 335 | bool evmcs_already_enabled = vmx->nested.enlightened_vmcs_enabled; | ||
| 336 | |||
| 337 | vmx->nested.enlightened_vmcs_enabled = true; | ||
| 335 | 338 | ||
| 336 | if (vmcs_version) | 339 | if (vmcs_version) |
| 337 | *vmcs_version = nested_get_evmcs_version(vcpu); | 340 | *vmcs_version = nested_get_evmcs_version(vcpu); |
| 338 | 341 | ||
| 339 | /* We don't support disabling the feature for simplicity. */ | 342 | /* We don't support disabling the feature for simplicity. */ |
| 340 | if (vmx->nested.enlightened_vmcs_enabled) | 343 | if (evmcs_already_enabled) |
| 341 | return 0; | 344 | return 0; |
| 342 | 345 | ||
| 343 | vmx->nested.enlightened_vmcs_enabled = true; | ||
| 344 | |||
| 345 | vmx->nested.msrs.pinbased_ctls_high &= ~EVMCS1_UNSUPPORTED_PINCTRL; | 346 | vmx->nested.msrs.pinbased_ctls_high &= ~EVMCS1_UNSUPPORTED_PINCTRL; |
| 346 | vmx->nested.msrs.entry_ctls_high &= ~EVMCS1_UNSUPPORTED_VMENTRY_CTRL; | 347 | vmx->nested.msrs.entry_ctls_high &= ~EVMCS1_UNSUPPORTED_VMENTRY_CTRL; |
| 347 | vmx->nested.msrs.exit_ctls_high &= ~EVMCS1_UNSUPPORTED_VMEXIT_CTRL; | 348 | vmx->nested.msrs.exit_ctls_high &= ~EVMCS1_UNSUPPORTED_VMEXIT_CTRL; |
diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c index 3170e291215d..d737a51a53ca 100644 --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c | |||
| @@ -55,7 +55,7 @@ static u16 shadow_read_write_fields[] = { | |||
| 55 | static int max_shadow_read_write_fields = | 55 | static int max_shadow_read_write_fields = |
| 56 | ARRAY_SIZE(shadow_read_write_fields); | 56 | ARRAY_SIZE(shadow_read_write_fields); |
| 57 | 57 | ||
| 58 | void init_vmcs_shadow_fields(void) | 58 | static void init_vmcs_shadow_fields(void) |
| 59 | { | 59 | { |
| 60 | int i, j; | 60 | int i, j; |
| 61 | 61 | ||
| @@ -211,6 +211,7 @@ static void free_nested(struct kvm_vcpu *vcpu) | |||
| 211 | if (!vmx->nested.vmxon && !vmx->nested.smm.vmxon) | 211 | if (!vmx->nested.vmxon && !vmx->nested.smm.vmxon) |
| 212 | return; | 212 | return; |
| 213 | 213 | ||
| 214 | hrtimer_cancel(&vmx->nested.preemption_timer); | ||
| 214 | vmx->nested.vmxon = false; | 215 | vmx->nested.vmxon = false; |
| 215 | vmx->nested.smm.vmxon = false; | 216 | vmx->nested.smm.vmxon = false; |
| 216 | free_vpid(vmx->nested.vpid02); | 217 | free_vpid(vmx->nested.vpid02); |
| @@ -2472,6 +2473,10 @@ static int nested_check_vm_execution_controls(struct kvm_vcpu *vcpu, | |||
| 2472 | (nested_cpu_has_vpid(vmcs12) && !vmcs12->virtual_processor_id)) | 2473 | (nested_cpu_has_vpid(vmcs12) && !vmcs12->virtual_processor_id)) |
| 2473 | return -EINVAL; | 2474 | return -EINVAL; |
| 2474 | 2475 | ||
| 2476 | if (!nested_cpu_has_preemption_timer(vmcs12) && | ||
| 2477 | nested_cpu_has_save_preemption_timer(vmcs12)) | ||
| 2478 | return -EINVAL; | ||
| 2479 | |||
| 2475 | if (nested_cpu_has_ept(vmcs12) && | 2480 | if (nested_cpu_has_ept(vmcs12) && |
| 2476 | !valid_ept_address(vcpu, vmcs12->ept_pointer)) | 2481 | !valid_ept_address(vcpu, vmcs12->ept_pointer)) |
| 2477 | return -EINVAL; | 2482 | return -EINVAL; |
| @@ -4140,11 +4145,11 @@ static int enter_vmx_operation(struct kvm_vcpu *vcpu) | |||
| 4140 | if (r < 0) | 4145 | if (r < 0) |
| 4141 | goto out_vmcs02; | 4146 | goto out_vmcs02; |
| 4142 | 4147 | ||
| 4143 | vmx->nested.cached_vmcs12 = kmalloc(VMCS12_SIZE, GFP_KERNEL); | 4148 | vmx->nested.cached_vmcs12 = kzalloc(VMCS12_SIZE, GFP_KERNEL); |
| 4144 | if (!vmx->nested.cached_vmcs12) | 4149 | if (!vmx->nested.cached_vmcs12) |
| 4145 | goto out_cached_vmcs12; | 4150 | goto out_cached_vmcs12; |
| 4146 | 4151 | ||
| 4147 | vmx->nested.cached_shadow_vmcs12 = kmalloc(VMCS12_SIZE, GFP_KERNEL); | 4152 | vmx->nested.cached_shadow_vmcs12 = kzalloc(VMCS12_SIZE, GFP_KERNEL); |
| 4148 | if (!vmx->nested.cached_shadow_vmcs12) | 4153 | if (!vmx->nested.cached_shadow_vmcs12) |
| 4149 | goto out_cached_shadow_vmcs12; | 4154 | goto out_cached_shadow_vmcs12; |
| 4150 | 4155 | ||
| @@ -4540,9 +4545,8 @@ static int handle_vmptrld(struct kvm_vcpu *vcpu) | |||
| 4540 | * given physical address won't match the required | 4545 | * given physical address won't match the required |
| 4541 | * VMCS12_REVISION identifier. | 4546 | * VMCS12_REVISION identifier. |
| 4542 | */ | 4547 | */ |
| 4543 | nested_vmx_failValid(vcpu, | 4548 | return nested_vmx_failValid(vcpu, |
| 4544 | VMXERR_VMPTRLD_INCORRECT_VMCS_REVISION_ID); | 4549 | VMXERR_VMPTRLD_INCORRECT_VMCS_REVISION_ID); |
| 4545 | return kvm_skip_emulated_instruction(vcpu); | ||
| 4546 | } | 4550 | } |
| 4547 | new_vmcs12 = kmap(page); | 4551 | new_vmcs12 = kmap(page); |
| 4548 | if (new_vmcs12->hdr.revision_id != VMCS12_REVISION || | 4552 | if (new_vmcs12->hdr.revision_id != VMCS12_REVISION || |
| @@ -5264,13 +5268,17 @@ static int vmx_get_nested_state(struct kvm_vcpu *vcpu, | |||
| 5264 | copy_shadow_to_vmcs12(vmx); | 5268 | copy_shadow_to_vmcs12(vmx); |
| 5265 | } | 5269 | } |
| 5266 | 5270 | ||
| 5267 | if (copy_to_user(user_kvm_nested_state->data, vmcs12, sizeof(*vmcs12))) | 5271 | /* |
| 5272 | * Copy over the full allocated size of vmcs12 rather than just the size | ||
| 5273 | * of the struct. | ||
| 5274 | */ | ||
| 5275 | if (copy_to_user(user_kvm_nested_state->data, vmcs12, VMCS12_SIZE)) | ||
| 5268 | return -EFAULT; | 5276 | return -EFAULT; |
| 5269 | 5277 | ||
| 5270 | if (nested_cpu_has_shadow_vmcs(vmcs12) && | 5278 | if (nested_cpu_has_shadow_vmcs(vmcs12) && |
| 5271 | vmcs12->vmcs_link_pointer != -1ull) { | 5279 | vmcs12->vmcs_link_pointer != -1ull) { |
| 5272 | if (copy_to_user(user_kvm_nested_state->data + VMCS12_SIZE, | 5280 | if (copy_to_user(user_kvm_nested_state->data + VMCS12_SIZE, |
| 5273 | get_shadow_vmcs12(vcpu), sizeof(*vmcs12))) | 5281 | get_shadow_vmcs12(vcpu), VMCS12_SIZE)) |
| 5274 | return -EFAULT; | 5282 | return -EFAULT; |
| 5275 | } | 5283 | } |
| 5276 | 5284 | ||
| @@ -5553,9 +5561,11 @@ void nested_vmx_setup_ctls_msrs(struct nested_vmx_msrs *msrs, u32 ept_caps, | |||
| 5553 | * secondary cpu-based controls. Do not include those that | 5561 | * secondary cpu-based controls. Do not include those that |
| 5554 | * depend on CPUID bits, they are added later by vmx_cpuid_update. | 5562 | * depend on CPUID bits, they are added later by vmx_cpuid_update. |
| 5555 | */ | 5563 | */ |
| 5556 | rdmsr(MSR_IA32_VMX_PROCBASED_CTLS2, | 5564 | if (msrs->procbased_ctls_high & CPU_BASED_ACTIVATE_SECONDARY_CONTROLS) |
| 5557 | msrs->secondary_ctls_low, | 5565 | rdmsr(MSR_IA32_VMX_PROCBASED_CTLS2, |
| 5558 | msrs->secondary_ctls_high); | 5566 | msrs->secondary_ctls_low, |
| 5567 | msrs->secondary_ctls_high); | ||
| 5568 | |||
| 5559 | msrs->secondary_ctls_low = 0; | 5569 | msrs->secondary_ctls_low = 0; |
| 5560 | msrs->secondary_ctls_high &= | 5570 | msrs->secondary_ctls_high &= |
| 5561 | SECONDARY_EXEC_DESC | | 5571 | SECONDARY_EXEC_DESC | |
diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index 4d39f731bc33..30a6bcd735ec 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | #include <linux/mod_devicetable.h> | 26 | #include <linux/mod_devicetable.h> |
| 27 | #include <linux/mm.h> | 27 | #include <linux/mm.h> |
| 28 | #include <linux/sched.h> | 28 | #include <linux/sched.h> |
| 29 | #include <linux/sched/smt.h> | ||
| 29 | #include <linux/slab.h> | 30 | #include <linux/slab.h> |
| 30 | #include <linux/tboot.h> | 31 | #include <linux/tboot.h> |
| 31 | #include <linux/trace_events.h> | 32 | #include <linux/trace_events.h> |
| @@ -423,7 +424,7 @@ static void check_ept_pointer_match(struct kvm *kvm) | |||
| 423 | to_kvm_vmx(kvm)->ept_pointers_match = EPT_POINTERS_MATCH; | 424 | to_kvm_vmx(kvm)->ept_pointers_match = EPT_POINTERS_MATCH; |
| 424 | } | 425 | } |
| 425 | 426 | ||
| 426 | int kvm_fill_hv_flush_list_func(struct hv_guest_mapping_flush_list *flush, | 427 | static int kvm_fill_hv_flush_list_func(struct hv_guest_mapping_flush_list *flush, |
| 427 | void *data) | 428 | void *data) |
| 428 | { | 429 | { |
| 429 | struct kvm_tlb_range *range = data; | 430 | struct kvm_tlb_range *range = data; |
| @@ -453,7 +454,7 @@ static int hv_remote_flush_tlb_with_range(struct kvm *kvm, | |||
| 453 | struct kvm_tlb_range *range) | 454 | struct kvm_tlb_range *range) |
| 454 | { | 455 | { |
| 455 | struct kvm_vcpu *vcpu; | 456 | struct kvm_vcpu *vcpu; |
| 456 | int ret = -ENOTSUPP, i; | 457 | int ret = 0, i; |
| 457 | 458 | ||
| 458 | spin_lock(&to_kvm_vmx(kvm)->ept_pointer_lock); | 459 | spin_lock(&to_kvm_vmx(kvm)->ept_pointer_lock); |
| 459 | 460 | ||
| @@ -862,7 +863,8 @@ static void add_atomic_switch_msr(struct vcpu_vmx *vmx, unsigned msr, | |||
| 862 | if (!entry_only) | 863 | if (!entry_only) |
| 863 | j = find_msr(&m->host, msr); | 864 | j = find_msr(&m->host, msr); |
| 864 | 865 | ||
| 865 | if (i == NR_AUTOLOAD_MSRS || j == NR_AUTOLOAD_MSRS) { | 866 | if ((i < 0 && m->guest.nr == NR_AUTOLOAD_MSRS) || |
| 867 | (j < 0 && m->host.nr == NR_AUTOLOAD_MSRS)) { | ||
| 866 | printk_once(KERN_WARNING "Not enough msr switch entries. " | 868 | printk_once(KERN_WARNING "Not enough msr switch entries. " |
| 867 | "Can't add msr %x\n", msr); | 869 | "Can't add msr %x\n", msr); |
| 868 | return; | 870 | return; |
| @@ -1192,21 +1194,6 @@ static void vmx_vcpu_pi_load(struct kvm_vcpu *vcpu, int cpu) | |||
| 1192 | if (!pi_test_sn(pi_desc) && vcpu->cpu == cpu) | 1194 | if (!pi_test_sn(pi_desc) && vcpu->cpu == cpu) |
| 1193 | return; | 1195 | return; |
| 1194 | 1196 | ||
| 1195 | /* | ||
| 1196 | * First handle the simple case where no cmpxchg is necessary; just | ||
| 1197 | * allow posting non-urgent interrupts. | ||
| 1198 | * | ||
| 1199 | * If the 'nv' field is POSTED_INTR_WAKEUP_VECTOR, do not change | ||
| 1200 | * PI.NDST: pi_post_block will do it for us and the wakeup_handler | ||
| 1201 | * expects the VCPU to be on the blocked_vcpu_list that matches | ||
| 1202 | * PI.NDST. | ||
| 1203 | */ | ||
| 1204 | if (pi_desc->nv == POSTED_INTR_WAKEUP_VECTOR || | ||
| 1205 | vcpu->cpu == cpu) { | ||
| 1206 | pi_clear_sn(pi_desc); | ||
| 1207 | return; | ||
| 1208 | } | ||
| 1209 | |||
| 1210 | /* The full case. */ | 1197 | /* The full case. */ |
| 1211 | do { | 1198 | do { |
| 1212 | old.control = new.control = pi_desc->control; | 1199 | old.control = new.control = pi_desc->control; |
| @@ -1221,6 +1208,17 @@ static void vmx_vcpu_pi_load(struct kvm_vcpu *vcpu, int cpu) | |||
| 1221 | new.sn = 0; | 1208 | new.sn = 0; |
| 1222 | } while (cmpxchg64(&pi_desc->control, old.control, | 1209 | } while (cmpxchg64(&pi_desc->control, old.control, |
| 1223 | new.control) != old.control); | 1210 | new.control) != old.control); |
| 1211 | |||
| 1212 | /* | ||
| 1213 | * Clear SN before reading the bitmap. The VT-d firmware | ||
| 1214 | * writes the bitmap and reads SN atomically (5.2.3 in the | ||
| 1215 | * spec), so it doesn't really have a memory barrier that | ||
| 1216 | * pairs with this, but we cannot do that and we need one. | ||
| 1217 | */ | ||
| 1218 | smp_mb__after_atomic(); | ||
| 1219 | |||
| 1220 | if (!bitmap_empty((unsigned long *)pi_desc->pir, NR_VECTORS)) | ||
| 1221 | pi_set_on(pi_desc); | ||
| 1224 | } | 1222 | } |
| 1225 | 1223 | ||
| 1226 | /* | 1224 | /* |
| @@ -1773,7 +1771,7 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) | |||
| 1773 | if (!msr_info->host_initiated && | 1771 | if (!msr_info->host_initiated && |
| 1774 | !guest_cpuid_has(vcpu, X86_FEATURE_RDTSCP)) | 1772 | !guest_cpuid_has(vcpu, X86_FEATURE_RDTSCP)) |
| 1775 | return 1; | 1773 | return 1; |
| 1776 | /* Otherwise falls through */ | 1774 | /* Else, falls through */ |
| 1777 | default: | 1775 | default: |
| 1778 | msr = find_msr_entry(vmx, msr_info->index); | 1776 | msr = find_msr_entry(vmx, msr_info->index); |
| 1779 | if (msr) { | 1777 | if (msr) { |
| @@ -2014,7 +2012,7 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) | |||
| 2014 | /* Check reserved bit, higher 32 bits should be zero */ | 2012 | /* Check reserved bit, higher 32 bits should be zero */ |
| 2015 | if ((data >> 32) != 0) | 2013 | if ((data >> 32) != 0) |
| 2016 | return 1; | 2014 | return 1; |
| 2017 | /* Otherwise falls through */ | 2015 | /* Else, falls through */ |
| 2018 | default: | 2016 | default: |
| 2019 | msr = find_msr_entry(vmx, msr_index); | 2017 | msr = find_msr_entry(vmx, msr_index); |
| 2020 | if (msr) { | 2018 | if (msr) { |
| @@ -2344,7 +2342,7 @@ static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf, | |||
| 2344 | case 37: /* AAT100 */ | 2342 | case 37: /* AAT100 */ |
| 2345 | case 44: /* BC86,AAY89,BD102 */ | 2343 | case 44: /* BC86,AAY89,BD102 */ |
| 2346 | case 46: /* BA97 */ | 2344 | case 46: /* BA97 */ |
| 2347 | _vmexit_control &= ~VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL; | 2345 | _vmentry_control &= ~VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL; |
| 2348 | _vmexit_control &= ~VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL; | 2346 | _vmexit_control &= ~VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL; |
| 2349 | pr_warn_once("kvm: VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL " | 2347 | pr_warn_once("kvm: VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL " |
| 2350 | "does not work properly. Using workaround\n"); | 2348 | "does not work properly. Using workaround\n"); |
| @@ -6362,72 +6360,9 @@ static void vmx_update_hv_timer(struct kvm_vcpu *vcpu) | |||
| 6362 | vmx->loaded_vmcs->hv_timer_armed = false; | 6360 | vmx->loaded_vmcs->hv_timer_armed = false; |
| 6363 | } | 6361 | } |
| 6364 | 6362 | ||
| 6365 | static void vmx_vcpu_run(struct kvm_vcpu *vcpu) | 6363 | static void __vmx_vcpu_run(struct kvm_vcpu *vcpu, struct vcpu_vmx *vmx) |
| 6366 | { | 6364 | { |
| 6367 | struct vcpu_vmx *vmx = to_vmx(vcpu); | 6365 | unsigned long evmcs_rsp; |
| 6368 | unsigned long cr3, cr4, evmcs_rsp; | ||
| 6369 | |||
| 6370 | /* Record the guest's net vcpu time for enforced NMI injections. */ | ||
| 6371 | if (unlikely(!enable_vnmi && | ||
| 6372 | vmx->loaded_vmcs->soft_vnmi_blocked)) | ||
| 6373 | vmx->loaded_vmcs->entry_time = ktime_get(); | ||
| 6374 | |||
| 6375 | /* Don't enter VMX if guest state is invalid, let the exit handler | ||
| 6376 | start emulation until we arrive back to a valid state */ | ||
| 6377 | if (vmx->emulation_required) | ||
| 6378 | return; | ||
| 6379 | |||
| 6380 | if (vmx->ple_window_dirty) { | ||
| 6381 | vmx->ple_window_dirty = false; | ||
| 6382 | vmcs_write32(PLE_WINDOW, vmx->ple_window); | ||
| 6383 | } | ||
| 6384 | |||
| 6385 | if (vmx->nested.need_vmcs12_sync) | ||
| 6386 | nested_sync_from_vmcs12(vcpu); | ||
| 6387 | |||
| 6388 | if (test_bit(VCPU_REGS_RSP, (unsigned long *)&vcpu->arch.regs_dirty)) | ||
| 6389 | vmcs_writel(GUEST_RSP, vcpu->arch.regs[VCPU_REGS_RSP]); | ||
| 6390 | if (test_bit(VCPU_REGS_RIP, (unsigned long *)&vcpu->arch.regs_dirty)) | ||
| 6391 | vmcs_writel(GUEST_RIP, vcpu->arch.regs[VCPU_REGS_RIP]); | ||
| 6392 | |||
| 6393 | cr3 = __get_current_cr3_fast(); | ||
| 6394 | if (unlikely(cr3 != vmx->loaded_vmcs->host_state.cr3)) { | ||
| 6395 | vmcs_writel(HOST_CR3, cr3); | ||
| 6396 | vmx->loaded_vmcs->host_state.cr3 = cr3; | ||
| 6397 | } | ||
| 6398 | |||
| 6399 | cr4 = cr4_read_shadow(); | ||
| 6400 | if (unlikely(cr4 != vmx->loaded_vmcs->host_state.cr4)) { | ||
| 6401 | vmcs_writel(HOST_CR4, cr4); | ||
| 6402 | vmx->loaded_vmcs->host_state.cr4 = cr4; | ||
| 6403 | } | ||
| 6404 | |||
| 6405 | /* When single-stepping over STI and MOV SS, we must clear the | ||
| 6406 | * corresponding interruptibility bits in the guest state. Otherwise | ||
| 6407 | * vmentry fails as it then expects bit 14 (BS) in pending debug | ||
| 6408 | * exceptions being set, but that's not correct for the guest debugging | ||
| 6409 | * case. */ | ||
| 6410 | if (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP) | ||
| 6411 | vmx_set_interrupt_shadow(vcpu, 0); | ||
| 6412 | |||
| 6413 | if (static_cpu_has(X86_FEATURE_PKU) && | ||
| 6414 | kvm_read_cr4_bits(vcpu, X86_CR4_PKE) && | ||
| 6415 | vcpu->arch.pkru != vmx->host_pkru) | ||
| 6416 | __write_pkru(vcpu->arch.pkru); | ||
| 6417 | |||
| 6418 | pt_guest_enter(vmx); | ||
| 6419 | |||
| 6420 | atomic_switch_perf_msrs(vmx); | ||
| 6421 | |||
| 6422 | vmx_update_hv_timer(vcpu); | ||
| 6423 | |||
| 6424 | /* | ||
| 6425 | * If this vCPU has touched SPEC_CTRL, restore the guest's value if | ||
| 6426 | * it's non-zero. Since vmentry is serialising on affected CPUs, there | ||
| 6427 | * is no need to worry about the conditional branch over the wrmsr | ||
| 6428 | * being speculatively taken. | ||
| 6429 | */ | ||
| 6430 | x86_spec_ctrl_set_guest(vmx->spec_ctrl, 0); | ||
| 6431 | 6366 | ||
| 6432 | vmx->__launched = vmx->loaded_vmcs->launched; | 6367 | vmx->__launched = vmx->loaded_vmcs->launched; |
| 6433 | 6368 | ||
| @@ -6567,6 +6502,77 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu) | |||
| 6567 | , "eax", "ebx", "edi" | 6502 | , "eax", "ebx", "edi" |
| 6568 | #endif | 6503 | #endif |
| 6569 | ); | 6504 | ); |
| 6505 | } | ||
| 6506 | STACK_FRAME_NON_STANDARD(__vmx_vcpu_run); | ||
| 6507 | |||
| 6508 | static void vmx_vcpu_run(struct kvm_vcpu *vcpu) | ||
| 6509 | { | ||
| 6510 | struct vcpu_vmx *vmx = to_vmx(vcpu); | ||
| 6511 | unsigned long cr3, cr4; | ||
| 6512 | |||
| 6513 | /* Record the guest's net vcpu time for enforced NMI injections. */ | ||
| 6514 | if (unlikely(!enable_vnmi && | ||
| 6515 | vmx->loaded_vmcs->soft_vnmi_blocked)) | ||
| 6516 | vmx->loaded_vmcs->entry_time = ktime_get(); | ||
| 6517 | |||
| 6518 | /* Don't enter VMX if guest state is invalid, let the exit handler | ||
| 6519 | start emulation until we arrive back to a valid state */ | ||
| 6520 | if (vmx->emulation_required) | ||
| 6521 | return; | ||
| 6522 | |||
| 6523 | if (vmx->ple_window_dirty) { | ||
| 6524 | vmx->ple_window_dirty = false; | ||
| 6525 | vmcs_write32(PLE_WINDOW, vmx->ple_window); | ||
| 6526 | } | ||
| 6527 | |||
| 6528 | if (vmx->nested.need_vmcs12_sync) | ||
| 6529 | nested_sync_from_vmcs12(vcpu); | ||
| 6530 | |||
| 6531 | if (test_bit(VCPU_REGS_RSP, (unsigned long *)&vcpu->arch.regs_dirty)) | ||
| 6532 | vmcs_writel(GUEST_RSP, vcpu->arch.regs[VCPU_REGS_RSP]); | ||
| 6533 | if (test_bit(VCPU_REGS_RIP, (unsigned long *)&vcpu->arch.regs_dirty)) | ||
| 6534 | vmcs_writel(GUEST_RIP, vcpu->arch.regs[VCPU_REGS_RIP]); | ||
| 6535 | |||
| 6536 | cr3 = __get_current_cr3_fast(); | ||
| 6537 | if (unlikely(cr3 != vmx->loaded_vmcs->host_state.cr3)) { | ||
| 6538 | vmcs_writel(HOST_CR3, cr3); | ||
| 6539 | vmx->loaded_vmcs->host_state.cr3 = cr3; | ||
| 6540 | } | ||
| 6541 | |||
| 6542 | cr4 = cr4_read_shadow(); | ||
| 6543 | if (unlikely(cr4 != vmx->loaded_vmcs->host_state.cr4)) { | ||
| 6544 | vmcs_writel(HOST_CR4, cr4); | ||
| 6545 | vmx->loaded_vmcs->host_state.cr4 = cr4; | ||
| 6546 | } | ||
| 6547 | |||
| 6548 | /* When single-stepping over STI and MOV SS, we must clear the | ||
| 6549 | * corresponding interruptibility bits in the guest state. Otherwise | ||
| 6550 | * vmentry fails as it then expects bit 14 (BS) in pending debug | ||
| 6551 | * exceptions being set, but that's not correct for the guest debugging | ||
| 6552 | * case. */ | ||
| 6553 | if (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP) | ||
| 6554 | vmx_set_interrupt_shadow(vcpu, 0); | ||
| 6555 | |||
| 6556 | if (static_cpu_has(X86_FEATURE_PKU) && | ||
| 6557 | kvm_read_cr4_bits(vcpu, X86_CR4_PKE) && | ||
| 6558 | vcpu->arch.pkru != vmx->host_pkru) | ||
| 6559 | __write_pkru(vcpu->arch.pkru); | ||
| 6560 | |||
| 6561 | pt_guest_enter(vmx); | ||
| 6562 | |||
| 6563 | atomic_switch_perf_msrs(vmx); | ||
| 6564 | |||
| 6565 | vmx_update_hv_timer(vcpu); | ||
| 6566 | |||
| 6567 | /* | ||
| 6568 | * If this vCPU has touched SPEC_CTRL, restore the guest's value if | ||
| 6569 | * it's non-zero. Since vmentry is serialising on affected CPUs, there | ||
| 6570 | * is no need to worry about the conditional branch over the wrmsr | ||
| 6571 | * being speculatively taken. | ||
| 6572 | */ | ||
| 6573 | x86_spec_ctrl_set_guest(vmx->spec_ctrl, 0); | ||
| 6574 | |||
| 6575 | __vmx_vcpu_run(vcpu, vmx); | ||
| 6570 | 6576 | ||
| 6571 | /* | 6577 | /* |
| 6572 | * We do not use IBRS in the kernel. If this vCPU has used the | 6578 | * We do not use IBRS in the kernel. If this vCPU has used the |
| @@ -6648,7 +6654,6 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu) | |||
| 6648 | vmx_recover_nmi_blocking(vmx); | 6654 | vmx_recover_nmi_blocking(vmx); |
| 6649 | vmx_complete_interrupts(vmx); | 6655 | vmx_complete_interrupts(vmx); |
| 6650 | } | 6656 | } |
| 6651 | STACK_FRAME_NON_STANDARD(vmx_vcpu_run); | ||
| 6652 | 6657 | ||
| 6653 | static struct kvm *vmx_vm_alloc(void) | 6658 | static struct kvm *vmx_vm_alloc(void) |
| 6654 | { | 6659 | { |
| @@ -6816,7 +6821,7 @@ static int vmx_vm_init(struct kvm *kvm) | |||
| 6816 | * Warn upon starting the first VM in a potentially | 6821 | * Warn upon starting the first VM in a potentially |
| 6817 | * insecure environment. | 6822 | * insecure environment. |
| 6818 | */ | 6823 | */ |
| 6819 | if (cpu_smt_control == CPU_SMT_ENABLED) | 6824 | if (sched_smt_active()) |
| 6820 | pr_warn_once(L1TF_MSG_SMT); | 6825 | pr_warn_once(L1TF_MSG_SMT); |
| 6821 | if (l1tf_vmx_mitigation == VMENTER_L1D_FLUSH_NEVER) | 6826 | if (l1tf_vmx_mitigation == VMENTER_L1D_FLUSH_NEVER) |
| 6822 | pr_warn_once(L1TF_MSG_L1D); | 6827 | pr_warn_once(L1TF_MSG_L1D); |
| @@ -7044,7 +7049,7 @@ static void update_intel_pt_cfg(struct kvm_vcpu *vcpu) | |||
| 7044 | 7049 | ||
| 7045 | /* unmask address range configure area */ | 7050 | /* unmask address range configure area */ |
| 7046 | for (i = 0; i < vmx->pt_desc.addr_range; i++) | 7051 | for (i = 0; i < vmx->pt_desc.addr_range; i++) |
| 7047 | vmx->pt_desc.ctl_bitmask &= ~(0xf << (32 + i * 4)); | 7052 | vmx->pt_desc.ctl_bitmask &= ~(0xfULL << (32 + i * 4)); |
| 7048 | } | 7053 | } |
| 7049 | 7054 | ||
| 7050 | static void vmx_cpuid_update(struct kvm_vcpu *vcpu) | 7055 | static void vmx_cpuid_update(struct kvm_vcpu *vcpu) |
diff --git a/arch/x86/kvm/vmx/vmx.h b/arch/x86/kvm/vmx/vmx.h index 99328954c2fc..0ac0a64c7790 100644 --- a/arch/x86/kvm/vmx/vmx.h +++ b/arch/x86/kvm/vmx/vmx.h | |||
| @@ -337,16 +337,16 @@ static inline int pi_test_and_set_pir(int vector, struct pi_desc *pi_desc) | |||
| 337 | return test_and_set_bit(vector, (unsigned long *)pi_desc->pir); | 337 | return test_and_set_bit(vector, (unsigned long *)pi_desc->pir); |
| 338 | } | 338 | } |
| 339 | 339 | ||
| 340 | static inline void pi_clear_sn(struct pi_desc *pi_desc) | 340 | static inline void pi_set_sn(struct pi_desc *pi_desc) |
| 341 | { | 341 | { |
| 342 | return clear_bit(POSTED_INTR_SN, | 342 | return set_bit(POSTED_INTR_SN, |
| 343 | (unsigned long *)&pi_desc->control); | 343 | (unsigned long *)&pi_desc->control); |
| 344 | } | 344 | } |
| 345 | 345 | ||
| 346 | static inline void pi_set_sn(struct pi_desc *pi_desc) | 346 | static inline void pi_set_on(struct pi_desc *pi_desc) |
| 347 | { | 347 | { |
| 348 | return set_bit(POSTED_INTR_SN, | 348 | set_bit(POSTED_INTR_ON, |
| 349 | (unsigned long *)&pi_desc->control); | 349 | (unsigned long *)&pi_desc->control); |
| 350 | } | 350 | } |
| 351 | 351 | ||
| 352 | static inline void pi_clear_on(struct pi_desc *pi_desc) | 352 | static inline void pi_clear_on(struct pi_desc *pi_desc) |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 02c8e095a239..941f932373d0 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
| @@ -3834,6 +3834,8 @@ static int kvm_vcpu_ioctl_enable_cap(struct kvm_vcpu *vcpu, | |||
| 3834 | case KVM_CAP_HYPERV_SYNIC2: | 3834 | case KVM_CAP_HYPERV_SYNIC2: |
| 3835 | if (cap->args[0]) | 3835 | if (cap->args[0]) |
| 3836 | return -EINVAL; | 3836 | return -EINVAL; |
| 3837 | /* fall through */ | ||
| 3838 | |||
| 3837 | case KVM_CAP_HYPERV_SYNIC: | 3839 | case KVM_CAP_HYPERV_SYNIC: |
| 3838 | if (!irqchip_in_kernel(vcpu->kvm)) | 3840 | if (!irqchip_in_kernel(vcpu->kvm)) |
| 3839 | return -EINVAL; | 3841 | return -EINVAL; |
| @@ -5114,6 +5116,13 @@ int kvm_read_guest_virt(struct kvm_vcpu *vcpu, | |||
| 5114 | { | 5116 | { |
| 5115 | u32 access = (kvm_x86_ops->get_cpl(vcpu) == 3) ? PFERR_USER_MASK : 0; | 5117 | u32 access = (kvm_x86_ops->get_cpl(vcpu) == 3) ? PFERR_USER_MASK : 0; |
| 5116 | 5118 | ||
| 5119 | /* | ||
| 5120 | * FIXME: this should call handle_emulation_failure if X86EMUL_IO_NEEDED | ||
| 5121 | * is returned, but our callers are not ready for that and they blindly | ||
| 5122 | * call kvm_inject_page_fault. Ensure that they at least do not leak | ||
| 5123 | * uninitialized kernel stack memory into cr2 and error code. | ||
| 5124 | */ | ||
| 5125 | memset(exception, 0, sizeof(*exception)); | ||
| 5117 | return kvm_read_guest_virt_helper(addr, val, bytes, vcpu, access, | 5126 | return kvm_read_guest_virt_helper(addr, val, bytes, vcpu, access, |
| 5118 | exception); | 5127 | exception); |
| 5119 | } | 5128 | } |
| @@ -6480,8 +6489,7 @@ restart: | |||
| 6480 | toggle_interruptibility(vcpu, ctxt->interruptibility); | 6489 | toggle_interruptibility(vcpu, ctxt->interruptibility); |
| 6481 | vcpu->arch.emulate_regs_need_sync_to_vcpu = false; | 6490 | vcpu->arch.emulate_regs_need_sync_to_vcpu = false; |
| 6482 | kvm_rip_write(vcpu, ctxt->eip); | 6491 | kvm_rip_write(vcpu, ctxt->eip); |
| 6483 | if (r == EMULATE_DONE && | 6492 | if (r == EMULATE_DONE && ctxt->tf) |
| 6484 | (ctxt->tf || (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP))) | ||
| 6485 | kvm_vcpu_do_singlestep(vcpu, &r); | 6493 | kvm_vcpu_do_singlestep(vcpu, &r); |
| 6486 | if (!ctxt->have_exception || | 6494 | if (!ctxt->have_exception || |
| 6487 | exception_type(ctxt->exception.vector) == EXCPT_TRAP) | 6495 | exception_type(ctxt->exception.vector) == EXCPT_TRAP) |
| @@ -7093,10 +7101,10 @@ int kvm_emulate_hypercall(struct kvm_vcpu *vcpu) | |||
| 7093 | case KVM_HC_CLOCK_PAIRING: | 7101 | case KVM_HC_CLOCK_PAIRING: |
| 7094 | ret = kvm_pv_clock_pairing(vcpu, a0, a1); | 7102 | ret = kvm_pv_clock_pairing(vcpu, a0, a1); |
| 7095 | break; | 7103 | break; |
| 7104 | #endif | ||
| 7096 | case KVM_HC_SEND_IPI: | 7105 | case KVM_HC_SEND_IPI: |
| 7097 | ret = kvm_pv_send_ipi(vcpu->kvm, a0, a1, a2, a3, op_64_bit); | 7106 | ret = kvm_pv_send_ipi(vcpu->kvm, a0, a1, a2, a3, op_64_bit); |
| 7098 | break; | 7107 | break; |
| 7099 | #endif | ||
| 7100 | default: | 7108 | default: |
| 7101 | ret = -KVM_ENOSYS; | 7109 | ret = -KVM_ENOSYS; |
| 7102 | break; | 7110 | break; |
| @@ -7793,7 +7801,7 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) | |||
| 7793 | * 1) We should set ->mode before checking ->requests. Please see | 7801 | * 1) We should set ->mode before checking ->requests. Please see |
| 7794 | * the comment in kvm_vcpu_exiting_guest_mode(). | 7802 | * the comment in kvm_vcpu_exiting_guest_mode(). |
| 7795 | * | 7803 | * |
| 7796 | * 2) For APICv, we should set ->mode before checking PIR.ON. This | 7804 | * 2) For APICv, we should set ->mode before checking PID.ON. This |
| 7797 | * pairs with the memory barrier implicit in pi_test_and_set_on | 7805 | * pairs with the memory barrier implicit in pi_test_and_set_on |
| 7798 | * (see vmx_deliver_posted_interrupt). | 7806 | * (see vmx_deliver_posted_interrupt). |
| 7799 | * | 7807 | * |
| @@ -7937,6 +7945,7 @@ static inline int vcpu_block(struct kvm *kvm, struct kvm_vcpu *vcpu) | |||
| 7937 | vcpu->arch.pv.pv_unhalted = false; | 7945 | vcpu->arch.pv.pv_unhalted = false; |
| 7938 | vcpu->arch.mp_state = | 7946 | vcpu->arch.mp_state = |
| 7939 | KVM_MP_STATE_RUNNABLE; | 7947 | KVM_MP_STATE_RUNNABLE; |
| 7948 | /* fall through */ | ||
| 7940 | case KVM_MP_STATE_RUNNABLE: | 7949 | case KVM_MP_STATE_RUNNABLE: |
| 7941 | vcpu->arch.apf.halted = false; | 7950 | vcpu->arch.apf.halted = false; |
| 7942 | break; | 7951 | break; |
diff --git a/arch/x86/lib/iomem.c b/arch/x86/lib/iomem.c index 66894675f3c8..df50451d94ef 100644 --- a/arch/x86/lib/iomem.c +++ b/arch/x86/lib/iomem.c | |||
| @@ -2,8 +2,11 @@ | |||
| 2 | #include <linux/module.h> | 2 | #include <linux/module.h> |
| 3 | #include <linux/io.h> | 3 | #include <linux/io.h> |
| 4 | 4 | ||
| 5 | #define movs(type,to,from) \ | ||
| 6 | asm volatile("movs" type:"=&D" (to), "=&S" (from):"0" (to), "1" (from):"memory") | ||
| 7 | |||
| 5 | /* Originally from i386/string.h */ | 8 | /* Originally from i386/string.h */ |
| 6 | static __always_inline void __iomem_memcpy(void *to, const void *from, size_t n) | 9 | static __always_inline void rep_movs(void *to, const void *from, size_t n) |
| 7 | { | 10 | { |
| 8 | unsigned long d0, d1, d2; | 11 | unsigned long d0, d1, d2; |
| 9 | asm volatile("rep ; movsl\n\t" | 12 | asm volatile("rep ; movsl\n\t" |
| @@ -21,13 +24,37 @@ static __always_inline void __iomem_memcpy(void *to, const void *from, size_t n) | |||
| 21 | 24 | ||
| 22 | void memcpy_fromio(void *to, const volatile void __iomem *from, size_t n) | 25 | void memcpy_fromio(void *to, const volatile void __iomem *from, size_t n) |
| 23 | { | 26 | { |
| 24 | __iomem_memcpy(to, (const void *)from, n); | 27 | if (unlikely(!n)) |
| 28 | return; | ||
| 29 | |||
| 30 | /* Align any unaligned source IO */ | ||
| 31 | if (unlikely(1 & (unsigned long)from)) { | ||
| 32 | movs("b", to, from); | ||
| 33 | n--; | ||
| 34 | } | ||
| 35 | if (n > 1 && unlikely(2 & (unsigned long)from)) { | ||
| 36 | movs("w", to, from); | ||
| 37 | n-=2; | ||
| 38 | } | ||
| 39 | rep_movs(to, (const void *)from, n); | ||
| 25 | } | 40 | } |
| 26 | EXPORT_SYMBOL(memcpy_fromio); | 41 | EXPORT_SYMBOL(memcpy_fromio); |
| 27 | 42 | ||
| 28 | void memcpy_toio(volatile void __iomem *to, const void *from, size_t n) | 43 | void memcpy_toio(volatile void __iomem *to, const void *from, size_t n) |
| 29 | { | 44 | { |
| 30 | __iomem_memcpy((void *)to, (const void *) from, n); | 45 | if (unlikely(!n)) |
| 46 | return; | ||
| 47 | |||
| 48 | /* Align any unaligned destination IO */ | ||
| 49 | if (unlikely(1 & (unsigned long)to)) { | ||
| 50 | movs("b", to, from); | ||
| 51 | n--; | ||
| 52 | } | ||
| 53 | if (n > 1 && unlikely(2 & (unsigned long)to)) { | ||
| 54 | movs("w", to, from); | ||
| 55 | n-=2; | ||
| 56 | } | ||
| 57 | rep_movs((void *)to, (const void *) from, n); | ||
| 31 | } | 58 | } |
| 32 | EXPORT_SYMBOL(memcpy_toio); | 59 | EXPORT_SYMBOL(memcpy_toio); |
| 33 | 60 | ||
diff --git a/arch/x86/lib/kaslr.c b/arch/x86/lib/kaslr.c index 79778ab200e4..a53665116458 100644 --- a/arch/x86/lib/kaslr.c +++ b/arch/x86/lib/kaslr.c | |||
| @@ -36,8 +36,8 @@ static inline u16 i8254(void) | |||
| 36 | u16 status, timer; | 36 | u16 status, timer; |
| 37 | 37 | ||
| 38 | do { | 38 | do { |
| 39 | outb(I8254_PORT_CONTROL, | 39 | outb(I8254_CMD_READBACK | I8254_SELECT_COUNTER0, |
| 40 | I8254_CMD_READBACK | I8254_SELECT_COUNTER0); | 40 | I8254_PORT_CONTROL); |
| 41 | status = inb(I8254_PORT_COUNTER0); | 41 | status = inb(I8254_PORT_COUNTER0); |
| 42 | timer = inb(I8254_PORT_COUNTER0); | 42 | timer = inb(I8254_PORT_COUNTER0); |
| 43 | timer |= inb(I8254_PORT_COUNTER0) << 8; | 43 | timer |= inb(I8254_PORT_COUNTER0) << 8; |
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index 2ff25ad33233..9d5c75f02295 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c | |||
| @@ -595,7 +595,7 @@ static void show_ldttss(const struct desc_ptr *gdt, const char *name, u16 index) | |||
| 595 | return; | 595 | return; |
| 596 | } | 596 | } |
| 597 | 597 | ||
| 598 | addr = desc.base0 | (desc.base1 << 16) | (desc.base2 << 24); | 598 | addr = desc.base0 | (desc.base1 << 16) | ((unsigned long)desc.base2 << 24); |
| 599 | #ifdef CONFIG_X86_64 | 599 | #ifdef CONFIG_X86_64 |
| 600 | addr |= ((u64)desc.base3 << 32); | 600 | addr |= ((u64)desc.base3 << 32); |
| 601 | #endif | 601 | #endif |
diff --git a/arch/x86/mm/mem_encrypt_identity.c b/arch/x86/mm/mem_encrypt_identity.c index a19ef1a416ff..4aa9b1480866 100644 --- a/arch/x86/mm/mem_encrypt_identity.c +++ b/arch/x86/mm/mem_encrypt_identity.c | |||
| @@ -158,8 +158,8 @@ static void __init sme_populate_pgd(struct sme_populate_pgd_data *ppd) | |||
| 158 | pmd = pmd_offset(pud, ppd->vaddr); | 158 | pmd = pmd_offset(pud, ppd->vaddr); |
| 159 | if (pmd_none(*pmd)) { | 159 | if (pmd_none(*pmd)) { |
| 160 | pte = ppd->pgtable_area; | 160 | pte = ppd->pgtable_area; |
| 161 | memset(pte, 0, sizeof(pte) * PTRS_PER_PTE); | 161 | memset(pte, 0, sizeof(*pte) * PTRS_PER_PTE); |
| 162 | ppd->pgtable_area += sizeof(pte) * PTRS_PER_PTE; | 162 | ppd->pgtable_area += sizeof(*pte) * PTRS_PER_PTE; |
| 163 | set_pmd(pmd, __pmd(PMD_FLAGS | __pa(pte))); | 163 | set_pmd(pmd, __pmd(PMD_FLAGS | __pa(pte))); |
| 164 | } | 164 | } |
| 165 | 165 | ||
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index 4f8972311a77..14e6119838a6 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c | |||
| @@ -230,6 +230,29 @@ static bool __cpa_pfn_in_highmap(unsigned long pfn) | |||
| 230 | 230 | ||
| 231 | #endif | 231 | #endif |
| 232 | 232 | ||
| 233 | /* | ||
| 234 | * See set_mce_nospec(). | ||
| 235 | * | ||
| 236 | * Machine check recovery code needs to change cache mode of poisoned pages to | ||
| 237 | * UC to avoid speculative access logging another error. But passing the | ||
| 238 | * address of the 1:1 mapping to set_memory_uc() is a fine way to encourage a | ||
| 239 | * speculative access. So we cheat and flip the top bit of the address. This | ||
| 240 | * works fine for the code that updates the page tables. But at the end of the | ||
| 241 | * process we need to flush the TLB and cache and the non-canonical address | ||
| 242 | * causes a #GP fault when used by the INVLPG and CLFLUSH instructions. | ||
| 243 | * | ||
| 244 | * But in the common case we already have a canonical address. This code | ||
| 245 | * will fix the top bit if needed and is a no-op otherwise. | ||
| 246 | */ | ||
| 247 | static inline unsigned long fix_addr(unsigned long addr) | ||
| 248 | { | ||
| 249 | #ifdef CONFIG_X86_64 | ||
| 250 | return (long)(addr << 1) >> 1; | ||
| 251 | #else | ||
| 252 | return addr; | ||
| 253 | #endif | ||
| 254 | } | ||
| 255 | |||
| 233 | static unsigned long __cpa_addr(struct cpa_data *cpa, unsigned long idx) | 256 | static unsigned long __cpa_addr(struct cpa_data *cpa, unsigned long idx) |
| 234 | { | 257 | { |
| 235 | if (cpa->flags & CPA_PAGES_ARRAY) { | 258 | if (cpa->flags & CPA_PAGES_ARRAY) { |
| @@ -313,7 +336,7 @@ void __cpa_flush_tlb(void *data) | |||
| 313 | unsigned int i; | 336 | unsigned int i; |
| 314 | 337 | ||
| 315 | for (i = 0; i < cpa->numpages; i++) | 338 | for (i = 0; i < cpa->numpages; i++) |
| 316 | __flush_tlb_one_kernel(__cpa_addr(cpa, i)); | 339 | __flush_tlb_one_kernel(fix_addr(__cpa_addr(cpa, i))); |
| 317 | } | 340 | } |
| 318 | 341 | ||
| 319 | static void cpa_flush(struct cpa_data *data, int cache) | 342 | static void cpa_flush(struct cpa_data *data, int cache) |
| @@ -347,7 +370,7 @@ static void cpa_flush(struct cpa_data *data, int cache) | |||
| 347 | * Only flush present addresses: | 370 | * Only flush present addresses: |
| 348 | */ | 371 | */ |
| 349 | if (pte && (pte_val(*pte) & _PAGE_PRESENT)) | 372 | if (pte && (pte_val(*pte) & _PAGE_PRESENT)) |
| 350 | clflush_cache_range_opt((void *)addr, PAGE_SIZE); | 373 | clflush_cache_range_opt((void *)fix_addr(addr), PAGE_SIZE); |
| 351 | } | 374 | } |
| 352 | mb(); | 375 | mb(); |
| 353 | } | 376 | } |
| @@ -1627,29 +1650,6 @@ out: | |||
| 1627 | return ret; | 1650 | return ret; |
| 1628 | } | 1651 | } |
| 1629 | 1652 | ||
| 1630 | /* | ||
| 1631 | * Machine check recovery code needs to change cache mode of poisoned | ||
| 1632 | * pages to UC to avoid speculative access logging another error. But | ||
| 1633 | * passing the address of the 1:1 mapping to set_memory_uc() is a fine | ||
| 1634 | * way to encourage a speculative access. So we cheat and flip the top | ||
| 1635 | * bit of the address. This works fine for the code that updates the | ||
| 1636 | * page tables. But at the end of the process we need to flush the cache | ||
| 1637 | * and the non-canonical address causes a #GP fault when used by the | ||
| 1638 | * CLFLUSH instruction. | ||
| 1639 | * | ||
| 1640 | * But in the common case we already have a canonical address. This code | ||
| 1641 | * will fix the top bit if needed and is a no-op otherwise. | ||
| 1642 | */ | ||
| 1643 | static inline unsigned long make_addr_canonical_again(unsigned long addr) | ||
| 1644 | { | ||
| 1645 | #ifdef CONFIG_X86_64 | ||
| 1646 | return (long)(addr << 1) >> 1; | ||
| 1647 | #else | ||
| 1648 | return addr; | ||
| 1649 | #endif | ||
| 1650 | } | ||
| 1651 | |||
| 1652 | |||
| 1653 | static int change_page_attr_set_clr(unsigned long *addr, int numpages, | 1653 | static int change_page_attr_set_clr(unsigned long *addr, int numpages, |
| 1654 | pgprot_t mask_set, pgprot_t mask_clr, | 1654 | pgprot_t mask_set, pgprot_t mask_clr, |
| 1655 | int force_split, int in_flag, | 1655 | int force_split, int in_flag, |
diff --git a/arch/x86/platform/uv/bios_uv.c b/arch/x86/platform/uv/bios_uv.c index 4a6a5a26c582..eb33432f2f24 100644 --- a/arch/x86/platform/uv/bios_uv.c +++ b/arch/x86/platform/uv/bios_uv.c | |||
| @@ -29,7 +29,8 @@ | |||
| 29 | 29 | ||
| 30 | struct uv_systab *uv_systab; | 30 | struct uv_systab *uv_systab; |
| 31 | 31 | ||
| 32 | s64 uv_bios_call(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3, u64 a4, u64 a5) | 32 | static s64 __uv_bios_call(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3, |
| 33 | u64 a4, u64 a5) | ||
| 33 | { | 34 | { |
| 34 | struct uv_systab *tab = uv_systab; | 35 | struct uv_systab *tab = uv_systab; |
| 35 | s64 ret; | 36 | s64 ret; |
| @@ -51,6 +52,19 @@ s64 uv_bios_call(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3, u64 a4, u64 a5) | |||
| 51 | 52 | ||
| 52 | return ret; | 53 | return ret; |
| 53 | } | 54 | } |
| 55 | |||
| 56 | s64 uv_bios_call(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3, u64 a4, u64 a5) | ||
| 57 | { | ||
| 58 | s64 ret; | ||
| 59 | |||
| 60 | if (down_interruptible(&__efi_uv_runtime_lock)) | ||
| 61 | return BIOS_STATUS_ABORT; | ||
| 62 | |||
| 63 | ret = __uv_bios_call(which, a1, a2, a3, a4, a5); | ||
| 64 | up(&__efi_uv_runtime_lock); | ||
| 65 | |||
| 66 | return ret; | ||
| 67 | } | ||
| 54 | EXPORT_SYMBOL_GPL(uv_bios_call); | 68 | EXPORT_SYMBOL_GPL(uv_bios_call); |
| 55 | 69 | ||
| 56 | s64 uv_bios_call_irqsave(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3, | 70 | s64 uv_bios_call_irqsave(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3, |
| @@ -59,10 +73,15 @@ s64 uv_bios_call_irqsave(enum uv_bios_cmd which, u64 a1, u64 a2, u64 a3, | |||
| 59 | unsigned long bios_flags; | 73 | unsigned long bios_flags; |
| 60 | s64 ret; | 74 | s64 ret; |
| 61 | 75 | ||
| 76 | if (down_interruptible(&__efi_uv_runtime_lock)) | ||
| 77 | return BIOS_STATUS_ABORT; | ||
| 78 | |||
| 62 | local_irq_save(bios_flags); | 79 | local_irq_save(bios_flags); |
| 63 | ret = uv_bios_call(which, a1, a2, a3, a4, a5); | 80 | ret = __uv_bios_call(which, a1, a2, a3, a4, a5); |
| 64 | local_irq_restore(bios_flags); | 81 | local_irq_restore(bios_flags); |
| 65 | 82 | ||
| 83 | up(&__efi_uv_runtime_lock); | ||
| 84 | |||
| 66 | return ret; | 85 | return ret; |
| 67 | } | 86 | } |
| 68 | 87 | ||
diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c index 2f6787fc7106..c54a493e139a 100644 --- a/arch/x86/xen/enlighten_pv.c +++ b/arch/x86/xen/enlighten_pv.c | |||
| @@ -898,10 +898,7 @@ static u64 xen_read_msr_safe(unsigned int msr, int *err) | |||
| 898 | val = native_read_msr_safe(msr, err); | 898 | val = native_read_msr_safe(msr, err); |
| 899 | switch (msr) { | 899 | switch (msr) { |
| 900 | case MSR_IA32_APICBASE: | 900 | case MSR_IA32_APICBASE: |
| 901 | #ifdef CONFIG_X86_X2APIC | 901 | val &= ~X2APIC_ENABLE; |
| 902 | if (!(cpuid_ecx(1) & (1 << (X86_FEATURE_X2APIC & 31)))) | ||
| 903 | #endif | ||
| 904 | val &= ~X2APIC_ENABLE; | ||
| 905 | break; | 902 | break; |
| 906 | } | 903 | } |
| 907 | return val; | 904 | return val; |
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c index 72bf446c3fee..6e29794573b7 100644 --- a/arch/x86/xen/time.c +++ b/arch/x86/xen/time.c | |||
| @@ -361,8 +361,6 @@ void xen_timer_resume(void) | |||
| 361 | { | 361 | { |
| 362 | int cpu; | 362 | int cpu; |
| 363 | 363 | ||
| 364 | pvclock_resume(); | ||
| 365 | |||
| 366 | if (xen_clockevent != &xen_vcpuop_clockevent) | 364 | if (xen_clockevent != &xen_vcpuop_clockevent) |
| 367 | return; | 365 | return; |
| 368 | 366 | ||
| @@ -379,12 +377,15 @@ static const struct pv_time_ops xen_time_ops __initconst = { | |||
| 379 | }; | 377 | }; |
| 380 | 378 | ||
| 381 | static struct pvclock_vsyscall_time_info *xen_clock __read_mostly; | 379 | static struct pvclock_vsyscall_time_info *xen_clock __read_mostly; |
| 380 | static u64 xen_clock_value_saved; | ||
| 382 | 381 | ||
| 383 | void xen_save_time_memory_area(void) | 382 | void xen_save_time_memory_area(void) |
| 384 | { | 383 | { |
| 385 | struct vcpu_register_time_memory_area t; | 384 | struct vcpu_register_time_memory_area t; |
| 386 | int ret; | 385 | int ret; |
| 387 | 386 | ||
| 387 | xen_clock_value_saved = xen_clocksource_read() - xen_sched_clock_offset; | ||
| 388 | |||
| 388 | if (!xen_clock) | 389 | if (!xen_clock) |
| 389 | return; | 390 | return; |
| 390 | 391 | ||
| @@ -404,7 +405,7 @@ void xen_restore_time_memory_area(void) | |||
| 404 | int ret; | 405 | int ret; |
| 405 | 406 | ||
| 406 | if (!xen_clock) | 407 | if (!xen_clock) |
| 407 | return; | 408 | goto out; |
| 408 | 409 | ||
| 409 | t.addr.v = &xen_clock->pvti; | 410 | t.addr.v = &xen_clock->pvti; |
| 410 | 411 | ||
| @@ -421,6 +422,11 @@ void xen_restore_time_memory_area(void) | |||
| 421 | if (ret != 0) | 422 | if (ret != 0) |
| 422 | pr_notice("Cannot restore secondary vcpu_time_info (err %d)", | 423 | pr_notice("Cannot restore secondary vcpu_time_info (err %d)", |
| 423 | ret); | 424 | ret); |
| 425 | |||
| 426 | out: | ||
| 427 | /* Need pvclock_resume() before using xen_clocksource_read(). */ | ||
| 428 | pvclock_resume(); | ||
| 429 | xen_sched_clock_offset = xen_clocksource_read() - xen_clock_value_saved; | ||
| 424 | } | 430 | } |
| 425 | 431 | ||
| 426 | static void xen_setup_vsyscall_time_info(void) | 432 | static void xen_setup_vsyscall_time_info(void) |
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig index 20a0756f27ef..ce91682770cb 100644 --- a/arch/xtensa/Kconfig +++ b/arch/xtensa/Kconfig | |||
| @@ -164,7 +164,7 @@ config XTENSA_FAKE_NMI | |||
| 164 | If unsure, say N. | 164 | If unsure, say N. |
| 165 | 165 | ||
| 166 | config XTENSA_UNALIGNED_USER | 166 | config XTENSA_UNALIGNED_USER |
| 167 | bool "Unaligned memory access in use space" | 167 | bool "Unaligned memory access in user space" |
| 168 | help | 168 | help |
| 169 | The Xtensa architecture currently does not handle unaligned | 169 | The Xtensa architecture currently does not handle unaligned |
| 170 | memory accesses in hardware but through an exception handler. | 170 | memory accesses in hardware but through an exception handler. |
| @@ -451,7 +451,7 @@ config USE_OF | |||
| 451 | help | 451 | help |
| 452 | Include support for flattened device tree machine descriptions. | 452 | Include support for flattened device tree machine descriptions. |
| 453 | 453 | ||
| 454 | config BUILTIN_DTB | 454 | config BUILTIN_DTB_SOURCE |
| 455 | string "DTB to build into the kernel image" | 455 | string "DTB to build into the kernel image" |
| 456 | depends on OF | 456 | depends on OF |
| 457 | 457 | ||
diff --git a/arch/xtensa/boot/dts/Makefile b/arch/xtensa/boot/dts/Makefile index f8052ba5aea8..0b8d00cdae7c 100644 --- a/arch/xtensa/boot/dts/Makefile +++ b/arch/xtensa/boot/dts/Makefile | |||
| @@ -7,9 +7,9 @@ | |||
| 7 | # | 7 | # |
| 8 | # | 8 | # |
| 9 | 9 | ||
| 10 | BUILTIN_DTB := $(patsubst "%",%,$(CONFIG_BUILTIN_DTB)).dtb.o | 10 | BUILTIN_DTB_SOURCE := $(patsubst "%",%,$(CONFIG_BUILTIN_DTB_SOURCE)).dtb.o |
| 11 | ifneq ($(CONFIG_BUILTIN_DTB),"") | 11 | ifneq ($(CONFIG_BUILTIN_DTB_SOURCE),"") |
| 12 | obj-$(CONFIG_OF) += $(BUILTIN_DTB) | 12 | obj-$(CONFIG_OF) += $(BUILTIN_DTB_SOURCE) |
| 13 | endif | 13 | endif |
| 14 | 14 | ||
| 15 | # for CONFIG_OF_ALL_DTBS test | 15 | # for CONFIG_OF_ALL_DTBS test |
diff --git a/arch/xtensa/configs/audio_kc705_defconfig b/arch/xtensa/configs/audio_kc705_defconfig index 2bf964df37ba..f378e56f9ce6 100644 --- a/arch/xtensa/configs/audio_kc705_defconfig +++ b/arch/xtensa/configs/audio_kc705_defconfig | |||
| @@ -34,7 +34,7 @@ CONFIG_XTENSA_PLATFORM_XTFPGA=y | |||
| 34 | CONFIG_CMDLINE_BOOL=y | 34 | CONFIG_CMDLINE_BOOL=y |
| 35 | CONFIG_CMDLINE="earlycon=uart8250,mmio32native,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=0x38000000@0" | 35 | CONFIG_CMDLINE="earlycon=uart8250,mmio32native,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=0x38000000@0" |
| 36 | CONFIG_USE_OF=y | 36 | CONFIG_USE_OF=y |
| 37 | CONFIG_BUILTIN_DTB="kc705" | 37 | CONFIG_BUILTIN_DTB_SOURCE="kc705" |
| 38 | # CONFIG_COMPACTION is not set | 38 | # CONFIG_COMPACTION is not set |
| 39 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set | 39 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set |
| 40 | CONFIG_PM=y | 40 | CONFIG_PM=y |
diff --git a/arch/xtensa/configs/cadence_csp_defconfig b/arch/xtensa/configs/cadence_csp_defconfig index 3221b7053fa3..62f32a902568 100644 --- a/arch/xtensa/configs/cadence_csp_defconfig +++ b/arch/xtensa/configs/cadence_csp_defconfig | |||
| @@ -38,7 +38,7 @@ CONFIG_HIGHMEM=y | |||
| 38 | # CONFIG_PCI is not set | 38 | # CONFIG_PCI is not set |
| 39 | CONFIG_XTENSA_PLATFORM_XTFPGA=y | 39 | CONFIG_XTENSA_PLATFORM_XTFPGA=y |
| 40 | CONFIG_USE_OF=y | 40 | CONFIG_USE_OF=y |
| 41 | CONFIG_BUILTIN_DTB="csp" | 41 | CONFIG_BUILTIN_DTB_SOURCE="csp" |
| 42 | # CONFIG_COMPACTION is not set | 42 | # CONFIG_COMPACTION is not set |
| 43 | CONFIG_XTFPGA_LCD=y | 43 | CONFIG_XTFPGA_LCD=y |
| 44 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set | 44 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set |
diff --git a/arch/xtensa/configs/generic_kc705_defconfig b/arch/xtensa/configs/generic_kc705_defconfig index 985fa8546e4e..8bebe07f1060 100644 --- a/arch/xtensa/configs/generic_kc705_defconfig +++ b/arch/xtensa/configs/generic_kc705_defconfig | |||
| @@ -33,7 +33,7 @@ CONFIG_XTENSA_PLATFORM_XTFPGA=y | |||
| 33 | CONFIG_CMDLINE_BOOL=y | 33 | CONFIG_CMDLINE_BOOL=y |
| 34 | CONFIG_CMDLINE="earlycon=uart8250,mmio32native,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=0x38000000@0" | 34 | CONFIG_CMDLINE="earlycon=uart8250,mmio32native,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=0x38000000@0" |
| 35 | CONFIG_USE_OF=y | 35 | CONFIG_USE_OF=y |
| 36 | CONFIG_BUILTIN_DTB="kc705" | 36 | CONFIG_BUILTIN_DTB_SOURCE="kc705" |
| 37 | # CONFIG_COMPACTION is not set | 37 | # CONFIG_COMPACTION is not set |
| 38 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set | 38 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set |
| 39 | CONFIG_NET=y | 39 | CONFIG_NET=y |
diff --git a/arch/xtensa/configs/nommu_kc705_defconfig b/arch/xtensa/configs/nommu_kc705_defconfig index f3fc4f970ca8..933ab2adf434 100644 --- a/arch/xtensa/configs/nommu_kc705_defconfig +++ b/arch/xtensa/configs/nommu_kc705_defconfig | |||
| @@ -39,7 +39,7 @@ CONFIG_XTENSA_PLATFORM_XTFPGA=y | |||
| 39 | CONFIG_CMDLINE_BOOL=y | 39 | CONFIG_CMDLINE_BOOL=y |
| 40 | CONFIG_CMDLINE="earlycon=uart8250,mmio32native,0x9d050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=256M@0x60000000" | 40 | CONFIG_CMDLINE="earlycon=uart8250,mmio32native,0x9d050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=256M@0x60000000" |
| 41 | CONFIG_USE_OF=y | 41 | CONFIG_USE_OF=y |
| 42 | CONFIG_BUILTIN_DTB="kc705_nommu" | 42 | CONFIG_BUILTIN_DTB_SOURCE="kc705_nommu" |
| 43 | CONFIG_BINFMT_FLAT=y | 43 | CONFIG_BINFMT_FLAT=y |
| 44 | CONFIG_NET=y | 44 | CONFIG_NET=y |
| 45 | CONFIG_PACKET=y | 45 | CONFIG_PACKET=y |
diff --git a/arch/xtensa/configs/smp_lx200_defconfig b/arch/xtensa/configs/smp_lx200_defconfig index 11fed6c06a7c..e29c5b179a5b 100644 --- a/arch/xtensa/configs/smp_lx200_defconfig +++ b/arch/xtensa/configs/smp_lx200_defconfig | |||
| @@ -33,11 +33,12 @@ CONFIG_SMP=y | |||
| 33 | CONFIG_HOTPLUG_CPU=y | 33 | CONFIG_HOTPLUG_CPU=y |
| 34 | # CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX is not set | 34 | # CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX is not set |
| 35 | # CONFIG_PCI is not set | 35 | # CONFIG_PCI is not set |
| 36 | CONFIG_VECTORS_OFFSET=0x00002000 | ||
| 36 | CONFIG_XTENSA_PLATFORM_XTFPGA=y | 37 | CONFIG_XTENSA_PLATFORM_XTFPGA=y |
| 37 | CONFIG_CMDLINE_BOOL=y | 38 | CONFIG_CMDLINE_BOOL=y |
| 38 | CONFIG_CMDLINE="earlycon=uart8250,mmio32native,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=96M@0" | 39 | CONFIG_CMDLINE="earlycon=uart8250,mmio32native,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug memmap=96M@0" |
| 39 | CONFIG_USE_OF=y | 40 | CONFIG_USE_OF=y |
| 40 | CONFIG_BUILTIN_DTB="lx200mx" | 41 | CONFIG_BUILTIN_DTB_SOURCE="lx200mx" |
| 41 | # CONFIG_COMPACTION is not set | 42 | # CONFIG_COMPACTION is not set |
| 42 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set | 43 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set |
| 43 | CONFIG_NET=y | 44 | CONFIG_NET=y |
diff --git a/arch/xtensa/kernel/head.S b/arch/xtensa/kernel/head.S index da08e75100ab..7f009719304e 100644 --- a/arch/xtensa/kernel/head.S +++ b/arch/xtensa/kernel/head.S | |||
| @@ -276,12 +276,13 @@ should_never_return: | |||
| 276 | 276 | ||
| 277 | movi a2, cpu_start_ccount | 277 | movi a2, cpu_start_ccount |
| 278 | 1: | 278 | 1: |
| 279 | memw | ||
| 279 | l32i a3, a2, 0 | 280 | l32i a3, a2, 0 |
| 280 | beqi a3, 0, 1b | 281 | beqi a3, 0, 1b |
| 281 | movi a3, 0 | 282 | movi a3, 0 |
| 282 | s32i a3, a2, 0 | 283 | s32i a3, a2, 0 |
| 283 | memw | ||
| 284 | 1: | 284 | 1: |
| 285 | memw | ||
| 285 | l32i a3, a2, 0 | 286 | l32i a3, a2, 0 |
| 286 | beqi a3, 0, 1b | 287 | beqi a3, 0, 1b |
| 287 | wsr a3, ccount | 288 | wsr a3, ccount |
| @@ -317,11 +318,13 @@ ENTRY(cpu_restart) | |||
| 317 | rsr a0, prid | 318 | rsr a0, prid |
| 318 | neg a2, a0 | 319 | neg a2, a0 |
| 319 | movi a3, cpu_start_id | 320 | movi a3, cpu_start_id |
| 321 | memw | ||
| 320 | s32i a2, a3, 0 | 322 | s32i a2, a3, 0 |
| 321 | #if XCHAL_DCACHE_IS_WRITEBACK | 323 | #if XCHAL_DCACHE_IS_WRITEBACK |
| 322 | dhwbi a3, 0 | 324 | dhwbi a3, 0 |
| 323 | #endif | 325 | #endif |
| 324 | 1: | 326 | 1: |
| 327 | memw | ||
| 325 | l32i a2, a3, 0 | 328 | l32i a2, a3, 0 |
| 326 | dhi a3, 0 | 329 | dhi a3, 0 |
| 327 | bne a2, a0, 1b | 330 | bne a2, a0, 1b |
diff --git a/arch/xtensa/kernel/smp.c b/arch/xtensa/kernel/smp.c index 932d64689bac..be1f280c322c 100644 --- a/arch/xtensa/kernel/smp.c +++ b/arch/xtensa/kernel/smp.c | |||
| @@ -83,7 +83,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus) | |||
| 83 | { | 83 | { |
| 84 | unsigned i; | 84 | unsigned i; |
| 85 | 85 | ||
| 86 | for (i = 0; i < max_cpus; ++i) | 86 | for_each_possible_cpu(i) |
| 87 | set_cpu_present(i, true); | 87 | set_cpu_present(i, true); |
| 88 | } | 88 | } |
| 89 | 89 | ||
| @@ -96,6 +96,11 @@ void __init smp_init_cpus(void) | |||
| 96 | pr_info("%s: Core Count = %d\n", __func__, ncpus); | 96 | pr_info("%s: Core Count = %d\n", __func__, ncpus); |
| 97 | pr_info("%s: Core Id = %d\n", __func__, core_id); | 97 | pr_info("%s: Core Id = %d\n", __func__, core_id); |
| 98 | 98 | ||
| 99 | if (ncpus > NR_CPUS) { | ||
| 100 | ncpus = NR_CPUS; | ||
| 101 | pr_info("%s: limiting core count by %d\n", __func__, ncpus); | ||
| 102 | } | ||
| 103 | |||
| 99 | for (i = 0; i < ncpus; ++i) | 104 | for (i = 0; i < ncpus; ++i) |
| 100 | set_cpu_possible(i, true); | 105 | set_cpu_possible(i, true); |
| 101 | } | 106 | } |
| @@ -195,9 +200,11 @@ static int boot_secondary(unsigned int cpu, struct task_struct *ts) | |||
| 195 | int i; | 200 | int i; |
| 196 | 201 | ||
| 197 | #ifdef CONFIG_HOTPLUG_CPU | 202 | #ifdef CONFIG_HOTPLUG_CPU |
| 198 | cpu_start_id = cpu; | 203 | WRITE_ONCE(cpu_start_id, cpu); |
| 199 | system_flush_invalidate_dcache_range( | 204 | /* Pairs with the third memw in the cpu_restart */ |
| 200 | (unsigned long)&cpu_start_id, sizeof(cpu_start_id)); | 205 | mb(); |
| 206 | system_flush_invalidate_dcache_range((unsigned long)&cpu_start_id, | ||
| 207 | sizeof(cpu_start_id)); | ||
| 201 | #endif | 208 | #endif |
| 202 | smp_call_function_single(0, mx_cpu_start, (void *)cpu, 1); | 209 | smp_call_function_single(0, mx_cpu_start, (void *)cpu, 1); |
| 203 | 210 | ||
| @@ -206,18 +213,21 @@ static int boot_secondary(unsigned int cpu, struct task_struct *ts) | |||
| 206 | ccount = get_ccount(); | 213 | ccount = get_ccount(); |
| 207 | while (!ccount); | 214 | while (!ccount); |
| 208 | 215 | ||
| 209 | cpu_start_ccount = ccount; | 216 | WRITE_ONCE(cpu_start_ccount, ccount); |
| 210 | 217 | ||
| 211 | while (time_before(jiffies, timeout)) { | 218 | do { |
| 219 | /* | ||
| 220 | * Pairs with the first two memws in the | ||
| 221 | * .Lboot_secondary. | ||
| 222 | */ | ||
| 212 | mb(); | 223 | mb(); |
| 213 | if (!cpu_start_ccount) | 224 | ccount = READ_ONCE(cpu_start_ccount); |
| 214 | break; | 225 | } while (ccount && time_before(jiffies, timeout)); |
| 215 | } | ||
| 216 | 226 | ||
| 217 | if (cpu_start_ccount) { | 227 | if (ccount) { |
| 218 | smp_call_function_single(0, mx_cpu_stop, | 228 | smp_call_function_single(0, mx_cpu_stop, |
| 219 | (void *)cpu, 1); | 229 | (void *)cpu, 1); |
| 220 | cpu_start_ccount = 0; | 230 | WRITE_ONCE(cpu_start_ccount, 0); |
| 221 | return -EIO; | 231 | return -EIO; |
| 222 | } | 232 | } |
| 223 | } | 233 | } |
| @@ -237,6 +247,7 @@ int __cpu_up(unsigned int cpu, struct task_struct *idle) | |||
| 237 | pr_debug("%s: Calling wakeup_secondary(cpu:%d, idle:%p, sp: %08lx)\n", | 247 | pr_debug("%s: Calling wakeup_secondary(cpu:%d, idle:%p, sp: %08lx)\n", |
| 238 | __func__, cpu, idle, start_info.stack); | 248 | __func__, cpu, idle, start_info.stack); |
| 239 | 249 | ||
| 250 | init_completion(&cpu_running); | ||
| 240 | ret = boot_secondary(cpu, idle); | 251 | ret = boot_secondary(cpu, idle); |
| 241 | if (ret == 0) { | 252 | if (ret == 0) { |
| 242 | wait_for_completion_timeout(&cpu_running, | 253 | wait_for_completion_timeout(&cpu_running, |
| @@ -298,8 +309,10 @@ void __cpu_die(unsigned int cpu) | |||
| 298 | unsigned long timeout = jiffies + msecs_to_jiffies(1000); | 309 | unsigned long timeout = jiffies + msecs_to_jiffies(1000); |
| 299 | while (time_before(jiffies, timeout)) { | 310 | while (time_before(jiffies, timeout)) { |
| 300 | system_invalidate_dcache_range((unsigned long)&cpu_start_id, | 311 | system_invalidate_dcache_range((unsigned long)&cpu_start_id, |
| 301 | sizeof(cpu_start_id)); | 312 | sizeof(cpu_start_id)); |
| 302 | if (cpu_start_id == -cpu) { | 313 | /* Pairs with the second memw in the cpu_restart */ |
| 314 | mb(); | ||
| 315 | if (READ_ONCE(cpu_start_id) == -cpu) { | ||
| 303 | platform_cpu_kill(cpu); | 316 | platform_cpu_kill(cpu); |
| 304 | return; | 317 | return; |
| 305 | } | 318 | } |
diff --git a/arch/xtensa/kernel/time.c b/arch/xtensa/kernel/time.c index fd524a54d2ab..378186b5eb40 100644 --- a/arch/xtensa/kernel/time.c +++ b/arch/xtensa/kernel/time.c | |||
| @@ -89,7 +89,7 @@ static int ccount_timer_shutdown(struct clock_event_device *evt) | |||
| 89 | container_of(evt, struct ccount_timer, evt); | 89 | container_of(evt, struct ccount_timer, evt); |
| 90 | 90 | ||
| 91 | if (timer->irq_enabled) { | 91 | if (timer->irq_enabled) { |
| 92 | disable_irq(evt->irq); | 92 | disable_irq_nosync(evt->irq); |
| 93 | timer->irq_enabled = 0; | 93 | timer->irq_enabled = 0; |
| 94 | } | 94 | } |
| 95 | return 0; | 95 | return 0; |
