diff options
author | Dave Airlie <airlied@redhat.com> | 2015-06-03 19:23:51 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2015-06-03 19:23:51 -0400 |
commit | a8a50fce60e86f82e442bf84b8af20750b3d6105 (patch) | |
tree | 974c04f9f4f10275a8a9435113ea5b307d172bb6 | |
parent | 9b5edbf7a462b7c846e9d4675b9b72b7a4e84de9 (diff) | |
parent | c65b99f046843d2455aa231747b5a07a999a9f3d (diff) |
Merge tag 'v4.1-rc6' into drm-next
Linux 4.1-rc6
backmerge 4.1-rc6 as some of the later pull reqs are based on newer bases
and I'd prefer to do the fixup myself.
376 files changed, 3285 insertions, 1820 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/Documentation/devicetree/bindings/clock/silabs,si5351.txt b/Documentation/devicetree/bindings/clock/silabs,si5351.txt index c40711e8e8f7..28b28309f535 100644 --- a/Documentation/devicetree/bindings/clock/silabs,si5351.txt +++ b/Documentation/devicetree/bindings/clock/silabs,si5351.txt | |||
@@ -17,7 +17,8 @@ Required properties: | |||
17 | - #clock-cells: from common clock binding; shall be set to 1. | 17 | - #clock-cells: from common clock binding; shall be set to 1. |
18 | - clocks: from common clock binding; list of parent clock | 18 | - clocks: from common clock binding; list of parent clock |
19 | handles, shall be xtal reference clock or xtal and clkin for | 19 | handles, shall be xtal reference clock or xtal and clkin for |
20 | si5351c only. | 20 | si5351c only. Corresponding clock input names are "xtal" and |
21 | "clkin" respectively. | ||
21 | - #address-cells: shall be set to 1. | 22 | - #address-cells: shall be set to 1. |
22 | - #size-cells: shall be set to 0. | 23 | - #size-cells: shall be set to 0. |
23 | 24 | ||
@@ -71,6 +72,7 @@ i2c-master-node { | |||
71 | 72 | ||
72 | /* connect xtal input to 25MHz reference */ | 73 | /* connect xtal input to 25MHz reference */ |
73 | clocks = <&ref25>; | 74 | clocks = <&ref25>; |
75 | clock-names = "xtal"; | ||
74 | 76 | ||
75 | /* connect xtal input as source of pll0 and pll1 */ | 77 | /* connect xtal input as source of pll0 and pll1 */ |
76 | silabs,pll-source = <0 0>, <1 0>; | 78 | silabs,pll-source = <0 0>, <1 0>; |
diff --git a/Documentation/devicetree/bindings/net/cdns-emac.txt b/Documentation/devicetree/bindings/net/cdns-emac.txt index abd67c13d344..4451ee973223 100644 --- a/Documentation/devicetree/bindings/net/cdns-emac.txt +++ b/Documentation/devicetree/bindings/net/cdns-emac.txt | |||
@@ -3,7 +3,8 @@ | |||
3 | Required properties: | 3 | Required properties: |
4 | - compatible: Should be "cdns,[<chip>-]{emac}" | 4 | - compatible: Should be "cdns,[<chip>-]{emac}" |
5 | Use "cdns,at91rm9200-emac" Atmel at91rm9200 SoC. | 5 | Use "cdns,at91rm9200-emac" Atmel at91rm9200 SoC. |
6 | or the generic form: "cdns,emac". | 6 | Use "cdns,zynq-gem" Xilinx Zynq-7xxx SoC. |
7 | Or the generic form: "cdns,emac". | ||
7 | - reg: Address and length of the register set for the device | 8 | - reg: Address and length of the register set for the device |
8 | - interrupts: Should contain macb interrupt | 9 | - interrupts: Should contain macb interrupt |
9 | - phy-mode: see ethernet.txt file in the same directory. | 10 | - phy-mode: see ethernet.txt file in the same directory. |
diff --git a/Documentation/hwmon/tmp401 b/Documentation/hwmon/tmp401 index 8eb88e974055..711f75e189eb 100644 --- a/Documentation/hwmon/tmp401 +++ b/Documentation/hwmon/tmp401 | |||
@@ -20,7 +20,7 @@ Supported chips: | |||
20 | Datasheet: http://focus.ti.com/docs/prod/folders/print/tmp432.html | 20 | Datasheet: http://focus.ti.com/docs/prod/folders/print/tmp432.html |
21 | * Texas Instruments TMP435 | 21 | * Texas Instruments TMP435 |
22 | Prefix: 'tmp435' | 22 | Prefix: 'tmp435' |
23 | Addresses scanned: I2C 0x37, 0x48 - 0x4f | 23 | Addresses scanned: I2C 0x48 - 0x4f |
24 | Datasheet: http://focus.ti.com/docs/prod/folders/print/tmp435.html | 24 | Datasheet: http://focus.ti.com/docs/prod/folders/print/tmp435.html |
25 | 25 | ||
26 | Authors: | 26 | Authors: |
diff --git a/Documentation/target/tcmu-design.txt b/Documentation/target/tcmu-design.txt index 43e94ea6d2ca..263b907517ac 100644 --- a/Documentation/target/tcmu-design.txt +++ b/Documentation/target/tcmu-design.txt | |||
@@ -15,8 +15,7 @@ Contents: | |||
15 | a) Discovering and configuring TCMU uio devices | 15 | a) Discovering and configuring TCMU uio devices |
16 | b) Waiting for events on the device(s) | 16 | b) Waiting for events on the device(s) |
17 | c) Managing the command ring | 17 | c) Managing the command ring |
18 | 3) Command filtering and pass_level | 18 | 3) A final note |
19 | 4) A final note | ||
20 | 19 | ||
21 | 20 | ||
22 | TCM Userspace Design | 21 | TCM Userspace Design |
@@ -324,7 +323,7 @@ int handle_device_events(int fd, void *map) | |||
324 | /* Process events from cmd ring until we catch up with cmd_head */ | 323 | /* Process events from cmd ring until we catch up with cmd_head */ |
325 | while (ent != (void *)mb + mb->cmdr_off + mb->cmd_head) { | 324 | while (ent != (void *)mb + mb->cmdr_off + mb->cmd_head) { |
326 | 325 | ||
327 | if (tcmu_hdr_get_op(&ent->hdr) == TCMU_OP_CMD) { | 326 | if (tcmu_hdr_get_op(ent->hdr.len_op) == TCMU_OP_CMD) { |
328 | uint8_t *cdb = (void *)mb + ent->req.cdb_off; | 327 | uint8_t *cdb = (void *)mb + ent->req.cdb_off; |
329 | bool success = true; | 328 | bool success = true; |
330 | 329 | ||
@@ -339,8 +338,12 @@ int handle_device_events(int fd, void *map) | |||
339 | ent->rsp.scsi_status = SCSI_CHECK_CONDITION; | 338 | ent->rsp.scsi_status = SCSI_CHECK_CONDITION; |
340 | } | 339 | } |
341 | } | 340 | } |
341 | else if (tcmu_hdr_get_op(ent->hdr.len_op) != TCMU_OP_PAD) { | ||
342 | /* Tell the kernel we didn't handle unknown opcodes */ | ||
343 | ent->hdr.uflags |= TCMU_UFLAG_UNKNOWN_OP; | ||
344 | } | ||
342 | else { | 345 | else { |
343 | /* Do nothing for PAD entries */ | 346 | /* Do nothing for PAD entries except update cmd_tail */ |
344 | } | 347 | } |
345 | 348 | ||
346 | /* update cmd_tail */ | 349 | /* update cmd_tail */ |
@@ -360,28 +363,6 @@ int handle_device_events(int fd, void *map) | |||
360 | } | 363 | } |
361 | 364 | ||
362 | 365 | ||
363 | Command filtering and pass_level | ||
364 | -------------------------------- | ||
365 | |||
366 | TCMU supports a "pass_level" option with valid values of 0 or 1. When | ||
367 | the value is 0 (the default), nearly all SCSI commands received for | ||
368 | the device are passed through to the handler. This allows maximum | ||
369 | flexibility but increases the amount of code required by the handler, | ||
370 | to support all mandatory SCSI commands. If pass_level is set to 1, | ||
371 | then only IO-related commands are presented, and the rest are handled | ||
372 | by LIO's in-kernel command emulation. The commands presented at level | ||
373 | 1 include all versions of: | ||
374 | |||
375 | READ | ||
376 | WRITE | ||
377 | WRITE_VERIFY | ||
378 | XDWRITEREAD | ||
379 | WRITE_SAME | ||
380 | COMPARE_AND_WRITE | ||
381 | SYNCHRONIZE_CACHE | ||
382 | UNMAP | ||
383 | |||
384 | |||
385 | A final note | 366 | A final note |
386 | ------------ | 367 | ------------ |
387 | 368 | ||
diff --git a/Documentation/virtual/kvm/mmu.txt b/Documentation/virtual/kvm/mmu.txt index 53838d9c6295..c59bd9bc41ef 100644 --- a/Documentation/virtual/kvm/mmu.txt +++ b/Documentation/virtual/kvm/mmu.txt | |||
@@ -169,6 +169,10 @@ Shadow pages contain the following information: | |||
169 | Contains the value of cr4.smep && !cr0.wp for which the page is valid | 169 | Contains the value of cr4.smep && !cr0.wp for which the page is valid |
170 | (pages for which this is true are different from other pages; see the | 170 | (pages for which this is true are different from other pages; see the |
171 | treatment of cr0.wp=0 below). | 171 | treatment of cr0.wp=0 below). |
172 | role.smap_andnot_wp: | ||
173 | Contains the value of cr4.smap && !cr0.wp for which the page is valid | ||
174 | (pages for which this is true are different from other pages; see the | ||
175 | treatment of cr0.wp=0 below). | ||
172 | gfn: | 176 | gfn: |
173 | Either the guest page table containing the translations shadowed by this | 177 | Either the guest page table containing the translations shadowed by this |
174 | page, or the base page frame for linear translations. See role.direct. | 178 | page, or the base page frame for linear translations. See role.direct. |
@@ -344,10 +348,16 @@ on fault type: | |||
344 | 348 | ||
345 | (user write faults generate a #PF) | 349 | (user write faults generate a #PF) |
346 | 350 | ||
347 | In the first case there is an additional complication if CR4.SMEP is | 351 | In the first case there are two additional complications: |
348 | enabled: since we've turned the page into a kernel page, the kernel may now | 352 | - if CR4.SMEP is enabled: since we've turned the page into a kernel page, |
349 | execute it. We handle this by also setting spte.nx. If we get a user | 353 | the kernel may now execute it. We handle this by also setting spte.nx. |
350 | fetch or read fault, we'll change spte.u=1 and spte.nx=gpte.nx back. | 354 | If we get a user fetch or read fault, we'll change spte.u=1 and |
355 | spte.nx=gpte.nx back. | ||
356 | - if CR4.SMAP is disabled: since the page has been changed to a kernel | ||
357 | page, it can not be reused when CR4.SMAP is enabled. We set | ||
358 | CR4.SMAP && !CR0.WP into shadow page's role to avoid this case. Note, | ||
359 | here we do not care the case that CR4.SMAP is enabled since KVM will | ||
360 | directly inject #PF to guest due to failed permission check. | ||
351 | 361 | ||
352 | To prevent an spte that was converted into a kernel page with cr0.wp=0 | 362 | To prevent an spte that was converted into a kernel page with cr0.wp=0 |
353 | from being written by the kernel after cr0.wp has changed to 1, we make | 363 | from being written by the kernel after cr0.wp has changed to 1, we make |
diff --git a/MAINTAINERS b/MAINTAINERS index 9480ea31c68d..c9506ea5ec2f 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 | ||
@@ -3825,10 +3824,11 @@ M: David Woodhouse <dwmw2@infradead.org> | |||
3825 | L: linux-embedded@vger.kernel.org | 3824 | L: linux-embedded@vger.kernel.org |
3826 | S: Maintained | 3825 | S: Maintained |
3827 | 3826 | ||
3828 | EMULEX LPFC FC SCSI DRIVER | 3827 | EMULEX/AVAGO LPFC FC/FCOE SCSI DRIVER |
3829 | M: James Smart <james.smart@emulex.com> | 3828 | M: James Smart <james.smart@avagotech.com> |
3829 | M: Dick Kennedy <dick.kennedy@avagotech.com> | ||
3830 | L: linux-scsi@vger.kernel.org | 3830 | L: linux-scsi@vger.kernel.org |
3831 | W: http://sourceforge.net/projects/lpfcxxxx | 3831 | W: http://www.avagotech.com |
3832 | S: Supported | 3832 | S: Supported |
3833 | F: drivers/scsi/lpfc/ | 3833 | F: drivers/scsi/lpfc/ |
3834 | 3834 | ||
@@ -4536,7 +4536,7 @@ M: Jean Delvare <jdelvare@suse.de> | |||
4536 | M: Guenter Roeck <linux@roeck-us.net> | 4536 | M: Guenter Roeck <linux@roeck-us.net> |
4537 | L: lm-sensors@lm-sensors.org | 4537 | L: lm-sensors@lm-sensors.org |
4538 | W: http://www.lm-sensors.org/ | 4538 | W: http://www.lm-sensors.org/ |
4539 | T: quilt kernel.org/pub/linux/kernel/people/jdelvare/linux-2.6/jdelvare-hwmon/ | 4539 | T: quilt http://jdelvare.nerim.net/devel/linux/jdelvare-hwmon/ |
4540 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git | 4540 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git |
4541 | S: Maintained | 4541 | S: Maintained |
4542 | F: Documentation/hwmon/ | 4542 | F: Documentation/hwmon/ |
@@ -8829,9 +8829,11 @@ F: drivers/misc/phantom.c | |||
8829 | F: include/uapi/linux/phantom.h | 8829 | F: include/uapi/linux/phantom.h |
8830 | 8830 | ||
8831 | SERVER ENGINES 10Gbps iSCSI - BladeEngine 2 DRIVER | 8831 | SERVER ENGINES 10Gbps iSCSI - BladeEngine 2 DRIVER |
8832 | M: Jayamohan Kallickal <jayamohan.kallickal@emulex.com> | 8832 | M: Jayamohan Kallickal <jayamohan.kallickal@avagotech.com> |
8833 | M: Minh Tran <minh.tran@avagotech.com> | ||
8834 | M: John Soni Jose <sony.john-n@avagotech.com> | ||
8833 | L: linux-scsi@vger.kernel.org | 8835 | L: linux-scsi@vger.kernel.org |
8834 | W: http://www.emulex.com | 8836 | W: http://www.avagotech.com |
8835 | S: Supported | 8837 | S: Supported |
8836 | F: drivers/scsi/be2iscsi/ | 8838 | F: drivers/scsi/be2iscsi/ |
8837 | 8839 | ||
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 4 | 1 | VERSION = 4 |
2 | PATCHLEVEL = 1 | 2 | PATCHLEVEL = 1 |
3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
4 | EXTRAVERSION = -rc4 | 4 | EXTRAVERSION = -rc6 |
5 | NAME = Hurr durr I'ma sheep | 5 | NAME = Hurr durr I'ma sheep |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
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/boot/dts/zynq-7000.dtsi b/arch/arm/boot/dts/zynq-7000.dtsi index a5cd2eda3edf..9ea54b3dba09 100644 --- a/arch/arm/boot/dts/zynq-7000.dtsi +++ b/arch/arm/boot/dts/zynq-7000.dtsi | |||
@@ -193,7 +193,7 @@ | |||
193 | }; | 193 | }; |
194 | 194 | ||
195 | gem0: ethernet@e000b000 { | 195 | gem0: ethernet@e000b000 { |
196 | compatible = "cdns,gem"; | 196 | compatible = "cdns,zynq-gem"; |
197 | reg = <0xe000b000 0x1000>; | 197 | reg = <0xe000b000 0x1000>; |
198 | status = "disabled"; | 198 | status = "disabled"; |
199 | interrupts = <0 22 4>; | 199 | interrupts = <0 22 4>; |
@@ -204,7 +204,7 @@ | |||
204 | }; | 204 | }; |
205 | 205 | ||
206 | gem1: ethernet@e000c000 { | 206 | gem1: ethernet@e000c000 { |
207 | compatible = "cdns,gem"; | 207 | compatible = "cdns,zynq-gem"; |
208 | reg = <0xe000c000 0x1000>; | 208 | reg = <0xe000c000 0x1000>; |
209 | status = "disabled"; | 209 | status = "disabled"; |
210 | interrupts = <0 45 4>; | 210 | interrupts = <0 45 4>; |
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/kernel/entry-common.S b/arch/arm/kernel/entry-common.S index f8ccc21fa032..4e7f40c577e6 100644 --- a/arch/arm/kernel/entry-common.S +++ b/arch/arm/kernel/entry-common.S | |||
@@ -33,7 +33,9 @@ ret_fast_syscall: | |||
33 | UNWIND(.fnstart ) | 33 | UNWIND(.fnstart ) |
34 | UNWIND(.cantunwind ) | 34 | UNWIND(.cantunwind ) |
35 | disable_irq @ disable interrupts | 35 | disable_irq @ disable interrupts |
36 | ldr r1, [tsk, #TI_FLAGS] | 36 | ldr r1, [tsk, #TI_FLAGS] @ re-check for syscall tracing |
37 | tst r1, #_TIF_SYSCALL_WORK | ||
38 | bne __sys_trace_return | ||
37 | tst r1, #_TIF_WORK_MASK | 39 | tst r1, #_TIF_WORK_MASK |
38 | bne fast_work_pending | 40 | bne fast_work_pending |
39 | asm_trace_hardirqs_on | 41 | asm_trace_hardirqs_on |
diff --git a/arch/arm/kernel/perf_event_cpu.c b/arch/arm/kernel/perf_event_cpu.c index 213919ba326f..3b8c2833c537 100644 --- a/arch/arm/kernel/perf_event_cpu.c +++ b/arch/arm/kernel/perf_event_cpu.c | |||
@@ -304,16 +304,17 @@ static int probe_current_pmu(struct arm_pmu *pmu) | |||
304 | static int of_pmu_irq_cfg(struct platform_device *pdev) | 304 | static int of_pmu_irq_cfg(struct platform_device *pdev) |
305 | { | 305 | { |
306 | int i, irq; | 306 | int i, irq; |
307 | int *irqs = kcalloc(pdev->num_resources, sizeof(*irqs), GFP_KERNEL); | 307 | int *irqs; |
308 | |||
309 | if (!irqs) | ||
310 | return -ENOMEM; | ||
311 | 308 | ||
312 | /* Don't bother with PPIs; they're already affine */ | 309 | /* Don't bother with PPIs; they're already affine */ |
313 | irq = platform_get_irq(pdev, 0); | 310 | irq = platform_get_irq(pdev, 0); |
314 | if (irq >= 0 && irq_is_percpu(irq)) | 311 | if (irq >= 0 && irq_is_percpu(irq)) |
315 | return 0; | 312 | return 0; |
316 | 313 | ||
314 | irqs = kcalloc(pdev->num_resources, sizeof(*irqs), GFP_KERNEL); | ||
315 | if (!irqs) | ||
316 | return -ENOMEM; | ||
317 | |||
317 | for (i = 0; i < pdev->num_resources; ++i) { | 318 | for (i = 0; i < pdev->num_resources; ++i) { |
318 | struct device_node *dn; | 319 | struct device_node *dn; |
319 | int cpu; | 320 | int cpu; |
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/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 4e6ef896c619..7186382672b5 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c | |||
@@ -1112,22 +1112,22 @@ void __init sanity_check_meminfo(void) | |||
1112 | } | 1112 | } |
1113 | 1113 | ||
1114 | /* | 1114 | /* |
1115 | * Find the first non-section-aligned page, and point | 1115 | * Find the first non-pmd-aligned page, and point |
1116 | * memblock_limit at it. This relies on rounding the | 1116 | * memblock_limit at it. This relies on rounding the |
1117 | * limit down to be section-aligned, which happens at | 1117 | * limit down to be pmd-aligned, which happens at the |
1118 | * the end of this function. | 1118 | * end of this function. |
1119 | * | 1119 | * |
1120 | * With this algorithm, the start or end of almost any | 1120 | * With this algorithm, the start or end of almost any |
1121 | * bank can be non-section-aligned. The only exception | 1121 | * bank can be non-pmd-aligned. The only exception is |
1122 | * is that the start of the bank 0 must be section- | 1122 | * that the start of the bank 0 must be section- |
1123 | * aligned, since otherwise memory would need to be | 1123 | * aligned, since otherwise memory would need to be |
1124 | * allocated when mapping the start of bank 0, which | 1124 | * allocated when mapping the start of bank 0, which |
1125 | * occurs before any free memory is mapped. | 1125 | * occurs before any free memory is mapped. |
1126 | */ | 1126 | */ |
1127 | if (!memblock_limit) { | 1127 | if (!memblock_limit) { |
1128 | if (!IS_ALIGNED(block_start, SECTION_SIZE)) | 1128 | if (!IS_ALIGNED(block_start, PMD_SIZE)) |
1129 | memblock_limit = block_start; | 1129 | memblock_limit = block_start; |
1130 | else if (!IS_ALIGNED(block_end, SECTION_SIZE)) | 1130 | else if (!IS_ALIGNED(block_end, PMD_SIZE)) |
1131 | memblock_limit = arm_lowmem_limit; | 1131 | memblock_limit = arm_lowmem_limit; |
1132 | } | 1132 | } |
1133 | 1133 | ||
@@ -1137,12 +1137,12 @@ void __init sanity_check_meminfo(void) | |||
1137 | high_memory = __va(arm_lowmem_limit - 1) + 1; | 1137 | high_memory = __va(arm_lowmem_limit - 1) + 1; |
1138 | 1138 | ||
1139 | /* | 1139 | /* |
1140 | * Round the memblock limit down to a section size. This | 1140 | * Round the memblock limit down to a pmd size. This |
1141 | * helps to ensure that we will allocate memory from the | 1141 | * helps to ensure that we will allocate memory from the |
1142 | * last full section, which should be mapped. | 1142 | * last full pmd, which should be mapped. |
1143 | */ | 1143 | */ |
1144 | if (memblock_limit) | 1144 | if (memblock_limit) |
1145 | memblock_limit = round_down(memblock_limit, SECTION_SIZE); | 1145 | memblock_limit = round_down(memblock_limit, PMD_SIZE); |
1146 | if (!memblock_limit) | 1146 | if (!memblock_limit) |
1147 | memblock_limit = arm_lowmem_limit; | 1147 | memblock_limit = arm_lowmem_limit; |
1148 | 1148 | ||
diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c index 224081ccc92f..7d0f07020c80 100644 --- a/arch/arm/xen/enlighten.c +++ b/arch/arm/xen/enlighten.c | |||
@@ -272,6 +272,7 @@ void xen_arch_pre_suspend(void) { } | |||
272 | void xen_arch_post_suspend(int suspend_cancelled) { } | 272 | void xen_arch_post_suspend(int suspend_cancelled) { } |
273 | void xen_timer_resume(void) { } | 273 | void xen_timer_resume(void) { } |
274 | void xen_arch_resume(void) { } | 274 | void xen_arch_resume(void) { } |
275 | void xen_arch_suspend(void) { } | ||
275 | 276 | ||
276 | 277 | ||
277 | /* In the hypervisor.S file. */ | 278 | /* In the hypervisor.S file. */ |
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/mips/ath79/prom.c b/arch/mips/ath79/prom.c index e1fe63051136..597899ad5438 100644 --- a/arch/mips/ath79/prom.c +++ b/arch/mips/ath79/prom.c | |||
@@ -1,6 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Atheros AR71XX/AR724X/AR913X specific prom routines | 2 | * Atheros AR71XX/AR724X/AR913X specific prom routines |
3 | * | 3 | * |
4 | * Copyright (C) 2015 Laurent Fasnacht <l@libres.ch> | ||
4 | * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org> | 5 | * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org> |
5 | * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org> | 6 | * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org> |
6 | * | 7 | * |
@@ -25,12 +26,14 @@ void __init prom_init(void) | |||
25 | { | 26 | { |
26 | fw_init_cmdline(); | 27 | fw_init_cmdline(); |
27 | 28 | ||
29 | #ifdef CONFIG_BLK_DEV_INITRD | ||
28 | /* Read the initrd address from the firmware environment */ | 30 | /* Read the initrd address from the firmware environment */ |
29 | initrd_start = fw_getenvl("initrd_start"); | 31 | initrd_start = fw_getenvl("initrd_start"); |
30 | if (initrd_start) { | 32 | if (initrd_start) { |
31 | initrd_start = KSEG0ADDR(initrd_start); | 33 | initrd_start = KSEG0ADDR(initrd_start); |
32 | initrd_end = initrd_start + fw_getenvl("initrd_size"); | 34 | initrd_end = initrd_start + fw_getenvl("initrd_size"); |
33 | } | 35 | } |
36 | #endif | ||
34 | } | 37 | } |
35 | 38 | ||
36 | void __init prom_free_prom_memory(void) | 39 | void __init prom_free_prom_memory(void) |
diff --git a/arch/mips/configs/fuloong2e_defconfig b/arch/mips/configs/fuloong2e_defconfig index 002680648dcb..b2a577ebce0b 100644 --- a/arch/mips/configs/fuloong2e_defconfig +++ b/arch/mips/configs/fuloong2e_defconfig | |||
@@ -194,7 +194,7 @@ CONFIG_USB_WUSB_CBAF=m | |||
194 | CONFIG_USB_C67X00_HCD=m | 194 | CONFIG_USB_C67X00_HCD=m |
195 | CONFIG_USB_EHCI_HCD=y | 195 | CONFIG_USB_EHCI_HCD=y |
196 | CONFIG_USB_EHCI_ROOT_HUB_TT=y | 196 | CONFIG_USB_EHCI_ROOT_HUB_TT=y |
197 | CONFIG_USB_ISP1760_HCD=m | 197 | CONFIG_USB_ISP1760=m |
198 | CONFIG_USB_OHCI_HCD=y | 198 | CONFIG_USB_OHCI_HCD=y |
199 | CONFIG_USB_UHCI_HCD=m | 199 | CONFIG_USB_UHCI_HCD=m |
200 | CONFIG_USB_R8A66597_HCD=m | 200 | CONFIG_USB_R8A66597_HCD=m |
diff --git a/arch/mips/kernel/irq.c b/arch/mips/kernel/irq.c index d2bfbc2e8995..51f57d841662 100644 --- a/arch/mips/kernel/irq.c +++ b/arch/mips/kernel/irq.c | |||
@@ -29,7 +29,7 @@ | |||
29 | int kgdb_early_setup; | 29 | int kgdb_early_setup; |
30 | #endif | 30 | #endif |
31 | 31 | ||
32 | static unsigned long irq_map[NR_IRQS / BITS_PER_LONG]; | 32 | static DECLARE_BITMAP(irq_map, NR_IRQS); |
33 | 33 | ||
34 | int allocate_irqno(void) | 34 | int allocate_irqno(void) |
35 | { | 35 | { |
diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c index fd528d7ea278..336708ae5c5b 100644 --- a/arch/mips/kernel/smp-bmips.c +++ b/arch/mips/kernel/smp-bmips.c | |||
@@ -444,7 +444,7 @@ struct plat_smp_ops bmips5000_smp_ops = { | |||
444 | static void bmips_wr_vec(unsigned long dst, char *start, char *end) | 444 | static void bmips_wr_vec(unsigned long dst, char *start, char *end) |
445 | { | 445 | { |
446 | memcpy((void *)dst, start, end - start); | 446 | memcpy((void *)dst, start, end - start); |
447 | dma_cache_wback((unsigned long)start, end - start); | 447 | dma_cache_wback(dst, end - start); |
448 | local_flush_icache_range(dst, dst + (end - start)); | 448 | local_flush_icache_range(dst, dst + (end - start)); |
449 | instruction_hazard(); | 449 | instruction_hazard(); |
450 | } | 450 | } |
diff --git a/arch/mips/lib/strnlen_user.S b/arch/mips/lib/strnlen_user.S index 7d12c0dded3d..77e64942f004 100644 --- a/arch/mips/lib/strnlen_user.S +++ b/arch/mips/lib/strnlen_user.S | |||
@@ -34,7 +34,12 @@ LEAF(__strnlen_\func\()_asm) | |||
34 | FEXPORT(__strnlen_\func\()_nocheck_asm) | 34 | FEXPORT(__strnlen_\func\()_nocheck_asm) |
35 | move v0, a0 | 35 | move v0, a0 |
36 | PTR_ADDU a1, a0 # stop pointer | 36 | PTR_ADDU a1, a0 # stop pointer |
37 | 1: beq v0, a1, 1f # limit reached? | 37 | 1: |
38 | #ifdef CONFIG_CPU_DADDI_WORKAROUNDS | ||
39 | .set noat | ||
40 | li AT, 1 | ||
41 | #endif | ||
42 | beq v0, a1, 1f # limit reached? | ||
38 | .ifeqs "\func", "kernel" | 43 | .ifeqs "\func", "kernel" |
39 | EX(lb, t0, (v0), .Lfault\@) | 44 | EX(lb, t0, (v0), .Lfault\@) |
40 | .else | 45 | .else |
@@ -42,7 +47,13 @@ FEXPORT(__strnlen_\func\()_nocheck_asm) | |||
42 | .endif | 47 | .endif |
43 | .set noreorder | 48 | .set noreorder |
44 | bnez t0, 1b | 49 | bnez t0, 1b |
45 | 1: PTR_ADDIU v0, 1 | 50 | 1: |
51 | #ifndef CONFIG_CPU_DADDI_WORKAROUNDS | ||
52 | PTR_ADDIU v0, 1 | ||
53 | #else | ||
54 | PTR_ADDU v0, AT | ||
55 | .set at | ||
56 | #endif | ||
46 | .set reorder | 57 | .set reorder |
47 | PTR_SUBU v0, a0 | 58 | PTR_SUBU v0, a0 |
48 | jr ra | 59 | jr ra |
diff --git a/arch/powerpc/kernel/mce.c b/arch/powerpc/kernel/mce.c index 15c99b649b04..b2eb4686bd8f 100644 --- a/arch/powerpc/kernel/mce.c +++ b/arch/powerpc/kernel/mce.c | |||
@@ -73,7 +73,7 @@ void save_mce_event(struct pt_regs *regs, long handled, | |||
73 | uint64_t nip, uint64_t addr) | 73 | uint64_t nip, uint64_t addr) |
74 | { | 74 | { |
75 | uint64_t srr1; | 75 | uint64_t srr1; |
76 | int index = __this_cpu_inc_return(mce_nest_count); | 76 | int index = __this_cpu_inc_return(mce_nest_count) - 1; |
77 | struct machine_check_event *mce = this_cpu_ptr(&mce_event[index]); | 77 | struct machine_check_event *mce = this_cpu_ptr(&mce_event[index]); |
78 | 78 | ||
79 | /* | 79 | /* |
@@ -184,7 +184,7 @@ void machine_check_queue_event(void) | |||
184 | if (!get_mce_event(&evt, MCE_EVENT_RELEASE)) | 184 | if (!get_mce_event(&evt, MCE_EVENT_RELEASE)) |
185 | return; | 185 | return; |
186 | 186 | ||
187 | index = __this_cpu_inc_return(mce_queue_count); | 187 | index = __this_cpu_inc_return(mce_queue_count) - 1; |
188 | /* If queue is full, just return for now. */ | 188 | /* If queue is full, just return for now. */ |
189 | if (index >= MAX_MC_EVT) { | 189 | if (index >= MAX_MC_EVT) { |
190 | __this_cpu_dec(mce_queue_count); | 190 | __this_cpu_dec(mce_queue_count); |
diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S index f096e72262f4..1db685104ffc 100644 --- a/arch/powerpc/kernel/vmlinux.lds.S +++ b/arch/powerpc/kernel/vmlinux.lds.S | |||
@@ -213,6 +213,7 @@ SECTIONS | |||
213 | *(.opd) | 213 | *(.opd) |
214 | } | 214 | } |
215 | 215 | ||
216 | . = ALIGN(256); | ||
216 | .got : AT(ADDR(.got) - LOAD_OFFSET) { | 217 | .got : AT(ADDR(.got) - LOAD_OFFSET) { |
217 | __toc_start = .; | 218 | __toc_start = .; |
218 | #ifndef CONFIG_RELOCATABLE | 219 | #ifndef CONFIG_RELOCATABLE |
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c index 48d3c5d2ecc9..df81caab7383 100644 --- a/arch/powerpc/kvm/book3s_hv.c +++ b/arch/powerpc/kvm/book3s_hv.c | |||
@@ -1952,7 +1952,7 @@ static void post_guest_process(struct kvmppc_vcore *vc) | |||
1952 | */ | 1952 | */ |
1953 | static noinline void kvmppc_run_core(struct kvmppc_vcore *vc) | 1953 | static noinline void kvmppc_run_core(struct kvmppc_vcore *vc) |
1954 | { | 1954 | { |
1955 | struct kvm_vcpu *vcpu; | 1955 | struct kvm_vcpu *vcpu, *vnext; |
1956 | int i; | 1956 | int i; |
1957 | int srcu_idx; | 1957 | int srcu_idx; |
1958 | 1958 | ||
@@ -1982,7 +1982,8 @@ static noinline void kvmppc_run_core(struct kvmppc_vcore *vc) | |||
1982 | */ | 1982 | */ |
1983 | if ((threads_per_core > 1) && | 1983 | if ((threads_per_core > 1) && |
1984 | ((vc->num_threads > threads_per_subcore) || !on_primary_thread())) { | 1984 | ((vc->num_threads > threads_per_subcore) || !on_primary_thread())) { |
1985 | list_for_each_entry(vcpu, &vc->runnable_threads, arch.run_list) { | 1985 | list_for_each_entry_safe(vcpu, vnext, &vc->runnable_threads, |
1986 | arch.run_list) { | ||
1986 | vcpu->arch.ret = -EBUSY; | 1987 | vcpu->arch.ret = -EBUSY; |
1987 | kvmppc_remove_runnable(vc, vcpu); | 1988 | kvmppc_remove_runnable(vc, vcpu); |
1988 | wake_up(&vcpu->arch.cpu_run); | 1989 | wake_up(&vcpu->arch.cpu_run); |
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c index 0ce968b00b7c..3385e3d0506e 100644 --- a/arch/powerpc/mm/hugetlbpage.c +++ b/arch/powerpc/mm/hugetlbpage.c | |||
@@ -689,27 +689,34 @@ void hugetlb_free_pgd_range(struct mmu_gather *tlb, | |||
689 | struct page * | 689 | struct page * |
690 | follow_huge_addr(struct mm_struct *mm, unsigned long address, int write) | 690 | follow_huge_addr(struct mm_struct *mm, unsigned long address, int write) |
691 | { | 691 | { |
692 | pte_t *ptep; | 692 | pte_t *ptep, pte; |
693 | struct page *page; | ||
694 | unsigned shift; | 693 | unsigned shift; |
695 | unsigned long mask, flags; | 694 | unsigned long mask, flags; |
695 | struct page *page = ERR_PTR(-EINVAL); | ||
696 | |||
697 | local_irq_save(flags); | ||
698 | ptep = find_linux_pte_or_hugepte(mm->pgd, address, &shift); | ||
699 | if (!ptep) | ||
700 | goto no_page; | ||
701 | pte = READ_ONCE(*ptep); | ||
696 | /* | 702 | /* |
703 | * Verify it is a huge page else bail. | ||
697 | * Transparent hugepages are handled by generic code. We can skip them | 704 | * Transparent hugepages are handled by generic code. We can skip them |
698 | * here. | 705 | * here. |
699 | */ | 706 | */ |
700 | local_irq_save(flags); | 707 | if (!shift || pmd_trans_huge(__pmd(pte_val(pte)))) |
701 | ptep = find_linux_pte_or_hugepte(mm->pgd, address, &shift); | 708 | goto no_page; |
702 | 709 | ||
703 | /* Verify it is a huge page else bail. */ | 710 | if (!pte_present(pte)) { |
704 | if (!ptep || !shift || pmd_trans_huge(*(pmd_t *)ptep)) { | 711 | page = NULL; |
705 | local_irq_restore(flags); | 712 | goto no_page; |
706 | return ERR_PTR(-EINVAL); | ||
707 | } | 713 | } |
708 | mask = (1UL << shift) - 1; | 714 | mask = (1UL << shift) - 1; |
709 | page = pte_page(*ptep); | 715 | page = pte_page(pte); |
710 | if (page) | 716 | if (page) |
711 | page += (address & mask) / PAGE_SIZE; | 717 | page += (address & mask) / PAGE_SIZE; |
712 | 718 | ||
719 | no_page: | ||
713 | local_irq_restore(flags); | 720 | local_irq_restore(flags); |
714 | return page; | 721 | return page; |
715 | } | 722 | } |
diff --git a/arch/powerpc/mm/pgtable_64.c b/arch/powerpc/mm/pgtable_64.c index 59daa5eeec25..6bfadf1aa5cb 100644 --- a/arch/powerpc/mm/pgtable_64.c +++ b/arch/powerpc/mm/pgtable_64.c | |||
@@ -839,6 +839,17 @@ pmd_t pmdp_get_and_clear(struct mm_struct *mm, | |||
839 | * hash fault look at them. | 839 | * hash fault look at them. |
840 | */ | 840 | */ |
841 | memset(pgtable, 0, PTE_FRAG_SIZE); | 841 | memset(pgtable, 0, PTE_FRAG_SIZE); |
842 | /* | ||
843 | * Serialize against find_linux_pte_or_hugepte which does lock-less | ||
844 | * lookup in page tables with local interrupts disabled. For huge pages | ||
845 | * it casts pmd_t to pte_t. Since format of pte_t is different from | ||
846 | * pmd_t we want to prevent transit from pmd pointing to page table | ||
847 | * to pmd pointing to huge page (and back) while interrupts are disabled. | ||
848 | * We clear pmd to possibly replace it with page table pointer in | ||
849 | * different code paths. So make sure we wait for the parallel | ||
850 | * find_linux_pte_or_hugepage to finish. | ||
851 | */ | ||
852 | kick_all_cpus_sync(); | ||
842 | return old_pmd; | 853 | return old_pmd; |
843 | } | 854 | } |
844 | 855 | ||
diff --git a/arch/s390/crypto/ghash_s390.c b/arch/s390/crypto/ghash_s390.c index 7940dc90e80b..b258110da952 100644 --- a/arch/s390/crypto/ghash_s390.c +++ b/arch/s390/crypto/ghash_s390.c | |||
@@ -16,11 +16,12 @@ | |||
16 | #define GHASH_DIGEST_SIZE 16 | 16 | #define GHASH_DIGEST_SIZE 16 |
17 | 17 | ||
18 | struct ghash_ctx { | 18 | struct ghash_ctx { |
19 | u8 icv[16]; | 19 | u8 key[GHASH_BLOCK_SIZE]; |
20 | u8 key[16]; | ||
21 | }; | 20 | }; |
22 | 21 | ||
23 | struct ghash_desc_ctx { | 22 | struct ghash_desc_ctx { |
23 | u8 icv[GHASH_BLOCK_SIZE]; | ||
24 | u8 key[GHASH_BLOCK_SIZE]; | ||
24 | u8 buffer[GHASH_BLOCK_SIZE]; | 25 | u8 buffer[GHASH_BLOCK_SIZE]; |
25 | u32 bytes; | 26 | u32 bytes; |
26 | }; | 27 | }; |
@@ -28,8 +29,10 @@ struct ghash_desc_ctx { | |||
28 | static int ghash_init(struct shash_desc *desc) | 29 | static int ghash_init(struct shash_desc *desc) |
29 | { | 30 | { |
30 | struct ghash_desc_ctx *dctx = shash_desc_ctx(desc); | 31 | struct ghash_desc_ctx *dctx = shash_desc_ctx(desc); |
32 | struct ghash_ctx *ctx = crypto_shash_ctx(desc->tfm); | ||
31 | 33 | ||
32 | memset(dctx, 0, sizeof(*dctx)); | 34 | memset(dctx, 0, sizeof(*dctx)); |
35 | memcpy(dctx->key, ctx->key, GHASH_BLOCK_SIZE); | ||
33 | 36 | ||
34 | return 0; | 37 | return 0; |
35 | } | 38 | } |
@@ -45,7 +48,6 @@ static int ghash_setkey(struct crypto_shash *tfm, | |||
45 | } | 48 | } |
46 | 49 | ||
47 | memcpy(ctx->key, key, GHASH_BLOCK_SIZE); | 50 | memcpy(ctx->key, key, GHASH_BLOCK_SIZE); |
48 | memset(ctx->icv, 0, GHASH_BLOCK_SIZE); | ||
49 | 51 | ||
50 | return 0; | 52 | return 0; |
51 | } | 53 | } |
@@ -54,7 +56,6 @@ static int ghash_update(struct shash_desc *desc, | |||
54 | const u8 *src, unsigned int srclen) | 56 | const u8 *src, unsigned int srclen) |
55 | { | 57 | { |
56 | struct ghash_desc_ctx *dctx = shash_desc_ctx(desc); | 58 | struct ghash_desc_ctx *dctx = shash_desc_ctx(desc); |
57 | struct ghash_ctx *ctx = crypto_shash_ctx(desc->tfm); | ||
58 | unsigned int n; | 59 | unsigned int n; |
59 | u8 *buf = dctx->buffer; | 60 | u8 *buf = dctx->buffer; |
60 | int ret; | 61 | int ret; |
@@ -70,7 +71,7 @@ static int ghash_update(struct shash_desc *desc, | |||
70 | src += n; | 71 | src += n; |
71 | 72 | ||
72 | if (!dctx->bytes) { | 73 | if (!dctx->bytes) { |
73 | ret = crypt_s390_kimd(KIMD_GHASH, ctx, buf, | 74 | ret = crypt_s390_kimd(KIMD_GHASH, dctx, buf, |
74 | GHASH_BLOCK_SIZE); | 75 | GHASH_BLOCK_SIZE); |
75 | if (ret != GHASH_BLOCK_SIZE) | 76 | if (ret != GHASH_BLOCK_SIZE) |
76 | return -EIO; | 77 | return -EIO; |
@@ -79,7 +80,7 @@ static int ghash_update(struct shash_desc *desc, | |||
79 | 80 | ||
80 | n = srclen & ~(GHASH_BLOCK_SIZE - 1); | 81 | n = srclen & ~(GHASH_BLOCK_SIZE - 1); |
81 | if (n) { | 82 | if (n) { |
82 | ret = crypt_s390_kimd(KIMD_GHASH, ctx, src, n); | 83 | ret = crypt_s390_kimd(KIMD_GHASH, dctx, src, n); |
83 | if (ret != n) | 84 | if (ret != n) |
84 | return -EIO; | 85 | return -EIO; |
85 | src += n; | 86 | src += n; |
@@ -94,7 +95,7 @@ static int ghash_update(struct shash_desc *desc, | |||
94 | return 0; | 95 | return 0; |
95 | } | 96 | } |
96 | 97 | ||
97 | static int ghash_flush(struct ghash_ctx *ctx, struct ghash_desc_ctx *dctx) | 98 | static int ghash_flush(struct ghash_desc_ctx *dctx) |
98 | { | 99 | { |
99 | u8 *buf = dctx->buffer; | 100 | u8 *buf = dctx->buffer; |
100 | int ret; | 101 | int ret; |
@@ -104,24 +105,24 @@ static int ghash_flush(struct ghash_ctx *ctx, struct ghash_desc_ctx *dctx) | |||
104 | 105 | ||
105 | memset(pos, 0, dctx->bytes); | 106 | memset(pos, 0, dctx->bytes); |
106 | 107 | ||
107 | ret = crypt_s390_kimd(KIMD_GHASH, ctx, buf, GHASH_BLOCK_SIZE); | 108 | ret = crypt_s390_kimd(KIMD_GHASH, dctx, buf, GHASH_BLOCK_SIZE); |
108 | if (ret != GHASH_BLOCK_SIZE) | 109 | if (ret != GHASH_BLOCK_SIZE) |
109 | return -EIO; | 110 | return -EIO; |
111 | |||
112 | dctx->bytes = 0; | ||
110 | } | 113 | } |
111 | 114 | ||
112 | dctx->bytes = 0; | ||
113 | return 0; | 115 | return 0; |
114 | } | 116 | } |
115 | 117 | ||
116 | static int ghash_final(struct shash_desc *desc, u8 *dst) | 118 | static int ghash_final(struct shash_desc *desc, u8 *dst) |
117 | { | 119 | { |
118 | struct ghash_desc_ctx *dctx = shash_desc_ctx(desc); | 120 | struct ghash_desc_ctx *dctx = shash_desc_ctx(desc); |
119 | struct ghash_ctx *ctx = crypto_shash_ctx(desc->tfm); | ||
120 | int ret; | 121 | int ret; |
121 | 122 | ||
122 | ret = ghash_flush(ctx, dctx); | 123 | ret = ghash_flush(dctx); |
123 | if (!ret) | 124 | if (!ret) |
124 | memcpy(dst, ctx->icv, GHASH_BLOCK_SIZE); | 125 | memcpy(dst, dctx->icv, GHASH_BLOCK_SIZE); |
125 | return ret; | 126 | return ret; |
126 | } | 127 | } |
127 | 128 | ||
diff --git a/arch/s390/crypto/prng.c b/arch/s390/crypto/prng.c index 1f374b39a4ec..9d5192c94963 100644 --- a/arch/s390/crypto/prng.c +++ b/arch/s390/crypto/prng.c | |||
@@ -125,7 +125,7 @@ static int generate_entropy(u8 *ebuf, size_t nbytes) | |||
125 | /* fill page with urandom bytes */ | 125 | /* fill page with urandom bytes */ |
126 | get_random_bytes(pg, PAGE_SIZE); | 126 | get_random_bytes(pg, PAGE_SIZE); |
127 | /* exor page with stckf values */ | 127 | /* exor page with stckf values */ |
128 | for (n = 0; n < sizeof(PAGE_SIZE/sizeof(u64)); n++) { | 128 | for (n = 0; n < PAGE_SIZE / sizeof(u64); n++) { |
129 | u64 *p = ((u64 *)pg) + n; | 129 | u64 *p = ((u64 *)pg) + n; |
130 | *p ^= get_tod_clock_fast(); | 130 | *p ^= get_tod_clock_fast(); |
131 | } | 131 | } |
diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h index fc642399b489..ef24a212eeb7 100644 --- a/arch/s390/include/asm/pgtable.h +++ b/arch/s390/include/asm/pgtable.h | |||
@@ -494,7 +494,7 @@ static inline int pmd_large(pmd_t pmd) | |||
494 | return (pmd_val(pmd) & _SEGMENT_ENTRY_LARGE) != 0; | 494 | return (pmd_val(pmd) & _SEGMENT_ENTRY_LARGE) != 0; |
495 | } | 495 | } |
496 | 496 | ||
497 | static inline int pmd_pfn(pmd_t pmd) | 497 | static inline unsigned long pmd_pfn(pmd_t pmd) |
498 | { | 498 | { |
499 | unsigned long origin_mask; | 499 | unsigned long origin_mask; |
500 | 500 | ||
diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c index 7690dc8e1ab5..20c146d1251a 100644 --- a/arch/s390/net/bpf_jit_comp.c +++ b/arch/s390/net/bpf_jit_comp.c | |||
@@ -443,8 +443,11 @@ static void bpf_jit_epilogue(struct bpf_jit *jit) | |||
443 | 443 | ||
444 | /* | 444 | /* |
445 | * Compile one eBPF instruction into s390x code | 445 | * Compile one eBPF instruction into s390x code |
446 | * | ||
447 | * NOTE: Use noinline because for gcov (-fprofile-arcs) gcc allocates a lot of | ||
448 | * stack space for the large switch statement. | ||
446 | */ | 449 | */ |
447 | static int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i) | 450 | static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i) |
448 | { | 451 | { |
449 | struct bpf_insn *insn = &fp->insnsi[i]; | 452 | struct bpf_insn *insn = &fp->insnsi[i]; |
450 | int jmp_off, last, insn_count = 1; | 453 | int jmp_off, last, insn_count = 1; |
@@ -588,8 +591,8 @@ static int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i) | |||
588 | EMIT4(0xb9160000, dst_reg, rc_reg); | 591 | EMIT4(0xb9160000, dst_reg, rc_reg); |
589 | break; | 592 | break; |
590 | } | 593 | } |
591 | case BPF_ALU64 | BPF_DIV | BPF_X: /* dst = dst / (u32) src */ | 594 | case BPF_ALU64 | BPF_DIV | BPF_X: /* dst = dst / src */ |
592 | case BPF_ALU64 | BPF_MOD | BPF_X: /* dst = dst % (u32) src */ | 595 | case BPF_ALU64 | BPF_MOD | BPF_X: /* dst = dst % src */ |
593 | { | 596 | { |
594 | int rc_reg = BPF_OP(insn->code) == BPF_DIV ? REG_W1 : REG_W0; | 597 | int rc_reg = BPF_OP(insn->code) == BPF_DIV ? REG_W1 : REG_W0; |
595 | 598 | ||
@@ -602,10 +605,8 @@ static int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i) | |||
602 | EMIT4_IMM(0xa7090000, REG_W0, 0); | 605 | EMIT4_IMM(0xa7090000, REG_W0, 0); |
603 | /* lgr %w1,%dst */ | 606 | /* lgr %w1,%dst */ |
604 | EMIT4(0xb9040000, REG_W1, dst_reg); | 607 | EMIT4(0xb9040000, REG_W1, dst_reg); |
605 | /* llgfr %dst,%src (u32 cast) */ | ||
606 | EMIT4(0xb9160000, dst_reg, src_reg); | ||
607 | /* dlgr %w0,%dst */ | 608 | /* dlgr %w0,%dst */ |
608 | EMIT4(0xb9870000, REG_W0, dst_reg); | 609 | EMIT4(0xb9870000, REG_W0, src_reg); |
609 | /* lgr %dst,%rc */ | 610 | /* lgr %dst,%rc */ |
610 | EMIT4(0xb9040000, dst_reg, rc_reg); | 611 | EMIT4(0xb9040000, dst_reg, rc_reg); |
611 | break; | 612 | break; |
@@ -632,8 +633,8 @@ static int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i) | |||
632 | EMIT4(0xb9160000, dst_reg, rc_reg); | 633 | EMIT4(0xb9160000, dst_reg, rc_reg); |
633 | break; | 634 | break; |
634 | } | 635 | } |
635 | case BPF_ALU64 | BPF_DIV | BPF_K: /* dst = dst / (u32) imm */ | 636 | case BPF_ALU64 | BPF_DIV | BPF_K: /* dst = dst / imm */ |
636 | case BPF_ALU64 | BPF_MOD | BPF_K: /* dst = dst % (u32) imm */ | 637 | case BPF_ALU64 | BPF_MOD | BPF_K: /* dst = dst % imm */ |
637 | { | 638 | { |
638 | int rc_reg = BPF_OP(insn->code) == BPF_DIV ? REG_W1 : REG_W0; | 639 | int rc_reg = BPF_OP(insn->code) == BPF_DIV ? REG_W1 : REG_W0; |
639 | 640 | ||
@@ -649,7 +650,7 @@ static int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp, int i) | |||
649 | EMIT4(0xb9040000, REG_W1, dst_reg); | 650 | EMIT4(0xb9040000, REG_W1, dst_reg); |
650 | /* dlg %w0,<d(imm)>(%l) */ | 651 | /* dlg %w0,<d(imm)>(%l) */ |
651 | EMIT6_DISP_LH(0xe3000000, 0x0087, REG_W0, REG_0, REG_L, | 652 | EMIT6_DISP_LH(0xe3000000, 0x0087, REG_W0, REG_0, REG_L, |
652 | EMIT_CONST_U64((u32) imm)); | 653 | EMIT_CONST_U64(imm)); |
653 | /* lgr %dst,%rc */ | 654 | /* lgr %dst,%rc */ |
654 | EMIT4(0xb9040000, dst_reg, rc_reg); | 655 | EMIT4(0xb9040000, dst_reg, rc_reg); |
655 | break; | 656 | break; |
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index dea2e7e962e3..f4a555beef19 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h | |||
@@ -207,6 +207,7 @@ union kvm_mmu_page_role { | |||
207 | unsigned nxe:1; | 207 | unsigned nxe:1; |
208 | unsigned cr0_wp:1; | 208 | unsigned cr0_wp:1; |
209 | unsigned smep_andnot_wp:1; | 209 | unsigned smep_andnot_wp:1; |
210 | unsigned smap_andnot_wp:1; | ||
210 | }; | 211 | }; |
211 | }; | 212 | }; |
212 | 213 | ||
@@ -400,6 +401,7 @@ struct kvm_vcpu_arch { | |||
400 | struct kvm_mmu_memory_cache mmu_page_header_cache; | 401 | struct kvm_mmu_memory_cache mmu_page_header_cache; |
401 | 402 | ||
402 | struct fpu guest_fpu; | 403 | struct fpu guest_fpu; |
404 | bool eager_fpu; | ||
403 | u64 xcr0; | 405 | u64 xcr0; |
404 | u64 guest_supported_xcr0; | 406 | u64 guest_supported_xcr0; |
405 | u32 guest_xstate_size; | 407 | u32 guest_xstate_size; |
@@ -743,6 +745,7 @@ struct kvm_x86_ops { | |||
743 | void (*cache_reg)(struct kvm_vcpu *vcpu, enum kvm_reg reg); | 745 | void (*cache_reg)(struct kvm_vcpu *vcpu, enum kvm_reg reg); |
744 | unsigned long (*get_rflags)(struct kvm_vcpu *vcpu); | 746 | unsigned long (*get_rflags)(struct kvm_vcpu *vcpu); |
745 | void (*set_rflags)(struct kvm_vcpu *vcpu, unsigned long rflags); | 747 | void (*set_rflags)(struct kvm_vcpu *vcpu, unsigned long rflags); |
748 | void (*fpu_activate)(struct kvm_vcpu *vcpu); | ||
746 | void (*fpu_deactivate)(struct kvm_vcpu *vcpu); | 749 | void (*fpu_deactivate)(struct kvm_vcpu *vcpu); |
747 | 750 | ||
748 | void (*tlb_flush)(struct kvm_vcpu *vcpu); | 751 | void (*tlb_flush)(struct kvm_vcpu *vcpu); |
diff --git a/arch/x86/include/uapi/asm/msr-index.h b/arch/x86/include/uapi/asm/msr-index.h index c469490db4a8..3c6bb342a48f 100644 --- a/arch/x86/include/uapi/asm/msr-index.h +++ b/arch/x86/include/uapi/asm/msr-index.h | |||
@@ -140,6 +140,7 @@ | |||
140 | #define MSR_CORE_C3_RESIDENCY 0x000003fc | 140 | #define MSR_CORE_C3_RESIDENCY 0x000003fc |
141 | #define MSR_CORE_C6_RESIDENCY 0x000003fd | 141 | #define MSR_CORE_C6_RESIDENCY 0x000003fd |
142 | #define MSR_CORE_C7_RESIDENCY 0x000003fe | 142 | #define MSR_CORE_C7_RESIDENCY 0x000003fe |
143 | #define MSR_KNL_CORE_C6_RESIDENCY 0x000003ff | ||
143 | #define MSR_PKG_C2_RESIDENCY 0x0000060d | 144 | #define MSR_PKG_C2_RESIDENCY 0x0000060d |
144 | #define MSR_PKG_C8_RESIDENCY 0x00000630 | 145 | #define MSR_PKG_C8_RESIDENCY 0x00000630 |
145 | #define MSR_PKG_C9_RESIDENCY 0x00000631 | 146 | #define MSR_PKG_C9_RESIDENCY 0x00000631 |
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/kvm/cpuid.c b/arch/x86/kvm/cpuid.c index 59b69f6a2844..1d08ad3582d0 100644 --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c | |||
@@ -16,6 +16,8 @@ | |||
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/vmalloc.h> | 17 | #include <linux/vmalloc.h> |
18 | #include <linux/uaccess.h> | 18 | #include <linux/uaccess.h> |
19 | #include <asm/i387.h> /* For use_eager_fpu. Ugh! */ | ||
20 | #include <asm/fpu-internal.h> /* For use_eager_fpu. Ugh! */ | ||
19 | #include <asm/user.h> | 21 | #include <asm/user.h> |
20 | #include <asm/xsave.h> | 22 | #include <asm/xsave.h> |
21 | #include "cpuid.h" | 23 | #include "cpuid.h" |
@@ -95,6 +97,8 @@ int kvm_update_cpuid(struct kvm_vcpu *vcpu) | |||
95 | if (best && (best->eax & (F(XSAVES) | F(XSAVEC)))) | 97 | if (best && (best->eax & (F(XSAVES) | F(XSAVEC)))) |
96 | best->ebx = xstate_required_size(vcpu->arch.xcr0, true); | 98 | best->ebx = xstate_required_size(vcpu->arch.xcr0, true); |
97 | 99 | ||
100 | vcpu->arch.eager_fpu = guest_cpuid_has_mpx(vcpu); | ||
101 | |||
98 | /* | 102 | /* |
99 | * The existing code assumes virtual address is 48-bit in the canonical | 103 | * The existing code assumes virtual address is 48-bit in the canonical |
100 | * address checks; exit if it is ever changed. | 104 | * address checks; exit if it is ever changed. |
diff --git a/arch/x86/kvm/cpuid.h b/arch/x86/kvm/cpuid.h index c3b1ad9fca81..496b3695d3d3 100644 --- a/arch/x86/kvm/cpuid.h +++ b/arch/x86/kvm/cpuid.h | |||
@@ -117,4 +117,12 @@ static inline bool guest_cpuid_has_rtm(struct kvm_vcpu *vcpu) | |||
117 | best = kvm_find_cpuid_entry(vcpu, 7, 0); | 117 | best = kvm_find_cpuid_entry(vcpu, 7, 0); |
118 | return best && (best->ebx & bit(X86_FEATURE_RTM)); | 118 | return best && (best->ebx & bit(X86_FEATURE_RTM)); |
119 | } | 119 | } |
120 | |||
121 | static inline bool guest_cpuid_has_mpx(struct kvm_vcpu *vcpu) | ||
122 | { | ||
123 | struct kvm_cpuid_entry2 *best; | ||
124 | |||
125 | best = kvm_find_cpuid_entry(vcpu, 7, 0); | ||
126 | return best && (best->ebx & bit(X86_FEATURE_MPX)); | ||
127 | } | ||
120 | #endif | 128 | #endif |
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index d43867c33bc4..44a7d2515497 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c | |||
@@ -3736,8 +3736,8 @@ static void reset_rsvds_bits_mask_ept(struct kvm_vcpu *vcpu, | |||
3736 | } | 3736 | } |
3737 | } | 3737 | } |
3738 | 3738 | ||
3739 | void update_permission_bitmask(struct kvm_vcpu *vcpu, | 3739 | static void update_permission_bitmask(struct kvm_vcpu *vcpu, |
3740 | struct kvm_mmu *mmu, bool ept) | 3740 | struct kvm_mmu *mmu, bool ept) |
3741 | { | 3741 | { |
3742 | unsigned bit, byte, pfec; | 3742 | unsigned bit, byte, pfec; |
3743 | u8 map; | 3743 | u8 map; |
@@ -3918,6 +3918,7 @@ static void init_kvm_tdp_mmu(struct kvm_vcpu *vcpu) | |||
3918 | void kvm_init_shadow_mmu(struct kvm_vcpu *vcpu) | 3918 | void kvm_init_shadow_mmu(struct kvm_vcpu *vcpu) |
3919 | { | 3919 | { |
3920 | bool smep = kvm_read_cr4_bits(vcpu, X86_CR4_SMEP); | 3920 | bool smep = kvm_read_cr4_bits(vcpu, X86_CR4_SMEP); |
3921 | bool smap = kvm_read_cr4_bits(vcpu, X86_CR4_SMAP); | ||
3921 | struct kvm_mmu *context = &vcpu->arch.mmu; | 3922 | struct kvm_mmu *context = &vcpu->arch.mmu; |
3922 | 3923 | ||
3923 | MMU_WARN_ON(VALID_PAGE(context->root_hpa)); | 3924 | MMU_WARN_ON(VALID_PAGE(context->root_hpa)); |
@@ -3936,6 +3937,8 @@ void kvm_init_shadow_mmu(struct kvm_vcpu *vcpu) | |||
3936 | context->base_role.cr0_wp = is_write_protection(vcpu); | 3937 | context->base_role.cr0_wp = is_write_protection(vcpu); |
3937 | context->base_role.smep_andnot_wp | 3938 | context->base_role.smep_andnot_wp |
3938 | = smep && !is_write_protection(vcpu); | 3939 | = smep && !is_write_protection(vcpu); |
3940 | context->base_role.smap_andnot_wp | ||
3941 | = smap && !is_write_protection(vcpu); | ||
3939 | } | 3942 | } |
3940 | EXPORT_SYMBOL_GPL(kvm_init_shadow_mmu); | 3943 | EXPORT_SYMBOL_GPL(kvm_init_shadow_mmu); |
3941 | 3944 | ||
@@ -4207,12 +4210,18 @@ void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa, | |||
4207 | const u8 *new, int bytes) | 4210 | const u8 *new, int bytes) |
4208 | { | 4211 | { |
4209 | gfn_t gfn = gpa >> PAGE_SHIFT; | 4212 | gfn_t gfn = gpa >> PAGE_SHIFT; |
4210 | union kvm_mmu_page_role mask = { .word = 0 }; | ||
4211 | struct kvm_mmu_page *sp; | 4213 | struct kvm_mmu_page *sp; |
4212 | LIST_HEAD(invalid_list); | 4214 | LIST_HEAD(invalid_list); |
4213 | u64 entry, gentry, *spte; | 4215 | u64 entry, gentry, *spte; |
4214 | int npte; | 4216 | int npte; |
4215 | bool remote_flush, local_flush, zap_page; | 4217 | bool remote_flush, local_flush, zap_page; |
4218 | union kvm_mmu_page_role mask = (union kvm_mmu_page_role) { | ||
4219 | .cr0_wp = 1, | ||
4220 | .cr4_pae = 1, | ||
4221 | .nxe = 1, | ||
4222 | .smep_andnot_wp = 1, | ||
4223 | .smap_andnot_wp = 1, | ||
4224 | }; | ||
4216 | 4225 | ||
4217 | /* | 4226 | /* |
4218 | * If we don't have indirect shadow pages, it means no page is | 4227 | * If we don't have indirect shadow pages, it means no page is |
@@ -4238,7 +4247,6 @@ void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa, | |||
4238 | ++vcpu->kvm->stat.mmu_pte_write; | 4247 | ++vcpu->kvm->stat.mmu_pte_write; |
4239 | kvm_mmu_audit(vcpu, AUDIT_PRE_PTE_WRITE); | 4248 | kvm_mmu_audit(vcpu, AUDIT_PRE_PTE_WRITE); |
4240 | 4249 | ||
4241 | mask.cr0_wp = mask.cr4_pae = mask.nxe = 1; | ||
4242 | for_each_gfn_indirect_valid_sp(vcpu->kvm, sp, gfn) { | 4250 | for_each_gfn_indirect_valid_sp(vcpu->kvm, sp, gfn) { |
4243 | if (detect_write_misaligned(sp, gpa, bytes) || | 4251 | if (detect_write_misaligned(sp, gpa, bytes) || |
4244 | detect_write_flooding(sp)) { | 4252 | detect_write_flooding(sp)) { |
diff --git a/arch/x86/kvm/mmu.h b/arch/x86/kvm/mmu.h index c7d65637c851..0ada65ecddcf 100644 --- a/arch/x86/kvm/mmu.h +++ b/arch/x86/kvm/mmu.h | |||
@@ -71,8 +71,6 @@ enum { | |||
71 | int handle_mmio_page_fault_common(struct kvm_vcpu *vcpu, u64 addr, bool direct); | 71 | int handle_mmio_page_fault_common(struct kvm_vcpu *vcpu, u64 addr, bool direct); |
72 | void kvm_init_shadow_mmu(struct kvm_vcpu *vcpu); | 72 | void kvm_init_shadow_mmu(struct kvm_vcpu *vcpu); |
73 | void kvm_init_shadow_ept_mmu(struct kvm_vcpu *vcpu, bool execonly); | 73 | void kvm_init_shadow_ept_mmu(struct kvm_vcpu *vcpu, bool execonly); |
74 | void update_permission_bitmask(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, | ||
75 | bool ept); | ||
76 | 74 | ||
77 | static inline unsigned int kvm_mmu_available_pages(struct kvm *kvm) | 75 | static inline unsigned int kvm_mmu_available_pages(struct kvm *kvm) |
78 | { | 76 | { |
@@ -166,6 +164,8 @@ static inline bool permission_fault(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, | |||
166 | int index = (pfec >> 1) + | 164 | int index = (pfec >> 1) + |
167 | (smap >> (X86_EFLAGS_AC_BIT - PFERR_RSVD_BIT + 1)); | 165 | (smap >> (X86_EFLAGS_AC_BIT - PFERR_RSVD_BIT + 1)); |
168 | 166 | ||
167 | WARN_ON(pfec & PFERR_RSVD_MASK); | ||
168 | |||
169 | return (mmu->permissions[index] >> pte_access) & 1; | 169 | return (mmu->permissions[index] >> pte_access) & 1; |
170 | } | 170 | } |
171 | 171 | ||
diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h index fd49c867b25a..6e6d115fe9b5 100644 --- a/arch/x86/kvm/paging_tmpl.h +++ b/arch/x86/kvm/paging_tmpl.h | |||
@@ -718,6 +718,13 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr, u32 error_code, | |||
718 | mmu_is_nested(vcpu)); | 718 | mmu_is_nested(vcpu)); |
719 | if (likely(r != RET_MMIO_PF_INVALID)) | 719 | if (likely(r != RET_MMIO_PF_INVALID)) |
720 | return r; | 720 | return r; |
721 | |||
722 | /* | ||
723 | * page fault with PFEC.RSVD = 1 is caused by shadow | ||
724 | * page fault, should not be used to walk guest page | ||
725 | * table. | ||
726 | */ | ||
727 | error_code &= ~PFERR_RSVD_MASK; | ||
721 | }; | 728 | }; |
722 | 729 | ||
723 | r = mmu_topup_memory_caches(vcpu); | 730 | r = mmu_topup_memory_caches(vcpu); |
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index ce741b8650f6..9afa233b5482 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -4381,6 +4381,7 @@ static struct kvm_x86_ops svm_x86_ops = { | |||
4381 | .cache_reg = svm_cache_reg, | 4381 | .cache_reg = svm_cache_reg, |
4382 | .get_rflags = svm_get_rflags, | 4382 | .get_rflags = svm_get_rflags, |
4383 | .set_rflags = svm_set_rflags, | 4383 | .set_rflags = svm_set_rflags, |
4384 | .fpu_activate = svm_fpu_activate, | ||
4384 | .fpu_deactivate = svm_fpu_deactivate, | 4385 | .fpu_deactivate = svm_fpu_deactivate, |
4385 | 4386 | ||
4386 | .tlb_flush = svm_flush_tlb, | 4387 | .tlb_flush = svm_flush_tlb, |
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index f7b61687bd79..2d73807f0d31 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -10185,6 +10185,7 @@ static struct kvm_x86_ops vmx_x86_ops = { | |||
10185 | .cache_reg = vmx_cache_reg, | 10185 | .cache_reg = vmx_cache_reg, |
10186 | .get_rflags = vmx_get_rflags, | 10186 | .get_rflags = vmx_get_rflags, |
10187 | .set_rflags = vmx_set_rflags, | 10187 | .set_rflags = vmx_set_rflags, |
10188 | .fpu_activate = vmx_fpu_activate, | ||
10188 | .fpu_deactivate = vmx_fpu_deactivate, | 10189 | .fpu_deactivate = vmx_fpu_deactivate, |
10189 | 10190 | ||
10190 | .tlb_flush = vmx_flush_tlb, | 10191 | .tlb_flush = vmx_flush_tlb, |
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index c73efcd03e29..ea306adbbc13 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -702,8 +702,9 @@ EXPORT_SYMBOL_GPL(kvm_set_xcr); | |||
702 | int kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) | 702 | int kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) |
703 | { | 703 | { |
704 | unsigned long old_cr4 = kvm_read_cr4(vcpu); | 704 | unsigned long old_cr4 = kvm_read_cr4(vcpu); |
705 | unsigned long pdptr_bits = X86_CR4_PGE | X86_CR4_PSE | | 705 | unsigned long pdptr_bits = X86_CR4_PGE | X86_CR4_PSE | X86_CR4_PAE | |
706 | X86_CR4_PAE | X86_CR4_SMEP; | 706 | X86_CR4_SMEP | X86_CR4_SMAP; |
707 | |||
707 | if (cr4 & CR4_RESERVED_BITS) | 708 | if (cr4 & CR4_RESERVED_BITS) |
708 | return 1; | 709 | return 1; |
709 | 710 | ||
@@ -744,9 +745,6 @@ int kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) | |||
744 | (!(cr4 & X86_CR4_PCIDE) && (old_cr4 & X86_CR4_PCIDE))) | 745 | (!(cr4 & X86_CR4_PCIDE) && (old_cr4 & X86_CR4_PCIDE))) |
745 | kvm_mmu_reset_context(vcpu); | 746 | kvm_mmu_reset_context(vcpu); |
746 | 747 | ||
747 | if ((cr4 ^ old_cr4) & X86_CR4_SMAP) | ||
748 | update_permission_bitmask(vcpu, vcpu->arch.walk_mmu, false); | ||
749 | |||
750 | if ((cr4 ^ old_cr4) & X86_CR4_OSXSAVE) | 748 | if ((cr4 ^ old_cr4) & X86_CR4_OSXSAVE) |
751 | kvm_update_cpuid(vcpu); | 749 | kvm_update_cpuid(vcpu); |
752 | 750 | ||
@@ -6197,6 +6195,8 @@ void kvm_vcpu_reload_apic_access_page(struct kvm_vcpu *vcpu) | |||
6197 | return; | 6195 | return; |
6198 | 6196 | ||
6199 | page = gfn_to_page(vcpu->kvm, APIC_DEFAULT_PHYS_BASE >> PAGE_SHIFT); | 6197 | page = gfn_to_page(vcpu->kvm, APIC_DEFAULT_PHYS_BASE >> PAGE_SHIFT); |
6198 | if (is_error_page(page)) | ||
6199 | return; | ||
6200 | kvm_x86_ops->set_apic_access_page_addr(vcpu, page_to_phys(page)); | 6200 | kvm_x86_ops->set_apic_access_page_addr(vcpu, page_to_phys(page)); |
6201 | 6201 | ||
6202 | /* | 6202 | /* |
@@ -7060,7 +7060,9 @@ void kvm_put_guest_fpu(struct kvm_vcpu *vcpu) | |||
7060 | fpu_save_init(&vcpu->arch.guest_fpu); | 7060 | fpu_save_init(&vcpu->arch.guest_fpu); |
7061 | __kernel_fpu_end(); | 7061 | __kernel_fpu_end(); |
7062 | ++vcpu->stat.fpu_reload; | 7062 | ++vcpu->stat.fpu_reload; |
7063 | kvm_make_request(KVM_REQ_DEACTIVATE_FPU, vcpu); | 7063 | if (!vcpu->arch.eager_fpu) |
7064 | kvm_make_request(KVM_REQ_DEACTIVATE_FPU, vcpu); | ||
7065 | |||
7064 | trace_kvm_fpu(0); | 7066 | trace_kvm_fpu(0); |
7065 | } | 7067 | } |
7066 | 7068 | ||
@@ -7076,11 +7078,21 @@ void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu) | |||
7076 | struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, | 7078 | struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, |
7077 | unsigned int id) | 7079 | unsigned int id) |
7078 | { | 7080 | { |
7081 | struct kvm_vcpu *vcpu; | ||
7082 | |||
7079 | if (check_tsc_unstable() && atomic_read(&kvm->online_vcpus) != 0) | 7083 | if (check_tsc_unstable() && atomic_read(&kvm->online_vcpus) != 0) |
7080 | printk_once(KERN_WARNING | 7084 | printk_once(KERN_WARNING |
7081 | "kvm: SMP vm created on host with unstable TSC; " | 7085 | "kvm: SMP vm created on host with unstable TSC; " |
7082 | "guest TSC will not be reliable\n"); | 7086 | "guest TSC will not be reliable\n"); |
7083 | return kvm_x86_ops->vcpu_create(kvm, id); | 7087 | |
7088 | vcpu = kvm_x86_ops->vcpu_create(kvm, id); | ||
7089 | |||
7090 | /* | ||
7091 | * Activate fpu unconditionally in case the guest needs eager FPU. It will be | ||
7092 | * deactivated soon if it doesn't. | ||
7093 | */ | ||
7094 | kvm_x86_ops->fpu_activate(vcpu); | ||
7095 | return vcpu; | ||
7084 | } | 7096 | } |
7085 | 7097 | ||
7086 | int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu) | 7098 | int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu) |
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/block/blk-core.c b/block/blk-core.c index 7871603f0a29..03b5f8d77f37 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -734,6 +734,8 @@ blk_init_queue_node(request_fn_proc *rfn, spinlock_t *lock, int node_id) | |||
734 | } | 734 | } |
735 | EXPORT_SYMBOL(blk_init_queue_node); | 735 | EXPORT_SYMBOL(blk_init_queue_node); |
736 | 736 | ||
737 | static void blk_queue_bio(struct request_queue *q, struct bio *bio); | ||
738 | |||
737 | struct request_queue * | 739 | struct request_queue * |
738 | blk_init_allocated_queue(struct request_queue *q, request_fn_proc *rfn, | 740 | blk_init_allocated_queue(struct request_queue *q, request_fn_proc *rfn, |
739 | spinlock_t *lock) | 741 | spinlock_t *lock) |
@@ -1578,7 +1580,7 @@ void init_request_from_bio(struct request *req, struct bio *bio) | |||
1578 | blk_rq_bio_prep(req->q, req, bio); | 1580 | blk_rq_bio_prep(req->q, req, bio); |
1579 | } | 1581 | } |
1580 | 1582 | ||
1581 | void blk_queue_bio(struct request_queue *q, struct bio *bio) | 1583 | static void blk_queue_bio(struct request_queue *q, struct bio *bio) |
1582 | { | 1584 | { |
1583 | const bool sync = !!(bio->bi_rw & REQ_SYNC); | 1585 | const bool sync = !!(bio->bi_rw & REQ_SYNC); |
1584 | struct blk_plug *plug; | 1586 | struct blk_plug *plug; |
@@ -1686,7 +1688,6 @@ out_unlock: | |||
1686 | spin_unlock_irq(q->queue_lock); | 1688 | spin_unlock_irq(q->queue_lock); |
1687 | } | 1689 | } |
1688 | } | 1690 | } |
1689 | EXPORT_SYMBOL_GPL(blk_queue_bio); /* for device mapper only */ | ||
1690 | 1691 | ||
1691 | /* | 1692 | /* |
1692 | * If bio->bi_dev is a partition, remap the location | 1693 | * If bio->bi_dev is a partition, remap the location |
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/crypto/algif_aead.c b/crypto/algif_aead.c index 00a6fe166fed..69abada22373 100644 --- a/crypto/algif_aead.c +++ b/crypto/algif_aead.c | |||
@@ -33,7 +33,7 @@ struct aead_ctx { | |||
33 | /* | 33 | /* |
34 | * RSGL_MAX_ENTRIES is an artificial limit where user space at maximum | 34 | * RSGL_MAX_ENTRIES is an artificial limit where user space at maximum |
35 | * can cause the kernel to allocate RSGL_MAX_ENTRIES * ALG_MAX_PAGES | 35 | * can cause the kernel to allocate RSGL_MAX_ENTRIES * ALG_MAX_PAGES |
36 | * bytes | 36 | * pages |
37 | */ | 37 | */ |
38 | #define RSGL_MAX_ENTRIES ALG_MAX_PAGES | 38 | #define RSGL_MAX_ENTRIES ALG_MAX_PAGES |
39 | struct af_alg_sgl rsgl[RSGL_MAX_ENTRIES]; | 39 | struct af_alg_sgl rsgl[RSGL_MAX_ENTRIES]; |
@@ -435,11 +435,10 @@ static int aead_recvmsg(struct socket *sock, struct msghdr *msg, size_t ignored, | |||
435 | if (err < 0) | 435 | if (err < 0) |
436 | goto unlock; | 436 | goto unlock; |
437 | usedpages += err; | 437 | usedpages += err; |
438 | /* chain the new scatterlist with initial list */ | 438 | /* chain the new scatterlist with previous one */ |
439 | if (cnt) | 439 | if (cnt) |
440 | scatterwalk_crypto_chain(ctx->rsgl[0].sg, | 440 | af_alg_link_sg(&ctx->rsgl[cnt-1], &ctx->rsgl[cnt]); |
441 | ctx->rsgl[cnt].sg, 1, | 441 | |
442 | sg_nents(ctx->rsgl[cnt-1].sg)); | ||
443 | /* we do not need more iovecs as we have sufficient memory */ | 442 | /* we do not need more iovecs as we have sufficient memory */ |
444 | if (outlen <= usedpages) | 443 | if (outlen <= usedpages) |
445 | break; | 444 | break; |
diff --git a/drivers/block/nvme-scsi.c b/drivers/block/nvme-scsi.c index 88f13c525712..44f2514fb775 100644 --- a/drivers/block/nvme-scsi.c +++ b/drivers/block/nvme-scsi.c | |||
@@ -2257,7 +2257,8 @@ static int nvme_trans_inquiry(struct nvme_ns *ns, struct sg_io_hdr *hdr, | |||
2257 | page_code = GET_INQ_PAGE_CODE(cmd); | 2257 | page_code = GET_INQ_PAGE_CODE(cmd); |
2258 | alloc_len = GET_INQ_ALLOC_LENGTH(cmd); | 2258 | alloc_len = GET_INQ_ALLOC_LENGTH(cmd); |
2259 | 2259 | ||
2260 | inq_response = kmalloc(alloc_len, GFP_KERNEL); | 2260 | inq_response = kmalloc(max(alloc_len, STANDARD_INQUIRY_LENGTH), |
2261 | GFP_KERNEL); | ||
2261 | if (inq_response == NULL) { | 2262 | if (inq_response == NULL) { |
2262 | res = -ENOMEM; | 2263 | res = -ENOMEM; |
2263 | goto out_mem; | 2264 | goto out_mem; |
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c index 288547a3c566..8c81af6dbe06 100644 --- a/drivers/bluetooth/ath3k.c +++ b/drivers/bluetooth/ath3k.c | |||
@@ -88,6 +88,7 @@ static const struct usb_device_id ath3k_table[] = { | |||
88 | { USB_DEVICE(0x04CA, 0x3007) }, | 88 | { USB_DEVICE(0x04CA, 0x3007) }, |
89 | { USB_DEVICE(0x04CA, 0x3008) }, | 89 | { USB_DEVICE(0x04CA, 0x3008) }, |
90 | { USB_DEVICE(0x04CA, 0x300b) }, | 90 | { USB_DEVICE(0x04CA, 0x300b) }, |
91 | { USB_DEVICE(0x04CA, 0x300f) }, | ||
91 | { USB_DEVICE(0x04CA, 0x3010) }, | 92 | { USB_DEVICE(0x04CA, 0x3010) }, |
92 | { USB_DEVICE(0x0930, 0x0219) }, | 93 | { USB_DEVICE(0x0930, 0x0219) }, |
93 | { USB_DEVICE(0x0930, 0x0220) }, | 94 | { USB_DEVICE(0x0930, 0x0220) }, |
@@ -104,6 +105,7 @@ static const struct usb_device_id ath3k_table[] = { | |||
104 | { USB_DEVICE(0x0cf3, 0xe003) }, | 105 | { USB_DEVICE(0x0cf3, 0xe003) }, |
105 | { USB_DEVICE(0x0CF3, 0xE004) }, | 106 | { USB_DEVICE(0x0CF3, 0xE004) }, |
106 | { USB_DEVICE(0x0CF3, 0xE005) }, | 107 | { USB_DEVICE(0x0CF3, 0xE005) }, |
108 | { USB_DEVICE(0x0CF3, 0xE006) }, | ||
107 | { USB_DEVICE(0x13d3, 0x3362) }, | 109 | { USB_DEVICE(0x13d3, 0x3362) }, |
108 | { USB_DEVICE(0x13d3, 0x3375) }, | 110 | { USB_DEVICE(0x13d3, 0x3375) }, |
109 | { USB_DEVICE(0x13d3, 0x3393) }, | 111 | { USB_DEVICE(0x13d3, 0x3393) }, |
@@ -143,6 +145,7 @@ static const struct usb_device_id ath3k_blist_tbl[] = { | |||
143 | { USB_DEVICE(0x04ca, 0x3007), .driver_info = BTUSB_ATH3012 }, | 145 | { USB_DEVICE(0x04ca, 0x3007), .driver_info = BTUSB_ATH3012 }, |
144 | { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 }, | 146 | { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 }, |
145 | { USB_DEVICE(0x04ca, 0x300b), .driver_info = BTUSB_ATH3012 }, | 147 | { USB_DEVICE(0x04ca, 0x300b), .driver_info = BTUSB_ATH3012 }, |
148 | { USB_DEVICE(0x04ca, 0x300f), .driver_info = BTUSB_ATH3012 }, | ||
146 | { USB_DEVICE(0x04ca, 0x3010), .driver_info = BTUSB_ATH3012 }, | 149 | { USB_DEVICE(0x04ca, 0x3010), .driver_info = BTUSB_ATH3012 }, |
147 | { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 }, | 150 | { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 }, |
148 | { USB_DEVICE(0x0930, 0x0220), .driver_info = BTUSB_ATH3012 }, | 151 | { USB_DEVICE(0x0930, 0x0220), .driver_info = BTUSB_ATH3012 }, |
@@ -158,6 +161,7 @@ static const struct usb_device_id ath3k_blist_tbl[] = { | |||
158 | { USB_DEVICE(0x0CF3, 0x817a), .driver_info = BTUSB_ATH3012 }, | 161 | { USB_DEVICE(0x0CF3, 0x817a), .driver_info = BTUSB_ATH3012 }, |
159 | { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, | 162 | { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, |
160 | { USB_DEVICE(0x0cf3, 0xe005), .driver_info = BTUSB_ATH3012 }, | 163 | { USB_DEVICE(0x0cf3, 0xe005), .driver_info = BTUSB_ATH3012 }, |
164 | { USB_DEVICE(0x0cf3, 0xe006), .driver_info = BTUSB_ATH3012 }, | ||
161 | { USB_DEVICE(0x0cf3, 0xe003), .driver_info = BTUSB_ATH3012 }, | 165 | { USB_DEVICE(0x0cf3, 0xe003), .driver_info = BTUSB_ATH3012 }, |
162 | { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, | 166 | { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, |
163 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, | 167 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, |
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index d21f3b4176d3..3c10d4dfe9a7 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c | |||
@@ -186,6 +186,7 @@ static const struct usb_device_id blacklist_table[] = { | |||
186 | { USB_DEVICE(0x04ca, 0x3007), .driver_info = BTUSB_ATH3012 }, | 186 | { USB_DEVICE(0x04ca, 0x3007), .driver_info = BTUSB_ATH3012 }, |
187 | { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 }, | 187 | { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 }, |
188 | { USB_DEVICE(0x04ca, 0x300b), .driver_info = BTUSB_ATH3012 }, | 188 | { USB_DEVICE(0x04ca, 0x300b), .driver_info = BTUSB_ATH3012 }, |
189 | { USB_DEVICE(0x04ca, 0x300f), .driver_info = BTUSB_ATH3012 }, | ||
189 | { USB_DEVICE(0x04ca, 0x3010), .driver_info = BTUSB_ATH3012 }, | 190 | { USB_DEVICE(0x04ca, 0x3010), .driver_info = BTUSB_ATH3012 }, |
190 | { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 }, | 191 | { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 }, |
191 | { USB_DEVICE(0x0930, 0x0220), .driver_info = BTUSB_ATH3012 }, | 192 | { USB_DEVICE(0x0930, 0x0220), .driver_info = BTUSB_ATH3012 }, |
@@ -202,6 +203,7 @@ static const struct usb_device_id blacklist_table[] = { | |||
202 | { USB_DEVICE(0x0cf3, 0xe003), .driver_info = BTUSB_ATH3012 }, | 203 | { USB_DEVICE(0x0cf3, 0xe003), .driver_info = BTUSB_ATH3012 }, |
203 | { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, | 204 | { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, |
204 | { USB_DEVICE(0x0cf3, 0xe005), .driver_info = BTUSB_ATH3012 }, | 205 | { USB_DEVICE(0x0cf3, 0xe005), .driver_info = BTUSB_ATH3012 }, |
206 | { USB_DEVICE(0x0cf3, 0xe006), .driver_info = BTUSB_ATH3012 }, | ||
205 | { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, | 207 | { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, |
206 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, | 208 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, |
207 | { USB_DEVICE(0x13d3, 0x3393), .driver_info = BTUSB_ATH3012 }, | 209 | { USB_DEVICE(0x13d3, 0x3393), .driver_info = BTUSB_ATH3012 }, |
@@ -218,6 +220,7 @@ static const struct usb_device_id blacklist_table[] = { | |||
218 | { USB_DEVICE(0x0489, 0xe03c), .driver_info = BTUSB_ATH3012 }, | 220 | { USB_DEVICE(0x0489, 0xe03c), .driver_info = BTUSB_ATH3012 }, |
219 | 221 | ||
220 | /* QCA ROME chipset */ | 222 | /* QCA ROME chipset */ |
223 | { USB_DEVICE(0x0cf3, 0xe007), .driver_info = BTUSB_QCA_ROME }, | ||
221 | { USB_DEVICE(0x0cf3, 0xe300), .driver_info = BTUSB_QCA_ROME }, | 224 | { USB_DEVICE(0x0cf3, 0xe300), .driver_info = BTUSB_QCA_ROME }, |
222 | { USB_DEVICE(0x0cf3, 0xe360), .driver_info = BTUSB_QCA_ROME }, | 225 | { USB_DEVICE(0x0cf3, 0xe360), .driver_info = BTUSB_QCA_ROME }, |
223 | 226 | ||
diff --git a/drivers/bus/mips_cdmm.c b/drivers/bus/mips_cdmm.c index 5bd792c68f9b..ab3bde16ecb4 100644 --- a/drivers/bus/mips_cdmm.c +++ b/drivers/bus/mips_cdmm.c | |||
@@ -453,7 +453,7 @@ void __iomem *mips_cdmm_early_probe(unsigned int dev_type) | |||
453 | 453 | ||
454 | /* Look for a specific device type */ | 454 | /* Look for a specific device type */ |
455 | for (; drb < bus->drbs; drb += size + 1) { | 455 | for (; drb < bus->drbs; drb += size + 1) { |
456 | acsr = readl(cdmm + drb * CDMM_DRB_SIZE); | 456 | acsr = __raw_readl(cdmm + drb * CDMM_DRB_SIZE); |
457 | type = (acsr & CDMM_ACSR_DEVTYPE) >> CDMM_ACSR_DEVTYPE_SHIFT; | 457 | type = (acsr & CDMM_ACSR_DEVTYPE) >> CDMM_ACSR_DEVTYPE_SHIFT; |
458 | if (type == dev_type) | 458 | if (type == dev_type) |
459 | return cdmm + drb * CDMM_DRB_SIZE; | 459 | return cdmm + drb * CDMM_DRB_SIZE; |
@@ -500,7 +500,7 @@ static void mips_cdmm_bus_discover(struct mips_cdmm_bus *bus) | |||
500 | bus->discovered = true; | 500 | bus->discovered = true; |
501 | pr_info("cdmm%u discovery (%u blocks)\n", cpu, bus->drbs); | 501 | pr_info("cdmm%u discovery (%u blocks)\n", cpu, bus->drbs); |
502 | for (; drb < bus->drbs; drb += size + 1) { | 502 | for (; drb < bus->drbs; drb += size + 1) { |
503 | acsr = readl(cdmm + drb * CDMM_DRB_SIZE); | 503 | acsr = __raw_readl(cdmm + drb * CDMM_DRB_SIZE); |
504 | type = (acsr & CDMM_ACSR_DEVTYPE) >> CDMM_ACSR_DEVTYPE_SHIFT; | 504 | type = (acsr & CDMM_ACSR_DEVTYPE) >> CDMM_ACSR_DEVTYPE_SHIFT; |
505 | size = (acsr & CDMM_ACSR_DEVSIZE) >> CDMM_ACSR_DEVSIZE_SHIFT; | 505 | size = (acsr & CDMM_ACSR_DEVSIZE) >> CDMM_ACSR_DEVSIZE_SHIFT; |
506 | rev = (acsr & CDMM_ACSR_DEVREV) >> CDMM_ACSR_DEVREV_SHIFT; | 506 | rev = (acsr & CDMM_ACSR_DEVREV) >> CDMM_ACSR_DEVREV_SHIFT; |
diff --git a/drivers/clk/clk-si5351.c b/drivers/clk/clk-si5351.c index 44ea107cfc67..30335d3b99af 100644 --- a/drivers/clk/clk-si5351.c +++ b/drivers/clk/clk-si5351.c | |||
@@ -1128,13 +1128,6 @@ static int si5351_dt_parse(struct i2c_client *client, | |||
1128 | if (!pdata) | 1128 | if (!pdata) |
1129 | return -ENOMEM; | 1129 | return -ENOMEM; |
1130 | 1130 | ||
1131 | pdata->clk_xtal = of_clk_get(np, 0); | ||
1132 | if (!IS_ERR(pdata->clk_xtal)) | ||
1133 | clk_put(pdata->clk_xtal); | ||
1134 | pdata->clk_clkin = of_clk_get(np, 1); | ||
1135 | if (!IS_ERR(pdata->clk_clkin)) | ||
1136 | clk_put(pdata->clk_clkin); | ||
1137 | |||
1138 | /* | 1131 | /* |
1139 | * property silabs,pll-source : <num src>, [<..>] | 1132 | * property silabs,pll-source : <num src>, [<..>] |
1140 | * allow to selectively set pll source | 1133 | * allow to selectively set pll source |
@@ -1328,8 +1321,22 @@ static int si5351_i2c_probe(struct i2c_client *client, | |||
1328 | i2c_set_clientdata(client, drvdata); | 1321 | i2c_set_clientdata(client, drvdata); |
1329 | drvdata->client = client; | 1322 | drvdata->client = client; |
1330 | drvdata->variant = variant; | 1323 | drvdata->variant = variant; |
1331 | drvdata->pxtal = pdata->clk_xtal; | 1324 | drvdata->pxtal = devm_clk_get(&client->dev, "xtal"); |
1332 | drvdata->pclkin = pdata->clk_clkin; | 1325 | drvdata->pclkin = devm_clk_get(&client->dev, "clkin"); |
1326 | |||
1327 | if (PTR_ERR(drvdata->pxtal) == -EPROBE_DEFER || | ||
1328 | PTR_ERR(drvdata->pclkin) == -EPROBE_DEFER) | ||
1329 | return -EPROBE_DEFER; | ||
1330 | |||
1331 | /* | ||
1332 | * Check for valid parent clock: VARIANT_A and VARIANT_B need XTAL, | ||
1333 | * VARIANT_C can have CLKIN instead. | ||
1334 | */ | ||
1335 | if (IS_ERR(drvdata->pxtal) && | ||
1336 | (drvdata->variant != SI5351_VARIANT_C || IS_ERR(drvdata->pclkin))) { | ||
1337 | dev_err(&client->dev, "missing parent clock\n"); | ||
1338 | return -EINVAL; | ||
1339 | } | ||
1333 | 1340 | ||
1334 | drvdata->regmap = devm_regmap_init_i2c(client, &si5351_regmap_config); | 1341 | drvdata->regmap = devm_regmap_init_i2c(client, &si5351_regmap_config); |
1335 | if (IS_ERR(drvdata->regmap)) { | 1342 | if (IS_ERR(drvdata->regmap)) { |
@@ -1393,6 +1400,11 @@ static int si5351_i2c_probe(struct i2c_client *client, | |||
1393 | } | 1400 | } |
1394 | } | 1401 | } |
1395 | 1402 | ||
1403 | if (!IS_ERR(drvdata->pxtal)) | ||
1404 | clk_prepare_enable(drvdata->pxtal); | ||
1405 | if (!IS_ERR(drvdata->pclkin)) | ||
1406 | clk_prepare_enable(drvdata->pclkin); | ||
1407 | |||
1396 | /* register xtal input clock gate */ | 1408 | /* register xtal input clock gate */ |
1397 | memset(&init, 0, sizeof(init)); | 1409 | memset(&init, 0, sizeof(init)); |
1398 | init.name = si5351_input_names[0]; | 1410 | init.name = si5351_input_names[0]; |
@@ -1407,7 +1419,8 @@ static int si5351_i2c_probe(struct i2c_client *client, | |||
1407 | clk = devm_clk_register(&client->dev, &drvdata->xtal); | 1419 | clk = devm_clk_register(&client->dev, &drvdata->xtal); |
1408 | if (IS_ERR(clk)) { | 1420 | if (IS_ERR(clk)) { |
1409 | dev_err(&client->dev, "unable to register %s\n", init.name); | 1421 | dev_err(&client->dev, "unable to register %s\n", init.name); |
1410 | return PTR_ERR(clk); | 1422 | ret = PTR_ERR(clk); |
1423 | goto err_clk; | ||
1411 | } | 1424 | } |
1412 | 1425 | ||
1413 | /* register clkin input clock gate */ | 1426 | /* register clkin input clock gate */ |
@@ -1425,7 +1438,8 @@ static int si5351_i2c_probe(struct i2c_client *client, | |||
1425 | if (IS_ERR(clk)) { | 1438 | if (IS_ERR(clk)) { |
1426 | dev_err(&client->dev, "unable to register %s\n", | 1439 | dev_err(&client->dev, "unable to register %s\n", |
1427 | init.name); | 1440 | init.name); |
1428 | return PTR_ERR(clk); | 1441 | ret = PTR_ERR(clk); |
1442 | goto err_clk; | ||
1429 | } | 1443 | } |
1430 | } | 1444 | } |
1431 | 1445 | ||
@@ -1447,7 +1461,8 @@ static int si5351_i2c_probe(struct i2c_client *client, | |||
1447 | clk = devm_clk_register(&client->dev, &drvdata->pll[0].hw); | 1461 | clk = devm_clk_register(&client->dev, &drvdata->pll[0].hw); |
1448 | if (IS_ERR(clk)) { | 1462 | if (IS_ERR(clk)) { |
1449 | dev_err(&client->dev, "unable to register %s\n", init.name); | 1463 | dev_err(&client->dev, "unable to register %s\n", init.name); |
1450 | return -EINVAL; | 1464 | ret = PTR_ERR(clk); |
1465 | goto err_clk; | ||
1451 | } | 1466 | } |
1452 | 1467 | ||
1453 | /* register PLLB or VXCO (Si5351B) */ | 1468 | /* register PLLB or VXCO (Si5351B) */ |
@@ -1471,7 +1486,8 @@ static int si5351_i2c_probe(struct i2c_client *client, | |||
1471 | clk = devm_clk_register(&client->dev, &drvdata->pll[1].hw); | 1486 | clk = devm_clk_register(&client->dev, &drvdata->pll[1].hw); |
1472 | if (IS_ERR(clk)) { | 1487 | if (IS_ERR(clk)) { |
1473 | dev_err(&client->dev, "unable to register %s\n", init.name); | 1488 | dev_err(&client->dev, "unable to register %s\n", init.name); |
1474 | return -EINVAL; | 1489 | ret = PTR_ERR(clk); |
1490 | goto err_clk; | ||
1475 | } | 1491 | } |
1476 | 1492 | ||
1477 | /* register clk multisync and clk out divider */ | 1493 | /* register clk multisync and clk out divider */ |
@@ -1492,8 +1508,10 @@ static int si5351_i2c_probe(struct i2c_client *client, | |||
1492 | num_clocks * sizeof(*drvdata->onecell.clks), GFP_KERNEL); | 1508 | num_clocks * sizeof(*drvdata->onecell.clks), GFP_KERNEL); |
1493 | 1509 | ||
1494 | if (WARN_ON(!drvdata->msynth || !drvdata->clkout || | 1510 | if (WARN_ON(!drvdata->msynth || !drvdata->clkout || |
1495 | !drvdata->onecell.clks)) | 1511 | !drvdata->onecell.clks)) { |
1496 | return -ENOMEM; | 1512 | ret = -ENOMEM; |
1513 | goto err_clk; | ||
1514 | } | ||
1497 | 1515 | ||
1498 | for (n = 0; n < num_clocks; n++) { | 1516 | for (n = 0; n < num_clocks; n++) { |
1499 | drvdata->msynth[n].num = n; | 1517 | drvdata->msynth[n].num = n; |
@@ -1511,7 +1529,8 @@ static int si5351_i2c_probe(struct i2c_client *client, | |||
1511 | if (IS_ERR(clk)) { | 1529 | if (IS_ERR(clk)) { |
1512 | dev_err(&client->dev, "unable to register %s\n", | 1530 | dev_err(&client->dev, "unable to register %s\n", |
1513 | init.name); | 1531 | init.name); |
1514 | return -EINVAL; | 1532 | ret = PTR_ERR(clk); |
1533 | goto err_clk; | ||
1515 | } | 1534 | } |
1516 | } | 1535 | } |
1517 | 1536 | ||
@@ -1538,7 +1557,8 @@ static int si5351_i2c_probe(struct i2c_client *client, | |||
1538 | if (IS_ERR(clk)) { | 1557 | if (IS_ERR(clk)) { |
1539 | dev_err(&client->dev, "unable to register %s\n", | 1558 | dev_err(&client->dev, "unable to register %s\n", |
1540 | init.name); | 1559 | init.name); |
1541 | return -EINVAL; | 1560 | ret = PTR_ERR(clk); |
1561 | goto err_clk; | ||
1542 | } | 1562 | } |
1543 | drvdata->onecell.clks[n] = clk; | 1563 | drvdata->onecell.clks[n] = clk; |
1544 | 1564 | ||
@@ -1557,10 +1577,17 @@ static int si5351_i2c_probe(struct i2c_client *client, | |||
1557 | &drvdata->onecell); | 1577 | &drvdata->onecell); |
1558 | if (ret) { | 1578 | if (ret) { |
1559 | dev_err(&client->dev, "unable to add clk provider\n"); | 1579 | dev_err(&client->dev, "unable to add clk provider\n"); |
1560 | return ret; | 1580 | goto err_clk; |
1561 | } | 1581 | } |
1562 | 1582 | ||
1563 | return 0; | 1583 | return 0; |
1584 | |||
1585 | err_clk: | ||
1586 | if (!IS_ERR(drvdata->pxtal)) | ||
1587 | clk_disable_unprepare(drvdata->pxtal); | ||
1588 | if (!IS_ERR(drvdata->pclkin)) | ||
1589 | clk_disable_unprepare(drvdata->pclkin); | ||
1590 | return ret; | ||
1564 | } | 1591 | } |
1565 | 1592 | ||
1566 | static const struct i2c_device_id si5351_i2c_ids[] = { | 1593 | static const struct i2c_device_id si5351_i2c_ids[] = { |
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 459ce9da13e0..5b0f41868b42 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c | |||
@@ -1475,8 +1475,10 @@ static struct clk_core *__clk_set_parent_before(struct clk_core *clk, | |||
1475 | */ | 1475 | */ |
1476 | if (clk->prepare_count) { | 1476 | if (clk->prepare_count) { |
1477 | clk_core_prepare(parent); | 1477 | clk_core_prepare(parent); |
1478 | flags = clk_enable_lock(); | ||
1478 | clk_core_enable(parent); | 1479 | clk_core_enable(parent); |
1479 | clk_core_enable(clk); | 1480 | clk_core_enable(clk); |
1481 | clk_enable_unlock(flags); | ||
1480 | } | 1482 | } |
1481 | 1483 | ||
1482 | /* update the clk tree topology */ | 1484 | /* update the clk tree topology */ |
@@ -1491,13 +1493,17 @@ static void __clk_set_parent_after(struct clk_core *core, | |||
1491 | struct clk_core *parent, | 1493 | struct clk_core *parent, |
1492 | struct clk_core *old_parent) | 1494 | struct clk_core *old_parent) |
1493 | { | 1495 | { |
1496 | unsigned long flags; | ||
1497 | |||
1494 | /* | 1498 | /* |
1495 | * Finish the migration of prepare state and undo the changes done | 1499 | * Finish the migration of prepare state and undo the changes done |
1496 | * for preventing a race with clk_enable(). | 1500 | * for preventing a race with clk_enable(). |
1497 | */ | 1501 | */ |
1498 | if (core->prepare_count) { | 1502 | if (core->prepare_count) { |
1503 | flags = clk_enable_lock(); | ||
1499 | clk_core_disable(core); | 1504 | clk_core_disable(core); |
1500 | clk_core_disable(old_parent); | 1505 | clk_core_disable(old_parent); |
1506 | clk_enable_unlock(flags); | ||
1501 | clk_core_unprepare(old_parent); | 1507 | clk_core_unprepare(old_parent); |
1502 | } | 1508 | } |
1503 | } | 1509 | } |
@@ -1525,8 +1531,10 @@ static int __clk_set_parent(struct clk_core *clk, struct clk_core *parent, | |||
1525 | clk_enable_unlock(flags); | 1531 | clk_enable_unlock(flags); |
1526 | 1532 | ||
1527 | if (clk->prepare_count) { | 1533 | if (clk->prepare_count) { |
1534 | flags = clk_enable_lock(); | ||
1528 | clk_core_disable(clk); | 1535 | clk_core_disable(clk); |
1529 | clk_core_disable(parent); | 1536 | clk_core_disable(parent); |
1537 | clk_enable_unlock(flags); | ||
1530 | clk_core_unprepare(parent); | 1538 | clk_core_unprepare(parent); |
1531 | } | 1539 | } |
1532 | return ret; | 1540 | return ret; |
diff --git a/drivers/clk/qcom/gcc-msm8916.c b/drivers/clk/qcom/gcc-msm8916.c index d3458474eb3a..c66f7bc2ae87 100644 --- a/drivers/clk/qcom/gcc-msm8916.c +++ b/drivers/clk/qcom/gcc-msm8916.c | |||
@@ -71,8 +71,8 @@ static const char *gcc_xo_gpll0_bimc[] = { | |||
71 | static const struct parent_map gcc_xo_gpll0a_gpll1_gpll2a_map[] = { | 71 | static const struct parent_map gcc_xo_gpll0a_gpll1_gpll2a_map[] = { |
72 | { P_XO, 0 }, | 72 | { P_XO, 0 }, |
73 | { P_GPLL0_AUX, 3 }, | 73 | { P_GPLL0_AUX, 3 }, |
74 | { P_GPLL2_AUX, 2 }, | ||
75 | { P_GPLL1, 1 }, | 74 | { P_GPLL1, 1 }, |
75 | { P_GPLL2_AUX, 2 }, | ||
76 | }; | 76 | }; |
77 | 77 | ||
78 | static const char *gcc_xo_gpll0a_gpll1_gpll2a[] = { | 78 | static const char *gcc_xo_gpll0a_gpll1_gpll2a[] = { |
@@ -1115,7 +1115,7 @@ static struct clk_rcg2 usb_hs_system_clk_src = { | |||
1115 | static const struct freq_tbl ftbl_gcc_venus0_vcodec0_clk[] = { | 1115 | static const struct freq_tbl ftbl_gcc_venus0_vcodec0_clk[] = { |
1116 | F(100000000, P_GPLL0, 8, 0, 0), | 1116 | F(100000000, P_GPLL0, 8, 0, 0), |
1117 | F(160000000, P_GPLL0, 5, 0, 0), | 1117 | F(160000000, P_GPLL0, 5, 0, 0), |
1118 | F(228570000, P_GPLL0, 5, 0, 0), | 1118 | F(228570000, P_GPLL0, 3.5, 0, 0), |
1119 | { } | 1119 | { } |
1120 | }; | 1120 | }; |
1121 | 1121 | ||
diff --git a/drivers/clk/samsung/Makefile b/drivers/clk/samsung/Makefile index 17e9af7fe81f..a17683b2cf27 100644 --- a/drivers/clk/samsung/Makefile +++ b/drivers/clk/samsung/Makefile | |||
@@ -10,7 +10,7 @@ obj-$(CONFIG_SOC_EXYNOS5250) += clk-exynos5250.o | |||
10 | obj-$(CONFIG_SOC_EXYNOS5260) += clk-exynos5260.o | 10 | obj-$(CONFIG_SOC_EXYNOS5260) += clk-exynos5260.o |
11 | obj-$(CONFIG_SOC_EXYNOS5410) += clk-exynos5410.o | 11 | obj-$(CONFIG_SOC_EXYNOS5410) += clk-exynos5410.o |
12 | obj-$(CONFIG_SOC_EXYNOS5420) += clk-exynos5420.o | 12 | obj-$(CONFIG_SOC_EXYNOS5420) += clk-exynos5420.o |
13 | obj-$(CONFIG_ARCH_EXYNOS5433) += clk-exynos5433.o | 13 | obj-$(CONFIG_ARCH_EXYNOS) += clk-exynos5433.o |
14 | obj-$(CONFIG_SOC_EXYNOS5440) += clk-exynos5440.o | 14 | obj-$(CONFIG_SOC_EXYNOS5440) += clk-exynos5440.o |
15 | obj-$(CONFIG_ARCH_EXYNOS) += clk-exynos-audss.o | 15 | obj-$(CONFIG_ARCH_EXYNOS) += clk-exynos-audss.o |
16 | obj-$(CONFIG_ARCH_EXYNOS) += clk-exynos-clkout.o | 16 | obj-$(CONFIG_ARCH_EXYNOS) += clk-exynos-clkout.o |
diff --git a/drivers/clk/samsung/clk-exynos5420.c b/drivers/clk/samsung/clk-exynos5420.c index 07d666cc6a29..bea4a173eef5 100644 --- a/drivers/clk/samsung/clk-exynos5420.c +++ b/drivers/clk/samsung/clk-exynos5420.c | |||
@@ -271,6 +271,7 @@ static const struct samsung_clk_reg_dump exynos5420_set_clksrc[] = { | |||
271 | { .offset = SRC_MASK_PERIC0, .value = 0x11111110, }, | 271 | { .offset = SRC_MASK_PERIC0, .value = 0x11111110, }, |
272 | { .offset = SRC_MASK_PERIC1, .value = 0x11111100, }, | 272 | { .offset = SRC_MASK_PERIC1, .value = 0x11111100, }, |
273 | { .offset = SRC_MASK_ISP, .value = 0x11111000, }, | 273 | { .offset = SRC_MASK_ISP, .value = 0x11111000, }, |
274 | { .offset = GATE_BUS_TOP, .value = 0xffffffff, }, | ||
274 | { .offset = GATE_BUS_DISP1, .value = 0xffffffff, }, | 275 | { .offset = GATE_BUS_DISP1, .value = 0xffffffff, }, |
275 | { .offset = GATE_IP_PERIC, .value = 0xffffffff, }, | 276 | { .offset = GATE_IP_PERIC, .value = 0xffffffff, }, |
276 | }; | 277 | }; |
diff --git a/drivers/clk/samsung/clk-exynos5433.c b/drivers/clk/samsung/clk-exynos5433.c index 387e3e39e635..9e04ae2bb4d7 100644 --- a/drivers/clk/samsung/clk-exynos5433.c +++ b/drivers/clk/samsung/clk-exynos5433.c | |||
@@ -748,7 +748,7 @@ static struct samsung_pll_rate_table exynos5443_pll_rates[] = { | |||
748 | PLL_35XX_RATE(825000000U, 275, 4, 1), | 748 | PLL_35XX_RATE(825000000U, 275, 4, 1), |
749 | PLL_35XX_RATE(800000000U, 400, 6, 1), | 749 | PLL_35XX_RATE(800000000U, 400, 6, 1), |
750 | PLL_35XX_RATE(733000000U, 733, 12, 1), | 750 | PLL_35XX_RATE(733000000U, 733, 12, 1), |
751 | PLL_35XX_RATE(700000000U, 360, 6, 1), | 751 | PLL_35XX_RATE(700000000U, 175, 3, 1), |
752 | PLL_35XX_RATE(667000000U, 222, 4, 1), | 752 | PLL_35XX_RATE(667000000U, 222, 4, 1), |
753 | PLL_35XX_RATE(633000000U, 211, 4, 1), | 753 | PLL_35XX_RATE(633000000U, 211, 4, 1), |
754 | PLL_35XX_RATE(600000000U, 500, 5, 2), | 754 | PLL_35XX_RATE(600000000U, 500, 5, 2), |
@@ -760,14 +760,14 @@ static struct samsung_pll_rate_table exynos5443_pll_rates[] = { | |||
760 | PLL_35XX_RATE(444000000U, 370, 5, 2), | 760 | PLL_35XX_RATE(444000000U, 370, 5, 2), |
761 | PLL_35XX_RATE(420000000U, 350, 5, 2), | 761 | PLL_35XX_RATE(420000000U, 350, 5, 2), |
762 | PLL_35XX_RATE(400000000U, 400, 6, 2), | 762 | PLL_35XX_RATE(400000000U, 400, 6, 2), |
763 | PLL_35XX_RATE(350000000U, 360, 6, 2), | 763 | PLL_35XX_RATE(350000000U, 350, 6, 2), |
764 | PLL_35XX_RATE(333000000U, 222, 4, 2), | 764 | PLL_35XX_RATE(333000000U, 222, 4, 2), |
765 | PLL_35XX_RATE(300000000U, 500, 5, 3), | 765 | PLL_35XX_RATE(300000000U, 500, 5, 3), |
766 | PLL_35XX_RATE(266000000U, 532, 6, 3), | 766 | PLL_35XX_RATE(266000000U, 532, 6, 3), |
767 | PLL_35XX_RATE(200000000U, 400, 6, 3), | 767 | PLL_35XX_RATE(200000000U, 400, 6, 3), |
768 | PLL_35XX_RATE(166000000U, 332, 6, 3), | 768 | PLL_35XX_RATE(166000000U, 332, 6, 3), |
769 | PLL_35XX_RATE(160000000U, 320, 6, 3), | 769 | PLL_35XX_RATE(160000000U, 320, 6, 3), |
770 | PLL_35XX_RATE(133000000U, 552, 6, 4), | 770 | PLL_35XX_RATE(133000000U, 532, 6, 4), |
771 | PLL_35XX_RATE(100000000U, 400, 6, 4), | 771 | PLL_35XX_RATE(100000000U, 400, 6, 4), |
772 | { /* sentinel */ } | 772 | { /* sentinel */ } |
773 | }; | 773 | }; |
@@ -1490,7 +1490,7 @@ static struct samsung_gate_clock mif_gate_clks[] __initdata = { | |||
1490 | 1490 | ||
1491 | /* ENABLE_PCLK_MIF_SECURE_MONOTONIC_CNT */ | 1491 | /* ENABLE_PCLK_MIF_SECURE_MONOTONIC_CNT */ |
1492 | GATE(CLK_PCLK_MONOTONIC_CNT, "pclk_monotonic_cnt", "div_aclk_mif_133", | 1492 | GATE(CLK_PCLK_MONOTONIC_CNT, "pclk_monotonic_cnt", "div_aclk_mif_133", |
1493 | ENABLE_PCLK_MIF_SECURE_RTC, 0, 0, 0), | 1493 | ENABLE_PCLK_MIF_SECURE_MONOTONIC_CNT, 0, 0, 0), |
1494 | 1494 | ||
1495 | /* ENABLE_PCLK_MIF_SECURE_RTC */ | 1495 | /* ENABLE_PCLK_MIF_SECURE_RTC */ |
1496 | GATE(CLK_PCLK_RTC, "pclk_rtc", "div_aclk_mif_133", | 1496 | GATE(CLK_PCLK_RTC, "pclk_rtc", "div_aclk_mif_133", |
@@ -3665,7 +3665,7 @@ static struct samsung_gate_clock apollo_gate_clks[] __initdata = { | |||
3665 | ENABLE_SCLK_APOLLO, 3, CLK_IGNORE_UNUSED, 0), | 3665 | ENABLE_SCLK_APOLLO, 3, CLK_IGNORE_UNUSED, 0), |
3666 | GATE(CLK_SCLK_HPM_APOLLO, "sclk_hpm_apollo", "div_sclk_hpm_apollo", | 3666 | GATE(CLK_SCLK_HPM_APOLLO, "sclk_hpm_apollo", "div_sclk_hpm_apollo", |
3667 | ENABLE_SCLK_APOLLO, 1, CLK_IGNORE_UNUSED, 0), | 3667 | ENABLE_SCLK_APOLLO, 1, CLK_IGNORE_UNUSED, 0), |
3668 | GATE(CLK_SCLK_APOLLO, "sclk_apollo", "div_apollo_pll", | 3668 | GATE(CLK_SCLK_APOLLO, "sclk_apollo", "div_apollo2", |
3669 | ENABLE_SCLK_APOLLO, 0, CLK_IGNORE_UNUSED, 0), | 3669 | ENABLE_SCLK_APOLLO, 0, CLK_IGNORE_UNUSED, 0), |
3670 | }; | 3670 | }; |
3671 | 3671 | ||
@@ -3927,7 +3927,7 @@ CLK_OF_DECLARE(exynos5433_cmu_atlas, "samsung,exynos5433-cmu-atlas", | |||
3927 | #define ENABLE_PCLK_MSCL 0x0900 | 3927 | #define ENABLE_PCLK_MSCL 0x0900 |
3928 | #define ENABLE_PCLK_MSCL_SECURE_SMMU_M2MSCALER0 0x0904 | 3928 | #define ENABLE_PCLK_MSCL_SECURE_SMMU_M2MSCALER0 0x0904 |
3929 | #define ENABLE_PCLK_MSCL_SECURE_SMMU_M2MSCALER1 0x0908 | 3929 | #define ENABLE_PCLK_MSCL_SECURE_SMMU_M2MSCALER1 0x0908 |
3930 | #define ENABLE_PCLK_MSCL_SECURE_SMMU_JPEG 0x000c | 3930 | #define ENABLE_PCLK_MSCL_SECURE_SMMU_JPEG 0x090c |
3931 | #define ENABLE_SCLK_MSCL 0x0a00 | 3931 | #define ENABLE_SCLK_MSCL 0x0a00 |
3932 | #define ENABLE_IP_MSCL0 0x0b00 | 3932 | #define ENABLE_IP_MSCL0 0x0b00 |
3933 | #define ENABLE_IP_MSCL1 0x0b04 | 3933 | #define ENABLE_IP_MSCL1 0x0b04 |
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/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c index 1f7e33f59de6..6714e5b193ea 100644 --- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c | |||
@@ -91,7 +91,7 @@ static void decon_wait_for_vblank(struct exynos_drm_crtc *crtc) | |||
91 | 91 | ||
92 | static void decon_clear_channel(struct decon_context *ctx) | 92 | static void decon_clear_channel(struct decon_context *ctx) |
93 | { | 93 | { |
94 | int win, ch_enabled = 0; | 94 | unsigned int win, ch_enabled = 0; |
95 | 95 | ||
96 | DRM_DEBUG_KMS("%s\n", __FILE__); | 96 | DRM_DEBUG_KMS("%s\n", __FILE__); |
97 | 97 | ||
@@ -710,7 +710,7 @@ static void decon_dpms(struct exynos_drm_crtc *crtc, int mode) | |||
710 | } | 710 | } |
711 | } | 711 | } |
712 | 712 | ||
713 | static struct exynos_drm_crtc_ops decon_crtc_ops = { | 713 | static const struct exynos_drm_crtc_ops decon_crtc_ops = { |
714 | .dpms = decon_dpms, | 714 | .dpms = decon_dpms, |
715 | .mode_fixup = decon_mode_fixup, | 715 | .mode_fixup = decon_mode_fixup, |
716 | .commit = decon_commit, | 716 | .commit = decon_commit, |
diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c index 1dbfba58f909..30feb7d06624 100644 --- a/drivers/gpu/drm/exynos/exynos_dp_core.c +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include <drm/bridge/ptn3460.h> | 32 | #include <drm/bridge/ptn3460.h> |
33 | 33 | ||
34 | #include "exynos_dp_core.h" | 34 | #include "exynos_dp_core.h" |
35 | #include "exynos_drm_fimd.h" | ||
36 | 35 | ||
37 | #define ctx_from_connector(c) container_of(c, struct exynos_dp_device, \ | 36 | #define ctx_from_connector(c) container_of(c, struct exynos_dp_device, \ |
38 | connector) | 37 | connector) |
@@ -196,7 +195,7 @@ static int exynos_dp_read_edid(struct exynos_dp_device *dp) | |||
196 | } | 195 | } |
197 | } | 196 | } |
198 | 197 | ||
199 | dev_err(dp->dev, "EDID Read success!\n"); | 198 | dev_dbg(dp->dev, "EDID Read success!\n"); |
200 | return 0; | 199 | return 0; |
201 | } | 200 | } |
202 | 201 | ||
@@ -1066,6 +1065,8 @@ static void exynos_dp_phy_exit(struct exynos_dp_device *dp) | |||
1066 | 1065 | ||
1067 | static void exynos_dp_poweron(struct exynos_dp_device *dp) | 1066 | static void exynos_dp_poweron(struct exynos_dp_device *dp) |
1068 | { | 1067 | { |
1068 | struct exynos_drm_crtc *crtc = dp_to_crtc(dp); | ||
1069 | |||
1069 | if (dp->dpms_mode == DRM_MODE_DPMS_ON) | 1070 | if (dp->dpms_mode == DRM_MODE_DPMS_ON) |
1070 | return; | 1071 | return; |
1071 | 1072 | ||
@@ -1076,7 +1077,8 @@ static void exynos_dp_poweron(struct exynos_dp_device *dp) | |||
1076 | } | 1077 | } |
1077 | } | 1078 | } |
1078 | 1079 | ||
1079 | fimd_dp_clock_enable(dp_to_crtc(dp), true); | 1080 | if (crtc->ops->clock_enable) |
1081 | crtc->ops->clock_enable(dp_to_crtc(dp), true); | ||
1080 | 1082 | ||
1081 | clk_prepare_enable(dp->clock); | 1083 | clk_prepare_enable(dp->clock); |
1082 | exynos_dp_phy_init(dp); | 1084 | exynos_dp_phy_init(dp); |
@@ -1087,6 +1089,8 @@ static void exynos_dp_poweron(struct exynos_dp_device *dp) | |||
1087 | 1089 | ||
1088 | static void exynos_dp_poweroff(struct exynos_dp_device *dp) | 1090 | static void exynos_dp_poweroff(struct exynos_dp_device *dp) |
1089 | { | 1091 | { |
1092 | struct exynos_drm_crtc *crtc = dp_to_crtc(dp); | ||
1093 | |||
1090 | if (dp->dpms_mode != DRM_MODE_DPMS_ON) | 1094 | if (dp->dpms_mode != DRM_MODE_DPMS_ON) |
1091 | return; | 1095 | return; |
1092 | 1096 | ||
@@ -1102,7 +1106,8 @@ static void exynos_dp_poweroff(struct exynos_dp_device *dp) | |||
1102 | exynos_dp_phy_exit(dp); | 1106 | exynos_dp_phy_exit(dp); |
1103 | clk_disable_unprepare(dp->clock); | 1107 | clk_disable_unprepare(dp->clock); |
1104 | 1108 | ||
1105 | fimd_dp_clock_enable(dp_to_crtc(dp), false); | 1109 | if (crtc->ops->clock_enable) |
1110 | crtc->ops->clock_enable(dp_to_crtc(dp), false); | ||
1106 | 1111 | ||
1107 | if (dp->panel) { | 1112 | if (dp->panel) { |
1108 | if (drm_panel_unprepare(dp->panel)) | 1113 | if (drm_panel_unprepare(dp->panel)) |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c index eb49195cec5c..9006b947e03c 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c | |||
@@ -238,11 +238,11 @@ static struct drm_crtc_funcs exynos_crtc_funcs = { | |||
238 | }; | 238 | }; |
239 | 239 | ||
240 | struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev, | 240 | struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev, |
241 | struct drm_plane *plane, | 241 | struct drm_plane *plane, |
242 | int pipe, | 242 | int pipe, |
243 | enum exynos_drm_output_type type, | 243 | enum exynos_drm_output_type type, |
244 | struct exynos_drm_crtc_ops *ops, | 244 | const struct exynos_drm_crtc_ops *ops, |
245 | void *ctx) | 245 | void *ctx) |
246 | { | 246 | { |
247 | struct exynos_drm_crtc *exynos_crtc; | 247 | struct exynos_drm_crtc *exynos_crtc; |
248 | struct exynos_drm_private *private = drm_dev->dev_private; | 248 | struct exynos_drm_private *private = drm_dev->dev_private; |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.h b/drivers/gpu/drm/exynos/exynos_drm_crtc.h index 0ecd8fc45cff..0f3aa70818e3 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.h +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.h | |||
@@ -18,11 +18,11 @@ | |||
18 | #include "exynos_drm_drv.h" | 18 | #include "exynos_drm_drv.h" |
19 | 19 | ||
20 | struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev, | 20 | struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev, |
21 | struct drm_plane *plane, | 21 | struct drm_plane *plane, |
22 | int pipe, | 22 | int pipe, |
23 | enum exynos_drm_output_type type, | 23 | enum exynos_drm_output_type type, |
24 | struct exynos_drm_crtc_ops *ops, | 24 | const struct exynos_drm_crtc_ops *ops, |
25 | void *context); | 25 | void *context); |
26 | int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int pipe); | 26 | int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int pipe); |
27 | void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int pipe); | 27 | void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int pipe); |
28 | void exynos_drm_crtc_finish_pageflip(struct drm_device *dev, int pipe); | 28 | void exynos_drm_crtc_finish_pageflip(struct drm_device *dev, int pipe); |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index e12ecb5d5d9a..29e3fb78c615 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h | |||
@@ -71,13 +71,6 @@ enum exynos_drm_output_type { | |||
71 | * @dma_addr: array of bus(accessed by dma) address to the memory region | 71 | * @dma_addr: array of bus(accessed by dma) address to the memory region |
72 | * allocated for a overlay. | 72 | * allocated for a overlay. |
73 | * @zpos: order of overlay layer(z position). | 73 | * @zpos: order of overlay layer(z position). |
74 | * @index_color: if using color key feature then this value would be used | ||
75 | * as index color. | ||
76 | * @default_win: a window to be enabled. | ||
77 | * @color_key: color key on or off. | ||
78 | * @local_path: in case of lcd type, local path mode on or off. | ||
79 | * @transparency: transparency on or off. | ||
80 | * @activated: activated or not. | ||
81 | * @enabled: enabled or not. | 74 | * @enabled: enabled or not. |
82 | * @resume: to resume or not. | 75 | * @resume: to resume or not. |
83 | * | 76 | * |
@@ -108,13 +101,7 @@ struct exynos_drm_plane { | |||
108 | uint32_t pixel_format; | 101 | uint32_t pixel_format; |
109 | dma_addr_t dma_addr[MAX_FB_BUFFER]; | 102 | dma_addr_t dma_addr[MAX_FB_BUFFER]; |
110 | unsigned int zpos; | 103 | unsigned int zpos; |
111 | unsigned int index_color; | ||
112 | 104 | ||
113 | bool default_win:1; | ||
114 | bool color_key:1; | ||
115 | bool local_path:1; | ||
116 | bool transparency:1; | ||
117 | bool activated:1; | ||
118 | bool enabled:1; | 105 | bool enabled:1; |
119 | bool resume:1; | 106 | bool resume:1; |
120 | }; | 107 | }; |
@@ -181,6 +168,10 @@ struct exynos_drm_display { | |||
181 | * @win_disable: disable hardware specific overlay. | 168 | * @win_disable: disable hardware specific overlay. |
182 | * @te_handler: trigger to transfer video image at the tearing effect | 169 | * @te_handler: trigger to transfer video image at the tearing effect |
183 | * synchronization signal if there is a page flip request. | 170 | * synchronization signal if there is a page flip request. |
171 | * @clock_enable: optional function enabling/disabling display domain clock, | ||
172 | * called from exynos-dp driver before powering up (with | ||
173 | * 'enable' argument as true) and after powering down (with | ||
174 | * 'enable' as false). | ||
184 | */ | 175 | */ |
185 | struct exynos_drm_crtc; | 176 | struct exynos_drm_crtc; |
186 | struct exynos_drm_crtc_ops { | 177 | struct exynos_drm_crtc_ops { |
@@ -195,6 +186,7 @@ struct exynos_drm_crtc_ops { | |||
195 | void (*win_commit)(struct exynos_drm_crtc *crtc, unsigned int zpos); | 186 | void (*win_commit)(struct exynos_drm_crtc *crtc, unsigned int zpos); |
196 | void (*win_disable)(struct exynos_drm_crtc *crtc, unsigned int zpos); | 187 | void (*win_disable)(struct exynos_drm_crtc *crtc, unsigned int zpos); |
197 | void (*te_handler)(struct exynos_drm_crtc *crtc); | 188 | void (*te_handler)(struct exynos_drm_crtc *crtc); |
189 | void (*clock_enable)(struct exynos_drm_crtc *crtc, bool enable); | ||
198 | }; | 190 | }; |
199 | 191 | ||
200 | /* | 192 | /* |
@@ -221,7 +213,7 @@ struct exynos_drm_crtc { | |||
221 | unsigned int dpms; | 213 | unsigned int dpms; |
222 | wait_queue_head_t pending_flip_queue; | 214 | wait_queue_head_t pending_flip_queue; |
223 | struct drm_pending_vblank_event *event; | 215 | struct drm_pending_vblank_event *event; |
224 | struct exynos_drm_crtc_ops *ops; | 216 | const struct exynos_drm_crtc_ops *ops; |
225 | void *ctx; | 217 | void *ctx; |
226 | }; | 218 | }; |
227 | 219 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c b/drivers/gpu/drm/exynos/exynos_drm_fb.c index 929cb03a8eab..142eb4e3f59e 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fb.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c | |||
@@ -171,43 +171,6 @@ exynos_drm_framebuffer_init(struct drm_device *dev, | |||
171 | return &exynos_fb->fb; | 171 | return &exynos_fb->fb; |
172 | } | 172 | } |
173 | 173 | ||
174 | static u32 exynos_drm_format_num_buffers(struct drm_mode_fb_cmd2 *mode_cmd) | ||
175 | { | ||
176 | unsigned int cnt = 0; | ||
177 | |||
178 | if (mode_cmd->pixel_format != DRM_FORMAT_NV12) | ||
179 | return drm_format_num_planes(mode_cmd->pixel_format); | ||
180 | |||
181 | while (cnt != MAX_FB_BUFFER) { | ||
182 | if (!mode_cmd->handles[cnt]) | ||
183 | break; | ||
184 | cnt++; | ||
185 | } | ||
186 | |||
187 | /* | ||
188 | * check if NV12 or NV12M. | ||
189 | * | ||
190 | * NV12 | ||
191 | * handles[0] = base1, offsets[0] = 0 | ||
192 | * handles[1] = base1, offsets[1] = Y_size | ||
193 | * | ||
194 | * NV12M | ||
195 | * handles[0] = base1, offsets[0] = 0 | ||
196 | * handles[1] = base2, offsets[1] = 0 | ||
197 | */ | ||
198 | if (cnt == 2) { | ||
199 | /* | ||
200 | * in case of NV12 format, offsets[1] is not 0 and | ||
201 | * handles[0] is same as handles[1]. | ||
202 | */ | ||
203 | if (mode_cmd->offsets[1] && | ||
204 | mode_cmd->handles[0] == mode_cmd->handles[1]) | ||
205 | cnt = 1; | ||
206 | } | ||
207 | |||
208 | return cnt; | ||
209 | } | ||
210 | |||
211 | static struct drm_framebuffer * | 174 | static struct drm_framebuffer * |
212 | exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, | 175 | exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, |
213 | struct drm_mode_fb_cmd2 *mode_cmd) | 176 | struct drm_mode_fb_cmd2 *mode_cmd) |
@@ -230,7 +193,7 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, | |||
230 | 193 | ||
231 | drm_helper_mode_fill_fb_struct(&exynos_fb->fb, mode_cmd); | 194 | drm_helper_mode_fill_fb_struct(&exynos_fb->fb, mode_cmd); |
232 | exynos_fb->exynos_gem_obj[0] = to_exynos_gem_obj(obj); | 195 | exynos_fb->exynos_gem_obj[0] = to_exynos_gem_obj(obj); |
233 | exynos_fb->buf_cnt = exynos_drm_format_num_buffers(mode_cmd); | 196 | exynos_fb->buf_cnt = drm_format_num_planes(mode_cmd->pixel_format); |
234 | 197 | ||
235 | DRM_DEBUG_KMS("buf_cnt = %d\n", exynos_fb->buf_cnt); | 198 | DRM_DEBUG_KMS("buf_cnt = %d\n", exynos_fb->buf_cnt); |
236 | 199 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 9819fa6a9e2a..a0edab833148 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c | |||
@@ -33,7 +33,6 @@ | |||
33 | #include "exynos_drm_crtc.h" | 33 | #include "exynos_drm_crtc.h" |
34 | #include "exynos_drm_plane.h" | 34 | #include "exynos_drm_plane.h" |
35 | #include "exynos_drm_iommu.h" | 35 | #include "exynos_drm_iommu.h" |
36 | #include "exynos_drm_fimd.h" | ||
37 | 36 | ||
38 | /* | 37 | /* |
39 | * FIMD stands for Fully Interactive Mobile Display and | 38 | * FIMD stands for Fully Interactive Mobile Display and |
@@ -216,7 +215,7 @@ static void fimd_wait_for_vblank(struct exynos_drm_crtc *crtc) | |||
216 | DRM_DEBUG_KMS("vblank wait timed out.\n"); | 215 | DRM_DEBUG_KMS("vblank wait timed out.\n"); |
217 | } | 216 | } |
218 | 217 | ||
219 | static void fimd_enable_video_output(struct fimd_context *ctx, int win, | 218 | static void fimd_enable_video_output(struct fimd_context *ctx, unsigned int win, |
220 | bool enable) | 219 | bool enable) |
221 | { | 220 | { |
222 | u32 val = readl(ctx->regs + WINCON(win)); | 221 | u32 val = readl(ctx->regs + WINCON(win)); |
@@ -229,7 +228,8 @@ static void fimd_enable_video_output(struct fimd_context *ctx, int win, | |||
229 | writel(val, ctx->regs + WINCON(win)); | 228 | writel(val, ctx->regs + WINCON(win)); |
230 | } | 229 | } |
231 | 230 | ||
232 | static void fimd_enable_shadow_channel_path(struct fimd_context *ctx, int win, | 231 | static void fimd_enable_shadow_channel_path(struct fimd_context *ctx, |
232 | unsigned int win, | ||
233 | bool enable) | 233 | bool enable) |
234 | { | 234 | { |
235 | u32 val = readl(ctx->regs + SHADOWCON); | 235 | u32 val = readl(ctx->regs + SHADOWCON); |
@@ -244,7 +244,7 @@ static void fimd_enable_shadow_channel_path(struct fimd_context *ctx, int win, | |||
244 | 244 | ||
245 | static void fimd_clear_channel(struct fimd_context *ctx) | 245 | static void fimd_clear_channel(struct fimd_context *ctx) |
246 | { | 246 | { |
247 | int win, ch_enabled = 0; | 247 | unsigned int win, ch_enabled = 0; |
248 | 248 | ||
249 | DRM_DEBUG_KMS("%s\n", __FILE__); | 249 | DRM_DEBUG_KMS("%s\n", __FILE__); |
250 | 250 | ||
@@ -946,7 +946,24 @@ static void fimd_te_handler(struct exynos_drm_crtc *crtc) | |||
946 | drm_handle_vblank(ctx->drm_dev, ctx->pipe); | 946 | drm_handle_vblank(ctx->drm_dev, ctx->pipe); |
947 | } | 947 | } |
948 | 948 | ||
949 | static struct exynos_drm_crtc_ops fimd_crtc_ops = { | 949 | static void fimd_dp_clock_enable(struct exynos_drm_crtc *crtc, bool enable) |
950 | { | ||
951 | struct fimd_context *ctx = crtc->ctx; | ||
952 | u32 val; | ||
953 | |||
954 | /* | ||
955 | * Only Exynos 5250, 5260, 5410 and 542x requires enabling DP/MIE | ||
956 | * clock. On these SoCs the bootloader may enable it but any | ||
957 | * power domain off/on will reset it to disable state. | ||
958 | */ | ||
959 | if (ctx->driver_data != &exynos5_fimd_driver_data) | ||
960 | return; | ||
961 | |||
962 | val = enable ? DP_MIE_CLK_DP_ENABLE : DP_MIE_CLK_DISABLE; | ||
963 | writel(DP_MIE_CLK_DP_ENABLE, ctx->regs + DP_MIE_CLKCON); | ||
964 | } | ||
965 | |||
966 | static const struct exynos_drm_crtc_ops fimd_crtc_ops = { | ||
950 | .dpms = fimd_dpms, | 967 | .dpms = fimd_dpms, |
951 | .mode_fixup = fimd_mode_fixup, | 968 | .mode_fixup = fimd_mode_fixup, |
952 | .commit = fimd_commit, | 969 | .commit = fimd_commit, |
@@ -956,6 +973,7 @@ static struct exynos_drm_crtc_ops fimd_crtc_ops = { | |||
956 | .win_commit = fimd_win_commit, | 973 | .win_commit = fimd_win_commit, |
957 | .win_disable = fimd_win_disable, | 974 | .win_disable = fimd_win_disable, |
958 | .te_handler = fimd_te_handler, | 975 | .te_handler = fimd_te_handler, |
976 | .clock_enable = fimd_dp_clock_enable, | ||
959 | }; | 977 | }; |
960 | 978 | ||
961 | static irqreturn_t fimd_irq_handler(int irq, void *dev_id) | 979 | static irqreturn_t fimd_irq_handler(int irq, void *dev_id) |
@@ -1025,12 +1043,7 @@ static int fimd_bind(struct device *dev, struct device *master, void *data) | |||
1025 | if (ctx->display) | 1043 | if (ctx->display) |
1026 | exynos_drm_create_enc_conn(drm_dev, ctx->display); | 1044 | exynos_drm_create_enc_conn(drm_dev, ctx->display); |
1027 | 1045 | ||
1028 | ret = fimd_iommu_attach_devices(ctx, drm_dev); | 1046 | return fimd_iommu_attach_devices(ctx, drm_dev); |
1029 | if (ret) | ||
1030 | return ret; | ||
1031 | |||
1032 | return 0; | ||
1033 | |||
1034 | } | 1047 | } |
1035 | 1048 | ||
1036 | static void fimd_unbind(struct device *dev, struct device *master, | 1049 | static void fimd_unbind(struct device *dev, struct device *master, |
@@ -1192,24 +1205,6 @@ static int fimd_remove(struct platform_device *pdev) | |||
1192 | return 0; | 1205 | return 0; |
1193 | } | 1206 | } |
1194 | 1207 | ||
1195 | void fimd_dp_clock_enable(struct exynos_drm_crtc *crtc, bool enable) | ||
1196 | { | ||
1197 | struct fimd_context *ctx = crtc->ctx; | ||
1198 | u32 val; | ||
1199 | |||
1200 | /* | ||
1201 | * Only Exynos 5250, 5260, 5410 and 542x requires enabling DP/MIE | ||
1202 | * clock. On these SoCs the bootloader may enable it but any | ||
1203 | * power domain off/on will reset it to disable state. | ||
1204 | */ | ||
1205 | if (ctx->driver_data != &exynos5_fimd_driver_data) | ||
1206 | return; | ||
1207 | |||
1208 | val = enable ? DP_MIE_CLK_DP_ENABLE : DP_MIE_CLK_DISABLE; | ||
1209 | writel(DP_MIE_CLK_DP_ENABLE, ctx->regs + DP_MIE_CLKCON); | ||
1210 | } | ||
1211 | EXPORT_SYMBOL_GPL(fimd_dp_clock_enable); | ||
1212 | |||
1213 | struct platform_driver fimd_driver = { | 1208 | struct platform_driver fimd_driver = { |
1214 | .probe = fimd_probe, | 1209 | .probe = fimd_probe, |
1215 | .remove = fimd_remove, | 1210 | .remove = fimd_remove, |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.h b/drivers/gpu/drm/exynos/exynos_drm_fimd.h deleted file mode 100644 index b4fcaa568456..000000000000 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.h +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms of the GNU General Public License as published by the | ||
6 | * Free Software Foundation; either version 2 of the License, or (at your | ||
7 | * option) any later version. | ||
8 | */ | ||
9 | |||
10 | #ifndef _EXYNOS_DRM_FIMD_H_ | ||
11 | #define _EXYNOS_DRM_FIMD_H_ | ||
12 | |||
13 | extern void fimd_dp_clock_enable(struct exynos_drm_crtc *crtc, bool enable); | ||
14 | |||
15 | #endif /* _EXYNOS_DRM_FIMD_H_ */ | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c index 13ea3349363b..b1180fbe7546 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_plane.c +++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c | |||
@@ -76,7 +76,7 @@ int exynos_check_plane(struct drm_plane *plane, struct drm_framebuffer *fb) | |||
76 | return -EFAULT; | 76 | return -EFAULT; |
77 | } | 77 | } |
78 | 78 | ||
79 | exynos_plane->dma_addr[i] = buffer->dma_addr; | 79 | exynos_plane->dma_addr[i] = buffer->dma_addr + fb->offsets[i]; |
80 | 80 | ||
81 | DRM_DEBUG_KMS("buffer: %d, dma_addr = 0x%lx\n", | 81 | DRM_DEBUG_KMS("buffer: %d, dma_addr = 0x%lx\n", |
82 | i, (unsigned long)exynos_plane->dma_addr[i]); | 82 | i, (unsigned long)exynos_plane->dma_addr[i]); |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c index 27e84ec21694..1b3479a8db5f 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c | |||
@@ -217,7 +217,7 @@ static int vidi_ctx_initialize(struct vidi_context *ctx, | |||
217 | return 0; | 217 | return 0; |
218 | } | 218 | } |
219 | 219 | ||
220 | static struct exynos_drm_crtc_ops vidi_crtc_ops = { | 220 | static const struct exynos_drm_crtc_ops vidi_crtc_ops = { |
221 | .dpms = vidi_dpms, | 221 | .dpms = vidi_dpms, |
222 | .enable_vblank = vidi_enable_vblank, | 222 | .enable_vblank = vidi_enable_vblank, |
223 | .disable_vblank = vidi_disable_vblank, | 223 | .disable_vblank = vidi_disable_vblank, |
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index fbec750574e6..8874c1fcb3ab 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c | |||
@@ -44,6 +44,12 @@ | |||
44 | #define MIXER_WIN_NR 3 | 44 | #define MIXER_WIN_NR 3 |
45 | #define MIXER_DEFAULT_WIN 0 | 45 | #define MIXER_DEFAULT_WIN 0 |
46 | 46 | ||
47 | /* The pixelformats that are natively supported by the mixer. */ | ||
48 | #define MXR_FORMAT_RGB565 4 | ||
49 | #define MXR_FORMAT_ARGB1555 5 | ||
50 | #define MXR_FORMAT_ARGB4444 6 | ||
51 | #define MXR_FORMAT_ARGB8888 7 | ||
52 | |||
47 | struct mixer_resources { | 53 | struct mixer_resources { |
48 | int irq; | 54 | int irq; |
49 | void __iomem *mixer_regs; | 55 | void __iomem *mixer_regs; |
@@ -327,7 +333,8 @@ static void mixer_cfg_rgb_fmt(struct mixer_context *ctx, unsigned int height) | |||
327 | mixer_reg_writemask(res, MXR_CFG, val, MXR_CFG_RGB_FMT_MASK); | 333 | mixer_reg_writemask(res, MXR_CFG, val, MXR_CFG_RGB_FMT_MASK); |
328 | } | 334 | } |
329 | 335 | ||
330 | static void mixer_cfg_layer(struct mixer_context *ctx, int win, bool enable) | 336 | static void mixer_cfg_layer(struct mixer_context *ctx, unsigned int win, |
337 | bool enable) | ||
331 | { | 338 | { |
332 | struct mixer_resources *res = &ctx->mixer_res; | 339 | struct mixer_resources *res = &ctx->mixer_res; |
333 | u32 val = enable ? ~0 : 0; | 340 | u32 val = enable ? ~0 : 0; |
@@ -359,8 +366,6 @@ static void mixer_run(struct mixer_context *ctx) | |||
359 | struct mixer_resources *res = &ctx->mixer_res; | 366 | struct mixer_resources *res = &ctx->mixer_res; |
360 | 367 | ||
361 | mixer_reg_writemask(res, MXR_STATUS, ~0, MXR_STATUS_REG_RUN); | 368 | mixer_reg_writemask(res, MXR_STATUS, ~0, MXR_STATUS_REG_RUN); |
362 | |||
363 | mixer_regs_dump(ctx); | ||
364 | } | 369 | } |
365 | 370 | ||
366 | static void mixer_stop(struct mixer_context *ctx) | 371 | static void mixer_stop(struct mixer_context *ctx) |
@@ -373,16 +378,13 @@ static void mixer_stop(struct mixer_context *ctx) | |||
373 | while (!(mixer_reg_read(res, MXR_STATUS) & MXR_STATUS_REG_IDLE) && | 378 | while (!(mixer_reg_read(res, MXR_STATUS) & MXR_STATUS_REG_IDLE) && |
374 | --timeout) | 379 | --timeout) |
375 | usleep_range(10000, 12000); | 380 | usleep_range(10000, 12000); |
376 | |||
377 | mixer_regs_dump(ctx); | ||
378 | } | 381 | } |
379 | 382 | ||
380 | static void vp_video_buffer(struct mixer_context *ctx, int win) | 383 | static void vp_video_buffer(struct mixer_context *ctx, unsigned int win) |
381 | { | 384 | { |
382 | struct mixer_resources *res = &ctx->mixer_res; | 385 | struct mixer_resources *res = &ctx->mixer_res; |
383 | unsigned long flags; | 386 | unsigned long flags; |
384 | struct exynos_drm_plane *plane; | 387 | struct exynos_drm_plane *plane; |
385 | unsigned int buf_num = 1; | ||
386 | dma_addr_t luma_addr[2], chroma_addr[2]; | 388 | dma_addr_t luma_addr[2], chroma_addr[2]; |
387 | bool tiled_mode = false; | 389 | bool tiled_mode = false; |
388 | bool crcb_mode = false; | 390 | bool crcb_mode = false; |
@@ -393,27 +395,18 @@ static void vp_video_buffer(struct mixer_context *ctx, int win) | |||
393 | switch (plane->pixel_format) { | 395 | switch (plane->pixel_format) { |
394 | case DRM_FORMAT_NV12: | 396 | case DRM_FORMAT_NV12: |
395 | crcb_mode = false; | 397 | crcb_mode = false; |
396 | buf_num = 2; | ||
397 | break; | 398 | break; |
398 | /* TODO: single buffer format NV12, NV21 */ | 399 | case DRM_FORMAT_NV21: |
400 | crcb_mode = true; | ||
401 | break; | ||
399 | default: | 402 | default: |
400 | /* ignore pixel format at disable time */ | ||
401 | if (!plane->dma_addr[0]) | ||
402 | break; | ||
403 | |||
404 | DRM_ERROR("pixel format for vp is wrong [%d].\n", | 403 | DRM_ERROR("pixel format for vp is wrong [%d].\n", |
405 | plane->pixel_format); | 404 | plane->pixel_format); |
406 | return; | 405 | return; |
407 | } | 406 | } |
408 | 407 | ||
409 | if (buf_num == 2) { | 408 | luma_addr[0] = plane->dma_addr[0]; |
410 | luma_addr[0] = plane->dma_addr[0]; | 409 | chroma_addr[0] = plane->dma_addr[1]; |
411 | chroma_addr[0] = plane->dma_addr[1]; | ||
412 | } else { | ||
413 | luma_addr[0] = plane->dma_addr[0]; | ||
414 | chroma_addr[0] = plane->dma_addr[0] | ||
415 | + (plane->pitch * plane->fb_height); | ||
416 | } | ||
417 | 410 | ||
418 | if (plane->scan_flag & DRM_MODE_FLAG_INTERLACE) { | 411 | if (plane->scan_flag & DRM_MODE_FLAG_INTERLACE) { |
419 | ctx->interlace = true; | 412 | ctx->interlace = true; |
@@ -484,6 +477,7 @@ static void vp_video_buffer(struct mixer_context *ctx, int win) | |||
484 | mixer_vsync_set_update(ctx, true); | 477 | mixer_vsync_set_update(ctx, true); |
485 | spin_unlock_irqrestore(&res->reg_slock, flags); | 478 | spin_unlock_irqrestore(&res->reg_slock, flags); |
486 | 479 | ||
480 | mixer_regs_dump(ctx); | ||
487 | vp_regs_dump(ctx); | 481 | vp_regs_dump(ctx); |
488 | } | 482 | } |
489 | 483 | ||
@@ -518,7 +512,7 @@ fail: | |||
518 | return -ENOTSUPP; | 512 | return -ENOTSUPP; |
519 | } | 513 | } |
520 | 514 | ||
521 | static void mixer_graph_buffer(struct mixer_context *ctx, int win) | 515 | static void mixer_graph_buffer(struct mixer_context *ctx, unsigned int win) |
522 | { | 516 | { |
523 | struct mixer_resources *res = &ctx->mixer_res; | 517 | struct mixer_resources *res = &ctx->mixer_res; |
524 | unsigned long flags; | 518 | unsigned long flags; |
@@ -531,20 +525,27 @@ static void mixer_graph_buffer(struct mixer_context *ctx, int win) | |||
531 | 525 | ||
532 | plane = &ctx->planes[win]; | 526 | plane = &ctx->planes[win]; |
533 | 527 | ||
534 | #define RGB565 4 | 528 | switch (plane->pixel_format) { |
535 | #define ARGB1555 5 | 529 | case DRM_FORMAT_XRGB4444: |
536 | #define ARGB4444 6 | 530 | fmt = MXR_FORMAT_ARGB4444; |
537 | #define ARGB8888 7 | 531 | break; |
538 | 532 | ||
539 | switch (plane->bpp) { | 533 | case DRM_FORMAT_XRGB1555: |
540 | case 16: | 534 | fmt = MXR_FORMAT_ARGB1555; |
541 | fmt = ARGB4444; | ||
542 | break; | 535 | break; |
543 | case 32: | 536 | |
544 | fmt = ARGB8888; | 537 | case DRM_FORMAT_RGB565: |
538 | fmt = MXR_FORMAT_RGB565; | ||
539 | break; | ||
540 | |||
541 | case DRM_FORMAT_XRGB8888: | ||
542 | case DRM_FORMAT_ARGB8888: | ||
543 | fmt = MXR_FORMAT_ARGB8888; | ||
545 | break; | 544 | break; |
545 | |||
546 | default: | 546 | default: |
547 | fmt = ARGB8888; | 547 | DRM_DEBUG_KMS("pixelformat unsupported by mixer\n"); |
548 | return; | ||
548 | } | 549 | } |
549 | 550 | ||
550 | /* check if mixer supports requested scaling setup */ | 551 | /* check if mixer supports requested scaling setup */ |
@@ -617,6 +618,8 @@ static void mixer_graph_buffer(struct mixer_context *ctx, int win) | |||
617 | 618 | ||
618 | mixer_vsync_set_update(ctx, true); | 619 | mixer_vsync_set_update(ctx, true); |
619 | spin_unlock_irqrestore(&res->reg_slock, flags); | 620 | spin_unlock_irqrestore(&res->reg_slock, flags); |
621 | |||
622 | mixer_regs_dump(ctx); | ||
620 | } | 623 | } |
621 | 624 | ||
622 | static void vp_win_reset(struct mixer_context *ctx) | 625 | static void vp_win_reset(struct mixer_context *ctx) |
@@ -1070,6 +1073,7 @@ static void mixer_poweroff(struct mixer_context *ctx) | |||
1070 | mutex_unlock(&ctx->mixer_mutex); | 1073 | mutex_unlock(&ctx->mixer_mutex); |
1071 | 1074 | ||
1072 | mixer_stop(ctx); | 1075 | mixer_stop(ctx); |
1076 | mixer_regs_dump(ctx); | ||
1073 | mixer_window_suspend(ctx); | 1077 | mixer_window_suspend(ctx); |
1074 | 1078 | ||
1075 | ctx->int_en = mixer_reg_read(res, MXR_INT_EN); | 1079 | ctx->int_en = mixer_reg_read(res, MXR_INT_EN); |
@@ -1126,7 +1130,7 @@ int mixer_check_mode(struct drm_display_mode *mode) | |||
1126 | return -EINVAL; | 1130 | return -EINVAL; |
1127 | } | 1131 | } |
1128 | 1132 | ||
1129 | static struct exynos_drm_crtc_ops mixer_crtc_ops = { | 1133 | static const struct exynos_drm_crtc_ops mixer_crtc_ops = { |
1130 | .dpms = mixer_dpms, | 1134 | .dpms = mixer_dpms, |
1131 | .enable_vblank = mixer_enable_vblank, | 1135 | .enable_vblank = mixer_enable_vblank, |
1132 | .disable_vblank = mixer_disable_vblank, | 1136 | .disable_vblank = mixer_disable_vblank, |
@@ -1156,7 +1160,7 @@ static struct mixer_drv_data exynos4210_mxr_drv_data = { | |||
1156 | .has_sclk = 1, | 1160 | .has_sclk = 1, |
1157 | }; | 1161 | }; |
1158 | 1162 | ||
1159 | static struct platform_device_id mixer_driver_types[] = { | 1163 | static const struct platform_device_id mixer_driver_types[] = { |
1160 | { | 1164 | { |
1161 | .name = "s5p-mixer", | 1165 | .name = "s5p-mixer", |
1162 | .driver_data = (unsigned long)&exynos4210_mxr_drv_data, | 1166 | .driver_data = (unsigned long)&exynos4210_mxr_drv_data, |
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c index c5914564939c..eadc15cddbeb 100644 --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c | |||
@@ -2068,22 +2068,20 @@ static void ilk_compute_wm_parameters(struct drm_crtc *crtc, | |||
2068 | p->pipe_htotal = intel_crtc->config->base.adjusted_mode.crtc_htotal; | 2068 | p->pipe_htotal = intel_crtc->config->base.adjusted_mode.crtc_htotal; |
2069 | p->pixel_rate = ilk_pipe_pixel_rate(dev, crtc); | 2069 | p->pixel_rate = ilk_pipe_pixel_rate(dev, crtc); |
2070 | 2070 | ||
2071 | if (crtc->primary->state->fb) { | 2071 | if (crtc->primary->state->fb) |
2072 | p->pri.enabled = true; | ||
2073 | p->pri.bytes_per_pixel = | 2072 | p->pri.bytes_per_pixel = |
2074 | crtc->primary->state->fb->bits_per_pixel / 8; | 2073 | crtc->primary->state->fb->bits_per_pixel / 8; |
2075 | } else { | 2074 | else |
2076 | p->pri.enabled = false; | 2075 | p->pri.bytes_per_pixel = 4; |
2077 | p->pri.bytes_per_pixel = 0; | 2076 | |
2078 | } | 2077 | p->cur.bytes_per_pixel = 4; |
2078 | /* | ||
2079 | * TODO: for now, assume primary and cursor planes are always enabled. | ||
2080 | * Setting them to false makes the screen flicker. | ||
2081 | */ | ||
2082 | p->pri.enabled = true; | ||
2083 | p->cur.enabled = true; | ||
2079 | 2084 | ||
2080 | if (crtc->cursor->state->fb) { | ||
2081 | p->cur.enabled = true; | ||
2082 | p->cur.bytes_per_pixel = 4; | ||
2083 | } else { | ||
2084 | p->cur.enabled = false; | ||
2085 | p->cur.bytes_per_pixel = 0; | ||
2086 | } | ||
2087 | p->pri.horiz_pixels = intel_crtc->config->pipe_src_w; | 2085 | p->pri.horiz_pixels = intel_crtc->config->pipe_src_w; |
2088 | p->cur.horiz_pixels = intel_crtc->base.cursor->state->crtc_w; | 2086 | p->cur.horiz_pixels = intel_crtc->base.cursor->state->crtc_w; |
2089 | 2087 | ||
diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c index 94a5bee69fe7..bbdcab0a56c1 100644 --- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c +++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c | |||
@@ -384,7 +384,7 @@ void adreno_gpu_cleanup(struct adreno_gpu *gpu) | |||
384 | if (gpu->memptrs_bo) { | 384 | if (gpu->memptrs_bo) { |
385 | if (gpu->memptrs_iova) | 385 | if (gpu->memptrs_iova) |
386 | msm_gem_put_iova(gpu->memptrs_bo, gpu->base.id); | 386 | msm_gem_put_iova(gpu->memptrs_bo, gpu->base.id); |
387 | drm_gem_object_unreference(gpu->memptrs_bo); | 387 | drm_gem_object_unreference_unlocked(gpu->memptrs_bo); |
388 | } | 388 | } |
389 | release_firmware(gpu->pm4); | 389 | release_firmware(gpu->pm4); |
390 | release_firmware(gpu->pfp); | 390 | release_firmware(gpu->pfp); |
diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c index 28d1f95a90cc..ad50b80225f5 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.c +++ b/drivers/gpu/drm/msm/dsi/dsi.c | |||
@@ -177,6 +177,11 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev, | |||
177 | goto fail; | 177 | goto fail; |
178 | } | 178 | } |
179 | 179 | ||
180 | for (i = 0; i < MSM_DSI_ENCODER_NUM; i++) { | ||
181 | encoders[i]->bridge = msm_dsi->bridge; | ||
182 | msm_dsi->encoders[i] = encoders[i]; | ||
183 | } | ||
184 | |||
180 | msm_dsi->connector = msm_dsi_manager_connector_init(msm_dsi->id); | 185 | msm_dsi->connector = msm_dsi_manager_connector_init(msm_dsi->id); |
181 | if (IS_ERR(msm_dsi->connector)) { | 186 | if (IS_ERR(msm_dsi->connector)) { |
182 | ret = PTR_ERR(msm_dsi->connector); | 187 | ret = PTR_ERR(msm_dsi->connector); |
@@ -185,11 +190,6 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev, | |||
185 | goto fail; | 190 | goto fail; |
186 | } | 191 | } |
187 | 192 | ||
188 | for (i = 0; i < MSM_DSI_ENCODER_NUM; i++) { | ||
189 | encoders[i]->bridge = msm_dsi->bridge; | ||
190 | msm_dsi->encoders[i] = encoders[i]; | ||
191 | } | ||
192 | |||
193 | priv->bridges[priv->num_bridges++] = msm_dsi->bridge; | 193 | priv->bridges[priv->num_bridges++] = msm_dsi->bridge; |
194 | priv->connectors[priv->num_connectors++] = msm_dsi->connector; | 194 | priv->connectors[priv->num_connectors++] = msm_dsi->connector; |
195 | 195 | ||
diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c index 956b22492c9a..649d20d29f92 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_host.c +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c | |||
@@ -1023,7 +1023,7 @@ static int dsi_short_read1_resp(u8 *buf, const struct mipi_dsi_msg *msg) | |||
1023 | *data = buf[1]; /* strip out dcs type */ | 1023 | *data = buf[1]; /* strip out dcs type */ |
1024 | return 1; | 1024 | return 1; |
1025 | } else { | 1025 | } else { |
1026 | pr_err("%s: read data does not match with rx_buf len %d\n", | 1026 | pr_err("%s: read data does not match with rx_buf len %zu\n", |
1027 | __func__, msg->rx_len); | 1027 | __func__, msg->rx_len); |
1028 | return -EINVAL; | 1028 | return -EINVAL; |
1029 | } | 1029 | } |
@@ -1040,7 +1040,7 @@ static int dsi_short_read2_resp(u8 *buf, const struct mipi_dsi_msg *msg) | |||
1040 | data[1] = buf[2]; | 1040 | data[1] = buf[2]; |
1041 | return 2; | 1041 | return 2; |
1042 | } else { | 1042 | } else { |
1043 | pr_err("%s: read data does not match with rx_buf len %d\n", | 1043 | pr_err("%s: read data does not match with rx_buf len %zu\n", |
1044 | __func__, msg->rx_len); | 1044 | __func__, msg->rx_len); |
1045 | return -EINVAL; | 1045 | return -EINVAL; |
1046 | } | 1046 | } |
@@ -1093,7 +1093,6 @@ static int dsi_cmd_dma_rx(struct msm_dsi_host *msm_host, | |||
1093 | { | 1093 | { |
1094 | u32 *lp, *temp, data; | 1094 | u32 *lp, *temp, data; |
1095 | int i, j = 0, cnt; | 1095 | int i, j = 0, cnt; |
1096 | bool ack_error = false; | ||
1097 | u32 read_cnt; | 1096 | u32 read_cnt; |
1098 | u8 reg[16]; | 1097 | u8 reg[16]; |
1099 | int repeated_bytes = 0; | 1098 | int repeated_bytes = 0; |
@@ -1105,15 +1104,10 @@ static int dsi_cmd_dma_rx(struct msm_dsi_host *msm_host, | |||
1105 | if (cnt > 4) | 1104 | if (cnt > 4) |
1106 | cnt = 4; /* 4 x 32 bits registers only */ | 1105 | cnt = 4; /* 4 x 32 bits registers only */ |
1107 | 1106 | ||
1108 | /* Calculate real read data count */ | 1107 | if (rx_byte == 4) |
1109 | read_cnt = dsi_read(msm_host, 0x1d4) >> 16; | 1108 | read_cnt = 4; |
1110 | 1109 | else | |
1111 | ack_error = (rx_byte == 4) ? | 1110 | read_cnt = pkt_size + 6; |
1112 | (read_cnt == 8) : /* short pkt + 4-byte error pkt */ | ||
1113 | (read_cnt == (pkt_size + 6 + 4)); /* long pkt+4-byte error pkt*/ | ||
1114 | |||
1115 | if (ack_error) | ||
1116 | read_cnt -= 4; /* Remove 4 byte error pkt */ | ||
1117 | 1111 | ||
1118 | /* | 1112 | /* |
1119 | * In case of multiple reads from the panel, after the first read, there | 1113 | * In case of multiple reads from the panel, after the first read, there |
@@ -1215,7 +1209,7 @@ static void dsi_err_worker(struct work_struct *work) | |||
1215 | container_of(work, struct msm_dsi_host, err_work); | 1209 | container_of(work, struct msm_dsi_host, err_work); |
1216 | u32 status = msm_host->err_work_state; | 1210 | u32 status = msm_host->err_work_state; |
1217 | 1211 | ||
1218 | pr_err("%s: status=%x\n", __func__, status); | 1212 | pr_err_ratelimited("%s: status=%x\n", __func__, status); |
1219 | if (status & DSI_ERR_STATE_MDP_FIFO_UNDERFLOW) | 1213 | if (status & DSI_ERR_STATE_MDP_FIFO_UNDERFLOW) |
1220 | dsi_sw_reset_restore(msm_host); | 1214 | dsi_sw_reset_restore(msm_host); |
1221 | 1215 | ||
@@ -1797,6 +1791,7 @@ int msm_dsi_host_cmd_rx(struct mipi_dsi_host *host, | |||
1797 | case MIPI_DSI_RX_ACKNOWLEDGE_AND_ERROR_REPORT: | 1791 | case MIPI_DSI_RX_ACKNOWLEDGE_AND_ERROR_REPORT: |
1798 | pr_err("%s: rx ACK_ERR_PACLAGE\n", __func__); | 1792 | pr_err("%s: rx ACK_ERR_PACLAGE\n", __func__); |
1799 | ret = 0; | 1793 | ret = 0; |
1794 | break; | ||
1800 | case MIPI_DSI_RX_GENERIC_SHORT_READ_RESPONSE_1BYTE: | 1795 | case MIPI_DSI_RX_GENERIC_SHORT_READ_RESPONSE_1BYTE: |
1801 | case MIPI_DSI_RX_DCS_SHORT_READ_RESPONSE_1BYTE: | 1796 | case MIPI_DSI_RX_DCS_SHORT_READ_RESPONSE_1BYTE: |
1802 | ret = dsi_short_read1_resp(buf, msg); | 1797 | ret = dsi_short_read1_resp(buf, msg); |
diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c index ee3ebcaa33f5..0a40f3c64e8b 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c | |||
@@ -462,7 +462,7 @@ struct drm_connector *msm_dsi_manager_connector_init(u8 id) | |||
462 | struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id); | 462 | struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id); |
463 | struct drm_connector *connector = NULL; | 463 | struct drm_connector *connector = NULL; |
464 | struct dsi_connector *dsi_connector; | 464 | struct dsi_connector *dsi_connector; |
465 | int ret; | 465 | int ret, i; |
466 | 466 | ||
467 | dsi_connector = devm_kzalloc(msm_dsi->dev->dev, | 467 | dsi_connector = devm_kzalloc(msm_dsi->dev->dev, |
468 | sizeof(*dsi_connector), GFP_KERNEL); | 468 | sizeof(*dsi_connector), GFP_KERNEL); |
@@ -495,6 +495,10 @@ struct drm_connector *msm_dsi_manager_connector_init(u8 id) | |||
495 | if (ret) | 495 | if (ret) |
496 | goto fail; | 496 | goto fail; |
497 | 497 | ||
498 | for (i = 0; i < MSM_DSI_ENCODER_NUM; i++) | ||
499 | drm_mode_connector_attach_encoder(connector, | ||
500 | msm_dsi->encoders[i]); | ||
501 | |||
498 | return connector; | 502 | return connector; |
499 | 503 | ||
500 | fail: | 504 | fail: |
diff --git a/drivers/gpu/drm/msm/edp/edp_aux.c b/drivers/gpu/drm/msm/edp/edp_aux.c index 5f5a84f6074c..208f9d47f82e 100644 --- a/drivers/gpu/drm/msm/edp/edp_aux.c +++ b/drivers/gpu/drm/msm/edp/edp_aux.c | |||
@@ -132,7 +132,7 @@ ssize_t edp_aux_transfer(struct drm_dp_aux *drm_aux, struct drm_dp_aux_msg *msg) | |||
132 | /* msg sanity check */ | 132 | /* msg sanity check */ |
133 | if ((native && (msg->size > AUX_CMD_NATIVE_MAX)) || | 133 | if ((native && (msg->size > AUX_CMD_NATIVE_MAX)) || |
134 | (msg->size > AUX_CMD_I2C_MAX)) { | 134 | (msg->size > AUX_CMD_I2C_MAX)) { |
135 | pr_err("%s: invalid msg: size(%d), request(%x)\n", | 135 | pr_err("%s: invalid msg: size(%zu), request(%x)\n", |
136 | __func__, msg->size, msg->request); | 136 | __func__, msg->size, msg->request); |
137 | return -EINVAL; | 137 | return -EINVAL; |
138 | } | 138 | } |
@@ -155,7 +155,7 @@ ssize_t edp_aux_transfer(struct drm_dp_aux *drm_aux, struct drm_dp_aux_msg *msg) | |||
155 | */ | 155 | */ |
156 | edp_write(aux->base + REG_EDP_AUX_TRANS_CTRL, 0); | 156 | edp_write(aux->base + REG_EDP_AUX_TRANS_CTRL, 0); |
157 | msm_edp_aux_ctrl(aux, 1); | 157 | msm_edp_aux_ctrl(aux, 1); |
158 | pr_err("%s: aux timeout, %d\n", __func__, ret); | 158 | pr_err("%s: aux timeout, %zd\n", __func__, ret); |
159 | goto unlock_exit; | 159 | goto unlock_exit; |
160 | } | 160 | } |
161 | DBG("completion"); | 161 | DBG("completion"); |
diff --git a/drivers/gpu/drm/msm/edp/edp_connector.c b/drivers/gpu/drm/msm/edp/edp_connector.c index d8812e84da54..b4d1b469862a 100644 --- a/drivers/gpu/drm/msm/edp/edp_connector.c +++ b/drivers/gpu/drm/msm/edp/edp_connector.c | |||
@@ -151,6 +151,8 @@ struct drm_connector *msm_edp_connector_init(struct msm_edp *edp) | |||
151 | if (ret) | 151 | if (ret) |
152 | goto fail; | 152 | goto fail; |
153 | 153 | ||
154 | drm_mode_connector_attach_encoder(connector, edp->encoder); | ||
155 | |||
154 | return connector; | 156 | return connector; |
155 | 157 | ||
156 | fail: | 158 | fail: |
diff --git a/drivers/gpu/drm/msm/edp/edp_ctrl.c b/drivers/gpu/drm/msm/edp/edp_ctrl.c index 0ec5abdba5c4..29e52d7c61c0 100644 --- a/drivers/gpu/drm/msm/edp/edp_ctrl.c +++ b/drivers/gpu/drm/msm/edp/edp_ctrl.c | |||
@@ -1149,12 +1149,13 @@ int msm_edp_ctrl_init(struct msm_edp *edp) | |||
1149 | ctrl->aux = msm_edp_aux_init(dev, ctrl->base, &ctrl->drm_aux); | 1149 | ctrl->aux = msm_edp_aux_init(dev, ctrl->base, &ctrl->drm_aux); |
1150 | if (!ctrl->aux || !ctrl->drm_aux) { | 1150 | if (!ctrl->aux || !ctrl->drm_aux) { |
1151 | pr_err("%s:failed to init aux\n", __func__); | 1151 | pr_err("%s:failed to init aux\n", __func__); |
1152 | return ret; | 1152 | return -ENOMEM; |
1153 | } | 1153 | } |
1154 | 1154 | ||
1155 | ctrl->phy = msm_edp_phy_init(dev, ctrl->base); | 1155 | ctrl->phy = msm_edp_phy_init(dev, ctrl->base); |
1156 | if (!ctrl->phy) { | 1156 | if (!ctrl->phy) { |
1157 | pr_err("%s:failed to init phy\n", __func__); | 1157 | pr_err("%s:failed to init phy\n", __func__); |
1158 | ret = -ENOMEM; | ||
1158 | goto err_destory_aux; | 1159 | goto err_destory_aux; |
1159 | } | 1160 | } |
1160 | 1161 | ||
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c index e001e6b2296a..8b9a7931b162 100644 --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c | |||
@@ -72,14 +72,13 @@ const struct mdp5_cfg_hw msm8x74_config = { | |||
72 | .base = { 0x12d00, 0x12e00, 0x12f00 }, | 72 | .base = { 0x12d00, 0x12e00, 0x12f00 }, |
73 | }, | 73 | }, |
74 | .intf = { | 74 | .intf = { |
75 | .count = 4, | ||
76 | .base = { 0x12500, 0x12700, 0x12900, 0x12b00 }, | 75 | .base = { 0x12500, 0x12700, 0x12900, 0x12b00 }, |
77 | }, | 76 | .connect = { |
78 | .intfs = { | 77 | [0] = INTF_eDP, |
79 | [0] = INTF_eDP, | 78 | [1] = INTF_DSI, |
80 | [1] = INTF_DSI, | 79 | [2] = INTF_DSI, |
81 | [2] = INTF_DSI, | 80 | [3] = INTF_HDMI, |
82 | [3] = INTF_HDMI, | 81 | }, |
83 | }, | 82 | }, |
84 | .max_clk = 200000000, | 83 | .max_clk = 200000000, |
85 | }; | 84 | }; |
@@ -142,14 +141,13 @@ const struct mdp5_cfg_hw apq8084_config = { | |||
142 | .base = { 0x12f00, 0x13000, 0x13100, 0x13200 }, | 141 | .base = { 0x12f00, 0x13000, 0x13100, 0x13200 }, |
143 | }, | 142 | }, |
144 | .intf = { | 143 | .intf = { |
145 | .count = 5, | ||
146 | .base = { 0x12500, 0x12700, 0x12900, 0x12b00, 0x12d00 }, | 144 | .base = { 0x12500, 0x12700, 0x12900, 0x12b00, 0x12d00 }, |
147 | }, | 145 | .connect = { |
148 | .intfs = { | 146 | [0] = INTF_eDP, |
149 | [0] = INTF_eDP, | 147 | [1] = INTF_DSI, |
150 | [1] = INTF_DSI, | 148 | [2] = INTF_DSI, |
151 | [2] = INTF_DSI, | 149 | [3] = INTF_HDMI, |
152 | [3] = INTF_HDMI, | 150 | }, |
153 | }, | 151 | }, |
154 | .max_clk = 320000000, | 152 | .max_clk = 320000000, |
155 | }; | 153 | }; |
@@ -196,10 +194,12 @@ const struct mdp5_cfg_hw msm8x16_config = { | |||
196 | 194 | ||
197 | }, | 195 | }, |
198 | .intf = { | 196 | .intf = { |
199 | .count = 1, /* INTF_1 */ | 197 | .base = { 0x00000, 0x6b800 }, |
200 | .base = { 0x6B800 }, | 198 | .connect = { |
199 | [0] = INTF_DISABLED, | ||
200 | [1] = INTF_DSI, | ||
201 | }, | ||
201 | }, | 202 | }, |
202 | /* TODO enable .intfs[] with [1] = INTF_DSI, once DSI is implemented */ | ||
203 | .max_clk = 320000000, | 203 | .max_clk = 320000000, |
204 | }; | 204 | }; |
205 | 205 | ||
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.h b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.h index 3a551b0892d8..69349abe59f2 100644 --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.h +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.h | |||
@@ -59,6 +59,11 @@ struct mdp5_smp_block { | |||
59 | 59 | ||
60 | #define MDP5_INTF_NUM_MAX 5 | 60 | #define MDP5_INTF_NUM_MAX 5 |
61 | 61 | ||
62 | struct mdp5_intf_block { | ||
63 | uint32_t base[MAX_BASES]; | ||
64 | u32 connect[MDP5_INTF_NUM_MAX]; /* array of enum mdp5_intf_type */ | ||
65 | }; | ||
66 | |||
62 | struct mdp5_cfg_hw { | 67 | struct mdp5_cfg_hw { |
63 | char *name; | 68 | char *name; |
64 | 69 | ||
@@ -72,9 +77,7 @@ struct mdp5_cfg_hw { | |||
72 | struct mdp5_sub_block dspp; | 77 | struct mdp5_sub_block dspp; |
73 | struct mdp5_sub_block ad; | 78 | struct mdp5_sub_block ad; |
74 | struct mdp5_sub_block pp; | 79 | struct mdp5_sub_block pp; |
75 | struct mdp5_sub_block intf; | 80 | struct mdp5_intf_block intf; |
76 | |||
77 | u32 intfs[MDP5_INTF_NUM_MAX]; /* array of enum mdp5_intf_type */ | ||
78 | 81 | ||
79 | uint32_t max_clk; | 82 | uint32_t max_clk; |
80 | }; | 83 | }; |
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c index dfa8beb9343a..bbacf9d2b738 100644 --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c | |||
@@ -206,8 +206,8 @@ static struct drm_encoder *construct_encoder(struct mdp5_kms *mdp5_kms, | |||
206 | 206 | ||
207 | static int get_dsi_id_from_intf(const struct mdp5_cfg_hw *hw_cfg, int intf_num) | 207 | static int get_dsi_id_from_intf(const struct mdp5_cfg_hw *hw_cfg, int intf_num) |
208 | { | 208 | { |
209 | const int intf_cnt = hw_cfg->intf.count; | 209 | const enum mdp5_intf_type *intfs = hw_cfg->intf.connect; |
210 | const u32 *intfs = hw_cfg->intfs; | 210 | const int intf_cnt = ARRAY_SIZE(hw_cfg->intf.connect); |
211 | int id = 0, i; | 211 | int id = 0, i; |
212 | 212 | ||
213 | for (i = 0; i < intf_cnt; i++) { | 213 | for (i = 0; i < intf_cnt; i++) { |
@@ -228,7 +228,7 @@ static int modeset_init_intf(struct mdp5_kms *mdp5_kms, int intf_num) | |||
228 | struct msm_drm_private *priv = dev->dev_private; | 228 | struct msm_drm_private *priv = dev->dev_private; |
229 | const struct mdp5_cfg_hw *hw_cfg = | 229 | const struct mdp5_cfg_hw *hw_cfg = |
230 | mdp5_cfg_get_hw_config(mdp5_kms->cfg); | 230 | mdp5_cfg_get_hw_config(mdp5_kms->cfg); |
231 | enum mdp5_intf_type intf_type = hw_cfg->intfs[intf_num]; | 231 | enum mdp5_intf_type intf_type = hw_cfg->intf.connect[intf_num]; |
232 | struct drm_encoder *encoder; | 232 | struct drm_encoder *encoder; |
233 | int ret = 0; | 233 | int ret = 0; |
234 | 234 | ||
@@ -365,7 +365,7 @@ static int modeset_init(struct mdp5_kms *mdp5_kms) | |||
365 | /* Construct encoders and modeset initialize connector devices | 365 | /* Construct encoders and modeset initialize connector devices |
366 | * for each external display interface. | 366 | * for each external display interface. |
367 | */ | 367 | */ |
368 | for (i = 0; i < ARRAY_SIZE(hw_cfg->intfs); i++) { | 368 | for (i = 0; i < ARRAY_SIZE(hw_cfg->intf.connect); i++) { |
369 | ret = modeset_init_intf(mdp5_kms, i); | 369 | ret = modeset_init_intf(mdp5_kms, i); |
370 | if (ret) | 370 | if (ret) |
371 | goto fail; | 371 | goto fail; |
@@ -514,8 +514,8 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev) | |||
514 | */ | 514 | */ |
515 | mdp5_enable(mdp5_kms); | 515 | mdp5_enable(mdp5_kms); |
516 | for (i = 0; i < MDP5_INTF_NUM_MAX; i++) { | 516 | for (i = 0; i < MDP5_INTF_NUM_MAX; i++) { |
517 | if (!config->hw->intf.base[i] || | 517 | if (mdp5_cfg_intf_is_virtual(config->hw->intf.connect[i]) || |
518 | mdp5_cfg_intf_is_virtual(config->hw->intfs[i])) | 518 | !config->hw->intf.base[i]) |
519 | continue; | 519 | continue; |
520 | mdp5_write(mdp5_kms, REG_MDP5_INTF_TIMING_ENGINE_EN(i), 0); | 520 | mdp5_write(mdp5_kms, REG_MDP5_INTF_TIMING_ENGINE_EN(i), 0); |
521 | } | 521 | } |
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c index 18a3d203b174..57b8f56ae9d0 100644 --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | |||
@@ -273,7 +273,7 @@ static void set_scanout_locked(struct drm_plane *plane, | |||
273 | mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC2_ADDR(pipe), | 273 | mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC2_ADDR(pipe), |
274 | msm_framebuffer_iova(fb, mdp5_kms->id, 2)); | 274 | msm_framebuffer_iova(fb, mdp5_kms->id, 2)); |
275 | mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC3_ADDR(pipe), | 275 | mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC3_ADDR(pipe), |
276 | msm_framebuffer_iova(fb, mdp5_kms->id, 4)); | 276 | msm_framebuffer_iova(fb, mdp5_kms->id, 3)); |
277 | 277 | ||
278 | plane->fb = fb; | 278 | plane->fb = fb; |
279 | } | 279 | } |
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 47f4dd407671..c80a6bee2b18 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c | |||
@@ -21,9 +21,11 @@ | |||
21 | 21 | ||
22 | static void msm_fb_output_poll_changed(struct drm_device *dev) | 22 | static void msm_fb_output_poll_changed(struct drm_device *dev) |
23 | { | 23 | { |
24 | #ifdef CONFIG_DRM_MSM_FBDEV | ||
24 | struct msm_drm_private *priv = dev->dev_private; | 25 | struct msm_drm_private *priv = dev->dev_private; |
25 | if (priv->fbdev) | 26 | if (priv->fbdev) |
26 | drm_fb_helper_hotplug_event(priv->fbdev); | 27 | drm_fb_helper_hotplug_event(priv->fbdev); |
28 | #endif | ||
27 | } | 29 | } |
28 | 30 | ||
29 | static const struct drm_mode_config_funcs mode_config_funcs = { | 31 | static const struct drm_mode_config_funcs mode_config_funcs = { |
@@ -94,7 +96,7 @@ void __iomem *msm_ioremap(struct platform_device *pdev, const char *name, | |||
94 | } | 96 | } |
95 | 97 | ||
96 | if (reglog) | 98 | if (reglog) |
97 | printk(KERN_DEBUG "IO:region %s %08x %08lx\n", dbgname, (u32)ptr, size); | 99 | printk(KERN_DEBUG "IO:region %s %p %08lx\n", dbgname, ptr, size); |
98 | 100 | ||
99 | return ptr; | 101 | return ptr; |
100 | } | 102 | } |
@@ -102,7 +104,7 @@ void __iomem *msm_ioremap(struct platform_device *pdev, const char *name, | |||
102 | void msm_writel(u32 data, void __iomem *addr) | 104 | void msm_writel(u32 data, void __iomem *addr) |
103 | { | 105 | { |
104 | if (reglog) | 106 | if (reglog) |
105 | printk(KERN_DEBUG "IO:W %08x %08x\n", (u32)addr, data); | 107 | printk(KERN_DEBUG "IO:W %p %08x\n", addr, data); |
106 | writel(data, addr); | 108 | writel(data, addr); |
107 | } | 109 | } |
108 | 110 | ||
@@ -110,7 +112,7 @@ u32 msm_readl(const void __iomem *addr) | |||
110 | { | 112 | { |
111 | u32 val = readl(addr); | 113 | u32 val = readl(addr); |
112 | if (reglog) | 114 | if (reglog) |
113 | printk(KERN_ERR "IO:R %08x %08x\n", (u32)addr, val); | 115 | printk(KERN_ERR "IO:R %p %08x\n", addr, val); |
114 | return val; | 116 | return val; |
115 | } | 117 | } |
116 | 118 | ||
@@ -143,8 +145,8 @@ static int msm_unload(struct drm_device *dev) | |||
143 | if (gpu) { | 145 | if (gpu) { |
144 | mutex_lock(&dev->struct_mutex); | 146 | mutex_lock(&dev->struct_mutex); |
145 | gpu->funcs->pm_suspend(gpu); | 147 | gpu->funcs->pm_suspend(gpu); |
146 | gpu->funcs->destroy(gpu); | ||
147 | mutex_unlock(&dev->struct_mutex); | 148 | mutex_unlock(&dev->struct_mutex); |
149 | gpu->funcs->destroy(gpu); | ||
148 | } | 150 | } |
149 | 151 | ||
150 | if (priv->vram.paddr) { | 152 | if (priv->vram.paddr) { |
@@ -177,7 +179,7 @@ static int get_mdp_ver(struct platform_device *pdev) | |||
177 | const struct of_device_id *match; | 179 | const struct of_device_id *match; |
178 | match = of_match_node(match_types, dev->of_node); | 180 | match = of_match_node(match_types, dev->of_node); |
179 | if (match) | 181 | if (match) |
180 | return (int)match->data; | 182 | return (int)(unsigned long)match->data; |
181 | #endif | 183 | #endif |
182 | return 4; | 184 | return 4; |
183 | } | 185 | } |
@@ -216,7 +218,7 @@ static int msm_init_vram(struct drm_device *dev) | |||
216 | if (ret) | 218 | if (ret) |
217 | return ret; | 219 | return ret; |
218 | size = r.end - r.start; | 220 | size = r.end - r.start; |
219 | DRM_INFO("using VRAM carveout: %lx@%08x\n", size, r.start); | 221 | DRM_INFO("using VRAM carveout: %lx@%pa\n", size, &r.start); |
220 | } else | 222 | } else |
221 | #endif | 223 | #endif |
222 | 224 | ||
@@ -283,10 +285,6 @@ static int msm_load(struct drm_device *dev, unsigned long flags) | |||
283 | 285 | ||
284 | drm_mode_config_init(dev); | 286 | drm_mode_config_init(dev); |
285 | 287 | ||
286 | ret = msm_init_vram(dev); | ||
287 | if (ret) | ||
288 | goto fail; | ||
289 | |||
290 | platform_set_drvdata(pdev, dev); | 288 | platform_set_drvdata(pdev, dev); |
291 | 289 | ||
292 | /* Bind all our sub-components: */ | 290 | /* Bind all our sub-components: */ |
@@ -294,6 +292,10 @@ static int msm_load(struct drm_device *dev, unsigned long flags) | |||
294 | if (ret) | 292 | if (ret) |
295 | return ret; | 293 | return ret; |
296 | 294 | ||
295 | ret = msm_init_vram(dev); | ||
296 | if (ret) | ||
297 | goto fail; | ||
298 | |||
297 | switch (get_mdp_ver(pdev)) { | 299 | switch (get_mdp_ver(pdev)) { |
298 | case 4: | 300 | case 4: |
299 | kms = mdp4_kms_init(dev); | 301 | kms = mdp4_kms_init(dev); |
@@ -419,9 +421,11 @@ static void msm_preclose(struct drm_device *dev, struct drm_file *file) | |||
419 | 421 | ||
420 | static void msm_lastclose(struct drm_device *dev) | 422 | static void msm_lastclose(struct drm_device *dev) |
421 | { | 423 | { |
424 | #ifdef CONFIG_DRM_MSM_FBDEV | ||
422 | struct msm_drm_private *priv = dev->dev_private; | 425 | struct msm_drm_private *priv = dev->dev_private; |
423 | if (priv->fbdev) | 426 | if (priv->fbdev) |
424 | drm_fb_helper_restore_fbdev_mode_unlocked(priv->fbdev); | 427 | drm_fb_helper_restore_fbdev_mode_unlocked(priv->fbdev); |
428 | #endif | ||
425 | } | 429 | } |
426 | 430 | ||
427 | static irqreturn_t msm_irq(int irq, void *arg) | 431 | static irqreturn_t msm_irq(int irq, void *arg) |
diff --git a/drivers/gpu/drm/msm/msm_fb.c b/drivers/gpu/drm/msm/msm_fb.c index 6b573e612f27..121713281417 100644 --- a/drivers/gpu/drm/msm/msm_fb.c +++ b/drivers/gpu/drm/msm/msm_fb.c | |||
@@ -172,8 +172,8 @@ struct drm_framebuffer *msm_framebuffer_init(struct drm_device *dev, | |||
172 | { | 172 | { |
173 | struct msm_drm_private *priv = dev->dev_private; | 173 | struct msm_drm_private *priv = dev->dev_private; |
174 | struct msm_kms *kms = priv->kms; | 174 | struct msm_kms *kms = priv->kms; |
175 | struct msm_framebuffer *msm_fb; | 175 | struct msm_framebuffer *msm_fb = NULL; |
176 | struct drm_framebuffer *fb = NULL; | 176 | struct drm_framebuffer *fb; |
177 | const struct msm_format *format; | 177 | const struct msm_format *format; |
178 | int ret, i, n; | 178 | int ret, i, n; |
179 | unsigned int hsub, vsub; | 179 | unsigned int hsub, vsub; |
@@ -239,8 +239,7 @@ struct drm_framebuffer *msm_framebuffer_init(struct drm_device *dev, | |||
239 | return fb; | 239 | return fb; |
240 | 240 | ||
241 | fail: | 241 | fail: |
242 | if (fb) | 242 | kfree(msm_fb); |
243 | msm_framebuffer_destroy(fb); | ||
244 | 243 | ||
245 | return ERR_PTR(ret); | 244 | return ERR_PTR(ret); |
246 | } | 245 | } |
diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c index 479d8af72bcb..52839769eb6c 100644 --- a/drivers/gpu/drm/msm/msm_gem.c +++ b/drivers/gpu/drm/msm/msm_gem.c | |||
@@ -483,7 +483,7 @@ void msm_gem_describe(struct drm_gem_object *obj, struct seq_file *m) | |||
483 | uint64_t off = drm_vma_node_start(&obj->vma_node); | 483 | uint64_t off = drm_vma_node_start(&obj->vma_node); |
484 | 484 | ||
485 | WARN_ON(!mutex_is_locked(&dev->struct_mutex)); | 485 | WARN_ON(!mutex_is_locked(&dev->struct_mutex)); |
486 | seq_printf(m, "%08x: %c(r=%u,w=%u) %2d (%2d) %08llx %p %d\n", | 486 | seq_printf(m, "%08x: %c(r=%u,w=%u) %2d (%2d) %08llx %p %zu\n", |
487 | msm_obj->flags, is_active(msm_obj) ? 'A' : 'I', | 487 | msm_obj->flags, is_active(msm_obj) ? 'A' : 'I', |
488 | msm_obj->read_fence, msm_obj->write_fence, | 488 | msm_obj->read_fence, msm_obj->write_fence, |
489 | obj->name, obj->refcount.refcount.counter, | 489 | obj->name, obj->refcount.refcount.counter, |
diff --git a/drivers/gpu/drm/msm/msm_iommu.c b/drivers/gpu/drm/msm/msm_iommu.c index 7acdaa5688b7..7ac2f1997e4a 100644 --- a/drivers/gpu/drm/msm/msm_iommu.c +++ b/drivers/gpu/drm/msm/msm_iommu.c | |||
@@ -60,7 +60,7 @@ static int msm_iommu_map(struct msm_mmu *mmu, uint32_t iova, | |||
60 | u32 pa = sg_phys(sg) - sg->offset; | 60 | u32 pa = sg_phys(sg) - sg->offset; |
61 | size_t bytes = sg->length + sg->offset; | 61 | size_t bytes = sg->length + sg->offset; |
62 | 62 | ||
63 | VERB("map[%d]: %08x %08x(%x)", i, iova, pa, bytes); | 63 | VERB("map[%d]: %08x %08x(%zx)", i, iova, pa, bytes); |
64 | 64 | ||
65 | ret = iommu_map(domain, da, pa, bytes, prot); | 65 | ret = iommu_map(domain, da, pa, bytes, prot); |
66 | if (ret) | 66 | if (ret) |
@@ -99,7 +99,7 @@ static int msm_iommu_unmap(struct msm_mmu *mmu, uint32_t iova, | |||
99 | if (unmapped < bytes) | 99 | if (unmapped < bytes) |
100 | return unmapped; | 100 | return unmapped; |
101 | 101 | ||
102 | VERB("unmap[%d]: %08x(%x)", i, iova, bytes); | 102 | VERB("unmap[%d]: %08x(%zx)", i, iova, bytes); |
103 | 103 | ||
104 | BUG_ON(!PAGE_ALIGNED(bytes)); | 104 | BUG_ON(!PAGE_ALIGNED(bytes)); |
105 | 105 | ||
diff --git a/drivers/gpu/drm/msm/msm_ringbuffer.c b/drivers/gpu/drm/msm/msm_ringbuffer.c index 8171537dd7d1..1f14b908b221 100644 --- a/drivers/gpu/drm/msm/msm_ringbuffer.c +++ b/drivers/gpu/drm/msm/msm_ringbuffer.c | |||
@@ -56,6 +56,6 @@ fail: | |||
56 | void msm_ringbuffer_destroy(struct msm_ringbuffer *ring) | 56 | void msm_ringbuffer_destroy(struct msm_ringbuffer *ring) |
57 | { | 57 | { |
58 | if (ring->bo) | 58 | if (ring->bo) |
59 | drm_gem_object_unreference(ring->bo); | 59 | drm_gem_object_unreference_unlocked(ring->bo); |
60 | kfree(ring); | 60 | kfree(ring); |
61 | } | 61 | } |
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/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c index ed173d30f1c0..f81e0d7d0232 100644 --- a/drivers/gpu/drm/radeon/atombios_dp.c +++ b/drivers/gpu/drm/radeon/atombios_dp.c | |||
@@ -421,19 +421,21 @@ bool radeon_dp_getdpcd(struct radeon_connector *radeon_connector) | |||
421 | { | 421 | { |
422 | struct radeon_connector_atom_dig *dig_connector = radeon_connector->con_priv; | 422 | struct radeon_connector_atom_dig *dig_connector = radeon_connector->con_priv; |
423 | u8 msg[DP_DPCD_SIZE]; | 423 | u8 msg[DP_DPCD_SIZE]; |
424 | int ret; | 424 | int ret, i; |
425 | 425 | ||
426 | ret = drm_dp_dpcd_read(&radeon_connector->ddc_bus->aux, DP_DPCD_REV, msg, | 426 | for (i = 0; i < 7; i++) { |
427 | DP_DPCD_SIZE); | 427 | ret = drm_dp_dpcd_read(&radeon_connector->ddc_bus->aux, DP_DPCD_REV, msg, |
428 | if (ret > 0) { | 428 | DP_DPCD_SIZE); |
429 | memcpy(dig_connector->dpcd, msg, DP_DPCD_SIZE); | 429 | if (ret == DP_DPCD_SIZE) { |
430 | memcpy(dig_connector->dpcd, msg, DP_DPCD_SIZE); | ||
430 | 431 | ||
431 | DRM_DEBUG_KMS("DPCD: %*ph\n", (int)sizeof(dig_connector->dpcd), | 432 | DRM_DEBUG_KMS("DPCD: %*ph\n", (int)sizeof(dig_connector->dpcd), |
432 | dig_connector->dpcd); | 433 | dig_connector->dpcd); |
433 | 434 | ||
434 | radeon_dp_probe_oui(radeon_connector); | 435 | radeon_dp_probe_oui(radeon_connector); |
435 | 436 | ||
436 | return true; | 437 | return true; |
438 | } | ||
437 | } | 439 | } |
438 | dig_connector->dpcd[0] = 0; | 440 | dig_connector->dpcd[0] = 0; |
439 | return false; | 441 | return false; |
diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c index d3a22f212948..b0688b0c8908 100644 --- a/drivers/gpu/drm/radeon/cik.c +++ b/drivers/gpu/drm/radeon/cik.c | |||
@@ -5847,7 +5847,7 @@ static int cik_pcie_gart_enable(struct radeon_device *rdev) | |||
5847 | L2_CACHE_BIGK_FRAGMENT_SIZE(4)); | 5847 | L2_CACHE_BIGK_FRAGMENT_SIZE(4)); |
5848 | /* setup context0 */ | 5848 | /* setup context0 */ |
5849 | WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR, rdev->mc.gtt_start >> 12); | 5849 | WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR, rdev->mc.gtt_start >> 12); |
5850 | WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR, (rdev->mc.gtt_end >> 12) - 1); | 5850 | WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR, rdev->mc.gtt_end >> 12); |
5851 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR, rdev->gart.table_addr >> 12); | 5851 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR, rdev->gart.table_addr >> 12); |
5852 | WREG32(VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR, | 5852 | WREG32(VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR, |
5853 | (u32)(rdev->dummy_page.addr >> 12)); | 5853 | (u32)(rdev->dummy_page.addr >> 12)); |
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index 5397bed26b86..3a6d483a2c36 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -2554,7 +2554,7 @@ static int evergreen_pcie_gart_enable(struct radeon_device *rdev) | |||
2554 | WREG32(MC_VM_MB_L1_TLB2_CNTL, tmp); | 2554 | WREG32(MC_VM_MB_L1_TLB2_CNTL, tmp); |
2555 | WREG32(MC_VM_MB_L1_TLB3_CNTL, tmp); | 2555 | WREG32(MC_VM_MB_L1_TLB3_CNTL, tmp); |
2556 | WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR, rdev->mc.gtt_start >> 12); | 2556 | WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR, rdev->mc.gtt_start >> 12); |
2557 | WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR, (rdev->mc.gtt_end >> 12) - 1); | 2557 | WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR, rdev->mc.gtt_end >> 12); |
2558 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR, rdev->gart.table_addr >> 12); | 2558 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR, rdev->gart.table_addr >> 12); |
2559 | WREG32(VM_CONTEXT0_CNTL, ENABLE_CONTEXT | PAGE_TABLE_DEPTH(0) | | 2559 | WREG32(VM_CONTEXT0_CNTL, ENABLE_CONTEXT | PAGE_TABLE_DEPTH(0) | |
2560 | RANGE_PROTECTION_FAULT_ENABLE_DEFAULT); | 2560 | 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 75977d7e177e..8e5aeeb058a5 100644 --- a/drivers/gpu/drm/radeon/ni.c +++ b/drivers/gpu/drm/radeon/ni.c | |||
@@ -1307,7 +1307,7 @@ static int cayman_pcie_gart_enable(struct radeon_device *rdev) | |||
1307 | L2_CACHE_BIGK_FRAGMENT_SIZE(6)); | 1307 | L2_CACHE_BIGK_FRAGMENT_SIZE(6)); |
1308 | /* setup context0 */ | 1308 | /* setup context0 */ |
1309 | WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR, rdev->mc.gtt_start >> 12); | 1309 | WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR, rdev->mc.gtt_start >> 12); |
1310 | WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR, (rdev->mc.gtt_end >> 12) - 1); | 1310 | WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR, rdev->mc.gtt_end >> 12); |
1311 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR, rdev->gart.table_addr >> 12); | 1311 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR, rdev->gart.table_addr >> 12); |
1312 | WREG32(VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR, | 1312 | WREG32(VM_CONTEXT0_PROTECTION_FAULT_DEFAULT_ADDR, |
1313 | (u32)(rdev->dummy_page.addr >> 12)); | 1313 | (u32)(rdev->dummy_page.addr >> 12)); |
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index d0ff93256bb0..35dafd77a639 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
@@ -1159,7 +1159,7 @@ static int r600_pcie_gart_enable(struct radeon_device *rdev) | |||
1159 | WREG32(MC_VM_L1_TLB_MCB_RD_SEM_CNTL, tmp | ENABLE_SEMAPHORE_MODE); | 1159 | WREG32(MC_VM_L1_TLB_MCB_RD_SEM_CNTL, tmp | ENABLE_SEMAPHORE_MODE); |
1160 | WREG32(MC_VM_L1_TLB_MCB_WR_SEM_CNTL, tmp | ENABLE_SEMAPHORE_MODE); | 1160 | WREG32(MC_VM_L1_TLB_MCB_WR_SEM_CNTL, tmp | ENABLE_SEMAPHORE_MODE); |
1161 | WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR, rdev->mc.gtt_start >> 12); | 1161 | WREG32(VM_CONTEXT0_PAGE_TABLE_START_ADDR, rdev->mc.gtt_start >> 12); |
1162 | WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR, (rdev->mc.gtt_end >> 12) - 1); | 1162 | WREG32(VM_CONTEXT0_PAGE_TABLE_END_ADDR, rdev->mc.gtt_end >> 12); |
1163 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR, rdev->gart.table_addr >> 12); | 1163 | WREG32(VM_CONTEXT0_PAGE_TABLE_BASE_ADDR, rdev->gart.table_addr >> 12); |
1164 | WREG32(VM_CONTEXT0_CNTL, ENABLE_CONTEXT | PAGE_TABLE_DEPTH(0) | | 1164 | WREG32(VM_CONTEXT0_CNTL, ENABLE_CONTEXT | PAGE_TABLE_DEPTH(0) | |
1165 | RANGE_PROTECTION_FAULT_ENABLE_DEFAULT); | 1165 | RANGE_PROTECTION_FAULT_ENABLE_DEFAULT); |
diff --git a/drivers/gpu/drm/radeon/radeon_audio.c b/drivers/gpu/drm/radeon/radeon_audio.c index abbc154b1bff..c89215275053 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/radeon_dp_auxch.c b/drivers/gpu/drm/radeon/radeon_dp_auxch.c index bf1fecc6cceb..fcbd60bb0349 100644 --- a/drivers/gpu/drm/radeon/radeon_dp_auxch.c +++ b/drivers/gpu/drm/radeon/radeon_dp_auxch.c | |||
@@ -30,8 +30,6 @@ | |||
30 | AUX_SW_RX_HPD_DISCON | \ | 30 | AUX_SW_RX_HPD_DISCON | \ |
31 | AUX_SW_RX_PARTIAL_BYTE | \ | 31 | AUX_SW_RX_PARTIAL_BYTE | \ |
32 | AUX_SW_NON_AUX_MODE | \ | 32 | AUX_SW_NON_AUX_MODE | \ |
33 | AUX_SW_RX_MIN_COUNT_VIOL | \ | ||
34 | AUX_SW_RX_INVALID_STOP | \ | ||
35 | AUX_SW_RX_SYNC_INVALID_L | \ | 33 | AUX_SW_RX_SYNC_INVALID_L | \ |
36 | AUX_SW_RX_SYNC_INVALID_H | \ | 34 | AUX_SW_RX_SYNC_INVALID_H | \ |
37 | AUX_SW_RX_INVALID_START | \ | 35 | AUX_SW_RX_INVALID_START | \ |
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 34c3739c87cf..26388b5dd6ed 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/hid/hid-ids.h b/drivers/hid/hid-ids.h index 41f167e4d75f..7ce93d927f62 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
@@ -164,6 +164,7 @@ | |||
164 | #define USB_DEVICE_ID_ATEN_2PORTKVM 0x2204 | 164 | #define USB_DEVICE_ID_ATEN_2PORTKVM 0x2204 |
165 | #define USB_DEVICE_ID_ATEN_4PORTKVM 0x2205 | 165 | #define USB_DEVICE_ID_ATEN_4PORTKVM 0x2205 |
166 | #define USB_DEVICE_ID_ATEN_4PORTKVMC 0x2208 | 166 | #define USB_DEVICE_ID_ATEN_4PORTKVMC 0x2208 |
167 | #define USB_DEVICE_ID_ATEN_CS682 0x2213 | ||
167 | 168 | ||
168 | #define USB_VENDOR_ID_ATMEL 0x03eb | 169 | #define USB_VENDOR_ID_ATMEL 0x03eb |
169 | #define USB_DEVICE_ID_ATMEL_MULTITOUCH 0x211c | 170 | #define USB_DEVICE_ID_ATMEL_MULTITOUCH 0x211c |
diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c index b3cf6fd4be96..5fd530acf747 100644 --- a/drivers/hid/hid-logitech-hidpp.c +++ b/drivers/hid/hid-logitech-hidpp.c | |||
@@ -44,7 +44,6 @@ MODULE_PARM_DESC(disable_raw_mode, | |||
44 | /* bits 1..20 are reserved for classes */ | 44 | /* bits 1..20 are reserved for classes */ |
45 | #define HIDPP_QUIRK_DELAYED_INIT BIT(21) | 45 | #define HIDPP_QUIRK_DELAYED_INIT BIT(21) |
46 | #define HIDPP_QUIRK_WTP_PHYSICAL_BUTTONS BIT(22) | 46 | #define HIDPP_QUIRK_WTP_PHYSICAL_BUTTONS BIT(22) |
47 | #define HIDPP_QUIRK_MULTI_INPUT BIT(23) | ||
48 | 47 | ||
49 | /* | 48 | /* |
50 | * There are two hidpp protocols in use, the first version hidpp10 is known | 49 | * There are two hidpp protocols in use, the first version hidpp10 is known |
@@ -706,12 +705,6 @@ static int wtp_input_mapping(struct hid_device *hdev, struct hid_input *hi, | |||
706 | struct hid_field *field, struct hid_usage *usage, | 705 | struct hid_field *field, struct hid_usage *usage, |
707 | unsigned long **bit, int *max) | 706 | unsigned long **bit, int *max) |
708 | { | 707 | { |
709 | struct hidpp_device *hidpp = hid_get_drvdata(hdev); | ||
710 | |||
711 | if ((hidpp->quirks & HIDPP_QUIRK_MULTI_INPUT) && | ||
712 | (field->application == HID_GD_KEYBOARD)) | ||
713 | return 0; | ||
714 | |||
715 | return -1; | 708 | return -1; |
716 | } | 709 | } |
717 | 710 | ||
@@ -720,10 +713,6 @@ static void wtp_populate_input(struct hidpp_device *hidpp, | |||
720 | { | 713 | { |
721 | struct wtp_data *wd = hidpp->private_data; | 714 | struct wtp_data *wd = hidpp->private_data; |
722 | 715 | ||
723 | if ((hidpp->quirks & HIDPP_QUIRK_MULTI_INPUT) && origin_is_hid_core) | ||
724 | /* this is the generic hid-input call */ | ||
725 | return; | ||
726 | |||
727 | __set_bit(EV_ABS, input_dev->evbit); | 716 | __set_bit(EV_ABS, input_dev->evbit); |
728 | __set_bit(EV_KEY, input_dev->evbit); | 717 | __set_bit(EV_KEY, input_dev->evbit); |
729 | __clear_bit(EV_REL, input_dev->evbit); | 718 | __clear_bit(EV_REL, input_dev->evbit); |
@@ -1245,10 +1234,6 @@ static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
1245 | if (hidpp->quirks & HIDPP_QUIRK_DELAYED_INIT) | 1234 | if (hidpp->quirks & HIDPP_QUIRK_DELAYED_INIT) |
1246 | connect_mask &= ~HID_CONNECT_HIDINPUT; | 1235 | connect_mask &= ~HID_CONNECT_HIDINPUT; |
1247 | 1236 | ||
1248 | /* Re-enable hidinput for multi-input devices */ | ||
1249 | if (hidpp->quirks & HIDPP_QUIRK_MULTI_INPUT) | ||
1250 | connect_mask |= HID_CONNECT_HIDINPUT; | ||
1251 | |||
1252 | ret = hid_hw_start(hdev, connect_mask); | 1237 | ret = hid_hw_start(hdev, connect_mask); |
1253 | if (ret) { | 1238 | if (ret) { |
1254 | hid_err(hdev, "%s:hid_hw_start returned error\n", __func__); | 1239 | hid_err(hdev, "%s:hid_hw_start returned error\n", __func__); |
@@ -1296,11 +1281,6 @@ static const struct hid_device_id hidpp_devices[] = { | |||
1296 | HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, | 1281 | HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, |
1297 | USB_DEVICE_ID_LOGITECH_T651), | 1282 | USB_DEVICE_ID_LOGITECH_T651), |
1298 | .driver_data = HIDPP_QUIRK_CLASS_WTP }, | 1283 | .driver_data = HIDPP_QUIRK_CLASS_WTP }, |
1299 | { /* Keyboard TK820 */ | ||
1300 | HID_DEVICE(BUS_USB, HID_GROUP_LOGITECH_DJ_DEVICE, | ||
1301 | USB_VENDOR_ID_LOGITECH, 0x4102), | ||
1302 | .driver_data = HIDPP_QUIRK_DELAYED_INIT | HIDPP_QUIRK_MULTI_INPUT | | ||
1303 | HIDPP_QUIRK_CLASS_WTP }, | ||
1304 | 1284 | ||
1305 | { HID_DEVICE(BUS_USB, HID_GROUP_LOGITECH_DJ_DEVICE, | 1285 | { HID_DEVICE(BUS_USB, HID_GROUP_LOGITECH_DJ_DEVICE, |
1306 | USB_VENDOR_ID_LOGITECH, HID_ANY_ID)}, | 1286 | USB_VENDOR_ID_LOGITECH, HID_ANY_ID)}, |
diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c index c3f6f1e311ea..090a1ba0abb6 100644 --- a/drivers/hid/hid-sensor-hub.c +++ b/drivers/hid/hid-sensor-hub.c | |||
@@ -294,7 +294,7 @@ int sensor_hub_input_attr_get_raw_value(struct hid_sensor_hub_device *hsdev, | |||
294 | if (!report) | 294 | if (!report) |
295 | return -EINVAL; | 295 | return -EINVAL; |
296 | 296 | ||
297 | mutex_lock(&hsdev->mutex); | 297 | mutex_lock(hsdev->mutex_ptr); |
298 | if (flag == SENSOR_HUB_SYNC) { | 298 | if (flag == SENSOR_HUB_SYNC) { |
299 | memset(&hsdev->pending, 0, sizeof(hsdev->pending)); | 299 | memset(&hsdev->pending, 0, sizeof(hsdev->pending)); |
300 | init_completion(&hsdev->pending.ready); | 300 | init_completion(&hsdev->pending.ready); |
@@ -328,7 +328,7 @@ int sensor_hub_input_attr_get_raw_value(struct hid_sensor_hub_device *hsdev, | |||
328 | kfree(hsdev->pending.raw_data); | 328 | kfree(hsdev->pending.raw_data); |
329 | hsdev->pending.status = false; | 329 | hsdev->pending.status = false; |
330 | } | 330 | } |
331 | mutex_unlock(&hsdev->mutex); | 331 | mutex_unlock(hsdev->mutex_ptr); |
332 | 332 | ||
333 | return ret_val; | 333 | return ret_val; |
334 | } | 334 | } |
@@ -667,7 +667,14 @@ static int sensor_hub_probe(struct hid_device *hdev, | |||
667 | hsdev->vendor_id = hdev->vendor; | 667 | hsdev->vendor_id = hdev->vendor; |
668 | hsdev->product_id = hdev->product; | 668 | hsdev->product_id = hdev->product; |
669 | hsdev->usage = collection->usage; | 669 | hsdev->usage = collection->usage; |
670 | mutex_init(&hsdev->mutex); | 670 | hsdev->mutex_ptr = devm_kzalloc(&hdev->dev, |
671 | sizeof(struct mutex), | ||
672 | GFP_KERNEL); | ||
673 | if (!hsdev->mutex_ptr) { | ||
674 | ret = -ENOMEM; | ||
675 | goto err_stop_hw; | ||
676 | } | ||
677 | mutex_init(hsdev->mutex_ptr); | ||
671 | hsdev->start_collection_index = i; | 678 | hsdev->start_collection_index = i; |
672 | if (last_hsdev) | 679 | if (last_hsdev) |
673 | last_hsdev->end_collection_index = i; | 680 | last_hsdev->end_collection_index = i; |
diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c index ab4dd952b6ba..92d6cdf02460 100644 --- a/drivers/hid/i2c-hid/i2c-hid.c +++ b/drivers/hid/i2c-hid/i2c-hid.c | |||
@@ -862,6 +862,7 @@ static int i2c_hid_acpi_pdata(struct i2c_client *client, | |||
862 | union acpi_object *obj; | 862 | union acpi_object *obj; |
863 | struct acpi_device *adev; | 863 | struct acpi_device *adev; |
864 | acpi_handle handle; | 864 | acpi_handle handle; |
865 | int ret; | ||
865 | 866 | ||
866 | handle = ACPI_HANDLE(&client->dev); | 867 | handle = ACPI_HANDLE(&client->dev); |
867 | if (!handle || acpi_bus_get_device(handle, &adev)) | 868 | if (!handle || acpi_bus_get_device(handle, &adev)) |
@@ -877,7 +878,9 @@ static int i2c_hid_acpi_pdata(struct i2c_client *client, | |||
877 | pdata->hid_descriptor_address = obj->integer.value; | 878 | pdata->hid_descriptor_address = obj->integer.value; |
878 | ACPI_FREE(obj); | 879 | ACPI_FREE(obj); |
879 | 880 | ||
880 | return acpi_dev_add_driver_gpios(adev, i2c_hid_acpi_gpios); | 881 | /* GPIOs are optional */ |
882 | ret = acpi_dev_add_driver_gpios(adev, i2c_hid_acpi_gpios); | ||
883 | return ret < 0 && ret != -ENXIO ? ret : 0; | ||
881 | } | 884 | } |
882 | 885 | ||
883 | static const struct acpi_device_id i2c_hid_acpi_match[] = { | 886 | static const struct acpi_device_id i2c_hid_acpi_match[] = { |
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index a775143e6265..4696895eb708 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c | |||
@@ -61,6 +61,7 @@ static const struct hid_blacklist { | |||
61 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_2PORTKVM, HID_QUIRK_NOGET }, | 61 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_2PORTKVM, HID_QUIRK_NOGET }, |
62 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVM, HID_QUIRK_NOGET }, | 62 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVM, HID_QUIRK_NOGET }, |
63 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVMC, HID_QUIRK_NOGET }, | 63 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVMC, HID_QUIRK_NOGET }, |
64 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_CS682, HID_QUIRK_NOGET }, | ||
64 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_FIGHTERSTICK, HID_QUIRK_NOGET }, | 65 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_FIGHTERSTICK, HID_QUIRK_NOGET }, |
65 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_COMBATSTICK, HID_QUIRK_NOGET }, | 66 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_COMBATSTICK, HID_QUIRK_NOGET }, |
66 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_FLIGHT_SIM_ECLIPSE_YOKE, HID_QUIRK_NOGET }, | 67 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_FLIGHT_SIM_ECLIPSE_YOKE, HID_QUIRK_NOGET }, |
diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index fa54d3290659..adf959dcfa5d 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c | |||
@@ -1072,6 +1072,9 @@ static int wacom_wac_finger_count_touches(struct wacom_wac *wacom) | |||
1072 | int count = 0; | 1072 | int count = 0; |
1073 | int i; | 1073 | int i; |
1074 | 1074 | ||
1075 | if (!touch_max) | ||
1076 | return 0; | ||
1077 | |||
1075 | /* non-HID_GENERIC single touch input doesn't call this routine */ | 1078 | /* non-HID_GENERIC single touch input doesn't call this routine */ |
1076 | if ((touch_max == 1) && (wacom->features.type == HID_GENERIC)) | 1079 | if ((touch_max == 1) && (wacom->features.type == HID_GENERIC)) |
1077 | return wacom->hid_data.tipswitch && | 1080 | return wacom->hid_data.tipswitch && |
diff --git a/drivers/hwmon/nct6683.c b/drivers/hwmon/nct6683.c index f3830db02d46..37f01702d081 100644 --- a/drivers/hwmon/nct6683.c +++ b/drivers/hwmon/nct6683.c | |||
@@ -439,6 +439,7 @@ nct6683_create_attr_group(struct device *dev, struct sensor_template_group *tg, | |||
439 | (*t)->dev_attr.attr.name, tg->base + i); | 439 | (*t)->dev_attr.attr.name, tg->base + i); |
440 | if ((*t)->s2) { | 440 | if ((*t)->s2) { |
441 | a2 = &su->u.a2; | 441 | a2 = &su->u.a2; |
442 | sysfs_attr_init(&a2->dev_attr.attr); | ||
442 | a2->dev_attr.attr.name = su->name; | 443 | a2->dev_attr.attr.name = su->name; |
443 | a2->nr = (*t)->u.s.nr + i; | 444 | a2->nr = (*t)->u.s.nr + i; |
444 | a2->index = (*t)->u.s.index; | 445 | a2->index = (*t)->u.s.index; |
@@ -449,6 +450,7 @@ nct6683_create_attr_group(struct device *dev, struct sensor_template_group *tg, | |||
449 | *attrs = &a2->dev_attr.attr; | 450 | *attrs = &a2->dev_attr.attr; |
450 | } else { | 451 | } else { |
451 | a = &su->u.a1; | 452 | a = &su->u.a1; |
453 | sysfs_attr_init(&a->dev_attr.attr); | ||
452 | a->dev_attr.attr.name = su->name; | 454 | a->dev_attr.attr.name = su->name; |
453 | a->index = (*t)->u.index + i; | 455 | a->index = (*t)->u.index + i; |
454 | a->dev_attr.attr.mode = | 456 | a->dev_attr.attr.mode = |
diff --git a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c index 4fcb48103299..bd1c99deac71 100644 --- a/drivers/hwmon/nct6775.c +++ b/drivers/hwmon/nct6775.c | |||
@@ -995,6 +995,7 @@ nct6775_create_attr_group(struct device *dev, struct sensor_template_group *tg, | |||
995 | (*t)->dev_attr.attr.name, tg->base + i); | 995 | (*t)->dev_attr.attr.name, tg->base + i); |
996 | if ((*t)->s2) { | 996 | if ((*t)->s2) { |
997 | a2 = &su->u.a2; | 997 | a2 = &su->u.a2; |
998 | sysfs_attr_init(&a2->dev_attr.attr); | ||
998 | a2->dev_attr.attr.name = su->name; | 999 | a2->dev_attr.attr.name = su->name; |
999 | a2->nr = (*t)->u.s.nr + i; | 1000 | a2->nr = (*t)->u.s.nr + i; |
1000 | a2->index = (*t)->u.s.index; | 1001 | a2->index = (*t)->u.s.index; |
@@ -1005,6 +1006,7 @@ nct6775_create_attr_group(struct device *dev, struct sensor_template_group *tg, | |||
1005 | *attrs = &a2->dev_attr.attr; | 1006 | *attrs = &a2->dev_attr.attr; |
1006 | } else { | 1007 | } else { |
1007 | a = &su->u.a1; | 1008 | a = &su->u.a1; |
1009 | sysfs_attr_init(&a->dev_attr.attr); | ||
1008 | a->dev_attr.attr.name = su->name; | 1010 | a->dev_attr.attr.name = su->name; |
1009 | a->index = (*t)->u.index + i; | 1011 | a->index = (*t)->u.index + i; |
1010 | a->dev_attr.attr.mode = | 1012 | a->dev_attr.attr.mode = |
diff --git a/drivers/hwmon/ntc_thermistor.c b/drivers/hwmon/ntc_thermistor.c index 112e4d45e4a0..68800115876b 100644 --- a/drivers/hwmon/ntc_thermistor.c +++ b/drivers/hwmon/ntc_thermistor.c | |||
@@ -239,8 +239,10 @@ static struct ntc_thermistor_platform_data * | |||
239 | ntc_thermistor_parse_dt(struct platform_device *pdev) | 239 | ntc_thermistor_parse_dt(struct platform_device *pdev) |
240 | { | 240 | { |
241 | struct iio_channel *chan; | 241 | struct iio_channel *chan; |
242 | enum iio_chan_type type; | ||
242 | struct device_node *np = pdev->dev.of_node; | 243 | struct device_node *np = pdev->dev.of_node; |
243 | struct ntc_thermistor_platform_data *pdata; | 244 | struct ntc_thermistor_platform_data *pdata; |
245 | int ret; | ||
244 | 246 | ||
245 | if (!np) | 247 | if (!np) |
246 | return NULL; | 248 | return NULL; |
@@ -253,6 +255,13 @@ ntc_thermistor_parse_dt(struct platform_device *pdev) | |||
253 | if (IS_ERR(chan)) | 255 | if (IS_ERR(chan)) |
254 | return ERR_CAST(chan); | 256 | return ERR_CAST(chan); |
255 | 257 | ||
258 | ret = iio_get_channel_type(chan, &type); | ||
259 | if (ret < 0) | ||
260 | return ERR_PTR(ret); | ||
261 | |||
262 | if (type != IIO_VOLTAGE) | ||
263 | return ERR_PTR(-EINVAL); | ||
264 | |||
256 | if (of_property_read_u32(np, "pullup-uv", &pdata->pullup_uv)) | 265 | if (of_property_read_u32(np, "pullup-uv", &pdata->pullup_uv)) |
257 | return ERR_PTR(-ENODEV); | 266 | return ERR_PTR(-ENODEV); |
258 | if (of_property_read_u32(np, "pullup-ohm", &pdata->pullup_ohm)) | 267 | if (of_property_read_u32(np, "pullup-ohm", &pdata->pullup_ohm)) |
diff --git a/drivers/hwmon/tmp401.c b/drivers/hwmon/tmp401.c index 99664ebc738d..ccf4cffe0ee1 100644 --- a/drivers/hwmon/tmp401.c +++ b/drivers/hwmon/tmp401.c | |||
@@ -44,7 +44,7 @@ | |||
44 | #include <linux/sysfs.h> | 44 | #include <linux/sysfs.h> |
45 | 45 | ||
46 | /* Addresses to scan */ | 46 | /* Addresses to scan */ |
47 | static const unsigned short normal_i2c[] = { 0x37, 0x48, 0x49, 0x4a, 0x4c, 0x4d, | 47 | static const unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4c, 0x4d, |
48 | 0x4e, 0x4f, I2C_CLIENT_END }; | 48 | 0x4e, 0x4f, I2C_CLIENT_END }; |
49 | 49 | ||
50 | enum chips { tmp401, tmp411, tmp431, tmp432, tmp435 }; | 50 | enum chips { tmp401, tmp411, tmp431, tmp432, tmp435 }; |
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c index 0c1419105ff0..0271608a51c4 100644 --- a/drivers/infiniband/core/cm.c +++ b/drivers/infiniband/core/cm.c | |||
@@ -861,6 +861,7 @@ retest: | |||
861 | cm_reject_sidr_req(cm_id_priv, IB_SIDR_REJECT); | 861 | cm_reject_sidr_req(cm_id_priv, IB_SIDR_REJECT); |
862 | break; | 862 | break; |
863 | case IB_CM_REQ_SENT: | 863 | case IB_CM_REQ_SENT: |
864 | case IB_CM_MRA_REQ_RCVD: | ||
864 | ib_cancel_mad(cm_id_priv->av.port->mad_agent, cm_id_priv->msg); | 865 | ib_cancel_mad(cm_id_priv->av.port->mad_agent, cm_id_priv->msg); |
865 | spin_unlock_irq(&cm_id_priv->lock); | 866 | spin_unlock_irq(&cm_id_priv->lock); |
866 | ib_send_cm_rej(cm_id, IB_CM_REJ_TIMEOUT, | 867 | ib_send_cm_rej(cm_id, IB_CM_REJ_TIMEOUT, |
@@ -879,7 +880,6 @@ retest: | |||
879 | NULL, 0, NULL, 0); | 880 | NULL, 0, NULL, 0); |
880 | } | 881 | } |
881 | break; | 882 | break; |
882 | case IB_CM_MRA_REQ_RCVD: | ||
883 | case IB_CM_REP_SENT: | 883 | case IB_CM_REP_SENT: |
884 | case IB_CM_MRA_REP_RCVD: | 884 | case IB_CM_MRA_REP_RCVD: |
885 | ib_cancel_mad(cm_id_priv->av.port->mad_agent, cm_id_priv->msg); | 885 | ib_cancel_mad(cm_id_priv->av.port->mad_agent, cm_id_priv->msg); |
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index 06441a43c3aa..38ffe0981503 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c | |||
@@ -845,18 +845,26 @@ static void cma_save_ib_info(struct rdma_cm_id *id, struct rdma_cm_id *listen_id | |||
845 | listen_ib = (struct sockaddr_ib *) &listen_id->route.addr.src_addr; | 845 | listen_ib = (struct sockaddr_ib *) &listen_id->route.addr.src_addr; |
846 | ib = (struct sockaddr_ib *) &id->route.addr.src_addr; | 846 | ib = (struct sockaddr_ib *) &id->route.addr.src_addr; |
847 | ib->sib_family = listen_ib->sib_family; | 847 | ib->sib_family = listen_ib->sib_family; |
848 | ib->sib_pkey = path->pkey; | 848 | if (path) { |
849 | ib->sib_flowinfo = path->flow_label; | 849 | ib->sib_pkey = path->pkey; |
850 | memcpy(&ib->sib_addr, &path->sgid, 16); | 850 | ib->sib_flowinfo = path->flow_label; |
851 | memcpy(&ib->sib_addr, &path->sgid, 16); | ||
852 | } else { | ||
853 | ib->sib_pkey = listen_ib->sib_pkey; | ||
854 | ib->sib_flowinfo = listen_ib->sib_flowinfo; | ||
855 | ib->sib_addr = listen_ib->sib_addr; | ||
856 | } | ||
851 | ib->sib_sid = listen_ib->sib_sid; | 857 | ib->sib_sid = listen_ib->sib_sid; |
852 | ib->sib_sid_mask = cpu_to_be64(0xffffffffffffffffULL); | 858 | ib->sib_sid_mask = cpu_to_be64(0xffffffffffffffffULL); |
853 | ib->sib_scope_id = listen_ib->sib_scope_id; | 859 | ib->sib_scope_id = listen_ib->sib_scope_id; |
854 | 860 | ||
855 | ib = (struct sockaddr_ib *) &id->route.addr.dst_addr; | 861 | if (path) { |
856 | ib->sib_family = listen_ib->sib_family; | 862 | ib = (struct sockaddr_ib *) &id->route.addr.dst_addr; |
857 | ib->sib_pkey = path->pkey; | 863 | ib->sib_family = listen_ib->sib_family; |
858 | ib->sib_flowinfo = path->flow_label; | 864 | ib->sib_pkey = path->pkey; |
859 | memcpy(&ib->sib_addr, &path->dgid, 16); | 865 | ib->sib_flowinfo = path->flow_label; |
866 | memcpy(&ib->sib_addr, &path->dgid, 16); | ||
867 | } | ||
860 | } | 868 | } |
861 | 869 | ||
862 | static __be16 ss_get_port(const struct sockaddr_storage *ss) | 870 | static __be16 ss_get_port(const struct sockaddr_storage *ss) |
@@ -905,9 +913,11 @@ static int cma_save_net_info(struct rdma_cm_id *id, struct rdma_cm_id *listen_id | |||
905 | { | 913 | { |
906 | struct cma_hdr *hdr; | 914 | struct cma_hdr *hdr; |
907 | 915 | ||
908 | if ((listen_id->route.addr.src_addr.ss_family == AF_IB) && | 916 | if (listen_id->route.addr.src_addr.ss_family == AF_IB) { |
909 | (ib_event->event == IB_CM_REQ_RECEIVED)) { | 917 | if (ib_event->event == IB_CM_REQ_RECEIVED) |
910 | cma_save_ib_info(id, listen_id, ib_event->param.req_rcvd.primary_path); | 918 | cma_save_ib_info(id, listen_id, ib_event->param.req_rcvd.primary_path); |
919 | else if (ib_event->event == IB_CM_SIDR_REQ_RECEIVED) | ||
920 | cma_save_ib_info(id, listen_id, NULL); | ||
911 | return 0; | 921 | return 0; |
912 | } | 922 | } |
913 | 923 | ||
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma.h b/drivers/infiniband/hw/ocrdma/ocrdma.h index c9780d919769..b396344fae16 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma.h +++ b/drivers/infiniband/hw/ocrdma/ocrdma.h | |||
@@ -40,7 +40,7 @@ | |||
40 | #include <be_roce.h> | 40 | #include <be_roce.h> |
41 | #include "ocrdma_sli.h" | 41 | #include "ocrdma_sli.h" |
42 | 42 | ||
43 | #define OCRDMA_ROCE_DRV_VERSION "10.4.205.0u" | 43 | #define OCRDMA_ROCE_DRV_VERSION "10.6.0.0" |
44 | 44 | ||
45 | #define OCRDMA_ROCE_DRV_DESC "Emulex OneConnect RoCE Driver" | 45 | #define OCRDMA_ROCE_DRV_DESC "Emulex OneConnect RoCE Driver" |
46 | #define OCRDMA_NODE_DESC "Emulex OneConnect RoCE HCA" | 46 | #define OCRDMA_NODE_DESC "Emulex OneConnect RoCE HCA" |
@@ -515,6 +515,8 @@ static inline int ocrdma_resolve_dmac(struct ocrdma_dev *dev, | |||
515 | memcpy(&in6, ah_attr->grh.dgid.raw, sizeof(in6)); | 515 | memcpy(&in6, ah_attr->grh.dgid.raw, sizeof(in6)); |
516 | if (rdma_is_multicast_addr(&in6)) | 516 | if (rdma_is_multicast_addr(&in6)) |
517 | rdma_get_mcast_mac(&in6, mac_addr); | 517 | rdma_get_mcast_mac(&in6, mac_addr); |
518 | else if (rdma_link_local_addr(&in6)) | ||
519 | rdma_get_ll_mac(&in6, mac_addr); | ||
518 | else | 520 | else |
519 | memcpy(mac_addr, ah_attr->dmac, ETH_ALEN); | 521 | memcpy(mac_addr, ah_attr->dmac, ETH_ALEN); |
520 | return 0; | 522 | return 0; |
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_ah.c b/drivers/infiniband/hw/ocrdma/ocrdma_ah.c index d812904f3984..f5a5ea836dbd 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_ah.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_ah.c | |||
@@ -56,7 +56,13 @@ static inline int set_av_attr(struct ocrdma_dev *dev, struct ocrdma_ah *ah, | |||
56 | vlan_tag = attr->vlan_id; | 56 | vlan_tag = attr->vlan_id; |
57 | if (!vlan_tag || (vlan_tag > 0xFFF)) | 57 | if (!vlan_tag || (vlan_tag > 0xFFF)) |
58 | vlan_tag = dev->pvid; | 58 | vlan_tag = dev->pvid; |
59 | if (vlan_tag && (vlan_tag < 0x1000)) { | 59 | if (vlan_tag || dev->pfc_state) { |
60 | if (!vlan_tag) { | ||
61 | pr_err("ocrdma%d:Using VLAN with PFC is recommended\n", | ||
62 | dev->id); | ||
63 | pr_err("ocrdma%d:Using VLAN 0 for this connection\n", | ||
64 | dev->id); | ||
65 | } | ||
60 | eth.eth_type = cpu_to_be16(0x8100); | 66 | eth.eth_type = cpu_to_be16(0x8100); |
61 | eth.roce_eth_type = cpu_to_be16(OCRDMA_ROCE_ETH_TYPE); | 67 | eth.roce_eth_type = cpu_to_be16(OCRDMA_ROCE_ETH_TYPE); |
62 | vlan_tag |= (dev->sl & 0x07) << OCRDMA_VID_PCP_SHIFT; | 68 | vlan_tag |= (dev->sl & 0x07) << OCRDMA_VID_PCP_SHIFT; |
@@ -121,7 +127,9 @@ struct ib_ah *ocrdma_create_ah(struct ib_pd *ibpd, struct ib_ah_attr *attr) | |||
121 | goto av_conf_err; | 127 | goto av_conf_err; |
122 | } | 128 | } |
123 | 129 | ||
124 | if (pd->uctx) { | 130 | if ((pd->uctx) && |
131 | (!rdma_is_multicast_addr((struct in6_addr *)attr->grh.dgid.raw)) && | ||
132 | (!rdma_link_local_addr((struct in6_addr *)attr->grh.dgid.raw))) { | ||
125 | status = rdma_addr_find_dmac_by_grh(&sgid, &attr->grh.dgid, | 133 | status = rdma_addr_find_dmac_by_grh(&sgid, &attr->grh.dgid, |
126 | attr->dmac, &attr->vlan_id); | 134 | attr->dmac, &attr->vlan_id); |
127 | if (status) { | 135 | if (status) { |
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c index 0c9e95909a64..47615ff33bc6 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c | |||
@@ -933,12 +933,18 @@ static irqreturn_t ocrdma_irq_handler(int irq, void *handle) | |||
933 | struct ocrdma_eqe eqe; | 933 | struct ocrdma_eqe eqe; |
934 | struct ocrdma_eqe *ptr; | 934 | struct ocrdma_eqe *ptr; |
935 | u16 cq_id; | 935 | u16 cq_id; |
936 | u8 mcode; | ||
936 | int budget = eq->cq_cnt; | 937 | int budget = eq->cq_cnt; |
937 | 938 | ||
938 | do { | 939 | do { |
939 | ptr = ocrdma_get_eqe(eq); | 940 | ptr = ocrdma_get_eqe(eq); |
940 | eqe = *ptr; | 941 | eqe = *ptr; |
941 | ocrdma_le32_to_cpu(&eqe, sizeof(eqe)); | 942 | ocrdma_le32_to_cpu(&eqe, sizeof(eqe)); |
943 | mcode = (eqe.id_valid & OCRDMA_EQE_MAJOR_CODE_MASK) | ||
944 | >> OCRDMA_EQE_MAJOR_CODE_SHIFT; | ||
945 | if (mcode == OCRDMA_MAJOR_CODE_SENTINAL) | ||
946 | pr_err("EQ full on eqid = 0x%x, eqe = 0x%x\n", | ||
947 | eq->q.id, eqe.id_valid); | ||
942 | if ((eqe.id_valid & OCRDMA_EQE_VALID_MASK) == 0) | 948 | if ((eqe.id_valid & OCRDMA_EQE_VALID_MASK) == 0) |
943 | break; | 949 | break; |
944 | 950 | ||
@@ -1434,27 +1440,30 @@ static int ocrdma_mbx_alloc_pd_range(struct ocrdma_dev *dev) | |||
1434 | struct ocrdma_alloc_pd_range_rsp *rsp; | 1440 | struct ocrdma_alloc_pd_range_rsp *rsp; |
1435 | 1441 | ||
1436 | /* Pre allocate the DPP PDs */ | 1442 | /* Pre allocate the DPP PDs */ |
1437 | cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_ALLOC_PD_RANGE, sizeof(*cmd)); | 1443 | if (dev->attr.max_dpp_pds) { |
1438 | if (!cmd) | 1444 | cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_ALLOC_PD_RANGE, |
1439 | return -ENOMEM; | 1445 | sizeof(*cmd)); |
1440 | cmd->pd_count = dev->attr.max_dpp_pds; | 1446 | if (!cmd) |
1441 | cmd->enable_dpp_rsvd |= OCRDMA_ALLOC_PD_ENABLE_DPP; | 1447 | return -ENOMEM; |
1442 | status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd); | 1448 | cmd->pd_count = dev->attr.max_dpp_pds; |
1443 | if (status) | 1449 | cmd->enable_dpp_rsvd |= OCRDMA_ALLOC_PD_ENABLE_DPP; |
1444 | goto mbx_err; | 1450 | status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd); |
1445 | rsp = (struct ocrdma_alloc_pd_range_rsp *)cmd; | 1451 | rsp = (struct ocrdma_alloc_pd_range_rsp *)cmd; |
1446 | 1452 | ||
1447 | if ((rsp->dpp_page_pdid & OCRDMA_ALLOC_PD_RSP_DPP) && rsp->pd_count) { | 1453 | if (!status && (rsp->dpp_page_pdid & OCRDMA_ALLOC_PD_RSP_DPP) && |
1448 | dev->pd_mgr->dpp_page_index = rsp->dpp_page_pdid >> | 1454 | rsp->pd_count) { |
1449 | OCRDMA_ALLOC_PD_RSP_DPP_PAGE_SHIFT; | 1455 | dev->pd_mgr->dpp_page_index = rsp->dpp_page_pdid >> |
1450 | dev->pd_mgr->pd_dpp_start = rsp->dpp_page_pdid & | 1456 | OCRDMA_ALLOC_PD_RSP_DPP_PAGE_SHIFT; |
1451 | OCRDMA_ALLOC_PD_RNG_RSP_START_PDID_MASK; | 1457 | dev->pd_mgr->pd_dpp_start = rsp->dpp_page_pdid & |
1452 | dev->pd_mgr->max_dpp_pd = rsp->pd_count; | 1458 | OCRDMA_ALLOC_PD_RNG_RSP_START_PDID_MASK; |
1453 | pd_bitmap_size = BITS_TO_LONGS(rsp->pd_count) * sizeof(long); | 1459 | dev->pd_mgr->max_dpp_pd = rsp->pd_count; |
1454 | dev->pd_mgr->pd_dpp_bitmap = kzalloc(pd_bitmap_size, | 1460 | pd_bitmap_size = |
1455 | GFP_KERNEL); | 1461 | BITS_TO_LONGS(rsp->pd_count) * sizeof(long); |
1462 | dev->pd_mgr->pd_dpp_bitmap = kzalloc(pd_bitmap_size, | ||
1463 | GFP_KERNEL); | ||
1464 | } | ||
1465 | kfree(cmd); | ||
1456 | } | 1466 | } |
1457 | kfree(cmd); | ||
1458 | 1467 | ||
1459 | cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_ALLOC_PD_RANGE, sizeof(*cmd)); | 1468 | cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_ALLOC_PD_RANGE, sizeof(*cmd)); |
1460 | if (!cmd) | 1469 | if (!cmd) |
@@ -1462,10 +1471,8 @@ static int ocrdma_mbx_alloc_pd_range(struct ocrdma_dev *dev) | |||
1462 | 1471 | ||
1463 | cmd->pd_count = dev->attr.max_pd - dev->attr.max_dpp_pds; | 1472 | cmd->pd_count = dev->attr.max_pd - dev->attr.max_dpp_pds; |
1464 | status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd); | 1473 | status = ocrdma_mbx_cmd(dev, (struct ocrdma_mqe *)cmd); |
1465 | if (status) | ||
1466 | goto mbx_err; | ||
1467 | rsp = (struct ocrdma_alloc_pd_range_rsp *)cmd; | 1474 | rsp = (struct ocrdma_alloc_pd_range_rsp *)cmd; |
1468 | if (rsp->pd_count) { | 1475 | if (!status && rsp->pd_count) { |
1469 | dev->pd_mgr->pd_norm_start = rsp->dpp_page_pdid & | 1476 | dev->pd_mgr->pd_norm_start = rsp->dpp_page_pdid & |
1470 | OCRDMA_ALLOC_PD_RNG_RSP_START_PDID_MASK; | 1477 | OCRDMA_ALLOC_PD_RNG_RSP_START_PDID_MASK; |
1471 | dev->pd_mgr->max_normal_pd = rsp->pd_count; | 1478 | dev->pd_mgr->max_normal_pd = rsp->pd_count; |
@@ -1473,15 +1480,13 @@ static int ocrdma_mbx_alloc_pd_range(struct ocrdma_dev *dev) | |||
1473 | dev->pd_mgr->pd_norm_bitmap = kzalloc(pd_bitmap_size, | 1480 | dev->pd_mgr->pd_norm_bitmap = kzalloc(pd_bitmap_size, |
1474 | GFP_KERNEL); | 1481 | GFP_KERNEL); |
1475 | } | 1482 | } |
1483 | kfree(cmd); | ||
1476 | 1484 | ||
1477 | if (dev->pd_mgr->pd_norm_bitmap || dev->pd_mgr->pd_dpp_bitmap) { | 1485 | if (dev->pd_mgr->pd_norm_bitmap || dev->pd_mgr->pd_dpp_bitmap) { |
1478 | /* Enable PD resource manager */ | 1486 | /* Enable PD resource manager */ |
1479 | dev->pd_mgr->pd_prealloc_valid = true; | 1487 | dev->pd_mgr->pd_prealloc_valid = true; |
1480 | } else { | 1488 | return 0; |
1481 | return -ENOMEM; | ||
1482 | } | 1489 | } |
1483 | mbx_err: | ||
1484 | kfree(cmd); | ||
1485 | return status; | 1490 | return status; |
1486 | } | 1491 | } |
1487 | 1492 | ||
@@ -2406,7 +2411,7 @@ int ocrdma_mbx_query_qp(struct ocrdma_dev *dev, struct ocrdma_qp *qp, | |||
2406 | struct ocrdma_query_qp *cmd; | 2411 | struct ocrdma_query_qp *cmd; |
2407 | struct ocrdma_query_qp_rsp *rsp; | 2412 | struct ocrdma_query_qp_rsp *rsp; |
2408 | 2413 | ||
2409 | cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_QUERY_QP, sizeof(*cmd)); | 2414 | cmd = ocrdma_init_emb_mqe(OCRDMA_CMD_QUERY_QP, sizeof(*rsp)); |
2410 | if (!cmd) | 2415 | if (!cmd) |
2411 | return status; | 2416 | return status; |
2412 | cmd->qp_id = qp->id; | 2417 | cmd->qp_id = qp->id; |
@@ -2428,7 +2433,7 @@ static int ocrdma_set_av_params(struct ocrdma_qp *qp, | |||
2428 | int status; | 2433 | int status; |
2429 | struct ib_ah_attr *ah_attr = &attrs->ah_attr; | 2434 | struct ib_ah_attr *ah_attr = &attrs->ah_attr; |
2430 | union ib_gid sgid, zgid; | 2435 | union ib_gid sgid, zgid; |
2431 | u32 vlan_id; | 2436 | u32 vlan_id = 0xFFFF; |
2432 | u8 mac_addr[6]; | 2437 | u8 mac_addr[6]; |
2433 | struct ocrdma_dev *dev = get_ocrdma_dev(qp->ibqp.device); | 2438 | struct ocrdma_dev *dev = get_ocrdma_dev(qp->ibqp.device); |
2434 | 2439 | ||
@@ -2468,12 +2473,22 @@ static int ocrdma_set_av_params(struct ocrdma_qp *qp, | |||
2468 | cmd->params.vlan_dmac_b4_to_b5 = mac_addr[4] | (mac_addr[5] << 8); | 2473 | cmd->params.vlan_dmac_b4_to_b5 = mac_addr[4] | (mac_addr[5] << 8); |
2469 | if (attr_mask & IB_QP_VID) { | 2474 | if (attr_mask & IB_QP_VID) { |
2470 | vlan_id = attrs->vlan_id; | 2475 | vlan_id = attrs->vlan_id; |
2476 | } else if (dev->pfc_state) { | ||
2477 | vlan_id = 0; | ||
2478 | pr_err("ocrdma%d:Using VLAN with PFC is recommended\n", | ||
2479 | dev->id); | ||
2480 | pr_err("ocrdma%d:Using VLAN 0 for this connection\n", | ||
2481 | dev->id); | ||
2482 | } | ||
2483 | |||
2484 | if (vlan_id < 0x1000) { | ||
2471 | cmd->params.vlan_dmac_b4_to_b5 |= | 2485 | cmd->params.vlan_dmac_b4_to_b5 |= |
2472 | vlan_id << OCRDMA_QP_PARAMS_VLAN_SHIFT; | 2486 | vlan_id << OCRDMA_QP_PARAMS_VLAN_SHIFT; |
2473 | cmd->flags |= OCRDMA_QP_PARA_VLAN_EN_VALID; | 2487 | cmd->flags |= OCRDMA_QP_PARA_VLAN_EN_VALID; |
2474 | cmd->params.rnt_rc_sl_fl |= | 2488 | cmd->params.rnt_rc_sl_fl |= |
2475 | (dev->sl & 0x07) << OCRDMA_QP_PARAMS_SL_SHIFT; | 2489 | (dev->sl & 0x07) << OCRDMA_QP_PARAMS_SL_SHIFT; |
2476 | } | 2490 | } |
2491 | |||
2477 | return 0; | 2492 | return 0; |
2478 | } | 2493 | } |
2479 | 2494 | ||
@@ -2519,8 +2534,10 @@ static int ocrdma_set_qp_params(struct ocrdma_qp *qp, | |||
2519 | cmd->flags |= OCRDMA_QP_PARA_DST_QPN_VALID; | 2534 | cmd->flags |= OCRDMA_QP_PARA_DST_QPN_VALID; |
2520 | } | 2535 | } |
2521 | if (attr_mask & IB_QP_PATH_MTU) { | 2536 | if (attr_mask & IB_QP_PATH_MTU) { |
2522 | if (attrs->path_mtu < IB_MTU_256 || | 2537 | if (attrs->path_mtu < IB_MTU_512 || |
2523 | attrs->path_mtu > IB_MTU_4096) { | 2538 | attrs->path_mtu > IB_MTU_4096) { |
2539 | pr_err("ocrdma%d: IB MTU %d is not supported\n", | ||
2540 | dev->id, ib_mtu_enum_to_int(attrs->path_mtu)); | ||
2524 | status = -EINVAL; | 2541 | status = -EINVAL; |
2525 | goto pmtu_err; | 2542 | goto pmtu_err; |
2526 | } | 2543 | } |
@@ -3147,9 +3164,9 @@ void ocrdma_cleanup_hw(struct ocrdma_dev *dev) | |||
3147 | ocrdma_free_pd_pool(dev); | 3164 | ocrdma_free_pd_pool(dev); |
3148 | ocrdma_mbx_delete_ah_tbl(dev); | 3165 | ocrdma_mbx_delete_ah_tbl(dev); |
3149 | 3166 | ||
3150 | /* cleanup the eqs */ | ||
3151 | ocrdma_destroy_eqs(dev); | ||
3152 | |||
3153 | /* cleanup the control path */ | 3167 | /* cleanup the control path */ |
3154 | ocrdma_destroy_mq(dev); | 3168 | ocrdma_destroy_mq(dev); |
3169 | |||
3170 | /* cleanup the eqs */ | ||
3171 | ocrdma_destroy_eqs(dev); | ||
3155 | } | 3172 | } |
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_sli.h b/drivers/infiniband/hw/ocrdma/ocrdma_sli.h index 243c87c8bd65..02ad0aee99af 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_sli.h +++ b/drivers/infiniband/hw/ocrdma/ocrdma_sli.h | |||
@@ -1176,6 +1176,8 @@ struct ocrdma_query_qp_rsp { | |||
1176 | struct ocrdma_mqe_hdr hdr; | 1176 | struct ocrdma_mqe_hdr hdr; |
1177 | struct ocrdma_mbx_rsp rsp; | 1177 | struct ocrdma_mbx_rsp rsp; |
1178 | struct ocrdma_qp_params params; | 1178 | struct ocrdma_qp_params params; |
1179 | u32 dpp_credits_cqid; | ||
1180 | u32 rbq_id; | ||
1179 | }; | 1181 | }; |
1180 | 1182 | ||
1181 | enum { | 1183 | enum { |
@@ -1624,12 +1626,19 @@ struct ocrdma_delete_ah_tbl_rsp { | |||
1624 | enum { | 1626 | enum { |
1625 | OCRDMA_EQE_VALID_SHIFT = 0, | 1627 | OCRDMA_EQE_VALID_SHIFT = 0, |
1626 | OCRDMA_EQE_VALID_MASK = BIT(0), | 1628 | OCRDMA_EQE_VALID_MASK = BIT(0), |
1629 | OCRDMA_EQE_MAJOR_CODE_MASK = 0x0E, | ||
1630 | OCRDMA_EQE_MAJOR_CODE_SHIFT = 0x01, | ||
1627 | OCRDMA_EQE_FOR_CQE_MASK = 0xFFFE, | 1631 | OCRDMA_EQE_FOR_CQE_MASK = 0xFFFE, |
1628 | OCRDMA_EQE_RESOURCE_ID_SHIFT = 16, | 1632 | OCRDMA_EQE_RESOURCE_ID_SHIFT = 16, |
1629 | OCRDMA_EQE_RESOURCE_ID_MASK = 0xFFFF << | 1633 | OCRDMA_EQE_RESOURCE_ID_MASK = 0xFFFF << |
1630 | OCRDMA_EQE_RESOURCE_ID_SHIFT, | 1634 | OCRDMA_EQE_RESOURCE_ID_SHIFT, |
1631 | }; | 1635 | }; |
1632 | 1636 | ||
1637 | enum major_code { | ||
1638 | OCRDMA_MAJOR_CODE_COMPLETION = 0x00, | ||
1639 | OCRDMA_MAJOR_CODE_SENTINAL = 0x01 | ||
1640 | }; | ||
1641 | |||
1633 | struct ocrdma_eqe { | 1642 | struct ocrdma_eqe { |
1634 | u32 id_valid; | 1643 | u32 id_valid; |
1635 | }; | 1644 | }; |
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c index 877175563634..9dcb66077d6c 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | |||
@@ -365,7 +365,7 @@ static struct ocrdma_pd *_ocrdma_alloc_pd(struct ocrdma_dev *dev, | |||
365 | if (!pd) | 365 | if (!pd) |
366 | return ERR_PTR(-ENOMEM); | 366 | return ERR_PTR(-ENOMEM); |
367 | 367 | ||
368 | if (udata && uctx) { | 368 | if (udata && uctx && dev->attr.max_dpp_pds) { |
369 | pd->dpp_enabled = | 369 | pd->dpp_enabled = |
370 | ocrdma_get_asic_type(dev) == OCRDMA_ASIC_GEN_SKH_R; | 370 | ocrdma_get_asic_type(dev) == OCRDMA_ASIC_GEN_SKH_R; |
371 | pd->num_dpp_qp = | 371 | pd->num_dpp_qp = |
@@ -1721,18 +1721,20 @@ int ocrdma_destroy_qp(struct ib_qp *ibqp) | |||
1721 | struct ocrdma_qp *qp; | 1721 | struct ocrdma_qp *qp; |
1722 | struct ocrdma_dev *dev; | 1722 | struct ocrdma_dev *dev; |
1723 | struct ib_qp_attr attrs; | 1723 | struct ib_qp_attr attrs; |
1724 | int attr_mask = IB_QP_STATE; | 1724 | int attr_mask; |
1725 | unsigned long flags; | 1725 | unsigned long flags; |
1726 | 1726 | ||
1727 | qp = get_ocrdma_qp(ibqp); | 1727 | qp = get_ocrdma_qp(ibqp); |
1728 | dev = get_ocrdma_dev(ibqp->device); | 1728 | dev = get_ocrdma_dev(ibqp->device); |
1729 | 1729 | ||
1730 | attrs.qp_state = IB_QPS_ERR; | ||
1731 | pd = qp->pd; | 1730 | pd = qp->pd; |
1732 | 1731 | ||
1733 | /* change the QP state to ERROR */ | 1732 | /* change the QP state to ERROR */ |
1734 | _ocrdma_modify_qp(ibqp, &attrs, attr_mask); | 1733 | if (qp->state != OCRDMA_QPS_RST) { |
1735 | 1734 | attrs.qp_state = IB_QPS_ERR; | |
1735 | attr_mask = IB_QP_STATE; | ||
1736 | _ocrdma_modify_qp(ibqp, &attrs, attr_mask); | ||
1737 | } | ||
1736 | /* ensure that CQEs for newly created QP (whose id may be same with | 1738 | /* ensure that CQEs for newly created QP (whose id may be same with |
1737 | * one which just getting destroyed are same), dont get | 1739 | * one which just getting destroyed are same), dont get |
1738 | * discarded until the old CQEs are discarded. | 1740 | * discarded until the old CQEs are discarded. |
diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c index 327529ee85eb..3f40319a55da 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.c +++ b/drivers/infiniband/ulp/isert/ib_isert.c | |||
@@ -547,11 +547,11 @@ isert_create_pi_ctx(struct fast_reg_descriptor *desc, | |||
547 | return 0; | 547 | return 0; |
548 | 548 | ||
549 | err_prot_mr: | 549 | err_prot_mr: |
550 | ib_dereg_mr(desc->pi_ctx->prot_mr); | 550 | ib_dereg_mr(pi_ctx->prot_mr); |
551 | err_prot_frpl: | 551 | err_prot_frpl: |
552 | ib_free_fast_reg_page_list(desc->pi_ctx->prot_frpl); | 552 | ib_free_fast_reg_page_list(pi_ctx->prot_frpl); |
553 | err_pi_ctx: | 553 | err_pi_ctx: |
554 | kfree(desc->pi_ctx); | 554 | kfree(pi_ctx); |
555 | 555 | ||
556 | return ret; | 556 | return ret; |
557 | } | 557 | } |
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c index f362883c94e3..1d247bcf2ae2 100644 --- a/drivers/input/joydev.c +++ b/drivers/input/joydev.c | |||
@@ -747,6 +747,63 @@ static void joydev_cleanup(struct joydev *joydev) | |||
747 | input_close_device(handle); | 747 | input_close_device(handle); |
748 | } | 748 | } |
749 | 749 | ||
750 | static bool joydev_dev_is_absolute_mouse(struct input_dev *dev) | ||
751 | { | ||
752 | DECLARE_BITMAP(jd_scratch, KEY_CNT); | ||
753 | |||
754 | BUILD_BUG_ON(ABS_CNT > KEY_CNT || EV_CNT > KEY_CNT); | ||
755 | |||
756 | /* | ||
757 | * Virtualization (VMware, etc) and remote management (HP | ||
758 | * ILO2) solutions use absolute coordinates for their virtual | ||
759 | * pointing devices so that there is one-to-one relationship | ||
760 | * between pointer position on the host screen and virtual | ||
761 | * guest screen, and so their mice use ABS_X, ABS_Y and 3 | ||
762 | * primary button events. This clashes with what joydev | ||
763 | * considers to be joysticks (a device with at minimum ABS_X | ||
764 | * axis). | ||
765 | * | ||
766 | * Here we are trying to separate absolute mice from | ||
767 | * joysticks. A device is, for joystick detection purposes, | ||
768 | * considered to be an absolute mouse if the following is | ||
769 | * true: | ||
770 | * | ||
771 | * 1) Event types are exactly EV_ABS, EV_KEY and EV_SYN. | ||
772 | * 2) Absolute events are exactly ABS_X and ABS_Y. | ||
773 | * 3) Keys are exactly BTN_LEFT, BTN_RIGHT and BTN_MIDDLE. | ||
774 | * 4) Device is not on "Amiga" bus. | ||
775 | */ | ||
776 | |||
777 | bitmap_zero(jd_scratch, EV_CNT); | ||
778 | __set_bit(EV_ABS, jd_scratch); | ||
779 | __set_bit(EV_KEY, jd_scratch); | ||
780 | __set_bit(EV_SYN, jd_scratch); | ||
781 | if (!bitmap_equal(jd_scratch, dev->evbit, EV_CNT)) | ||
782 | return false; | ||
783 | |||
784 | bitmap_zero(jd_scratch, ABS_CNT); | ||
785 | __set_bit(ABS_X, jd_scratch); | ||
786 | __set_bit(ABS_Y, jd_scratch); | ||
787 | if (!bitmap_equal(dev->absbit, jd_scratch, ABS_CNT)) | ||
788 | return false; | ||
789 | |||
790 | bitmap_zero(jd_scratch, KEY_CNT); | ||
791 | __set_bit(BTN_LEFT, jd_scratch); | ||
792 | __set_bit(BTN_RIGHT, jd_scratch); | ||
793 | __set_bit(BTN_MIDDLE, jd_scratch); | ||
794 | |||
795 | if (!bitmap_equal(dev->keybit, jd_scratch, KEY_CNT)) | ||
796 | return false; | ||
797 | |||
798 | /* | ||
799 | * Amiga joystick (amijoy) historically uses left/middle/right | ||
800 | * button events. | ||
801 | */ | ||
802 | if (dev->id.bustype == BUS_AMIGA) | ||
803 | return false; | ||
804 | |||
805 | return true; | ||
806 | } | ||
750 | 807 | ||
751 | static bool joydev_match(struct input_handler *handler, struct input_dev *dev) | 808 | static bool joydev_match(struct input_handler *handler, struct input_dev *dev) |
752 | { | 809 | { |
@@ -758,6 +815,10 @@ static bool joydev_match(struct input_handler *handler, struct input_dev *dev) | |||
758 | if (test_bit(EV_KEY, dev->evbit) && test_bit(BTN_DIGI, dev->keybit)) | 815 | if (test_bit(EV_KEY, dev->evbit) && test_bit(BTN_DIGI, dev->keybit)) |
759 | return false; | 816 | return false; |
760 | 817 | ||
818 | /* Avoid absolute mice */ | ||
819 | if (joydev_dev_is_absolute_mouse(dev)) | ||
820 | return false; | ||
821 | |||
761 | return true; | 822 | return true; |
762 | } | 823 | } |
763 | 824 | ||
diff --git a/drivers/input/mouse/Kconfig b/drivers/input/mouse/Kconfig index 7462d2fc8cfe..d7820d1152d2 100644 --- a/drivers/input/mouse/Kconfig +++ b/drivers/input/mouse/Kconfig | |||
@@ -156,7 +156,7 @@ config MOUSE_PS2_VMMOUSE | |||
156 | Say Y here if you are running under control of VMware hypervisor | 156 | Say Y here if you are running under control of VMware hypervisor |
157 | (ESXi, Workstation or Fusion). Also make sure that when you enable | 157 | (ESXi, Workstation or Fusion). Also make sure that when you enable |
158 | this option, you remove the xf86-input-vmmouse user-space driver | 158 | this option, you remove the xf86-input-vmmouse user-space driver |
159 | or upgrade it to at least xf86-input-vmmouse 13.0.1, which doesn't | 159 | or upgrade it to at least xf86-input-vmmouse 13.1.0, which doesn't |
160 | load in the presence of an in-kernel vmmouse driver. | 160 | load in the presence of an in-kernel vmmouse driver. |
161 | 161 | ||
162 | If unsure, say N. | 162 | If unsure, say N. |
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index e6708f6efb4d..7752bd59d4b7 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c | |||
@@ -941,6 +941,11 @@ static void alps_get_finger_coordinate_v7(struct input_mt_pos *mt, | |||
941 | case V7_PACKET_ID_TWO: | 941 | case V7_PACKET_ID_TWO: |
942 | mt[1].x &= ~0x000F; | 942 | mt[1].x &= ~0x000F; |
943 | mt[1].y |= 0x000F; | 943 | mt[1].y |= 0x000F; |
944 | /* Detect false-postive touches where x & y report max value */ | ||
945 | if (mt[1].y == 0x7ff && mt[1].x == 0xff0) { | ||
946 | mt[1].x = 0; | ||
947 | /* y gets set to 0 at the end of this function */ | ||
948 | } | ||
944 | break; | 949 | break; |
945 | 950 | ||
946 | case V7_PACKET_ID_MULTI: | 951 | case V7_PACKET_ID_MULTI: |
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index 991dc6b20a58..79363b687195 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c | |||
@@ -315,7 +315,7 @@ static void elantech_report_semi_mt_data(struct input_dev *dev, | |||
315 | unsigned int x2, unsigned int y2) | 315 | unsigned int x2, unsigned int y2) |
316 | { | 316 | { |
317 | elantech_set_slot(dev, 0, num_fingers != 0, x1, y1); | 317 | elantech_set_slot(dev, 0, num_fingers != 0, x1, y1); |
318 | elantech_set_slot(dev, 1, num_fingers == 2, x2, y2); | 318 | elantech_set_slot(dev, 1, num_fingers >= 2, x2, y2); |
319 | } | 319 | } |
320 | 320 | ||
321 | /* | 321 | /* |
diff --git a/drivers/input/touchscreen/stmpe-ts.c b/drivers/input/touchscreen/stmpe-ts.c index 2d5ff86b343f..e4c31256a74d 100644 --- a/drivers/input/touchscreen/stmpe-ts.c +++ b/drivers/input/touchscreen/stmpe-ts.c | |||
@@ -164,7 +164,7 @@ static irqreturn_t stmpe_ts_handler(int irq, void *data) | |||
164 | STMPE_TSC_CTRL_TSC_EN, STMPE_TSC_CTRL_TSC_EN); | 164 | STMPE_TSC_CTRL_TSC_EN, STMPE_TSC_CTRL_TSC_EN); |
165 | 165 | ||
166 | /* start polling for touch_det to detect release */ | 166 | /* start polling for touch_det to detect release */ |
167 | schedule_delayed_work(&ts->work, HZ / 50); | 167 | schedule_delayed_work(&ts->work, msecs_to_jiffies(50)); |
168 | 168 | ||
169 | return IRQ_HANDLED; | 169 | return IRQ_HANDLED; |
170 | } | 170 | } |
diff --git a/drivers/input/touchscreen/sx8654.c b/drivers/input/touchscreen/sx8654.c index aecb9ad2e701..642f4a53de50 100644 --- a/drivers/input/touchscreen/sx8654.c +++ b/drivers/input/touchscreen/sx8654.c | |||
@@ -187,7 +187,7 @@ static int sx8654_probe(struct i2c_client *client, | |||
187 | return -ENOMEM; | 187 | return -ENOMEM; |
188 | 188 | ||
189 | input = devm_input_allocate_device(&client->dev); | 189 | input = devm_input_allocate_device(&client->dev); |
190 | if (!sx8654) | 190 | if (!input) |
191 | return -ENOMEM; | 191 | return -ENOMEM; |
192 | 192 | ||
193 | input->name = "SX8654 I2C Touchscreen"; | 193 | input->name = "SX8654 I2C Touchscreen"; |
diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index 9687f8afebff..1b7e155869f6 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c | |||
@@ -828,7 +828,14 @@ static int its_alloc_tables(struct its_node *its) | |||
828 | u64 typer = readq_relaxed(its->base + GITS_TYPER); | 828 | u64 typer = readq_relaxed(its->base + GITS_TYPER); |
829 | u32 ids = GITS_TYPER_DEVBITS(typer); | 829 | u32 ids = GITS_TYPER_DEVBITS(typer); |
830 | 830 | ||
831 | order = get_order((1UL << ids) * entry_size); | 831 | /* |
832 | * 'order' was initialized earlier to the default page | ||
833 | * granule of the the ITS. We can't have an allocation | ||
834 | * smaller than that. If the requested allocation | ||
835 | * is smaller, round up to the default page granule. | ||
836 | */ | ||
837 | order = max(get_order((1UL << ids) * entry_size), | ||
838 | order); | ||
832 | if (order >= MAX_ORDER) { | 839 | if (order >= MAX_ORDER) { |
833 | order = MAX_ORDER - 1; | 840 | order = MAX_ORDER - 1; |
834 | pr_warn("%s: Device Table too large, reduce its page order to %u\n", | 841 | pr_warn("%s: Device Table too large, reduce its page order to %u\n", |
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/bitmap.c b/drivers/md/bitmap.c index 2bc56e2a3526..135a0907e9de 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
@@ -177,11 +177,16 @@ static struct md_rdev *next_active_rdev(struct md_rdev *rdev, struct mddev *mdde | |||
177 | * nr_pending is 0 and In_sync is clear, the entries we return will | 177 | * nr_pending is 0 and In_sync is clear, the entries we return will |
178 | * still be in the same position on the list when we re-enter | 178 | * still be in the same position on the list when we re-enter |
179 | * list_for_each_entry_continue_rcu. | 179 | * list_for_each_entry_continue_rcu. |
180 | * | ||
181 | * Note that if entered with 'rdev == NULL' to start at the | ||
182 | * beginning, we temporarily assign 'rdev' to an address which | ||
183 | * isn't really an rdev, but which can be used by | ||
184 | * list_for_each_entry_continue_rcu() to find the first entry. | ||
180 | */ | 185 | */ |
181 | rcu_read_lock(); | 186 | rcu_read_lock(); |
182 | if (rdev == NULL) | 187 | if (rdev == NULL) |
183 | /* start at the beginning */ | 188 | /* start at the beginning */ |
184 | rdev = list_entry_rcu(&mddev->disks, struct md_rdev, same_set); | 189 | rdev = list_entry(&mddev->disks, struct md_rdev, same_set); |
185 | else { | 190 | else { |
186 | /* release the previous rdev and start from there. */ | 191 | /* release the previous rdev and start from there. */ |
187 | rdev_dec_pending(rdev, mddev); | 192 | rdev_dec_pending(rdev, mddev); |
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/raid0.c b/drivers/md/raid0.c index 6a68ef5246d4..efb654eb5399 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c | |||
@@ -524,6 +524,9 @@ static void raid0_make_request(struct mddev *mddev, struct bio *bio) | |||
524 | ? (sector & (chunk_sects-1)) | 524 | ? (sector & (chunk_sects-1)) |
525 | : sector_div(sector, chunk_sects)); | 525 | : sector_div(sector, chunk_sects)); |
526 | 526 | ||
527 | /* Restore due to sector_div */ | ||
528 | sector = bio->bi_iter.bi_sector; | ||
529 | |||
527 | if (sectors < bio_sectors(bio)) { | 530 | if (sectors < bio_sectors(bio)) { |
528 | split = bio_split(bio, sectors, GFP_NOIO, fs_bio_set); | 531 | split = bio_split(bio, sectors, GFP_NOIO, fs_bio_set); |
529 | bio_chain(split, bio); | 532 | bio_chain(split, bio); |
@@ -531,7 +534,6 @@ static void raid0_make_request(struct mddev *mddev, struct bio *bio) | |||
531 | split = bio; | 534 | split = bio; |
532 | } | 535 | } |
533 | 536 | ||
534 | sector = bio->bi_iter.bi_sector; | ||
535 | zone = find_zone(mddev->private, §or); | 537 | zone = find_zone(mddev->private, §or); |
536 | tmp_dev = map_sector(mddev, zone, sector, §or); | 538 | tmp_dev = map_sector(mddev, zone, sector, §or); |
537 | split->bi_bdev = tmp_dev->bdev; | 539 | split->bi_bdev = tmp_dev->bdev; |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 1ba97fdc6df1..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); |
@@ -1822,7 +1832,7 @@ again: | |||
1822 | } else | 1832 | } else |
1823 | init_async_submit(&submit, 0, tx, NULL, NULL, | 1833 | init_async_submit(&submit, 0, tx, NULL, NULL, |
1824 | to_addr_conv(sh, percpu, j)); | 1834 | to_addr_conv(sh, percpu, j)); |
1825 | async_gen_syndrome(blocks, 0, count+2, STRIPE_SIZE, &submit); | 1835 | tx = async_gen_syndrome(blocks, 0, count+2, STRIPE_SIZE, &submit); |
1826 | if (!last_stripe) { | 1836 | if (!last_stripe) { |
1827 | j++; | 1837 | j++; |
1828 | sh = list_first_entry(&sh->batch_list, struct stripe_head, | 1838 | sh = list_first_entry(&sh->batch_list, struct stripe_head, |
@@ -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/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c index 03d7c7521d97..9a39e0b7e583 100644 --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c | |||
@@ -1304,7 +1304,7 @@ static void atmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
1304 | 1304 | ||
1305 | if (ios->clock) { | 1305 | if (ios->clock) { |
1306 | unsigned int clock_min = ~0U; | 1306 | unsigned int clock_min = ~0U; |
1307 | u32 clkdiv; | 1307 | int clkdiv; |
1308 | 1308 | ||
1309 | spin_lock_bh(&host->lock); | 1309 | spin_lock_bh(&host->lock); |
1310 | if (!host->mode_reg) { | 1310 | if (!host->mode_reg) { |
@@ -1328,7 +1328,12 @@ static void atmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
1328 | /* Calculate clock divider */ | 1328 | /* Calculate clock divider */ |
1329 | if (host->caps.has_odd_clk_div) { | 1329 | if (host->caps.has_odd_clk_div) { |
1330 | clkdiv = DIV_ROUND_UP(host->bus_hz, clock_min) - 2; | 1330 | clkdiv = DIV_ROUND_UP(host->bus_hz, clock_min) - 2; |
1331 | if (clkdiv > 511) { | 1331 | if (clkdiv < 0) { |
1332 | dev_warn(&mmc->class_dev, | ||
1333 | "clock %u too fast; using %lu\n", | ||
1334 | clock_min, host->bus_hz / 2); | ||
1335 | clkdiv = 0; | ||
1336 | } else if (clkdiv > 511) { | ||
1332 | dev_warn(&mmc->class_dev, | 1337 | dev_warn(&mmc->class_dev, |
1333 | "clock %u too slow; using %lu\n", | 1338 | "clock %u too slow; using %lu\n", |
1334 | clock_min, host->bus_hz / (511 + 2)); | 1339 | clock_min, host->bus_hz / (511 + 2)); |
diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c index 4df28943d222..e8d3c1d35453 100644 --- a/drivers/net/bonding/bond_options.c +++ b/drivers/net/bonding/bond_options.c | |||
@@ -624,7 +624,7 @@ int __bond_opt_set(struct bonding *bond, | |||
624 | out: | 624 | out: |
625 | if (ret) | 625 | if (ret) |
626 | bond_opt_error_interpret(bond, opt, ret, val); | 626 | bond_opt_error_interpret(bond, opt, ret, val); |
627 | else | 627 | else if (bond->dev->reg_state == NETREG_REGISTERED) |
628 | call_netdevice_notifiers(NETDEV_CHANGEINFODATA, bond->dev); | 628 | call_netdevice_notifiers(NETDEV_CHANGEINFODATA, bond->dev); |
629 | 629 | ||
630 | return ret; | 630 | return ret; |
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index 61aa570aad9a..fc646a41d548 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c | |||
@@ -350,6 +350,9 @@ static int macb_mii_probe(struct net_device *dev) | |||
350 | else | 350 | else |
351 | phydev->supported &= PHY_BASIC_FEATURES; | 351 | phydev->supported &= PHY_BASIC_FEATURES; |
352 | 352 | ||
353 | if (bp->caps & MACB_CAPS_NO_GIGABIT_HALF) | ||
354 | phydev->supported &= ~SUPPORTED_1000baseT_Half; | ||
355 | |||
353 | phydev->advertising = phydev->supported; | 356 | phydev->advertising = phydev->supported; |
354 | 357 | ||
355 | bp->link = 0; | 358 | bp->link = 0; |
@@ -1037,6 +1040,12 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id) | |||
1037 | * add that if/when we get our hands on a full-blown MII PHY. | 1040 | * add that if/when we get our hands on a full-blown MII PHY. |
1038 | */ | 1041 | */ |
1039 | 1042 | ||
1043 | /* There is a hardware issue under heavy load where DMA can | ||
1044 | * stop, this causes endless "used buffer descriptor read" | ||
1045 | * interrupts but it can be cleared by re-enabling RX. See | ||
1046 | * the at91 manual, section 41.3.1 or the Zynq manual | ||
1047 | * section 16.7.4 for details. | ||
1048 | */ | ||
1040 | if (status & MACB_BIT(RXUBR)) { | 1049 | if (status & MACB_BIT(RXUBR)) { |
1041 | ctrl = macb_readl(bp, NCR); | 1050 | ctrl = macb_readl(bp, NCR); |
1042 | macb_writel(bp, NCR, ctrl & ~MACB_BIT(RE)); | 1051 | macb_writel(bp, NCR, ctrl & ~MACB_BIT(RE)); |
@@ -2693,6 +2702,14 @@ static const struct macb_config emac_config = { | |||
2693 | .init = at91ether_init, | 2702 | .init = at91ether_init, |
2694 | }; | 2703 | }; |
2695 | 2704 | ||
2705 | static const struct macb_config zynq_config = { | ||
2706 | .caps = MACB_CAPS_SG_DISABLED | MACB_CAPS_GIGABIT_MODE_AVAILABLE | | ||
2707 | MACB_CAPS_NO_GIGABIT_HALF, | ||
2708 | .dma_burst_length = 16, | ||
2709 | .clk_init = macb_clk_init, | ||
2710 | .init = macb_init, | ||
2711 | }; | ||
2712 | |||
2696 | static const struct of_device_id macb_dt_ids[] = { | 2713 | static const struct of_device_id macb_dt_ids[] = { |
2697 | { .compatible = "cdns,at32ap7000-macb" }, | 2714 | { .compatible = "cdns,at32ap7000-macb" }, |
2698 | { .compatible = "cdns,at91sam9260-macb", .data = &at91sam9260_config }, | 2715 | { .compatible = "cdns,at91sam9260-macb", .data = &at91sam9260_config }, |
@@ -2703,6 +2720,7 @@ static const struct of_device_id macb_dt_ids[] = { | |||
2703 | { .compatible = "atmel,sama5d4-gem", .data = &sama5d4_config }, | 2720 | { .compatible = "atmel,sama5d4-gem", .data = &sama5d4_config }, |
2704 | { .compatible = "cdns,at91rm9200-emac", .data = &emac_config }, | 2721 | { .compatible = "cdns,at91rm9200-emac", .data = &emac_config }, |
2705 | { .compatible = "cdns,emac", .data = &emac_config }, | 2722 | { .compatible = "cdns,emac", .data = &emac_config }, |
2723 | { .compatible = "cdns,zynq-gem", .data = &zynq_config }, | ||
2706 | { /* sentinel */ } | 2724 | { /* sentinel */ } |
2707 | }; | 2725 | }; |
2708 | MODULE_DEVICE_TABLE(of, macb_dt_ids); | 2726 | MODULE_DEVICE_TABLE(of, macb_dt_ids); |
diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h index eb7d76f7bf6a..24b1d9bcd865 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h | |||
@@ -393,6 +393,7 @@ | |||
393 | #define MACB_CAPS_ISR_CLEAR_ON_WRITE 0x00000001 | 393 | #define MACB_CAPS_ISR_CLEAR_ON_WRITE 0x00000001 |
394 | #define MACB_CAPS_USRIO_HAS_CLKEN 0x00000002 | 394 | #define MACB_CAPS_USRIO_HAS_CLKEN 0x00000002 |
395 | #define MACB_CAPS_USRIO_DEFAULT_IS_MII 0x00000004 | 395 | #define MACB_CAPS_USRIO_DEFAULT_IS_MII 0x00000004 |
396 | #define MACB_CAPS_NO_GIGABIT_HALF 0x00000008 | ||
396 | #define MACB_CAPS_FIFO_MODE 0x10000000 | 397 | #define MACB_CAPS_FIFO_MODE 0x10000000 |
397 | #define MACB_CAPS_GIGABIT_MODE_AVAILABLE 0x20000000 | 398 | #define MACB_CAPS_GIGABIT_MODE_AVAILABLE 0x20000000 |
398 | #define MACB_CAPS_SG_DISABLED 0x40000000 | 399 | #define MACB_CAPS_SG_DISABLED 0x40000000 |
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/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c index 92fce1b98558..bafe2180cf0c 100644 --- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | |||
@@ -3187,7 +3187,7 @@ int mlx4_SW2HW_CQ_wrapper(struct mlx4_dev *dev, int slave, | |||
3187 | int cqn = vhcr->in_modifier; | 3187 | int cqn = vhcr->in_modifier; |
3188 | struct mlx4_cq_context *cqc = inbox->buf; | 3188 | struct mlx4_cq_context *cqc = inbox->buf; |
3189 | int mtt_base = cq_get_mtt_addr(cqc) / dev->caps.mtt_entry_sz; | 3189 | int mtt_base = cq_get_mtt_addr(cqc) / dev->caps.mtt_entry_sz; |
3190 | struct res_cq *cq; | 3190 | struct res_cq *cq = NULL; |
3191 | struct res_mtt *mtt; | 3191 | struct res_mtt *mtt; |
3192 | 3192 | ||
3193 | err = cq_res_start_move_to(dev, slave, cqn, RES_CQ_HW, &cq); | 3193 | err = cq_res_start_move_to(dev, slave, cqn, RES_CQ_HW, &cq); |
@@ -3223,7 +3223,7 @@ int mlx4_HW2SW_CQ_wrapper(struct mlx4_dev *dev, int slave, | |||
3223 | { | 3223 | { |
3224 | int err; | 3224 | int err; |
3225 | int cqn = vhcr->in_modifier; | 3225 | int cqn = vhcr->in_modifier; |
3226 | struct res_cq *cq; | 3226 | struct res_cq *cq = NULL; |
3227 | 3227 | ||
3228 | err = cq_res_start_move_to(dev, slave, cqn, RES_CQ_ALLOCATED, &cq); | 3228 | err = cq_res_start_move_to(dev, slave, cqn, RES_CQ_ALLOCATED, &cq); |
3229 | if (err) | 3229 | if (err) |
@@ -3362,7 +3362,7 @@ int mlx4_SW2HW_SRQ_wrapper(struct mlx4_dev *dev, int slave, | |||
3362 | int err; | 3362 | int err; |
3363 | int srqn = vhcr->in_modifier; | 3363 | int srqn = vhcr->in_modifier; |
3364 | struct res_mtt *mtt; | 3364 | struct res_mtt *mtt; |
3365 | struct res_srq *srq; | 3365 | struct res_srq *srq = NULL; |
3366 | struct mlx4_srq_context *srqc = inbox->buf; | 3366 | struct mlx4_srq_context *srqc = inbox->buf; |
3367 | int mtt_base = srq_get_mtt_addr(srqc) / dev->caps.mtt_entry_sz; | 3367 | int mtt_base = srq_get_mtt_addr(srqc) / dev->caps.mtt_entry_sz; |
3368 | 3368 | ||
@@ -3406,7 +3406,7 @@ int mlx4_HW2SW_SRQ_wrapper(struct mlx4_dev *dev, int slave, | |||
3406 | { | 3406 | { |
3407 | int err; | 3407 | int err; |
3408 | int srqn = vhcr->in_modifier; | 3408 | int srqn = vhcr->in_modifier; |
3409 | struct res_srq *srq; | 3409 | struct res_srq *srq = NULL; |
3410 | 3410 | ||
3411 | err = srq_res_start_move_to(dev, slave, srqn, RES_SRQ_ALLOCATED, &srq); | 3411 | err = srq_res_start_move_to(dev, slave, srqn, RES_SRQ_ALLOCATED, &srq); |
3412 | if (err) | 3412 | if (err) |
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/rocker/rocker.c b/drivers/net/ethernet/rocker/rocker.c index ec251531bd9f..cf98cc9bbc8d 100644 --- a/drivers/net/ethernet/rocker/rocker.c +++ b/drivers/net/ethernet/rocker/rocker.c | |||
@@ -2921,10 +2921,11 @@ static int rocker_port_ipv4_resolve(struct rocker_port *rocker_port, | |||
2921 | struct neighbour *n = __ipv4_neigh_lookup(dev, (__force u32)ip_addr); | 2921 | struct neighbour *n = __ipv4_neigh_lookup(dev, (__force u32)ip_addr); |
2922 | int err = 0; | 2922 | int err = 0; |
2923 | 2923 | ||
2924 | if (!n) | 2924 | if (!n) { |
2925 | n = neigh_create(&arp_tbl, &ip_addr, dev); | 2925 | n = neigh_create(&arp_tbl, &ip_addr, dev); |
2926 | if (!n) | 2926 | if (IS_ERR(n)) |
2927 | return -ENOMEM; | 2927 | return IS_ERR(n); |
2928 | } | ||
2928 | 2929 | ||
2929 | /* If the neigh is already resolved, then go ahead and | 2930 | /* If the neigh is already resolved, then go ahead and |
2930 | * install the entry, otherwise start the ARP process to | 2931 | * install the entry, otherwise start the ARP process to |
@@ -2936,6 +2937,7 @@ static int rocker_port_ipv4_resolve(struct rocker_port *rocker_port, | |||
2936 | else | 2937 | else |
2937 | neigh_event_send(n, NULL); | 2938 | neigh_event_send(n, NULL); |
2938 | 2939 | ||
2940 | neigh_release(n); | ||
2939 | return err; | 2941 | return err; |
2940 | } | 2942 | } |
2941 | 2943 | ||
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/phy/phy.c b/drivers/net/phy/phy.c index 52cd8db2c57d..47cd578052fc 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c | |||
@@ -742,6 +742,9 @@ EXPORT_SYMBOL(phy_stop); | |||
742 | */ | 742 | */ |
743 | void phy_start(struct phy_device *phydev) | 743 | void phy_start(struct phy_device *phydev) |
744 | { | 744 | { |
745 | bool do_resume = false; | ||
746 | int err = 0; | ||
747 | |||
745 | mutex_lock(&phydev->lock); | 748 | mutex_lock(&phydev->lock); |
746 | 749 | ||
747 | switch (phydev->state) { | 750 | switch (phydev->state) { |
@@ -752,11 +755,22 @@ void phy_start(struct phy_device *phydev) | |||
752 | phydev->state = PHY_UP; | 755 | phydev->state = PHY_UP; |
753 | break; | 756 | break; |
754 | case PHY_HALTED: | 757 | case PHY_HALTED: |
758 | /* make sure interrupts are re-enabled for the PHY */ | ||
759 | err = phy_enable_interrupts(phydev); | ||
760 | if (err < 0) | ||
761 | break; | ||
762 | |||
755 | phydev->state = PHY_RESUMING; | 763 | phydev->state = PHY_RESUMING; |
764 | do_resume = true; | ||
765 | break; | ||
756 | default: | 766 | default: |
757 | break; | 767 | break; |
758 | } | 768 | } |
759 | mutex_unlock(&phydev->lock); | 769 | mutex_unlock(&phydev->lock); |
770 | |||
771 | /* if phy was suspended, bring the physical link up again */ | ||
772 | if (do_resume) | ||
773 | phy_resume(phydev); | ||
760 | } | 774 | } |
761 | EXPORT_SYMBOL(phy_start); | 775 | EXPORT_SYMBOL(phy_start); |
762 | 776 | ||
@@ -769,7 +783,7 @@ void phy_state_machine(struct work_struct *work) | |||
769 | struct delayed_work *dwork = to_delayed_work(work); | 783 | struct delayed_work *dwork = to_delayed_work(work); |
770 | struct phy_device *phydev = | 784 | struct phy_device *phydev = |
771 | container_of(dwork, struct phy_device, state_queue); | 785 | container_of(dwork, struct phy_device, state_queue); |
772 | bool needs_aneg = false, do_suspend = false, do_resume = false; | 786 | bool needs_aneg = false, do_suspend = false; |
773 | int err = 0; | 787 | int err = 0; |
774 | 788 | ||
775 | mutex_lock(&phydev->lock); | 789 | mutex_lock(&phydev->lock); |
@@ -888,14 +902,6 @@ void phy_state_machine(struct work_struct *work) | |||
888 | } | 902 | } |
889 | break; | 903 | break; |
890 | case PHY_RESUMING: | 904 | case PHY_RESUMING: |
891 | err = phy_clear_interrupt(phydev); | ||
892 | if (err) | ||
893 | break; | ||
894 | |||
895 | err = phy_config_interrupt(phydev, PHY_INTERRUPT_ENABLED); | ||
896 | if (err) | ||
897 | break; | ||
898 | |||
899 | if (AUTONEG_ENABLE == phydev->autoneg) { | 905 | if (AUTONEG_ENABLE == phydev->autoneg) { |
900 | err = phy_aneg_done(phydev); | 906 | err = phy_aneg_done(phydev); |
901 | if (err < 0) | 907 | if (err < 0) |
@@ -933,7 +939,6 @@ void phy_state_machine(struct work_struct *work) | |||
933 | } | 939 | } |
934 | phydev->adjust_link(phydev->attached_dev); | 940 | phydev->adjust_link(phydev->attached_dev); |
935 | } | 941 | } |
936 | do_resume = true; | ||
937 | break; | 942 | break; |
938 | } | 943 | } |
939 | 944 | ||
@@ -943,8 +948,6 @@ void phy_state_machine(struct work_struct *work) | |||
943 | err = phy_start_aneg(phydev); | 948 | err = phy_start_aneg(phydev); |
944 | else if (do_suspend) | 949 | else if (do_suspend) |
945 | phy_suspend(phydev); | 950 | phy_suspend(phydev); |
946 | else if (do_resume) | ||
947 | phy_resume(phydev); | ||
948 | 951 | ||
949 | if (err < 0) | 952 | if (err < 0) |
950 | phy_error(phydev); | 953 | phy_error(phydev); |
@@ -1053,13 +1056,14 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable) | |||
1053 | { | 1056 | { |
1054 | /* According to 802.3az,the EEE is supported only in full duplex-mode. | 1057 | /* According to 802.3az,the EEE is supported only in full duplex-mode. |
1055 | * Also EEE feature is active when core is operating with MII, GMII | 1058 | * Also EEE feature is active when core is operating with MII, GMII |
1056 | * or RGMII. Internal PHYs are also allowed to proceed and should | 1059 | * or RGMII (all kinds). Internal PHYs are also allowed to proceed and |
1057 | * return an error if they do not support EEE. | 1060 | * should return an error if they do not support EEE. |
1058 | */ | 1061 | */ |
1059 | if ((phydev->duplex == DUPLEX_FULL) && | 1062 | if ((phydev->duplex == DUPLEX_FULL) && |
1060 | ((phydev->interface == PHY_INTERFACE_MODE_MII) || | 1063 | ((phydev->interface == PHY_INTERFACE_MODE_MII) || |
1061 | (phydev->interface == PHY_INTERFACE_MODE_GMII) || | 1064 | (phydev->interface == PHY_INTERFACE_MODE_GMII) || |
1062 | (phydev->interface == PHY_INTERFACE_MODE_RGMII) || | 1065 | (phydev->interface >= PHY_INTERFACE_MODE_RGMII && |
1066 | phydev->interface <= PHY_INTERFACE_MODE_RGMII_TXID) || | ||
1063 | phy_is_internal(phydev))) { | 1067 | phy_is_internal(phydev))) { |
1064 | int eee_lp, eee_cap, eee_adv; | 1068 | int eee_lp, eee_cap, eee_adv; |
1065 | u32 lp, cap, adv; | 1069 | u32 lp, cap, adv; |
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c index c3e4da9e79ca..8067b8fbb0ee 100644 --- a/drivers/net/usb/cdc_ncm.c +++ b/drivers/net/usb/cdc_ncm.c | |||
@@ -1182,7 +1182,7 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign) | |||
1182 | * payload data instead. | 1182 | * payload data instead. |
1183 | */ | 1183 | */ |
1184 | usbnet_set_skb_tx_stats(skb_out, n, | 1184 | usbnet_set_skb_tx_stats(skb_out, n, |
1185 | ctx->tx_curr_frame_payload - skb_out->len); | 1185 | (long)ctx->tx_curr_frame_payload - skb_out->len); |
1186 | 1186 | ||
1187 | return skb_out; | 1187 | return skb_out; |
1188 | 1188 | ||
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 27a5f954f8e9..21a0fbf1ed94 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
@@ -2961,7 +2961,7 @@ static void __net_exit vxlan_exit_net(struct net *net) | |||
2961 | * to the list by the previous loop. | 2961 | * to the list by the previous loop. |
2962 | */ | 2962 | */ |
2963 | if (!net_eq(dev_net(vxlan->dev), net)) | 2963 | if (!net_eq(dev_net(vxlan->dev), net)) |
2964 | unregister_netdevice_queue(dev, &list); | 2964 | unregister_netdevice_queue(vxlan->dev, &list); |
2965 | } | 2965 | } |
2966 | 2966 | ||
2967 | unregister_netdevice_many(&list); | 2967 | unregister_netdevice_many(&list); |
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/pwm/pwm-img.c b/drivers/pwm/pwm-img.c index 476171a768d6..8a029f9bc18c 100644 --- a/drivers/pwm/pwm-img.c +++ b/drivers/pwm/pwm-img.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/mfd/syscon.h> | 16 | #include <linux/mfd/syscon.h> |
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/of.h> | 18 | #include <linux/of.h> |
19 | #include <linux/of_device.h> | ||
19 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
20 | #include <linux/pwm.h> | 21 | #include <linux/pwm.h> |
21 | #include <linux/regmap.h> | 22 | #include <linux/regmap.h> |
@@ -38,7 +39,22 @@ | |||
38 | #define PERIP_PWM_PDM_CONTROL_CH_MASK 0x1 | 39 | #define PERIP_PWM_PDM_CONTROL_CH_MASK 0x1 |
39 | #define PERIP_PWM_PDM_CONTROL_CH_SHIFT(ch) ((ch) * 4) | 40 | #define PERIP_PWM_PDM_CONTROL_CH_SHIFT(ch) ((ch) * 4) |
40 | 41 | ||
41 | #define MAX_TMBASE_STEPS 65536 | 42 | /* |
43 | * PWM period is specified with a timebase register, | ||
44 | * in number of step periods. The PWM duty cycle is also | ||
45 | * specified in step periods, in the [0, $timebase] range. | ||
46 | * In other words, the timebase imposes the duty cycle | ||
47 | * resolution. Therefore, let's constraint the timebase to | ||
48 | * a minimum value to allow a sane range of duty cycle values. | ||
49 | * Imposing a minimum timebase, will impose a maximum PWM frequency. | ||
50 | * | ||
51 | * The value chosen is completely arbitrary. | ||
52 | */ | ||
53 | #define MIN_TMBASE_STEPS 16 | ||
54 | |||
55 | struct img_pwm_soc_data { | ||
56 | u32 max_timebase; | ||
57 | }; | ||
42 | 58 | ||
43 | struct img_pwm_chip { | 59 | struct img_pwm_chip { |
44 | struct device *dev; | 60 | struct device *dev; |
@@ -47,6 +63,9 @@ struct img_pwm_chip { | |||
47 | struct clk *sys_clk; | 63 | struct clk *sys_clk; |
48 | void __iomem *base; | 64 | void __iomem *base; |
49 | struct regmap *periph_regs; | 65 | struct regmap *periph_regs; |
66 | int max_period_ns; | ||
67 | int min_period_ns; | ||
68 | const struct img_pwm_soc_data *data; | ||
50 | }; | 69 | }; |
51 | 70 | ||
52 | static inline struct img_pwm_chip *to_img_pwm_chip(struct pwm_chip *chip) | 71 | static inline struct img_pwm_chip *to_img_pwm_chip(struct pwm_chip *chip) |
@@ -72,24 +91,31 @@ static int img_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, | |||
72 | u32 val, div, duty, timebase; | 91 | u32 val, div, duty, timebase; |
73 | unsigned long mul, output_clk_hz, input_clk_hz; | 92 | unsigned long mul, output_clk_hz, input_clk_hz; |
74 | struct img_pwm_chip *pwm_chip = to_img_pwm_chip(chip); | 93 | struct img_pwm_chip *pwm_chip = to_img_pwm_chip(chip); |
94 | unsigned int max_timebase = pwm_chip->data->max_timebase; | ||
95 | |||
96 | if (period_ns < pwm_chip->min_period_ns || | ||
97 | period_ns > pwm_chip->max_period_ns) { | ||
98 | dev_err(chip->dev, "configured period not in range\n"); | ||
99 | return -ERANGE; | ||
100 | } | ||
75 | 101 | ||
76 | input_clk_hz = clk_get_rate(pwm_chip->pwm_clk); | 102 | input_clk_hz = clk_get_rate(pwm_chip->pwm_clk); |
77 | output_clk_hz = DIV_ROUND_UP(NSEC_PER_SEC, period_ns); | 103 | output_clk_hz = DIV_ROUND_UP(NSEC_PER_SEC, period_ns); |
78 | 104 | ||
79 | mul = DIV_ROUND_UP(input_clk_hz, output_clk_hz); | 105 | mul = DIV_ROUND_UP(input_clk_hz, output_clk_hz); |
80 | if (mul <= MAX_TMBASE_STEPS) { | 106 | if (mul <= max_timebase) { |
81 | div = PWM_CTRL_CFG_NO_SUB_DIV; | 107 | div = PWM_CTRL_CFG_NO_SUB_DIV; |
82 | timebase = DIV_ROUND_UP(mul, 1); | 108 | timebase = DIV_ROUND_UP(mul, 1); |
83 | } else if (mul <= MAX_TMBASE_STEPS * 8) { | 109 | } else if (mul <= max_timebase * 8) { |
84 | div = PWM_CTRL_CFG_SUB_DIV0; | 110 | div = PWM_CTRL_CFG_SUB_DIV0; |
85 | timebase = DIV_ROUND_UP(mul, 8); | 111 | timebase = DIV_ROUND_UP(mul, 8); |
86 | } else if (mul <= MAX_TMBASE_STEPS * 64) { | 112 | } else if (mul <= max_timebase * 64) { |
87 | div = PWM_CTRL_CFG_SUB_DIV1; | 113 | div = PWM_CTRL_CFG_SUB_DIV1; |
88 | timebase = DIV_ROUND_UP(mul, 64); | 114 | timebase = DIV_ROUND_UP(mul, 64); |
89 | } else if (mul <= MAX_TMBASE_STEPS * 512) { | 115 | } else if (mul <= max_timebase * 512) { |
90 | div = PWM_CTRL_CFG_SUB_DIV0_DIV1; | 116 | div = PWM_CTRL_CFG_SUB_DIV0_DIV1; |
91 | timebase = DIV_ROUND_UP(mul, 512); | 117 | timebase = DIV_ROUND_UP(mul, 512); |
92 | } else if (mul > MAX_TMBASE_STEPS * 512) { | 118 | } else if (mul > max_timebase * 512) { |
93 | dev_err(chip->dev, | 119 | dev_err(chip->dev, |
94 | "failed to configure timebase steps/divider value\n"); | 120 | "failed to configure timebase steps/divider value\n"); |
95 | return -EINVAL; | 121 | return -EINVAL; |
@@ -143,11 +169,27 @@ static const struct pwm_ops img_pwm_ops = { | |||
143 | .owner = THIS_MODULE, | 169 | .owner = THIS_MODULE, |
144 | }; | 170 | }; |
145 | 171 | ||
172 | static const struct img_pwm_soc_data pistachio_pwm = { | ||
173 | .max_timebase = 255, | ||
174 | }; | ||
175 | |||
176 | static const struct of_device_id img_pwm_of_match[] = { | ||
177 | { | ||
178 | .compatible = "img,pistachio-pwm", | ||
179 | .data = &pistachio_pwm, | ||
180 | }, | ||
181 | { } | ||
182 | }; | ||
183 | MODULE_DEVICE_TABLE(of, img_pwm_of_match); | ||
184 | |||
146 | static int img_pwm_probe(struct platform_device *pdev) | 185 | static int img_pwm_probe(struct platform_device *pdev) |
147 | { | 186 | { |
148 | int ret; | 187 | int ret; |
188 | u64 val; | ||
189 | unsigned long clk_rate; | ||
149 | struct resource *res; | 190 | struct resource *res; |
150 | struct img_pwm_chip *pwm; | 191 | struct img_pwm_chip *pwm; |
192 | const struct of_device_id *of_dev_id; | ||
151 | 193 | ||
152 | pwm = devm_kzalloc(&pdev->dev, sizeof(*pwm), GFP_KERNEL); | 194 | pwm = devm_kzalloc(&pdev->dev, sizeof(*pwm), GFP_KERNEL); |
153 | if (!pwm) | 195 | if (!pwm) |
@@ -160,6 +202,11 @@ static int img_pwm_probe(struct platform_device *pdev) | |||
160 | if (IS_ERR(pwm->base)) | 202 | if (IS_ERR(pwm->base)) |
161 | return PTR_ERR(pwm->base); | 203 | return PTR_ERR(pwm->base); |
162 | 204 | ||
205 | of_dev_id = of_match_device(img_pwm_of_match, &pdev->dev); | ||
206 | if (!of_dev_id) | ||
207 | return -ENODEV; | ||
208 | pwm->data = of_dev_id->data; | ||
209 | |||
163 | pwm->periph_regs = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, | 210 | pwm->periph_regs = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, |
164 | "img,cr-periph"); | 211 | "img,cr-periph"); |
165 | if (IS_ERR(pwm->periph_regs)) | 212 | if (IS_ERR(pwm->periph_regs)) |
@@ -189,6 +236,17 @@ static int img_pwm_probe(struct platform_device *pdev) | |||
189 | goto disable_sysclk; | 236 | goto disable_sysclk; |
190 | } | 237 | } |
191 | 238 | ||
239 | clk_rate = clk_get_rate(pwm->pwm_clk); | ||
240 | |||
241 | /* The maximum input clock divider is 512 */ | ||
242 | val = (u64)NSEC_PER_SEC * 512 * pwm->data->max_timebase; | ||
243 | do_div(val, clk_rate); | ||
244 | pwm->max_period_ns = val; | ||
245 | |||
246 | val = (u64)NSEC_PER_SEC * MIN_TMBASE_STEPS; | ||
247 | do_div(val, clk_rate); | ||
248 | pwm->min_period_ns = val; | ||
249 | |||
192 | pwm->chip.dev = &pdev->dev; | 250 | pwm->chip.dev = &pdev->dev; |
193 | pwm->chip.ops = &img_pwm_ops; | 251 | pwm->chip.ops = &img_pwm_ops; |
194 | pwm->chip.base = -1; | 252 | pwm->chip.base = -1; |
@@ -228,12 +286,6 @@ static int img_pwm_remove(struct platform_device *pdev) | |||
228 | return pwmchip_remove(&pwm_chip->chip); | 286 | return pwmchip_remove(&pwm_chip->chip); |
229 | } | 287 | } |
230 | 288 | ||
231 | static const struct of_device_id img_pwm_of_match[] = { | ||
232 | { .compatible = "img,pistachio-pwm", }, | ||
233 | { } | ||
234 | }; | ||
235 | MODULE_DEVICE_TABLE(of, img_pwm_of_match); | ||
236 | |||
237 | static struct platform_driver img_pwm_driver = { | 289 | static struct platform_driver img_pwm_driver = { |
238 | .driver = { | 290 | .driver = { |
239 | .name = "img-pwm", | 291 | .name = "img-pwm", |
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/s390/crypto/ap_bus.c b/drivers/s390/crypto/ap_bus.c index f0b9871a4bbd..3ba611419759 100644 --- a/drivers/s390/crypto/ap_bus.c +++ b/drivers/s390/crypto/ap_bus.c | |||
@@ -1158,11 +1158,12 @@ static ssize_t poll_timeout_store(struct bus_type *bus, const char *buf, | |||
1158 | poll_timeout = time; | 1158 | poll_timeout = time; |
1159 | hr_time = ktime_set(0, poll_timeout); | 1159 | hr_time = ktime_set(0, poll_timeout); |
1160 | 1160 | ||
1161 | if (!hrtimer_is_queued(&ap_poll_timer) || | 1161 | spin_lock_bh(&ap_poll_timer_lock); |
1162 | !hrtimer_forward(&ap_poll_timer, hrtimer_get_expires(&ap_poll_timer), hr_time)) { | 1162 | hrtimer_cancel(&ap_poll_timer); |
1163 | hrtimer_set_expires(&ap_poll_timer, hr_time); | 1163 | hrtimer_set_expires(&ap_poll_timer, hr_time); |
1164 | hrtimer_start_expires(&ap_poll_timer, HRTIMER_MODE_ABS); | 1164 | hrtimer_start_expires(&ap_poll_timer, HRTIMER_MODE_ABS); |
1165 | } | 1165 | spin_unlock_bh(&ap_poll_timer_lock); |
1166 | |||
1166 | return count; | 1167 | return count; |
1167 | } | 1168 | } |
1168 | 1169 | ||
@@ -1528,14 +1529,11 @@ static inline void __ap_schedule_poll_timer(void) | |||
1528 | ktime_t hr_time; | 1529 | ktime_t hr_time; |
1529 | 1530 | ||
1530 | spin_lock_bh(&ap_poll_timer_lock); | 1531 | spin_lock_bh(&ap_poll_timer_lock); |
1531 | if (hrtimer_is_queued(&ap_poll_timer) || ap_suspend_flag) | 1532 | if (!hrtimer_is_queued(&ap_poll_timer) && !ap_suspend_flag) { |
1532 | goto out; | ||
1533 | if (ktime_to_ns(hrtimer_expires_remaining(&ap_poll_timer)) <= 0) { | ||
1534 | hr_time = ktime_set(0, poll_timeout); | 1533 | hr_time = ktime_set(0, poll_timeout); |
1535 | hrtimer_forward_now(&ap_poll_timer, hr_time); | 1534 | hrtimer_forward_now(&ap_poll_timer, hr_time); |
1536 | hrtimer_restart(&ap_poll_timer); | 1535 | hrtimer_restart(&ap_poll_timer); |
1537 | } | 1536 | } |
1538 | out: | ||
1539 | spin_unlock_bh(&ap_poll_timer_lock); | 1537 | spin_unlock_bh(&ap_poll_timer_lock); |
1540 | } | 1538 | } |
1541 | 1539 | ||
@@ -1952,7 +1950,7 @@ static void ap_reset_domain(void) | |||
1952 | { | 1950 | { |
1953 | int i; | 1951 | int i; |
1954 | 1952 | ||
1955 | if (ap_domain_index != -1) | 1953 | if ((ap_domain_index != -1) && (ap_test_config_domain(ap_domain_index))) |
1956 | for (i = 0; i < AP_DEVICES; i++) | 1954 | for (i = 0; i < AP_DEVICES; i++) |
1957 | ap_reset_queue(AP_MKQID(i, ap_domain_index)); | 1955 | ap_reset_queue(AP_MKQID(i, ap_domain_index)); |
1958 | } | 1956 | } |
@@ -2097,7 +2095,6 @@ void ap_module_exit(void) | |||
2097 | hrtimer_cancel(&ap_poll_timer); | 2095 | hrtimer_cancel(&ap_poll_timer); |
2098 | destroy_workqueue(ap_work_queue); | 2096 | destroy_workqueue(ap_work_queue); |
2099 | tasklet_kill(&ap_tasklet); | 2097 | tasklet_kill(&ap_tasklet); |
2100 | root_device_unregister(ap_root_device); | ||
2101 | while ((dev = bus_find_device(&ap_bus_type, NULL, NULL, | 2098 | while ((dev = bus_find_device(&ap_bus_type, NULL, NULL, |
2102 | __ap_match_all))) | 2099 | __ap_match_all))) |
2103 | { | 2100 | { |
@@ -2106,6 +2103,7 @@ void ap_module_exit(void) | |||
2106 | } | 2103 | } |
2107 | for (i = 0; ap_bus_attrs[i]; i++) | 2104 | for (i = 0; ap_bus_attrs[i]; i++) |
2108 | bus_remove_file(&ap_bus_type, ap_bus_attrs[i]); | 2105 | bus_remove_file(&ap_bus_type, ap_bus_attrs[i]); |
2106 | root_device_unregister(ap_root_device); | ||
2109 | bus_unregister(&ap_bus_type); | 2107 | bus_unregister(&ap_bus_type); |
2110 | unregister_reset_call(&ap_reset_call); | 2108 | unregister_reset_call(&ap_reset_call); |
2111 | if (ap_using_interrupts()) | 2109 | if (ap_using_interrupts()) |
diff --git a/drivers/scsi/be2iscsi/be.h b/drivers/scsi/be2iscsi/be.h index 81e83a65a193..32070099c333 100644 --- a/drivers/scsi/be2iscsi/be.h +++ b/drivers/scsi/be2iscsi/be.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * Copyright (C) 2005 - 2014 Emulex | 2 | * Copyright (C) 2005 - 2015 Avago Technologies |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or | 5 | * This program is free software; you can redistribute it and/or |
@@ -8,9 +8,9 @@ | |||
8 | * Public License is included in this distribution in the file called COPYING. | 8 | * Public License is included in this distribution in the file called COPYING. |
9 | * | 9 | * |
10 | * Contact Information: | 10 | * Contact Information: |
11 | * linux-drivers@emulex.com | 11 | * linux-drivers@avagotech.com |
12 | * | 12 | * |
13 | * Emulex | 13 | * Avago Technologies |
14 | * 3333 Susan Street | 14 | * 3333 Susan Street |
15 | * Costa Mesa, CA 92626 | 15 | * Costa Mesa, CA 92626 |
16 | */ | 16 | */ |
diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c index 1028760b8a22..447cf7ce606e 100644 --- a/drivers/scsi/be2iscsi/be_cmds.c +++ b/drivers/scsi/be2iscsi/be_cmds.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * Copyright (C) 2005 - 2014 Emulex | 2 | * Copyright (C) 2005 - 2015 Avago Technologies |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or | 5 | * This program is free software; you can redistribute it and/or |
@@ -8,9 +8,9 @@ | |||
8 | * Public License is included in this distribution in the file called COPYING. | 8 | * Public License is included in this distribution in the file called COPYING. |
9 | * | 9 | * |
10 | * Contact Information: | 10 | * Contact Information: |
11 | * linux-drivers@emulex.com | 11 | * linux-drivers@avagotech.com |
12 | * | 12 | * |
13 | * Emulex | 13 | * Avago Technologies |
14 | * 3333 Susan Street | 14 | * 3333 Susan Street |
15 | * Costa Mesa, CA 92626 | 15 | * Costa Mesa, CA 92626 |
16 | */ | 16 | */ |
diff --git a/drivers/scsi/be2iscsi/be_cmds.h b/drivers/scsi/be2iscsi/be_cmds.h index 98897434bcb4..f11d325fe696 100644 --- a/drivers/scsi/be2iscsi/be_cmds.h +++ b/drivers/scsi/be2iscsi/be_cmds.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * Copyright (C) 2005 - 2014 Emulex | 2 | * Copyright (C) 2005 - 2015 Avago Technologies |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or | 5 | * This program is free software; you can redistribute it and/or |
@@ -8,9 +8,9 @@ | |||
8 | * Public License is included in this distribution in the file called COPYING. | 8 | * Public License is included in this distribution in the file called COPYING. |
9 | * | 9 | * |
10 | * Contact Information: | 10 | * Contact Information: |
11 | * linux-drivers@emulex.com | 11 | * linux-drivers@avagotech.com |
12 | * | 12 | * |
13 | * Emulex | 13 | * Avago Technologies |
14 | * 3333 Susan Street | 14 | * 3333 Susan Street |
15 | * Costa Mesa, CA 92626 | 15 | * Costa Mesa, CA 92626 |
16 | */ | 16 | */ |
diff --git a/drivers/scsi/be2iscsi/be_iscsi.c b/drivers/scsi/be2iscsi/be_iscsi.c index b7391a3f9f0b..2f0700796842 100644 --- a/drivers/scsi/be2iscsi/be_iscsi.c +++ b/drivers/scsi/be2iscsi/be_iscsi.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * Copyright (C) 2005 - 2014 Emulex | 2 | * Copyright (C) 2005 - 2015 Avago Technologies |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or | 5 | * This program is free software; you can redistribute it and/or |
@@ -7,12 +7,12 @@ | |||
7 | * as published by the Free Software Foundation. The full GNU General | 7 | * as published by the Free Software Foundation. The full GNU General |
8 | * Public License is included in this distribution in the file called COPYING. | 8 | * Public License is included in this distribution in the file called COPYING. |
9 | * | 9 | * |
10 | * Written by: Jayamohan Kallickal (jayamohan.kallickal@emulex.com) | 10 | * Written by: Jayamohan Kallickal (jayamohan.kallickal@avagotech.com) |
11 | * | 11 | * |
12 | * Contact Information: | 12 | * Contact Information: |
13 | * linux-drivers@emulex.com | 13 | * linux-drivers@avagotech.com |
14 | * | 14 | * |
15 | * Emulex | 15 | * Avago Technologies |
16 | * 3333 Susan Street | 16 | * 3333 Susan Street |
17 | * Costa Mesa, CA 92626 | 17 | * Costa Mesa, CA 92626 |
18 | */ | 18 | */ |
diff --git a/drivers/scsi/be2iscsi/be_iscsi.h b/drivers/scsi/be2iscsi/be_iscsi.h index e0b3b2d1f27a..0c84e1c0763a 100644 --- a/drivers/scsi/be2iscsi/be_iscsi.h +++ b/drivers/scsi/be2iscsi/be_iscsi.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * Copyright (C) 2005 - 2014 Emulex | 2 | * Copyright (C) 2005 - 2015 Avago Technologies |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or | 5 | * This program is free software; you can redistribute it and/or |
@@ -7,12 +7,12 @@ | |||
7 | * as published by the Free Software Foundation. The full GNU General | 7 | * as published by the Free Software Foundation. The full GNU General |
8 | * Public License is included in this distribution in the file called COPYING. | 8 | * Public License is included in this distribution in the file called COPYING. |
9 | * | 9 | * |
10 | * Written by: Jayamohan Kallickal (jayamohan.kallickal@emulex.com) | 10 | * Written by: Jayamohan Kallickal (jayamohan.kallickal@avagotech.com) |
11 | * | 11 | * |
12 | * Contact Information: | 12 | * Contact Information: |
13 | * linux-drivers@emulex.com | 13 | * linux-drivers@avagotech.com |
14 | * | 14 | * |
15 | * Emulex | 15 | * Avago Technologies |
16 | * 3333 Susan Street | 16 | * 3333 Susan Street |
17 | * Costa Mesa, CA 92626 | 17 | * Costa Mesa, CA 92626 |
18 | */ | 18 | */ |
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c index 923a2b5a2439..1f74760ce86c 100644 --- a/drivers/scsi/be2iscsi/be_main.c +++ b/drivers/scsi/be2iscsi/be_main.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * Copyright (C) 2005 - 2014 Emulex | 2 | * Copyright (C) 2005 - 2015 Avago Technologies |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or | 5 | * This program is free software; you can redistribute it and/or |
@@ -7,12 +7,12 @@ | |||
7 | * as published by the Free Software Foundation. The full GNU General | 7 | * as published by the Free Software Foundation. The full GNU General |
8 | * Public License is included in this distribution in the file called COPYING. | 8 | * Public License is included in this distribution in the file called COPYING. |
9 | * | 9 | * |
10 | * Written by: Jayamohan Kallickal (jayamohan.kallickal@emulex.com) | 10 | * Written by: Jayamohan Kallickal (jayamohan.kallickal@avagotech.com) |
11 | * | 11 | * |
12 | * Contact Information: | 12 | * Contact Information: |
13 | * linux-drivers@emulex.com | 13 | * linux-drivers@avagotech.com |
14 | * | 14 | * |
15 | * Emulex | 15 | * Avago Technologies |
16 | * 3333 Susan Street | 16 | * 3333 Susan Street |
17 | * Costa Mesa, CA 92626 | 17 | * Costa Mesa, CA 92626 |
18 | */ | 18 | */ |
@@ -50,7 +50,7 @@ static unsigned int enable_msix = 1; | |||
50 | 50 | ||
51 | MODULE_DESCRIPTION(DRV_DESC " " BUILD_STR); | 51 | MODULE_DESCRIPTION(DRV_DESC " " BUILD_STR); |
52 | MODULE_VERSION(BUILD_STR); | 52 | MODULE_VERSION(BUILD_STR); |
53 | MODULE_AUTHOR("Emulex Corporation"); | 53 | MODULE_AUTHOR("Avago Technologies"); |
54 | MODULE_LICENSE("GPL"); | 54 | MODULE_LICENSE("GPL"); |
55 | module_param(be_iopoll_budget, int, 0); | 55 | module_param(be_iopoll_budget, int, 0); |
56 | module_param(enable_msix, int, 0); | 56 | module_param(enable_msix, int, 0); |
@@ -552,7 +552,7 @@ MODULE_DEVICE_TABLE(pci, beiscsi_pci_id_table); | |||
552 | 552 | ||
553 | static struct scsi_host_template beiscsi_sht = { | 553 | static struct scsi_host_template beiscsi_sht = { |
554 | .module = THIS_MODULE, | 554 | .module = THIS_MODULE, |
555 | .name = "Emulex 10Gbe open-iscsi Initiator Driver", | 555 | .name = "Avago Technologies 10Gbe open-iscsi Initiator Driver", |
556 | .proc_name = DRV_NAME, | 556 | .proc_name = DRV_NAME, |
557 | .queuecommand = iscsi_queuecommand, | 557 | .queuecommand = iscsi_queuecommand, |
558 | .change_queue_depth = scsi_change_queue_depth, | 558 | .change_queue_depth = scsi_change_queue_depth, |
diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h index 7ee0ffc38514..e70ea26bbc2b 100644 --- a/drivers/scsi/be2iscsi/be_main.h +++ b/drivers/scsi/be2iscsi/be_main.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * Copyright (C) 2005 - 2014 Emulex | 2 | * Copyright (C) 2005 - 2015 Avago Technologies |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or | 5 | * This program is free software; you can redistribute it and/or |
@@ -7,12 +7,12 @@ | |||
7 | * as published by the Free Software Foundation. The full GNU General | 7 | * as published by the Free Software Foundation. The full GNU General |
8 | * Public License is included in this distribution in the file called COPYING. | 8 | * Public License is included in this distribution in the file called COPYING. |
9 | * | 9 | * |
10 | * Written by: Jayamohan Kallickal (jayamohan.kallickal@emulex.com) | 10 | * Written by: Jayamohan Kallickal (jayamohan.kallickal@avagotech.com) |
11 | * | 11 | * |
12 | * Contact Information: | 12 | * Contact Information: |
13 | * linux-drivers@emulex.com | 13 | * linux-drivers@avagotech.com |
14 | * | 14 | * |
15 | * Emulex | 15 | * Avago Technologies |
16 | * 3333 Susan Street | 16 | * 3333 Susan Street |
17 | * Costa Mesa, CA 92626 | 17 | * Costa Mesa, CA 92626 |
18 | */ | 18 | */ |
@@ -37,7 +37,7 @@ | |||
37 | 37 | ||
38 | #define DRV_NAME "be2iscsi" | 38 | #define DRV_NAME "be2iscsi" |
39 | #define BUILD_STR "10.4.114.0" | 39 | #define BUILD_STR "10.4.114.0" |
40 | #define BE_NAME "Emulex OneConnect" \ | 40 | #define BE_NAME "Avago Technologies OneConnect" \ |
41 | "Open-iSCSI Driver version" BUILD_STR | 41 | "Open-iSCSI Driver version" BUILD_STR |
42 | #define DRV_DESC BE_NAME " " "Driver" | 42 | #define DRV_DESC BE_NAME " " "Driver" |
43 | 43 | ||
diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c index 681d4e8f003a..c2c4d6975fb7 100644 --- a/drivers/scsi/be2iscsi/be_mgmt.c +++ b/drivers/scsi/be2iscsi/be_mgmt.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * Copyright (C) 2005 - 2014 Emulex | 2 | * Copyright (C) 2005 - 2015 Avago Technologies |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or | 5 | * This program is free software; you can redistribute it and/or |
@@ -7,12 +7,12 @@ | |||
7 | * as published by the Free Software Foundation. The full GNU General | 7 | * as published by the Free Software Foundation. The full GNU General |
8 | * Public License is included in this distribution in the file called COPYING. | 8 | * Public License is included in this distribution in the file called COPYING. |
9 | * | 9 | * |
10 | * Written by: Jayamohan Kallickal (jayamohan.kallickal@emulex.com) | 10 | * Written by: Jayamohan Kallickal (jayamohan.kallickal@avagotech.com) |
11 | * | 11 | * |
12 | * Contact Information: | 12 | * Contact Information: |
13 | * linux-drivers@emulex.com | 13 | * linux-drivers@avagotech.com |
14 | * | 14 | * |
15 | * Emulex | 15 | * Avago Technologies |
16 | * 3333 Susan Street | 16 | * 3333 Susan Street |
17 | * Costa Mesa, CA 92626 | 17 | * Costa Mesa, CA 92626 |
18 | */ | 18 | */ |
diff --git a/drivers/scsi/be2iscsi/be_mgmt.h b/drivers/scsi/be2iscsi/be_mgmt.h index bd81446936fc..9356b9a86b66 100644 --- a/drivers/scsi/be2iscsi/be_mgmt.h +++ b/drivers/scsi/be2iscsi/be_mgmt.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /** | 1 | /** |
2 | * Copyright (C) 2005 - 2014 Emulex | 2 | * Copyright (C) 2005 - 2015 Avago Technologies |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or | 5 | * This program is free software; you can redistribute it and/or |
@@ -7,12 +7,12 @@ | |||
7 | * as published by the Free Software Foundation. The full GNU General | 7 | * as published by the Free Software Foundation. The full GNU General |
8 | * Public License is included in this distribution in the file called COPYING. | 8 | * Public License is included in this distribution in the file called COPYING. |
9 | * | 9 | * |
10 | * Written by: Jayamohan Kallickal (jayamohan.kallickal@emulex.com) | 10 | * Written by: Jayamohan Kallickal (jayamohan.kallickal@avagotech.com) |
11 | * | 11 | * |
12 | * Contact Information: | 12 | * Contact Information: |
13 | * linux-drivers@emulex.com | 13 | * linux-drivers@avagotech.com |
14 | * | 14 | * |
15 | * Emulex | 15 | * Avago Technologies |
16 | * 3333 Susan Street | 16 | * 3333 Susan Street |
17 | * Costa Mesa, CA 92626 | 17 | * Costa Mesa, CA 92626 |
18 | */ | 18 | */ |
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index cb73cf9e9ba5..c140f99772ca 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c | |||
@@ -1130,25 +1130,6 @@ lpfc_release_scsi_buf(struct lpfc_hba *phba, struct lpfc_scsi_buf *psb) | |||
1130 | } | 1130 | } |
1131 | 1131 | ||
1132 | /** | 1132 | /** |
1133 | * lpfc_fcpcmd_to_iocb - copy the fcp_cmd data into the IOCB | ||
1134 | * @data: A pointer to the immediate command data portion of the IOCB. | ||
1135 | * @fcp_cmnd: The FCP Command that is provided by the SCSI layer. | ||
1136 | * | ||
1137 | * The routine copies the entire FCP command from @fcp_cmnd to @data while | ||
1138 | * byte swapping the data to big endian format for transmission on the wire. | ||
1139 | **/ | ||
1140 | static void | ||
1141 | lpfc_fcpcmd_to_iocb(uint8_t *data, struct fcp_cmnd *fcp_cmnd) | ||
1142 | { | ||
1143 | int i, j; | ||
1144 | |||
1145 | for (i = 0, j = 0; i < sizeof(struct fcp_cmnd); | ||
1146 | i += sizeof(uint32_t), j++) { | ||
1147 | ((uint32_t *)data)[j] = cpu_to_be32(((uint32_t *)fcp_cmnd)[j]); | ||
1148 | } | ||
1149 | } | ||
1150 | |||
1151 | /** | ||
1152 | * lpfc_scsi_prep_dma_buf_s3 - DMA mapping for scsi buffer to SLI3 IF spec | 1133 | * lpfc_scsi_prep_dma_buf_s3 - DMA mapping for scsi buffer to SLI3 IF spec |
1153 | * @phba: The Hba for which this call is being executed. | 1134 | * @phba: The Hba for which this call is being executed. |
1154 | * @lpfc_cmd: The scsi buffer which is going to be mapped. | 1135 | * @lpfc_cmd: The scsi buffer which is going to be mapped. |
@@ -1283,7 +1264,6 @@ lpfc_scsi_prep_dma_buf_s3(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd) | |||
1283 | * we need to set word 4 of IOCB here | 1264 | * we need to set word 4 of IOCB here |
1284 | */ | 1265 | */ |
1285 | iocb_cmd->un.fcpi.fcpi_parm = scsi_bufflen(scsi_cmnd); | 1266 | iocb_cmd->un.fcpi.fcpi_parm = scsi_bufflen(scsi_cmnd); |
1286 | lpfc_fcpcmd_to_iocb(iocb_cmd->unsli3.fcp_ext.icd, fcp_cmnd); | ||
1287 | return 0; | 1267 | return 0; |
1288 | } | 1268 | } |
1289 | 1269 | ||
@@ -4147,6 +4127,24 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, | |||
4147 | } | 4127 | } |
4148 | 4128 | ||
4149 | /** | 4129 | /** |
4130 | * lpfc_fcpcmd_to_iocb - copy the fcp_cmd data into the IOCB | ||
4131 | * @data: A pointer to the immediate command data portion of the IOCB. | ||
4132 | * @fcp_cmnd: The FCP Command that is provided by the SCSI layer. | ||
4133 | * | ||
4134 | * The routine copies the entire FCP command from @fcp_cmnd to @data while | ||
4135 | * byte swapping the data to big endian format for transmission on the wire. | ||
4136 | **/ | ||
4137 | static void | ||
4138 | lpfc_fcpcmd_to_iocb(uint8_t *data, struct fcp_cmnd *fcp_cmnd) | ||
4139 | { | ||
4140 | int i, j; | ||
4141 | for (i = 0, j = 0; i < sizeof(struct fcp_cmnd); | ||
4142 | i += sizeof(uint32_t), j++) { | ||
4143 | ((uint32_t *)data)[j] = cpu_to_be32(((uint32_t *)fcp_cmnd)[j]); | ||
4144 | } | ||
4145 | } | ||
4146 | |||
4147 | /** | ||
4150 | * lpfc_scsi_prep_cmnd - Wrapper func for convert scsi cmnd to FCP info unit | 4148 | * lpfc_scsi_prep_cmnd - Wrapper func for convert scsi cmnd to FCP info unit |
4151 | * @vport: The virtual port for which this call is being executed. | 4149 | * @vport: The virtual port for which this call is being executed. |
4152 | * @lpfc_cmd: The scsi command which needs to send. | 4150 | * @lpfc_cmd: The scsi command which needs to send. |
@@ -4225,6 +4223,9 @@ lpfc_scsi_prep_cmnd(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd, | |||
4225 | fcp_cmnd->fcpCntl3 = 0; | 4223 | fcp_cmnd->fcpCntl3 = 0; |
4226 | phba->fc4ControlRequests++; | 4224 | phba->fc4ControlRequests++; |
4227 | } | 4225 | } |
4226 | if (phba->sli_rev == 3 && | ||
4227 | !(phba->sli3_options & LPFC_SLI3_BG_ENABLED)) | ||
4228 | lpfc_fcpcmd_to_iocb(iocb_cmd->unsli3.fcp_ext.icd, fcp_cmnd); | ||
4228 | /* | 4229 | /* |
4229 | * Finish initializing those IOCB fields that are independent | 4230 | * Finish initializing those IOCB fields that are independent |
4230 | * of the scsi_cmnd request_buffer | 4231 | * of the scsi_cmnd request_buffer |
diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c index 68c2002e78bf..5c9e680aa375 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c | |||
@@ -1020,8 +1020,7 @@ static void tcm_qla2xxx_depend_tpg(struct work_struct *work) | |||
1020 | struct se_portal_group *se_tpg = &base_tpg->se_tpg; | 1020 | struct se_portal_group *se_tpg = &base_tpg->se_tpg; |
1021 | struct scsi_qla_host *base_vha = base_tpg->lport->qla_vha; | 1021 | struct scsi_qla_host *base_vha = base_tpg->lport->qla_vha; |
1022 | 1022 | ||
1023 | if (!configfs_depend_item(se_tpg->se_tpg_tfo->tf_subsys, | 1023 | if (!target_depend_item(&se_tpg->tpg_group.cg_item)) { |
1024 | &se_tpg->tpg_group.cg_item)) { | ||
1025 | atomic_set(&base_tpg->lport_tpg_enabled, 1); | 1024 | atomic_set(&base_tpg->lport_tpg_enabled, 1); |
1026 | qlt_enable_vha(base_vha); | 1025 | qlt_enable_vha(base_vha); |
1027 | } | 1026 | } |
@@ -1037,8 +1036,7 @@ static void tcm_qla2xxx_undepend_tpg(struct work_struct *work) | |||
1037 | 1036 | ||
1038 | if (!qlt_stop_phase1(base_vha->vha_tgt.qla_tgt)) { | 1037 | if (!qlt_stop_phase1(base_vha->vha_tgt.qla_tgt)) { |
1039 | atomic_set(&base_tpg->lport_tpg_enabled, 0); | 1038 | atomic_set(&base_tpg->lport_tpg_enabled, 0); |
1040 | configfs_undepend_item(se_tpg->se_tpg_tfo->tf_subsys, | 1039 | target_undepend_item(&se_tpg->tpg_group.cg_item); |
1041 | &se_tpg->tpg_group.cg_item); | ||
1042 | } | 1040 | } |
1043 | complete(&base_tpg->tpg_base_comp); | 1041 | complete(&base_tpg->tpg_base_comp); |
1044 | } | 1042 | } |
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 79beebf53302..7f9d65fe4fd9 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -1600,6 +1600,7 @@ static unsigned int sd_completed_bytes(struct scsi_cmnd *scmd) | |||
1600 | { | 1600 | { |
1601 | u64 start_lba = blk_rq_pos(scmd->request); | 1601 | u64 start_lba = blk_rq_pos(scmd->request); |
1602 | u64 end_lba = blk_rq_pos(scmd->request) + (scsi_bufflen(scmd) / 512); | 1602 | u64 end_lba = blk_rq_pos(scmd->request) + (scsi_bufflen(scmd) / 512); |
1603 | u64 factor = scmd->device->sector_size / 512; | ||
1603 | u64 bad_lba; | 1604 | u64 bad_lba; |
1604 | int info_valid; | 1605 | int info_valid; |
1605 | /* | 1606 | /* |
@@ -1621,16 +1622,9 @@ static unsigned int sd_completed_bytes(struct scsi_cmnd *scmd) | |||
1621 | if (scsi_bufflen(scmd) <= scmd->device->sector_size) | 1622 | if (scsi_bufflen(scmd) <= scmd->device->sector_size) |
1622 | return 0; | 1623 | return 0; |
1623 | 1624 | ||
1624 | if (scmd->device->sector_size < 512) { | 1625 | /* be careful ... don't want any overflows */ |
1625 | /* only legitimate sector_size here is 256 */ | 1626 | do_div(start_lba, factor); |
1626 | start_lba <<= 1; | 1627 | do_div(end_lba, factor); |
1627 | end_lba <<= 1; | ||
1628 | } else { | ||
1629 | /* be careful ... don't want any overflows */ | ||
1630 | unsigned int factor = scmd->device->sector_size / 512; | ||
1631 | do_div(start_lba, factor); | ||
1632 | do_div(end_lba, factor); | ||
1633 | } | ||
1634 | 1628 | ||
1635 | /* The bad lba was reported incorrectly, we have no idea where | 1629 | /* The bad lba was reported incorrectly, we have no idea where |
1636 | * the error is. | 1630 | * the error is. |
@@ -2188,8 +2182,7 @@ got_data: | |||
2188 | if (sector_size != 512 && | 2182 | if (sector_size != 512 && |
2189 | sector_size != 1024 && | 2183 | sector_size != 1024 && |
2190 | sector_size != 2048 && | 2184 | sector_size != 2048 && |
2191 | sector_size != 4096 && | 2185 | sector_size != 4096) { |
2192 | sector_size != 256) { | ||
2193 | sd_printk(KERN_NOTICE, sdkp, "Unsupported sector size %d.\n", | 2186 | sd_printk(KERN_NOTICE, sdkp, "Unsupported sector size %d.\n", |
2194 | sector_size); | 2187 | sector_size); |
2195 | /* | 2188 | /* |
@@ -2244,8 +2237,6 @@ got_data: | |||
2244 | sdkp->capacity <<= 2; | 2237 | sdkp->capacity <<= 2; |
2245 | else if (sector_size == 1024) | 2238 | else if (sector_size == 1024) |
2246 | sdkp->capacity <<= 1; | 2239 | sdkp->capacity <<= 1; |
2247 | else if (sector_size == 256) | ||
2248 | sdkp->capacity >>= 1; | ||
2249 | 2240 | ||
2250 | blk_queue_physical_block_size(sdp->request_queue, | 2241 | blk_queue_physical_block_size(sdp->request_queue, |
2251 | sdkp->physical_block_size); | 2242 | sdkp->physical_block_size); |
diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index d9dad90344d5..3c6584ff65c1 100644 --- a/drivers/scsi/storvsc_drv.c +++ b/drivers/scsi/storvsc_drv.c | |||
@@ -1600,8 +1600,7 @@ static int storvsc_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *scmnd) | |||
1600 | break; | 1600 | break; |
1601 | default: | 1601 | default: |
1602 | vm_srb->data_in = UNKNOWN_TYPE; | 1602 | vm_srb->data_in = UNKNOWN_TYPE; |
1603 | vm_srb->win8_extension.srb_flags |= (SRB_FLAGS_DATA_IN | | 1603 | vm_srb->win8_extension.srb_flags |= SRB_FLAGS_NO_DATA_TRANSFER; |
1604 | SRB_FLAGS_DATA_OUT); | ||
1605 | break; | 1604 | break; |
1606 | } | 1605 | } |
1607 | 1606 | ||
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/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index 34871a628b11..74e6114ff18f 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c | |||
@@ -230,7 +230,7 @@ int iscsit_access_np(struct iscsi_np *np, struct iscsi_portal_group *tpg) | |||
230 | * Here we serialize access across the TIQN+TPG Tuple. | 230 | * Here we serialize access across the TIQN+TPG Tuple. |
231 | */ | 231 | */ |
232 | ret = down_interruptible(&tpg->np_login_sem); | 232 | ret = down_interruptible(&tpg->np_login_sem); |
233 | if ((ret != 0) || signal_pending(current)) | 233 | if (ret != 0) |
234 | return -1; | 234 | return -1; |
235 | 235 | ||
236 | spin_lock_bh(&tpg->tpg_state_lock); | 236 | spin_lock_bh(&tpg->tpg_state_lock); |
diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c index 8ce94ff744e6..70d799dfab03 100644 --- a/drivers/target/iscsi/iscsi_target_login.c +++ b/drivers/target/iscsi/iscsi_target_login.c | |||
@@ -346,6 +346,7 @@ static int iscsi_login_zero_tsih_s1( | |||
346 | if (IS_ERR(sess->se_sess)) { | 346 | if (IS_ERR(sess->se_sess)) { |
347 | iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR, | 347 | iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_TARGET_ERR, |
348 | ISCSI_LOGIN_STATUS_NO_RESOURCES); | 348 | ISCSI_LOGIN_STATUS_NO_RESOURCES); |
349 | kfree(sess->sess_ops); | ||
349 | kfree(sess); | 350 | kfree(sess); |
350 | return -ENOMEM; | 351 | return -ENOMEM; |
351 | } | 352 | } |
diff --git a/drivers/target/iscsi/iscsi_target_tpg.c b/drivers/target/iscsi/iscsi_target_tpg.c index e8a240818353..5e3295fe404d 100644 --- a/drivers/target/iscsi/iscsi_target_tpg.c +++ b/drivers/target/iscsi/iscsi_target_tpg.c | |||
@@ -161,10 +161,7 @@ struct iscsi_portal_group *iscsit_get_tpg_from_np( | |||
161 | int iscsit_get_tpg( | 161 | int iscsit_get_tpg( |
162 | struct iscsi_portal_group *tpg) | 162 | struct iscsi_portal_group *tpg) |
163 | { | 163 | { |
164 | int ret; | 164 | return mutex_lock_interruptible(&tpg->tpg_access_lock); |
165 | |||
166 | ret = mutex_lock_interruptible(&tpg->tpg_access_lock); | ||
167 | return ((ret != 0) || signal_pending(current)) ? -1 : 0; | ||
168 | } | 165 | } |
169 | 166 | ||
170 | void iscsit_put_tpg(struct iscsi_portal_group *tpg) | 167 | void iscsit_put_tpg(struct iscsi_portal_group *tpg) |
diff --git a/drivers/target/target_core_alua.c b/drivers/target/target_core_alua.c index 75cbde1f7c5b..4f8d4d459aa4 100644 --- a/drivers/target/target_core_alua.c +++ b/drivers/target/target_core_alua.c | |||
@@ -704,7 +704,7 @@ target_alua_state_check(struct se_cmd *cmd) | |||
704 | 704 | ||
705 | if (dev->se_hba->hba_flags & HBA_FLAGS_INTERNAL_USE) | 705 | if (dev->se_hba->hba_flags & HBA_FLAGS_INTERNAL_USE) |
706 | return 0; | 706 | return 0; |
707 | if (dev->transport->transport_type == TRANSPORT_PLUGIN_PHBA_PDEV) | 707 | if (dev->transport->transport_flags & TRANSPORT_FLAG_PASSTHROUGH) |
708 | return 0; | 708 | return 0; |
709 | 709 | ||
710 | if (!port) | 710 | if (!port) |
@@ -2377,7 +2377,7 @@ ssize_t core_alua_store_secondary_write_metadata( | |||
2377 | 2377 | ||
2378 | int core_setup_alua(struct se_device *dev) | 2378 | int core_setup_alua(struct se_device *dev) |
2379 | { | 2379 | { |
2380 | if (dev->transport->transport_type != TRANSPORT_PLUGIN_PHBA_PDEV && | 2380 | if (!(dev->transport->transport_flags & TRANSPORT_FLAG_PASSTHROUGH) && |
2381 | !(dev->se_hba->hba_flags & HBA_FLAGS_INTERNAL_USE)) { | 2381 | !(dev->se_hba->hba_flags & HBA_FLAGS_INTERNAL_USE)) { |
2382 | struct t10_alua_lu_gp_member *lu_gp_mem; | 2382 | struct t10_alua_lu_gp_member *lu_gp_mem; |
2383 | 2383 | ||
diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c index ddaf76a4ac2a..e7b0430a0575 100644 --- a/drivers/target/target_core_configfs.c +++ b/drivers/target/target_core_configfs.c | |||
@@ -212,10 +212,6 @@ static struct config_group *target_core_register_fabric( | |||
212 | 212 | ||
213 | pr_debug("Target_Core_ConfigFS: REGISTER -> Allocated Fabric:" | 213 | pr_debug("Target_Core_ConfigFS: REGISTER -> Allocated Fabric:" |
214 | " %s\n", tf->tf_group.cg_item.ci_name); | 214 | " %s\n", tf->tf_group.cg_item.ci_name); |
215 | /* | ||
216 | * Setup tf_ops.tf_subsys pointer for usage with configfs_depend_item() | ||
217 | */ | ||
218 | tf->tf_ops.tf_subsys = tf->tf_subsys; | ||
219 | tf->tf_fabric = &tf->tf_group.cg_item; | 215 | tf->tf_fabric = &tf->tf_group.cg_item; |
220 | pr_debug("Target_Core_ConfigFS: REGISTER -> Set tf->tf_fabric" | 216 | pr_debug("Target_Core_ConfigFS: REGISTER -> Set tf->tf_fabric" |
221 | " for %s\n", name); | 217 | " for %s\n", name); |
@@ -291,10 +287,17 @@ static struct configfs_subsystem target_core_fabrics = { | |||
291 | }, | 287 | }, |
292 | }; | 288 | }; |
293 | 289 | ||
294 | struct configfs_subsystem *target_core_subsystem[] = { | 290 | int target_depend_item(struct config_item *item) |
295 | &target_core_fabrics, | 291 | { |
296 | NULL, | 292 | return configfs_depend_item(&target_core_fabrics, item); |
297 | }; | 293 | } |
294 | EXPORT_SYMBOL(target_depend_item); | ||
295 | |||
296 | void target_undepend_item(struct config_item *item) | ||
297 | { | ||
298 | return configfs_undepend_item(&target_core_fabrics, item); | ||
299 | } | ||
300 | EXPORT_SYMBOL(target_undepend_item); | ||
298 | 301 | ||
299 | /*############################################################################## | 302 | /*############################################################################## |
300 | // Start functions called by external Target Fabrics Modules | 303 | // Start functions called by external Target Fabrics Modules |
@@ -467,7 +470,6 @@ int target_register_template(const struct target_core_fabric_ops *fo) | |||
467 | * struct target_fabric_configfs->tf_cit_tmpl | 470 | * struct target_fabric_configfs->tf_cit_tmpl |
468 | */ | 471 | */ |
469 | tf->tf_module = fo->module; | 472 | tf->tf_module = fo->module; |
470 | tf->tf_subsys = target_core_subsystem[0]; | ||
471 | snprintf(tf->tf_name, TARGET_FABRIC_NAME_SIZE, "%s", fo->name); | 473 | snprintf(tf->tf_name, TARGET_FABRIC_NAME_SIZE, "%s", fo->name); |
472 | 474 | ||
473 | tf->tf_ops = *fo; | 475 | tf->tf_ops = *fo; |
@@ -809,7 +811,7 @@ static ssize_t target_core_dev_pr_show_attr_res_holder(struct se_device *dev, | |||
809 | { | 811 | { |
810 | int ret; | 812 | int ret; |
811 | 813 | ||
812 | if (dev->transport->transport_type == TRANSPORT_PLUGIN_PHBA_PDEV) | 814 | if (dev->transport->transport_flags & TRANSPORT_FLAG_PASSTHROUGH) |
813 | return sprintf(page, "Passthrough\n"); | 815 | return sprintf(page, "Passthrough\n"); |
814 | 816 | ||
815 | spin_lock(&dev->dev_reservation_lock); | 817 | spin_lock(&dev->dev_reservation_lock); |
@@ -960,7 +962,7 @@ SE_DEV_PR_ATTR_RO(res_pr_type); | |||
960 | static ssize_t target_core_dev_pr_show_attr_res_type( | 962 | static ssize_t target_core_dev_pr_show_attr_res_type( |
961 | struct se_device *dev, char *page) | 963 | struct se_device *dev, char *page) |
962 | { | 964 | { |
963 | if (dev->transport->transport_type == TRANSPORT_PLUGIN_PHBA_PDEV) | 965 | if (dev->transport->transport_flags & TRANSPORT_FLAG_PASSTHROUGH) |
964 | return sprintf(page, "SPC_PASSTHROUGH\n"); | 966 | return sprintf(page, "SPC_PASSTHROUGH\n"); |
965 | else if (dev->dev_reservation_flags & DRF_SPC2_RESERVATIONS) | 967 | else if (dev->dev_reservation_flags & DRF_SPC2_RESERVATIONS) |
966 | return sprintf(page, "SPC2_RESERVATIONS\n"); | 968 | return sprintf(page, "SPC2_RESERVATIONS\n"); |
@@ -973,7 +975,7 @@ SE_DEV_PR_ATTR_RO(res_type); | |||
973 | static ssize_t target_core_dev_pr_show_attr_res_aptpl_active( | 975 | static ssize_t target_core_dev_pr_show_attr_res_aptpl_active( |
974 | struct se_device *dev, char *page) | 976 | struct se_device *dev, char *page) |
975 | { | 977 | { |
976 | if (dev->transport->transport_type == TRANSPORT_PLUGIN_PHBA_PDEV) | 978 | if (dev->transport->transport_flags & TRANSPORT_FLAG_PASSTHROUGH) |
977 | return 0; | 979 | return 0; |
978 | 980 | ||
979 | return sprintf(page, "APTPL Bit Status: %s\n", | 981 | return sprintf(page, "APTPL Bit Status: %s\n", |
@@ -988,7 +990,7 @@ SE_DEV_PR_ATTR_RO(res_aptpl_active); | |||
988 | static ssize_t target_core_dev_pr_show_attr_res_aptpl_metadata( | 990 | static ssize_t target_core_dev_pr_show_attr_res_aptpl_metadata( |
989 | struct se_device *dev, char *page) | 991 | struct se_device *dev, char *page) |
990 | { | 992 | { |
991 | if (dev->transport->transport_type == TRANSPORT_PLUGIN_PHBA_PDEV) | 993 | if (dev->transport->transport_flags & TRANSPORT_FLAG_PASSTHROUGH) |
992 | return 0; | 994 | return 0; |
993 | 995 | ||
994 | return sprintf(page, "Ready to process PR APTPL metadata..\n"); | 996 | return sprintf(page, "Ready to process PR APTPL metadata..\n"); |
@@ -1035,7 +1037,7 @@ static ssize_t target_core_dev_pr_store_attr_res_aptpl_metadata( | |||
1035 | u16 port_rpti = 0, tpgt = 0; | 1037 | u16 port_rpti = 0, tpgt = 0; |
1036 | u8 type = 0, scope; | 1038 | u8 type = 0, scope; |
1037 | 1039 | ||
1038 | if (dev->transport->transport_type == TRANSPORT_PLUGIN_PHBA_PDEV) | 1040 | if (dev->transport->transport_flags & TRANSPORT_FLAG_PASSTHROUGH) |
1039 | return 0; | 1041 | return 0; |
1040 | if (dev->dev_reservation_flags & DRF_SPC2_RESERVATIONS) | 1042 | if (dev->dev_reservation_flags & DRF_SPC2_RESERVATIONS) |
1041 | return 0; | 1043 | return 0; |
@@ -2870,7 +2872,7 @@ static int __init target_core_init_configfs(void) | |||
2870 | { | 2872 | { |
2871 | struct config_group *target_cg, *hba_cg = NULL, *alua_cg = NULL; | 2873 | struct config_group *target_cg, *hba_cg = NULL, *alua_cg = NULL; |
2872 | struct config_group *lu_gp_cg = NULL; | 2874 | struct config_group *lu_gp_cg = NULL; |
2873 | struct configfs_subsystem *subsys; | 2875 | struct configfs_subsystem *subsys = &target_core_fabrics; |
2874 | struct t10_alua_lu_gp *lu_gp; | 2876 | struct t10_alua_lu_gp *lu_gp; |
2875 | int ret; | 2877 | int ret; |
2876 | 2878 | ||
@@ -2878,7 +2880,6 @@ static int __init target_core_init_configfs(void) | |||
2878 | " Engine: %s on %s/%s on "UTS_RELEASE"\n", | 2880 | " Engine: %s on %s/%s on "UTS_RELEASE"\n", |
2879 | TARGET_CORE_VERSION, utsname()->sysname, utsname()->machine); | 2881 | TARGET_CORE_VERSION, utsname()->sysname, utsname()->machine); |
2880 | 2882 | ||
2881 | subsys = target_core_subsystem[0]; | ||
2882 | config_group_init(&subsys->su_group); | 2883 | config_group_init(&subsys->su_group); |
2883 | mutex_init(&subsys->su_mutex); | 2884 | mutex_init(&subsys->su_mutex); |
2884 | 2885 | ||
@@ -3008,13 +3009,10 @@ out_global: | |||
3008 | 3009 | ||
3009 | static void __exit target_core_exit_configfs(void) | 3010 | static void __exit target_core_exit_configfs(void) |
3010 | { | 3011 | { |
3011 | struct configfs_subsystem *subsys; | ||
3012 | struct config_group *hba_cg, *alua_cg, *lu_gp_cg; | 3012 | struct config_group *hba_cg, *alua_cg, *lu_gp_cg; |
3013 | struct config_item *item; | 3013 | struct config_item *item; |
3014 | int i; | 3014 | int i; |
3015 | 3015 | ||
3016 | subsys = target_core_subsystem[0]; | ||
3017 | |||
3018 | lu_gp_cg = &alua_lu_gps_group; | 3016 | lu_gp_cg = &alua_lu_gps_group; |
3019 | for (i = 0; lu_gp_cg->default_groups[i]; i++) { | 3017 | for (i = 0; lu_gp_cg->default_groups[i]; i++) { |
3020 | item = &lu_gp_cg->default_groups[i]->cg_item; | 3018 | item = &lu_gp_cg->default_groups[i]->cg_item; |
@@ -3045,8 +3043,8 @@ static void __exit target_core_exit_configfs(void) | |||
3045 | * We expect subsys->su_group.default_groups to be released | 3043 | * We expect subsys->su_group.default_groups to be released |
3046 | * by configfs subsystem provider logic.. | 3044 | * by configfs subsystem provider logic.. |
3047 | */ | 3045 | */ |
3048 | configfs_unregister_subsystem(subsys); | 3046 | configfs_unregister_subsystem(&target_core_fabrics); |
3049 | kfree(subsys->su_group.default_groups); | 3047 | kfree(target_core_fabrics.su_group.default_groups); |
3050 | 3048 | ||
3051 | core_alua_free_lu_gp(default_lu_gp); | 3049 | core_alua_free_lu_gp(default_lu_gp); |
3052 | default_lu_gp = NULL; | 3050 | default_lu_gp = NULL; |
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index 7faa6aef9a4d..ce5f768181ff 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/kthread.h> | 33 | #include <linux/kthread.h> |
34 | #include <linux/in.h> | 34 | #include <linux/in.h> |
35 | #include <linux/export.h> | 35 | #include <linux/export.h> |
36 | #include <asm/unaligned.h> | ||
36 | #include <net/sock.h> | 37 | #include <net/sock.h> |
37 | #include <net/tcp.h> | 38 | #include <net/tcp.h> |
38 | #include <scsi/scsi.h> | 39 | #include <scsi/scsi.h> |
@@ -527,7 +528,7 @@ static void core_export_port( | |||
527 | list_add_tail(&port->sep_list, &dev->dev_sep_list); | 528 | list_add_tail(&port->sep_list, &dev->dev_sep_list); |
528 | spin_unlock(&dev->se_port_lock); | 529 | spin_unlock(&dev->se_port_lock); |
529 | 530 | ||
530 | if (dev->transport->transport_type != TRANSPORT_PLUGIN_PHBA_PDEV && | 531 | if (!(dev->transport->transport_flags & TRANSPORT_FLAG_PASSTHROUGH) && |
531 | !(dev->se_hba->hba_flags & HBA_FLAGS_INTERNAL_USE)) { | 532 | !(dev->se_hba->hba_flags & HBA_FLAGS_INTERNAL_USE)) { |
532 | tg_pt_gp_mem = core_alua_allocate_tg_pt_gp_mem(port); | 533 | tg_pt_gp_mem = core_alua_allocate_tg_pt_gp_mem(port); |
533 | if (IS_ERR(tg_pt_gp_mem) || !tg_pt_gp_mem) { | 534 | if (IS_ERR(tg_pt_gp_mem) || !tg_pt_gp_mem) { |
@@ -1603,7 +1604,7 @@ int target_configure_device(struct se_device *dev) | |||
1603 | * anything virtual (IBLOCK, FILEIO, RAMDISK), but not for TCM/pSCSI | 1604 | * anything virtual (IBLOCK, FILEIO, RAMDISK), but not for TCM/pSCSI |
1604 | * passthrough because this is being provided by the backend LLD. | 1605 | * passthrough because this is being provided by the backend LLD. |
1605 | */ | 1606 | */ |
1606 | if (dev->transport->transport_type != TRANSPORT_PLUGIN_PHBA_PDEV) { | 1607 | if (!(dev->transport->transport_flags & TRANSPORT_FLAG_PASSTHROUGH)) { |
1607 | strncpy(&dev->t10_wwn.vendor[0], "LIO-ORG", 8); | 1608 | strncpy(&dev->t10_wwn.vendor[0], "LIO-ORG", 8); |
1608 | strncpy(&dev->t10_wwn.model[0], | 1609 | strncpy(&dev->t10_wwn.model[0], |
1609 | dev->transport->inquiry_prod, 16); | 1610 | dev->transport->inquiry_prod, 16); |
@@ -1707,3 +1708,76 @@ void core_dev_release_virtual_lun0(void) | |||
1707 | target_free_device(g_lun0_dev); | 1708 | target_free_device(g_lun0_dev); |
1708 | core_delete_hba(hba); | 1709 | core_delete_hba(hba); |
1709 | } | 1710 | } |
1711 | |||
1712 | /* | ||
1713 | * Common CDB parsing for kernel and user passthrough. | ||
1714 | */ | ||
1715 | sense_reason_t | ||
1716 | passthrough_parse_cdb(struct se_cmd *cmd, | ||
1717 | sense_reason_t (*exec_cmd)(struct se_cmd *cmd)) | ||
1718 | { | ||
1719 | unsigned char *cdb = cmd->t_task_cdb; | ||
1720 | |||
1721 | /* | ||
1722 | * Clear a lun set in the cdb if the initiator talking to use spoke | ||
1723 | * and old standards version, as we can't assume the underlying device | ||
1724 | * won't choke up on it. | ||
1725 | */ | ||
1726 | switch (cdb[0]) { | ||
1727 | case READ_10: /* SBC - RDProtect */ | ||
1728 | case READ_12: /* SBC - RDProtect */ | ||
1729 | case READ_16: /* SBC - RDProtect */ | ||
1730 | case SEND_DIAGNOSTIC: /* SPC - SELF-TEST Code */ | ||
1731 | case VERIFY: /* SBC - VRProtect */ | ||
1732 | case VERIFY_16: /* SBC - VRProtect */ | ||
1733 | case WRITE_VERIFY: /* SBC - VRProtect */ | ||
1734 | case WRITE_VERIFY_12: /* SBC - VRProtect */ | ||
1735 | case MAINTENANCE_IN: /* SPC - Parameter Data Format for SA RTPG */ | ||
1736 | break; | ||
1737 | default: | ||
1738 | cdb[1] &= 0x1f; /* clear logical unit number */ | ||
1739 | break; | ||
1740 | } | ||
1741 | |||
1742 | /* | ||
1743 | * For REPORT LUNS we always need to emulate the response, for everything | ||
1744 | * else, pass it up. | ||
1745 | */ | ||
1746 | if (cdb[0] == REPORT_LUNS) { | ||
1747 | cmd->execute_cmd = spc_emulate_report_luns; | ||
1748 | return TCM_NO_SENSE; | ||
1749 | } | ||
1750 | |||
1751 | /* Set DATA_CDB flag for ops that should have it */ | ||
1752 | switch (cdb[0]) { | ||
1753 | case READ_6: | ||
1754 | case READ_10: | ||
1755 | case READ_12: | ||
1756 | case READ_16: | ||
1757 | case WRITE_6: | ||
1758 | case WRITE_10: | ||
1759 | case WRITE_12: | ||
1760 | case WRITE_16: | ||
1761 | case WRITE_VERIFY: | ||
1762 | case WRITE_VERIFY_12: | ||
1763 | case 0x8e: /* WRITE_VERIFY_16 */ | ||
1764 | case COMPARE_AND_WRITE: | ||
1765 | case XDWRITEREAD_10: | ||
1766 | cmd->se_cmd_flags |= SCF_SCSI_DATA_CDB; | ||
1767 | break; | ||
1768 | case VARIABLE_LENGTH_CMD: | ||
1769 | switch (get_unaligned_be16(&cdb[8])) { | ||
1770 | case READ_32: | ||
1771 | case WRITE_32: | ||
1772 | case 0x0c: /* WRITE_VERIFY_32 */ | ||
1773 | case XDWRITEREAD_32: | ||
1774 | cmd->se_cmd_flags |= SCF_SCSI_DATA_CDB; | ||
1775 | break; | ||
1776 | } | ||
1777 | } | ||
1778 | |||
1779 | cmd->execute_cmd = exec_cmd; | ||
1780 | |||
1781 | return TCM_NO_SENSE; | ||
1782 | } | ||
1783 | EXPORT_SYMBOL(passthrough_parse_cdb); | ||
diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c index f7e6e51aed36..3f27bfd816d8 100644 --- a/drivers/target/target_core_file.c +++ b/drivers/target/target_core_file.c | |||
@@ -958,7 +958,6 @@ static struct se_subsystem_api fileio_template = { | |||
958 | .inquiry_prod = "FILEIO", | 958 | .inquiry_prod = "FILEIO", |
959 | .inquiry_rev = FD_VERSION, | 959 | .inquiry_rev = FD_VERSION, |
960 | .owner = THIS_MODULE, | 960 | .owner = THIS_MODULE, |
961 | .transport_type = TRANSPORT_PLUGIN_VHBA_PDEV, | ||
962 | .attach_hba = fd_attach_hba, | 961 | .attach_hba = fd_attach_hba, |
963 | .detach_hba = fd_detach_hba, | 962 | .detach_hba = fd_detach_hba, |
964 | .alloc_device = fd_alloc_device, | 963 | .alloc_device = fd_alloc_device, |
diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c index 1b7947c2510f..8c965683789f 100644 --- a/drivers/target/target_core_iblock.c +++ b/drivers/target/target_core_iblock.c | |||
@@ -904,7 +904,6 @@ static struct se_subsystem_api iblock_template = { | |||
904 | .inquiry_prod = "IBLOCK", | 904 | .inquiry_prod = "IBLOCK", |
905 | .inquiry_rev = IBLOCK_VERSION, | 905 | .inquiry_rev = IBLOCK_VERSION, |
906 | .owner = THIS_MODULE, | 906 | .owner = THIS_MODULE, |
907 | .transport_type = TRANSPORT_PLUGIN_VHBA_PDEV, | ||
908 | .attach_hba = iblock_attach_hba, | 907 | .attach_hba = iblock_attach_hba, |
909 | .detach_hba = iblock_detach_hba, | 908 | .detach_hba = iblock_detach_hba, |
910 | .alloc_device = iblock_alloc_device, | 909 | .alloc_device = iblock_alloc_device, |
diff --git a/drivers/target/target_core_internal.h b/drivers/target/target_core_internal.h index 874a9bc988d8..68bd7f5d9f73 100644 --- a/drivers/target/target_core_internal.h +++ b/drivers/target/target_core_internal.h | |||
@@ -4,9 +4,6 @@ | |||
4 | /* target_core_alua.c */ | 4 | /* target_core_alua.c */ |
5 | extern struct t10_alua_lu_gp *default_lu_gp; | 5 | extern struct t10_alua_lu_gp *default_lu_gp; |
6 | 6 | ||
7 | /* target_core_configfs.c */ | ||
8 | extern struct configfs_subsystem *target_core_subsystem[]; | ||
9 | |||
10 | /* target_core_device.c */ | 7 | /* target_core_device.c */ |
11 | extern struct mutex g_device_mutex; | 8 | extern struct mutex g_device_mutex; |
12 | extern struct list_head g_device_list; | 9 | extern struct list_head g_device_list; |
diff --git a/drivers/target/target_core_pr.c b/drivers/target/target_core_pr.c index c1aa9655e96e..a15411c79ae9 100644 --- a/drivers/target/target_core_pr.c +++ b/drivers/target/target_core_pr.c | |||
@@ -1367,41 +1367,26 @@ void core_scsi3_free_all_registrations( | |||
1367 | 1367 | ||
1368 | static int core_scsi3_tpg_depend_item(struct se_portal_group *tpg) | 1368 | static int core_scsi3_tpg_depend_item(struct se_portal_group *tpg) |
1369 | { | 1369 | { |
1370 | return configfs_depend_item(tpg->se_tpg_tfo->tf_subsys, | 1370 | return target_depend_item(&tpg->tpg_group.cg_item); |
1371 | &tpg->tpg_group.cg_item); | ||
1372 | } | 1371 | } |
1373 | 1372 | ||
1374 | static void core_scsi3_tpg_undepend_item(struct se_portal_group *tpg) | 1373 | static void core_scsi3_tpg_undepend_item(struct se_portal_group *tpg) |
1375 | { | 1374 | { |
1376 | configfs_undepend_item(tpg->se_tpg_tfo->tf_subsys, | 1375 | target_undepend_item(&tpg->tpg_group.cg_item); |
1377 | &tpg->tpg_group.cg_item); | ||
1378 | |||
1379 | atomic_dec_mb(&tpg->tpg_pr_ref_count); | 1376 | atomic_dec_mb(&tpg->tpg_pr_ref_count); |
1380 | } | 1377 | } |
1381 | 1378 | ||
1382 | static int core_scsi3_nodeacl_depend_item(struct se_node_acl *nacl) | 1379 | static int core_scsi3_nodeacl_depend_item(struct se_node_acl *nacl) |
1383 | { | 1380 | { |
1384 | struct se_portal_group *tpg = nacl->se_tpg; | ||
1385 | |||
1386 | if (nacl->dynamic_node_acl) | 1381 | if (nacl->dynamic_node_acl) |
1387 | return 0; | 1382 | return 0; |
1388 | 1383 | return target_depend_item(&nacl->acl_group.cg_item); | |
1389 | return configfs_depend_item(tpg->se_tpg_tfo->tf_subsys, | ||
1390 | &nacl->acl_group.cg_item); | ||
1391 | } | 1384 | } |
1392 | 1385 | ||
1393 | static void core_scsi3_nodeacl_undepend_item(struct se_node_acl *nacl) | 1386 | static void core_scsi3_nodeacl_undepend_item(struct se_node_acl *nacl) |
1394 | { | 1387 | { |
1395 | struct se_portal_group *tpg = nacl->se_tpg; | 1388 | if (!nacl->dynamic_node_acl) |
1396 | 1389 | target_undepend_item(&nacl->acl_group.cg_item); | |
1397 | if (nacl->dynamic_node_acl) { | ||
1398 | atomic_dec_mb(&nacl->acl_pr_ref_count); | ||
1399 | return; | ||
1400 | } | ||
1401 | |||
1402 | configfs_undepend_item(tpg->se_tpg_tfo->tf_subsys, | ||
1403 | &nacl->acl_group.cg_item); | ||
1404 | |||
1405 | atomic_dec_mb(&nacl->acl_pr_ref_count); | 1390 | atomic_dec_mb(&nacl->acl_pr_ref_count); |
1406 | } | 1391 | } |
1407 | 1392 | ||
@@ -1419,8 +1404,7 @@ static int core_scsi3_lunacl_depend_item(struct se_dev_entry *se_deve) | |||
1419 | nacl = lun_acl->se_lun_nacl; | 1404 | nacl = lun_acl->se_lun_nacl; |
1420 | tpg = nacl->se_tpg; | 1405 | tpg = nacl->se_tpg; |
1421 | 1406 | ||
1422 | return configfs_depend_item(tpg->se_tpg_tfo->tf_subsys, | 1407 | return target_depend_item(&lun_acl->se_lun_group.cg_item); |
1423 | &lun_acl->se_lun_group.cg_item); | ||
1424 | } | 1408 | } |
1425 | 1409 | ||
1426 | static void core_scsi3_lunacl_undepend_item(struct se_dev_entry *se_deve) | 1410 | static void core_scsi3_lunacl_undepend_item(struct se_dev_entry *se_deve) |
@@ -1438,9 +1422,7 @@ static void core_scsi3_lunacl_undepend_item(struct se_dev_entry *se_deve) | |||
1438 | nacl = lun_acl->se_lun_nacl; | 1422 | nacl = lun_acl->se_lun_nacl; |
1439 | tpg = nacl->se_tpg; | 1423 | tpg = nacl->se_tpg; |
1440 | 1424 | ||
1441 | configfs_undepend_item(tpg->se_tpg_tfo->tf_subsys, | 1425 | target_undepend_item(&lun_acl->se_lun_group.cg_item); |
1442 | &lun_acl->se_lun_group.cg_item); | ||
1443 | |||
1444 | atomic_dec_mb(&se_deve->pr_ref_count); | 1426 | atomic_dec_mb(&se_deve->pr_ref_count); |
1445 | } | 1427 | } |
1446 | 1428 | ||
@@ -4111,7 +4093,7 @@ target_check_reservation(struct se_cmd *cmd) | |||
4111 | return 0; | 4093 | return 0; |
4112 | if (dev->se_hba->hba_flags & HBA_FLAGS_INTERNAL_USE) | 4094 | if (dev->se_hba->hba_flags & HBA_FLAGS_INTERNAL_USE) |
4113 | return 0; | 4095 | return 0; |
4114 | if (dev->transport->transport_type == TRANSPORT_PLUGIN_PHBA_PDEV) | 4096 | if (dev->transport->transport_flags & TRANSPORT_FLAG_PASSTHROUGH) |
4115 | return 0; | 4097 | return 0; |
4116 | 4098 | ||
4117 | spin_lock(&dev->dev_reservation_lock); | 4099 | spin_lock(&dev->dev_reservation_lock); |
diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c index f6c954c4635f..ecc5eaef13d6 100644 --- a/drivers/target/target_core_pscsi.c +++ b/drivers/target/target_core_pscsi.c | |||
@@ -521,6 +521,7 @@ static int pscsi_configure_device(struct se_device *dev) | |||
521 | " pdv_host_id: %d\n", pdv->pdv_host_id); | 521 | " pdv_host_id: %d\n", pdv->pdv_host_id); |
522 | return -EINVAL; | 522 | return -EINVAL; |
523 | } | 523 | } |
524 | pdv->pdv_lld_host = sh; | ||
524 | } | 525 | } |
525 | } else { | 526 | } else { |
526 | if (phv->phv_mode == PHV_VIRTUAL_HOST_ID) { | 527 | if (phv->phv_mode == PHV_VIRTUAL_HOST_ID) { |
@@ -603,6 +604,8 @@ static void pscsi_free_device(struct se_device *dev) | |||
603 | if ((phv->phv_mode == PHV_LLD_SCSI_HOST_NO) && | 604 | if ((phv->phv_mode == PHV_LLD_SCSI_HOST_NO) && |
604 | (phv->phv_lld_host != NULL)) | 605 | (phv->phv_lld_host != NULL)) |
605 | scsi_host_put(phv->phv_lld_host); | 606 | scsi_host_put(phv->phv_lld_host); |
607 | else if (pdv->pdv_lld_host) | ||
608 | scsi_host_put(pdv->pdv_lld_host); | ||
606 | 609 | ||
607 | if ((sd->type == TYPE_DISK) || (sd->type == TYPE_ROM)) | 610 | if ((sd->type == TYPE_DISK) || (sd->type == TYPE_ROM)) |
608 | scsi_device_put(sd); | 611 | scsi_device_put(sd); |
@@ -970,64 +973,13 @@ fail: | |||
970 | return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | 973 | return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
971 | } | 974 | } |
972 | 975 | ||
973 | /* | ||
974 | * Clear a lun set in the cdb if the initiator talking to use spoke | ||
975 | * and old standards version, as we can't assume the underlying device | ||
976 | * won't choke up on it. | ||
977 | */ | ||
978 | static inline void pscsi_clear_cdb_lun(unsigned char *cdb) | ||
979 | { | ||
980 | switch (cdb[0]) { | ||
981 | case READ_10: /* SBC - RDProtect */ | ||
982 | case READ_12: /* SBC - RDProtect */ | ||
983 | case READ_16: /* SBC - RDProtect */ | ||
984 | case SEND_DIAGNOSTIC: /* SPC - SELF-TEST Code */ | ||
985 | case VERIFY: /* SBC - VRProtect */ | ||
986 | case VERIFY_16: /* SBC - VRProtect */ | ||
987 | case WRITE_VERIFY: /* SBC - VRProtect */ | ||
988 | case WRITE_VERIFY_12: /* SBC - VRProtect */ | ||
989 | case MAINTENANCE_IN: /* SPC - Parameter Data Format for SA RTPG */ | ||
990 | break; | ||
991 | default: | ||
992 | cdb[1] &= 0x1f; /* clear logical unit number */ | ||
993 | break; | ||
994 | } | ||
995 | } | ||
996 | |||
997 | static sense_reason_t | 976 | static sense_reason_t |
998 | pscsi_parse_cdb(struct se_cmd *cmd) | 977 | pscsi_parse_cdb(struct se_cmd *cmd) |
999 | { | 978 | { |
1000 | unsigned char *cdb = cmd->t_task_cdb; | ||
1001 | |||
1002 | if (cmd->se_cmd_flags & SCF_BIDI) | 979 | if (cmd->se_cmd_flags & SCF_BIDI) |
1003 | return TCM_UNSUPPORTED_SCSI_OPCODE; | 980 | return TCM_UNSUPPORTED_SCSI_OPCODE; |
1004 | 981 | ||
1005 | pscsi_clear_cdb_lun(cdb); | 982 | return passthrough_parse_cdb(cmd, pscsi_execute_cmd); |
1006 | |||
1007 | /* | ||
1008 | * For REPORT LUNS we always need to emulate the response, for everything | ||
1009 | * else the default for pSCSI is to pass the command to the underlying | ||
1010 | * LLD / physical hardware. | ||
1011 | */ | ||
1012 | switch (cdb[0]) { | ||
1013 | case REPORT_LUNS: | ||
1014 | cmd->execute_cmd = spc_emulate_report_luns; | ||
1015 | return 0; | ||
1016 | case READ_6: | ||
1017 | case READ_10: | ||
1018 | case READ_12: | ||
1019 | case READ_16: | ||
1020 | case WRITE_6: | ||
1021 | case WRITE_10: | ||
1022 | case WRITE_12: | ||
1023 | case WRITE_16: | ||
1024 | case WRITE_VERIFY: | ||
1025 | cmd->se_cmd_flags |= SCF_SCSI_DATA_CDB; | ||
1026 | /* FALLTHROUGH*/ | ||
1027 | default: | ||
1028 | cmd->execute_cmd = pscsi_execute_cmd; | ||
1029 | return 0; | ||
1030 | } | ||
1031 | } | 983 | } |
1032 | 984 | ||
1033 | static sense_reason_t | 985 | static sense_reason_t |
@@ -1189,7 +1141,7 @@ static struct configfs_attribute *pscsi_backend_dev_attrs[] = { | |||
1189 | static struct se_subsystem_api pscsi_template = { | 1141 | static struct se_subsystem_api pscsi_template = { |
1190 | .name = "pscsi", | 1142 | .name = "pscsi", |
1191 | .owner = THIS_MODULE, | 1143 | .owner = THIS_MODULE, |
1192 | .transport_type = TRANSPORT_PLUGIN_PHBA_PDEV, | 1144 | .transport_flags = TRANSPORT_FLAG_PASSTHROUGH, |
1193 | .attach_hba = pscsi_attach_hba, | 1145 | .attach_hba = pscsi_attach_hba, |
1194 | .detach_hba = pscsi_detach_hba, | 1146 | .detach_hba = pscsi_detach_hba, |
1195 | .pmode_enable_hba = pscsi_pmode_enable_hba, | 1147 | .pmode_enable_hba = pscsi_pmode_enable_hba, |
diff --git a/drivers/target/target_core_pscsi.h b/drivers/target/target_core_pscsi.h index 1bd757dff8ee..820d3052b775 100644 --- a/drivers/target/target_core_pscsi.h +++ b/drivers/target/target_core_pscsi.h | |||
@@ -45,6 +45,7 @@ struct pscsi_dev_virt { | |||
45 | int pdv_lun_id; | 45 | int pdv_lun_id; |
46 | struct block_device *pdv_bd; | 46 | struct block_device *pdv_bd; |
47 | struct scsi_device *pdv_sd; | 47 | struct scsi_device *pdv_sd; |
48 | struct Scsi_Host *pdv_lld_host; | ||
48 | } ____cacheline_aligned; | 49 | } ____cacheline_aligned; |
49 | 50 | ||
50 | typedef enum phv_modes { | 51 | typedef enum phv_modes { |
diff --git a/drivers/target/target_core_rd.c b/drivers/target/target_core_rd.c index a263bf5fab8d..d16489b6a1a4 100644 --- a/drivers/target/target_core_rd.c +++ b/drivers/target/target_core_rd.c | |||
@@ -733,7 +733,6 @@ static struct se_subsystem_api rd_mcp_template = { | |||
733 | .name = "rd_mcp", | 733 | .name = "rd_mcp", |
734 | .inquiry_prod = "RAMDISK-MCP", | 734 | .inquiry_prod = "RAMDISK-MCP", |
735 | .inquiry_rev = RD_MCP_VERSION, | 735 | .inquiry_rev = RD_MCP_VERSION, |
736 | .transport_type = TRANSPORT_PLUGIN_VHBA_VDEV, | ||
737 | .attach_hba = rd_attach_hba, | 736 | .attach_hba = rd_attach_hba, |
738 | .detach_hba = rd_detach_hba, | 737 | .detach_hba = rd_detach_hba, |
739 | .alloc_device = rd_alloc_device, | 738 | .alloc_device = rd_alloc_device, |
diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c index 8855781ac653..733824e3825f 100644 --- a/drivers/target/target_core_sbc.c +++ b/drivers/target/target_core_sbc.c | |||
@@ -568,7 +568,7 @@ sbc_compare_and_write(struct se_cmd *cmd) | |||
568 | * comparision using SGLs at cmd->t_bidi_data_sg.. | 568 | * comparision using SGLs at cmd->t_bidi_data_sg.. |
569 | */ | 569 | */ |
570 | rc = down_interruptible(&dev->caw_sem); | 570 | rc = down_interruptible(&dev->caw_sem); |
571 | if ((rc != 0) || signal_pending(current)) { | 571 | if (rc != 0) { |
572 | cmd->transport_complete_callback = NULL; | 572 | cmd->transport_complete_callback = NULL; |
573 | return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | 573 | return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; |
574 | } | 574 | } |
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 3fe5cb240b6f..675f2d9d1f14 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
@@ -1196,7 +1196,7 @@ transport_check_alloc_task_attr(struct se_cmd *cmd) | |||
1196 | * Check if SAM Task Attribute emulation is enabled for this | 1196 | * Check if SAM Task Attribute emulation is enabled for this |
1197 | * struct se_device storage object | 1197 | * struct se_device storage object |
1198 | */ | 1198 | */ |
1199 | if (dev->transport->transport_type == TRANSPORT_PLUGIN_PHBA_PDEV) | 1199 | if (dev->transport->transport_flags & TRANSPORT_FLAG_PASSTHROUGH) |
1200 | return 0; | 1200 | return 0; |
1201 | 1201 | ||
1202 | if (cmd->sam_task_attr == TCM_ACA_TAG) { | 1202 | if (cmd->sam_task_attr == TCM_ACA_TAG) { |
@@ -1770,7 +1770,7 @@ static int target_write_prot_action(struct se_cmd *cmd) | |||
1770 | sectors, 0, NULL, 0); | 1770 | sectors, 0, NULL, 0); |
1771 | if (unlikely(cmd->pi_err)) { | 1771 | if (unlikely(cmd->pi_err)) { |
1772 | spin_lock_irq(&cmd->t_state_lock); | 1772 | spin_lock_irq(&cmd->t_state_lock); |
1773 | cmd->transport_state &= ~CMD_T_BUSY|CMD_T_SENT; | 1773 | cmd->transport_state &= ~(CMD_T_BUSY|CMD_T_SENT); |
1774 | spin_unlock_irq(&cmd->t_state_lock); | 1774 | spin_unlock_irq(&cmd->t_state_lock); |
1775 | transport_generic_request_failure(cmd, cmd->pi_err); | 1775 | transport_generic_request_failure(cmd, cmd->pi_err); |
1776 | return -1; | 1776 | return -1; |
@@ -1787,7 +1787,7 @@ static bool target_handle_task_attr(struct se_cmd *cmd) | |||
1787 | { | 1787 | { |
1788 | struct se_device *dev = cmd->se_dev; | 1788 | struct se_device *dev = cmd->se_dev; |
1789 | 1789 | ||
1790 | if (dev->transport->transport_type == TRANSPORT_PLUGIN_PHBA_PDEV) | 1790 | if (dev->transport->transport_flags & TRANSPORT_FLAG_PASSTHROUGH) |
1791 | return false; | 1791 | return false; |
1792 | 1792 | ||
1793 | /* | 1793 | /* |
@@ -1868,7 +1868,7 @@ void target_execute_cmd(struct se_cmd *cmd) | |||
1868 | 1868 | ||
1869 | if (target_handle_task_attr(cmd)) { | 1869 | if (target_handle_task_attr(cmd)) { |
1870 | spin_lock_irq(&cmd->t_state_lock); | 1870 | spin_lock_irq(&cmd->t_state_lock); |
1871 | cmd->transport_state &= ~CMD_T_BUSY|CMD_T_SENT; | 1871 | cmd->transport_state &= ~(CMD_T_BUSY | CMD_T_SENT); |
1872 | spin_unlock_irq(&cmd->t_state_lock); | 1872 | spin_unlock_irq(&cmd->t_state_lock); |
1873 | return; | 1873 | return; |
1874 | } | 1874 | } |
@@ -1912,7 +1912,7 @@ static void transport_complete_task_attr(struct se_cmd *cmd) | |||
1912 | { | 1912 | { |
1913 | struct se_device *dev = cmd->se_dev; | 1913 | struct se_device *dev = cmd->se_dev; |
1914 | 1914 | ||
1915 | if (dev->transport->transport_type == TRANSPORT_PLUGIN_PHBA_PDEV) | 1915 | if (dev->transport->transport_flags & TRANSPORT_FLAG_PASSTHROUGH) |
1916 | return; | 1916 | return; |
1917 | 1917 | ||
1918 | if (cmd->sam_task_attr == TCM_SIMPLE_TAG) { | 1918 | if (cmd->sam_task_attr == TCM_SIMPLE_TAG) { |
@@ -1957,8 +1957,7 @@ static void transport_complete_qf(struct se_cmd *cmd) | |||
1957 | case DMA_TO_DEVICE: | 1957 | case DMA_TO_DEVICE: |
1958 | if (cmd->se_cmd_flags & SCF_BIDI) { | 1958 | if (cmd->se_cmd_flags & SCF_BIDI) { |
1959 | ret = cmd->se_tfo->queue_data_in(cmd); | 1959 | ret = cmd->se_tfo->queue_data_in(cmd); |
1960 | if (ret < 0) | 1960 | break; |
1961 | break; | ||
1962 | } | 1961 | } |
1963 | /* Fall through for DMA_TO_DEVICE */ | 1962 | /* Fall through for DMA_TO_DEVICE */ |
1964 | case DMA_NONE: | 1963 | case DMA_NONE: |
diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c index dbc872a6c981..07d2996d8c1f 100644 --- a/drivers/target/target_core_user.c +++ b/drivers/target/target_core_user.c | |||
@@ -71,13 +71,6 @@ struct tcmu_hba { | |||
71 | u32 host_id; | 71 | u32 host_id; |
72 | }; | 72 | }; |
73 | 73 | ||
74 | /* User wants all cmds or just some */ | ||
75 | enum passthru_level { | ||
76 | TCMU_PASS_ALL = 0, | ||
77 | TCMU_PASS_IO, | ||
78 | TCMU_PASS_INVALID, | ||
79 | }; | ||
80 | |||
81 | #define TCMU_CONFIG_LEN 256 | 74 | #define TCMU_CONFIG_LEN 256 |
82 | 75 | ||
83 | struct tcmu_dev { | 76 | struct tcmu_dev { |
@@ -89,7 +82,6 @@ struct tcmu_dev { | |||
89 | #define TCMU_DEV_BIT_OPEN 0 | 82 | #define TCMU_DEV_BIT_OPEN 0 |
90 | #define TCMU_DEV_BIT_BROKEN 1 | 83 | #define TCMU_DEV_BIT_BROKEN 1 |
91 | unsigned long flags; | 84 | unsigned long flags; |
92 | enum passthru_level pass_level; | ||
93 | 85 | ||
94 | struct uio_info uio_info; | 86 | struct uio_info uio_info; |
95 | 87 | ||
@@ -683,8 +675,6 @@ static struct se_device *tcmu_alloc_device(struct se_hba *hba, const char *name) | |||
683 | setup_timer(&udev->timeout, tcmu_device_timedout, | 675 | setup_timer(&udev->timeout, tcmu_device_timedout, |
684 | (unsigned long)udev); | 676 | (unsigned long)udev); |
685 | 677 | ||
686 | udev->pass_level = TCMU_PASS_ALL; | ||
687 | |||
688 | return &udev->se_dev; | 678 | return &udev->se_dev; |
689 | } | 679 | } |
690 | 680 | ||
@@ -948,13 +938,13 @@ static void tcmu_free_device(struct se_device *dev) | |||
948 | } | 938 | } |
949 | 939 | ||
950 | enum { | 940 | enum { |
951 | Opt_dev_config, Opt_dev_size, Opt_err, Opt_pass_level, | 941 | Opt_dev_config, Opt_dev_size, Opt_hw_block_size, Opt_err, |
952 | }; | 942 | }; |
953 | 943 | ||
954 | static match_table_t tokens = { | 944 | static match_table_t tokens = { |
955 | {Opt_dev_config, "dev_config=%s"}, | 945 | {Opt_dev_config, "dev_config=%s"}, |
956 | {Opt_dev_size, "dev_size=%u"}, | 946 | {Opt_dev_size, "dev_size=%u"}, |
957 | {Opt_pass_level, "pass_level=%u"}, | 947 | {Opt_hw_block_size, "hw_block_size=%u"}, |
958 | {Opt_err, NULL} | 948 | {Opt_err, NULL} |
959 | }; | 949 | }; |
960 | 950 | ||
@@ -965,7 +955,7 @@ static ssize_t tcmu_set_configfs_dev_params(struct se_device *dev, | |||
965 | char *orig, *ptr, *opts, *arg_p; | 955 | char *orig, *ptr, *opts, *arg_p; |
966 | substring_t args[MAX_OPT_ARGS]; | 956 | substring_t args[MAX_OPT_ARGS]; |
967 | int ret = 0, token; | 957 | int ret = 0, token; |
968 | int arg; | 958 | unsigned long tmp_ul; |
969 | 959 | ||
970 | opts = kstrdup(page, GFP_KERNEL); | 960 | opts = kstrdup(page, GFP_KERNEL); |
971 | if (!opts) | 961 | if (!opts) |
@@ -998,15 +988,23 @@ static ssize_t tcmu_set_configfs_dev_params(struct se_device *dev, | |||
998 | if (ret < 0) | 988 | if (ret < 0) |
999 | pr_err("kstrtoul() failed for dev_size=\n"); | 989 | pr_err("kstrtoul() failed for dev_size=\n"); |
1000 | break; | 990 | break; |
1001 | case Opt_pass_level: | 991 | case Opt_hw_block_size: |
1002 | match_int(args, &arg); | 992 | arg_p = match_strdup(&args[0]); |
1003 | if (arg >= TCMU_PASS_INVALID) { | 993 | if (!arg_p) { |
1004 | pr_warn("TCMU: Invalid pass_level: %d\n", arg); | 994 | ret = -ENOMEM; |
1005 | break; | 995 | break; |
1006 | } | 996 | } |
1007 | 997 | ret = kstrtoul(arg_p, 0, &tmp_ul); | |
1008 | pr_debug("TCMU: Setting pass_level to %d\n", arg); | 998 | kfree(arg_p); |
1009 | udev->pass_level = arg; | 999 | if (ret < 0) { |
1000 | pr_err("kstrtoul() failed for hw_block_size=\n"); | ||
1001 | break; | ||
1002 | } | ||
1003 | if (!tmp_ul) { | ||
1004 | pr_err("hw_block_size must be nonzero\n"); | ||
1005 | break; | ||
1006 | } | ||
1007 | dev->dev_attrib.hw_block_size = tmp_ul; | ||
1010 | break; | 1008 | break; |
1011 | default: | 1009 | default: |
1012 | break; | 1010 | break; |
@@ -1024,8 +1022,7 @@ static ssize_t tcmu_show_configfs_dev_params(struct se_device *dev, char *b) | |||
1024 | 1022 | ||
1025 | bl = sprintf(b + bl, "Config: %s ", | 1023 | bl = sprintf(b + bl, "Config: %s ", |
1026 | udev->dev_config[0] ? udev->dev_config : "NULL"); | 1024 | udev->dev_config[0] ? udev->dev_config : "NULL"); |
1027 | bl += sprintf(b + bl, "Size: %zu PassLevel: %u\n", | 1025 | bl += sprintf(b + bl, "Size: %zu\n", udev->dev_size); |
1028 | udev->dev_size, udev->pass_level); | ||
1029 | 1026 | ||
1030 | return bl; | 1027 | return bl; |
1031 | } | 1028 | } |
@@ -1039,20 +1036,6 @@ static sector_t tcmu_get_blocks(struct se_device *dev) | |||
1039 | } | 1036 | } |
1040 | 1037 | ||
1041 | static sense_reason_t | 1038 | static sense_reason_t |
1042 | tcmu_execute_rw(struct se_cmd *se_cmd, struct scatterlist *sgl, u32 sgl_nents, | ||
1043 | enum dma_data_direction data_direction) | ||
1044 | { | ||
1045 | int ret; | ||
1046 | |||
1047 | ret = tcmu_queue_cmd(se_cmd); | ||
1048 | |||
1049 | if (ret != 0) | ||
1050 | return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE; | ||
1051 | else | ||
1052 | return TCM_NO_SENSE; | ||
1053 | } | ||
1054 | |||
1055 | static sense_reason_t | ||
1056 | tcmu_pass_op(struct se_cmd *se_cmd) | 1039 | tcmu_pass_op(struct se_cmd *se_cmd) |
1057 | { | 1040 | { |
1058 | int ret = tcmu_queue_cmd(se_cmd); | 1041 | int ret = tcmu_queue_cmd(se_cmd); |
@@ -1063,91 +1046,29 @@ tcmu_pass_op(struct se_cmd *se_cmd) | |||
1063 | return TCM_NO_SENSE; | 1046 | return TCM_NO_SENSE; |
1064 | } | 1047 | } |
1065 | 1048 | ||
1066 | static struct sbc_ops tcmu_sbc_ops = { | ||
1067 | .execute_rw = tcmu_execute_rw, | ||
1068 | .execute_sync_cache = tcmu_pass_op, | ||
1069 | .execute_write_same = tcmu_pass_op, | ||
1070 | .execute_write_same_unmap = tcmu_pass_op, | ||
1071 | .execute_unmap = tcmu_pass_op, | ||
1072 | }; | ||
1073 | |||
1074 | static sense_reason_t | 1049 | static sense_reason_t |
1075 | tcmu_parse_cdb(struct se_cmd *cmd) | 1050 | tcmu_parse_cdb(struct se_cmd *cmd) |
1076 | { | 1051 | { |
1077 | unsigned char *cdb = cmd->t_task_cdb; | 1052 | return passthrough_parse_cdb(cmd, tcmu_pass_op); |
1078 | struct tcmu_dev *udev = TCMU_DEV(cmd->se_dev); | ||
1079 | sense_reason_t ret; | ||
1080 | |||
1081 | switch (udev->pass_level) { | ||
1082 | case TCMU_PASS_ALL: | ||
1083 | /* We're just like pscsi, then */ | ||
1084 | /* | ||
1085 | * For REPORT LUNS we always need to emulate the response, for everything | ||
1086 | * else, pass it up. | ||
1087 | */ | ||
1088 | switch (cdb[0]) { | ||
1089 | case REPORT_LUNS: | ||
1090 | cmd->execute_cmd = spc_emulate_report_luns; | ||
1091 | break; | ||
1092 | case READ_6: | ||
1093 | case READ_10: | ||
1094 | case READ_12: | ||
1095 | case READ_16: | ||
1096 | case WRITE_6: | ||
1097 | case WRITE_10: | ||
1098 | case WRITE_12: | ||
1099 | case WRITE_16: | ||
1100 | case WRITE_VERIFY: | ||
1101 | cmd->se_cmd_flags |= SCF_SCSI_DATA_CDB; | ||
1102 | /* FALLTHROUGH */ | ||
1103 | default: | ||
1104 | cmd->execute_cmd = tcmu_pass_op; | ||
1105 | } | ||
1106 | ret = TCM_NO_SENSE; | ||
1107 | break; | ||
1108 | case TCMU_PASS_IO: | ||
1109 | ret = sbc_parse_cdb(cmd, &tcmu_sbc_ops); | ||
1110 | break; | ||
1111 | default: | ||
1112 | pr_err("Unknown tcm-user pass level %d\n", udev->pass_level); | ||
1113 | ret = TCM_CHECK_CONDITION_ABORT_CMD; | ||
1114 | } | ||
1115 | |||
1116 | return ret; | ||
1117 | } | 1053 | } |
1118 | 1054 | ||
1119 | DEF_TB_DEFAULT_ATTRIBS(tcmu); | 1055 | DEF_TB_DEV_ATTRIB_RO(tcmu, hw_pi_prot_type); |
1056 | TB_DEV_ATTR_RO(tcmu, hw_pi_prot_type); | ||
1057 | |||
1058 | DEF_TB_DEV_ATTRIB_RO(tcmu, hw_block_size); | ||
1059 | TB_DEV_ATTR_RO(tcmu, hw_block_size); | ||
1060 | |||
1061 | DEF_TB_DEV_ATTRIB_RO(tcmu, hw_max_sectors); | ||
1062 | TB_DEV_ATTR_RO(tcmu, hw_max_sectors); | ||
1063 | |||
1064 | DEF_TB_DEV_ATTRIB_RO(tcmu, hw_queue_depth); | ||
1065 | TB_DEV_ATTR_RO(tcmu, hw_queue_depth); | ||
1120 | 1066 | ||
1121 | static struct configfs_attribute *tcmu_backend_dev_attrs[] = { | 1067 | static struct configfs_attribute *tcmu_backend_dev_attrs[] = { |
1122 | &tcmu_dev_attrib_emulate_model_alias.attr, | ||
1123 | &tcmu_dev_attrib_emulate_dpo.attr, | ||
1124 | &tcmu_dev_attrib_emulate_fua_write.attr, | ||
1125 | &tcmu_dev_attrib_emulate_fua_read.attr, | ||
1126 | &tcmu_dev_attrib_emulate_write_cache.attr, | ||
1127 | &tcmu_dev_attrib_emulate_ua_intlck_ctrl.attr, | ||
1128 | &tcmu_dev_attrib_emulate_tas.attr, | ||
1129 | &tcmu_dev_attrib_emulate_tpu.attr, | ||
1130 | &tcmu_dev_attrib_emulate_tpws.attr, | ||
1131 | &tcmu_dev_attrib_emulate_caw.attr, | ||
1132 | &tcmu_dev_attrib_emulate_3pc.attr, | ||
1133 | &tcmu_dev_attrib_pi_prot_type.attr, | ||
1134 | &tcmu_dev_attrib_hw_pi_prot_type.attr, | 1068 | &tcmu_dev_attrib_hw_pi_prot_type.attr, |
1135 | &tcmu_dev_attrib_pi_prot_format.attr, | ||
1136 | &tcmu_dev_attrib_enforce_pr_isids.attr, | ||
1137 | &tcmu_dev_attrib_is_nonrot.attr, | ||
1138 | &tcmu_dev_attrib_emulate_rest_reord.attr, | ||
1139 | &tcmu_dev_attrib_force_pr_aptpl.attr, | ||
1140 | &tcmu_dev_attrib_hw_block_size.attr, | 1069 | &tcmu_dev_attrib_hw_block_size.attr, |
1141 | &tcmu_dev_attrib_block_size.attr, | ||
1142 | &tcmu_dev_attrib_hw_max_sectors.attr, | 1070 | &tcmu_dev_attrib_hw_max_sectors.attr, |
1143 | &tcmu_dev_attrib_optimal_sectors.attr, | ||
1144 | &tcmu_dev_attrib_hw_queue_depth.attr, | 1071 | &tcmu_dev_attrib_hw_queue_depth.attr, |
1145 | &tcmu_dev_attrib_queue_depth.attr, | ||
1146 | &tcmu_dev_attrib_max_unmap_lba_count.attr, | ||
1147 | &tcmu_dev_attrib_max_unmap_block_desc_count.attr, | ||
1148 | &tcmu_dev_attrib_unmap_granularity.attr, | ||
1149 | &tcmu_dev_attrib_unmap_granularity_alignment.attr, | ||
1150 | &tcmu_dev_attrib_max_write_same_len.attr, | ||
1151 | NULL, | 1072 | NULL, |
1152 | }; | 1073 | }; |
1153 | 1074 | ||
@@ -1156,7 +1077,7 @@ static struct se_subsystem_api tcmu_template = { | |||
1156 | .inquiry_prod = "USER", | 1077 | .inquiry_prod = "USER", |
1157 | .inquiry_rev = TCMU_VERSION, | 1078 | .inquiry_rev = TCMU_VERSION, |
1158 | .owner = THIS_MODULE, | 1079 | .owner = THIS_MODULE, |
1159 | .transport_type = TRANSPORT_PLUGIN_VHBA_PDEV, | 1080 | .transport_flags = TRANSPORT_FLAG_PASSTHROUGH, |
1160 | .attach_hba = tcmu_attach_hba, | 1081 | .attach_hba = tcmu_attach_hba, |
1161 | .detach_hba = tcmu_detach_hba, | 1082 | .detach_hba = tcmu_detach_hba, |
1162 | .alloc_device = tcmu_alloc_device, | 1083 | .alloc_device = tcmu_alloc_device, |
diff --git a/drivers/target/target_core_xcopy.c b/drivers/target/target_core_xcopy.c index a600ff15dcfd..8fd680ac941b 100644 --- a/drivers/target/target_core_xcopy.c +++ b/drivers/target/target_core_xcopy.c | |||
@@ -58,7 +58,6 @@ static int target_xcopy_locate_se_dev_e4(struct se_cmd *se_cmd, struct xcopy_op | |||
58 | bool src) | 58 | bool src) |
59 | { | 59 | { |
60 | struct se_device *se_dev; | 60 | struct se_device *se_dev; |
61 | struct configfs_subsystem *subsys = target_core_subsystem[0]; | ||
62 | unsigned char tmp_dev_wwn[XCOPY_NAA_IEEE_REGEX_LEN], *dev_wwn; | 61 | unsigned char tmp_dev_wwn[XCOPY_NAA_IEEE_REGEX_LEN], *dev_wwn; |
63 | int rc; | 62 | int rc; |
64 | 63 | ||
@@ -90,8 +89,7 @@ static int target_xcopy_locate_se_dev_e4(struct se_cmd *se_cmd, struct xcopy_op | |||
90 | " se_dev\n", xop->src_dev); | 89 | " se_dev\n", xop->src_dev); |
91 | } | 90 | } |
92 | 91 | ||
93 | rc = configfs_depend_item(subsys, | 92 | rc = target_depend_item(&se_dev->dev_group.cg_item); |
94 | &se_dev->dev_group.cg_item); | ||
95 | if (rc != 0) { | 93 | if (rc != 0) { |
96 | pr_err("configfs_depend_item attempt failed:" | 94 | pr_err("configfs_depend_item attempt failed:" |
97 | " %d for se_dev: %p\n", rc, se_dev); | 95 | " %d for se_dev: %p\n", rc, se_dev); |
@@ -99,8 +97,8 @@ static int target_xcopy_locate_se_dev_e4(struct se_cmd *se_cmd, struct xcopy_op | |||
99 | return rc; | 97 | return rc; |
100 | } | 98 | } |
101 | 99 | ||
102 | pr_debug("Called configfs_depend_item for subsys: %p se_dev: %p" | 100 | pr_debug("Called configfs_depend_item for se_dev: %p" |
103 | " se_dev->se_dev_group: %p\n", subsys, se_dev, | 101 | " se_dev->se_dev_group: %p\n", se_dev, |
104 | &se_dev->dev_group); | 102 | &se_dev->dev_group); |
105 | 103 | ||
106 | mutex_unlock(&g_device_mutex); | 104 | mutex_unlock(&g_device_mutex); |
@@ -373,7 +371,6 @@ static int xcopy_pt_get_cmd_state(struct se_cmd *se_cmd) | |||
373 | 371 | ||
374 | static void xcopy_pt_undepend_remotedev(struct xcopy_op *xop) | 372 | static void xcopy_pt_undepend_remotedev(struct xcopy_op *xop) |
375 | { | 373 | { |
376 | struct configfs_subsystem *subsys = target_core_subsystem[0]; | ||
377 | struct se_device *remote_dev; | 374 | struct se_device *remote_dev; |
378 | 375 | ||
379 | if (xop->op_origin == XCOL_SOURCE_RECV_OP) | 376 | if (xop->op_origin == XCOL_SOURCE_RECV_OP) |
@@ -381,11 +378,11 @@ static void xcopy_pt_undepend_remotedev(struct xcopy_op *xop) | |||
381 | else | 378 | else |
382 | remote_dev = xop->src_dev; | 379 | remote_dev = xop->src_dev; |
383 | 380 | ||
384 | pr_debug("Calling configfs_undepend_item for subsys: %p" | 381 | pr_debug("Calling configfs_undepend_item for" |
385 | " remote_dev: %p remote_dev->dev_group: %p\n", | 382 | " remote_dev: %p remote_dev->dev_group: %p\n", |
386 | subsys, remote_dev, &remote_dev->dev_group.cg_item); | 383 | remote_dev, &remote_dev->dev_group.cg_item); |
387 | 384 | ||
388 | configfs_undepend_item(subsys, &remote_dev->dev_group.cg_item); | 385 | target_undepend_item(&remote_dev->dev_group.cg_item); |
389 | } | 386 | } |
390 | 387 | ||
391 | static void xcopy_pt_release_cmd(struct se_cmd *se_cmd) | 388 | static void xcopy_pt_release_cmd(struct se_cmd *se_cmd) |
diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c index c2556cf5186b..01255fd65135 100644 --- a/drivers/thermal/armada_thermal.c +++ b/drivers/thermal/armada_thermal.c | |||
@@ -224,9 +224,9 @@ static const struct armada_thermal_data armada380_data = { | |||
224 | .is_valid_shift = 10, | 224 | .is_valid_shift = 10, |
225 | .temp_shift = 0, | 225 | .temp_shift = 0, |
226 | .temp_mask = 0x3ff, | 226 | .temp_mask = 0x3ff, |
227 | .coef_b = 1169498786UL, | 227 | .coef_b = 2931108200UL, |
228 | .coef_m = 2000000UL, | 228 | .coef_m = 5000000UL, |
229 | .coef_div = 4289, | 229 | .coef_div = 10502, |
230 | .inverted = true, | 230 | .inverted = true, |
231 | }; | 231 | }; |
232 | 232 | ||
diff --git a/drivers/thermal/ti-soc-thermal/dra752-thermal-data.c b/drivers/thermal/ti-soc-thermal/dra752-thermal-data.c index a4929272074f..58b5c6694cd4 100644 --- a/drivers/thermal/ti-soc-thermal/dra752-thermal-data.c +++ b/drivers/thermal/ti-soc-thermal/dra752-thermal-data.c | |||
@@ -420,7 +420,8 @@ const struct ti_bandgap_data dra752_data = { | |||
420 | TI_BANDGAP_FEATURE_FREEZE_BIT | | 420 | TI_BANDGAP_FEATURE_FREEZE_BIT | |
421 | TI_BANDGAP_FEATURE_TALERT | | 421 | TI_BANDGAP_FEATURE_TALERT | |
422 | TI_BANDGAP_FEATURE_COUNTER_DELAY | | 422 | TI_BANDGAP_FEATURE_COUNTER_DELAY | |
423 | TI_BANDGAP_FEATURE_HISTORY_BUFFER, | 423 | TI_BANDGAP_FEATURE_HISTORY_BUFFER | |
424 | TI_BANDGAP_FEATURE_ERRATA_814, | ||
424 | .fclock_name = "l3instr_ts_gclk_div", | 425 | .fclock_name = "l3instr_ts_gclk_div", |
425 | .div_ck_name = "l3instr_ts_gclk_div", | 426 | .div_ck_name = "l3instr_ts_gclk_div", |
426 | .conv_table = dra752_adc_to_temp, | 427 | .conv_table = dra752_adc_to_temp, |
diff --git a/drivers/thermal/ti-soc-thermal/omap5-thermal-data.c b/drivers/thermal/ti-soc-thermal/omap5-thermal-data.c index eff0c80fd4af..79ff70c446ba 100644 --- a/drivers/thermal/ti-soc-thermal/omap5-thermal-data.c +++ b/drivers/thermal/ti-soc-thermal/omap5-thermal-data.c | |||
@@ -319,7 +319,8 @@ const struct ti_bandgap_data omap5430_data = { | |||
319 | TI_BANDGAP_FEATURE_FREEZE_BIT | | 319 | TI_BANDGAP_FEATURE_FREEZE_BIT | |
320 | TI_BANDGAP_FEATURE_TALERT | | 320 | TI_BANDGAP_FEATURE_TALERT | |
321 | TI_BANDGAP_FEATURE_COUNTER_DELAY | | 321 | TI_BANDGAP_FEATURE_COUNTER_DELAY | |
322 | TI_BANDGAP_FEATURE_HISTORY_BUFFER, | 322 | TI_BANDGAP_FEATURE_HISTORY_BUFFER | |
323 | TI_BANDGAP_FEATURE_ERRATA_813, | ||
323 | .fclock_name = "l3instr_ts_gclk_div", | 324 | .fclock_name = "l3instr_ts_gclk_div", |
324 | .div_ck_name = "l3instr_ts_gclk_div", | 325 | .div_ck_name = "l3instr_ts_gclk_div", |
325 | .conv_table = omap5430_adc_to_temp, | 326 | .conv_table = omap5430_adc_to_temp, |
diff --git a/drivers/thermal/ti-soc-thermal/ti-bandgap.c b/drivers/thermal/ti-soc-thermal/ti-bandgap.c index 62a5d449c388..bc14dc874594 100644 --- a/drivers/thermal/ti-soc-thermal/ti-bandgap.c +++ b/drivers/thermal/ti-soc-thermal/ti-bandgap.c | |||
@@ -119,6 +119,37 @@ exit: | |||
119 | } | 119 | } |
120 | 120 | ||
121 | /** | 121 | /** |
122 | * ti_errata814_bandgap_read_temp() - helper function to read dra7 sensor temperature | ||
123 | * @bgp: pointer to ti_bandgap structure | ||
124 | * @reg: desired register (offset) to be read | ||
125 | * | ||
126 | * Function to read dra7 bandgap sensor temperature. This is done separately | ||
127 | * so as to workaround the errata "Bandgap Temperature read Dtemp can be | ||
128 | * corrupted" - Errata ID: i814". | ||
129 | * Read accesses to registers listed below can be corrupted due to incorrect | ||
130 | * resynchronization between clock domains. | ||
131 | * Read access to registers below can be corrupted : | ||
132 | * CTRL_CORE_DTEMP_MPU/GPU/CORE/DSPEVE/IVA_n (n = 0 to 4) | ||
133 | * CTRL_CORE_TEMP_SENSOR_MPU/GPU/CORE/DSPEVE/IVA_n | ||
134 | * | ||
135 | * Return: the register value. | ||
136 | */ | ||
137 | static u32 ti_errata814_bandgap_read_temp(struct ti_bandgap *bgp, u32 reg) | ||
138 | { | ||
139 | u32 val1, val2; | ||
140 | |||
141 | val1 = ti_bandgap_readl(bgp, reg); | ||
142 | val2 = ti_bandgap_readl(bgp, reg); | ||
143 | |||
144 | /* If both times we read the same value then that is right */ | ||
145 | if (val1 == val2) | ||
146 | return val1; | ||
147 | |||
148 | /* if val1 and val2 are different read it third time */ | ||
149 | return ti_bandgap_readl(bgp, reg); | ||
150 | } | ||
151 | |||
152 | /** | ||
122 | * ti_bandgap_read_temp() - helper function to read sensor temperature | 153 | * ti_bandgap_read_temp() - helper function to read sensor temperature |
123 | * @bgp: pointer to ti_bandgap structure | 154 | * @bgp: pointer to ti_bandgap structure |
124 | * @id: bandgap sensor id | 155 | * @id: bandgap sensor id |
@@ -148,7 +179,11 @@ static u32 ti_bandgap_read_temp(struct ti_bandgap *bgp, int id) | |||
148 | } | 179 | } |
149 | 180 | ||
150 | /* read temperature */ | 181 | /* read temperature */ |
151 | temp = ti_bandgap_readl(bgp, reg); | 182 | if (TI_BANDGAP_HAS(bgp, ERRATA_814)) |
183 | temp = ti_errata814_bandgap_read_temp(bgp, reg); | ||
184 | else | ||
185 | temp = ti_bandgap_readl(bgp, reg); | ||
186 | |||
152 | temp &= tsr->bgap_dtemp_mask; | 187 | temp &= tsr->bgap_dtemp_mask; |
153 | 188 | ||
154 | if (TI_BANDGAP_HAS(bgp, FREEZE_BIT)) | 189 | if (TI_BANDGAP_HAS(bgp, FREEZE_BIT)) |
@@ -410,7 +445,7 @@ static int ti_bandgap_update_alert_threshold(struct ti_bandgap *bgp, int id, | |||
410 | { | 445 | { |
411 | struct temp_sensor_data *ts_data = bgp->conf->sensors[id].ts_data; | 446 | struct temp_sensor_data *ts_data = bgp->conf->sensors[id].ts_data; |
412 | struct temp_sensor_registers *tsr; | 447 | struct temp_sensor_registers *tsr; |
413 | u32 thresh_val, reg_val, t_hot, t_cold; | 448 | u32 thresh_val, reg_val, t_hot, t_cold, ctrl; |
414 | int err = 0; | 449 | int err = 0; |
415 | 450 | ||
416 | tsr = bgp->conf->sensors[id].registers; | 451 | tsr = bgp->conf->sensors[id].registers; |
@@ -442,8 +477,47 @@ static int ti_bandgap_update_alert_threshold(struct ti_bandgap *bgp, int id, | |||
442 | ~(tsr->threshold_thot_mask | tsr->threshold_tcold_mask); | 477 | ~(tsr->threshold_thot_mask | tsr->threshold_tcold_mask); |
443 | reg_val |= (t_hot << __ffs(tsr->threshold_thot_mask)) | | 478 | reg_val |= (t_hot << __ffs(tsr->threshold_thot_mask)) | |
444 | (t_cold << __ffs(tsr->threshold_tcold_mask)); | 479 | (t_cold << __ffs(tsr->threshold_tcold_mask)); |
480 | |||
481 | /** | ||
482 | * Errata i813: | ||
483 | * Spurious Thermal Alert: Talert can happen randomly while the device | ||
484 | * remains under the temperature limit defined for this event to trig. | ||
485 | * This spurious event is caused by a incorrect re-synchronization | ||
486 | * between clock domains. The comparison between configured threshold | ||
487 | * and current temperature value can happen while the value is | ||
488 | * transitioning (metastable), thus causing inappropriate event | ||
489 | * generation. No spurious event occurs as long as the threshold value | ||
490 | * stays unchanged. Spurious event can be generated while a thermal | ||
491 | * alert threshold is modified in | ||
492 | * CONTROL_BANDGAP_THRESHOLD_MPU/GPU/CORE/DSPEVE/IVA_n. | ||
493 | */ | ||
494 | |||
495 | if (TI_BANDGAP_HAS(bgp, ERRATA_813)) { | ||
496 | /* Mask t_hot and t_cold events at the IP Level */ | ||
497 | ctrl = ti_bandgap_readl(bgp, tsr->bgap_mask_ctrl); | ||
498 | |||
499 | if (hot) | ||
500 | ctrl &= ~tsr->mask_hot_mask; | ||
501 | else | ||
502 | ctrl &= ~tsr->mask_cold_mask; | ||
503 | |||
504 | ti_bandgap_writel(bgp, ctrl, tsr->bgap_mask_ctrl); | ||
505 | } | ||
506 | |||
507 | /* Write the threshold value */ | ||
445 | ti_bandgap_writel(bgp, reg_val, tsr->bgap_threshold); | 508 | ti_bandgap_writel(bgp, reg_val, tsr->bgap_threshold); |
446 | 509 | ||
510 | if (TI_BANDGAP_HAS(bgp, ERRATA_813)) { | ||
511 | /* Unmask t_hot and t_cold events at the IP Level */ | ||
512 | ctrl = ti_bandgap_readl(bgp, tsr->bgap_mask_ctrl); | ||
513 | if (hot) | ||
514 | ctrl |= tsr->mask_hot_mask; | ||
515 | else | ||
516 | ctrl |= tsr->mask_cold_mask; | ||
517 | |||
518 | ti_bandgap_writel(bgp, ctrl, tsr->bgap_mask_ctrl); | ||
519 | } | ||
520 | |||
447 | if (err) { | 521 | if (err) { |
448 | dev_err(bgp->dev, "failed to reprogram thot threshold\n"); | 522 | dev_err(bgp->dev, "failed to reprogram thot threshold\n"); |
449 | err = -EIO; | 523 | err = -EIO; |
diff --git a/drivers/thermal/ti-soc-thermal/ti-bandgap.h b/drivers/thermal/ti-soc-thermal/ti-bandgap.h index b3adf72f252d..0c52f7afba00 100644 --- a/drivers/thermal/ti-soc-thermal/ti-bandgap.h +++ b/drivers/thermal/ti-soc-thermal/ti-bandgap.h | |||
@@ -318,6 +318,10 @@ struct ti_temp_sensor { | |||
318 | * TI_BANDGAP_FEATURE_HISTORY_BUFFER - used when the bandgap device features | 318 | * TI_BANDGAP_FEATURE_HISTORY_BUFFER - used when the bandgap device features |
319 | * a history buffer of temperatures. | 319 | * a history buffer of temperatures. |
320 | * | 320 | * |
321 | * TI_BANDGAP_FEATURE_ERRATA_814 - used to workaorund when the bandgap device | ||
322 | * has Errata 814 | ||
323 | * TI_BANDGAP_FEATURE_ERRATA_813 - used to workaorund when the bandgap device | ||
324 | * has Errata 813 | ||
321 | * TI_BANDGAP_HAS(b, f) - macro to check if a bandgap device is capable of a | 325 | * TI_BANDGAP_HAS(b, f) - macro to check if a bandgap device is capable of a |
322 | * specific feature (above) or not. Return non-zero, if yes. | 326 | * specific feature (above) or not. Return non-zero, if yes. |
323 | */ | 327 | */ |
@@ -331,6 +335,8 @@ struct ti_temp_sensor { | |||
331 | #define TI_BANDGAP_FEATURE_FREEZE_BIT BIT(7) | 335 | #define TI_BANDGAP_FEATURE_FREEZE_BIT BIT(7) |
332 | #define TI_BANDGAP_FEATURE_COUNTER_DELAY BIT(8) | 336 | #define TI_BANDGAP_FEATURE_COUNTER_DELAY BIT(8) |
333 | #define TI_BANDGAP_FEATURE_HISTORY_BUFFER BIT(9) | 337 | #define TI_BANDGAP_FEATURE_HISTORY_BUFFER BIT(9) |
338 | #define TI_BANDGAP_FEATURE_ERRATA_814 BIT(10) | ||
339 | #define TI_BANDGAP_FEATURE_ERRATA_813 BIT(11) | ||
334 | #define TI_BANDGAP_HAS(b, f) \ | 340 | #define TI_BANDGAP_HAS(b, f) \ |
335 | ((b)->conf->features & TI_BANDGAP_FEATURE_ ## f) | 341 | ((b)->conf->features & TI_BANDGAP_FEATURE_ ## f) |
336 | 342 | ||
diff --git a/drivers/tty/hvc/hvc_xen.c b/drivers/tty/hvc/hvc_xen.c index 5bab1c684bb1..7a3d146a5f0e 100644 --- a/drivers/tty/hvc/hvc_xen.c +++ b/drivers/tty/hvc/hvc_xen.c | |||
@@ -289,7 +289,7 @@ static int xen_initial_domain_console_init(void) | |||
289 | return -ENOMEM; | 289 | return -ENOMEM; |
290 | } | 290 | } |
291 | 291 | ||
292 | info->irq = bind_virq_to_irq(VIRQ_CONSOLE, 0); | 292 | info->irq = bind_virq_to_irq(VIRQ_CONSOLE, 0, false); |
293 | info->vtermno = HVC_COOKIE; | 293 | info->vtermno = HVC_COOKIE; |
294 | 294 | ||
295 | spin_lock(&xencons_lock); | 295 | spin_lock(&xencons_lock); |
diff --git a/drivers/tty/mips_ejtag_fdc.c b/drivers/tty/mips_ejtag_fdc.c index 04d9e23d1ee1..358323c83b4f 100644 --- a/drivers/tty/mips_ejtag_fdc.c +++ b/drivers/tty/mips_ejtag_fdc.c | |||
@@ -174,13 +174,13 @@ struct mips_ejtag_fdc_tty { | |||
174 | static inline void mips_ejtag_fdc_write(struct mips_ejtag_fdc_tty *priv, | 174 | static inline void mips_ejtag_fdc_write(struct mips_ejtag_fdc_tty *priv, |
175 | unsigned int offs, unsigned int data) | 175 | unsigned int offs, unsigned int data) |
176 | { | 176 | { |
177 | iowrite32(data, priv->reg + offs); | 177 | __raw_writel(data, priv->reg + offs); |
178 | } | 178 | } |
179 | 179 | ||
180 | static inline unsigned int mips_ejtag_fdc_read(struct mips_ejtag_fdc_tty *priv, | 180 | static inline unsigned int mips_ejtag_fdc_read(struct mips_ejtag_fdc_tty *priv, |
181 | unsigned int offs) | 181 | unsigned int offs) |
182 | { | 182 | { |
183 | return ioread32(priv->reg + offs); | 183 | return __raw_readl(priv->reg + offs); |
184 | } | 184 | } |
185 | 185 | ||
186 | /* Encoding of byte stream in FDC words */ | 186 | /* Encoding of byte stream in FDC words */ |
@@ -347,9 +347,9 @@ static void mips_ejtag_fdc_console_write(struct console *c, const char *s, | |||
347 | s += inc[word.bytes - 1]; | 347 | s += inc[word.bytes - 1]; |
348 | 348 | ||
349 | /* Busy wait until there's space in fifo */ | 349 | /* Busy wait until there's space in fifo */ |
350 | while (ioread32(regs + REG_FDSTAT) & REG_FDSTAT_TXF) | 350 | while (__raw_readl(regs + REG_FDSTAT) & REG_FDSTAT_TXF) |
351 | ; | 351 | ; |
352 | iowrite32(word.word, regs + REG_FDTX(c->index)); | 352 | __raw_writel(word.word, regs + REG_FDTX(c->index)); |
353 | } | 353 | } |
354 | out: | 354 | out: |
355 | local_irq_restore(flags); | 355 | local_irq_restore(flags); |
@@ -1227,7 +1227,7 @@ static int kgdbfdc_read_char(void) | |||
1227 | 1227 | ||
1228 | /* Read next word from KGDB channel */ | 1228 | /* Read next word from KGDB channel */ |
1229 | do { | 1229 | do { |
1230 | stat = ioread32(regs + REG_FDSTAT); | 1230 | stat = __raw_readl(regs + REG_FDSTAT); |
1231 | 1231 | ||
1232 | /* No data waiting? */ | 1232 | /* No data waiting? */ |
1233 | if (stat & REG_FDSTAT_RXE) | 1233 | if (stat & REG_FDSTAT_RXE) |
@@ -1236,7 +1236,7 @@ static int kgdbfdc_read_char(void) | |||
1236 | /* Read next word */ | 1236 | /* Read next word */ |
1237 | channel = (stat & REG_FDSTAT_RXCHAN) >> | 1237 | channel = (stat & REG_FDSTAT_RXCHAN) >> |
1238 | REG_FDSTAT_RXCHAN_SHIFT; | 1238 | REG_FDSTAT_RXCHAN_SHIFT; |
1239 | data = ioread32(regs + REG_FDRX); | 1239 | data = __raw_readl(regs + REG_FDRX); |
1240 | } while (channel != CONFIG_MIPS_EJTAG_FDC_KGDB_CHAN); | 1240 | } while (channel != CONFIG_MIPS_EJTAG_FDC_KGDB_CHAN); |
1241 | 1241 | ||
1242 | /* Decode into rbuf */ | 1242 | /* Decode into rbuf */ |
@@ -1266,9 +1266,10 @@ static void kgdbfdc_push_one(void) | |||
1266 | return; | 1266 | return; |
1267 | 1267 | ||
1268 | /* Busy wait until there's space in fifo */ | 1268 | /* Busy wait until there's space in fifo */ |
1269 | while (ioread32(regs + REG_FDSTAT) & REG_FDSTAT_TXF) | 1269 | while (__raw_readl(regs + REG_FDSTAT) & REG_FDSTAT_TXF) |
1270 | ; | 1270 | ; |
1271 | iowrite32(word.word, regs + REG_FDTX(CONFIG_MIPS_EJTAG_FDC_KGDB_CHAN)); | 1271 | __raw_writel(word.word, |
1272 | regs + REG_FDTX(CONFIG_MIPS_EJTAG_FDC_KGDB_CHAN)); | ||
1272 | } | 1273 | } |
1273 | 1274 | ||
1274 | /* flush the whole write buffer to the TX FIFO */ | 1275 | /* flush the whole write buffer to the TX FIFO */ |
diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 5e19bb53b3a9..ea32b386797f 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c | |||
@@ -1409,8 +1409,7 @@ vhost_scsi_set_endpoint(struct vhost_scsi *vs, | |||
1409 | * dependency now. | 1409 | * dependency now. |
1410 | */ | 1410 | */ |
1411 | se_tpg = &tpg->se_tpg; | 1411 | se_tpg = &tpg->se_tpg; |
1412 | ret = configfs_depend_item(se_tpg->se_tpg_tfo->tf_subsys, | 1412 | ret = target_depend_item(&se_tpg->tpg_group.cg_item); |
1413 | &se_tpg->tpg_group.cg_item); | ||
1414 | if (ret) { | 1413 | if (ret) { |
1415 | pr_warn("configfs_depend_item() failed: %d\n", ret); | 1414 | pr_warn("configfs_depend_item() failed: %d\n", ret); |
1416 | kfree(vs_tpg); | 1415 | kfree(vs_tpg); |
@@ -1513,8 +1512,7 @@ vhost_scsi_clear_endpoint(struct vhost_scsi *vs, | |||
1513 | * to allow vhost-scsi WWPN se_tpg->tpg_group shutdown to occur. | 1512 | * to allow vhost-scsi WWPN se_tpg->tpg_group shutdown to occur. |
1514 | */ | 1513 | */ |
1515 | se_tpg = &tpg->se_tpg; | 1514 | se_tpg = &tpg->se_tpg; |
1516 | configfs_undepend_item(se_tpg->se_tpg_tfo->tf_subsys, | 1515 | target_undepend_item(&se_tpg->tpg_group.cg_item); |
1517 | &se_tpg->tpg_group.cg_item); | ||
1518 | } | 1516 | } |
1519 | if (match) { | 1517 | if (match) { |
1520 | for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) { | 1518 | for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) { |
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/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c index 2b8553bd8715..38387950490e 100644 --- a/drivers/xen/events/events_base.c +++ b/drivers/xen/events/events_base.c | |||
@@ -957,7 +957,7 @@ unsigned xen_evtchn_nr_channels(void) | |||
957 | } | 957 | } |
958 | EXPORT_SYMBOL_GPL(xen_evtchn_nr_channels); | 958 | EXPORT_SYMBOL_GPL(xen_evtchn_nr_channels); |
959 | 959 | ||
960 | int bind_virq_to_irq(unsigned int virq, unsigned int cpu) | 960 | int bind_virq_to_irq(unsigned int virq, unsigned int cpu, bool percpu) |
961 | { | 961 | { |
962 | struct evtchn_bind_virq bind_virq; | 962 | struct evtchn_bind_virq bind_virq; |
963 | int evtchn, irq, ret; | 963 | int evtchn, irq, ret; |
@@ -971,8 +971,12 @@ int bind_virq_to_irq(unsigned int virq, unsigned int cpu) | |||
971 | if (irq < 0) | 971 | if (irq < 0) |
972 | goto out; | 972 | goto out; |
973 | 973 | ||
974 | irq_set_chip_and_handler_name(irq, &xen_percpu_chip, | 974 | if (percpu) |
975 | handle_percpu_irq, "virq"); | 975 | irq_set_chip_and_handler_name(irq, &xen_percpu_chip, |
976 | handle_percpu_irq, "virq"); | ||
977 | else | ||
978 | irq_set_chip_and_handler_name(irq, &xen_dynamic_chip, | ||
979 | handle_edge_irq, "virq"); | ||
976 | 980 | ||
977 | bind_virq.virq = virq; | 981 | bind_virq.virq = virq; |
978 | bind_virq.vcpu = cpu; | 982 | bind_virq.vcpu = cpu; |
@@ -1062,7 +1066,7 @@ int bind_virq_to_irqhandler(unsigned int virq, unsigned int cpu, | |||
1062 | { | 1066 | { |
1063 | int irq, retval; | 1067 | int irq, retval; |
1064 | 1068 | ||
1065 | irq = bind_virq_to_irq(virq, cpu); | 1069 | irq = bind_virq_to_irq(virq, cpu, irqflags & IRQF_PERCPU); |
1066 | if (irq < 0) | 1070 | if (irq < 0) |
1067 | return irq; | 1071 | return irq; |
1068 | retval = request_irq(irq, handler, irqflags, devname, dev_id); | 1072 | retval = request_irq(irq, handler, irqflags, devname, dev_id); |
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/btrfs/backref.c b/fs/btrfs/backref.c index 9de772ee0031..614aaa1969bd 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c | |||
@@ -880,6 +880,8 @@ static int __add_keyed_refs(struct btrfs_fs_info *fs_info, | |||
880 | * indirect refs to their parent bytenr. | 880 | * indirect refs to their parent bytenr. |
881 | * When roots are found, they're added to the roots list | 881 | * When roots are found, they're added to the roots list |
882 | * | 882 | * |
883 | * NOTE: This can return values > 0 | ||
884 | * | ||
883 | * FIXME some caching might speed things up | 885 | * FIXME some caching might speed things up |
884 | */ | 886 | */ |
885 | static int find_parent_nodes(struct btrfs_trans_handle *trans, | 887 | static int find_parent_nodes(struct btrfs_trans_handle *trans, |
@@ -1198,6 +1200,19 @@ int btrfs_find_all_roots(struct btrfs_trans_handle *trans, | |||
1198 | return ret; | 1200 | return ret; |
1199 | } | 1201 | } |
1200 | 1202 | ||
1203 | /** | ||
1204 | * btrfs_check_shared - tell us whether an extent is shared | ||
1205 | * | ||
1206 | * @trans: optional trans handle | ||
1207 | * | ||
1208 | * btrfs_check_shared uses the backref walking code but will short | ||
1209 | * circuit as soon as it finds a root or inode that doesn't match the | ||
1210 | * one passed in. This provides a significant performance benefit for | ||
1211 | * callers (such as fiemap) which want to know whether the extent is | ||
1212 | * shared but do not need a ref count. | ||
1213 | * | ||
1214 | * Return: 0 if extent is not shared, 1 if it is shared, < 0 on error. | ||
1215 | */ | ||
1201 | int btrfs_check_shared(struct btrfs_trans_handle *trans, | 1216 | int btrfs_check_shared(struct btrfs_trans_handle *trans, |
1202 | struct btrfs_fs_info *fs_info, u64 root_objectid, | 1217 | struct btrfs_fs_info *fs_info, u64 root_objectid, |
1203 | u64 inum, u64 bytenr) | 1218 | u64 inum, u64 bytenr) |
@@ -1226,11 +1241,13 @@ int btrfs_check_shared(struct btrfs_trans_handle *trans, | |||
1226 | ret = find_parent_nodes(trans, fs_info, bytenr, elem.seq, tmp, | 1241 | ret = find_parent_nodes(trans, fs_info, bytenr, elem.seq, tmp, |
1227 | roots, NULL, root_objectid, inum); | 1242 | roots, NULL, root_objectid, inum); |
1228 | if (ret == BACKREF_FOUND_SHARED) { | 1243 | if (ret == BACKREF_FOUND_SHARED) { |
1244 | /* this is the only condition under which we return 1 */ | ||
1229 | ret = 1; | 1245 | ret = 1; |
1230 | break; | 1246 | break; |
1231 | } | 1247 | } |
1232 | if (ret < 0 && ret != -ENOENT) | 1248 | if (ret < 0 && ret != -ENOENT) |
1233 | break; | 1249 | break; |
1250 | ret = 0; | ||
1234 | node = ulist_next(tmp, &uiter); | 1251 | node = ulist_next(tmp, &uiter); |
1235 | if (!node) | 1252 | if (!node) |
1236 | break; | 1253 | break; |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 7effed6f2fa6..0ec3acd14cbf 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -8829,6 +8829,24 @@ again: | |||
8829 | goto again; | 8829 | goto again; |
8830 | } | 8830 | } |
8831 | 8831 | ||
8832 | /* | ||
8833 | * if we are changing raid levels, try to allocate a corresponding | ||
8834 | * block group with the new raid level. | ||
8835 | */ | ||
8836 | alloc_flags = update_block_group_flags(root, cache->flags); | ||
8837 | if (alloc_flags != cache->flags) { | ||
8838 | ret = do_chunk_alloc(trans, root, alloc_flags, | ||
8839 | CHUNK_ALLOC_FORCE); | ||
8840 | /* | ||
8841 | * ENOSPC is allowed here, we may have enough space | ||
8842 | * already allocated at the new raid level to | ||
8843 | * carry on | ||
8844 | */ | ||
8845 | if (ret == -ENOSPC) | ||
8846 | ret = 0; | ||
8847 | if (ret < 0) | ||
8848 | goto out; | ||
8849 | } | ||
8832 | 8850 | ||
8833 | ret = set_block_group_ro(cache, 0); | 8851 | ret = set_block_group_ro(cache, 0); |
8834 | if (!ret) | 8852 | if (!ret) |
@@ -8842,7 +8860,9 @@ again: | |||
8842 | out: | 8860 | out: |
8843 | if (cache->flags & BTRFS_BLOCK_GROUP_SYSTEM) { | 8861 | if (cache->flags & BTRFS_BLOCK_GROUP_SYSTEM) { |
8844 | alloc_flags = update_block_group_flags(root, cache->flags); | 8862 | alloc_flags = update_block_group_flags(root, cache->flags); |
8863 | lock_chunks(root->fs_info->chunk_root); | ||
8845 | check_system_chunk(trans, root, alloc_flags); | 8864 | check_system_chunk(trans, root, alloc_flags); |
8865 | unlock_chunks(root->fs_info->chunk_root); | ||
8846 | } | 8866 | } |
8847 | mutex_unlock(&root->fs_info->ro_block_group_mutex); | 8867 | mutex_unlock(&root->fs_info->ro_block_group_mutex); |
8848 | 8868 | ||
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 96aebf3bcd5b..174f5e1e00ab 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -4625,6 +4625,7 @@ int btrfs_alloc_chunk(struct btrfs_trans_handle *trans, | |||
4625 | { | 4625 | { |
4626 | u64 chunk_offset; | 4626 | u64 chunk_offset; |
4627 | 4627 | ||
4628 | ASSERT(mutex_is_locked(&extent_root->fs_info->chunk_mutex)); | ||
4628 | chunk_offset = find_next_chunk(extent_root->fs_info); | 4629 | chunk_offset = find_next_chunk(extent_root->fs_info); |
4629 | return __btrfs_alloc_chunk(trans, extent_root, chunk_offset, type); | 4630 | return __btrfs_alloc_chunk(trans, extent_root, chunk_offset, type); |
4630 | } | 4631 | } |
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/dcache.c b/fs/dcache.c index 656ce522a218..37b5afdaf698 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -1239,13 +1239,13 @@ ascend: | |||
1239 | /* might go back up the wrong parent if we have had a rename. */ | 1239 | /* might go back up the wrong parent if we have had a rename. */ |
1240 | if (need_seqretry(&rename_lock, seq)) | 1240 | if (need_seqretry(&rename_lock, seq)) |
1241 | goto rename_retry; | 1241 | goto rename_retry; |
1242 | next = child->d_child.next; | 1242 | /* go into the first sibling still alive */ |
1243 | while (unlikely(child->d_flags & DCACHE_DENTRY_KILLED)) { | 1243 | do { |
1244 | next = child->d_child.next; | ||
1244 | if (next == &this_parent->d_subdirs) | 1245 | if (next == &this_parent->d_subdirs) |
1245 | goto ascend; | 1246 | goto ascend; |
1246 | child = list_entry(next, struct dentry, d_child); | 1247 | child = list_entry(next, struct dentry, d_child); |
1247 | next = next->next; | 1248 | } while (unlikely(child->d_flags & DCACHE_DENTRY_KILLED)); |
1248 | } | ||
1249 | rcu_read_unlock(); | 1249 | rcu_read_unlock(); |
1250 | goto resume; | 1250 | goto resume; |
1251 | } | 1251 | } |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 45b35b9b1e36..55e1e3af23a3 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/mm.h> | 38 | #include <linux/mm.h> |
39 | #include <linux/delay.h> | 39 | #include <linux/delay.h> |
40 | #include <linux/errno.h> | 40 | #include <linux/errno.h> |
41 | #include <linux/file.h> | ||
41 | #include <linux/string.h> | 42 | #include <linux/string.h> |
42 | #include <linux/ratelimit.h> | 43 | #include <linux/ratelimit.h> |
43 | #include <linux/printk.h> | 44 | #include <linux/printk.h> |
@@ -5604,6 +5605,7 @@ static struct nfs4_lockdata *nfs4_alloc_lockdata(struct file_lock *fl, | |||
5604 | p->server = server; | 5605 | p->server = server; |
5605 | atomic_inc(&lsp->ls_count); | 5606 | atomic_inc(&lsp->ls_count); |
5606 | p->ctx = get_nfs_open_context(ctx); | 5607 | p->ctx = get_nfs_open_context(ctx); |
5608 | get_file(fl->fl_file); | ||
5607 | memcpy(&p->fl, fl, sizeof(p->fl)); | 5609 | memcpy(&p->fl, fl, sizeof(p->fl)); |
5608 | return p; | 5610 | return p; |
5609 | out_free_seqid: | 5611 | out_free_seqid: |
@@ -5716,6 +5718,7 @@ static void nfs4_lock_release(void *calldata) | |||
5716 | nfs_free_seqid(data->arg.lock_seqid); | 5718 | nfs_free_seqid(data->arg.lock_seqid); |
5717 | nfs4_put_lock_state(data->lsp); | 5719 | nfs4_put_lock_state(data->lsp); |
5718 | put_nfs_open_context(data->ctx); | 5720 | put_nfs_open_context(data->ctx); |
5721 | fput(data->fl.fl_file); | ||
5719 | kfree(data); | 5722 | kfree(data); |
5720 | dprintk("%s: done!\n", __func__); | 5723 | dprintk("%s: done!\n", __func__); |
5721 | } | 5724 | } |
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index d12a4be613a5..dfc19f1575a1 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -1845,12 +1845,15 @@ int nfs_wb_all(struct inode *inode) | |||
1845 | trace_nfs_writeback_inode_enter(inode); | 1845 | trace_nfs_writeback_inode_enter(inode); |
1846 | 1846 | ||
1847 | ret = filemap_write_and_wait(inode->i_mapping); | 1847 | ret = filemap_write_and_wait(inode->i_mapping); |
1848 | if (!ret) { | 1848 | if (ret) |
1849 | ret = nfs_commit_inode(inode, FLUSH_SYNC); | 1849 | goto out; |
1850 | if (!ret) | 1850 | ret = nfs_commit_inode(inode, FLUSH_SYNC); |
1851 | pnfs_sync_inode(inode, true); | 1851 | if (ret < 0) |
1852 | } | 1852 | goto out; |
1853 | pnfs_sync_inode(inode, true); | ||
1854 | ret = 0; | ||
1853 | 1855 | ||
1856 | out: | ||
1854 | trace_nfs_writeback_inode_exit(inode, ret); | 1857 | trace_nfs_writeback_inode_exit(inode, ret); |
1855 | return ret; | 1858 | return ret; |
1856 | } | 1859 | } |
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/blkdev.h b/include/linux/blkdev.h index 7f9a516f24de..5d93a6645e88 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -821,8 +821,6 @@ extern int scsi_cmd_ioctl(struct request_queue *, struct gendisk *, fmode_t, | |||
821 | extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t, | 821 | extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t, |
822 | struct scsi_ioctl_command __user *); | 822 | struct scsi_ioctl_command __user *); |
823 | 823 | ||
824 | extern void blk_queue_bio(struct request_queue *q, struct bio *bio); | ||
825 | |||
826 | /* | 824 | /* |
827 | * A queue has just exitted congestion. Note this in the global counter of | 825 | * A queue has just exitted congestion. Note this in the global counter of |
828 | * congested queues, and wake up anyone who was waiting for requests to be | 826 | * congested queues, and wake up anyone who was waiting for requests to be |
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/hid-sensor-hub.h b/include/linux/hid-sensor-hub.h index 0408421d885f..0042bf330b99 100644 --- a/include/linux/hid-sensor-hub.h +++ b/include/linux/hid-sensor-hub.h | |||
@@ -74,7 +74,7 @@ struct sensor_hub_pending { | |||
74 | * @usage: Usage id for this hub device instance. | 74 | * @usage: Usage id for this hub device instance. |
75 | * @start_collection_index: Starting index for a phy type collection | 75 | * @start_collection_index: Starting index for a phy type collection |
76 | * @end_collection_index: Last index for a phy type collection | 76 | * @end_collection_index: Last index for a phy type collection |
77 | * @mutex: synchronizing mutex. | 77 | * @mutex_ptr: synchronizing mutex pointer. |
78 | * @pending: Holds information of pending sync read request. | 78 | * @pending: Holds information of pending sync read request. |
79 | */ | 79 | */ |
80 | struct hid_sensor_hub_device { | 80 | struct hid_sensor_hub_device { |
@@ -84,7 +84,7 @@ struct hid_sensor_hub_device { | |||
84 | u32 usage; | 84 | u32 usage; |
85 | int start_collection_index; | 85 | int start_collection_index; |
86 | int end_collection_index; | 86 | int end_collection_index; |
87 | struct mutex mutex; | 87 | struct mutex *mutex_ptr; |
88 | struct sensor_hub_pending pending; | 88 | struct sensor_hub_pending pending; |
89 | }; | 89 | }; |
90 | 90 | ||
diff --git a/include/linux/ktime.h b/include/linux/ktime.h index 5fc3d1083071..2b6a204bd8d4 100644 --- a/include/linux/ktime.h +++ b/include/linux/ktime.h | |||
@@ -166,19 +166,34 @@ static inline bool ktime_before(const ktime_t cmp1, const ktime_t cmp2) | |||
166 | } | 166 | } |
167 | 167 | ||
168 | #if BITS_PER_LONG < 64 | 168 | #if BITS_PER_LONG < 64 |
169 | extern u64 __ktime_divns(const ktime_t kt, s64 div); | 169 | extern s64 __ktime_divns(const ktime_t kt, s64 div); |
170 | static inline u64 ktime_divns(const ktime_t kt, s64 div) | 170 | static inline s64 ktime_divns(const ktime_t kt, s64 div) |
171 | { | 171 | { |
172 | /* | ||
173 | * Negative divisors could cause an inf loop, | ||
174 | * so bug out here. | ||
175 | */ | ||
176 | BUG_ON(div < 0); | ||
172 | if (__builtin_constant_p(div) && !(div >> 32)) { | 177 | if (__builtin_constant_p(div) && !(div >> 32)) { |
173 | u64 ns = kt.tv64; | 178 | s64 ns = kt.tv64; |
174 | do_div(ns, div); | 179 | u64 tmp = ns < 0 ? -ns : ns; |
175 | return ns; | 180 | |
181 | do_div(tmp, div); | ||
182 | return ns < 0 ? -tmp : tmp; | ||
176 | } else { | 183 | } else { |
177 | return __ktime_divns(kt, div); | 184 | return __ktime_divns(kt, div); |
178 | } | 185 | } |
179 | } | 186 | } |
180 | #else /* BITS_PER_LONG < 64 */ | 187 | #else /* BITS_PER_LONG < 64 */ |
181 | # define ktime_divns(kt, div) (u64)((kt).tv64 / (div)) | 188 | static inline s64 ktime_divns(const ktime_t kt, s64 div) |
189 | { | ||
190 | /* | ||
191 | * 32-bit implementation cannot handle negative divisors, | ||
192 | * so catch them on 64bit as well. | ||
193 | */ | ||
194 | WARN_ON(div < 0); | ||
195 | return kt.tv64 / div; | ||
196 | } | ||
182 | #endif | 197 | #endif |
183 | 198 | ||
184 | static inline s64 ktime_to_us(const ktime_t kt) | 199 | static inline s64 ktime_to_us(const ktime_t kt) |
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/linux/platform_data/si5351.h b/include/linux/platform_data/si5351.h index a947ab8b441a..533d9807e543 100644 --- a/include/linux/platform_data/si5351.h +++ b/include/linux/platform_data/si5351.h | |||
@@ -5,8 +5,6 @@ | |||
5 | #ifndef __LINUX_PLATFORM_DATA_SI5351_H__ | 5 | #ifndef __LINUX_PLATFORM_DATA_SI5351_H__ |
6 | #define __LINUX_PLATFORM_DATA_SI5351_H__ | 6 | #define __LINUX_PLATFORM_DATA_SI5351_H__ |
7 | 7 | ||
8 | struct clk; | ||
9 | |||
10 | /** | 8 | /** |
11 | * enum si5351_pll_src - Si5351 pll clock source | 9 | * enum si5351_pll_src - Si5351 pll clock source |
12 | * @SI5351_PLL_SRC_DEFAULT: default, do not change eeprom config | 10 | * @SI5351_PLL_SRC_DEFAULT: default, do not change eeprom config |
@@ -107,8 +105,6 @@ struct si5351_clkout_config { | |||
107 | * @clkout: array of clkout configuration | 105 | * @clkout: array of clkout configuration |
108 | */ | 106 | */ |
109 | struct si5351_platform_data { | 107 | struct si5351_platform_data { |
110 | struct clk *clk_xtal; | ||
111 | struct clk *clk_clkin; | ||
112 | enum si5351_pll_src pll_src[2]; | 108 | enum si5351_pll_src pll_src[2]; |
113 | struct si5351_clkout_config clkout[8]; | 109 | struct si5351_clkout_config clkout[8]; |
114 | }; | 110 | }; |
diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h index dbcbcc59aa92..843ceca9a21e 100644 --- a/include/linux/rhashtable.h +++ b/include/linux/rhashtable.h | |||
@@ -17,6 +17,7 @@ | |||
17 | #ifndef _LINUX_RHASHTABLE_H | 17 | #ifndef _LINUX_RHASHTABLE_H |
18 | #define _LINUX_RHASHTABLE_H | 18 | #define _LINUX_RHASHTABLE_H |
19 | 19 | ||
20 | #include <linux/atomic.h> | ||
20 | #include <linux/compiler.h> | 21 | #include <linux/compiler.h> |
21 | #include <linux/errno.h> | 22 | #include <linux/errno.h> |
22 | #include <linux/jhash.h> | 23 | #include <linux/jhash.h> |
@@ -100,6 +101,7 @@ struct rhashtable; | |||
100 | * @key_len: Length of key | 101 | * @key_len: Length of key |
101 | * @key_offset: Offset of key in struct to be hashed | 102 | * @key_offset: Offset of key in struct to be hashed |
102 | * @head_offset: Offset of rhash_head in struct to be hashed | 103 | * @head_offset: Offset of rhash_head in struct to be hashed |
104 | * @insecure_max_entries: Maximum number of entries (may be exceeded) | ||
103 | * @max_size: Maximum size while expanding | 105 | * @max_size: Maximum size while expanding |
104 | * @min_size: Minimum size while shrinking | 106 | * @min_size: Minimum size while shrinking |
105 | * @nulls_base: Base value to generate nulls marker | 107 | * @nulls_base: Base value to generate nulls marker |
@@ -115,6 +117,7 @@ struct rhashtable_params { | |||
115 | size_t key_len; | 117 | size_t key_len; |
116 | size_t key_offset; | 118 | size_t key_offset; |
117 | size_t head_offset; | 119 | size_t head_offset; |
120 | unsigned int insecure_max_entries; | ||
118 | unsigned int max_size; | 121 | unsigned int max_size; |
119 | unsigned int min_size; | 122 | unsigned int min_size; |
120 | u32 nulls_base; | 123 | u32 nulls_base; |
@@ -286,6 +289,18 @@ static inline bool rht_grow_above_100(const struct rhashtable *ht, | |||
286 | (!ht->p.max_size || tbl->size < ht->p.max_size); | 289 | (!ht->p.max_size || tbl->size < ht->p.max_size); |
287 | } | 290 | } |
288 | 291 | ||
292 | /** | ||
293 | * rht_grow_above_max - returns true if table is above maximum | ||
294 | * @ht: hash table | ||
295 | * @tbl: current table | ||
296 | */ | ||
297 | static inline bool rht_grow_above_max(const struct rhashtable *ht, | ||
298 | const struct bucket_table *tbl) | ||
299 | { | ||
300 | return ht->p.insecure_max_entries && | ||
301 | atomic_read(&ht->nelems) >= ht->p.insecure_max_entries; | ||
302 | } | ||
303 | |||
289 | /* The bucket lock is selected based on the hash and protects mutations | 304 | /* The bucket lock is selected based on the hash and protects mutations |
290 | * on a group of hash buckets. | 305 | * on a group of hash buckets. |
291 | * | 306 | * |
@@ -589,6 +604,10 @@ restart: | |||
589 | goto out; | 604 | goto out; |
590 | } | 605 | } |
591 | 606 | ||
607 | err = -E2BIG; | ||
608 | if (unlikely(rht_grow_above_max(ht, tbl))) | ||
609 | goto out; | ||
610 | |||
592 | if (unlikely(rht_grow_above_100(ht, tbl))) { | 611 | if (unlikely(rht_grow_above_100(ht, tbl))) { |
593 | slow_path: | 612 | slow_path: |
594 | spin_unlock_bh(lock); | 613 | spin_unlock_bh(lock); |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 66e374d62f64..f15154a879c7 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -176,6 +176,7 @@ struct nf_bridge_info { | |||
176 | struct net_device *physindev; | 176 | struct net_device *physindev; |
177 | struct net_device *physoutdev; | 177 | struct net_device *physoutdev; |
178 | char neigh_header[8]; | 178 | char neigh_header[8]; |
179 | __be32 ipv4_daddr; | ||
179 | }; | 180 | }; |
180 | #endif | 181 | #endif |
181 | 182 | ||
diff --git a/include/linux/tcp.h b/include/linux/tcp.h index 3b2911502a8c..e8bbf403618f 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h | |||
@@ -158,6 +158,8 @@ struct tcp_sock { | |||
158 | * sum(delta(snd_una)), or how many bytes | 158 | * sum(delta(snd_una)), or how many bytes |
159 | * were acked. | 159 | * were acked. |
160 | */ | 160 | */ |
161 | struct u64_stats_sync syncp; /* protects 64bit vars (cf tcp_get_info()) */ | ||
162 | |||
161 | u32 snd_una; /* First byte we want an ack for */ | 163 | u32 snd_una; /* First byte we want an ack for */ |
162 | u32 snd_sml; /* Last byte of the most recently transmitted small packet */ | 164 | u32 snd_sml; /* Last byte of the most recently transmitted small packet */ |
163 | u32 rcv_tstamp; /* timestamp of last received ACK (for keepalives) */ | 165 | u32 rcv_tstamp; /* timestamp of last received ACK (for keepalives) */ |
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h index 48a815823587..497bc14cdb85 100644 --- a/include/net/inet_connection_sock.h +++ b/include/net/inet_connection_sock.h | |||
@@ -129,9 +129,10 @@ struct inet_connection_sock { | |||
129 | 129 | ||
130 | u32 probe_timestamp; | 130 | u32 probe_timestamp; |
131 | } icsk_mtup; | 131 | } icsk_mtup; |
132 | u32 icsk_ca_priv[16]; | ||
133 | u32 icsk_user_timeout; | 132 | u32 icsk_user_timeout; |
134 | #define ICSK_CA_PRIV_SIZE (16 * sizeof(u32)) | 133 | |
134 | u64 icsk_ca_priv[64 / sizeof(u64)]; | ||
135 | #define ICSK_CA_PRIV_SIZE (8 * sizeof(u64)) | ||
135 | }; | 136 | }; |
136 | 137 | ||
137 | #define ICSK_TIME_RETRANS 1 /* Retransmit timer */ | 138 | #define ICSK_TIME_RETRANS 1 /* Retransmit timer */ |
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/target/target_core_backend.h b/include/target/target_core_backend.h index d61be7297b2c..5f1225706993 100644 --- a/include/target/target_core_backend.h +++ b/include/target/target_core_backend.h | |||
@@ -1,9 +1,7 @@ | |||
1 | #ifndef TARGET_CORE_BACKEND_H | 1 | #ifndef TARGET_CORE_BACKEND_H |
2 | #define TARGET_CORE_BACKEND_H | 2 | #define TARGET_CORE_BACKEND_H |
3 | 3 | ||
4 | #define TRANSPORT_PLUGIN_PHBA_PDEV 1 | 4 | #define TRANSPORT_FLAG_PASSTHROUGH 1 |
5 | #define TRANSPORT_PLUGIN_VHBA_PDEV 2 | ||
6 | #define TRANSPORT_PLUGIN_VHBA_VDEV 3 | ||
7 | 5 | ||
8 | struct target_backend_cits { | 6 | struct target_backend_cits { |
9 | struct config_item_type tb_dev_cit; | 7 | struct config_item_type tb_dev_cit; |
@@ -22,7 +20,7 @@ struct se_subsystem_api { | |||
22 | char inquiry_rev[4]; | 20 | char inquiry_rev[4]; |
23 | struct module *owner; | 21 | struct module *owner; |
24 | 22 | ||
25 | u8 transport_type; | 23 | u8 transport_flags; |
26 | 24 | ||
27 | int (*attach_hba)(struct se_hba *, u32); | 25 | int (*attach_hba)(struct se_hba *, u32); |
28 | void (*detach_hba)(struct se_hba *); | 26 | void (*detach_hba)(struct se_hba *); |
@@ -138,5 +136,7 @@ int se_dev_set_queue_depth(struct se_device *, u32); | |||
138 | int se_dev_set_max_sectors(struct se_device *, u32); | 136 | int se_dev_set_max_sectors(struct se_device *, u32); |
139 | int se_dev_set_optimal_sectors(struct se_device *, u32); | 137 | int se_dev_set_optimal_sectors(struct se_device *, u32); |
140 | int se_dev_set_block_size(struct se_device *, u32); | 138 | int se_dev_set_block_size(struct se_device *, u32); |
139 | sense_reason_t passthrough_parse_cdb(struct se_cmd *cmd, | ||
140 | sense_reason_t (*exec_cmd)(struct se_cmd *cmd)); | ||
141 | 141 | ||
142 | #endif /* TARGET_CORE_BACKEND_H */ | 142 | #endif /* TARGET_CORE_BACKEND_H */ |
diff --git a/include/target/target_core_configfs.h b/include/target/target_core_configfs.h index 25bb04c4209e..b99c01170392 100644 --- a/include/target/target_core_configfs.h +++ b/include/target/target_core_configfs.h | |||
@@ -40,8 +40,6 @@ struct target_fabric_configfs { | |||
40 | struct config_item *tf_fabric; | 40 | struct config_item *tf_fabric; |
41 | /* Passed from fabric modules */ | 41 | /* Passed from fabric modules */ |
42 | struct config_item_type *tf_fabric_cit; | 42 | struct config_item_type *tf_fabric_cit; |
43 | /* Pointer to target core subsystem */ | ||
44 | struct configfs_subsystem *tf_subsys; | ||
45 | /* Pointer to fabric's struct module */ | 43 | /* Pointer to fabric's struct module */ |
46 | struct module *tf_module; | 44 | struct module *tf_module; |
47 | struct target_core_fabric_ops tf_ops; | 45 | struct target_core_fabric_ops tf_ops; |
diff --git a/include/target/target_core_fabric.h b/include/target/target_core_fabric.h index 17c7f5ac7ea0..0f4dc3768587 100644 --- a/include/target/target_core_fabric.h +++ b/include/target/target_core_fabric.h | |||
@@ -4,7 +4,6 @@ | |||
4 | struct target_core_fabric_ops { | 4 | struct target_core_fabric_ops { |
5 | struct module *module; | 5 | struct module *module; |
6 | const char *name; | 6 | const char *name; |
7 | struct configfs_subsystem *tf_subsys; | ||
8 | char *(*get_fabric_name)(void); | 7 | char *(*get_fabric_name)(void); |
9 | u8 (*get_fabric_proto_ident)(struct se_portal_group *); | 8 | u8 (*get_fabric_proto_ident)(struct se_portal_group *); |
10 | char *(*tpg_get_wwn)(struct se_portal_group *); | 9 | char *(*tpg_get_wwn)(struct se_portal_group *); |
@@ -109,6 +108,9 @@ struct target_core_fabric_ops { | |||
109 | int target_register_template(const struct target_core_fabric_ops *fo); | 108 | int target_register_template(const struct target_core_fabric_ops *fo); |
110 | void target_unregister_template(const struct target_core_fabric_ops *fo); | 109 | void target_unregister_template(const struct target_core_fabric_ops *fo); |
111 | 110 | ||
111 | int target_depend_item(struct config_item *item); | ||
112 | void target_undepend_item(struct config_item *item); | ||
113 | |||
112 | struct se_session *transport_init_session(enum target_prot_op); | 114 | struct se_session *transport_init_session(enum target_prot_op); |
113 | int transport_alloc_session_tags(struct se_session *, unsigned int, | 115 | int transport_alloc_session_tags(struct se_session *, unsigned int, |
114 | unsigned int); | 116 | unsigned int); |
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/include/uapi/linux/netfilter/nf_conntrack_tcp.h b/include/uapi/linux/netfilter/nf_conntrack_tcp.h index 9993a421201c..ef9f80f0f529 100644 --- a/include/uapi/linux/netfilter/nf_conntrack_tcp.h +++ b/include/uapi/linux/netfilter/nf_conntrack_tcp.h | |||
@@ -42,6 +42,9 @@ enum tcp_conntrack { | |||
42 | /* The field td_maxack has been set */ | 42 | /* The field td_maxack has been set */ |
43 | #define IP_CT_TCP_FLAG_MAXACK_SET 0x20 | 43 | #define IP_CT_TCP_FLAG_MAXACK_SET 0x20 |
44 | 44 | ||
45 | /* Marks possibility for expected RFC5961 challenge ACK */ | ||
46 | #define IP_CT_EXP_CHALLENGE_ACK 0x40 | ||
47 | |||
45 | struct nf_ct_tcp_flags { | 48 | struct nf_ct_tcp_flags { |
46 | __u8 flags; | 49 | __u8 flags; |
47 | __u8 mask; | 50 | __u8 mask; |
diff --git a/include/uapi/linux/rtnetlink.h b/include/uapi/linux/rtnetlink.h index 974db03f7b1a..17fb02f488da 100644 --- a/include/uapi/linux/rtnetlink.h +++ b/include/uapi/linux/rtnetlink.h | |||
@@ -337,7 +337,7 @@ struct rtnexthop { | |||
337 | #define RTNH_F_DEAD 1 /* Nexthop is dead (used by multipath) */ | 337 | #define RTNH_F_DEAD 1 /* Nexthop is dead (used by multipath) */ |
338 | #define RTNH_F_PERVASIVE 2 /* Do recursive gateway lookup */ | 338 | #define RTNH_F_PERVASIVE 2 /* Do recursive gateway lookup */ |
339 | #define RTNH_F_ONLINK 4 /* Gateway is forced on link */ | 339 | #define RTNH_F_ONLINK 4 /* Gateway is forced on link */ |
340 | #define RTNH_F_EXTERNAL 8 /* Route installed externally */ | 340 | #define RTNH_F_OFFLOAD 8 /* offloaded route */ |
341 | 341 | ||
342 | /* Macros to handle hexthops */ | 342 | /* Macros to handle hexthops */ |
343 | 343 | ||
diff --git a/include/xen/events.h b/include/xen/events.h index 5321cd9636e6..7d95fdf9cf3e 100644 --- a/include/xen/events.h +++ b/include/xen/events.h | |||
@@ -17,7 +17,7 @@ int bind_evtchn_to_irqhandler(unsigned int evtchn, | |||
17 | irq_handler_t handler, | 17 | irq_handler_t handler, |
18 | unsigned long irqflags, const char *devname, | 18 | unsigned long irqflags, const char *devname, |
19 | void *dev_id); | 19 | void *dev_id); |
20 | int bind_virq_to_irq(unsigned int virq, unsigned int cpu); | 20 | int bind_virq_to_irq(unsigned int virq, unsigned int cpu, bool percpu); |
21 | int bind_virq_to_irqhandler(unsigned int virq, unsigned int cpu, | 21 | int bind_virq_to_irqhandler(unsigned int virq, unsigned int cpu, |
22 | irq_handler_t handler, | 22 | irq_handler_t handler, |
23 | unsigned long irqflags, const char *devname, | 23 | unsigned long irqflags, const char *devname, |
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/kernel/sched/core.c b/kernel/sched/core.c index 57bd333bc4ab..123673291ffb 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
@@ -4389,10 +4389,7 @@ long __sched io_schedule_timeout(long timeout) | |||
4389 | long ret; | 4389 | long ret; |
4390 | 4390 | ||
4391 | current->in_iowait = 1; | 4391 | current->in_iowait = 1; |
4392 | if (old_iowait) | 4392 | blk_schedule_flush_plug(current); |
4393 | blk_schedule_flush_plug(current); | ||
4394 | else | ||
4395 | blk_flush_plug(current); | ||
4396 | 4393 | ||
4397 | delayacct_blkio_start(); | 4394 | delayacct_blkio_start(); |
4398 | rq = raw_rq(); | 4395 | rq = raw_rq(); |
diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index 76d4bd962b19..93ef7190bdea 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c | |||
@@ -266,21 +266,23 @@ lock_hrtimer_base(const struct hrtimer *timer, unsigned long *flags) | |||
266 | /* | 266 | /* |
267 | * Divide a ktime value by a nanosecond value | 267 | * Divide a ktime value by a nanosecond value |
268 | */ | 268 | */ |
269 | u64 __ktime_divns(const ktime_t kt, s64 div) | 269 | s64 __ktime_divns(const ktime_t kt, s64 div) |
270 | { | 270 | { |
271 | u64 dclc; | ||
272 | int sft = 0; | 271 | int sft = 0; |
272 | s64 dclc; | ||
273 | u64 tmp; | ||
273 | 274 | ||
274 | dclc = ktime_to_ns(kt); | 275 | dclc = ktime_to_ns(kt); |
276 | tmp = dclc < 0 ? -dclc : dclc; | ||
277 | |||
275 | /* Make sure the divisor is less than 2^32: */ | 278 | /* Make sure the divisor is less than 2^32: */ |
276 | while (div >> 32) { | 279 | while (div >> 32) { |
277 | sft++; | 280 | sft++; |
278 | div >>= 1; | 281 | div >>= 1; |
279 | } | 282 | } |
280 | dclc >>= sft; | 283 | tmp >>= sft; |
281 | do_div(dclc, (unsigned long) div); | 284 | do_div(tmp, (unsigned long) div); |
282 | 285 | return dclc < 0 ? -tmp : tmp; | |
283 | return dclc; | ||
284 | } | 286 | } |
285 | EXPORT_SYMBOL_GPL(__ktime_divns); | 287 | EXPORT_SYMBOL_GPL(__ktime_divns); |
286 | #endif /* BITS_PER_LONG >= 64 */ | 288 | #endif /* BITS_PER_LONG >= 64 */ |
diff --git a/kernel/watchdog.c b/kernel/watchdog.c index 506edcc500c4..581a68a04c64 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c | |||
@@ -621,7 +621,7 @@ void watchdog_nmi_enable_all(void) | |||
621 | put_online_cpus(); | 621 | put_online_cpus(); |
622 | 622 | ||
623 | unlock: | 623 | unlock: |
624 | mutex_lock(&watchdog_proc_mutex); | 624 | mutex_unlock(&watchdog_proc_mutex); |
625 | } | 625 | } |
626 | 626 | ||
627 | void watchdog_nmi_disable_all(void) | 627 | void watchdog_nmi_disable_all(void) |
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/lib/rhashtable.c b/lib/rhashtable.c index b28df4019ade..4396434e4715 100644 --- a/lib/rhashtable.c +++ b/lib/rhashtable.c | |||
@@ -14,6 +14,7 @@ | |||
14 | * published by the Free Software Foundation. | 14 | * published by the Free Software Foundation. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <linux/atomic.h> | ||
17 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
18 | #include <linux/init.h> | 19 | #include <linux/init.h> |
19 | #include <linux/log2.h> | 20 | #include <linux/log2.h> |
@@ -446,6 +447,10 @@ int rhashtable_insert_slow(struct rhashtable *ht, const void *key, | |||
446 | if (key && rhashtable_lookup_fast(ht, key, ht->p)) | 447 | if (key && rhashtable_lookup_fast(ht, key, ht->p)) |
447 | goto exit; | 448 | goto exit; |
448 | 449 | ||
450 | err = -E2BIG; | ||
451 | if (unlikely(rht_grow_above_max(ht, tbl))) | ||
452 | goto exit; | ||
453 | |||
449 | err = -EAGAIN; | 454 | err = -EAGAIN; |
450 | if (rhashtable_check_elasticity(ht, tbl, hash) || | 455 | if (rhashtable_check_elasticity(ht, tbl, hash) || |
451 | rht_grow_above_100(ht, tbl)) | 456 | rht_grow_above_100(ht, tbl)) |
@@ -738,6 +743,12 @@ int rhashtable_init(struct rhashtable *ht, | |||
738 | if (params->max_size) | 743 | if (params->max_size) |
739 | ht->p.max_size = rounddown_pow_of_two(params->max_size); | 744 | ht->p.max_size = rounddown_pow_of_two(params->max_size); |
740 | 745 | ||
746 | if (params->insecure_max_entries) | ||
747 | ht->p.insecure_max_entries = | ||
748 | rounddown_pow_of_two(params->insecure_max_entries); | ||
749 | else | ||
750 | ht->p.insecure_max_entries = ht->p.max_size * 2; | ||
751 | |||
741 | ht->p.min_size = max(ht->p.min_size, HASH_MIN_SIZE); | 752 | ht->p.min_size = max(ht->p.min_size, HASH_MIN_SIZE); |
742 | 753 | ||
743 | /* The maximum (not average) chain length grows with the | 754 | /* The maximum (not average) chain length grows with the |
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index 98a30a5b8664..59555f0f8fc8 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c | |||
@@ -443,7 +443,7 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event, | |||
443 | case NETDEV_UP: | 443 | case NETDEV_UP: |
444 | /* Put all VLANs for this dev in the up state too. */ | 444 | /* Put all VLANs for this dev in the up state too. */ |
445 | vlan_group_for_each_dev(grp, i, vlandev) { | 445 | vlan_group_for_each_dev(grp, i, vlandev) { |
446 | flgs = vlandev->flags; | 446 | flgs = dev_get_flags(vlandev); |
447 | if (flgs & IFF_UP) | 447 | if (flgs & IFF_UP) |
448 | continue; | 448 | continue; |
449 | 449 | ||
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 4663c3dad3f5..c4802f3bd4c5 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -2854,9 +2854,11 @@ static void le_scan_disable_work_complete(struct hci_dev *hdev, u8 status, | |||
2854 | * state. If we were running both LE and BR/EDR inquiry | 2854 | * state. If we were running both LE and BR/EDR inquiry |
2855 | * simultaneously, and BR/EDR inquiry is already | 2855 | * simultaneously, and BR/EDR inquiry is already |
2856 | * finished, stop discovery, otherwise BR/EDR inquiry | 2856 | * finished, stop discovery, otherwise BR/EDR inquiry |
2857 | * will stop discovery when finished. | 2857 | * will stop discovery when finished. If we will resolve |
2858 | * remote device name, do not change discovery state. | ||
2858 | */ | 2859 | */ |
2859 | if (!test_bit(HCI_INQUIRY, &hdev->flags)) | 2860 | if (!test_bit(HCI_INQUIRY, &hdev->flags) && |
2861 | hdev->discovery.state != DISCOVERY_RESOLVING) | ||
2860 | hci_discovery_set_state(hdev, | 2862 | hci_discovery_set_state(hdev, |
2861 | DISCOVERY_STOPPED); | 2863 | DISCOVERY_STOPPED); |
2862 | } else { | 2864 | } else { |
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 4b6722f8f179..a3abe6ed111e 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c | |||
@@ -1072,7 +1072,7 @@ static int br_ip6_multicast_mld2_report(struct net_bridge *br, | |||
1072 | 1072 | ||
1073 | err = br_ip6_multicast_add_group(br, port, &grec->grec_mca, | 1073 | err = br_ip6_multicast_add_group(br, port, &grec->grec_mca, |
1074 | vid); | 1074 | vid); |
1075 | if (!err) | 1075 | if (err) |
1076 | break; | 1076 | break; |
1077 | } | 1077 | } |
1078 | 1078 | ||
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c index ab55e2472beb..60ddfbeb47f5 100644 --- a/net/bridge/br_netfilter.c +++ b/net/bridge/br_netfilter.c | |||
@@ -37,10 +37,6 @@ | |||
37 | #include <net/route.h> | 37 | #include <net/route.h> |
38 | #include <net/netfilter/br_netfilter.h> | 38 | #include <net/netfilter/br_netfilter.h> |
39 | 39 | ||
40 | #if IS_ENABLED(CONFIG_NF_CONNTRACK) | ||
41 | #include <net/netfilter/nf_conntrack.h> | ||
42 | #endif | ||
43 | |||
44 | #include <asm/uaccess.h> | 40 | #include <asm/uaccess.h> |
45 | #include "br_private.h" | 41 | #include "br_private.h" |
46 | #ifdef CONFIG_SYSCTL | 42 | #ifdef CONFIG_SYSCTL |
@@ -350,24 +346,15 @@ free_skb: | |||
350 | return 0; | 346 | return 0; |
351 | } | 347 | } |
352 | 348 | ||
353 | static bool dnat_took_place(const struct sk_buff *skb) | 349 | static bool daddr_was_changed(const struct sk_buff *skb, |
350 | const struct nf_bridge_info *nf_bridge) | ||
354 | { | 351 | { |
355 | #if IS_ENABLED(CONFIG_NF_CONNTRACK) | 352 | return ip_hdr(skb)->daddr != nf_bridge->ipv4_daddr; |
356 | enum ip_conntrack_info ctinfo; | ||
357 | struct nf_conn *ct; | ||
358 | |||
359 | ct = nf_ct_get(skb, &ctinfo); | ||
360 | if (!ct || nf_ct_is_untracked(ct)) | ||
361 | return false; | ||
362 | |||
363 | return test_bit(IPS_DST_NAT_BIT, &ct->status); | ||
364 | #else | ||
365 | return false; | ||
366 | #endif | ||
367 | } | 353 | } |
368 | 354 | ||
369 | /* This requires some explaining. If DNAT has taken place, | 355 | /* This requires some explaining. If DNAT has taken place, |
370 | * we will need to fix up the destination Ethernet address. | 356 | * we will need to fix up the destination Ethernet address. |
357 | * This is also true when SNAT takes place (for the reply direction). | ||
371 | * | 358 | * |
372 | * There are two cases to consider: | 359 | * There are two cases to consider: |
373 | * 1. The packet was DNAT'ed to a device in the same bridge | 360 | * 1. The packet was DNAT'ed to a device in the same bridge |
@@ -421,7 +408,7 @@ static int br_nf_pre_routing_finish(struct sock *sk, struct sk_buff *skb) | |||
421 | nf_bridge->pkt_otherhost = false; | 408 | nf_bridge->pkt_otherhost = false; |
422 | } | 409 | } |
423 | nf_bridge->mask ^= BRNF_NF_BRIDGE_PREROUTING; | 410 | nf_bridge->mask ^= BRNF_NF_BRIDGE_PREROUTING; |
424 | if (dnat_took_place(skb)) { | 411 | if (daddr_was_changed(skb, nf_bridge)) { |
425 | if ((err = ip_route_input(skb, iph->daddr, iph->saddr, iph->tos, dev))) { | 412 | if ((err = ip_route_input(skb, iph->daddr, iph->saddr, iph->tos, dev))) { |
426 | struct in_device *in_dev = __in_dev_get_rcu(dev); | 413 | struct in_device *in_dev = __in_dev_get_rcu(dev); |
427 | 414 | ||
@@ -632,6 +619,7 @@ static unsigned int br_nf_pre_routing(const struct nf_hook_ops *ops, | |||
632 | struct sk_buff *skb, | 619 | struct sk_buff *skb, |
633 | const struct nf_hook_state *state) | 620 | const struct nf_hook_state *state) |
634 | { | 621 | { |
622 | struct nf_bridge_info *nf_bridge; | ||
635 | struct net_bridge_port *p; | 623 | struct net_bridge_port *p; |
636 | struct net_bridge *br; | 624 | struct net_bridge *br; |
637 | __u32 len = nf_bridge_encap_header_len(skb); | 625 | __u32 len = nf_bridge_encap_header_len(skb); |
@@ -669,6 +657,9 @@ static unsigned int br_nf_pre_routing(const struct nf_hook_ops *ops, | |||
669 | if (!setup_pre_routing(skb)) | 657 | if (!setup_pre_routing(skb)) |
670 | return NF_DROP; | 658 | return NF_DROP; |
671 | 659 | ||
660 | nf_bridge = nf_bridge_info_get(skb); | ||
661 | nf_bridge->ipv4_daddr = ip_hdr(skb)->daddr; | ||
662 | |||
672 | skb->protocol = htons(ETH_P_IP); | 663 | skb->protocol = htons(ETH_P_IP); |
673 | 664 | ||
674 | NF_HOOK(NFPROTO_IPV4, NF_INET_PRE_ROUTING, state->sk, skb, | 665 | NF_HOOK(NFPROTO_IPV4, NF_INET_PRE_ROUTING, state->sk, skb, |
diff --git a/net/bridge/br_stp_timer.c b/net/bridge/br_stp_timer.c index 4fcaa67750fd..7caf7fae2d5b 100644 --- a/net/bridge/br_stp_timer.c +++ b/net/bridge/br_stp_timer.c | |||
@@ -97,7 +97,9 @@ static void br_forward_delay_timer_expired(unsigned long arg) | |||
97 | netif_carrier_on(br->dev); | 97 | netif_carrier_on(br->dev); |
98 | } | 98 | } |
99 | br_log_state(p); | 99 | br_log_state(p); |
100 | rcu_read_lock(); | ||
100 | br_ifinfo_notify(RTM_NEWLINK, p); | 101 | br_ifinfo_notify(RTM_NEWLINK, p); |
102 | rcu_read_unlock(); | ||
101 | spin_unlock(&br->lock); | 103 | spin_unlock(&br->lock); |
102 | } | 104 | } |
103 | 105 | ||
diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c index 91180a7fc943..24c7c96bf5f8 100644 --- a/net/bridge/netfilter/ebtables.c +++ b/net/bridge/netfilter/ebtables.c | |||
@@ -1117,6 +1117,8 @@ static int do_replace(struct net *net, const void __user *user, | |||
1117 | return -ENOMEM; | 1117 | return -ENOMEM; |
1118 | if (tmp.num_counters >= INT_MAX / sizeof(struct ebt_counter)) | 1118 | if (tmp.num_counters >= INT_MAX / sizeof(struct ebt_counter)) |
1119 | return -ENOMEM; | 1119 | return -ENOMEM; |
1120 | if (tmp.num_counters == 0) | ||
1121 | return -EINVAL; | ||
1120 | 1122 | ||
1121 | tmp.name[sizeof(tmp.name) - 1] = 0; | 1123 | tmp.name[sizeof(tmp.name) - 1] = 0; |
1122 | 1124 | ||
@@ -2159,6 +2161,8 @@ static int compat_copy_ebt_replace_from_user(struct ebt_replace *repl, | |||
2159 | return -ENOMEM; | 2161 | return -ENOMEM; |
2160 | if (tmp.num_counters >= INT_MAX / sizeof(struct ebt_counter)) | 2162 | if (tmp.num_counters >= INT_MAX / sizeof(struct ebt_counter)) |
2161 | return -ENOMEM; | 2163 | return -ENOMEM; |
2164 | if (tmp.num_counters == 0) | ||
2165 | return -EINVAL; | ||
2162 | 2166 | ||
2163 | memcpy(repl, &tmp, offsetof(struct ebt_replace, hook_entry)); | 2167 | memcpy(repl, &tmp, offsetof(struct ebt_replace, hook_entry)); |
2164 | 2168 | ||
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/ceph/osd_client.c b/net/ceph/osd_client.c index 41a4abc7e98e..c4ec9239249a 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c | |||
@@ -1306,8 +1306,6 @@ static void __unregister_linger_request(struct ceph_osd_client *osdc, | |||
1306 | if (list_empty(&req->r_osd_item)) | 1306 | if (list_empty(&req->r_osd_item)) |
1307 | req->r_osd = NULL; | 1307 | req->r_osd = NULL; |
1308 | } | 1308 | } |
1309 | |||
1310 | list_del_init(&req->r_req_lru_item); /* can be on notarget */ | ||
1311 | ceph_osdc_put_request(req); | 1309 | ceph_osdc_put_request(req); |
1312 | } | 1310 | } |
1313 | 1311 | ||
@@ -2017,20 +2015,29 @@ static void kick_requests(struct ceph_osd_client *osdc, bool force_resend, | |||
2017 | err = __map_request(osdc, req, | 2015 | err = __map_request(osdc, req, |
2018 | force_resend || force_resend_writes); | 2016 | force_resend || force_resend_writes); |
2019 | dout("__map_request returned %d\n", err); | 2017 | dout("__map_request returned %d\n", err); |
2020 | if (err == 0) | ||
2021 | continue; /* no change and no osd was specified */ | ||
2022 | if (err < 0) | 2018 | if (err < 0) |
2023 | continue; /* hrm! */ | 2019 | continue; /* hrm! */ |
2024 | if (req->r_osd == NULL) { | 2020 | if (req->r_osd == NULL || err > 0) { |
2025 | dout("tid %llu maps to no valid osd\n", req->r_tid); | 2021 | if (req->r_osd == NULL) { |
2026 | needmap++; /* request a newer map */ | 2022 | dout("lingering %p tid %llu maps to no osd\n", |
2027 | continue; | 2023 | req, req->r_tid); |
2028 | } | 2024 | /* |
2025 | * A homeless lingering request makes | ||
2026 | * no sense, as it's job is to keep | ||
2027 | * a particular OSD connection open. | ||
2028 | * Request a newer map and kick the | ||
2029 | * request, knowing that it won't be | ||
2030 | * resent until we actually get a map | ||
2031 | * that can tell us where to send it. | ||
2032 | */ | ||
2033 | needmap++; | ||
2034 | } | ||
2029 | 2035 | ||
2030 | dout("kicking lingering %p tid %llu osd%d\n", req, req->r_tid, | 2036 | dout("kicking lingering %p tid %llu osd%d\n", req, |
2031 | req->r_osd ? req->r_osd->o_osd : -1); | 2037 | req->r_tid, req->r_osd ? req->r_osd->o_osd : -1); |
2032 | __register_request(osdc, req); | 2038 | __register_request(osdc, req); |
2033 | __unregister_linger_request(osdc, req); | 2039 | __unregister_linger_request(osdc, req); |
2040 | } | ||
2034 | } | 2041 | } |
2035 | reset_changed_osds(osdc); | 2042 | reset_changed_osds(osdc); |
2036 | mutex_unlock(&osdc->request_mutex); | 2043 | mutex_unlock(&osdc->request_mutex); |
diff --git a/net/core/ethtool.c b/net/core/ethtool.c index 1d00b8922902..1347e11f5cc9 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c | |||
@@ -359,7 +359,15 @@ static int ethtool_get_settings(struct net_device *dev, void __user *useraddr) | |||
359 | int err; | 359 | int err; |
360 | struct ethtool_cmd cmd; | 360 | struct ethtool_cmd cmd; |
361 | 361 | ||
362 | err = __ethtool_get_settings(dev, &cmd); | 362 | if (!dev->ethtool_ops->get_settings) |
363 | return -EOPNOTSUPP; | ||
364 | |||
365 | if (copy_from_user(&cmd, useraddr, sizeof(cmd))) | ||
366 | return -EFAULT; | ||
367 | |||
368 | cmd.cmd = ETHTOOL_GSET; | ||
369 | |||
370 | err = dev->ethtool_ops->get_settings(dev, &cmd); | ||
363 | if (err < 0) | 371 | if (err < 0) |
364 | return err; | 372 | return err; |
365 | 373 | ||
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 666e0928ba40..8de36824018d 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -2416,6 +2416,9 @@ void rtmsg_ifinfo(int type, struct net_device *dev, unsigned int change, | |||
2416 | { | 2416 | { |
2417 | struct sk_buff *skb; | 2417 | struct sk_buff *skb; |
2418 | 2418 | ||
2419 | if (dev->reg_state != NETREG_REGISTERED) | ||
2420 | return; | ||
2421 | |||
2419 | skb = rtmsg_ifinfo_build_skb(type, dev, change, flags); | 2422 | skb = rtmsg_ifinfo_build_skb(type, dev, change, flags); |
2420 | if (skb) | 2423 | if (skb) |
2421 | rtmsg_ifinfo_send(skb, dev, flags); | 2424 | rtmsg_ifinfo_send(skb, dev, flags); |
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index e13fcc602da2..09b62e17dd8c 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c | |||
@@ -1164,6 +1164,7 @@ int fib_table_insert(struct fib_table *tb, struct fib_config *cfg) | |||
1164 | state = fa->fa_state; | 1164 | state = fa->fa_state; |
1165 | new_fa->fa_state = state & ~FA_S_ACCESSED; | 1165 | new_fa->fa_state = state & ~FA_S_ACCESSED; |
1166 | new_fa->fa_slen = fa->fa_slen; | 1166 | new_fa->fa_slen = fa->fa_slen; |
1167 | new_fa->tb_id = tb->tb_id; | ||
1167 | 1168 | ||
1168 | err = netdev_switch_fib_ipv4_add(key, plen, fi, | 1169 | err = netdev_switch_fib_ipv4_add(key, plen, fi, |
1169 | new_fa->fa_tos, | 1170 | new_fa->fa_tos, |
@@ -1764,7 +1765,7 @@ void fib_table_flush_external(struct fib_table *tb) | |||
1764 | /* record local slen */ | 1765 | /* record local slen */ |
1765 | slen = fa->fa_slen; | 1766 | slen = fa->fa_slen; |
1766 | 1767 | ||
1767 | if (!fi || !(fi->fib_flags & RTNH_F_EXTERNAL)) | 1768 | if (!fi || !(fi->fib_flags & RTNH_F_OFFLOAD)) |
1768 | continue; | 1769 | continue; |
1769 | 1770 | ||
1770 | netdev_switch_fib_ipv4_del(n->key, | 1771 | netdev_switch_fib_ipv4_del(n->key, |
diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c index 13bfe84bf3ca..a61200754f4b 100644 --- a/net/ipv4/netfilter/arp_tables.c +++ b/net/ipv4/netfilter/arp_tables.c | |||
@@ -1075,6 +1075,9 @@ static int do_replace(struct net *net, const void __user *user, | |||
1075 | /* overflow check */ | 1075 | /* overflow check */ |
1076 | if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters)) | 1076 | if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters)) |
1077 | return -ENOMEM; | 1077 | return -ENOMEM; |
1078 | if (tmp.num_counters == 0) | ||
1079 | return -EINVAL; | ||
1080 | |||
1078 | tmp.name[sizeof(tmp.name)-1] = 0; | 1081 | tmp.name[sizeof(tmp.name)-1] = 0; |
1079 | 1082 | ||
1080 | newinfo = xt_alloc_table_info(tmp.size); | 1083 | newinfo = xt_alloc_table_info(tmp.size); |
@@ -1499,6 +1502,9 @@ static int compat_do_replace(struct net *net, void __user *user, | |||
1499 | return -ENOMEM; | 1502 | return -ENOMEM; |
1500 | if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters)) | 1503 | if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters)) |
1501 | return -ENOMEM; | 1504 | return -ENOMEM; |
1505 | if (tmp.num_counters == 0) | ||
1506 | return -EINVAL; | ||
1507 | |||
1502 | tmp.name[sizeof(tmp.name)-1] = 0; | 1508 | tmp.name[sizeof(tmp.name)-1] = 0; |
1503 | 1509 | ||
1504 | newinfo = xt_alloc_table_info(tmp.size); | 1510 | newinfo = xt_alloc_table_info(tmp.size); |
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c index c69db7fa25ee..2d0e265fef6e 100644 --- a/net/ipv4/netfilter/ip_tables.c +++ b/net/ipv4/netfilter/ip_tables.c | |||
@@ -1262,6 +1262,9 @@ do_replace(struct net *net, const void __user *user, unsigned int len) | |||
1262 | /* overflow check */ | 1262 | /* overflow check */ |
1263 | if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters)) | 1263 | if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters)) |
1264 | return -ENOMEM; | 1264 | return -ENOMEM; |
1265 | if (tmp.num_counters == 0) | ||
1266 | return -EINVAL; | ||
1267 | |||
1265 | tmp.name[sizeof(tmp.name)-1] = 0; | 1268 | tmp.name[sizeof(tmp.name)-1] = 0; |
1266 | 1269 | ||
1267 | newinfo = xt_alloc_table_info(tmp.size); | 1270 | newinfo = xt_alloc_table_info(tmp.size); |
@@ -1809,6 +1812,9 @@ compat_do_replace(struct net *net, void __user *user, unsigned int len) | |||
1809 | return -ENOMEM; | 1812 | return -ENOMEM; |
1810 | if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters)) | 1813 | if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters)) |
1811 | return -ENOMEM; | 1814 | return -ENOMEM; |
1815 | if (tmp.num_counters == 0) | ||
1816 | return -EINVAL; | ||
1817 | |||
1812 | tmp.name[sizeof(tmp.name)-1] = 0; | 1818 | tmp.name[sizeof(tmp.name)-1] = 0; |
1813 | 1819 | ||
1814 | newinfo = xt_alloc_table_info(tmp.size); | 1820 | newinfo = xt_alloc_table_info(tmp.size); |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index bff62fc87b8e..f45f2a12f37b 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -902,6 +902,10 @@ static int ip_error(struct sk_buff *skb) | |||
902 | bool send; | 902 | bool send; |
903 | int code; | 903 | int code; |
904 | 904 | ||
905 | /* IP on this device is disabled. */ | ||
906 | if (!in_dev) | ||
907 | goto out; | ||
908 | |||
905 | net = dev_net(rt->dst.dev); | 909 | net = dev_net(rt->dst.dev); |
906 | if (!IN_DEV_FORWARD(in_dev)) { | 910 | if (!IN_DEV_FORWARD(in_dev)) { |
907 | switch (rt->dst.error) { | 911 | switch (rt->dst.error) { |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 46efa03d2b11..f1377f2a0472 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -402,6 +402,7 @@ void tcp_init_sock(struct sock *sk) | |||
402 | tp->snd_ssthresh = TCP_INFINITE_SSTHRESH; | 402 | tp->snd_ssthresh = TCP_INFINITE_SSTHRESH; |
403 | tp->snd_cwnd_clamp = ~0; | 403 | tp->snd_cwnd_clamp = ~0; |
404 | tp->mss_cache = TCP_MSS_DEFAULT; | 404 | tp->mss_cache = TCP_MSS_DEFAULT; |
405 | u64_stats_init(&tp->syncp); | ||
405 | 406 | ||
406 | tp->reordering = sysctl_tcp_reordering; | 407 | tp->reordering = sysctl_tcp_reordering; |
407 | tcp_enable_early_retrans(tp); | 408 | tcp_enable_early_retrans(tp); |
@@ -2598,6 +2599,7 @@ void tcp_get_info(struct sock *sk, struct tcp_info *info) | |||
2598 | const struct tcp_sock *tp = tcp_sk(sk); | 2599 | const struct tcp_sock *tp = tcp_sk(sk); |
2599 | const struct inet_connection_sock *icsk = inet_csk(sk); | 2600 | const struct inet_connection_sock *icsk = inet_csk(sk); |
2600 | u32 now = tcp_time_stamp; | 2601 | u32 now = tcp_time_stamp; |
2602 | unsigned int start; | ||
2601 | u32 rate; | 2603 | u32 rate; |
2602 | 2604 | ||
2603 | memset(info, 0, sizeof(*info)); | 2605 | memset(info, 0, sizeof(*info)); |
@@ -2665,10 +2667,11 @@ void tcp_get_info(struct sock *sk, struct tcp_info *info) | |||
2665 | rate = READ_ONCE(sk->sk_max_pacing_rate); | 2667 | rate = READ_ONCE(sk->sk_max_pacing_rate); |
2666 | info->tcpi_max_pacing_rate = rate != ~0U ? rate : ~0ULL; | 2668 | info->tcpi_max_pacing_rate = rate != ~0U ? rate : ~0ULL; |
2667 | 2669 | ||
2668 | spin_lock_bh(&sk->sk_lock.slock); | 2670 | do { |
2669 | info->tcpi_bytes_acked = tp->bytes_acked; | 2671 | start = u64_stats_fetch_begin_irq(&tp->syncp); |
2670 | info->tcpi_bytes_received = tp->bytes_received; | 2672 | info->tcpi_bytes_acked = tp->bytes_acked; |
2671 | spin_unlock_bh(&sk->sk_lock.slock); | 2673 | info->tcpi_bytes_received = tp->bytes_received; |
2674 | } while (u64_stats_fetch_retry_irq(&tp->syncp, start)); | ||
2672 | } | 2675 | } |
2673 | EXPORT_SYMBOL_GPL(tcp_get_info); | 2676 | EXPORT_SYMBOL_GPL(tcp_get_info); |
2674 | 2677 | ||
diff --git a/net/ipv4/tcp_fastopen.c b/net/ipv4/tcp_fastopen.c index 3c673d5e6cff..46b087a27503 100644 --- a/net/ipv4/tcp_fastopen.c +++ b/net/ipv4/tcp_fastopen.c | |||
@@ -206,6 +206,10 @@ static bool tcp_fastopen_create_child(struct sock *sk, | |||
206 | skb_set_owner_r(skb2, child); | 206 | skb_set_owner_r(skb2, child); |
207 | __skb_queue_tail(&child->sk_receive_queue, skb2); | 207 | __skb_queue_tail(&child->sk_receive_queue, skb2); |
208 | tp->syn_data_acked = 1; | 208 | tp->syn_data_acked = 1; |
209 | |||
210 | /* u64_stats_update_begin(&tp->syncp) not needed here, | ||
211 | * as we certainly are not changing upper 32bit value (0) | ||
212 | */ | ||
209 | tp->bytes_received = end_seq - TCP_SKB_CB(skb)->seq - 1; | 213 | tp->bytes_received = end_seq - TCP_SKB_CB(skb)->seq - 1; |
210 | } else { | 214 | } else { |
211 | end_seq = TCP_SKB_CB(skb)->seq + 1; | 215 | end_seq = TCP_SKB_CB(skb)->seq + 1; |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index bc790ea9960f..c9ab964189a0 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -2698,16 +2698,21 @@ static void tcp_process_loss(struct sock *sk, int flag, bool is_dupack) | |||
2698 | struct tcp_sock *tp = tcp_sk(sk); | 2698 | struct tcp_sock *tp = tcp_sk(sk); |
2699 | bool recovered = !before(tp->snd_una, tp->high_seq); | 2699 | bool recovered = !before(tp->snd_una, tp->high_seq); |
2700 | 2700 | ||
2701 | if ((flag & FLAG_SND_UNA_ADVANCED) && | ||
2702 | tcp_try_undo_loss(sk, false)) | ||
2703 | return; | ||
2704 | |||
2701 | if (tp->frto) { /* F-RTO RFC5682 sec 3.1 (sack enhanced version). */ | 2705 | if (tp->frto) { /* F-RTO RFC5682 sec 3.1 (sack enhanced version). */ |
2702 | /* Step 3.b. A timeout is spurious if not all data are | 2706 | /* Step 3.b. A timeout is spurious if not all data are |
2703 | * lost, i.e., never-retransmitted data are (s)acked. | 2707 | * lost, i.e., never-retransmitted data are (s)acked. |
2704 | */ | 2708 | */ |
2705 | if (tcp_try_undo_loss(sk, flag & FLAG_ORIG_SACK_ACKED)) | 2709 | if ((flag & FLAG_ORIG_SACK_ACKED) && |
2710 | tcp_try_undo_loss(sk, true)) | ||
2706 | return; | 2711 | return; |
2707 | 2712 | ||
2708 | if (after(tp->snd_nxt, tp->high_seq) && | 2713 | if (after(tp->snd_nxt, tp->high_seq)) { |
2709 | (flag & FLAG_DATA_SACKED || is_dupack)) { | 2714 | if (flag & FLAG_DATA_SACKED || is_dupack) |
2710 | tp->frto = 0; /* Loss was real: 2nd part of step 3.a */ | 2715 | tp->frto = 0; /* Step 3.a. loss was real */ |
2711 | } else if (flag & FLAG_SND_UNA_ADVANCED && !recovered) { | 2716 | } else if (flag & FLAG_SND_UNA_ADVANCED && !recovered) { |
2712 | tp->high_seq = tp->snd_nxt; | 2717 | tp->high_seq = tp->snd_nxt; |
2713 | __tcp_push_pending_frames(sk, tcp_current_mss(sk), | 2718 | __tcp_push_pending_frames(sk, tcp_current_mss(sk), |
@@ -2732,8 +2737,6 @@ static void tcp_process_loss(struct sock *sk, int flag, bool is_dupack) | |||
2732 | else if (flag & FLAG_SND_UNA_ADVANCED) | 2737 | else if (flag & FLAG_SND_UNA_ADVANCED) |
2733 | tcp_reset_reno_sack(tp); | 2738 | tcp_reset_reno_sack(tp); |
2734 | } | 2739 | } |
2735 | if (tcp_try_undo_loss(sk, false)) | ||
2736 | return; | ||
2737 | tcp_xmit_retransmit_queue(sk); | 2740 | tcp_xmit_retransmit_queue(sk); |
2738 | } | 2741 | } |
2739 | 2742 | ||
@@ -3283,7 +3286,9 @@ static void tcp_snd_una_update(struct tcp_sock *tp, u32 ack) | |||
3283 | { | 3286 | { |
3284 | u32 delta = ack - tp->snd_una; | 3287 | u32 delta = ack - tp->snd_una; |
3285 | 3288 | ||
3289 | u64_stats_update_begin(&tp->syncp); | ||
3286 | tp->bytes_acked += delta; | 3290 | tp->bytes_acked += delta; |
3291 | u64_stats_update_end(&tp->syncp); | ||
3287 | tp->snd_una = ack; | 3292 | tp->snd_una = ack; |
3288 | } | 3293 | } |
3289 | 3294 | ||
@@ -3292,7 +3297,9 @@ static void tcp_rcv_nxt_update(struct tcp_sock *tp, u32 seq) | |||
3292 | { | 3297 | { |
3293 | u32 delta = seq - tp->rcv_nxt; | 3298 | u32 delta = seq - tp->rcv_nxt; |
3294 | 3299 | ||
3300 | u64_stats_update_begin(&tp->syncp); | ||
3295 | tp->bytes_received += delta; | 3301 | tp->bytes_received += delta; |
3302 | u64_stats_update_end(&tp->syncp); | ||
3296 | tp->rcv_nxt = seq; | 3303 | tp->rcv_nxt = seq; |
3297 | } | 3304 | } |
3298 | 3305 | ||
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c index e5d7649136fc..b5732a54f2ad 100644 --- a/net/ipv4/tcp_minisocks.c +++ b/net/ipv4/tcp_minisocks.c | |||
@@ -300,7 +300,7 @@ void tcp_time_wait(struct sock *sk, int state, int timeo) | |||
300 | tw->tw_v6_daddr = sk->sk_v6_daddr; | 300 | tw->tw_v6_daddr = sk->sk_v6_daddr; |
301 | tw->tw_v6_rcv_saddr = sk->sk_v6_rcv_saddr; | 301 | tw->tw_v6_rcv_saddr = sk->sk_v6_rcv_saddr; |
302 | tw->tw_tclass = np->tclass; | 302 | tw->tw_tclass = np->tclass; |
303 | tw->tw_flowlabel = np->flow_label >> 12; | 303 | tw->tw_flowlabel = be32_to_cpu(np->flow_label & IPV6_FLOWLABEL_MASK); |
304 | tw->tw_ipv6only = sk->sk_ipv6only; | 304 | tw->tw_ipv6only = sk->sk_ipv6only; |
305 | } | 305 | } |
306 | #endif | 306 | #endif |
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c index 96dbffff5a24..bde57b113009 100644 --- a/net/ipv6/ip6_fib.c +++ b/net/ipv6/ip6_fib.c | |||
@@ -693,6 +693,7 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt, | |||
693 | { | 693 | { |
694 | struct rt6_info *iter = NULL; | 694 | struct rt6_info *iter = NULL; |
695 | struct rt6_info **ins; | 695 | struct rt6_info **ins; |
696 | struct rt6_info **fallback_ins = NULL; | ||
696 | int replace = (info->nlh && | 697 | int replace = (info->nlh && |
697 | (info->nlh->nlmsg_flags & NLM_F_REPLACE)); | 698 | (info->nlh->nlmsg_flags & NLM_F_REPLACE)); |
698 | int add = (!info->nlh || | 699 | int add = (!info->nlh || |
@@ -716,8 +717,13 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt, | |||
716 | (info->nlh->nlmsg_flags & NLM_F_EXCL)) | 717 | (info->nlh->nlmsg_flags & NLM_F_EXCL)) |
717 | return -EEXIST; | 718 | return -EEXIST; |
718 | if (replace) { | 719 | if (replace) { |
719 | found++; | 720 | if (rt_can_ecmp == rt6_qualify_for_ecmp(iter)) { |
720 | break; | 721 | found++; |
722 | break; | ||
723 | } | ||
724 | if (rt_can_ecmp) | ||
725 | fallback_ins = fallback_ins ?: ins; | ||
726 | goto next_iter; | ||
721 | } | 727 | } |
722 | 728 | ||
723 | if (iter->dst.dev == rt->dst.dev && | 729 | if (iter->dst.dev == rt->dst.dev && |
@@ -753,9 +759,17 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt, | |||
753 | if (iter->rt6i_metric > rt->rt6i_metric) | 759 | if (iter->rt6i_metric > rt->rt6i_metric) |
754 | break; | 760 | break; |
755 | 761 | ||
762 | next_iter: | ||
756 | ins = &iter->dst.rt6_next; | 763 | ins = &iter->dst.rt6_next; |
757 | } | 764 | } |
758 | 765 | ||
766 | if (fallback_ins && !found) { | ||
767 | /* No ECMP-able route found, replace first non-ECMP one */ | ||
768 | ins = fallback_ins; | ||
769 | iter = *ins; | ||
770 | found++; | ||
771 | } | ||
772 | |||
759 | /* Reset round-robin state, if necessary */ | 773 | /* Reset round-robin state, if necessary */ |
760 | if (ins == &fn->leaf) | 774 | if (ins == &fn->leaf) |
761 | fn->rr_ptr = NULL; | 775 | fn->rr_ptr = NULL; |
@@ -815,6 +829,8 @@ add: | |||
815 | } | 829 | } |
816 | 830 | ||
817 | } else { | 831 | } else { |
832 | int nsiblings; | ||
833 | |||
818 | if (!found) { | 834 | if (!found) { |
819 | if (add) | 835 | if (add) |
820 | goto add; | 836 | goto add; |
@@ -835,8 +851,27 @@ add: | |||
835 | info->nl_net->ipv6.rt6_stats->fib_route_nodes++; | 851 | info->nl_net->ipv6.rt6_stats->fib_route_nodes++; |
836 | fn->fn_flags |= RTN_RTINFO; | 852 | fn->fn_flags |= RTN_RTINFO; |
837 | } | 853 | } |
854 | nsiblings = iter->rt6i_nsiblings; | ||
838 | fib6_purge_rt(iter, fn, info->nl_net); | 855 | fib6_purge_rt(iter, fn, info->nl_net); |
839 | rt6_release(iter); | 856 | rt6_release(iter); |
857 | |||
858 | if (nsiblings) { | ||
859 | /* Replacing an ECMP route, remove all siblings */ | ||
860 | ins = &rt->dst.rt6_next; | ||
861 | iter = *ins; | ||
862 | while (iter) { | ||
863 | if (rt6_qualify_for_ecmp(iter)) { | ||
864 | *ins = iter->dst.rt6_next; | ||
865 | fib6_purge_rt(iter, fn, info->nl_net); | ||
866 | rt6_release(iter); | ||
867 | nsiblings--; | ||
868 | } else { | ||
869 | ins = &iter->dst.rt6_next; | ||
870 | } | ||
871 | iter = *ins; | ||
872 | } | ||
873 | WARN_ON(nsiblings != 0); | ||
874 | } | ||
840 | } | 875 | } |
841 | 876 | ||
842 | return 0; | 877 | return 0; |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index c21777565c58..bc09cb97b840 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -1300,8 +1300,10 @@ emsgsize: | |||
1300 | 1300 | ||
1301 | /* If this is the first and only packet and device | 1301 | /* If this is the first and only packet and device |
1302 | * supports checksum offloading, let's use it. | 1302 | * supports checksum offloading, let's use it. |
1303 | * Use transhdrlen, same as IPv4, because partial | ||
1304 | * sums only work when transhdrlen is set. | ||
1303 | */ | 1305 | */ |
1304 | if (!skb && sk->sk_protocol == IPPROTO_UDP && | 1306 | if (transhdrlen && sk->sk_protocol == IPPROTO_UDP && |
1305 | length + fragheaderlen < mtu && | 1307 | length + fragheaderlen < mtu && |
1306 | rt->dst.dev->features & NETIF_F_V6_CSUM && | 1308 | rt->dst.dev->features & NETIF_F_V6_CSUM && |
1307 | !exthdrlen) | 1309 | !exthdrlen) |
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c index 1a732a1d3c8e..62f5b0d0bc9b 100644 --- a/net/ipv6/netfilter/ip6_tables.c +++ b/net/ipv6/netfilter/ip6_tables.c | |||
@@ -1275,6 +1275,9 @@ do_replace(struct net *net, const void __user *user, unsigned int len) | |||
1275 | /* overflow check */ | 1275 | /* overflow check */ |
1276 | if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters)) | 1276 | if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters)) |
1277 | return -ENOMEM; | 1277 | return -ENOMEM; |
1278 | if (tmp.num_counters == 0) | ||
1279 | return -EINVAL; | ||
1280 | |||
1278 | tmp.name[sizeof(tmp.name)-1] = 0; | 1281 | tmp.name[sizeof(tmp.name)-1] = 0; |
1279 | 1282 | ||
1280 | newinfo = xt_alloc_table_info(tmp.size); | 1283 | newinfo = xt_alloc_table_info(tmp.size); |
@@ -1822,6 +1825,9 @@ compat_do_replace(struct net *net, void __user *user, unsigned int len) | |||
1822 | return -ENOMEM; | 1825 | return -ENOMEM; |
1823 | if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters)) | 1826 | if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters)) |
1824 | return -ENOMEM; | 1827 | return -ENOMEM; |
1828 | if (tmp.num_counters == 0) | ||
1829 | return -EINVAL; | ||
1830 | |||
1825 | tmp.name[sizeof(tmp.name)-1] = 0; | 1831 | tmp.name[sizeof(tmp.name)-1] = 0; |
1826 | 1832 | ||
1827 | newinfo = xt_alloc_table_info(tmp.size); | 1833 | newinfo = xt_alloc_table_info(tmp.size); |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index d3588885f097..c73ae5039e46 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -2504,9 +2504,9 @@ static int ip6_route_multipath(struct fib6_config *cfg, int add) | |||
2504 | int attrlen; | 2504 | int attrlen; |
2505 | int err = 0, last_err = 0; | 2505 | int err = 0, last_err = 0; |
2506 | 2506 | ||
2507 | remaining = cfg->fc_mp_len; | ||
2507 | beginning: | 2508 | beginning: |
2508 | rtnh = (struct rtnexthop *)cfg->fc_mp; | 2509 | rtnh = (struct rtnexthop *)cfg->fc_mp; |
2509 | remaining = cfg->fc_mp_len; | ||
2510 | 2510 | ||
2511 | /* Parse a Multipath Entry */ | 2511 | /* Parse a Multipath Entry */ |
2512 | while (rtnh_ok(rtnh, remaining)) { | 2512 | while (rtnh_ok(rtnh, remaining)) { |
@@ -2536,15 +2536,19 @@ beginning: | |||
2536 | * next hops that have been already added. | 2536 | * next hops that have been already added. |
2537 | */ | 2537 | */ |
2538 | add = 0; | 2538 | add = 0; |
2539 | remaining = cfg->fc_mp_len - remaining; | ||
2539 | goto beginning; | 2540 | goto beginning; |
2540 | } | 2541 | } |
2541 | } | 2542 | } |
2542 | /* Because each route is added like a single route we remove | 2543 | /* Because each route is added like a single route we remove |
2543 | * this flag after the first nexthop (if there is a collision, | 2544 | * these flags after the first nexthop: if there is a collision, |
2544 | * we have already fail to add the first nexthop: | 2545 | * we have already failed to add the first nexthop: |
2545 | * fib6_add_rt2node() has reject it). | 2546 | * fib6_add_rt2node() has rejected it; when replacing, old |
2547 | * nexthops have been replaced by first new, the rest should | ||
2548 | * be added to it. | ||
2546 | */ | 2549 | */ |
2547 | cfg->fc_nlinfo.nlh->nlmsg_flags &= ~NLM_F_EXCL; | 2550 | cfg->fc_nlinfo.nlh->nlmsg_flags &= ~(NLM_F_EXCL | |
2551 | NLM_F_REPLACE); | ||
2548 | rtnh = rtnh_next(rtnh, &remaining); | 2552 | rtnh = rtnh_next(rtnh, &remaining); |
2549 | } | 2553 | } |
2550 | 2554 | ||
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index b6575d665568..3adffb300238 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -914,7 +914,7 @@ static void tcp_v6_timewait_ack(struct sock *sk, struct sk_buff *skb) | |||
914 | tcptw->tw_rcv_wnd >> tw->tw_rcv_wscale, | 914 | tcptw->tw_rcv_wnd >> tw->tw_rcv_wscale, |
915 | tcp_time_stamp + tcptw->tw_ts_offset, | 915 | tcp_time_stamp + tcptw->tw_ts_offset, |
916 | tcptw->tw_ts_recent, tw->tw_bound_dev_if, tcp_twsk_md5_key(tcptw), | 916 | tcptw->tw_ts_recent, tw->tw_bound_dev_if, tcp_twsk_md5_key(tcptw), |
917 | tw->tw_tclass, (tw->tw_flowlabel << 12)); | 917 | tw->tw_tclass, cpu_to_be32(tw->tw_flowlabel)); |
918 | 918 | ||
919 | inet_twsk_put(tw); | 919 | inet_twsk_put(tw); |
920 | } | 920 | } |
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 3477c919fcc8..c2ec41617a35 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -731,7 +731,9 @@ static bool __udp_v6_is_mcast_sock(struct net *net, struct sock *sk, | |||
731 | (inet->inet_dport && inet->inet_dport != rmt_port) || | 731 | (inet->inet_dport && inet->inet_dport != rmt_port) || |
732 | (!ipv6_addr_any(&sk->sk_v6_daddr) && | 732 | (!ipv6_addr_any(&sk->sk_v6_daddr) && |
733 | !ipv6_addr_equal(&sk->sk_v6_daddr, rmt_addr)) || | 733 | !ipv6_addr_equal(&sk->sk_v6_daddr, rmt_addr)) || |
734 | (sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif)) | 734 | (sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif) || |
735 | (!ipv6_addr_any(&sk->sk_v6_rcv_saddr) && | ||
736 | !ipv6_addr_equal(&sk->sk_v6_rcv_saddr, loc_addr))) | ||
735 | return false; | 737 | return false; |
736 | if (!inet6_mc_check(sk, loc_addr, rmt_addr)) | 738 | if (!inet6_mc_check(sk, loc_addr, rmt_addr)) |
737 | return false; | 739 | return false; |
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/mac80211/wep.c b/net/mac80211/wep.c index a4220e92f0cc..efa3f48f1ec5 100644 --- a/net/mac80211/wep.c +++ b/net/mac80211/wep.c | |||
@@ -98,8 +98,7 @@ static u8 *ieee80211_wep_add_iv(struct ieee80211_local *local, | |||
98 | 98 | ||
99 | hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); | 99 | hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); |
100 | 100 | ||
101 | if (WARN_ON(skb_tailroom(skb) < IEEE80211_WEP_ICV_LEN || | 101 | if (WARN_ON(skb_headroom(skb) < IEEE80211_WEP_IV_LEN)) |
102 | skb_headroom(skb) < IEEE80211_WEP_IV_LEN)) | ||
103 | return NULL; | 102 | return NULL; |
104 | 103 | ||
105 | hdrlen = ieee80211_hdrlen(hdr->frame_control); | 104 | hdrlen = ieee80211_hdrlen(hdr->frame_control); |
@@ -167,6 +166,9 @@ int ieee80211_wep_encrypt(struct ieee80211_local *local, | |||
167 | size_t len; | 166 | size_t len; |
168 | u8 rc4key[3 + WLAN_KEY_LEN_WEP104]; | 167 | u8 rc4key[3 + WLAN_KEY_LEN_WEP104]; |
169 | 168 | ||
169 | if (WARN_ON(skb_tailroom(skb) < IEEE80211_WEP_ICV_LEN)) | ||
170 | return -1; | ||
171 | |||
170 | iv = ieee80211_wep_add_iv(local, skb, keylen, keyidx); | 172 | iv = ieee80211_wep_add_iv(local, skb, keylen, keyidx); |
171 | if (!iv) | 173 | if (!iv) |
172 | return -1; | 174 | return -1; |
diff --git a/net/netfilter/Kconfig b/net/netfilter/Kconfig index f70e34a68f70..a0f3e6a3c7d1 100644 --- a/net/netfilter/Kconfig +++ b/net/netfilter/Kconfig | |||
@@ -863,6 +863,7 @@ config NETFILTER_XT_TARGET_TPROXY | |||
863 | depends on NETFILTER_XTABLES | 863 | depends on NETFILTER_XTABLES |
864 | depends on NETFILTER_ADVANCED | 864 | depends on NETFILTER_ADVANCED |
865 | depends on (IPV6 || IPV6=n) | 865 | depends on (IPV6 || IPV6=n) |
866 | depends on (IP6_NF_IPTABLES || IP6_NF_IPTABLES=n) | ||
866 | depends on IP_NF_MANGLE | 867 | depends on IP_NF_MANGLE |
867 | select NF_DEFRAG_IPV4 | 868 | select NF_DEFRAG_IPV4 |
868 | select NF_DEFRAG_IPV6 if IP6_NF_IPTABLES | 869 | select NF_DEFRAG_IPV6 if IP6_NF_IPTABLES |
@@ -1356,6 +1357,7 @@ config NETFILTER_XT_MATCH_SOCKET | |||
1356 | depends on NETFILTER_ADVANCED | 1357 | depends on NETFILTER_ADVANCED |
1357 | depends on !NF_CONNTRACK || NF_CONNTRACK | 1358 | depends on !NF_CONNTRACK || NF_CONNTRACK |
1358 | depends on (IPV6 || IPV6=n) | 1359 | depends on (IPV6 || IPV6=n) |
1360 | depends on (IP6_NF_IPTABLES || IP6_NF_IPTABLES=n) | ||
1359 | select NF_DEFRAG_IPV4 | 1361 | select NF_DEFRAG_IPV4 |
1360 | select NF_DEFRAG_IPV6 if IP6_NF_IPTABLES | 1362 | select NF_DEFRAG_IPV6 if IP6_NF_IPTABLES |
1361 | help | 1363 | help |
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c index 49532672f66d..285eae3a1454 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c | |||
@@ -3823,6 +3823,9 @@ static void __net_exit ip_vs_control_net_cleanup_sysctl(struct net *net) | |||
3823 | cancel_work_sync(&ipvs->defense_work.work); | 3823 | cancel_work_sync(&ipvs->defense_work.work); |
3824 | unregister_net_sysctl_table(ipvs->sysctl_hdr); | 3824 | unregister_net_sysctl_table(ipvs->sysctl_hdr); |
3825 | ip_vs_stop_estimator(net, &ipvs->tot_stats); | 3825 | ip_vs_stop_estimator(net, &ipvs->tot_stats); |
3826 | |||
3827 | if (!net_eq(net, &init_net)) | ||
3828 | kfree(ipvs->sysctl_tbl); | ||
3826 | } | 3829 | } |
3827 | 3830 | ||
3828 | #else | 3831 | #else |
diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c index 5caa0c41bf26..70383de72054 100644 --- a/net/netfilter/nf_conntrack_proto_tcp.c +++ b/net/netfilter/nf_conntrack_proto_tcp.c | |||
@@ -202,7 +202,7 @@ static const u8 tcp_conntracks[2][6][TCP_CONNTRACK_MAX] = { | |||
202 | * sES -> sES :-) | 202 | * sES -> sES :-) |
203 | * sFW -> sCW Normal close request answered by ACK. | 203 | * sFW -> sCW Normal close request answered by ACK. |
204 | * sCW -> sCW | 204 | * sCW -> sCW |
205 | * sLA -> sTW Last ACK detected. | 205 | * sLA -> sTW Last ACK detected (RFC5961 challenged) |
206 | * sTW -> sTW Retransmitted last ACK. Remain in the same state. | 206 | * sTW -> sTW Retransmitted last ACK. Remain in the same state. |
207 | * sCL -> sCL | 207 | * sCL -> sCL |
208 | */ | 208 | */ |
@@ -261,7 +261,7 @@ static const u8 tcp_conntracks[2][6][TCP_CONNTRACK_MAX] = { | |||
261 | * sES -> sES :-) | 261 | * sES -> sES :-) |
262 | * sFW -> sCW Normal close request answered by ACK. | 262 | * sFW -> sCW Normal close request answered by ACK. |
263 | * sCW -> sCW | 263 | * sCW -> sCW |
264 | * sLA -> sTW Last ACK detected. | 264 | * sLA -> sTW Last ACK detected (RFC5961 challenged) |
265 | * sTW -> sTW Retransmitted last ACK. | 265 | * sTW -> sTW Retransmitted last ACK. |
266 | * sCL -> sCL | 266 | * sCL -> sCL |
267 | */ | 267 | */ |
@@ -906,6 +906,7 @@ static int tcp_packet(struct nf_conn *ct, | |||
906 | 1 : ct->proto.tcp.last_win; | 906 | 1 : ct->proto.tcp.last_win; |
907 | ct->proto.tcp.seen[ct->proto.tcp.last_dir].td_scale = | 907 | ct->proto.tcp.seen[ct->proto.tcp.last_dir].td_scale = |
908 | ct->proto.tcp.last_wscale; | 908 | ct->proto.tcp.last_wscale; |
909 | ct->proto.tcp.last_flags &= ~IP_CT_EXP_CHALLENGE_ACK; | ||
909 | ct->proto.tcp.seen[ct->proto.tcp.last_dir].flags = | 910 | ct->proto.tcp.seen[ct->proto.tcp.last_dir].flags = |
910 | ct->proto.tcp.last_flags; | 911 | ct->proto.tcp.last_flags; |
911 | memset(&ct->proto.tcp.seen[dir], 0, | 912 | memset(&ct->proto.tcp.seen[dir], 0, |
@@ -923,7 +924,9 @@ static int tcp_packet(struct nf_conn *ct, | |||
923 | * may be in sync but we are not. In that case, we annotate | 924 | * may be in sync but we are not. In that case, we annotate |
924 | * the TCP options and let the packet go through. If it is a | 925 | * the TCP options and let the packet go through. If it is a |
925 | * valid SYN packet, the server will reply with a SYN/ACK, and | 926 | * valid SYN packet, the server will reply with a SYN/ACK, and |
926 | * then we'll get in sync. Otherwise, the server ignores it. */ | 927 | * then we'll get in sync. Otherwise, the server potentially |
928 | * responds with a challenge ACK if implementing RFC5961. | ||
929 | */ | ||
927 | if (index == TCP_SYN_SET && dir == IP_CT_DIR_ORIGINAL) { | 930 | if (index == TCP_SYN_SET && dir == IP_CT_DIR_ORIGINAL) { |
928 | struct ip_ct_tcp_state seen = {}; | 931 | struct ip_ct_tcp_state seen = {}; |
929 | 932 | ||
@@ -939,6 +942,13 @@ static int tcp_packet(struct nf_conn *ct, | |||
939 | ct->proto.tcp.last_flags |= | 942 | ct->proto.tcp.last_flags |= |
940 | IP_CT_TCP_FLAG_SACK_PERM; | 943 | IP_CT_TCP_FLAG_SACK_PERM; |
941 | } | 944 | } |
945 | /* Mark the potential for RFC5961 challenge ACK, | ||
946 | * this pose a special problem for LAST_ACK state | ||
947 | * as ACK is intrepretated as ACKing last FIN. | ||
948 | */ | ||
949 | if (old_state == TCP_CONNTRACK_LAST_ACK) | ||
950 | ct->proto.tcp.last_flags |= | ||
951 | IP_CT_EXP_CHALLENGE_ACK; | ||
942 | } | 952 | } |
943 | spin_unlock_bh(&ct->lock); | 953 | spin_unlock_bh(&ct->lock); |
944 | if (LOG_INVALID(net, IPPROTO_TCP)) | 954 | if (LOG_INVALID(net, IPPROTO_TCP)) |
@@ -970,6 +980,25 @@ static int tcp_packet(struct nf_conn *ct, | |||
970 | nf_log_packet(net, pf, 0, skb, NULL, NULL, NULL, | 980 | nf_log_packet(net, pf, 0, skb, NULL, NULL, NULL, |
971 | "nf_ct_tcp: invalid state "); | 981 | "nf_ct_tcp: invalid state "); |
972 | return -NF_ACCEPT; | 982 | return -NF_ACCEPT; |
983 | case TCP_CONNTRACK_TIME_WAIT: | ||
984 | /* RFC5961 compliance cause stack to send "challenge-ACK" | ||
985 | * e.g. in response to spurious SYNs. Conntrack MUST | ||
986 | * not believe this ACK is acking last FIN. | ||
987 | */ | ||
988 | if (old_state == TCP_CONNTRACK_LAST_ACK && | ||
989 | index == TCP_ACK_SET && | ||
990 | ct->proto.tcp.last_dir != dir && | ||
991 | ct->proto.tcp.last_index == TCP_SYN_SET && | ||
992 | (ct->proto.tcp.last_flags & IP_CT_EXP_CHALLENGE_ACK)) { | ||
993 | /* Detected RFC5961 challenge ACK */ | ||
994 | ct->proto.tcp.last_flags &= ~IP_CT_EXP_CHALLENGE_ACK; | ||
995 | spin_unlock_bh(&ct->lock); | ||
996 | if (LOG_INVALID(net, IPPROTO_TCP)) | ||
997 | nf_log_packet(net, pf, 0, skb, NULL, NULL, NULL, | ||
998 | "nf_ct_tcp: challenge-ACK ignored "); | ||
999 | return NF_ACCEPT; /* Don't change state */ | ||
1000 | } | ||
1001 | break; | ||
973 | case TCP_CONNTRACK_CLOSE: | 1002 | case TCP_CONNTRACK_CLOSE: |
974 | if (index == TCP_RST_SET | 1003 | if (index == TCP_RST_SET |
975 | && (ct->proto.tcp.seen[!dir].flags & IP_CT_TCP_FLAG_MAXACK_SET) | 1004 | && (ct->proto.tcp.seen[!dir].flags & IP_CT_TCP_FLAG_MAXACK_SET) |
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index ad9d11fb29fd..34ded09317e7 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c | |||
@@ -4472,9 +4472,9 @@ EXPORT_SYMBOL_GPL(nft_data_init); | |||
4472 | */ | 4472 | */ |
4473 | void nft_data_uninit(const struct nft_data *data, enum nft_data_types type) | 4473 | void nft_data_uninit(const struct nft_data *data, enum nft_data_types type) |
4474 | { | 4474 | { |
4475 | switch (type) { | 4475 | if (type < NFT_DATA_VERDICT) |
4476 | case NFT_DATA_VALUE: | ||
4477 | return; | 4476 | return; |
4477 | switch (type) { | ||
4478 | case NFT_DATA_VERDICT: | 4478 | case NFT_DATA_VERDICT: |
4479 | return nft_verdict_uninit(data); | 4479 | return nft_verdict_uninit(data); |
4480 | default: | 4480 | default: |
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c index 3ad91266c821..4ef1fae8445e 100644 --- a/net/netfilter/nfnetlink_log.c +++ b/net/netfilter/nfnetlink_log.c | |||
@@ -1073,7 +1073,13 @@ static struct pernet_operations nfnl_log_net_ops = { | |||
1073 | 1073 | ||
1074 | static int __init nfnetlink_log_init(void) | 1074 | static int __init nfnetlink_log_init(void) |
1075 | { | 1075 | { |
1076 | int status = -ENOMEM; | 1076 | int status; |
1077 | |||
1078 | status = register_pernet_subsys(&nfnl_log_net_ops); | ||
1079 | if (status < 0) { | ||
1080 | pr_err("failed to register pernet ops\n"); | ||
1081 | goto out; | ||
1082 | } | ||
1077 | 1083 | ||
1078 | netlink_register_notifier(&nfulnl_rtnl_notifier); | 1084 | netlink_register_notifier(&nfulnl_rtnl_notifier); |
1079 | status = nfnetlink_subsys_register(&nfulnl_subsys); | 1085 | status = nfnetlink_subsys_register(&nfulnl_subsys); |
@@ -1088,28 +1094,23 @@ static int __init nfnetlink_log_init(void) | |||
1088 | goto cleanup_subsys; | 1094 | goto cleanup_subsys; |
1089 | } | 1095 | } |
1090 | 1096 | ||
1091 | status = register_pernet_subsys(&nfnl_log_net_ops); | ||
1092 | if (status < 0) { | ||
1093 | pr_err("failed to register pernet ops\n"); | ||
1094 | goto cleanup_logger; | ||
1095 | } | ||
1096 | return status; | 1097 | return status; |
1097 | 1098 | ||
1098 | cleanup_logger: | ||
1099 | nf_log_unregister(&nfulnl_logger); | ||
1100 | cleanup_subsys: | 1099 | cleanup_subsys: |
1101 | nfnetlink_subsys_unregister(&nfulnl_subsys); | 1100 | nfnetlink_subsys_unregister(&nfulnl_subsys); |
1102 | cleanup_netlink_notifier: | 1101 | cleanup_netlink_notifier: |
1103 | netlink_unregister_notifier(&nfulnl_rtnl_notifier); | 1102 | netlink_unregister_notifier(&nfulnl_rtnl_notifier); |
1103 | unregister_pernet_subsys(&nfnl_log_net_ops); | ||
1104 | out: | ||
1104 | return status; | 1105 | return status; |
1105 | } | 1106 | } |
1106 | 1107 | ||
1107 | static void __exit nfnetlink_log_fini(void) | 1108 | static void __exit nfnetlink_log_fini(void) |
1108 | { | 1109 | { |
1109 | unregister_pernet_subsys(&nfnl_log_net_ops); | ||
1110 | nf_log_unregister(&nfulnl_logger); | 1110 | nf_log_unregister(&nfulnl_logger); |
1111 | nfnetlink_subsys_unregister(&nfulnl_subsys); | 1111 | nfnetlink_subsys_unregister(&nfulnl_subsys); |
1112 | netlink_unregister_notifier(&nfulnl_rtnl_notifier); | 1112 | netlink_unregister_notifier(&nfulnl_rtnl_notifier); |
1113 | unregister_pernet_subsys(&nfnl_log_net_ops); | ||
1113 | } | 1114 | } |
1114 | 1115 | ||
1115 | MODULE_DESCRIPTION("netfilter userspace logging"); | 1116 | MODULE_DESCRIPTION("netfilter userspace logging"); |
diff --git a/net/netfilter/nfnetlink_queue_core.c b/net/netfilter/nfnetlink_queue_core.c index 0b98c7420239..11c7682fa0ea 100644 --- a/net/netfilter/nfnetlink_queue_core.c +++ b/net/netfilter/nfnetlink_queue_core.c | |||
@@ -1317,7 +1317,13 @@ static struct pernet_operations nfnl_queue_net_ops = { | |||
1317 | 1317 | ||
1318 | static int __init nfnetlink_queue_init(void) | 1318 | static int __init nfnetlink_queue_init(void) |
1319 | { | 1319 | { |
1320 | int status = -ENOMEM; | 1320 | int status; |
1321 | |||
1322 | status = register_pernet_subsys(&nfnl_queue_net_ops); | ||
1323 | if (status < 0) { | ||
1324 | pr_err("nf_queue: failed to register pernet ops\n"); | ||
1325 | goto out; | ||
1326 | } | ||
1321 | 1327 | ||
1322 | netlink_register_notifier(&nfqnl_rtnl_notifier); | 1328 | netlink_register_notifier(&nfqnl_rtnl_notifier); |
1323 | status = nfnetlink_subsys_register(&nfqnl_subsys); | 1329 | status = nfnetlink_subsys_register(&nfqnl_subsys); |
@@ -1326,19 +1332,13 @@ static int __init nfnetlink_queue_init(void) | |||
1326 | goto cleanup_netlink_notifier; | 1332 | goto cleanup_netlink_notifier; |
1327 | } | 1333 | } |
1328 | 1334 | ||
1329 | status = register_pernet_subsys(&nfnl_queue_net_ops); | ||
1330 | if (status < 0) { | ||
1331 | pr_err("nf_queue: failed to register pernet ops\n"); | ||
1332 | goto cleanup_subsys; | ||
1333 | } | ||
1334 | register_netdevice_notifier(&nfqnl_dev_notifier); | 1335 | register_netdevice_notifier(&nfqnl_dev_notifier); |
1335 | nf_register_queue_handler(&nfqh); | 1336 | nf_register_queue_handler(&nfqh); |
1336 | return status; | 1337 | return status; |
1337 | 1338 | ||
1338 | cleanup_subsys: | ||
1339 | nfnetlink_subsys_unregister(&nfqnl_subsys); | ||
1340 | cleanup_netlink_notifier: | 1339 | cleanup_netlink_notifier: |
1341 | netlink_unregister_notifier(&nfqnl_rtnl_notifier); | 1340 | netlink_unregister_notifier(&nfqnl_rtnl_notifier); |
1341 | out: | ||
1342 | return status; | 1342 | return status; |
1343 | } | 1343 | } |
1344 | 1344 | ||
@@ -1346,9 +1346,9 @@ static void __exit nfnetlink_queue_fini(void) | |||
1346 | { | 1346 | { |
1347 | nf_unregister_queue_handler(); | 1347 | nf_unregister_queue_handler(); |
1348 | unregister_netdevice_notifier(&nfqnl_dev_notifier); | 1348 | unregister_netdevice_notifier(&nfqnl_dev_notifier); |
1349 | unregister_pernet_subsys(&nfnl_queue_net_ops); | ||
1350 | nfnetlink_subsys_unregister(&nfqnl_subsys); | 1349 | nfnetlink_subsys_unregister(&nfqnl_subsys); |
1351 | netlink_unregister_notifier(&nfqnl_rtnl_notifier); | 1350 | netlink_unregister_notifier(&nfqnl_rtnl_notifier); |
1351 | unregister_pernet_subsys(&nfnl_queue_net_ops); | ||
1352 | 1352 | ||
1353 | rcu_barrier(); /* Wait for completion of call_rcu()'s */ | 1353 | rcu_barrier(); /* Wait for completion of call_rcu()'s */ |
1354 | } | 1354 | } |
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index daa0b818174b..bf6e76643f78 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -89,7 +89,7 @@ static inline int netlink_is_kernel(struct sock *sk) | |||
89 | return nlk_sk(sk)->flags & NETLINK_KERNEL_SOCKET; | 89 | return nlk_sk(sk)->flags & NETLINK_KERNEL_SOCKET; |
90 | } | 90 | } |
91 | 91 | ||
92 | struct netlink_table *nl_table; | 92 | struct netlink_table *nl_table __read_mostly; |
93 | EXPORT_SYMBOL_GPL(nl_table); | 93 | EXPORT_SYMBOL_GPL(nl_table); |
94 | 94 | ||
95 | static DECLARE_WAIT_QUEUE_HEAD(nl_table_wait); | 95 | static DECLARE_WAIT_QUEUE_HEAD(nl_table_wait); |
@@ -1081,6 +1081,7 @@ static int netlink_insert(struct sock *sk, u32 portid) | |||
1081 | if (err) { | 1081 | if (err) { |
1082 | if (err == -EEXIST) | 1082 | if (err == -EEXIST) |
1083 | err = -EADDRINUSE; | 1083 | err = -EADDRINUSE; |
1084 | nlk_sk(sk)->portid = 0; | ||
1084 | sock_put(sk); | 1085 | sock_put(sk); |
1085 | } | 1086 | } |
1086 | 1087 | ||
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index b6ef9a04de06..a75864d93142 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c | |||
@@ -81,6 +81,11 @@ int unregister_tcf_proto_ops(struct tcf_proto_ops *ops) | |||
81 | struct tcf_proto_ops *t; | 81 | struct tcf_proto_ops *t; |
82 | int rc = -ENOENT; | 82 | int rc = -ENOENT; |
83 | 83 | ||
84 | /* Wait for outstanding call_rcu()s, if any, from a | ||
85 | * tcf_proto_ops's destroy() handler. | ||
86 | */ | ||
87 | rcu_barrier(); | ||
88 | |||
84 | write_lock(&cls_mod_lock); | 89 | write_lock(&cls_mod_lock); |
85 | list_for_each_entry(t, &tcf_proto_base, head) { | 90 | list_for_each_entry(t, &tcf_proto_base, head) { |
86 | if (t == ops) { | 91 | if (t == ops) { |
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/switchdev/switchdev.c b/net/switchdev/switchdev.c index 46568b85c333..055453d48668 100644 --- a/net/switchdev/switchdev.c +++ b/net/switchdev/switchdev.c | |||
@@ -338,7 +338,7 @@ int netdev_switch_fib_ipv4_add(u32 dst, int dst_len, struct fib_info *fi, | |||
338 | fi, tos, type, nlflags, | 338 | fi, tos, type, nlflags, |
339 | tb_id); | 339 | tb_id); |
340 | if (!err) | 340 | if (!err) |
341 | fi->fib_flags |= RTNH_F_EXTERNAL; | 341 | fi->fib_flags |= RTNH_F_OFFLOAD; |
342 | } | 342 | } |
343 | 343 | ||
344 | return err; | 344 | return err; |
@@ -364,7 +364,7 @@ int netdev_switch_fib_ipv4_del(u32 dst, int dst_len, struct fib_info *fi, | |||
364 | const struct swdev_ops *ops; | 364 | const struct swdev_ops *ops; |
365 | int err = 0; | 365 | int err = 0; |
366 | 366 | ||
367 | if (!(fi->fib_flags & RTNH_F_EXTERNAL)) | 367 | if (!(fi->fib_flags & RTNH_F_OFFLOAD)) |
368 | return 0; | 368 | return 0; |
369 | 369 | ||
370 | dev = netdev_switch_get_dev_by_nhs(fi); | 370 | dev = netdev_switch_get_dev_by_nhs(fi); |
@@ -376,7 +376,7 @@ int netdev_switch_fib_ipv4_del(u32 dst, int dst_len, struct fib_info *fi, | |||
376 | err = ops->swdev_fib_ipv4_del(dev, htonl(dst), dst_len, | 376 | err = ops->swdev_fib_ipv4_del(dev, htonl(dst), dst_len, |
377 | fi, tos, type, tb_id); | 377 | fi, tos, type, tb_id); |
378 | if (!err) | 378 | if (!err) |
379 | fi->fib_flags &= ~RTNH_F_EXTERNAL; | 379 | fi->fib_flags &= ~RTNH_F_OFFLOAD; |
380 | } | 380 | } |
381 | 381 | ||
382 | return err; | 382 | return err; |
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/atmel/ac97c.c b/sound/atmel/ac97c.c index cf4cedf2b420..6dad042630d8 100644 --- a/sound/atmel/ac97c.c +++ b/sound/atmel/ac97c.c | |||
@@ -916,7 +916,6 @@ static struct ac97c_platform_data *atmel_ac97c_probe_dt(struct device *dev) | |||
916 | { | 916 | { |
917 | struct ac97c_platform_data *pdata; | 917 | struct ac97c_platform_data *pdata; |
918 | struct device_node *node = dev->of_node; | 918 | struct device_node *node = dev->of_node; |
919 | const struct of_device_id *match; | ||
920 | 919 | ||
921 | if (!node) { | 920 | if (!node) { |
922 | dev_err(dev, "Device does not have associated DT data\n"); | 921 | dev_err(dev, "Device does not have associated DT data\n"); |
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c index ac6b33f3779c..7d45645f10ba 100644 --- a/sound/core/pcm_lib.c +++ b/sound/core/pcm_lib.c | |||
@@ -339,7 +339,7 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream, | |||
339 | if (delta > new_hw_ptr) { | 339 | if (delta > new_hw_ptr) { |
340 | /* check for double acknowledged interrupts */ | 340 | /* check for double acknowledged interrupts */ |
341 | hdelta = curr_jiffies - runtime->hw_ptr_jiffies; | 341 | hdelta = curr_jiffies - runtime->hw_ptr_jiffies; |
342 | if (hdelta > runtime->hw_ptr_buffer_jiffies/2) { | 342 | if (hdelta > runtime->hw_ptr_buffer_jiffies/2 + 1) { |
343 | hw_base += runtime->buffer_size; | 343 | hw_base += runtime->buffer_size; |
344 | if (hw_base >= runtime->boundary) { | 344 | if (hw_base >= runtime->boundary) { |
345 | hw_base = 0; | 345 | hw_base = 0; |
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index 788f969b1a68..ac0db1679f09 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c | |||
@@ -844,8 +844,16 @@ static hda_nid_t path_power_update(struct hda_codec *codec, | |||
844 | snd_hda_codec_write(codec, nid, 0, | 844 | snd_hda_codec_write(codec, nid, 0, |
845 | AC_VERB_SET_POWER_STATE, state); | 845 | AC_VERB_SET_POWER_STATE, state); |
846 | changed = nid; | 846 | changed = nid; |
847 | /* all known codecs seem to be capable to handl | ||
848 | * widgets state even in D3, so far. | ||
849 | * if any new codecs need to restore the widget | ||
850 | * states after D0 transition, call the function | ||
851 | * below. | ||
852 | */ | ||
853 | #if 0 /* disabled */ | ||
847 | if (state == AC_PWRST_D0) | 854 | if (state == AC_PWRST_D0) |
848 | snd_hdac_regmap_sync_node(&codec->core, nid); | 855 | snd_hdac_regmap_sync_node(&codec->core, nid); |
856 | #endif | ||
849 | } | 857 | } |
850 | } | 858 | } |
851 | return changed; | 859 | return changed; |
@@ -4918,9 +4926,12 @@ int snd_hda_gen_parse_auto_config(struct hda_codec *codec, | |||
4918 | dig_only: | 4926 | dig_only: |
4919 | parse_digital(codec); | 4927 | parse_digital(codec); |
4920 | 4928 | ||
4921 | if (spec->power_down_unused || codec->power_save_node) | 4929 | if (spec->power_down_unused || codec->power_save_node) { |
4922 | if (!codec->power_filter) | 4930 | if (!codec->power_filter) |
4923 | 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 | } | ||
4924 | 4935 | ||
4925 | if (!spec->no_analog && spec->beep_nid) { | 4936 | if (!spec->no_analog && spec->beep_nid) { |
4926 | 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_conexant.c b/sound/pci/hda/patch_conexant.c index f8f0dfbef149..78b719b5b34d 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
@@ -968,6 +968,14 @@ static const struct hda_codec_preset snd_hda_preset_conexant[] = { | |||
968 | .patch = patch_conexant_auto }, | 968 | .patch = patch_conexant_auto }, |
969 | { .id = 0x14f150b9, .name = "CX20665", | 969 | { .id = 0x14f150b9, .name = "CX20665", |
970 | .patch = patch_conexant_auto }, | 970 | .patch = patch_conexant_auto }, |
971 | { .id = 0x14f150f1, .name = "CX20721", | ||
972 | .patch = patch_conexant_auto }, | ||
973 | { .id = 0x14f150f2, .name = "CX20722", | ||
974 | .patch = patch_conexant_auto }, | ||
975 | { .id = 0x14f150f3, .name = "CX20723", | ||
976 | .patch = patch_conexant_auto }, | ||
977 | { .id = 0x14f150f4, .name = "CX20724", | ||
978 | .patch = patch_conexant_auto }, | ||
971 | { .id = 0x14f1510f, .name = "CX20751/2", | 979 | { .id = 0x14f1510f, .name = "CX20751/2", |
972 | .patch = patch_conexant_auto }, | 980 | .patch = patch_conexant_auto }, |
973 | { .id = 0x14f15110, .name = "CX20751/2", | 981 | { .id = 0x14f15110, .name = "CX20751/2", |
@@ -1002,6 +1010,10 @@ MODULE_ALIAS("snd-hda-codec-id:14f150ab"); | |||
1002 | MODULE_ALIAS("snd-hda-codec-id:14f150ac"); | 1010 | MODULE_ALIAS("snd-hda-codec-id:14f150ac"); |
1003 | MODULE_ALIAS("snd-hda-codec-id:14f150b8"); | 1011 | MODULE_ALIAS("snd-hda-codec-id:14f150b8"); |
1004 | MODULE_ALIAS("snd-hda-codec-id:14f150b9"); | 1012 | MODULE_ALIAS("snd-hda-codec-id:14f150b9"); |
1013 | MODULE_ALIAS("snd-hda-codec-id:14f150f1"); | ||
1014 | MODULE_ALIAS("snd-hda-codec-id:14f150f2"); | ||
1015 | MODULE_ALIAS("snd-hda-codec-id:14f150f3"); | ||
1016 | MODULE_ALIAS("snd-hda-codec-id:14f150f4"); | ||
1005 | MODULE_ALIAS("snd-hda-codec-id:14f1510f"); | 1017 | MODULE_ALIAS("snd-hda-codec-id:14f1510f"); |
1006 | MODULE_ALIAS("snd-hda-codec-id:14f15110"); | 1018 | MODULE_ALIAS("snd-hda-codec-id:14f15110"); |
1007 | MODULE_ALIAS("snd-hda-codec-id:14f15111"); | 1019 | MODULE_ALIAS("snd-hda-codec-id:14f15111"); |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index e2afd53cc14c..464168426465 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -883,6 +883,8 @@ static struct alc_codec_rename_pci_table rename_pci_tbl[] = { | |||
883 | { 0x10ec0668, 0x1028, 0, "ALC3661" }, | 883 | { 0x10ec0668, 0x1028, 0, "ALC3661" }, |
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" }, | ||
887 | { 0x10ec0256, 0x1028, 0, "ALC3246" }, | ||
886 | { 0x10ec0670, 0x1025, 0, "ALC669X" }, | 888 | { 0x10ec0670, 0x1025, 0, "ALC669X" }, |
887 | { 0x10ec0676, 0x1025, 0, "ALC679X" }, | 889 | { 0x10ec0676, 0x1025, 0, "ALC679X" }, |
888 | { 0x10ec0282, 0x1043, 0, "ALC3229" }, | 890 | { 0x10ec0282, 0x1043, 0, "ALC3229" }, |
@@ -3673,6 +3675,10 @@ static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin, | |||
3673 | alc_process_coef_fw(codec, coef0293); | 3675 | alc_process_coef_fw(codec, coef0293); |
3674 | snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); | 3676 | snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); |
3675 | break; | 3677 | break; |
3678 | case 0x10ec0662: | ||
3679 | snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); | ||
3680 | snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); | ||
3681 | break; | ||
3676 | case 0x10ec0668: | 3682 | case 0x10ec0668: |
3677 | alc_write_coef_idx(codec, 0x11, 0x0001); | 3683 | alc_write_coef_idx(codec, 0x11, 0x0001); |
3678 | snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); | 3684 | snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); |
@@ -3738,7 +3744,6 @@ static void alc_headset_mode_default(struct hda_codec *codec) | |||
3738 | case 0x10ec0288: | 3744 | case 0x10ec0288: |
3739 | alc_process_coef_fw(codec, coef0288); | 3745 | alc_process_coef_fw(codec, coef0288); |
3740 | break; | 3746 | break; |
3741 | break; | ||
3742 | case 0x10ec0292: | 3747 | case 0x10ec0292: |
3743 | alc_process_coef_fw(codec, coef0292); | 3748 | alc_process_coef_fw(codec, coef0292); |
3744 | break; | 3749 | break; |
@@ -4012,7 +4017,7 @@ static void alc_update_headset_mode(struct hda_codec *codec) | |||
4012 | if (new_headset_mode != ALC_HEADSET_MODE_MIC) { | 4017 | if (new_headset_mode != ALC_HEADSET_MODE_MIC) { |
4013 | snd_hda_set_pin_ctl_cache(codec, hp_pin, | 4018 | snd_hda_set_pin_ctl_cache(codec, hp_pin, |
4014 | AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN); | 4019 | AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN); |
4015 | if (spec->headphone_mic_pin) | 4020 | if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin) |
4016 | snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin, | 4021 | snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin, |
4017 | PIN_VREFHIZ); | 4022 | PIN_VREFHIZ); |
4018 | } | 4023 | } |
@@ -4215,6 +4220,23 @@ static void alc_fixup_dell_xps13(struct hda_codec *codec, | |||
4215 | } | 4220 | } |
4216 | } | 4221 | } |
4217 | 4222 | ||
4223 | static void alc_fixup_headset_mode_alc662(struct hda_codec *codec, | ||
4224 | const struct hda_fixup *fix, int action) | ||
4225 | { | ||
4226 | struct alc_spec *spec = codec->spec; | ||
4227 | |||
4228 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | ||
4229 | spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; | ||
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); | ||
4236 | } else | ||
4237 | alc_fixup_headset_mode(codec, fix, action); | ||
4238 | } | ||
4239 | |||
4218 | static void alc_fixup_headset_mode_alc668(struct hda_codec *codec, | 4240 | static void alc_fixup_headset_mode_alc668(struct hda_codec *codec, |
4219 | const struct hda_fixup *fix, int action) | 4241 | const struct hda_fixup *fix, int action) |
4220 | { | 4242 | { |
@@ -5119,6 +5141,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
5119 | SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX), | 5141 | SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX), |
5120 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK), | 5142 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK), |
5121 | SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN), | 5143 | SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN), |
5144 | SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN), | ||
5122 | SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC), | 5145 | SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC), |
5123 | SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC), | 5146 | SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC), |
5124 | SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_BXBT2807_MIC), | 5147 | SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_BXBT2807_MIC), |
@@ -5148,6 +5171,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
5148 | SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | 5171 | SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
5149 | SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK), | 5172 | SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK), |
5150 | SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK), | 5173 | SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK), |
5174 | SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK), | ||
5151 | SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | 5175 | SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
5152 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K), | 5176 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K), |
5153 | SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), | 5177 | SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), |
@@ -5345,6 +5369,13 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { | |||
5345 | {0x17, 0x40000000}, | 5369 | {0x17, 0x40000000}, |
5346 | {0x1d, 0x40700001}, | 5370 | {0x1d, 0x40700001}, |
5347 | {0x21, 0x02211050}), | 5371 | {0x21, 0x02211050}), |
5372 | SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | ||
5373 | ALC255_STANDARD_PINS, | ||
5374 | {0x12, 0x90a60180}, | ||
5375 | {0x14, 0x90170130}, | ||
5376 | {0x17, 0x40000000}, | ||
5377 | {0x1d, 0x40700001}, | ||
5378 | {0x21, 0x02211040}), | ||
5348 | SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | 5379 | SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, |
5349 | ALC256_STANDARD_PINS, | 5380 | ALC256_STANDARD_PINS, |
5350 | {0x13, 0x40000000}), | 5381 | {0x13, 0x40000000}), |
@@ -5598,7 +5629,8 @@ static int patch_alc269(struct hda_codec *codec) | |||
5598 | 5629 | ||
5599 | spec = codec->spec; | 5630 | spec = codec->spec; |
5600 | spec->gen.shared_mic_vref_pin = 0x18; | 5631 | spec->gen.shared_mic_vref_pin = 0x18; |
5601 | codec->power_save_node = 1; | 5632 | if (codec->core.vendor_id != 0x10ec0292) |
5633 | codec->power_save_node = 1; | ||
5602 | 5634 | ||
5603 | snd_hda_pick_fixup(codec, alc269_fixup_models, | 5635 | snd_hda_pick_fixup(codec, alc269_fixup_models, |
5604 | alc269_fixup_tbl, alc269_fixups); | 5636 | alc269_fixup_tbl, alc269_fixups); |
@@ -6079,7 +6111,9 @@ enum { | |||
6079 | ALC662_FIXUP_NO_JACK_DETECT, | 6111 | ALC662_FIXUP_NO_JACK_DETECT, |
6080 | ALC662_FIXUP_ZOTAC_Z68, | 6112 | ALC662_FIXUP_ZOTAC_Z68, |
6081 | ALC662_FIXUP_INV_DMIC, | 6113 | ALC662_FIXUP_INV_DMIC, |
6114 | ALC662_FIXUP_DELL_MIC_NO_PRESENCE, | ||
6082 | ALC668_FIXUP_DELL_MIC_NO_PRESENCE, | 6115 | ALC668_FIXUP_DELL_MIC_NO_PRESENCE, |
6116 | ALC662_FIXUP_HEADSET_MODE, | ||
6083 | ALC668_FIXUP_HEADSET_MODE, | 6117 | ALC668_FIXUP_HEADSET_MODE, |
6084 | ALC662_FIXUP_BASS_MODE4_CHMAP, | 6118 | ALC662_FIXUP_BASS_MODE4_CHMAP, |
6085 | ALC662_FIXUP_BASS_16, | 6119 | ALC662_FIXUP_BASS_16, |
@@ -6272,6 +6306,20 @@ static const struct hda_fixup alc662_fixups[] = { | |||
6272 | .chained = true, | 6306 | .chained = true, |
6273 | .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE | 6307 | .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE |
6274 | }, | 6308 | }, |
6309 | [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = { | ||
6310 | .type = HDA_FIXUP_PINS, | ||
6311 | .v.pins = (const struct hda_pintbl[]) { | ||
6312 | { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */ | ||
6313 | /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */ | ||
6314 | { } | ||
6315 | }, | ||
6316 | .chained = true, | ||
6317 | .chain_id = ALC662_FIXUP_HEADSET_MODE | ||
6318 | }, | ||
6319 | [ALC662_FIXUP_HEADSET_MODE] = { | ||
6320 | .type = HDA_FIXUP_FUNC, | ||
6321 | .v.func = alc_fixup_headset_mode_alc662, | ||
6322 | }, | ||
6275 | [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = { | 6323 | [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = { |
6276 | .type = HDA_FIXUP_PINS, | 6324 | .type = HDA_FIXUP_PINS, |
6277 | .v.pins = (const struct hda_pintbl[]) { | 6325 | .v.pins = (const struct hda_pintbl[]) { |
@@ -6423,6 +6471,18 @@ static const struct hda_model_fixup alc662_fixup_models[] = { | |||
6423 | }; | 6471 | }; |
6424 | 6472 | ||
6425 | static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = { | 6473 | static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = { |
6474 | SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE, | ||
6475 | {0x12, 0x4004c000}, | ||
6476 | {0x14, 0x01014010}, | ||
6477 | {0x15, 0x411111f0}, | ||
6478 | {0x16, 0x411111f0}, | ||
6479 | {0x18, 0x01a19020}, | ||
6480 | {0x19, 0x411111f0}, | ||
6481 | {0x1a, 0x0181302f}, | ||
6482 | {0x1b, 0x0221401f}, | ||
6483 | {0x1c, 0x411111f0}, | ||
6484 | {0x1d, 0x4054c601}, | ||
6485 | {0x1e, 0x411111f0}), | ||
6426 | SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE, | 6486 | SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE, |
6427 | {0x12, 0x99a30130}, | 6487 | {0x12, 0x99a30130}, |
6428 | {0x14, 0x90170110}, | 6488 | {0x14, 0x90170110}, |
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/soc/codecs/mc13783.c b/sound/soc/codecs/mc13783.c index 2ffb9a0570dc..3d44fc50e4d0 100644 --- a/sound/soc/codecs/mc13783.c +++ b/sound/soc/codecs/mc13783.c | |||
@@ -623,14 +623,14 @@ static int mc13783_probe(struct snd_soc_codec *codec) | |||
623 | AUDIO_SSI_SEL, 0); | 623 | AUDIO_SSI_SEL, 0); |
624 | else | 624 | else |
625 | mc13xxx_reg_rmw(priv->mc13xxx, MC13783_AUDIO_CODEC, | 625 | mc13xxx_reg_rmw(priv->mc13xxx, MC13783_AUDIO_CODEC, |
626 | 0, AUDIO_SSI_SEL); | 626 | AUDIO_SSI_SEL, AUDIO_SSI_SEL); |
627 | 627 | ||
628 | if (priv->dac_ssi_port == MC13783_SSI1_PORT) | 628 | if (priv->dac_ssi_port == MC13783_SSI1_PORT) |
629 | mc13xxx_reg_rmw(priv->mc13xxx, MC13783_AUDIO_DAC, | 629 | mc13xxx_reg_rmw(priv->mc13xxx, MC13783_AUDIO_DAC, |
630 | AUDIO_SSI_SEL, 0); | 630 | AUDIO_SSI_SEL, 0); |
631 | else | 631 | else |
632 | mc13xxx_reg_rmw(priv->mc13xxx, MC13783_AUDIO_DAC, | 632 | mc13xxx_reg_rmw(priv->mc13xxx, MC13783_AUDIO_DAC, |
633 | 0, AUDIO_SSI_SEL); | 633 | AUDIO_SSI_SEL, AUDIO_SSI_SEL); |
634 | 634 | ||
635 | return 0; | 635 | return 0; |
636 | } | 636 | } |
diff --git a/sound/soc/codecs/uda1380.c b/sound/soc/codecs/uda1380.c index dc7778b6dd7f..c3c33bd0df1c 100644 --- a/sound/soc/codecs/uda1380.c +++ b/sound/soc/codecs/uda1380.c | |||
@@ -437,7 +437,7 @@ static int uda1380_set_dai_fmt_both(struct snd_soc_dai *codec_dai, | |||
437 | if ((fmt & SND_SOC_DAIFMT_MASTER_MASK) != SND_SOC_DAIFMT_CBS_CFS) | 437 | if ((fmt & SND_SOC_DAIFMT_MASTER_MASK) != SND_SOC_DAIFMT_CBS_CFS) |
438 | return -EINVAL; | 438 | return -EINVAL; |
439 | 439 | ||
440 | uda1380_write(codec, UDA1380_IFACE, iface); | 440 | uda1380_write_reg_cache(codec, UDA1380_IFACE, iface); |
441 | 441 | ||
442 | return 0; | 442 | return 0; |
443 | } | 443 | } |
diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c index 3035d9856415..e97a7615df85 100644 --- a/sound/soc/codecs/wm8960.c +++ b/sound/soc/codecs/wm8960.c | |||
@@ -395,7 +395,7 @@ static const struct snd_soc_dapm_route audio_paths[] = { | |||
395 | { "Right Input Mixer", "Boost Switch", "Right Boost Mixer", }, | 395 | { "Right Input Mixer", "Boost Switch", "Right Boost Mixer", }, |
396 | { "Right Input Mixer", NULL, "RINPUT1", }, /* Really Boost Switch */ | 396 | { "Right Input Mixer", NULL, "RINPUT1", }, /* Really Boost Switch */ |
397 | { "Right Input Mixer", NULL, "RINPUT2" }, | 397 | { "Right Input Mixer", NULL, "RINPUT2" }, |
398 | { "Right Input Mixer", NULL, "LINPUT3" }, | 398 | { "Right Input Mixer", NULL, "RINPUT3" }, |
399 | 399 | ||
400 | { "Left ADC", NULL, "Left Input Mixer" }, | 400 | { "Left ADC", NULL, "Left Input Mixer" }, |
401 | { "Right ADC", NULL, "Right Input Mixer" }, | 401 | { "Right ADC", NULL, "Right Input Mixer" }, |
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 4fbc7689339a..a1c04dab6684 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c | |||
@@ -2754,7 +2754,7 @@ static struct { | |||
2754 | }; | 2754 | }; |
2755 | 2755 | ||
2756 | static int fs_ratios[] = { | 2756 | static int fs_ratios[] = { |
2757 | 64, 128, 192, 256, 348, 512, 768, 1024, 1408, 1536 | 2757 | 64, 128, 192, 256, 384, 512, 768, 1024, 1408, 1536 |
2758 | }; | 2758 | }; |
2759 | 2759 | ||
2760 | static int bclk_divs[] = { | 2760 | static int bclk_divs[] = { |
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index bb4b78eada58..23c91fa65ab8 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c | |||
@@ -1247,7 +1247,7 @@ static int davinci_mcasp_suspend(struct snd_soc_dai *dai) | |||
1247 | u32 reg; | 1247 | u32 reg; |
1248 | int i; | 1248 | int i; |
1249 | 1249 | ||
1250 | context->pm_state = pm_runtime_enabled(mcasp->dev); | 1250 | context->pm_state = pm_runtime_active(mcasp->dev); |
1251 | if (!context->pm_state) | 1251 | if (!context->pm_state) |
1252 | pm_runtime_get_sync(mcasp->dev); | 1252 | pm_runtime_get_sync(mcasp->dev); |
1253 | 1253 | ||
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index defe0f0082b5..158204d08924 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -3100,11 +3100,16 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm, | |||
3100 | } | 3100 | } |
3101 | 3101 | ||
3102 | prefix = soc_dapm_prefix(dapm); | 3102 | prefix = soc_dapm_prefix(dapm); |
3103 | if (prefix) | 3103 | if (prefix) { |
3104 | w->name = kasprintf(GFP_KERNEL, "%s %s", prefix, widget->name); | 3104 | w->name = kasprintf(GFP_KERNEL, "%s %s", prefix, widget->name); |
3105 | else | 3105 | if (widget->sname) |
3106 | w->sname = kasprintf(GFP_KERNEL, "%s %s", prefix, | ||
3107 | widget->sname); | ||
3108 | } else { | ||
3106 | w->name = kasprintf(GFP_KERNEL, "%s", widget->name); | 3109 | w->name = kasprintf(GFP_KERNEL, "%s", widget->name); |
3107 | 3110 | if (widget->sname) | |
3111 | w->sname = kasprintf(GFP_KERNEL, "%s", widget->sname); | ||
3112 | } | ||
3108 | if (w->name == NULL) { | 3113 | if (w->name == NULL) { |
3109 | kfree(w); | 3114 | kfree(w); |
3110 | return NULL; | 3115 | return NULL; |
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index 7c5a70139278..29175346cc4f 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c | |||
@@ -1117,6 +1117,8 @@ bool snd_usb_get_sample_rate_quirk(struct snd_usb_audio *chip) | |||
1117 | switch (chip->usb_id) { | 1117 | switch (chip->usb_id) { |
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 */ | ||
1121 | case USB_ID(0x045E, 0x0779): /* MS Lifecam HD-3000 */ | ||
1120 | case USB_ID(0x04D8, 0xFEEA): /* Benchmark DAC1 Pre */ | 1122 | case USB_ID(0x04D8, 0xFEEA): /* Benchmark DAC1 Pre */ |
1121 | return true; | 1123 | return true; |
1122 | } | 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) { |
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c index bac98ca3d4ca..323b65edfc97 100644 --- a/tools/power/x86/turbostat/turbostat.c +++ b/tools/power/x86/turbostat/turbostat.c | |||
@@ -52,6 +52,7 @@ unsigned int skip_c0; | |||
52 | unsigned int skip_c1; | 52 | unsigned int skip_c1; |
53 | unsigned int do_nhm_cstates; | 53 | unsigned int do_nhm_cstates; |
54 | unsigned int do_snb_cstates; | 54 | unsigned int do_snb_cstates; |
55 | unsigned int do_knl_cstates; | ||
55 | unsigned int do_pc2; | 56 | unsigned int do_pc2; |
56 | unsigned int do_pc3; | 57 | unsigned int do_pc3; |
57 | unsigned int do_pc6; | 58 | unsigned int do_pc6; |
@@ -91,6 +92,7 @@ unsigned int do_gfx_perf_limit_reasons; | |||
91 | unsigned int do_ring_perf_limit_reasons; | 92 | unsigned int do_ring_perf_limit_reasons; |
92 | unsigned int crystal_hz; | 93 | unsigned int crystal_hz; |
93 | unsigned long long tsc_hz; | 94 | unsigned long long tsc_hz; |
95 | int base_cpu; | ||
94 | 96 | ||
95 | #define RAPL_PKG (1 << 0) | 97 | #define RAPL_PKG (1 << 0) |
96 | /* 0x610 MSR_PKG_POWER_LIMIT */ | 98 | /* 0x610 MSR_PKG_POWER_LIMIT */ |
@@ -316,7 +318,7 @@ void print_header(void) | |||
316 | 318 | ||
317 | if (do_nhm_cstates) | 319 | if (do_nhm_cstates) |
318 | outp += sprintf(outp, " CPU%%c1"); | 320 | outp += sprintf(outp, " CPU%%c1"); |
319 | if (do_nhm_cstates && !do_slm_cstates) | 321 | if (do_nhm_cstates && !do_slm_cstates && !do_knl_cstates) |
320 | outp += sprintf(outp, " CPU%%c3"); | 322 | outp += sprintf(outp, " CPU%%c3"); |
321 | if (do_nhm_cstates) | 323 | if (do_nhm_cstates) |
322 | outp += sprintf(outp, " CPU%%c6"); | 324 | outp += sprintf(outp, " CPU%%c6"); |
@@ -546,7 +548,7 @@ int format_counters(struct thread_data *t, struct core_data *c, | |||
546 | if (!(t->flags & CPU_IS_FIRST_THREAD_IN_CORE)) | 548 | if (!(t->flags & CPU_IS_FIRST_THREAD_IN_CORE)) |
547 | goto done; | 549 | goto done; |
548 | 550 | ||
549 | if (do_nhm_cstates && !do_slm_cstates) | 551 | if (do_nhm_cstates && !do_slm_cstates && !do_knl_cstates) |
550 | outp += sprintf(outp, "%8.2f", 100.0 * c->c3/t->tsc); | 552 | outp += sprintf(outp, "%8.2f", 100.0 * c->c3/t->tsc); |
551 | if (do_nhm_cstates) | 553 | if (do_nhm_cstates) |
552 | outp += sprintf(outp, "%8.2f", 100.0 * c->c6/t->tsc); | 554 | outp += sprintf(outp, "%8.2f", 100.0 * c->c6/t->tsc); |
@@ -1018,14 +1020,17 @@ int get_counters(struct thread_data *t, struct core_data *c, struct pkg_data *p) | |||
1018 | if (!(t->flags & CPU_IS_FIRST_THREAD_IN_CORE)) | 1020 | if (!(t->flags & CPU_IS_FIRST_THREAD_IN_CORE)) |
1019 | return 0; | 1021 | return 0; |
1020 | 1022 | ||
1021 | if (do_nhm_cstates && !do_slm_cstates) { | 1023 | if (do_nhm_cstates && !do_slm_cstates && !do_knl_cstates) { |
1022 | if (get_msr(cpu, MSR_CORE_C3_RESIDENCY, &c->c3)) | 1024 | if (get_msr(cpu, MSR_CORE_C3_RESIDENCY, &c->c3)) |
1023 | return -6; | 1025 | return -6; |
1024 | } | 1026 | } |
1025 | 1027 | ||
1026 | if (do_nhm_cstates) { | 1028 | if (do_nhm_cstates && !do_knl_cstates) { |
1027 | if (get_msr(cpu, MSR_CORE_C6_RESIDENCY, &c->c6)) | 1029 | if (get_msr(cpu, MSR_CORE_C6_RESIDENCY, &c->c6)) |
1028 | return -7; | 1030 | return -7; |
1031 | } else if (do_knl_cstates) { | ||
1032 | if (get_msr(cpu, MSR_KNL_CORE_C6_RESIDENCY, &c->c6)) | ||
1033 | return -7; | ||
1029 | } | 1034 | } |
1030 | 1035 | ||
1031 | if (do_snb_cstates) | 1036 | if (do_snb_cstates) |
@@ -1150,7 +1155,7 @@ dump_nhm_platform_info(void) | |||
1150 | unsigned long long msr; | 1155 | unsigned long long msr; |
1151 | unsigned int ratio; | 1156 | unsigned int ratio; |
1152 | 1157 | ||
1153 | get_msr(0, MSR_NHM_PLATFORM_INFO, &msr); | 1158 | get_msr(base_cpu, MSR_NHM_PLATFORM_INFO, &msr); |
1154 | 1159 | ||
1155 | fprintf(stderr, "cpu0: MSR_NHM_PLATFORM_INFO: 0x%08llx\n", msr); | 1160 | fprintf(stderr, "cpu0: MSR_NHM_PLATFORM_INFO: 0x%08llx\n", msr); |
1156 | 1161 | ||
@@ -1162,7 +1167,7 @@ dump_nhm_platform_info(void) | |||
1162 | fprintf(stderr, "%d * %.0f = %.0f MHz base frequency\n", | 1167 | fprintf(stderr, "%d * %.0f = %.0f MHz base frequency\n", |
1163 | ratio, bclk, ratio * bclk); | 1168 | ratio, bclk, ratio * bclk); |
1164 | 1169 | ||
1165 | get_msr(0, MSR_IA32_POWER_CTL, &msr); | 1170 | get_msr(base_cpu, MSR_IA32_POWER_CTL, &msr); |
1166 | fprintf(stderr, "cpu0: MSR_IA32_POWER_CTL: 0x%08llx (C1E auto-promotion: %sabled)\n", | 1171 | fprintf(stderr, "cpu0: MSR_IA32_POWER_CTL: 0x%08llx (C1E auto-promotion: %sabled)\n", |
1167 | msr, msr & 0x2 ? "EN" : "DIS"); | 1172 | msr, msr & 0x2 ? "EN" : "DIS"); |
1168 | 1173 | ||
@@ -1175,7 +1180,7 @@ dump_hsw_turbo_ratio_limits(void) | |||
1175 | unsigned long long msr; | 1180 | unsigned long long msr; |
1176 | unsigned int ratio; | 1181 | unsigned int ratio; |
1177 | 1182 | ||
1178 | get_msr(0, MSR_TURBO_RATIO_LIMIT2, &msr); | 1183 | get_msr(base_cpu, MSR_TURBO_RATIO_LIMIT2, &msr); |
1179 | 1184 | ||
1180 | fprintf(stderr, "cpu0: MSR_TURBO_RATIO_LIMIT2: 0x%08llx\n", msr); | 1185 | fprintf(stderr, "cpu0: MSR_TURBO_RATIO_LIMIT2: 0x%08llx\n", msr); |
1181 | 1186 | ||
@@ -1197,7 +1202,7 @@ dump_ivt_turbo_ratio_limits(void) | |||
1197 | unsigned long long msr; | 1202 | unsigned long long msr; |
1198 | unsigned int ratio; | 1203 | unsigned int ratio; |
1199 | 1204 | ||
1200 | get_msr(0, MSR_TURBO_RATIO_LIMIT1, &msr); | 1205 | get_msr(base_cpu, MSR_TURBO_RATIO_LIMIT1, &msr); |
1201 | 1206 | ||
1202 | fprintf(stderr, "cpu0: MSR_TURBO_RATIO_LIMIT1: 0x%08llx\n", msr); | 1207 | fprintf(stderr, "cpu0: MSR_TURBO_RATIO_LIMIT1: 0x%08llx\n", msr); |
1203 | 1208 | ||
@@ -1249,7 +1254,7 @@ dump_nhm_turbo_ratio_limits(void) | |||
1249 | unsigned long long msr; | 1254 | unsigned long long msr; |
1250 | unsigned int ratio; | 1255 | unsigned int ratio; |
1251 | 1256 | ||
1252 | get_msr(0, MSR_TURBO_RATIO_LIMIT, &msr); | 1257 | get_msr(base_cpu, MSR_TURBO_RATIO_LIMIT, &msr); |
1253 | 1258 | ||
1254 | fprintf(stderr, "cpu0: MSR_TURBO_RATIO_LIMIT: 0x%08llx\n", msr); | 1259 | fprintf(stderr, "cpu0: MSR_TURBO_RATIO_LIMIT: 0x%08llx\n", msr); |
1255 | 1260 | ||
@@ -1296,11 +1301,72 @@ dump_nhm_turbo_ratio_limits(void) | |||
1296 | } | 1301 | } |
1297 | 1302 | ||
1298 | static void | 1303 | static void |
1304 | dump_knl_turbo_ratio_limits(void) | ||
1305 | { | ||
1306 | int cores; | ||
1307 | unsigned int ratio; | ||
1308 | unsigned long long msr; | ||
1309 | int delta_cores; | ||
1310 | int delta_ratio; | ||
1311 | int i; | ||
1312 | |||
1313 | get_msr(base_cpu, MSR_NHM_TURBO_RATIO_LIMIT, &msr); | ||
1314 | |||
1315 | fprintf(stderr, "cpu0: MSR_NHM_TURBO_RATIO_LIMIT: 0x%08llx\n", | ||
1316 | msr); | ||
1317 | |||
1318 | /** | ||
1319 | * Turbo encoding in KNL is as follows: | ||
1320 | * [7:0] -- Base value of number of active cores of bucket 1. | ||
1321 | * [15:8] -- Base value of freq ratio of bucket 1. | ||
1322 | * [20:16] -- +ve delta of number of active cores of bucket 2. | ||
1323 | * i.e. active cores of bucket 2 = | ||
1324 | * active cores of bucket 1 + delta | ||
1325 | * [23:21] -- Negative delta of freq ratio of bucket 2. | ||
1326 | * i.e. freq ratio of bucket 2 = | ||
1327 | * freq ratio of bucket 1 - delta | ||
1328 | * [28:24]-- +ve delta of number of active cores of bucket 3. | ||
1329 | * [31:29]-- -ve delta of freq ratio of bucket 3. | ||
1330 | * [36:32]-- +ve delta of number of active cores of bucket 4. | ||
1331 | * [39:37]-- -ve delta of freq ratio of bucket 4. | ||
1332 | * [44:40]-- +ve delta of number of active cores of bucket 5. | ||
1333 | * [47:45]-- -ve delta of freq ratio of bucket 5. | ||
1334 | * [52:48]-- +ve delta of number of active cores of bucket 6. | ||
1335 | * [55:53]-- -ve delta of freq ratio of bucket 6. | ||
1336 | * [60:56]-- +ve delta of number of active cores of bucket 7. | ||
1337 | * [63:61]-- -ve delta of freq ratio of bucket 7. | ||
1338 | */ | ||
1339 | cores = msr & 0xFF; | ||
1340 | ratio = (msr >> 8) && 0xFF; | ||
1341 | if (ratio > 0) | ||
1342 | fprintf(stderr, | ||
1343 | "%d * %.0f = %.0f MHz max turbo %d active cores\n", | ||
1344 | ratio, bclk, ratio * bclk, cores); | ||
1345 | |||
1346 | for (i = 16; i < 64; i = i + 8) { | ||
1347 | delta_cores = (msr >> i) & 0x1F; | ||
1348 | delta_ratio = (msr >> (i + 5)) && 0x7; | ||
1349 | if (!delta_cores || !delta_ratio) | ||
1350 | return; | ||
1351 | cores = cores + delta_cores; | ||
1352 | ratio = ratio - delta_ratio; | ||
1353 | |||
1354 | /** -ve ratios will make successive ratio calculations | ||
1355 | * negative. Hence return instead of carrying on. | ||
1356 | */ | ||
1357 | if (ratio > 0) | ||
1358 | fprintf(stderr, | ||
1359 | "%d * %.0f = %.0f MHz max turbo %d active cores\n", | ||
1360 | ratio, bclk, ratio * bclk, cores); | ||
1361 | } | ||
1362 | } | ||
1363 | |||
1364 | static void | ||
1299 | dump_nhm_cst_cfg(void) | 1365 | dump_nhm_cst_cfg(void) |
1300 | { | 1366 | { |
1301 | unsigned long long msr; | 1367 | unsigned long long msr; |
1302 | 1368 | ||
1303 | get_msr(0, MSR_NHM_SNB_PKG_CST_CFG_CTL, &msr); | 1369 | get_msr(base_cpu, MSR_NHM_SNB_PKG_CST_CFG_CTL, &msr); |
1304 | 1370 | ||
1305 | #define SNB_C1_AUTO_UNDEMOTE (1UL << 27) | 1371 | #define SNB_C1_AUTO_UNDEMOTE (1UL << 27) |
1306 | #define SNB_C3_AUTO_UNDEMOTE (1UL << 28) | 1372 | #define SNB_C3_AUTO_UNDEMOTE (1UL << 28) |
@@ -1381,12 +1447,41 @@ int parse_int_file(const char *fmt, ...) | |||
1381 | } | 1447 | } |
1382 | 1448 | ||
1383 | /* | 1449 | /* |
1384 | * cpu_is_first_sibling_in_core(cpu) | 1450 | * get_cpu_position_in_core(cpu) |
1385 | * return 1 if given CPU is 1st HT sibling in the core | 1451 | * return the position of the CPU among its HT siblings in the core |
1452 | * return -1 if the sibling is not in list | ||
1386 | */ | 1453 | */ |
1387 | int cpu_is_first_sibling_in_core(int cpu) | 1454 | int get_cpu_position_in_core(int cpu) |
1388 | { | 1455 | { |
1389 | return cpu == parse_int_file("/sys/devices/system/cpu/cpu%d/topology/thread_siblings_list", cpu); | 1456 | char path[64]; |
1457 | FILE *filep; | ||
1458 | int this_cpu; | ||
1459 | char character; | ||
1460 | int i; | ||
1461 | |||
1462 | sprintf(path, | ||
1463 | "/sys/devices/system/cpu/cpu%d/topology/thread_siblings_list", | ||
1464 | cpu); | ||
1465 | filep = fopen(path, "r"); | ||
1466 | if (filep == NULL) { | ||
1467 | perror(path); | ||
1468 | exit(1); | ||
1469 | } | ||
1470 | |||
1471 | for (i = 0; i < topo.num_threads_per_core; i++) { | ||
1472 | fscanf(filep, "%d", &this_cpu); | ||
1473 | if (this_cpu == cpu) { | ||
1474 | fclose(filep); | ||
1475 | return i; | ||
1476 | } | ||
1477 | |||
1478 | /* Account for no separator after last thread*/ | ||
1479 | if (i != (topo.num_threads_per_core - 1)) | ||
1480 | fscanf(filep, "%c", &character); | ||
1481 | } | ||
1482 | |||
1483 | fclose(filep); | ||
1484 | return -1; | ||
1390 | } | 1485 | } |
1391 | 1486 | ||
1392 | /* | 1487 | /* |
@@ -1412,25 +1507,31 @@ int get_num_ht_siblings(int cpu) | |||
1412 | { | 1507 | { |
1413 | char path[80]; | 1508 | char path[80]; |
1414 | FILE *filep; | 1509 | FILE *filep; |
1415 | int sib1, sib2; | 1510 | int sib1; |
1416 | int matches; | 1511 | int matches = 0; |
1417 | char character; | 1512 | char character; |
1513 | char str[100]; | ||
1514 | char *ch; | ||
1418 | 1515 | ||
1419 | sprintf(path, "/sys/devices/system/cpu/cpu%d/topology/thread_siblings_list", cpu); | 1516 | sprintf(path, "/sys/devices/system/cpu/cpu%d/topology/thread_siblings_list", cpu); |
1420 | filep = fopen_or_die(path, "r"); | 1517 | filep = fopen_or_die(path, "r"); |
1518 | |||
1421 | /* | 1519 | /* |
1422 | * file format: | 1520 | * file format: |
1423 | * if a pair of number with a character between: 2 siblings (eg. 1-2, or 1,4) | 1521 | * A ',' separated or '-' separated set of numbers |
1424 | * otherwinse 1 sibling (self). | 1522 | * (eg 1-2 or 1,3,4,5) |
1425 | */ | 1523 | */ |
1426 | matches = fscanf(filep, "%d%c%d\n", &sib1, &character, &sib2); | 1524 | fscanf(filep, "%d%c\n", &sib1, &character); |
1525 | fseek(filep, 0, SEEK_SET); | ||
1526 | fgets(str, 100, filep); | ||
1527 | ch = strchr(str, character); | ||
1528 | while (ch != NULL) { | ||
1529 | matches++; | ||
1530 | ch = strchr(ch+1, character); | ||
1531 | } | ||
1427 | 1532 | ||
1428 | fclose(filep); | 1533 | fclose(filep); |
1429 | 1534 | return matches+1; | |
1430 | if (matches == 3) | ||
1431 | return 2; | ||
1432 | else | ||
1433 | return 1; | ||
1434 | } | 1535 | } |
1435 | 1536 | ||
1436 | /* | 1537 | /* |
@@ -1594,8 +1695,10 @@ restart: | |||
1594 | void check_dev_msr() | 1695 | void check_dev_msr() |
1595 | { | 1696 | { |
1596 | struct stat sb; | 1697 | struct stat sb; |
1698 | char pathname[32]; | ||
1597 | 1699 | ||
1598 | if (stat("/dev/cpu/0/msr", &sb)) | 1700 | sprintf(pathname, "/dev/cpu/%d/msr", base_cpu); |
1701 | if (stat(pathname, &sb)) | ||
1599 | if (system("/sbin/modprobe msr > /dev/null 2>&1")) | 1702 | if (system("/sbin/modprobe msr > /dev/null 2>&1")) |
1600 | err(-5, "no /dev/cpu/0/msr, Try \"# modprobe msr\" "); | 1703 | err(-5, "no /dev/cpu/0/msr, Try \"# modprobe msr\" "); |
1601 | } | 1704 | } |
@@ -1608,6 +1711,7 @@ void check_permissions() | |||
1608 | cap_user_data_t cap_data = &cap_data_data; | 1711 | cap_user_data_t cap_data = &cap_data_data; |
1609 | extern int capget(cap_user_header_t hdrp, cap_user_data_t datap); | 1712 | extern int capget(cap_user_header_t hdrp, cap_user_data_t datap); |
1610 | int do_exit = 0; | 1713 | int do_exit = 0; |
1714 | char pathname[32]; | ||
1611 | 1715 | ||
1612 | /* check for CAP_SYS_RAWIO */ | 1716 | /* check for CAP_SYS_RAWIO */ |
1613 | cap_header->pid = getpid(); | 1717 | cap_header->pid = getpid(); |
@@ -1622,7 +1726,8 @@ void check_permissions() | |||
1622 | } | 1726 | } |
1623 | 1727 | ||
1624 | /* test file permissions */ | 1728 | /* test file permissions */ |
1625 | if (euidaccess("/dev/cpu/0/msr", R_OK)) { | 1729 | sprintf(pathname, "/dev/cpu/%d/msr", base_cpu); |
1730 | if (euidaccess(pathname, R_OK)) { | ||
1626 | do_exit++; | 1731 | do_exit++; |
1627 | warn("/dev/cpu/0/msr open failed, try chown or chmod +r /dev/cpu/*/msr"); | 1732 | warn("/dev/cpu/0/msr open failed, try chown or chmod +r /dev/cpu/*/msr"); |
1628 | } | 1733 | } |
@@ -1704,7 +1809,7 @@ int probe_nhm_msrs(unsigned int family, unsigned int model) | |||
1704 | default: | 1809 | default: |
1705 | return 0; | 1810 | return 0; |
1706 | } | 1811 | } |
1707 | get_msr(0, MSR_NHM_SNB_PKG_CST_CFG_CTL, &msr); | 1812 | get_msr(base_cpu, MSR_NHM_SNB_PKG_CST_CFG_CTL, &msr); |
1708 | 1813 | ||
1709 | pkg_cstate_limit = pkg_cstate_limits[msr & 0xF]; | 1814 | pkg_cstate_limit = pkg_cstate_limits[msr & 0xF]; |
1710 | 1815 | ||
@@ -1753,6 +1858,21 @@ int has_hsw_turbo_ratio_limit(unsigned int family, unsigned int model) | |||
1753 | } | 1858 | } |
1754 | } | 1859 | } |
1755 | 1860 | ||
1861 | int has_knl_turbo_ratio_limit(unsigned int family, unsigned int model) | ||
1862 | { | ||
1863 | if (!genuine_intel) | ||
1864 | return 0; | ||
1865 | |||
1866 | if (family != 6) | ||
1867 | return 0; | ||
1868 | |||
1869 | switch (model) { | ||
1870 | case 0x57: /* Knights Landing */ | ||
1871 | return 1; | ||
1872 | default: | ||
1873 | return 0; | ||
1874 | } | ||
1875 | } | ||
1756 | static void | 1876 | static void |
1757 | dump_cstate_pstate_config_info(family, model) | 1877 | dump_cstate_pstate_config_info(family, model) |
1758 | { | 1878 | { |
@@ -1770,6 +1890,9 @@ dump_cstate_pstate_config_info(family, model) | |||
1770 | if (has_nhm_turbo_ratio_limit(family, model)) | 1890 | if (has_nhm_turbo_ratio_limit(family, model)) |
1771 | dump_nhm_turbo_ratio_limits(); | 1891 | dump_nhm_turbo_ratio_limits(); |
1772 | 1892 | ||
1893 | if (has_knl_turbo_ratio_limit(family, model)) | ||
1894 | dump_knl_turbo_ratio_limits(); | ||
1895 | |||
1773 | dump_nhm_cst_cfg(); | 1896 | dump_nhm_cst_cfg(); |
1774 | } | 1897 | } |
1775 | 1898 | ||
@@ -1801,7 +1924,7 @@ int print_epb(struct thread_data *t, struct core_data *c, struct pkg_data *p) | |||
1801 | if (get_msr(cpu, MSR_IA32_ENERGY_PERF_BIAS, &msr)) | 1924 | if (get_msr(cpu, MSR_IA32_ENERGY_PERF_BIAS, &msr)) |
1802 | return 0; | 1925 | return 0; |
1803 | 1926 | ||
1804 | switch (msr & 0x7) { | 1927 | switch (msr & 0xF) { |
1805 | case ENERGY_PERF_BIAS_PERFORMANCE: | 1928 | case ENERGY_PERF_BIAS_PERFORMANCE: |
1806 | epb_string = "performance"; | 1929 | epb_string = "performance"; |
1807 | break; | 1930 | break; |
@@ -1925,7 +2048,7 @@ double get_tdp(model) | |||
1925 | unsigned long long msr; | 2048 | unsigned long long msr; |
1926 | 2049 | ||
1927 | if (do_rapl & RAPL_PKG_POWER_INFO) | 2050 | if (do_rapl & RAPL_PKG_POWER_INFO) |
1928 | if (!get_msr(0, MSR_PKG_POWER_INFO, &msr)) | 2051 | if (!get_msr(base_cpu, MSR_PKG_POWER_INFO, &msr)) |
1929 | return ((msr >> 0) & RAPL_POWER_GRANULARITY) * rapl_power_units; | 2052 | return ((msr >> 0) & RAPL_POWER_GRANULARITY) * rapl_power_units; |
1930 | 2053 | ||
1931 | switch (model) { | 2054 | switch (model) { |
@@ -1950,6 +2073,7 @@ rapl_dram_energy_units_probe(int model, double rapl_energy_units) | |||
1950 | case 0x3F: /* HSX */ | 2073 | case 0x3F: /* HSX */ |
1951 | case 0x4F: /* BDX */ | 2074 | case 0x4F: /* BDX */ |
1952 | case 0x56: /* BDX-DE */ | 2075 | case 0x56: /* BDX-DE */ |
2076 | case 0x57: /* KNL */ | ||
1953 | return (rapl_dram_energy_units = 15.3 / 1000000); | 2077 | return (rapl_dram_energy_units = 15.3 / 1000000); |
1954 | default: | 2078 | default: |
1955 | return (rapl_energy_units); | 2079 | return (rapl_energy_units); |
@@ -1991,6 +2115,7 @@ void rapl_probe(unsigned int family, unsigned int model) | |||
1991 | case 0x3F: /* HSX */ | 2115 | case 0x3F: /* HSX */ |
1992 | case 0x4F: /* BDX */ | 2116 | case 0x4F: /* BDX */ |
1993 | case 0x56: /* BDX-DE */ | 2117 | case 0x56: /* BDX-DE */ |
2118 | case 0x57: /* KNL */ | ||
1994 | do_rapl = RAPL_PKG | RAPL_DRAM | RAPL_DRAM_POWER_INFO | RAPL_DRAM_PERF_STATUS | RAPL_PKG_PERF_STATUS | RAPL_PKG_POWER_INFO; | 2119 | do_rapl = RAPL_PKG | RAPL_DRAM | RAPL_DRAM_POWER_INFO | RAPL_DRAM_PERF_STATUS | RAPL_PKG_PERF_STATUS | RAPL_PKG_POWER_INFO; |
1995 | break; | 2120 | break; |
1996 | case 0x2D: | 2121 | case 0x2D: |
@@ -2006,7 +2131,7 @@ void rapl_probe(unsigned int family, unsigned int model) | |||
2006 | } | 2131 | } |
2007 | 2132 | ||
2008 | /* units on package 0, verify later other packages match */ | 2133 | /* units on package 0, verify later other packages match */ |
2009 | if (get_msr(0, MSR_RAPL_POWER_UNIT, &msr)) | 2134 | if (get_msr(base_cpu, MSR_RAPL_POWER_UNIT, &msr)) |
2010 | return; | 2135 | return; |
2011 | 2136 | ||
2012 | rapl_power_units = 1.0 / (1 << (msr & 0xF)); | 2137 | rapl_power_units = 1.0 / (1 << (msr & 0xF)); |
@@ -2331,6 +2456,17 @@ int is_slm(unsigned int family, unsigned int model) | |||
2331 | return 0; | 2456 | return 0; |
2332 | } | 2457 | } |
2333 | 2458 | ||
2459 | int is_knl(unsigned int family, unsigned int model) | ||
2460 | { | ||
2461 | if (!genuine_intel) | ||
2462 | return 0; | ||
2463 | switch (model) { | ||
2464 | case 0x57: /* KNL */ | ||
2465 | return 1; | ||
2466 | } | ||
2467 | return 0; | ||
2468 | } | ||
2469 | |||
2334 | #define SLM_BCLK_FREQS 5 | 2470 | #define SLM_BCLK_FREQS 5 |
2335 | double slm_freq_table[SLM_BCLK_FREQS] = { 83.3, 100.0, 133.3, 116.7, 80.0}; | 2471 | double slm_freq_table[SLM_BCLK_FREQS] = { 83.3, 100.0, 133.3, 116.7, 80.0}; |
2336 | 2472 | ||
@@ -2340,7 +2476,7 @@ double slm_bclk(void) | |||
2340 | unsigned int i; | 2476 | unsigned int i; |
2341 | double freq; | 2477 | double freq; |
2342 | 2478 | ||
2343 | if (get_msr(0, MSR_FSB_FREQ, &msr)) | 2479 | if (get_msr(base_cpu, MSR_FSB_FREQ, &msr)) |
2344 | fprintf(stderr, "SLM BCLK: unknown\n"); | 2480 | fprintf(stderr, "SLM BCLK: unknown\n"); |
2345 | 2481 | ||
2346 | i = msr & 0xf; | 2482 | i = msr & 0xf; |
@@ -2408,7 +2544,7 @@ int set_temperature_target(struct thread_data *t, struct core_data *c, struct pk | |||
2408 | if (!do_nhm_platform_info) | 2544 | if (!do_nhm_platform_info) |
2409 | goto guess; | 2545 | goto guess; |
2410 | 2546 | ||
2411 | if (get_msr(0, MSR_IA32_TEMPERATURE_TARGET, &msr)) | 2547 | if (get_msr(base_cpu, MSR_IA32_TEMPERATURE_TARGET, &msr)) |
2412 | goto guess; | 2548 | goto guess; |
2413 | 2549 | ||
2414 | target_c_local = (msr >> 16) & 0xFF; | 2550 | target_c_local = (msr >> 16) & 0xFF; |
@@ -2541,6 +2677,7 @@ void process_cpuid() | |||
2541 | do_c8_c9_c10 = has_hsw_msrs(family, model); | 2677 | do_c8_c9_c10 = has_hsw_msrs(family, model); |
2542 | do_skl_residency = has_skl_msrs(family, model); | 2678 | do_skl_residency = has_skl_msrs(family, model); |
2543 | do_slm_cstates = is_slm(family, model); | 2679 | do_slm_cstates = is_slm(family, model); |
2680 | do_knl_cstates = is_knl(family, model); | ||
2544 | bclk = discover_bclk(family, model); | 2681 | bclk = discover_bclk(family, model); |
2545 | 2682 | ||
2546 | rapl_probe(family, model); | 2683 | rapl_probe(family, model); |
@@ -2755,13 +2892,9 @@ int initialize_counters(int cpu_id) | |||
2755 | 2892 | ||
2756 | my_package_id = get_physical_package_id(cpu_id); | 2893 | my_package_id = get_physical_package_id(cpu_id); |
2757 | my_core_id = get_core_id(cpu_id); | 2894 | my_core_id = get_core_id(cpu_id); |
2758 | 2895 | my_thread_id = get_cpu_position_in_core(cpu_id); | |
2759 | if (cpu_is_first_sibling_in_core(cpu_id)) { | 2896 | if (!my_thread_id) |
2760 | my_thread_id = 0; | ||
2761 | topo.num_cores++; | 2897 | topo.num_cores++; |
2762 | } else { | ||
2763 | my_thread_id = 1; | ||
2764 | } | ||
2765 | 2898 | ||
2766 | init_counter(EVEN_COUNTERS, my_thread_id, my_core_id, my_package_id, cpu_id); | 2899 | init_counter(EVEN_COUNTERS, my_thread_id, my_core_id, my_package_id, cpu_id); |
2767 | init_counter(ODD_COUNTERS, my_thread_id, my_core_id, my_package_id, cpu_id); | 2900 | init_counter(ODD_COUNTERS, my_thread_id, my_core_id, my_package_id, cpu_id); |
@@ -2785,13 +2918,24 @@ void setup_all_buffers(void) | |||
2785 | for_all_proc_cpus(initialize_counters); | 2918 | for_all_proc_cpus(initialize_counters); |
2786 | } | 2919 | } |
2787 | 2920 | ||
2921 | void set_base_cpu(void) | ||
2922 | { | ||
2923 | base_cpu = sched_getcpu(); | ||
2924 | if (base_cpu < 0) | ||
2925 | err(-ENODEV, "No valid cpus found"); | ||
2926 | |||
2927 | if (debug > 1) | ||
2928 | fprintf(stderr, "base_cpu = %d\n", base_cpu); | ||
2929 | } | ||
2930 | |||
2788 | void turbostat_init() | 2931 | void turbostat_init() |
2789 | { | 2932 | { |
2933 | setup_all_buffers(); | ||
2934 | set_base_cpu(); | ||
2790 | check_dev_msr(); | 2935 | check_dev_msr(); |
2791 | check_permissions(); | 2936 | check_permissions(); |
2792 | process_cpuid(); | 2937 | process_cpuid(); |
2793 | 2938 | ||
2794 | setup_all_buffers(); | ||
2795 | 2939 | ||
2796 | if (debug) | 2940 | if (debug) |
2797 | for_all_cpus(print_epb, ODD_COUNTERS); | 2941 | for_all_cpus(print_epb, ODD_COUNTERS); |
@@ -2870,7 +3014,7 @@ int get_and_dump_counters(void) | |||
2870 | } | 3014 | } |
2871 | 3015 | ||
2872 | void print_version() { | 3016 | void print_version() { |
2873 | fprintf(stderr, "turbostat version 4.5 2 Apr, 2015" | 3017 | fprintf(stderr, "turbostat version 4.7 27-May, 2015" |
2874 | " - Len Brown <lenb@kernel.org>\n"); | 3018 | " - Len Brown <lenb@kernel.org>\n"); |
2875 | } | 3019 | } |
2876 | 3020 | ||