diff options
155 files changed, 1495 insertions, 764 deletions
diff --git a/Documentation/ABI/testing/sysfs-devices-system-cpu b/Documentation/ABI/testing/sysfs-devices-system-cpu index 99983e67c13c..da95513571ea 100644 --- a/Documentation/ABI/testing/sysfs-devices-system-cpu +++ b/Documentation/ABI/testing/sysfs-devices-system-cpu | |||
| @@ -162,7 +162,7 @@ Description: Discover CPUs in the same CPU frequency coordination domain | |||
| 162 | What: /sys/devices/system/cpu/cpu*/cache/index3/cache_disable_{0,1} | 162 | What: /sys/devices/system/cpu/cpu*/cache/index3/cache_disable_{0,1} |
| 163 | Date: August 2008 | 163 | Date: August 2008 |
| 164 | KernelVersion: 2.6.27 | 164 | KernelVersion: 2.6.27 |
| 165 | Contact: discuss@x86-64.org | 165 | Contact: Linux kernel mailing list <linux-kernel@vger.kernel.org> |
| 166 | Description: Disable L3 cache indices | 166 | Description: Disable L3 cache indices |
| 167 | 167 | ||
| 168 | These files exist in every CPU's cache/index3 directory. Each | 168 | These files exist in every CPU's cache/index3 directory. Each |
diff --git a/MAINTAINERS b/MAINTAINERS index 474bcb6c0bac..af802b357b6a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
| @@ -2427,7 +2427,6 @@ L: linux-security-module@vger.kernel.org | |||
| 2427 | S: Supported | 2427 | S: Supported |
| 2428 | F: include/linux/capability.h | 2428 | F: include/linux/capability.h |
| 2429 | F: include/uapi/linux/capability.h | 2429 | F: include/uapi/linux/capability.h |
| 2430 | F: security/capability.c | ||
| 2431 | F: security/commoncap.c | 2430 | F: security/commoncap.c |
| 2432 | F: kernel/capability.c | 2431 | F: kernel/capability.c |
| 2433 | 2432 | ||
diff --git a/arch/alpha/boot/Makefile b/arch/alpha/boot/Makefile index cd143887380a..8399bd0e68e8 100644 --- a/arch/alpha/boot/Makefile +++ b/arch/alpha/boot/Makefile | |||
| @@ -14,6 +14,9 @@ targets := vmlinux.gz vmlinux \ | |||
| 14 | tools/bootpzh bootloader bootpheader bootpzheader | 14 | tools/bootpzh bootloader bootpheader bootpzheader |
| 15 | OBJSTRIP := $(obj)/tools/objstrip | 15 | OBJSTRIP := $(obj)/tools/objstrip |
| 16 | 16 | ||
| 17 | HOSTCFLAGS := -Wall -I$(objtree)/usr/include | ||
| 18 | BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj) | ||
| 19 | |||
| 17 | # SRM bootable image. Copy to offset 512 of a partition. | 20 | # SRM bootable image. Copy to offset 512 of a partition. |
| 18 | $(obj)/bootimage: $(addprefix $(obj)/tools/,mkbb lxboot bootlx) $(obj)/vmlinux.nh | 21 | $(obj)/bootimage: $(addprefix $(obj)/tools/,mkbb lxboot bootlx) $(obj)/vmlinux.nh |
| 19 | ( cat $(obj)/tools/lxboot $(obj)/tools/bootlx $(obj)/vmlinux.nh ) > $@ | 22 | ( cat $(obj)/tools/lxboot $(obj)/tools/bootlx $(obj)/vmlinux.nh ) > $@ |
| @@ -96,13 +99,14 @@ $(obj)/tools/bootph: $(obj)/bootpheader $(OBJSTRIP) FORCE | |||
| 96 | $(obj)/tools/bootpzh: $(obj)/bootpzheader $(OBJSTRIP) FORCE | 99 | $(obj)/tools/bootpzh: $(obj)/bootpzheader $(OBJSTRIP) FORCE |
| 97 | $(call if_changed,objstrip) | 100 | $(call if_changed,objstrip) |
| 98 | 101 | ||
| 99 | LDFLAGS_bootloader := -static -uvsprintf -T #-N -relax | 102 | LDFLAGS_bootloader := -static -T # -N -relax |
| 100 | LDFLAGS_bootpheader := -static -uvsprintf -T #-N -relax | 103 | LDFLAGS_bootloader := -static -T # -N -relax |
| 101 | LDFLAGS_bootpzheader := -static -uvsprintf -T #-N -relax | 104 | LDFLAGS_bootpheader := -static -T # -N -relax |
| 105 | LDFLAGS_bootpzheader := -static -T # -N -relax | ||
| 102 | 106 | ||
| 103 | OBJ_bootlx := $(obj)/head.o $(obj)/main.o | 107 | OBJ_bootlx := $(obj)/head.o $(obj)/stdio.o $(obj)/main.o |
| 104 | OBJ_bootph := $(obj)/head.o $(obj)/bootp.o | 108 | OBJ_bootph := $(obj)/head.o $(obj)/stdio.o $(obj)/bootp.o |
| 105 | OBJ_bootpzh := $(obj)/head.o $(obj)/bootpz.o $(obj)/misc.o | 109 | OBJ_bootpzh := $(obj)/head.o $(obj)/stdio.o $(obj)/bootpz.o $(obj)/misc.o |
| 106 | 110 | ||
| 107 | $(obj)/bootloader: $(obj)/bootloader.lds $(OBJ_bootlx) $(LIBS_Y) FORCE | 111 | $(obj)/bootloader: $(obj)/bootloader.lds $(OBJ_bootlx) $(LIBS_Y) FORCE |
| 108 | $(call if_changed,ld) | 112 | $(call if_changed,ld) |
diff --git a/arch/alpha/boot/main.c b/arch/alpha/boot/main.c index 3baf2d1e908d..dd6eb4a33582 100644 --- a/arch/alpha/boot/main.c +++ b/arch/alpha/boot/main.c | |||
| @@ -19,7 +19,6 @@ | |||
| 19 | 19 | ||
| 20 | #include "ksize.h" | 20 | #include "ksize.h" |
| 21 | 21 | ||
| 22 | extern int vsprintf(char *, const char *, va_list); | ||
| 23 | extern unsigned long switch_to_osf_pal(unsigned long nr, | 22 | extern unsigned long switch_to_osf_pal(unsigned long nr, |
| 24 | struct pcb_struct * pcb_va, struct pcb_struct * pcb_pa, | 23 | struct pcb_struct * pcb_va, struct pcb_struct * pcb_pa, |
| 25 | unsigned long *vptb); | 24 | unsigned long *vptb); |
diff --git a/arch/alpha/boot/stdio.c b/arch/alpha/boot/stdio.c new file mode 100644 index 000000000000..f844dae8a54a --- /dev/null +++ b/arch/alpha/boot/stdio.c | |||
| @@ -0,0 +1,306 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) Paul Mackerras 1997. | ||
| 3 | * | ||
| 4 | * This program is free software; you can redistribute it and/or | ||
| 5 | * modify it under the terms of the GNU General Public License | ||
| 6 | * as published by the Free Software Foundation; either version | ||
| 7 | * 2 of the License, or (at your option) any later version. | ||
| 8 | */ | ||
| 9 | #include <stdarg.h> | ||
| 10 | #include <stddef.h> | ||
| 11 | |||
| 12 | size_t strnlen(const char * s, size_t count) | ||
| 13 | { | ||
| 14 | const char *sc; | ||
| 15 | |||
| 16 | for (sc = s; count-- && *sc != '\0'; ++sc) | ||
| 17 | /* nothing */; | ||
| 18 | return sc - s; | ||
| 19 | } | ||
| 20 | |||
| 21 | # define do_div(n, base) ({ \ | ||
| 22 | unsigned int __base = (base); \ | ||
| 23 | unsigned int __rem; \ | ||
| 24 | __rem = ((unsigned long long)(n)) % __base; \ | ||
| 25 | (n) = ((unsigned long long)(n)) / __base; \ | ||
| 26 | __rem; \ | ||
| 27 | }) | ||
| 28 | |||
| 29 | |||
| 30 | static int skip_atoi(const char **s) | ||
| 31 | { | ||
| 32 | int i, c; | ||
| 33 | |||
| 34 | for (i = 0; '0' <= (c = **s) && c <= '9'; ++*s) | ||
| 35 | i = i*10 + c - '0'; | ||
| 36 | return i; | ||
| 37 | } | ||
| 38 | |||
| 39 | #define ZEROPAD 1 /* pad with zero */ | ||
| 40 | #define SIGN 2 /* unsigned/signed long */ | ||
| 41 | #define PLUS 4 /* show plus */ | ||
| 42 | #define SPACE 8 /* space if plus */ | ||
| 43 | #define LEFT 16 /* left justified */ | ||
| 44 | #define SPECIAL 32 /* 0x */ | ||
| 45 | #define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */ | ||
| 46 | |||
| 47 | static char * number(char * str, unsigned long long num, int base, int size, int precision, int type) | ||
| 48 | { | ||
| 49 | char c,sign,tmp[66]; | ||
| 50 | const char *digits="0123456789abcdefghijklmnopqrstuvwxyz"; | ||
| 51 | int i; | ||
| 52 | |||
| 53 | if (type & LARGE) | ||
| 54 | digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; | ||
| 55 | if (type & LEFT) | ||
| 56 | type &= ~ZEROPAD; | ||
| 57 | if (base < 2 || base > 36) | ||
| 58 | return 0; | ||
| 59 | c = (type & ZEROPAD) ? '0' : ' '; | ||
| 60 | sign = 0; | ||
| 61 | if (type & SIGN) { | ||
| 62 | if ((signed long long)num < 0) { | ||
| 63 | sign = '-'; | ||
| 64 | num = - (signed long long)num; | ||
| 65 | size--; | ||
| 66 | } else if (type & PLUS) { | ||
| 67 | sign = '+'; | ||
| 68 | size--; | ||
| 69 | } else if (type & SPACE) { | ||
| 70 | sign = ' '; | ||
| 71 | size--; | ||
| 72 | } | ||
| 73 | } | ||
| 74 | if (type & SPECIAL) { | ||
| 75 | if (base == 16) | ||
| 76 | size -= 2; | ||
| 77 | else if (base == 8) | ||
| 78 | size--; | ||
| 79 | } | ||
| 80 | i = 0; | ||
| 81 | if (num == 0) | ||
| 82 | tmp[i++]='0'; | ||
| 83 | else while (num != 0) { | ||
| 84 | tmp[i++] = digits[do_div(num, base)]; | ||
| 85 | } | ||
| 86 | if (i > precision) | ||
| 87 | precision = i; | ||
| 88 | size -= precision; | ||
| 89 | if (!(type&(ZEROPAD+LEFT))) | ||
| 90 | while(size-->0) | ||
| 91 | *str++ = ' '; | ||
| 92 | if (sign) | ||
| 93 | *str++ = sign; | ||
| 94 | if (type & SPECIAL) { | ||
| 95 | if (base==8) | ||
| 96 | *str++ = '0'; | ||
| 97 | else if (base==16) { | ||
| 98 | *str++ = '0'; | ||
| 99 | *str++ = digits[33]; | ||
| 100 | } | ||
| 101 | } | ||
| 102 | if (!(type & LEFT)) | ||
| 103 | while (size-- > 0) | ||
| 104 | *str++ = c; | ||
| 105 | while (i < precision--) | ||
| 106 | *str++ = '0'; | ||
| 107 | while (i-- > 0) | ||
| 108 | *str++ = tmp[i]; | ||
| 109 | while (size-- > 0) | ||
| 110 | *str++ = ' '; | ||
| 111 | return str; | ||
| 112 | } | ||
| 113 | |||
| 114 | int vsprintf(char *buf, const char *fmt, va_list args) | ||
| 115 | { | ||
| 116 | int len; | ||
| 117 | unsigned long long num; | ||
| 118 | int i, base; | ||
| 119 | char * str; | ||
| 120 | const char *s; | ||
| 121 | |||
| 122 | int flags; /* flags to number() */ | ||
| 123 | |||
| 124 | int field_width; /* width of output field */ | ||
| 125 | int precision; /* min. # of digits for integers; max | ||
| 126 | number of chars for from string */ | ||
| 127 | int qualifier; /* 'h', 'l', or 'L' for integer fields */ | ||
| 128 | /* 'z' support added 23/7/1999 S.H. */ | ||
| 129 | /* 'z' changed to 'Z' --davidm 1/25/99 */ | ||
| 130 | |||
| 131 | |||
| 132 | for (str=buf ; *fmt ; ++fmt) { | ||
| 133 | if (*fmt != '%') { | ||
| 134 | *str++ = *fmt; | ||
| 135 | continue; | ||
| 136 | } | ||
| 137 | |||
| 138 | /* process flags */ | ||
| 139 | flags = 0; | ||
| 140 | repeat: | ||
| 141 | ++fmt; /* this also skips first '%' */ | ||
| 142 | switch (*fmt) { | ||
| 143 | case '-': flags |= LEFT; goto repeat; | ||
| 144 | case '+': flags |= PLUS; goto repeat; | ||
| 145 | case ' ': flags |= SPACE; goto repeat; | ||
| 146 | case '#': flags |= SPECIAL; goto repeat; | ||
| 147 | case '0': flags |= ZEROPAD; goto repeat; | ||
| 148 | } | ||
| 149 | |||
| 150 | /* get field width */ | ||
| 151 | field_width = -1; | ||
| 152 | if ('0' <= *fmt && *fmt <= '9') | ||
| 153 | field_width = skip_atoi(&fmt); | ||
| 154 | else if (*fmt == '*') { | ||
| 155 | ++fmt; | ||
| 156 | /* it's the next argument */ | ||
| 157 | field_width = va_arg(args, int); | ||
| 158 | if (field_width < 0) { | ||
| 159 | field_width = -field_width; | ||
| 160 | flags |= LEFT; | ||
| 161 | } | ||
| 162 | } | ||
| 163 | |||
| 164 | /* get the precision */ | ||
| 165 | precision = -1; | ||
| 166 | if (*fmt == '.') { | ||
| 167 | ++fmt; | ||
| 168 | if ('0' <= *fmt && *fmt <= '9') | ||
| 169 | precision = skip_atoi(&fmt); | ||
| 170 | else if (*fmt == '*') { | ||
| 171 | ++fmt; | ||
| 172 | /* it's the next argument */ | ||
| 173 | precision = va_arg(args, int); | ||
| 174 | } | ||
| 175 | if (precision < 0) | ||
| 176 | precision = 0; | ||
| 177 | } | ||
| 178 | |||
| 179 | /* get the conversion qualifier */ | ||
| 180 | qualifier = -1; | ||
| 181 | if (*fmt == 'l' && *(fmt + 1) == 'l') { | ||
| 182 | qualifier = 'q'; | ||
| 183 | fmt += 2; | ||
| 184 | } else if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' | ||
| 185 | || *fmt == 'Z') { | ||
| 186 | qualifier = *fmt; | ||
| 187 | ++fmt; | ||
| 188 | } | ||
| 189 | |||
| 190 | /* default base */ | ||
| 191 | base = 10; | ||
| 192 | |||
| 193 | switch (*fmt) { | ||
| 194 | case 'c': | ||
| 195 | if (!(flags & LEFT)) | ||
| 196 | while (--field_width > 0) | ||
| 197 | *str++ = ' '; | ||
| 198 | *str++ = (unsigned char) va_arg(args, int); | ||
| 199 | while (--field_width > 0) | ||
| 200 | *str++ = ' '; | ||
| 201 | continue; | ||
| 202 | |||
| 203 | case 's': | ||
| 204 | s = va_arg(args, char *); | ||
| 205 | if (!s) | ||
| 206 | s = "<NULL>"; | ||
| 207 | |||
| 208 | len = strnlen(s, precision); | ||
| 209 | |||
| 210 | if (!(flags & LEFT)) | ||
| 211 | while (len < field_width--) | ||
| 212 | *str++ = ' '; | ||
| 213 | for (i = 0; i < len; ++i) | ||
| 214 | *str++ = *s++; | ||
| 215 | while (len < field_width--) | ||
| 216 | *str++ = ' '; | ||
| 217 | continue; | ||
| 218 | |||
| 219 | case 'p': | ||
| 220 | if (field_width == -1) { | ||
| 221 | field_width = 2*sizeof(void *); | ||
| 222 | flags |= ZEROPAD; | ||
| 223 | } | ||
| 224 | str = number(str, | ||
| 225 | (unsigned long) va_arg(args, void *), 16, | ||
| 226 | field_width, precision, flags); | ||
| 227 | continue; | ||
| 228 | |||
| 229 | |||
| 230 | case 'n': | ||
| 231 | if (qualifier == 'l') { | ||
| 232 | long * ip = va_arg(args, long *); | ||
| 233 | *ip = (str - buf); | ||
| 234 | } else if (qualifier == 'Z') { | ||
| 235 | size_t * ip = va_arg(args, size_t *); | ||
| 236 | *ip = (str - buf); | ||
| 237 | } else { | ||
| 238 | int * ip = va_arg(args, int *); | ||
| 239 | *ip = (str - buf); | ||
| 240 | } | ||
| 241 | continue; | ||
| 242 | |||
| 243 | case '%': | ||
| 244 | *str++ = '%'; | ||
| 245 | continue; | ||
| 246 | |||
| 247 | /* integer number formats - set up the flags and "break" */ | ||
| 248 | case 'o': | ||
| 249 | base = 8; | ||
| 250 | break; | ||
| 251 | |||
| 252 | case 'X': | ||
| 253 | flags |= LARGE; | ||
| 254 | case 'x': | ||
| 255 | base = 16; | ||
| 256 | break; | ||
| 257 | |||
| 258 | case 'd': | ||
| 259 | case 'i': | ||
| 260 | flags |= SIGN; | ||
| 261 | case 'u': | ||
| 262 | break; | ||
| 263 | |||
| 264 | default: | ||
| 265 | *str++ = '%'; | ||
| 266 | if (*fmt) | ||
| 267 | *str++ = *fmt; | ||
| 268 | else | ||
| 269 | --fmt; | ||
| 270 | continue; | ||
| 271 | } | ||
| 272 | if (qualifier == 'l') { | ||
| 273 | num = va_arg(args, unsigned long); | ||
| 274 | if (flags & SIGN) | ||
| 275 | num = (signed long) num; | ||
| 276 | } else if (qualifier == 'q') { | ||
| 277 | num = va_arg(args, unsigned long long); | ||
| 278 | if (flags & SIGN) | ||
| 279 | num = (signed long long) num; | ||
| 280 | } else if (qualifier == 'Z') { | ||
| 281 | num = va_arg(args, size_t); | ||
| 282 | } else if (qualifier == 'h') { | ||
| 283 | num = (unsigned short) va_arg(args, int); | ||
| 284 | if (flags & SIGN) | ||
| 285 | num = (signed short) num; | ||
| 286 | } else { | ||
| 287 | num = va_arg(args, unsigned int); | ||
| 288 | if (flags & SIGN) | ||
| 289 | num = (signed int) num; | ||
| 290 | } | ||
| 291 | str = number(str, num, base, field_width, precision, flags); | ||
| 292 | } | ||
| 293 | *str = '\0'; | ||
| 294 | return str-buf; | ||
| 295 | } | ||
| 296 | |||
| 297 | int sprintf(char * buf, const char *fmt, ...) | ||
| 298 | { | ||
| 299 | va_list args; | ||
| 300 | int i; | ||
| 301 | |||
| 302 | va_start(args, fmt); | ||
| 303 | i=vsprintf(buf,fmt,args); | ||
| 304 | va_end(args); | ||
| 305 | return i; | ||
| 306 | } | ||
diff --git a/arch/alpha/boot/tools/objstrip.c b/arch/alpha/boot/tools/objstrip.c index 367d53d031fc..dee82695f48b 100644 --- a/arch/alpha/boot/tools/objstrip.c +++ b/arch/alpha/boot/tools/objstrip.c | |||
| @@ -27,6 +27,9 @@ | |||
| 27 | #include <linux/param.h> | 27 | #include <linux/param.h> |
| 28 | #ifdef __ELF__ | 28 | #ifdef __ELF__ |
| 29 | # include <linux/elf.h> | 29 | # include <linux/elf.h> |
| 30 | # define elfhdr elf64_hdr | ||
| 31 | # define elf_phdr elf64_phdr | ||
| 32 | # define elf_check_arch(x) ((x)->e_machine == EM_ALPHA) | ||
| 30 | #endif | 33 | #endif |
| 31 | 34 | ||
| 32 | /* bootfile size must be multiple of BLOCK_SIZE: */ | 35 | /* bootfile size must be multiple of BLOCK_SIZE: */ |
diff --git a/arch/alpha/include/asm/types.h b/arch/alpha/include/asm/types.h index f61e1a56c378..4cb4b6d3452c 100644 --- a/arch/alpha/include/asm/types.h +++ b/arch/alpha/include/asm/types.h | |||
| @@ -2,6 +2,5 @@ | |||
| 2 | #define _ALPHA_TYPES_H | 2 | #define _ALPHA_TYPES_H |
| 3 | 3 | ||
| 4 | #include <asm-generic/int-ll64.h> | 4 | #include <asm-generic/int-ll64.h> |
| 5 | #include <uapi/asm/types.h> | ||
| 6 | 5 | ||
| 7 | #endif /* _ALPHA_TYPES_H */ | 6 | #endif /* _ALPHA_TYPES_H */ |
diff --git a/arch/alpha/include/asm/unistd.h b/arch/alpha/include/asm/unistd.h index c509d306db45..a56e608db2f9 100644 --- a/arch/alpha/include/asm/unistd.h +++ b/arch/alpha/include/asm/unistd.h | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include <uapi/asm/unistd.h> | 4 | #include <uapi/asm/unistd.h> |
| 5 | 5 | ||
| 6 | #define NR_SYSCALLS 511 | 6 | #define NR_SYSCALLS 514 |
| 7 | 7 | ||
| 8 | #define __ARCH_WANT_OLD_READDIR | 8 | #define __ARCH_WANT_OLD_READDIR |
| 9 | #define __ARCH_WANT_STAT64 | 9 | #define __ARCH_WANT_STAT64 |
diff --git a/arch/alpha/include/uapi/asm/unistd.h b/arch/alpha/include/uapi/asm/unistd.h index d214a0358100..aa33bf5aacb6 100644 --- a/arch/alpha/include/uapi/asm/unistd.h +++ b/arch/alpha/include/uapi/asm/unistd.h | |||
| @@ -472,5 +472,8 @@ | |||
| 472 | #define __NR_sched_setattr 508 | 472 | #define __NR_sched_setattr 508 |
| 473 | #define __NR_sched_getattr 509 | 473 | #define __NR_sched_getattr 509 |
| 474 | #define __NR_renameat2 510 | 474 | #define __NR_renameat2 510 |
| 475 | #define __NR_getrandom 511 | ||
| 476 | #define __NR_memfd_create 512 | ||
| 477 | #define __NR_execveat 513 | ||
| 475 | 478 | ||
| 476 | #endif /* _UAPI_ALPHA_UNISTD_H */ | 479 | #endif /* _UAPI_ALPHA_UNISTD_H */ |
diff --git a/arch/alpha/kernel/err_ev6.c b/arch/alpha/kernel/err_ev6.c index 253cf1a87481..51267ac5729b 100644 --- a/arch/alpha/kernel/err_ev6.c +++ b/arch/alpha/kernel/err_ev6.c | |||
| @@ -6,7 +6,6 @@ | |||
| 6 | * Error handling code supporting Alpha systems | 6 | * Error handling code supporting Alpha systems |
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | #include <linux/init.h> | ||
| 10 | #include <linux/sched.h> | 9 | #include <linux/sched.h> |
| 11 | 10 | ||
| 12 | #include <asm/io.h> | 11 | #include <asm/io.h> |
diff --git a/arch/alpha/kernel/irq.c b/arch/alpha/kernel/irq.c index 7b2be251c30f..51f2c8654253 100644 --- a/arch/alpha/kernel/irq.c +++ b/arch/alpha/kernel/irq.c | |||
| @@ -19,7 +19,6 @@ | |||
| 19 | #include <linux/ptrace.h> | 19 | #include <linux/ptrace.h> |
| 20 | #include <linux/interrupt.h> | 20 | #include <linux/interrupt.h> |
| 21 | #include <linux/random.h> | 21 | #include <linux/random.h> |
| 22 | #include <linux/init.h> | ||
| 23 | #include <linux/irq.h> | 22 | #include <linux/irq.h> |
| 24 | #include <linux/proc_fs.h> | 23 | #include <linux/proc_fs.h> |
| 25 | #include <linux/seq_file.h> | 24 | #include <linux/seq_file.h> |
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c index e51f578636a5..36dc91ace83a 100644 --- a/arch/alpha/kernel/osf_sys.c +++ b/arch/alpha/kernel/osf_sys.c | |||
| @@ -1019,14 +1019,13 @@ SYSCALL_DEFINE2(osf_settimeofday, struct timeval32 __user *, tv, | |||
| 1019 | if (tv) { | 1019 | if (tv) { |
| 1020 | if (get_tv32((struct timeval *)&kts, tv)) | 1020 | if (get_tv32((struct timeval *)&kts, tv)) |
| 1021 | return -EFAULT; | 1021 | return -EFAULT; |
| 1022 | kts.tv_nsec *= 1000; | ||
| 1022 | } | 1023 | } |
| 1023 | if (tz) { | 1024 | if (tz) { |
| 1024 | if (copy_from_user(&ktz, tz, sizeof(*tz))) | 1025 | if (copy_from_user(&ktz, tz, sizeof(*tz))) |
| 1025 | return -EFAULT; | 1026 | return -EFAULT; |
| 1026 | } | 1027 | } |
| 1027 | 1028 | ||
| 1028 | kts.tv_nsec *= 1000; | ||
| 1029 | |||
| 1030 | return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL); | 1029 | return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL); |
| 1031 | } | 1030 | } |
| 1032 | 1031 | ||
diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c index 1941a07b5811..84d13263ce46 100644 --- a/arch/alpha/kernel/process.c +++ b/arch/alpha/kernel/process.c | |||
| @@ -236,12 +236,11 @@ release_thread(struct task_struct *dead_task) | |||
| 236 | } | 236 | } |
| 237 | 237 | ||
| 238 | /* | 238 | /* |
| 239 | * Copy an alpha thread.. | 239 | * Copy architecture-specific thread state |
| 240 | */ | 240 | */ |
| 241 | |||
| 242 | int | 241 | int |
| 243 | copy_thread(unsigned long clone_flags, unsigned long usp, | 242 | copy_thread(unsigned long clone_flags, unsigned long usp, |
| 244 | unsigned long arg, | 243 | unsigned long kthread_arg, |
| 245 | struct task_struct *p) | 244 | struct task_struct *p) |
| 246 | { | 245 | { |
| 247 | extern void ret_from_fork(void); | 246 | extern void ret_from_fork(void); |
| @@ -262,7 +261,7 @@ copy_thread(unsigned long clone_flags, unsigned long usp, | |||
| 262 | sizeof(struct switch_stack) + sizeof(struct pt_regs)); | 261 | sizeof(struct switch_stack) + sizeof(struct pt_regs)); |
| 263 | childstack->r26 = (unsigned long) ret_from_kernel_thread; | 262 | childstack->r26 = (unsigned long) ret_from_kernel_thread; |
| 264 | childstack->r9 = usp; /* function */ | 263 | childstack->r9 = usp; /* function */ |
| 265 | childstack->r10 = arg; | 264 | childstack->r10 = kthread_arg; |
| 266 | childregs->hae = alpha_mv.hae_cache, | 265 | childregs->hae = alpha_mv.hae_cache, |
| 267 | childti->pcb.usp = 0; | 266 | childti->pcb.usp = 0; |
| 268 | return 0; | 267 | return 0; |
diff --git a/arch/alpha/kernel/smp.c b/arch/alpha/kernel/smp.c index 99ac36d5de4e..2f24447fef92 100644 --- a/arch/alpha/kernel/smp.c +++ b/arch/alpha/kernel/smp.c | |||
| @@ -63,7 +63,6 @@ static struct { | |||
| 63 | enum ipi_message_type { | 63 | enum ipi_message_type { |
| 64 | IPI_RESCHEDULE, | 64 | IPI_RESCHEDULE, |
| 65 | IPI_CALL_FUNC, | 65 | IPI_CALL_FUNC, |
| 66 | IPI_CALL_FUNC_SINGLE, | ||
| 67 | IPI_CPU_STOP, | 66 | IPI_CPU_STOP, |
| 68 | }; | 67 | }; |
| 69 | 68 | ||
| @@ -506,7 +505,6 @@ setup_profiling_timer(unsigned int multiplier) | |||
| 506 | return -EINVAL; | 505 | return -EINVAL; |
| 507 | } | 506 | } |
| 508 | 507 | ||
| 509 | |||
| 510 | static void | 508 | static void |
| 511 | send_ipi_message(const struct cpumask *to_whom, enum ipi_message_type operation) | 509 | send_ipi_message(const struct cpumask *to_whom, enum ipi_message_type operation) |
| 512 | { | 510 | { |
| @@ -552,10 +550,6 @@ handle_ipi(struct pt_regs *regs) | |||
| 552 | generic_smp_call_function_interrupt(); | 550 | generic_smp_call_function_interrupt(); |
| 553 | break; | 551 | break; |
| 554 | 552 | ||
| 555 | case IPI_CALL_FUNC_SINGLE: | ||
| 556 | generic_smp_call_function_single_interrupt(); | ||
| 557 | break; | ||
| 558 | |||
| 559 | case IPI_CPU_STOP: | 553 | case IPI_CPU_STOP: |
| 560 | halt(); | 554 | halt(); |
| 561 | 555 | ||
| @@ -606,7 +600,7 @@ void arch_send_call_function_ipi_mask(const struct cpumask *mask) | |||
| 606 | 600 | ||
| 607 | void arch_send_call_function_single_ipi(int cpu) | 601 | void arch_send_call_function_single_ipi(int cpu) |
| 608 | { | 602 | { |
| 609 | send_ipi_message(cpumask_of(cpu), IPI_CALL_FUNC_SINGLE); | 603 | send_ipi_message(cpumask_of(cpu), IPI_CALL_FUNC); |
| 610 | } | 604 | } |
| 611 | 605 | ||
| 612 | static void | 606 | static void |
diff --git a/arch/alpha/kernel/srmcons.c b/arch/alpha/kernel/srmcons.c index 6f01d9ad7b81..72b59511e59a 100644 --- a/arch/alpha/kernel/srmcons.c +++ b/arch/alpha/kernel/srmcons.c | |||
| @@ -237,8 +237,7 @@ srmcons_init(void) | |||
| 237 | 237 | ||
| 238 | return -ENODEV; | 238 | return -ENODEV; |
| 239 | } | 239 | } |
| 240 | 240 | device_initcall(srmcons_init); | |
| 241 | module_init(srmcons_init); | ||
| 242 | 241 | ||
| 243 | 242 | ||
| 244 | /* | 243 | /* |
diff --git a/arch/alpha/kernel/sys_marvel.c b/arch/alpha/kernel/sys_marvel.c index f21d61fab678..24e41bd7d3c9 100644 --- a/arch/alpha/kernel/sys_marvel.c +++ b/arch/alpha/kernel/sys_marvel.c | |||
| @@ -331,7 +331,7 @@ marvel_map_irq(const struct pci_dev *cdev, u8 slot, u8 pin) | |||
| 331 | pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &intline); | 331 | pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &intline); |
| 332 | irq = intline; | 332 | irq = intline; |
| 333 | 333 | ||
| 334 | msi_loc = pci_find_capability(dev, PCI_CAP_ID_MSI); | 334 | msi_loc = dev->msi_cap; |
| 335 | msg_ctl = 0; | 335 | msg_ctl = 0; |
| 336 | if (msi_loc) | 336 | if (msi_loc) |
| 337 | pci_read_config_word(dev, msi_loc + PCI_MSI_FLAGS, &msg_ctl); | 337 | pci_read_config_word(dev, msi_loc + PCI_MSI_FLAGS, &msg_ctl); |
diff --git a/arch/alpha/kernel/systbls.S b/arch/alpha/kernel/systbls.S index 24789713f1ea..9b62e3fd4f03 100644 --- a/arch/alpha/kernel/systbls.S +++ b/arch/alpha/kernel/systbls.S | |||
| @@ -529,6 +529,9 @@ sys_call_table: | |||
| 529 | .quad sys_sched_setattr | 529 | .quad sys_sched_setattr |
| 530 | .quad sys_sched_getattr | 530 | .quad sys_sched_getattr |
| 531 | .quad sys_renameat2 /* 510 */ | 531 | .quad sys_renameat2 /* 510 */ |
| 532 | .quad sys_getrandom | ||
| 533 | .quad sys_memfd_create | ||
| 534 | .quad sys_execveat | ||
| 532 | 535 | ||
| 533 | .size sys_call_table, . - sys_call_table | 536 | .size sys_call_table, . - sys_call_table |
| 534 | .type sys_call_table, @object | 537 | .type sys_call_table, @object |
diff --git a/arch/alpha/kernel/traps.c b/arch/alpha/kernel/traps.c index 9c4c189eb22f..74aceead06e9 100644 --- a/arch/alpha/kernel/traps.c +++ b/arch/alpha/kernel/traps.c | |||
| @@ -14,7 +14,6 @@ | |||
| 14 | #include <linux/tty.h> | 14 | #include <linux/tty.h> |
| 15 | #include <linux/delay.h> | 15 | #include <linux/delay.h> |
| 16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
| 17 | #include <linux/init.h> | ||
| 18 | #include <linux/kallsyms.h> | 17 | #include <linux/kallsyms.h> |
| 19 | #include <linux/ratelimit.h> | 18 | #include <linux/ratelimit.h> |
| 20 | 19 | ||
diff --git a/arch/alpha/oprofile/op_model_ev4.c b/arch/alpha/oprofile/op_model_ev4.c index 18aa9b4f94f1..086a0d5445c5 100644 --- a/arch/alpha/oprofile/op_model_ev4.c +++ b/arch/alpha/oprofile/op_model_ev4.c | |||
| @@ -8,7 +8,6 @@ | |||
| 8 | */ | 8 | */ |
| 9 | 9 | ||
| 10 | #include <linux/oprofile.h> | 10 | #include <linux/oprofile.h> |
| 11 | #include <linux/init.h> | ||
| 12 | #include <linux/smp.h> | 11 | #include <linux/smp.h> |
| 13 | #include <asm/ptrace.h> | 12 | #include <asm/ptrace.h> |
| 14 | 13 | ||
diff --git a/arch/alpha/oprofile/op_model_ev5.c b/arch/alpha/oprofile/op_model_ev5.c index c32f8a0ad925..c300f5ef3482 100644 --- a/arch/alpha/oprofile/op_model_ev5.c +++ b/arch/alpha/oprofile/op_model_ev5.c | |||
| @@ -8,7 +8,6 @@ | |||
| 8 | */ | 8 | */ |
| 9 | 9 | ||
| 10 | #include <linux/oprofile.h> | 10 | #include <linux/oprofile.h> |
| 11 | #include <linux/init.h> | ||
| 12 | #include <linux/smp.h> | 11 | #include <linux/smp.h> |
| 13 | #include <asm/ptrace.h> | 12 | #include <asm/ptrace.h> |
| 14 | 13 | ||
diff --git a/arch/alpha/oprofile/op_model_ev6.c b/arch/alpha/oprofile/op_model_ev6.c index 1c84cc257fc7..02edf5971614 100644 --- a/arch/alpha/oprofile/op_model_ev6.c +++ b/arch/alpha/oprofile/op_model_ev6.c | |||
| @@ -8,7 +8,6 @@ | |||
| 8 | */ | 8 | */ |
| 9 | 9 | ||
| 10 | #include <linux/oprofile.h> | 10 | #include <linux/oprofile.h> |
| 11 | #include <linux/init.h> | ||
| 12 | #include <linux/smp.h> | 11 | #include <linux/smp.h> |
| 13 | #include <asm/ptrace.h> | 12 | #include <asm/ptrace.h> |
| 14 | 13 | ||
diff --git a/arch/alpha/oprofile/op_model_ev67.c b/arch/alpha/oprofile/op_model_ev67.c index 34a57a126553..adb1744d20f3 100644 --- a/arch/alpha/oprofile/op_model_ev67.c +++ b/arch/alpha/oprofile/op_model_ev67.c | |||
| @@ -9,7 +9,6 @@ | |||
| 9 | */ | 9 | */ |
| 10 | 10 | ||
| 11 | #include <linux/oprofile.h> | 11 | #include <linux/oprofile.h> |
| 12 | #include <linux/init.h> | ||
| 13 | #include <linux/smp.h> | 12 | #include <linux/smp.h> |
| 14 | #include <asm/ptrace.h> | 13 | #include <asm/ptrace.h> |
| 15 | 14 | ||
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index 86217db2937a..992736b5229b 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile | |||
| @@ -223,7 +223,7 @@ dtb-$(CONFIG_SOC_IMX25) += \ | |||
| 223 | imx25-eukrea-mbimxsd25-baseboard-dvi-vga.dtb \ | 223 | imx25-eukrea-mbimxsd25-baseboard-dvi-vga.dtb \ |
| 224 | imx25-karo-tx25.dtb \ | 224 | imx25-karo-tx25.dtb \ |
| 225 | imx25-pdk.dtb | 225 | imx25-pdk.dtb |
| 226 | dtb-$(CONFIG_SOC_IMX31) += \ | 226 | dtb-$(CONFIG_SOC_IMX27) += \ |
| 227 | imx27-apf27.dtb \ | 227 | imx27-apf27.dtb \ |
| 228 | imx27-apf27dev.dtb \ | 228 | imx27-apf27dev.dtb \ |
| 229 | imx27-eukrea-mbimxsd27-baseboard.dtb \ | 229 | imx27-eukrea-mbimxsd27-baseboard.dtb \ |
diff --git a/arch/arm/boot/dts/am335x-boneblack.dts b/arch/arm/boot/dts/am335x-boneblack.dts index 5c42d259fa68..901739fcb85a 100644 --- a/arch/arm/boot/dts/am335x-boneblack.dts +++ b/arch/arm/boot/dts/am335x-boneblack.dts | |||
| @@ -80,7 +80,3 @@ | |||
| 80 | status = "okay"; | 80 | status = "okay"; |
| 81 | }; | 81 | }; |
| 82 | }; | 82 | }; |
| 83 | |||
| 84 | &rtc { | ||
| 85 | system-power-controller; | ||
| 86 | }; | ||
diff --git a/arch/arm/boot/dts/am335x-evmsk.dts b/arch/arm/boot/dts/am335x-evmsk.dts index 87fc7a35e802..156d05efcb70 100644 --- a/arch/arm/boot/dts/am335x-evmsk.dts +++ b/arch/arm/boot/dts/am335x-evmsk.dts | |||
| @@ -654,7 +654,7 @@ | |||
| 654 | wlcore: wlcore@2 { | 654 | wlcore: wlcore@2 { |
| 655 | compatible = "ti,wl1271"; | 655 | compatible = "ti,wl1271"; |
| 656 | reg = <2>; | 656 | reg = <2>; |
| 657 | interrupt-parent = <&gpio1>; | 657 | interrupt-parent = <&gpio0>; |
| 658 | interrupts = <31 IRQ_TYPE_LEVEL_HIGH>; /* gpio 31 */ | 658 | interrupts = <31 IRQ_TYPE_LEVEL_HIGH>; /* gpio 31 */ |
| 659 | ref-clock-frequency = <38400000>; | 659 | ref-clock-frequency = <38400000>; |
| 660 | }; | 660 | }; |
diff --git a/arch/arm/boot/dts/exynos4412-trats2.dts b/arch/arm/boot/dts/exynos4412-trats2.dts index 173ffa479ad3..792394dd0f2a 100644 --- a/arch/arm/boot/dts/exynos4412-trats2.dts +++ b/arch/arm/boot/dts/exynos4412-trats2.dts | |||
| @@ -736,7 +736,7 @@ | |||
| 736 | 736 | ||
| 737 | display-timings { | 737 | display-timings { |
| 738 | timing-0 { | 738 | timing-0 { |
| 739 | clock-frequency = <0>; | 739 | clock-frequency = <57153600>; |
| 740 | hactive = <720>; | 740 | hactive = <720>; |
| 741 | vactive = <1280>; | 741 | vactive = <1280>; |
| 742 | hfront-porch = <5>; | 742 | hfront-porch = <5>; |
diff --git a/arch/arm/boot/dts/imx27.dtsi b/arch/arm/boot/dts/imx27.dtsi index 6951b66d1ab7..bc215e4b75fd 100644 --- a/arch/arm/boot/dts/imx27.dtsi +++ b/arch/arm/boot/dts/imx27.dtsi | |||
| @@ -533,7 +533,7 @@ | |||
| 533 | 533 | ||
| 534 | fec: ethernet@1002b000 { | 534 | fec: ethernet@1002b000 { |
| 535 | compatible = "fsl,imx27-fec"; | 535 | compatible = "fsl,imx27-fec"; |
| 536 | reg = <0x1002b000 0x4000>; | 536 | reg = <0x1002b000 0x1000>; |
| 537 | interrupts = <50>; | 537 | interrupts = <50>; |
| 538 | clocks = <&clks IMX27_CLK_FEC_IPG_GATE>, | 538 | clocks = <&clks IMX27_CLK_FEC_IPG_GATE>, |
| 539 | <&clks IMX27_CLK_FEC_AHB_GATE>; | 539 | <&clks IMX27_CLK_FEC_AHB_GATE>; |
diff --git a/arch/arm/boot/dts/omap3-devkit8000.dts b/arch/arm/boot/dts/omap3-devkit8000.dts index 134d3f27a8ec..921de6605f07 100644 --- a/arch/arm/boot/dts/omap3-devkit8000.dts +++ b/arch/arm/boot/dts/omap3-devkit8000.dts | |||
| @@ -110,6 +110,8 @@ | |||
| 110 | nand@0,0 { | 110 | nand@0,0 { |
| 111 | reg = <0 0 4>; /* CS0, offset 0, IO size 4 */ | 111 | reg = <0 0 4>; /* CS0, offset 0, IO size 4 */ |
| 112 | nand-bus-width = <16>; | 112 | nand-bus-width = <16>; |
| 113 | gpmc,device-width = <2>; | ||
| 114 | ti,nand-ecc-opt = "sw"; | ||
| 113 | 115 | ||
| 114 | gpmc,sync-clk-ps = <0>; | 116 | gpmc,sync-clk-ps = <0>; |
| 115 | gpmc,cs-on-ns = <0>; | 117 | gpmc,cs-on-ns = <0>; |
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig index 0ca4a3eaf65d..fbbb1915c6a9 100644 --- a/arch/arm/configs/multi_v7_defconfig +++ b/arch/arm/configs/multi_v7_defconfig | |||
| @@ -429,7 +429,7 @@ CONFIG_USB_EHCI_EXYNOS=y | |||
| 429 | CONFIG_USB_EHCI_TEGRA=y | 429 | CONFIG_USB_EHCI_TEGRA=y |
| 430 | CONFIG_USB_EHCI_HCD_STI=y | 430 | CONFIG_USB_EHCI_HCD_STI=y |
| 431 | CONFIG_USB_EHCI_HCD_PLATFORM=y | 431 | CONFIG_USB_EHCI_HCD_PLATFORM=y |
| 432 | CONFIG_USB_ISP1760_HCD=y | 432 | CONFIG_USB_ISP1760=y |
| 433 | CONFIG_USB_OHCI_HCD=y | 433 | CONFIG_USB_OHCI_HCD=y |
| 434 | CONFIG_USB_OHCI_HCD_STI=y | 434 | CONFIG_USB_OHCI_HCD_STI=y |
| 435 | CONFIG_USB_OHCI_HCD_PLATFORM=y | 435 | CONFIG_USB_OHCI_HCD_PLATFORM=y |
diff --git a/arch/arm/mach-imx/gpc.c b/arch/arm/mach-imx/gpc.c index 4d60005e9277..6d0893a3828e 100644 --- a/arch/arm/mach-imx/gpc.c +++ b/arch/arm/mach-imx/gpc.c | |||
| @@ -280,9 +280,15 @@ void __init imx_gpc_check_dt(void) | |||
| 280 | struct device_node *np; | 280 | struct device_node *np; |
| 281 | 281 | ||
| 282 | np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-gpc"); | 282 | np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-gpc"); |
| 283 | if (WARN_ON(!np || | 283 | if (WARN_ON(!np)) |
| 284 | !of_find_property(np, "interrupt-controller", NULL))) | 284 | return; |
| 285 | pr_warn("Outdated DT detected, system is about to crash!!!\n"); | 285 | |
| 286 | if (WARN_ON(!of_find_property(np, "interrupt-controller", NULL))) { | ||
| 287 | pr_warn("Outdated DT detected, suspend/resume will NOT work\n"); | ||
| 288 | |||
| 289 | /* map GPC, so that at least CPUidle and WARs keep working */ | ||
| 290 | gpc_base = of_iomap(np, 0); | ||
| 291 | } | ||
| 286 | } | 292 | } |
| 287 | 293 | ||
| 288 | #ifdef CONFIG_PM_GENERIC_DOMAINS | 294 | #ifdef CONFIG_PM_GENERIC_DOMAINS |
| @@ -443,6 +449,10 @@ static int imx_gpc_probe(struct platform_device *pdev) | |||
| 443 | struct regulator *pu_reg; | 449 | struct regulator *pu_reg; |
| 444 | int ret; | 450 | int ret; |
| 445 | 451 | ||
| 452 | /* bail out if DT too old and doesn't provide the necessary info */ | ||
| 453 | if (!of_property_read_bool(pdev->dev.of_node, "#power-domain-cells")) | ||
| 454 | return 0; | ||
| 455 | |||
| 446 | pu_reg = devm_regulator_get_optional(&pdev->dev, "pu"); | 456 | pu_reg = devm_regulator_get_optional(&pdev->dev, "pu"); |
| 447 | if (PTR_ERR(pu_reg) == -ENODEV) | 457 | if (PTR_ERR(pu_reg) == -ENODEV) |
| 448 | pu_reg = NULL; | 458 | pu_reg = NULL; |
diff --git a/arch/arm/mach-pxa/pxa_cplds_irqs.c b/arch/arm/mach-pxa/pxa_cplds_irqs.c index f1aeb54fabe3..2385052b0ce1 100644 --- a/arch/arm/mach-pxa/pxa_cplds_irqs.c +++ b/arch/arm/mach-pxa/pxa_cplds_irqs.c | |||
| @@ -107,7 +107,7 @@ static int cplds_probe(struct platform_device *pdev) | |||
| 107 | struct resource *res; | 107 | struct resource *res; |
| 108 | struct cplds *fpga; | 108 | struct cplds *fpga; |
| 109 | int ret; | 109 | int ret; |
| 110 | unsigned int base_irq = 0; | 110 | int base_irq; |
| 111 | unsigned long irqflags = 0; | 111 | unsigned long irqflags = 0; |
| 112 | 112 | ||
| 113 | fpga = devm_kzalloc(&pdev->dev, sizeof(*fpga), GFP_KERNEL); | 113 | fpga = devm_kzalloc(&pdev->dev, sizeof(*fpga), GFP_KERNEL); |
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c index d4e162d35b34..7cc3be9fa7c6 100644 --- a/arch/ia64/pci/pci.c +++ b/arch/ia64/pci/pci.c | |||
| @@ -478,9 +478,16 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) | |||
| 478 | 478 | ||
| 479 | int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge) | 479 | int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge) |
| 480 | { | 480 | { |
| 481 | struct pci_controller *controller = bridge->bus->sysdata; | 481 | /* |
| 482 | 482 | * We pass NULL as parent to pci_create_root_bus(), so if it is not NULL | |
| 483 | ACPI_COMPANION_SET(&bridge->dev, controller->companion); | 483 | * here, pci_create_root_bus() has been called by someone else and |
| 484 | * sysdata is likely to be different from what we expect. Let it go in | ||
| 485 | * that case. | ||
| 486 | */ | ||
| 487 | if (!bridge->dev.parent) { | ||
| 488 | struct pci_controller *controller = bridge->bus->sysdata; | ||
| 489 | ACPI_COMPANION_SET(&bridge->dev, controller->companion); | ||
| 490 | } | ||
| 484 | return 0; | 491 | return 0; |
| 485 | } | 492 | } |
| 486 | 493 | ||
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c index e535533d5ab8..20190bdac9d5 100644 --- a/arch/x86/kernel/cpu/mcheck/mce.c +++ b/arch/x86/kernel/cpu/mcheck/mce.c | |||
| @@ -708,6 +708,7 @@ static int mce_no_way_out(struct mce *m, char **msg, unsigned long *validp, | |||
| 708 | struct pt_regs *regs) | 708 | struct pt_regs *regs) |
| 709 | { | 709 | { |
| 710 | int i, ret = 0; | 710 | int i, ret = 0; |
| 711 | char *tmp; | ||
| 711 | 712 | ||
| 712 | for (i = 0; i < mca_cfg.banks; i++) { | 713 | for (i = 0; i < mca_cfg.banks; i++) { |
| 713 | m->status = mce_rdmsrl(MSR_IA32_MCx_STATUS(i)); | 714 | m->status = mce_rdmsrl(MSR_IA32_MCx_STATUS(i)); |
| @@ -716,9 +717,11 @@ static int mce_no_way_out(struct mce *m, char **msg, unsigned long *validp, | |||
| 716 | if (quirk_no_way_out) | 717 | if (quirk_no_way_out) |
| 717 | quirk_no_way_out(i, m, regs); | 718 | quirk_no_way_out(i, m, regs); |
| 718 | } | 719 | } |
| 719 | if (mce_severity(m, mca_cfg.tolerant, msg, true) >= | 720 | |
| 720 | MCE_PANIC_SEVERITY) | 721 | if (mce_severity(m, mca_cfg.tolerant, &tmp, true) >= MCE_PANIC_SEVERITY) { |
| 722 | *msg = tmp; | ||
| 721 | ret = 1; | 723 | ret = 1; |
| 724 | } | ||
| 722 | } | 725 | } |
| 723 | return ret; | 726 | return ret; |
| 724 | } | 727 | } |
diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c index 009183276bb7..6185d3141219 100644 --- a/arch/x86/kernel/i387.c +++ b/arch/x86/kernel/i387.c | |||
| @@ -173,6 +173,21 @@ static void init_thread_xstate(void) | |||
| 173 | xstate_size = sizeof(struct i387_fxsave_struct); | 173 | xstate_size = sizeof(struct i387_fxsave_struct); |
| 174 | else | 174 | else |
| 175 | xstate_size = sizeof(struct i387_fsave_struct); | 175 | xstate_size = sizeof(struct i387_fsave_struct); |
| 176 | |||
| 177 | /* | ||
| 178 | * Quirk: we don't yet handle the XSAVES* instructions | ||
| 179 | * correctly, as we don't correctly convert between | ||
| 180 | * standard and compacted format when interfacing | ||
| 181 | * with user-space - so disable it for now. | ||
| 182 | * | ||
| 183 | * The difference is small: with recent CPUs the | ||
| 184 | * compacted format is only marginally smaller than | ||
| 185 | * the standard FPU state format. | ||
| 186 | * | ||
| 187 | * ( This is easy to backport while we are fixing | ||
| 188 | * XSAVES* support. ) | ||
| 189 | */ | ||
| 190 | setup_clear_cpu_cap(X86_FEATURE_XSAVES); | ||
| 176 | } | 191 | } |
| 177 | 192 | ||
| 178 | /* | 193 | /* |
diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c index 99f76103c6b7..ddeff4844a10 100644 --- a/arch/x86/net/bpf_jit_comp.c +++ b/arch/x86/net/bpf_jit_comp.c | |||
| @@ -966,7 +966,12 @@ void bpf_int_jit_compile(struct bpf_prog *prog) | |||
| 966 | } | 966 | } |
| 967 | ctx.cleanup_addr = proglen; | 967 | ctx.cleanup_addr = proglen; |
| 968 | 968 | ||
| 969 | for (pass = 0; pass < 10; pass++) { | 969 | /* JITed image shrinks with every pass and the loop iterates |
| 970 | * until the image stops shrinking. Very large bpf programs | ||
| 971 | * may converge on the last pass. In such case do one more | ||
| 972 | * pass to emit the final image | ||
| 973 | */ | ||
| 974 | for (pass = 0; pass < 10 || image; pass++) { | ||
| 970 | proglen = do_jit(prog, addrs, image, oldproglen, &ctx); | 975 | proglen = do_jit(prog, addrs, image, oldproglen, &ctx); |
| 971 | if (proglen <= 0) { | 976 | if (proglen <= 0) { |
| 972 | image = NULL; | 977 | image = NULL; |
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c index d93963340c3c..14a63ed6fe09 100644 --- a/arch/x86/pci/acpi.c +++ b/arch/x86/pci/acpi.c | |||
| @@ -482,9 +482,16 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) | |||
| 482 | 482 | ||
| 483 | int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge) | 483 | int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge) |
| 484 | { | 484 | { |
| 485 | struct pci_sysdata *sd = bridge->bus->sysdata; | 485 | /* |
| 486 | 486 | * We pass NULL as parent to pci_create_root_bus(), so if it is not NULL | |
| 487 | ACPI_COMPANION_SET(&bridge->dev, sd->companion); | 487 | * here, pci_create_root_bus() has been called by someone else and |
| 488 | * sysdata is likely to be different from what we expect. Let it go in | ||
| 489 | * that case. | ||
| 490 | */ | ||
| 491 | if (!bridge->dev.parent) { | ||
| 492 | struct pci_sysdata *sd = bridge->bus->sysdata; | ||
| 493 | ACPI_COMPANION_SET(&bridge->dev, sd->companion); | ||
| 494 | } | ||
| 488 | return 0; | 495 | return 0; |
| 489 | } | 496 | } |
| 490 | 497 | ||
diff --git a/arch/xtensa/include/asm/dma-mapping.h b/arch/xtensa/include/asm/dma-mapping.h index 172a02a6ad14..ba78ccf651e7 100644 --- a/arch/xtensa/include/asm/dma-mapping.h +++ b/arch/xtensa/include/asm/dma-mapping.h | |||
| @@ -185,4 +185,17 @@ static inline int dma_get_sgtable(struct device *dev, struct sg_table *sgt, | |||
| 185 | return -EINVAL; | 185 | return -EINVAL; |
| 186 | } | 186 | } |
| 187 | 187 | ||
| 188 | static inline void *dma_alloc_attrs(struct device *dev, size_t size, | ||
| 189 | dma_addr_t *dma_handle, gfp_t flag, | ||
| 190 | struct dma_attrs *attrs) | ||
| 191 | { | ||
| 192 | return NULL; | ||
| 193 | } | ||
| 194 | |||
| 195 | static inline void dma_free_attrs(struct device *dev, size_t size, | ||
| 196 | void *vaddr, dma_addr_t dma_handle, | ||
| 197 | struct dma_attrs *attrs) | ||
| 198 | { | ||
| 199 | } | ||
| 200 | |||
| 188 | #endif /* _XTENSA_DMA_MAPPING_H */ | 201 | #endif /* _XTENSA_DMA_MAPPING_H */ |
diff --git a/crypto/Kconfig b/crypto/Kconfig index 8aaf298a80e1..362905e7c841 100644 --- a/crypto/Kconfig +++ b/crypto/Kconfig | |||
| @@ -1512,15 +1512,6 @@ config CRYPTO_USER_API_RNG | |||
| 1512 | This option enables the user-spaces interface for random | 1512 | This option enables the user-spaces interface for random |
| 1513 | number generator algorithms. | 1513 | number generator algorithms. |
| 1514 | 1514 | ||
| 1515 | config CRYPTO_USER_API_AEAD | ||
| 1516 | tristate "User-space interface for AEAD cipher algorithms" | ||
| 1517 | depends on NET | ||
| 1518 | select CRYPTO_AEAD | ||
| 1519 | select CRYPTO_USER_API | ||
| 1520 | help | ||
| 1521 | This option enables the user-spaces interface for AEAD | ||
| 1522 | cipher algorithms. | ||
| 1523 | |||
| 1524 | config CRYPTO_HASH_INFO | 1515 | config CRYPTO_HASH_INFO |
| 1525 | bool | 1516 | bool |
| 1526 | 1517 | ||
diff --git a/drivers/gpio/gpio-kempld.c b/drivers/gpio/gpio-kempld.c index 6b8115f34208..83f281dda1e0 100644 --- a/drivers/gpio/gpio-kempld.c +++ b/drivers/gpio/gpio-kempld.c | |||
| @@ -117,7 +117,7 @@ static int kempld_gpio_get_direction(struct gpio_chip *chip, unsigned offset) | |||
| 117 | = container_of(chip, struct kempld_gpio_data, chip); | 117 | = container_of(chip, struct kempld_gpio_data, chip); |
| 118 | struct kempld_device_data *pld = gpio->pld; | 118 | struct kempld_device_data *pld = gpio->pld; |
| 119 | 119 | ||
| 120 | return kempld_gpio_get_bit(pld, KEMPLD_GPIO_DIR_NUM(offset), offset); | 120 | return !kempld_gpio_get_bit(pld, KEMPLD_GPIO_DIR_NUM(offset), offset); |
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | static int kempld_gpio_pincount(struct kempld_device_data *pld) | 123 | static int kempld_gpio_pincount(struct kempld_device_data *pld) |
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 59eaa23767d8..6bc612b8a49f 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
| @@ -53,6 +53,11 @@ static DEFINE_MUTEX(gpio_lookup_lock); | |||
| 53 | static LIST_HEAD(gpio_lookup_list); | 53 | static LIST_HEAD(gpio_lookup_list); |
| 54 | LIST_HEAD(gpio_chips); | 54 | LIST_HEAD(gpio_chips); |
| 55 | 55 | ||
| 56 | |||
| 57 | static void gpiochip_free_hogs(struct gpio_chip *chip); | ||
| 58 | static void gpiochip_irqchip_remove(struct gpio_chip *gpiochip); | ||
| 59 | |||
| 60 | |||
| 56 | static inline void desc_set_label(struct gpio_desc *d, const char *label) | 61 | static inline void desc_set_label(struct gpio_desc *d, const char *label) |
| 57 | { | 62 | { |
| 58 | d->label = label; | 63 | d->label = label; |
| @@ -297,6 +302,7 @@ int gpiochip_add(struct gpio_chip *chip) | |||
| 297 | 302 | ||
| 298 | err_remove_chip: | 303 | err_remove_chip: |
| 299 | acpi_gpiochip_remove(chip); | 304 | acpi_gpiochip_remove(chip); |
| 305 | gpiochip_free_hogs(chip); | ||
| 300 | of_gpiochip_remove(chip); | 306 | of_gpiochip_remove(chip); |
| 301 | spin_lock_irqsave(&gpio_lock, flags); | 307 | spin_lock_irqsave(&gpio_lock, flags); |
| 302 | list_del(&chip->list); | 308 | list_del(&chip->list); |
| @@ -313,10 +319,6 @@ err_free_descs: | |||
| 313 | } | 319 | } |
| 314 | EXPORT_SYMBOL_GPL(gpiochip_add); | 320 | EXPORT_SYMBOL_GPL(gpiochip_add); |
| 315 | 321 | ||
| 316 | /* Forward-declaration */ | ||
| 317 | static void gpiochip_irqchip_remove(struct gpio_chip *gpiochip); | ||
| 318 | static void gpiochip_free_hogs(struct gpio_chip *chip); | ||
| 319 | |||
| 320 | /** | 322 | /** |
| 321 | * gpiochip_remove() - unregister a gpio_chip | 323 | * gpiochip_remove() - unregister a gpio_chip |
| 322 | * @chip: the chip to unregister | 324 | * @chip: the chip to unregister |
diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c index 40c1db9ad7c3..2f0ed11024eb 100644 --- a/drivers/gpu/drm/drm_plane_helper.c +++ b/drivers/gpu/drm/drm_plane_helper.c | |||
| @@ -465,6 +465,9 @@ int drm_plane_helper_commit(struct drm_plane *plane, | |||
| 465 | if (!crtc[i]) | 465 | if (!crtc[i]) |
| 466 | continue; | 466 | continue; |
| 467 | 467 | ||
| 468 | if (crtc[i]->cursor == plane) | ||
| 469 | continue; | ||
| 470 | |||
| 468 | /* There's no other way to figure out whether the crtc is running. */ | 471 | /* There's no other way to figure out whether the crtc is running. */ |
| 469 | ret = drm_crtc_vblank_get(crtc[i]); | 472 | ret = drm_crtc_vblank_get(crtc[i]); |
| 470 | if (ret == 0) { | 473 | if (ret == 0) { |
diff --git a/drivers/gpu/drm/nouveau/include/nvif/class.h b/drivers/gpu/drm/nouveau/include/nvif/class.h index 0b5af0fe8659..64f8b2f687d2 100644 --- a/drivers/gpu/drm/nouveau/include/nvif/class.h +++ b/drivers/gpu/drm/nouveau/include/nvif/class.h | |||
| @@ -14,7 +14,7 @@ | |||
| 14 | 14 | ||
| 15 | #define FERMI_TWOD_A 0x0000902d | 15 | #define FERMI_TWOD_A 0x0000902d |
| 16 | 16 | ||
| 17 | #define FERMI_MEMORY_TO_MEMORY_FORMAT_A 0x0000903d | 17 | #define FERMI_MEMORY_TO_MEMORY_FORMAT_A 0x00009039 |
| 18 | 18 | ||
| 19 | #define KEPLER_INLINE_TO_MEMORY_A 0x0000a040 | 19 | #define KEPLER_INLINE_TO_MEMORY_A 0x0000a040 |
| 20 | #define KEPLER_INLINE_TO_MEMORY_B 0x0000a140 | 20 | #define KEPLER_INLINE_TO_MEMORY_B 0x0000a140 |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gm204.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gm204.c index 2f5eadd12a9b..fdb1dcf16a59 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gm204.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gm204.c | |||
| @@ -329,7 +329,6 @@ gm204_gr_init(struct nvkm_object *object) | |||
| 329 | nv_mask(priv, 0x419cc0, 0x00000008, 0x00000008); | 329 | nv_mask(priv, 0x419cc0, 0x00000008, 0x00000008); |
| 330 | 330 | ||
| 331 | for (gpc = 0; gpc < priv->gpc_nr; gpc++) { | 331 | for (gpc = 0; gpc < priv->gpc_nr; gpc++) { |
| 332 | printk(KERN_ERR "ppc %d %d\n", gpc, priv->ppc_nr[gpc]); | ||
| 333 | for (ppc = 0; ppc < priv->ppc_nr[gpc]; ppc++) | 332 | for (ppc = 0; ppc < priv->ppc_nr[gpc]; ppc++) |
| 334 | nv_wr32(priv, PPC_UNIT(gpc, ppc, 0x038), 0xc0000000); | 333 | nv_wr32(priv, PPC_UNIT(gpc, ppc, 0x038), 0xc0000000); |
| 335 | nv_wr32(priv, GPC_UNIT(gpc, 0x0420), 0xc0000000); | 334 | nv_wr32(priv, GPC_UNIT(gpc, 0x0420), 0xc0000000); |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gf100.c b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gf100.c index e8778c67578e..c61102f70805 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gf100.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gf100.c | |||
| @@ -90,12 +90,14 @@ gf100_devinit_disable(struct nvkm_devinit *devinit) | |||
| 90 | return disable; | 90 | return disable; |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | static int | 93 | int |
| 94 | gf100_devinit_ctor(struct nvkm_object *parent, struct nvkm_object *engine, | 94 | gf100_devinit_ctor(struct nvkm_object *parent, struct nvkm_object *engine, |
| 95 | struct nvkm_oclass *oclass, void *data, u32 size, | 95 | struct nvkm_oclass *oclass, void *data, u32 size, |
| 96 | struct nvkm_object **pobject) | 96 | struct nvkm_object **pobject) |
| 97 | { | 97 | { |
| 98 | struct nvkm_devinit_impl *impl = (void *)oclass; | ||
| 98 | struct nv50_devinit_priv *priv; | 99 | struct nv50_devinit_priv *priv; |
| 100 | u64 disable; | ||
| 99 | int ret; | 101 | int ret; |
| 100 | 102 | ||
| 101 | ret = nvkm_devinit_create(parent, engine, oclass, &priv); | 103 | ret = nvkm_devinit_create(parent, engine, oclass, &priv); |
| @@ -103,7 +105,8 @@ gf100_devinit_ctor(struct nvkm_object *parent, struct nvkm_object *engine, | |||
| 103 | if (ret) | 105 | if (ret) |
| 104 | return ret; | 106 | return ret; |
| 105 | 107 | ||
| 106 | if (nv_rd32(priv, 0x022500) & 0x00000001) | 108 | disable = impl->disable(&priv->base); |
| 109 | if (disable & (1ULL << NVDEV_ENGINE_DISP)) | ||
| 107 | priv->base.post = true; | 110 | priv->base.post = true; |
| 108 | 111 | ||
| 109 | return 0; | 112 | return 0; |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm107.c b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm107.c index b345a53e881d..87ca0ece37b4 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm107.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm107.c | |||
| @@ -48,7 +48,7 @@ struct nvkm_oclass * | |||
| 48 | gm107_devinit_oclass = &(struct nvkm_devinit_impl) { | 48 | gm107_devinit_oclass = &(struct nvkm_devinit_impl) { |
| 49 | .base.handle = NV_SUBDEV(DEVINIT, 0x07), | 49 | .base.handle = NV_SUBDEV(DEVINIT, 0x07), |
| 50 | .base.ofuncs = &(struct nvkm_ofuncs) { | 50 | .base.ofuncs = &(struct nvkm_ofuncs) { |
| 51 | .ctor = nv50_devinit_ctor, | 51 | .ctor = gf100_devinit_ctor, |
| 52 | .dtor = _nvkm_devinit_dtor, | 52 | .dtor = _nvkm_devinit_dtor, |
| 53 | .init = nv50_devinit_init, | 53 | .init = nv50_devinit_init, |
| 54 | .fini = _nvkm_devinit_fini, | 54 | .fini = _nvkm_devinit_fini, |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm204.c b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm204.c index 535172c5f1ad..1076fcf0d716 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm204.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gm204.c | |||
| @@ -161,7 +161,7 @@ struct nvkm_oclass * | |||
| 161 | gm204_devinit_oclass = &(struct nvkm_devinit_impl) { | 161 | gm204_devinit_oclass = &(struct nvkm_devinit_impl) { |
| 162 | .base.handle = NV_SUBDEV(DEVINIT, 0x07), | 162 | .base.handle = NV_SUBDEV(DEVINIT, 0x07), |
| 163 | .base.ofuncs = &(struct nvkm_ofuncs) { | 163 | .base.ofuncs = &(struct nvkm_ofuncs) { |
| 164 | .ctor = nv50_devinit_ctor, | 164 | .ctor = gf100_devinit_ctor, |
| 165 | .dtor = _nvkm_devinit_dtor, | 165 | .dtor = _nvkm_devinit_dtor, |
| 166 | .init = nv50_devinit_init, | 166 | .init = nv50_devinit_init, |
| 167 | .fini = _nvkm_devinit_fini, | 167 | .fini = _nvkm_devinit_fini, |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/nv50.h b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/nv50.h index b882b65ff3cd..9243521c80ac 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/nv50.h +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/nv50.h | |||
| @@ -15,6 +15,9 @@ int nv50_devinit_pll_set(struct nvkm_devinit *, u32, u32); | |||
| 15 | 15 | ||
| 16 | int gt215_devinit_pll_set(struct nvkm_devinit *, u32, u32); | 16 | int gt215_devinit_pll_set(struct nvkm_devinit *, u32, u32); |
| 17 | 17 | ||
| 18 | int gf100_devinit_ctor(struct nvkm_object *, struct nvkm_object *, | ||
| 19 | struct nvkm_oclass *, void *, u32, | ||
| 20 | struct nvkm_object **); | ||
| 18 | int gf100_devinit_pll_set(struct nvkm_devinit *, u32, u32); | 21 | int gf100_devinit_pll_set(struct nvkm_devinit *, u32, u32); |
| 19 | 22 | ||
| 20 | u64 gm107_devinit_disable(struct nvkm_devinit *); | 23 | u64 gm107_devinit_disable(struct nvkm_devinit *); |
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index 42b2ea3fdcf3..e597ffc26563 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | |||
| @@ -1798,7 +1798,9 @@ static int radeon_get_shared_nondp_ppll(struct drm_crtc *crtc) | |||
| 1798 | if ((crtc->mode.clock == test_crtc->mode.clock) && | 1798 | if ((crtc->mode.clock == test_crtc->mode.clock) && |
| 1799 | (adjusted_clock == test_adjusted_clock) && | 1799 | (adjusted_clock == test_adjusted_clock) && |
| 1800 | (radeon_crtc->ss_enabled == test_radeon_crtc->ss_enabled) && | 1800 | (radeon_crtc->ss_enabled == test_radeon_crtc->ss_enabled) && |
| 1801 | (test_radeon_crtc->pll_id != ATOM_PPLL_INVALID)) | 1801 | (test_radeon_crtc->pll_id != ATOM_PPLL_INVALID) && |
| 1802 | (drm_detect_monitor_audio(radeon_connector_edid(test_radeon_crtc->connector)) == | ||
| 1803 | drm_detect_monitor_audio(radeon_connector_edid(radeon_crtc->connector)))) | ||
| 1802 | return test_radeon_crtc->pll_id; | 1804 | return test_radeon_crtc->pll_id; |
| 1803 | } | 1805 | } |
| 1804 | } | 1806 | } |
diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c index a0c35bbc8546..ba50f3c1c2e0 100644 --- a/drivers/gpu/drm/radeon/cik.c +++ b/drivers/gpu/drm/radeon/cik.c | |||
| @@ -5822,7 +5822,7 @@ static int cik_pcie_gart_enable(struct radeon_device *rdev) | |||
| 5822 | L2_CACHE_BIGK_FRAGMENT_SIZE(4)); | 5822 | L2_CACHE_BIGK_FRAGMENT_SIZE(4)); |
| 5823 | /* setup context0 */ | 5823 | /* setup context0 */ |
| 5824 | WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR, rdev->mc.gtt_start >> 12); | 5824 | WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR, rdev->mc.gtt_start >> 12); |
| 5825 | WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR, (rdev->mc.gtt_end >> 12) - 1); | 5825 | WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR, rdev->mc.gtt_end >> 12); |
| 5826 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR, rdev->gart.table_addr >> 12); | 5826 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR, rdev->gart.table_addr >> 12); |
| 5827 | WREG32(VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR, | 5827 | WREG32(VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR, |
| 5828 | (u32)(rdev->dummy_page.addr >> 12)); | 5828 | (u32)(rdev->dummy_page.addr >> 12)); |
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index 05e6d6ef5963..f848acfd3fc8 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
| @@ -2485,7 +2485,7 @@ static int evergreen_pcie_gart_enable(struct radeon_device *rdev) | |||
| 2485 | WREG32(MC_VM_MB_L1_TLB2_CNTL, tmp); | 2485 | WREG32(MC_VM_MB_L1_TLB2_CNTL, tmp); |
| 2486 | WREG32(MC_VM_MB_L1_TLB3_CNTL, tmp); | 2486 | WREG32(MC_VM_MB_L1_TLB3_CNTL, tmp); |
| 2487 | WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR, rdev->mc.gtt_start >> 12); | 2487 | WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR, rdev->mc.gtt_start >> 12); |
| 2488 | WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR, (rdev->mc.gtt_end >> 12) - 1); | 2488 | WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR, rdev->mc.gtt_end >> 12); |
| 2489 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR, rdev->gart.table_addr >> 12); | 2489 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR, rdev->gart.table_addr >> 12); |
| 2490 | WREG32(VM_CONTEXT0_CNTL, ENABLE_CONTEXT | PAGE_TABLE_DEPTH(0) | | 2490 | WREG32(VM_CONTEXT0_CNTL, ENABLE_CONTEXT | PAGE_TABLE_DEPTH(0) | |
| 2491 | RANGE_PROTECTION_FAULT_ENABLE_DEFAULT); | 2491 | RANGE_PROTECTION_FAULT_ENABLE_DEFAULT); |
diff --git a/drivers/gpu/drm/radeon/evergreen_hdmi.c b/drivers/gpu/drm/radeon/evergreen_hdmi.c index 0926739c9fa7..9953356fe263 100644 --- a/drivers/gpu/drm/radeon/evergreen_hdmi.c +++ b/drivers/gpu/drm/radeon/evergreen_hdmi.c | |||
| @@ -400,7 +400,7 @@ void evergreen_hdmi_enable(struct drm_encoder *encoder, bool enable) | |||
| 400 | if (enable) { | 400 | if (enable) { |
| 401 | struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); | 401 | struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); |
| 402 | 402 | ||
| 403 | if (drm_detect_monitor_audio(radeon_connector_edid(connector))) { | 403 | if (connector && drm_detect_monitor_audio(radeon_connector_edid(connector))) { |
| 404 | WREG32(HDMI_INFOFRAME_CONTROL0 + dig->afmt->offset, | 404 | WREG32(HDMI_INFOFRAME_CONTROL0 + dig->afmt->offset, |
| 405 | HDMI_AVI_INFO_SEND | /* enable AVI info frames */ | 405 | HDMI_AVI_INFO_SEND | /* enable AVI info frames */ |
| 406 | HDMI_AVI_INFO_CONT | /* required for audio info values to be updated */ | 406 | HDMI_AVI_INFO_CONT | /* required for audio info values to be updated */ |
| @@ -438,7 +438,8 @@ void evergreen_dp_enable(struct drm_encoder *encoder, bool enable) | |||
| 438 | if (!dig || !dig->afmt) | 438 | if (!dig || !dig->afmt) |
| 439 | return; | 439 | return; |
| 440 | 440 | ||
| 441 | if (enable && drm_detect_monitor_audio(radeon_connector_edid(connector))) { | 441 | if (enable && connector && |
| 442 | drm_detect_monitor_audio(radeon_connector_edid(connector))) { | ||
| 442 | struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); | 443 | struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); |
| 443 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); | 444 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
| 444 | struct radeon_connector_atom_dig *dig_connector; | 445 | struct radeon_connector_atom_dig *dig_connector; |
diff --git a/drivers/gpu/drm/radeon/ni.c b/drivers/gpu/drm/radeon/ni.c index aba2f428c0a8..64d3a771920d 100644 --- a/drivers/gpu/drm/radeon/ni.c +++ b/drivers/gpu/drm/radeon/ni.c | |||
| @@ -1282,7 +1282,7 @@ static int cayman_pcie_gart_enable(struct radeon_device *rdev) | |||
| 1282 | L2_CACHE_BIGK_FRAGMENT_SIZE(6)); | 1282 | L2_CACHE_BIGK_FRAGMENT_SIZE(6)); |
| 1283 | /* setup context0 */ | 1283 | /* setup context0 */ |
| 1284 | WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR, rdev->mc.gtt_start >> 12); | 1284 | WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR, rdev->mc.gtt_start >> 12); |
| 1285 | WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR, (rdev->mc.gtt_end >> 12) - 1); | 1285 | WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR, rdev->mc.gtt_end >> 12); |
| 1286 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR, rdev->gart.table_addr >> 12); | 1286 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR, rdev->gart.table_addr >> 12); |
| 1287 | WREG32(VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR, | 1287 | WREG32(VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR, |
| 1288 | (u32)(rdev->dummy_page.addr >> 12)); | 1288 | (u32)(rdev->dummy_page.addr >> 12)); |
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index 25b4ac967742..8f6d862a1882 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
| @@ -1112,7 +1112,7 @@ static int r600_pcie_gart_enable(struct radeon_device *rdev) | |||
| 1112 | WREG32(MC_VM_L1_TLB_MCB_RD_SEM_CNTL, tmp | ENABLE_SEMAPHORE_MODE); | 1112 | WREG32(MC_VM_L1_TLB_MCB_RD_SEM_CNTL, tmp | ENABLE_SEMAPHORE_MODE); |
| 1113 | WREG32(MC_VM_L1_TLB_MCB_WR_SEM_CNTL, tmp | ENABLE_SEMAPHORE_MODE); | 1113 | WREG32(MC_VM_L1_TLB_MCB_WR_SEM_CNTL, tmp | ENABLE_SEMAPHORE_MODE); |
| 1114 | WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR, rdev->mc.gtt_start >> 12); | 1114 | WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR, rdev->mc.gtt_start >> 12); |
| 1115 | WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR, (rdev->mc.gtt_end >> 12) - 1); | 1115 | WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR, rdev->mc.gtt_end >> 12); |
| 1116 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR, rdev->gart.table_addr >> 12); | 1116 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR, rdev->gart.table_addr >> 12); |
| 1117 | WREG32(VM_CONTEXT0_CNTL, ENABLE_CONTEXT | PAGE_TABLE_DEPTH(0) | | 1117 | WREG32(VM_CONTEXT0_CNTL, ENABLE_CONTEXT | PAGE_TABLE_DEPTH(0) | |
| 1118 | RANGE_PROTECTION_FAULT_ENABLE_DEFAULT); | 1118 | RANGE_PROTECTION_FAULT_ENABLE_DEFAULT); |
diff --git a/drivers/gpu/drm/radeon/radeon_audio.c b/drivers/gpu/drm/radeon/radeon_audio.c index dcb779647c57..25191f126f3b 100644 --- a/drivers/gpu/drm/radeon/radeon_audio.c +++ b/drivers/gpu/drm/radeon/radeon_audio.c | |||
| @@ -460,9 +460,6 @@ void radeon_audio_detect(struct drm_connector *connector, | |||
| 460 | if (!connector || !connector->encoder) | 460 | if (!connector || !connector->encoder) |
| 461 | return; | 461 | return; |
| 462 | 462 | ||
| 463 | if (!radeon_encoder_is_digital(connector->encoder)) | ||
| 464 | return; | ||
| 465 | |||
| 466 | rdev = connector->encoder->dev->dev_private; | 463 | rdev = connector->encoder->dev->dev_private; |
| 467 | 464 | ||
| 468 | if (!radeon_audio_chipset_supported(rdev)) | 465 | if (!radeon_audio_chipset_supported(rdev)) |
| @@ -471,26 +468,26 @@ void radeon_audio_detect(struct drm_connector *connector, | |||
| 471 | radeon_encoder = to_radeon_encoder(connector->encoder); | 468 | radeon_encoder = to_radeon_encoder(connector->encoder); |
| 472 | dig = radeon_encoder->enc_priv; | 469 | dig = radeon_encoder->enc_priv; |
| 473 | 470 | ||
| 474 | if (!dig->afmt) | ||
| 475 | return; | ||
| 476 | |||
| 477 | if (status == connector_status_connected) { | 471 | if (status == connector_status_connected) { |
| 478 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); | 472 | struct radeon_connector *radeon_connector; |
| 473 | int sink_type; | ||
| 474 | |||
| 475 | if (!drm_detect_monitor_audio(radeon_connector_edid(connector))) { | ||
| 476 | radeon_encoder->audio = NULL; | ||
| 477 | return; | ||
| 478 | } | ||
| 479 | |||
| 480 | radeon_connector = to_radeon_connector(connector); | ||
| 481 | sink_type = radeon_dp_getsinktype(radeon_connector); | ||
| 479 | 482 | ||
| 480 | if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort && | 483 | if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort && |
| 481 | radeon_dp_getsinktype(radeon_connector) == | 484 | sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) |
| 482 | CONNECTOR_OBJECT_ID_DISPLAYPORT) | ||
| 483 | radeon_encoder->audio = rdev->audio.dp_funcs; | 485 | radeon_encoder->audio = rdev->audio.dp_funcs; |
| 484 | else | 486 | else |
| 485 | radeon_encoder->audio = rdev->audio.hdmi_funcs; | 487 | radeon_encoder->audio = rdev->audio.hdmi_funcs; |
| 486 | 488 | ||
| 487 | dig->afmt->pin = radeon_audio_get_pin(connector->encoder); | 489 | dig->afmt->pin = radeon_audio_get_pin(connector->encoder); |
| 488 | if (drm_detect_monitor_audio(radeon_connector_edid(connector))) { | 490 | radeon_audio_enable(rdev, dig->afmt->pin, 0xf); |
| 489 | radeon_audio_enable(rdev, dig->afmt->pin, 0xf); | ||
| 490 | } else { | ||
| 491 | radeon_audio_enable(rdev, dig->afmt->pin, 0); | ||
| 492 | dig->afmt->pin = NULL; | ||
| 493 | } | ||
| 494 | } else { | 491 | } else { |
| 495 | radeon_audio_enable(rdev, dig->afmt->pin, 0); | 492 | radeon_audio_enable(rdev, dig->afmt->pin, 0); |
| 496 | dig->afmt->pin = NULL; | 493 | dig->afmt->pin = NULL; |
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c index d17d251dbd4f..cebb65e07e1d 100644 --- a/drivers/gpu/drm/radeon/radeon_connectors.c +++ b/drivers/gpu/drm/radeon/radeon_connectors.c | |||
| @@ -1379,10 +1379,8 @@ out: | |||
| 1379 | /* updated in get modes as well since we need to know if it's analog or digital */ | 1379 | /* updated in get modes as well since we need to know if it's analog or digital */ |
| 1380 | radeon_connector_update_scratch_regs(connector, ret); | 1380 | radeon_connector_update_scratch_regs(connector, ret); |
| 1381 | 1381 | ||
| 1382 | if (radeon_audio != 0) { | 1382 | if (radeon_audio != 0) |
| 1383 | radeon_connector_get_edid(connector); | ||
| 1384 | radeon_audio_detect(connector, ret); | 1383 | radeon_audio_detect(connector, ret); |
| 1385 | } | ||
| 1386 | 1384 | ||
| 1387 | exit: | 1385 | exit: |
| 1388 | pm_runtime_mark_last_busy(connector->dev->dev); | 1386 | pm_runtime_mark_last_busy(connector->dev->dev); |
| @@ -1719,10 +1717,8 @@ radeon_dp_detect(struct drm_connector *connector, bool force) | |||
| 1719 | 1717 | ||
| 1720 | radeon_connector_update_scratch_regs(connector, ret); | 1718 | radeon_connector_update_scratch_regs(connector, ret); |
| 1721 | 1719 | ||
| 1722 | if (radeon_audio != 0) { | 1720 | if (radeon_audio != 0) |
| 1723 | radeon_connector_get_edid(connector); | ||
| 1724 | radeon_audio_detect(connector, ret); | 1721 | radeon_audio_detect(connector, ret); |
| 1725 | } | ||
| 1726 | 1722 | ||
| 1727 | out: | 1723 | out: |
| 1728 | pm_runtime_mark_last_busy(connector->dev->dev); | 1724 | pm_runtime_mark_last_busy(connector->dev->dev); |
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index c54d6313a46d..01ee96acb398 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c | |||
| @@ -921,7 +921,7 @@ static int rv770_pcie_gart_enable(struct radeon_device *rdev) | |||
| 921 | WREG32(MC_VM_MB_L1_TLB2_CNTL, tmp); | 921 | WREG32(MC_VM_MB_L1_TLB2_CNTL, tmp); |
| 922 | WREG32(MC_VM_MB_L1_TLB3_CNTL, tmp); | 922 | WREG32(MC_VM_MB_L1_TLB3_CNTL, tmp); |
| 923 | WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR, rdev->mc.gtt_start >> 12); | 923 | WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR, rdev->mc.gtt_start >> 12); |
| 924 | WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR, (rdev->mc.gtt_end >> 12) - 1); | 924 | WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR, rdev->mc.gtt_end >> 12); |
| 925 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR, rdev->gart.table_addr >> 12); | 925 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR, rdev->gart.table_addr >> 12); |
| 926 | WREG32(VM_CONTEXT0_CNTL, ENABLE_CONTEXT | PAGE_TABLE_DEPTH(0) | | 926 | WREG32(VM_CONTEXT0_CNTL, ENABLE_CONTEXT | PAGE_TABLE_DEPTH(0) | |
| 927 | RANGE_PROTECTION_FAULT_ENABLE_DEFAULT); | 927 | RANGE_PROTECTION_FAULT_ENABLE_DEFAULT); |
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index 5326f753e107..4c679b802bc8 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c | |||
| @@ -4303,7 +4303,7 @@ static int si_pcie_gart_enable(struct radeon_device *rdev) | |||
| 4303 | L2_CACHE_BIGK_FRAGMENT_SIZE(4)); | 4303 | L2_CACHE_BIGK_FRAGMENT_SIZE(4)); |
| 4304 | /* setup context0 */ | 4304 | /* setup context0 */ |
| 4305 | WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR, rdev->mc.gtt_start >> 12); | 4305 | WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR, rdev->mc.gtt_start >> 12); |
| 4306 | WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR, (rdev->mc.gtt_end >> 12) - 1); | 4306 | WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR, rdev->mc.gtt_end >> 12); |
| 4307 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR, rdev->gart.table_addr >> 12); | 4307 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR, rdev->gart.table_addr >> 12); |
| 4308 | WREG32(VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR, | 4308 | WREG32(VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR, |
| 4309 | (u32)(rdev->dummy_page.addr >> 12)); | 4309 | (u32)(rdev->dummy_page.addr >> 12)); |
diff --git a/drivers/gpu/drm/vgem/Makefile b/drivers/gpu/drm/vgem/Makefile index 1055cb79096c..3f4c7b842028 100644 --- a/drivers/gpu/drm/vgem/Makefile +++ b/drivers/gpu/drm/vgem/Makefile | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ccflags-y := -Iinclude/drm | 1 | ccflags-y := -Iinclude/drm |
| 2 | vgem-y := vgem_drv.o vgem_dma_buf.o | 2 | vgem-y := vgem_drv.o |
| 3 | 3 | ||
| 4 | obj-$(CONFIG_DRM_VGEM) += vgem.o | 4 | obj-$(CONFIG_DRM_VGEM) += vgem.o |
diff --git a/drivers/gpu/drm/vgem/vgem_dma_buf.c b/drivers/gpu/drm/vgem/vgem_dma_buf.c deleted file mode 100644 index 0254438ad1a6..000000000000 --- a/drivers/gpu/drm/vgem/vgem_dma_buf.c +++ /dev/null | |||
| @@ -1,94 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Copyright © 2012 Intel Corporation | ||
| 3 | * Copyright © 2014 The Chromium OS Authors | ||
| 4 | * | ||
| 5 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
| 6 | * copy of this software and associated documentation files (the "Software"), | ||
| 7 | * to deal in the Software without restriction, including without limitation | ||
| 8 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
| 9 | * and/or sell copies of the Software, and to permit persons to whom the | ||
| 10 | * Software is furnished to do so, subject to the following conditions: | ||
| 11 | * | ||
| 12 | * The above copyright notice and this permission notice (including the next | ||
| 13 | * paragraph) shall be included in all copies or substantial portions of the | ||
| 14 | * Software. | ||
| 15 | * | ||
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
| 19 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
| 21 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
| 22 | * IN THE SOFTWARE. | ||
| 23 | * | ||
| 24 | * Authors: | ||
| 25 | * Ben Widawsky <ben@bwidawsk.net> | ||
| 26 | * | ||
| 27 | */ | ||
| 28 | |||
| 29 | #include <linux/dma-buf.h> | ||
| 30 | #include "vgem_drv.h" | ||
| 31 | |||
| 32 | struct sg_table *vgem_gem_prime_get_sg_table(struct drm_gem_object *gobj) | ||
| 33 | { | ||
| 34 | struct drm_vgem_gem_object *obj = to_vgem_bo(gobj); | ||
| 35 | BUG_ON(obj->pages == NULL); | ||
| 36 | |||
| 37 | return drm_prime_pages_to_sg(obj->pages, obj->base.size / PAGE_SIZE); | ||
| 38 | } | ||
| 39 | |||
| 40 | int vgem_gem_prime_pin(struct drm_gem_object *gobj) | ||
| 41 | { | ||
| 42 | struct drm_vgem_gem_object *obj = to_vgem_bo(gobj); | ||
| 43 | return vgem_gem_get_pages(obj); | ||
| 44 | } | ||
| 45 | |||
| 46 | void vgem_gem_prime_unpin(struct drm_gem_object *gobj) | ||
| 47 | { | ||
| 48 | struct drm_vgem_gem_object *obj = to_vgem_bo(gobj); | ||
| 49 | vgem_gem_put_pages(obj); | ||
| 50 | } | ||
| 51 | |||
| 52 | void *vgem_gem_prime_vmap(struct drm_gem_object *gobj) | ||
| 53 | { | ||
| 54 | struct drm_vgem_gem_object *obj = to_vgem_bo(gobj); | ||
| 55 | BUG_ON(obj->pages == NULL); | ||
| 56 | |||
| 57 | return vmap(obj->pages, obj->base.size / PAGE_SIZE, 0, PAGE_KERNEL); | ||
| 58 | } | ||
| 59 | |||
| 60 | void vgem_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr) | ||
| 61 | { | ||
| 62 | vunmap(vaddr); | ||
| 63 | } | ||
| 64 | |||
| 65 | struct drm_gem_object *vgem_gem_prime_import(struct drm_device *dev, | ||
| 66 | struct dma_buf *dma_buf) | ||
| 67 | { | ||
| 68 | struct drm_vgem_gem_object *obj = NULL; | ||
| 69 | int ret; | ||
| 70 | |||
| 71 | obj = kzalloc(sizeof(*obj), GFP_KERNEL); | ||
| 72 | if (obj == NULL) { | ||
| 73 | ret = -ENOMEM; | ||
| 74 | goto fail; | ||
| 75 | } | ||
| 76 | |||
| 77 | ret = drm_gem_object_init(dev, &obj->base, dma_buf->size); | ||
| 78 | if (ret) { | ||
| 79 | ret = -ENOMEM; | ||
| 80 | goto fail_free; | ||
| 81 | } | ||
| 82 | |||
| 83 | get_dma_buf(dma_buf); | ||
| 84 | |||
| 85 | obj->base.dma_buf = dma_buf; | ||
| 86 | obj->use_dma_buf = true; | ||
| 87 | |||
| 88 | return &obj->base; | ||
| 89 | |||
| 90 | fail_free: | ||
| 91 | kfree(obj); | ||
| 92 | fail: | ||
| 93 | return ERR_PTR(ret); | ||
| 94 | } | ||
diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c index cb3b43525b2d..7a207ca547be 100644 --- a/drivers/gpu/drm/vgem/vgem_drv.c +++ b/drivers/gpu/drm/vgem/vgem_drv.c | |||
| @@ -302,22 +302,13 @@ static const struct file_operations vgem_driver_fops = { | |||
| 302 | }; | 302 | }; |
| 303 | 303 | ||
| 304 | static struct drm_driver vgem_driver = { | 304 | static struct drm_driver vgem_driver = { |
| 305 | .driver_features = DRIVER_GEM | DRIVER_PRIME, | 305 | .driver_features = DRIVER_GEM, |
| 306 | .gem_free_object = vgem_gem_free_object, | 306 | .gem_free_object = vgem_gem_free_object, |
| 307 | .gem_vm_ops = &vgem_gem_vm_ops, | 307 | .gem_vm_ops = &vgem_gem_vm_ops, |
| 308 | .ioctls = vgem_ioctls, | 308 | .ioctls = vgem_ioctls, |
| 309 | .fops = &vgem_driver_fops, | 309 | .fops = &vgem_driver_fops, |
| 310 | .dumb_create = vgem_gem_dumb_create, | 310 | .dumb_create = vgem_gem_dumb_create, |
| 311 | .dumb_map_offset = vgem_gem_dumb_map, | 311 | .dumb_map_offset = vgem_gem_dumb_map, |
| 312 | .prime_handle_to_fd = drm_gem_prime_handle_to_fd, | ||
| 313 | .prime_fd_to_handle = drm_gem_prime_fd_to_handle, | ||
| 314 | .gem_prime_export = drm_gem_prime_export, | ||
| 315 | .gem_prime_import = vgem_gem_prime_import, | ||
| 316 | .gem_prime_pin = vgem_gem_prime_pin, | ||
| 317 | .gem_prime_unpin = vgem_gem_prime_unpin, | ||
| 318 | .gem_prime_get_sg_table = vgem_gem_prime_get_sg_table, | ||
| 319 | .gem_prime_vmap = vgem_gem_prime_vmap, | ||
| 320 | .gem_prime_vunmap = vgem_gem_prime_vunmap, | ||
| 321 | .name = DRIVER_NAME, | 312 | .name = DRIVER_NAME, |
| 322 | .desc = DRIVER_DESC, | 313 | .desc = DRIVER_DESC, |
| 323 | .date = DRIVER_DATE, | 314 | .date = DRIVER_DATE, |
diff --git a/drivers/gpu/drm/vgem/vgem_drv.h b/drivers/gpu/drm/vgem/vgem_drv.h index 57ab4d8f41f9..e9f92f7ee275 100644 --- a/drivers/gpu/drm/vgem/vgem_drv.h +++ b/drivers/gpu/drm/vgem/vgem_drv.h | |||
| @@ -43,15 +43,4 @@ struct drm_vgem_gem_object { | |||
| 43 | extern void vgem_gem_put_pages(struct drm_vgem_gem_object *obj); | 43 | extern void vgem_gem_put_pages(struct drm_vgem_gem_object *obj); |
| 44 | extern int vgem_gem_get_pages(struct drm_vgem_gem_object *obj); | 44 | extern int vgem_gem_get_pages(struct drm_vgem_gem_object *obj); |
| 45 | 45 | ||
| 46 | /* vgem_dma_buf.c */ | ||
| 47 | extern struct sg_table *vgem_gem_prime_get_sg_table( | ||
| 48 | struct drm_gem_object *gobj); | ||
| 49 | extern int vgem_gem_prime_pin(struct drm_gem_object *gobj); | ||
| 50 | extern void vgem_gem_prime_unpin(struct drm_gem_object *gobj); | ||
| 51 | extern void *vgem_gem_prime_vmap(struct drm_gem_object *gobj); | ||
| 52 | extern void vgem_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr); | ||
| 53 | extern struct drm_gem_object *vgem_gem_prime_import(struct drm_device *dev, | ||
| 54 | struct dma_buf *dma_buf); | ||
| 55 | |||
| 56 | |||
| 57 | #endif | 46 | #endif |
diff --git a/drivers/lguest/core.c b/drivers/lguest/core.c index 7dc93aa004c8..312ffd3d0017 100644 --- a/drivers/lguest/core.c +++ b/drivers/lguest/core.c | |||
| @@ -173,7 +173,7 @@ static void unmap_switcher(void) | |||
| 173 | bool lguest_address_ok(const struct lguest *lg, | 173 | bool lguest_address_ok(const struct lguest *lg, |
| 174 | unsigned long addr, unsigned long len) | 174 | unsigned long addr, unsigned long len) |
| 175 | { | 175 | { |
| 176 | return (addr+len) / PAGE_SIZE < lg->pfn_limit && (addr+len >= addr); | 176 | return addr+len <= lg->pfn_limit * PAGE_SIZE && (addr+len >= addr); |
| 177 | } | 177 | } |
| 178 | 178 | ||
| 179 | /* | 179 | /* |
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index 63953477a07c..eff7bdd7731d 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c | |||
| @@ -429,9 +429,11 @@ static int __multipath_map(struct dm_target *ti, struct request *clone, | |||
| 429 | /* blk-mq request-based interface */ | 429 | /* blk-mq request-based interface */ |
| 430 | *__clone = blk_get_request(bdev_get_queue(bdev), | 430 | *__clone = blk_get_request(bdev_get_queue(bdev), |
| 431 | rq_data_dir(rq), GFP_ATOMIC); | 431 | rq_data_dir(rq), GFP_ATOMIC); |
| 432 | if (IS_ERR(*__clone)) | 432 | if (IS_ERR(*__clone)) { |
| 433 | /* ENOMEM, requeue */ | 433 | /* ENOMEM, requeue */ |
| 434 | clear_mapinfo(m, map_context); | ||
| 434 | return r; | 435 | return r; |
| 436 | } | ||
| 435 | (*__clone)->bio = (*__clone)->biotail = NULL; | 437 | (*__clone)->bio = (*__clone)->biotail = NULL; |
| 436 | (*__clone)->rq_disk = bdev->bd_disk; | 438 | (*__clone)->rq_disk = bdev->bd_disk; |
| 437 | (*__clone)->cmd_flags |= REQ_FAILFAST_TRANSPORT; | 439 | (*__clone)->cmd_flags |= REQ_FAILFAST_TRANSPORT; |
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index d9b00b8565c6..16ba55ad7089 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c | |||
| @@ -820,6 +820,12 @@ void dm_consume_args(struct dm_arg_set *as, unsigned num_args) | |||
| 820 | } | 820 | } |
| 821 | EXPORT_SYMBOL(dm_consume_args); | 821 | EXPORT_SYMBOL(dm_consume_args); |
| 822 | 822 | ||
| 823 | static bool __table_type_request_based(unsigned table_type) | ||
| 824 | { | ||
| 825 | return (table_type == DM_TYPE_REQUEST_BASED || | ||
| 826 | table_type == DM_TYPE_MQ_REQUEST_BASED); | ||
| 827 | } | ||
| 828 | |||
| 823 | static int dm_table_set_type(struct dm_table *t) | 829 | static int dm_table_set_type(struct dm_table *t) |
| 824 | { | 830 | { |
| 825 | unsigned i; | 831 | unsigned i; |
| @@ -852,8 +858,7 @@ static int dm_table_set_type(struct dm_table *t) | |||
| 852 | * Determine the type from the live device. | 858 | * Determine the type from the live device. |
| 853 | * Default to bio-based if device is new. | 859 | * Default to bio-based if device is new. |
| 854 | */ | 860 | */ |
| 855 | if (live_md_type == DM_TYPE_REQUEST_BASED || | 861 | if (__table_type_request_based(live_md_type)) |
| 856 | live_md_type == DM_TYPE_MQ_REQUEST_BASED) | ||
| 857 | request_based = 1; | 862 | request_based = 1; |
| 858 | else | 863 | else |
| 859 | bio_based = 1; | 864 | bio_based = 1; |
| @@ -903,7 +908,7 @@ static int dm_table_set_type(struct dm_table *t) | |||
| 903 | } | 908 | } |
| 904 | t->type = DM_TYPE_MQ_REQUEST_BASED; | 909 | t->type = DM_TYPE_MQ_REQUEST_BASED; |
| 905 | 910 | ||
| 906 | } else if (hybrid && list_empty(devices) && live_md_type != DM_TYPE_NONE) { | 911 | } else if (list_empty(devices) && __table_type_request_based(live_md_type)) { |
| 907 | /* inherit live MD type */ | 912 | /* inherit live MD type */ |
| 908 | t->type = live_md_type; | 913 | t->type = live_md_type; |
| 909 | 914 | ||
| @@ -925,10 +930,7 @@ struct target_type *dm_table_get_immutable_target_type(struct dm_table *t) | |||
| 925 | 930 | ||
| 926 | bool dm_table_request_based(struct dm_table *t) | 931 | bool dm_table_request_based(struct dm_table *t) |
| 927 | { | 932 | { |
| 928 | unsigned table_type = dm_table_get_type(t); | 933 | return __table_type_request_based(dm_table_get_type(t)); |
| 929 | |||
| 930 | return (table_type == DM_TYPE_REQUEST_BASED || | ||
| 931 | table_type == DM_TYPE_MQ_REQUEST_BASED); | ||
| 932 | } | 934 | } |
| 933 | 935 | ||
| 934 | bool dm_table_mq_request_based(struct dm_table *t) | 936 | bool dm_table_mq_request_based(struct dm_table *t) |
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index a930b72314ac..2caf492890d6 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
| @@ -1082,13 +1082,11 @@ static void rq_completed(struct mapped_device *md, int rw, bool run_queue) | |||
| 1082 | dm_put(md); | 1082 | dm_put(md); |
| 1083 | } | 1083 | } |
| 1084 | 1084 | ||
| 1085 | static void free_rq_clone(struct request *clone, bool must_be_mapped) | 1085 | static void free_rq_clone(struct request *clone) |
| 1086 | { | 1086 | { |
| 1087 | struct dm_rq_target_io *tio = clone->end_io_data; | 1087 | struct dm_rq_target_io *tio = clone->end_io_data; |
| 1088 | struct mapped_device *md = tio->md; | 1088 | struct mapped_device *md = tio->md; |
| 1089 | 1089 | ||
| 1090 | WARN_ON_ONCE(must_be_mapped && !clone->q); | ||
| 1091 | |||
| 1092 | blk_rq_unprep_clone(clone); | 1090 | blk_rq_unprep_clone(clone); |
| 1093 | 1091 | ||
| 1094 | if (md->type == DM_TYPE_MQ_REQUEST_BASED) | 1092 | if (md->type == DM_TYPE_MQ_REQUEST_BASED) |
| @@ -1132,7 +1130,7 @@ static void dm_end_request(struct request *clone, int error) | |||
| 1132 | rq->sense_len = clone->sense_len; | 1130 | rq->sense_len = clone->sense_len; |
| 1133 | } | 1131 | } |
| 1134 | 1132 | ||
| 1135 | free_rq_clone(clone, true); | 1133 | free_rq_clone(clone); |
| 1136 | if (!rq->q->mq_ops) | 1134 | if (!rq->q->mq_ops) |
| 1137 | blk_end_request_all(rq, error); | 1135 | blk_end_request_all(rq, error); |
| 1138 | else | 1136 | else |
| @@ -1151,7 +1149,7 @@ static void dm_unprep_request(struct request *rq) | |||
| 1151 | } | 1149 | } |
| 1152 | 1150 | ||
| 1153 | if (clone) | 1151 | if (clone) |
| 1154 | free_rq_clone(clone, false); | 1152 | free_rq_clone(clone); |
| 1155 | } | 1153 | } |
| 1156 | 1154 | ||
| 1157 | /* | 1155 | /* |
| @@ -1164,6 +1162,7 @@ static void old_requeue_request(struct request *rq) | |||
| 1164 | 1162 | ||
| 1165 | spin_lock_irqsave(q->queue_lock, flags); | 1163 | spin_lock_irqsave(q->queue_lock, flags); |
| 1166 | blk_requeue_request(q, rq); | 1164 | blk_requeue_request(q, rq); |
| 1165 | blk_run_queue_async(q); | ||
| 1167 | spin_unlock_irqrestore(q->queue_lock, flags); | 1166 | spin_unlock_irqrestore(q->queue_lock, flags); |
| 1168 | } | 1167 | } |
| 1169 | 1168 | ||
| @@ -1724,8 +1723,7 @@ static int dm_merge_bvec(struct request_queue *q, | |||
| 1724 | struct mapped_device *md = q->queuedata; | 1723 | struct mapped_device *md = q->queuedata; |
| 1725 | struct dm_table *map = dm_get_live_table_fast(md); | 1724 | struct dm_table *map = dm_get_live_table_fast(md); |
| 1726 | struct dm_target *ti; | 1725 | struct dm_target *ti; |
| 1727 | sector_t max_sectors; | 1726 | sector_t max_sectors, max_size = 0; |
| 1728 | int max_size = 0; | ||
| 1729 | 1727 | ||
| 1730 | if (unlikely(!map)) | 1728 | if (unlikely(!map)) |
| 1731 | goto out; | 1729 | goto out; |
| @@ -1740,8 +1738,16 @@ static int dm_merge_bvec(struct request_queue *q, | |||
| 1740 | max_sectors = min(max_io_len(bvm->bi_sector, ti), | 1738 | max_sectors = min(max_io_len(bvm->bi_sector, ti), |
| 1741 | (sector_t) queue_max_sectors(q)); | 1739 | (sector_t) queue_max_sectors(q)); |
| 1742 | max_size = (max_sectors << SECTOR_SHIFT) - bvm->bi_size; | 1740 | max_size = (max_sectors << SECTOR_SHIFT) - bvm->bi_size; |
| 1743 | if (unlikely(max_size < 0)) /* this shouldn't _ever_ happen */ | 1741 | |
| 1744 | max_size = 0; | 1742 | /* |
| 1743 | * FIXME: this stop-gap fix _must_ be cleaned up (by passing a sector_t | ||
| 1744 | * to the targets' merge function since it holds sectors not bytes). | ||
| 1745 | * Just doing this as an interim fix for stable@ because the more | ||
| 1746 | * comprehensive cleanup of switching to sector_t will impact every | ||
| 1747 | * DM target that implements a ->merge hook. | ||
| 1748 | */ | ||
| 1749 | if (max_size > INT_MAX) | ||
| 1750 | max_size = INT_MAX; | ||
| 1745 | 1751 | ||
| 1746 | /* | 1752 | /* |
| 1747 | * merge_bvec_fn() returns number of bytes | 1753 | * merge_bvec_fn() returns number of bytes |
| @@ -1749,7 +1755,7 @@ static int dm_merge_bvec(struct request_queue *q, | |||
| 1749 | * max is precomputed maximal io size | 1755 | * max is precomputed maximal io size |
| 1750 | */ | 1756 | */ |
| 1751 | if (max_size && ti->type->merge) | 1757 | if (max_size && ti->type->merge) |
| 1752 | max_size = ti->type->merge(ti, bvm, biovec, max_size); | 1758 | max_size = ti->type->merge(ti, bvm, biovec, (int) max_size); |
| 1753 | /* | 1759 | /* |
| 1754 | * If the target doesn't support merge method and some of the devices | 1760 | * If the target doesn't support merge method and some of the devices |
| 1755 | * provided their merge_bvec method (we know this by looking for the | 1761 | * provided their merge_bvec method (we know this by looking for the |
| @@ -1971,8 +1977,8 @@ static int map_request(struct dm_rq_target_io *tio, struct request *rq, | |||
| 1971 | dm_kill_unmapped_request(rq, r); | 1977 | dm_kill_unmapped_request(rq, r); |
| 1972 | return r; | 1978 | return r; |
| 1973 | } | 1979 | } |
| 1974 | if (IS_ERR(clone)) | 1980 | if (r != DM_MAPIO_REMAPPED) |
| 1975 | return DM_MAPIO_REQUEUE; | 1981 | return r; |
| 1976 | if (setup_clone(clone, rq, tio, GFP_ATOMIC)) { | 1982 | if (setup_clone(clone, rq, tio, GFP_ATOMIC)) { |
| 1977 | /* -ENOMEM */ | 1983 | /* -ENOMEM */ |
| 1978 | ti->type->release_clone_rq(clone); | 1984 | ti->type->release_clone_rq(clone); |
| @@ -2753,13 +2759,15 @@ static int dm_mq_queue_rq(struct blk_mq_hw_ctx *hctx, | |||
| 2753 | if (dm_table_get_type(map) == DM_TYPE_REQUEST_BASED) { | 2759 | if (dm_table_get_type(map) == DM_TYPE_REQUEST_BASED) { |
| 2754 | /* clone request is allocated at the end of the pdu */ | 2760 | /* clone request is allocated at the end of the pdu */ |
| 2755 | tio->clone = (void *)blk_mq_rq_to_pdu(rq) + sizeof(struct dm_rq_target_io); | 2761 | tio->clone = (void *)blk_mq_rq_to_pdu(rq) + sizeof(struct dm_rq_target_io); |
| 2756 | if (!clone_rq(rq, md, tio, GFP_ATOMIC)) | 2762 | (void) clone_rq(rq, md, tio, GFP_ATOMIC); |
| 2757 | return BLK_MQ_RQ_QUEUE_BUSY; | ||
| 2758 | queue_kthread_work(&md->kworker, &tio->work); | 2763 | queue_kthread_work(&md->kworker, &tio->work); |
| 2759 | } else { | 2764 | } else { |
| 2760 | /* Direct call is fine since .queue_rq allows allocations */ | 2765 | /* Direct call is fine since .queue_rq allows allocations */ |
| 2761 | if (map_request(tio, rq, md) == DM_MAPIO_REQUEUE) | 2766 | if (map_request(tio, rq, md) == DM_MAPIO_REQUEUE) { |
| 2762 | dm_requeue_unmapped_original_request(md, rq); | 2767 | /* Undo dm_start_request() before requeuing */ |
| 2768 | rq_completed(md, rq_data_dir(rq), false); | ||
| 2769 | return BLK_MQ_RQ_QUEUE_BUSY; | ||
| 2770 | } | ||
| 2763 | } | 2771 | } |
| 2764 | 2772 | ||
| 2765 | return BLK_MQ_RQ_QUEUE_OK; | 2773 | return BLK_MQ_RQ_QUEUE_OK; |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 593a02476c78..27506302eb7a 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
| @@ -4211,12 +4211,12 @@ action_store(struct mddev *mddev, const char *page, size_t len) | |||
| 4211 | if (!mddev->pers || !mddev->pers->sync_request) | 4211 | if (!mddev->pers || !mddev->pers->sync_request) |
| 4212 | return -EINVAL; | 4212 | return -EINVAL; |
| 4213 | 4213 | ||
| 4214 | if (cmd_match(page, "frozen")) | ||
| 4215 | set_bit(MD_RECOVERY_FROZEN, &mddev->recovery); | ||
| 4216 | else | ||
| 4217 | clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); | ||
| 4218 | 4214 | ||
| 4219 | if (cmd_match(page, "idle") || cmd_match(page, "frozen")) { | 4215 | if (cmd_match(page, "idle") || cmd_match(page, "frozen")) { |
| 4216 | if (cmd_match(page, "frozen")) | ||
| 4217 | set_bit(MD_RECOVERY_FROZEN, &mddev->recovery); | ||
| 4218 | else | ||
| 4219 | clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); | ||
| 4220 | flush_workqueue(md_misc_wq); | 4220 | flush_workqueue(md_misc_wq); |
| 4221 | if (mddev->sync_thread) { | 4221 | if (mddev->sync_thread) { |
| 4222 | set_bit(MD_RECOVERY_INTR, &mddev->recovery); | 4222 | set_bit(MD_RECOVERY_INTR, &mddev->recovery); |
| @@ -4229,16 +4229,17 @@ action_store(struct mddev *mddev, const char *page, size_t len) | |||
| 4229 | test_bit(MD_RECOVERY_NEEDED, &mddev->recovery)) | 4229 | test_bit(MD_RECOVERY_NEEDED, &mddev->recovery)) |
| 4230 | return -EBUSY; | 4230 | return -EBUSY; |
| 4231 | else if (cmd_match(page, "resync")) | 4231 | else if (cmd_match(page, "resync")) |
| 4232 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); | 4232 | clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); |
| 4233 | else if (cmd_match(page, "recover")) { | 4233 | else if (cmd_match(page, "recover")) { |
| 4234 | clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); | ||
| 4234 | set_bit(MD_RECOVERY_RECOVER, &mddev->recovery); | 4235 | set_bit(MD_RECOVERY_RECOVER, &mddev->recovery); |
| 4235 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); | ||
| 4236 | } else if (cmd_match(page, "reshape")) { | 4236 | } else if (cmd_match(page, "reshape")) { |
| 4237 | int err; | 4237 | int err; |
| 4238 | if (mddev->pers->start_reshape == NULL) | 4238 | if (mddev->pers->start_reshape == NULL) |
| 4239 | return -EINVAL; | 4239 | return -EINVAL; |
| 4240 | err = mddev_lock(mddev); | 4240 | err = mddev_lock(mddev); |
| 4241 | if (!err) { | 4241 | if (!err) { |
| 4242 | clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); | ||
| 4242 | err = mddev->pers->start_reshape(mddev); | 4243 | err = mddev->pers->start_reshape(mddev); |
| 4243 | mddev_unlock(mddev); | 4244 | mddev_unlock(mddev); |
| 4244 | } | 4245 | } |
| @@ -4250,6 +4251,7 @@ action_store(struct mddev *mddev, const char *page, size_t len) | |||
| 4250 | set_bit(MD_RECOVERY_CHECK, &mddev->recovery); | 4251 | set_bit(MD_RECOVERY_CHECK, &mddev->recovery); |
| 4251 | else if (!cmd_match(page, "repair")) | 4252 | else if (!cmd_match(page, "repair")) |
| 4252 | return -EINVAL; | 4253 | return -EINVAL; |
| 4254 | clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); | ||
| 4253 | set_bit(MD_RECOVERY_REQUESTED, &mddev->recovery); | 4255 | set_bit(MD_RECOVERY_REQUESTED, &mddev->recovery); |
| 4254 | set_bit(MD_RECOVERY_SYNC, &mddev->recovery); | 4256 | set_bit(MD_RECOVERY_SYNC, &mddev->recovery); |
| 4255 | } | 4257 | } |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index b9f2b9cc6060..553d54b87052 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
| @@ -749,6 +749,7 @@ static void unlock_two_stripes(struct stripe_head *sh1, struct stripe_head *sh2) | |||
| 749 | static bool stripe_can_batch(struct stripe_head *sh) | 749 | static bool stripe_can_batch(struct stripe_head *sh) |
| 750 | { | 750 | { |
| 751 | return test_bit(STRIPE_BATCH_READY, &sh->state) && | 751 | return test_bit(STRIPE_BATCH_READY, &sh->state) && |
| 752 | !test_bit(STRIPE_BITMAP_PENDING, &sh->state) && | ||
| 752 | is_full_stripe_write(sh); | 753 | is_full_stripe_write(sh); |
| 753 | } | 754 | } |
| 754 | 755 | ||
| @@ -837,6 +838,15 @@ static void stripe_add_to_batch_list(struct r5conf *conf, struct stripe_head *sh | |||
| 837 | < IO_THRESHOLD) | 838 | < IO_THRESHOLD) |
| 838 | md_wakeup_thread(conf->mddev->thread); | 839 | md_wakeup_thread(conf->mddev->thread); |
| 839 | 840 | ||
| 841 | if (test_and_clear_bit(STRIPE_BIT_DELAY, &sh->state)) { | ||
| 842 | int seq = sh->bm_seq; | ||
| 843 | if (test_bit(STRIPE_BIT_DELAY, &sh->batch_head->state) && | ||
| 844 | sh->batch_head->bm_seq > seq) | ||
| 845 | seq = sh->batch_head->bm_seq; | ||
| 846 | set_bit(STRIPE_BIT_DELAY, &sh->batch_head->state); | ||
| 847 | sh->batch_head->bm_seq = seq; | ||
| 848 | } | ||
| 849 | |||
| 840 | atomic_inc(&sh->count); | 850 | atomic_inc(&sh->count); |
| 841 | unlock_out: | 851 | unlock_out: |
| 842 | unlock_two_stripes(head, sh); | 852 | unlock_two_stripes(head, sh); |
| @@ -2987,14 +2997,32 @@ static int add_stripe_bio(struct stripe_head *sh, struct bio *bi, int dd_idx, | |||
| 2987 | pr_debug("added bi b#%llu to stripe s#%llu, disk %d.\n", | 2997 | pr_debug("added bi b#%llu to stripe s#%llu, disk %d.\n", |
| 2988 | (unsigned long long)(*bip)->bi_iter.bi_sector, | 2998 | (unsigned long long)(*bip)->bi_iter.bi_sector, |
| 2989 | (unsigned long long)sh->sector, dd_idx); | 2999 | (unsigned long long)sh->sector, dd_idx); |
| 2990 | spin_unlock_irq(&sh->stripe_lock); | ||
| 2991 | 3000 | ||
| 2992 | if (conf->mddev->bitmap && firstwrite) { | 3001 | if (conf->mddev->bitmap && firstwrite) { |
| 3002 | /* Cannot hold spinlock over bitmap_startwrite, | ||
| 3003 | * but must ensure this isn't added to a batch until | ||
| 3004 | * we have added to the bitmap and set bm_seq. | ||
| 3005 | * So set STRIPE_BITMAP_PENDING to prevent | ||
| 3006 | * batching. | ||
| 3007 | * If multiple add_stripe_bio() calls race here they | ||
| 3008 | * much all set STRIPE_BITMAP_PENDING. So only the first one | ||
| 3009 | * to complete "bitmap_startwrite" gets to set | ||
| 3010 | * STRIPE_BIT_DELAY. This is important as once a stripe | ||
| 3011 | * is added to a batch, STRIPE_BIT_DELAY cannot be changed | ||
| 3012 | * any more. | ||
| 3013 | */ | ||
| 3014 | set_bit(STRIPE_BITMAP_PENDING, &sh->state); | ||
| 3015 | spin_unlock_irq(&sh->stripe_lock); | ||
| 2993 | bitmap_startwrite(conf->mddev->bitmap, sh->sector, | 3016 | bitmap_startwrite(conf->mddev->bitmap, sh->sector, |
| 2994 | STRIPE_SECTORS, 0); | 3017 | STRIPE_SECTORS, 0); |
| 2995 | sh->bm_seq = conf->seq_flush+1; | 3018 | spin_lock_irq(&sh->stripe_lock); |
| 2996 | set_bit(STRIPE_BIT_DELAY, &sh->state); | 3019 | clear_bit(STRIPE_BITMAP_PENDING, &sh->state); |
| 3020 | if (!sh->batch_head) { | ||
| 3021 | sh->bm_seq = conf->seq_flush+1; | ||
| 3022 | set_bit(STRIPE_BIT_DELAY, &sh->state); | ||
| 3023 | } | ||
| 2997 | } | 3024 | } |
| 3025 | spin_unlock_irq(&sh->stripe_lock); | ||
| 2998 | 3026 | ||
| 2999 | if (stripe_can_batch(sh)) | 3027 | if (stripe_can_batch(sh)) |
| 3000 | stripe_add_to_batch_list(conf, sh); | 3028 | stripe_add_to_batch_list(conf, sh); |
| @@ -3392,6 +3420,8 @@ static void handle_stripe_fill(struct stripe_head *sh, | |||
| 3392 | set_bit(STRIPE_HANDLE, &sh->state); | 3420 | set_bit(STRIPE_HANDLE, &sh->state); |
| 3393 | } | 3421 | } |
| 3394 | 3422 | ||
| 3423 | static void break_stripe_batch_list(struct stripe_head *head_sh, | ||
| 3424 | unsigned long handle_flags); | ||
| 3395 | /* handle_stripe_clean_event | 3425 | /* handle_stripe_clean_event |
| 3396 | * any written block on an uptodate or failed drive can be returned. | 3426 | * any written block on an uptodate or failed drive can be returned. |
| 3397 | * Note that if we 'wrote' to a failed drive, it will be UPTODATE, but | 3427 | * Note that if we 'wrote' to a failed drive, it will be UPTODATE, but |
| @@ -3405,7 +3435,6 @@ static void handle_stripe_clean_event(struct r5conf *conf, | |||
| 3405 | int discard_pending = 0; | 3435 | int discard_pending = 0; |
| 3406 | struct stripe_head *head_sh = sh; | 3436 | struct stripe_head *head_sh = sh; |
| 3407 | bool do_endio = false; | 3437 | bool do_endio = false; |
| 3408 | int wakeup_nr = 0; | ||
| 3409 | 3438 | ||
| 3410 | for (i = disks; i--; ) | 3439 | for (i = disks; i--; ) |
| 3411 | if (sh->dev[i].written) { | 3440 | if (sh->dev[i].written) { |
| @@ -3494,44 +3523,8 @@ unhash: | |||
| 3494 | if (atomic_dec_and_test(&conf->pending_full_writes)) | 3523 | if (atomic_dec_and_test(&conf->pending_full_writes)) |
| 3495 | md_wakeup_thread(conf->mddev->thread); | 3524 | md_wakeup_thread(conf->mddev->thread); |
| 3496 | 3525 | ||
| 3497 | if (!head_sh->batch_head || !do_endio) | 3526 | if (head_sh->batch_head && do_endio) |
| 3498 | return; | 3527 | break_stripe_batch_list(head_sh, STRIPE_EXPAND_SYNC_FLAGS); |
| 3499 | for (i = 0; i < head_sh->disks; i++) { | ||
| 3500 | if (test_and_clear_bit(R5_Overlap, &head_sh->dev[i].flags)) | ||
| 3501 | wakeup_nr++; | ||
| 3502 | } | ||
| 3503 | while (!list_empty(&head_sh->batch_list)) { | ||
| 3504 | int i; | ||
| 3505 | sh = list_first_entry(&head_sh->batch_list, | ||
| 3506 | struct stripe_head, batch_list); | ||
| 3507 | list_del_init(&sh->batch_list); | ||
| 3508 | |||
| 3509 | set_mask_bits(&sh->state, ~STRIPE_EXPAND_SYNC_FLAG, | ||
| 3510 | head_sh->state & ~((1 << STRIPE_ACTIVE) | | ||
| 3511 | (1 << STRIPE_PREREAD_ACTIVE) | | ||
| 3512 | STRIPE_EXPAND_SYNC_FLAG)); | ||
| 3513 | sh->check_state = head_sh->check_state; | ||
| 3514 | sh->reconstruct_state = head_sh->reconstruct_state; | ||
| 3515 | for (i = 0; i < sh->disks; i++) { | ||
| 3516 | if (test_and_clear_bit(R5_Overlap, &sh->dev[i].flags)) | ||
| 3517 | wakeup_nr++; | ||
| 3518 | sh->dev[i].flags = head_sh->dev[i].flags; | ||
| 3519 | } | ||
| 3520 | |||
| 3521 | spin_lock_irq(&sh->stripe_lock); | ||
| 3522 | sh->batch_head = NULL; | ||
| 3523 | spin_unlock_irq(&sh->stripe_lock); | ||
| 3524 | if (sh->state & STRIPE_EXPAND_SYNC_FLAG) | ||
| 3525 | set_bit(STRIPE_HANDLE, &sh->state); | ||
| 3526 | release_stripe(sh); | ||
| 3527 | } | ||
| 3528 | |||
| 3529 | spin_lock_irq(&head_sh->stripe_lock); | ||
| 3530 | head_sh->batch_head = NULL; | ||
| 3531 | spin_unlock_irq(&head_sh->stripe_lock); | ||
| 3532 | wake_up_nr(&conf->wait_for_overlap, wakeup_nr); | ||
| 3533 | if (head_sh->state & STRIPE_EXPAND_SYNC_FLAG) | ||
| 3534 | set_bit(STRIPE_HANDLE, &head_sh->state); | ||
| 3535 | } | 3528 | } |
| 3536 | 3529 | ||
| 3537 | static void handle_stripe_dirtying(struct r5conf *conf, | 3530 | static void handle_stripe_dirtying(struct r5conf *conf, |
| @@ -4172,9 +4165,13 @@ static void analyse_stripe(struct stripe_head *sh, struct stripe_head_state *s) | |||
| 4172 | 4165 | ||
| 4173 | static int clear_batch_ready(struct stripe_head *sh) | 4166 | static int clear_batch_ready(struct stripe_head *sh) |
| 4174 | { | 4167 | { |
| 4168 | /* Return '1' if this is a member of batch, or | ||
| 4169 | * '0' if it is a lone stripe or a head which can now be | ||
| 4170 | * handled. | ||
| 4171 | */ | ||
| 4175 | struct stripe_head *tmp; | 4172 | struct stripe_head *tmp; |
| 4176 | if (!test_and_clear_bit(STRIPE_BATCH_READY, &sh->state)) | 4173 | if (!test_and_clear_bit(STRIPE_BATCH_READY, &sh->state)) |
| 4177 | return 0; | 4174 | return (sh->batch_head && sh->batch_head != sh); |
| 4178 | spin_lock(&sh->stripe_lock); | 4175 | spin_lock(&sh->stripe_lock); |
| 4179 | if (!sh->batch_head) { | 4176 | if (!sh->batch_head) { |
| 4180 | spin_unlock(&sh->stripe_lock); | 4177 | spin_unlock(&sh->stripe_lock); |
| @@ -4202,38 +4199,65 @@ static int clear_batch_ready(struct stripe_head *sh) | |||
| 4202 | return 0; | 4199 | return 0; |
| 4203 | } | 4200 | } |
| 4204 | 4201 | ||
| 4205 | static void check_break_stripe_batch_list(struct stripe_head *sh) | 4202 | static void break_stripe_batch_list(struct stripe_head *head_sh, |
| 4203 | unsigned long handle_flags) | ||
| 4206 | { | 4204 | { |
| 4207 | struct stripe_head *head_sh, *next; | 4205 | struct stripe_head *sh, *next; |
| 4208 | int i; | 4206 | int i; |
| 4209 | 4207 | int do_wakeup = 0; | |
| 4210 | if (!test_and_clear_bit(STRIPE_BATCH_ERR, &sh->state)) | ||
| 4211 | return; | ||
| 4212 | |||
| 4213 | head_sh = sh; | ||
| 4214 | 4208 | ||
| 4215 | list_for_each_entry_safe(sh, next, &head_sh->batch_list, batch_list) { | 4209 | list_for_each_entry_safe(sh, next, &head_sh->batch_list, batch_list) { |
| 4216 | 4210 | ||
| 4217 | list_del_init(&sh->batch_list); | 4211 | list_del_init(&sh->batch_list); |
| 4218 | 4212 | ||
| 4219 | set_mask_bits(&sh->state, ~STRIPE_EXPAND_SYNC_FLAG, | 4213 | WARN_ON_ONCE(sh->state & ((1 << STRIPE_ACTIVE) | |
| 4220 | head_sh->state & ~((1 << STRIPE_ACTIVE) | | 4214 | (1 << STRIPE_SYNCING) | |
| 4221 | (1 << STRIPE_PREREAD_ACTIVE) | | 4215 | (1 << STRIPE_REPLACED) | |
| 4222 | (1 << STRIPE_DEGRADED) | | 4216 | (1 << STRIPE_PREREAD_ACTIVE) | |
| 4223 | STRIPE_EXPAND_SYNC_FLAG)); | 4217 | (1 << STRIPE_DELAYED) | |
| 4218 | (1 << STRIPE_BIT_DELAY) | | ||
| 4219 | (1 << STRIPE_FULL_WRITE) | | ||
| 4220 | (1 << STRIPE_BIOFILL_RUN) | | ||
| 4221 | (1 << STRIPE_COMPUTE_RUN) | | ||
| 4222 | (1 << STRIPE_OPS_REQ_PENDING) | | ||
| 4223 | (1 << STRIPE_DISCARD) | | ||
| 4224 | (1 << STRIPE_BATCH_READY) | | ||
| 4225 | (1 << STRIPE_BATCH_ERR) | | ||
| 4226 | (1 << STRIPE_BITMAP_PENDING))); | ||
| 4227 | WARN_ON_ONCE(head_sh->state & ((1 << STRIPE_DISCARD) | | ||
| 4228 | (1 << STRIPE_REPLACED))); | ||
| 4229 | |||
| 4230 | set_mask_bits(&sh->state, ~(STRIPE_EXPAND_SYNC_FLAGS | | ||
| 4231 | (1 << STRIPE_DEGRADED)), | ||
| 4232 | head_sh->state & (1 << STRIPE_INSYNC)); | ||
| 4233 | |||
| 4224 | sh->check_state = head_sh->check_state; | 4234 | sh->check_state = head_sh->check_state; |
| 4225 | sh->reconstruct_state = head_sh->reconstruct_state; | 4235 | sh->reconstruct_state = head_sh->reconstruct_state; |
| 4226 | for (i = 0; i < sh->disks; i++) | 4236 | for (i = 0; i < sh->disks; i++) { |
| 4237 | if (test_and_clear_bit(R5_Overlap, &sh->dev[i].flags)) | ||
| 4238 | do_wakeup = 1; | ||
| 4227 | sh->dev[i].flags = head_sh->dev[i].flags & | 4239 | sh->dev[i].flags = head_sh->dev[i].flags & |
| 4228 | (~((1 << R5_WriteError) | (1 << R5_Overlap))); | 4240 | (~((1 << R5_WriteError) | (1 << R5_Overlap))); |
| 4229 | 4241 | } | |
| 4230 | spin_lock_irq(&sh->stripe_lock); | 4242 | spin_lock_irq(&sh->stripe_lock); |
| 4231 | sh->batch_head = NULL; | 4243 | sh->batch_head = NULL; |
| 4232 | spin_unlock_irq(&sh->stripe_lock); | 4244 | spin_unlock_irq(&sh->stripe_lock); |
| 4233 | 4245 | if (handle_flags == 0 || | |
| 4234 | set_bit(STRIPE_HANDLE, &sh->state); | 4246 | sh->state & handle_flags) |
| 4247 | set_bit(STRIPE_HANDLE, &sh->state); | ||
| 4235 | release_stripe(sh); | 4248 | release_stripe(sh); |
| 4236 | } | 4249 | } |
| 4250 | spin_lock_irq(&head_sh->stripe_lock); | ||
| 4251 | head_sh->batch_head = NULL; | ||
| 4252 | spin_unlock_irq(&head_sh->stripe_lock); | ||
| 4253 | for (i = 0; i < head_sh->disks; i++) | ||
| 4254 | if (test_and_clear_bit(R5_Overlap, &head_sh->dev[i].flags)) | ||
| 4255 | do_wakeup = 1; | ||
| 4256 | if (head_sh->state & handle_flags) | ||
| 4257 | set_bit(STRIPE_HANDLE, &head_sh->state); | ||
| 4258 | |||
| 4259 | if (do_wakeup) | ||
| 4260 | wake_up(&head_sh->raid_conf->wait_for_overlap); | ||
| 4237 | } | 4261 | } |
| 4238 | 4262 | ||
| 4239 | static void handle_stripe(struct stripe_head *sh) | 4263 | static void handle_stripe(struct stripe_head *sh) |
| @@ -4258,7 +4282,8 @@ static void handle_stripe(struct stripe_head *sh) | |||
| 4258 | return; | 4282 | return; |
| 4259 | } | 4283 | } |
| 4260 | 4284 | ||
| 4261 | check_break_stripe_batch_list(sh); | 4285 | if (test_and_clear_bit(STRIPE_BATCH_ERR, &sh->state)) |
| 4286 | break_stripe_batch_list(sh, 0); | ||
| 4262 | 4287 | ||
| 4263 | if (test_bit(STRIPE_SYNC_REQUESTED, &sh->state) && !sh->batch_head) { | 4288 | if (test_bit(STRIPE_SYNC_REQUESTED, &sh->state) && !sh->batch_head) { |
| 4264 | spin_lock(&sh->stripe_lock); | 4289 | spin_lock(&sh->stripe_lock); |
| @@ -4312,6 +4337,7 @@ static void handle_stripe(struct stripe_head *sh) | |||
| 4312 | if (s.failed > conf->max_degraded) { | 4337 | if (s.failed > conf->max_degraded) { |
| 4313 | sh->check_state = 0; | 4338 | sh->check_state = 0; |
| 4314 | sh->reconstruct_state = 0; | 4339 | sh->reconstruct_state = 0; |
| 4340 | break_stripe_batch_list(sh, 0); | ||
| 4315 | if (s.to_read+s.to_write+s.written) | 4341 | if (s.to_read+s.to_write+s.written) |
| 4316 | handle_failed_stripe(conf, sh, &s, disks, &s.return_bi); | 4342 | handle_failed_stripe(conf, sh, &s, disks, &s.return_bi); |
| 4317 | if (s.syncing + s.replacing) | 4343 | if (s.syncing + s.replacing) |
diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h index 7dc0dd86074b..896d603ad0da 100644 --- a/drivers/md/raid5.h +++ b/drivers/md/raid5.h | |||
| @@ -337,9 +337,12 @@ enum { | |||
| 337 | STRIPE_ON_RELEASE_LIST, | 337 | STRIPE_ON_RELEASE_LIST, |
| 338 | STRIPE_BATCH_READY, | 338 | STRIPE_BATCH_READY, |
| 339 | STRIPE_BATCH_ERR, | 339 | STRIPE_BATCH_ERR, |
| 340 | STRIPE_BITMAP_PENDING, /* Being added to bitmap, don't add | ||
| 341 | * to batch yet. | ||
| 342 | */ | ||
| 340 | }; | 343 | }; |
| 341 | 344 | ||
| 342 | #define STRIPE_EXPAND_SYNC_FLAG \ | 345 | #define STRIPE_EXPAND_SYNC_FLAGS \ |
| 343 | ((1 << STRIPE_EXPAND_SOURCE) |\ | 346 | ((1 << STRIPE_EXPAND_SOURCE) |\ |
| 344 | (1 << STRIPE_EXPAND_READY) |\ | 347 | (1 << STRIPE_EXPAND_READY) |\ |
| 345 | (1 << STRIPE_EXPANDING) |\ | 348 | (1 << STRIPE_EXPANDING) |\ |
diff --git a/drivers/mfd/da9052-core.c b/drivers/mfd/da9052-core.c index ae498b53ee40..46e3840c7a37 100644 --- a/drivers/mfd/da9052-core.c +++ b/drivers/mfd/da9052-core.c | |||
| @@ -433,6 +433,10 @@ EXPORT_SYMBOL_GPL(da9052_adc_read_temp); | |||
| 433 | static const struct mfd_cell da9052_subdev_info[] = { | 433 | static const struct mfd_cell da9052_subdev_info[] = { |
| 434 | { | 434 | { |
| 435 | .name = "da9052-regulator", | 435 | .name = "da9052-regulator", |
| 436 | .id = 0, | ||
| 437 | }, | ||
| 438 | { | ||
| 439 | .name = "da9052-regulator", | ||
| 436 | .id = 1, | 440 | .id = 1, |
| 437 | }, | 441 | }, |
| 438 | { | 442 | { |
| @@ -484,10 +488,6 @@ static const struct mfd_cell da9052_subdev_info[] = { | |||
| 484 | .id = 13, | 488 | .id = 13, |
| 485 | }, | 489 | }, |
| 486 | { | 490 | { |
| 487 | .name = "da9052-regulator", | ||
| 488 | .id = 14, | ||
| 489 | }, | ||
| 490 | { | ||
| 491 | .name = "da9052-onkey", | 491 | .name = "da9052-onkey", |
| 492 | }, | 492 | }, |
| 493 | { | 493 | { |
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index a6dcbf850c1f..6f9ffb9026cd 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c | |||
| @@ -2358,11 +2358,11 @@ static int be_evt_queues_create(struct be_adapter *adapter) | |||
| 2358 | adapter->cfg_num_qs); | 2358 | adapter->cfg_num_qs); |
| 2359 | 2359 | ||
| 2360 | for_all_evt_queues(adapter, eqo, i) { | 2360 | for_all_evt_queues(adapter, eqo, i) { |
| 2361 | int numa_node = dev_to_node(&adapter->pdev->dev); | ||
| 2361 | if (!zalloc_cpumask_var(&eqo->affinity_mask, GFP_KERNEL)) | 2362 | if (!zalloc_cpumask_var(&eqo->affinity_mask, GFP_KERNEL)) |
| 2362 | return -ENOMEM; | 2363 | return -ENOMEM; |
| 2363 | cpumask_set_cpu_local_first(i, dev_to_node(&adapter->pdev->dev), | 2364 | cpumask_set_cpu(cpumask_local_spread(i, numa_node), |
| 2364 | eqo->affinity_mask); | 2365 | eqo->affinity_mask); |
| 2365 | |||
| 2366 | netif_napi_add(adapter->netdev, &eqo->napi, be_poll, | 2366 | netif_napi_add(adapter->netdev, &eqo->napi, be_poll, |
| 2367 | BE_NAPI_WEIGHT); | 2367 | BE_NAPI_WEIGHT); |
| 2368 | napi_hash_add(&eqo->napi); | 2368 | napi_hash_add(&eqo->napi); |
diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c index de7919322190..b9df0cbd0a38 100644 --- a/drivers/net/ethernet/ibm/emac/core.c +++ b/drivers/net/ethernet/ibm/emac/core.c | |||
| @@ -2084,12 +2084,8 @@ static void emac_ethtool_get_pauseparam(struct net_device *ndev, | |||
| 2084 | 2084 | ||
| 2085 | static int emac_get_regs_len(struct emac_instance *dev) | 2085 | static int emac_get_regs_len(struct emac_instance *dev) |
| 2086 | { | 2086 | { |
| 2087 | if (emac_has_feature(dev, EMAC_FTR_EMAC4)) | ||
| 2088 | return sizeof(struct emac_ethtool_regs_subhdr) + | ||
| 2089 | EMAC4_ETHTOOL_REGS_SIZE(dev); | ||
| 2090 | else | ||
| 2091 | return sizeof(struct emac_ethtool_regs_subhdr) + | 2087 | return sizeof(struct emac_ethtool_regs_subhdr) + |
| 2092 | EMAC_ETHTOOL_REGS_SIZE(dev); | 2088 | sizeof(struct emac_regs); |
| 2093 | } | 2089 | } |
| 2094 | 2090 | ||
| 2095 | static int emac_ethtool_get_regs_len(struct net_device *ndev) | 2091 | static int emac_ethtool_get_regs_len(struct net_device *ndev) |
| @@ -2114,15 +2110,15 @@ static void *emac_dump_regs(struct emac_instance *dev, void *buf) | |||
| 2114 | struct emac_ethtool_regs_subhdr *hdr = buf; | 2110 | struct emac_ethtool_regs_subhdr *hdr = buf; |
| 2115 | 2111 | ||
| 2116 | hdr->index = dev->cell_index; | 2112 | hdr->index = dev->cell_index; |
| 2117 | if (emac_has_feature(dev, EMAC_FTR_EMAC4)) { | 2113 | if (emac_has_feature(dev, EMAC_FTR_EMAC4SYNC)) { |
| 2114 | hdr->version = EMAC4SYNC_ETHTOOL_REGS_VER; | ||
| 2115 | } else if (emac_has_feature(dev, EMAC_FTR_EMAC4)) { | ||
| 2118 | hdr->version = EMAC4_ETHTOOL_REGS_VER; | 2116 | hdr->version = EMAC4_ETHTOOL_REGS_VER; |
| 2119 | memcpy_fromio(hdr + 1, dev->emacp, EMAC4_ETHTOOL_REGS_SIZE(dev)); | ||
| 2120 | return (void *)(hdr + 1) + EMAC4_ETHTOOL_REGS_SIZE(dev); | ||
| 2121 | } else { | 2117 | } else { |
| 2122 | hdr->version = EMAC_ETHTOOL_REGS_VER; | 2118 | hdr->version = EMAC_ETHTOOL_REGS_VER; |
| 2123 | memcpy_fromio(hdr + 1, dev->emacp, EMAC_ETHTOOL_REGS_SIZE(dev)); | ||
| 2124 | return (void *)(hdr + 1) + EMAC_ETHTOOL_REGS_SIZE(dev); | ||
| 2125 | } | 2119 | } |
| 2120 | memcpy_fromio(hdr + 1, dev->emacp, sizeof(struct emac_regs)); | ||
| 2121 | return (void *)(hdr + 1) + sizeof(struct emac_regs); | ||
| 2126 | } | 2122 | } |
| 2127 | 2123 | ||
| 2128 | static void emac_ethtool_get_regs(struct net_device *ndev, | 2124 | static void emac_ethtool_get_regs(struct net_device *ndev, |
diff --git a/drivers/net/ethernet/ibm/emac/core.h b/drivers/net/ethernet/ibm/emac/core.h index 67f342a9f65e..28df37420da9 100644 --- a/drivers/net/ethernet/ibm/emac/core.h +++ b/drivers/net/ethernet/ibm/emac/core.h | |||
| @@ -461,10 +461,7 @@ struct emac_ethtool_regs_subhdr { | |||
| 461 | }; | 461 | }; |
| 462 | 462 | ||
| 463 | #define EMAC_ETHTOOL_REGS_VER 0 | 463 | #define EMAC_ETHTOOL_REGS_VER 0 |
| 464 | #define EMAC_ETHTOOL_REGS_SIZE(dev) ((dev)->rsrc_regs.end - \ | 464 | #define EMAC4_ETHTOOL_REGS_VER 1 |
| 465 | (dev)->rsrc_regs.start + 1) | 465 | #define EMAC4SYNC_ETHTOOL_REGS_VER 2 |
| 466 | #define EMAC4_ETHTOOL_REGS_VER 1 | ||
| 467 | #define EMAC4_ETHTOOL_REGS_SIZE(dev) ((dev)->rsrc_regs.end - \ | ||
| 468 | (dev)->rsrc_regs.start + 1) | ||
| 469 | 466 | ||
| 470 | #endif /* __IBM_NEWEMAC_CORE_H */ | 467 | #endif /* __IBM_NEWEMAC_CORE_H */ |
diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c index 4f7dc044601e..529ef0594b90 100644 --- a/drivers/net/ethernet/mellanox/mlx4/cmd.c +++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c | |||
| @@ -714,8 +714,13 @@ static int mlx4_cmd_wait(struct mlx4_dev *dev, u64 in_param, u64 *out_param, | |||
| 714 | msecs_to_jiffies(timeout))) { | 714 | msecs_to_jiffies(timeout))) { |
| 715 | mlx4_warn(dev, "command 0x%x timed out (go bit not cleared)\n", | 715 | mlx4_warn(dev, "command 0x%x timed out (go bit not cleared)\n", |
| 716 | op); | 716 | op); |
| 717 | err = -EIO; | 717 | if (op == MLX4_CMD_NOP) { |
| 718 | goto out_reset; | 718 | err = -EBUSY; |
| 719 | goto out; | ||
| 720 | } else { | ||
| 721 | err = -EIO; | ||
| 722 | goto out_reset; | ||
| 723 | } | ||
| 719 | } | 724 | } |
| 720 | 725 | ||
| 721 | err = context->result; | 726 | err = context->result; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index 32f5ec737472..cf467a9f6cc7 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
| @@ -1501,17 +1501,13 @@ static int mlx4_en_init_affinity_hint(struct mlx4_en_priv *priv, int ring_idx) | |||
| 1501 | { | 1501 | { |
| 1502 | struct mlx4_en_rx_ring *ring = priv->rx_ring[ring_idx]; | 1502 | struct mlx4_en_rx_ring *ring = priv->rx_ring[ring_idx]; |
| 1503 | int numa_node = priv->mdev->dev->numa_node; | 1503 | int numa_node = priv->mdev->dev->numa_node; |
| 1504 | int ret = 0; | ||
| 1505 | 1504 | ||
| 1506 | if (!zalloc_cpumask_var(&ring->affinity_mask, GFP_KERNEL)) | 1505 | if (!zalloc_cpumask_var(&ring->affinity_mask, GFP_KERNEL)) |
| 1507 | return -ENOMEM; | 1506 | return -ENOMEM; |
| 1508 | 1507 | ||
| 1509 | ret = cpumask_set_cpu_local_first(ring_idx, numa_node, | 1508 | cpumask_set_cpu(cpumask_local_spread(ring_idx, numa_node), |
| 1510 | ring->affinity_mask); | 1509 | ring->affinity_mask); |
| 1511 | if (ret) | 1510 | return 0; |
| 1512 | free_cpumask_var(ring->affinity_mask); | ||
| 1513 | |||
| 1514 | return ret; | ||
| 1515 | } | 1511 | } |
| 1516 | 1512 | ||
| 1517 | static void mlx4_en_free_affinity_hint(struct mlx4_en_priv *priv, int ring_idx) | 1513 | static void mlx4_en_free_affinity_hint(struct mlx4_en_priv *priv, int ring_idx) |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c index f7bf312fb443..7bed3a88579f 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c | |||
| @@ -144,9 +144,9 @@ int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv, | |||
| 144 | ring->queue_index = queue_index; | 144 | ring->queue_index = queue_index; |
| 145 | 145 | ||
| 146 | if (queue_index < priv->num_tx_rings_p_up) | 146 | if (queue_index < priv->num_tx_rings_p_up) |
| 147 | cpumask_set_cpu_local_first(queue_index, | 147 | cpumask_set_cpu(cpumask_local_spread(queue_index, |
| 148 | priv->mdev->dev->numa_node, | 148 | priv->mdev->dev->numa_node), |
| 149 | &ring->affinity_mask); | 149 | &ring->affinity_mask); |
| 150 | 150 | ||
| 151 | *pring = ring; | 151 | *pring = ring; |
| 152 | return 0; | 152 | return 0; |
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c index e0c31e3947d1..6409a06bbdf6 100644 --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c | |||
| @@ -3025,9 +3025,9 @@ netxen_sysfs_read_dimm(struct file *filp, struct kobject *kobj, | |||
| 3025 | u8 dw, rows, cols, banks, ranks; | 3025 | u8 dw, rows, cols, banks, ranks; |
| 3026 | u32 val; | 3026 | u32 val; |
| 3027 | 3027 | ||
| 3028 | if (size != sizeof(struct netxen_dimm_cfg)) { | 3028 | if (size < attr->size) { |
| 3029 | netdev_err(netdev, "Invalid size\n"); | 3029 | netdev_err(netdev, "Invalid size\n"); |
| 3030 | return -1; | 3030 | return -EINVAL; |
| 3031 | } | 3031 | } |
| 3032 | 3032 | ||
| 3033 | memset(&dimm, 0, sizeof(struct netxen_dimm_cfg)); | 3033 | memset(&dimm, 0, sizeof(struct netxen_dimm_cfg)); |
| @@ -3137,7 +3137,7 @@ out: | |||
| 3137 | 3137 | ||
| 3138 | static struct bin_attribute bin_attr_dimm = { | 3138 | static struct bin_attribute bin_attr_dimm = { |
| 3139 | .attr = { .name = "dimm", .mode = (S_IRUGO | S_IWUSR) }, | 3139 | .attr = { .name = "dimm", .mode = (S_IRUGO | S_IWUSR) }, |
| 3140 | .size = 0, | 3140 | .size = sizeof(struct netxen_dimm_cfg), |
| 3141 | .read = netxen_sysfs_read_dimm, | 3141 | .read = netxen_sysfs_read_dimm, |
| 3142 | }; | 3142 | }; |
| 3143 | 3143 | ||
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index 2ac9552d1fa3..73bab983edd9 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h | |||
| @@ -117,6 +117,12 @@ struct stmmac_priv { | |||
| 117 | int use_riwt; | 117 | int use_riwt; |
| 118 | int irq_wake; | 118 | int irq_wake; |
| 119 | spinlock_t ptp_lock; | 119 | spinlock_t ptp_lock; |
| 120 | |||
| 121 | #ifdef CONFIG_DEBUG_FS | ||
| 122 | struct dentry *dbgfs_dir; | ||
| 123 | struct dentry *dbgfs_rings_status; | ||
| 124 | struct dentry *dbgfs_dma_cap; | ||
| 125 | #endif | ||
| 120 | }; | 126 | }; |
| 121 | 127 | ||
| 122 | int stmmac_mdio_unregister(struct net_device *ndev); | 128 | int stmmac_mdio_unregister(struct net_device *ndev); |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 05c146f718a3..2c5ce2baca87 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
| @@ -118,7 +118,7 @@ static irqreturn_t stmmac_interrupt(int irq, void *dev_id); | |||
| 118 | 118 | ||
| 119 | #ifdef CONFIG_DEBUG_FS | 119 | #ifdef CONFIG_DEBUG_FS |
| 120 | static int stmmac_init_fs(struct net_device *dev); | 120 | static int stmmac_init_fs(struct net_device *dev); |
| 121 | static void stmmac_exit_fs(void); | 121 | static void stmmac_exit_fs(struct net_device *dev); |
| 122 | #endif | 122 | #endif |
| 123 | 123 | ||
| 124 | #define STMMAC_COAL_TIMER(x) (jiffies + usecs_to_jiffies(x)) | 124 | #define STMMAC_COAL_TIMER(x) (jiffies + usecs_to_jiffies(x)) |
| @@ -1916,7 +1916,7 @@ static int stmmac_release(struct net_device *dev) | |||
| 1916 | netif_carrier_off(dev); | 1916 | netif_carrier_off(dev); |
| 1917 | 1917 | ||
| 1918 | #ifdef CONFIG_DEBUG_FS | 1918 | #ifdef CONFIG_DEBUG_FS |
| 1919 | stmmac_exit_fs(); | 1919 | stmmac_exit_fs(dev); |
| 1920 | #endif | 1920 | #endif |
| 1921 | 1921 | ||
| 1922 | stmmac_release_ptp(priv); | 1922 | stmmac_release_ptp(priv); |
| @@ -2508,8 +2508,6 @@ static int stmmac_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | |||
| 2508 | 2508 | ||
| 2509 | #ifdef CONFIG_DEBUG_FS | 2509 | #ifdef CONFIG_DEBUG_FS |
| 2510 | static struct dentry *stmmac_fs_dir; | 2510 | static struct dentry *stmmac_fs_dir; |
| 2511 | static struct dentry *stmmac_rings_status; | ||
| 2512 | static struct dentry *stmmac_dma_cap; | ||
| 2513 | 2511 | ||
| 2514 | static void sysfs_display_ring(void *head, int size, int extend_desc, | 2512 | static void sysfs_display_ring(void *head, int size, int extend_desc, |
| 2515 | struct seq_file *seq) | 2513 | struct seq_file *seq) |
| @@ -2648,36 +2646,39 @@ static const struct file_operations stmmac_dma_cap_fops = { | |||
| 2648 | 2646 | ||
| 2649 | static int stmmac_init_fs(struct net_device *dev) | 2647 | static int stmmac_init_fs(struct net_device *dev) |
| 2650 | { | 2648 | { |
| 2651 | /* Create debugfs entries */ | 2649 | struct stmmac_priv *priv = netdev_priv(dev); |
| 2652 | stmmac_fs_dir = debugfs_create_dir(STMMAC_RESOURCE_NAME, NULL); | 2650 | |
| 2651 | /* Create per netdev entries */ | ||
| 2652 | priv->dbgfs_dir = debugfs_create_dir(dev->name, stmmac_fs_dir); | ||
| 2653 | 2653 | ||
| 2654 | if (!stmmac_fs_dir || IS_ERR(stmmac_fs_dir)) { | 2654 | if (!priv->dbgfs_dir || IS_ERR(priv->dbgfs_dir)) { |
| 2655 | pr_err("ERROR %s, debugfs create directory failed\n", | 2655 | pr_err("ERROR %s/%s, debugfs create directory failed\n", |
| 2656 | STMMAC_RESOURCE_NAME); | 2656 | STMMAC_RESOURCE_NAME, dev->name); |
| 2657 | 2657 | ||
| 2658 | return -ENOMEM; | 2658 | return -ENOMEM; |
| 2659 | } | 2659 | } |
| 2660 | 2660 | ||
| 2661 | /* Entry to report DMA RX/TX rings */ | 2661 | /* Entry to report DMA RX/TX rings */ |
| 2662 | stmmac_rings_status = debugfs_create_file("descriptors_status", | 2662 | priv->dbgfs_rings_status = |
| 2663 | S_IRUGO, stmmac_fs_dir, dev, | 2663 | debugfs_create_file("descriptors_status", S_IRUGO, |
| 2664 | &stmmac_rings_status_fops); | 2664 | priv->dbgfs_dir, dev, |
| 2665 | &stmmac_rings_status_fops); | ||
| 2665 | 2666 | ||
| 2666 | if (!stmmac_rings_status || IS_ERR(stmmac_rings_status)) { | 2667 | if (!priv->dbgfs_rings_status || IS_ERR(priv->dbgfs_rings_status)) { |
| 2667 | pr_info("ERROR creating stmmac ring debugfs file\n"); | 2668 | pr_info("ERROR creating stmmac ring debugfs file\n"); |
| 2668 | debugfs_remove(stmmac_fs_dir); | 2669 | debugfs_remove_recursive(priv->dbgfs_dir); |
| 2669 | 2670 | ||
| 2670 | return -ENOMEM; | 2671 | return -ENOMEM; |
| 2671 | } | 2672 | } |
| 2672 | 2673 | ||
| 2673 | /* Entry to report the DMA HW features */ | 2674 | /* Entry to report the DMA HW features */ |
| 2674 | stmmac_dma_cap = debugfs_create_file("dma_cap", S_IRUGO, stmmac_fs_dir, | 2675 | priv->dbgfs_dma_cap = debugfs_create_file("dma_cap", S_IRUGO, |
| 2675 | dev, &stmmac_dma_cap_fops); | 2676 | priv->dbgfs_dir, |
| 2677 | dev, &stmmac_dma_cap_fops); | ||
| 2676 | 2678 | ||
| 2677 | if (!stmmac_dma_cap || IS_ERR(stmmac_dma_cap)) { | 2679 | if (!priv->dbgfs_dma_cap || IS_ERR(priv->dbgfs_dma_cap)) { |
| 2678 | pr_info("ERROR creating stmmac MMC debugfs file\n"); | 2680 | pr_info("ERROR creating stmmac MMC debugfs file\n"); |
| 2679 | debugfs_remove(stmmac_rings_status); | 2681 | debugfs_remove_recursive(priv->dbgfs_dir); |
| 2680 | debugfs_remove(stmmac_fs_dir); | ||
| 2681 | 2682 | ||
| 2682 | return -ENOMEM; | 2683 | return -ENOMEM; |
| 2683 | } | 2684 | } |
| @@ -2685,11 +2686,11 @@ static int stmmac_init_fs(struct net_device *dev) | |||
| 2685 | return 0; | 2686 | return 0; |
| 2686 | } | 2687 | } |
| 2687 | 2688 | ||
| 2688 | static void stmmac_exit_fs(void) | 2689 | static void stmmac_exit_fs(struct net_device *dev) |
| 2689 | { | 2690 | { |
| 2690 | debugfs_remove(stmmac_rings_status); | 2691 | struct stmmac_priv *priv = netdev_priv(dev); |
| 2691 | debugfs_remove(stmmac_dma_cap); | 2692 | |
| 2692 | debugfs_remove(stmmac_fs_dir); | 2693 | debugfs_remove_recursive(priv->dbgfs_dir); |
| 2693 | } | 2694 | } |
| 2694 | #endif /* CONFIG_DEBUG_FS */ | 2695 | #endif /* CONFIG_DEBUG_FS */ |
| 2695 | 2696 | ||
| @@ -3149,6 +3150,35 @@ err: | |||
| 3149 | __setup("stmmaceth=", stmmac_cmdline_opt); | 3150 | __setup("stmmaceth=", stmmac_cmdline_opt); |
| 3150 | #endif /* MODULE */ | 3151 | #endif /* MODULE */ |
| 3151 | 3152 | ||
| 3153 | static int __init stmmac_init(void) | ||
| 3154 | { | ||
| 3155 | #ifdef CONFIG_DEBUG_FS | ||
| 3156 | /* Create debugfs main directory if it doesn't exist yet */ | ||
| 3157 | if (!stmmac_fs_dir) { | ||
| 3158 | stmmac_fs_dir = debugfs_create_dir(STMMAC_RESOURCE_NAME, NULL); | ||
| 3159 | |||
| 3160 | if (!stmmac_fs_dir || IS_ERR(stmmac_fs_dir)) { | ||
| 3161 | pr_err("ERROR %s, debugfs create directory failed\n", | ||
| 3162 | STMMAC_RESOURCE_NAME); | ||
| 3163 | |||
| 3164 | return -ENOMEM; | ||
| 3165 | } | ||
| 3166 | } | ||
| 3167 | #endif | ||
| 3168 | |||
| 3169 | return 0; | ||
| 3170 | } | ||
| 3171 | |||
| 3172 | static void __exit stmmac_exit(void) | ||
| 3173 | { | ||
| 3174 | #ifdef CONFIG_DEBUG_FS | ||
| 3175 | debugfs_remove_recursive(stmmac_fs_dir); | ||
| 3176 | #endif | ||
| 3177 | } | ||
| 3178 | |||
| 3179 | module_init(stmmac_init) | ||
| 3180 | module_exit(stmmac_exit) | ||
| 3181 | |||
| 3152 | MODULE_DESCRIPTION("STMMAC 10/100/1000 Ethernet device driver"); | 3182 | MODULE_DESCRIPTION("STMMAC 10/100/1000 Ethernet device driver"); |
| 3153 | MODULE_AUTHOR("Giuseppe Cavallaro <peppe.cavallaro@st.com>"); | 3183 | MODULE_AUTHOR("Giuseppe Cavallaro <peppe.cavallaro@st.com>"); |
| 3154 | MODULE_LICENSE("GPL"); | 3184 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/net/phy/amd-xgbe-phy.c b/drivers/net/phy/amd-xgbe-phy.c index fb276f64cd64..34a75cba3b73 100644 --- a/drivers/net/phy/amd-xgbe-phy.c +++ b/drivers/net/phy/amd-xgbe-phy.c | |||
| @@ -755,6 +755,45 @@ static int amd_xgbe_phy_set_mode(struct phy_device *phydev, | |||
| 755 | return ret; | 755 | return ret; |
| 756 | } | 756 | } |
| 757 | 757 | ||
| 758 | static bool amd_xgbe_phy_use_xgmii_mode(struct phy_device *phydev) | ||
| 759 | { | ||
| 760 | if (phydev->autoneg == AUTONEG_ENABLE) { | ||
| 761 | if (phydev->advertising & ADVERTISED_10000baseKR_Full) | ||
| 762 | return true; | ||
| 763 | } else { | ||
| 764 | if (phydev->speed == SPEED_10000) | ||
| 765 | return true; | ||
| 766 | } | ||
| 767 | |||
| 768 | return false; | ||
| 769 | } | ||
| 770 | |||
| 771 | static bool amd_xgbe_phy_use_gmii_2500_mode(struct phy_device *phydev) | ||
| 772 | { | ||
| 773 | if (phydev->autoneg == AUTONEG_ENABLE) { | ||
| 774 | if (phydev->advertising & ADVERTISED_2500baseX_Full) | ||
| 775 | return true; | ||
| 776 | } else { | ||
| 777 | if (phydev->speed == SPEED_2500) | ||
| 778 | return true; | ||
| 779 | } | ||
| 780 | |||
| 781 | return false; | ||
| 782 | } | ||
| 783 | |||
| 784 | static bool amd_xgbe_phy_use_gmii_mode(struct phy_device *phydev) | ||
| 785 | { | ||
| 786 | if (phydev->autoneg == AUTONEG_ENABLE) { | ||
| 787 | if (phydev->advertising & ADVERTISED_1000baseKX_Full) | ||
| 788 | return true; | ||
| 789 | } else { | ||
| 790 | if (phydev->speed == SPEED_1000) | ||
| 791 | return true; | ||
| 792 | } | ||
| 793 | |||
| 794 | return false; | ||
| 795 | } | ||
| 796 | |||
| 758 | static int amd_xgbe_phy_set_an(struct phy_device *phydev, bool enable, | 797 | static int amd_xgbe_phy_set_an(struct phy_device *phydev, bool enable, |
| 759 | bool restart) | 798 | bool restart) |
| 760 | { | 799 | { |
| @@ -1235,11 +1274,11 @@ static int amd_xgbe_phy_config_init(struct phy_device *phydev) | |||
| 1235 | /* Set initial mode - call the mode setting routines | 1274 | /* Set initial mode - call the mode setting routines |
| 1236 | * directly to insure we are properly configured | 1275 | * directly to insure we are properly configured |
| 1237 | */ | 1276 | */ |
| 1238 | if (phydev->advertising & SUPPORTED_10000baseKR_Full) | 1277 | if (amd_xgbe_phy_use_xgmii_mode(phydev)) |
| 1239 | ret = amd_xgbe_phy_xgmii_mode(phydev); | 1278 | ret = amd_xgbe_phy_xgmii_mode(phydev); |
| 1240 | else if (phydev->advertising & SUPPORTED_1000baseKX_Full) | 1279 | else if (amd_xgbe_phy_use_gmii_mode(phydev)) |
| 1241 | ret = amd_xgbe_phy_gmii_mode(phydev); | 1280 | ret = amd_xgbe_phy_gmii_mode(phydev); |
| 1242 | else if (phydev->advertising & SUPPORTED_2500baseX_Full) | 1281 | else if (amd_xgbe_phy_use_gmii_2500_mode(phydev)) |
| 1243 | ret = amd_xgbe_phy_gmii_2500_mode(phydev); | 1282 | ret = amd_xgbe_phy_gmii_2500_mode(phydev); |
| 1244 | else | 1283 | else |
| 1245 | ret = -EINVAL; | 1284 | ret = -EINVAL; |
diff --git a/drivers/net/phy/bcm7xxx.c b/drivers/net/phy/bcm7xxx.c index 64c74c6a4828..b5dc59de094e 100644 --- a/drivers/net/phy/bcm7xxx.c +++ b/drivers/net/phy/bcm7xxx.c | |||
| @@ -404,7 +404,7 @@ static struct phy_driver bcm7xxx_driver[] = { | |||
| 404 | .name = "Broadcom BCM7425", | 404 | .name = "Broadcom BCM7425", |
| 405 | .features = PHY_GBIT_FEATURES | | 405 | .features = PHY_GBIT_FEATURES | |
| 406 | SUPPORTED_Pause | SUPPORTED_Asym_Pause, | 406 | SUPPORTED_Pause | SUPPORTED_Asym_Pause, |
| 407 | .flags = 0, | 407 | .flags = PHY_IS_INTERNAL, |
| 408 | .config_init = bcm7xxx_config_init, | 408 | .config_init = bcm7xxx_config_init, |
| 409 | .config_aneg = genphy_config_aneg, | 409 | .config_aneg = genphy_config_aneg, |
| 410 | .read_status = genphy_read_status, | 410 | .read_status = genphy_read_status, |
diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c index 496e02f961d3..00cb41e71312 100644 --- a/drivers/net/phy/dp83640.c +++ b/drivers/net/phy/dp83640.c | |||
| @@ -47,7 +47,7 @@ | |||
| 47 | #define PSF_TX 0x1000 | 47 | #define PSF_TX 0x1000 |
| 48 | #define EXT_EVENT 1 | 48 | #define EXT_EVENT 1 |
| 49 | #define CAL_EVENT 7 | 49 | #define CAL_EVENT 7 |
| 50 | #define CAL_TRIGGER 7 | 50 | #define CAL_TRIGGER 1 |
| 51 | #define DP83640_N_PINS 12 | 51 | #define DP83640_N_PINS 12 |
| 52 | 52 | ||
| 53 | #define MII_DP83640_MICR 0x11 | 53 | #define MII_DP83640_MICR 0x11 |
| @@ -496,7 +496,9 @@ static int ptp_dp83640_enable(struct ptp_clock_info *ptp, | |||
| 496 | else | 496 | else |
| 497 | evnt |= EVNT_RISE; | 497 | evnt |= EVNT_RISE; |
| 498 | } | 498 | } |
| 499 | mutex_lock(&clock->extreg_lock); | ||
| 499 | ext_write(0, phydev, PAGE5, PTP_EVNT, evnt); | 500 | ext_write(0, phydev, PAGE5, PTP_EVNT, evnt); |
| 501 | mutex_unlock(&clock->extreg_lock); | ||
| 500 | return 0; | 502 | return 0; |
| 501 | 503 | ||
| 502 | case PTP_CLK_REQ_PEROUT: | 504 | case PTP_CLK_REQ_PEROUT: |
| @@ -532,6 +534,8 @@ static u8 status_frame_src[6] = { 0x08, 0x00, 0x17, 0x0B, 0x6B, 0x0F }; | |||
| 532 | 534 | ||
| 533 | static void enable_status_frames(struct phy_device *phydev, bool on) | 535 | static void enable_status_frames(struct phy_device *phydev, bool on) |
| 534 | { | 536 | { |
| 537 | struct dp83640_private *dp83640 = phydev->priv; | ||
| 538 | struct dp83640_clock *clock = dp83640->clock; | ||
| 535 | u16 cfg0 = 0, ver; | 539 | u16 cfg0 = 0, ver; |
| 536 | 540 | ||
| 537 | if (on) | 541 | if (on) |
| @@ -539,9 +543,13 @@ static void enable_status_frames(struct phy_device *phydev, bool on) | |||
| 539 | 543 | ||
| 540 | ver = (PSF_PTPVER & VERSIONPTP_MASK) << VERSIONPTP_SHIFT; | 544 | ver = (PSF_PTPVER & VERSIONPTP_MASK) << VERSIONPTP_SHIFT; |
| 541 | 545 | ||
| 546 | mutex_lock(&clock->extreg_lock); | ||
| 547 | |||
| 542 | ext_write(0, phydev, PAGE5, PSF_CFG0, cfg0); | 548 | ext_write(0, phydev, PAGE5, PSF_CFG0, cfg0); |
| 543 | ext_write(0, phydev, PAGE6, PSF_CFG1, ver); | 549 | ext_write(0, phydev, PAGE6, PSF_CFG1, ver); |
| 544 | 550 | ||
| 551 | mutex_unlock(&clock->extreg_lock); | ||
| 552 | |||
| 545 | if (!phydev->attached_dev) { | 553 | if (!phydev->attached_dev) { |
| 546 | pr_warn("expected to find an attached netdevice\n"); | 554 | pr_warn("expected to find an attached netdevice\n"); |
| 547 | return; | 555 | return; |
| @@ -838,7 +846,7 @@ static void decode_rxts(struct dp83640_private *dp83640, | |||
| 838 | list_del_init(&rxts->list); | 846 | list_del_init(&rxts->list); |
| 839 | phy2rxts(phy_rxts, rxts); | 847 | phy2rxts(phy_rxts, rxts); |
| 840 | 848 | ||
| 841 | spin_lock_irqsave(&dp83640->rx_queue.lock, flags); | 849 | spin_lock(&dp83640->rx_queue.lock); |
| 842 | skb_queue_walk(&dp83640->rx_queue, skb) { | 850 | skb_queue_walk(&dp83640->rx_queue, skb) { |
| 843 | struct dp83640_skb_info *skb_info; | 851 | struct dp83640_skb_info *skb_info; |
| 844 | 852 | ||
| @@ -853,7 +861,7 @@ static void decode_rxts(struct dp83640_private *dp83640, | |||
| 853 | break; | 861 | break; |
| 854 | } | 862 | } |
| 855 | } | 863 | } |
| 856 | spin_unlock_irqrestore(&dp83640->rx_queue.lock, flags); | 864 | spin_unlock(&dp83640->rx_queue.lock); |
| 857 | 865 | ||
| 858 | if (!shhwtstamps) | 866 | if (!shhwtstamps) |
| 859 | list_add_tail(&rxts->list, &dp83640->rxts); | 867 | list_add_tail(&rxts->list, &dp83640->rxts); |
| @@ -1173,11 +1181,18 @@ static int dp83640_config_init(struct phy_device *phydev) | |||
| 1173 | 1181 | ||
| 1174 | if (clock->chosen && !list_empty(&clock->phylist)) | 1182 | if (clock->chosen && !list_empty(&clock->phylist)) |
| 1175 | recalibrate(clock); | 1183 | recalibrate(clock); |
| 1176 | else | 1184 | else { |
| 1185 | mutex_lock(&clock->extreg_lock); | ||
| 1177 | enable_broadcast(phydev, clock->page, 1); | 1186 | enable_broadcast(phydev, clock->page, 1); |
| 1187 | mutex_unlock(&clock->extreg_lock); | ||
| 1188 | } | ||
| 1178 | 1189 | ||
| 1179 | enable_status_frames(phydev, true); | 1190 | enable_status_frames(phydev, true); |
| 1191 | |||
| 1192 | mutex_lock(&clock->extreg_lock); | ||
| 1180 | ext_write(0, phydev, PAGE4, PTP_CTL, PTP_ENABLE); | 1193 | ext_write(0, phydev, PAGE4, PTP_CTL, PTP_ENABLE); |
| 1194 | mutex_unlock(&clock->extreg_lock); | ||
| 1195 | |||
| 1181 | return 0; | 1196 | return 0; |
| 1182 | } | 1197 | } |
| 1183 | 1198 | ||
diff --git a/drivers/net/wireless/iwlwifi/Kconfig b/drivers/net/wireless/iwlwifi/Kconfig index ab019b45551b..f89f446e5c8a 100644 --- a/drivers/net/wireless/iwlwifi/Kconfig +++ b/drivers/net/wireless/iwlwifi/Kconfig | |||
| @@ -21,6 +21,7 @@ config IWLWIFI | |||
| 21 | Intel 7260 Wi-Fi Adapter | 21 | Intel 7260 Wi-Fi Adapter |
| 22 | Intel 3160 Wi-Fi Adapter | 22 | Intel 3160 Wi-Fi Adapter |
| 23 | Intel 7265 Wi-Fi Adapter | 23 | Intel 7265 Wi-Fi Adapter |
| 24 | Intel 3165 Wi-Fi Adapter | ||
| 24 | 25 | ||
| 25 | 26 | ||
| 26 | This driver uses the kernel's mac80211 subsystem. | 27 | This driver uses the kernel's mac80211 subsystem. |
diff --git a/drivers/net/wireless/iwlwifi/iwl-7000.c b/drivers/net/wireless/iwlwifi/iwl-7000.c index 36e786f0387b..74ad278116be 100644 --- a/drivers/net/wireless/iwlwifi/iwl-7000.c +++ b/drivers/net/wireless/iwlwifi/iwl-7000.c | |||
| @@ -70,15 +70,14 @@ | |||
| 70 | 70 | ||
| 71 | /* Highest firmware API version supported */ | 71 | /* Highest firmware API version supported */ |
| 72 | #define IWL7260_UCODE_API_MAX 13 | 72 | #define IWL7260_UCODE_API_MAX 13 |
| 73 | #define IWL3160_UCODE_API_MAX 13 | ||
| 74 | 73 | ||
| 75 | /* Oldest version we won't warn about */ | 74 | /* Oldest version we won't warn about */ |
| 76 | #define IWL7260_UCODE_API_OK 12 | 75 | #define IWL7260_UCODE_API_OK 12 |
| 77 | #define IWL3160_UCODE_API_OK 12 | 76 | #define IWL3165_UCODE_API_OK 13 |
| 78 | 77 | ||
| 79 | /* Lowest firmware API version supported */ | 78 | /* Lowest firmware API version supported */ |
| 80 | #define IWL7260_UCODE_API_MIN 10 | 79 | #define IWL7260_UCODE_API_MIN 10 |
| 81 | #define IWL3160_UCODE_API_MIN 10 | 80 | #define IWL3165_UCODE_API_MIN 13 |
| 82 | 81 | ||
| 83 | /* NVM versions */ | 82 | /* NVM versions */ |
| 84 | #define IWL7260_NVM_VERSION 0x0a1d | 83 | #define IWL7260_NVM_VERSION 0x0a1d |
| @@ -104,9 +103,6 @@ | |||
| 104 | #define IWL3160_FW_PRE "iwlwifi-3160-" | 103 | #define IWL3160_FW_PRE "iwlwifi-3160-" |
| 105 | #define IWL3160_MODULE_FIRMWARE(api) IWL3160_FW_PRE __stringify(api) ".ucode" | 104 | #define IWL3160_MODULE_FIRMWARE(api) IWL3160_FW_PRE __stringify(api) ".ucode" |
| 106 | 105 | ||
| 107 | #define IWL3165_FW_PRE "iwlwifi-3165-" | ||
| 108 | #define IWL3165_MODULE_FIRMWARE(api) IWL3165_FW_PRE __stringify(api) ".ucode" | ||
| 109 | |||
| 110 | #define IWL7265_FW_PRE "iwlwifi-7265-" | 106 | #define IWL7265_FW_PRE "iwlwifi-7265-" |
| 111 | #define IWL7265_MODULE_FIRMWARE(api) IWL7265_FW_PRE __stringify(api) ".ucode" | 107 | #define IWL7265_MODULE_FIRMWARE(api) IWL7265_FW_PRE __stringify(api) ".ucode" |
| 112 | 108 | ||
| @@ -248,8 +244,13 @@ static const struct iwl_ht_params iwl7265_ht_params = { | |||
| 248 | 244 | ||
| 249 | const struct iwl_cfg iwl3165_2ac_cfg = { | 245 | const struct iwl_cfg iwl3165_2ac_cfg = { |
| 250 | .name = "Intel(R) Dual Band Wireless AC 3165", | 246 | .name = "Intel(R) Dual Band Wireless AC 3165", |
| 251 | .fw_name_pre = IWL3165_FW_PRE, | 247 | .fw_name_pre = IWL7265D_FW_PRE, |
| 252 | IWL_DEVICE_7000, | 248 | IWL_DEVICE_7000, |
| 249 | /* sparse doens't like the re-assignment but it is safe */ | ||
| 250 | #ifndef __CHECKER__ | ||
| 251 | .ucode_api_ok = IWL3165_UCODE_API_OK, | ||
| 252 | .ucode_api_min = IWL3165_UCODE_API_MIN, | ||
| 253 | #endif | ||
| 253 | .ht_params = &iwl7000_ht_params, | 254 | .ht_params = &iwl7000_ht_params, |
| 254 | .nvm_ver = IWL3165_NVM_VERSION, | 255 | .nvm_ver = IWL3165_NVM_VERSION, |
| 255 | .nvm_calib_ver = IWL3165_TX_POWER_VERSION, | 256 | .nvm_calib_ver = IWL3165_TX_POWER_VERSION, |
| @@ -325,6 +326,5 @@ const struct iwl_cfg iwl7265d_n_cfg = { | |||
| 325 | 326 | ||
| 326 | MODULE_FIRMWARE(IWL7260_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); | 327 | MODULE_FIRMWARE(IWL7260_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); |
| 327 | MODULE_FIRMWARE(IWL3160_MODULE_FIRMWARE(IWL3160_UCODE_API_OK)); | 328 | MODULE_FIRMWARE(IWL3160_MODULE_FIRMWARE(IWL3160_UCODE_API_OK)); |
| 328 | MODULE_FIRMWARE(IWL3165_MODULE_FIRMWARE(IWL3160_UCODE_API_OK)); | ||
| 329 | MODULE_FIRMWARE(IWL7265_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); | 329 | MODULE_FIRMWARE(IWL7265_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); |
| 330 | MODULE_FIRMWARE(IWL7265D_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); | 330 | MODULE_FIRMWARE(IWL7265D_MODULE_FIRMWARE(IWL7260_UCODE_API_OK)); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c b/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c index 41ff85de7334..21302b6f2bfd 100644 --- a/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c +++ b/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | * GPL LICENSE SUMMARY | 6 | * GPL LICENSE SUMMARY |
| 7 | * | 7 | * |
| 8 | * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved. | 8 | * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved. |
| 9 | * Copyright(c) 2015 Intel Mobile Communications GmbH | ||
| 9 | * | 10 | * |
| 10 | * This program is free software; you can redistribute it and/or modify | 11 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of version 2 of the GNU General Public License as | 12 | * it under the terms of version 2 of the GNU General Public License as |
| @@ -31,6 +32,7 @@ | |||
| 31 | * BSD LICENSE | 32 | * BSD LICENSE |
| 32 | * | 33 | * |
| 33 | * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved. | 34 | * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved. |
| 35 | * Copyright(c) 2015 Intel Mobile Communications GmbH | ||
| 34 | * All rights reserved. | 36 | * All rights reserved. |
| 35 | * | 37 | * |
| 36 | * Redistribution and use in source and binary forms, with or without | 38 | * Redistribution and use in source and binary forms, with or without |
| @@ -748,6 +750,9 @@ void iwl_init_ht_hw_capab(const struct iwl_cfg *cfg, | |||
| 748 | return; | 750 | return; |
| 749 | } | 751 | } |
| 750 | 752 | ||
| 753 | if (data->sku_cap_mimo_disabled) | ||
| 754 | rx_chains = 1; | ||
| 755 | |||
| 751 | ht_info->ht_supported = true; | 756 | ht_info->ht_supported = true; |
| 752 | ht_info->cap = IEEE80211_HT_CAP_DSSSCCK40; | 757 | ht_info->cap = IEEE80211_HT_CAP_DSSSCCK40; |
| 753 | 758 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.h b/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.h index 5234a0bf11e4..750c8c9ee70d 100644 --- a/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.h +++ b/drivers/net/wireless/iwlwifi/iwl-eeprom-parse.h | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | * GPL LICENSE SUMMARY | 6 | * GPL LICENSE SUMMARY |
| 7 | * | 7 | * |
| 8 | * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved. | 8 | * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved. |
| 9 | * Copyright(c) 2015 Intel Mobile Communications GmbH | ||
| 9 | * | 10 | * |
| 10 | * This program is free software; you can redistribute it and/or modify | 11 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of version 2 of the GNU General Public License as | 12 | * it under the terms of version 2 of the GNU General Public License as |
| @@ -31,6 +32,7 @@ | |||
| 31 | * BSD LICENSE | 32 | * BSD LICENSE |
| 32 | * | 33 | * |
| 33 | * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved. | 34 | * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved. |
| 35 | * Copyright(c) 2015 Intel Mobile Communications GmbH | ||
| 34 | * All rights reserved. | 36 | * All rights reserved. |
| 35 | * | 37 | * |
| 36 | * Redistribution and use in source and binary forms, with or without | 38 | * Redistribution and use in source and binary forms, with or without |
| @@ -84,6 +86,7 @@ struct iwl_nvm_data { | |||
| 84 | bool sku_cap_11ac_enable; | 86 | bool sku_cap_11ac_enable; |
| 85 | bool sku_cap_amt_enable; | 87 | bool sku_cap_amt_enable; |
| 86 | bool sku_cap_ipan_enable; | 88 | bool sku_cap_ipan_enable; |
| 89 | bool sku_cap_mimo_disabled; | ||
| 87 | 90 | ||
| 88 | u16 radio_cfg_type; | 91 | u16 radio_cfg_type; |
| 89 | u8 radio_cfg_step; | 92 | u8 radio_cfg_step; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c b/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c index 83903a5025c2..75e96db6626b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c +++ b/drivers/net/wireless/iwlwifi/iwl-nvm-parse.c | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | * GPL LICENSE SUMMARY | 6 | * GPL LICENSE SUMMARY |
| 7 | * | 7 | * |
| 8 | * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved. | 8 | * Copyright(c) 2008 - 2014 Intel Corporation. All rights reserved. |
| 9 | * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH | 9 | * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH |
| 10 | * | 10 | * |
| 11 | * This program is free software; you can redistribute it and/or modify | 11 | * This program is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of version 2 of the GNU General Public License as | 12 | * it under the terms of version 2 of the GNU General Public License as |
| @@ -32,7 +32,7 @@ | |||
| 32 | * BSD LICENSE | 32 | * BSD LICENSE |
| 33 | * | 33 | * |
| 34 | * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved. | 34 | * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved. |
| 35 | * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH | 35 | * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH |
| 36 | * All rights reserved. | 36 | * All rights reserved. |
| 37 | * | 37 | * |
| 38 | * Redistribution and use in source and binary forms, with or without | 38 | * Redistribution and use in source and binary forms, with or without |
| @@ -116,10 +116,11 @@ enum family_8000_nvm_offsets { | |||
| 116 | 116 | ||
| 117 | /* SKU Capabilities (actual values from NVM definition) */ | 117 | /* SKU Capabilities (actual values from NVM definition) */ |
| 118 | enum nvm_sku_bits { | 118 | enum nvm_sku_bits { |
| 119 | NVM_SKU_CAP_BAND_24GHZ = BIT(0), | 119 | NVM_SKU_CAP_BAND_24GHZ = BIT(0), |
| 120 | NVM_SKU_CAP_BAND_52GHZ = BIT(1), | 120 | NVM_SKU_CAP_BAND_52GHZ = BIT(1), |
| 121 | NVM_SKU_CAP_11N_ENABLE = BIT(2), | 121 | NVM_SKU_CAP_11N_ENABLE = BIT(2), |
| 122 | NVM_SKU_CAP_11AC_ENABLE = BIT(3), | 122 | NVM_SKU_CAP_11AC_ENABLE = BIT(3), |
| 123 | NVM_SKU_CAP_MIMO_DISABLE = BIT(5), | ||
| 123 | }; | 124 | }; |
| 124 | 125 | ||
| 125 | /* | 126 | /* |
| @@ -368,6 +369,11 @@ static void iwl_init_vht_hw_capab(const struct iwl_cfg *cfg, | |||
| 368 | if (cfg->ht_params->ldpc) | 369 | if (cfg->ht_params->ldpc) |
| 369 | vht_cap->cap |= IEEE80211_VHT_CAP_RXLDPC; | 370 | vht_cap->cap |= IEEE80211_VHT_CAP_RXLDPC; |
| 370 | 371 | ||
| 372 | if (data->sku_cap_mimo_disabled) { | ||
| 373 | num_rx_ants = 1; | ||
| 374 | num_tx_ants = 1; | ||
| 375 | } | ||
| 376 | |||
| 371 | if (num_tx_ants > 1) | 377 | if (num_tx_ants > 1) |
| 372 | vht_cap->cap |= IEEE80211_VHT_CAP_TXSTBC; | 378 | vht_cap->cap |= IEEE80211_VHT_CAP_TXSTBC; |
| 373 | else | 379 | else |
| @@ -527,6 +533,10 @@ static void iwl_set_hw_address_family_8000(struct device *dev, | |||
| 527 | const u8 *hw_addr; | 533 | const u8 *hw_addr; |
| 528 | 534 | ||
| 529 | if (mac_override) { | 535 | if (mac_override) { |
| 536 | static const u8 reserved_mac[] = { | ||
| 537 | 0x02, 0xcc, 0xaa, 0xff, 0xee, 0x00 | ||
| 538 | }; | ||
| 539 | |||
| 530 | hw_addr = (const u8 *)(mac_override + | 540 | hw_addr = (const u8 *)(mac_override + |
| 531 | MAC_ADDRESS_OVERRIDE_FAMILY_8000); | 541 | MAC_ADDRESS_OVERRIDE_FAMILY_8000); |
| 532 | 542 | ||
| @@ -538,7 +548,12 @@ static void iwl_set_hw_address_family_8000(struct device *dev, | |||
| 538 | data->hw_addr[4] = hw_addr[5]; | 548 | data->hw_addr[4] = hw_addr[5]; |
| 539 | data->hw_addr[5] = hw_addr[4]; | 549 | data->hw_addr[5] = hw_addr[4]; |
| 540 | 550 | ||
| 541 | if (is_valid_ether_addr(data->hw_addr)) | 551 | /* |
| 552 | * Force the use of the OTP MAC address in case of reserved MAC | ||
| 553 | * address in the NVM, or if address is given but invalid. | ||
| 554 | */ | ||
| 555 | if (is_valid_ether_addr(data->hw_addr) && | ||
| 556 | memcmp(reserved_mac, hw_addr, ETH_ALEN) != 0) | ||
| 542 | return; | 557 | return; |
| 543 | 558 | ||
| 544 | IWL_ERR_DEV(dev, | 559 | IWL_ERR_DEV(dev, |
| @@ -610,6 +625,7 @@ iwl_parse_nvm_data(struct device *dev, const struct iwl_cfg *cfg, | |||
| 610 | data->sku_cap_11n_enable = false; | 625 | data->sku_cap_11n_enable = false; |
| 611 | data->sku_cap_11ac_enable = data->sku_cap_11n_enable && | 626 | data->sku_cap_11ac_enable = data->sku_cap_11n_enable && |
| 612 | (sku & NVM_SKU_CAP_11AC_ENABLE); | 627 | (sku & NVM_SKU_CAP_11AC_ENABLE); |
| 628 | data->sku_cap_mimo_disabled = sku & NVM_SKU_CAP_MIMO_DISABLE; | ||
| 613 | 629 | ||
| 614 | data->n_hw_addrs = iwl_get_n_hw_addrs(cfg, nvm_sw); | 630 | data->n_hw_addrs = iwl_get_n_hw_addrs(cfg, nvm_sw); |
| 615 | 631 | ||
diff --git a/drivers/net/wireless/iwlwifi/mvm/coex_legacy.c b/drivers/net/wireless/iwlwifi/mvm/coex_legacy.c index d954591e0be5..6ac6de2af977 100644 --- a/drivers/net/wireless/iwlwifi/mvm/coex_legacy.c +++ b/drivers/net/wireless/iwlwifi/mvm/coex_legacy.c | |||
| @@ -776,7 +776,7 @@ static int iwl_mvm_bt_coex_reduced_txp(struct iwl_mvm *mvm, u8 sta_id, | |||
| 776 | struct iwl_host_cmd cmd = { | 776 | struct iwl_host_cmd cmd = { |
| 777 | .id = BT_CONFIG, | 777 | .id = BT_CONFIG, |
| 778 | .len = { sizeof(*bt_cmd), }, | 778 | .len = { sizeof(*bt_cmd), }, |
| 779 | .dataflags = { IWL_HCMD_DFL_NOCOPY, }, | 779 | .dataflags = { IWL_HCMD_DFL_DUP, }, |
| 780 | .flags = CMD_ASYNC, | 780 | .flags = CMD_ASYNC, |
| 781 | }; | 781 | }; |
| 782 | struct iwl_mvm_sta *mvmsta; | 782 | struct iwl_mvm_sta *mvmsta; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/d3.c b/drivers/net/wireless/iwlwifi/mvm/d3.c index 1b1b2bf26819..4310cf102d78 100644 --- a/drivers/net/wireless/iwlwifi/mvm/d3.c +++ b/drivers/net/wireless/iwlwifi/mvm/d3.c | |||
| @@ -1750,8 +1750,10 @@ static void iwl_mvm_query_netdetect_reasons(struct iwl_mvm *mvm, | |||
| 1750 | int i, j, n_matches, ret; | 1750 | int i, j, n_matches, ret; |
| 1751 | 1751 | ||
| 1752 | fw_status = iwl_mvm_get_wakeup_status(mvm, vif); | 1752 | fw_status = iwl_mvm_get_wakeup_status(mvm, vif); |
| 1753 | if (!IS_ERR_OR_NULL(fw_status)) | 1753 | if (!IS_ERR_OR_NULL(fw_status)) { |
| 1754 | reasons = le32_to_cpu(fw_status->wakeup_reasons); | 1754 | reasons = le32_to_cpu(fw_status->wakeup_reasons); |
| 1755 | kfree(fw_status); | ||
| 1756 | } | ||
| 1755 | 1757 | ||
| 1756 | if (reasons & IWL_WOWLAN_WAKEUP_BY_RFKILL_DEASSERTED) | 1758 | if (reasons & IWL_WOWLAN_WAKEUP_BY_RFKILL_DEASSERTED) |
| 1757 | wakeup.rfkill_release = true; | 1759 | wakeup.rfkill_release = true; |
| @@ -1868,15 +1870,15 @@ static int __iwl_mvm_resume(struct iwl_mvm *mvm, bool test) | |||
| 1868 | /* get the BSS vif pointer again */ | 1870 | /* get the BSS vif pointer again */ |
| 1869 | vif = iwl_mvm_get_bss_vif(mvm); | 1871 | vif = iwl_mvm_get_bss_vif(mvm); |
| 1870 | if (IS_ERR_OR_NULL(vif)) | 1872 | if (IS_ERR_OR_NULL(vif)) |
| 1871 | goto out_unlock; | 1873 | goto err; |
| 1872 | 1874 | ||
| 1873 | ret = iwl_trans_d3_resume(mvm->trans, &d3_status, test); | 1875 | ret = iwl_trans_d3_resume(mvm->trans, &d3_status, test); |
| 1874 | if (ret) | 1876 | if (ret) |
| 1875 | goto out_unlock; | 1877 | goto err; |
| 1876 | 1878 | ||
| 1877 | if (d3_status != IWL_D3_STATUS_ALIVE) { | 1879 | if (d3_status != IWL_D3_STATUS_ALIVE) { |
| 1878 | IWL_INFO(mvm, "Device was reset during suspend\n"); | 1880 | IWL_INFO(mvm, "Device was reset during suspend\n"); |
| 1879 | goto out_unlock; | 1881 | goto err; |
| 1880 | } | 1882 | } |
| 1881 | 1883 | ||
| 1882 | /* query SRAM first in case we want event logging */ | 1884 | /* query SRAM first in case we want event logging */ |
| @@ -1902,7 +1904,8 @@ static int __iwl_mvm_resume(struct iwl_mvm *mvm, bool test) | |||
| 1902 | goto out_iterate; | 1904 | goto out_iterate; |
| 1903 | } | 1905 | } |
| 1904 | 1906 | ||
| 1905 | out_unlock: | 1907 | err: |
| 1908 | iwl_mvm_free_nd(mvm); | ||
| 1906 | mutex_unlock(&mvm->mutex); | 1909 | mutex_unlock(&mvm->mutex); |
| 1907 | 1910 | ||
| 1908 | out_iterate: | 1911 | out_iterate: |
| @@ -1915,6 +1918,14 @@ out: | |||
| 1915 | /* return 1 to reconfigure the device */ | 1918 | /* return 1 to reconfigure the device */ |
| 1916 | set_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status); | 1919 | set_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status); |
| 1917 | set_bit(IWL_MVM_STATUS_D3_RECONFIG, &mvm->status); | 1920 | set_bit(IWL_MVM_STATUS_D3_RECONFIG, &mvm->status); |
| 1921 | |||
| 1922 | /* We always return 1, which causes mac80211 to do a reconfig | ||
| 1923 | * with IEEE80211_RECONFIG_TYPE_RESTART. This type of | ||
| 1924 | * reconfig calls iwl_mvm_restart_complete(), where we unref | ||
| 1925 | * the IWL_MVM_REF_UCODE_DOWN, so we need to take the | ||
| 1926 | * reference here. | ||
| 1927 | */ | ||
| 1928 | iwl_mvm_ref(mvm, IWL_MVM_REF_UCODE_DOWN); | ||
| 1918 | return 1; | 1929 | return 1; |
| 1919 | } | 1930 | } |
| 1920 | 1931 | ||
| @@ -2021,7 +2032,6 @@ static int iwl_mvm_d3_test_release(struct inode *inode, struct file *file) | |||
| 2021 | __iwl_mvm_resume(mvm, true); | 2032 | __iwl_mvm_resume(mvm, true); |
| 2022 | rtnl_unlock(); | 2033 | rtnl_unlock(); |
| 2023 | iwl_abort_notification_waits(&mvm->notif_wait); | 2034 | iwl_abort_notification_waits(&mvm->notif_wait); |
| 2024 | iwl_mvm_ref(mvm, IWL_MVM_REF_UCODE_DOWN); | ||
| 2025 | ieee80211_restart_hw(mvm->hw); | 2035 | ieee80211_restart_hw(mvm->hw); |
| 2026 | 2036 | ||
| 2027 | /* wait for restart and disconnect all interfaces */ | 2037 | /* wait for restart and disconnect all interfaces */ |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c index 40265b9c66ae..dda9f7b5f342 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c | |||
| @@ -3995,9 +3995,6 @@ static void iwl_mvm_mac_event_callback(struct ieee80211_hw *hw, | |||
| 3995 | if (!iwl_fw_dbg_trigger_enabled(mvm->fw, FW_DBG_TRIGGER_MLME)) | 3995 | if (!iwl_fw_dbg_trigger_enabled(mvm->fw, FW_DBG_TRIGGER_MLME)) |
| 3996 | return; | 3996 | return; |
| 3997 | 3997 | ||
| 3998 | if (event->u.mlme.status == MLME_SUCCESS) | ||
| 3999 | return; | ||
| 4000 | |||
| 4001 | trig = iwl_fw_dbg_get_trigger(mvm->fw, FW_DBG_TRIGGER_MLME); | 3998 | trig = iwl_fw_dbg_get_trigger(mvm->fw, FW_DBG_TRIGGER_MLME); |
| 4002 | trig_mlme = (void *)trig->data; | 3999 | trig_mlme = (void *)trig->data; |
| 4003 | if (!iwl_fw_dbg_trigger_check_stop(mvm, vif, trig)) | 4000 | if (!iwl_fw_dbg_trigger_check_stop(mvm, vif, trig)) |
diff --git a/drivers/net/wireless/iwlwifi/mvm/ops.c b/drivers/net/wireless/iwlwifi/mvm/ops.c index 1c66297d82c0..2ea01238754e 100644 --- a/drivers/net/wireless/iwlwifi/mvm/ops.c +++ b/drivers/net/wireless/iwlwifi/mvm/ops.c | |||
| @@ -1263,11 +1263,13 @@ static void iwl_mvm_d0i3_exit_work(struct work_struct *wk) | |||
| 1263 | ieee80211_iterate_active_interfaces( | 1263 | ieee80211_iterate_active_interfaces( |
| 1264 | mvm->hw, IEEE80211_IFACE_ITER_NORMAL, | 1264 | mvm->hw, IEEE80211_IFACE_ITER_NORMAL, |
| 1265 | iwl_mvm_d0i3_disconnect_iter, mvm); | 1265 | iwl_mvm_d0i3_disconnect_iter, mvm); |
| 1266 | |||
| 1267 | iwl_free_resp(&get_status_cmd); | ||
| 1268 | out: | 1266 | out: |
| 1269 | iwl_mvm_d0i3_enable_tx(mvm, qos_seq); | 1267 | iwl_mvm_d0i3_enable_tx(mvm, qos_seq); |
| 1270 | 1268 | ||
| 1269 | /* qos_seq might point inside resp_pkt, so free it only now */ | ||
| 1270 | if (get_status_cmd.resp_pkt) | ||
| 1271 | iwl_free_resp(&get_status_cmd); | ||
| 1272 | |||
| 1271 | /* the FW might have updated the regdomain */ | 1273 | /* the FW might have updated the regdomain */ |
| 1272 | iwl_mvm_update_changed_regdom(mvm); | 1274 | iwl_mvm_update_changed_regdom(mvm); |
| 1273 | 1275 | ||
diff --git a/drivers/net/wireless/iwlwifi/mvm/rs.c b/drivers/net/wireless/iwlwifi/mvm/rs.c index f9928f2c125f..33cd68ae7bf9 100644 --- a/drivers/net/wireless/iwlwifi/mvm/rs.c +++ b/drivers/net/wireless/iwlwifi/mvm/rs.c | |||
| @@ -180,6 +180,9 @@ static bool rs_mimo_allow(struct iwl_mvm *mvm, struct ieee80211_sta *sta, | |||
| 180 | if (iwl_mvm_vif_low_latency(mvmvif) && mvmsta->vif->p2p) | 180 | if (iwl_mvm_vif_low_latency(mvmvif) && mvmsta->vif->p2p) |
| 181 | return false; | 181 | return false; |
| 182 | 182 | ||
| 183 | if (mvm->nvm_data->sku_cap_mimo_disabled) | ||
| 184 | return false; | ||
| 185 | |||
| 183 | return true; | 186 | return true; |
| 184 | } | 187 | } |
| 185 | 188 | ||
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c index 47bbf573fdc8..d6f6515fe663 100644 --- a/drivers/net/wireless/iwlwifi/pcie/trans.c +++ b/drivers/net/wireless/iwlwifi/pcie/trans.c | |||
| @@ -1049,9 +1049,11 @@ static void iwl_trans_pcie_stop_device(struct iwl_trans *trans, bool low_power) | |||
| 1049 | iwl_pcie_rx_stop(trans); | 1049 | iwl_pcie_rx_stop(trans); |
| 1050 | 1050 | ||
| 1051 | /* Power-down device's busmaster DMA clocks */ | 1051 | /* Power-down device's busmaster DMA clocks */ |
| 1052 | iwl_write_prph(trans, APMG_CLK_DIS_REG, | 1052 | if (trans->cfg->device_family != IWL_DEVICE_FAMILY_8000) { |
| 1053 | APMG_CLK_VAL_DMA_CLK_RQT); | 1053 | iwl_write_prph(trans, APMG_CLK_DIS_REG, |
| 1054 | udelay(5); | 1054 | APMG_CLK_VAL_DMA_CLK_RQT); |
| 1055 | udelay(5); | ||
| 1056 | } | ||
| 1055 | } | 1057 | } |
| 1056 | 1058 | ||
| 1057 | /* Make sure (redundant) we've released our request to stay awake */ | 1059 | /* Make sure (redundant) we've released our request to stay awake */ |
diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c index 3d8dbf5f2d39..fee02414529e 100644 --- a/drivers/net/xen-netback/xenbus.c +++ b/drivers/net/xen-netback/xenbus.c | |||
| @@ -793,6 +793,7 @@ static void connect(struct backend_info *be) | |||
| 793 | goto err; | 793 | goto err; |
| 794 | } | 794 | } |
| 795 | 795 | ||
| 796 | queue->credit_bytes = credit_bytes; | ||
| 796 | queue->remaining_credit = credit_bytes; | 797 | queue->remaining_credit = credit_bytes; |
| 797 | queue->credit_usec = credit_usec; | 798 | queue->credit_usec = credit_usec; |
| 798 | 799 | ||
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index 3f45afd4382e..e031c943286e 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c | |||
| @@ -1698,6 +1698,7 @@ static void xennet_destroy_queues(struct netfront_info *info) | |||
| 1698 | 1698 | ||
| 1699 | if (netif_running(info->netdev)) | 1699 | if (netif_running(info->netdev)) |
| 1700 | napi_disable(&queue->napi); | 1700 | napi_disable(&queue->napi); |
| 1701 | del_timer_sync(&queue->rx_refill_timer); | ||
| 1701 | netif_napi_del(&queue->napi); | 1702 | netif_napi_del(&queue->napi); |
| 1702 | } | 1703 | } |
| 1703 | 1704 | ||
| @@ -2102,9 +2103,6 @@ static const struct attribute_group xennet_dev_group = { | |||
| 2102 | static int xennet_remove(struct xenbus_device *dev) | 2103 | static int xennet_remove(struct xenbus_device *dev) |
| 2103 | { | 2104 | { |
| 2104 | struct netfront_info *info = dev_get_drvdata(&dev->dev); | 2105 | struct netfront_info *info = dev_get_drvdata(&dev->dev); |
| 2105 | unsigned int num_queues = info->netdev->real_num_tx_queues; | ||
| 2106 | struct netfront_queue *queue = NULL; | ||
| 2107 | unsigned int i = 0; | ||
| 2108 | 2106 | ||
| 2109 | dev_dbg(&dev->dev, "%s\n", dev->nodename); | 2107 | dev_dbg(&dev->dev, "%s\n", dev->nodename); |
| 2110 | 2108 | ||
| @@ -2112,16 +2110,7 @@ static int xennet_remove(struct xenbus_device *dev) | |||
| 2112 | 2110 | ||
| 2113 | unregister_netdev(info->netdev); | 2111 | unregister_netdev(info->netdev); |
| 2114 | 2112 | ||
| 2115 | for (i = 0; i < num_queues; ++i) { | 2113 | xennet_destroy_queues(info); |
| 2116 | queue = &info->queues[i]; | ||
| 2117 | del_timer_sync(&queue->rx_refill_timer); | ||
| 2118 | } | ||
| 2119 | |||
| 2120 | if (num_queues) { | ||
| 2121 | kfree(info->queues); | ||
| 2122 | info->queues = NULL; | ||
| 2123 | } | ||
| 2124 | |||
| 2125 | xennet_free_netdev(info->netdev); | 2114 | xennet_free_netdev(info->netdev); |
| 2126 | 2115 | ||
| 2127 | return 0; | 2116 | return 0; |
diff --git a/drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c b/drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c index 4ad5c1a996e3..e406e3d8c1c7 100644 --- a/drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c +++ b/drivers/pinctrl/bcm/pinctrl-cygnus-gpio.c | |||
| @@ -643,7 +643,9 @@ static const struct cygnus_gpio_pin_range cygnus_gpio_pintable[] = { | |||
| 643 | CYGNUS_PINRANGE(87, 104, 12), | 643 | CYGNUS_PINRANGE(87, 104, 12), |
| 644 | CYGNUS_PINRANGE(99, 102, 2), | 644 | CYGNUS_PINRANGE(99, 102, 2), |
| 645 | CYGNUS_PINRANGE(101, 90, 4), | 645 | CYGNUS_PINRANGE(101, 90, 4), |
| 646 | CYGNUS_PINRANGE(105, 116, 10), | 646 | CYGNUS_PINRANGE(105, 116, 6), |
| 647 | CYGNUS_PINRANGE(111, 100, 2), | ||
| 648 | CYGNUS_PINRANGE(113, 122, 4), | ||
| 647 | CYGNUS_PINRANGE(123, 11, 1), | 649 | CYGNUS_PINRANGE(123, 11, 1), |
| 648 | CYGNUS_PINRANGE(124, 38, 4), | 650 | CYGNUS_PINRANGE(124, 38, 4), |
| 649 | CYGNUS_PINRANGE(128, 43, 1), | 651 | CYGNUS_PINRANGE(128, 43, 1), |
diff --git a/drivers/pinctrl/intel/pinctrl-cherryview.c b/drivers/pinctrl/intel/pinctrl-cherryview.c index 82f691eeeec4..732ff757a95f 100644 --- a/drivers/pinctrl/intel/pinctrl-cherryview.c +++ b/drivers/pinctrl/intel/pinctrl-cherryview.c | |||
| @@ -1292,6 +1292,49 @@ static void chv_gpio_irq_unmask(struct irq_data *d) | |||
| 1292 | chv_gpio_irq_mask_unmask(d, false); | 1292 | chv_gpio_irq_mask_unmask(d, false); |
| 1293 | } | 1293 | } |
| 1294 | 1294 | ||
| 1295 | static unsigned chv_gpio_irq_startup(struct irq_data *d) | ||
| 1296 | { | ||
| 1297 | /* | ||
| 1298 | * Check if the interrupt has been requested with 0 as triggering | ||
| 1299 | * type. In that case it is assumed that the current values | ||
| 1300 | * programmed to the hardware are used (e.g BIOS configured | ||
| 1301 | * defaults). | ||
| 1302 | * | ||
| 1303 | * In that case ->irq_set_type() will never be called so we need to | ||
| 1304 | * read back the values from hardware now, set correct flow handler | ||
| 1305 | * and update mappings before the interrupt is being used. | ||
| 1306 | */ | ||
| 1307 | if (irqd_get_trigger_type(d) == IRQ_TYPE_NONE) { | ||
| 1308 | struct gpio_chip *gc = irq_data_get_irq_chip_data(d); | ||
| 1309 | struct chv_pinctrl *pctrl = gpiochip_to_pinctrl(gc); | ||
| 1310 | unsigned offset = irqd_to_hwirq(d); | ||
| 1311 | int pin = chv_gpio_offset_to_pin(pctrl, offset); | ||
| 1312 | irq_flow_handler_t handler; | ||
| 1313 | unsigned long flags; | ||
| 1314 | u32 intsel, value; | ||
| 1315 | |||
| 1316 | intsel = readl(chv_padreg(pctrl, pin, CHV_PADCTRL0)); | ||
| 1317 | intsel &= CHV_PADCTRL0_INTSEL_MASK; | ||
| 1318 | intsel >>= CHV_PADCTRL0_INTSEL_SHIFT; | ||
| 1319 | |||
| 1320 | value = readl(chv_padreg(pctrl, pin, CHV_PADCTRL1)); | ||
| 1321 | if (value & CHV_PADCTRL1_INTWAKECFG_LEVEL) | ||
| 1322 | handler = handle_level_irq; | ||
| 1323 | else | ||
| 1324 | handler = handle_edge_irq; | ||
| 1325 | |||
| 1326 | spin_lock_irqsave(&pctrl->lock, flags); | ||
| 1327 | if (!pctrl->intr_lines[intsel]) { | ||
| 1328 | __irq_set_handler_locked(d->irq, handler); | ||
| 1329 | pctrl->intr_lines[intsel] = offset; | ||
| 1330 | } | ||
| 1331 | spin_unlock_irqrestore(&pctrl->lock, flags); | ||
| 1332 | } | ||
| 1333 | |||
| 1334 | chv_gpio_irq_unmask(d); | ||
| 1335 | return 0; | ||
| 1336 | } | ||
| 1337 | |||
| 1295 | static int chv_gpio_irq_type(struct irq_data *d, unsigned type) | 1338 | static int chv_gpio_irq_type(struct irq_data *d, unsigned type) |
| 1296 | { | 1339 | { |
| 1297 | struct gpio_chip *gc = irq_data_get_irq_chip_data(d); | 1340 | struct gpio_chip *gc = irq_data_get_irq_chip_data(d); |
| @@ -1357,6 +1400,7 @@ static int chv_gpio_irq_type(struct irq_data *d, unsigned type) | |||
| 1357 | 1400 | ||
| 1358 | static struct irq_chip chv_gpio_irqchip = { | 1401 | static struct irq_chip chv_gpio_irqchip = { |
| 1359 | .name = "chv-gpio", | 1402 | .name = "chv-gpio", |
| 1403 | .irq_startup = chv_gpio_irq_startup, | ||
| 1360 | .irq_ack = chv_gpio_irq_ack, | 1404 | .irq_ack = chv_gpio_irq_ack, |
| 1361 | .irq_mask = chv_gpio_irq_mask, | 1405 | .irq_mask = chv_gpio_irq_mask, |
| 1362 | .irq_unmask = chv_gpio_irq_unmask, | 1406 | .irq_unmask = chv_gpio_irq_unmask, |
diff --git a/drivers/pinctrl/meson/pinctrl-meson.c b/drivers/pinctrl/meson/pinctrl-meson.c index edcd140e0899..a70a5fe79d44 100644 --- a/drivers/pinctrl/meson/pinctrl-meson.c +++ b/drivers/pinctrl/meson/pinctrl-meson.c | |||
| @@ -569,7 +569,7 @@ static int meson_gpiolib_register(struct meson_pinctrl *pc) | |||
| 569 | domain->chip.direction_output = meson_gpio_direction_output; | 569 | domain->chip.direction_output = meson_gpio_direction_output; |
| 570 | domain->chip.get = meson_gpio_get; | 570 | domain->chip.get = meson_gpio_get; |
| 571 | domain->chip.set = meson_gpio_set; | 571 | domain->chip.set = meson_gpio_set; |
| 572 | domain->chip.base = -1; | 572 | domain->chip.base = domain->data->pin_base; |
| 573 | domain->chip.ngpio = domain->data->num_pins; | 573 | domain->chip.ngpio = domain->data->num_pins; |
| 574 | domain->chip.can_sleep = false; | 574 | domain->chip.can_sleep = false; |
| 575 | domain->chip.of_node = domain->of_node; | 575 | domain->chip.of_node = domain->of_node; |
diff --git a/drivers/pinctrl/meson/pinctrl-meson8b.c b/drivers/pinctrl/meson/pinctrl-meson8b.c index 2f7ea6229880..9677807db364 100644 --- a/drivers/pinctrl/meson/pinctrl-meson8b.c +++ b/drivers/pinctrl/meson/pinctrl-meson8b.c | |||
| @@ -876,13 +876,13 @@ static struct meson_domain_data meson8b_domain_data[] = { | |||
| 876 | .banks = meson8b_banks, | 876 | .banks = meson8b_banks, |
| 877 | .num_banks = ARRAY_SIZE(meson8b_banks), | 877 | .num_banks = ARRAY_SIZE(meson8b_banks), |
| 878 | .pin_base = 0, | 878 | .pin_base = 0, |
| 879 | .num_pins = 83, | 879 | .num_pins = 130, |
| 880 | }, | 880 | }, |
| 881 | { | 881 | { |
| 882 | .name = "ao-bank", | 882 | .name = "ao-bank", |
| 883 | .banks = meson8b_ao_banks, | 883 | .banks = meson8b_ao_banks, |
| 884 | .num_banks = ARRAY_SIZE(meson8b_ao_banks), | 884 | .num_banks = ARRAY_SIZE(meson8b_ao_banks), |
| 885 | .pin_base = 83, | 885 | .pin_base = 130, |
| 886 | .num_pins = 16, | 886 | .num_pins = 16, |
| 887 | }, | 887 | }, |
| 888 | }; | 888 | }; |
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index 9bb9ad6d4a1b..28f328136f0d 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c | |||
| @@ -2897,7 +2897,7 @@ static ssize_t hotkey_wakeup_reason_show(struct device *dev, | |||
| 2897 | return snprintf(buf, PAGE_SIZE, "%d\n", hotkey_wakeup_reason); | 2897 | return snprintf(buf, PAGE_SIZE, "%d\n", hotkey_wakeup_reason); |
| 2898 | } | 2898 | } |
| 2899 | 2899 | ||
| 2900 | static DEVICE_ATTR_RO(hotkey_wakeup_reason); | 2900 | static DEVICE_ATTR(wakeup_reason, S_IRUGO, hotkey_wakeup_reason_show, NULL); |
| 2901 | 2901 | ||
| 2902 | static void hotkey_wakeup_reason_notify_change(void) | 2902 | static void hotkey_wakeup_reason_notify_change(void) |
| 2903 | { | 2903 | { |
| @@ -2913,7 +2913,8 @@ static ssize_t hotkey_wakeup_hotunplug_complete_show(struct device *dev, | |||
| 2913 | return snprintf(buf, PAGE_SIZE, "%d\n", hotkey_autosleep_ack); | 2913 | return snprintf(buf, PAGE_SIZE, "%d\n", hotkey_autosleep_ack); |
| 2914 | } | 2914 | } |
| 2915 | 2915 | ||
| 2916 | static DEVICE_ATTR_RO(hotkey_wakeup_hotunplug_complete); | 2916 | static DEVICE_ATTR(wakeup_hotunplug_complete, S_IRUGO, |
| 2917 | hotkey_wakeup_hotunplug_complete_show, NULL); | ||
| 2917 | 2918 | ||
| 2918 | static void hotkey_wakeup_hotunplug_complete_notify_change(void) | 2919 | static void hotkey_wakeup_hotunplug_complete_notify_change(void) |
| 2919 | { | 2920 | { |
| @@ -2978,8 +2979,8 @@ static struct attribute *hotkey_attributes[] __initdata = { | |||
| 2978 | &dev_attr_hotkey_enable.attr, | 2979 | &dev_attr_hotkey_enable.attr, |
| 2979 | &dev_attr_hotkey_bios_enabled.attr, | 2980 | &dev_attr_hotkey_bios_enabled.attr, |
| 2980 | &dev_attr_hotkey_bios_mask.attr, | 2981 | &dev_attr_hotkey_bios_mask.attr, |
| 2981 | &dev_attr_hotkey_wakeup_reason.attr, | 2982 | &dev_attr_wakeup_reason.attr, |
| 2982 | &dev_attr_hotkey_wakeup_hotunplug_complete.attr, | 2983 | &dev_attr_wakeup_hotunplug_complete.attr, |
| 2983 | &dev_attr_hotkey_mask.attr, | 2984 | &dev_attr_hotkey_mask.attr, |
| 2984 | &dev_attr_hotkey_all_mask.attr, | 2985 | &dev_attr_hotkey_all_mask.attr, |
| 2985 | &dev_attr_hotkey_recommended_mask.attr, | 2986 | &dev_attr_hotkey_recommended_mask.attr, |
| @@ -4393,12 +4394,13 @@ static ssize_t wan_enable_store(struct device *dev, | |||
| 4393 | attr, buf, count); | 4394 | attr, buf, count); |
| 4394 | } | 4395 | } |
| 4395 | 4396 | ||
| 4396 | static DEVICE_ATTR_RW(wan_enable); | 4397 | static DEVICE_ATTR(wwan_enable, S_IWUSR | S_IRUGO, |
| 4398 | wan_enable_show, wan_enable_store); | ||
| 4397 | 4399 | ||
| 4398 | /* --------------------------------------------------------------------- */ | 4400 | /* --------------------------------------------------------------------- */ |
| 4399 | 4401 | ||
| 4400 | static struct attribute *wan_attributes[] = { | 4402 | static struct attribute *wan_attributes[] = { |
| 4401 | &dev_attr_wan_enable.attr, | 4403 | &dev_attr_wwan_enable.attr, |
| 4402 | NULL | 4404 | NULL |
| 4403 | }; | 4405 | }; |
| 4404 | 4406 | ||
| @@ -8138,7 +8140,8 @@ static ssize_t fan_pwm1_enable_store(struct device *dev, | |||
| 8138 | return count; | 8140 | return count; |
| 8139 | } | 8141 | } |
| 8140 | 8142 | ||
| 8141 | static DEVICE_ATTR_RW(fan_pwm1_enable); | 8143 | static DEVICE_ATTR(pwm1_enable, S_IWUSR | S_IRUGO, |
| 8144 | fan_pwm1_enable_show, fan_pwm1_enable_store); | ||
| 8142 | 8145 | ||
| 8143 | /* sysfs fan pwm1 ------------------------------------------------------ */ | 8146 | /* sysfs fan pwm1 ------------------------------------------------------ */ |
| 8144 | static ssize_t fan_pwm1_show(struct device *dev, | 8147 | static ssize_t fan_pwm1_show(struct device *dev, |
| @@ -8198,7 +8201,7 @@ static ssize_t fan_pwm1_store(struct device *dev, | |||
| 8198 | return (rc) ? rc : count; | 8201 | return (rc) ? rc : count; |
| 8199 | } | 8202 | } |
| 8200 | 8203 | ||
| 8201 | static DEVICE_ATTR_RW(fan_pwm1); | 8204 | static DEVICE_ATTR(pwm1, S_IWUSR | S_IRUGO, fan_pwm1_show, fan_pwm1_store); |
| 8202 | 8205 | ||
| 8203 | /* sysfs fan fan1_input ------------------------------------------------ */ | 8206 | /* sysfs fan fan1_input ------------------------------------------------ */ |
| 8204 | static ssize_t fan_fan1_input_show(struct device *dev, | 8207 | static ssize_t fan_fan1_input_show(struct device *dev, |
| @@ -8215,7 +8218,7 @@ static ssize_t fan_fan1_input_show(struct device *dev, | |||
| 8215 | return snprintf(buf, PAGE_SIZE, "%u\n", speed); | 8218 | return snprintf(buf, PAGE_SIZE, "%u\n", speed); |
| 8216 | } | 8219 | } |
| 8217 | 8220 | ||
| 8218 | static DEVICE_ATTR_RO(fan_fan1_input); | 8221 | static DEVICE_ATTR(fan1_input, S_IRUGO, fan_fan1_input_show, NULL); |
| 8219 | 8222 | ||
| 8220 | /* sysfs fan fan2_input ------------------------------------------------ */ | 8223 | /* sysfs fan fan2_input ------------------------------------------------ */ |
| 8221 | static ssize_t fan_fan2_input_show(struct device *dev, | 8224 | static ssize_t fan_fan2_input_show(struct device *dev, |
| @@ -8232,7 +8235,7 @@ static ssize_t fan_fan2_input_show(struct device *dev, | |||
| 8232 | return snprintf(buf, PAGE_SIZE, "%u\n", speed); | 8235 | return snprintf(buf, PAGE_SIZE, "%u\n", speed); |
| 8233 | } | 8236 | } |
| 8234 | 8237 | ||
| 8235 | static DEVICE_ATTR_RO(fan_fan2_input); | 8238 | static DEVICE_ATTR(fan2_input, S_IRUGO, fan_fan2_input_show, NULL); |
| 8236 | 8239 | ||
| 8237 | /* sysfs fan fan_watchdog (hwmon driver) ------------------------------- */ | 8240 | /* sysfs fan fan_watchdog (hwmon driver) ------------------------------- */ |
| 8238 | static ssize_t fan_fan_watchdog_show(struct device_driver *drv, | 8241 | static ssize_t fan_fan_watchdog_show(struct device_driver *drv, |
| @@ -8265,8 +8268,8 @@ static DRIVER_ATTR(fan_watchdog, S_IWUSR | S_IRUGO, | |||
| 8265 | 8268 | ||
| 8266 | /* --------------------------------------------------------------------- */ | 8269 | /* --------------------------------------------------------------------- */ |
| 8267 | static struct attribute *fan_attributes[] = { | 8270 | static struct attribute *fan_attributes[] = { |
| 8268 | &dev_attr_fan_pwm1_enable.attr, &dev_attr_fan_pwm1.attr, | 8271 | &dev_attr_pwm1_enable.attr, &dev_attr_pwm1.attr, |
| 8269 | &dev_attr_fan_fan1_input.attr, | 8272 | &dev_attr_fan1_input.attr, |
| 8270 | NULL, /* for fan2_input */ | 8273 | NULL, /* for fan2_input */ |
| 8271 | NULL | 8274 | NULL |
| 8272 | }; | 8275 | }; |
| @@ -8400,7 +8403,7 @@ static int __init fan_init(struct ibm_init_struct *iibm) | |||
| 8400 | if (tp_features.second_fan) { | 8403 | if (tp_features.second_fan) { |
| 8401 | /* attach second fan tachometer */ | 8404 | /* attach second fan tachometer */ |
| 8402 | fan_attributes[ARRAY_SIZE(fan_attributes)-2] = | 8405 | fan_attributes[ARRAY_SIZE(fan_attributes)-2] = |
| 8403 | &dev_attr_fan_fan2_input.attr; | 8406 | &dev_attr_fan2_input.attr; |
| 8404 | } | 8407 | } |
| 8405 | rc = sysfs_create_group(&tpacpi_sensors_pdev->dev.kobj, | 8408 | rc = sysfs_create_group(&tpacpi_sensors_pdev->dev.kobj, |
| 8406 | &fan_attr_group); | 8409 | &fan_attr_group); |
| @@ -8848,7 +8851,7 @@ static ssize_t thinkpad_acpi_pdev_name_show(struct device *dev, | |||
| 8848 | return snprintf(buf, PAGE_SIZE, "%s\n", TPACPI_NAME); | 8851 | return snprintf(buf, PAGE_SIZE, "%s\n", TPACPI_NAME); |
| 8849 | } | 8852 | } |
| 8850 | 8853 | ||
| 8851 | static DEVICE_ATTR_RO(thinkpad_acpi_pdev_name); | 8854 | static DEVICE_ATTR(name, S_IRUGO, thinkpad_acpi_pdev_name_show, NULL); |
| 8852 | 8855 | ||
| 8853 | /* --------------------------------------------------------------------- */ | 8856 | /* --------------------------------------------------------------------- */ |
| 8854 | 8857 | ||
| @@ -9390,8 +9393,7 @@ static void thinkpad_acpi_module_exit(void) | |||
| 9390 | hwmon_device_unregister(tpacpi_hwmon); | 9393 | hwmon_device_unregister(tpacpi_hwmon); |
| 9391 | 9394 | ||
| 9392 | if (tp_features.sensors_pdev_attrs_registered) | 9395 | if (tp_features.sensors_pdev_attrs_registered) |
| 9393 | device_remove_file(&tpacpi_sensors_pdev->dev, | 9396 | device_remove_file(&tpacpi_sensors_pdev->dev, &dev_attr_name); |
| 9394 | &dev_attr_thinkpad_acpi_pdev_name); | ||
| 9395 | if (tpacpi_sensors_pdev) | 9397 | if (tpacpi_sensors_pdev) |
| 9396 | platform_device_unregister(tpacpi_sensors_pdev); | 9398 | platform_device_unregister(tpacpi_sensors_pdev); |
| 9397 | if (tpacpi_pdev) | 9399 | if (tpacpi_pdev) |
| @@ -9512,8 +9514,7 @@ static int __init thinkpad_acpi_module_init(void) | |||
| 9512 | thinkpad_acpi_module_exit(); | 9514 | thinkpad_acpi_module_exit(); |
| 9513 | return ret; | 9515 | return ret; |
| 9514 | } | 9516 | } |
| 9515 | ret = device_create_file(&tpacpi_sensors_pdev->dev, | 9517 | ret = device_create_file(&tpacpi_sensors_pdev->dev, &dev_attr_name); |
| 9516 | &dev_attr_thinkpad_acpi_pdev_name); | ||
| 9517 | if (ret) { | 9518 | if (ret) { |
| 9518 | pr_err("unable to create sysfs hwmon device attributes\n"); | 9519 | pr_err("unable to create sysfs hwmon device attributes\n"); |
| 9519 | thinkpad_acpi_module_exit(); | 9520 | thinkpad_acpi_module_exit(); |
diff --git a/drivers/regulator/da9052-regulator.c b/drivers/regulator/da9052-regulator.c index 8a4df7a1f2ee..e628d4c2f2ae 100644 --- a/drivers/regulator/da9052-regulator.c +++ b/drivers/regulator/da9052-regulator.c | |||
| @@ -394,6 +394,7 @@ static inline struct da9052_regulator_info *find_regulator_info(u8 chip_id, | |||
| 394 | 394 | ||
| 395 | static int da9052_regulator_probe(struct platform_device *pdev) | 395 | static int da9052_regulator_probe(struct platform_device *pdev) |
| 396 | { | 396 | { |
| 397 | const struct mfd_cell *cell = mfd_get_cell(pdev); | ||
| 397 | struct regulator_config config = { }; | 398 | struct regulator_config config = { }; |
| 398 | struct da9052_regulator *regulator; | 399 | struct da9052_regulator *regulator; |
| 399 | struct da9052 *da9052; | 400 | struct da9052 *da9052; |
| @@ -409,7 +410,7 @@ static int da9052_regulator_probe(struct platform_device *pdev) | |||
| 409 | regulator->da9052 = da9052; | 410 | regulator->da9052 = da9052; |
| 410 | 411 | ||
| 411 | regulator->info = find_regulator_info(regulator->da9052->chip_id, | 412 | regulator->info = find_regulator_info(regulator->da9052->chip_id, |
| 412 | pdev->id); | 413 | cell->id); |
| 413 | if (regulator->info == NULL) { | 414 | if (regulator->info == NULL) { |
| 414 | dev_err(&pdev->dev, "invalid regulator ID specified\n"); | 415 | dev_err(&pdev->dev, "invalid regulator ID specified\n"); |
| 415 | return -EINVAL; | 416 | return -EINVAL; |
| @@ -419,7 +420,7 @@ static int da9052_regulator_probe(struct platform_device *pdev) | |||
| 419 | config.driver_data = regulator; | 420 | config.driver_data = regulator; |
| 420 | config.regmap = da9052->regmap; | 421 | config.regmap = da9052->regmap; |
| 421 | if (pdata && pdata->regulators) { | 422 | if (pdata && pdata->regulators) { |
| 422 | config.init_data = pdata->regulators[pdev->id]; | 423 | config.init_data = pdata->regulators[cell->id]; |
| 423 | } else { | 424 | } else { |
| 424 | #ifdef CONFIG_OF | 425 | #ifdef CONFIG_OF |
| 425 | struct device_node *nproot = da9052->dev->of_node; | 426 | struct device_node *nproot = da9052->dev->of_node; |
diff --git a/drivers/ssb/driver_pcicore.c b/drivers/ssb/driver_pcicore.c index 15a7ee3859dd..5fe1c22e289b 100644 --- a/drivers/ssb/driver_pcicore.c +++ b/drivers/ssb/driver_pcicore.c | |||
| @@ -359,12 +359,13 @@ static void ssb_pcicore_init_hostmode(struct ssb_pcicore *pc) | |||
| 359 | 359 | ||
| 360 | /* | 360 | /* |
| 361 | * Accessing PCI config without a proper delay after devices reset (not | 361 | * Accessing PCI config without a proper delay after devices reset (not |
| 362 | * GPIO reset) was causing reboots on WRT300N v1.0. | 362 | * GPIO reset) was causing reboots on WRT300N v1.0 (BCM4704). |
| 363 | * Tested delay 850 us lowered reboot chance to 50-80%, 1000 us fixed it | 363 | * Tested delay 850 us lowered reboot chance to 50-80%, 1000 us fixed it |
| 364 | * completely. Flushing all writes was also tested but with no luck. | 364 | * completely. Flushing all writes was also tested but with no luck. |
| 365 | * The same problem was reported for WRT350N v1 (BCM4705), so we just | ||
| 366 | * sleep here unconditionally. | ||
| 365 | */ | 367 | */ |
| 366 | if (pc->dev->bus->chip_id == 0x4704) | 368 | usleep_range(1000, 2000); |
| 367 | usleep_range(1000, 2000); | ||
| 368 | 369 | ||
| 369 | /* Enable PCI bridge BAR0 prefetch and burst */ | 370 | /* Enable PCI bridge BAR0 prefetch and burst */ |
| 370 | val = PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY; | 371 | val = PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY; |
diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index 3a145a643e0d..6897f1c1bc73 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c | |||
| @@ -274,6 +274,10 @@ static int pwm_backlight_probe(struct platform_device *pdev) | |||
| 274 | 274 | ||
| 275 | pb->pwm = devm_pwm_get(&pdev->dev, NULL); | 275 | pb->pwm = devm_pwm_get(&pdev->dev, NULL); |
| 276 | if (IS_ERR(pb->pwm)) { | 276 | if (IS_ERR(pb->pwm)) { |
| 277 | ret = PTR_ERR(pb->pwm); | ||
| 278 | if (ret == -EPROBE_DEFER) | ||
| 279 | goto err_alloc; | ||
| 280 | |||
| 277 | dev_err(&pdev->dev, "unable to request PWM, trying legacy API\n"); | 281 | dev_err(&pdev->dev, "unable to request PWM, trying legacy API\n"); |
| 278 | pb->legacy = true; | 282 | pb->legacy = true; |
| 279 | pb->pwm = pwm_request(data->pwm_id, "pwm-backlight"); | 283 | pb->pwm = pwm_request(data->pwm_id, "pwm-backlight"); |
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 241ef68d2893..cd46e4158830 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
| @@ -918,7 +918,7 @@ static int load_elf_binary(struct linux_binprm *bprm) | |||
| 918 | total_size = total_mapping_size(elf_phdata, | 918 | total_size = total_mapping_size(elf_phdata, |
| 919 | loc->elf_ex.e_phnum); | 919 | loc->elf_ex.e_phnum); |
| 920 | if (!total_size) { | 920 | if (!total_size) { |
| 921 | error = -EINVAL; | 921 | retval = -EINVAL; |
| 922 | goto out_free_dentry; | 922 | goto out_free_dentry; |
| 923 | } | 923 | } |
| 924 | } | 924 | } |
diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c index 430e0348c99e..7dc886c9a78f 100644 --- a/fs/cifs/cifs_dfs_ref.c +++ b/fs/cifs/cifs_dfs_ref.c | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | #include "cifsfs.h" | 24 | #include "cifsfs.h" |
| 25 | #include "dns_resolve.h" | 25 | #include "dns_resolve.h" |
| 26 | #include "cifs_debug.h" | 26 | #include "cifs_debug.h" |
| 27 | #include "cifs_unicode.h" | ||
| 27 | 28 | ||
| 28 | static LIST_HEAD(cifs_dfs_automount_list); | 29 | static LIST_HEAD(cifs_dfs_automount_list); |
| 29 | 30 | ||
| @@ -312,7 +313,7 @@ static struct vfsmount *cifs_dfs_do_automount(struct dentry *mntpt) | |||
| 312 | xid = get_xid(); | 313 | xid = get_xid(); |
| 313 | rc = get_dfs_path(xid, ses, full_path + 1, cifs_sb->local_nls, | 314 | rc = get_dfs_path(xid, ses, full_path + 1, cifs_sb->local_nls, |
| 314 | &num_referrals, &referrals, | 315 | &num_referrals, &referrals, |
| 315 | cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); | 316 | cifs_remap(cifs_sb)); |
| 316 | free_xid(xid); | 317 | free_xid(xid); |
| 317 | 318 | ||
| 318 | cifs_put_tlink(tlink); | 319 | cifs_put_tlink(tlink); |
diff --git a/fs/cifs/cifs_unicode.c b/fs/cifs/cifs_unicode.c index 0303c6793d90..5a53ac6b1e02 100644 --- a/fs/cifs/cifs_unicode.c +++ b/fs/cifs/cifs_unicode.c | |||
| @@ -27,41 +27,6 @@ | |||
| 27 | #include "cifsglob.h" | 27 | #include "cifsglob.h" |
| 28 | #include "cifs_debug.h" | 28 | #include "cifs_debug.h" |
| 29 | 29 | ||
| 30 | /* | ||
| 31 | * cifs_utf16_bytes - how long will a string be after conversion? | ||
| 32 | * @utf16 - pointer to input string | ||
| 33 | * @maxbytes - don't go past this many bytes of input string | ||
| 34 | * @codepage - destination codepage | ||
| 35 | * | ||
| 36 | * Walk a utf16le string and return the number of bytes that the string will | ||
| 37 | * be after being converted to the given charset, not including any null | ||
| 38 | * termination required. Don't walk past maxbytes in the source buffer. | ||
| 39 | */ | ||
| 40 | int | ||
| 41 | cifs_utf16_bytes(const __le16 *from, int maxbytes, | ||
| 42 | const struct nls_table *codepage) | ||
| 43 | { | ||
| 44 | int i; | ||
| 45 | int charlen, outlen = 0; | ||
| 46 | int maxwords = maxbytes / 2; | ||
| 47 | char tmp[NLS_MAX_CHARSET_SIZE]; | ||
| 48 | __u16 ftmp; | ||
| 49 | |||
| 50 | for (i = 0; i < maxwords; i++) { | ||
| 51 | ftmp = get_unaligned_le16(&from[i]); | ||
| 52 | if (ftmp == 0) | ||
| 53 | break; | ||
| 54 | |||
| 55 | charlen = codepage->uni2char(ftmp, tmp, NLS_MAX_CHARSET_SIZE); | ||
| 56 | if (charlen > 0) | ||
| 57 | outlen += charlen; | ||
| 58 | else | ||
| 59 | outlen++; | ||
| 60 | } | ||
| 61 | |||
| 62 | return outlen; | ||
| 63 | } | ||
| 64 | |||
| 65 | int cifs_remap(struct cifs_sb_info *cifs_sb) | 30 | int cifs_remap(struct cifs_sb_info *cifs_sb) |
| 66 | { | 31 | { |
| 67 | int map_type; | 32 | int map_type; |
| @@ -155,10 +120,13 @@ convert_sfm_char(const __u16 src_char, char *target) | |||
| 155 | * enough to hold the result of the conversion (at least NLS_MAX_CHARSET_SIZE). | 120 | * enough to hold the result of the conversion (at least NLS_MAX_CHARSET_SIZE). |
| 156 | */ | 121 | */ |
| 157 | static int | 122 | static int |
| 158 | cifs_mapchar(char *target, const __u16 src_char, const struct nls_table *cp, | 123 | cifs_mapchar(char *target, const __u16 *from, const struct nls_table *cp, |
| 159 | int maptype) | 124 | int maptype) |
| 160 | { | 125 | { |
| 161 | int len = 1; | 126 | int len = 1; |
| 127 | __u16 src_char; | ||
| 128 | |||
| 129 | src_char = *from; | ||
| 162 | 130 | ||
| 163 | if ((maptype == SFM_MAP_UNI_RSVD) && convert_sfm_char(src_char, target)) | 131 | if ((maptype == SFM_MAP_UNI_RSVD) && convert_sfm_char(src_char, target)) |
| 164 | return len; | 132 | return len; |
| @@ -168,10 +136,23 @@ cifs_mapchar(char *target, const __u16 src_char, const struct nls_table *cp, | |||
| 168 | 136 | ||
| 169 | /* if character not one of seven in special remap set */ | 137 | /* if character not one of seven in special remap set */ |
| 170 | len = cp->uni2char(src_char, target, NLS_MAX_CHARSET_SIZE); | 138 | len = cp->uni2char(src_char, target, NLS_MAX_CHARSET_SIZE); |
| 171 | if (len <= 0) { | 139 | if (len <= 0) |
| 172 | *target = '?'; | 140 | goto surrogate_pair; |
| 173 | len = 1; | 141 | |
| 174 | } | 142 | return len; |
| 143 | |||
| 144 | surrogate_pair: | ||
| 145 | /* convert SURROGATE_PAIR and IVS */ | ||
| 146 | if (strcmp(cp->charset, "utf8")) | ||
| 147 | goto unknown; | ||
| 148 | len = utf16s_to_utf8s(from, 3, UTF16_LITTLE_ENDIAN, target, 6); | ||
| 149 | if (len <= 0) | ||
| 150 | goto unknown; | ||
| 151 | return len; | ||
| 152 | |||
| 153 | unknown: | ||
| 154 | *target = '?'; | ||
| 155 | len = 1; | ||
| 175 | return len; | 156 | return len; |
| 176 | } | 157 | } |
| 177 | 158 | ||
| @@ -206,7 +187,7 @@ cifs_from_utf16(char *to, const __le16 *from, int tolen, int fromlen, | |||
| 206 | int nullsize = nls_nullsize(codepage); | 187 | int nullsize = nls_nullsize(codepage); |
| 207 | int fromwords = fromlen / 2; | 188 | int fromwords = fromlen / 2; |
| 208 | char tmp[NLS_MAX_CHARSET_SIZE]; | 189 | char tmp[NLS_MAX_CHARSET_SIZE]; |
| 209 | __u16 ftmp; | 190 | __u16 ftmp[3]; /* ftmp[3] = 3array x 2bytes = 6bytes UTF-16 */ |
| 210 | 191 | ||
| 211 | /* | 192 | /* |
| 212 | * because the chars can be of varying widths, we need to take care | 193 | * because the chars can be of varying widths, we need to take care |
| @@ -217,9 +198,17 @@ cifs_from_utf16(char *to, const __le16 *from, int tolen, int fromlen, | |||
| 217 | safelen = tolen - (NLS_MAX_CHARSET_SIZE + nullsize); | 198 | safelen = tolen - (NLS_MAX_CHARSET_SIZE + nullsize); |
| 218 | 199 | ||
| 219 | for (i = 0; i < fromwords; i++) { | 200 | for (i = 0; i < fromwords; i++) { |
| 220 | ftmp = get_unaligned_le16(&from[i]); | 201 | ftmp[0] = get_unaligned_le16(&from[i]); |
| 221 | if (ftmp == 0) | 202 | if (ftmp[0] == 0) |
| 222 | break; | 203 | break; |
| 204 | if (i + 1 < fromwords) | ||
| 205 | ftmp[1] = get_unaligned_le16(&from[i + 1]); | ||
| 206 | else | ||
| 207 | ftmp[1] = 0; | ||
| 208 | if (i + 2 < fromwords) | ||
| 209 | ftmp[2] = get_unaligned_le16(&from[i + 2]); | ||
| 210 | else | ||
| 211 | ftmp[2] = 0; | ||
| 223 | 212 | ||
| 224 | /* | 213 | /* |
| 225 | * check to see if converting this character might make the | 214 | * check to see if converting this character might make the |
| @@ -234,6 +223,17 @@ cifs_from_utf16(char *to, const __le16 *from, int tolen, int fromlen, | |||
| 234 | /* put converted char into 'to' buffer */ | 223 | /* put converted char into 'to' buffer */ |
| 235 | charlen = cifs_mapchar(&to[outlen], ftmp, codepage, map_type); | 224 | charlen = cifs_mapchar(&to[outlen], ftmp, codepage, map_type); |
| 236 | outlen += charlen; | 225 | outlen += charlen; |
| 226 | |||
| 227 | /* charlen (=bytes of UTF-8 for 1 character) | ||
| 228 | * 4bytes UTF-8(surrogate pair) is charlen=4 | ||
| 229 | * (4bytes UTF-16 code) | ||
| 230 | * 7-8bytes UTF-8(IVS) is charlen=3+4 or 4+4 | ||
| 231 | * (2 UTF-8 pairs divided to 2 UTF-16 pairs) */ | ||
| 232 | if (charlen == 4) | ||
| 233 | i++; | ||
| 234 | else if (charlen >= 5) | ||
| 235 | /* 5-6bytes UTF-8 */ | ||
| 236 | i += 2; | ||
| 237 | } | 237 | } |
| 238 | 238 | ||
| 239 | /* properly null-terminate string */ | 239 | /* properly null-terminate string */ |
| @@ -296,6 +296,46 @@ success: | |||
| 296 | } | 296 | } |
| 297 | 297 | ||
| 298 | /* | 298 | /* |
| 299 | * cifs_utf16_bytes - how long will a string be after conversion? | ||
| 300 | * @utf16 - pointer to input string | ||
| 301 | * @maxbytes - don't go past this many bytes of input string | ||
| 302 | * @codepage - destination codepage | ||
| 303 | * | ||
| 304 | * Walk a utf16le string and return the number of bytes that the string will | ||
| 305 | * be after being converted to the given charset, not including any null | ||
| 306 | * termination required. Don't walk past maxbytes in the source buffer. | ||
| 307 | */ | ||
| 308 | int | ||
| 309 | cifs_utf16_bytes(const __le16 *from, int maxbytes, | ||
| 310 | const struct nls_table *codepage) | ||
| 311 | { | ||
| 312 | int i; | ||
| 313 | int charlen, outlen = 0; | ||
| 314 | int maxwords = maxbytes / 2; | ||
| 315 | char tmp[NLS_MAX_CHARSET_SIZE]; | ||
| 316 | __u16 ftmp[3]; | ||
| 317 | |||
| 318 | for (i = 0; i < maxwords; i++) { | ||
| 319 | ftmp[0] = get_unaligned_le16(&from[i]); | ||
| 320 | if (ftmp[0] == 0) | ||
| 321 | break; | ||
| 322 | if (i + 1 < maxwords) | ||
| 323 | ftmp[1] = get_unaligned_le16(&from[i + 1]); | ||
| 324 | else | ||
| 325 | ftmp[1] = 0; | ||
| 326 | if (i + 2 < maxwords) | ||
| 327 | ftmp[2] = get_unaligned_le16(&from[i + 2]); | ||
| 328 | else | ||
| 329 | ftmp[2] = 0; | ||
| 330 | |||
| 331 | charlen = cifs_mapchar(tmp, ftmp, codepage, NO_MAP_UNI_RSVD); | ||
| 332 | outlen += charlen; | ||
| 333 | } | ||
| 334 | |||
| 335 | return outlen; | ||
| 336 | } | ||
| 337 | |||
| 338 | /* | ||
| 299 | * cifs_strndup_from_utf16 - copy a string from wire format to the local | 339 | * cifs_strndup_from_utf16 - copy a string from wire format to the local |
| 300 | * codepage | 340 | * codepage |
| 301 | * @src - source string | 341 | * @src - source string |
| @@ -409,10 +449,15 @@ cifsConvertToUTF16(__le16 *target, const char *source, int srclen, | |||
| 409 | char src_char; | 449 | char src_char; |
| 410 | __le16 dst_char; | 450 | __le16 dst_char; |
| 411 | wchar_t tmp; | 451 | wchar_t tmp; |
| 452 | wchar_t *wchar_to; /* UTF-16 */ | ||
| 453 | int ret; | ||
| 454 | unicode_t u; | ||
| 412 | 455 | ||
| 413 | if (map_chars == NO_MAP_UNI_RSVD) | 456 | if (map_chars == NO_MAP_UNI_RSVD) |
| 414 | return cifs_strtoUTF16(target, source, PATH_MAX, cp); | 457 | return cifs_strtoUTF16(target, source, PATH_MAX, cp); |
| 415 | 458 | ||
| 459 | wchar_to = kzalloc(6, GFP_KERNEL); | ||
| 460 | |||
| 416 | for (i = 0; i < srclen; j++) { | 461 | for (i = 0; i < srclen; j++) { |
| 417 | src_char = source[i]; | 462 | src_char = source[i]; |
| 418 | charlen = 1; | 463 | charlen = 1; |
| @@ -441,11 +486,55 @@ cifsConvertToUTF16(__le16 *target, const char *source, int srclen, | |||
| 441 | * if no match, use question mark, which at least in | 486 | * if no match, use question mark, which at least in |
| 442 | * some cases serves as wild card | 487 | * some cases serves as wild card |
| 443 | */ | 488 | */ |
| 444 | if (charlen < 1) { | 489 | if (charlen > 0) |
| 445 | dst_char = cpu_to_le16(0x003f); | 490 | goto ctoUTF16; |
| 446 | charlen = 1; | 491 | |
| 492 | /* convert SURROGATE_PAIR */ | ||
| 493 | if (strcmp(cp->charset, "utf8") || !wchar_to) | ||
| 494 | goto unknown; | ||
| 495 | if (*(source + i) & 0x80) { | ||
| 496 | charlen = utf8_to_utf32(source + i, 6, &u); | ||
| 497 | if (charlen < 0) | ||
| 498 | goto unknown; | ||
| 499 | } else | ||
| 500 | goto unknown; | ||
| 501 | ret = utf8s_to_utf16s(source + i, charlen, | ||
| 502 | UTF16_LITTLE_ENDIAN, | ||
| 503 | wchar_to, 6); | ||
| 504 | if (ret < 0) | ||
| 505 | goto unknown; | ||
| 506 | |||
| 507 | i += charlen; | ||
| 508 | dst_char = cpu_to_le16(*wchar_to); | ||
| 509 | if (charlen <= 3) | ||
| 510 | /* 1-3bytes UTF-8 to 2bytes UTF-16 */ | ||
| 511 | put_unaligned(dst_char, &target[j]); | ||
| 512 | else if (charlen == 4) { | ||
| 513 | /* 4bytes UTF-8(surrogate pair) to 4bytes UTF-16 | ||
| 514 | * 7-8bytes UTF-8(IVS) divided to 2 UTF-16 | ||
| 515 | * (charlen=3+4 or 4+4) */ | ||
| 516 | put_unaligned(dst_char, &target[j]); | ||
| 517 | dst_char = cpu_to_le16(*(wchar_to + 1)); | ||
| 518 | j++; | ||
| 519 | put_unaligned(dst_char, &target[j]); | ||
| 520 | } else if (charlen >= 5) { | ||
| 521 | /* 5-6bytes UTF-8 to 6bytes UTF-16 */ | ||
| 522 | put_unaligned(dst_char, &target[j]); | ||
| 523 | dst_char = cpu_to_le16(*(wchar_to + 1)); | ||
| 524 | j++; | ||
| 525 | put_unaligned(dst_char, &target[j]); | ||
| 526 | dst_char = cpu_to_le16(*(wchar_to + 2)); | ||
| 527 | j++; | ||
| 528 | put_unaligned(dst_char, &target[j]); | ||
| 447 | } | 529 | } |
| 530 | continue; | ||
| 531 | |||
| 532 | unknown: | ||
| 533 | dst_char = cpu_to_le16(0x003f); | ||
| 534 | charlen = 1; | ||
| 448 | } | 535 | } |
| 536 | |||
| 537 | ctoUTF16: | ||
| 449 | /* | 538 | /* |
| 450 | * character may take more than one byte in the source string, | 539 | * character may take more than one byte in the source string, |
| 451 | * but will take exactly two bytes in the target string | 540 | * but will take exactly two bytes in the target string |
| @@ -456,6 +545,7 @@ cifsConvertToUTF16(__le16 *target, const char *source, int srclen, | |||
| 456 | 545 | ||
| 457 | ctoUTF16_out: | 546 | ctoUTF16_out: |
| 458 | put_unaligned(0, &target[j]); /* Null terminate target unicode string */ | 547 | put_unaligned(0, &target[j]); /* Null terminate target unicode string */ |
| 548 | kfree(wchar_to); | ||
| 459 | return j; | 549 | return j; |
| 460 | } | 550 | } |
| 461 | 551 | ||
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index f5089bde3635..0a9fb6b53126 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
| @@ -469,6 +469,8 @@ cifs_show_options(struct seq_file *s, struct dentry *root) | |||
| 469 | seq_puts(s, ",nouser_xattr"); | 469 | seq_puts(s, ",nouser_xattr"); |
| 470 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR) | 470 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR) |
| 471 | seq_puts(s, ",mapchars"); | 471 | seq_puts(s, ",mapchars"); |
| 472 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SFM_CHR) | ||
| 473 | seq_puts(s, ",mapposix"); | ||
| 472 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) | 474 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) |
| 473 | seq_puts(s, ",sfu"); | 475 | seq_puts(s, ",sfu"); |
| 474 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) | 476 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) |
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index c31ce98c1704..c63fd1dde25b 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h | |||
| @@ -361,11 +361,11 @@ extern int CIFSUnixCreateHardLink(const unsigned int xid, | |||
| 361 | extern int CIFSUnixCreateSymLink(const unsigned int xid, | 361 | extern int CIFSUnixCreateSymLink(const unsigned int xid, |
| 362 | struct cifs_tcon *tcon, | 362 | struct cifs_tcon *tcon, |
| 363 | const char *fromName, const char *toName, | 363 | const char *fromName, const char *toName, |
| 364 | const struct nls_table *nls_codepage); | 364 | const struct nls_table *nls_codepage, int remap); |
| 365 | extern int CIFSSMBUnixQuerySymLink(const unsigned int xid, | 365 | extern int CIFSSMBUnixQuerySymLink(const unsigned int xid, |
| 366 | struct cifs_tcon *tcon, | 366 | struct cifs_tcon *tcon, |
| 367 | const unsigned char *searchName, char **syminfo, | 367 | const unsigned char *searchName, char **syminfo, |
| 368 | const struct nls_table *nls_codepage); | 368 | const struct nls_table *nls_codepage, int remap); |
| 369 | extern int CIFSSMBQuerySymLink(const unsigned int xid, struct cifs_tcon *tcon, | 369 | extern int CIFSSMBQuerySymLink(const unsigned int xid, struct cifs_tcon *tcon, |
| 370 | __u16 fid, char **symlinkinfo, | 370 | __u16 fid, char **symlinkinfo, |
| 371 | const struct nls_table *nls_codepage); | 371 | const struct nls_table *nls_codepage); |
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 84650a51c7c4..f26ffbfc64d8 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
| @@ -2784,7 +2784,7 @@ copyRetry: | |||
| 2784 | int | 2784 | int |
| 2785 | CIFSUnixCreateSymLink(const unsigned int xid, struct cifs_tcon *tcon, | 2785 | CIFSUnixCreateSymLink(const unsigned int xid, struct cifs_tcon *tcon, |
| 2786 | const char *fromName, const char *toName, | 2786 | const char *fromName, const char *toName, |
| 2787 | const struct nls_table *nls_codepage) | 2787 | const struct nls_table *nls_codepage, int remap) |
| 2788 | { | 2788 | { |
| 2789 | TRANSACTION2_SPI_REQ *pSMB = NULL; | 2789 | TRANSACTION2_SPI_REQ *pSMB = NULL; |
| 2790 | TRANSACTION2_SPI_RSP *pSMBr = NULL; | 2790 | TRANSACTION2_SPI_RSP *pSMBr = NULL; |
| @@ -2804,9 +2804,9 @@ createSymLinkRetry: | |||
| 2804 | 2804 | ||
| 2805 | if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { | 2805 | if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { |
| 2806 | name_len = | 2806 | name_len = |
| 2807 | cifs_strtoUTF16((__le16 *) pSMB->FileName, fromName, | 2807 | cifsConvertToUTF16((__le16 *) pSMB->FileName, fromName, |
| 2808 | /* find define for this maxpathcomponent */ | 2808 | /* find define for this maxpathcomponent */ |
| 2809 | PATH_MAX, nls_codepage); | 2809 | PATH_MAX, nls_codepage, remap); |
| 2810 | name_len++; /* trailing null */ | 2810 | name_len++; /* trailing null */ |
| 2811 | name_len *= 2; | 2811 | name_len *= 2; |
| 2812 | 2812 | ||
| @@ -2828,9 +2828,9 @@ createSymLinkRetry: | |||
| 2828 | data_offset = (char *) (&pSMB->hdr.Protocol) + offset; | 2828 | data_offset = (char *) (&pSMB->hdr.Protocol) + offset; |
| 2829 | if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { | 2829 | if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { |
| 2830 | name_len_target = | 2830 | name_len_target = |
| 2831 | cifs_strtoUTF16((__le16 *) data_offset, toName, PATH_MAX | 2831 | cifsConvertToUTF16((__le16 *) data_offset, toName, |
| 2832 | /* find define for this maxpathcomponent */ | 2832 | /* find define for this maxpathcomponent */ |
| 2833 | , nls_codepage); | 2833 | PATH_MAX, nls_codepage, remap); |
| 2834 | name_len_target++; /* trailing null */ | 2834 | name_len_target++; /* trailing null */ |
| 2835 | name_len_target *= 2; | 2835 | name_len_target *= 2; |
| 2836 | } else { /* BB improve the check for buffer overruns BB */ | 2836 | } else { /* BB improve the check for buffer overruns BB */ |
| @@ -3034,7 +3034,7 @@ winCreateHardLinkRetry: | |||
| 3034 | int | 3034 | int |
| 3035 | CIFSSMBUnixQuerySymLink(const unsigned int xid, struct cifs_tcon *tcon, | 3035 | CIFSSMBUnixQuerySymLink(const unsigned int xid, struct cifs_tcon *tcon, |
| 3036 | const unsigned char *searchName, char **symlinkinfo, | 3036 | const unsigned char *searchName, char **symlinkinfo, |
| 3037 | const struct nls_table *nls_codepage) | 3037 | const struct nls_table *nls_codepage, int remap) |
| 3038 | { | 3038 | { |
| 3039 | /* SMB_QUERY_FILE_UNIX_LINK */ | 3039 | /* SMB_QUERY_FILE_UNIX_LINK */ |
| 3040 | TRANSACTION2_QPI_REQ *pSMB = NULL; | 3040 | TRANSACTION2_QPI_REQ *pSMB = NULL; |
| @@ -3055,8 +3055,9 @@ querySymLinkRetry: | |||
| 3055 | 3055 | ||
| 3056 | if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { | 3056 | if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { |
| 3057 | name_len = | 3057 | name_len = |
| 3058 | cifs_strtoUTF16((__le16 *) pSMB->FileName, searchName, | 3058 | cifsConvertToUTF16((__le16 *) pSMB->FileName, |
| 3059 | PATH_MAX, nls_codepage); | 3059 | searchName, PATH_MAX, nls_codepage, |
| 3060 | remap); | ||
| 3060 | name_len++; /* trailing null */ | 3061 | name_len++; /* trailing null */ |
| 3061 | name_len *= 2; | 3062 | name_len *= 2; |
| 3062 | } else { /* BB improve the check for buffer overruns BB */ | 3063 | } else { /* BB improve the check for buffer overruns BB */ |
| @@ -4917,7 +4918,7 @@ getDFSRetry: | |||
| 4917 | strncpy(pSMB->RequestFileName, search_name, name_len); | 4918 | strncpy(pSMB->RequestFileName, search_name, name_len); |
| 4918 | } | 4919 | } |
| 4919 | 4920 | ||
| 4920 | if (ses->server && ses->server->sign) | 4921 | if (ses->server->sign) |
| 4921 | pSMB->hdr.Flags2 |= SMBFLG2_SECURITY_SIGNATURE; | 4922 | pSMB->hdr.Flags2 |= SMBFLG2_SECURITY_SIGNATURE; |
| 4922 | 4923 | ||
| 4923 | pSMB->hdr.Uid = ses->Suid; | 4924 | pSMB->hdr.Uid = ses->Suid; |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index f3bfe08e177b..8383d5ea4202 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
| @@ -386,6 +386,7 @@ cifs_reconnect(struct TCP_Server_Info *server) | |||
| 386 | rc = generic_ip_connect(server); | 386 | rc = generic_ip_connect(server); |
| 387 | if (rc) { | 387 | if (rc) { |
| 388 | cifs_dbg(FYI, "reconnect error %d\n", rc); | 388 | cifs_dbg(FYI, "reconnect error %d\n", rc); |
| 389 | mutex_unlock(&server->srv_mutex); | ||
| 389 | msleep(3000); | 390 | msleep(3000); |
| 390 | } else { | 391 | } else { |
| 391 | atomic_inc(&tcpSesReconnectCount); | 392 | atomic_inc(&tcpSesReconnectCount); |
| @@ -393,8 +394,8 @@ cifs_reconnect(struct TCP_Server_Info *server) | |||
| 393 | if (server->tcpStatus != CifsExiting) | 394 | if (server->tcpStatus != CifsExiting) |
| 394 | server->tcpStatus = CifsNeedNegotiate; | 395 | server->tcpStatus = CifsNeedNegotiate; |
| 395 | spin_unlock(&GlobalMid_Lock); | 396 | spin_unlock(&GlobalMid_Lock); |
| 397 | mutex_unlock(&server->srv_mutex); | ||
| 396 | } | 398 | } |
| 397 | mutex_unlock(&server->srv_mutex); | ||
| 398 | } while (server->tcpStatus == CifsNeedReconnect); | 399 | } while (server->tcpStatus == CifsNeedReconnect); |
| 399 | 400 | ||
| 400 | return rc; | 401 | return rc; |
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index 338d56936f6a..c3eb998a99bd 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c | |||
| @@ -620,8 +620,7 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, umode_t mode, | |||
| 620 | } | 620 | } |
| 621 | rc = CIFSSMBUnixSetPathInfo(xid, tcon, full_path, &args, | 621 | rc = CIFSSMBUnixSetPathInfo(xid, tcon, full_path, &args, |
| 622 | cifs_sb->local_nls, | 622 | cifs_sb->local_nls, |
| 623 | cifs_sb->mnt_cifs_flags & | 623 | cifs_remap(cifs_sb)); |
| 624 | CIFS_MOUNT_MAP_SPECIAL_CHR); | ||
| 625 | if (rc) | 624 | if (rc) |
| 626 | goto mknod_out; | 625 | goto mknod_out; |
| 627 | 626 | ||
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index cafbf10521d5..3f50cee79df9 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
| @@ -140,8 +140,7 @@ int cifs_posix_open(char *full_path, struct inode **pinode, | |||
| 140 | posix_flags = cifs_posix_convert_flags(f_flags); | 140 | posix_flags = cifs_posix_convert_flags(f_flags); |
| 141 | rc = CIFSPOSIXCreate(xid, tcon, posix_flags, mode, pnetfid, presp_data, | 141 | rc = CIFSPOSIXCreate(xid, tcon, posix_flags, mode, pnetfid, presp_data, |
| 142 | poplock, full_path, cifs_sb->local_nls, | 142 | poplock, full_path, cifs_sb->local_nls, |
| 143 | cifs_sb->mnt_cifs_flags & | 143 | cifs_remap(cifs_sb)); |
| 144 | CIFS_MOUNT_MAP_SPECIAL_CHR); | ||
| 145 | cifs_put_tlink(tlink); | 144 | cifs_put_tlink(tlink); |
| 146 | 145 | ||
| 147 | if (rc) | 146 | if (rc) |
| @@ -1553,8 +1552,8 @@ cifs_setlk(struct file *file, struct file_lock *flock, __u32 type, | |||
| 1553 | rc = server->ops->mand_unlock_range(cfile, flock, xid); | 1552 | rc = server->ops->mand_unlock_range(cfile, flock, xid); |
| 1554 | 1553 | ||
| 1555 | out: | 1554 | out: |
| 1556 | if (flock->fl_flags & FL_POSIX) | 1555 | if (flock->fl_flags & FL_POSIX && !rc) |
| 1557 | posix_lock_file_wait(file, flock); | 1556 | rc = posix_lock_file_wait(file, flock); |
| 1558 | return rc; | 1557 | return rc; |
| 1559 | } | 1558 | } |
| 1560 | 1559 | ||
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 55b58112d122..f621b44cb800 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
| @@ -373,8 +373,7 @@ int cifs_get_inode_info_unix(struct inode **pinode, | |||
| 373 | 373 | ||
| 374 | /* could have done a find first instead but this returns more info */ | 374 | /* could have done a find first instead but this returns more info */ |
| 375 | rc = CIFSSMBUnixQPathInfo(xid, tcon, full_path, &find_data, | 375 | rc = CIFSSMBUnixQPathInfo(xid, tcon, full_path, &find_data, |
| 376 | cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & | 376 | cifs_sb->local_nls, cifs_remap(cifs_sb)); |
| 377 | CIFS_MOUNT_MAP_SPECIAL_CHR); | ||
| 378 | cifs_put_tlink(tlink); | 377 | cifs_put_tlink(tlink); |
| 379 | 378 | ||
| 380 | if (!rc) { | 379 | if (!rc) { |
| @@ -402,9 +401,25 @@ int cifs_get_inode_info_unix(struct inode **pinode, | |||
| 402 | rc = -ENOMEM; | 401 | rc = -ENOMEM; |
| 403 | } else { | 402 | } else { |
| 404 | /* we already have inode, update it */ | 403 | /* we already have inode, update it */ |
| 404 | |||
| 405 | /* if uniqueid is different, return error */ | ||
| 406 | if (unlikely(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM && | ||
| 407 | CIFS_I(*pinode)->uniqueid != fattr.cf_uniqueid)) { | ||
| 408 | rc = -ESTALE; | ||
| 409 | goto cgiiu_exit; | ||
| 410 | } | ||
| 411 | |||
| 412 | /* if filetype is different, return error */ | ||
| 413 | if (unlikely(((*pinode)->i_mode & S_IFMT) != | ||
| 414 | (fattr.cf_mode & S_IFMT))) { | ||
| 415 | rc = -ESTALE; | ||
| 416 | goto cgiiu_exit; | ||
| 417 | } | ||
| 418 | |||
| 405 | cifs_fattr_to_inode(*pinode, &fattr); | 419 | cifs_fattr_to_inode(*pinode, &fattr); |
| 406 | } | 420 | } |
| 407 | 421 | ||
| 422 | cgiiu_exit: | ||
| 408 | return rc; | 423 | return rc; |
| 409 | } | 424 | } |
| 410 | 425 | ||
| @@ -839,6 +854,15 @@ cifs_get_inode_info(struct inode **inode, const char *full_path, | |||
| 839 | if (!*inode) | 854 | if (!*inode) |
| 840 | rc = -ENOMEM; | 855 | rc = -ENOMEM; |
| 841 | } else { | 856 | } else { |
| 857 | /* we already have inode, update it */ | ||
| 858 | |||
| 859 | /* if filetype is different, return error */ | ||
| 860 | if (unlikely(((*inode)->i_mode & S_IFMT) != | ||
| 861 | (fattr.cf_mode & S_IFMT))) { | ||
| 862 | rc = -ESTALE; | ||
| 863 | goto cgii_exit; | ||
| 864 | } | ||
| 865 | |||
| 842 | cifs_fattr_to_inode(*inode, &fattr); | 866 | cifs_fattr_to_inode(*inode, &fattr); |
| 843 | } | 867 | } |
| 844 | 868 | ||
| @@ -2215,8 +2239,7 @@ cifs_setattr_unix(struct dentry *direntry, struct iattr *attrs) | |||
| 2215 | pTcon = tlink_tcon(tlink); | 2239 | pTcon = tlink_tcon(tlink); |
| 2216 | rc = CIFSSMBUnixSetPathInfo(xid, pTcon, full_path, args, | 2240 | rc = CIFSSMBUnixSetPathInfo(xid, pTcon, full_path, args, |
| 2217 | cifs_sb->local_nls, | 2241 | cifs_sb->local_nls, |
| 2218 | cifs_sb->mnt_cifs_flags & | 2242 | cifs_remap(cifs_sb)); |
| 2219 | CIFS_MOUNT_MAP_SPECIAL_CHR); | ||
| 2220 | cifs_put_tlink(tlink); | 2243 | cifs_put_tlink(tlink); |
| 2221 | } | 2244 | } |
| 2222 | 2245 | ||
diff --git a/fs/cifs/link.c b/fs/cifs/link.c index 252e672d5604..e6c707cc62b3 100644 --- a/fs/cifs/link.c +++ b/fs/cifs/link.c | |||
| @@ -717,7 +717,8 @@ cifs_symlink(struct inode *inode, struct dentry *direntry, const char *symname) | |||
| 717 | rc = create_mf_symlink(xid, pTcon, cifs_sb, full_path, symname); | 717 | rc = create_mf_symlink(xid, pTcon, cifs_sb, full_path, symname); |
| 718 | else if (pTcon->unix_ext) | 718 | else if (pTcon->unix_ext) |
| 719 | rc = CIFSUnixCreateSymLink(xid, pTcon, full_path, symname, | 719 | rc = CIFSUnixCreateSymLink(xid, pTcon, full_path, symname, |
| 720 | cifs_sb->local_nls); | 720 | cifs_sb->local_nls, |
| 721 | cifs_remap(cifs_sb)); | ||
| 721 | /* else | 722 | /* else |
| 722 | rc = CIFSCreateReparseSymLink(xid, pTcon, fromName, toName, | 723 | rc = CIFSCreateReparseSymLink(xid, pTcon, fromName, toName, |
| 723 | cifs_sb_target->local_nls); */ | 724 | cifs_sb_target->local_nls); */ |
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c index b4a47237486b..b1eede3678a9 100644 --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c | |||
| @@ -90,6 +90,8 @@ cifs_prime_dcache(struct dentry *parent, struct qstr *name, | |||
| 90 | if (dentry) { | 90 | if (dentry) { |
| 91 | inode = d_inode(dentry); | 91 | inode = d_inode(dentry); |
| 92 | if (inode) { | 92 | if (inode) { |
| 93 | if (d_mountpoint(dentry)) | ||
| 94 | goto out; | ||
| 93 | /* | 95 | /* |
| 94 | * If we're generating inode numbers, then we don't | 96 | * If we're generating inode numbers, then we don't |
| 95 | * want to clobber the existing one with the one that | 97 | * want to clobber the existing one with the one that |
diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c index 7bfdd6066276..fc537c29044e 100644 --- a/fs/cifs/smb1ops.c +++ b/fs/cifs/smb1ops.c | |||
| @@ -960,7 +960,8 @@ cifs_query_symlink(const unsigned int xid, struct cifs_tcon *tcon, | |||
| 960 | /* Check for unix extensions */ | 960 | /* Check for unix extensions */ |
| 961 | if (cap_unix(tcon->ses)) { | 961 | if (cap_unix(tcon->ses)) { |
| 962 | rc = CIFSSMBUnixQuerySymLink(xid, tcon, full_path, target_path, | 962 | rc = CIFSSMBUnixQuerySymLink(xid, tcon, full_path, target_path, |
| 963 | cifs_sb->local_nls); | 963 | cifs_sb->local_nls, |
| 964 | cifs_remap(cifs_sb)); | ||
| 964 | if (rc == -EREMOTE) | 965 | if (rc == -EREMOTE) |
| 965 | rc = cifs_unix_dfs_readlink(xid, tcon, full_path, | 966 | rc = cifs_unix_dfs_readlink(xid, tcon, full_path, |
| 966 | target_path, | 967 | target_path, |
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index 65cd7a84c8bc..54cbe19d9c08 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c | |||
| @@ -110,7 +110,7 @@ smb2_hdr_assemble(struct smb2_hdr *hdr, __le16 smb2_cmd /* command */ , | |||
| 110 | 110 | ||
| 111 | /* GLOBAL_CAP_LARGE_MTU will only be set if dialect > SMB2.02 */ | 111 | /* GLOBAL_CAP_LARGE_MTU will only be set if dialect > SMB2.02 */ |
| 112 | /* See sections 2.2.4 and 3.2.4.1.5 of MS-SMB2 */ | 112 | /* See sections 2.2.4 and 3.2.4.1.5 of MS-SMB2 */ |
| 113 | if ((tcon->ses) && | 113 | if ((tcon->ses) && (tcon->ses->server) && |
| 114 | (tcon->ses->server->capabilities & SMB2_GLOBAL_CAP_LARGE_MTU)) | 114 | (tcon->ses->server->capabilities & SMB2_GLOBAL_CAP_LARGE_MTU)) |
| 115 | hdr->CreditCharge = cpu_to_le16(1); | 115 | hdr->CreditCharge = cpu_to_le16(1); |
| 116 | /* else CreditCharge MBZ */ | 116 | /* else CreditCharge MBZ */ |
diff --git a/fs/omfs/bitmap.c b/fs/omfs/bitmap.c index 082234581d05..83f4e76511c2 100644 --- a/fs/omfs/bitmap.c +++ b/fs/omfs/bitmap.c | |||
| @@ -159,7 +159,7 @@ int omfs_allocate_range(struct super_block *sb, | |||
| 159 | goto out; | 159 | goto out; |
| 160 | 160 | ||
| 161 | found: | 161 | found: |
| 162 | *return_block = i * bits_per_entry + bit; | 162 | *return_block = (u64) i * bits_per_entry + bit; |
| 163 | *return_size = run; | 163 | *return_size = run; |
| 164 | ret = set_run(sb, i, bits_per_entry, bit, run, 1); | 164 | ret = set_run(sb, i, bits_per_entry, bit, run, 1); |
| 165 | 165 | ||
diff --git a/fs/omfs/inode.c b/fs/omfs/inode.c index 138321b0c6c2..3d935c81789a 100644 --- a/fs/omfs/inode.c +++ b/fs/omfs/inode.c | |||
| @@ -306,7 +306,8 @@ static const struct super_operations omfs_sops = { | |||
| 306 | */ | 306 | */ |
| 307 | static int omfs_get_imap(struct super_block *sb) | 307 | static int omfs_get_imap(struct super_block *sb) |
| 308 | { | 308 | { |
| 309 | unsigned int bitmap_size, count, array_size; | 309 | unsigned int bitmap_size, array_size; |
| 310 | int count; | ||
| 310 | struct omfs_sb_info *sbi = OMFS_SB(sb); | 311 | struct omfs_sb_info *sbi = OMFS_SB(sb); |
| 311 | struct buffer_head *bh; | 312 | struct buffer_head *bh; |
| 312 | unsigned long **ptr; | 313 | unsigned long **ptr; |
| @@ -359,7 +360,7 @@ nomem: | |||
| 359 | } | 360 | } |
| 360 | 361 | ||
| 361 | enum { | 362 | enum { |
| 362 | Opt_uid, Opt_gid, Opt_umask, Opt_dmask, Opt_fmask | 363 | Opt_uid, Opt_gid, Opt_umask, Opt_dmask, Opt_fmask, Opt_err |
| 363 | }; | 364 | }; |
| 364 | 365 | ||
| 365 | static const match_table_t tokens = { | 366 | static const match_table_t tokens = { |
| @@ -368,6 +369,7 @@ static const match_table_t tokens = { | |||
| 368 | {Opt_umask, "umask=%o"}, | 369 | {Opt_umask, "umask=%o"}, |
| 369 | {Opt_dmask, "dmask=%o"}, | 370 | {Opt_dmask, "dmask=%o"}, |
| 370 | {Opt_fmask, "fmask=%o"}, | 371 | {Opt_fmask, "fmask=%o"}, |
| 372 | {Opt_err, NULL}, | ||
| 371 | }; | 373 | }; |
| 372 | 374 | ||
| 373 | static int parse_options(char *options, struct omfs_sb_info *sbi) | 375 | static int parse_options(char *options, struct omfs_sb_info *sbi) |
| @@ -548,8 +550,10 @@ static int omfs_fill_super(struct super_block *sb, void *data, int silent) | |||
| 548 | } | 550 | } |
| 549 | 551 | ||
| 550 | sb->s_root = d_make_root(root); | 552 | sb->s_root = d_make_root(root); |
| 551 | if (!sb->s_root) | 553 | if (!sb->s_root) { |
| 554 | ret = -ENOMEM; | ||
| 552 | goto out_brelse_bh2; | 555 | goto out_brelse_bh2; |
| 556 | } | ||
| 553 | printk(KERN_DEBUG "omfs: Mounted volume %s\n", omfs_rb->r_name); | 557 | printk(KERN_DEBUG "omfs: Mounted volume %s\n", omfs_rb->r_name); |
| 554 | 558 | ||
| 555 | ret = 0; | 559 | ret = 0; |
diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c index 24f640441bd9..84d693d37428 100644 --- a/fs/overlayfs/copy_up.c +++ b/fs/overlayfs/copy_up.c | |||
| @@ -299,6 +299,9 @@ int ovl_copy_up_one(struct dentry *parent, struct dentry *dentry, | |||
| 299 | struct cred *override_cred; | 299 | struct cred *override_cred; |
| 300 | char *link = NULL; | 300 | char *link = NULL; |
| 301 | 301 | ||
| 302 | if (WARN_ON(!workdir)) | ||
| 303 | return -EROFS; | ||
| 304 | |||
| 302 | ovl_path_upper(parent, &parentpath); | 305 | ovl_path_upper(parent, &parentpath); |
| 303 | upperdir = parentpath.dentry; | 306 | upperdir = parentpath.dentry; |
| 304 | 307 | ||
diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c index d139405d2bfa..692ceda3bc21 100644 --- a/fs/overlayfs/dir.c +++ b/fs/overlayfs/dir.c | |||
| @@ -222,6 +222,9 @@ static struct dentry *ovl_clear_empty(struct dentry *dentry, | |||
| 222 | struct kstat stat; | 222 | struct kstat stat; |
| 223 | int err; | 223 | int err; |
| 224 | 224 | ||
| 225 | if (WARN_ON(!workdir)) | ||
| 226 | return ERR_PTR(-EROFS); | ||
| 227 | |||
| 225 | err = ovl_lock_rename_workdir(workdir, upperdir); | 228 | err = ovl_lock_rename_workdir(workdir, upperdir); |
| 226 | if (err) | 229 | if (err) |
| 227 | goto out; | 230 | goto out; |
| @@ -322,6 +325,9 @@ static int ovl_create_over_whiteout(struct dentry *dentry, struct inode *inode, | |||
| 322 | struct dentry *newdentry; | 325 | struct dentry *newdentry; |
| 323 | int err; | 326 | int err; |
| 324 | 327 | ||
| 328 | if (WARN_ON(!workdir)) | ||
| 329 | return -EROFS; | ||
| 330 | |||
| 325 | err = ovl_lock_rename_workdir(workdir, upperdir); | 331 | err = ovl_lock_rename_workdir(workdir, upperdir); |
| 326 | if (err) | 332 | if (err) |
| 327 | goto out; | 333 | goto out; |
| @@ -506,11 +512,28 @@ static int ovl_remove_and_whiteout(struct dentry *dentry, bool is_dir) | |||
| 506 | struct dentry *opaquedir = NULL; | 512 | struct dentry *opaquedir = NULL; |
| 507 | int err; | 513 | int err; |
| 508 | 514 | ||
| 509 | if (is_dir && OVL_TYPE_MERGE_OR_LOWER(ovl_path_type(dentry))) { | 515 | if (WARN_ON(!workdir)) |
| 510 | opaquedir = ovl_check_empty_and_clear(dentry); | 516 | return -EROFS; |
| 511 | err = PTR_ERR(opaquedir); | 517 | |
| 512 | if (IS_ERR(opaquedir)) | 518 | if (is_dir) { |
| 513 | goto out; | 519 | if (OVL_TYPE_MERGE_OR_LOWER(ovl_path_type(dentry))) { |
| 520 | opaquedir = ovl_check_empty_and_clear(dentry); | ||
| 521 | err = PTR_ERR(opaquedir); | ||
| 522 | if (IS_ERR(opaquedir)) | ||
| 523 | goto out; | ||
| 524 | } else { | ||
| 525 | LIST_HEAD(list); | ||
| 526 | |||
| 527 | /* | ||
| 528 | * When removing an empty opaque directory, then it | ||
| 529 | * makes no sense to replace it with an exact replica of | ||
| 530 | * itself. But emptiness still needs to be checked. | ||
| 531 | */ | ||
| 532 | err = ovl_check_empty_dir(dentry, &list); | ||
| 533 | ovl_cache_free(&list); | ||
| 534 | if (err) | ||
| 535 | goto out; | ||
| 536 | } | ||
| 514 | } | 537 | } |
| 515 | 538 | ||
| 516 | err = ovl_lock_rename_workdir(workdir, upperdir); | 539 | err = ovl_lock_rename_workdir(workdir, upperdir); |
diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c index 5f0d1993e6e3..bf8537c7f455 100644 --- a/fs/overlayfs/super.c +++ b/fs/overlayfs/super.c | |||
| @@ -529,7 +529,7 @@ static int ovl_remount(struct super_block *sb, int *flags, char *data) | |||
| 529 | { | 529 | { |
| 530 | struct ovl_fs *ufs = sb->s_fs_info; | 530 | struct ovl_fs *ufs = sb->s_fs_info; |
| 531 | 531 | ||
| 532 | if (!(*flags & MS_RDONLY) && !ufs->upper_mnt) | 532 | if (!(*flags & MS_RDONLY) && (!ufs->upper_mnt || !ufs->workdir)) |
| 533 | return -EROFS; | 533 | return -EROFS; |
| 534 | 534 | ||
| 535 | return 0; | 535 | return 0; |
| @@ -925,9 +925,10 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent) | |||
| 925 | ufs->workdir = ovl_workdir_create(ufs->upper_mnt, workpath.dentry); | 925 | ufs->workdir = ovl_workdir_create(ufs->upper_mnt, workpath.dentry); |
| 926 | err = PTR_ERR(ufs->workdir); | 926 | err = PTR_ERR(ufs->workdir); |
| 927 | if (IS_ERR(ufs->workdir)) { | 927 | if (IS_ERR(ufs->workdir)) { |
| 928 | pr_err("overlayfs: failed to create directory %s/%s\n", | 928 | pr_warn("overlayfs: failed to create directory %s/%s (errno: %i); mounting read-only\n", |
| 929 | ufs->config.workdir, OVL_WORKDIR_NAME); | 929 | ufs->config.workdir, OVL_WORKDIR_NAME, -err); |
| 930 | goto out_put_upper_mnt; | 930 | sb->s_flags |= MS_RDONLY; |
| 931 | ufs->workdir = NULL; | ||
| 931 | } | 932 | } |
| 932 | } | 933 | } |
| 933 | 934 | ||
| @@ -997,7 +998,6 @@ out_put_lower_mnt: | |||
| 997 | kfree(ufs->lower_mnt); | 998 | kfree(ufs->lower_mnt); |
| 998 | out_put_workdir: | 999 | out_put_workdir: |
| 999 | dput(ufs->workdir); | 1000 | dput(ufs->workdir); |
| 1000 | out_put_upper_mnt: | ||
| 1001 | mntput(ufs->upper_mnt); | 1001 | mntput(ufs->upper_mnt); |
| 1002 | out_put_lowerpath: | 1002 | out_put_lowerpath: |
| 1003 | for (i = 0; i < numlower; i++) | 1003 | for (i = 0; i < numlower; i++) |
diff --git a/fs/xfs/libxfs/xfs_attr_leaf.c b/fs/xfs/libxfs/xfs_attr_leaf.c index 04e79d57bca6..e9d401ce93bb 100644 --- a/fs/xfs/libxfs/xfs_attr_leaf.c +++ b/fs/xfs/libxfs/xfs_attr_leaf.c | |||
| @@ -574,8 +574,8 @@ xfs_attr_shortform_add(xfs_da_args_t *args, int forkoff) | |||
| 574 | * After the last attribute is removed revert to original inode format, | 574 | * After the last attribute is removed revert to original inode format, |
| 575 | * making all literal area available to the data fork once more. | 575 | * making all literal area available to the data fork once more. |
| 576 | */ | 576 | */ |
| 577 | STATIC void | 577 | void |
| 578 | xfs_attr_fork_reset( | 578 | xfs_attr_fork_remove( |
| 579 | struct xfs_inode *ip, | 579 | struct xfs_inode *ip, |
| 580 | struct xfs_trans *tp) | 580 | struct xfs_trans *tp) |
| 581 | { | 581 | { |
| @@ -641,7 +641,7 @@ xfs_attr_shortform_remove(xfs_da_args_t *args) | |||
| 641 | (mp->m_flags & XFS_MOUNT_ATTR2) && | 641 | (mp->m_flags & XFS_MOUNT_ATTR2) && |
| 642 | (dp->i_d.di_format != XFS_DINODE_FMT_BTREE) && | 642 | (dp->i_d.di_format != XFS_DINODE_FMT_BTREE) && |
| 643 | !(args->op_flags & XFS_DA_OP_ADDNAME)) { | 643 | !(args->op_flags & XFS_DA_OP_ADDNAME)) { |
| 644 | xfs_attr_fork_reset(dp, args->trans); | 644 | xfs_attr_fork_remove(dp, args->trans); |
| 645 | } else { | 645 | } else { |
| 646 | xfs_idata_realloc(dp, -size, XFS_ATTR_FORK); | 646 | xfs_idata_realloc(dp, -size, XFS_ATTR_FORK); |
| 647 | dp->i_d.di_forkoff = xfs_attr_shortform_bytesfit(dp, totsize); | 647 | dp->i_d.di_forkoff = xfs_attr_shortform_bytesfit(dp, totsize); |
| @@ -905,7 +905,7 @@ xfs_attr3_leaf_to_shortform( | |||
| 905 | if (forkoff == -1) { | 905 | if (forkoff == -1) { |
| 906 | ASSERT(dp->i_mount->m_flags & XFS_MOUNT_ATTR2); | 906 | ASSERT(dp->i_mount->m_flags & XFS_MOUNT_ATTR2); |
| 907 | ASSERT(dp->i_d.di_format != XFS_DINODE_FMT_BTREE); | 907 | ASSERT(dp->i_d.di_format != XFS_DINODE_FMT_BTREE); |
| 908 | xfs_attr_fork_reset(dp, args->trans); | 908 | xfs_attr_fork_remove(dp, args->trans); |
| 909 | goto out; | 909 | goto out; |
| 910 | } | 910 | } |
| 911 | 911 | ||
diff --git a/fs/xfs/libxfs/xfs_attr_leaf.h b/fs/xfs/libxfs/xfs_attr_leaf.h index 025c4b820c03..882c8d338891 100644 --- a/fs/xfs/libxfs/xfs_attr_leaf.h +++ b/fs/xfs/libxfs/xfs_attr_leaf.h | |||
| @@ -53,7 +53,7 @@ int xfs_attr_shortform_remove(struct xfs_da_args *args); | |||
| 53 | int xfs_attr_shortform_list(struct xfs_attr_list_context *context); | 53 | int xfs_attr_shortform_list(struct xfs_attr_list_context *context); |
| 54 | int xfs_attr_shortform_allfit(struct xfs_buf *bp, struct xfs_inode *dp); | 54 | int xfs_attr_shortform_allfit(struct xfs_buf *bp, struct xfs_inode *dp); |
| 55 | int xfs_attr_shortform_bytesfit(xfs_inode_t *dp, int bytes); | 55 | int xfs_attr_shortform_bytesfit(xfs_inode_t *dp, int bytes); |
| 56 | 56 | void xfs_attr_fork_remove(struct xfs_inode *ip, struct xfs_trans *tp); | |
| 57 | 57 | ||
| 58 | /* | 58 | /* |
| 59 | * Internal routines when attribute fork size == XFS_LBSIZE(mp). | 59 | * Internal routines when attribute fork size == XFS_LBSIZE(mp). |
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index aeffeaaac0ec..f1026e86dabc 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c | |||
| @@ -3224,12 +3224,24 @@ xfs_bmap_extsize_align( | |||
| 3224 | align_alen += temp; | 3224 | align_alen += temp; |
| 3225 | align_off -= temp; | 3225 | align_off -= temp; |
| 3226 | } | 3226 | } |
| 3227 | |||
| 3228 | /* Same adjustment for the end of the requested area. */ | ||
| 3229 | temp = (align_alen % extsz); | ||
| 3230 | if (temp) | ||
| 3231 | align_alen += extsz - temp; | ||
| 3232 | |||
| 3227 | /* | 3233 | /* |
| 3228 | * Same adjustment for the end of the requested area. | 3234 | * For large extent hint sizes, the aligned extent might be larger than |
| 3235 | * MAXEXTLEN. In that case, reduce the size by an extsz so that it pulls | ||
| 3236 | * the length back under MAXEXTLEN. The outer allocation loops handle | ||
| 3237 | * short allocation just fine, so it is safe to do this. We only want to | ||
| 3238 | * do it when we are forced to, though, because it means more allocation | ||
| 3239 | * operations are required. | ||
| 3229 | */ | 3240 | */ |
| 3230 | if ((temp = (align_alen % extsz))) { | 3241 | while (align_alen > MAXEXTLEN) |
| 3231 | align_alen += extsz - temp; | 3242 | align_alen -= extsz; |
| 3232 | } | 3243 | ASSERT(align_alen <= MAXEXTLEN); |
| 3244 | |||
| 3233 | /* | 3245 | /* |
| 3234 | * If the previous block overlaps with this proposed allocation | 3246 | * If the previous block overlaps with this proposed allocation |
| 3235 | * then move the start forward without adjusting the length. | 3247 | * then move the start forward without adjusting the length. |
| @@ -3318,7 +3330,9 @@ xfs_bmap_extsize_align( | |||
| 3318 | return -EINVAL; | 3330 | return -EINVAL; |
| 3319 | } else { | 3331 | } else { |
| 3320 | ASSERT(orig_off >= align_off); | 3332 | ASSERT(orig_off >= align_off); |
| 3321 | ASSERT(orig_end <= align_off + align_alen); | 3333 | /* see MAXEXTLEN handling above */ |
| 3334 | ASSERT(orig_end <= align_off + align_alen || | ||
| 3335 | align_alen + extsz > MAXEXTLEN); | ||
| 3322 | } | 3336 | } |
| 3323 | 3337 | ||
| 3324 | #ifdef DEBUG | 3338 | #ifdef DEBUG |
| @@ -4099,13 +4113,6 @@ xfs_bmapi_reserve_delalloc( | |||
| 4099 | /* Figure out the extent size, adjust alen */ | 4113 | /* Figure out the extent size, adjust alen */ |
| 4100 | extsz = xfs_get_extsz_hint(ip); | 4114 | extsz = xfs_get_extsz_hint(ip); |
| 4101 | if (extsz) { | 4115 | if (extsz) { |
| 4102 | /* | ||
| 4103 | * Make sure we don't exceed a single extent length when we | ||
| 4104 | * align the extent by reducing length we are going to | ||
| 4105 | * allocate by the maximum amount extent size aligment may | ||
| 4106 | * require. | ||
| 4107 | */ | ||
| 4108 | alen = XFS_FILBLKS_MIN(len, MAXEXTLEN - (2 * extsz - 1)); | ||
| 4109 | error = xfs_bmap_extsize_align(mp, got, prev, extsz, rt, eof, | 4116 | error = xfs_bmap_extsize_align(mp, got, prev, extsz, rt, eof, |
| 4110 | 1, 0, &aoff, &alen); | 4117 | 1, 0, &aoff, &alen); |
| 4111 | ASSERT(!error); | 4118 | ASSERT(!error); |
diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c index 07349a183a11..1c9e75521250 100644 --- a/fs/xfs/libxfs/xfs_ialloc.c +++ b/fs/xfs/libxfs/xfs_ialloc.c | |||
| @@ -376,7 +376,7 @@ xfs_ialloc_ag_alloc( | |||
| 376 | */ | 376 | */ |
| 377 | newlen = args.mp->m_ialloc_inos; | 377 | newlen = args.mp->m_ialloc_inos; |
| 378 | if (args.mp->m_maxicount && | 378 | if (args.mp->m_maxicount && |
| 379 | percpu_counter_read(&args.mp->m_icount) + newlen > | 379 | percpu_counter_read_positive(&args.mp->m_icount) + newlen > |
| 380 | args.mp->m_maxicount) | 380 | args.mp->m_maxicount) |
| 381 | return -ENOSPC; | 381 | return -ENOSPC; |
| 382 | args.minlen = args.maxlen = args.mp->m_ialloc_blks; | 382 | args.minlen = args.maxlen = args.mp->m_ialloc_blks; |
| @@ -1339,10 +1339,13 @@ xfs_dialloc( | |||
| 1339 | * If we have already hit the ceiling of inode blocks then clear | 1339 | * If we have already hit the ceiling of inode blocks then clear |
| 1340 | * okalloc so we scan all available agi structures for a free | 1340 | * okalloc so we scan all available agi structures for a free |
| 1341 | * inode. | 1341 | * inode. |
| 1342 | * | ||
| 1343 | * Read rough value of mp->m_icount by percpu_counter_read_positive, | ||
| 1344 | * which will sacrifice the preciseness but improve the performance. | ||
| 1342 | */ | 1345 | */ |
| 1343 | if (mp->m_maxicount && | 1346 | if (mp->m_maxicount && |
| 1344 | percpu_counter_read(&mp->m_icount) + mp->m_ialloc_inos > | 1347 | percpu_counter_read_positive(&mp->m_icount) + mp->m_ialloc_inos |
| 1345 | mp->m_maxicount) { | 1348 | > mp->m_maxicount) { |
| 1346 | noroom = 1; | 1349 | noroom = 1; |
| 1347 | okalloc = 0; | 1350 | okalloc = 0; |
| 1348 | } | 1351 | } |
diff --git a/fs/xfs/xfs_attr_inactive.c b/fs/xfs/xfs_attr_inactive.c index f9c1c64782d3..3fbf167cfb4c 100644 --- a/fs/xfs/xfs_attr_inactive.c +++ b/fs/xfs/xfs_attr_inactive.c | |||
| @@ -380,23 +380,31 @@ xfs_attr3_root_inactive( | |||
| 380 | return error; | 380 | return error; |
| 381 | } | 381 | } |
| 382 | 382 | ||
| 383 | /* | ||
| 384 | * xfs_attr_inactive kills all traces of an attribute fork on an inode. It | ||
| 385 | * removes both the on-disk and in-memory inode fork. Note that this also has to | ||
| 386 | * handle the condition of inodes without attributes but with an attribute fork | ||
| 387 | * configured, so we can't use xfs_inode_hasattr() here. | ||
| 388 | * | ||
| 389 | * The in-memory attribute fork is removed even on error. | ||
| 390 | */ | ||
| 383 | int | 391 | int |
| 384 | xfs_attr_inactive(xfs_inode_t *dp) | 392 | xfs_attr_inactive( |
| 393 | struct xfs_inode *dp) | ||
| 385 | { | 394 | { |
| 386 | xfs_trans_t *trans; | 395 | struct xfs_trans *trans; |
| 387 | xfs_mount_t *mp; | 396 | struct xfs_mount *mp; |
| 388 | int error; | 397 | int cancel_flags = 0; |
| 398 | int lock_mode = XFS_ILOCK_SHARED; | ||
| 399 | int error = 0; | ||
| 389 | 400 | ||
| 390 | mp = dp->i_mount; | 401 | mp = dp->i_mount; |
| 391 | ASSERT(! XFS_NOT_DQATTACHED(mp, dp)); | 402 | ASSERT(! XFS_NOT_DQATTACHED(mp, dp)); |
| 392 | 403 | ||
| 393 | xfs_ilock(dp, XFS_ILOCK_SHARED); | 404 | xfs_ilock(dp, lock_mode); |
| 394 | if (!xfs_inode_hasattr(dp) || | 405 | if (!XFS_IFORK_Q(dp)) |
| 395 | dp->i_d.di_aformat == XFS_DINODE_FMT_LOCAL) { | 406 | goto out_destroy_fork; |
| 396 | xfs_iunlock(dp, XFS_ILOCK_SHARED); | 407 | xfs_iunlock(dp, lock_mode); |
| 397 | return 0; | ||
| 398 | } | ||
| 399 | xfs_iunlock(dp, XFS_ILOCK_SHARED); | ||
| 400 | 408 | ||
| 401 | /* | 409 | /* |
| 402 | * Start our first transaction of the day. | 410 | * Start our first transaction of the day. |
| @@ -408,13 +416,18 @@ xfs_attr_inactive(xfs_inode_t *dp) | |||
| 408 | * the inode in every transaction to let it float upward through | 416 | * the inode in every transaction to let it float upward through |
| 409 | * the log. | 417 | * the log. |
| 410 | */ | 418 | */ |
| 419 | lock_mode = 0; | ||
| 411 | trans = xfs_trans_alloc(mp, XFS_TRANS_ATTRINVAL); | 420 | trans = xfs_trans_alloc(mp, XFS_TRANS_ATTRINVAL); |
| 412 | error = xfs_trans_reserve(trans, &M_RES(mp)->tr_attrinval, 0, 0); | 421 | error = xfs_trans_reserve(trans, &M_RES(mp)->tr_attrinval, 0, 0); |
| 413 | if (error) { | 422 | if (error) |
| 414 | xfs_trans_cancel(trans, 0); | 423 | goto out_cancel; |
| 415 | return error; | 424 | |
| 416 | } | 425 | lock_mode = XFS_ILOCK_EXCL; |
| 417 | xfs_ilock(dp, XFS_ILOCK_EXCL); | 426 | cancel_flags = XFS_TRANS_RELEASE_LOG_RES | XFS_TRANS_ABORT; |
| 427 | xfs_ilock(dp, lock_mode); | ||
| 428 | |||
| 429 | if (!XFS_IFORK_Q(dp)) | ||
| 430 | goto out_cancel; | ||
| 418 | 431 | ||
| 419 | /* | 432 | /* |
| 420 | * No need to make quota reservations here. We expect to release some | 433 | * No need to make quota reservations here. We expect to release some |
| @@ -422,29 +435,31 @@ xfs_attr_inactive(xfs_inode_t *dp) | |||
| 422 | */ | 435 | */ |
| 423 | xfs_trans_ijoin(trans, dp, 0); | 436 | xfs_trans_ijoin(trans, dp, 0); |
| 424 | 437 | ||
| 425 | /* | 438 | /* invalidate and truncate the attribute fork extents */ |
| 426 | * Decide on what work routines to call based on the inode size. | 439 | if (dp->i_d.di_aformat != XFS_DINODE_FMT_LOCAL) { |
| 427 | */ | 440 | error = xfs_attr3_root_inactive(&trans, dp); |
| 428 | if (!xfs_inode_hasattr(dp) || | 441 | if (error) |
| 429 | dp->i_d.di_aformat == XFS_DINODE_FMT_LOCAL) { | 442 | goto out_cancel; |
| 430 | error = 0; | 443 | |
| 431 | goto out; | 444 | error = xfs_itruncate_extents(&trans, dp, XFS_ATTR_FORK, 0); |
| 445 | if (error) | ||
| 446 | goto out_cancel; | ||
| 432 | } | 447 | } |
| 433 | error = xfs_attr3_root_inactive(&trans, dp); | ||
| 434 | if (error) | ||
| 435 | goto out; | ||
| 436 | 448 | ||
| 437 | error = xfs_itruncate_extents(&trans, dp, XFS_ATTR_FORK, 0); | 449 | /* Reset the attribute fork - this also destroys the in-core fork */ |
| 438 | if (error) | 450 | xfs_attr_fork_remove(dp, trans); |
| 439 | goto out; | ||
| 440 | 451 | ||
| 441 | error = xfs_trans_commit(trans, XFS_TRANS_RELEASE_LOG_RES); | 452 | error = xfs_trans_commit(trans, XFS_TRANS_RELEASE_LOG_RES); |
| 442 | xfs_iunlock(dp, XFS_ILOCK_EXCL); | 453 | xfs_iunlock(dp, lock_mode); |
| 443 | |||
| 444 | return error; | 454 | return error; |
| 445 | 455 | ||
| 446 | out: | 456 | out_cancel: |
| 447 | xfs_trans_cancel(trans, XFS_TRANS_RELEASE_LOG_RES|XFS_TRANS_ABORT); | 457 | xfs_trans_cancel(trans, cancel_flags); |
| 448 | xfs_iunlock(dp, XFS_ILOCK_EXCL); | 458 | out_destroy_fork: |
| 459 | /* kill the in-core attr fork before we drop the inode lock */ | ||
| 460 | if (dp->i_afp) | ||
| 461 | xfs_idestroy_fork(dp, XFS_ATTR_FORK); | ||
| 462 | if (lock_mode) | ||
| 463 | xfs_iunlock(dp, lock_mode); | ||
| 449 | return error; | 464 | return error; |
| 450 | } | 465 | } |
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index 8121e75352ee..3b7591224f4a 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c | |||
| @@ -124,7 +124,7 @@ xfs_iozero( | |||
| 124 | status = 0; | 124 | status = 0; |
| 125 | } while (count); | 125 | } while (count); |
| 126 | 126 | ||
| 127 | return (-status); | 127 | return status; |
| 128 | } | 128 | } |
| 129 | 129 | ||
| 130 | int | 130 | int |
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index d6ebc85192b7..539a85fddbc2 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
| @@ -1946,21 +1946,17 @@ xfs_inactive( | |||
| 1946 | /* | 1946 | /* |
| 1947 | * If there are attributes associated with the file then blow them away | 1947 | * If there are attributes associated with the file then blow them away |
| 1948 | * now. The code calls a routine that recursively deconstructs the | 1948 | * now. The code calls a routine that recursively deconstructs the |
| 1949 | * attribute fork. We need to just commit the current transaction | 1949 | * attribute fork. If also blows away the in-core attribute fork. |
| 1950 | * because we can't use it for xfs_attr_inactive(). | ||
| 1951 | */ | 1950 | */ |
| 1952 | if (ip->i_d.di_anextents > 0) { | 1951 | if (XFS_IFORK_Q(ip)) { |
| 1953 | ASSERT(ip->i_d.di_forkoff != 0); | ||
| 1954 | |||
| 1955 | error = xfs_attr_inactive(ip); | 1952 | error = xfs_attr_inactive(ip); |
| 1956 | if (error) | 1953 | if (error) |
| 1957 | return; | 1954 | return; |
| 1958 | } | 1955 | } |
| 1959 | 1956 | ||
| 1960 | if (ip->i_afp) | 1957 | ASSERT(!ip->i_afp); |
| 1961 | xfs_idestroy_fork(ip, XFS_ATTR_FORK); | ||
| 1962 | |||
| 1963 | ASSERT(ip->i_d.di_anextents == 0); | 1958 | ASSERT(ip->i_d.di_anextents == 0); |
| 1959 | ASSERT(ip->i_d.di_forkoff == 0); | ||
| 1964 | 1960 | ||
| 1965 | /* | 1961 | /* |
| 1966 | * Free the inode. | 1962 | * Free the inode. |
| @@ -2883,7 +2879,13 @@ xfs_rename_alloc_whiteout( | |||
| 2883 | if (error) | 2879 | if (error) |
| 2884 | return error; | 2880 | return error; |
| 2885 | 2881 | ||
| 2886 | /* Satisfy xfs_bumplink that this is a real tmpfile */ | 2882 | /* |
| 2883 | * Prepare the tmpfile inode as if it were created through the VFS. | ||
| 2884 | * Otherwise, the link increment paths will complain about nlink 0->1. | ||
| 2885 | * Drop the link count as done by d_tmpfile(), complete the inode setup | ||
| 2886 | * and flag it as linkable. | ||
| 2887 | */ | ||
| 2888 | drop_nlink(VFS_I(tmpfile)); | ||
| 2887 | xfs_finish_inode_setup(tmpfile); | 2889 | xfs_finish_inode_setup(tmpfile); |
| 2888 | VFS_I(tmpfile)->i_state |= I_LINKABLE; | 2890 | VFS_I(tmpfile)->i_state |= I_LINKABLE; |
| 2889 | 2891 | ||
| @@ -3151,7 +3153,7 @@ xfs_rename( | |||
| 3151 | * intermediate state on disk. | 3153 | * intermediate state on disk. |
| 3152 | */ | 3154 | */ |
| 3153 | if (wip) { | 3155 | if (wip) { |
| 3154 | ASSERT(wip->i_d.di_nlink == 0); | 3156 | ASSERT(VFS_I(wip)->i_nlink == 0 && wip->i_d.di_nlink == 0); |
| 3155 | error = xfs_bumplink(tp, wip); | 3157 | error = xfs_bumplink(tp, wip); |
| 3156 | if (error) | 3158 | if (error) |
| 3157 | goto out_trans_abort; | 3159 | goto out_trans_abort; |
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index 2ce7ee3b4ec1..6f23fbdfb365 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c | |||
| @@ -1084,14 +1084,18 @@ xfs_log_sbcount(xfs_mount_t *mp) | |||
| 1084 | return xfs_sync_sb(mp, true); | 1084 | return xfs_sync_sb(mp, true); |
| 1085 | } | 1085 | } |
| 1086 | 1086 | ||
| 1087 | /* | ||
| 1088 | * Deltas for the inode count are +/-64, hence we use a large batch size | ||
| 1089 | * of 128 so we don't need to take the counter lock on every update. | ||
| 1090 | */ | ||
| 1091 | #define XFS_ICOUNT_BATCH 128 | ||
| 1087 | int | 1092 | int |
| 1088 | xfs_mod_icount( | 1093 | xfs_mod_icount( |
| 1089 | struct xfs_mount *mp, | 1094 | struct xfs_mount *mp, |
| 1090 | int64_t delta) | 1095 | int64_t delta) |
| 1091 | { | 1096 | { |
| 1092 | /* deltas are +/-64, hence the large batch size of 128. */ | 1097 | __percpu_counter_add(&mp->m_icount, delta, XFS_ICOUNT_BATCH); |
| 1093 | __percpu_counter_add(&mp->m_icount, delta, 128); | 1098 | if (__percpu_counter_compare(&mp->m_icount, 0, XFS_ICOUNT_BATCH) < 0) { |
| 1094 | if (percpu_counter_compare(&mp->m_icount, 0) < 0) { | ||
| 1095 | ASSERT(0); | 1099 | ASSERT(0); |
| 1096 | percpu_counter_add(&mp->m_icount, -delta); | 1100 | percpu_counter_add(&mp->m_icount, -delta); |
| 1097 | return -EINVAL; | 1101 | return -EINVAL; |
| @@ -1113,6 +1117,14 @@ xfs_mod_ifree( | |||
| 1113 | return 0; | 1117 | return 0; |
| 1114 | } | 1118 | } |
| 1115 | 1119 | ||
| 1120 | /* | ||
| 1121 | * Deltas for the block count can vary from 1 to very large, but lock contention | ||
| 1122 | * only occurs on frequent small block count updates such as in the delayed | ||
| 1123 | * allocation path for buffered writes (page a time updates). Hence we set | ||
| 1124 | * a large batch count (1024) to minimise global counter updates except when | ||
| 1125 | * we get near to ENOSPC and we have to be very accurate with our updates. | ||
| 1126 | */ | ||
| 1127 | #define XFS_FDBLOCKS_BATCH 1024 | ||
| 1116 | int | 1128 | int |
| 1117 | xfs_mod_fdblocks( | 1129 | xfs_mod_fdblocks( |
| 1118 | struct xfs_mount *mp, | 1130 | struct xfs_mount *mp, |
| @@ -1151,25 +1163,19 @@ xfs_mod_fdblocks( | |||
| 1151 | * Taking blocks away, need to be more accurate the closer we | 1163 | * Taking blocks away, need to be more accurate the closer we |
| 1152 | * are to zero. | 1164 | * are to zero. |
| 1153 | * | 1165 | * |
| 1154 | * batch size is set to a maximum of 1024 blocks - if we are | ||
| 1155 | * allocating of freeing extents larger than this then we aren't | ||
| 1156 | * going to be hammering the counter lock so a lock per update | ||
| 1157 | * is not a problem. | ||
| 1158 | * | ||
| 1159 | * If the counter has a value of less than 2 * max batch size, | 1166 | * If the counter has a value of less than 2 * max batch size, |
| 1160 | * then make everything serialise as we are real close to | 1167 | * then make everything serialise as we are real close to |
| 1161 | * ENOSPC. | 1168 | * ENOSPC. |
| 1162 | */ | 1169 | */ |
| 1163 | #define __BATCH 1024 | 1170 | if (__percpu_counter_compare(&mp->m_fdblocks, 2 * XFS_FDBLOCKS_BATCH, |
| 1164 | if (percpu_counter_compare(&mp->m_fdblocks, 2 * __BATCH) < 0) | 1171 | XFS_FDBLOCKS_BATCH) < 0) |
| 1165 | batch = 1; | 1172 | batch = 1; |
| 1166 | else | 1173 | else |
| 1167 | batch = __BATCH; | 1174 | batch = XFS_FDBLOCKS_BATCH; |
| 1168 | #undef __BATCH | ||
| 1169 | 1175 | ||
| 1170 | __percpu_counter_add(&mp->m_fdblocks, delta, batch); | 1176 | __percpu_counter_add(&mp->m_fdblocks, delta, batch); |
| 1171 | if (percpu_counter_compare(&mp->m_fdblocks, | 1177 | if (__percpu_counter_compare(&mp->m_fdblocks, XFS_ALLOC_SET_ASIDE(mp), |
| 1172 | XFS_ALLOC_SET_ASIDE(mp)) >= 0) { | 1178 | XFS_FDBLOCKS_BATCH) >= 0) { |
| 1173 | /* we had space! */ | 1179 | /* we had space! */ |
| 1174 | return 0; | 1180 | return 0; |
| 1175 | } | 1181 | } |
diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h index ae2982c0f7a6..656da2a12ffe 100644 --- a/include/linux/brcmphy.h +++ b/include/linux/brcmphy.h | |||
| @@ -17,7 +17,7 @@ | |||
| 17 | #define PHY_ID_BCM7250 0xae025280 | 17 | #define PHY_ID_BCM7250 0xae025280 |
| 18 | #define PHY_ID_BCM7364 0xae025260 | 18 | #define PHY_ID_BCM7364 0xae025260 |
| 19 | #define PHY_ID_BCM7366 0x600d8490 | 19 | #define PHY_ID_BCM7366 0x600d8490 |
| 20 | #define PHY_ID_BCM7425 0x03625e60 | 20 | #define PHY_ID_BCM7425 0x600d86b0 |
| 21 | #define PHY_ID_BCM7429 0x600d8730 | 21 | #define PHY_ID_BCM7429 0x600d8730 |
| 22 | #define PHY_ID_BCM7439 0x600d8480 | 22 | #define PHY_ID_BCM7439 0x600d8480 |
| 23 | #define PHY_ID_BCM7439_2 0xae025080 | 23 | #define PHY_ID_BCM7439_2 0xae025080 |
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index 27e285b92b5f..59915ea5373c 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h | |||
| @@ -151,10 +151,8 @@ static inline unsigned int cpumask_any_but(const struct cpumask *mask, | |||
| 151 | return 1; | 151 | return 1; |
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | static inline int cpumask_set_cpu_local_first(int i, int numa_node, cpumask_t *dstp) | 154 | static inline unsigned int cpumask_local_spread(unsigned int i, int node) |
| 155 | { | 155 | { |
| 156 | set_bit(0, cpumask_bits(dstp)); | ||
| 157 | |||
| 158 | return 0; | 156 | return 0; |
| 159 | } | 157 | } |
| 160 | 158 | ||
| @@ -208,7 +206,7 @@ static inline unsigned int cpumask_next_zero(int n, const struct cpumask *srcp) | |||
| 208 | 206 | ||
| 209 | int cpumask_next_and(int n, const struct cpumask *, const struct cpumask *); | 207 | int cpumask_next_and(int n, const struct cpumask *, const struct cpumask *); |
| 210 | int cpumask_any_but(const struct cpumask *mask, unsigned int cpu); | 208 | int cpumask_any_but(const struct cpumask *mask, unsigned int cpu); |
| 211 | int cpumask_set_cpu_local_first(int i, int numa_node, cpumask_t *dstp); | 209 | unsigned int cpumask_local_spread(unsigned int i, int node); |
| 212 | 210 | ||
| 213 | /** | 211 | /** |
| 214 | * for_each_cpu - iterate over every cpu in a mask | 212 | * for_each_cpu - iterate over every cpu in a mask |
diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h index 50e50095c8d1..84a109449610 100644 --- a/include/linux/percpu_counter.h +++ b/include/linux/percpu_counter.h | |||
| @@ -41,7 +41,12 @@ void percpu_counter_destroy(struct percpu_counter *fbc); | |||
| 41 | void percpu_counter_set(struct percpu_counter *fbc, s64 amount); | 41 | void percpu_counter_set(struct percpu_counter *fbc, s64 amount); |
| 42 | void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch); | 42 | void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch); |
| 43 | s64 __percpu_counter_sum(struct percpu_counter *fbc); | 43 | s64 __percpu_counter_sum(struct percpu_counter *fbc); |
| 44 | int percpu_counter_compare(struct percpu_counter *fbc, s64 rhs); | 44 | int __percpu_counter_compare(struct percpu_counter *fbc, s64 rhs, s32 batch); |
| 45 | |||
| 46 | static inline int percpu_counter_compare(struct percpu_counter *fbc, s64 rhs) | ||
| 47 | { | ||
| 48 | return __percpu_counter_compare(fbc, rhs, percpu_counter_batch); | ||
| 49 | } | ||
| 45 | 50 | ||
| 46 | static inline void percpu_counter_add(struct percpu_counter *fbc, s64 amount) | 51 | static inline void percpu_counter_add(struct percpu_counter *fbc, s64 amount) |
| 47 | { | 52 | { |
| @@ -116,6 +121,12 @@ static inline int percpu_counter_compare(struct percpu_counter *fbc, s64 rhs) | |||
| 116 | return 0; | 121 | return 0; |
| 117 | } | 122 | } |
| 118 | 123 | ||
| 124 | static inline int | ||
| 125 | __percpu_counter_compare(struct percpu_counter *fbc, s64 rhs, s32 batch) | ||
| 126 | { | ||
| 127 | return percpu_counter_compare(fbc, rhs); | ||
| 128 | } | ||
| 129 | |||
| 119 | static inline void | 130 | static inline void |
| 120 | percpu_counter_add(struct percpu_counter *fbc, s64 amount) | 131 | percpu_counter_add(struct percpu_counter *fbc, s64 amount) |
| 121 | { | 132 | { |
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index c56a438c3a1e..ce13cf20f625 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h | |||
| @@ -574,11 +574,14 @@ static inline void sctp_v6_map_v4(union sctp_addr *addr) | |||
| 574 | /* Map v4 address to v4-mapped v6 address */ | 574 | /* Map v4 address to v4-mapped v6 address */ |
| 575 | static inline void sctp_v4_map_v6(union sctp_addr *addr) | 575 | static inline void sctp_v4_map_v6(union sctp_addr *addr) |
| 576 | { | 576 | { |
| 577 | __be16 port; | ||
| 578 | |||
| 579 | port = addr->v4.sin_port; | ||
| 580 | addr->v6.sin6_addr.s6_addr32[3] = addr->v4.sin_addr.s_addr; | ||
| 581 | addr->v6.sin6_port = port; | ||
| 577 | addr->v6.sin6_family = AF_INET6; | 582 | addr->v6.sin6_family = AF_INET6; |
| 578 | addr->v6.sin6_flowinfo = 0; | 583 | addr->v6.sin6_flowinfo = 0; |
| 579 | addr->v6.sin6_scope_id = 0; | 584 | addr->v6.sin6_scope_id = 0; |
| 580 | addr->v6.sin6_port = addr->v4.sin_port; | ||
| 581 | addr->v6.sin6_addr.s6_addr32[3] = addr->v4.sin_addr.s_addr; | ||
| 582 | addr->v6.sin6_addr.s6_addr32[0] = 0; | 585 | addr->v6.sin6_addr.s6_addr32[0] = 0; |
| 583 | addr->v6.sin6_addr.s6_addr32[1] = 0; | 586 | addr->v6.sin6_addr.s6_addr32[1] = 0; |
| 584 | addr->v6.sin6_addr.s6_addr32[2] = htonl(0x0000ffff); | 587 | addr->v6.sin6_addr.s6_addr32[2] = htonl(0x0000ffff); |
diff --git a/include/trace/events/kmem.h b/include/trace/events/kmem.h index 81ea59812117..f7554fd7fc62 100644 --- a/include/trace/events/kmem.h +++ b/include/trace/events/kmem.h | |||
| @@ -140,19 +140,42 @@ DEFINE_EVENT(kmem_free, kfree, | |||
| 140 | TP_ARGS(call_site, ptr) | 140 | TP_ARGS(call_site, ptr) |
| 141 | ); | 141 | ); |
| 142 | 142 | ||
| 143 | DEFINE_EVENT(kmem_free, kmem_cache_free, | 143 | DEFINE_EVENT_CONDITION(kmem_free, kmem_cache_free, |
| 144 | 144 | ||
| 145 | TP_PROTO(unsigned long call_site, const void *ptr), | 145 | TP_PROTO(unsigned long call_site, const void *ptr), |
| 146 | 146 | ||
| 147 | TP_ARGS(call_site, ptr) | 147 | TP_ARGS(call_site, ptr), |
| 148 | |||
| 149 | /* | ||
| 150 | * This trace can be potentially called from an offlined cpu. | ||
| 151 | * Since trace points use RCU and RCU should not be used from | ||
| 152 | * offline cpus, filter such calls out. | ||
| 153 | * While this trace can be called from a preemptable section, | ||
| 154 | * it has no impact on the condition since tasks can migrate | ||
| 155 | * only from online cpus to other online cpus. Thus its safe | ||
| 156 | * to use raw_smp_processor_id. | ||
| 157 | */ | ||
| 158 | TP_CONDITION(cpu_online(raw_smp_processor_id())) | ||
| 148 | ); | 159 | ); |
| 149 | 160 | ||
| 150 | TRACE_EVENT(mm_page_free, | 161 | TRACE_EVENT_CONDITION(mm_page_free, |
| 151 | 162 | ||
| 152 | TP_PROTO(struct page *page, unsigned int order), | 163 | TP_PROTO(struct page *page, unsigned int order), |
| 153 | 164 | ||
| 154 | TP_ARGS(page, order), | 165 | TP_ARGS(page, order), |
| 155 | 166 | ||
| 167 | |||
| 168 | /* | ||
| 169 | * This trace can be potentially called from an offlined cpu. | ||
| 170 | * Since trace points use RCU and RCU should not be used from | ||
| 171 | * offline cpus, filter such calls out. | ||
| 172 | * While this trace can be called from a preemptable section, | ||
| 173 | * it has no impact on the condition since tasks can migrate | ||
| 174 | * only from online cpus to other online cpus. Thus its safe | ||
| 175 | * to use raw_smp_processor_id. | ||
| 176 | */ | ||
| 177 | TP_CONDITION(cpu_online(raw_smp_processor_id())), | ||
| 178 | |||
| 156 | TP_STRUCT__entry( | 179 | TP_STRUCT__entry( |
| 157 | __field( unsigned long, pfn ) | 180 | __field( unsigned long, pfn ) |
| 158 | __field( unsigned int, order ) | 181 | __field( unsigned int, order ) |
| @@ -253,12 +276,35 @@ DEFINE_EVENT(mm_page, mm_page_alloc_zone_locked, | |||
| 253 | TP_ARGS(page, order, migratetype) | 276 | TP_ARGS(page, order, migratetype) |
| 254 | ); | 277 | ); |
| 255 | 278 | ||
| 256 | DEFINE_EVENT_PRINT(mm_page, mm_page_pcpu_drain, | 279 | TRACE_EVENT_CONDITION(mm_page_pcpu_drain, |
| 257 | 280 | ||
| 258 | TP_PROTO(struct page *page, unsigned int order, int migratetype), | 281 | TP_PROTO(struct page *page, unsigned int order, int migratetype), |
| 259 | 282 | ||
| 260 | TP_ARGS(page, order, migratetype), | 283 | TP_ARGS(page, order, migratetype), |
| 261 | 284 | ||
| 285 | /* | ||
| 286 | * This trace can be potentially called from an offlined cpu. | ||
| 287 | * Since trace points use RCU and RCU should not be used from | ||
| 288 | * offline cpus, filter such calls out. | ||
| 289 | * While this trace can be called from a preemptable section, | ||
| 290 | * it has no impact on the condition since tasks can migrate | ||
| 291 | * only from online cpus to other online cpus. Thus its safe | ||
| 292 | * to use raw_smp_processor_id. | ||
| 293 | */ | ||
| 294 | TP_CONDITION(cpu_online(raw_smp_processor_id())), | ||
| 295 | |||
| 296 | TP_STRUCT__entry( | ||
| 297 | __field( unsigned long, pfn ) | ||
| 298 | __field( unsigned int, order ) | ||
| 299 | __field( int, migratetype ) | ||
| 300 | ), | ||
| 301 | |||
| 302 | TP_fast_assign( | ||
| 303 | __entry->pfn = page ? page_to_pfn(page) : -1UL; | ||
| 304 | __entry->order = order; | ||
| 305 | __entry->migratetype = migratetype; | ||
| 306 | ), | ||
| 307 | |||
| 262 | TP_printk("page=%p pfn=%lu order=%d migratetype=%d", | 308 | TP_printk("page=%p pfn=%lu order=%d migratetype=%d", |
| 263 | pfn_to_page(__entry->pfn), __entry->pfn, | 309 | pfn_to_page(__entry->pfn), __entry->pfn, |
| 264 | __entry->order, __entry->migratetype) | 310 | __entry->order, __entry->migratetype) |
diff --git a/kernel/module.c b/kernel/module.c index 42a1d2afb217..cfc9e843a924 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
| @@ -3370,6 +3370,9 @@ static int load_module(struct load_info *info, const char __user *uargs, | |||
| 3370 | module_bug_cleanup(mod); | 3370 | module_bug_cleanup(mod); |
| 3371 | mutex_unlock(&module_mutex); | 3371 | mutex_unlock(&module_mutex); |
| 3372 | 3372 | ||
| 3373 | blocking_notifier_call_chain(&module_notify_list, | ||
| 3374 | MODULE_STATE_GOING, mod); | ||
| 3375 | |||
| 3373 | /* we can't deallocate the module until we clear memory protection */ | 3376 | /* we can't deallocate the module until we clear memory protection */ |
| 3374 | unset_module_init_ro_nx(mod); | 3377 | unset_module_init_ro_nx(mod); |
| 3375 | unset_module_core_ro_nx(mod); | 3378 | unset_module_core_ro_nx(mod); |
diff --git a/lib/cpumask.c b/lib/cpumask.c index 830dd5dec40f..5f627084f2e9 100644 --- a/lib/cpumask.c +++ b/lib/cpumask.c | |||
| @@ -139,64 +139,42 @@ void __init free_bootmem_cpumask_var(cpumask_var_t mask) | |||
| 139 | #endif | 139 | #endif |
| 140 | 140 | ||
| 141 | /** | 141 | /** |
| 142 | * cpumask_set_cpu_local_first - set i'th cpu with local numa cpu's first | 142 | * cpumask_local_spread - select the i'th cpu with local numa cpu's first |
| 143 | * | ||
| 144 | * @i: index number | 143 | * @i: index number |
| 145 | * @numa_node: local numa_node | 144 | * @node: local numa_node |
| 146 | * @dstp: cpumask with the relevant cpu bit set according to the policy | ||
| 147 | * | 145 | * |
| 148 | * This function sets the cpumask according to a numa aware policy. | 146 | * This function selects an online CPU according to a numa aware policy; |
| 149 | * cpumask could be used as an affinity hint for the IRQ related to a | 147 | * local cpus are returned first, followed by non-local ones, then it |
| 150 | * queue. When the policy is to spread queues across cores - local cores | 148 | * wraps around. |
| 151 | * first. | ||
| 152 | * | 149 | * |
| 153 | * Returns 0 on success, -ENOMEM for no memory, and -EAGAIN when failed to set | 150 | * It's not very efficient, but useful for setup. |
| 154 | * the cpu bit and need to re-call the function. | ||
| 155 | */ | 151 | */ |
| 156 | int cpumask_set_cpu_local_first(int i, int numa_node, cpumask_t *dstp) | 152 | unsigned int cpumask_local_spread(unsigned int i, int node) |
| 157 | { | 153 | { |
| 158 | cpumask_var_t mask; | ||
| 159 | int cpu; | 154 | int cpu; |
| 160 | int ret = 0; | ||
| 161 | |||
| 162 | if (!zalloc_cpumask_var(&mask, GFP_KERNEL)) | ||
| 163 | return -ENOMEM; | ||
| 164 | 155 | ||
| 156 | /* Wrap: we always want a cpu. */ | ||
| 165 | i %= num_online_cpus(); | 157 | i %= num_online_cpus(); |
| 166 | 158 | ||
| 167 | if (numa_node == -1 || !cpumask_of_node(numa_node)) { | 159 | if (node == -1) { |
| 168 | /* Use all online cpu's for non numa aware system */ | 160 | for_each_cpu(cpu, cpu_online_mask) |
| 169 | cpumask_copy(mask, cpu_online_mask); | 161 | if (i-- == 0) |
| 162 | return cpu; | ||
| 170 | } else { | 163 | } else { |
| 171 | int n; | 164 | /* NUMA first. */ |
| 172 | 165 | for_each_cpu_and(cpu, cpumask_of_node(node), cpu_online_mask) | |
| 173 | cpumask_and(mask, | 166 | if (i-- == 0) |
| 174 | cpumask_of_node(numa_node), cpu_online_mask); | 167 | return cpu; |
| 175 | 168 | ||
| 176 | n = cpumask_weight(mask); | 169 | for_each_cpu(cpu, cpu_online_mask) { |
| 177 | if (i >= n) { | 170 | /* Skip NUMA nodes, done above. */ |
| 178 | i -= n; | 171 | if (cpumask_test_cpu(cpu, cpumask_of_node(node))) |
| 179 | 172 | continue; | |
| 180 | /* If index > number of local cpu's, mask out local | 173 | |
| 181 | * cpu's | 174 | if (i-- == 0) |
| 182 | */ | 175 | return cpu; |
| 183 | cpumask_andnot(mask, cpu_online_mask, mask); | ||
| 184 | } | 176 | } |
| 185 | } | 177 | } |
| 186 | 178 | BUG(); | |
| 187 | for_each_cpu(cpu, mask) { | ||
| 188 | if (--i < 0) | ||
| 189 | goto out; | ||
| 190 | } | ||
| 191 | |||
| 192 | ret = -EAGAIN; | ||
| 193 | |||
| 194 | out: | ||
| 195 | free_cpumask_var(mask); | ||
| 196 | |||
| 197 | if (!ret) | ||
| 198 | cpumask_set_cpu(cpu, dstp); | ||
| 199 | |||
| 200 | return ret; | ||
| 201 | } | 179 | } |
| 202 | EXPORT_SYMBOL(cpumask_set_cpu_local_first); | 180 | EXPORT_SYMBOL(cpumask_local_spread); |
diff --git a/lib/percpu_counter.c b/lib/percpu_counter.c index 48144cdae819..f051d69f0910 100644 --- a/lib/percpu_counter.c +++ b/lib/percpu_counter.c | |||
| @@ -197,13 +197,13 @@ static int percpu_counter_hotcpu_callback(struct notifier_block *nb, | |||
| 197 | * Compare counter against given value. | 197 | * Compare counter against given value. |
| 198 | * Return 1 if greater, 0 if equal and -1 if less | 198 | * Return 1 if greater, 0 if equal and -1 if less |
| 199 | */ | 199 | */ |
| 200 | int percpu_counter_compare(struct percpu_counter *fbc, s64 rhs) | 200 | int __percpu_counter_compare(struct percpu_counter *fbc, s64 rhs, s32 batch) |
| 201 | { | 201 | { |
| 202 | s64 count; | 202 | s64 count; |
| 203 | 203 | ||
| 204 | count = percpu_counter_read(fbc); | 204 | count = percpu_counter_read(fbc); |
| 205 | /* Check to see if rough count will be sufficient for comparison */ | 205 | /* Check to see if rough count will be sufficient for comparison */ |
| 206 | if (abs(count - rhs) > (percpu_counter_batch*num_online_cpus())) { | 206 | if (abs(count - rhs) > (batch * num_online_cpus())) { |
| 207 | if (count > rhs) | 207 | if (count > rhs) |
| 208 | return 1; | 208 | return 1; |
| 209 | else | 209 | else |
| @@ -218,7 +218,7 @@ int percpu_counter_compare(struct percpu_counter *fbc, s64 rhs) | |||
| 218 | else | 218 | else |
| 219 | return 0; | 219 | return 0; |
| 220 | } | 220 | } |
| 221 | EXPORT_SYMBOL(percpu_counter_compare); | 221 | EXPORT_SYMBOL(__percpu_counter_compare); |
| 222 | 222 | ||
| 223 | static int __init percpu_counter_startup(void) | 223 | static int __init percpu_counter_startup(void) |
| 224 | { | 224 | { |
diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c index 4ec0c803aef1..112ad784838a 100644 --- a/net/caif/caif_socket.c +++ b/net/caif/caif_socket.c | |||
| @@ -330,6 +330,10 @@ static long caif_stream_data_wait(struct sock *sk, long timeo) | |||
| 330 | release_sock(sk); | 330 | release_sock(sk); |
| 331 | timeo = schedule_timeout(timeo); | 331 | timeo = schedule_timeout(timeo); |
| 332 | lock_sock(sk); | 332 | lock_sock(sk); |
| 333 | |||
| 334 | if (sock_flag(sk, SOCK_DEAD)) | ||
| 335 | break; | ||
| 336 | |||
| 333 | clear_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags); | 337 | clear_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags); |
| 334 | } | 338 | } |
| 335 | 339 | ||
| @@ -373,6 +377,10 @@ static int caif_stream_recvmsg(struct socket *sock, struct msghdr *msg, | |||
| 373 | struct sk_buff *skb; | 377 | struct sk_buff *skb; |
| 374 | 378 | ||
| 375 | lock_sock(sk); | 379 | lock_sock(sk); |
| 380 | if (sock_flag(sk, SOCK_DEAD)) { | ||
| 381 | err = -ECONNRESET; | ||
| 382 | goto unlock; | ||
| 383 | } | ||
| 376 | skb = skb_dequeue(&sk->sk_receive_queue); | 384 | skb = skb_dequeue(&sk->sk_receive_queue); |
| 377 | caif_check_flow_release(sk); | 385 | caif_check_flow_release(sk); |
| 378 | 386 | ||
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 265e42721a66..ff347a0eebd4 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
| @@ -2495,51 +2495,22 @@ static bool ieee80211_coalesce_started_roc(struct ieee80211_local *local, | |||
| 2495 | struct ieee80211_roc_work *new_roc, | 2495 | struct ieee80211_roc_work *new_roc, |
| 2496 | struct ieee80211_roc_work *cur_roc) | 2496 | struct ieee80211_roc_work *cur_roc) |
| 2497 | { | 2497 | { |
| 2498 | unsigned long j = jiffies; | 2498 | unsigned long now = jiffies; |
| 2499 | unsigned long cur_roc_end = cur_roc->hw_start_time + | 2499 | unsigned long remaining = cur_roc->hw_start_time + |
| 2500 | msecs_to_jiffies(cur_roc->duration); | 2500 | msecs_to_jiffies(cur_roc->duration) - |
| 2501 | struct ieee80211_roc_work *next_roc; | 2501 | now; |
| 2502 | int new_dur; | ||
| 2503 | 2502 | ||
| 2504 | if (WARN_ON(!cur_roc->started || !cur_roc->hw_begun)) | 2503 | if (WARN_ON(!cur_roc->started || !cur_roc->hw_begun)) |
| 2505 | return false; | 2504 | return false; |
| 2506 | 2505 | ||
| 2507 | if (time_after(j + IEEE80211_ROC_MIN_LEFT, cur_roc_end)) | 2506 | /* if it doesn't fit entirely, schedule a new one */ |
| 2507 | if (new_roc->duration > jiffies_to_msecs(remaining)) | ||
| 2508 | return false; | 2508 | return false; |
| 2509 | 2509 | ||
| 2510 | ieee80211_handle_roc_started(new_roc); | 2510 | ieee80211_handle_roc_started(new_roc); |
| 2511 | 2511 | ||
| 2512 | new_dur = new_roc->duration - jiffies_to_msecs(cur_roc_end - j); | 2512 | /* add to dependents so we send the expired event properly */ |
| 2513 | 2513 | list_add_tail(&new_roc->list, &cur_roc->dependents); | |
| 2514 | /* cur_roc is long enough - add new_roc to the dependents list. */ | ||
| 2515 | if (new_dur <= 0) { | ||
| 2516 | list_add_tail(&new_roc->list, &cur_roc->dependents); | ||
| 2517 | return true; | ||
| 2518 | } | ||
| 2519 | |||
| 2520 | new_roc->duration = new_dur; | ||
| 2521 | |||
| 2522 | /* | ||
| 2523 | * if cur_roc was already coalesced before, we might | ||
| 2524 | * want to extend the next roc instead of adding | ||
| 2525 | * a new one. | ||
| 2526 | */ | ||
| 2527 | next_roc = list_entry(cur_roc->list.next, | ||
| 2528 | struct ieee80211_roc_work, list); | ||
| 2529 | if (&next_roc->list != &local->roc_list && | ||
| 2530 | next_roc->chan == new_roc->chan && | ||
| 2531 | next_roc->sdata == new_roc->sdata && | ||
| 2532 | !WARN_ON(next_roc->started)) { | ||
| 2533 | list_add_tail(&new_roc->list, &next_roc->dependents); | ||
| 2534 | next_roc->duration = max(next_roc->duration, | ||
| 2535 | new_roc->duration); | ||
| 2536 | next_roc->type = max(next_roc->type, new_roc->type); | ||
| 2537 | return true; | ||
| 2538 | } | ||
| 2539 | |||
| 2540 | /* add right after cur_roc */ | ||
| 2541 | list_add(&new_roc->list, &cur_roc->list); | ||
| 2542 | |||
| 2543 | return true; | 2514 | return true; |
| 2544 | } | 2515 | } |
| 2545 | 2516 | ||
| @@ -2652,17 +2623,9 @@ static int ieee80211_start_roc_work(struct ieee80211_local *local, | |||
| 2652 | * In the offloaded ROC case, if it hasn't begun, add | 2623 | * In the offloaded ROC case, if it hasn't begun, add |
| 2653 | * this new one to the dependent list to be handled | 2624 | * this new one to the dependent list to be handled |
| 2654 | * when the master one begins. If it has begun, | 2625 | * when the master one begins. If it has begun, |
| 2655 | * check that there's still a minimum time left and | 2626 | * check if it fits entirely within the existing one, |
| 2656 | * if so, start this one, transmitting the frame, but | 2627 | * in which case it will just be dependent as well. |
| 2657 | * add it to the list directly after this one with | 2628 | * Otherwise, schedule it by itself. |
| 2658 | * a reduced time so we'll ask the driver to execute | ||
| 2659 | * it right after finishing the previous one, in the | ||
| 2660 | * hope that it'll also be executed right afterwards, | ||
| 2661 | * effectively extending the old one. | ||
| 2662 | * If there's no minimum time left, just add it to the | ||
| 2663 | * normal list. | ||
| 2664 | * TODO: the ROC type is ignored here, assuming that it | ||
| 2665 | * is better to immediately use the current ROC. | ||
| 2666 | */ | 2629 | */ |
| 2667 | if (!tmp->hw_begun) { | 2630 | if (!tmp->hw_begun) { |
| 2668 | list_add_tail(&roc->list, &tmp->dependents); | 2631 | list_add_tail(&roc->list, &tmp->dependents); |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index ab46ab4a7249..c0a9187bc3a9 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
| @@ -205,6 +205,8 @@ enum ieee80211_packet_rx_flags { | |||
| 205 | * @IEEE80211_RX_CMNTR: received on cooked monitor already | 205 | * @IEEE80211_RX_CMNTR: received on cooked monitor already |
| 206 | * @IEEE80211_RX_BEACON_REPORTED: This frame was already reported | 206 | * @IEEE80211_RX_BEACON_REPORTED: This frame was already reported |
| 207 | * to cfg80211_report_obss_beacon(). | 207 | * to cfg80211_report_obss_beacon(). |
| 208 | * @IEEE80211_RX_REORDER_TIMER: this frame is released by the | ||
| 209 | * reorder buffer timeout timer, not the normal RX path | ||
| 208 | * | 210 | * |
| 209 | * These flags are used across handling multiple interfaces | 211 | * These flags are used across handling multiple interfaces |
| 210 | * for a single frame. | 212 | * for a single frame. |
| @@ -212,6 +214,7 @@ enum ieee80211_packet_rx_flags { | |||
| 212 | enum ieee80211_rx_flags { | 214 | enum ieee80211_rx_flags { |
| 213 | IEEE80211_RX_CMNTR = BIT(0), | 215 | IEEE80211_RX_CMNTR = BIT(0), |
| 214 | IEEE80211_RX_BEACON_REPORTED = BIT(1), | 216 | IEEE80211_RX_BEACON_REPORTED = BIT(1), |
| 217 | IEEE80211_RX_REORDER_TIMER = BIT(2), | ||
| 215 | }; | 218 | }; |
| 216 | 219 | ||
| 217 | struct ieee80211_rx_data { | 220 | struct ieee80211_rx_data { |
| @@ -325,12 +328,6 @@ struct mesh_preq_queue { | |||
| 325 | u8 flags; | 328 | u8 flags; |
| 326 | }; | 329 | }; |
| 327 | 330 | ||
| 328 | #if HZ/100 == 0 | ||
| 329 | #define IEEE80211_ROC_MIN_LEFT 1 | ||
| 330 | #else | ||
| 331 | #define IEEE80211_ROC_MIN_LEFT (HZ/100) | ||
| 332 | #endif | ||
| 333 | |||
| 334 | struct ieee80211_roc_work { | 331 | struct ieee80211_roc_work { |
| 335 | struct list_head list; | 332 | struct list_head list; |
| 336 | struct list_head dependents; | 333 | struct list_head dependents; |
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index bab5c63c0bad..84cef600c573 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c | |||
| @@ -522,6 +522,12 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up) | |||
| 522 | memcpy(sdata->vif.hw_queue, master->vif.hw_queue, | 522 | memcpy(sdata->vif.hw_queue, master->vif.hw_queue, |
| 523 | sizeof(sdata->vif.hw_queue)); | 523 | sizeof(sdata->vif.hw_queue)); |
| 524 | sdata->vif.bss_conf.chandef = master->vif.bss_conf.chandef; | 524 | sdata->vif.bss_conf.chandef = master->vif.bss_conf.chandef; |
| 525 | |||
| 526 | mutex_lock(&local->key_mtx); | ||
| 527 | sdata->crypto_tx_tailroom_needed_cnt += | ||
| 528 | master->crypto_tx_tailroom_needed_cnt; | ||
| 529 | mutex_unlock(&local->key_mtx); | ||
| 530 | |||
| 525 | break; | 531 | break; |
| 526 | } | 532 | } |
| 527 | case NL80211_IFTYPE_AP: | 533 | case NL80211_IFTYPE_AP: |
diff --git a/net/mac80211/key.c b/net/mac80211/key.c index 2291cd730091..a907f2d5c12d 100644 --- a/net/mac80211/key.c +++ b/net/mac80211/key.c | |||
| @@ -58,6 +58,22 @@ static void assert_key_lock(struct ieee80211_local *local) | |||
| 58 | lockdep_assert_held(&local->key_mtx); | 58 | lockdep_assert_held(&local->key_mtx); |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | static void | ||
| 62 | update_vlan_tailroom_need_count(struct ieee80211_sub_if_data *sdata, int delta) | ||
| 63 | { | ||
| 64 | struct ieee80211_sub_if_data *vlan; | ||
| 65 | |||
| 66 | if (sdata->vif.type != NL80211_IFTYPE_AP) | ||
| 67 | return; | ||
| 68 | |||
| 69 | mutex_lock(&sdata->local->mtx); | ||
| 70 | |||
| 71 | list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list) | ||
| 72 | vlan->crypto_tx_tailroom_needed_cnt += delta; | ||
| 73 | |||
| 74 | mutex_unlock(&sdata->local->mtx); | ||
| 75 | } | ||
| 76 | |||
| 61 | static void increment_tailroom_need_count(struct ieee80211_sub_if_data *sdata) | 77 | static void increment_tailroom_need_count(struct ieee80211_sub_if_data *sdata) |
| 62 | { | 78 | { |
| 63 | /* | 79 | /* |
| @@ -79,6 +95,8 @@ static void increment_tailroom_need_count(struct ieee80211_sub_if_data *sdata) | |||
| 79 | * http://mid.gmane.org/1308590980.4322.19.camel@jlt3.sipsolutions.net | 95 | * http://mid.gmane.org/1308590980.4322.19.camel@jlt3.sipsolutions.net |
| 80 | */ | 96 | */ |
| 81 | 97 | ||
| 98 | update_vlan_tailroom_need_count(sdata, 1); | ||
| 99 | |||
| 82 | if (!sdata->crypto_tx_tailroom_needed_cnt++) { | 100 | if (!sdata->crypto_tx_tailroom_needed_cnt++) { |
| 83 | /* | 101 | /* |
| 84 | * Flush all XMIT packets currently using HW encryption or no | 102 | * Flush all XMIT packets currently using HW encryption or no |
| @@ -88,6 +106,15 @@ static void increment_tailroom_need_count(struct ieee80211_sub_if_data *sdata) | |||
| 88 | } | 106 | } |
| 89 | } | 107 | } |
| 90 | 108 | ||
| 109 | static void decrease_tailroom_need_count(struct ieee80211_sub_if_data *sdata, | ||
| 110 | int delta) | ||
| 111 | { | ||
| 112 | WARN_ON_ONCE(sdata->crypto_tx_tailroom_needed_cnt < delta); | ||
| 113 | |||
| 114 | update_vlan_tailroom_need_count(sdata, -delta); | ||
| 115 | sdata->crypto_tx_tailroom_needed_cnt -= delta; | ||
| 116 | } | ||
| 117 | |||
| 91 | static int ieee80211_key_enable_hw_accel(struct ieee80211_key *key) | 118 | static int ieee80211_key_enable_hw_accel(struct ieee80211_key *key) |
| 92 | { | 119 | { |
| 93 | struct ieee80211_sub_if_data *sdata; | 120 | struct ieee80211_sub_if_data *sdata; |
| @@ -144,7 +171,7 @@ static int ieee80211_key_enable_hw_accel(struct ieee80211_key *key) | |||
| 144 | 171 | ||
| 145 | if (!((key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC) || | 172 | if (!((key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_MMIC) || |
| 146 | (key->conf.flags & IEEE80211_KEY_FLAG_RESERVE_TAILROOM))) | 173 | (key->conf.flags & IEEE80211_KEY_FLAG_RESERVE_TAILROOM))) |
| 147 | sdata->crypto_tx_tailroom_needed_cnt--; | 174 | decrease_tailroom_need_count(sdata, 1); |
| 148 | 175 | ||
| 149 | WARN_ON((key->conf.flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE) && | 176 | WARN_ON((key->conf.flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE) && |
| 150 | (key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)); | 177 | (key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)); |
| @@ -541,7 +568,7 @@ static void __ieee80211_key_destroy(struct ieee80211_key *key, | |||
| 541 | schedule_delayed_work(&sdata->dec_tailroom_needed_wk, | 568 | schedule_delayed_work(&sdata->dec_tailroom_needed_wk, |
| 542 | HZ/2); | 569 | HZ/2); |
| 543 | } else { | 570 | } else { |
| 544 | sdata->crypto_tx_tailroom_needed_cnt--; | 571 | decrease_tailroom_need_count(sdata, 1); |
| 545 | } | 572 | } |
| 546 | } | 573 | } |
| 547 | 574 | ||
| @@ -631,6 +658,7 @@ void ieee80211_key_free(struct ieee80211_key *key, bool delay_tailroom) | |||
| 631 | void ieee80211_enable_keys(struct ieee80211_sub_if_data *sdata) | 658 | void ieee80211_enable_keys(struct ieee80211_sub_if_data *sdata) |
| 632 | { | 659 | { |
| 633 | struct ieee80211_key *key; | 660 | struct ieee80211_key *key; |
| 661 | struct ieee80211_sub_if_data *vlan; | ||
| 634 | 662 | ||
| 635 | ASSERT_RTNL(); | 663 | ASSERT_RTNL(); |
| 636 | 664 | ||
| @@ -639,7 +667,14 @@ void ieee80211_enable_keys(struct ieee80211_sub_if_data *sdata) | |||
| 639 | 667 | ||
| 640 | mutex_lock(&sdata->local->key_mtx); | 668 | mutex_lock(&sdata->local->key_mtx); |
| 641 | 669 | ||
| 642 | sdata->crypto_tx_tailroom_needed_cnt = 0; | 670 | WARN_ON_ONCE(sdata->crypto_tx_tailroom_needed_cnt || |
| 671 | sdata->crypto_tx_tailroom_pending_dec); | ||
| 672 | |||
| 673 | if (sdata->vif.type == NL80211_IFTYPE_AP) { | ||
| 674 | list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list) | ||
| 675 | WARN_ON_ONCE(vlan->crypto_tx_tailroom_needed_cnt || | ||
| 676 | vlan->crypto_tx_tailroom_pending_dec); | ||
| 677 | } | ||
| 643 | 678 | ||
| 644 | list_for_each_entry(key, &sdata->key_list, list) { | 679 | list_for_each_entry(key, &sdata->key_list, list) { |
| 645 | increment_tailroom_need_count(sdata); | 680 | increment_tailroom_need_count(sdata); |
| @@ -649,6 +684,22 @@ void ieee80211_enable_keys(struct ieee80211_sub_if_data *sdata) | |||
| 649 | mutex_unlock(&sdata->local->key_mtx); | 684 | mutex_unlock(&sdata->local->key_mtx); |
| 650 | } | 685 | } |
| 651 | 686 | ||
| 687 | void ieee80211_reset_crypto_tx_tailroom(struct ieee80211_sub_if_data *sdata) | ||
| 688 | { | ||
| 689 | struct ieee80211_sub_if_data *vlan; | ||
| 690 | |||
| 691 | mutex_lock(&sdata->local->key_mtx); | ||
| 692 | |||
| 693 | sdata->crypto_tx_tailroom_needed_cnt = 0; | ||
| 694 | |||
| 695 | if (sdata->vif.type == NL80211_IFTYPE_AP) { | ||
| 696 | list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list) | ||
| 697 | vlan->crypto_tx_tailroom_needed_cnt = 0; | ||
| 698 | } | ||
| 699 | |||
| 700 | mutex_unlock(&sdata->local->key_mtx); | ||
| 701 | } | ||
| 702 | |||
| 652 | void ieee80211_iter_keys(struct ieee80211_hw *hw, | 703 | void ieee80211_iter_keys(struct ieee80211_hw *hw, |
| 653 | struct ieee80211_vif *vif, | 704 | struct ieee80211_vif *vif, |
| 654 | void (*iter)(struct ieee80211_hw *hw, | 705 | void (*iter)(struct ieee80211_hw *hw, |
| @@ -688,8 +739,8 @@ static void ieee80211_free_keys_iface(struct ieee80211_sub_if_data *sdata, | |||
| 688 | { | 739 | { |
| 689 | struct ieee80211_key *key, *tmp; | 740 | struct ieee80211_key *key, *tmp; |
| 690 | 741 | ||
| 691 | sdata->crypto_tx_tailroom_needed_cnt -= | 742 | decrease_tailroom_need_count(sdata, |
| 692 | sdata->crypto_tx_tailroom_pending_dec; | 743 | sdata->crypto_tx_tailroom_pending_dec); |
| 693 | sdata->crypto_tx_tailroom_pending_dec = 0; | 744 | sdata->crypto_tx_tailroom_pending_dec = 0; |
| 694 | 745 | ||
| 695 | ieee80211_debugfs_key_remove_mgmt_default(sdata); | 746 | ieee80211_debugfs_key_remove_mgmt_default(sdata); |
| @@ -709,6 +760,7 @@ void ieee80211_free_keys(struct ieee80211_sub_if_data *sdata, | |||
| 709 | { | 760 | { |
| 710 | struct ieee80211_local *local = sdata->local; | 761 | struct ieee80211_local *local = sdata->local; |
| 711 | struct ieee80211_sub_if_data *vlan; | 762 | struct ieee80211_sub_if_data *vlan; |
| 763 | struct ieee80211_sub_if_data *master; | ||
| 712 | struct ieee80211_key *key, *tmp; | 764 | struct ieee80211_key *key, *tmp; |
| 713 | LIST_HEAD(keys); | 765 | LIST_HEAD(keys); |
| 714 | 766 | ||
| @@ -728,8 +780,20 @@ void ieee80211_free_keys(struct ieee80211_sub_if_data *sdata, | |||
| 728 | list_for_each_entry_safe(key, tmp, &keys, list) | 780 | list_for_each_entry_safe(key, tmp, &keys, list) |
| 729 | __ieee80211_key_destroy(key, false); | 781 | __ieee80211_key_destroy(key, false); |
| 730 | 782 | ||
| 731 | WARN_ON_ONCE(sdata->crypto_tx_tailroom_needed_cnt || | 783 | if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) { |
| 732 | sdata->crypto_tx_tailroom_pending_dec); | 784 | if (sdata->bss) { |
| 785 | master = container_of(sdata->bss, | ||
| 786 | struct ieee80211_sub_if_data, | ||
| 787 | u.ap); | ||
| 788 | |||
| 789 | WARN_ON_ONCE(sdata->crypto_tx_tailroom_needed_cnt != | ||
| 790 | master->crypto_tx_tailroom_needed_cnt); | ||
| 791 | } | ||
| 792 | } else { | ||
| 793 | WARN_ON_ONCE(sdata->crypto_tx_tailroom_needed_cnt || | ||
| 794 | sdata->crypto_tx_tailroom_pending_dec); | ||
| 795 | } | ||
| 796 | |||
| 733 | if (sdata->vif.type == NL80211_IFTYPE_AP) { | 797 | if (sdata->vif.type == NL80211_IFTYPE_AP) { |
| 734 | list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list) | 798 | list_for_each_entry(vlan, &sdata->u.ap.vlans, u.vlan.list) |
| 735 | WARN_ON_ONCE(vlan->crypto_tx_tailroom_needed_cnt || | 799 | WARN_ON_ONCE(vlan->crypto_tx_tailroom_needed_cnt || |
| @@ -793,8 +857,8 @@ void ieee80211_delayed_tailroom_dec(struct work_struct *wk) | |||
| 793 | */ | 857 | */ |
| 794 | 858 | ||
| 795 | mutex_lock(&sdata->local->key_mtx); | 859 | mutex_lock(&sdata->local->key_mtx); |
| 796 | sdata->crypto_tx_tailroom_needed_cnt -= | 860 | decrease_tailroom_need_count(sdata, |
| 797 | sdata->crypto_tx_tailroom_pending_dec; | 861 | sdata->crypto_tx_tailroom_pending_dec); |
| 798 | sdata->crypto_tx_tailroom_pending_dec = 0; | 862 | sdata->crypto_tx_tailroom_pending_dec = 0; |
| 799 | mutex_unlock(&sdata->local->key_mtx); | 863 | mutex_unlock(&sdata->local->key_mtx); |
| 800 | } | 864 | } |
diff --git a/net/mac80211/key.h b/net/mac80211/key.h index c5a31835be0e..96557dd1e77d 100644 --- a/net/mac80211/key.h +++ b/net/mac80211/key.h | |||
| @@ -161,6 +161,7 @@ void ieee80211_free_keys(struct ieee80211_sub_if_data *sdata, | |||
| 161 | void ieee80211_free_sta_keys(struct ieee80211_local *local, | 161 | void ieee80211_free_sta_keys(struct ieee80211_local *local, |
| 162 | struct sta_info *sta); | 162 | struct sta_info *sta); |
| 163 | void ieee80211_enable_keys(struct ieee80211_sub_if_data *sdata); | 163 | void ieee80211_enable_keys(struct ieee80211_sub_if_data *sdata); |
| 164 | void ieee80211_reset_crypto_tx_tailroom(struct ieee80211_sub_if_data *sdata); | ||
| 164 | 165 | ||
| 165 | #define key_mtx_dereference(local, ref) \ | 166 | #define key_mtx_dereference(local, ref) \ |
| 166 | rcu_dereference_protected(ref, lockdep_is_held(&((local)->key_mtx))) | 167 | rcu_dereference_protected(ref, lockdep_is_held(&((local)->key_mtx))) |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 260eed45b6d2..5793f75c5ffd 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
| @@ -2121,7 +2121,8 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx) | |||
| 2121 | /* deliver to local stack */ | 2121 | /* deliver to local stack */ |
| 2122 | skb->protocol = eth_type_trans(skb, dev); | 2122 | skb->protocol = eth_type_trans(skb, dev); |
| 2123 | memset(skb->cb, 0, sizeof(skb->cb)); | 2123 | memset(skb->cb, 0, sizeof(skb->cb)); |
| 2124 | if (rx->local->napi) | 2124 | if (!(rx->flags & IEEE80211_RX_REORDER_TIMER) && |
| 2125 | rx->local->napi) | ||
| 2125 | napi_gro_receive(rx->local->napi, skb); | 2126 | napi_gro_receive(rx->local->napi, skb); |
| 2126 | else | 2127 | else |
| 2127 | netif_receive_skb(skb); | 2128 | netif_receive_skb(skb); |
| @@ -3231,7 +3232,7 @@ void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid) | |||
| 3231 | /* This is OK -- must be QoS data frame */ | 3232 | /* This is OK -- must be QoS data frame */ |
| 3232 | .security_idx = tid, | 3233 | .security_idx = tid, |
| 3233 | .seqno_idx = tid, | 3234 | .seqno_idx = tid, |
| 3234 | .flags = 0, | 3235 | .flags = IEEE80211_RX_REORDER_TIMER, |
| 3235 | }; | 3236 | }; |
| 3236 | struct tid_ampdu_rx *tid_agg_rx; | 3237 | struct tid_ampdu_rx *tid_agg_rx; |
| 3237 | 3238 | ||
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 79412f16b61d..b864ebc6ab8f 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
| @@ -2023,6 +2023,9 @@ int ieee80211_reconfig(struct ieee80211_local *local) | |||
| 2023 | 2023 | ||
| 2024 | /* add back keys */ | 2024 | /* add back keys */ |
| 2025 | list_for_each_entry(sdata, &local->interfaces, list) | 2025 | list_for_each_entry(sdata, &local->interfaces, list) |
| 2026 | ieee80211_reset_crypto_tx_tailroom(sdata); | ||
| 2027 | |||
| 2028 | list_for_each_entry(sdata, &local->interfaces, list) | ||
| 2026 | if (ieee80211_sdata_running(sdata)) | 2029 | if (ieee80211_sdata_running(sdata)) |
| 2027 | ieee80211_enable_keys(sdata); | 2030 | ieee80211_enable_keys(sdata); |
| 2028 | 2031 | ||
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index ad9eed70bc8f..1e1c89e51a11 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
| @@ -815,10 +815,8 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent, | |||
| 815 | if (dev->flags & IFF_UP) | 815 | if (dev->flags & IFF_UP) |
| 816 | dev_deactivate(dev); | 816 | dev_deactivate(dev); |
| 817 | 817 | ||
| 818 | if (new && new->ops->attach) { | 818 | if (new && new->ops->attach) |
| 819 | new->ops->attach(new); | 819 | goto skip; |
| 820 | num_q = 0; | ||
| 821 | } | ||
| 822 | 820 | ||
| 823 | for (i = 0; i < num_q; i++) { | 821 | for (i = 0; i < num_q; i++) { |
| 824 | struct netdev_queue *dev_queue = dev_ingress_queue(dev); | 822 | struct netdev_queue *dev_queue = dev_ingress_queue(dev); |
| @@ -834,12 +832,16 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent, | |||
| 834 | qdisc_destroy(old); | 832 | qdisc_destroy(old); |
| 835 | } | 833 | } |
| 836 | 834 | ||
| 835 | skip: | ||
| 837 | if (!ingress) { | 836 | if (!ingress) { |
| 838 | notify_and_destroy(net, skb, n, classid, | 837 | notify_and_destroy(net, skb, n, classid, |
| 839 | dev->qdisc, new); | 838 | dev->qdisc, new); |
| 840 | if (new && !new->ops->attach) | 839 | if (new && !new->ops->attach) |
| 841 | atomic_inc(&new->refcnt); | 840 | atomic_inc(&new->refcnt); |
| 842 | dev->qdisc = new ? : &noop_qdisc; | 841 | dev->qdisc = new ? : &noop_qdisc; |
| 842 | |||
| 843 | if (new && new->ops->attach) | ||
| 844 | new->ops->attach(new); | ||
| 843 | } else { | 845 | } else { |
| 844 | notify_and_destroy(net, skb, n, classid, old, new); | 846 | notify_and_destroy(net, skb, n, classid, old, new); |
| 845 | } | 847 | } |
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 5266ea7b922b..06430598cf51 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
| @@ -1880,6 +1880,10 @@ static long unix_stream_data_wait(struct sock *sk, long timeo, | |||
| 1880 | unix_state_unlock(sk); | 1880 | unix_state_unlock(sk); |
| 1881 | timeo = freezable_schedule_timeout(timeo); | 1881 | timeo = freezable_schedule_timeout(timeo); |
| 1882 | unix_state_lock(sk); | 1882 | unix_state_lock(sk); |
| 1883 | |||
| 1884 | if (sock_flag(sk, SOCK_DEAD)) | ||
| 1885 | break; | ||
| 1886 | |||
| 1883 | clear_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags); | 1887 | clear_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags); |
| 1884 | } | 1888 | } |
| 1885 | 1889 | ||
| @@ -1939,6 +1943,10 @@ static int unix_stream_recvmsg(struct socket *sock, struct msghdr *msg, | |||
| 1939 | struct sk_buff *skb, *last; | 1943 | struct sk_buff *skb, *last; |
| 1940 | 1944 | ||
| 1941 | unix_state_lock(sk); | 1945 | unix_state_lock(sk); |
| 1946 | if (sock_flag(sk, SOCK_DEAD)) { | ||
| 1947 | err = -ECONNRESET; | ||
| 1948 | goto unlock; | ||
| 1949 | } | ||
| 1942 | last = skb = skb_peek(&sk->sk_receive_queue); | 1950 | last = skb = skb_peek(&sk->sk_receive_queue); |
| 1943 | again: | 1951 | again: |
| 1944 | if (skb == NULL) { | 1952 | if (skb == NULL) { |
diff --git a/scripts/gdb/linux/modules.py b/scripts/gdb/linux/modules.py index a1504c4f1900..25db8cff44a2 100644 --- a/scripts/gdb/linux/modules.py +++ b/scripts/gdb/linux/modules.py | |||
| @@ -73,18 +73,11 @@ class LxLsmod(gdb.Command): | |||
| 73 | " " if utils.get_long_type().sizeof == 8 else "")) | 73 | " " if utils.get_long_type().sizeof == 8 else "")) |
| 74 | 74 | ||
| 75 | for module in module_list(): | 75 | for module in module_list(): |
| 76 | ref = 0 | ||
| 77 | module_refptr = module['refptr'] | ||
| 78 | for cpu in cpus.cpu_list("cpu_possible_mask"): | ||
| 79 | refptr = cpus.per_cpu(module_refptr, cpu) | ||
| 80 | ref += refptr['incs'] | ||
| 81 | ref -= refptr['decs'] | ||
| 82 | |||
| 83 | gdb.write("{address} {name:<19} {size:>8} {ref}".format( | 76 | gdb.write("{address} {name:<19} {size:>8} {ref}".format( |
| 84 | address=str(module['module_core']).split()[0], | 77 | address=str(module['module_core']).split()[0], |
| 85 | name=module['name'].string(), | 78 | name=module['name'].string(), |
| 86 | size=str(module['core_size']), | 79 | size=str(module['core_size']), |
| 87 | ref=str(ref))) | 80 | ref=str(module['refcnt']['counter']))) |
| 88 | 81 | ||
| 89 | source_list = module['source_list'] | 82 | source_list = module['source_list'] |
| 90 | t = self._module_use_type.get_type().pointer() | 83 | t = self._module_use_type.get_type().pointer() |
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index 1c8678775f40..ac0db1679f09 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c | |||
| @@ -4926,9 +4926,12 @@ int snd_hda_gen_parse_auto_config(struct hda_codec *codec, | |||
| 4926 | dig_only: | 4926 | dig_only: |
| 4927 | parse_digital(codec); | 4927 | parse_digital(codec); |
| 4928 | 4928 | ||
| 4929 | if (spec->power_down_unused || codec->power_save_node) | 4929 | if (spec->power_down_unused || codec->power_save_node) { |
| 4930 | if (!codec->power_filter) | 4930 | if (!codec->power_filter) |
| 4931 | codec->power_filter = snd_hda_gen_path_power_filter; | 4931 | codec->power_filter = snd_hda_gen_path_power_filter; |
| 4932 | if (!codec->patch_ops.stream_pm) | ||
| 4933 | codec->patch_ops.stream_pm = snd_hda_gen_stream_pm; | ||
| 4934 | } | ||
| 4932 | 4935 | ||
| 4933 | if (!spec->no_analog && spec->beep_nid) { | 4936 | if (!spec->no_analog && spec->beep_nid) { |
| 4934 | err = snd_hda_attach_beep_device(codec, spec->beep_nid); | 4937 | err = snd_hda_attach_beep_device(codec, spec->beep_nid); |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 34040d26c94f..fea198c58196 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
| @@ -2089,6 +2089,8 @@ static const struct pci_device_id azx_ids[] = { | |||
| 2089 | .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, | 2089 | .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, |
| 2090 | { PCI_DEVICE(0x1002, 0xaab0), | 2090 | { PCI_DEVICE(0x1002, 0xaab0), |
| 2091 | .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, | 2091 | .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, |
| 2092 | { PCI_DEVICE(0x1002, 0xaac8), | ||
| 2093 | .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, | ||
| 2092 | /* VIA VT8251/VT8237A */ | 2094 | /* VIA VT8251/VT8237A */ |
| 2093 | { PCI_DEVICE(0x1106, 0x3288), | 2095 | { PCI_DEVICE(0x1106, 0x3288), |
| 2094 | .driver_data = AZX_DRIVER_VIA | AZX_DCAPS_POSFIX_VIA }, | 2096 | .driver_data = AZX_DRIVER_VIA | AZX_DCAPS_POSFIX_VIA }, |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 31f8f13be907..464168426465 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
| @@ -884,6 +884,7 @@ static struct alc_codec_rename_pci_table rename_pci_tbl[] = { | |||
| 884 | { 0x10ec0275, 0x1028, 0, "ALC3260" }, | 884 | { 0x10ec0275, 0x1028, 0, "ALC3260" }, |
| 885 | { 0x10ec0899, 0x1028, 0, "ALC3861" }, | 885 | { 0x10ec0899, 0x1028, 0, "ALC3861" }, |
| 886 | { 0x10ec0298, 0x1028, 0, "ALC3266" }, | 886 | { 0x10ec0298, 0x1028, 0, "ALC3266" }, |
| 887 | { 0x10ec0256, 0x1028, 0, "ALC3246" }, | ||
| 887 | { 0x10ec0670, 0x1025, 0, "ALC669X" }, | 888 | { 0x10ec0670, 0x1025, 0, "ALC669X" }, |
| 888 | { 0x10ec0676, 0x1025, 0, "ALC679X" }, | 889 | { 0x10ec0676, 0x1025, 0, "ALC679X" }, |
| 889 | { 0x10ec0282, 0x1043, 0, "ALC3229" }, | 890 | { 0x10ec0282, 0x1043, 0, "ALC3229" }, |
| @@ -4227,6 +4228,11 @@ static void alc_fixup_headset_mode_alc662(struct hda_codec *codec, | |||
| 4227 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | 4228 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { |
| 4228 | spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; | 4229 | spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; |
| 4229 | spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */ | 4230 | spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */ |
| 4231 | |||
| 4232 | /* Disable boost for mic-in permanently. (This code is only called | ||
| 4233 | from quirks that guarantee that the headphone is at NID 0x1b.) */ | ||
| 4234 | snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000); | ||
| 4235 | snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP); | ||
| 4230 | } else | 4236 | } else |
| 4231 | alc_fixup_headset_mode(codec, fix, action); | 4237 | alc_fixup_headset_mode(codec, fix, action); |
| 4232 | } | 4238 | } |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 43c99ce4a520..6833c74ed6ff 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
| @@ -4403,7 +4403,6 @@ static const struct hda_codec_ops stac_patch_ops = { | |||
| 4403 | #ifdef CONFIG_PM | 4403 | #ifdef CONFIG_PM |
| 4404 | .suspend = stac_suspend, | 4404 | .suspend = stac_suspend, |
| 4405 | #endif | 4405 | #endif |
| 4406 | .stream_pm = snd_hda_gen_stream_pm, | ||
| 4407 | .reboot_notify = stac_shutup, | 4406 | .reboot_notify = stac_shutup, |
| 4408 | }; | 4407 | }; |
| 4409 | 4408 | ||
| @@ -4697,7 +4696,8 @@ static int patch_stac92hd71bxx(struct hda_codec *codec) | |||
| 4697 | return err; | 4696 | return err; |
| 4698 | 4697 | ||
| 4699 | spec = codec->spec; | 4698 | spec = codec->spec; |
| 4700 | codec->power_save_node = 1; | 4699 | /* disabled power_save_node since it causes noises on a Dell machine */ |
| 4700 | /* codec->power_save_node = 1; */ | ||
| 4701 | spec->linear_tone_beep = 0; | 4701 | spec->linear_tone_beep = 0; |
| 4702 | spec->gen.own_eapd_ctl = 1; | 4702 | spec->gen.own_eapd_ctl = 1; |
| 4703 | spec->gen.power_down_unused = 1; | 4703 | spec->gen.power_down_unused = 1; |
diff --git a/sound/pci/hda/thinkpad_helper.c b/sound/pci/hda/thinkpad_helper.c index d51703e30523..0a4ad5feb82e 100644 --- a/sound/pci/hda/thinkpad_helper.c +++ b/sound/pci/hda/thinkpad_helper.c | |||
| @@ -72,7 +72,6 @@ static void hda_fixup_thinkpad_acpi(struct hda_codec *codec, | |||
| 72 | if (led_set_func(TPACPI_LED_MUTE, false) >= 0) { | 72 | if (led_set_func(TPACPI_LED_MUTE, false) >= 0) { |
| 73 | old_vmaster_hook = spec->vmaster_mute.hook; | 73 | old_vmaster_hook = spec->vmaster_mute.hook; |
| 74 | spec->vmaster_mute.hook = update_tpacpi_mute_led; | 74 | spec->vmaster_mute.hook = update_tpacpi_mute_led; |
| 75 | spec->vmaster_mute_enum = 1; | ||
| 76 | removefunc = false; | 75 | removefunc = false; |
| 77 | } | 76 | } |
| 78 | if (led_set_func(TPACPI_LED_MICMUTE, false) >= 0) { | 77 | if (led_set_func(TPACPI_LED_MICMUTE, false) >= 0) { |
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index 46facfc9aec1..29175346cc4f 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c | |||
| @@ -1118,6 +1118,7 @@ bool snd_usb_get_sample_rate_quirk(struct snd_usb_audio *chip) | |||
| 1118 | case USB_ID(0x045E, 0x075D): /* MS Lifecam Cinema */ | 1118 | case USB_ID(0x045E, 0x075D): /* MS Lifecam Cinema */ |
| 1119 | case USB_ID(0x045E, 0x076D): /* MS Lifecam HD-5000 */ | 1119 | case USB_ID(0x045E, 0x076D): /* MS Lifecam HD-5000 */ |
| 1120 | case USB_ID(0x045E, 0x0772): /* MS Lifecam Studio */ | 1120 | case USB_ID(0x045E, 0x0772): /* MS Lifecam Studio */ |
| 1121 | case USB_ID(0x045E, 0x0779): /* MS Lifecam HD-3000 */ | ||
| 1121 | case USB_ID(0x04D8, 0xFEEA): /* Benchmark DAC1 Pre */ | 1122 | case USB_ID(0x04D8, 0xFEEA): /* Benchmark DAC1 Pre */ |
| 1122 | return true; | 1123 | return true; |
| 1123 | } | 1124 | } |
diff --git a/tools/net/bpf_jit_disasm.c b/tools/net/bpf_jit_disasm.c index c5baf9c591b7..618c2bcd4eab 100644 --- a/tools/net/bpf_jit_disasm.c +++ b/tools/net/bpf_jit_disasm.c | |||
| @@ -123,6 +123,8 @@ static int get_last_jit_image(char *haystack, size_t hlen, | |||
| 123 | assert(ret == 0); | 123 | assert(ret == 0); |
| 124 | 124 | ||
| 125 | ptr = haystack; | 125 | ptr = haystack; |
| 126 | memset(pmatch, 0, sizeof(pmatch)); | ||
| 127 | |||
| 126 | while (1) { | 128 | while (1) { |
| 127 | ret = regexec(®ex, ptr, 1, pmatch, 0); | 129 | ret = regexec(®ex, ptr, 1, pmatch, 0); |
| 128 | if (ret == 0) { | 130 | if (ret == 0) { |
