diff options
101 files changed, 1067 insertions, 521 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index 358eb0105e00..88c09ca2584f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -1186,7 +1186,7 @@ M: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> | |||
| 1186 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 1186 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
| 1187 | S: Maintained | 1187 | S: Maintained |
| 1188 | F: arch/arm/mach-mvebu/ | 1188 | F: arch/arm/mach-mvebu/ |
| 1189 | F: drivers/rtc/armada38x-rtc | 1189 | F: drivers/rtc/rtc-armada38x.c |
| 1190 | 1190 | ||
| 1191 | ARM/Marvell Berlin SoC support | 1191 | ARM/Marvell Berlin SoC support |
| 1192 | M: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> | 1192 | M: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> |
| @@ -1675,8 +1675,8 @@ F: drivers/misc/eeprom/at24.c | |||
| 1675 | F: include/linux/platform_data/at24.h | 1675 | F: include/linux/platform_data/at24.h |
| 1676 | 1676 | ||
| 1677 | ATA OVER ETHERNET (AOE) DRIVER | 1677 | ATA OVER ETHERNET (AOE) DRIVER |
| 1678 | M: "Ed L. Cashin" <ecashin@coraid.com> | 1678 | M: "Ed L. Cashin" <ed.cashin@acm.org> |
| 1679 | W: http://support.coraid.com/support/linux | 1679 | W: http://www.openaoe.org/ |
| 1680 | S: Supported | 1680 | S: Supported |
| 1681 | F: Documentation/aoe/ | 1681 | F: Documentation/aoe/ |
| 1682 | F: drivers/block/aoe/ | 1682 | F: drivers/block/aoe/ |
| @@ -3252,6 +3252,13 @@ S: Maintained | |||
| 3252 | F: Documentation/hwmon/dme1737 | 3252 | F: Documentation/hwmon/dme1737 |
| 3253 | F: drivers/hwmon/dme1737.c | 3253 | F: drivers/hwmon/dme1737.c |
| 3254 | 3254 | ||
| 3255 | DMI/SMBIOS SUPPORT | ||
| 3256 | M: Jean Delvare <jdelvare@suse.de> | ||
| 3257 | S: Maintained | ||
| 3258 | F: drivers/firmware/dmi-id.c | ||
| 3259 | F: drivers/firmware/dmi_scan.c | ||
| 3260 | F: include/linux/dmi.h | ||
| 3261 | |||
| 3255 | DOCKING STATION DRIVER | 3262 | DOCKING STATION DRIVER |
| 3256 | M: Shaohua Li <shaohua.li@intel.com> | 3263 | M: Shaohua Li <shaohua.li@intel.com> |
| 3257 | L: linux-acpi@vger.kernel.org | 3264 | L: linux-acpi@vger.kernel.org |
diff --git a/arch/arc/kernel/signal.c b/arch/arc/kernel/signal.c index 114234e83caa..edda76fae83f 100644 --- a/arch/arc/kernel/signal.c +++ b/arch/arc/kernel/signal.c | |||
| @@ -67,7 +67,7 @@ stash_usr_regs(struct rt_sigframe __user *sf, struct pt_regs *regs, | |||
| 67 | sigset_t *set) | 67 | sigset_t *set) |
| 68 | { | 68 | { |
| 69 | int err; | 69 | int err; |
| 70 | err = __copy_to_user(&(sf->uc.uc_mcontext.regs), regs, | 70 | err = __copy_to_user(&(sf->uc.uc_mcontext.regs.scratch), regs, |
| 71 | sizeof(sf->uc.uc_mcontext.regs.scratch)); | 71 | sizeof(sf->uc.uc_mcontext.regs.scratch)); |
| 72 | err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(sigset_t)); | 72 | err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(sigset_t)); |
| 73 | 73 | ||
| @@ -83,7 +83,7 @@ static int restore_usr_regs(struct pt_regs *regs, struct rt_sigframe __user *sf) | |||
| 83 | if (!err) | 83 | if (!err) |
| 84 | set_current_blocked(&set); | 84 | set_current_blocked(&set); |
| 85 | 85 | ||
| 86 | err |= __copy_from_user(regs, &(sf->uc.uc_mcontext.regs), | 86 | err |= __copy_from_user(regs, &(sf->uc.uc_mcontext.regs.scratch), |
| 87 | sizeof(sf->uc.uc_mcontext.regs.scratch)); | 87 | sizeof(sf->uc.uc_mcontext.regs.scratch)); |
| 88 | 88 | ||
| 89 | return err; | 89 | return err; |
| @@ -131,6 +131,15 @@ SYSCALL_DEFINE0(rt_sigreturn) | |||
| 131 | /* Don't restart from sigreturn */ | 131 | /* Don't restart from sigreturn */ |
| 132 | syscall_wont_restart(regs); | 132 | syscall_wont_restart(regs); |
| 133 | 133 | ||
| 134 | /* | ||
| 135 | * Ensure that sigreturn always returns to user mode (in case the | ||
| 136 | * regs saved on user stack got fudged between save and sigreturn) | ||
| 137 | * Otherwise it is easy to panic the kernel with a custom | ||
| 138 | * signal handler and/or restorer which clobberes the status32/ret | ||
| 139 | * to return to a bogus location in kernel mode. | ||
| 140 | */ | ||
| 141 | regs->status32 |= STATUS_U_MASK; | ||
| 142 | |||
| 134 | return regs->r0; | 143 | return regs->r0; |
| 135 | 144 | ||
| 136 | badframe: | 145 | badframe: |
| @@ -229,8 +238,11 @@ setup_rt_frame(struct ksignal *ksig, sigset_t *set, struct pt_regs *regs) | |||
| 229 | 238 | ||
| 230 | /* | 239 | /* |
| 231 | * handler returns using sigreturn stub provided already by userpsace | 240 | * handler returns using sigreturn stub provided already by userpsace |
| 241 | * If not, nuke the process right away | ||
| 232 | */ | 242 | */ |
| 233 | BUG_ON(!(ksig->ka.sa.sa_flags & SA_RESTORER)); | 243 | if(!(ksig->ka.sa.sa_flags & SA_RESTORER)) |
| 244 | return 1; | ||
| 245 | |||
| 234 | regs->blink = (unsigned long)ksig->ka.sa.sa_restorer; | 246 | regs->blink = (unsigned long)ksig->ka.sa.sa_restorer; |
| 235 | 247 | ||
| 236 | /* User Stack for signal handler will be above the frame just carved */ | 248 | /* User Stack for signal handler will be above the frame just carved */ |
| @@ -296,12 +308,12 @@ static void | |||
| 296 | handle_signal(struct ksignal *ksig, struct pt_regs *regs) | 308 | handle_signal(struct ksignal *ksig, struct pt_regs *regs) |
| 297 | { | 309 | { |
| 298 | sigset_t *oldset = sigmask_to_save(); | 310 | sigset_t *oldset = sigmask_to_save(); |
| 299 | int ret; | 311 | int failed; |
| 300 | 312 | ||
| 301 | /* Set up the stack frame */ | 313 | /* Set up the stack frame */ |
| 302 | ret = setup_rt_frame(ksig, oldset, regs); | 314 | failed = setup_rt_frame(ksig, oldset, regs); |
| 303 | 315 | ||
| 304 | signal_setup_done(ret, ksig, 0); | 316 | signal_setup_done(failed, ksig, 0); |
| 305 | } | 317 | } |
| 306 | 318 | ||
| 307 | void do_signal(struct pt_regs *regs) | 319 | void do_signal(struct pt_regs *regs) |
diff --git a/arch/arm64/include/asm/cmpxchg.h b/arch/arm64/include/asm/cmpxchg.h index cb9593079f29..d8c25b7b18fb 100644 --- a/arch/arm64/include/asm/cmpxchg.h +++ b/arch/arm64/include/asm/cmpxchg.h | |||
| @@ -246,14 +246,30 @@ static inline unsigned long __cmpxchg_mb(volatile void *ptr, unsigned long old, | |||
| 246 | __ret; \ | 246 | __ret; \ |
| 247 | }) | 247 | }) |
| 248 | 248 | ||
| 249 | #define this_cpu_cmpxchg_1(ptr, o, n) cmpxchg_local(raw_cpu_ptr(&(ptr)), o, n) | 249 | #define _protect_cmpxchg_local(pcp, o, n) \ |
| 250 | #define this_cpu_cmpxchg_2(ptr, o, n) cmpxchg_local(raw_cpu_ptr(&(ptr)), o, n) | 250 | ({ \ |
| 251 | #define this_cpu_cmpxchg_4(ptr, o, n) cmpxchg_local(raw_cpu_ptr(&(ptr)), o, n) | 251 | typeof(*raw_cpu_ptr(&(pcp))) __ret; \ |
| 252 | #define this_cpu_cmpxchg_8(ptr, o, n) cmpxchg_local(raw_cpu_ptr(&(ptr)), o, n) | 252 | preempt_disable(); \ |
| 253 | 253 | __ret = cmpxchg_local(raw_cpu_ptr(&(pcp)), o, n); \ | |
| 254 | #define this_cpu_cmpxchg_double_8(ptr1, ptr2, o1, o2, n1, n2) \ | 254 | preempt_enable(); \ |
| 255 | cmpxchg_double_local(raw_cpu_ptr(&(ptr1)), raw_cpu_ptr(&(ptr2)), \ | 255 | __ret; \ |
| 256 | o1, o2, n1, n2) | 256 | }) |
| 257 | |||
| 258 | #define this_cpu_cmpxchg_1(ptr, o, n) _protect_cmpxchg_local(ptr, o, n) | ||
| 259 | #define this_cpu_cmpxchg_2(ptr, o, n) _protect_cmpxchg_local(ptr, o, n) | ||
| 260 | #define this_cpu_cmpxchg_4(ptr, o, n) _protect_cmpxchg_local(ptr, o, n) | ||
| 261 | #define this_cpu_cmpxchg_8(ptr, o, n) _protect_cmpxchg_local(ptr, o, n) | ||
| 262 | |||
| 263 | #define this_cpu_cmpxchg_double_8(ptr1, ptr2, o1, o2, n1, n2) \ | ||
| 264 | ({ \ | ||
| 265 | int __ret; \ | ||
| 266 | preempt_disable(); \ | ||
| 267 | __ret = cmpxchg_double_local( raw_cpu_ptr(&(ptr1)), \ | ||
| 268 | raw_cpu_ptr(&(ptr2)), \ | ||
| 269 | o1, o2, n1, n2); \ | ||
| 270 | preempt_enable(); \ | ||
| 271 | __ret; \ | ||
| 272 | }) | ||
| 257 | 273 | ||
| 258 | #define cmpxchg64(ptr,o,n) cmpxchg((ptr),(o),(n)) | 274 | #define cmpxchg64(ptr,o,n) cmpxchg((ptr),(o),(n)) |
| 259 | #define cmpxchg64_local(ptr,o,n) cmpxchg_local((ptr),(o),(n)) | 275 | #define cmpxchg64_local(ptr,o,n) cmpxchg_local((ptr),(o),(n)) |
diff --git a/arch/arm64/include/asm/mmu_context.h b/arch/arm64/include/asm/mmu_context.h index a9eee33dfa62..101a42bde728 100644 --- a/arch/arm64/include/asm/mmu_context.h +++ b/arch/arm64/include/asm/mmu_context.h | |||
| @@ -151,6 +151,15 @@ switch_mm(struct mm_struct *prev, struct mm_struct *next, | |||
| 151 | { | 151 | { |
| 152 | unsigned int cpu = smp_processor_id(); | 152 | unsigned int cpu = smp_processor_id(); |
| 153 | 153 | ||
| 154 | /* | ||
| 155 | * init_mm.pgd does not contain any user mappings and it is always | ||
| 156 | * active for kernel addresses in TTBR1. Just set the reserved TTBR0. | ||
| 157 | */ | ||
| 158 | if (next == &init_mm) { | ||
| 159 | cpu_set_reserved_ttbr0(); | ||
| 160 | return; | ||
| 161 | } | ||
| 162 | |||
| 154 | if (!cpumask_test_and_set_cpu(cpu, mm_cpumask(next)) || prev != next) | 163 | if (!cpumask_test_and_set_cpu(cpu, mm_cpumask(next)) || prev != next) |
| 155 | check_and_switch_context(next, tsk); | 164 | check_and_switch_context(next, tsk); |
| 156 | } | 165 | } |
diff --git a/arch/arm64/include/asm/percpu.h b/arch/arm64/include/asm/percpu.h index 09da25bc596f..4fde8c1df97f 100644 --- a/arch/arm64/include/asm/percpu.h +++ b/arch/arm64/include/asm/percpu.h | |||
| @@ -204,25 +204,47 @@ static inline unsigned long __percpu_xchg(void *ptr, unsigned long val, | |||
| 204 | return ret; | 204 | return ret; |
| 205 | } | 205 | } |
| 206 | 206 | ||
| 207 | #define _percpu_read(pcp) \ | ||
| 208 | ({ \ | ||
| 209 | typeof(pcp) __retval; \ | ||
| 210 | preempt_disable(); \ | ||
| 211 | __retval = (typeof(pcp))__percpu_read(raw_cpu_ptr(&(pcp)), \ | ||
| 212 | sizeof(pcp)); \ | ||
| 213 | preempt_enable(); \ | ||
| 214 | __retval; \ | ||
| 215 | }) | ||
| 216 | |||
| 217 | #define _percpu_write(pcp, val) \ | ||
| 218 | do { \ | ||
| 219 | preempt_disable(); \ | ||
| 220 | __percpu_write(raw_cpu_ptr(&(pcp)), (unsigned long)(val), \ | ||
| 221 | sizeof(pcp)); \ | ||
| 222 | preempt_enable(); \ | ||
| 223 | } while(0) \ | ||
| 224 | |||
| 225 | #define _pcp_protect(operation, pcp, val) \ | ||
| 226 | ({ \ | ||
| 227 | typeof(pcp) __retval; \ | ||
| 228 | preempt_disable(); \ | ||
| 229 | __retval = (typeof(pcp))operation(raw_cpu_ptr(&(pcp)), \ | ||
| 230 | (val), sizeof(pcp)); \ | ||
| 231 | preempt_enable(); \ | ||
| 232 | __retval; \ | ||
| 233 | }) | ||
| 234 | |||
| 207 | #define _percpu_add(pcp, val) \ | 235 | #define _percpu_add(pcp, val) \ |
| 208 | __percpu_add(raw_cpu_ptr(&(pcp)), val, sizeof(pcp)) | 236 | _pcp_protect(__percpu_add, pcp, val) |
| 209 | 237 | ||
| 210 | #define _percpu_add_return(pcp, val) (typeof(pcp)) (_percpu_add(pcp, val)) | 238 | #define _percpu_add_return(pcp, val) _percpu_add(pcp, val) |
| 211 | 239 | ||
| 212 | #define _percpu_and(pcp, val) \ | 240 | #define _percpu_and(pcp, val) \ |
| 213 | __percpu_and(raw_cpu_ptr(&(pcp)), val, sizeof(pcp)) | 241 | _pcp_protect(__percpu_and, pcp, val) |
| 214 | 242 | ||
| 215 | #define _percpu_or(pcp, val) \ | 243 | #define _percpu_or(pcp, val) \ |
| 216 | __percpu_or(raw_cpu_ptr(&(pcp)), val, sizeof(pcp)) | 244 | _pcp_protect(__percpu_or, pcp, val) |
| 217 | |||
| 218 | #define _percpu_read(pcp) (typeof(pcp)) \ | ||
| 219 | (__percpu_read(raw_cpu_ptr(&(pcp)), sizeof(pcp))) | ||
| 220 | |||
| 221 | #define _percpu_write(pcp, val) \ | ||
| 222 | __percpu_write(raw_cpu_ptr(&(pcp)), (unsigned long)(val), sizeof(pcp)) | ||
| 223 | 245 | ||
| 224 | #define _percpu_xchg(pcp, val) (typeof(pcp)) \ | 246 | #define _percpu_xchg(pcp, val) (typeof(pcp)) \ |
| 225 | (__percpu_xchg(raw_cpu_ptr(&(pcp)), (unsigned long)(val), sizeof(pcp))) | 247 | _pcp_protect(__percpu_xchg, pcp, (unsigned long)(val)) |
| 226 | 248 | ||
| 227 | #define this_cpu_add_1(pcp, val) _percpu_add(pcp, val) | 249 | #define this_cpu_add_1(pcp, val) _percpu_add(pcp, val) |
| 228 | #define this_cpu_add_2(pcp, val) _percpu_add(pcp, val) | 250 | #define this_cpu_add_2(pcp, val) _percpu_add(pcp, val) |
diff --git a/arch/metag/include/asm/io.h b/arch/metag/include/asm/io.h index 9359e5048442..d5779b0ec573 100644 --- a/arch/metag/include/asm/io.h +++ b/arch/metag/include/asm/io.h | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | #define _ASM_METAG_IO_H | 2 | #define _ASM_METAG_IO_H |
| 3 | 3 | ||
| 4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
| 5 | #include <asm/pgtable-bits.h> | ||
| 5 | 6 | ||
| 6 | #define IO_SPACE_LIMIT 0 | 7 | #define IO_SPACE_LIMIT 0 |
| 7 | 8 | ||
diff --git a/arch/metag/include/asm/pgtable-bits.h b/arch/metag/include/asm/pgtable-bits.h new file mode 100644 index 000000000000..25ba6729f496 --- /dev/null +++ b/arch/metag/include/asm/pgtable-bits.h | |||
| @@ -0,0 +1,104 @@ | |||
| 1 | /* | ||
| 2 | * Meta page table definitions. | ||
| 3 | */ | ||
| 4 | |||
| 5 | #ifndef _METAG_PGTABLE_BITS_H | ||
| 6 | #define _METAG_PGTABLE_BITS_H | ||
| 7 | |||
| 8 | #include <asm/metag_mem.h> | ||
| 9 | |||
| 10 | /* | ||
| 11 | * Definitions for MMU descriptors | ||
| 12 | * | ||
| 13 | * These are the hardware bits in the MMCU pte entries. | ||
| 14 | * Derived from the Meta toolkit headers. | ||
| 15 | */ | ||
| 16 | #define _PAGE_PRESENT MMCU_ENTRY_VAL_BIT | ||
| 17 | #define _PAGE_WRITE MMCU_ENTRY_WR_BIT | ||
| 18 | #define _PAGE_PRIV MMCU_ENTRY_PRIV_BIT | ||
| 19 | /* Write combine bit - this can cause writes to occur out of order */ | ||
| 20 | #define _PAGE_WR_COMBINE MMCU_ENTRY_WRC_BIT | ||
| 21 | /* Sys coherent bit - this bit is never used by Linux */ | ||
| 22 | #define _PAGE_SYS_COHERENT MMCU_ENTRY_SYS_BIT | ||
| 23 | #define _PAGE_ALWAYS_ZERO_1 0x020 | ||
| 24 | #define _PAGE_CACHE_CTRL0 0x040 | ||
| 25 | #define _PAGE_CACHE_CTRL1 0x080 | ||
| 26 | #define _PAGE_ALWAYS_ZERO_2 0x100 | ||
| 27 | #define _PAGE_ALWAYS_ZERO_3 0x200 | ||
| 28 | #define _PAGE_ALWAYS_ZERO_4 0x400 | ||
| 29 | #define _PAGE_ALWAYS_ZERO_5 0x800 | ||
| 30 | |||
| 31 | /* These are software bits that we stuff into the gaps in the hardware | ||
| 32 | * pte entries that are not used. Note, these DO get stored in the actual | ||
| 33 | * hardware, but the hardware just does not use them. | ||
| 34 | */ | ||
| 35 | #define _PAGE_ACCESSED _PAGE_ALWAYS_ZERO_1 | ||
| 36 | #define _PAGE_DIRTY _PAGE_ALWAYS_ZERO_2 | ||
| 37 | |||
| 38 | /* Pages owned, and protected by, the kernel. */ | ||
| 39 | #define _PAGE_KERNEL _PAGE_PRIV | ||
| 40 | |||
| 41 | /* No cacheing of this page */ | ||
| 42 | #define _PAGE_CACHE_WIN0 (MMCU_CWIN_UNCACHED << MMCU_ENTRY_CWIN_S) | ||
| 43 | /* burst cacheing - good for data streaming */ | ||
| 44 | #define _PAGE_CACHE_WIN1 (MMCU_CWIN_BURST << MMCU_ENTRY_CWIN_S) | ||
| 45 | /* One cache way per thread */ | ||
| 46 | #define _PAGE_CACHE_WIN2 (MMCU_CWIN_C1SET << MMCU_ENTRY_CWIN_S) | ||
| 47 | /* Full on cacheing */ | ||
| 48 | #define _PAGE_CACHE_WIN3 (MMCU_CWIN_CACHED << MMCU_ENTRY_CWIN_S) | ||
| 49 | |||
| 50 | #define _PAGE_CACHEABLE (_PAGE_CACHE_WIN3 | _PAGE_WR_COMBINE) | ||
| 51 | |||
| 52 | /* which bits are used for cache control ... */ | ||
| 53 | #define _PAGE_CACHE_MASK (_PAGE_CACHE_CTRL0 | _PAGE_CACHE_CTRL1 | \ | ||
| 54 | _PAGE_WR_COMBINE) | ||
| 55 | |||
| 56 | /* This is a mask of the bits that pte_modify is allowed to change. */ | ||
| 57 | #define _PAGE_CHG_MASK (PAGE_MASK) | ||
| 58 | |||
| 59 | #define _PAGE_SZ_SHIFT 1 | ||
| 60 | #define _PAGE_SZ_4K (0x0) | ||
| 61 | #define _PAGE_SZ_8K (0x1 << _PAGE_SZ_SHIFT) | ||
| 62 | #define _PAGE_SZ_16K (0x2 << _PAGE_SZ_SHIFT) | ||
| 63 | #define _PAGE_SZ_32K (0x3 << _PAGE_SZ_SHIFT) | ||
| 64 | #define _PAGE_SZ_64K (0x4 << _PAGE_SZ_SHIFT) | ||
| 65 | #define _PAGE_SZ_128K (0x5 << _PAGE_SZ_SHIFT) | ||
| 66 | #define _PAGE_SZ_256K (0x6 << _PAGE_SZ_SHIFT) | ||
| 67 | #define _PAGE_SZ_512K (0x7 << _PAGE_SZ_SHIFT) | ||
| 68 | #define _PAGE_SZ_1M (0x8 << _PAGE_SZ_SHIFT) | ||
| 69 | #define _PAGE_SZ_2M (0x9 << _PAGE_SZ_SHIFT) | ||
| 70 | #define _PAGE_SZ_4M (0xa << _PAGE_SZ_SHIFT) | ||
| 71 | #define _PAGE_SZ_MASK (0xf << _PAGE_SZ_SHIFT) | ||
| 72 | |||
| 73 | #if defined(CONFIG_PAGE_SIZE_4K) | ||
| 74 | #define _PAGE_SZ (_PAGE_SZ_4K) | ||
| 75 | #elif defined(CONFIG_PAGE_SIZE_8K) | ||
| 76 | #define _PAGE_SZ (_PAGE_SZ_8K) | ||
| 77 | #elif defined(CONFIG_PAGE_SIZE_16K) | ||
| 78 | #define _PAGE_SZ (_PAGE_SZ_16K) | ||
| 79 | #endif | ||
| 80 | #define _PAGE_TABLE (_PAGE_SZ | _PAGE_PRESENT) | ||
| 81 | |||
| 82 | #if defined(CONFIG_HUGETLB_PAGE_SIZE_8K) | ||
| 83 | # define _PAGE_SZHUGE (_PAGE_SZ_8K) | ||
| 84 | #elif defined(CONFIG_HUGETLB_PAGE_SIZE_16K) | ||
| 85 | # define _PAGE_SZHUGE (_PAGE_SZ_16K) | ||
| 86 | #elif defined(CONFIG_HUGETLB_PAGE_SIZE_32K) | ||
| 87 | # define _PAGE_SZHUGE (_PAGE_SZ_32K) | ||
| 88 | #elif defined(CONFIG_HUGETLB_PAGE_SIZE_64K) | ||
| 89 | # define _PAGE_SZHUGE (_PAGE_SZ_64K) | ||
| 90 | #elif defined(CONFIG_HUGETLB_PAGE_SIZE_128K) | ||
| 91 | # define _PAGE_SZHUGE (_PAGE_SZ_128K) | ||
| 92 | #elif defined(CONFIG_HUGETLB_PAGE_SIZE_256K) | ||
| 93 | # define _PAGE_SZHUGE (_PAGE_SZ_256K) | ||
| 94 | #elif defined(CONFIG_HUGETLB_PAGE_SIZE_512K) | ||
| 95 | # define _PAGE_SZHUGE (_PAGE_SZ_512K) | ||
| 96 | #elif defined(CONFIG_HUGETLB_PAGE_SIZE_1M) | ||
| 97 | # define _PAGE_SZHUGE (_PAGE_SZ_1M) | ||
| 98 | #elif defined(CONFIG_HUGETLB_PAGE_SIZE_2M) | ||
| 99 | # define _PAGE_SZHUGE (_PAGE_SZ_2M) | ||
| 100 | #elif defined(CONFIG_HUGETLB_PAGE_SIZE_4M) | ||
| 101 | # define _PAGE_SZHUGE (_PAGE_SZ_4M) | ||
| 102 | #endif | ||
| 103 | |||
| 104 | #endif /* _METAG_PGTABLE_BITS_H */ | ||
diff --git a/arch/metag/include/asm/pgtable.h b/arch/metag/include/asm/pgtable.h index d0604c0a8702..ffa3a3a2ecad 100644 --- a/arch/metag/include/asm/pgtable.h +++ b/arch/metag/include/asm/pgtable.h | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #ifndef _METAG_PGTABLE_H | 5 | #ifndef _METAG_PGTABLE_H |
| 6 | #define _METAG_PGTABLE_H | 6 | #define _METAG_PGTABLE_H |
| 7 | 7 | ||
| 8 | #include <asm/pgtable-bits.h> | ||
| 8 | #include <asm-generic/pgtable-nopmd.h> | 9 | #include <asm-generic/pgtable-nopmd.h> |
| 9 | 10 | ||
| 10 | /* Invalid regions on Meta: 0x00000000-0x001FFFFF and 0xFFFF0000-0xFFFFFFFF */ | 11 | /* Invalid regions on Meta: 0x00000000-0x001FFFFF and 0xFFFF0000-0xFFFFFFFF */ |
| @@ -21,100 +22,6 @@ | |||
| 21 | #endif | 22 | #endif |
| 22 | 23 | ||
| 23 | /* | 24 | /* |
| 24 | * Definitions for MMU descriptors | ||
| 25 | * | ||
| 26 | * These are the hardware bits in the MMCU pte entries. | ||
| 27 | * Derived from the Meta toolkit headers. | ||
| 28 | */ | ||
| 29 | #define _PAGE_PRESENT MMCU_ENTRY_VAL_BIT | ||
| 30 | #define _PAGE_WRITE MMCU_ENTRY_WR_BIT | ||
| 31 | #define _PAGE_PRIV MMCU_ENTRY_PRIV_BIT | ||
| 32 | /* Write combine bit - this can cause writes to occur out of order */ | ||
| 33 | #define _PAGE_WR_COMBINE MMCU_ENTRY_WRC_BIT | ||
| 34 | /* Sys coherent bit - this bit is never used by Linux */ | ||
| 35 | #define _PAGE_SYS_COHERENT MMCU_ENTRY_SYS_BIT | ||
| 36 | #define _PAGE_ALWAYS_ZERO_1 0x020 | ||
| 37 | #define _PAGE_CACHE_CTRL0 0x040 | ||
| 38 | #define _PAGE_CACHE_CTRL1 0x080 | ||
| 39 | #define _PAGE_ALWAYS_ZERO_2 0x100 | ||
| 40 | #define _PAGE_ALWAYS_ZERO_3 0x200 | ||
| 41 | #define _PAGE_ALWAYS_ZERO_4 0x400 | ||
| 42 | #define _PAGE_ALWAYS_ZERO_5 0x800 | ||
| 43 | |||
| 44 | /* These are software bits that we stuff into the gaps in the hardware | ||
| 45 | * pte entries that are not used. Note, these DO get stored in the actual | ||
| 46 | * hardware, but the hardware just does not use them. | ||
| 47 | */ | ||
| 48 | #define _PAGE_ACCESSED _PAGE_ALWAYS_ZERO_1 | ||
| 49 | #define _PAGE_DIRTY _PAGE_ALWAYS_ZERO_2 | ||
| 50 | |||
| 51 | /* Pages owned, and protected by, the kernel. */ | ||
| 52 | #define _PAGE_KERNEL _PAGE_PRIV | ||
| 53 | |||
| 54 | /* No cacheing of this page */ | ||
| 55 | #define _PAGE_CACHE_WIN0 (MMCU_CWIN_UNCACHED << MMCU_ENTRY_CWIN_S) | ||
| 56 | /* burst cacheing - good for data streaming */ | ||
| 57 | #define _PAGE_CACHE_WIN1 (MMCU_CWIN_BURST << MMCU_ENTRY_CWIN_S) | ||
| 58 | /* One cache way per thread */ | ||
| 59 | #define _PAGE_CACHE_WIN2 (MMCU_CWIN_C1SET << MMCU_ENTRY_CWIN_S) | ||
| 60 | /* Full on cacheing */ | ||
| 61 | #define _PAGE_CACHE_WIN3 (MMCU_CWIN_CACHED << MMCU_ENTRY_CWIN_S) | ||
| 62 | |||
| 63 | #define _PAGE_CACHEABLE (_PAGE_CACHE_WIN3 | _PAGE_WR_COMBINE) | ||
| 64 | |||
| 65 | /* which bits are used for cache control ... */ | ||
| 66 | #define _PAGE_CACHE_MASK (_PAGE_CACHE_CTRL0 | _PAGE_CACHE_CTRL1 | \ | ||
| 67 | _PAGE_WR_COMBINE) | ||
| 68 | |||
| 69 | /* This is a mask of the bits that pte_modify is allowed to change. */ | ||
| 70 | #define _PAGE_CHG_MASK (PAGE_MASK) | ||
| 71 | |||
| 72 | #define _PAGE_SZ_SHIFT 1 | ||
| 73 | #define _PAGE_SZ_4K (0x0) | ||
| 74 | #define _PAGE_SZ_8K (0x1 << _PAGE_SZ_SHIFT) | ||
| 75 | #define _PAGE_SZ_16K (0x2 << _PAGE_SZ_SHIFT) | ||
| 76 | #define _PAGE_SZ_32K (0x3 << _PAGE_SZ_SHIFT) | ||
| 77 | #define _PAGE_SZ_64K (0x4 << _PAGE_SZ_SHIFT) | ||
| 78 | #define _PAGE_SZ_128K (0x5 << _PAGE_SZ_SHIFT) | ||
| 79 | #define _PAGE_SZ_256K (0x6 << _PAGE_SZ_SHIFT) | ||
| 80 | #define _PAGE_SZ_512K (0x7 << _PAGE_SZ_SHIFT) | ||
| 81 | #define _PAGE_SZ_1M (0x8 << _PAGE_SZ_SHIFT) | ||
| 82 | #define _PAGE_SZ_2M (0x9 << _PAGE_SZ_SHIFT) | ||
| 83 | #define _PAGE_SZ_4M (0xa << _PAGE_SZ_SHIFT) | ||
| 84 | #define _PAGE_SZ_MASK (0xf << _PAGE_SZ_SHIFT) | ||
| 85 | |||
| 86 | #if defined(CONFIG_PAGE_SIZE_4K) | ||
| 87 | #define _PAGE_SZ (_PAGE_SZ_4K) | ||
| 88 | #elif defined(CONFIG_PAGE_SIZE_8K) | ||
| 89 | #define _PAGE_SZ (_PAGE_SZ_8K) | ||
| 90 | #elif defined(CONFIG_PAGE_SIZE_16K) | ||
| 91 | #define _PAGE_SZ (_PAGE_SZ_16K) | ||
| 92 | #endif | ||
| 93 | #define _PAGE_TABLE (_PAGE_SZ | _PAGE_PRESENT) | ||
| 94 | |||
| 95 | #if defined(CONFIG_HUGETLB_PAGE_SIZE_8K) | ||
| 96 | # define _PAGE_SZHUGE (_PAGE_SZ_8K) | ||
| 97 | #elif defined(CONFIG_HUGETLB_PAGE_SIZE_16K) | ||
| 98 | # define _PAGE_SZHUGE (_PAGE_SZ_16K) | ||
| 99 | #elif defined(CONFIG_HUGETLB_PAGE_SIZE_32K) | ||
| 100 | # define _PAGE_SZHUGE (_PAGE_SZ_32K) | ||
| 101 | #elif defined(CONFIG_HUGETLB_PAGE_SIZE_64K) | ||
| 102 | # define _PAGE_SZHUGE (_PAGE_SZ_64K) | ||
| 103 | #elif defined(CONFIG_HUGETLB_PAGE_SIZE_128K) | ||
| 104 | # define _PAGE_SZHUGE (_PAGE_SZ_128K) | ||
| 105 | #elif defined(CONFIG_HUGETLB_PAGE_SIZE_256K) | ||
| 106 | # define _PAGE_SZHUGE (_PAGE_SZ_256K) | ||
| 107 | #elif defined(CONFIG_HUGETLB_PAGE_SIZE_512K) | ||
| 108 | # define _PAGE_SZHUGE (_PAGE_SZ_512K) | ||
| 109 | #elif defined(CONFIG_HUGETLB_PAGE_SIZE_1M) | ||
| 110 | # define _PAGE_SZHUGE (_PAGE_SZ_1M) | ||
| 111 | #elif defined(CONFIG_HUGETLB_PAGE_SIZE_2M) | ||
| 112 | # define _PAGE_SZHUGE (_PAGE_SZ_2M) | ||
| 113 | #elif defined(CONFIG_HUGETLB_PAGE_SIZE_4M) | ||
| 114 | # define _PAGE_SZHUGE (_PAGE_SZ_4M) | ||
| 115 | #endif | ||
| 116 | |||
| 117 | /* | ||
| 118 | * The Linux memory management assumes a three-level page table setup. On | 25 | * The Linux memory management assumes a three-level page table setup. On |
| 119 | * Meta, we use that, but "fold" the mid level into the top-level page | 26 | * Meta, we use that, but "fold" the mid level into the top-level page |
| 120 | * table. | 27 | * table. |
diff --git a/arch/parisc/include/asm/pgalloc.h b/arch/parisc/include/asm/pgalloc.h index f213f5b4c423..d17437238a2c 100644 --- a/arch/parisc/include/asm/pgalloc.h +++ b/arch/parisc/include/asm/pgalloc.h | |||
| @@ -26,7 +26,7 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm) | |||
| 26 | 26 | ||
| 27 | if (likely(pgd != NULL)) { | 27 | if (likely(pgd != NULL)) { |
| 28 | memset(pgd, 0, PAGE_SIZE<<PGD_ALLOC_ORDER); | 28 | memset(pgd, 0, PAGE_SIZE<<PGD_ALLOC_ORDER); |
| 29 | #ifdef CONFIG_64BIT | 29 | #if PT_NLEVELS == 3 |
| 30 | actual_pgd += PTRS_PER_PGD; | 30 | actual_pgd += PTRS_PER_PGD; |
| 31 | /* Populate first pmd with allocated memory. We mark it | 31 | /* Populate first pmd with allocated memory. We mark it |
| 32 | * with PxD_FLAG_ATTACHED as a signal to the system that this | 32 | * with PxD_FLAG_ATTACHED as a signal to the system that this |
| @@ -45,7 +45,7 @@ static inline pgd_t *pgd_alloc(struct mm_struct *mm) | |||
| 45 | 45 | ||
| 46 | static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) | 46 | static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) |
| 47 | { | 47 | { |
| 48 | #ifdef CONFIG_64BIT | 48 | #if PT_NLEVELS == 3 |
| 49 | pgd -= PTRS_PER_PGD; | 49 | pgd -= PTRS_PER_PGD; |
| 50 | #endif | 50 | #endif |
| 51 | free_pages((unsigned long)pgd, PGD_ALLOC_ORDER); | 51 | free_pages((unsigned long)pgd, PGD_ALLOC_ORDER); |
| @@ -72,12 +72,15 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address) | |||
| 72 | 72 | ||
| 73 | static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd) | 73 | static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd) |
| 74 | { | 74 | { |
| 75 | #ifdef CONFIG_64BIT | ||
| 76 | if(pmd_flag(*pmd) & PxD_FLAG_ATTACHED) | 75 | if(pmd_flag(*pmd) & PxD_FLAG_ATTACHED) |
| 77 | /* This is the permanent pmd attached to the pgd; | 76 | /* |
| 78 | * cannot free it */ | 77 | * This is the permanent pmd attached to the pgd; |
| 78 | * cannot free it. | ||
| 79 | * Increment the counter to compensate for the decrement | ||
| 80 | * done by generic mm code. | ||
| 81 | */ | ||
| 82 | mm_inc_nr_pmds(mm); | ||
| 79 | return; | 83 | return; |
| 80 | #endif | ||
| 81 | free_pages((unsigned long)pmd, PMD_ORDER); | 84 | free_pages((unsigned long)pmd, PMD_ORDER); |
| 82 | } | 85 | } |
| 83 | 86 | ||
| @@ -99,7 +102,7 @@ static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd) | |||
| 99 | static inline void | 102 | static inline void |
| 100 | pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte) | 103 | pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte) |
| 101 | { | 104 | { |
| 102 | #ifdef CONFIG_64BIT | 105 | #if PT_NLEVELS == 3 |
| 103 | /* preserve the gateway marker if this is the beginning of | 106 | /* preserve the gateway marker if this is the beginning of |
| 104 | * the permanent pmd */ | 107 | * the permanent pmd */ |
| 105 | if(pmd_flag(*pmd) & PxD_FLAG_ATTACHED) | 108 | if(pmd_flag(*pmd) & PxD_FLAG_ATTACHED) |
diff --git a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S index 5a8997d63899..8eefb12d1d33 100644 --- a/arch/parisc/kernel/syscall_table.S +++ b/arch/parisc/kernel/syscall_table.S | |||
| @@ -55,8 +55,8 @@ | |||
| 55 | #define ENTRY_COMP(_name_) .word sys_##_name_ | 55 | #define ENTRY_COMP(_name_) .word sys_##_name_ |
| 56 | #endif | 56 | #endif |
| 57 | 57 | ||
| 58 | ENTRY_SAME(restart_syscall) /* 0 */ | 58 | 90: ENTRY_SAME(restart_syscall) /* 0 */ |
| 59 | ENTRY_SAME(exit) | 59 | 91: ENTRY_SAME(exit) |
| 60 | ENTRY_SAME(fork_wrapper) | 60 | ENTRY_SAME(fork_wrapper) |
| 61 | ENTRY_SAME(read) | 61 | ENTRY_SAME(read) |
| 62 | ENTRY_SAME(write) | 62 | ENTRY_SAME(write) |
| @@ -439,7 +439,10 @@ | |||
| 439 | ENTRY_SAME(bpf) | 439 | ENTRY_SAME(bpf) |
| 440 | ENTRY_COMP(execveat) | 440 | ENTRY_COMP(execveat) |
| 441 | 441 | ||
| 442 | /* Nothing yet */ | 442 | |
| 443 | .ifne (. - 90b) - (__NR_Linux_syscalls * (91b - 90b)) | ||
| 444 | .error "size of syscall table does not fit value of __NR_Linux_syscalls" | ||
| 445 | .endif | ||
| 443 | 446 | ||
| 444 | #undef ENTRY_SAME | 447 | #undef ENTRY_SAME |
| 445 | #undef ENTRY_DIFF | 448 | #undef ENTRY_DIFF |
diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h index 03cd858a401c..4cbe23af400a 100644 --- a/arch/powerpc/include/asm/ppc-opcode.h +++ b/arch/powerpc/include/asm/ppc-opcode.h | |||
| @@ -153,6 +153,7 @@ | |||
| 153 | #define PPC_INST_MFSPR_PVR_MASK 0xfc1fffff | 153 | #define PPC_INST_MFSPR_PVR_MASK 0xfc1fffff |
| 154 | #define PPC_INST_MFTMR 0x7c0002dc | 154 | #define PPC_INST_MFTMR 0x7c0002dc |
| 155 | #define PPC_INST_MSGSND 0x7c00019c | 155 | #define PPC_INST_MSGSND 0x7c00019c |
| 156 | #define PPC_INST_MSGCLR 0x7c0001dc | ||
| 156 | #define PPC_INST_MSGSNDP 0x7c00011c | 157 | #define PPC_INST_MSGSNDP 0x7c00011c |
| 157 | #define PPC_INST_MTTMR 0x7c0003dc | 158 | #define PPC_INST_MTTMR 0x7c0003dc |
| 158 | #define PPC_INST_NOP 0x60000000 | 159 | #define PPC_INST_NOP 0x60000000 |
| @@ -309,6 +310,8 @@ | |||
| 309 | ___PPC_RB(b) | __PPC_EH(eh)) | 310 | ___PPC_RB(b) | __PPC_EH(eh)) |
| 310 | #define PPC_MSGSND(b) stringify_in_c(.long PPC_INST_MSGSND | \ | 311 | #define PPC_MSGSND(b) stringify_in_c(.long PPC_INST_MSGSND | \ |
| 311 | ___PPC_RB(b)) | 312 | ___PPC_RB(b)) |
| 313 | #define PPC_MSGCLR(b) stringify_in_c(.long PPC_INST_MSGCLR | \ | ||
| 314 | ___PPC_RB(b)) | ||
| 312 | #define PPC_MSGSNDP(b) stringify_in_c(.long PPC_INST_MSGSNDP | \ | 315 | #define PPC_MSGSNDP(b) stringify_in_c(.long PPC_INST_MSGSNDP | \ |
| 313 | ___PPC_RB(b)) | 316 | ___PPC_RB(b)) |
| 314 | #define PPC_POPCNTB(a, s) stringify_in_c(.long PPC_INST_POPCNTB | \ | 317 | #define PPC_POPCNTB(a, s) stringify_in_c(.long PPC_INST_POPCNTB | \ |
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h index 1c874fb533bb..af56b5c6c81a 100644 --- a/arch/powerpc/include/asm/reg.h +++ b/arch/powerpc/include/asm/reg.h | |||
| @@ -608,13 +608,16 @@ | |||
| 608 | #define SRR1_ISI_N_OR_G 0x10000000 /* ISI: Access is no-exec or G */ | 608 | #define SRR1_ISI_N_OR_G 0x10000000 /* ISI: Access is no-exec or G */ |
| 609 | #define SRR1_ISI_PROT 0x08000000 /* ISI: Other protection fault */ | 609 | #define SRR1_ISI_PROT 0x08000000 /* ISI: Other protection fault */ |
| 610 | #define SRR1_WAKEMASK 0x00380000 /* reason for wakeup */ | 610 | #define SRR1_WAKEMASK 0x00380000 /* reason for wakeup */ |
| 611 | #define SRR1_WAKEMASK_P8 0x003c0000 /* reason for wakeup on POWER8 */ | ||
| 611 | #define SRR1_WAKESYSERR 0x00300000 /* System error */ | 612 | #define SRR1_WAKESYSERR 0x00300000 /* System error */ |
| 612 | #define SRR1_WAKEEE 0x00200000 /* External interrupt */ | 613 | #define SRR1_WAKEEE 0x00200000 /* External interrupt */ |
| 613 | #define SRR1_WAKEMT 0x00280000 /* mtctrl */ | 614 | #define SRR1_WAKEMT 0x00280000 /* mtctrl */ |
| 614 | #define SRR1_WAKEHMI 0x00280000 /* Hypervisor maintenance */ | 615 | #define SRR1_WAKEHMI 0x00280000 /* Hypervisor maintenance */ |
| 615 | #define SRR1_WAKEDEC 0x00180000 /* Decrementer interrupt */ | 616 | #define SRR1_WAKEDEC 0x00180000 /* Decrementer interrupt */ |
| 617 | #define SRR1_WAKEDBELL 0x00140000 /* Privileged doorbell on P8 */ | ||
| 616 | #define SRR1_WAKETHERM 0x00100000 /* Thermal management interrupt */ | 618 | #define SRR1_WAKETHERM 0x00100000 /* Thermal management interrupt */ |
| 617 | #define SRR1_WAKERESET 0x00100000 /* System reset */ | 619 | #define SRR1_WAKERESET 0x00100000 /* System reset */ |
| 620 | #define SRR1_WAKEHDBELL 0x000c0000 /* Hypervisor doorbell on P8 */ | ||
| 618 | #define SRR1_WAKESTATE 0x00030000 /* Powersave exit mask [46:47] */ | 621 | #define SRR1_WAKESTATE 0x00030000 /* Powersave exit mask [46:47] */ |
| 619 | #define SRR1_WS_DEEPEST 0x00030000 /* Some resources not maintained, | 622 | #define SRR1_WS_DEEPEST 0x00030000 /* Some resources not maintained, |
| 620 | * may not be recoverable */ | 623 | * may not be recoverable */ |
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c index f337666768a7..f83046878336 100644 --- a/arch/powerpc/kernel/cputable.c +++ b/arch/powerpc/kernel/cputable.c | |||
| @@ -437,6 +437,26 @@ static struct cpu_spec __initdata cpu_specs[] = { | |||
| 437 | .machine_check_early = __machine_check_early_realmode_p8, | 437 | .machine_check_early = __machine_check_early_realmode_p8, |
| 438 | .platform = "power8", | 438 | .platform = "power8", |
| 439 | }, | 439 | }, |
| 440 | { /* Power8NVL */ | ||
| 441 | .pvr_mask = 0xffff0000, | ||
| 442 | .pvr_value = 0x004c0000, | ||
| 443 | .cpu_name = "POWER8NVL (raw)", | ||
| 444 | .cpu_features = CPU_FTRS_POWER8, | ||
| 445 | .cpu_user_features = COMMON_USER_POWER8, | ||
| 446 | .cpu_user_features2 = COMMON_USER2_POWER8, | ||
| 447 | .mmu_features = MMU_FTRS_POWER8, | ||
| 448 | .icache_bsize = 128, | ||
| 449 | .dcache_bsize = 128, | ||
| 450 | .num_pmcs = 6, | ||
| 451 | .pmc_type = PPC_PMC_IBM, | ||
| 452 | .oprofile_cpu_type = "ppc64/power8", | ||
| 453 | .oprofile_type = PPC_OPROFILE_INVALID, | ||
| 454 | .cpu_setup = __setup_cpu_power8, | ||
| 455 | .cpu_restore = __restore_cpu_power8, | ||
| 456 | .flush_tlb = __flush_tlb_power8, | ||
| 457 | .machine_check_early = __machine_check_early_realmode_p8, | ||
| 458 | .platform = "power8", | ||
| 459 | }, | ||
| 440 | { /* Power8 DD1: Does not support doorbell IPIs */ | 460 | { /* Power8 DD1: Does not support doorbell IPIs */ |
| 441 | .pvr_mask = 0xffffff00, | 461 | .pvr_mask = 0xffffff00, |
| 442 | .pvr_value = 0x004d0100, | 462 | .pvr_value = 0x004d0100, |
diff --git a/arch/powerpc/kernel/dbell.c b/arch/powerpc/kernel/dbell.c index f4217819cc31..2128f3a96c32 100644 --- a/arch/powerpc/kernel/dbell.c +++ b/arch/powerpc/kernel/dbell.c | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | 17 | ||
| 18 | #include <asm/dbell.h> | 18 | #include <asm/dbell.h> |
| 19 | #include <asm/irq_regs.h> | 19 | #include <asm/irq_regs.h> |
| 20 | #include <asm/kvm_ppc.h> | ||
| 20 | 21 | ||
| 21 | #ifdef CONFIG_SMP | 22 | #ifdef CONFIG_SMP |
| 22 | void doorbell_setup_this_cpu(void) | 23 | void doorbell_setup_this_cpu(void) |
| @@ -41,6 +42,7 @@ void doorbell_exception(struct pt_regs *regs) | |||
| 41 | 42 | ||
| 42 | may_hard_irq_enable(); | 43 | may_hard_irq_enable(); |
| 43 | 44 | ||
| 45 | kvmppc_set_host_ipi(smp_processor_id(), 0); | ||
| 44 | __this_cpu_inc(irq_stat.doorbell_irqs); | 46 | __this_cpu_inc(irq_stat.doorbell_irqs); |
| 45 | 47 | ||
| 46 | smp_ipi_demux(); | 48 | smp_ipi_demux(); |
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index c2df8150bd7a..9519e6bdc6d7 100644 --- a/arch/powerpc/kernel/exceptions-64s.S +++ b/arch/powerpc/kernel/exceptions-64s.S | |||
| @@ -1408,7 +1408,7 @@ machine_check_handle_early: | |||
| 1408 | bne 9f /* continue in V mode if we are. */ | 1408 | bne 9f /* continue in V mode if we are. */ |
| 1409 | 1409 | ||
| 1410 | 5: | 1410 | 5: |
| 1411 | #ifdef CONFIG_KVM_BOOK3S_64_HV | 1411 | #ifdef CONFIG_KVM_BOOK3S_64_HANDLER |
| 1412 | /* | 1412 | /* |
| 1413 | * We are coming from kernel context. Check if we are coming from | 1413 | * We are coming from kernel context. Check if we are coming from |
| 1414 | * guest. if yes, then we can continue. We will fall through | 1414 | * guest. if yes, then we can continue. We will fall through |
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index de4018a1bc4b..de747563d29d 100644 --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c | |||
| @@ -636,7 +636,7 @@ static int kvmppc_get_yield_count(struct kvm_vcpu *vcpu) | |||
| 636 | spin_lock(&vcpu->arch.vpa_update_lock); | 636 | spin_lock(&vcpu->arch.vpa_update_lock); |
| 637 | lppaca = (struct lppaca *)vcpu->arch.vpa.pinned_addr; | 637 | lppaca = (struct lppaca *)vcpu->arch.vpa.pinned_addr; |
| 638 | if (lppaca) | 638 | if (lppaca) |
| 639 | yield_count = lppaca->yield_count; | 639 | yield_count = be32_to_cpu(lppaca->yield_count); |
| 640 | spin_unlock(&vcpu->arch.vpa_update_lock); | 640 | spin_unlock(&vcpu->arch.vpa_update_lock); |
| 641 | return yield_count; | 641 | return yield_count; |
| 642 | } | 642 | } |
| @@ -942,20 +942,20 @@ static int kvm_arch_vcpu_ioctl_set_sregs_hv(struct kvm_vcpu *vcpu, | |||
| 942 | static void kvmppc_set_lpcr(struct kvm_vcpu *vcpu, u64 new_lpcr, | 942 | static void kvmppc_set_lpcr(struct kvm_vcpu *vcpu, u64 new_lpcr, |
| 943 | bool preserve_top32) | 943 | bool preserve_top32) |
| 944 | { | 944 | { |
| 945 | struct kvm *kvm = vcpu->kvm; | ||
| 945 | struct kvmppc_vcore *vc = vcpu->arch.vcore; | 946 | struct kvmppc_vcore *vc = vcpu->arch.vcore; |
| 946 | u64 mask; | 947 | u64 mask; |
| 947 | 948 | ||
| 949 | mutex_lock(&kvm->lock); | ||
| 948 | spin_lock(&vc->lock); | 950 | spin_lock(&vc->lock); |
| 949 | /* | 951 | /* |
| 950 | * If ILE (interrupt little-endian) has changed, update the | 952 | * If ILE (interrupt little-endian) has changed, update the |
| 951 | * MSR_LE bit in the intr_msr for each vcpu in this vcore. | 953 | * MSR_LE bit in the intr_msr for each vcpu in this vcore. |
| 952 | */ | 954 | */ |
| 953 | if ((new_lpcr & LPCR_ILE) != (vc->lpcr & LPCR_ILE)) { | 955 | if ((new_lpcr & LPCR_ILE) != (vc->lpcr & LPCR_ILE)) { |
| 954 | struct kvm *kvm = vcpu->kvm; | ||
| 955 | struct kvm_vcpu *vcpu; | 956 | struct kvm_vcpu *vcpu; |
| 956 | int i; | 957 | int i; |
| 957 | 958 | ||
| 958 | mutex_lock(&kvm->lock); | ||
| 959 | kvm_for_each_vcpu(i, vcpu, kvm) { | 959 | kvm_for_each_vcpu(i, vcpu, kvm) { |
| 960 | if (vcpu->arch.vcore != vc) | 960 | if (vcpu->arch.vcore != vc) |
| 961 | continue; | 961 | continue; |
| @@ -964,7 +964,6 @@ static void kvmppc_set_lpcr(struct kvm_vcpu *vcpu, u64 new_lpcr, | |||
| 964 | else | 964 | else |
| 965 | vcpu->arch.intr_msr &= ~MSR_LE; | 965 | vcpu->arch.intr_msr &= ~MSR_LE; |
| 966 | } | 966 | } |
| 967 | mutex_unlock(&kvm->lock); | ||
| 968 | } | 967 | } |
| 969 | 968 | ||
| 970 | /* | 969 | /* |
| @@ -981,6 +980,7 @@ static void kvmppc_set_lpcr(struct kvm_vcpu *vcpu, u64 new_lpcr, | |||
| 981 | mask &= 0xFFFFFFFF; | 980 | mask &= 0xFFFFFFFF; |
| 982 | vc->lpcr = (vc->lpcr & ~mask) | (new_lpcr & mask); | 981 | vc->lpcr = (vc->lpcr & ~mask) | (new_lpcr & mask); |
| 983 | spin_unlock(&vc->lock); | 982 | spin_unlock(&vc->lock); |
| 983 | mutex_unlock(&kvm->lock); | ||
| 984 | } | 984 | } |
| 985 | 985 | ||
| 986 | static int kvmppc_get_one_reg_hv(struct kvm_vcpu *vcpu, u64 id, | 986 | static int kvmppc_get_one_reg_hv(struct kvm_vcpu *vcpu, u64 id, |
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S index bb94e6f20c81..6cbf1630cb70 100644 --- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S +++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S | |||
| @@ -1005,6 +1005,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR) | |||
| 1005 | /* Save HEIR (HV emulation assist reg) in emul_inst | 1005 | /* Save HEIR (HV emulation assist reg) in emul_inst |
| 1006 | if this is an HEI (HV emulation interrupt, e40) */ | 1006 | if this is an HEI (HV emulation interrupt, e40) */ |
| 1007 | li r3,KVM_INST_FETCH_FAILED | 1007 | li r3,KVM_INST_FETCH_FAILED |
| 1008 | stw r3,VCPU_LAST_INST(r9) | ||
| 1008 | cmpwi r12,BOOK3S_INTERRUPT_H_EMUL_ASSIST | 1009 | cmpwi r12,BOOK3S_INTERRUPT_H_EMUL_ASSIST |
| 1009 | bne 11f | 1010 | bne 11f |
| 1010 | mfspr r3,SPRN_HEIR | 1011 | mfspr r3,SPRN_HEIR |
diff --git a/arch/powerpc/platforms/powernv/smp.c b/arch/powerpc/platforms/powernv/smp.c index fc34025ef822..38a45088f633 100644 --- a/arch/powerpc/platforms/powernv/smp.c +++ b/arch/powerpc/platforms/powernv/smp.c | |||
| @@ -33,6 +33,8 @@ | |||
| 33 | #include <asm/runlatch.h> | 33 | #include <asm/runlatch.h> |
| 34 | #include <asm/code-patching.h> | 34 | #include <asm/code-patching.h> |
| 35 | #include <asm/dbell.h> | 35 | #include <asm/dbell.h> |
| 36 | #include <asm/kvm_ppc.h> | ||
| 37 | #include <asm/ppc-opcode.h> | ||
| 36 | 38 | ||
| 37 | #include "powernv.h" | 39 | #include "powernv.h" |
| 38 | 40 | ||
| @@ -149,7 +151,7 @@ static int pnv_smp_cpu_disable(void) | |||
| 149 | static void pnv_smp_cpu_kill_self(void) | 151 | static void pnv_smp_cpu_kill_self(void) |
| 150 | { | 152 | { |
| 151 | unsigned int cpu; | 153 | unsigned int cpu; |
| 152 | unsigned long srr1; | 154 | unsigned long srr1, wmask; |
| 153 | u32 idle_states; | 155 | u32 idle_states; |
| 154 | 156 | ||
| 155 | /* Standard hot unplug procedure */ | 157 | /* Standard hot unplug procedure */ |
| @@ -161,6 +163,10 @@ static void pnv_smp_cpu_kill_self(void) | |||
| 161 | generic_set_cpu_dead(cpu); | 163 | generic_set_cpu_dead(cpu); |
| 162 | smp_wmb(); | 164 | smp_wmb(); |
| 163 | 165 | ||
| 166 | wmask = SRR1_WAKEMASK; | ||
| 167 | if (cpu_has_feature(CPU_FTR_ARCH_207S)) | ||
| 168 | wmask = SRR1_WAKEMASK_P8; | ||
| 169 | |||
| 164 | idle_states = pnv_get_supported_cpuidle_states(); | 170 | idle_states = pnv_get_supported_cpuidle_states(); |
| 165 | /* We don't want to take decrementer interrupts while we are offline, | 171 | /* We don't want to take decrementer interrupts while we are offline, |
| 166 | * so clear LPCR:PECE1. We keep PECE2 enabled. | 172 | * so clear LPCR:PECE1. We keep PECE2 enabled. |
| @@ -191,10 +197,14 @@ static void pnv_smp_cpu_kill_self(void) | |||
| 191 | * having finished executing in a KVM guest, then srr1 | 197 | * having finished executing in a KVM guest, then srr1 |
| 192 | * contains 0. | 198 | * contains 0. |
| 193 | */ | 199 | */ |
| 194 | if ((srr1 & SRR1_WAKEMASK) == SRR1_WAKEEE) { | 200 | if ((srr1 & wmask) == SRR1_WAKEEE) { |
| 195 | icp_native_flush_interrupt(); | 201 | icp_native_flush_interrupt(); |
| 196 | local_paca->irq_happened &= PACA_IRQ_HARD_DIS; | 202 | local_paca->irq_happened &= PACA_IRQ_HARD_DIS; |
| 197 | smp_mb(); | 203 | smp_mb(); |
| 204 | } else if ((srr1 & wmask) == SRR1_WAKEHDBELL) { | ||
| 205 | unsigned long msg = PPC_DBELL_TYPE(PPC_DBELL_SERVER); | ||
| 206 | asm volatile(PPC_MSGCLR(%0) : : "r" (msg)); | ||
| 207 | kvmppc_set_host_ipi(cpu, 0); | ||
| 198 | } | 208 | } |
| 199 | 209 | ||
| 200 | if (cpu_core_split_required()) | 210 | if (cpu_core_split_required()) |
diff --git a/arch/powerpc/platforms/pseries/mobility.c b/arch/powerpc/platforms/pseries/mobility.c index 90cf3dcbd9f2..8f35d525cede 100644 --- a/arch/powerpc/platforms/pseries/mobility.c +++ b/arch/powerpc/platforms/pseries/mobility.c | |||
| @@ -25,10 +25,10 @@ | |||
| 25 | static struct kobject *mobility_kobj; | 25 | static struct kobject *mobility_kobj; |
| 26 | 26 | ||
| 27 | struct update_props_workarea { | 27 | struct update_props_workarea { |
| 28 | u32 phandle; | 28 | __be32 phandle; |
| 29 | u32 state; | 29 | __be32 state; |
| 30 | u64 reserved; | 30 | __be64 reserved; |
| 31 | u32 nprops; | 31 | __be32 nprops; |
| 32 | } __packed; | 32 | } __packed; |
| 33 | 33 | ||
| 34 | #define NODE_ACTION_MASK 0xff000000 | 34 | #define NODE_ACTION_MASK 0xff000000 |
| @@ -54,11 +54,11 @@ static int mobility_rtas_call(int token, char *buf, s32 scope) | |||
| 54 | return rc; | 54 | return rc; |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | static int delete_dt_node(u32 phandle) | 57 | static int delete_dt_node(__be32 phandle) |
| 58 | { | 58 | { |
| 59 | struct device_node *dn; | 59 | struct device_node *dn; |
| 60 | 60 | ||
| 61 | dn = of_find_node_by_phandle(phandle); | 61 | dn = of_find_node_by_phandle(be32_to_cpu(phandle)); |
| 62 | if (!dn) | 62 | if (!dn) |
| 63 | return -ENOENT; | 63 | return -ENOENT; |
| 64 | 64 | ||
| @@ -127,7 +127,7 @@ static int update_dt_property(struct device_node *dn, struct property **prop, | |||
| 127 | return 0; | 127 | return 0; |
| 128 | } | 128 | } |
| 129 | 129 | ||
| 130 | static int update_dt_node(u32 phandle, s32 scope) | 130 | static int update_dt_node(__be32 phandle, s32 scope) |
| 131 | { | 131 | { |
| 132 | struct update_props_workarea *upwa; | 132 | struct update_props_workarea *upwa; |
| 133 | struct device_node *dn; | 133 | struct device_node *dn; |
| @@ -136,6 +136,7 @@ static int update_dt_node(u32 phandle, s32 scope) | |||
| 136 | char *prop_data; | 136 | char *prop_data; |
| 137 | char *rtas_buf; | 137 | char *rtas_buf; |
| 138 | int update_properties_token; | 138 | int update_properties_token; |
| 139 | u32 nprops; | ||
| 139 | u32 vd; | 140 | u32 vd; |
| 140 | 141 | ||
| 141 | update_properties_token = rtas_token("ibm,update-properties"); | 142 | update_properties_token = rtas_token("ibm,update-properties"); |
| @@ -146,7 +147,7 @@ static int update_dt_node(u32 phandle, s32 scope) | |||
| 146 | if (!rtas_buf) | 147 | if (!rtas_buf) |
| 147 | return -ENOMEM; | 148 | return -ENOMEM; |
| 148 | 149 | ||
| 149 | dn = of_find_node_by_phandle(phandle); | 150 | dn = of_find_node_by_phandle(be32_to_cpu(phandle)); |
| 150 | if (!dn) { | 151 | if (!dn) { |
| 151 | kfree(rtas_buf); | 152 | kfree(rtas_buf); |
| 152 | return -ENOENT; | 153 | return -ENOENT; |
| @@ -162,6 +163,7 @@ static int update_dt_node(u32 phandle, s32 scope) | |||
| 162 | break; | 163 | break; |
| 163 | 164 | ||
| 164 | prop_data = rtas_buf + sizeof(*upwa); | 165 | prop_data = rtas_buf + sizeof(*upwa); |
| 166 | nprops = be32_to_cpu(upwa->nprops); | ||
| 165 | 167 | ||
| 166 | /* On the first call to ibm,update-properties for a node the | 168 | /* On the first call to ibm,update-properties for a node the |
| 167 | * the first property value descriptor contains an empty | 169 | * the first property value descriptor contains an empty |
| @@ -170,17 +172,17 @@ static int update_dt_node(u32 phandle, s32 scope) | |||
| 170 | */ | 172 | */ |
| 171 | if (*prop_data == 0) { | 173 | if (*prop_data == 0) { |
| 172 | prop_data++; | 174 | prop_data++; |
| 173 | vd = *(u32 *)prop_data; | 175 | vd = be32_to_cpu(*(__be32 *)prop_data); |
| 174 | prop_data += vd + sizeof(vd); | 176 | prop_data += vd + sizeof(vd); |
| 175 | upwa->nprops--; | 177 | nprops--; |
| 176 | } | 178 | } |
| 177 | 179 | ||
| 178 | for (i = 0; i < upwa->nprops; i++) { | 180 | for (i = 0; i < nprops; i++) { |
| 179 | char *prop_name; | 181 | char *prop_name; |
| 180 | 182 | ||
| 181 | prop_name = prop_data; | 183 | prop_name = prop_data; |
| 182 | prop_data += strlen(prop_name) + 1; | 184 | prop_data += strlen(prop_name) + 1; |
| 183 | vd = *(u32 *)prop_data; | 185 | vd = be32_to_cpu(*(__be32 *)prop_data); |
| 184 | prop_data += sizeof(vd); | 186 | prop_data += sizeof(vd); |
| 185 | 187 | ||
| 186 | switch (vd) { | 188 | switch (vd) { |
| @@ -212,13 +214,13 @@ static int update_dt_node(u32 phandle, s32 scope) | |||
| 212 | return 0; | 214 | return 0; |
| 213 | } | 215 | } |
| 214 | 216 | ||
| 215 | static int add_dt_node(u32 parent_phandle, u32 drc_index) | 217 | static int add_dt_node(__be32 parent_phandle, __be32 drc_index) |
| 216 | { | 218 | { |
| 217 | struct device_node *dn; | 219 | struct device_node *dn; |
| 218 | struct device_node *parent_dn; | 220 | struct device_node *parent_dn; |
| 219 | int rc; | 221 | int rc; |
| 220 | 222 | ||
| 221 | parent_dn = of_find_node_by_phandle(parent_phandle); | 223 | parent_dn = of_find_node_by_phandle(be32_to_cpu(parent_phandle)); |
| 222 | if (!parent_dn) | 224 | if (!parent_dn) |
| 223 | return -ENOENT; | 225 | return -ENOENT; |
| 224 | 226 | ||
| @@ -237,7 +239,7 @@ static int add_dt_node(u32 parent_phandle, u32 drc_index) | |||
| 237 | int pseries_devicetree_update(s32 scope) | 239 | int pseries_devicetree_update(s32 scope) |
| 238 | { | 240 | { |
| 239 | char *rtas_buf; | 241 | char *rtas_buf; |
| 240 | u32 *data; | 242 | __be32 *data; |
| 241 | int update_nodes_token; | 243 | int update_nodes_token; |
| 242 | int rc; | 244 | int rc; |
| 243 | 245 | ||
| @@ -254,17 +256,17 @@ int pseries_devicetree_update(s32 scope) | |||
| 254 | if (rc && rc != 1) | 256 | if (rc && rc != 1) |
| 255 | break; | 257 | break; |
| 256 | 258 | ||
| 257 | data = (u32 *)rtas_buf + 4; | 259 | data = (__be32 *)rtas_buf + 4; |
| 258 | while (*data & NODE_ACTION_MASK) { | 260 | while (be32_to_cpu(*data) & NODE_ACTION_MASK) { |
| 259 | int i; | 261 | int i; |
| 260 | u32 action = *data & NODE_ACTION_MASK; | 262 | u32 action = be32_to_cpu(*data) & NODE_ACTION_MASK; |
| 261 | int node_count = *data & NODE_COUNT_MASK; | 263 | u32 node_count = be32_to_cpu(*data) & NODE_COUNT_MASK; |
| 262 | 264 | ||
| 263 | data++; | 265 | data++; |
| 264 | 266 | ||
| 265 | for (i = 0; i < node_count; i++) { | 267 | for (i = 0; i < node_count; i++) { |
| 266 | u32 phandle = *data++; | 268 | __be32 phandle = *data++; |
| 267 | u32 drc_index; | 269 | __be32 drc_index; |
| 268 | 270 | ||
| 269 | switch (action) { | 271 | switch (action) { |
| 270 | case DELETE_DT_NODE: | 272 | case DELETE_DT_NODE: |
diff --git a/arch/s390/include/asm/elf.h b/arch/s390/include/asm/elf.h index c9df40b5c0ac..c9c875d9ed31 100644 --- a/arch/s390/include/asm/elf.h +++ b/arch/s390/include/asm/elf.h | |||
| @@ -211,7 +211,7 @@ do { \ | |||
| 211 | 211 | ||
| 212 | extern unsigned long mmap_rnd_mask; | 212 | extern unsigned long mmap_rnd_mask; |
| 213 | 213 | ||
| 214 | #define STACK_RND_MASK (mmap_rnd_mask) | 214 | #define STACK_RND_MASK (test_thread_flag(TIF_31BIT) ? 0x7ff : mmap_rnd_mask) |
| 215 | 215 | ||
| 216 | #define ARCH_DLINFO \ | 216 | #define ARCH_DLINFO \ |
| 217 | do { \ | 217 | do { \ |
diff --git a/arch/s390/kernel/ftrace.c b/arch/s390/kernel/ftrace.c index 82c19899574f..6c79f1b44fe7 100644 --- a/arch/s390/kernel/ftrace.c +++ b/arch/s390/kernel/ftrace.c | |||
| @@ -57,6 +57,44 @@ | |||
| 57 | 57 | ||
| 58 | unsigned long ftrace_plt; | 58 | unsigned long ftrace_plt; |
| 59 | 59 | ||
| 60 | static inline void ftrace_generate_orig_insn(struct ftrace_insn *insn) | ||
| 61 | { | ||
| 62 | #ifdef CC_USING_HOTPATCH | ||
| 63 | /* brcl 0,0 */ | ||
| 64 | insn->opc = 0xc004; | ||
| 65 | insn->disp = 0; | ||
| 66 | #else | ||
| 67 | /* stg r14,8(r15) */ | ||
| 68 | insn->opc = 0xe3e0; | ||
| 69 | insn->disp = 0xf0080024; | ||
| 70 | #endif | ||
| 71 | } | ||
| 72 | |||
| 73 | static inline int is_kprobe_on_ftrace(struct ftrace_insn *insn) | ||
| 74 | { | ||
| 75 | #ifdef CONFIG_KPROBES | ||
| 76 | if (insn->opc == BREAKPOINT_INSTRUCTION) | ||
| 77 | return 1; | ||
| 78 | #endif | ||
| 79 | return 0; | ||
| 80 | } | ||
| 81 | |||
| 82 | static inline void ftrace_generate_kprobe_nop_insn(struct ftrace_insn *insn) | ||
| 83 | { | ||
| 84 | #ifdef CONFIG_KPROBES | ||
| 85 | insn->opc = BREAKPOINT_INSTRUCTION; | ||
| 86 | insn->disp = KPROBE_ON_FTRACE_NOP; | ||
| 87 | #endif | ||
| 88 | } | ||
| 89 | |||
| 90 | static inline void ftrace_generate_kprobe_call_insn(struct ftrace_insn *insn) | ||
| 91 | { | ||
| 92 | #ifdef CONFIG_KPROBES | ||
| 93 | insn->opc = BREAKPOINT_INSTRUCTION; | ||
| 94 | insn->disp = KPROBE_ON_FTRACE_CALL; | ||
| 95 | #endif | ||
| 96 | } | ||
| 97 | |||
| 60 | int ftrace_modify_call(struct dyn_ftrace *rec, unsigned long old_addr, | 98 | int ftrace_modify_call(struct dyn_ftrace *rec, unsigned long old_addr, |
| 61 | unsigned long addr) | 99 | unsigned long addr) |
| 62 | { | 100 | { |
| @@ -72,16 +110,9 @@ int ftrace_make_nop(struct module *mod, struct dyn_ftrace *rec, | |||
| 72 | return -EFAULT; | 110 | return -EFAULT; |
| 73 | if (addr == MCOUNT_ADDR) { | 111 | if (addr == MCOUNT_ADDR) { |
| 74 | /* Initial code replacement */ | 112 | /* Initial code replacement */ |
| 75 | #ifdef CC_USING_HOTPATCH | 113 | ftrace_generate_orig_insn(&orig); |
| 76 | /* We expect to see brcl 0,0 */ | ||
| 77 | ftrace_generate_nop_insn(&orig); | ||
| 78 | #else | ||
| 79 | /* We expect to see stg r14,8(r15) */ | ||
| 80 | orig.opc = 0xe3e0; | ||
| 81 | orig.disp = 0xf0080024; | ||
| 82 | #endif | ||
| 83 | ftrace_generate_nop_insn(&new); | 114 | ftrace_generate_nop_insn(&new); |
| 84 | } else if (old.opc == BREAKPOINT_INSTRUCTION) { | 115 | } else if (is_kprobe_on_ftrace(&old)) { |
| 85 | /* | 116 | /* |
| 86 | * If we find a breakpoint instruction, a kprobe has been | 117 | * If we find a breakpoint instruction, a kprobe has been |
| 87 | * placed at the beginning of the function. We write the | 118 | * placed at the beginning of the function. We write the |
| @@ -89,9 +120,8 @@ int ftrace_make_nop(struct module *mod, struct dyn_ftrace *rec, | |||
| 89 | * bytes of the original instruction so that the kprobes | 120 | * bytes of the original instruction so that the kprobes |
| 90 | * handler can execute a nop, if it reaches this breakpoint. | 121 | * handler can execute a nop, if it reaches this breakpoint. |
| 91 | */ | 122 | */ |
| 92 | new.opc = orig.opc = BREAKPOINT_INSTRUCTION; | 123 | ftrace_generate_kprobe_call_insn(&orig); |
| 93 | orig.disp = KPROBE_ON_FTRACE_CALL; | 124 | ftrace_generate_kprobe_nop_insn(&new); |
| 94 | new.disp = KPROBE_ON_FTRACE_NOP; | ||
| 95 | } else { | 125 | } else { |
| 96 | /* Replace ftrace call with a nop. */ | 126 | /* Replace ftrace call with a nop. */ |
| 97 | ftrace_generate_call_insn(&orig, rec->ip); | 127 | ftrace_generate_call_insn(&orig, rec->ip); |
| @@ -111,7 +141,7 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) | |||
| 111 | 141 | ||
| 112 | if (probe_kernel_read(&old, (void *) rec->ip, sizeof(old))) | 142 | if (probe_kernel_read(&old, (void *) rec->ip, sizeof(old))) |
| 113 | return -EFAULT; | 143 | return -EFAULT; |
| 114 | if (old.opc == BREAKPOINT_INSTRUCTION) { | 144 | if (is_kprobe_on_ftrace(&old)) { |
| 115 | /* | 145 | /* |
| 116 | * If we find a breakpoint instruction, a kprobe has been | 146 | * If we find a breakpoint instruction, a kprobe has been |
| 117 | * placed at the beginning of the function. We write the | 147 | * placed at the beginning of the function. We write the |
| @@ -119,9 +149,8 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) | |||
| 119 | * bytes of the original instruction so that the kprobes | 149 | * bytes of the original instruction so that the kprobes |
| 120 | * handler can execute a brasl if it reaches this breakpoint. | 150 | * handler can execute a brasl if it reaches this breakpoint. |
| 121 | */ | 151 | */ |
| 122 | new.opc = orig.opc = BREAKPOINT_INSTRUCTION; | 152 | ftrace_generate_kprobe_nop_insn(&orig); |
| 123 | orig.disp = KPROBE_ON_FTRACE_NOP; | 153 | ftrace_generate_kprobe_call_insn(&new); |
| 124 | new.disp = KPROBE_ON_FTRACE_CALL; | ||
| 125 | } else { | 154 | } else { |
| 126 | /* Replace nop with an ftrace call. */ | 155 | /* Replace nop with an ftrace call. */ |
| 127 | ftrace_generate_nop_insn(&orig); | 156 | ftrace_generate_nop_insn(&orig); |
diff --git a/arch/s390/kernel/perf_cpum_sf.c b/arch/s390/kernel/perf_cpum_sf.c index c3f8d157cb0d..e6a1578fc000 100644 --- a/arch/s390/kernel/perf_cpum_sf.c +++ b/arch/s390/kernel/perf_cpum_sf.c | |||
| @@ -1415,7 +1415,7 @@ CPUMF_EVENT_ATTR(SF, SF_CYCLES_BASIC_DIAG, PERF_EVENT_CPUM_SF_DIAG); | |||
| 1415 | 1415 | ||
| 1416 | static struct attribute *cpumsf_pmu_events_attr[] = { | 1416 | static struct attribute *cpumsf_pmu_events_attr[] = { |
| 1417 | CPUMF_EVENT_PTR(SF, SF_CYCLES_BASIC), | 1417 | CPUMF_EVENT_PTR(SF, SF_CYCLES_BASIC), |
| 1418 | CPUMF_EVENT_PTR(SF, SF_CYCLES_BASIC_DIAG), | 1418 | NULL, |
| 1419 | NULL, | 1419 | NULL, |
| 1420 | }; | 1420 | }; |
| 1421 | 1421 | ||
| @@ -1606,8 +1606,11 @@ static int __init init_cpum_sampling_pmu(void) | |||
| 1606 | return -EINVAL; | 1606 | return -EINVAL; |
| 1607 | } | 1607 | } |
| 1608 | 1608 | ||
| 1609 | if (si.ad) | 1609 | if (si.ad) { |
| 1610 | sfb_set_limits(CPUM_SF_MIN_SDB, CPUM_SF_MAX_SDB); | 1610 | sfb_set_limits(CPUM_SF_MIN_SDB, CPUM_SF_MAX_SDB); |
| 1611 | cpumsf_pmu_events_attr[1] = | ||
| 1612 | CPUMF_EVENT_PTR(SF, SF_CYCLES_BASIC_DIAG); | ||
| 1613 | } | ||
| 1611 | 1614 | ||
| 1612 | sfdbg = debug_register(KMSG_COMPONENT, 2, 1, 80); | 1615 | sfdbg = debug_register(KMSG_COMPONENT, 2, 1, 80); |
| 1613 | if (!sfdbg) | 1616 | if (!sfdbg) |
diff --git a/arch/s390/kernel/swsusp_asm64.S b/arch/s390/kernel/swsusp_asm64.S index 6b09fdffbd2f..ca6294645dd3 100644 --- a/arch/s390/kernel/swsusp_asm64.S +++ b/arch/s390/kernel/swsusp_asm64.S | |||
| @@ -177,6 +177,17 @@ restart_entry: | |||
| 177 | lhi %r1,1 | 177 | lhi %r1,1 |
| 178 | sigp %r1,%r0,SIGP_SET_ARCHITECTURE | 178 | sigp %r1,%r0,SIGP_SET_ARCHITECTURE |
| 179 | sam64 | 179 | sam64 |
| 180 | #ifdef CONFIG_SMP | ||
| 181 | larl %r1,smp_cpu_mt_shift | ||
| 182 | icm %r1,15,0(%r1) | ||
| 183 | jz smt_done | ||
| 184 | llgfr %r1,%r1 | ||
| 185 | smt_loop: | ||
| 186 | sigp %r1,%r0,SIGP_SET_MULTI_THREADING | ||
| 187 | brc 8,smt_done /* accepted */ | ||
| 188 | brc 2,smt_loop /* busy, try again */ | ||
| 189 | smt_done: | ||
| 190 | #endif | ||
| 180 | larl %r1,.Lnew_pgm_check_psw | 191 | larl %r1,.Lnew_pgm_check_psw |
| 181 | lpswe 0(%r1) | 192 | lpswe 0(%r1) |
| 182 | pgm_check_entry: | 193 | pgm_check_entry: |
diff --git a/arch/sparc/include/asm/hypervisor.h b/arch/sparc/include/asm/hypervisor.h index 4f6725ff4c33..f5b6537306f0 100644 --- a/arch/sparc/include/asm/hypervisor.h +++ b/arch/sparc/include/asm/hypervisor.h | |||
| @@ -2957,6 +2957,17 @@ unsigned long sun4v_t5_set_perfreg(unsigned long reg_num, | |||
| 2957 | unsigned long reg_val); | 2957 | unsigned long reg_val); |
| 2958 | #endif | 2958 | #endif |
| 2959 | 2959 | ||
| 2960 | |||
| 2961 | #define HV_FAST_M7_GET_PERFREG 0x43 | ||
| 2962 | #define HV_FAST_M7_SET_PERFREG 0x44 | ||
| 2963 | |||
| 2964 | #ifndef __ASSEMBLY__ | ||
| 2965 | unsigned long sun4v_m7_get_perfreg(unsigned long reg_num, | ||
| 2966 | unsigned long *reg_val); | ||
| 2967 | unsigned long sun4v_m7_set_perfreg(unsigned long reg_num, | ||
| 2968 | unsigned long reg_val); | ||
| 2969 | #endif | ||
| 2970 | |||
| 2960 | /* Function numbers for HV_CORE_TRAP. */ | 2971 | /* Function numbers for HV_CORE_TRAP. */ |
| 2961 | #define HV_CORE_SET_VER 0x00 | 2972 | #define HV_CORE_SET_VER 0x00 |
| 2962 | #define HV_CORE_PUTCHAR 0x01 | 2973 | #define HV_CORE_PUTCHAR 0x01 |
| @@ -2981,6 +2992,7 @@ unsigned long sun4v_t5_set_perfreg(unsigned long reg_num, | |||
| 2981 | #define HV_GRP_SDIO 0x0108 | 2992 | #define HV_GRP_SDIO 0x0108 |
| 2982 | #define HV_GRP_SDIO_ERR 0x0109 | 2993 | #define HV_GRP_SDIO_ERR 0x0109 |
| 2983 | #define HV_GRP_REBOOT_DATA 0x0110 | 2994 | #define HV_GRP_REBOOT_DATA 0x0110 |
| 2995 | #define HV_GRP_M7_PERF 0x0114 | ||
| 2984 | #define HV_GRP_NIAG_PERF 0x0200 | 2996 | #define HV_GRP_NIAG_PERF 0x0200 |
| 2985 | #define HV_GRP_FIRE_PERF 0x0201 | 2997 | #define HV_GRP_FIRE_PERF 0x0201 |
| 2986 | #define HV_GRP_N2_CPU 0x0202 | 2998 | #define HV_GRP_N2_CPU 0x0202 |
diff --git a/arch/sparc/kernel/hvapi.c b/arch/sparc/kernel/hvapi.c index 5c55145bfbf0..662500fa555f 100644 --- a/arch/sparc/kernel/hvapi.c +++ b/arch/sparc/kernel/hvapi.c | |||
| @@ -48,6 +48,7 @@ static struct api_info api_table[] = { | |||
| 48 | { .group = HV_GRP_VT_CPU, }, | 48 | { .group = HV_GRP_VT_CPU, }, |
| 49 | { .group = HV_GRP_T5_CPU, }, | 49 | { .group = HV_GRP_T5_CPU, }, |
| 50 | { .group = HV_GRP_DIAG, .flags = FLAG_PRE_API }, | 50 | { .group = HV_GRP_DIAG, .flags = FLAG_PRE_API }, |
| 51 | { .group = HV_GRP_M7_PERF, }, | ||
| 51 | }; | 52 | }; |
| 52 | 53 | ||
| 53 | static DEFINE_SPINLOCK(hvapi_lock); | 54 | static DEFINE_SPINLOCK(hvapi_lock); |
diff --git a/arch/sparc/kernel/hvcalls.S b/arch/sparc/kernel/hvcalls.S index caedf8320416..afbaba52d2f1 100644 --- a/arch/sparc/kernel/hvcalls.S +++ b/arch/sparc/kernel/hvcalls.S | |||
| @@ -837,3 +837,19 @@ ENTRY(sun4v_t5_set_perfreg) | |||
| 837 | retl | 837 | retl |
| 838 | nop | 838 | nop |
| 839 | ENDPROC(sun4v_t5_set_perfreg) | 839 | ENDPROC(sun4v_t5_set_perfreg) |
| 840 | |||
| 841 | ENTRY(sun4v_m7_get_perfreg) | ||
| 842 | mov %o1, %o4 | ||
| 843 | mov HV_FAST_M7_GET_PERFREG, %o5 | ||
| 844 | ta HV_FAST_TRAP | ||
| 845 | stx %o1, [%o4] | ||
| 846 | retl | ||
| 847 | nop | ||
| 848 | ENDPROC(sun4v_m7_get_perfreg) | ||
| 849 | |||
| 850 | ENTRY(sun4v_m7_set_perfreg) | ||
| 851 | mov HV_FAST_M7_SET_PERFREG, %o5 | ||
| 852 | ta HV_FAST_TRAP | ||
| 853 | retl | ||
| 854 | nop | ||
| 855 | ENDPROC(sun4v_m7_set_perfreg) | ||
diff --git a/arch/sparc/kernel/pcr.c b/arch/sparc/kernel/pcr.c index 7e967c8018c8..eb978c77c76a 100644 --- a/arch/sparc/kernel/pcr.c +++ b/arch/sparc/kernel/pcr.c | |||
| @@ -217,6 +217,31 @@ static const struct pcr_ops n5_pcr_ops = { | |||
| 217 | .pcr_nmi_disable = PCR_N4_PICNPT, | 217 | .pcr_nmi_disable = PCR_N4_PICNPT, |
| 218 | }; | 218 | }; |
| 219 | 219 | ||
| 220 | static u64 m7_pcr_read(unsigned long reg_num) | ||
| 221 | { | ||
| 222 | unsigned long val; | ||
| 223 | |||
| 224 | (void) sun4v_m7_get_perfreg(reg_num, &val); | ||
| 225 | |||
| 226 | return val; | ||
| 227 | } | ||
| 228 | |||
| 229 | static void m7_pcr_write(unsigned long reg_num, u64 val) | ||
| 230 | { | ||
| 231 | (void) sun4v_m7_set_perfreg(reg_num, val); | ||
| 232 | } | ||
| 233 | |||
| 234 | static const struct pcr_ops m7_pcr_ops = { | ||
| 235 | .read_pcr = m7_pcr_read, | ||
| 236 | .write_pcr = m7_pcr_write, | ||
| 237 | .read_pic = n4_pic_read, | ||
| 238 | .write_pic = n4_pic_write, | ||
| 239 | .nmi_picl_value = n4_picl_value, | ||
| 240 | .pcr_nmi_enable = (PCR_N4_PICNPT | PCR_N4_STRACE | | ||
| 241 | PCR_N4_UTRACE | PCR_N4_TOE | | ||
| 242 | (26 << PCR_N4_SL_SHIFT)), | ||
| 243 | .pcr_nmi_disable = PCR_N4_PICNPT, | ||
| 244 | }; | ||
| 220 | 245 | ||
| 221 | static unsigned long perf_hsvc_group; | 246 | static unsigned long perf_hsvc_group; |
| 222 | static unsigned long perf_hsvc_major; | 247 | static unsigned long perf_hsvc_major; |
| @@ -248,6 +273,10 @@ static int __init register_perf_hsvc(void) | |||
| 248 | perf_hsvc_group = HV_GRP_T5_CPU; | 273 | perf_hsvc_group = HV_GRP_T5_CPU; |
| 249 | break; | 274 | break; |
| 250 | 275 | ||
| 276 | case SUN4V_CHIP_SPARC_M7: | ||
| 277 | perf_hsvc_group = HV_GRP_M7_PERF; | ||
| 278 | break; | ||
| 279 | |||
| 251 | default: | 280 | default: |
| 252 | return -ENODEV; | 281 | return -ENODEV; |
| 253 | } | 282 | } |
| @@ -293,6 +322,10 @@ static int __init setup_sun4v_pcr_ops(void) | |||
| 293 | pcr_ops = &n5_pcr_ops; | 322 | pcr_ops = &n5_pcr_ops; |
| 294 | break; | 323 | break; |
| 295 | 324 | ||
| 325 | case SUN4V_CHIP_SPARC_M7: | ||
| 326 | pcr_ops = &m7_pcr_ops; | ||
| 327 | break; | ||
| 328 | |||
| 296 | default: | 329 | default: |
| 297 | ret = -ENODEV; | 330 | ret = -ENODEV; |
| 298 | break; | 331 | break; |
diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c index 46a5e4508752..86eebfa3b158 100644 --- a/arch/sparc/kernel/perf_event.c +++ b/arch/sparc/kernel/perf_event.c | |||
| @@ -792,6 +792,42 @@ static const struct sparc_pmu niagara4_pmu = { | |||
| 792 | .num_pic_regs = 4, | 792 | .num_pic_regs = 4, |
| 793 | }; | 793 | }; |
| 794 | 794 | ||
| 795 | static void sparc_m7_write_pmc(int idx, u64 val) | ||
| 796 | { | ||
| 797 | u64 pcr; | ||
| 798 | |||
| 799 | pcr = pcr_ops->read_pcr(idx); | ||
| 800 | /* ensure ov and ntc are reset */ | ||
| 801 | pcr &= ~(PCR_N4_OV | PCR_N4_NTC); | ||
| 802 | |||
| 803 | pcr_ops->write_pic(idx, val & 0xffffffff); | ||
| 804 | |||
| 805 | pcr_ops->write_pcr(idx, pcr); | ||
| 806 | } | ||
| 807 | |||
| 808 | static const struct sparc_pmu sparc_m7_pmu = { | ||
| 809 | .event_map = niagara4_event_map, | ||
| 810 | .cache_map = &niagara4_cache_map, | ||
| 811 | .max_events = ARRAY_SIZE(niagara4_perfmon_event_map), | ||
| 812 | .read_pmc = sparc_vt_read_pmc, | ||
| 813 | .write_pmc = sparc_m7_write_pmc, | ||
| 814 | .upper_shift = 5, | ||
| 815 | .lower_shift = 5, | ||
| 816 | .event_mask = 0x7ff, | ||
| 817 | .user_bit = PCR_N4_UTRACE, | ||
| 818 | .priv_bit = PCR_N4_STRACE, | ||
| 819 | |||
| 820 | /* We explicitly don't support hypervisor tracing. */ | ||
| 821 | .hv_bit = 0, | ||
| 822 | |||
| 823 | .irq_bit = PCR_N4_TOE, | ||
| 824 | .upper_nop = 0, | ||
| 825 | .lower_nop = 0, | ||
| 826 | .flags = 0, | ||
| 827 | .max_hw_events = 4, | ||
| 828 | .num_pcrs = 4, | ||
| 829 | .num_pic_regs = 4, | ||
| 830 | }; | ||
| 795 | static const struct sparc_pmu *sparc_pmu __read_mostly; | 831 | static const struct sparc_pmu *sparc_pmu __read_mostly; |
| 796 | 832 | ||
| 797 | static u64 event_encoding(u64 event_id, int idx) | 833 | static u64 event_encoding(u64 event_id, int idx) |
| @@ -960,6 +996,8 @@ out: | |||
| 960 | cpuc->pcr[0] |= cpuc->event[0]->hw.config_base; | 996 | cpuc->pcr[0] |= cpuc->event[0]->hw.config_base; |
| 961 | } | 997 | } |
| 962 | 998 | ||
| 999 | static void sparc_pmu_start(struct perf_event *event, int flags); | ||
| 1000 | |||
| 963 | /* On this PMU each PIC has it's own PCR control register. */ | 1001 | /* On this PMU each PIC has it's own PCR control register. */ |
| 964 | static void calculate_multiple_pcrs(struct cpu_hw_events *cpuc) | 1002 | static void calculate_multiple_pcrs(struct cpu_hw_events *cpuc) |
| 965 | { | 1003 | { |
| @@ -972,20 +1010,13 @@ static void calculate_multiple_pcrs(struct cpu_hw_events *cpuc) | |||
| 972 | struct perf_event *cp = cpuc->event[i]; | 1010 | struct perf_event *cp = cpuc->event[i]; |
| 973 | struct hw_perf_event *hwc = &cp->hw; | 1011 | struct hw_perf_event *hwc = &cp->hw; |
| 974 | int idx = hwc->idx; | 1012 | int idx = hwc->idx; |
| 975 | u64 enc; | ||
| 976 | 1013 | ||
| 977 | if (cpuc->current_idx[i] != PIC_NO_INDEX) | 1014 | if (cpuc->current_idx[i] != PIC_NO_INDEX) |
| 978 | continue; | 1015 | continue; |
| 979 | 1016 | ||
| 980 | sparc_perf_event_set_period(cp, hwc, idx); | ||
| 981 | cpuc->current_idx[i] = idx; | 1017 | cpuc->current_idx[i] = idx; |
| 982 | 1018 | ||
| 983 | enc = perf_event_get_enc(cpuc->events[i]); | 1019 | sparc_pmu_start(cp, PERF_EF_RELOAD); |
| 984 | cpuc->pcr[idx] &= ~mask_for_index(idx); | ||
| 985 | if (hwc->state & PERF_HES_STOPPED) | ||
| 986 | cpuc->pcr[idx] |= nop_for_index(idx); | ||
| 987 | else | ||
| 988 | cpuc->pcr[idx] |= event_encoding(enc, idx); | ||
| 989 | } | 1020 | } |
| 990 | out: | 1021 | out: |
| 991 | for (i = 0; i < cpuc->n_events; i++) { | 1022 | for (i = 0; i < cpuc->n_events; i++) { |
| @@ -1101,7 +1132,6 @@ static void sparc_pmu_del(struct perf_event *event, int _flags) | |||
| 1101 | int i; | 1132 | int i; |
| 1102 | 1133 | ||
| 1103 | local_irq_save(flags); | 1134 | local_irq_save(flags); |
| 1104 | perf_pmu_disable(event->pmu); | ||
| 1105 | 1135 | ||
| 1106 | for (i = 0; i < cpuc->n_events; i++) { | 1136 | for (i = 0; i < cpuc->n_events; i++) { |
| 1107 | if (event == cpuc->event[i]) { | 1137 | if (event == cpuc->event[i]) { |
| @@ -1127,7 +1157,6 @@ static void sparc_pmu_del(struct perf_event *event, int _flags) | |||
| 1127 | } | 1157 | } |
| 1128 | } | 1158 | } |
| 1129 | 1159 | ||
| 1130 | perf_pmu_enable(event->pmu); | ||
| 1131 | local_irq_restore(flags); | 1160 | local_irq_restore(flags); |
| 1132 | } | 1161 | } |
| 1133 | 1162 | ||
| @@ -1361,7 +1390,6 @@ static int sparc_pmu_add(struct perf_event *event, int ef_flags) | |||
| 1361 | unsigned long flags; | 1390 | unsigned long flags; |
| 1362 | 1391 | ||
| 1363 | local_irq_save(flags); | 1392 | local_irq_save(flags); |
| 1364 | perf_pmu_disable(event->pmu); | ||
| 1365 | 1393 | ||
| 1366 | n0 = cpuc->n_events; | 1394 | n0 = cpuc->n_events; |
| 1367 | if (n0 >= sparc_pmu->max_hw_events) | 1395 | if (n0 >= sparc_pmu->max_hw_events) |
| @@ -1394,7 +1422,6 @@ nocheck: | |||
| 1394 | 1422 | ||
| 1395 | ret = 0; | 1423 | ret = 0; |
| 1396 | out: | 1424 | out: |
| 1397 | perf_pmu_enable(event->pmu); | ||
| 1398 | local_irq_restore(flags); | 1425 | local_irq_restore(flags); |
| 1399 | return ret; | 1426 | return ret; |
| 1400 | } | 1427 | } |
| @@ -1667,6 +1694,10 @@ static bool __init supported_pmu(void) | |||
| 1667 | sparc_pmu = &niagara4_pmu; | 1694 | sparc_pmu = &niagara4_pmu; |
| 1668 | return true; | 1695 | return true; |
| 1669 | } | 1696 | } |
| 1697 | if (!strcmp(sparc_pmu_type, "sparc-m7")) { | ||
| 1698 | sparc_pmu = &sparc_m7_pmu; | ||
| 1699 | return true; | ||
| 1700 | } | ||
| 1670 | return false; | 1701 | return false; |
| 1671 | } | 1702 | } |
| 1672 | 1703 | ||
diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c index 0be7bf978cb1..46a59643bb1c 100644 --- a/arch/sparc/kernel/process_64.c +++ b/arch/sparc/kernel/process_64.c | |||
| @@ -287,6 +287,8 @@ void arch_trigger_all_cpu_backtrace(bool include_self) | |||
| 287 | printk(" TPC[%lx] O7[%lx] I7[%lx] RPC[%lx]\n", | 287 | printk(" TPC[%lx] O7[%lx] I7[%lx] RPC[%lx]\n", |
| 288 | gp->tpc, gp->o7, gp->i7, gp->rpc); | 288 | gp->tpc, gp->o7, gp->i7, gp->rpc); |
| 289 | } | 289 | } |
| 290 | |||
| 291 | touch_nmi_watchdog(); | ||
| 290 | } | 292 | } |
| 291 | 293 | ||
| 292 | memset(global_cpu_snapshot, 0, sizeof(global_cpu_snapshot)); | 294 | memset(global_cpu_snapshot, 0, sizeof(global_cpu_snapshot)); |
| @@ -362,6 +364,8 @@ static void pmu_snapshot_all_cpus(void) | |||
| 362 | (cpu == this_cpu ? '*' : ' '), cpu, | 364 | (cpu == this_cpu ? '*' : ' '), cpu, |
| 363 | pp->pcr[0], pp->pcr[1], pp->pcr[2], pp->pcr[3], | 365 | pp->pcr[0], pp->pcr[1], pp->pcr[2], pp->pcr[3], |
| 364 | pp->pic[0], pp->pic[1], pp->pic[2], pp->pic[3]); | 366 | pp->pic[0], pp->pic[1], pp->pic[2], pp->pic[3]); |
| 367 | |||
| 368 | touch_nmi_watchdog(); | ||
| 365 | } | 369 | } |
| 366 | 370 | ||
| 367 | memset(global_cpu_snapshot, 0, sizeof(global_cpu_snapshot)); | 371 | memset(global_cpu_snapshot, 0, sizeof(global_cpu_snapshot)); |
diff --git a/arch/sparc/lib/memmove.S b/arch/sparc/lib/memmove.S index b7f6334e159f..857ad4f8905f 100644 --- a/arch/sparc/lib/memmove.S +++ b/arch/sparc/lib/memmove.S | |||
| @@ -8,9 +8,11 @@ | |||
| 8 | 8 | ||
| 9 | .text | 9 | .text |
| 10 | ENTRY(memmove) /* o0=dst o1=src o2=len */ | 10 | ENTRY(memmove) /* o0=dst o1=src o2=len */ |
| 11 | mov %o0, %g1 | 11 | brz,pn %o2, 99f |
| 12 | mov %o0, %g1 | ||
| 13 | |||
| 12 | cmp %o0, %o1 | 14 | cmp %o0, %o1 |
| 13 | bleu,pt %xcc, memcpy | 15 | bleu,pt %xcc, 2f |
| 14 | add %o1, %o2, %g7 | 16 | add %o1, %o2, %g7 |
| 15 | cmp %g7, %o0 | 17 | cmp %g7, %o0 |
| 16 | bleu,pt %xcc, memcpy | 18 | bleu,pt %xcc, memcpy |
| @@ -24,7 +26,34 @@ ENTRY(memmove) /* o0=dst o1=src o2=len */ | |||
| 24 | stb %g7, [%o0] | 26 | stb %g7, [%o0] |
| 25 | bne,pt %icc, 1b | 27 | bne,pt %icc, 1b |
| 26 | sub %o0, 1, %o0 | 28 | sub %o0, 1, %o0 |
| 27 | 29 | 99: | |
| 28 | retl | 30 | retl |
| 29 | mov %g1, %o0 | 31 | mov %g1, %o0 |
| 32 | |||
| 33 | /* We can't just call memcpy for these memmove cases. On some | ||
| 34 | * chips the memcpy uses cache initializing stores and when dst | ||
| 35 | * and src are close enough, those can clobber the source data | ||
| 36 | * before we've loaded it in. | ||
| 37 | */ | ||
| 38 | 2: or %o0, %o1, %g7 | ||
| 39 | or %o2, %g7, %g7 | ||
| 40 | andcc %g7, 0x7, %g0 | ||
| 41 | bne,pn %xcc, 4f | ||
| 42 | nop | ||
| 43 | |||
| 44 | 3: ldx [%o1], %g7 | ||
| 45 | add %o1, 8, %o1 | ||
| 46 | subcc %o2, 8, %o2 | ||
| 47 | add %o0, 8, %o0 | ||
| 48 | bne,pt %icc, 3b | ||
| 49 | stx %g7, [%o0 - 0x8] | ||
| 50 | ba,a,pt %xcc, 99b | ||
| 51 | |||
| 52 | 4: ldub [%o1], %g7 | ||
| 53 | add %o1, 1, %o1 | ||
| 54 | subcc %o2, 1, %o2 | ||
| 55 | add %o0, 1, %o0 | ||
| 56 | bne,pt %icc, 4b | ||
| 57 | stb %g7, [%o0 - 0x1] | ||
| 58 | ba,a,pt %xcc, 99b | ||
| 30 | ENDPROC(memmove) | 59 | ENDPROC(memmove) |
diff --git a/arch/x86/kvm/ioapic.c b/arch/x86/kvm/ioapic.c index b1947e0f3e10..46d4449772bc 100644 --- a/arch/x86/kvm/ioapic.c +++ b/arch/x86/kvm/ioapic.c | |||
| @@ -422,6 +422,7 @@ static void __kvm_ioapic_update_eoi(struct kvm_vcpu *vcpu, | |||
| 422 | struct kvm_ioapic *ioapic, int vector, int trigger_mode) | 422 | struct kvm_ioapic *ioapic, int vector, int trigger_mode) |
| 423 | { | 423 | { |
| 424 | int i; | 424 | int i; |
| 425 | struct kvm_lapic *apic = vcpu->arch.apic; | ||
| 425 | 426 | ||
| 426 | for (i = 0; i < IOAPIC_NUM_PINS; i++) { | 427 | for (i = 0; i < IOAPIC_NUM_PINS; i++) { |
| 427 | union kvm_ioapic_redirect_entry *ent = &ioapic->redirtbl[i]; | 428 | union kvm_ioapic_redirect_entry *ent = &ioapic->redirtbl[i]; |
| @@ -443,7 +444,8 @@ static void __kvm_ioapic_update_eoi(struct kvm_vcpu *vcpu, | |||
| 443 | kvm_notify_acked_irq(ioapic->kvm, KVM_IRQCHIP_IOAPIC, i); | 444 | kvm_notify_acked_irq(ioapic->kvm, KVM_IRQCHIP_IOAPIC, i); |
| 444 | spin_lock(&ioapic->lock); | 445 | spin_lock(&ioapic->lock); |
| 445 | 446 | ||
| 446 | if (trigger_mode != IOAPIC_LEVEL_TRIG) | 447 | if (trigger_mode != IOAPIC_LEVEL_TRIG || |
| 448 | kvm_apic_get_reg(apic, APIC_SPIV) & APIC_SPIV_DIRECTED_EOI) | ||
| 447 | continue; | 449 | continue; |
| 448 | 450 | ||
| 449 | ASSERT(ent->fields.trig_mode == IOAPIC_LEVEL_TRIG); | 451 | ASSERT(ent->fields.trig_mode == IOAPIC_LEVEL_TRIG); |
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index bd4e34de24c7..4ee827d7bf36 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c | |||
| @@ -833,8 +833,7 @@ int kvm_apic_compare_prio(struct kvm_vcpu *vcpu1, struct kvm_vcpu *vcpu2) | |||
| 833 | 833 | ||
| 834 | static void kvm_ioapic_send_eoi(struct kvm_lapic *apic, int vector) | 834 | static void kvm_ioapic_send_eoi(struct kvm_lapic *apic, int vector) |
| 835 | { | 835 | { |
| 836 | if (!(kvm_apic_get_reg(apic, APIC_SPIV) & APIC_SPIV_DIRECTED_EOI) && | 836 | if (kvm_ioapic_handles_vector(apic->vcpu->kvm, vector)) { |
| 837 | kvm_ioapic_handles_vector(apic->vcpu->kvm, vector)) { | ||
| 838 | int trigger_mode; | 837 | int trigger_mode; |
| 839 | if (apic_test_vector(vector, apic->regs + APIC_TMR)) | 838 | if (apic_test_vector(vector, apic->regs + APIC_TMR)) |
| 840 | trigger_mode = IOAPIC_LEVEL_TRIG; | 839 | trigger_mode = IOAPIC_LEVEL_TRIG; |
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 10a481b7674d..ae4f6d35d19c 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
| @@ -2479,8 +2479,7 @@ static void nested_vmx_setup_ctls_msrs(struct vcpu_vmx *vmx) | |||
| 2479 | if (enable_ept) { | 2479 | if (enable_ept) { |
| 2480 | /* nested EPT: emulate EPT also to L1 */ | 2480 | /* nested EPT: emulate EPT also to L1 */ |
| 2481 | vmx->nested.nested_vmx_secondary_ctls_high |= | 2481 | vmx->nested.nested_vmx_secondary_ctls_high |= |
| 2482 | SECONDARY_EXEC_ENABLE_EPT | | 2482 | SECONDARY_EXEC_ENABLE_EPT; |
| 2483 | SECONDARY_EXEC_UNRESTRICTED_GUEST; | ||
| 2484 | vmx->nested.nested_vmx_ept_caps = VMX_EPT_PAGE_WALK_4_BIT | | 2483 | vmx->nested.nested_vmx_ept_caps = VMX_EPT_PAGE_WALK_4_BIT | |
| 2485 | VMX_EPTP_WB_BIT | VMX_EPT_2MB_PAGE_BIT | | 2484 | VMX_EPTP_WB_BIT | VMX_EPT_2MB_PAGE_BIT | |
| 2486 | VMX_EPT_INVEPT_BIT; | 2485 | VMX_EPT_INVEPT_BIT; |
| @@ -2494,6 +2493,10 @@ static void nested_vmx_setup_ctls_msrs(struct vcpu_vmx *vmx) | |||
| 2494 | } else | 2493 | } else |
| 2495 | vmx->nested.nested_vmx_ept_caps = 0; | 2494 | vmx->nested.nested_vmx_ept_caps = 0; |
| 2496 | 2495 | ||
| 2496 | if (enable_unrestricted_guest) | ||
| 2497 | vmx->nested.nested_vmx_secondary_ctls_high |= | ||
| 2498 | SECONDARY_EXEC_UNRESTRICTED_GUEST; | ||
| 2499 | |||
| 2497 | /* miscellaneous data */ | 2500 | /* miscellaneous data */ |
| 2498 | rdmsr(MSR_IA32_VMX_MISC, | 2501 | rdmsr(MSR_IA32_VMX_MISC, |
| 2499 | vmx->nested.nested_vmx_misc_low, | 2502 | vmx->nested.nested_vmx_misc_low, |
diff --git a/block/blk-merge.c b/block/blk-merge.c index fc1ff3b1ea1f..fd3fee81c23c 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c | |||
| @@ -592,7 +592,7 @@ bool blk_rq_merge_ok(struct request *rq, struct bio *bio) | |||
| 592 | if (q->queue_flags & (1 << QUEUE_FLAG_SG_GAPS)) { | 592 | if (q->queue_flags & (1 << QUEUE_FLAG_SG_GAPS)) { |
| 593 | struct bio_vec *bprev; | 593 | struct bio_vec *bprev; |
| 594 | 594 | ||
| 595 | bprev = &rq->biotail->bi_io_vec[bio->bi_vcnt - 1]; | 595 | bprev = &rq->biotail->bi_io_vec[rq->biotail->bi_vcnt - 1]; |
| 596 | if (bvec_gap_to_prev(bprev, bio->bi_io_vec[0].bv_offset)) | 596 | if (bvec_gap_to_prev(bprev, bio->bi_io_vec[0].bv_offset)) |
| 597 | return false; | 597 | return false; |
| 598 | } | 598 | } |
diff --git a/block/blk-mq-tag.c b/block/blk-mq-tag.c index d53a764b05ea..be3290cc0644 100644 --- a/block/blk-mq-tag.c +++ b/block/blk-mq-tag.c | |||
| @@ -278,9 +278,11 @@ static int bt_get(struct blk_mq_alloc_data *data, | |||
| 278 | /* | 278 | /* |
| 279 | * We're out of tags on this hardware queue, kick any | 279 | * We're out of tags on this hardware queue, kick any |
| 280 | * pending IO submits before going to sleep waiting for | 280 | * pending IO submits before going to sleep waiting for |
| 281 | * some to complete. | 281 | * some to complete. Note that hctx can be NULL here for |
| 282 | * reserved tag allocation. | ||
| 282 | */ | 283 | */ |
| 283 | blk_mq_run_hw_queue(hctx, false); | 284 | if (hctx) |
| 285 | blk_mq_run_hw_queue(hctx, false); | ||
| 284 | 286 | ||
| 285 | /* | 287 | /* |
| 286 | * Retry tag allocation after running the hardware queue, | 288 | * Retry tag allocation after running the hardware queue, |
diff --git a/block/blk-mq.c b/block/blk-mq.c index 4f4bea21052e..b7b8933ec241 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c | |||
| @@ -1938,7 +1938,7 @@ struct request_queue *blk_mq_init_queue(struct blk_mq_tag_set *set) | |||
| 1938 | */ | 1938 | */ |
| 1939 | if (percpu_ref_init(&q->mq_usage_counter, blk_mq_usage_counter_release, | 1939 | if (percpu_ref_init(&q->mq_usage_counter, blk_mq_usage_counter_release, |
| 1940 | PERCPU_REF_INIT_ATOMIC, GFP_KERNEL)) | 1940 | PERCPU_REF_INIT_ATOMIC, GFP_KERNEL)) |
| 1941 | goto err_map; | 1941 | goto err_mq_usage; |
| 1942 | 1942 | ||
| 1943 | setup_timer(&q->timeout, blk_mq_rq_timer, (unsigned long) q); | 1943 | setup_timer(&q->timeout, blk_mq_rq_timer, (unsigned long) q); |
| 1944 | blk_queue_rq_timeout(q, 30000); | 1944 | blk_queue_rq_timeout(q, 30000); |
| @@ -1981,7 +1981,7 @@ struct request_queue *blk_mq_init_queue(struct blk_mq_tag_set *set) | |||
| 1981 | blk_mq_init_cpu_queues(q, set->nr_hw_queues); | 1981 | blk_mq_init_cpu_queues(q, set->nr_hw_queues); |
| 1982 | 1982 | ||
| 1983 | if (blk_mq_init_hw_queues(q, set)) | 1983 | if (blk_mq_init_hw_queues(q, set)) |
| 1984 | goto err_hw; | 1984 | goto err_mq_usage; |
| 1985 | 1985 | ||
| 1986 | mutex_lock(&all_q_mutex); | 1986 | mutex_lock(&all_q_mutex); |
| 1987 | list_add_tail(&q->all_q_node, &all_q_list); | 1987 | list_add_tail(&q->all_q_node, &all_q_list); |
| @@ -1993,7 +1993,7 @@ struct request_queue *blk_mq_init_queue(struct blk_mq_tag_set *set) | |||
| 1993 | 1993 | ||
| 1994 | return q; | 1994 | return q; |
| 1995 | 1995 | ||
| 1996 | err_hw: | 1996 | err_mq_usage: |
| 1997 | blk_cleanup_queue(q); | 1997 | blk_cleanup_queue(q); |
| 1998 | err_hctxs: | 1998 | err_hctxs: |
| 1999 | kfree(map); | 1999 | kfree(map); |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 4c35f0822d06..ef150ebb4c30 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
| @@ -4737,7 +4737,7 @@ struct ata_queued_cmd *ata_qc_new_init(struct ata_device *dev, int tag) | |||
| 4737 | return NULL; | 4737 | return NULL; |
| 4738 | 4738 | ||
| 4739 | /* libsas case */ | 4739 | /* libsas case */ |
| 4740 | if (!ap->scsi_host) { | 4740 | if (ap->flags & ATA_FLAG_SAS_HOST) { |
| 4741 | tag = ata_sas_allocate_tag(ap); | 4741 | tag = ata_sas_allocate_tag(ap); |
| 4742 | if (tag < 0) | 4742 | if (tag < 0) |
| 4743 | return NULL; | 4743 | return NULL; |
| @@ -4776,7 +4776,7 @@ void ata_qc_free(struct ata_queued_cmd *qc) | |||
| 4776 | tag = qc->tag; | 4776 | tag = qc->tag; |
| 4777 | if (likely(ata_tag_valid(tag))) { | 4777 | if (likely(ata_tag_valid(tag))) { |
| 4778 | qc->tag = ATA_TAG_POISON; | 4778 | qc->tag = ATA_TAG_POISON; |
| 4779 | if (!ap->scsi_host) | 4779 | if (ap->flags & ATA_FLAG_SAS_HOST) |
| 4780 | ata_sas_free_tag(tag, ap); | 4780 | ata_sas_free_tag(tag, ap); |
| 4781 | } | 4781 | } |
| 4782 | } | 4782 | } |
diff --git a/drivers/base/regmap/internal.h b/drivers/base/regmap/internal.h index beb8b27d4621..a13587b5c2be 100644 --- a/drivers/base/regmap/internal.h +++ b/drivers/base/regmap/internal.h | |||
| @@ -243,4 +243,12 @@ extern struct regcache_ops regcache_rbtree_ops; | |||
| 243 | extern struct regcache_ops regcache_lzo_ops; | 243 | extern struct regcache_ops regcache_lzo_ops; |
| 244 | extern struct regcache_ops regcache_flat_ops; | 244 | extern struct regcache_ops regcache_flat_ops; |
| 245 | 245 | ||
| 246 | static inline const char *regmap_name(const struct regmap *map) | ||
| 247 | { | ||
| 248 | if (map->dev) | ||
| 249 | return dev_name(map->dev); | ||
| 250 | |||
| 251 | return map->name; | ||
| 252 | } | ||
| 253 | |||
| 246 | #endif | 254 | #endif |
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c index da84f544c544..87db9893b463 100644 --- a/drivers/base/regmap/regcache.c +++ b/drivers/base/regmap/regcache.c | |||
| @@ -218,7 +218,7 @@ int regcache_read(struct regmap *map, | |||
| 218 | ret = map->cache_ops->read(map, reg, value); | 218 | ret = map->cache_ops->read(map, reg, value); |
| 219 | 219 | ||
| 220 | if (ret == 0) | 220 | if (ret == 0) |
| 221 | trace_regmap_reg_read_cache(map->dev, reg, *value); | 221 | trace_regmap_reg_read_cache(map, reg, *value); |
| 222 | 222 | ||
| 223 | return ret; | 223 | return ret; |
| 224 | } | 224 | } |
| @@ -311,7 +311,7 @@ int regcache_sync(struct regmap *map) | |||
| 311 | dev_dbg(map->dev, "Syncing %s cache\n", | 311 | dev_dbg(map->dev, "Syncing %s cache\n", |
| 312 | map->cache_ops->name); | 312 | map->cache_ops->name); |
| 313 | name = map->cache_ops->name; | 313 | name = map->cache_ops->name; |
| 314 | trace_regcache_sync(map->dev, name, "start"); | 314 | trace_regcache_sync(map, name, "start"); |
| 315 | 315 | ||
| 316 | if (!map->cache_dirty) | 316 | if (!map->cache_dirty) |
| 317 | goto out; | 317 | goto out; |
| @@ -346,7 +346,7 @@ out: | |||
| 346 | 346 | ||
| 347 | regmap_async_complete(map); | 347 | regmap_async_complete(map); |
| 348 | 348 | ||
| 349 | trace_regcache_sync(map->dev, name, "stop"); | 349 | trace_regcache_sync(map, name, "stop"); |
| 350 | 350 | ||
| 351 | return ret; | 351 | return ret; |
| 352 | } | 352 | } |
| @@ -381,7 +381,7 @@ int regcache_sync_region(struct regmap *map, unsigned int min, | |||
| 381 | name = map->cache_ops->name; | 381 | name = map->cache_ops->name; |
| 382 | dev_dbg(map->dev, "Syncing %s cache from %d-%d\n", name, min, max); | 382 | dev_dbg(map->dev, "Syncing %s cache from %d-%d\n", name, min, max); |
| 383 | 383 | ||
| 384 | trace_regcache_sync(map->dev, name, "start region"); | 384 | trace_regcache_sync(map, name, "start region"); |
| 385 | 385 | ||
| 386 | if (!map->cache_dirty) | 386 | if (!map->cache_dirty) |
| 387 | goto out; | 387 | goto out; |
| @@ -401,7 +401,7 @@ out: | |||
| 401 | 401 | ||
| 402 | regmap_async_complete(map); | 402 | regmap_async_complete(map); |
| 403 | 403 | ||
| 404 | trace_regcache_sync(map->dev, name, "stop region"); | 404 | trace_regcache_sync(map, name, "stop region"); |
| 405 | 405 | ||
| 406 | return ret; | 406 | return ret; |
| 407 | } | 407 | } |
| @@ -428,7 +428,7 @@ int regcache_drop_region(struct regmap *map, unsigned int min, | |||
| 428 | 428 | ||
| 429 | map->lock(map->lock_arg); | 429 | map->lock(map->lock_arg); |
| 430 | 430 | ||
| 431 | trace_regcache_drop_region(map->dev, min, max); | 431 | trace_regcache_drop_region(map, min, max); |
| 432 | 432 | ||
| 433 | ret = map->cache_ops->drop(map, min, max); | 433 | ret = map->cache_ops->drop(map, min, max); |
| 434 | 434 | ||
| @@ -455,7 +455,7 @@ void regcache_cache_only(struct regmap *map, bool enable) | |||
| 455 | map->lock(map->lock_arg); | 455 | map->lock(map->lock_arg); |
| 456 | WARN_ON(map->cache_bypass && enable); | 456 | WARN_ON(map->cache_bypass && enable); |
| 457 | map->cache_only = enable; | 457 | map->cache_only = enable; |
| 458 | trace_regmap_cache_only(map->dev, enable); | 458 | trace_regmap_cache_only(map, enable); |
| 459 | map->unlock(map->lock_arg); | 459 | map->unlock(map->lock_arg); |
| 460 | } | 460 | } |
| 461 | EXPORT_SYMBOL_GPL(regcache_cache_only); | 461 | EXPORT_SYMBOL_GPL(regcache_cache_only); |
| @@ -493,7 +493,7 @@ void regcache_cache_bypass(struct regmap *map, bool enable) | |||
| 493 | map->lock(map->lock_arg); | 493 | map->lock(map->lock_arg); |
| 494 | WARN_ON(map->cache_only && enable); | 494 | WARN_ON(map->cache_only && enable); |
| 495 | map->cache_bypass = enable; | 495 | map->cache_bypass = enable; |
| 496 | trace_regmap_cache_bypass(map->dev, enable); | 496 | trace_regmap_cache_bypass(map, enable); |
| 497 | map->unlock(map->lock_arg); | 497 | map->unlock(map->lock_arg); |
| 498 | } | 498 | } |
| 499 | EXPORT_SYMBOL_GPL(regcache_cache_bypass); | 499 | EXPORT_SYMBOL_GPL(regcache_cache_bypass); |
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index f99b098ddabf..dbfe6a69c3da 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c | |||
| @@ -1281,7 +1281,7 @@ int _regmap_raw_write(struct regmap *map, unsigned int reg, | |||
| 1281 | if (map->async && map->bus->async_write) { | 1281 | if (map->async && map->bus->async_write) { |
| 1282 | struct regmap_async *async; | 1282 | struct regmap_async *async; |
| 1283 | 1283 | ||
| 1284 | trace_regmap_async_write_start(map->dev, reg, val_len); | 1284 | trace_regmap_async_write_start(map, reg, val_len); |
| 1285 | 1285 | ||
| 1286 | spin_lock_irqsave(&map->async_lock, flags); | 1286 | spin_lock_irqsave(&map->async_lock, flags); |
| 1287 | async = list_first_entry_or_null(&map->async_free, | 1287 | async = list_first_entry_or_null(&map->async_free, |
| @@ -1339,8 +1339,7 @@ int _regmap_raw_write(struct regmap *map, unsigned int reg, | |||
| 1339 | return ret; | 1339 | return ret; |
| 1340 | } | 1340 | } |
| 1341 | 1341 | ||
| 1342 | trace_regmap_hw_write_start(map->dev, reg, | 1342 | trace_regmap_hw_write_start(map, reg, val_len / map->format.val_bytes); |
| 1343 | val_len / map->format.val_bytes); | ||
| 1344 | 1343 | ||
| 1345 | /* If we're doing a single register write we can probably just | 1344 | /* If we're doing a single register write we can probably just |
| 1346 | * send the work_buf directly, otherwise try to do a gather | 1345 | * send the work_buf directly, otherwise try to do a gather |
| @@ -1372,8 +1371,7 @@ int _regmap_raw_write(struct regmap *map, unsigned int reg, | |||
| 1372 | kfree(buf); | 1371 | kfree(buf); |
| 1373 | } | 1372 | } |
| 1374 | 1373 | ||
| 1375 | trace_regmap_hw_write_done(map->dev, reg, | 1374 | trace_regmap_hw_write_done(map, reg, val_len / map->format.val_bytes); |
| 1376 | val_len / map->format.val_bytes); | ||
| 1377 | 1375 | ||
| 1378 | return ret; | 1376 | return ret; |
| 1379 | } | 1377 | } |
| @@ -1407,12 +1405,12 @@ static int _regmap_bus_formatted_write(void *context, unsigned int reg, | |||
| 1407 | 1405 | ||
| 1408 | map->format.format_write(map, reg, val); | 1406 | map->format.format_write(map, reg, val); |
| 1409 | 1407 | ||
| 1410 | trace_regmap_hw_write_start(map->dev, reg, 1); | 1408 | trace_regmap_hw_write_start(map, reg, 1); |
| 1411 | 1409 | ||
| 1412 | ret = map->bus->write(map->bus_context, map->work_buf, | 1410 | ret = map->bus->write(map->bus_context, map->work_buf, |
| 1413 | map->format.buf_size); | 1411 | map->format.buf_size); |
| 1414 | 1412 | ||
| 1415 | trace_regmap_hw_write_done(map->dev, reg, 1); | 1413 | trace_regmap_hw_write_done(map, reg, 1); |
| 1416 | 1414 | ||
| 1417 | return ret; | 1415 | return ret; |
| 1418 | } | 1416 | } |
| @@ -1470,7 +1468,7 @@ int _regmap_write(struct regmap *map, unsigned int reg, | |||
| 1470 | dev_info(map->dev, "%x <= %x\n", reg, val); | 1468 | dev_info(map->dev, "%x <= %x\n", reg, val); |
| 1471 | #endif | 1469 | #endif |
| 1472 | 1470 | ||
| 1473 | trace_regmap_reg_write(map->dev, reg, val); | 1471 | trace_regmap_reg_write(map, reg, val); |
| 1474 | 1472 | ||
| 1475 | return map->reg_write(context, reg, val); | 1473 | return map->reg_write(context, reg, val); |
| 1476 | } | 1474 | } |
| @@ -1773,7 +1771,7 @@ static int _regmap_raw_multi_reg_write(struct regmap *map, | |||
| 1773 | for (i = 0; i < num_regs; i++) { | 1771 | for (i = 0; i < num_regs; i++) { |
| 1774 | int reg = regs[i].reg; | 1772 | int reg = regs[i].reg; |
| 1775 | int val = regs[i].def; | 1773 | int val = regs[i].def; |
| 1776 | trace_regmap_hw_write_start(map->dev, reg, 1); | 1774 | trace_regmap_hw_write_start(map, reg, 1); |
| 1777 | map->format.format_reg(u8, reg, map->reg_shift); | 1775 | map->format.format_reg(u8, reg, map->reg_shift); |
| 1778 | u8 += reg_bytes + pad_bytes; | 1776 | u8 += reg_bytes + pad_bytes; |
| 1779 | map->format.format_val(u8, val, 0); | 1777 | map->format.format_val(u8, val, 0); |
| @@ -1788,7 +1786,7 @@ static int _regmap_raw_multi_reg_write(struct regmap *map, | |||
| 1788 | 1786 | ||
| 1789 | for (i = 0; i < num_regs; i++) { | 1787 | for (i = 0; i < num_regs; i++) { |
| 1790 | int reg = regs[i].reg; | 1788 | int reg = regs[i].reg; |
| 1791 | trace_regmap_hw_write_done(map->dev, reg, 1); | 1789 | trace_regmap_hw_write_done(map, reg, 1); |
| 1792 | } | 1790 | } |
| 1793 | return ret; | 1791 | return ret; |
| 1794 | } | 1792 | } |
| @@ -2059,15 +2057,13 @@ static int _regmap_raw_read(struct regmap *map, unsigned int reg, void *val, | |||
| 2059 | */ | 2057 | */ |
| 2060 | u8[0] |= map->read_flag_mask; | 2058 | u8[0] |= map->read_flag_mask; |
| 2061 | 2059 | ||
| 2062 | trace_regmap_hw_read_start(map->dev, reg, | 2060 | trace_regmap_hw_read_start(map, reg, val_len / map->format.val_bytes); |
| 2063 | val_len / map->format.val_bytes); | ||
| 2064 | 2061 | ||
| 2065 | ret = map->bus->read(map->bus_context, map->work_buf, | 2062 | ret = map->bus->read(map->bus_context, map->work_buf, |
| 2066 | map->format.reg_bytes + map->format.pad_bytes, | 2063 | map->format.reg_bytes + map->format.pad_bytes, |
| 2067 | val, val_len); | 2064 | val, val_len); |
| 2068 | 2065 | ||
| 2069 | trace_regmap_hw_read_done(map->dev, reg, | 2066 | trace_regmap_hw_read_done(map, reg, val_len / map->format.val_bytes); |
| 2070 | val_len / map->format.val_bytes); | ||
| 2071 | 2067 | ||
| 2072 | return ret; | 2068 | return ret; |
| 2073 | } | 2069 | } |
| @@ -2123,7 +2119,7 @@ static int _regmap_read(struct regmap *map, unsigned int reg, | |||
| 2123 | dev_info(map->dev, "%x => %x\n", reg, *val); | 2119 | dev_info(map->dev, "%x => %x\n", reg, *val); |
| 2124 | #endif | 2120 | #endif |
| 2125 | 2121 | ||
| 2126 | trace_regmap_reg_read(map->dev, reg, *val); | 2122 | trace_regmap_reg_read(map, reg, *val); |
| 2127 | 2123 | ||
| 2128 | if (!map->cache_bypass) | 2124 | if (!map->cache_bypass) |
| 2129 | regcache_write(map, reg, *val); | 2125 | regcache_write(map, reg, *val); |
| @@ -2480,7 +2476,7 @@ void regmap_async_complete_cb(struct regmap_async *async, int ret) | |||
| 2480 | struct regmap *map = async->map; | 2476 | struct regmap *map = async->map; |
| 2481 | bool wake; | 2477 | bool wake; |
| 2482 | 2478 | ||
| 2483 | trace_regmap_async_io_complete(map->dev); | 2479 | trace_regmap_async_io_complete(map); |
| 2484 | 2480 | ||
| 2485 | spin_lock(&map->async_lock); | 2481 | spin_lock(&map->async_lock); |
| 2486 | list_move(&async->list, &map->async_free); | 2482 | list_move(&async->list, &map->async_free); |
| @@ -2525,7 +2521,7 @@ int regmap_async_complete(struct regmap *map) | |||
| 2525 | if (!map->bus || !map->bus->async_write) | 2521 | if (!map->bus || !map->bus->async_write) |
| 2526 | return 0; | 2522 | return 0; |
| 2527 | 2523 | ||
| 2528 | trace_regmap_async_complete_start(map->dev); | 2524 | trace_regmap_async_complete_start(map); |
| 2529 | 2525 | ||
| 2530 | wait_event(map->async_waitq, regmap_async_is_done(map)); | 2526 | wait_event(map->async_waitq, regmap_async_is_done(map)); |
| 2531 | 2527 | ||
| @@ -2534,7 +2530,7 @@ int regmap_async_complete(struct regmap *map) | |||
| 2534 | map->async_ret = 0; | 2530 | map->async_ret = 0; |
| 2535 | spin_unlock_irqrestore(&map->async_lock, flags); | 2531 | spin_unlock_irqrestore(&map->async_lock, flags); |
| 2536 | 2532 | ||
| 2537 | trace_regmap_async_complete_done(map->dev); | 2533 | trace_regmap_async_complete_done(map); |
| 2538 | 2534 | ||
| 2539 | return ret; | 2535 | return ret; |
| 2540 | } | 2536 | } |
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 4bc2a5cb9935..a98c41f72c63 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c | |||
| @@ -803,10 +803,6 @@ static int __init nbd_init(void) | |||
| 803 | return -EINVAL; | 803 | return -EINVAL; |
| 804 | } | 804 | } |
| 805 | 805 | ||
| 806 | nbd_dev = kcalloc(nbds_max, sizeof(*nbd_dev), GFP_KERNEL); | ||
| 807 | if (!nbd_dev) | ||
| 808 | return -ENOMEM; | ||
| 809 | |||
| 810 | part_shift = 0; | 806 | part_shift = 0; |
| 811 | if (max_part > 0) { | 807 | if (max_part > 0) { |
| 812 | part_shift = fls(max_part); | 808 | part_shift = fls(max_part); |
| @@ -828,6 +824,10 @@ static int __init nbd_init(void) | |||
| 828 | if (nbds_max > 1UL << (MINORBITS - part_shift)) | 824 | if (nbds_max > 1UL << (MINORBITS - part_shift)) |
| 829 | return -EINVAL; | 825 | return -EINVAL; |
| 830 | 826 | ||
| 827 | nbd_dev = kcalloc(nbds_max, sizeof(*nbd_dev), GFP_KERNEL); | ||
| 828 | if (!nbd_dev) | ||
| 829 | return -ENOMEM; | ||
| 830 | |||
| 831 | for (i = 0; i < nbds_max; i++) { | 831 | for (i = 0; i < nbds_max; i++) { |
| 832 | struct gendisk *disk = alloc_disk(1 << part_shift); | 832 | struct gendisk *disk = alloc_disk(1 << part_shift); |
| 833 | if (!disk) | 833 | if (!disk) |
diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c index ceb32dd52a6c..e23be20a3417 100644 --- a/drivers/block/nvme-core.c +++ b/drivers/block/nvme-core.c | |||
| @@ -3003,6 +3003,7 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
| 3003 | } | 3003 | } |
| 3004 | get_device(dev->device); | 3004 | get_device(dev->device); |
| 3005 | 3005 | ||
| 3006 | INIT_LIST_HEAD(&dev->node); | ||
| 3006 | INIT_WORK(&dev->probe_work, nvme_async_probe); | 3007 | INIT_WORK(&dev->probe_work, nvme_async_probe); |
| 3007 | schedule_work(&dev->probe_work); | 3008 | schedule_work(&dev->probe_work); |
| 3008 | return 0; | 3009 | return 0; |
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index f6d04c7b5115..679b10e34fb5 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c | |||
| @@ -525,17 +525,6 @@ void drm_framebuffer_reference(struct drm_framebuffer *fb) | |||
| 525 | } | 525 | } |
| 526 | EXPORT_SYMBOL(drm_framebuffer_reference); | 526 | EXPORT_SYMBOL(drm_framebuffer_reference); |
| 527 | 527 | ||
| 528 | static void drm_framebuffer_free_bug(struct kref *kref) | ||
| 529 | { | ||
| 530 | BUG(); | ||
| 531 | } | ||
| 532 | |||
| 533 | static void __drm_framebuffer_unreference(struct drm_framebuffer *fb) | ||
| 534 | { | ||
| 535 | DRM_DEBUG("%p: FB ID: %d (%d)\n", fb, fb->base.id, atomic_read(&fb->refcount.refcount)); | ||
| 536 | kref_put(&fb->refcount, drm_framebuffer_free_bug); | ||
| 537 | } | ||
| 538 | |||
| 539 | /** | 528 | /** |
| 540 | * drm_framebuffer_unregister_private - unregister a private fb from the lookup idr | 529 | * drm_framebuffer_unregister_private - unregister a private fb from the lookup idr |
| 541 | * @fb: fb to unregister | 530 | * @fb: fb to unregister |
| @@ -1320,7 +1309,7 @@ void drm_plane_force_disable(struct drm_plane *plane) | |||
| 1320 | return; | 1309 | return; |
| 1321 | } | 1310 | } |
| 1322 | /* disconnect the plane from the fb and crtc: */ | 1311 | /* disconnect the plane from the fb and crtc: */ |
| 1323 | __drm_framebuffer_unreference(plane->old_fb); | 1312 | drm_framebuffer_unreference(plane->old_fb); |
| 1324 | plane->old_fb = NULL; | 1313 | plane->old_fb = NULL; |
| 1325 | plane->fb = NULL; | 1314 | plane->fb = NULL; |
| 1326 | plane->crtc = NULL; | 1315 | plane->crtc = NULL; |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 5b205863b659..27ea6bdebce7 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
| @@ -2737,24 +2737,11 @@ i915_gem_retire_requests_ring(struct intel_engine_cs *ring) | |||
| 2737 | 2737 | ||
| 2738 | WARN_ON(i915_verify_lists(ring->dev)); | 2738 | WARN_ON(i915_verify_lists(ring->dev)); |
| 2739 | 2739 | ||
| 2740 | /* Move any buffers on the active list that are no longer referenced | 2740 | /* Retire requests first as we use it above for the early return. |
| 2741 | * by the ringbuffer to the flushing/inactive lists as appropriate, | 2741 | * If we retire requests last, we may use a later seqno and so clear |
| 2742 | * before we free the context associated with the requests. | 2742 | * the requests lists without clearing the active list, leading to |
| 2743 | * confusion. | ||
| 2743 | */ | 2744 | */ |
| 2744 | while (!list_empty(&ring->active_list)) { | ||
| 2745 | struct drm_i915_gem_object *obj; | ||
| 2746 | |||
| 2747 | obj = list_first_entry(&ring->active_list, | ||
| 2748 | struct drm_i915_gem_object, | ||
| 2749 | ring_list); | ||
| 2750 | |||
| 2751 | if (!i915_gem_request_completed(obj->last_read_req, true)) | ||
| 2752 | break; | ||
| 2753 | |||
| 2754 | i915_gem_object_move_to_inactive(obj); | ||
| 2755 | } | ||
| 2756 | |||
| 2757 | |||
| 2758 | while (!list_empty(&ring->request_list)) { | 2745 | while (!list_empty(&ring->request_list)) { |
| 2759 | struct drm_i915_gem_request *request; | 2746 | struct drm_i915_gem_request *request; |
| 2760 | struct intel_ringbuffer *ringbuf; | 2747 | struct intel_ringbuffer *ringbuf; |
| @@ -2789,6 +2776,23 @@ i915_gem_retire_requests_ring(struct intel_engine_cs *ring) | |||
| 2789 | i915_gem_free_request(request); | 2776 | i915_gem_free_request(request); |
| 2790 | } | 2777 | } |
| 2791 | 2778 | ||
| 2779 | /* Move any buffers on the active list that are no longer referenced | ||
| 2780 | * by the ringbuffer to the flushing/inactive lists as appropriate, | ||
| 2781 | * before we free the context associated with the requests. | ||
| 2782 | */ | ||
| 2783 | while (!list_empty(&ring->active_list)) { | ||
| 2784 | struct drm_i915_gem_object *obj; | ||
| 2785 | |||
| 2786 | obj = list_first_entry(&ring->active_list, | ||
| 2787 | struct drm_i915_gem_object, | ||
| 2788 | ring_list); | ||
| 2789 | |||
| 2790 | if (!i915_gem_request_completed(obj->last_read_req, true)) | ||
| 2791 | break; | ||
| 2792 | |||
| 2793 | i915_gem_object_move_to_inactive(obj); | ||
| 2794 | } | ||
| 2795 | |||
| 2792 | if (unlikely(ring->trace_irq_req && | 2796 | if (unlikely(ring->trace_irq_req && |
| 2793 | i915_gem_request_completed(ring->trace_irq_req, true))) { | 2797 | i915_gem_request_completed(ring->trace_irq_req, true))) { |
| 2794 | ring->irq_put(ring); | 2798 | ring->irq_put(ring); |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 6d22128d97b1..f75173c20f47 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
| @@ -2438,8 +2438,15 @@ intel_find_plane_obj(struct intel_crtc *intel_crtc, | |||
| 2438 | if (!intel_crtc->base.primary->fb) | 2438 | if (!intel_crtc->base.primary->fb) |
| 2439 | return; | 2439 | return; |
| 2440 | 2440 | ||
| 2441 | if (intel_alloc_plane_obj(intel_crtc, plane_config)) | 2441 | if (intel_alloc_plane_obj(intel_crtc, plane_config)) { |
| 2442 | struct drm_plane *primary = intel_crtc->base.primary; | ||
| 2443 | |||
| 2444 | primary->state->crtc = &intel_crtc->base; | ||
| 2445 | primary->crtc = &intel_crtc->base; | ||
| 2446 | update_state_fb(primary); | ||
| 2447 | |||
| 2442 | return; | 2448 | return; |
| 2449 | } | ||
| 2443 | 2450 | ||
| 2444 | kfree(intel_crtc->base.primary->fb); | 2451 | kfree(intel_crtc->base.primary->fb); |
| 2445 | intel_crtc->base.primary->fb = NULL; | 2452 | intel_crtc->base.primary->fb = NULL; |
| @@ -2462,11 +2469,15 @@ intel_find_plane_obj(struct intel_crtc *intel_crtc, | |||
| 2462 | continue; | 2469 | continue; |
| 2463 | 2470 | ||
| 2464 | if (i915_gem_obj_ggtt_offset(obj) == plane_config->base) { | 2471 | if (i915_gem_obj_ggtt_offset(obj) == plane_config->base) { |
| 2472 | struct drm_plane *primary = intel_crtc->base.primary; | ||
| 2473 | |||
| 2465 | if (obj->tiling_mode != I915_TILING_NONE) | 2474 | if (obj->tiling_mode != I915_TILING_NONE) |
| 2466 | dev_priv->preserve_bios_swizzle = true; | 2475 | dev_priv->preserve_bios_swizzle = true; |
| 2467 | 2476 | ||
| 2468 | drm_framebuffer_reference(c->primary->fb); | 2477 | drm_framebuffer_reference(c->primary->fb); |
| 2469 | intel_crtc->base.primary->fb = c->primary->fb; | 2478 | primary->fb = c->primary->fb; |
| 2479 | primary->state->crtc = &intel_crtc->base; | ||
| 2480 | primary->crtc = &intel_crtc->base; | ||
| 2470 | obj->frontbuffer_bits |= INTEL_FRONTBUFFER_PRIMARY(intel_crtc->pipe); | 2481 | obj->frontbuffer_bits |= INTEL_FRONTBUFFER_PRIMARY(intel_crtc->pipe); |
| 2471 | break; | 2482 | break; |
| 2472 | } | 2483 | } |
| @@ -6663,7 +6674,6 @@ i9xx_get_initial_plane_config(struct intel_crtc *crtc, | |||
| 6663 | plane_config->size); | 6674 | plane_config->size); |
| 6664 | 6675 | ||
| 6665 | crtc->base.primary->fb = fb; | 6676 | crtc->base.primary->fb = fb; |
| 6666 | update_state_fb(crtc->base.primary); | ||
| 6667 | } | 6677 | } |
| 6668 | 6678 | ||
| 6669 | static void chv_crtc_clock_get(struct intel_crtc *crtc, | 6679 | static void chv_crtc_clock_get(struct intel_crtc *crtc, |
| @@ -7704,7 +7714,6 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc, | |||
| 7704 | plane_config->size); | 7714 | plane_config->size); |
| 7705 | 7715 | ||
| 7706 | crtc->base.primary->fb = fb; | 7716 | crtc->base.primary->fb = fb; |
| 7707 | update_state_fb(crtc->base.primary); | ||
| 7708 | return; | 7717 | return; |
| 7709 | 7718 | ||
| 7710 | error: | 7719 | error: |
| @@ -7798,7 +7807,6 @@ ironlake_get_initial_plane_config(struct intel_crtc *crtc, | |||
| 7798 | plane_config->size); | 7807 | plane_config->size); |
| 7799 | 7808 | ||
| 7800 | crtc->base.primary->fb = fb; | 7809 | crtc->base.primary->fb = fb; |
| 7801 | update_state_fb(crtc->base.primary); | ||
| 7802 | } | 7810 | } |
| 7803 | 7811 | ||
| 7804 | static bool ironlake_get_pipe_config(struct intel_crtc *crtc, | 7812 | static bool ironlake_get_pipe_config(struct intel_crtc *crtc, |
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 9b641b38b857..8001fe9e3434 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
| @@ -433,7 +433,6 @@ static int dm_blk_open(struct block_device *bdev, fmode_t mode) | |||
| 433 | 433 | ||
| 434 | dm_get(md); | 434 | dm_get(md); |
| 435 | atomic_inc(&md->open_count); | 435 | atomic_inc(&md->open_count); |
| 436 | |||
| 437 | out: | 436 | out: |
| 438 | spin_unlock(&_minor_lock); | 437 | spin_unlock(&_minor_lock); |
| 439 | 438 | ||
| @@ -442,16 +441,20 @@ out: | |||
| 442 | 441 | ||
| 443 | static void dm_blk_close(struct gendisk *disk, fmode_t mode) | 442 | static void dm_blk_close(struct gendisk *disk, fmode_t mode) |
| 444 | { | 443 | { |
| 445 | struct mapped_device *md = disk->private_data; | 444 | struct mapped_device *md; |
| 446 | 445 | ||
| 447 | spin_lock(&_minor_lock); | 446 | spin_lock(&_minor_lock); |
| 448 | 447 | ||
| 448 | md = disk->private_data; | ||
| 449 | if (WARN_ON(!md)) | ||
| 450 | goto out; | ||
| 451 | |||
| 449 | if (atomic_dec_and_test(&md->open_count) && | 452 | if (atomic_dec_and_test(&md->open_count) && |
| 450 | (test_bit(DMF_DEFERRED_REMOVE, &md->flags))) | 453 | (test_bit(DMF_DEFERRED_REMOVE, &md->flags))) |
| 451 | queue_work(deferred_remove_workqueue, &deferred_remove_work); | 454 | queue_work(deferred_remove_workqueue, &deferred_remove_work); |
| 452 | 455 | ||
| 453 | dm_put(md); | 456 | dm_put(md); |
| 454 | 457 | out: | |
| 455 | spin_unlock(&_minor_lock); | 458 | spin_unlock(&_minor_lock); |
| 456 | } | 459 | } |
| 457 | 460 | ||
| @@ -2241,7 +2244,6 @@ static void free_dev(struct mapped_device *md) | |||
| 2241 | int minor = MINOR(disk_devt(md->disk)); | 2244 | int minor = MINOR(disk_devt(md->disk)); |
| 2242 | 2245 | ||
| 2243 | unlock_fs(md); | 2246 | unlock_fs(md); |
| 2244 | bdput(md->bdev); | ||
| 2245 | destroy_workqueue(md->wq); | 2247 | destroy_workqueue(md->wq); |
| 2246 | 2248 | ||
| 2247 | if (md->kworker_task) | 2249 | if (md->kworker_task) |
| @@ -2252,19 +2254,22 @@ static void free_dev(struct mapped_device *md) | |||
| 2252 | mempool_destroy(md->rq_pool); | 2254 | mempool_destroy(md->rq_pool); |
| 2253 | if (md->bs) | 2255 | if (md->bs) |
| 2254 | bioset_free(md->bs); | 2256 | bioset_free(md->bs); |
| 2255 | blk_integrity_unregister(md->disk); | 2257 | |
| 2256 | del_gendisk(md->disk); | ||
| 2257 | cleanup_srcu_struct(&md->io_barrier); | 2258 | cleanup_srcu_struct(&md->io_barrier); |
| 2258 | free_table_devices(&md->table_devices); | 2259 | free_table_devices(&md->table_devices); |
| 2259 | free_minor(minor); | 2260 | dm_stats_cleanup(&md->stats); |
| 2260 | 2261 | ||
| 2261 | spin_lock(&_minor_lock); | 2262 | spin_lock(&_minor_lock); |
| 2262 | md->disk->private_data = NULL; | 2263 | md->disk->private_data = NULL; |
| 2263 | spin_unlock(&_minor_lock); | 2264 | spin_unlock(&_minor_lock); |
| 2264 | 2265 | if (blk_get_integrity(md->disk)) | |
| 2266 | blk_integrity_unregister(md->disk); | ||
| 2267 | del_gendisk(md->disk); | ||
| 2265 | put_disk(md->disk); | 2268 | put_disk(md->disk); |
| 2266 | blk_cleanup_queue(md->queue); | 2269 | blk_cleanup_queue(md->queue); |
| 2267 | dm_stats_cleanup(&md->stats); | 2270 | bdput(md->bdev); |
| 2271 | free_minor(minor); | ||
| 2272 | |||
| 2268 | module_put(THIS_MODULE); | 2273 | module_put(THIS_MODULE); |
| 2269 | kfree(md); | 2274 | kfree(md); |
| 2270 | } | 2275 | } |
| @@ -2642,8 +2647,9 @@ static void __dm_destroy(struct mapped_device *md, bool wait) | |||
| 2642 | 2647 | ||
| 2643 | might_sleep(); | 2648 | might_sleep(); |
| 2644 | 2649 | ||
| 2645 | spin_lock(&_minor_lock); | ||
| 2646 | map = dm_get_live_table(md, &srcu_idx); | 2650 | map = dm_get_live_table(md, &srcu_idx); |
| 2651 | |||
| 2652 | spin_lock(&_minor_lock); | ||
| 2647 | idr_replace(&_minor_idr, MINOR_ALLOCED, MINOR(disk_devt(dm_disk(md)))); | 2653 | idr_replace(&_minor_idr, MINOR_ALLOCED, MINOR(disk_devt(dm_disk(md)))); |
| 2648 | set_bit(DMF_FREEING, &md->flags); | 2654 | set_bit(DMF_FREEING, &md->flags); |
| 2649 | spin_unlock(&_minor_lock); | 2655 | spin_unlock(&_minor_lock); |
diff --git a/drivers/mfd/kempld-core.c b/drivers/mfd/kempld-core.c index f38ec424872e..5615522f8d62 100644 --- a/drivers/mfd/kempld-core.c +++ b/drivers/mfd/kempld-core.c | |||
| @@ -739,7 +739,7 @@ static int __init kempld_init(void) | |||
| 739 | for (id = kempld_dmi_table; | 739 | for (id = kempld_dmi_table; |
| 740 | id->matches[0].slot != DMI_NONE; id++) | 740 | id->matches[0].slot != DMI_NONE; id++) |
| 741 | if (strstr(id->ident, force_device_id)) | 741 | if (strstr(id->ident, force_device_id)) |
| 742 | if (id->callback && id->callback(id)) | 742 | if (id->callback && !id->callback(id)) |
| 743 | break; | 743 | break; |
| 744 | if (id->matches[0].slot == DMI_NONE) | 744 | if (id->matches[0].slot == DMI_NONE) |
| 745 | return -ENODEV; | 745 | return -ENODEV; |
diff --git a/drivers/mfd/rtsx_usb.c b/drivers/mfd/rtsx_usb.c index ede50244f265..dbd907d7170e 100644 --- a/drivers/mfd/rtsx_usb.c +++ b/drivers/mfd/rtsx_usb.c | |||
| @@ -196,18 +196,27 @@ EXPORT_SYMBOL_GPL(rtsx_usb_ep0_write_register); | |||
| 196 | int rtsx_usb_ep0_read_register(struct rtsx_ucr *ucr, u16 addr, u8 *data) | 196 | int rtsx_usb_ep0_read_register(struct rtsx_ucr *ucr, u16 addr, u8 *data) |
| 197 | { | 197 | { |
| 198 | u16 value; | 198 | u16 value; |
| 199 | u8 *buf; | ||
| 200 | int ret; | ||
| 199 | 201 | ||
| 200 | if (!data) | 202 | if (!data) |
| 201 | return -EINVAL; | 203 | return -EINVAL; |
| 202 | *data = 0; | 204 | |
| 205 | buf = kzalloc(sizeof(u8), GFP_KERNEL); | ||
| 206 | if (!buf) | ||
| 207 | return -ENOMEM; | ||
| 203 | 208 | ||
| 204 | addr |= EP0_READ_REG_CMD << EP0_OP_SHIFT; | 209 | addr |= EP0_READ_REG_CMD << EP0_OP_SHIFT; |
| 205 | value = swab16(addr); | 210 | value = swab16(addr); |
| 206 | 211 | ||
| 207 | return usb_control_msg(ucr->pusb_dev, | 212 | ret = usb_control_msg(ucr->pusb_dev, |
| 208 | usb_rcvctrlpipe(ucr->pusb_dev, 0), RTSX_USB_REQ_REG_OP, | 213 | usb_rcvctrlpipe(ucr->pusb_dev, 0), RTSX_USB_REQ_REG_OP, |
| 209 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 214 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
| 210 | value, 0, data, 1, 100); | 215 | value, 0, buf, 1, 100); |
| 216 | *data = *buf; | ||
| 217 | |||
| 218 | kfree(buf); | ||
| 219 | return ret; | ||
| 211 | } | 220 | } |
| 212 | EXPORT_SYMBOL_GPL(rtsx_usb_ep0_read_register); | 221 | EXPORT_SYMBOL_GPL(rtsx_usb_ep0_read_register); |
| 213 | 222 | ||
| @@ -288,18 +297,27 @@ static int rtsx_usb_get_status_with_bulk(struct rtsx_ucr *ucr, u16 *status) | |||
| 288 | int rtsx_usb_get_card_status(struct rtsx_ucr *ucr, u16 *status) | 297 | int rtsx_usb_get_card_status(struct rtsx_ucr *ucr, u16 *status) |
| 289 | { | 298 | { |
| 290 | int ret; | 299 | int ret; |
| 300 | u16 *buf; | ||
| 291 | 301 | ||
| 292 | if (!status) | 302 | if (!status) |
| 293 | return -EINVAL; | 303 | return -EINVAL; |
| 294 | 304 | ||
| 295 | if (polling_pipe == 0) | 305 | if (polling_pipe == 0) { |
| 306 | buf = kzalloc(sizeof(u16), GFP_KERNEL); | ||
| 307 | if (!buf) | ||
| 308 | return -ENOMEM; | ||
| 309 | |||
| 296 | ret = usb_control_msg(ucr->pusb_dev, | 310 | ret = usb_control_msg(ucr->pusb_dev, |
| 297 | usb_rcvctrlpipe(ucr->pusb_dev, 0), | 311 | usb_rcvctrlpipe(ucr->pusb_dev, 0), |
| 298 | RTSX_USB_REQ_POLL, | 312 | RTSX_USB_REQ_POLL, |
| 299 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 313 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
| 300 | 0, 0, status, 2, 100); | 314 | 0, 0, buf, 2, 100); |
| 301 | else | 315 | *status = *buf; |
| 316 | |||
| 317 | kfree(buf); | ||
| 318 | } else { | ||
| 302 | ret = rtsx_usb_get_status_with_bulk(ucr, status); | 319 | ret = rtsx_usb_get_status_with_bulk(ucr, status); |
| 320 | } | ||
| 303 | 321 | ||
| 304 | /* usb_control_msg may return positive when success */ | 322 | /* usb_control_msg may return positive when success */ |
| 305 | if (ret < 0) | 323 | if (ret < 0) |
diff --git a/drivers/net/ethernet/amd/pcnet32.c b/drivers/net/ethernet/amd/pcnet32.c index 11d6e6561df1..15a8190a6f75 100644 --- a/drivers/net/ethernet/amd/pcnet32.c +++ b/drivers/net/ethernet/amd/pcnet32.c | |||
| @@ -1543,7 +1543,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) | |||
| 1543 | { | 1543 | { |
| 1544 | struct pcnet32_private *lp; | 1544 | struct pcnet32_private *lp; |
| 1545 | int i, media; | 1545 | int i, media; |
| 1546 | int fdx, mii, fset, dxsuflo; | 1546 | int fdx, mii, fset, dxsuflo, sram; |
| 1547 | int chip_version; | 1547 | int chip_version; |
| 1548 | char *chipname; | 1548 | char *chipname; |
| 1549 | struct net_device *dev; | 1549 | struct net_device *dev; |
| @@ -1580,7 +1580,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) | |||
| 1580 | } | 1580 | } |
| 1581 | 1581 | ||
| 1582 | /* initialize variables */ | 1582 | /* initialize variables */ |
| 1583 | fdx = mii = fset = dxsuflo = 0; | 1583 | fdx = mii = fset = dxsuflo = sram = 0; |
| 1584 | chip_version = (chip_version >> 12) & 0xffff; | 1584 | chip_version = (chip_version >> 12) & 0xffff; |
| 1585 | 1585 | ||
| 1586 | switch (chip_version) { | 1586 | switch (chip_version) { |
| @@ -1613,6 +1613,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) | |||
| 1613 | chipname = "PCnet/FAST III 79C973"; /* PCI */ | 1613 | chipname = "PCnet/FAST III 79C973"; /* PCI */ |
| 1614 | fdx = 1; | 1614 | fdx = 1; |
| 1615 | mii = 1; | 1615 | mii = 1; |
| 1616 | sram = 1; | ||
| 1616 | break; | 1617 | break; |
| 1617 | case 0x2626: | 1618 | case 0x2626: |
| 1618 | chipname = "PCnet/Home 79C978"; /* PCI */ | 1619 | chipname = "PCnet/Home 79C978"; /* PCI */ |
| @@ -1636,6 +1637,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) | |||
| 1636 | chipname = "PCnet/FAST III 79C975"; /* PCI */ | 1637 | chipname = "PCnet/FAST III 79C975"; /* PCI */ |
| 1637 | fdx = 1; | 1638 | fdx = 1; |
| 1638 | mii = 1; | 1639 | mii = 1; |
| 1640 | sram = 1; | ||
| 1639 | break; | 1641 | break; |
| 1640 | case 0x2628: | 1642 | case 0x2628: |
| 1641 | chipname = "PCnet/PRO 79C976"; | 1643 | chipname = "PCnet/PRO 79C976"; |
| @@ -1664,6 +1666,31 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) | |||
| 1664 | dxsuflo = 1; | 1666 | dxsuflo = 1; |
| 1665 | } | 1667 | } |
| 1666 | 1668 | ||
| 1669 | /* | ||
| 1670 | * The Am79C973/Am79C975 controllers come with 12K of SRAM | ||
| 1671 | * which we can use for the Tx/Rx buffers but most importantly, | ||
| 1672 | * the use of SRAM allow us to use the BCR18:NOUFLO bit to avoid | ||
| 1673 | * Tx fifo underflows. | ||
| 1674 | */ | ||
| 1675 | if (sram) { | ||
| 1676 | /* | ||
| 1677 | * The SRAM is being configured in two steps. First we | ||
| 1678 | * set the SRAM size in the BCR25:SRAM_SIZE bits. According | ||
| 1679 | * to the datasheet, each bit corresponds to a 512-byte | ||
| 1680 | * page so we can have at most 24 pages. The SRAM_SIZE | ||
| 1681 | * holds the value of the upper 8 bits of the 16-bit SRAM size. | ||
| 1682 | * The low 8-bits start at 0x00 and end at 0xff. So the | ||
| 1683 | * address range is from 0x0000 up to 0x17ff. Therefore, | ||
| 1684 | * the SRAM_SIZE is set to 0x17. The next step is to set | ||
| 1685 | * the BCR26:SRAM_BND midway through so the Tx and Rx | ||
| 1686 | * buffers can share the SRAM equally. | ||
| 1687 | */ | ||
| 1688 | a->write_bcr(ioaddr, 25, 0x17); | ||
| 1689 | a->write_bcr(ioaddr, 26, 0xc); | ||
| 1690 | /* And finally enable the NOUFLO bit */ | ||
| 1691 | a->write_bcr(ioaddr, 18, a->read_bcr(ioaddr, 18) | (1 << 11)); | ||
| 1692 | } | ||
| 1693 | |||
| 1667 | dev = alloc_etherdev(sizeof(*lp)); | 1694 | dev = alloc_etherdev(sizeof(*lp)); |
| 1668 | if (!dev) { | 1695 | if (!dev) { |
| 1669 | ret = -ENOMEM; | 1696 | ret = -ENOMEM; |
diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h index 27de37aa90af..27b9fe99a9bd 100644 --- a/drivers/net/ethernet/emulex/benet/be.h +++ b/drivers/net/ethernet/emulex/benet/be.h | |||
| @@ -354,6 +354,7 @@ struct be_vf_cfg { | |||
| 354 | u16 vlan_tag; | 354 | u16 vlan_tag; |
| 355 | u32 tx_rate; | 355 | u32 tx_rate; |
| 356 | u32 plink_tracking; | 356 | u32 plink_tracking; |
| 357 | u32 privileges; | ||
| 357 | }; | 358 | }; |
| 358 | 359 | ||
| 359 | enum vf_state { | 360 | enum vf_state { |
| @@ -423,6 +424,7 @@ struct be_adapter { | |||
| 423 | 424 | ||
| 424 | u8 __iomem *csr; /* CSR BAR used only for BE2/3 */ | 425 | u8 __iomem *csr; /* CSR BAR used only for BE2/3 */ |
| 425 | u8 __iomem *db; /* Door Bell */ | 426 | u8 __iomem *db; /* Door Bell */ |
| 427 | u8 __iomem *pcicfg; /* On SH,BEx only. Shadow of PCI config space */ | ||
| 426 | 428 | ||
| 427 | struct mutex mbox_lock; /* For serializing mbox cmds to BE card */ | 429 | struct mutex mbox_lock; /* For serializing mbox cmds to BE card */ |
| 428 | struct be_dma_mem mbox_mem; | 430 | struct be_dma_mem mbox_mem; |
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c index 36916cfa70f9..7f05f309e935 100644 --- a/drivers/net/ethernet/emulex/benet/be_cmds.c +++ b/drivers/net/ethernet/emulex/benet/be_cmds.c | |||
| @@ -1902,15 +1902,11 @@ int be_cmd_modify_eqd(struct be_adapter *adapter, struct be_set_eqd *set_eqd, | |||
| 1902 | { | 1902 | { |
| 1903 | int num_eqs, i = 0; | 1903 | int num_eqs, i = 0; |
| 1904 | 1904 | ||
| 1905 | if (lancer_chip(adapter) && num > 8) { | 1905 | while (num) { |
| 1906 | while (num) { | 1906 | num_eqs = min(num, 8); |
| 1907 | num_eqs = min(num, 8); | 1907 | __be_cmd_modify_eqd(adapter, &set_eqd[i], num_eqs); |
| 1908 | __be_cmd_modify_eqd(adapter, &set_eqd[i], num_eqs); | 1908 | i += num_eqs; |
| 1909 | i += num_eqs; | 1909 | num -= num_eqs; |
| 1910 | num -= num_eqs; | ||
| 1911 | } | ||
| 1912 | } else { | ||
| 1913 | __be_cmd_modify_eqd(adapter, set_eqd, num); | ||
| 1914 | } | 1910 | } |
| 1915 | 1911 | ||
| 1916 | return 0; | 1912 | return 0; |
| @@ -1918,7 +1914,7 @@ int be_cmd_modify_eqd(struct be_adapter *adapter, struct be_set_eqd *set_eqd, | |||
| 1918 | 1914 | ||
| 1919 | /* Uses sycnhronous mcc */ | 1915 | /* Uses sycnhronous mcc */ |
| 1920 | int be_cmd_vlan_config(struct be_adapter *adapter, u32 if_id, u16 *vtag_array, | 1916 | int be_cmd_vlan_config(struct be_adapter *adapter, u32 if_id, u16 *vtag_array, |
| 1921 | u32 num) | 1917 | u32 num, u32 domain) |
| 1922 | { | 1918 | { |
| 1923 | struct be_mcc_wrb *wrb; | 1919 | struct be_mcc_wrb *wrb; |
| 1924 | struct be_cmd_req_vlan_config *req; | 1920 | struct be_cmd_req_vlan_config *req; |
| @@ -1936,6 +1932,7 @@ int be_cmd_vlan_config(struct be_adapter *adapter, u32 if_id, u16 *vtag_array, | |||
| 1936 | be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, | 1932 | be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, |
| 1937 | OPCODE_COMMON_NTWK_VLAN_CONFIG, sizeof(*req), | 1933 | OPCODE_COMMON_NTWK_VLAN_CONFIG, sizeof(*req), |
| 1938 | wrb, NULL); | 1934 | wrb, NULL); |
| 1935 | req->hdr.domain = domain; | ||
| 1939 | 1936 | ||
| 1940 | req->interface_id = if_id; | 1937 | req->interface_id = if_id; |
| 1941 | req->untagged = BE_IF_FLAGS_UNTAGGED & be_if_cap_flags(adapter) ? 1 : 0; | 1938 | req->untagged = BE_IF_FLAGS_UNTAGGED & be_if_cap_flags(adapter) ? 1 : 0; |
diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.h b/drivers/net/ethernet/emulex/benet/be_cmds.h index db761e8e42a3..a7634a3f052a 100644 --- a/drivers/net/ethernet/emulex/benet/be_cmds.h +++ b/drivers/net/ethernet/emulex/benet/be_cmds.h | |||
| @@ -2256,7 +2256,7 @@ int lancer_cmd_get_pport_stats(struct be_adapter *adapter, | |||
| 2256 | int be_cmd_get_fw_ver(struct be_adapter *adapter); | 2256 | int be_cmd_get_fw_ver(struct be_adapter *adapter); |
| 2257 | int be_cmd_modify_eqd(struct be_adapter *adapter, struct be_set_eqd *, int num); | 2257 | int be_cmd_modify_eqd(struct be_adapter *adapter, struct be_set_eqd *, int num); |
| 2258 | int be_cmd_vlan_config(struct be_adapter *adapter, u32 if_id, u16 *vtag_array, | 2258 | int be_cmd_vlan_config(struct be_adapter *adapter, u32 if_id, u16 *vtag_array, |
| 2259 | u32 num); | 2259 | u32 num, u32 domain); |
| 2260 | int be_cmd_rx_filter(struct be_adapter *adapter, u32 flags, u32 status); | 2260 | int be_cmd_rx_filter(struct be_adapter *adapter, u32 flags, u32 status); |
| 2261 | int be_cmd_set_flow_control(struct be_adapter *adapter, u32 tx_fc, u32 rx_fc); | 2261 | int be_cmd_set_flow_control(struct be_adapter *adapter, u32 tx_fc, u32 rx_fc); |
| 2262 | int be_cmd_get_flow_control(struct be_adapter *adapter, u32 *tx_fc, u32 *rx_fc); | 2262 | int be_cmd_get_flow_control(struct be_adapter *adapter, u32 *tx_fc, u32 *rx_fc); |
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 0a816859aca5..e6b790f0d9dc 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
| @@ -1171,7 +1171,7 @@ static int be_vid_config(struct be_adapter *adapter) | |||
| 1171 | for_each_set_bit(i, adapter->vids, VLAN_N_VID) | 1171 | for_each_set_bit(i, adapter->vids, VLAN_N_VID) |
| 1172 | vids[num++] = cpu_to_le16(i); | 1172 | vids[num++] = cpu_to_le16(i); |
| 1173 | 1173 | ||
| 1174 | status = be_cmd_vlan_config(adapter, adapter->if_handle, vids, num); | 1174 | status = be_cmd_vlan_config(adapter, adapter->if_handle, vids, num, 0); |
| 1175 | if (status) { | 1175 | if (status) { |
| 1176 | dev_err(dev, "Setting HW VLAN filtering failed\n"); | 1176 | dev_err(dev, "Setting HW VLAN filtering failed\n"); |
| 1177 | /* Set to VLAN promisc mode as setting VLAN filter failed */ | 1177 | /* Set to VLAN promisc mode as setting VLAN filter failed */ |
| @@ -1380,11 +1380,67 @@ static int be_get_vf_config(struct net_device *netdev, int vf, | |||
| 1380 | return 0; | 1380 | return 0; |
| 1381 | } | 1381 | } |
| 1382 | 1382 | ||
| 1383 | static int be_set_vf_tvt(struct be_adapter *adapter, int vf, u16 vlan) | ||
| 1384 | { | ||
| 1385 | struct be_vf_cfg *vf_cfg = &adapter->vf_cfg[vf]; | ||
| 1386 | u16 vids[BE_NUM_VLANS_SUPPORTED]; | ||
| 1387 | int vf_if_id = vf_cfg->if_handle; | ||
| 1388 | int status; | ||
| 1389 | |||
| 1390 | /* Enable Transparent VLAN Tagging */ | ||
| 1391 | status = be_cmd_set_hsw_config(adapter, vlan, vf + 1, vf_if_id, 0); | ||
| 1392 | if (status) | ||
| 1393 | return status; | ||
| 1394 | |||
| 1395 | /* Clear pre-programmed VLAN filters on VF if any, if TVT is enabled */ | ||
| 1396 | vids[0] = 0; | ||
| 1397 | status = be_cmd_vlan_config(adapter, vf_if_id, vids, 1, vf + 1); | ||
| 1398 | if (!status) | ||
| 1399 | dev_info(&adapter->pdev->dev, | ||
| 1400 | "Cleared guest VLANs on VF%d", vf); | ||
| 1401 | |||
| 1402 | /* After TVT is enabled, disallow VFs to program VLAN filters */ | ||
| 1403 | if (vf_cfg->privileges & BE_PRIV_FILTMGMT) { | ||
| 1404 | status = be_cmd_set_fn_privileges(adapter, vf_cfg->privileges & | ||
| 1405 | ~BE_PRIV_FILTMGMT, vf + 1); | ||
| 1406 | if (!status) | ||
| 1407 | vf_cfg->privileges &= ~BE_PRIV_FILTMGMT; | ||
| 1408 | } | ||
| 1409 | return 0; | ||
| 1410 | } | ||
| 1411 | |||
| 1412 | static int be_clear_vf_tvt(struct be_adapter *adapter, int vf) | ||
| 1413 | { | ||
| 1414 | struct be_vf_cfg *vf_cfg = &adapter->vf_cfg[vf]; | ||
| 1415 | struct device *dev = &adapter->pdev->dev; | ||
| 1416 | int status; | ||
| 1417 | |||
| 1418 | /* Reset Transparent VLAN Tagging. */ | ||
| 1419 | status = be_cmd_set_hsw_config(adapter, BE_RESET_VLAN_TAG_ID, vf + 1, | ||
| 1420 | vf_cfg->if_handle, 0); | ||
| 1421 | if (status) | ||
| 1422 | return status; | ||
| 1423 | |||
| 1424 | /* Allow VFs to program VLAN filtering */ | ||
| 1425 | if (!(vf_cfg->privileges & BE_PRIV_FILTMGMT)) { | ||
| 1426 | status = be_cmd_set_fn_privileges(adapter, vf_cfg->privileges | | ||
| 1427 | BE_PRIV_FILTMGMT, vf + 1); | ||
| 1428 | if (!status) { | ||
| 1429 | vf_cfg->privileges |= BE_PRIV_FILTMGMT; | ||
| 1430 | dev_info(dev, "VF%d: FILTMGMT priv enabled", vf); | ||
| 1431 | } | ||
| 1432 | } | ||
| 1433 | |||
| 1434 | dev_info(dev, | ||
| 1435 | "Disable/re-enable i/f in VM to clear Transparent VLAN tag"); | ||
| 1436 | return 0; | ||
| 1437 | } | ||
| 1438 | |||
| 1383 | static int be_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos) | 1439 | static int be_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos) |
| 1384 | { | 1440 | { |
| 1385 | struct be_adapter *adapter = netdev_priv(netdev); | 1441 | struct be_adapter *adapter = netdev_priv(netdev); |
| 1386 | struct be_vf_cfg *vf_cfg = &adapter->vf_cfg[vf]; | 1442 | struct be_vf_cfg *vf_cfg = &adapter->vf_cfg[vf]; |
| 1387 | int status = 0; | 1443 | int status; |
| 1388 | 1444 | ||
| 1389 | if (!sriov_enabled(adapter)) | 1445 | if (!sriov_enabled(adapter)) |
| 1390 | return -EPERM; | 1446 | return -EPERM; |
| @@ -1394,24 +1450,19 @@ static int be_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos) | |||
| 1394 | 1450 | ||
| 1395 | if (vlan || qos) { | 1451 | if (vlan || qos) { |
| 1396 | vlan |= qos << VLAN_PRIO_SHIFT; | 1452 | vlan |= qos << VLAN_PRIO_SHIFT; |
| 1397 | if (vf_cfg->vlan_tag != vlan) | 1453 | status = be_set_vf_tvt(adapter, vf, vlan); |
| 1398 | status = be_cmd_set_hsw_config(adapter, vlan, vf + 1, | ||
| 1399 | vf_cfg->if_handle, 0); | ||
| 1400 | } else { | 1454 | } else { |
| 1401 | /* Reset Transparent Vlan Tagging. */ | 1455 | status = be_clear_vf_tvt(adapter, vf); |
| 1402 | status = be_cmd_set_hsw_config(adapter, BE_RESET_VLAN_TAG_ID, | ||
| 1403 | vf + 1, vf_cfg->if_handle, 0); | ||
| 1404 | } | 1456 | } |
| 1405 | 1457 | ||
| 1406 | if (status) { | 1458 | if (status) { |
| 1407 | dev_err(&adapter->pdev->dev, | 1459 | dev_err(&adapter->pdev->dev, |
| 1408 | "VLAN %d config on VF %d failed : %#x\n", vlan, | 1460 | "VLAN %d config on VF %d failed : %#x\n", vlan, vf, |
| 1409 | vf, status); | 1461 | status); |
| 1410 | return be_cmd_status(status); | 1462 | return be_cmd_status(status); |
| 1411 | } | 1463 | } |
| 1412 | 1464 | ||
| 1413 | vf_cfg->vlan_tag = vlan; | 1465 | vf_cfg->vlan_tag = vlan; |
| 1414 | |||
| 1415 | return 0; | 1466 | return 0; |
| 1416 | } | 1467 | } |
| 1417 | 1468 | ||
| @@ -2772,14 +2823,12 @@ void be_detect_error(struct be_adapter *adapter) | |||
| 2772 | } | 2823 | } |
| 2773 | } | 2824 | } |
| 2774 | } else { | 2825 | } else { |
| 2775 | pci_read_config_dword(adapter->pdev, | 2826 | ue_lo = ioread32(adapter->pcicfg + PCICFG_UE_STATUS_LOW); |
| 2776 | PCICFG_UE_STATUS_LOW, &ue_lo); | 2827 | ue_hi = ioread32(adapter->pcicfg + PCICFG_UE_STATUS_HIGH); |
| 2777 | pci_read_config_dword(adapter->pdev, | 2828 | ue_lo_mask = ioread32(adapter->pcicfg + |
| 2778 | PCICFG_UE_STATUS_HIGH, &ue_hi); | 2829 | PCICFG_UE_STATUS_LOW_MASK); |
| 2779 | pci_read_config_dword(adapter->pdev, | 2830 | ue_hi_mask = ioread32(adapter->pcicfg + |
| 2780 | PCICFG_UE_STATUS_LOW_MASK, &ue_lo_mask); | 2831 | PCICFG_UE_STATUS_HI_MASK); |
| 2781 | pci_read_config_dword(adapter->pdev, | ||
| 2782 | PCICFG_UE_STATUS_HI_MASK, &ue_hi_mask); | ||
| 2783 | 2832 | ||
| 2784 | ue_lo = (ue_lo & ~ue_lo_mask); | 2833 | ue_lo = (ue_lo & ~ue_lo_mask); |
| 2785 | ue_hi = (ue_hi & ~ue_hi_mask); | 2834 | ue_hi = (ue_hi & ~ue_hi_mask); |
| @@ -3339,7 +3388,6 @@ static int be_if_create(struct be_adapter *adapter, u32 *if_handle, | |||
| 3339 | u32 cap_flags, u32 vf) | 3388 | u32 cap_flags, u32 vf) |
| 3340 | { | 3389 | { |
| 3341 | u32 en_flags; | 3390 | u32 en_flags; |
| 3342 | int status; | ||
| 3343 | 3391 | ||
| 3344 | en_flags = BE_IF_FLAGS_UNTAGGED | BE_IF_FLAGS_BROADCAST | | 3392 | en_flags = BE_IF_FLAGS_UNTAGGED | BE_IF_FLAGS_BROADCAST | |
| 3345 | BE_IF_FLAGS_MULTICAST | BE_IF_FLAGS_PASS_L3L4_ERRORS | | 3393 | BE_IF_FLAGS_MULTICAST | BE_IF_FLAGS_PASS_L3L4_ERRORS | |
| @@ -3347,10 +3395,7 @@ static int be_if_create(struct be_adapter *adapter, u32 *if_handle, | |||
| 3347 | 3395 | ||
| 3348 | en_flags &= cap_flags; | 3396 | en_flags &= cap_flags; |
| 3349 | 3397 | ||
| 3350 | status = be_cmd_if_create(adapter, cap_flags, en_flags, | 3398 | return be_cmd_if_create(adapter, cap_flags, en_flags, if_handle, vf); |
| 3351 | if_handle, vf); | ||
| 3352 | |||
| 3353 | return status; | ||
| 3354 | } | 3399 | } |
| 3355 | 3400 | ||
| 3356 | static int be_vfs_if_create(struct be_adapter *adapter) | 3401 | static int be_vfs_if_create(struct be_adapter *adapter) |
| @@ -3368,8 +3413,13 @@ static int be_vfs_if_create(struct be_adapter *adapter) | |||
| 3368 | if (!BE3_chip(adapter)) { | 3413 | if (!BE3_chip(adapter)) { |
| 3369 | status = be_cmd_get_profile_config(adapter, &res, | 3414 | status = be_cmd_get_profile_config(adapter, &res, |
| 3370 | vf + 1); | 3415 | vf + 1); |
| 3371 | if (!status) | 3416 | if (!status) { |
| 3372 | cap_flags = res.if_cap_flags; | 3417 | cap_flags = res.if_cap_flags; |
| 3418 | /* Prevent VFs from enabling VLAN promiscuous | ||
| 3419 | * mode | ||
| 3420 | */ | ||
| 3421 | cap_flags &= ~BE_IF_FLAGS_VLAN_PROMISCUOUS; | ||
| 3422 | } | ||
| 3373 | } | 3423 | } |
| 3374 | 3424 | ||
| 3375 | status = be_if_create(adapter, &vf_cfg->if_handle, | 3425 | status = be_if_create(adapter, &vf_cfg->if_handle, |
| @@ -3403,7 +3453,6 @@ static int be_vf_setup(struct be_adapter *adapter) | |||
| 3403 | struct device *dev = &adapter->pdev->dev; | 3453 | struct device *dev = &adapter->pdev->dev; |
| 3404 | struct be_vf_cfg *vf_cfg; | 3454 | struct be_vf_cfg *vf_cfg; |
| 3405 | int status, old_vfs, vf; | 3455 | int status, old_vfs, vf; |
| 3406 | u32 privileges; | ||
| 3407 | 3456 | ||
| 3408 | old_vfs = pci_num_vf(adapter->pdev); | 3457 | old_vfs = pci_num_vf(adapter->pdev); |
| 3409 | 3458 | ||
| @@ -3433,15 +3482,18 @@ static int be_vf_setup(struct be_adapter *adapter) | |||
| 3433 | 3482 | ||
| 3434 | for_all_vfs(adapter, vf_cfg, vf) { | 3483 | for_all_vfs(adapter, vf_cfg, vf) { |
| 3435 | /* Allow VFs to programs MAC/VLAN filters */ | 3484 | /* Allow VFs to programs MAC/VLAN filters */ |
| 3436 | status = be_cmd_get_fn_privileges(adapter, &privileges, vf + 1); | 3485 | status = be_cmd_get_fn_privileges(adapter, &vf_cfg->privileges, |
| 3437 | if (!status && !(privileges & BE_PRIV_FILTMGMT)) { | 3486 | vf + 1); |
| 3487 | if (!status && !(vf_cfg->privileges & BE_PRIV_FILTMGMT)) { | ||
| 3438 | status = be_cmd_set_fn_privileges(adapter, | 3488 | status = be_cmd_set_fn_privileges(adapter, |
| 3439 | privileges | | 3489 | vf_cfg->privileges | |
| 3440 | BE_PRIV_FILTMGMT, | 3490 | BE_PRIV_FILTMGMT, |
| 3441 | vf + 1); | 3491 | vf + 1); |
| 3442 | if (!status) | 3492 | if (!status) { |
| 3493 | vf_cfg->privileges |= BE_PRIV_FILTMGMT; | ||
| 3443 | dev_info(dev, "VF%d has FILTMGMT privilege\n", | 3494 | dev_info(dev, "VF%d has FILTMGMT privilege\n", |
| 3444 | vf); | 3495 | vf); |
| 3496 | } | ||
| 3445 | } | 3497 | } |
| 3446 | 3498 | ||
| 3447 | /* Allow full available bandwidth */ | 3499 | /* Allow full available bandwidth */ |
| @@ -4820,24 +4872,37 @@ static int be_roce_map_pci_bars(struct be_adapter *adapter) | |||
| 4820 | 4872 | ||
| 4821 | static int be_map_pci_bars(struct be_adapter *adapter) | 4873 | static int be_map_pci_bars(struct be_adapter *adapter) |
| 4822 | { | 4874 | { |
| 4875 | struct pci_dev *pdev = adapter->pdev; | ||
| 4823 | u8 __iomem *addr; | 4876 | u8 __iomem *addr; |
| 4824 | 4877 | ||
| 4825 | if (BEx_chip(adapter) && be_physfn(adapter)) { | 4878 | if (BEx_chip(adapter) && be_physfn(adapter)) { |
| 4826 | adapter->csr = pci_iomap(adapter->pdev, 2, 0); | 4879 | adapter->csr = pci_iomap(pdev, 2, 0); |
| 4827 | if (!adapter->csr) | 4880 | if (!adapter->csr) |
| 4828 | return -ENOMEM; | 4881 | return -ENOMEM; |
| 4829 | } | 4882 | } |
| 4830 | 4883 | ||
| 4831 | addr = pci_iomap(adapter->pdev, db_bar(adapter), 0); | 4884 | addr = pci_iomap(pdev, db_bar(adapter), 0); |
| 4832 | if (!addr) | 4885 | if (!addr) |
| 4833 | goto pci_map_err; | 4886 | goto pci_map_err; |
| 4834 | adapter->db = addr; | 4887 | adapter->db = addr; |
| 4835 | 4888 | ||
| 4889 | if (skyhawk_chip(adapter) || BEx_chip(adapter)) { | ||
| 4890 | if (be_physfn(adapter)) { | ||
| 4891 | /* PCICFG is the 2nd BAR in BE2 */ | ||
| 4892 | addr = pci_iomap(pdev, BE2_chip(adapter) ? 1 : 0, 0); | ||
| 4893 | if (!addr) | ||
| 4894 | goto pci_map_err; | ||
| 4895 | adapter->pcicfg = addr; | ||
| 4896 | } else { | ||
| 4897 | adapter->pcicfg = adapter->db + SRIOV_VF_PCICFG_OFFSET; | ||
| 4898 | } | ||
| 4899 | } | ||
| 4900 | |||
| 4836 | be_roce_map_pci_bars(adapter); | 4901 | be_roce_map_pci_bars(adapter); |
| 4837 | return 0; | 4902 | return 0; |
| 4838 | 4903 | ||
| 4839 | pci_map_err: | 4904 | pci_map_err: |
| 4840 | dev_err(&adapter->pdev->dev, "Error in mapping PCI BARs\n"); | 4905 | dev_err(&pdev->dev, "Error in mapping PCI BARs\n"); |
| 4841 | be_unmap_pci_bars(adapter); | 4906 | be_unmap_pci_bars(adapter); |
| 4842 | return -ENOMEM; | 4907 | return -ENOMEM; |
| 4843 | } | 4908 | } |
diff --git a/drivers/net/usb/cx82310_eth.c b/drivers/net/usb/cx82310_eth.c index fe48f4c51373..1762ad3910b2 100644 --- a/drivers/net/usb/cx82310_eth.c +++ b/drivers/net/usb/cx82310_eth.c | |||
| @@ -46,8 +46,7 @@ enum cx82310_status { | |||
| 46 | }; | 46 | }; |
| 47 | 47 | ||
| 48 | #define CMD_PACKET_SIZE 64 | 48 | #define CMD_PACKET_SIZE 64 |
| 49 | /* first command after power on can take around 8 seconds */ | 49 | #define CMD_TIMEOUT 100 |
| 50 | #define CMD_TIMEOUT 15000 | ||
| 51 | #define CMD_REPLY_RETRY 5 | 50 | #define CMD_REPLY_RETRY 5 |
| 52 | 51 | ||
| 53 | #define CX82310_MTU 1514 | 52 | #define CX82310_MTU 1514 |
| @@ -78,8 +77,9 @@ static int cx82310_cmd(struct usbnet *dev, enum cx82310_cmd cmd, bool reply, | |||
| 78 | ret = usb_bulk_msg(udev, usb_sndbulkpipe(udev, CMD_EP), buf, | 77 | ret = usb_bulk_msg(udev, usb_sndbulkpipe(udev, CMD_EP), buf, |
| 79 | CMD_PACKET_SIZE, &actual_len, CMD_TIMEOUT); | 78 | CMD_PACKET_SIZE, &actual_len, CMD_TIMEOUT); |
| 80 | if (ret < 0) { | 79 | if (ret < 0) { |
| 81 | dev_err(&dev->udev->dev, "send command %#x: error %d\n", | 80 | if (cmd != CMD_GET_LINK_STATUS) |
| 82 | cmd, ret); | 81 | dev_err(&dev->udev->dev, "send command %#x: error %d\n", |
| 82 | cmd, ret); | ||
| 83 | goto end; | 83 | goto end; |
| 84 | } | 84 | } |
| 85 | 85 | ||
| @@ -90,8 +90,10 @@ static int cx82310_cmd(struct usbnet *dev, enum cx82310_cmd cmd, bool reply, | |||
| 90 | buf, CMD_PACKET_SIZE, &actual_len, | 90 | buf, CMD_PACKET_SIZE, &actual_len, |
| 91 | CMD_TIMEOUT); | 91 | CMD_TIMEOUT); |
| 92 | if (ret < 0) { | 92 | if (ret < 0) { |
| 93 | dev_err(&dev->udev->dev, | 93 | if (cmd != CMD_GET_LINK_STATUS) |
| 94 | "reply receive error %d\n", ret); | 94 | dev_err(&dev->udev->dev, |
| 95 | "reply receive error %d\n", | ||
| 96 | ret); | ||
| 95 | goto end; | 97 | goto end; |
| 96 | } | 98 | } |
| 97 | if (actual_len > 0) | 99 | if (actual_len > 0) |
| @@ -134,6 +136,8 @@ static int cx82310_bind(struct usbnet *dev, struct usb_interface *intf) | |||
| 134 | int ret; | 136 | int ret; |
| 135 | char buf[15]; | 137 | char buf[15]; |
| 136 | struct usb_device *udev = dev->udev; | 138 | struct usb_device *udev = dev->udev; |
| 139 | u8 link[3]; | ||
| 140 | int timeout = 50; | ||
| 137 | 141 | ||
| 138 | /* avoid ADSL modems - continue only if iProduct is "USB NET CARD" */ | 142 | /* avoid ADSL modems - continue only if iProduct is "USB NET CARD" */ |
| 139 | if (usb_string(udev, udev->descriptor.iProduct, buf, sizeof(buf)) > 0 | 143 | if (usb_string(udev, udev->descriptor.iProduct, buf, sizeof(buf)) > 0 |
| @@ -160,6 +164,20 @@ static int cx82310_bind(struct usbnet *dev, struct usb_interface *intf) | |||
| 160 | if (!dev->partial_data) | 164 | if (!dev->partial_data) |
| 161 | return -ENOMEM; | 165 | return -ENOMEM; |
| 162 | 166 | ||
| 167 | /* wait for firmware to become ready (indicated by the link being up) */ | ||
| 168 | while (--timeout) { | ||
| 169 | ret = cx82310_cmd(dev, CMD_GET_LINK_STATUS, true, NULL, 0, | ||
| 170 | link, sizeof(link)); | ||
| 171 | /* the command can time out during boot - it's not an error */ | ||
| 172 | if (!ret && link[0] == 1 && link[2] == 1) | ||
| 173 | break; | ||
| 174 | msleep(500); | ||
| 175 | }; | ||
| 176 | if (!timeout) { | ||
| 177 | dev_err(&udev->dev, "firmware not ready in time\n"); | ||
| 178 | return -ETIMEDOUT; | ||
| 179 | } | ||
| 180 | |||
| 163 | /* enable ethernet mode (?) */ | 181 | /* enable ethernet mode (?) */ |
| 164 | ret = cx82310_cmd(dev, CMD_ETHERNET_MODE, true, "\x01", 1, NULL, 0); | 182 | ret = cx82310_cmd(dev, CMD_ETHERNET_MODE, true, "\x01", 1, NULL, 0); |
| 165 | if (ret) { | 183 | if (ret) { |
diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c index 9205f433573c..18198316b6cf 100644 --- a/drivers/regulator/palmas-regulator.c +++ b/drivers/regulator/palmas-regulator.c | |||
| @@ -1572,6 +1572,10 @@ static int palmas_regulators_probe(struct platform_device *pdev) | |||
| 1572 | if (!pmic) | 1572 | if (!pmic) |
| 1573 | return -ENOMEM; | 1573 | return -ENOMEM; |
| 1574 | 1574 | ||
| 1575 | if (of_device_is_compatible(node, "ti,tps659038-pmic")) | ||
| 1576 | palmas_generic_regs_info[PALMAS_REG_REGEN2].ctrl_addr = | ||
| 1577 | TPS659038_REGEN2_CTRL; | ||
| 1578 | |||
| 1575 | pmic->dev = &pdev->dev; | 1579 | pmic->dev = &pdev->dev; |
| 1576 | pmic->palmas = palmas; | 1580 | pmic->palmas = palmas; |
| 1577 | palmas->pmic = pmic; | 1581 | palmas->pmic = pmic; |
diff --git a/drivers/rtc/rtc-mrst.c b/drivers/rtc/rtc-mrst.c index e2436d140175..3a6fd3a8a2ec 100644 --- a/drivers/rtc/rtc-mrst.c +++ b/drivers/rtc/rtc-mrst.c | |||
| @@ -413,8 +413,8 @@ static void rtc_mrst_do_remove(struct device *dev) | |||
| 413 | mrst->dev = NULL; | 413 | mrst->dev = NULL; |
| 414 | } | 414 | } |
| 415 | 415 | ||
| 416 | #ifdef CONFIG_PM | 416 | #ifdef CONFIG_PM_SLEEP |
| 417 | static int mrst_suspend(struct device *dev, pm_message_t mesg) | 417 | static int mrst_suspend(struct device *dev) |
| 418 | { | 418 | { |
| 419 | struct mrst_rtc *mrst = dev_get_drvdata(dev); | 419 | struct mrst_rtc *mrst = dev_get_drvdata(dev); |
| 420 | unsigned char tmp; | 420 | unsigned char tmp; |
| @@ -453,7 +453,7 @@ static int mrst_suspend(struct device *dev, pm_message_t mesg) | |||
| 453 | */ | 453 | */ |
| 454 | static inline int mrst_poweroff(struct device *dev) | 454 | static inline int mrst_poweroff(struct device *dev) |
| 455 | { | 455 | { |
| 456 | return mrst_suspend(dev, PMSG_HIBERNATE); | 456 | return mrst_suspend(dev); |
| 457 | } | 457 | } |
| 458 | 458 | ||
| 459 | static int mrst_resume(struct device *dev) | 459 | static int mrst_resume(struct device *dev) |
| @@ -490,9 +490,11 @@ static int mrst_resume(struct device *dev) | |||
| 490 | return 0; | 490 | return 0; |
| 491 | } | 491 | } |
| 492 | 492 | ||
| 493 | static SIMPLE_DEV_PM_OPS(mrst_pm_ops, mrst_suspend, mrst_resume); | ||
| 494 | #define MRST_PM_OPS (&mrst_pm_ops) | ||
| 495 | |||
| 493 | #else | 496 | #else |
| 494 | #define mrst_suspend NULL | 497 | #define MRST_PM_OPS NULL |
| 495 | #define mrst_resume NULL | ||
| 496 | 498 | ||
| 497 | static inline int mrst_poweroff(struct device *dev) | 499 | static inline int mrst_poweroff(struct device *dev) |
| 498 | { | 500 | { |
| @@ -529,9 +531,8 @@ static struct platform_driver vrtc_mrst_platform_driver = { | |||
| 529 | .remove = vrtc_mrst_platform_remove, | 531 | .remove = vrtc_mrst_platform_remove, |
| 530 | .shutdown = vrtc_mrst_platform_shutdown, | 532 | .shutdown = vrtc_mrst_platform_shutdown, |
| 531 | .driver = { | 533 | .driver = { |
| 532 | .name = (char *) driver_name, | 534 | .name = driver_name, |
| 533 | .suspend = mrst_suspend, | 535 | .pm = MRST_PM_OPS, |
| 534 | .resume = mrst_resume, | ||
| 535 | } | 536 | } |
| 536 | }; | 537 | }; |
| 537 | 538 | ||
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index 9219953ee949..d9afc51af7d3 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c | |||
| @@ -6815,7 +6815,8 @@ static struct ata_port_operations ipr_sata_ops = { | |||
| 6815 | }; | 6815 | }; |
| 6816 | 6816 | ||
| 6817 | static struct ata_port_info sata_port_info = { | 6817 | static struct ata_port_info sata_port_info = { |
| 6818 | .flags = ATA_FLAG_SATA | ATA_FLAG_PIO_DMA, | 6818 | .flags = ATA_FLAG_SATA | ATA_FLAG_PIO_DMA | |
| 6819 | ATA_FLAG_SAS_HOST, | ||
| 6819 | .pio_mask = ATA_PIO4_ONLY, | 6820 | .pio_mask = ATA_PIO4_ONLY, |
| 6820 | .mwdma_mask = ATA_MWDMA2, | 6821 | .mwdma_mask = ATA_MWDMA2, |
| 6821 | .udma_mask = ATA_UDMA6, | 6822 | .udma_mask = ATA_UDMA6, |
diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c index 932d9cc98d2f..9c706d8c1441 100644 --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c | |||
| @@ -547,7 +547,8 @@ static struct ata_port_operations sas_sata_ops = { | |||
| 547 | }; | 547 | }; |
| 548 | 548 | ||
| 549 | static struct ata_port_info sata_port_info = { | 549 | static struct ata_port_info sata_port_info = { |
| 550 | .flags = ATA_FLAG_SATA | ATA_FLAG_PIO_DMA | ATA_FLAG_NCQ, | 550 | .flags = ATA_FLAG_SATA | ATA_FLAG_PIO_DMA | ATA_FLAG_NCQ | |
| 551 | ATA_FLAG_SAS_HOST, | ||
| 551 | .pio_mask = ATA_PIO4, | 552 | .pio_mask = ATA_PIO4, |
| 552 | .mwdma_mask = ATA_MWDMA2, | 553 | .mwdma_mask = ATA_MWDMA2, |
| 553 | .udma_mask = ATA_UDMA6, | 554 | .udma_mask = ATA_UDMA6, |
diff --git a/drivers/spi/spi-dw-mid.c b/drivers/spi/spi-dw-mid.c index 3ce39d10fafb..4f8c798e0633 100644 --- a/drivers/spi/spi-dw-mid.c +++ b/drivers/spi/spi-dw-mid.c | |||
| @@ -108,7 +108,8 @@ static void dw_spi_dma_tx_done(void *arg) | |||
| 108 | { | 108 | { |
| 109 | struct dw_spi *dws = arg; | 109 | struct dw_spi *dws = arg; |
| 110 | 110 | ||
| 111 | if (test_and_clear_bit(TX_BUSY, &dws->dma_chan_busy) & BIT(RX_BUSY)) | 111 | clear_bit(TX_BUSY, &dws->dma_chan_busy); |
| 112 | if (test_bit(RX_BUSY, &dws->dma_chan_busy)) | ||
| 112 | return; | 113 | return; |
| 113 | dw_spi_xfer_done(dws); | 114 | dw_spi_xfer_done(dws); |
| 114 | } | 115 | } |
| @@ -156,7 +157,8 @@ static void dw_spi_dma_rx_done(void *arg) | |||
| 156 | { | 157 | { |
| 157 | struct dw_spi *dws = arg; | 158 | struct dw_spi *dws = arg; |
| 158 | 159 | ||
| 159 | if (test_and_clear_bit(RX_BUSY, &dws->dma_chan_busy) & BIT(TX_BUSY)) | 160 | clear_bit(RX_BUSY, &dws->dma_chan_busy); |
| 161 | if (test_bit(TX_BUSY, &dws->dma_chan_busy)) | ||
| 160 | return; | 162 | return; |
| 161 | dw_spi_xfer_done(dws); | 163 | dw_spi_xfer_done(dws); |
| 162 | } | 164 | } |
diff --git a/drivers/spi/spi-qup.c b/drivers/spi/spi-qup.c index ff9cdbdb6672..2b2c359f5a50 100644 --- a/drivers/spi/spi-qup.c +++ b/drivers/spi/spi-qup.c | |||
| @@ -498,7 +498,7 @@ static int spi_qup_probe(struct platform_device *pdev) | |||
| 498 | struct resource *res; | 498 | struct resource *res; |
| 499 | struct device *dev; | 499 | struct device *dev; |
| 500 | void __iomem *base; | 500 | void __iomem *base; |
| 501 | u32 max_freq, iomode; | 501 | u32 max_freq, iomode, num_cs; |
| 502 | int ret, irq, size; | 502 | int ret, irq, size; |
| 503 | 503 | ||
| 504 | dev = &pdev->dev; | 504 | dev = &pdev->dev; |
| @@ -550,10 +550,11 @@ static int spi_qup_probe(struct platform_device *pdev) | |||
| 550 | } | 550 | } |
| 551 | 551 | ||
| 552 | /* use num-cs unless not present or out of range */ | 552 | /* use num-cs unless not present or out of range */ |
| 553 | if (of_property_read_u16(dev->of_node, "num-cs", | 553 | if (of_property_read_u32(dev->of_node, "num-cs", &num_cs) || |
| 554 | &master->num_chipselect) || | 554 | num_cs > SPI_NUM_CHIPSELECTS) |
| 555 | (master->num_chipselect > SPI_NUM_CHIPSELECTS)) | ||
| 556 | master->num_chipselect = SPI_NUM_CHIPSELECTS; | 555 | master->num_chipselect = SPI_NUM_CHIPSELECTS; |
| 556 | else | ||
| 557 | master->num_chipselect = num_cs; | ||
| 557 | 558 | ||
| 558 | master->bus_num = pdev->id; | 559 | master->bus_num = pdev->id; |
| 559 | master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LOOP; | 560 | master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LOOP; |
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index c64a3e59fce3..57a195041dc7 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
| @@ -1105,13 +1105,14 @@ void spi_finalize_current_message(struct spi_master *master) | |||
| 1105 | "failed to unprepare message: %d\n", ret); | 1105 | "failed to unprepare message: %d\n", ret); |
| 1106 | } | 1106 | } |
| 1107 | } | 1107 | } |
| 1108 | |||
| 1109 | trace_spi_message_done(mesg); | ||
| 1110 | |||
| 1108 | master->cur_msg_prepared = false; | 1111 | master->cur_msg_prepared = false; |
| 1109 | 1112 | ||
| 1110 | mesg->state = NULL; | 1113 | mesg->state = NULL; |
| 1111 | if (mesg->complete) | 1114 | if (mesg->complete) |
| 1112 | mesg->complete(mesg->context); | 1115 | mesg->complete(mesg->context); |
| 1113 | |||
| 1114 | trace_spi_message_done(mesg); | ||
| 1115 | } | 1116 | } |
| 1116 | EXPORT_SYMBOL_GPL(spi_finalize_current_message); | 1117 | EXPORT_SYMBOL_GPL(spi_finalize_current_message); |
| 1117 | 1118 | ||
diff --git a/drivers/watchdog/imgpdc_wdt.c b/drivers/watchdog/imgpdc_wdt.c index c8def68d9e4c..0deaa4f971f5 100644 --- a/drivers/watchdog/imgpdc_wdt.c +++ b/drivers/watchdog/imgpdc_wdt.c | |||
| @@ -42,10 +42,10 @@ | |||
| 42 | #define PDC_WDT_MIN_TIMEOUT 1 | 42 | #define PDC_WDT_MIN_TIMEOUT 1 |
| 43 | #define PDC_WDT_DEF_TIMEOUT 64 | 43 | #define PDC_WDT_DEF_TIMEOUT 64 |
| 44 | 44 | ||
| 45 | static int heartbeat; | 45 | static int heartbeat = PDC_WDT_DEF_TIMEOUT; |
| 46 | module_param(heartbeat, int, 0); | 46 | module_param(heartbeat, int, 0); |
| 47 | MODULE_PARM_DESC(heartbeat, "Watchdog heartbeats in seconds. " | 47 | MODULE_PARM_DESC(heartbeat, "Watchdog heartbeats in seconds " |
| 48 | "(default = " __MODULE_STRING(PDC_WDT_DEF_TIMEOUT) ")"); | 48 | "(default=" __MODULE_STRING(PDC_WDT_DEF_TIMEOUT) ")"); |
| 49 | 49 | ||
| 50 | static bool nowayout = WATCHDOG_NOWAYOUT; | 50 | static bool nowayout = WATCHDOG_NOWAYOUT; |
| 51 | module_param(nowayout, bool, 0); | 51 | module_param(nowayout, bool, 0); |
| @@ -191,6 +191,7 @@ static int pdc_wdt_probe(struct platform_device *pdev) | |||
| 191 | pdc_wdt->wdt_dev.ops = &pdc_wdt_ops; | 191 | pdc_wdt->wdt_dev.ops = &pdc_wdt_ops; |
| 192 | pdc_wdt->wdt_dev.max_timeout = 1 << PDC_WDT_CONFIG_DELAY_MASK; | 192 | pdc_wdt->wdt_dev.max_timeout = 1 << PDC_WDT_CONFIG_DELAY_MASK; |
| 193 | pdc_wdt->wdt_dev.parent = &pdev->dev; | 193 | pdc_wdt->wdt_dev.parent = &pdev->dev; |
| 194 | watchdog_set_drvdata(&pdc_wdt->wdt_dev, pdc_wdt); | ||
| 194 | 195 | ||
| 195 | ret = watchdog_init_timeout(&pdc_wdt->wdt_dev, heartbeat, &pdev->dev); | 196 | ret = watchdog_init_timeout(&pdc_wdt->wdt_dev, heartbeat, &pdev->dev); |
| 196 | if (ret < 0) { | 197 | if (ret < 0) { |
| @@ -232,7 +233,6 @@ static int pdc_wdt_probe(struct platform_device *pdev) | |||
| 232 | watchdog_set_nowayout(&pdc_wdt->wdt_dev, nowayout); | 233 | watchdog_set_nowayout(&pdc_wdt->wdt_dev, nowayout); |
| 233 | 234 | ||
| 234 | platform_set_drvdata(pdev, pdc_wdt); | 235 | platform_set_drvdata(pdev, pdc_wdt); |
| 235 | watchdog_set_drvdata(&pdc_wdt->wdt_dev, pdc_wdt); | ||
| 236 | 236 | ||
| 237 | ret = watchdog_register_device(&pdc_wdt->wdt_dev); | 237 | ret = watchdog_register_device(&pdc_wdt->wdt_dev); |
| 238 | if (ret) | 238 | if (ret) |
diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c index a87f6df6e85f..938b987de551 100644 --- a/drivers/watchdog/mtk_wdt.c +++ b/drivers/watchdog/mtk_wdt.c | |||
| @@ -133,7 +133,7 @@ static int mtk_wdt_start(struct watchdog_device *wdt_dev) | |||
| 133 | u32 reg; | 133 | u32 reg; |
| 134 | struct mtk_wdt_dev *mtk_wdt = watchdog_get_drvdata(wdt_dev); | 134 | struct mtk_wdt_dev *mtk_wdt = watchdog_get_drvdata(wdt_dev); |
| 135 | void __iomem *wdt_base = mtk_wdt->wdt_base; | 135 | void __iomem *wdt_base = mtk_wdt->wdt_base; |
| 136 | u32 ret; | 136 | int ret; |
| 137 | 137 | ||
| 138 | ret = mtk_wdt_set_timeout(wdt_dev, wdt_dev->timeout); | 138 | ret = mtk_wdt_set_timeout(wdt_dev, wdt_dev->timeout); |
| 139 | if (ret < 0) | 139 | if (ret < 0) |
diff --git a/fs/affs/file.c b/fs/affs/file.c index d2468bf95669..a91795e01a7f 100644 --- a/fs/affs/file.c +++ b/fs/affs/file.c | |||
| @@ -699,8 +699,10 @@ static int affs_write_end_ofs(struct file *file, struct address_space *mapping, | |||
| 699 | boff = tmp % bsize; | 699 | boff = tmp % bsize; |
| 700 | if (boff) { | 700 | if (boff) { |
| 701 | bh = affs_bread_ino(inode, bidx, 0); | 701 | bh = affs_bread_ino(inode, bidx, 0); |
| 702 | if (IS_ERR(bh)) | 702 | if (IS_ERR(bh)) { |
| 703 | return PTR_ERR(bh); | 703 | written = PTR_ERR(bh); |
| 704 | goto err_first_bh; | ||
| 705 | } | ||
| 704 | tmp = min(bsize - boff, to - from); | 706 | tmp = min(bsize - boff, to - from); |
| 705 | BUG_ON(boff + tmp > bsize || tmp > bsize); | 707 | BUG_ON(boff + tmp > bsize || tmp > bsize); |
| 706 | memcpy(AFFS_DATA(bh) + boff, data + from, tmp); | 708 | memcpy(AFFS_DATA(bh) + boff, data + from, tmp); |
| @@ -712,14 +714,16 @@ static int affs_write_end_ofs(struct file *file, struct address_space *mapping, | |||
| 712 | bidx++; | 714 | bidx++; |
| 713 | } else if (bidx) { | 715 | } else if (bidx) { |
| 714 | bh = affs_bread_ino(inode, bidx - 1, 0); | 716 | bh = affs_bread_ino(inode, bidx - 1, 0); |
| 715 | if (IS_ERR(bh)) | 717 | if (IS_ERR(bh)) { |
| 716 | return PTR_ERR(bh); | 718 | written = PTR_ERR(bh); |
| 719 | goto err_first_bh; | ||
| 720 | } | ||
| 717 | } | 721 | } |
| 718 | while (from + bsize <= to) { | 722 | while (from + bsize <= to) { |
| 719 | prev_bh = bh; | 723 | prev_bh = bh; |
| 720 | bh = affs_getemptyblk_ino(inode, bidx); | 724 | bh = affs_getemptyblk_ino(inode, bidx); |
| 721 | if (IS_ERR(bh)) | 725 | if (IS_ERR(bh)) |
| 722 | goto out; | 726 | goto err_bh; |
| 723 | memcpy(AFFS_DATA(bh), data + from, bsize); | 727 | memcpy(AFFS_DATA(bh), data + from, bsize); |
| 724 | if (buffer_new(bh)) { | 728 | if (buffer_new(bh)) { |
| 725 | AFFS_DATA_HEAD(bh)->ptype = cpu_to_be32(T_DATA); | 729 | AFFS_DATA_HEAD(bh)->ptype = cpu_to_be32(T_DATA); |
| @@ -751,7 +755,7 @@ static int affs_write_end_ofs(struct file *file, struct address_space *mapping, | |||
| 751 | prev_bh = bh; | 755 | prev_bh = bh; |
| 752 | bh = affs_bread_ino(inode, bidx, 1); | 756 | bh = affs_bread_ino(inode, bidx, 1); |
| 753 | if (IS_ERR(bh)) | 757 | if (IS_ERR(bh)) |
| 754 | goto out; | 758 | goto err_bh; |
| 755 | tmp = min(bsize, to - from); | 759 | tmp = min(bsize, to - from); |
| 756 | BUG_ON(tmp > bsize); | 760 | BUG_ON(tmp > bsize); |
| 757 | memcpy(AFFS_DATA(bh), data + from, tmp); | 761 | memcpy(AFFS_DATA(bh), data + from, tmp); |
| @@ -790,12 +794,13 @@ done: | |||
| 790 | if (tmp > inode->i_size) | 794 | if (tmp > inode->i_size) |
| 791 | inode->i_size = AFFS_I(inode)->mmu_private = tmp; | 795 | inode->i_size = AFFS_I(inode)->mmu_private = tmp; |
| 792 | 796 | ||
| 797 | err_first_bh: | ||
| 793 | unlock_page(page); | 798 | unlock_page(page); |
| 794 | page_cache_release(page); | 799 | page_cache_release(page); |
| 795 | 800 | ||
| 796 | return written; | 801 | return written; |
| 797 | 802 | ||
| 798 | out: | 803 | err_bh: |
| 799 | bh = prev_bh; | 804 | bh = prev_bh; |
| 800 | if (!written) | 805 | if (!written) |
| 801 | written = PTR_ERR(bh); | 806 | written = PTR_ERR(bh); |
diff --git a/fs/hfsplus/brec.c b/fs/hfsplus/brec.c index 6e560d56094b..754fdf8c6356 100644 --- a/fs/hfsplus/brec.c +++ b/fs/hfsplus/brec.c | |||
| @@ -131,13 +131,16 @@ skip: | |||
| 131 | hfs_bnode_write(node, entry, data_off + key_len, entry_len); | 131 | hfs_bnode_write(node, entry, data_off + key_len, entry_len); |
| 132 | hfs_bnode_dump(node); | 132 | hfs_bnode_dump(node); |
| 133 | 133 | ||
| 134 | if (new_node) { | 134 | /* |
| 135 | /* update parent key if we inserted a key | 135 | * update parent key if we inserted a key |
| 136 | * at the start of the first node | 136 | * at the start of the node and it is not the new node |
| 137 | */ | 137 | */ |
| 138 | if (!rec && new_node != node) | 138 | if (!rec && new_node != node) { |
| 139 | hfs_brec_update_parent(fd); | 139 | hfs_bnode_read_key(node, fd->search_key, data_off + size); |
| 140 | hfs_brec_update_parent(fd); | ||
| 141 | } | ||
| 140 | 142 | ||
| 143 | if (new_node) { | ||
| 141 | hfs_bnode_put(fd->bnode); | 144 | hfs_bnode_put(fd->bnode); |
| 142 | if (!new_node->parent) { | 145 | if (!new_node->parent) { |
| 143 | hfs_btree_inc_height(tree); | 146 | hfs_btree_inc_height(tree); |
| @@ -168,9 +171,6 @@ skip: | |||
| 168 | goto again; | 171 | goto again; |
| 169 | } | 172 | } |
| 170 | 173 | ||
| 171 | if (!rec) | ||
| 172 | hfs_brec_update_parent(fd); | ||
| 173 | |||
| 174 | return 0; | 174 | return 0; |
| 175 | } | 175 | } |
| 176 | 176 | ||
| @@ -370,6 +370,8 @@ again: | |||
| 370 | if (IS_ERR(parent)) | 370 | if (IS_ERR(parent)) |
| 371 | return PTR_ERR(parent); | 371 | return PTR_ERR(parent); |
| 372 | __hfs_brec_find(parent, fd, hfs_find_rec_by_key); | 372 | __hfs_brec_find(parent, fd, hfs_find_rec_by_key); |
| 373 | if (fd->record < 0) | ||
| 374 | return -ENOENT; | ||
| 373 | hfs_bnode_dump(parent); | 375 | hfs_bnode_dump(parent); |
| 374 | rec = fd->record; | 376 | rec = fd->record; |
| 375 | 377 | ||
diff --git a/include/linux/libata.h b/include/linux/libata.h index fc03efa64ffe..6b08cc106c21 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
| @@ -232,6 +232,7 @@ enum { | |||
| 232 | * led */ | 232 | * led */ |
| 233 | ATA_FLAG_NO_DIPM = (1 << 23), /* host not happy with DIPM */ | 233 | ATA_FLAG_NO_DIPM = (1 << 23), /* host not happy with DIPM */ |
| 234 | ATA_FLAG_LOWTAG = (1 << 24), /* host wants lowest available tag */ | 234 | ATA_FLAG_LOWTAG = (1 << 24), /* host wants lowest available tag */ |
| 235 | ATA_FLAG_SAS_HOST = (1 << 25), /* SAS host */ | ||
| 235 | 236 | ||
| 236 | /* bits 24:31 of ap->flags are reserved for LLD specific flags */ | 237 | /* bits 24:31 of ap->flags are reserved for LLD specific flags */ |
| 237 | 238 | ||
diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h index fb0390a1a498..ee7b1ce7a6f8 100644 --- a/include/linux/mfd/palmas.h +++ b/include/linux/mfd/palmas.h | |||
| @@ -2999,6 +2999,9 @@ enum usb_irq_events { | |||
| 2999 | #define PALMAS_GPADC_TRIM15 0x0E | 2999 | #define PALMAS_GPADC_TRIM15 0x0E |
| 3000 | #define PALMAS_GPADC_TRIM16 0x0F | 3000 | #define PALMAS_GPADC_TRIM16 0x0F |
| 3001 | 3001 | ||
| 3002 | /* TPS659038 regen2_ctrl offset iss different from palmas */ | ||
| 3003 | #define TPS659038_REGEN2_CTRL 0x12 | ||
| 3004 | |||
| 3002 | /* TPS65917 Interrupt registers */ | 3005 | /* TPS65917 Interrupt registers */ |
| 3003 | 3006 | ||
| 3004 | /* Registers for function INTERRUPT */ | 3007 | /* Registers for function INTERRUPT */ |
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h index d4ad5b5a02bb..045f709cb89b 100644 --- a/include/linux/regulator/driver.h +++ b/include/linux/regulator/driver.h | |||
| @@ -316,7 +316,7 @@ struct regulator_desc { | |||
| 316 | * @driver_data: private regulator data | 316 | * @driver_data: private regulator data |
| 317 | * @of_node: OpenFirmware node to parse for device tree bindings (may be | 317 | * @of_node: OpenFirmware node to parse for device tree bindings (may be |
| 318 | * NULL). | 318 | * NULL). |
| 319 | * @regmap: regmap to use for core regmap helpers if dev_get_regulator() is | 319 | * @regmap: regmap to use for core regmap helpers if dev_get_regmap() is |
| 320 | * insufficient. | 320 | * insufficient. |
| 321 | * @ena_gpio_initialized: GPIO controlling regulator enable was properly | 321 | * @ena_gpio_initialized: GPIO controlling regulator enable was properly |
| 322 | * initialized, meaning that >= 0 is a valid gpio | 322 | * initialized, meaning that >= 0 is a valid gpio |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 6d77432e14ff..a419b65770d6 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
| @@ -1625,11 +1625,11 @@ struct task_struct { | |||
| 1625 | 1625 | ||
| 1626 | /* | 1626 | /* |
| 1627 | * numa_faults_locality tracks if faults recorded during the last | 1627 | * numa_faults_locality tracks if faults recorded during the last |
| 1628 | * scan window were remote/local. The task scan period is adapted | 1628 | * scan window were remote/local or failed to migrate. The task scan |
| 1629 | * based on the locality of the faults with different weights | 1629 | * period is adapted based on the locality of the faults with different |
| 1630 | * depending on whether they were shared or private faults | 1630 | * weights depending on whether they were shared or private faults |
| 1631 | */ | 1631 | */ |
| 1632 | unsigned long numa_faults_locality[2]; | 1632 | unsigned long numa_faults_locality[3]; |
| 1633 | 1633 | ||
| 1634 | unsigned long numa_pages_migrated; | 1634 | unsigned long numa_pages_migrated; |
| 1635 | #endif /* CONFIG_NUMA_BALANCING */ | 1635 | #endif /* CONFIG_NUMA_BALANCING */ |
| @@ -1719,6 +1719,7 @@ struct task_struct { | |||
| 1719 | #define TNF_NO_GROUP 0x02 | 1719 | #define TNF_NO_GROUP 0x02 |
| 1720 | #define TNF_SHARED 0x04 | 1720 | #define TNF_SHARED 0x04 |
| 1721 | #define TNF_FAULT_LOCAL 0x08 | 1721 | #define TNF_FAULT_LOCAL 0x08 |
| 1722 | #define TNF_MIGRATE_FAIL 0x10 | ||
| 1722 | 1723 | ||
| 1723 | #ifdef CONFIG_NUMA_BALANCING | 1724 | #ifdef CONFIG_NUMA_BALANCING |
| 1724 | extern void task_numa_fault(int last_node, int node, int pages, int flags); | 1725 | extern void task_numa_fault(int last_node, int node, int pages, int flags); |
diff --git a/include/net/netfilter/nf_log.h b/include/net/netfilter/nf_log.h index 534e1f2ac4fc..57639fca223a 100644 --- a/include/net/netfilter/nf_log.h +++ b/include/net/netfilter/nf_log.h | |||
| @@ -79,6 +79,16 @@ void nf_log_packet(struct net *net, | |||
| 79 | const struct nf_loginfo *li, | 79 | const struct nf_loginfo *li, |
| 80 | const char *fmt, ...); | 80 | const char *fmt, ...); |
| 81 | 81 | ||
| 82 | __printf(8, 9) | ||
| 83 | void nf_log_trace(struct net *net, | ||
| 84 | u_int8_t pf, | ||
| 85 | unsigned int hooknum, | ||
| 86 | const struct sk_buff *skb, | ||
| 87 | const struct net_device *in, | ||
| 88 | const struct net_device *out, | ||
| 89 | const struct nf_loginfo *li, | ||
| 90 | const char *fmt, ...); | ||
| 91 | |||
| 82 | struct nf_log_buf; | 92 | struct nf_log_buf; |
| 83 | 93 | ||
| 84 | struct nf_log_buf *nf_log_buf_open(void); | 94 | struct nf_log_buf *nf_log_buf_open(void); |
diff --git a/include/trace/events/regmap.h b/include/trace/events/regmap.h index 23d561512f64..22317d2b52ab 100644 --- a/include/trace/events/regmap.h +++ b/include/trace/events/regmap.h | |||
| @@ -7,27 +7,26 @@ | |||
| 7 | #include <linux/ktime.h> | 7 | #include <linux/ktime.h> |
| 8 | #include <linux/tracepoint.h> | 8 | #include <linux/tracepoint.h> |
| 9 | 9 | ||
| 10 | struct device; | 10 | #include "../../../drivers/base/regmap/internal.h" |
| 11 | struct regmap; | ||
| 12 | 11 | ||
| 13 | /* | 12 | /* |
| 14 | * Log register events | 13 | * Log register events |
| 15 | */ | 14 | */ |
| 16 | DECLARE_EVENT_CLASS(regmap_reg, | 15 | DECLARE_EVENT_CLASS(regmap_reg, |
| 17 | 16 | ||
| 18 | TP_PROTO(struct device *dev, unsigned int reg, | 17 | TP_PROTO(struct regmap *map, unsigned int reg, |
| 19 | unsigned int val), | 18 | unsigned int val), |
| 20 | 19 | ||
| 21 | TP_ARGS(dev, reg, val), | 20 | TP_ARGS(map, reg, val), |
| 22 | 21 | ||
| 23 | TP_STRUCT__entry( | 22 | TP_STRUCT__entry( |
| 24 | __string( name, dev_name(dev) ) | 23 | __string( name, regmap_name(map) ) |
| 25 | __field( unsigned int, reg ) | 24 | __field( unsigned int, reg ) |
| 26 | __field( unsigned int, val ) | 25 | __field( unsigned int, val ) |
| 27 | ), | 26 | ), |
| 28 | 27 | ||
| 29 | TP_fast_assign( | 28 | TP_fast_assign( |
| 30 | __assign_str(name, dev_name(dev)); | 29 | __assign_str(name, regmap_name(map)); |
| 31 | __entry->reg = reg; | 30 | __entry->reg = reg; |
| 32 | __entry->val = val; | 31 | __entry->val = val; |
| 33 | ), | 32 | ), |
| @@ -39,45 +38,45 @@ DECLARE_EVENT_CLASS(regmap_reg, | |||
| 39 | 38 | ||
| 40 | DEFINE_EVENT(regmap_reg, regmap_reg_write, | 39 | DEFINE_EVENT(regmap_reg, regmap_reg_write, |
| 41 | 40 | ||
| 42 | TP_PROTO(struct device *dev, unsigned int reg, | 41 | TP_PROTO(struct regmap *map, unsigned int reg, |
| 43 | unsigned int val), | 42 | unsigned int val), |
| 44 | 43 | ||
| 45 | TP_ARGS(dev, reg, val) | 44 | TP_ARGS(map, reg, val) |
| 46 | 45 | ||
| 47 | ); | 46 | ); |
| 48 | 47 | ||
| 49 | DEFINE_EVENT(regmap_reg, regmap_reg_read, | 48 | DEFINE_EVENT(regmap_reg, regmap_reg_read, |
| 50 | 49 | ||
| 51 | TP_PROTO(struct device *dev, unsigned int reg, | 50 | TP_PROTO(struct regmap *map, unsigned int reg, |
| 52 | unsigned int val), | 51 | unsigned int val), |
| 53 | 52 | ||
| 54 | TP_ARGS(dev, reg, val) | 53 | TP_ARGS(map, reg, val) |
| 55 | 54 | ||
| 56 | ); | 55 | ); |
| 57 | 56 | ||
| 58 | DEFINE_EVENT(regmap_reg, regmap_reg_read_cache, | 57 | DEFINE_EVENT(regmap_reg, regmap_reg_read_cache, |
| 59 | 58 | ||
| 60 | TP_PROTO(struct device *dev, unsigned int reg, | 59 | TP_PROTO(struct regmap *map, unsigned int reg, |
| 61 | unsigned int val), | 60 | unsigned int val), |
| 62 | 61 | ||
| 63 | TP_ARGS(dev, reg, val) | 62 | TP_ARGS(map, reg, val) |
| 64 | 63 | ||
| 65 | ); | 64 | ); |
| 66 | 65 | ||
| 67 | DECLARE_EVENT_CLASS(regmap_block, | 66 | DECLARE_EVENT_CLASS(regmap_block, |
| 68 | 67 | ||
| 69 | TP_PROTO(struct device *dev, unsigned int reg, int count), | 68 | TP_PROTO(struct regmap *map, unsigned int reg, int count), |
| 70 | 69 | ||
| 71 | TP_ARGS(dev, reg, count), | 70 | TP_ARGS(map, reg, count), |
| 72 | 71 | ||
| 73 | TP_STRUCT__entry( | 72 | TP_STRUCT__entry( |
| 74 | __string( name, dev_name(dev) ) | 73 | __string( name, regmap_name(map) ) |
| 75 | __field( unsigned int, reg ) | 74 | __field( unsigned int, reg ) |
| 76 | __field( int, count ) | 75 | __field( int, count ) |
| 77 | ), | 76 | ), |
| 78 | 77 | ||
| 79 | TP_fast_assign( | 78 | TP_fast_assign( |
| 80 | __assign_str(name, dev_name(dev)); | 79 | __assign_str(name, regmap_name(map)); |
| 81 | __entry->reg = reg; | 80 | __entry->reg = reg; |
| 82 | __entry->count = count; | 81 | __entry->count = count; |
| 83 | ), | 82 | ), |
| @@ -89,48 +88,48 @@ DECLARE_EVENT_CLASS(regmap_block, | |||
| 89 | 88 | ||
| 90 | DEFINE_EVENT(regmap_block, regmap_hw_read_start, | 89 | DEFINE_EVENT(regmap_block, regmap_hw_read_start, |
| 91 | 90 | ||
| 92 | TP_PROTO(struct device *dev, unsigned int reg, int count), | 91 | TP_PROTO(struct regmap *map, unsigned int reg, int count), |
| 93 | 92 | ||
| 94 | TP_ARGS(dev, reg, count) | 93 | TP_ARGS(map, reg, count) |
| 95 | ); | 94 | ); |
| 96 | 95 | ||
| 97 | DEFINE_EVENT(regmap_block, regmap_hw_read_done, | 96 | DEFINE_EVENT(regmap_block, regmap_hw_read_done, |
| 98 | 97 | ||
| 99 | TP_PROTO(struct device *dev, unsigned int reg, int count), | 98 | TP_PROTO(struct regmap *map, unsigned int reg, int count), |
| 100 | 99 | ||
| 101 | TP_ARGS(dev, reg, count) | 100 | TP_ARGS(map, reg, count) |
| 102 | ); | 101 | ); |
| 103 | 102 | ||
| 104 | DEFINE_EVENT(regmap_block, regmap_hw_write_start, | 103 | DEFINE_EVENT(regmap_block, regmap_hw_write_start, |
| 105 | 104 | ||
| 106 | TP_PROTO(struct device *dev, unsigned int reg, int count), | 105 | TP_PROTO(struct regmap *map, unsigned int reg, int count), |
| 107 | 106 | ||
| 108 | TP_ARGS(dev, reg, count) | 107 | TP_ARGS(map, reg, count) |
| 109 | ); | 108 | ); |
| 110 | 109 | ||
| 111 | DEFINE_EVENT(regmap_block, regmap_hw_write_done, | 110 | DEFINE_EVENT(regmap_block, regmap_hw_write_done, |
| 112 | 111 | ||
| 113 | TP_PROTO(struct device *dev, unsigned int reg, int count), | 112 | TP_PROTO(struct regmap *map, unsigned int reg, int count), |
| 114 | 113 | ||
| 115 | TP_ARGS(dev, reg, count) | 114 | TP_ARGS(map, reg, count) |
| 116 | ); | 115 | ); |
| 117 | 116 | ||
| 118 | TRACE_EVENT(regcache_sync, | 117 | TRACE_EVENT(regcache_sync, |
| 119 | 118 | ||
| 120 | TP_PROTO(struct device *dev, const char *type, | 119 | TP_PROTO(struct regmap *map, const char *type, |
| 121 | const char *status), | 120 | const char *status), |
| 122 | 121 | ||
| 123 | TP_ARGS(dev, type, status), | 122 | TP_ARGS(map, type, status), |
| 124 | 123 | ||
| 125 | TP_STRUCT__entry( | 124 | TP_STRUCT__entry( |
| 126 | __string( name, dev_name(dev) ) | 125 | __string( name, regmap_name(map) ) |
| 127 | __string( status, status ) | 126 | __string( status, status ) |
| 128 | __string( type, type ) | 127 | __string( type, type ) |
| 129 | __field( int, type ) | 128 | __field( int, type ) |
| 130 | ), | 129 | ), |
| 131 | 130 | ||
| 132 | TP_fast_assign( | 131 | TP_fast_assign( |
| 133 | __assign_str(name, dev_name(dev)); | 132 | __assign_str(name, regmap_name(map)); |
| 134 | __assign_str(status, status); | 133 | __assign_str(status, status); |
| 135 | __assign_str(type, type); | 134 | __assign_str(type, type); |
| 136 | ), | 135 | ), |
| @@ -141,17 +140,17 @@ TRACE_EVENT(regcache_sync, | |||
| 141 | 140 | ||
| 142 | DECLARE_EVENT_CLASS(regmap_bool, | 141 | DECLARE_EVENT_CLASS(regmap_bool, |
| 143 | 142 | ||
| 144 | TP_PROTO(struct device *dev, bool flag), | 143 | TP_PROTO(struct regmap *map, bool flag), |
| 145 | 144 | ||
| 146 | TP_ARGS(dev, flag), | 145 | TP_ARGS(map, flag), |
| 147 | 146 | ||
| 148 | TP_STRUCT__entry( | 147 | TP_STRUCT__entry( |
| 149 | __string( name, dev_name(dev) ) | 148 | __string( name, regmap_name(map) ) |
| 150 | __field( int, flag ) | 149 | __field( int, flag ) |
| 151 | ), | 150 | ), |
| 152 | 151 | ||
| 153 | TP_fast_assign( | 152 | TP_fast_assign( |
| 154 | __assign_str(name, dev_name(dev)); | 153 | __assign_str(name, regmap_name(map)); |
| 155 | __entry->flag = flag; | 154 | __entry->flag = flag; |
| 156 | ), | 155 | ), |
| 157 | 156 | ||
| @@ -161,32 +160,32 @@ DECLARE_EVENT_CLASS(regmap_bool, | |||
| 161 | 160 | ||
| 162 | DEFINE_EVENT(regmap_bool, regmap_cache_only, | 161 | DEFINE_EVENT(regmap_bool, regmap_cache_only, |
| 163 | 162 | ||
| 164 | TP_PROTO(struct device *dev, bool flag), | 163 | TP_PROTO(struct regmap *map, bool flag), |
| 165 | 164 | ||
| 166 | TP_ARGS(dev, flag) | 165 | TP_ARGS(map, flag) |
| 167 | 166 | ||
| 168 | ); | 167 | ); |
| 169 | 168 | ||
| 170 | DEFINE_EVENT(regmap_bool, regmap_cache_bypass, | 169 | DEFINE_EVENT(regmap_bool, regmap_cache_bypass, |
| 171 | 170 | ||
| 172 | TP_PROTO(struct device *dev, bool flag), | 171 | TP_PROTO(struct regmap *map, bool flag), |
| 173 | 172 | ||
| 174 | TP_ARGS(dev, flag) | 173 | TP_ARGS(map, flag) |
| 175 | 174 | ||
| 176 | ); | 175 | ); |
| 177 | 176 | ||
| 178 | DECLARE_EVENT_CLASS(regmap_async, | 177 | DECLARE_EVENT_CLASS(regmap_async, |
| 179 | 178 | ||
| 180 | TP_PROTO(struct device *dev), | 179 | TP_PROTO(struct regmap *map), |
| 181 | 180 | ||
| 182 | TP_ARGS(dev), | 181 | TP_ARGS(map), |
| 183 | 182 | ||
| 184 | TP_STRUCT__entry( | 183 | TP_STRUCT__entry( |
| 185 | __string( name, dev_name(dev) ) | 184 | __string( name, regmap_name(map) ) |
| 186 | ), | 185 | ), |
| 187 | 186 | ||
| 188 | TP_fast_assign( | 187 | TP_fast_assign( |
| 189 | __assign_str(name, dev_name(dev)); | 188 | __assign_str(name, regmap_name(map)); |
| 190 | ), | 189 | ), |
| 191 | 190 | ||
| 192 | TP_printk("%s", __get_str(name)) | 191 | TP_printk("%s", __get_str(name)) |
| @@ -194,50 +193,50 @@ DECLARE_EVENT_CLASS(regmap_async, | |||
| 194 | 193 | ||
| 195 | DEFINE_EVENT(regmap_block, regmap_async_write_start, | 194 | DEFINE_EVENT(regmap_block, regmap_async_write_start, |
| 196 | 195 | ||
| 197 | TP_PROTO(struct device *dev, unsigned int reg, int count), | 196 | TP_PROTO(struct regmap *map, unsigned int reg, int count), |
| 198 | 197 | ||
| 199 | TP_ARGS(dev, reg, count) | 198 | TP_ARGS(map, reg, count) |
| 200 | ); | 199 | ); |
| 201 | 200 | ||
| 202 | DEFINE_EVENT(regmap_async, regmap_async_io_complete, | 201 | DEFINE_EVENT(regmap_async, regmap_async_io_complete, |
| 203 | 202 | ||
| 204 | TP_PROTO(struct device *dev), | 203 | TP_PROTO(struct regmap *map), |
| 205 | 204 | ||
| 206 | TP_ARGS(dev) | 205 | TP_ARGS(map) |
| 207 | 206 | ||
| 208 | ); | 207 | ); |
| 209 | 208 | ||
| 210 | DEFINE_EVENT(regmap_async, regmap_async_complete_start, | 209 | DEFINE_EVENT(regmap_async, regmap_async_complete_start, |
| 211 | 210 | ||
| 212 | TP_PROTO(struct device *dev), | 211 | TP_PROTO(struct regmap *map), |
| 213 | 212 | ||
| 214 | TP_ARGS(dev) | 213 | TP_ARGS(map) |
| 215 | 214 | ||
| 216 | ); | 215 | ); |
| 217 | 216 | ||
| 218 | DEFINE_EVENT(regmap_async, regmap_async_complete_done, | 217 | DEFINE_EVENT(regmap_async, regmap_async_complete_done, |
| 219 | 218 | ||
| 220 | TP_PROTO(struct device *dev), | 219 | TP_PROTO(struct regmap *map), |
| 221 | 220 | ||
| 222 | TP_ARGS(dev) | 221 | TP_ARGS(map) |
| 223 | 222 | ||
| 224 | ); | 223 | ); |
| 225 | 224 | ||
| 226 | TRACE_EVENT(regcache_drop_region, | 225 | TRACE_EVENT(regcache_drop_region, |
| 227 | 226 | ||
| 228 | TP_PROTO(struct device *dev, unsigned int from, | 227 | TP_PROTO(struct regmap *map, unsigned int from, |
| 229 | unsigned int to), | 228 | unsigned int to), |
| 230 | 229 | ||
| 231 | TP_ARGS(dev, from, to), | 230 | TP_ARGS(map, from, to), |
| 232 | 231 | ||
| 233 | TP_STRUCT__entry( | 232 | TP_STRUCT__entry( |
| 234 | __string( name, dev_name(dev) ) | 233 | __string( name, regmap_name(map) ) |
| 235 | __field( unsigned int, from ) | 234 | __field( unsigned int, from ) |
| 236 | __field( unsigned int, to ) | 235 | __field( unsigned int, to ) |
| 237 | ), | 236 | ), |
| 238 | 237 | ||
| 239 | TP_fast_assign( | 238 | TP_fast_assign( |
| 240 | __assign_str(name, dev_name(dev)); | 239 | __assign_str(name, regmap_name(map)); |
| 241 | __entry->from = from; | 240 | __entry->from = from; |
| 242 | __entry->to = to; | 241 | __entry->to = to; |
| 243 | ), | 242 | ), |
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 7ce18f3c097a..bcfe32088b37 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c | |||
| @@ -1609,9 +1609,11 @@ static void update_task_scan_period(struct task_struct *p, | |||
| 1609 | /* | 1609 | /* |
| 1610 | * If there were no record hinting faults then either the task is | 1610 | * If there were no record hinting faults then either the task is |
| 1611 | * completely idle or all activity is areas that are not of interest | 1611 | * completely idle or all activity is areas that are not of interest |
| 1612 | * to automatic numa balancing. Scan slower | 1612 | * to automatic numa balancing. Related to that, if there were failed |
| 1613 | * migration then it implies we are migrating too quickly or the local | ||
| 1614 | * node is overloaded. In either case, scan slower | ||
| 1613 | */ | 1615 | */ |
| 1614 | if (local + shared == 0) { | 1616 | if (local + shared == 0 || p->numa_faults_locality[2]) { |
| 1615 | p->numa_scan_period = min(p->numa_scan_period_max, | 1617 | p->numa_scan_period = min(p->numa_scan_period_max, |
| 1616 | p->numa_scan_period << 1); | 1618 | p->numa_scan_period << 1); |
| 1617 | 1619 | ||
| @@ -2080,6 +2082,8 @@ void task_numa_fault(int last_cpupid, int mem_node, int pages, int flags) | |||
| 2080 | 2082 | ||
| 2081 | if (migrated) | 2083 | if (migrated) |
| 2082 | p->numa_pages_migrated += pages; | 2084 | p->numa_pages_migrated += pages; |
| 2085 | if (flags & TNF_MIGRATE_FAIL) | ||
| 2086 | p->numa_faults_locality[2] += pages; | ||
| 2083 | 2087 | ||
| 2084 | p->numa_faults[task_faults_idx(NUMA_MEMBUF, mem_node, priv)] += pages; | 2088 | p->numa_faults[task_faults_idx(NUMA_MEMBUF, mem_node, priv)] += pages; |
| 2085 | p->numa_faults[task_faults_idx(NUMA_CPUBUF, cpu_node, priv)] += pages; | 2089 | p->numa_faults[task_faults_idx(NUMA_CPUBUF, cpu_node, priv)] += pages; |
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 626e93db28ba..6817b0350c71 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c | |||
| @@ -1260,6 +1260,7 @@ int do_huge_pmd_numa_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
| 1260 | int target_nid, last_cpupid = -1; | 1260 | int target_nid, last_cpupid = -1; |
| 1261 | bool page_locked; | 1261 | bool page_locked; |
| 1262 | bool migrated = false; | 1262 | bool migrated = false; |
| 1263 | bool was_writable; | ||
| 1263 | int flags = 0; | 1264 | int flags = 0; |
| 1264 | 1265 | ||
| 1265 | /* A PROT_NONE fault should not end up here */ | 1266 | /* A PROT_NONE fault should not end up here */ |
| @@ -1291,17 +1292,8 @@ int do_huge_pmd_numa_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
| 1291 | flags |= TNF_FAULT_LOCAL; | 1292 | flags |= TNF_FAULT_LOCAL; |
| 1292 | } | 1293 | } |
| 1293 | 1294 | ||
| 1294 | /* | 1295 | /* See similar comment in do_numa_page for explanation */ |
| 1295 | * Avoid grouping on DSO/COW pages in specific and RO pages | 1296 | if (!(vma->vm_flags & VM_WRITE)) |
| 1296 | * in general, RO pages shouldn't hurt as much anyway since | ||
| 1297 | * they can be in shared cache state. | ||
| 1298 | * | ||
| 1299 | * FIXME! This checks "pmd_dirty()" as an approximation of | ||
| 1300 | * "is this a read-only page", since checking "pmd_write()" | ||
| 1301 | * is even more broken. We haven't actually turned this into | ||
| 1302 | * a writable page, so pmd_write() will always be false. | ||
| 1303 | */ | ||
| 1304 | if (!pmd_dirty(pmd)) | ||
| 1305 | flags |= TNF_NO_GROUP; | 1297 | flags |= TNF_NO_GROUP; |
| 1306 | 1298 | ||
| 1307 | /* | 1299 | /* |
| @@ -1358,12 +1350,17 @@ int do_huge_pmd_numa_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
| 1358 | if (migrated) { | 1350 | if (migrated) { |
| 1359 | flags |= TNF_MIGRATED; | 1351 | flags |= TNF_MIGRATED; |
| 1360 | page_nid = target_nid; | 1352 | page_nid = target_nid; |
| 1361 | } | 1353 | } else |
| 1354 | flags |= TNF_MIGRATE_FAIL; | ||
| 1362 | 1355 | ||
| 1363 | goto out; | 1356 | goto out; |
| 1364 | clear_pmdnuma: | 1357 | clear_pmdnuma: |
| 1365 | BUG_ON(!PageLocked(page)); | 1358 | BUG_ON(!PageLocked(page)); |
| 1359 | was_writable = pmd_write(pmd); | ||
| 1366 | pmd = pmd_modify(pmd, vma->vm_page_prot); | 1360 | pmd = pmd_modify(pmd, vma->vm_page_prot); |
| 1361 | pmd = pmd_mkyoung(pmd); | ||
| 1362 | if (was_writable) | ||
| 1363 | pmd = pmd_mkwrite(pmd); | ||
| 1367 | set_pmd_at(mm, haddr, pmdp, pmd); | 1364 | set_pmd_at(mm, haddr, pmdp, pmd); |
| 1368 | update_mmu_cache_pmd(vma, addr, pmdp); | 1365 | update_mmu_cache_pmd(vma, addr, pmdp); |
| 1369 | unlock_page(page); | 1366 | unlock_page(page); |
| @@ -1487,6 +1484,7 @@ int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, | |||
| 1487 | 1484 | ||
| 1488 | if (__pmd_trans_huge_lock(pmd, vma, &ptl) == 1) { | 1485 | if (__pmd_trans_huge_lock(pmd, vma, &ptl) == 1) { |
| 1489 | pmd_t entry; | 1486 | pmd_t entry; |
| 1487 | bool preserve_write = prot_numa && pmd_write(*pmd); | ||
| 1490 | ret = 1; | 1488 | ret = 1; |
| 1491 | 1489 | ||
| 1492 | /* | 1490 | /* |
| @@ -1502,9 +1500,11 @@ int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, | |||
| 1502 | if (!prot_numa || !pmd_protnone(*pmd)) { | 1500 | if (!prot_numa || !pmd_protnone(*pmd)) { |
| 1503 | entry = pmdp_get_and_clear_notify(mm, addr, pmd); | 1501 | entry = pmdp_get_and_clear_notify(mm, addr, pmd); |
| 1504 | entry = pmd_modify(entry, newprot); | 1502 | entry = pmd_modify(entry, newprot); |
| 1503 | if (preserve_write) | ||
| 1504 | entry = pmd_mkwrite(entry); | ||
| 1505 | ret = HPAGE_PMD_NR; | 1505 | ret = HPAGE_PMD_NR; |
| 1506 | set_pmd_at(mm, addr, pmd, entry); | 1506 | set_pmd_at(mm, addr, pmd, entry); |
| 1507 | BUG_ON(pmd_write(entry)); | 1507 | BUG_ON(!preserve_write && pmd_write(entry)); |
| 1508 | } | 1508 | } |
| 1509 | spin_unlock(ptl); | 1509 | spin_unlock(ptl); |
| 1510 | } | 1510 | } |
diff --git a/mm/memory.c b/mm/memory.c index 411144f977b1..97839f5c8c30 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
| @@ -3035,6 +3035,7 @@ static int do_numa_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
| 3035 | int last_cpupid; | 3035 | int last_cpupid; |
| 3036 | int target_nid; | 3036 | int target_nid; |
| 3037 | bool migrated = false; | 3037 | bool migrated = false; |
| 3038 | bool was_writable = pte_write(pte); | ||
| 3038 | int flags = 0; | 3039 | int flags = 0; |
| 3039 | 3040 | ||
| 3040 | /* A PROT_NONE fault should not end up here */ | 3041 | /* A PROT_NONE fault should not end up here */ |
| @@ -3059,6 +3060,8 @@ static int do_numa_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
| 3059 | /* Make it present again */ | 3060 | /* Make it present again */ |
| 3060 | pte = pte_modify(pte, vma->vm_page_prot); | 3061 | pte = pte_modify(pte, vma->vm_page_prot); |
| 3061 | pte = pte_mkyoung(pte); | 3062 | pte = pte_mkyoung(pte); |
| 3063 | if (was_writable) | ||
| 3064 | pte = pte_mkwrite(pte); | ||
| 3062 | set_pte_at(mm, addr, ptep, pte); | 3065 | set_pte_at(mm, addr, ptep, pte); |
| 3063 | update_mmu_cache(vma, addr, ptep); | 3066 | update_mmu_cache(vma, addr, ptep); |
| 3064 | 3067 | ||
| @@ -3069,16 +3072,14 @@ static int do_numa_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
| 3069 | } | 3072 | } |
| 3070 | 3073 | ||
| 3071 | /* | 3074 | /* |
| 3072 | * Avoid grouping on DSO/COW pages in specific and RO pages | 3075 | * Avoid grouping on RO pages in general. RO pages shouldn't hurt as |
| 3073 | * in general, RO pages shouldn't hurt as much anyway since | 3076 | * much anyway since they can be in shared cache state. This misses |
| 3074 | * they can be in shared cache state. | 3077 | * the case where a mapping is writable but the process never writes |
| 3075 | * | 3078 | * to it but pte_write gets cleared during protection updates and |
| 3076 | * FIXME! This checks "pmd_dirty()" as an approximation of | 3079 | * pte_dirty has unpredictable behaviour between PTE scan updates, |
| 3077 | * "is this a read-only page", since checking "pmd_write()" | 3080 | * background writeback, dirty balancing and application behaviour. |
| 3078 | * is even more broken. We haven't actually turned this into | ||
| 3079 | * a writable page, so pmd_write() will always be false. | ||
| 3080 | */ | 3081 | */ |
| 3081 | if (!pte_dirty(pte)) | 3082 | if (!(vma->vm_flags & VM_WRITE)) |
| 3082 | flags |= TNF_NO_GROUP; | 3083 | flags |= TNF_NO_GROUP; |
| 3083 | 3084 | ||
| 3084 | /* | 3085 | /* |
| @@ -3102,7 +3103,8 @@ static int do_numa_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
| 3102 | if (migrated) { | 3103 | if (migrated) { |
| 3103 | page_nid = target_nid; | 3104 | page_nid = target_nid; |
| 3104 | flags |= TNF_MIGRATED; | 3105 | flags |= TNF_MIGRATED; |
| 3105 | } | 3106 | } else |
| 3107 | flags |= TNF_MIGRATE_FAIL; | ||
| 3106 | 3108 | ||
| 3107 | out: | 3109 | out: |
| 3108 | if (page_nid != -1) | 3110 | if (page_nid != -1) |
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 9fab10795bea..65842d688b7c 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c | |||
| @@ -1092,6 +1092,10 @@ static pg_data_t __ref *hotadd_new_pgdat(int nid, u64 start) | |||
| 1092 | return NULL; | 1092 | return NULL; |
| 1093 | 1093 | ||
| 1094 | arch_refresh_nodedata(nid, pgdat); | 1094 | arch_refresh_nodedata(nid, pgdat); |
| 1095 | } else { | ||
| 1096 | /* Reset the nr_zones and classzone_idx to 0 before reuse */ | ||
| 1097 | pgdat->nr_zones = 0; | ||
| 1098 | pgdat->classzone_idx = 0; | ||
| 1095 | } | 1099 | } |
| 1096 | 1100 | ||
| 1097 | /* we can use NODE_DATA(nid) from here */ | 1101 | /* we can use NODE_DATA(nid) from here */ |
| @@ -1977,15 +1981,6 @@ void try_offline_node(int nid) | |||
| 1977 | if (is_vmalloc_addr(zone->wait_table)) | 1981 | if (is_vmalloc_addr(zone->wait_table)) |
| 1978 | vfree(zone->wait_table); | 1982 | vfree(zone->wait_table); |
| 1979 | } | 1983 | } |
| 1980 | |||
| 1981 | /* | ||
| 1982 | * Since there is no way to guarentee the address of pgdat/zone is not | ||
| 1983 | * on stack of any kernel threads or used by other kernel objects | ||
| 1984 | * without reference counting or other symchronizing method, do not | ||
| 1985 | * reset node_data and free pgdat here. Just reset it to 0 and reuse | ||
| 1986 | * the memory when the node is online again. | ||
| 1987 | */ | ||
| 1988 | memset(pgdat, 0, sizeof(*pgdat)); | ||
| 1989 | } | 1984 | } |
| 1990 | EXPORT_SYMBOL(try_offline_node); | 1985 | EXPORT_SYMBOL(try_offline_node); |
| 1991 | 1986 | ||
| @@ -774,10 +774,8 @@ again: remove_next = 1 + (end > next->vm_end); | |||
| 774 | 774 | ||
| 775 | importer->anon_vma = exporter->anon_vma; | 775 | importer->anon_vma = exporter->anon_vma; |
| 776 | error = anon_vma_clone(importer, exporter); | 776 | error = anon_vma_clone(importer, exporter); |
| 777 | if (error) { | 777 | if (error) |
| 778 | importer->anon_vma = NULL; | ||
| 779 | return error; | 778 | return error; |
| 780 | } | ||
| 781 | } | 779 | } |
| 782 | } | 780 | } |
| 783 | 781 | ||
diff --git a/mm/mprotect.c b/mm/mprotect.c index 44727811bf4c..88584838e704 100644 --- a/mm/mprotect.c +++ b/mm/mprotect.c | |||
| @@ -75,6 +75,7 @@ static unsigned long change_pte_range(struct vm_area_struct *vma, pmd_t *pmd, | |||
| 75 | oldpte = *pte; | 75 | oldpte = *pte; |
| 76 | if (pte_present(oldpte)) { | 76 | if (pte_present(oldpte)) { |
| 77 | pte_t ptent; | 77 | pte_t ptent; |
| 78 | bool preserve_write = prot_numa && pte_write(oldpte); | ||
| 78 | 79 | ||
| 79 | /* | 80 | /* |
| 80 | * Avoid trapping faults against the zero or KSM | 81 | * Avoid trapping faults against the zero or KSM |
| @@ -94,6 +95,8 @@ static unsigned long change_pte_range(struct vm_area_struct *vma, pmd_t *pmd, | |||
| 94 | 95 | ||
| 95 | ptent = ptep_modify_prot_start(mm, addr, pte); | 96 | ptent = ptep_modify_prot_start(mm, addr, pte); |
| 96 | ptent = pte_modify(ptent, newprot); | 97 | ptent = pte_modify(ptent, newprot); |
| 98 | if (preserve_write) | ||
| 99 | ptent = pte_mkwrite(ptent); | ||
| 97 | 100 | ||
| 98 | /* Avoid taking write faults for known dirty pages */ | 101 | /* Avoid taking write faults for known dirty pages */ |
| 99 | if (dirty_accountable && pte_dirty(ptent) && | 102 | if (dirty_accountable && pte_dirty(ptent) && |
diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 45e187b2d971..644bcb665773 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c | |||
| @@ -857,8 +857,11 @@ static void bdi_update_write_bandwidth(struct backing_dev_info *bdi, | |||
| 857 | * bw * elapsed + write_bandwidth * (period - elapsed) | 857 | * bw * elapsed + write_bandwidth * (period - elapsed) |
| 858 | * write_bandwidth = --------------------------------------------------- | 858 | * write_bandwidth = --------------------------------------------------- |
| 859 | * period | 859 | * period |
| 860 | * | ||
| 861 | * @written may have decreased due to account_page_redirty(). | ||
| 862 | * Avoid underflowing @bw calculation. | ||
| 860 | */ | 863 | */ |
| 861 | bw = written - bdi->written_stamp; | 864 | bw = written - min(written, bdi->written_stamp); |
| 862 | bw *= HZ; | 865 | bw *= HZ; |
| 863 | if (unlikely(elapsed > period)) { | 866 | if (unlikely(elapsed > period)) { |
| 864 | do_div(bw, elapsed); | 867 | do_div(bw, elapsed); |
| @@ -922,7 +925,7 @@ static void global_update_bandwidth(unsigned long thresh, | |||
| 922 | unsigned long now) | 925 | unsigned long now) |
| 923 | { | 926 | { |
| 924 | static DEFINE_SPINLOCK(dirty_lock); | 927 | static DEFINE_SPINLOCK(dirty_lock); |
| 925 | static unsigned long update_time; | 928 | static unsigned long update_time = INITIAL_JIFFIES; |
| 926 | 929 | ||
| 927 | /* | 930 | /* |
| 928 | * check locklessly first to optimize away locking for the most time | 931 | * check locklessly first to optimize away locking for the most time |
diff --git a/mm/page_isolation.c b/mm/page_isolation.c index 72f5ac381ab3..755a42c76eb4 100644 --- a/mm/page_isolation.c +++ b/mm/page_isolation.c | |||
| @@ -103,6 +103,7 @@ void unset_migratetype_isolate(struct page *page, unsigned migratetype) | |||
| 103 | 103 | ||
| 104 | if (!is_migrate_isolate_page(buddy)) { | 104 | if (!is_migrate_isolate_page(buddy)) { |
| 105 | __isolate_free_page(page, order); | 105 | __isolate_free_page(page, order); |
| 106 | kernel_map_pages(page, (1 << order), 1); | ||
| 106 | set_page_refcounted(page); | 107 | set_page_refcounted(page); |
| 107 | isolated_page = page; | 108 | isolated_page = page; |
| 108 | } | 109 | } |
diff --git a/mm/pagewalk.c b/mm/pagewalk.c index 75c1f2878519..29f2f8b853ae 100644 --- a/mm/pagewalk.c +++ b/mm/pagewalk.c | |||
| @@ -265,8 +265,15 @@ int walk_page_range(unsigned long start, unsigned long end, | |||
| 265 | vma = vma->vm_next; | 265 | vma = vma->vm_next; |
| 266 | 266 | ||
| 267 | err = walk_page_test(start, next, walk); | 267 | err = walk_page_test(start, next, walk); |
| 268 | if (err > 0) | 268 | if (err > 0) { |
| 269 | /* | ||
| 270 | * positive return values are purely for | ||
| 271 | * controlling the pagewalk, so should never | ||
| 272 | * be passed to the callers. | ||
| 273 | */ | ||
| 274 | err = 0; | ||
| 269 | continue; | 275 | continue; |
| 276 | } | ||
| 270 | if (err < 0) | 277 | if (err < 0) |
| 271 | break; | 278 | break; |
| 272 | } | 279 | } |
| @@ -287,6 +287,13 @@ int anon_vma_clone(struct vm_area_struct *dst, struct vm_area_struct *src) | |||
| 287 | return 0; | 287 | return 0; |
| 288 | 288 | ||
| 289 | enomem_failure: | 289 | enomem_failure: |
| 290 | /* | ||
| 291 | * dst->anon_vma is dropped here otherwise its degree can be incorrectly | ||
| 292 | * decremented in unlink_anon_vmas(). | ||
| 293 | * We can safely do this because callers of anon_vma_clone() don't care | ||
| 294 | * about dst->anon_vma if anon_vma_clone() failed. | ||
| 295 | */ | ||
| 296 | dst->anon_vma = NULL; | ||
| 290 | unlink_anon_vmas(dst); | 297 | unlink_anon_vmas(dst); |
| 291 | return -ENOMEM; | 298 | return -ENOMEM; |
| 292 | } | 299 | } |
| @@ -2449,7 +2449,8 @@ redo: | |||
| 2449 | do { | 2449 | do { |
| 2450 | tid = this_cpu_read(s->cpu_slab->tid); | 2450 | tid = this_cpu_read(s->cpu_slab->tid); |
| 2451 | c = raw_cpu_ptr(s->cpu_slab); | 2451 | c = raw_cpu_ptr(s->cpu_slab); |
| 2452 | } while (IS_ENABLED(CONFIG_PREEMPT) && unlikely(tid != c->tid)); | 2452 | } while (IS_ENABLED(CONFIG_PREEMPT) && |
| 2453 | unlikely(tid != READ_ONCE(c->tid))); | ||
| 2453 | 2454 | ||
| 2454 | /* | 2455 | /* |
| 2455 | * Irqless object alloc/free algorithm used here depends on sequence | 2456 | * Irqless object alloc/free algorithm used here depends on sequence |
| @@ -2718,7 +2719,8 @@ redo: | |||
| 2718 | do { | 2719 | do { |
| 2719 | tid = this_cpu_read(s->cpu_slab->tid); | 2720 | tid = this_cpu_read(s->cpu_slab->tid); |
| 2720 | c = raw_cpu_ptr(s->cpu_slab); | 2721 | c = raw_cpu_ptr(s->cpu_slab); |
| 2721 | } while (IS_ENABLED(CONFIG_PREEMPT) && unlikely(tid != c->tid)); | 2722 | } while (IS_ENABLED(CONFIG_PREEMPT) && |
| 2723 | unlikely(tid != READ_ONCE(c->tid))); | ||
| 2722 | 2724 | ||
| 2723 | /* Same with comment on barrier() in slab_alloc_node() */ | 2725 | /* Same with comment on barrier() in slab_alloc_node() */ |
| 2724 | barrier(); | 2726 | barrier(); |
diff --git a/net/compat.c b/net/compat.c index 94d3d5e97883..f7bd286a8280 100644 --- a/net/compat.c +++ b/net/compat.c | |||
| @@ -49,6 +49,13 @@ ssize_t get_compat_msghdr(struct msghdr *kmsg, | |||
| 49 | __get_user(kmsg->msg_controllen, &umsg->msg_controllen) || | 49 | __get_user(kmsg->msg_controllen, &umsg->msg_controllen) || |
| 50 | __get_user(kmsg->msg_flags, &umsg->msg_flags)) | 50 | __get_user(kmsg->msg_flags, &umsg->msg_flags)) |
| 51 | return -EFAULT; | 51 | return -EFAULT; |
| 52 | |||
| 53 | if (!uaddr) | ||
| 54 | kmsg->msg_namelen = 0; | ||
| 55 | |||
| 56 | if (kmsg->msg_namelen < 0) | ||
| 57 | return -EINVAL; | ||
| 58 | |||
| 52 | if (kmsg->msg_namelen > sizeof(struct sockaddr_storage)) | 59 | if (kmsg->msg_namelen > sizeof(struct sockaddr_storage)) |
| 53 | kmsg->msg_namelen = sizeof(struct sockaddr_storage); | 60 | kmsg->msg_namelen = sizeof(struct sockaddr_storage); |
| 54 | kmsg->msg_control = compat_ptr(tmp3); | 61 | kmsg->msg_control = compat_ptr(tmp3); |
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c index 99e810f84671..cf5e82f39d3b 100644 --- a/net/ipv4/netfilter/ip_tables.c +++ b/net/ipv4/netfilter/ip_tables.c | |||
| @@ -272,9 +272,9 @@ static void trace_packet(const struct sk_buff *skb, | |||
| 272 | &chainname, &comment, &rulenum) != 0) | 272 | &chainname, &comment, &rulenum) != 0) |
| 273 | break; | 273 | break; |
| 274 | 274 | ||
| 275 | nf_log_packet(net, AF_INET, hook, skb, in, out, &trace_loginfo, | 275 | nf_log_trace(net, AF_INET, hook, skb, in, out, &trace_loginfo, |
| 276 | "TRACE: %s:%s:%s:%u ", | 276 | "TRACE: %s:%s:%s:%u ", |
| 277 | tablename, chainname, comment, rulenum); | 277 | tablename, chainname, comment, rulenum); |
| 278 | } | 278 | } |
| 279 | #endif | 279 | #endif |
| 280 | 280 | ||
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index a2a796c5536b..1db253e36045 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
| @@ -2773,15 +2773,11 @@ void tcp_send_fin(struct sock *sk) | |||
| 2773 | } else { | 2773 | } else { |
| 2774 | /* Socket is locked, keep trying until memory is available. */ | 2774 | /* Socket is locked, keep trying until memory is available. */ |
| 2775 | for (;;) { | 2775 | for (;;) { |
| 2776 | skb = alloc_skb_fclone(MAX_TCP_HEADER, | 2776 | skb = sk_stream_alloc_skb(sk, 0, sk->sk_allocation); |
| 2777 | sk->sk_allocation); | ||
| 2778 | if (skb) | 2777 | if (skb) |
| 2779 | break; | 2778 | break; |
| 2780 | yield(); | 2779 | yield(); |
| 2781 | } | 2780 | } |
| 2782 | |||
| 2783 | /* Reserve space for headers and prepare control bits. */ | ||
| 2784 | skb_reserve(skb, MAX_TCP_HEADER); | ||
| 2785 | /* FIN eats a sequence byte, write_seq advanced by tcp_queue_skb(). */ | 2781 | /* FIN eats a sequence byte, write_seq advanced by tcp_queue_skb(). */ |
| 2786 | tcp_init_nondata_skb(skb, tp->write_seq, | 2782 | tcp_init_nondata_skb(skb, tp->write_seq, |
| 2787 | TCPHDR_ACK | TCPHDR_FIN); | 2783 | TCPHDR_ACK | TCPHDR_FIN); |
diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c index b4d5e1d97c1b..27ca79682efb 100644 --- a/net/ipv6/fib6_rules.c +++ b/net/ipv6/fib6_rules.c | |||
| @@ -104,6 +104,7 @@ static int fib6_rule_action(struct fib_rule *rule, struct flowi *flp, | |||
| 104 | goto again; | 104 | goto again; |
| 105 | flp6->saddr = saddr; | 105 | flp6->saddr = saddr; |
| 106 | } | 106 | } |
| 107 | err = rt->dst.error; | ||
| 107 | goto out; | 108 | goto out; |
| 108 | } | 109 | } |
| 109 | again: | 110 | again: |
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c index e080fbbbc0e5..bb00c6f2a885 100644 --- a/net/ipv6/netfilter/ip6_tables.c +++ b/net/ipv6/netfilter/ip6_tables.c | |||
| @@ -298,9 +298,9 @@ static void trace_packet(const struct sk_buff *skb, | |||
| 298 | &chainname, &comment, &rulenum) != 0) | 298 | &chainname, &comment, &rulenum) != 0) |
| 299 | break; | 299 | break; |
| 300 | 300 | ||
| 301 | nf_log_packet(net, AF_INET6, hook, skb, in, out, &trace_loginfo, | 301 | nf_log_trace(net, AF_INET6, hook, skb, in, out, &trace_loginfo, |
| 302 | "TRACE: %s:%s:%s:%u ", | 302 | "TRACE: %s:%s:%s:%u ", |
| 303 | tablename, chainname, comment, rulenum); | 303 | tablename, chainname, comment, rulenum); |
| 304 | } | 304 | } |
| 305 | #endif | 305 | #endif |
| 306 | 306 | ||
diff --git a/net/ipv6/udp_offload.c b/net/ipv6/udp_offload.c index ab889bb16b3c..be2c0ba82c85 100644 --- a/net/ipv6/udp_offload.c +++ b/net/ipv6/udp_offload.c | |||
| @@ -112,11 +112,9 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb, | |||
| 112 | fptr = (struct frag_hdr *)(skb_network_header(skb) + unfrag_ip6hlen); | 112 | fptr = (struct frag_hdr *)(skb_network_header(skb) + unfrag_ip6hlen); |
| 113 | fptr->nexthdr = nexthdr; | 113 | fptr->nexthdr = nexthdr; |
| 114 | fptr->reserved = 0; | 114 | fptr->reserved = 0; |
| 115 | if (skb_shinfo(skb)->ip6_frag_id) | 115 | if (!skb_shinfo(skb)->ip6_frag_id) |
| 116 | fptr->identification = skb_shinfo(skb)->ip6_frag_id; | 116 | ipv6_proxy_select_ident(skb); |
| 117 | else | 117 | fptr->identification = skb_shinfo(skb)->ip6_frag_id; |
| 118 | ipv6_select_ident(fptr, | ||
| 119 | (struct rt6_info *)skb_dst(skb)); | ||
| 120 | 118 | ||
| 121 | /* Fragment the skb. ipv6 header and the remaining fields of the | 119 | /* Fragment the skb. ipv6 header and the remaining fields of the |
| 122 | * fragment header are updated in ipv6_gso_segment() | 120 | * fragment header are updated in ipv6_gso_segment() |
diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c index 0d8448f19dfe..675d12c69e32 100644 --- a/net/netfilter/nf_log.c +++ b/net/netfilter/nf_log.c | |||
| @@ -212,6 +212,30 @@ void nf_log_packet(struct net *net, | |||
| 212 | } | 212 | } |
| 213 | EXPORT_SYMBOL(nf_log_packet); | 213 | EXPORT_SYMBOL(nf_log_packet); |
| 214 | 214 | ||
| 215 | void nf_log_trace(struct net *net, | ||
| 216 | u_int8_t pf, | ||
| 217 | unsigned int hooknum, | ||
| 218 | const struct sk_buff *skb, | ||
| 219 | const struct net_device *in, | ||
| 220 | const struct net_device *out, | ||
| 221 | const struct nf_loginfo *loginfo, const char *fmt, ...) | ||
| 222 | { | ||
| 223 | va_list args; | ||
| 224 | char prefix[NF_LOG_PREFIXLEN]; | ||
| 225 | const struct nf_logger *logger; | ||
| 226 | |||
| 227 | rcu_read_lock(); | ||
| 228 | logger = rcu_dereference(net->nf.nf_loggers[pf]); | ||
| 229 | if (logger) { | ||
| 230 | va_start(args, fmt); | ||
| 231 | vsnprintf(prefix, sizeof(prefix), fmt, args); | ||
| 232 | va_end(args); | ||
| 233 | logger->logfn(net, pf, hooknum, skb, in, out, loginfo, prefix); | ||
| 234 | } | ||
| 235 | rcu_read_unlock(); | ||
| 236 | } | ||
| 237 | EXPORT_SYMBOL(nf_log_trace); | ||
| 238 | |||
| 215 | #define S_SIZE (1024 - (sizeof(unsigned int) + 1)) | 239 | #define S_SIZE (1024 - (sizeof(unsigned int) + 1)) |
| 216 | 240 | ||
| 217 | struct nf_log_buf { | 241 | struct nf_log_buf { |
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 6ab777912237..ac1a9528dbf2 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c | |||
| @@ -1225,7 +1225,10 @@ static int nf_tables_newchain(struct sock *nlsk, struct sk_buff *skb, | |||
| 1225 | 1225 | ||
| 1226 | if (nla[NFTA_CHAIN_POLICY]) { | 1226 | if (nla[NFTA_CHAIN_POLICY]) { |
| 1227 | if ((chain != NULL && | 1227 | if ((chain != NULL && |
| 1228 | !(chain->flags & NFT_BASE_CHAIN)) || | 1228 | !(chain->flags & NFT_BASE_CHAIN))) |
| 1229 | return -EOPNOTSUPP; | ||
| 1230 | |||
| 1231 | if (chain == NULL && | ||
| 1229 | nla[NFTA_CHAIN_HOOK] == NULL) | 1232 | nla[NFTA_CHAIN_HOOK] == NULL) |
| 1230 | return -EOPNOTSUPP; | 1233 | return -EOPNOTSUPP; |
| 1231 | 1234 | ||
diff --git a/net/netfilter/nf_tables_core.c b/net/netfilter/nf_tables_core.c index 3b90eb2b2c55..2d298dccb6dd 100644 --- a/net/netfilter/nf_tables_core.c +++ b/net/netfilter/nf_tables_core.c | |||
| @@ -94,10 +94,10 @@ static void nft_trace_packet(const struct nft_pktinfo *pkt, | |||
| 94 | { | 94 | { |
| 95 | struct net *net = dev_net(pkt->in ? pkt->in : pkt->out); | 95 | struct net *net = dev_net(pkt->in ? pkt->in : pkt->out); |
| 96 | 96 | ||
| 97 | nf_log_packet(net, pkt->xt.family, pkt->ops->hooknum, pkt->skb, pkt->in, | 97 | nf_log_trace(net, pkt->xt.family, pkt->ops->hooknum, pkt->skb, pkt->in, |
| 98 | pkt->out, &trace_loginfo, "TRACE: %s:%s:%s:%u ", | 98 | pkt->out, &trace_loginfo, "TRACE: %s:%s:%s:%u ", |
| 99 | chain->table->name, chain->name, comments[type], | 99 | chain->table->name, chain->name, comments[type], |
| 100 | rulenum); | 100 | rulenum); |
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | unsigned int | 103 | unsigned int |
diff --git a/net/netfilter/nfnetlink_cthelper.c b/net/netfilter/nfnetlink_cthelper.c index a5599fc51a6f..54330fb5efaf 100644 --- a/net/netfilter/nfnetlink_cthelper.c +++ b/net/netfilter/nfnetlink_cthelper.c | |||
| @@ -77,6 +77,9 @@ nfnl_cthelper_parse_tuple(struct nf_conntrack_tuple *tuple, | |||
| 77 | if (!tb[NFCTH_TUPLE_L3PROTONUM] || !tb[NFCTH_TUPLE_L4PROTONUM]) | 77 | if (!tb[NFCTH_TUPLE_L3PROTONUM] || !tb[NFCTH_TUPLE_L4PROTONUM]) |
| 78 | return -EINVAL; | 78 | return -EINVAL; |
| 79 | 79 | ||
| 80 | /* Not all fields are initialized so first zero the tuple */ | ||
| 81 | memset(tuple, 0, sizeof(struct nf_conntrack_tuple)); | ||
| 82 | |||
| 80 | tuple->src.l3num = ntohs(nla_get_be16(tb[NFCTH_TUPLE_L3PROTONUM])); | 83 | tuple->src.l3num = ntohs(nla_get_be16(tb[NFCTH_TUPLE_L3PROTONUM])); |
| 81 | tuple->dst.protonum = nla_get_u8(tb[NFCTH_TUPLE_L4PROTONUM]); | 84 | tuple->dst.protonum = nla_get_u8(tb[NFCTH_TUPLE_L4PROTONUM]); |
| 82 | 85 | ||
diff --git a/net/netfilter/nft_compat.c b/net/netfilter/nft_compat.c index 213584cf04b3..65f3e2b6be44 100644 --- a/net/netfilter/nft_compat.c +++ b/net/netfilter/nft_compat.c | |||
| @@ -133,6 +133,9 @@ nft_target_set_tgchk_param(struct xt_tgchk_param *par, | |||
| 133 | entry->e4.ip.invflags = inv ? IPT_INV_PROTO : 0; | 133 | entry->e4.ip.invflags = inv ? IPT_INV_PROTO : 0; |
| 134 | break; | 134 | break; |
| 135 | case AF_INET6: | 135 | case AF_INET6: |
| 136 | if (proto) | ||
| 137 | entry->e6.ipv6.flags |= IP6T_F_PROTO; | ||
| 138 | |||
| 136 | entry->e6.ipv6.proto = proto; | 139 | entry->e6.ipv6.proto = proto; |
| 137 | entry->e6.ipv6.invflags = inv ? IP6T_INV_PROTO : 0; | 140 | entry->e6.ipv6.invflags = inv ? IP6T_INV_PROTO : 0; |
| 138 | break; | 141 | break; |
| @@ -344,6 +347,9 @@ nft_match_set_mtchk_param(struct xt_mtchk_param *par, const struct nft_ctx *ctx, | |||
| 344 | entry->e4.ip.invflags = inv ? IPT_INV_PROTO : 0; | 347 | entry->e4.ip.invflags = inv ? IPT_INV_PROTO : 0; |
| 345 | break; | 348 | break; |
| 346 | case AF_INET6: | 349 | case AF_INET6: |
| 350 | if (proto) | ||
| 351 | entry->e6.ipv6.flags |= IP6T_F_PROTO; | ||
| 352 | |||
| 347 | entry->e6.ipv6.proto = proto; | 353 | entry->e6.ipv6.proto = proto; |
| 348 | entry->e6.ipv6.invflags = inv ? IP6T_INV_PROTO : 0; | 354 | entry->e6.ipv6.invflags = inv ? IP6T_INV_PROTO : 0; |
| 349 | break; | 355 | break; |
diff --git a/net/netfilter/nft_hash.c b/net/netfilter/nft_hash.c index c82df0a48fcd..37c15e674884 100644 --- a/net/netfilter/nft_hash.c +++ b/net/netfilter/nft_hash.c | |||
| @@ -153,6 +153,8 @@ static void nft_hash_walk(const struct nft_ctx *ctx, const struct nft_set *set, | |||
| 153 | iter->err = err; | 153 | iter->err = err; |
| 154 | goto out; | 154 | goto out; |
| 155 | } | 155 | } |
| 156 | |||
| 157 | continue; | ||
| 156 | } | 158 | } |
| 157 | 159 | ||
| 158 | if (iter->count < iter->skip) | 160 | if (iter->count < iter->skip) |
diff --git a/net/netfilter/xt_TPROXY.c b/net/netfilter/xt_TPROXY.c index ef8a926752a9..50e1e5aaf4ce 100644 --- a/net/netfilter/xt_TPROXY.c +++ b/net/netfilter/xt_TPROXY.c | |||
| @@ -513,8 +513,8 @@ static int tproxy_tg6_check(const struct xt_tgchk_param *par) | |||
| 513 | { | 513 | { |
| 514 | const struct ip6t_ip6 *i = par->entryinfo; | 514 | const struct ip6t_ip6 *i = par->entryinfo; |
| 515 | 515 | ||
| 516 | if ((i->proto == IPPROTO_TCP || i->proto == IPPROTO_UDP) | 516 | if ((i->proto == IPPROTO_TCP || i->proto == IPPROTO_UDP) && |
| 517 | && !(i->flags & IP6T_INV_PROTO)) | 517 | !(i->invflags & IP6T_INV_PROTO)) |
| 518 | return 0; | 518 | return 0; |
| 519 | 519 | ||
| 520 | pr_info("Can be used only in combination with " | 520 | pr_info("Can be used only in combination with " |
diff --git a/net/socket.c b/net/socket.c index bbedbfcb42c2..245330ca0015 100644 --- a/net/socket.c +++ b/net/socket.c | |||
| @@ -1702,6 +1702,8 @@ SYSCALL_DEFINE6(sendto, int, fd, void __user *, buff, size_t, len, | |||
| 1702 | 1702 | ||
| 1703 | if (len > INT_MAX) | 1703 | if (len > INT_MAX) |
| 1704 | len = INT_MAX; | 1704 | len = INT_MAX; |
| 1705 | if (unlikely(!access_ok(VERIFY_READ, buff, len))) | ||
| 1706 | return -EFAULT; | ||
| 1705 | sock = sockfd_lookup_light(fd, &err, &fput_needed); | 1707 | sock = sockfd_lookup_light(fd, &err, &fput_needed); |
| 1706 | if (!sock) | 1708 | if (!sock) |
| 1707 | goto out; | 1709 | goto out; |
| @@ -1760,6 +1762,8 @@ SYSCALL_DEFINE6(recvfrom, int, fd, void __user *, ubuf, size_t, size, | |||
| 1760 | 1762 | ||
| 1761 | if (size > INT_MAX) | 1763 | if (size > INT_MAX) |
| 1762 | size = INT_MAX; | 1764 | size = INT_MAX; |
| 1765 | if (unlikely(!access_ok(VERIFY_WRITE, ubuf, size))) | ||
| 1766 | return -EFAULT; | ||
| 1763 | sock = sockfd_lookup_light(fd, &err, &fput_needed); | 1767 | sock = sockfd_lookup_light(fd, &err, &fput_needed); |
| 1764 | if (!sock) | 1768 | if (!sock) |
| 1765 | goto out; | 1769 | goto out; |
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c index 1684bcc78b34..5fde34326dcf 100644 --- a/security/selinux/selinuxfs.c +++ b/security/selinux/selinuxfs.c | |||
| @@ -152,7 +152,7 @@ static ssize_t sel_write_enforce(struct file *file, const char __user *buf, | |||
| 152 | goto out; | 152 | goto out; |
| 153 | 153 | ||
| 154 | /* No partial writes. */ | 154 | /* No partial writes. */ |
| 155 | length = EINVAL; | 155 | length = -EINVAL; |
| 156 | if (*ppos != 0) | 156 | if (*ppos != 0) |
| 157 | goto out; | 157 | goto out; |
| 158 | 158 | ||
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 4ca3d5d02436..a8a1e14272a1 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
| @@ -1989,7 +1989,7 @@ static const struct pci_device_id azx_ids[] = { | |||
| 1989 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, | 1989 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, |
| 1990 | /* Sunrise Point */ | 1990 | /* Sunrise Point */ |
| 1991 | { PCI_DEVICE(0x8086, 0xa170), | 1991 | { PCI_DEVICE(0x8086, 0xa170), |
| 1992 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, | 1992 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_SKYLAKE }, |
| 1993 | /* Sunrise Point-LP */ | 1993 | /* Sunrise Point-LP */ |
| 1994 | { PCI_DEVICE(0x8086, 0x9d70), | 1994 | { PCI_DEVICE(0x8086, 0x9d70), |
| 1995 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_SKYLAKE }, | 1995 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_SKYLAKE }, |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 526398a4a442..74382137b9f5 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
| @@ -396,7 +396,7 @@ static void alc_auto_setup_eapd(struct hda_codec *codec, bool on) | |||
| 396 | { | 396 | { |
| 397 | /* We currently only handle front, HP */ | 397 | /* We currently only handle front, HP */ |
| 398 | static hda_nid_t pins[] = { | 398 | static hda_nid_t pins[] = { |
| 399 | 0x0f, 0x10, 0x14, 0x15, 0 | 399 | 0x0f, 0x10, 0x14, 0x15, 0x17, 0 |
| 400 | }; | 400 | }; |
| 401 | hda_nid_t *p; | 401 | hda_nid_t *p; |
| 402 | for (p = pins; *p; p++) | 402 | for (p = pins; *p; p++) |
| @@ -5036,6 +5036,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
| 5036 | SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC), | 5036 | SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC), |
| 5037 | SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK), | 5037 | SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK), |
| 5038 | SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | 5038 | SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
| 5039 | SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK), | ||
| 5039 | SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | 5040 | SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
| 5040 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K), | 5041 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K), |
| 5041 | SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), | 5042 | SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), |
diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile index 4e511221a0c1..0db571340edb 100644 --- a/tools/testing/selftests/Makefile +++ b/tools/testing/selftests/Makefile | |||
| @@ -22,6 +22,14 @@ TARGETS += vm | |||
| 22 | TARGETS_HOTPLUG = cpu-hotplug | 22 | TARGETS_HOTPLUG = cpu-hotplug |
| 23 | TARGETS_HOTPLUG += memory-hotplug | 23 | TARGETS_HOTPLUG += memory-hotplug |
| 24 | 24 | ||
| 25 | # Clear LDFLAGS and MAKEFLAGS if called from main | ||
| 26 | # Makefile to avoid test build failures when test | ||
| 27 | # Makefile doesn't have explicit build rules. | ||
| 28 | ifeq (1,$(MAKELEVEL)) | ||
| 29 | undefine LDFLAGS | ||
| 30 | override MAKEFLAGS = | ||
| 31 | endif | ||
| 32 | |||
| 25 | all: | 33 | all: |
| 26 | for TARGET in $(TARGETS); do \ | 34 | for TARGET in $(TARGETS); do \ |
| 27 | make -C $$TARGET; \ | 35 | make -C $$TARGET; \ |
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index a2214d9609bd..cc6a25d95fbf 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
| @@ -471,7 +471,7 @@ static struct kvm *kvm_create_vm(unsigned long type) | |||
| 471 | BUILD_BUG_ON(KVM_MEM_SLOTS_NUM > SHRT_MAX); | 471 | BUILD_BUG_ON(KVM_MEM_SLOTS_NUM > SHRT_MAX); |
| 472 | 472 | ||
| 473 | r = -ENOMEM; | 473 | r = -ENOMEM; |
| 474 | kvm->memslots = kzalloc(sizeof(struct kvm_memslots), GFP_KERNEL); | 474 | kvm->memslots = kvm_kvzalloc(sizeof(struct kvm_memslots)); |
| 475 | if (!kvm->memslots) | 475 | if (!kvm->memslots) |
| 476 | goto out_err_no_srcu; | 476 | goto out_err_no_srcu; |
| 477 | 477 | ||
| @@ -522,7 +522,7 @@ out_err_no_srcu: | |||
| 522 | out_err_no_disable: | 522 | out_err_no_disable: |
| 523 | for (i = 0; i < KVM_NR_BUSES; i++) | 523 | for (i = 0; i < KVM_NR_BUSES; i++) |
| 524 | kfree(kvm->buses[i]); | 524 | kfree(kvm->buses[i]); |
| 525 | kfree(kvm->memslots); | 525 | kvfree(kvm->memslots); |
| 526 | kvm_arch_free_vm(kvm); | 526 | kvm_arch_free_vm(kvm); |
| 527 | return ERR_PTR(r); | 527 | return ERR_PTR(r); |
| 528 | } | 528 | } |
| @@ -578,7 +578,7 @@ static void kvm_free_physmem(struct kvm *kvm) | |||
| 578 | kvm_for_each_memslot(memslot, slots) | 578 | kvm_for_each_memslot(memslot, slots) |
| 579 | kvm_free_physmem_slot(kvm, memslot, NULL); | 579 | kvm_free_physmem_slot(kvm, memslot, NULL); |
| 580 | 580 | ||
| 581 | kfree(kvm->memslots); | 581 | kvfree(kvm->memslots); |
| 582 | } | 582 | } |
| 583 | 583 | ||
| 584 | static void kvm_destroy_devices(struct kvm *kvm) | 584 | static void kvm_destroy_devices(struct kvm *kvm) |
| @@ -871,10 +871,10 @@ int __kvm_set_memory_region(struct kvm *kvm, | |||
| 871 | goto out_free; | 871 | goto out_free; |
| 872 | } | 872 | } |
| 873 | 873 | ||
| 874 | slots = kmemdup(kvm->memslots, sizeof(struct kvm_memslots), | 874 | slots = kvm_kvzalloc(sizeof(struct kvm_memslots)); |
| 875 | GFP_KERNEL); | ||
| 876 | if (!slots) | 875 | if (!slots) |
| 877 | goto out_free; | 876 | goto out_free; |
| 877 | memcpy(slots, kvm->memslots, sizeof(struct kvm_memslots)); | ||
| 878 | 878 | ||
| 879 | if ((change == KVM_MR_DELETE) || (change == KVM_MR_MOVE)) { | 879 | if ((change == KVM_MR_DELETE) || (change == KVM_MR_MOVE)) { |
| 880 | slot = id_to_memslot(slots, mem->slot); | 880 | slot = id_to_memslot(slots, mem->slot); |
| @@ -917,7 +917,7 @@ int __kvm_set_memory_region(struct kvm *kvm, | |||
| 917 | kvm_arch_commit_memory_region(kvm, mem, &old, change); | 917 | kvm_arch_commit_memory_region(kvm, mem, &old, change); |
| 918 | 918 | ||
| 919 | kvm_free_physmem_slot(kvm, &old, &new); | 919 | kvm_free_physmem_slot(kvm, &old, &new); |
| 920 | kfree(old_memslots); | 920 | kvfree(old_memslots); |
| 921 | 921 | ||
| 922 | /* | 922 | /* |
| 923 | * IOMMU mapping: New slots need to be mapped. Old slots need to be | 923 | * IOMMU mapping: New slots need to be mapped. Old slots need to be |
| @@ -936,7 +936,7 @@ int __kvm_set_memory_region(struct kvm *kvm, | |||
| 936 | return 0; | 936 | return 0; |
| 937 | 937 | ||
| 938 | out_slots: | 938 | out_slots: |
| 939 | kfree(slots); | 939 | kvfree(slots); |
| 940 | out_free: | 940 | out_free: |
| 941 | kvm_free_physmem_slot(kvm, &new, &old); | 941 | kvm_free_physmem_slot(kvm, &new, &old); |
| 942 | out: | 942 | out: |
