diff options
author | Takashi Iwai <tiwai@suse.de> | 2014-11-27 06:40:51 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-11-27 06:40:51 -0500 |
commit | acf403ecc4155153e5e2c1640be90fc166e56ba7 (patch) | |
tree | e9655b84776cec00a4da077f5dd1e336dfd9c7c0 | |
parent | 69eba10e606a80665f8573221fec589430d9d1cb (diff) | |
parent | b61f90eac1ff9d1b30497e611aba4651d4066706 (diff) |
Merge branch 'topic/usb-resume' into for-next
Merge the proper mixer resume support for quirk codes.
939 files changed, 9703 insertions, 5609 deletions
diff --git a/Documentation/ABI/testing/sysfs-ibft b/Documentation/ABI/testing/sysfs-ibft index c2b7d1154bec..cac3930bdb04 100644 --- a/Documentation/ABI/testing/sysfs-ibft +++ b/Documentation/ABI/testing/sysfs-ibft | |||
@@ -20,4 +20,4 @@ Date: November 2007 | |||
20 | Contact: Konrad Rzeszutek <ketuzsezr@darnok.org> | 20 | Contact: Konrad Rzeszutek <ketuzsezr@darnok.org> |
21 | Description: The /sys/firmware/ibft/ethernetX directory will contain | 21 | Description: The /sys/firmware/ibft/ethernetX directory will contain |
22 | files that expose the iSCSI Boot Firmware Table NIC data. | 22 | files that expose the iSCSI Boot Firmware Table NIC data. |
23 | This can this can the IP address, MAC, and gateway of the NIC. | 23 | Usually this contains the IP address, MAC, and gateway of the NIC. |
diff --git a/Documentation/DocBook/media/Makefile b/Documentation/DocBook/media/Makefile index df2962d9e11e..8bf7c6191296 100644 --- a/Documentation/DocBook/media/Makefile +++ b/Documentation/DocBook/media/Makefile | |||
@@ -25,7 +25,7 @@ GENFILES := $(addprefix $(MEDIA_OBJ_DIR)/, $(MEDIA_TEMP)) | |||
25 | PHONY += cleanmediadocs | 25 | PHONY += cleanmediadocs |
26 | 26 | ||
27 | cleanmediadocs: | 27 | cleanmediadocs: |
28 | -@rm `find $(MEDIA_OBJ_DIR) -type l` $(GENFILES) $(OBJIMGFILES) 2>/dev/null | 28 | -@rm -f `find $(MEDIA_OBJ_DIR) -type l` $(GENFILES) $(OBJIMGFILES) 2>/dev/null |
29 | 29 | ||
30 | $(obj)/media_api.xml: $(GENFILES) FORCE | 30 | $(obj)/media_api.xml: $(GENFILES) FORCE |
31 | 31 | ||
diff --git a/Documentation/DocBook/media/v4l/compat.xml b/Documentation/DocBook/media/v4l/compat.xml index 07ffc76553ba..0a2debfa68f6 100644 --- a/Documentation/DocBook/media/v4l/compat.xml +++ b/Documentation/DocBook/media/v4l/compat.xml | |||
@@ -2566,6 +2566,10 @@ fields changed from _s32 to _u32. | |||
2566 | <para>Added compound control types and &VIDIOC-QUERY-EXT-CTRL;. | 2566 | <para>Added compound control types and &VIDIOC-QUERY-EXT-CTRL;. |
2567 | </para> | 2567 | </para> |
2568 | </listitem> | 2568 | </listitem> |
2569 | </orderedlist> | ||
2570 | </section> | ||
2571 | |||
2572 | <section> | ||
2569 | <title>V4L2 in Linux 3.18</title> | 2573 | <title>V4L2 in Linux 3.18</title> |
2570 | <orderedlist> | 2574 | <orderedlist> |
2571 | <listitem> | 2575 | <listitem> |
diff --git a/Documentation/HOWTO b/Documentation/HOWTO index 57cf5efb044d..93aa8604630e 100644 --- a/Documentation/HOWTO +++ b/Documentation/HOWTO | |||
@@ -324,7 +324,6 @@ tree, they need to be integration-tested. For this purpose, a special | |||
324 | testing repository exists into which virtually all subsystem trees are | 324 | testing repository exists into which virtually all subsystem trees are |
325 | pulled on an almost daily basis: | 325 | pulled on an almost daily basis: |
326 | http://git.kernel.org/?p=linux/kernel/git/next/linux-next.git | 326 | http://git.kernel.org/?p=linux/kernel/git/next/linux-next.git |
327 | http://linux.f-seidel.de/linux-next/pmwiki/ | ||
328 | 327 | ||
329 | This way, the -next kernel gives a summary outlook onto what will be | 328 | This way, the -next kernel gives a summary outlook onto what will be |
330 | expected to go into the mainline kernel at the next merge period. | 329 | expected to go into the mainline kernel at the next merge period. |
diff --git a/Documentation/SubmittingPatches b/Documentation/SubmittingPatches index 482c74947de0..1fa1caa198eb 100644 --- a/Documentation/SubmittingPatches +++ b/Documentation/SubmittingPatches | |||
@@ -483,12 +483,10 @@ have been included in the discussion | |||
483 | 483 | ||
484 | 14) Using Reported-by:, Tested-by:, Reviewed-by:, Suggested-by: and Fixes: | 484 | 14) Using Reported-by:, Tested-by:, Reviewed-by:, Suggested-by: and Fixes: |
485 | 485 | ||
486 | If this patch fixes a problem reported by somebody else, consider adding a | 486 | The Reported-by tag gives credit to people who find bugs and report them and it |
487 | Reported-by: tag to credit the reporter for their contribution. Please | 487 | hopefully inspires them to help us again in the future. Please note that if |
488 | note that this tag should not be added without the reporter's permission, | 488 | the bug was reported in private, then ask for permission first before using the |
489 | especially if the problem was not reported in a public forum. That said, | 489 | Reported-by tag. |
490 | if we diligently credit our bug reporters, they will, hopefully, be | ||
491 | inspired to help us again in the future. | ||
492 | 490 | ||
493 | A Tested-by: tag indicates that the patch has been successfully tested (in | 491 | A Tested-by: tag indicates that the patch has been successfully tested (in |
494 | some environment) by the person named. This tag informs maintainers that | 492 | some environment) by the person named. This tag informs maintainers that |
diff --git a/Documentation/development-process/2.Process b/Documentation/development-process/2.Process index 2e0617936e8f..c24e156a6118 100644 --- a/Documentation/development-process/2.Process +++ b/Documentation/development-process/2.Process | |||
@@ -289,10 +289,6 @@ lists when they are assembled; they can be downloaded from: | |||
289 | 289 | ||
290 | http://www.kernel.org/pub/linux/kernel/next/ | 290 | http://www.kernel.org/pub/linux/kernel/next/ |
291 | 291 | ||
292 | Some information about linux-next has been gathered at: | ||
293 | |||
294 | http://linux.f-seidel.de/linux-next/pmwiki/ | ||
295 | |||
296 | Linux-next has become an integral part of the kernel development process; | 292 | Linux-next has become an integral part of the kernel development process; |
297 | all patches merged during a given merge window should really have found | 293 | all patches merged during a given merge window should really have found |
298 | their way into linux-next some time before the merge window opens. | 294 | their way into linux-next some time before the merge window opens. |
diff --git a/Documentation/development-process/8.Conclusion b/Documentation/development-process/8.Conclusion index 1990ab4b4949..caef69022e9c 100644 --- a/Documentation/development-process/8.Conclusion +++ b/Documentation/development-process/8.Conclusion | |||
@@ -22,10 +22,6 @@ Beyond that, a valuable resource for kernel developers is: | |||
22 | 22 | ||
23 | http://kernelnewbies.org/ | 23 | http://kernelnewbies.org/ |
24 | 24 | ||
25 | Information about the linux-next tree gathers at: | ||
26 | |||
27 | http://linux.f-seidel.de/linux-next/pmwiki/ | ||
28 | |||
29 | And, of course, one should not forget http://kernel.org/, the definitive | 25 | And, of course, one should not forget http://kernel.org/, the definitive |
30 | location for kernel release information. | 26 | location for kernel release information. |
31 | 27 | ||
diff --git a/Documentation/devicetree/bindings/ata/sata_rcar.txt b/Documentation/devicetree/bindings/ata/sata_rcar.txt index 1e6111333fa8..80ae87a0784b 100644 --- a/Documentation/devicetree/bindings/ata/sata_rcar.txt +++ b/Documentation/devicetree/bindings/ata/sata_rcar.txt | |||
@@ -3,8 +3,10 @@ | |||
3 | Required properties: | 3 | Required properties: |
4 | - compatible : should contain one of the following: | 4 | - compatible : should contain one of the following: |
5 | - "renesas,sata-r8a7779" for R-Car H1 | 5 | - "renesas,sata-r8a7779" for R-Car H1 |
6 | - "renesas,sata-r8a7790" for R-Car H2 | 6 | - "renesas,sata-r8a7790-es1" for R-Car H2 ES1 |
7 | - "renesas,sata-r8a7791" for R-Car M2 | 7 | - "renesas,sata-r8a7790" for R-Car H2 other than ES1 |
8 | - "renesas,sata-r8a7791" for R-Car M2-W | ||
9 | - "renesas,sata-r8a7793" for R-Car M2-N | ||
8 | - reg : address and length of the SATA registers; | 10 | - reg : address and length of the SATA registers; |
9 | - interrupts : must consist of one interrupt specifier. | 11 | - interrupts : must consist of one interrupt specifier. |
10 | 12 | ||
diff --git a/Documentation/devicetree/bindings/net/smsc-lan91c111.txt b/Documentation/devicetree/bindings/net/smsc-lan91c111.txt index 0f8487b88822..e77e167593db 100644 --- a/Documentation/devicetree/bindings/net/smsc-lan91c111.txt +++ b/Documentation/devicetree/bindings/net/smsc-lan91c111.txt | |||
@@ -11,3 +11,5 @@ Optional properties: | |||
11 | are supported on the device. Valid value for SMSC LAN91c111 are | 11 | are supported on the device. Valid value for SMSC LAN91c111 are |
12 | 1, 2 or 4. If it's omitted or invalid, the size would be 2 meaning | 12 | 1, 2 or 4. If it's omitted or invalid, the size would be 2 meaning |
13 | 16-bit access only. | 13 | 16-bit access only. |
14 | - power-gpios: GPIO to control the PWRDWN pin | ||
15 | - reset-gpios: GPIO to control the RESET pin | ||
diff --git a/Documentation/devicetree/bindings/submitting-patches.txt b/Documentation/devicetree/bindings/submitting-patches.txt index 042a0273b8ba..b7ba01ad1426 100644 --- a/Documentation/devicetree/bindings/submitting-patches.txt +++ b/Documentation/devicetree/bindings/submitting-patches.txt | |||
@@ -12,6 +12,9 @@ I. For patch submitters | |||
12 | 12 | ||
13 | devicetree@vger.kernel.org | 13 | devicetree@vger.kernel.org |
14 | 14 | ||
15 | 3) The Documentation/ portion of the patch should come in the series before | ||
16 | the code implementing the binding. | ||
17 | |||
15 | II. For kernel maintainers | 18 | II. For kernel maintainers |
16 | 19 | ||
17 | 1) If you aren't comfortable reviewing a given binding, reply to it and ask | 20 | 1) If you aren't comfortable reviewing a given binding, reply to it and ask |
diff --git a/Documentation/devicetree/bindings/thermal/rcar-thermal.txt b/Documentation/devicetree/bindings/thermal/rcar-thermal.txt index 0ef00be44b01..43404b197933 100644 --- a/Documentation/devicetree/bindings/thermal/rcar-thermal.txt +++ b/Documentation/devicetree/bindings/thermal/rcar-thermal.txt | |||
@@ -7,7 +7,10 @@ Required properties: | |||
7 | - "renesas,thermal-r8a73a4" (R-Mobile AP6) | 7 | - "renesas,thermal-r8a73a4" (R-Mobile AP6) |
8 | - "renesas,thermal-r8a7779" (R-Car H1) | 8 | - "renesas,thermal-r8a7779" (R-Car H1) |
9 | - "renesas,thermal-r8a7790" (R-Car H2) | 9 | - "renesas,thermal-r8a7790" (R-Car H2) |
10 | - "renesas,thermal-r8a7791" (R-Car M2) | 10 | - "renesas,thermal-r8a7791" (R-Car M2-W) |
11 | - "renesas,thermal-r8a7792" (R-Car V2H) | ||
12 | - "renesas,thermal-r8a7793" (R-Car M2-N) | ||
13 | - "renesas,thermal-r8a7794" (R-Car E2) | ||
11 | - reg : Address range of the thermal registers. | 14 | - reg : Address range of the thermal registers. |
12 | The 1st reg will be recognized as common register | 15 | The 1st reg will be recognized as common register |
13 | if it has "interrupts". | 16 | if it has "interrupts". |
diff --git a/Documentation/input/elantech.txt b/Documentation/input/elantech.txt index e1ae127ed099..1ec0db7879d3 100644 --- a/Documentation/input/elantech.txt +++ b/Documentation/input/elantech.txt | |||
@@ -38,22 +38,38 @@ Contents | |||
38 | 7.2.1 Status packet | 38 | 7.2.1 Status packet |
39 | 7.2.2 Head packet | 39 | 7.2.2 Head packet |
40 | 7.2.3 Motion packet | 40 | 7.2.3 Motion packet |
41 | 8. Trackpoint (for Hardware version 3 and 4) | ||
42 | 8.1 Registers | ||
43 | 8.2 Native relative mode 6 byte packet format | ||
44 | 8.2.1 Status Packet | ||
41 | 45 | ||
42 | 46 | ||
43 | 47 | ||
44 | 1. Introduction | 48 | 1. Introduction |
45 | ~~~~~~~~~~~~ | 49 | ~~~~~~~~~~~~ |
46 | 50 | ||
47 | Currently the Linux Elantech touchpad driver is aware of two different | 51 | Currently the Linux Elantech touchpad driver is aware of four different |
48 | hardware versions unimaginatively called version 1 and version 2. Version 1 | 52 | hardware versions unimaginatively called version 1,version 2, version 3 |
49 | is found in "older" laptops and uses 4 bytes per packet. Version 2 seems to | 53 | and version 4. Version 1 is found in "older" laptops and uses 4 bytes per |
50 | be introduced with the EeePC and uses 6 bytes per packet, and provides | 54 | packet. Version 2 seems to be introduced with the EeePC and uses 6 bytes |
51 | additional features such as position of two fingers, and width of the touch. | 55 | per packet, and provides additional features such as position of two fingers, |
56 | and width of the touch. Hardware version 3 uses 6 bytes per packet (and | ||
57 | for 2 fingers the concatenation of two 6 bytes packets) and allows tracking | ||
58 | of up to 3 fingers. Hardware version 4 uses 6 bytes per packet, and can | ||
59 | combine a status packet with multiple head or motion packets. Hardware version | ||
60 | 4 allows tracking up to 5 fingers. | ||
61 | |||
62 | Some Hardware version 3 and version 4 also have a trackpoint which uses a | ||
63 | separate packet format. It is also 6 bytes per packet. | ||
52 | 64 | ||
53 | The driver tries to support both hardware versions and should be compatible | 65 | The driver tries to support both hardware versions and should be compatible |
54 | with the Xorg Synaptics touchpad driver and its graphical configuration | 66 | with the Xorg Synaptics touchpad driver and its graphical configuration |
55 | utilities. | 67 | utilities. |
56 | 68 | ||
69 | Note that a mouse button is also associated with either the touchpad or the | ||
70 | trackpoint when a trackpoint is available. Disabling the Touchpad in xorg | ||
71 | (TouchPadOff=0) will also disable the buttons associated with the touchpad. | ||
72 | |||
57 | Additionally the operation of the touchpad can be altered by adjusting the | 73 | Additionally the operation of the touchpad can be altered by adjusting the |
58 | contents of some of its internal registers. These registers are represented | 74 | contents of some of its internal registers. These registers are represented |
59 | by the driver as sysfs entries under /sys/bus/serio/drivers/psmouse/serio? | 75 | by the driver as sysfs entries under /sys/bus/serio/drivers/psmouse/serio? |
@@ -78,7 +94,7 @@ completeness sake. | |||
78 | 2. Extra knobs | 94 | 2. Extra knobs |
79 | ~~~~~~~~~~~ | 95 | ~~~~~~~~~~~ |
80 | 96 | ||
81 | Currently the Linux Elantech touchpad driver provides two extra knobs under | 97 | Currently the Linux Elantech touchpad driver provides three extra knobs under |
82 | /sys/bus/serio/drivers/psmouse/serio? for the user. | 98 | /sys/bus/serio/drivers/psmouse/serio? for the user. |
83 | 99 | ||
84 | * debug | 100 | * debug |
@@ -112,6 +128,20 @@ Currently the Linux Elantech touchpad driver provides two extra knobs under | |||
112 | data consistency checking can be done. For now checking is disabled by | 128 | data consistency checking can be done. For now checking is disabled by |
113 | default. Currently even turning it on will do nothing. | 129 | default. Currently even turning it on will do nothing. |
114 | 130 | ||
131 | * crc_enabled | ||
132 | |||
133 | Sets crc_enabled to 0/1. The name "crc_enabled" is the official name of | ||
134 | this integrity check, even though it is not an actual cyclic redundancy | ||
135 | check. | ||
136 | |||
137 | Depending on the state of crc_enabled, certain basic data integrity | ||
138 | verification is done by the driver on hardware version 3 and 4. The | ||
139 | driver will reject any packet that appears corrupted. Using this knob, | ||
140 | The state of crc_enabled can be altered with this knob. | ||
141 | |||
142 | Reading the crc_enabled value will show the active value. Echoing | ||
143 | "0" or "1" to this file will set the state to "0" or "1". | ||
144 | |||
115 | ///////////////////////////////////////////////////////////////////////////// | 145 | ///////////////////////////////////////////////////////////////////////////// |
116 | 146 | ||
117 | 3. Differentiating hardware versions | 147 | 3. Differentiating hardware versions |
@@ -746,3 +776,42 @@ byte 5: | |||
746 | 776 | ||
747 | byte 0 ~ 2 for one finger | 777 | byte 0 ~ 2 for one finger |
748 | byte 3 ~ 5 for another | 778 | byte 3 ~ 5 for another |
779 | |||
780 | |||
781 | 8. Trackpoint (for Hardware version 3 and 4) | ||
782 | ========================================= | ||
783 | 8.1 Registers | ||
784 | ~~~~~~~~~ | ||
785 | No special registers have been identified. | ||
786 | |||
787 | 8.2 Native relative mode 6 byte packet format | ||
788 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
789 | 8.2.1 Status Packet | ||
790 | ~~~~~~~~~~~~~ | ||
791 | |||
792 | byte 0: | ||
793 | bit 7 6 5 4 3 2 1 0 | ||
794 | 0 0 sx sy 0 M R L | ||
795 | byte 1: | ||
796 | bit 7 6 5 4 3 2 1 0 | ||
797 | ~sx 0 0 0 0 0 0 0 | ||
798 | byte 2: | ||
799 | bit 7 6 5 4 3 2 1 0 | ||
800 | ~sy 0 0 0 0 0 0 0 | ||
801 | byte 3: | ||
802 | bit 7 6 5 4 3 2 1 0 | ||
803 | 0 0 ~sy ~sx 0 1 1 0 | ||
804 | byte 4: | ||
805 | bit 7 6 5 4 3 2 1 0 | ||
806 | x7 x6 x5 x4 x3 x2 x1 x0 | ||
807 | byte 5: | ||
808 | bit 7 6 5 4 3 2 1 0 | ||
809 | y7 y6 y5 y4 y3 y2 y1 y0 | ||
810 | |||
811 | |||
812 | x and y are written in two's complement spread | ||
813 | over 9 bits with sx/sy the relative top bit and | ||
814 | x7..x0 and y7..y0 the lower bits. | ||
815 | ~sx is the inverse of sx, ~sy is the inverse of sy. | ||
816 | The sign of y is opposite to what the input driver | ||
817 | expects for a relative movement | ||
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 74339c57b914..479f33204a37 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -1264,7 +1264,7 @@ bytes respectively. Such letter suffixes can also be entirely omitted. | |||
1264 | i8042.noloop [HW] Disable the AUX Loopback command while probing | 1264 | i8042.noloop [HW] Disable the AUX Loopback command while probing |
1265 | for the AUX port | 1265 | for the AUX port |
1266 | i8042.nomux [HW] Don't check presence of an active multiplexing | 1266 | i8042.nomux [HW] Don't check presence of an active multiplexing |
1267 | controller. Default: true. | 1267 | controller |
1268 | i8042.nopnp [HW] Don't use ACPIPnP / PnPBIOS to discover KBD/AUX | 1268 | i8042.nopnp [HW] Don't use ACPIPnP / PnPBIOS to discover KBD/AUX |
1269 | controllers | 1269 | controllers |
1270 | i8042.notimeout [HW] Ignore timeout condition signalled by controller | 1270 | i8042.notimeout [HW] Ignore timeout condition signalled by controller |
@@ -1307,6 +1307,18 @@ bytes respectively. Such letter suffixes can also be entirely omitted. | |||
1307 | .cdrom .chs .ignore_cable are additional options | 1307 | .cdrom .chs .ignore_cable are additional options |
1308 | See Documentation/ide/ide.txt. | 1308 | See Documentation/ide/ide.txt. |
1309 | 1309 | ||
1310 | ide-generic.probe-mask= [HW] (E)IDE subsystem | ||
1311 | Format: <int> | ||
1312 | Probe mask for legacy ISA IDE ports. Depending on | ||
1313 | platform up to 6 ports are supported, enabled by | ||
1314 | setting corresponding bits in the mask to 1. The | ||
1315 | default value is 0x0, which has a special meaning. | ||
1316 | On systems that have PCI, it triggers scanning the | ||
1317 | PCI bus for the first and the second port, which | ||
1318 | are then probed. On systems without PCI the value | ||
1319 | of 0x0 enables probing the two first ports as if it | ||
1320 | was 0x3. | ||
1321 | |||
1310 | ide-pci-generic.all-generic-ide [HW] (E)IDE subsystem | 1322 | ide-pci-generic.all-generic-ide [HW] (E)IDE subsystem |
1311 | Claim all unknown PCI IDE storage controllers. | 1323 | Claim all unknown PCI IDE storage controllers. |
1312 | 1324 | ||
@@ -1587,6 +1599,8 @@ bytes respectively. Such letter suffixes can also be entirely omitted. | |||
1587 | kmemleak= [KNL] Boot-time kmemleak enable/disable | 1599 | kmemleak= [KNL] Boot-time kmemleak enable/disable |
1588 | Valid arguments: on, off | 1600 | Valid arguments: on, off |
1589 | Default: on | 1601 | Default: on |
1602 | Built with CONFIG_DEBUG_KMEMLEAK_DEFAULT_OFF=y, | ||
1603 | the default is off. | ||
1590 | 1604 | ||
1591 | kmemcheck= [X86] Boot-time kmemcheck enable/disable/one-shot mode | 1605 | kmemcheck= [X86] Boot-time kmemcheck enable/disable/one-shot mode |
1592 | Valid arguments: 0, 1, 2 | 1606 | Valid arguments: 0, 1, 2 |
@@ -3607,7 +3621,7 @@ bytes respectively. Such letter suffixes can also be entirely omitted. | |||
3607 | 3621 | ||
3608 | usb-storage.delay_use= | 3622 | usb-storage.delay_use= |
3609 | [UMS] The delay in seconds before a new device is | 3623 | [UMS] The delay in seconds before a new device is |
3610 | scanned for Logical Units (default 5). | 3624 | scanned for Logical Units (default 1). |
3611 | 3625 | ||
3612 | usb-storage.quirks= | 3626 | usb-storage.quirks= |
3613 | [UMS] A list of quirks entries to supplement or | 3627 | [UMS] A list of quirks entries to supplement or |
diff --git a/Documentation/kmemleak.txt b/Documentation/kmemleak.txt index f4f033c8d856..45e777f4e41d 100644 --- a/Documentation/kmemleak.txt +++ b/Documentation/kmemleak.txt | |||
@@ -62,6 +62,10 @@ Memory may be allocated or freed before kmemleak is initialised and | |||
62 | these actions are stored in an early log buffer. The size of this buffer | 62 | these actions are stored in an early log buffer. The size of this buffer |
63 | is configured via the CONFIG_DEBUG_KMEMLEAK_EARLY_LOG_SIZE option. | 63 | is configured via the CONFIG_DEBUG_KMEMLEAK_EARLY_LOG_SIZE option. |
64 | 64 | ||
65 | If CONFIG_DEBUG_KMEMLEAK_DEFAULT_OFF are enabled, the kmemleak is | ||
66 | disabled by default. Passing "kmemleak=on" on the kernel command | ||
67 | line enables the function. | ||
68 | |||
65 | Basic Algorithm | 69 | Basic Algorithm |
66 | --------------- | 70 | --------------- |
67 | 71 | ||
diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt index 0307e2875f21..a476b08a43e0 100644 --- a/Documentation/networking/ip-sysctl.txt +++ b/Documentation/networking/ip-sysctl.txt | |||
@@ -56,6 +56,13 @@ ip_forward_use_pmtu - BOOLEAN | |||
56 | 0 - disabled | 56 | 0 - disabled |
57 | 1 - enabled | 57 | 1 - enabled |
58 | 58 | ||
59 | fwmark_reflect - BOOLEAN | ||
60 | Controls the fwmark of kernel-generated IPv4 reply packets that are not | ||
61 | associated with a socket for example, TCP RSTs or ICMP echo replies). | ||
62 | If unset, these packets have a fwmark of zero. If set, they have the | ||
63 | fwmark of the packet they are replying to. | ||
64 | Default: 0 | ||
65 | |||
59 | route/max_size - INTEGER | 66 | route/max_size - INTEGER |
60 | Maximum number of routes allowed in the kernel. Increase | 67 | Maximum number of routes allowed in the kernel. Increase |
61 | this when using large numbers of interfaces and/or routes. | 68 | this when using large numbers of interfaces and/or routes. |
@@ -1201,6 +1208,13 @@ conf/all/forwarding - BOOLEAN | |||
1201 | proxy_ndp - BOOLEAN | 1208 | proxy_ndp - BOOLEAN |
1202 | Do proxy ndp. | 1209 | Do proxy ndp. |
1203 | 1210 | ||
1211 | fwmark_reflect - BOOLEAN | ||
1212 | Controls the fwmark of kernel-generated IPv6 reply packets that are not | ||
1213 | associated with a socket for example, TCP RSTs or ICMPv6 echo replies). | ||
1214 | If unset, these packets have a fwmark of zero. If set, they have the | ||
1215 | fwmark of the packet they are replying to. | ||
1216 | Default: 0 | ||
1217 | |||
1204 | conf/interface/*: | 1218 | conf/interface/*: |
1205 | Change special settings per interface. | 1219 | Change special settings per interface. |
1206 | 1220 | ||
diff --git a/Documentation/prctl/Makefile b/Documentation/prctl/Makefile index 3e3232dcb2b8..2948b7b124b9 100644 --- a/Documentation/prctl/Makefile +++ b/Documentation/prctl/Makefile | |||
@@ -1,5 +1,5 @@ | |||
1 | # List of programs to build | 1 | # List of programs to build |
2 | hostprogs-y := disable-tsc-ctxt-sw-stress-test disable-tsc-on-off-stress-test disable-tsc-test | 2 | hostprogs-$(CONFIG_X86) := disable-tsc-ctxt-sw-stress-test disable-tsc-on-off-stress-test disable-tsc-test |
3 | # Tell kbuild to always build the programs | 3 | # Tell kbuild to always build the programs |
4 | always := $(hostprogs-y) | 4 | always := $(hostprogs-y) |
5 | 5 | ||
diff --git a/Documentation/ptp/testptp.mk b/Documentation/ptp/testptp.mk new file mode 100644 index 000000000000..4ef2d9755421 --- /dev/null +++ b/Documentation/ptp/testptp.mk | |||
@@ -0,0 +1,33 @@ | |||
1 | # PTP 1588 clock support - User space test program | ||
2 | # | ||
3 | # Copyright (C) 2010 OMICRON electronics GmbH | ||
4 | # | ||
5 | # This program is free software; you can redistribute it and/or modify | ||
6 | # it under the terms of the GNU General Public License as published by | ||
7 | # the Free Software Foundation; either version 2 of the License, or | ||
8 | # (at your option) any later version. | ||
9 | # | ||
10 | # This program is distributed in the hope that it will be useful, | ||
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | # GNU General Public License for more details. | ||
14 | # | ||
15 | # You should have received a copy of the GNU General Public License | ||
16 | # along with this program; if not, write to the Free Software | ||
17 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
18 | |||
19 | CC = $(CROSS_COMPILE)gcc | ||
20 | INC = -I$(KBUILD_OUTPUT)/usr/include | ||
21 | CFLAGS = -Wall $(INC) | ||
22 | LDLIBS = -lrt | ||
23 | PROGS = testptp | ||
24 | |||
25 | all: $(PROGS) | ||
26 | |||
27 | testptp: testptp.o | ||
28 | |||
29 | clean: | ||
30 | rm -f testptp.o | ||
31 | |||
32 | distclean: clean | ||
33 | rm -f $(PROGS) | ||
diff --git a/Documentation/vDSO/Makefile b/Documentation/vDSO/Makefile index 2b99e57207c1..ee075c3d2124 100644 --- a/Documentation/vDSO/Makefile +++ b/Documentation/vDSO/Makefile | |||
@@ -10,3 +10,6 @@ always := $(hostprogs-y) | |||
10 | HOSTCFLAGS := -I$(objtree)/usr/include -std=gnu99 | 10 | HOSTCFLAGS := -I$(objtree)/usr/include -std=gnu99 |
11 | HOSTCFLAGS_vdso_standalone_test_x86.o := -fno-asynchronous-unwind-tables -fno-stack-protector | 11 | HOSTCFLAGS_vdso_standalone_test_x86.o := -fno-asynchronous-unwind-tables -fno-stack-protector |
12 | HOSTLOADLIBES_vdso_standalone_test_x86 := -nostdlib | 12 | HOSTLOADLIBES_vdso_standalone_test_x86 := -nostdlib |
13 | ifeq ($(CONFIG_X86_32),y) | ||
14 | HOSTLOADLIBES_vdso_standalone_test_x86 += -lgcc_s | ||
15 | endif | ||
diff --git a/Documentation/vDSO/vdso_standalone_test_x86.c b/Documentation/vDSO/vdso_standalone_test_x86.c index d46240265c50..93b0ebf8cc38 100644 --- a/Documentation/vDSO/vdso_standalone_test_x86.c +++ b/Documentation/vDSO/vdso_standalone_test_x86.c | |||
@@ -63,7 +63,7 @@ static inline void linux_exit(int code) | |||
63 | x86_syscall3(__NR_exit, code, 0, 0); | 63 | x86_syscall3(__NR_exit, code, 0, 0); |
64 | } | 64 | } |
65 | 65 | ||
66 | void to_base10(char *lastdig, uint64_t n) | 66 | void to_base10(char *lastdig, time_t n) |
67 | { | 67 | { |
68 | while (n) { | 68 | while (n) { |
69 | *lastdig = (n % 10) + '0'; | 69 | *lastdig = (n % 10) + '0'; |
diff --git a/Documentation/video4linux/vivid.txt b/Documentation/video4linux/vivid.txt index eeb11a28e4fc..e5a940e3d304 100644 --- a/Documentation/video4linux/vivid.txt +++ b/Documentation/video4linux/vivid.txt | |||
@@ -221,12 +221,11 @@ ccs_out_mode: specify the allowed video output crop/compose/scaling combination | |||
221 | key, not quality. | 221 | key, not quality. |
222 | 222 | ||
223 | multiplanar: select whether each device instance supports multi-planar formats, | 223 | multiplanar: select whether each device instance supports multi-planar formats, |
224 | and thus the V4L2 multi-planar API. By default the first device instance | 224 | and thus the V4L2 multi-planar API. By default device instances are |
225 | is single-planar, the second multi-planar, and it keeps alternating. | 225 | single-planar. |
226 | 226 | ||
227 | This module option can override that for each instance. Values are: | 227 | This module option can override that for each instance. Values are: |
228 | 228 | ||
229 | 0: use alternating single and multi-planar devices. | ||
230 | 1: this is a single-planar instance. | 229 | 1: this is a single-planar instance. |
231 | 2: this is a multi-planar instance. | 230 | 2: this is a multi-planar instance. |
232 | 231 | ||
@@ -975,9 +974,8 @@ is set, then the alpha component is only used for the color red and set to | |||
975 | 0 otherwise. | 974 | 0 otherwise. |
976 | 975 | ||
977 | The driver has to be configured to support the multiplanar formats. By default | 976 | The driver has to be configured to support the multiplanar formats. By default |
978 | the first driver instance is single-planar, the second is multi-planar, and it | 977 | the driver instances are single-planar. This can be changed by setting the |
979 | keeps alternating. This can be changed by setting the multiplanar module option, | 978 | multiplanar module option, see section 1 for more details on that option. |
980 | see section 1 for more details on that option. | ||
981 | 979 | ||
982 | If the driver instance is using the multiplanar formats/API, then the first | 980 | If the driver instance is using the multiplanar formats/API, then the first |
983 | single planar format (YUYV) and the multiplanar NV16M and NV61M formats the | 981 | single planar format (YUYV) and the multiplanar NV16M and NV61M formats the |
@@ -1021,7 +1019,7 @@ the output overlay for the video output, turn on video looping and capture | |||
1021 | to see the blended framebuffer overlay that's being written to by the second | 1019 | to see the blended framebuffer overlay that's being written to by the second |
1022 | instance. This setup would require the following commands: | 1020 | instance. This setup would require the following commands: |
1023 | 1021 | ||
1024 | $ sudo modprobe vivid n_devs=2 node_types=0x10101,0x1 multiplanar=1,1 | 1022 | $ sudo modprobe vivid n_devs=2 node_types=0x10101,0x1 |
1025 | $ v4l2-ctl -d1 --find-fb | 1023 | $ v4l2-ctl -d1 --find-fb |
1026 | /dev/fb1 is the framebuffer associated with base address 0x12800000 | 1024 | /dev/fb1 is the framebuffer associated with base address 0x12800000 |
1027 | $ sudo v4l2-ctl -d2 --set-fbuf fb=1 | 1025 | $ sudo v4l2-ctl -d2 --set-fbuf fb=1 |
diff --git a/Documentation/vm/hugetlbpage.txt b/Documentation/vm/hugetlbpage.txt index bdd4bb97fff7..b64e0af9cc56 100644 --- a/Documentation/vm/hugetlbpage.txt +++ b/Documentation/vm/hugetlbpage.txt | |||
@@ -274,7 +274,7 @@ This command mounts a (pseudo) filesystem of type hugetlbfs on the directory | |||
274 | /mnt/huge. Any files created on /mnt/huge uses huge pages. The uid and gid | 274 | /mnt/huge. Any files created on /mnt/huge uses huge pages. The uid and gid |
275 | options sets the owner and group of the root of the file system. By default | 275 | options sets the owner and group of the root of the file system. By default |
276 | the uid and gid of the current process are taken. The mode option sets the | 276 | the uid and gid of the current process are taken. The mode option sets the |
277 | mode of root of file system to value & 0777. This value is given in octal. | 277 | mode of root of file system to value & 01777. This value is given in octal. |
278 | By default the value 0755 is picked. The size option sets the maximum value of | 278 | By default the value 0755 is picked. The size option sets the maximum value of |
279 | memory (huge pages) allowed for that filesystem (/mnt/huge). The size is | 279 | memory (huge pages) allowed for that filesystem (/mnt/huge). The size is |
280 | rounded down to HPAGE_SIZE. The option nr_inodes sets the maximum number of | 280 | rounded down to HPAGE_SIZE. The option nr_inodes sets the maximum number of |
diff --git a/MAINTAINERS b/MAINTAINERS index dab92a78d1d5..c444907ccd69 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -1543,6 +1543,7 @@ F: arch/arm/mach-pxa/include/mach/z2.h | |||
1543 | 1543 | ||
1544 | ARM/ZYNQ ARCHITECTURE | 1544 | ARM/ZYNQ ARCHITECTURE |
1545 | M: Michal Simek <michal.simek@xilinx.com> | 1545 | M: Michal Simek <michal.simek@xilinx.com> |
1546 | R: Sören Brinkmann <soren.brinkmann@xilinx.com> | ||
1546 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | 1547 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
1547 | W: http://wiki.xilinx.com | 1548 | W: http://wiki.xilinx.com |
1548 | T: git git://git.xilinx.com/linux-xlnx.git | 1549 | T: git git://git.xilinx.com/linux-xlnx.git |
@@ -2071,8 +2072,9 @@ F: drivers/clocksource/bcm_kona_timer.c | |||
2071 | 2072 | ||
2072 | BROADCOM BCM2835 ARM ARCHITECTURE | 2073 | BROADCOM BCM2835 ARM ARCHITECTURE |
2073 | M: Stephen Warren <swarren@wwwdotorg.org> | 2074 | M: Stephen Warren <swarren@wwwdotorg.org> |
2075 | M: Lee Jones <lee@kernel.org> | ||
2074 | L: linux-rpi-kernel@lists.infradead.org (moderated for non-subscribers) | 2076 | L: linux-rpi-kernel@lists.infradead.org (moderated for non-subscribers) |
2075 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/swarren/linux-rpi.git | 2077 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/rpi/linux-rpi.git |
2076 | S: Maintained | 2078 | S: Maintained |
2077 | N: bcm2835 | 2079 | N: bcm2835 |
2078 | 2080 | ||
@@ -2742,6 +2744,13 @@ W: http://www.chelsio.com | |||
2742 | S: Supported | 2744 | S: Supported |
2743 | F: drivers/net/ethernet/chelsio/cxgb3/ | 2745 | F: drivers/net/ethernet/chelsio/cxgb3/ |
2744 | 2746 | ||
2747 | CXGB3 ISCSI DRIVER (CXGB3I) | ||
2748 | M: Karen Xie <kxie@chelsio.com> | ||
2749 | L: linux-scsi@vger.kernel.org | ||
2750 | W: http://www.chelsio.com | ||
2751 | S: Supported | ||
2752 | F: drivers/scsi/cxgbi/cxgb3i | ||
2753 | |||
2745 | CXGB3 IWARP RNIC DRIVER (IW_CXGB3) | 2754 | CXGB3 IWARP RNIC DRIVER (IW_CXGB3) |
2746 | M: Steve Wise <swise@chelsio.com> | 2755 | M: Steve Wise <swise@chelsio.com> |
2747 | L: linux-rdma@vger.kernel.org | 2756 | L: linux-rdma@vger.kernel.org |
@@ -2756,6 +2765,13 @@ W: http://www.chelsio.com | |||
2756 | S: Supported | 2765 | S: Supported |
2757 | F: drivers/net/ethernet/chelsio/cxgb4/ | 2766 | F: drivers/net/ethernet/chelsio/cxgb4/ |
2758 | 2767 | ||
2768 | CXGB4 ISCSI DRIVER (CXGB4I) | ||
2769 | M: Karen Xie <kxie@chelsio.com> | ||
2770 | L: linux-scsi@vger.kernel.org | ||
2771 | W: http://www.chelsio.com | ||
2772 | S: Supported | ||
2773 | F: drivers/scsi/cxgbi/cxgb4i | ||
2774 | |||
2759 | CXGB4 IWARP RNIC DRIVER (IW_CXGB4) | 2775 | CXGB4 IWARP RNIC DRIVER (IW_CXGB4) |
2760 | M: Steve Wise <swise@chelsio.com> | 2776 | M: Steve Wise <swise@chelsio.com> |
2761 | L: linux-rdma@vger.kernel.org | 2777 | L: linux-rdma@vger.kernel.org |
@@ -4312,8 +4328,10 @@ F: Documentation/blockdev/cpqarray.txt | |||
4312 | F: drivers/block/cpqarray.* | 4328 | F: drivers/block/cpqarray.* |
4313 | 4329 | ||
4314 | HEWLETT-PACKARD SMART ARRAY RAID DRIVER (hpsa) | 4330 | HEWLETT-PACKARD SMART ARRAY RAID DRIVER (hpsa) |
4315 | M: "Stephen M. Cameron" <scameron@beardog.cce.hp.com> | 4331 | M: Don Brace <don.brace@pmcs.com> |
4316 | L: iss_storagedev@hp.com | 4332 | L: iss_storagedev@hp.com |
4333 | L: storagedev@pmcs.com | ||
4334 | L: linux-scsi@vger.kernel.org | ||
4317 | S: Supported | 4335 | S: Supported |
4318 | F: Documentation/scsi/hpsa.txt | 4336 | F: Documentation/scsi/hpsa.txt |
4319 | F: drivers/scsi/hpsa*.[ch] | 4337 | F: drivers/scsi/hpsa*.[ch] |
@@ -4321,8 +4339,10 @@ F: include/linux/cciss*.h | |||
4321 | F: include/uapi/linux/cciss*.h | 4339 | F: include/uapi/linux/cciss*.h |
4322 | 4340 | ||
4323 | HEWLETT-PACKARD SMART CISS RAID DRIVER (cciss) | 4341 | HEWLETT-PACKARD SMART CISS RAID DRIVER (cciss) |
4324 | M: Mike Miller <mike.miller@hp.com> | 4342 | M: Don Brace <don.brace@pmcs.com> |
4325 | L: iss_storagedev@hp.com | 4343 | L: iss_storagedev@hp.com |
4344 | L: storagedev@pmcs.com | ||
4345 | L: linux-scsi@vger.kernel.org | ||
4326 | S: Supported | 4346 | S: Supported |
4327 | F: Documentation/blockdev/cciss.txt | 4347 | F: Documentation/blockdev/cciss.txt |
4328 | F: drivers/block/cciss* | 4348 | F: drivers/block/cciss* |
@@ -4608,7 +4628,7 @@ S: Supported | |||
4608 | F: drivers/crypto/nx/ | 4628 | F: drivers/crypto/nx/ |
4609 | 4629 | ||
4610 | IBM Power 842 compression accelerator | 4630 | IBM Power 842 compression accelerator |
4611 | M: Nathan Fontenot <nfont@linux.vnet.ibm.com> | 4631 | M: Dan Streetman <ddstreet@us.ibm.com> |
4612 | S: Supported | 4632 | S: Supported |
4613 | F: drivers/crypto/nx/nx-842.c | 4633 | F: drivers/crypto/nx/nx-842.c |
4614 | F: include/linux/nx842.h | 4634 | F: include/linux/nx842.h |
@@ -4710,6 +4730,7 @@ L: linux-iio@vger.kernel.org | |||
4710 | S: Maintained | 4730 | S: Maintained |
4711 | F: drivers/iio/ | 4731 | F: drivers/iio/ |
4712 | F: drivers/staging/iio/ | 4732 | F: drivers/staging/iio/ |
4733 | F: include/linux/iio/ | ||
4713 | 4734 | ||
4714 | IKANOS/ADI EAGLE ADSL USB DRIVER | 4735 | IKANOS/ADI EAGLE ADSL USB DRIVER |
4715 | M: Matthieu Castet <castet.matthieu@free.fr> | 4736 | M: Matthieu Castet <castet.matthieu@free.fr> |
@@ -6590,6 +6611,23 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap.git | |||
6590 | S: Maintained | 6611 | S: Maintained |
6591 | F: arch/arm/*omap*/ | 6612 | F: arch/arm/*omap*/ |
6592 | F: drivers/i2c/busses/i2c-omap.c | 6613 | F: drivers/i2c/busses/i2c-omap.c |
6614 | F: drivers/irqchip/irq-omap-intc.c | ||
6615 | F: drivers/mfd/*omap*.c | ||
6616 | F: drivers/mfd/menelaus.c | ||
6617 | F: drivers/mfd/palmas.c | ||
6618 | F: drivers/mfd/tps65217.c | ||
6619 | F: drivers/mfd/tps65218.c | ||
6620 | F: drivers/mfd/tps65910.c | ||
6621 | F: drivers/mfd/twl-core.[ch] | ||
6622 | F: drivers/mfd/twl4030*.c | ||
6623 | F: drivers/mfd/twl6030*.c | ||
6624 | F: drivers/mfd/twl6040*.c | ||
6625 | F: drivers/regulator/palmas-regulator*.c | ||
6626 | F: drivers/regulator/pbias-regulator.c | ||
6627 | F: drivers/regulator/tps65217-regulator.c | ||
6628 | F: drivers/regulator/tps65218-regulator.c | ||
6629 | F: drivers/regulator/tps65910-regulator.c | ||
6630 | F: drivers/regulator/twl-regulator.c | ||
6593 | F: include/linux/i2c-omap.h | 6631 | F: include/linux/i2c-omap.h |
6594 | 6632 | ||
6595 | OMAP DEVICE TREE SUPPORT | 6633 | OMAP DEVICE TREE SUPPORT |
@@ -6600,6 +6638,9 @@ L: devicetree@vger.kernel.org | |||
6600 | S: Maintained | 6638 | S: Maintained |
6601 | F: arch/arm/boot/dts/*omap* | 6639 | F: arch/arm/boot/dts/*omap* |
6602 | F: arch/arm/boot/dts/*am3* | 6640 | F: arch/arm/boot/dts/*am3* |
6641 | F: arch/arm/boot/dts/*am4* | ||
6642 | F: arch/arm/boot/dts/*am5* | ||
6643 | F: arch/arm/boot/dts/*dra7* | ||
6603 | 6644 | ||
6604 | OMAP CLOCK FRAMEWORK SUPPORT | 6645 | OMAP CLOCK FRAMEWORK SUPPORT |
6605 | M: Paul Walmsley <paul@pwsan.com> | 6646 | M: Paul Walmsley <paul@pwsan.com> |
@@ -7175,6 +7216,7 @@ F: drivers/crypto/picoxcell* | |||
7175 | 7216 | ||
7176 | PIN CONTROL SUBSYSTEM | 7217 | PIN CONTROL SUBSYSTEM |
7177 | M: Linus Walleij <linus.walleij@linaro.org> | 7218 | M: Linus Walleij <linus.walleij@linaro.org> |
7219 | L: linux-gpio@vger.kernel.org | ||
7178 | S: Maintained | 7220 | S: Maintained |
7179 | F: drivers/pinctrl/ | 7221 | F: drivers/pinctrl/ |
7180 | F: include/linux/pinctrl/ | 7222 | F: include/linux/pinctrl/ |
@@ -8479,7 +8521,6 @@ F: arch/arm/mach-s3c24xx/bast-irq.c | |||
8479 | TI DAVINCI MACHINE SUPPORT | 8521 | TI DAVINCI MACHINE SUPPORT |
8480 | M: Sekhar Nori <nsekhar@ti.com> | 8522 | M: Sekhar Nori <nsekhar@ti.com> |
8481 | M: Kevin Hilman <khilman@deeprootsystems.com> | 8523 | M: Kevin Hilman <khilman@deeprootsystems.com> |
8482 | L: davinci-linux-open-source@linux.davincidsp.com (moderated for non-subscribers) | ||
8483 | T: git git://gitorious.org/linux-davinci/linux-davinci.git | 8524 | T: git git://gitorious.org/linux-davinci/linux-davinci.git |
8484 | Q: http://patchwork.kernel.org/project/linux-davinci/list/ | 8525 | Q: http://patchwork.kernel.org/project/linux-davinci/list/ |
8485 | S: Supported | 8526 | S: Supported |
@@ -8489,7 +8530,6 @@ F: drivers/i2c/busses/i2c-davinci.c | |||
8489 | TI DAVINCI SERIES MEDIA DRIVER | 8530 | TI DAVINCI SERIES MEDIA DRIVER |
8490 | M: Lad, Prabhakar <prabhakar.csengg@gmail.com> | 8531 | M: Lad, Prabhakar <prabhakar.csengg@gmail.com> |
8491 | L: linux-media@vger.kernel.org | 8532 | L: linux-media@vger.kernel.org |
8492 | L: davinci-linux-open-source@linux.davincidsp.com (moderated for non-subscribers) | ||
8493 | W: http://linuxtv.org/ | 8533 | W: http://linuxtv.org/ |
8494 | Q: http://patchwork.linuxtv.org/project/linux-media/list/ | 8534 | Q: http://patchwork.linuxtv.org/project/linux-media/list/ |
8495 | T: git git://linuxtv.org/mhadli/v4l-dvb-davinci_devices.git | 8535 | T: git git://linuxtv.org/mhadli/v4l-dvb-davinci_devices.git |
@@ -9606,7 +9646,6 @@ F: drivers/staging/unisys/ | |||
9606 | 9646 | ||
9607 | UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER | 9647 | UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER |
9608 | M: Vinayak Holikatti <vinholikatti@gmail.com> | 9648 | M: Vinayak Holikatti <vinholikatti@gmail.com> |
9609 | M: Santosh Y <santoshsy@gmail.com> | ||
9610 | L: linux-scsi@vger.kernel.org | 9649 | L: linux-scsi@vger.kernel.org |
9611 | S: Supported | 9650 | S: Supported |
9612 | F: Documentation/scsi/ufs.txt | 9651 | F: Documentation/scsi/ufs.txt |
@@ -9700,11 +9739,6 @@ S: Maintained | |||
9700 | F: Documentation/hid/hiddev.txt | 9739 | F: Documentation/hid/hiddev.txt |
9701 | F: drivers/hid/usbhid/ | 9740 | F: drivers/hid/usbhid/ |
9702 | 9741 | ||
9703 | USB/IP DRIVERS | ||
9704 | L: linux-usb@vger.kernel.org | ||
9705 | S: Orphan | ||
9706 | F: drivers/staging/usbip/ | ||
9707 | |||
9708 | USB ISP116X DRIVER | 9742 | USB ISP116X DRIVER |
9709 | M: Olav Kongas <ok@artecdesign.ee> | 9743 | M: Olav Kongas <ok@artecdesign.ee> |
9710 | L: linux-usb@vger.kernel.org | 9744 | L: linux-usb@vger.kernel.org |
@@ -1,8 +1,8 @@ | |||
1 | VERSION = 3 | 1 | VERSION = 3 |
2 | PATCHLEVEL = 18 | 2 | PATCHLEVEL = 18 |
3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
4 | EXTRAVERSION = -rc2 | 4 | EXTRAVERSION = -rc5 |
5 | NAME = Shuffling Zombie Juror | 5 | NAME = Diseased Newt |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
8 | # To see a list of typical targets execute "make help" | 8 | # To see a list of typical targets execute "make help" |
@@ -297,7 +297,7 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ | |||
297 | 297 | ||
298 | HOSTCC = gcc | 298 | HOSTCC = gcc |
299 | HOSTCXX = g++ | 299 | HOSTCXX = g++ |
300 | HOSTCFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer | 300 | HOSTCFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89 |
301 | HOSTCXXFLAGS = -O2 | 301 | HOSTCXXFLAGS = -O2 |
302 | 302 | ||
303 | ifeq ($(shell $(HOSTCC) -v 2>&1 | grep -c "clang version"), 1) | 303 | ifeq ($(shell $(HOSTCC) -v 2>&1 | grep -c "clang version"), 1) |
@@ -401,7 +401,8 @@ KBUILD_CPPFLAGS := -D__KERNEL__ | |||
401 | KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ | 401 | KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ |
402 | -fno-strict-aliasing -fno-common \ | 402 | -fno-strict-aliasing -fno-common \ |
403 | -Werror-implicit-function-declaration \ | 403 | -Werror-implicit-function-declaration \ |
404 | -Wno-format-security | 404 | -Wno-format-security \ |
405 | -std=gnu89 | ||
405 | 406 | ||
406 | KBUILD_AFLAGS_KERNEL := | 407 | KBUILD_AFLAGS_KERNEL := |
407 | KBUILD_CFLAGS_KERNEL := | 408 | KBUILD_CFLAGS_KERNEL := |
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug index 03dc4c1a8736..d8f6a2ec3d4e 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug | |||
@@ -1187,7 +1187,7 @@ config DEBUG_UART_VIRT | |||
1187 | default 0xf1c28000 if DEBUG_SUNXI_UART0 | 1187 | default 0xf1c28000 if DEBUG_SUNXI_UART0 |
1188 | default 0xf1c28400 if DEBUG_SUNXI_UART1 | 1188 | default 0xf1c28400 if DEBUG_SUNXI_UART1 |
1189 | default 0xf1f02800 if DEBUG_SUNXI_R_UART | 1189 | default 0xf1f02800 if DEBUG_SUNXI_R_UART |
1190 | default 0xf2100000 if DEBUG_PXA_UART1 | 1190 | default 0xf6200000 if DEBUG_PXA_UART1 |
1191 | default 0xf4090000 if ARCH_LPC32XX | 1191 | default 0xf4090000 if ARCH_LPC32XX |
1192 | default 0xf4200000 if ARCH_GEMINI | 1192 | default 0xf4200000 if ARCH_GEMINI |
1193 | default 0xf7000000 if DEBUG_S3C24XX_UART && (DEBUG_S3C_UART0 || \ | 1193 | default 0xf7000000 if DEBUG_S3C24XX_UART && (DEBUG_S3C_UART0 || \ |
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S index 413fd94b5301..68be9017593d 100644 --- a/arch/arm/boot/compressed/head.S +++ b/arch/arm/boot/compressed/head.S | |||
@@ -397,8 +397,7 @@ dtb_check_done: | |||
397 | add sp, sp, r6 | 397 | add sp, sp, r6 |
398 | #endif | 398 | #endif |
399 | 399 | ||
400 | tst r4, #1 | 400 | bl cache_clean_flush |
401 | bleq cache_clean_flush | ||
402 | 401 | ||
403 | adr r0, BSYM(restart) | 402 | adr r0, BSYM(restart) |
404 | add r0, r0, r6 | 403 | add r0, r0, r6 |
@@ -1047,6 +1046,8 @@ cache_clean_flush: | |||
1047 | b call_cache_fn | 1046 | b call_cache_fn |
1048 | 1047 | ||
1049 | __armv4_mpu_cache_flush: | 1048 | __armv4_mpu_cache_flush: |
1049 | tst r4, #1 | ||
1050 | movne pc, lr | ||
1050 | mov r2, #1 | 1051 | mov r2, #1 |
1051 | mov r3, #0 | 1052 | mov r3, #0 |
1052 | mcr p15, 0, ip, c7, c6, 0 @ invalidate D cache | 1053 | mcr p15, 0, ip, c7, c6, 0 @ invalidate D cache |
@@ -1064,6 +1065,8 @@ __armv4_mpu_cache_flush: | |||
1064 | mov pc, lr | 1065 | mov pc, lr |
1065 | 1066 | ||
1066 | __fa526_cache_flush: | 1067 | __fa526_cache_flush: |
1068 | tst r4, #1 | ||
1069 | movne pc, lr | ||
1067 | mov r1, #0 | 1070 | mov r1, #0 |
1068 | mcr p15, 0, r1, c7, c14, 0 @ clean and invalidate D cache | 1071 | mcr p15, 0, r1, c7, c14, 0 @ clean and invalidate D cache |
1069 | mcr p15, 0, r1, c7, c5, 0 @ flush I cache | 1072 | mcr p15, 0, r1, c7, c5, 0 @ flush I cache |
@@ -1072,13 +1075,16 @@ __fa526_cache_flush: | |||
1072 | 1075 | ||
1073 | __armv6_mmu_cache_flush: | 1076 | __armv6_mmu_cache_flush: |
1074 | mov r1, #0 | 1077 | mov r1, #0 |
1075 | mcr p15, 0, r1, c7, c14, 0 @ clean+invalidate D | 1078 | tst r4, #1 |
1079 | mcreq p15, 0, r1, c7, c14, 0 @ clean+invalidate D | ||
1076 | mcr p15, 0, r1, c7, c5, 0 @ invalidate I+BTB | 1080 | mcr p15, 0, r1, c7, c5, 0 @ invalidate I+BTB |
1077 | mcr p15, 0, r1, c7, c15, 0 @ clean+invalidate unified | 1081 | mcreq p15, 0, r1, c7, c15, 0 @ clean+invalidate unified |
1078 | mcr p15, 0, r1, c7, c10, 4 @ drain WB | 1082 | mcr p15, 0, r1, c7, c10, 4 @ drain WB |
1079 | mov pc, lr | 1083 | mov pc, lr |
1080 | 1084 | ||
1081 | __armv7_mmu_cache_flush: | 1085 | __armv7_mmu_cache_flush: |
1086 | tst r4, #1 | ||
1087 | bne iflush | ||
1082 | mrc p15, 0, r10, c0, c1, 5 @ read ID_MMFR1 | 1088 | mrc p15, 0, r10, c0, c1, 5 @ read ID_MMFR1 |
1083 | tst r10, #0xf << 16 @ hierarchical cache (ARMv7) | 1089 | tst r10, #0xf << 16 @ hierarchical cache (ARMv7) |
1084 | mov r10, #0 | 1090 | mov r10, #0 |
@@ -1139,6 +1145,8 @@ iflush: | |||
1139 | mov pc, lr | 1145 | mov pc, lr |
1140 | 1146 | ||
1141 | __armv5tej_mmu_cache_flush: | 1147 | __armv5tej_mmu_cache_flush: |
1148 | tst r4, #1 | ||
1149 | movne pc, lr | ||
1142 | 1: mrc p15, 0, r15, c7, c14, 3 @ test,clean,invalidate D cache | 1150 | 1: mrc p15, 0, r15, c7, c14, 3 @ test,clean,invalidate D cache |
1143 | bne 1b | 1151 | bne 1b |
1144 | mcr p15, 0, r0, c7, c5, 0 @ flush I cache | 1152 | mcr p15, 0, r0, c7, c5, 0 @ flush I cache |
@@ -1146,6 +1154,8 @@ __armv5tej_mmu_cache_flush: | |||
1146 | mov pc, lr | 1154 | mov pc, lr |
1147 | 1155 | ||
1148 | __armv4_mmu_cache_flush: | 1156 | __armv4_mmu_cache_flush: |
1157 | tst r4, #1 | ||
1158 | movne pc, lr | ||
1149 | mov r2, #64*1024 @ default: 32K dcache size (*2) | 1159 | mov r2, #64*1024 @ default: 32K dcache size (*2) |
1150 | mov r11, #32 @ default: 32 byte line size | 1160 | mov r11, #32 @ default: 32 byte line size |
1151 | mrc p15, 0, r3, c0, c0, 1 @ read cache type | 1161 | mrc p15, 0, r3, c0, c0, 1 @ read cache type |
@@ -1179,6 +1189,8 @@ no_cache_id: | |||
1179 | 1189 | ||
1180 | __armv3_mmu_cache_flush: | 1190 | __armv3_mmu_cache_flush: |
1181 | __armv3_mpu_cache_flush: | 1191 | __armv3_mpu_cache_flush: |
1192 | tst r4, #1 | ||
1193 | movne pc, lr | ||
1182 | mov r1, #0 | 1194 | mov r1, #0 |
1183 | mcr p15, 0, r1, c7, c0, 0 @ invalidate whole cache v3 | 1195 | mcr p15, 0, r1, c7, c0, 0 @ invalidate whole cache v3 |
1184 | mov pc, lr | 1196 | mov pc, lr |
diff --git a/arch/arm/boot/dts/am335x-evm.dts b/arch/arm/boot/dts/am335x-evm.dts index e2156a583de7..c4b968f0feb5 100644 --- a/arch/arm/boot/dts/am335x-evm.dts +++ b/arch/arm/boot/dts/am335x-evm.dts | |||
@@ -489,7 +489,7 @@ | |||
489 | reg = <0x00060000 0x00020000>; | 489 | reg = <0x00060000 0x00020000>; |
490 | }; | 490 | }; |
491 | partition@4 { | 491 | partition@4 { |
492 | label = "NAND.u-boot-spl"; | 492 | label = "NAND.u-boot-spl-os"; |
493 | reg = <0x00080000 0x00040000>; | 493 | reg = <0x00080000 0x00040000>; |
494 | }; | 494 | }; |
495 | partition@5 { | 495 | partition@5 { |
diff --git a/arch/arm/boot/dts/am437x-gp-evm.dts b/arch/arm/boot/dts/am437x-gp-evm.dts index e7ac47fa6615..a521ac0a7d5a 100644 --- a/arch/arm/boot/dts/am437x-gp-evm.dts +++ b/arch/arm/boot/dts/am437x-gp-evm.dts | |||
@@ -291,8 +291,8 @@ | |||
291 | dcdc3: regulator-dcdc3 { | 291 | dcdc3: regulator-dcdc3 { |
292 | compatible = "ti,tps65218-dcdc3"; | 292 | compatible = "ti,tps65218-dcdc3"; |
293 | regulator-name = "vdcdc3"; | 293 | regulator-name = "vdcdc3"; |
294 | regulator-min-microvolt = <1350000>; | 294 | regulator-min-microvolt = <1500000>; |
295 | regulator-max-microvolt = <1350000>; | 295 | regulator-max-microvolt = <1500000>; |
296 | regulator-boot-on; | 296 | regulator-boot-on; |
297 | regulator-always-on; | 297 | regulator-always-on; |
298 | }; | 298 | }; |
diff --git a/arch/arm/boot/dts/am437x-sk-evm.dts b/arch/arm/boot/dts/am437x-sk-evm.dts index 859ff3d620ee..87aa4f3b8b3d 100644 --- a/arch/arm/boot/dts/am437x-sk-evm.dts +++ b/arch/arm/boot/dts/am437x-sk-evm.dts | |||
@@ -363,8 +363,8 @@ | |||
363 | dcdc3: regulator-dcdc3 { | 363 | dcdc3: regulator-dcdc3 { |
364 | compatible = "ti,tps65218-dcdc3"; | 364 | compatible = "ti,tps65218-dcdc3"; |
365 | regulator-name = "vdds_ddr"; | 365 | regulator-name = "vdds_ddr"; |
366 | regulator-min-microvolt = <1350000>; | 366 | regulator-min-microvolt = <1500000>; |
367 | regulator-max-microvolt = <1350000>; | 367 | regulator-max-microvolt = <1500000>; |
368 | regulator-boot-on; | 368 | regulator-boot-on; |
369 | regulator-always-on; | 369 | regulator-always-on; |
370 | }; | 370 | }; |
diff --git a/arch/arm/boot/dts/am43x-epos-evm.dts b/arch/arm/boot/dts/am43x-epos-evm.dts index ac3e4859935f..f7e9bba10bd6 100644 --- a/arch/arm/boot/dts/am43x-epos-evm.dts +++ b/arch/arm/boot/dts/am43x-epos-evm.dts | |||
@@ -358,8 +358,8 @@ | |||
358 | dcdc3: regulator-dcdc3 { | 358 | dcdc3: regulator-dcdc3 { |
359 | compatible = "ti,tps65218-dcdc3"; | 359 | compatible = "ti,tps65218-dcdc3"; |
360 | regulator-name = "vdcdc3"; | 360 | regulator-name = "vdcdc3"; |
361 | regulator-min-microvolt = <1350000>; | 361 | regulator-min-microvolt = <1500000>; |
362 | regulator-max-microvolt = <1350000>; | 362 | regulator-max-microvolt = <1500000>; |
363 | regulator-boot-on; | 363 | regulator-boot-on; |
364 | regulator-always-on; | 364 | regulator-always-on; |
365 | }; | 365 | }; |
diff --git a/arch/arm/boot/dts/omap3-n900.dts b/arch/arm/boot/dts/omap3-n900.dts index 739fcf29c643..bc82a12d4c2c 100644 --- a/arch/arm/boot/dts/omap3-n900.dts +++ b/arch/arm/boot/dts/omap3-n900.dts | |||
@@ -668,6 +668,8 @@ | |||
668 | bank-width = <2>; | 668 | bank-width = <2>; |
669 | pinctrl-names = "default"; | 669 | pinctrl-names = "default"; |
670 | pinctrl-0 = <ðernet_pins>; | 670 | pinctrl-0 = <ðernet_pins>; |
671 | power-gpios = <&gpio3 22 GPIO_ACTIVE_HIGH>; /* gpio86 */ | ||
672 | reset-gpios = <&gpio6 4 GPIO_ACTIVE_HIGH>; /* gpio164 */ | ||
671 | gpmc,device-width = <2>; | 673 | gpmc,device-width = <2>; |
672 | gpmc,sync-clk-ps = <0>; | 674 | gpmc,sync-clk-ps = <0>; |
673 | gpmc,cs-on-ns = <0>; | 675 | gpmc,cs-on-ns = <0>; |
diff --git a/arch/arm/boot/dts/sama5d31.dtsi b/arch/arm/boot/dts/sama5d31.dtsi index 7997dc9863ed..883878b32971 100644 --- a/arch/arm/boot/dts/sama5d31.dtsi +++ b/arch/arm/boot/dts/sama5d31.dtsi | |||
@@ -12,5 +12,5 @@ | |||
12 | #include "sama5d3_uart.dtsi" | 12 | #include "sama5d3_uart.dtsi" |
13 | 13 | ||
14 | / { | 14 | / { |
15 | compatible = "atmel,samad31", "atmel,sama5d3", "atmel,sama5"; | 15 | compatible = "atmel,sama5d31", "atmel,sama5d3", "atmel,sama5"; |
16 | }; | 16 | }; |
diff --git a/arch/arm/boot/dts/sama5d33.dtsi b/arch/arm/boot/dts/sama5d33.dtsi index 39f832253caf..4b4434aca351 100644 --- a/arch/arm/boot/dts/sama5d33.dtsi +++ b/arch/arm/boot/dts/sama5d33.dtsi | |||
@@ -10,5 +10,5 @@ | |||
10 | #include "sama5d3_gmac.dtsi" | 10 | #include "sama5d3_gmac.dtsi" |
11 | 11 | ||
12 | / { | 12 | / { |
13 | compatible = "atmel,samad33", "atmel,sama5d3", "atmel,sama5"; | 13 | compatible = "atmel,sama5d33", "atmel,sama5d3", "atmel,sama5"; |
14 | }; | 14 | }; |
diff --git a/arch/arm/boot/dts/sama5d34.dtsi b/arch/arm/boot/dts/sama5d34.dtsi index 89cda2c0da39..aa01573fdee9 100644 --- a/arch/arm/boot/dts/sama5d34.dtsi +++ b/arch/arm/boot/dts/sama5d34.dtsi | |||
@@ -12,5 +12,5 @@ | |||
12 | #include "sama5d3_mci2.dtsi" | 12 | #include "sama5d3_mci2.dtsi" |
13 | 13 | ||
14 | / { | 14 | / { |
15 | compatible = "atmel,samad34", "atmel,sama5d3", "atmel,sama5"; | 15 | compatible = "atmel,sama5d34", "atmel,sama5d3", "atmel,sama5"; |
16 | }; | 16 | }; |
diff --git a/arch/arm/boot/dts/sama5d35.dtsi b/arch/arm/boot/dts/sama5d35.dtsi index d20cd71b5f0e..16c39f4c96a4 100644 --- a/arch/arm/boot/dts/sama5d35.dtsi +++ b/arch/arm/boot/dts/sama5d35.dtsi | |||
@@ -14,5 +14,5 @@ | |||
14 | #include "sama5d3_tcb1.dtsi" | 14 | #include "sama5d3_tcb1.dtsi" |
15 | 15 | ||
16 | / { | 16 | / { |
17 | compatible = "atmel,samad35", "atmel,sama5d3", "atmel,sama5"; | 17 | compatible = "atmel,sama5d35", "atmel,sama5d3", "atmel,sama5"; |
18 | }; | 18 | }; |
diff --git a/arch/arm/boot/dts/sama5d36.dtsi b/arch/arm/boot/dts/sama5d36.dtsi index db58cad6acd3..e85139ef40af 100644 --- a/arch/arm/boot/dts/sama5d36.dtsi +++ b/arch/arm/boot/dts/sama5d36.dtsi | |||
@@ -16,5 +16,5 @@ | |||
16 | #include "sama5d3_uart.dtsi" | 16 | #include "sama5d3_uart.dtsi" |
17 | 17 | ||
18 | / { | 18 | / { |
19 | compatible = "atmel,samad36", "atmel,sama5d3", "atmel,sama5"; | 19 | compatible = "atmel,sama5d36", "atmel,sama5d3", "atmel,sama5"; |
20 | }; | 20 | }; |
diff --git a/arch/arm/boot/dts/sama5d3xcm.dtsi b/arch/arm/boot/dts/sama5d3xcm.dtsi index 962dc28dc37b..cfcd200b0c17 100644 --- a/arch/arm/boot/dts/sama5d3xcm.dtsi +++ b/arch/arm/boot/dts/sama5d3xcm.dtsi | |||
@@ -8,7 +8,7 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | / { | 10 | / { |
11 | compatible = "atmel,samad3xcm", "atmel,sama5d3", "atmel,sama5"; | 11 | compatible = "atmel,sama5d3xcm", "atmel,sama5d3", "atmel,sama5"; |
12 | 12 | ||
13 | chosen { | 13 | chosen { |
14 | bootargs = "console=ttyS0,115200 rootfstype=ubifs ubi.mtd=5 root=ubi0:rootfs"; | 14 | bootargs = "console=ttyS0,115200 rootfstype=ubifs ubi.mtd=5 root=ubi0:rootfs"; |
diff --git a/arch/arm/boot/dts/vf610-cosmic.dts b/arch/arm/boot/dts/vf610-cosmic.dts index 3fd1b74e1216..de1b453c2932 100644 --- a/arch/arm/boot/dts/vf610-cosmic.dts +++ b/arch/arm/boot/dts/vf610-cosmic.dts | |||
@@ -33,6 +33,13 @@ | |||
33 | 33 | ||
34 | }; | 34 | }; |
35 | 35 | ||
36 | &esdhc1 { | ||
37 | pinctrl-names = "default"; | ||
38 | pinctrl-0 = <&pinctrl_esdhc1>; | ||
39 | bus-width = <4>; | ||
40 | status = "okay"; | ||
41 | }; | ||
42 | |||
36 | &fec1 { | 43 | &fec1 { |
37 | phy-mode = "rmii"; | 44 | phy-mode = "rmii"; |
38 | pinctrl-names = "default"; | 45 | pinctrl-names = "default"; |
@@ -42,6 +49,18 @@ | |||
42 | 49 | ||
43 | &iomuxc { | 50 | &iomuxc { |
44 | vf610-cosmic { | 51 | vf610-cosmic { |
52 | pinctrl_esdhc1: esdhc1grp { | ||
53 | fsl,pins = < | ||
54 | VF610_PAD_PTA24__ESDHC1_CLK 0x31ef | ||
55 | VF610_PAD_PTA25__ESDHC1_CMD 0x31ef | ||
56 | VF610_PAD_PTA26__ESDHC1_DAT0 0x31ef | ||
57 | VF610_PAD_PTA27__ESDHC1_DAT1 0x31ef | ||
58 | VF610_PAD_PTA28__ESDHC1_DATA2 0x31ef | ||
59 | VF610_PAD_PTA29__ESDHC1_DAT3 0x31ef | ||
60 | VF610_PAD_PTB28__GPIO_98 0x219d | ||
61 | >; | ||
62 | }; | ||
63 | |||
45 | pinctrl_fec1: fec1grp { | 64 | pinctrl_fec1: fec1grp { |
46 | fsl,pins = < | 65 | fsl,pins = < |
47 | VF610_PAD_PTC9__ENET_RMII1_MDC 0x30d2 | 66 | VF610_PAD_PTC9__ENET_RMII1_MDC 0x30d2 |
diff --git a/arch/arm/boot/dts/zynq-parallella.dts b/arch/arm/boot/dts/zynq-parallella.dts index e1f51ca127fe..0429bbd89fba 100644 --- a/arch/arm/boot/dts/zynq-parallella.dts +++ b/arch/arm/boot/dts/zynq-parallella.dts | |||
@@ -34,6 +34,10 @@ | |||
34 | }; | 34 | }; |
35 | }; | 35 | }; |
36 | 36 | ||
37 | &clkc { | ||
38 | fclk-enable = <0xf>; | ||
39 | }; | ||
40 | |||
37 | &gem0 { | 41 | &gem0 { |
38 | status = "okay"; | 42 | status = "okay"; |
39 | phy-mode = "rgmii-id"; | 43 | phy-mode = "rgmii-id"; |
diff --git a/arch/arm/common/edma.c b/arch/arm/common/edma.c index d86771abbf57..72041f002b7e 100644 --- a/arch/arm/common/edma.c +++ b/arch/arm/common/edma.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/io.h> | 26 | #include <linux/io.h> |
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <linux/edma.h> | 28 | #include <linux/edma.h> |
29 | #include <linux/dma-mapping.h> | ||
29 | #include <linux/of_address.h> | 30 | #include <linux/of_address.h> |
30 | #include <linux/of_device.h> | 31 | #include <linux/of_device.h> |
31 | #include <linux/of_dma.h> | 32 | #include <linux/of_dma.h> |
@@ -1623,6 +1624,11 @@ static int edma_probe(struct platform_device *pdev) | |||
1623 | struct device_node *node = pdev->dev.of_node; | 1624 | struct device_node *node = pdev->dev.of_node; |
1624 | struct device *dev = &pdev->dev; | 1625 | struct device *dev = &pdev->dev; |
1625 | int ret; | 1626 | int ret; |
1627 | struct platform_device_info edma_dev_info = { | ||
1628 | .name = "edma-dma-engine", | ||
1629 | .dma_mask = DMA_BIT_MASK(32), | ||
1630 | .parent = &pdev->dev, | ||
1631 | }; | ||
1626 | 1632 | ||
1627 | if (node) { | 1633 | if (node) { |
1628 | /* Check if this is a second instance registered */ | 1634 | /* Check if this is a second instance registered */ |
@@ -1793,6 +1799,9 @@ static int edma_probe(struct platform_device *pdev) | |||
1793 | edma_write_array(j, EDMA_QRAE, i, 0x0); | 1799 | edma_write_array(j, EDMA_QRAE, i, 0x0); |
1794 | } | 1800 | } |
1795 | arch_num_cc++; | 1801 | arch_num_cc++; |
1802 | |||
1803 | edma_dev_info.id = j; | ||
1804 | platform_device_register_full(&edma_dev_info); | ||
1796 | } | 1805 | } |
1797 | 1806 | ||
1798 | return 0; | 1807 | return 0; |
diff --git a/arch/arm/configs/imx_v4_v5_defconfig b/arch/arm/configs/imx_v4_v5_defconfig index e688741c89aa..e6b0007355f8 100644 --- a/arch/arm/configs/imx_v4_v5_defconfig +++ b/arch/arm/configs/imx_v4_v5_defconfig | |||
@@ -97,6 +97,7 @@ CONFIG_SERIAL_IMX_CONSOLE=y | |||
97 | # CONFIG_HW_RANDOM is not set | 97 | # CONFIG_HW_RANDOM is not set |
98 | CONFIG_I2C_CHARDEV=y | 98 | CONFIG_I2C_CHARDEV=y |
99 | CONFIG_I2C_IMX=y | 99 | CONFIG_I2C_IMX=y |
100 | CONFIG_SPI=y | ||
100 | CONFIG_SPI_IMX=y | 101 | CONFIG_SPI_IMX=y |
101 | CONFIG_SPI_SPIDEV=y | 102 | CONFIG_SPI_SPIDEV=y |
102 | CONFIG_GPIO_SYSFS=y | 103 | CONFIG_GPIO_SYSFS=y |
diff --git a/arch/arm/configs/imx_v6_v7_defconfig b/arch/arm/configs/imx_v6_v7_defconfig index 8fca6e276b69..6790f1b3f3a1 100644 --- a/arch/arm/configs/imx_v6_v7_defconfig +++ b/arch/arm/configs/imx_v6_v7_defconfig | |||
@@ -158,6 +158,7 @@ CONFIG_I2C_CHARDEV=y | |||
158 | CONFIG_I2C_ALGOPCF=m | 158 | CONFIG_I2C_ALGOPCF=m |
159 | CONFIG_I2C_ALGOPCA=m | 159 | CONFIG_I2C_ALGOPCA=m |
160 | CONFIG_I2C_IMX=y | 160 | CONFIG_I2C_IMX=y |
161 | CONFIG_SPI=y | ||
161 | CONFIG_SPI_IMX=y | 162 | CONFIG_SPI_IMX=y |
162 | CONFIG_GPIO_SYSFS=y | 163 | CONFIG_GPIO_SYSFS=y |
163 | CONFIG_GPIO_MC9S08DZ60=y | 164 | CONFIG_GPIO_MC9S08DZ60=y |
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig index f1dc7fc668f3..3487046d8a78 100644 --- a/arch/arm/configs/multi_v7_defconfig +++ b/arch/arm/configs/multi_v7_defconfig | |||
@@ -235,6 +235,7 @@ CONFIG_SPI_TEGRA20_SLINK=y | |||
235 | CONFIG_SPI_XILINX=y | 235 | CONFIG_SPI_XILINX=y |
236 | CONFIG_PINCTRL_AS3722=y | 236 | CONFIG_PINCTRL_AS3722=y |
237 | CONFIG_PINCTRL_PALMAS=y | 237 | CONFIG_PINCTRL_PALMAS=y |
238 | CONFIG_PINCTRL_APQ8084=y | ||
238 | CONFIG_GPIO_SYSFS=y | 239 | CONFIG_GPIO_SYSFS=y |
239 | CONFIG_GPIO_GENERIC_PLATFORM=y | 240 | CONFIG_GPIO_GENERIC_PLATFORM=y |
240 | CONFIG_GPIO_DWAPB=y | 241 | CONFIG_GPIO_DWAPB=y |
@@ -411,6 +412,7 @@ CONFIG_NVEC_POWER=y | |||
411 | CONFIG_NVEC_PAZ00=y | 412 | CONFIG_NVEC_PAZ00=y |
412 | CONFIG_QCOM_GSBI=y | 413 | CONFIG_QCOM_GSBI=y |
413 | CONFIG_COMMON_CLK_QCOM=y | 414 | CONFIG_COMMON_CLK_QCOM=y |
415 | CONFIG_APQ_MMCC_8084=y | ||
414 | CONFIG_MSM_GCC_8660=y | 416 | CONFIG_MSM_GCC_8660=y |
415 | CONFIG_MSM_MMCC_8960=y | 417 | CONFIG_MSM_MMCC_8960=y |
416 | CONFIG_MSM_MMCC_8974=y | 418 | CONFIG_MSM_MMCC_8974=y |
diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig index 16e719c268dd..b3f86670d2eb 100644 --- a/arch/arm/configs/omap2plus_defconfig +++ b/arch/arm/configs/omap2plus_defconfig | |||
@@ -86,7 +86,6 @@ CONFIG_IP_PNP_DHCP=y | |||
86 | CONFIG_IP_PNP_BOOTP=y | 86 | CONFIG_IP_PNP_BOOTP=y |
87 | CONFIG_IP_PNP_RARP=y | 87 | CONFIG_IP_PNP_RARP=y |
88 | # CONFIG_INET_LRO is not set | 88 | # CONFIG_INET_LRO is not set |
89 | CONFIG_IPV6=y | ||
90 | CONFIG_NETFILTER=y | 89 | CONFIG_NETFILTER=y |
91 | CONFIG_CAN=m | 90 | CONFIG_CAN=m |
92 | CONFIG_CAN_C_CAN=m | 91 | CONFIG_CAN_C_CAN=m |
@@ -112,6 +111,7 @@ CONFIG_MTD_OOPS=y | |||
112 | CONFIG_MTD_CFI=y | 111 | CONFIG_MTD_CFI=y |
113 | CONFIG_MTD_CFI_INTELEXT=y | 112 | CONFIG_MTD_CFI_INTELEXT=y |
114 | CONFIG_MTD_NAND=y | 113 | CONFIG_MTD_NAND=y |
114 | CONFIG_MTD_NAND_ECC_BCH=y | ||
115 | CONFIG_MTD_NAND_OMAP2=y | 115 | CONFIG_MTD_NAND_OMAP2=y |
116 | CONFIG_MTD_ONENAND=y | 116 | CONFIG_MTD_ONENAND=y |
117 | CONFIG_MTD_ONENAND_VERIFY_WRITE=y | 117 | CONFIG_MTD_ONENAND_VERIFY_WRITE=y |
@@ -317,7 +317,7 @@ CONFIG_EXT4_FS=y | |||
317 | CONFIG_FANOTIFY=y | 317 | CONFIG_FANOTIFY=y |
318 | CONFIG_QUOTA=y | 318 | CONFIG_QUOTA=y |
319 | CONFIG_QFMT_V2=y | 319 | CONFIG_QFMT_V2=y |
320 | CONFIG_AUTOFS4_FS=y | 320 | CONFIG_AUTOFS4_FS=m |
321 | CONFIG_MSDOS_FS=y | 321 | CONFIG_MSDOS_FS=y |
322 | CONFIG_VFAT_FS=y | 322 | CONFIG_VFAT_FS=y |
323 | CONFIG_TMPFS=y | 323 | CONFIG_TMPFS=y |
diff --git a/arch/arm/configs/socfpga_defconfig b/arch/arm/configs/socfpga_defconfig index d7a5855a5db8..a2956c3112f1 100644 --- a/arch/arm/configs/socfpga_defconfig +++ b/arch/arm/configs/socfpga_defconfig | |||
@@ -1,5 +1,6 @@ | |||
1 | CONFIG_EXPERIMENTAL=y | ||
2 | CONFIG_SYSVIPC=y | 1 | CONFIG_SYSVIPC=y |
2 | CONFIG_FHANDLE=y | ||
3 | CONFIG_HIGH_RES_TIMERS=y | ||
3 | CONFIG_IKCONFIG=y | 4 | CONFIG_IKCONFIG=y |
4 | CONFIG_IKCONFIG_PROC=y | 5 | CONFIG_IKCONFIG_PROC=y |
5 | CONFIG_LOG_BUF_SHIFT=14 | 6 | CONFIG_LOG_BUF_SHIFT=14 |
@@ -11,23 +12,17 @@ CONFIG_PROFILING=y | |||
11 | CONFIG_OPROFILE=y | 12 | CONFIG_OPROFILE=y |
12 | CONFIG_MODULES=y | 13 | CONFIG_MODULES=y |
13 | CONFIG_MODULE_UNLOAD=y | 14 | CONFIG_MODULE_UNLOAD=y |
14 | CONFIG_HOTPLUG=y | ||
15 | # CONFIG_LBDAF is not set | 15 | # CONFIG_LBDAF is not set |
16 | # CONFIG_BLK_DEV_BSG is not set | 16 | # CONFIG_BLK_DEV_BSG is not set |
17 | # CONFIG_IOSCHED_DEADLINE is not set | 17 | # CONFIG_IOSCHED_DEADLINE is not set |
18 | # CONFIG_IOSCHED_CFQ is not set | 18 | # CONFIG_IOSCHED_CFQ is not set |
19 | CONFIG_ARCH_SOCFPGA=y | 19 | CONFIG_ARCH_SOCFPGA=y |
20 | CONFIG_MACH_SOCFPGA_CYCLONE5=y | ||
21 | CONFIG_ARM_THUMBEE=y | 20 | CONFIG_ARM_THUMBEE=y |
22 | # CONFIG_ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA is not set | ||
23 | # CONFIG_CACHE_L2X0 is not set | ||
24 | CONFIG_HIGH_RES_TIMERS=y | ||
25 | CONFIG_SMP=y | 21 | CONFIG_SMP=y |
26 | CONFIG_NR_CPUS=2 | 22 | CONFIG_NR_CPUS=2 |
27 | CONFIG_AEABI=y | 23 | CONFIG_AEABI=y |
28 | CONFIG_ZBOOT_ROM_TEXT=0x0 | 24 | CONFIG_ZBOOT_ROM_TEXT=0x0 |
29 | CONFIG_ZBOOT_ROM_BSS=0x0 | 25 | CONFIG_ZBOOT_ROM_BSS=0x0 |
30 | CONFIG_CMDLINE="" | ||
31 | CONFIG_VFP=y | 26 | CONFIG_VFP=y |
32 | CONFIG_NEON=y | 27 | CONFIG_NEON=y |
33 | CONFIG_NET=y | 28 | CONFIG_NET=y |
@@ -41,38 +36,30 @@ CONFIG_IP_PNP=y | |||
41 | CONFIG_IP_PNP_DHCP=y | 36 | CONFIG_IP_PNP_DHCP=y |
42 | CONFIG_IP_PNP_BOOTP=y | 37 | CONFIG_IP_PNP_BOOTP=y |
43 | CONFIG_IP_PNP_RARP=y | 38 | CONFIG_IP_PNP_RARP=y |
39 | CONFIG_IPV6=y | ||
40 | CONFIG_NETWORK_PHY_TIMESTAMPING=y | ||
41 | CONFIG_VLAN_8021Q=y | ||
42 | CONFIG_VLAN_8021Q_GVRP=y | ||
44 | CONFIG_CAN=y | 43 | CONFIG_CAN=y |
45 | CONFIG_CAN_RAW=y | ||
46 | CONFIG_CAN_BCM=y | ||
47 | CONFIG_CAN_GW=y | ||
48 | CONFIG_CAN_DEV=y | ||
49 | CONFIG_CAN_CALC_BITTIMING=y | ||
50 | CONFIG_CAN_C_CAN=y | 44 | CONFIG_CAN_C_CAN=y |
51 | CONFIG_CAN_C_CAN_PLATFORM=y | 45 | CONFIG_CAN_C_CAN_PLATFORM=y |
52 | CONFIG_CAN_DEBUG_DEVICES=y | 46 | CONFIG_CAN_DEBUG_DEVICES=y |
53 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | 47 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" |
54 | CONFIG_DEVTMPFS=y | 48 | CONFIG_DEVTMPFS=y |
55 | CONFIG_PROC_DEVICETREE=y | 49 | CONFIG_DEVTMPFS_MOUNT=y |
56 | CONFIG_BLK_DEV_RAM=y | 50 | CONFIG_BLK_DEV_RAM=y |
57 | CONFIG_BLK_DEV_RAM_COUNT=2 | 51 | CONFIG_BLK_DEV_RAM_COUNT=2 |
58 | CONFIG_BLK_DEV_RAM_SIZE=8192 | 52 | CONFIG_BLK_DEV_RAM_SIZE=8192 |
53 | CONFIG_SRAM=y | ||
59 | CONFIG_SCSI=y | 54 | CONFIG_SCSI=y |
60 | # CONFIG_SCSI_PROC_FS is not set | 55 | # CONFIG_SCSI_PROC_FS is not set |
61 | CONFIG_BLK_DEV_SD=y | 56 | CONFIG_BLK_DEV_SD=y |
62 | # CONFIG_SCSI_LOWLEVEL is not set | 57 | # CONFIG_SCSI_LOWLEVEL is not set |
63 | CONFIG_NETDEVICES=y | 58 | CONFIG_NETDEVICES=y |
64 | CONFIG_STMMAC_ETH=y | 59 | CONFIG_STMMAC_ETH=y |
60 | CONFIG_DWMAC_SOCFPGA=y | ||
65 | CONFIG_MICREL_PHY=y | 61 | CONFIG_MICREL_PHY=y |
66 | # CONFIG_STMMAC_PHY_ID_ZERO_WORKAROUND is not set | ||
67 | CONFIG_INPUT_EVDEV=y | 62 | CONFIG_INPUT_EVDEV=y |
68 | CONFIG_DWMAC_SOCFPGA=y | ||
69 | CONFIG_PPS=y | ||
70 | CONFIG_NETWORK_PHY_TIMESTAMPING=y | ||
71 | CONFIG_PTP_1588_CLOCK=y | ||
72 | CONFIG_VLAN_8021Q=y | ||
73 | CONFIG_VLAN_8021Q_GVRP=y | ||
74 | CONFIG_GARP=y | ||
75 | CONFIG_IPV6=y | ||
76 | # CONFIG_SERIO_SERPORT is not set | 63 | # CONFIG_SERIO_SERPORT is not set |
77 | CONFIG_SERIO_AMBAKMI=y | 64 | CONFIG_SERIO_AMBAKMI=y |
78 | CONFIG_LEGACY_PTY_COUNT=16 | 65 | CONFIG_LEGACY_PTY_COUNT=16 |
@@ -81,45 +68,43 @@ CONFIG_SERIAL_8250_CONSOLE=y | |||
81 | CONFIG_SERIAL_8250_NR_UARTS=2 | 68 | CONFIG_SERIAL_8250_NR_UARTS=2 |
82 | CONFIG_SERIAL_8250_RUNTIME_UARTS=2 | 69 | CONFIG_SERIAL_8250_RUNTIME_UARTS=2 |
83 | CONFIG_SERIAL_8250_DW=y | 70 | CONFIG_SERIAL_8250_DW=y |
71 | CONFIG_I2C=y | ||
72 | CONFIG_I2C_CHARDEV=y | ||
73 | CONFIG_I2C_DESIGNWARE_PLATFORM=y | ||
84 | CONFIG_GPIOLIB=y | 74 | CONFIG_GPIOLIB=y |
85 | CONFIG_GPIO_SYSFS=y | 75 | CONFIG_GPIO_SYSFS=y |
86 | CONFIG_GPIO_DWAPB=y | 76 | CONFIG_GPIO_DWAPB=y |
87 | # CONFIG_RTC_HCTOSYS is not set | 77 | CONFIG_PMBUS=y |
78 | CONFIG_SENSORS_LTC2978=y | ||
79 | CONFIG_SENSORS_LTC2978_REGULATOR=y | ||
88 | CONFIG_WATCHDOG=y | 80 | CONFIG_WATCHDOG=y |
89 | CONFIG_DW_WATCHDOG=y | 81 | CONFIG_DW_WATCHDOG=y |
82 | CONFIG_REGULATOR=y | ||
83 | CONFIG_REGULATOR_FIXED_VOLTAGE=y | ||
84 | CONFIG_USB=y | ||
85 | CONFIG_USB_DWC2=y | ||
86 | CONFIG_USB_DWC2_HOST=y | ||
87 | CONFIG_MMC=y | ||
88 | CONFIG_MMC_DW=y | ||
90 | CONFIG_EXT2_FS=y | 89 | CONFIG_EXT2_FS=y |
91 | CONFIG_EXT2_FS_XATTR=y | 90 | CONFIG_EXT2_FS_XATTR=y |
92 | CONFIG_EXT2_FS_POSIX_ACL=y | 91 | CONFIG_EXT2_FS_POSIX_ACL=y |
93 | CONFIG_EXT3_FS=y | 92 | CONFIG_EXT3_FS=y |
94 | CONFIG_NFS_FS=y | 93 | CONFIG_EXT4_FS=y |
95 | CONFIG_ROOT_NFS=y | ||
96 | # CONFIG_DNOTIFY is not set | ||
97 | # CONFIG_INOTIFY_USER is not set | ||
98 | CONFIG_FHANDLE=y | ||
99 | CONFIG_VFAT_FS=y | 94 | CONFIG_VFAT_FS=y |
100 | CONFIG_NTFS_FS=y | 95 | CONFIG_NTFS_FS=y |
101 | CONFIG_NTFS_RW=y | 96 | CONFIG_NTFS_RW=y |
102 | CONFIG_TMPFS=y | 97 | CONFIG_TMPFS=y |
103 | CONFIG_JFFS2_FS=y | 98 | CONFIG_CONFIGFS_FS=y |
99 | CONFIG_NFS_FS=y | ||
100 | CONFIG_ROOT_NFS=y | ||
104 | CONFIG_NLS_CODEPAGE_437=y | 101 | CONFIG_NLS_CODEPAGE_437=y |
105 | CONFIG_NLS_ISO8859_1=y | 102 | CONFIG_NLS_ISO8859_1=y |
103 | CONFIG_PRINTK_TIME=y | ||
104 | CONFIG_DEBUG_INFO=y | ||
106 | CONFIG_MAGIC_SYSRQ=y | 105 | CONFIG_MAGIC_SYSRQ=y |
107 | CONFIG_DETECT_HUNG_TASK=y | 106 | CONFIG_DETECT_HUNG_TASK=y |
108 | # CONFIG_SCHED_DEBUG is not set | 107 | # CONFIG_SCHED_DEBUG is not set |
109 | CONFIG_DEBUG_INFO=y | ||
110 | CONFIG_ENABLE_DEFAULT_TRACERS=y | 108 | CONFIG_ENABLE_DEFAULT_TRACERS=y |
111 | CONFIG_DEBUG_USER=y | 109 | CONFIG_DEBUG_USER=y |
112 | CONFIG_XZ_DEC=y | 110 | CONFIG_XZ_DEC=y |
113 | CONFIG_I2C=y | ||
114 | CONFIG_I2C_DESIGNWARE_CORE=y | ||
115 | CONFIG_I2C_DESIGNWARE_PLATFORM=y | ||
116 | CONFIG_I2C_CHARDEV=y | ||
117 | CONFIG_MMC=y | ||
118 | CONFIG_MMC_DW=y | ||
119 | CONFIG_PM=y | ||
120 | CONFIG_SUSPEND=y | ||
121 | CONFIG_MMC_UNSAFE_RESUME=y | ||
122 | CONFIG_USB=y | ||
123 | CONFIG_USB_DWC2=y | ||
124 | CONFIG_USB_DWC2_HOST=y | ||
125 | CONFIG_USB_DWC2_PLATFORM=y | ||
diff --git a/arch/arm/include/uapi/asm/unistd.h b/arch/arm/include/uapi/asm/unistd.h index 3aaa75cae90c..705bb7620673 100644 --- a/arch/arm/include/uapi/asm/unistd.h +++ b/arch/arm/include/uapi/asm/unistd.h | |||
@@ -412,6 +412,7 @@ | |||
412 | #define __NR_seccomp (__NR_SYSCALL_BASE+383) | 412 | #define __NR_seccomp (__NR_SYSCALL_BASE+383) |
413 | #define __NR_getrandom (__NR_SYSCALL_BASE+384) | 413 | #define __NR_getrandom (__NR_SYSCALL_BASE+384) |
414 | #define __NR_memfd_create (__NR_SYSCALL_BASE+385) | 414 | #define __NR_memfd_create (__NR_SYSCALL_BASE+385) |
415 | #define __NR_bpf (__NR_SYSCALL_BASE+386) | ||
415 | 416 | ||
416 | /* | 417 | /* |
417 | * The following SWIs are ARM private. | 418 | * The following SWIs are ARM private. |
diff --git a/arch/arm/kernel/asm-offsets.c b/arch/arm/kernel/asm-offsets.c index 713e807621d2..2d2d6087b9b1 100644 --- a/arch/arm/kernel/asm-offsets.c +++ b/arch/arm/kernel/asm-offsets.c | |||
@@ -10,6 +10,7 @@ | |||
10 | * it under the terms of the GNU General Public License version 2 as | 10 | * it under the terms of the GNU General Public License version 2 as |
11 | * published by the Free Software Foundation. | 11 | * published by the Free Software Foundation. |
12 | */ | 12 | */ |
13 | #include <linux/compiler.h> | ||
13 | #include <linux/sched.h> | 14 | #include <linux/sched.h> |
14 | #include <linux/mm.h> | 15 | #include <linux/mm.h> |
15 | #include <linux/dma-mapping.h> | 16 | #include <linux/dma-mapping.h> |
@@ -39,10 +40,19 @@ | |||
39 | * GCC 3.2.x: miscompiles NEW_AUX_ENT in fs/binfmt_elf.c | 40 | * GCC 3.2.x: miscompiles NEW_AUX_ENT in fs/binfmt_elf.c |
40 | * (http://gcc.gnu.org/PR8896) and incorrect structure | 41 | * (http://gcc.gnu.org/PR8896) and incorrect structure |
41 | * initialisation in fs/jffs2/erase.c | 42 | * initialisation in fs/jffs2/erase.c |
43 | * GCC 4.8.0-4.8.2: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58854 | ||
44 | * miscompiles find_get_entry(), and can result in EXT3 and EXT4 | ||
45 | * filesystem corruption (possibly other FS too). | ||
42 | */ | 46 | */ |
47 | #ifdef __GNUC__ | ||
43 | #if (__GNUC__ == 3 && __GNUC_MINOR__ < 3) | 48 | #if (__GNUC__ == 3 && __GNUC_MINOR__ < 3) |
44 | #error Your compiler is too buggy; it is known to miscompile kernels. | 49 | #error Your compiler is too buggy; it is known to miscompile kernels. |
45 | #error Known good compilers: 3.3 | 50 | #error Known good compilers: 3.3, 4.x |
51 | #endif | ||
52 | #if GCC_VERSION >= 40800 && GCC_VERSION < 40803 | ||
53 | #error Your compiler is too buggy; it is known to miscompile kernels | ||
54 | #error and result in filesystem corruption and oopses. | ||
55 | #endif | ||
46 | #endif | 56 | #endif |
47 | 57 | ||
48 | int main(void) | 58 | int main(void) |
diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S index 9f899d8fdcca..e51833f8cc38 100644 --- a/arch/arm/kernel/calls.S +++ b/arch/arm/kernel/calls.S | |||
@@ -395,6 +395,7 @@ | |||
395 | CALL(sys_seccomp) | 395 | CALL(sys_seccomp) |
396 | CALL(sys_getrandom) | 396 | CALL(sys_getrandom) |
397 | /* 385 */ CALL(sys_memfd_create) | 397 | /* 385 */ CALL(sys_memfd_create) |
398 | CALL(sys_bpf) | ||
398 | #ifndef syscalls_counted | 399 | #ifndef syscalls_counted |
399 | .equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls | 400 | .equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls |
400 | #define syscalls_counted | 401 | #define syscalls_counted |
diff --git a/arch/arm/mach-imx/clk-vf610.c b/arch/arm/mach-imx/clk-vf610.c index a17818475050..409637254594 100644 --- a/arch/arm/mach-imx/clk-vf610.c +++ b/arch/arm/mach-imx/clk-vf610.c | |||
@@ -58,8 +58,14 @@ | |||
58 | #define PFD_PLL1_BASE (anatop_base + 0x2b0) | 58 | #define PFD_PLL1_BASE (anatop_base + 0x2b0) |
59 | #define PFD_PLL2_BASE (anatop_base + 0x100) | 59 | #define PFD_PLL2_BASE (anatop_base + 0x100) |
60 | #define PFD_PLL3_BASE (anatop_base + 0xf0) | 60 | #define PFD_PLL3_BASE (anatop_base + 0xf0) |
61 | #define PLL1_CTRL (anatop_base + 0x270) | ||
62 | #define PLL2_CTRL (anatop_base + 0x30) | ||
61 | #define PLL3_CTRL (anatop_base + 0x10) | 63 | #define PLL3_CTRL (anatop_base + 0x10) |
64 | #define PLL4_CTRL (anatop_base + 0x70) | ||
65 | #define PLL5_CTRL (anatop_base + 0xe0) | ||
66 | #define PLL6_CTRL (anatop_base + 0xa0) | ||
62 | #define PLL7_CTRL (anatop_base + 0x20) | 67 | #define PLL7_CTRL (anatop_base + 0x20) |
68 | #define ANA_MISC1 (anatop_base + 0x160) | ||
63 | 69 | ||
64 | static void __iomem *anatop_base; | 70 | static void __iomem *anatop_base; |
65 | static void __iomem *ccm_base; | 71 | static void __iomem *ccm_base; |
@@ -67,25 +73,34 @@ static void __iomem *ccm_base; | |||
67 | /* sources for multiplexer clocks, this is used multiple times */ | 73 | /* sources for multiplexer clocks, this is used multiple times */ |
68 | static const char *fast_sels[] = { "firc", "fxosc", }; | 74 | static const char *fast_sels[] = { "firc", "fxosc", }; |
69 | static const char *slow_sels[] = { "sirc_32k", "sxosc", }; | 75 | static const char *slow_sels[] = { "sirc_32k", "sxosc", }; |
70 | static const char *pll1_sels[] = { "pll1_main", "pll1_pfd1", "pll1_pfd2", "pll1_pfd3", "pll1_pfd4", }; | 76 | static const char *pll1_sels[] = { "pll1_sys", "pll1_pfd1", "pll1_pfd2", "pll1_pfd3", "pll1_pfd4", }; |
71 | static const char *pll2_sels[] = { "pll2_main", "pll2_pfd1", "pll2_pfd2", "pll2_pfd3", "pll2_pfd4", }; | 77 | static const char *pll2_sels[] = { "pll2_bus", "pll2_pfd1", "pll2_pfd2", "pll2_pfd3", "pll2_pfd4", }; |
72 | static const char *sys_sels[] = { "fast_clk_sel", "slow_clk_sel", "pll2_pfd_sel", "pll2_main", "pll1_pfd_sel", "pll3_main", }; | 78 | static const char *pll_bypass_src_sels[] = { "fast_clk_sel", "lvds1_in", }; |
79 | static const char *pll1_bypass_sels[] = { "pll1", "pll1_bypass_src", }; | ||
80 | static const char *pll2_bypass_sels[] = { "pll2", "pll2_bypass_src", }; | ||
81 | static const char *pll3_bypass_sels[] = { "pll3", "pll3_bypass_src", }; | ||
82 | static const char *pll4_bypass_sels[] = { "pll4", "pll4_bypass_src", }; | ||
83 | static const char *pll5_bypass_sels[] = { "pll5", "pll5_bypass_src", }; | ||
84 | static const char *pll6_bypass_sels[] = { "pll6", "pll6_bypass_src", }; | ||
85 | static const char *pll7_bypass_sels[] = { "pll7", "pll7_bypass_src", }; | ||
86 | static const char *sys_sels[] = { "fast_clk_sel", "slow_clk_sel", "pll2_pfd_sel", "pll2_bus", "pll1_pfd_sel", "pll3_usb_otg", }; | ||
73 | static const char *ddr_sels[] = { "pll2_pfd2", "sys_sel", }; | 87 | static const char *ddr_sels[] = { "pll2_pfd2", "sys_sel", }; |
74 | static const char *rmii_sels[] = { "enet_ext", "audio_ext", "enet_50m", "enet_25m", }; | 88 | static const char *rmii_sels[] = { "enet_ext", "audio_ext", "enet_50m", "enet_25m", }; |
75 | static const char *enet_ts_sels[] = { "enet_ext", "fxosc", "audio_ext", "usb", "enet_ts", "enet_25m", "enet_50m", }; | 89 | static const char *enet_ts_sels[] = { "enet_ext", "fxosc", "audio_ext", "usb", "enet_ts", "enet_25m", "enet_50m", }; |
76 | static const char *esai_sels[] = { "audio_ext", "mlb", "spdif_rx", "pll4_main_div", }; | 90 | static const char *esai_sels[] = { "audio_ext", "mlb", "spdif_rx", "pll4_audio_div", }; |
77 | static const char *sai_sels[] = { "audio_ext", "mlb", "spdif_rx", "pll4_main_div", }; | 91 | static const char *sai_sels[] = { "audio_ext", "mlb", "spdif_rx", "pll4_audio_div", }; |
78 | static const char *nfc_sels[] = { "platform_bus", "pll1_pfd1", "pll3_pfd1", "pll3_pfd3", }; | 92 | static const char *nfc_sels[] = { "platform_bus", "pll1_pfd1", "pll3_pfd1", "pll3_pfd3", }; |
79 | static const char *qspi_sels[] = { "pll3_main", "pll3_pfd4", "pll2_pfd4", "pll1_pfd4", }; | 93 | static const char *qspi_sels[] = { "pll3_usb_otg", "pll3_pfd4", "pll2_pfd4", "pll1_pfd4", }; |
80 | static const char *esdhc_sels[] = { "pll3_main", "pll3_pfd3", "pll1_pfd3", "platform_bus", }; | 94 | static const char *esdhc_sels[] = { "pll3_usb_otg", "pll3_pfd3", "pll1_pfd3", "platform_bus", }; |
81 | static const char *dcu_sels[] = { "pll1_pfd2", "pll3_main", }; | 95 | static const char *dcu_sels[] = { "pll1_pfd2", "pll3_usb_otg", }; |
82 | static const char *gpu_sels[] = { "pll2_pfd2", "pll3_pfd2", }; | 96 | static const char *gpu_sels[] = { "pll2_pfd2", "pll3_pfd2", }; |
83 | static const char *vadc_sels[] = { "pll6_main_div", "pll3_main_div", "pll3_main", }; | 97 | static const char *vadc_sels[] = { "pll6_video_div", "pll3_usb_otg_div", "pll3_usb_otg", }; |
84 | /* FTM counter clock source, not module clock */ | 98 | /* FTM counter clock source, not module clock */ |
85 | static const char *ftm_ext_sels[] = {"sirc_128k", "sxosc", "fxosc_half", "audio_ext", }; | 99 | static const char *ftm_ext_sels[] = {"sirc_128k", "sxosc", "fxosc_half", "audio_ext", }; |
86 | static const char *ftm_fix_sels[] = { "sxosc", "ipg_bus", }; | 100 | static const char *ftm_fix_sels[] = { "sxosc", "ipg_bus", }; |
87 | 101 | ||
88 | static struct clk_div_table pll4_main_div_table[] = { | 102 | |
103 | static struct clk_div_table pll4_audio_div_table[] = { | ||
89 | { .val = 0, .div = 1 }, | 104 | { .val = 0, .div = 1 }, |
90 | { .val = 1, .div = 2 }, | 105 | { .val = 1, .div = 2 }, |
91 | { .val = 2, .div = 6 }, | 106 | { .val = 2, .div = 6 }, |
@@ -120,6 +135,9 @@ static void __init vf610_clocks_init(struct device_node *ccm_node) | |||
120 | clk[VF610_CLK_AUDIO_EXT] = imx_obtain_fixed_clock("audio_ext", 0); | 135 | clk[VF610_CLK_AUDIO_EXT] = imx_obtain_fixed_clock("audio_ext", 0); |
121 | clk[VF610_CLK_ENET_EXT] = imx_obtain_fixed_clock("enet_ext", 0); | 136 | clk[VF610_CLK_ENET_EXT] = imx_obtain_fixed_clock("enet_ext", 0); |
122 | 137 | ||
138 | /* Clock source from external clock via LVDs PAD */ | ||
139 | clk[VF610_CLK_ANACLK1] = imx_obtain_fixed_clock("anaclk1", 0); | ||
140 | |||
123 | clk[VF610_CLK_FXOSC_HALF] = imx_clk_fixed_factor("fxosc_half", "fxosc", 1, 2); | 141 | clk[VF610_CLK_FXOSC_HALF] = imx_clk_fixed_factor("fxosc_half", "fxosc", 1, 2); |
124 | 142 | ||
125 | np = of_find_compatible_node(NULL, NULL, "fsl,vf610-anatop"); | 143 | np = of_find_compatible_node(NULL, NULL, "fsl,vf610-anatop"); |
@@ -133,31 +151,63 @@ static void __init vf610_clocks_init(struct device_node *ccm_node) | |||
133 | clk[VF610_CLK_SLOW_CLK_SEL] = imx_clk_mux("slow_clk_sel", CCM_CCSR, 4, 1, slow_sels, ARRAY_SIZE(slow_sels)); | 151 | clk[VF610_CLK_SLOW_CLK_SEL] = imx_clk_mux("slow_clk_sel", CCM_CCSR, 4, 1, slow_sels, ARRAY_SIZE(slow_sels)); |
134 | clk[VF610_CLK_FASK_CLK_SEL] = imx_clk_mux("fast_clk_sel", CCM_CCSR, 5, 1, fast_sels, ARRAY_SIZE(fast_sels)); | 152 | clk[VF610_CLK_FASK_CLK_SEL] = imx_clk_mux("fast_clk_sel", CCM_CCSR, 5, 1, fast_sels, ARRAY_SIZE(fast_sels)); |
135 | 153 | ||
136 | clk[VF610_CLK_PLL1_MAIN] = imx_clk_fixed_factor("pll1_main", "fast_clk_sel", 22, 1); | 154 | clk[VF610_CLK_PLL1_BYPASS_SRC] = imx_clk_mux("pll1_bypass_src", PLL1_CTRL, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); |
137 | clk[VF610_CLK_PLL1_PFD1] = imx_clk_pfd("pll1_pfd1", "pll1_main", PFD_PLL1_BASE, 0); | 155 | clk[VF610_CLK_PLL2_BYPASS_SRC] = imx_clk_mux("pll2_bypass_src", PLL2_CTRL, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); |
138 | clk[VF610_CLK_PLL1_PFD2] = imx_clk_pfd("pll1_pfd2", "pll1_main", PFD_PLL1_BASE, 1); | 156 | clk[VF610_CLK_PLL3_BYPASS_SRC] = imx_clk_mux("pll3_bypass_src", PLL3_CTRL, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); |
139 | clk[VF610_CLK_PLL1_PFD3] = imx_clk_pfd("pll1_pfd3", "pll1_main", PFD_PLL1_BASE, 2); | 157 | clk[VF610_CLK_PLL4_BYPASS_SRC] = imx_clk_mux("pll4_bypass_src", PLL4_CTRL, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); |
140 | clk[VF610_CLK_PLL1_PFD4] = imx_clk_pfd("pll1_pfd4", "pll1_main", PFD_PLL1_BASE, 3); | 158 | clk[VF610_CLK_PLL5_BYPASS_SRC] = imx_clk_mux("pll5_bypass_src", PLL5_CTRL, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); |
141 | 159 | clk[VF610_CLK_PLL6_BYPASS_SRC] = imx_clk_mux("pll6_bypass_src", PLL6_CTRL, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); | |
142 | clk[VF610_CLK_PLL2_MAIN] = imx_clk_fixed_factor("pll2_main", "fast_clk_sel", 22, 1); | 160 | clk[VF610_CLK_PLL7_BYPASS_SRC] = imx_clk_mux("pll7_bypass_src", PLL7_CTRL, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels)); |
143 | clk[VF610_CLK_PLL2_PFD1] = imx_clk_pfd("pll2_pfd1", "pll2_main", PFD_PLL2_BASE, 0); | 161 | |
144 | clk[VF610_CLK_PLL2_PFD2] = imx_clk_pfd("pll2_pfd2", "pll2_main", PFD_PLL2_BASE, 1); | 162 | clk[VF610_CLK_PLL1] = imx_clk_pllv3(IMX_PLLV3_GENERIC, "pll1", "pll1_bypass_src", PLL1_CTRL, 0x1); |
145 | clk[VF610_CLK_PLL2_PFD3] = imx_clk_pfd("pll2_pfd3", "pll2_main", PFD_PLL2_BASE, 2); | 163 | clk[VF610_CLK_PLL2] = imx_clk_pllv3(IMX_PLLV3_GENERIC, "pll2", "pll2_bypass_src", PLL2_CTRL, 0x1); |
146 | clk[VF610_CLK_PLL2_PFD4] = imx_clk_pfd("pll2_pfd4", "pll2_main", PFD_PLL2_BASE, 3); | 164 | clk[VF610_CLK_PLL3] = imx_clk_pllv3(IMX_PLLV3_USB, "pll3", "pll3_bypass_src", PLL3_CTRL, 0x1); |
147 | 165 | clk[VF610_CLK_PLL4] = imx_clk_pllv3(IMX_PLLV3_AV, "pll4", "pll4_bypass_src", PLL4_CTRL, 0x7f); | |
148 | clk[VF610_CLK_PLL3_MAIN] = imx_clk_fixed_factor("pll3_main", "fast_clk_sel", 20, 1); | 166 | clk[VF610_CLK_PLL5] = imx_clk_pllv3(IMX_PLLV3_ENET, "pll5", "pll5_bypass_src", PLL5_CTRL, 0x3); |
149 | clk[VF610_CLK_PLL3_PFD1] = imx_clk_pfd("pll3_pfd1", "pll3_main", PFD_PLL3_BASE, 0); | 167 | clk[VF610_CLK_PLL6] = imx_clk_pllv3(IMX_PLLV3_AV, "pll6", "pll6_bypass_src", PLL6_CTRL, 0x7f); |
150 | clk[VF610_CLK_PLL3_PFD2] = imx_clk_pfd("pll3_pfd2", "pll3_main", PFD_PLL3_BASE, 1); | 168 | clk[VF610_CLK_PLL7] = imx_clk_pllv3(IMX_PLLV3_USB, "pll7", "pll7_bypass_src", PLL7_CTRL, 0x1); |
151 | clk[VF610_CLK_PLL3_PFD3] = imx_clk_pfd("pll3_pfd3", "pll3_main", PFD_PLL3_BASE, 2); | 169 | |
152 | clk[VF610_CLK_PLL3_PFD4] = imx_clk_pfd("pll3_pfd4", "pll3_main", PFD_PLL3_BASE, 3); | 170 | clk[VF610_PLL1_BYPASS] = imx_clk_mux_flags("pll1_bypass", PLL1_CTRL, 16, 1, pll1_bypass_sels, ARRAY_SIZE(pll1_bypass_sels), CLK_SET_RATE_PARENT); |
153 | 171 | clk[VF610_PLL2_BYPASS] = imx_clk_mux_flags("pll2_bypass", PLL2_CTRL, 16, 1, pll2_bypass_sels, ARRAY_SIZE(pll2_bypass_sels), CLK_SET_RATE_PARENT); | |
154 | clk[VF610_CLK_PLL4_MAIN] = imx_clk_fixed_factor("pll4_main", "fast_clk_sel", 25, 1); | 172 | clk[VF610_PLL3_BYPASS] = imx_clk_mux_flags("pll3_bypass", PLL3_CTRL, 16, 1, pll3_bypass_sels, ARRAY_SIZE(pll3_bypass_sels), CLK_SET_RATE_PARENT); |
155 | /* Enet pll: fixed 50Mhz */ | 173 | clk[VF610_PLL4_BYPASS] = imx_clk_mux_flags("pll4_bypass", PLL4_CTRL, 16, 1, pll4_bypass_sels, ARRAY_SIZE(pll4_bypass_sels), CLK_SET_RATE_PARENT); |
156 | clk[VF610_CLK_PLL5_MAIN] = imx_clk_fixed_factor("pll5_main", "fast_clk_sel", 125, 6); | 174 | clk[VF610_PLL5_BYPASS] = imx_clk_mux_flags("pll5_bypass", PLL5_CTRL, 16, 1, pll5_bypass_sels, ARRAY_SIZE(pll5_bypass_sels), CLK_SET_RATE_PARENT); |
157 | /* pll6: default 960Mhz */ | 175 | clk[VF610_PLL6_BYPASS] = imx_clk_mux_flags("pll6_bypass", PLL6_CTRL, 16, 1, pll6_bypass_sels, ARRAY_SIZE(pll6_bypass_sels), CLK_SET_RATE_PARENT); |
158 | clk[VF610_CLK_PLL6_MAIN] = imx_clk_fixed_factor("pll6_main", "fast_clk_sel", 40, 1); | 176 | clk[VF610_PLL7_BYPASS] = imx_clk_mux_flags("pll7_bypass", PLL7_CTRL, 16, 1, pll7_bypass_sels, ARRAY_SIZE(pll7_bypass_sels), CLK_SET_RATE_PARENT); |
159 | /* pll7: USB1 PLL at 480MHz */ | 177 | |
160 | clk[VF610_CLK_PLL7_MAIN] = imx_clk_pllv3(IMX_PLLV3_USB, "pll7_main", "fast_clk_sel", PLL7_CTRL, 0x2); | 178 | /* Do not bypass PLLs initially */ |
179 | clk_set_parent(clk[VF610_PLL1_BYPASS], clk[VF610_CLK_PLL1]); | ||
180 | clk_set_parent(clk[VF610_PLL2_BYPASS], clk[VF610_CLK_PLL2]); | ||
181 | clk_set_parent(clk[VF610_PLL3_BYPASS], clk[VF610_CLK_PLL3]); | ||
182 | clk_set_parent(clk[VF610_PLL4_BYPASS], clk[VF610_CLK_PLL4]); | ||
183 | clk_set_parent(clk[VF610_PLL5_BYPASS], clk[VF610_CLK_PLL5]); | ||
184 | clk_set_parent(clk[VF610_PLL6_BYPASS], clk[VF610_CLK_PLL6]); | ||
185 | clk_set_parent(clk[VF610_PLL7_BYPASS], clk[VF610_CLK_PLL7]); | ||
186 | |||
187 | clk[VF610_CLK_PLL1_SYS] = imx_clk_gate("pll1_sys", "pll1_bypass", PLL1_CTRL, 13); | ||
188 | clk[VF610_CLK_PLL2_BUS] = imx_clk_gate("pll2_bus", "pll2_bypass", PLL2_CTRL, 13); | ||
189 | clk[VF610_CLK_PLL3_USB_OTG] = imx_clk_gate("pll3_usb_otg", "pll3_bypass", PLL3_CTRL, 13); | ||
190 | clk[VF610_CLK_PLL4_AUDIO] = imx_clk_gate("pll4_audio", "pll4_bypass", PLL4_CTRL, 13); | ||
191 | clk[VF610_CLK_PLL5_ENET] = imx_clk_gate("pll5_enet", "pll5_bypass", PLL5_CTRL, 13); | ||
192 | clk[VF610_CLK_PLL6_VIDEO] = imx_clk_gate("pll6_video", "pll6_bypass", PLL6_CTRL, 13); | ||
193 | clk[VF610_CLK_PLL7_USB_HOST] = imx_clk_gate("pll7_usb_host", "pll7_bypass", PLL7_CTRL, 13); | ||
194 | |||
195 | clk[VF610_CLK_LVDS1_IN] = imx_clk_gate_exclusive("lvds1_in", "anaclk1", ANA_MISC1, 12, BIT(10)); | ||
196 | |||
197 | clk[VF610_CLK_PLL1_PFD1] = imx_clk_pfd("pll1_pfd1", "pll1_sys", PFD_PLL1_BASE, 0); | ||
198 | clk[VF610_CLK_PLL1_PFD2] = imx_clk_pfd("pll1_pfd2", "pll1_sys", PFD_PLL1_BASE, 1); | ||
199 | clk[VF610_CLK_PLL1_PFD3] = imx_clk_pfd("pll1_pfd3", "pll1_sys", PFD_PLL1_BASE, 2); | ||
200 | clk[VF610_CLK_PLL1_PFD4] = imx_clk_pfd("pll1_pfd4", "pll1_sys", PFD_PLL1_BASE, 3); | ||
201 | |||
202 | clk[VF610_CLK_PLL2_PFD1] = imx_clk_pfd("pll2_pfd1", "pll2_bus", PFD_PLL2_BASE, 0); | ||
203 | clk[VF610_CLK_PLL2_PFD2] = imx_clk_pfd("pll2_pfd2", "pll2_bus", PFD_PLL2_BASE, 1); | ||
204 | clk[VF610_CLK_PLL2_PFD3] = imx_clk_pfd("pll2_pfd3", "pll2_bus", PFD_PLL2_BASE, 2); | ||
205 | clk[VF610_CLK_PLL2_PFD4] = imx_clk_pfd("pll2_pfd4", "pll2_bus", PFD_PLL2_BASE, 3); | ||
206 | |||
207 | clk[VF610_CLK_PLL3_PFD1] = imx_clk_pfd("pll3_pfd1", "pll3_usb_otg", PFD_PLL3_BASE, 0); | ||
208 | clk[VF610_CLK_PLL3_PFD2] = imx_clk_pfd("pll3_pfd2", "pll3_usb_otg", PFD_PLL3_BASE, 1); | ||
209 | clk[VF610_CLK_PLL3_PFD3] = imx_clk_pfd("pll3_pfd3", "pll3_usb_otg", PFD_PLL3_BASE, 2); | ||
210 | clk[VF610_CLK_PLL3_PFD4] = imx_clk_pfd("pll3_pfd4", "pll3_usb_otg", PFD_PLL3_BASE, 3); | ||
161 | 211 | ||
162 | clk[VF610_CLK_PLL1_PFD_SEL] = imx_clk_mux("pll1_pfd_sel", CCM_CCSR, 16, 3, pll1_sels, 5); | 212 | clk[VF610_CLK_PLL1_PFD_SEL] = imx_clk_mux("pll1_pfd_sel", CCM_CCSR, 16, 3, pll1_sels, 5); |
163 | clk[VF610_CLK_PLL2_PFD_SEL] = imx_clk_mux("pll2_pfd_sel", CCM_CCSR, 19, 3, pll2_sels, 5); | 213 | clk[VF610_CLK_PLL2_PFD_SEL] = imx_clk_mux("pll2_pfd_sel", CCM_CCSR, 19, 3, pll2_sels, 5); |
@@ -167,12 +217,12 @@ static void __init vf610_clocks_init(struct device_node *ccm_node) | |||
167 | clk[VF610_CLK_PLATFORM_BUS] = imx_clk_divider("platform_bus", "sys_bus", CCM_CACRR, 3, 3); | 217 | clk[VF610_CLK_PLATFORM_BUS] = imx_clk_divider("platform_bus", "sys_bus", CCM_CACRR, 3, 3); |
168 | clk[VF610_CLK_IPG_BUS] = imx_clk_divider("ipg_bus", "platform_bus", CCM_CACRR, 11, 2); | 218 | clk[VF610_CLK_IPG_BUS] = imx_clk_divider("ipg_bus", "platform_bus", CCM_CACRR, 11, 2); |
169 | 219 | ||
170 | clk[VF610_CLK_PLL3_MAIN_DIV] = imx_clk_divider("pll3_main_div", "pll3_main", CCM_CACRR, 20, 1); | 220 | clk[VF610_CLK_PLL3_MAIN_DIV] = imx_clk_divider("pll3_usb_otg_div", "pll3_usb_otg", CCM_CACRR, 20, 1); |
171 | clk[VF610_CLK_PLL4_MAIN_DIV] = clk_register_divider_table(NULL, "pll4_main_div", "pll4_main", 0, CCM_CACRR, 6, 3, 0, pll4_main_div_table, &imx_ccm_lock); | 221 | clk[VF610_CLK_PLL4_MAIN_DIV] = clk_register_divider_table(NULL, "pll4_audio_div", "pll4_audio", 0, CCM_CACRR, 6, 3, 0, pll4_audio_div_table, &imx_ccm_lock); |
172 | clk[VF610_CLK_PLL6_MAIN_DIV] = imx_clk_divider("pll6_main_div", "pll6_main", CCM_CACRR, 21, 1); | 222 | clk[VF610_CLK_PLL6_MAIN_DIV] = imx_clk_divider("pll6_video_div", "pll6_video", CCM_CACRR, 21, 1); |
173 | 223 | ||
174 | clk[VF610_CLK_USBPHY0] = imx_clk_gate("usbphy0", "pll3_main", PLL3_CTRL, 6); | 224 | clk[VF610_CLK_USBPHY0] = imx_clk_gate("usbphy0", "pll3_usb_otg", PLL3_CTRL, 6); |
175 | clk[VF610_CLK_USBPHY1] = imx_clk_gate("usbphy1", "pll7_main", PLL7_CTRL, 6); | 225 | clk[VF610_CLK_USBPHY1] = imx_clk_gate("usbphy1", "pll7_usb_host", PLL7_CTRL, 6); |
176 | 226 | ||
177 | clk[VF610_CLK_USBC0] = imx_clk_gate2("usbc0", "ipg_bus", CCM_CCGR1, CCM_CCGRx_CGn(4)); | 227 | clk[VF610_CLK_USBC0] = imx_clk_gate2("usbc0", "ipg_bus", CCM_CCGR1, CCM_CCGRx_CGn(4)); |
178 | clk[VF610_CLK_USBC1] = imx_clk_gate2("usbc1", "ipg_bus", CCM_CCGR7, CCM_CCGRx_CGn(4)); | 228 | clk[VF610_CLK_USBC1] = imx_clk_gate2("usbc1", "ipg_bus", CCM_CCGR7, CCM_CCGRx_CGn(4)); |
@@ -191,8 +241,8 @@ static void __init vf610_clocks_init(struct device_node *ccm_node) | |||
191 | clk[VF610_CLK_QSPI1_X1_DIV] = imx_clk_divider("qspi1_x1", "qspi1_x2", CCM_CSCDR3, 11, 1); | 241 | clk[VF610_CLK_QSPI1_X1_DIV] = imx_clk_divider("qspi1_x1", "qspi1_x2", CCM_CSCDR3, 11, 1); |
192 | clk[VF610_CLK_QSPI1] = imx_clk_gate2("qspi1", "qspi1_x1", CCM_CCGR8, CCM_CCGRx_CGn(4)); | 242 | clk[VF610_CLK_QSPI1] = imx_clk_gate2("qspi1", "qspi1_x1", CCM_CCGR8, CCM_CCGRx_CGn(4)); |
193 | 243 | ||
194 | clk[VF610_CLK_ENET_50M] = imx_clk_fixed_factor("enet_50m", "pll5_main", 1, 10); | 244 | clk[VF610_CLK_ENET_50M] = imx_clk_fixed_factor("enet_50m", "pll5_enet", 1, 10); |
195 | clk[VF610_CLK_ENET_25M] = imx_clk_fixed_factor("enet_25m", "pll5_main", 1, 20); | 245 | clk[VF610_CLK_ENET_25M] = imx_clk_fixed_factor("enet_25m", "pll5_enet", 1, 20); |
196 | clk[VF610_CLK_ENET_SEL] = imx_clk_mux("enet_sel", CCM_CSCMR2, 4, 2, rmii_sels, 4); | 246 | clk[VF610_CLK_ENET_SEL] = imx_clk_mux("enet_sel", CCM_CSCMR2, 4, 2, rmii_sels, 4); |
197 | clk[VF610_CLK_ENET_TS_SEL] = imx_clk_mux("enet_ts_sel", CCM_CSCMR2, 0, 3, enet_ts_sels, 7); | 247 | clk[VF610_CLK_ENET_TS_SEL] = imx_clk_mux("enet_ts_sel", CCM_CSCMR2, 0, 3, enet_ts_sels, 7); |
198 | clk[VF610_CLK_ENET] = imx_clk_gate("enet", "enet_sel", CCM_CSCDR1, 24); | 248 | clk[VF610_CLK_ENET] = imx_clk_gate("enet", "enet_sel", CCM_CSCDR1, 24); |
diff --git a/arch/arm/mach-ixp4xx/include/mach/io.h b/arch/arm/mach-ixp4xx/include/mach/io.h index 559c69a47731..7d11979da030 100644 --- a/arch/arm/mach-ixp4xx/include/mach/io.h +++ b/arch/arm/mach-ixp4xx/include/mach/io.h | |||
@@ -76,7 +76,7 @@ static inline void __indirect_writeb(u8 value, volatile void __iomem *p) | |||
76 | u32 n, byte_enables, data; | 76 | u32 n, byte_enables, data; |
77 | 77 | ||
78 | if (!is_pci_memory(addr)) { | 78 | if (!is_pci_memory(addr)) { |
79 | __raw_writeb(value, addr); | 79 | __raw_writeb(value, p); |
80 | return; | 80 | return; |
81 | } | 81 | } |
82 | 82 | ||
@@ -141,7 +141,7 @@ static inline unsigned char __indirect_readb(const volatile void __iomem *p) | |||
141 | u32 n, byte_enables, data; | 141 | u32 n, byte_enables, data; |
142 | 142 | ||
143 | if (!is_pci_memory(addr)) | 143 | if (!is_pci_memory(addr)) |
144 | return __raw_readb(addr); | 144 | return __raw_readb(p); |
145 | 145 | ||
146 | n = addr % 4; | 146 | n = addr % 4; |
147 | byte_enables = (0xf & ~BIT(n)) << IXP4XX_PCI_NP_CBE_BESL; | 147 | byte_enables = (0xf & ~BIT(n)) << IXP4XX_PCI_NP_CBE_BESL; |
diff --git a/arch/arm/mach-mvebu/board-v7.c b/arch/arm/mach-mvebu/board-v7.c index 6478626e3ff6..d0d39f150fab 100644 --- a/arch/arm/mach-mvebu/board-v7.c +++ b/arch/arm/mach-mvebu/board-v7.c | |||
@@ -188,7 +188,7 @@ static void __init thermal_quirk(void) | |||
188 | 188 | ||
189 | static void __init mvebu_dt_init(void) | 189 | static void __init mvebu_dt_init(void) |
190 | { | 190 | { |
191 | if (of_machine_is_compatible("plathome,openblocks-ax3-4")) | 191 | if (of_machine_is_compatible("marvell,armadaxp")) |
192 | i2c_quirk(); | 192 | i2c_quirk(); |
193 | if (of_machine_is_compatible("marvell,a375-db")) { | 193 | if (of_machine_is_compatible("marvell,a375-db")) { |
194 | external_abort_quirk(); | 194 | external_abort_quirk(); |
diff --git a/arch/arm/mach-omap2/omap_device.c b/arch/arm/mach-omap2/omap_device.c index d22c30d3ccfa..8c58b71c2727 100644 --- a/arch/arm/mach-omap2/omap_device.c +++ b/arch/arm/mach-omap2/omap_device.c | |||
@@ -917,6 +917,10 @@ static int __init omap_device_late_idle(struct device *dev, void *data) | |||
917 | static int __init omap_device_late_init(void) | 917 | static int __init omap_device_late_init(void) |
918 | { | 918 | { |
919 | bus_for_each_dev(&platform_bus_type, NULL, NULL, omap_device_late_idle); | 919 | bus_for_each_dev(&platform_bus_type, NULL, NULL, omap_device_late_idle); |
920 | |||
921 | WARN(!of_have_populated_dt(), | ||
922 | "legacy booting deprecated, please update to boot with .dts\n"); | ||
923 | |||
920 | return 0; | 924 | return 0; |
921 | } | 925 | } |
922 | omap_late_initcall_sync(omap_device_late_init); | 926 | omap_late_initcall_sync(omap_device_late_init); |
diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c index c95346c94829..cec9d6c6442c 100644 --- a/arch/arm/mach-omap2/pdata-quirks.c +++ b/arch/arm/mach-omap2/pdata-quirks.c | |||
@@ -252,9 +252,6 @@ static void __init nokia_n900_legacy_init(void) | |||
252 | platform_device_register(&omap3_rom_rng_device); | 252 | platform_device_register(&omap3_rom_rng_device); |
253 | 253 | ||
254 | } | 254 | } |
255 | |||
256 | /* Only on some development boards */ | ||
257 | gpio_request_one(164, GPIOF_OUT_INIT_LOW, "smc91x reset"); | ||
258 | } | 255 | } |
259 | 256 | ||
260 | static void __init omap3_tao3530_legacy_init(void) | 257 | static void __init omap3_tao3530_legacy_init(void) |
diff --git a/arch/arm/mach-pxa/include/mach/addr-map.h b/arch/arm/mach-pxa/include/mach/addr-map.h index bbf9df37ad4b..d28fe291233a 100644 --- a/arch/arm/mach-pxa/include/mach/addr-map.h +++ b/arch/arm/mach-pxa/include/mach/addr-map.h | |||
@@ -39,6 +39,11 @@ | |||
39 | #define DMEMC_SIZE 0x00100000 | 39 | #define DMEMC_SIZE 0x00100000 |
40 | 40 | ||
41 | /* | 41 | /* |
42 | * Reserved space for low level debug virtual addresses within | ||
43 | * 0xf6200000..0xf6201000 | ||
44 | */ | ||
45 | |||
46 | /* | ||
42 | * Internal Memory Controller (PXA27x and later) | 47 | * Internal Memory Controller (PXA27x and later) |
43 | */ | 48 | */ |
44 | #define IMEMC_PHYS 0x58000000 | 49 | #define IMEMC_PHYS 0x58000000 |
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig index ae69809a9e47..7eb94e6fc376 100644 --- a/arch/arm/mm/Kconfig +++ b/arch/arm/mm/Kconfig | |||
@@ -798,6 +798,7 @@ config NEED_KUSER_HELPERS | |||
798 | 798 | ||
799 | config KUSER_HELPERS | 799 | config KUSER_HELPERS |
800 | bool "Enable kuser helpers in vector page" if !NEED_KUSER_HELPERS | 800 | bool "Enable kuser helpers in vector page" if !NEED_KUSER_HELPERS |
801 | depends on MMU | ||
801 | default y | 802 | default y |
802 | help | 803 | help |
803 | Warning: disabling this option may break user programs. | 804 | Warning: disabling this option may break user programs. |
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c index 55f9d6e0cc88..5e65ca8dea62 100644 --- a/arch/arm/mm/cache-l2x0.c +++ b/arch/arm/mm/cache-l2x0.c | |||
@@ -956,7 +956,7 @@ static u32 cache_id_part_number_from_dt; | |||
956 | * @associativity: variable to return the calculated associativity in | 956 | * @associativity: variable to return the calculated associativity in |
957 | * @max_way_size: the maximum size in bytes for the cache ways | 957 | * @max_way_size: the maximum size in bytes for the cache ways |
958 | */ | 958 | */ |
959 | static void __init l2x0_cache_size_of_parse(const struct device_node *np, | 959 | static int __init l2x0_cache_size_of_parse(const struct device_node *np, |
960 | u32 *aux_val, u32 *aux_mask, | 960 | u32 *aux_val, u32 *aux_mask, |
961 | u32 *associativity, | 961 | u32 *associativity, |
962 | u32 max_way_size) | 962 | u32 max_way_size) |
@@ -974,7 +974,7 @@ static void __init l2x0_cache_size_of_parse(const struct device_node *np, | |||
974 | of_property_read_u32(np, "cache-line-size", &line_size); | 974 | of_property_read_u32(np, "cache-line-size", &line_size); |
975 | 975 | ||
976 | if (!cache_size || !sets) | 976 | if (!cache_size || !sets) |
977 | return; | 977 | return -ENODEV; |
978 | 978 | ||
979 | /* All these l2 caches have the same line = block size actually */ | 979 | /* All these l2 caches have the same line = block size actually */ |
980 | if (!line_size) { | 980 | if (!line_size) { |
@@ -1009,7 +1009,7 @@ static void __init l2x0_cache_size_of_parse(const struct device_node *np, | |||
1009 | 1009 | ||
1010 | if (way_size > max_way_size) { | 1010 | if (way_size > max_way_size) { |
1011 | pr_err("L2C OF: set size %dKB is too large\n", way_size); | 1011 | pr_err("L2C OF: set size %dKB is too large\n", way_size); |
1012 | return; | 1012 | return -EINVAL; |
1013 | } | 1013 | } |
1014 | 1014 | ||
1015 | pr_info("L2C OF: override cache size: %d bytes (%dKB)\n", | 1015 | pr_info("L2C OF: override cache size: %d bytes (%dKB)\n", |
@@ -1027,7 +1027,7 @@ static void __init l2x0_cache_size_of_parse(const struct device_node *np, | |||
1027 | if (way_size_bits < 1 || way_size_bits > 6) { | 1027 | if (way_size_bits < 1 || way_size_bits > 6) { |
1028 | pr_err("L2C OF: cache way size illegal: %dKB is not mapped\n", | 1028 | pr_err("L2C OF: cache way size illegal: %dKB is not mapped\n", |
1029 | way_size); | 1029 | way_size); |
1030 | return; | 1030 | return -EINVAL; |
1031 | } | 1031 | } |
1032 | 1032 | ||
1033 | mask |= L2C_AUX_CTRL_WAY_SIZE_MASK; | 1033 | mask |= L2C_AUX_CTRL_WAY_SIZE_MASK; |
@@ -1036,6 +1036,8 @@ static void __init l2x0_cache_size_of_parse(const struct device_node *np, | |||
1036 | *aux_val &= ~mask; | 1036 | *aux_val &= ~mask; |
1037 | *aux_val |= val; | 1037 | *aux_val |= val; |
1038 | *aux_mask &= ~mask; | 1038 | *aux_mask &= ~mask; |
1039 | |||
1040 | return 0; | ||
1039 | } | 1041 | } |
1040 | 1042 | ||
1041 | static void __init l2x0_of_parse(const struct device_node *np, | 1043 | static void __init l2x0_of_parse(const struct device_node *np, |
@@ -1046,6 +1048,7 @@ static void __init l2x0_of_parse(const struct device_node *np, | |||
1046 | u32 dirty = 0; | 1048 | u32 dirty = 0; |
1047 | u32 val = 0, mask = 0; | 1049 | u32 val = 0, mask = 0; |
1048 | u32 assoc; | 1050 | u32 assoc; |
1051 | int ret; | ||
1049 | 1052 | ||
1050 | of_property_read_u32(np, "arm,tag-latency", &tag); | 1053 | of_property_read_u32(np, "arm,tag-latency", &tag); |
1051 | if (tag) { | 1054 | if (tag) { |
@@ -1068,7 +1071,10 @@ static void __init l2x0_of_parse(const struct device_node *np, | |||
1068 | val |= (dirty - 1) << L2X0_AUX_CTRL_DIRTY_LATENCY_SHIFT; | 1071 | val |= (dirty - 1) << L2X0_AUX_CTRL_DIRTY_LATENCY_SHIFT; |
1069 | } | 1072 | } |
1070 | 1073 | ||
1071 | l2x0_cache_size_of_parse(np, aux_val, aux_mask, &assoc, SZ_256K); | 1074 | ret = l2x0_cache_size_of_parse(np, aux_val, aux_mask, &assoc, SZ_256K); |
1075 | if (ret) | ||
1076 | return; | ||
1077 | |||
1072 | if (assoc > 8) { | 1078 | if (assoc > 8) { |
1073 | pr_err("l2x0 of: cache setting yield too high associativity\n"); | 1079 | pr_err("l2x0 of: cache setting yield too high associativity\n"); |
1074 | pr_err("l2x0 of: %d calculated, max 8\n", assoc); | 1080 | pr_err("l2x0 of: %d calculated, max 8\n", assoc); |
@@ -1125,6 +1131,7 @@ static void __init l2c310_of_parse(const struct device_node *np, | |||
1125 | u32 tag[3] = { 0, 0, 0 }; | 1131 | u32 tag[3] = { 0, 0, 0 }; |
1126 | u32 filter[2] = { 0, 0 }; | 1132 | u32 filter[2] = { 0, 0 }; |
1127 | u32 assoc; | 1133 | u32 assoc; |
1134 | int ret; | ||
1128 | 1135 | ||
1129 | of_property_read_u32_array(np, "arm,tag-latency", tag, ARRAY_SIZE(tag)); | 1136 | of_property_read_u32_array(np, "arm,tag-latency", tag, ARRAY_SIZE(tag)); |
1130 | if (tag[0] && tag[1] && tag[2]) | 1137 | if (tag[0] && tag[1] && tag[2]) |
@@ -1152,7 +1159,10 @@ static void __init l2c310_of_parse(const struct device_node *np, | |||
1152 | l2x0_base + L310_ADDR_FILTER_START); | 1159 | l2x0_base + L310_ADDR_FILTER_START); |
1153 | } | 1160 | } |
1154 | 1161 | ||
1155 | l2x0_cache_size_of_parse(np, aux_val, aux_mask, &assoc, SZ_512K); | 1162 | ret = l2x0_cache_size_of_parse(np, aux_val, aux_mask, &assoc, SZ_512K); |
1163 | if (ret) | ||
1164 | return; | ||
1165 | |||
1156 | switch (assoc) { | 1166 | switch (assoc) { |
1157 | case 16: | 1167 | case 16: |
1158 | *aux_val &= ~L2X0_AUX_CTRL_ASSOC_MASK; | 1168 | *aux_val &= ~L2X0_AUX_CTRL_ASSOC_MASK; |
@@ -1164,8 +1174,8 @@ static void __init l2c310_of_parse(const struct device_node *np, | |||
1164 | *aux_mask &= ~L2X0_AUX_CTRL_ASSOC_MASK; | 1174 | *aux_mask &= ~L2X0_AUX_CTRL_ASSOC_MASK; |
1165 | break; | 1175 | break; |
1166 | default: | 1176 | default: |
1167 | pr_err("PL310 OF: cache setting yield illegal associativity\n"); | 1177 | pr_err("L2C-310 OF cache associativity %d invalid, only 8 or 16 permitted\n", |
1168 | pr_err("PL310 OF: %d calculated, only 8 and 16 legal\n", assoc); | 1178 | assoc); |
1169 | break; | 1179 | break; |
1170 | } | 1180 | } |
1171 | } | 1181 | } |
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index c245d903927f..e8907117861e 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c | |||
@@ -1198,7 +1198,6 @@ __iommu_alloc_remap(struct page **pages, size_t size, gfp_t gfp, pgprot_t prot, | |||
1198 | { | 1198 | { |
1199 | return dma_common_pages_remap(pages, size, | 1199 | return dma_common_pages_remap(pages, size, |
1200 | VM_ARM_DMA_CONSISTENT | VM_USERMAP, prot, caller); | 1200 | VM_ARM_DMA_CONSISTENT | VM_USERMAP, prot, caller); |
1201 | return NULL; | ||
1202 | } | 1201 | } |
1203 | 1202 | ||
1204 | /* | 1203 | /* |
diff --git a/arch/arm/mm/highmem.c b/arch/arm/mm/highmem.c index 45aeaaca9052..e17ed00828d7 100644 --- a/arch/arm/mm/highmem.c +++ b/arch/arm/mm/highmem.c | |||
@@ -127,8 +127,11 @@ void *kmap_atomic_pfn(unsigned long pfn) | |||
127 | { | 127 | { |
128 | unsigned long vaddr; | 128 | unsigned long vaddr; |
129 | int idx, type; | 129 | int idx, type; |
130 | struct page *page = pfn_to_page(pfn); | ||
130 | 131 | ||
131 | pagefault_disable(); | 132 | pagefault_disable(); |
133 | if (!PageHighMem(page)) | ||
134 | return page_address(page); | ||
132 | 135 | ||
133 | type = kmap_atomic_idx_push(); | 136 | type = kmap_atomic_idx_push(); |
134 | idx = type + KM_TYPE_NR * smp_processor_id(); | 137 | idx = type + KM_TYPE_NR * smp_processor_id(); |
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index 92bba32d9230..9481f85c56e6 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c | |||
@@ -559,10 +559,10 @@ void __init mem_init(void) | |||
559 | #ifdef CONFIG_MODULES | 559 | #ifdef CONFIG_MODULES |
560 | " modules : 0x%08lx - 0x%08lx (%4ld MB)\n" | 560 | " modules : 0x%08lx - 0x%08lx (%4ld MB)\n" |
561 | #endif | 561 | #endif |
562 | " .text : 0x%p" " - 0x%p" " (%4d kB)\n" | 562 | " .text : 0x%p" " - 0x%p" " (%4td kB)\n" |
563 | " .init : 0x%p" " - 0x%p" " (%4d kB)\n" | 563 | " .init : 0x%p" " - 0x%p" " (%4td kB)\n" |
564 | " .data : 0x%p" " - 0x%p" " (%4d kB)\n" | 564 | " .data : 0x%p" " - 0x%p" " (%4td kB)\n" |
565 | " .bss : 0x%p" " - 0x%p" " (%4d kB)\n", | 565 | " .bss : 0x%p" " - 0x%p" " (%4td kB)\n", |
566 | 566 | ||
567 | MLK(UL(CONFIG_VECTORS_BASE), UL(CONFIG_VECTORS_BASE) + | 567 | MLK(UL(CONFIG_VECTORS_BASE), UL(CONFIG_VECTORS_BASE) + |
568 | (PAGE_SIZE)), | 568 | (PAGE_SIZE)), |
diff --git a/arch/arm/plat-orion/gpio.c b/arch/arm/plat-orion/gpio.c index b61a3bcc2fa8..e048f6198d68 100644 --- a/arch/arm/plat-orion/gpio.c +++ b/arch/arm/plat-orion/gpio.c | |||
@@ -497,6 +497,34 @@ static void orion_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) | |||
497 | #define orion_gpio_dbg_show NULL | 497 | #define orion_gpio_dbg_show NULL |
498 | #endif | 498 | #endif |
499 | 499 | ||
500 | static void orion_gpio_unmask_irq(struct irq_data *d) | ||
501 | { | ||
502 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | ||
503 | struct irq_chip_type *ct = irq_data_get_chip_type(d); | ||
504 | u32 reg_val; | ||
505 | u32 mask = d->mask; | ||
506 | |||
507 | irq_gc_lock(gc); | ||
508 | reg_val = irq_reg_readl(gc->reg_base + ct->regs.mask); | ||
509 | reg_val |= mask; | ||
510 | irq_reg_writel(reg_val, gc->reg_base + ct->regs.mask); | ||
511 | irq_gc_unlock(gc); | ||
512 | } | ||
513 | |||
514 | static void orion_gpio_mask_irq(struct irq_data *d) | ||
515 | { | ||
516 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | ||
517 | struct irq_chip_type *ct = irq_data_get_chip_type(d); | ||
518 | u32 mask = d->mask; | ||
519 | u32 reg_val; | ||
520 | |||
521 | irq_gc_lock(gc); | ||
522 | reg_val = irq_reg_readl(gc->reg_base + ct->regs.mask); | ||
523 | reg_val &= ~mask; | ||
524 | irq_reg_writel(reg_val, gc->reg_base + ct->regs.mask); | ||
525 | irq_gc_unlock(gc); | ||
526 | } | ||
527 | |||
500 | void __init orion_gpio_init(struct device_node *np, | 528 | void __init orion_gpio_init(struct device_node *np, |
501 | int gpio_base, int ngpio, | 529 | int gpio_base, int ngpio, |
502 | void __iomem *base, int mask_offset, | 530 | void __iomem *base, int mask_offset, |
@@ -565,8 +593,8 @@ void __init orion_gpio_init(struct device_node *np, | |||
565 | ct = gc->chip_types; | 593 | ct = gc->chip_types; |
566 | ct->regs.mask = ochip->mask_offset + GPIO_LEVEL_MASK_OFF; | 594 | ct->regs.mask = ochip->mask_offset + GPIO_LEVEL_MASK_OFF; |
567 | ct->type = IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW; | 595 | ct->type = IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW; |
568 | ct->chip.irq_mask = irq_gc_mask_clr_bit; | 596 | ct->chip.irq_mask = orion_gpio_mask_irq; |
569 | ct->chip.irq_unmask = irq_gc_mask_set_bit; | 597 | ct->chip.irq_unmask = orion_gpio_unmask_irq; |
570 | ct->chip.irq_set_type = gpio_irq_set_type; | 598 | ct->chip.irq_set_type = gpio_irq_set_type; |
571 | ct->chip.name = ochip->chip.label; | 599 | ct->chip.name = ochip->chip.label; |
572 | 600 | ||
@@ -575,8 +603,8 @@ void __init orion_gpio_init(struct device_node *np, | |||
575 | ct->regs.ack = GPIO_EDGE_CAUSE_OFF; | 603 | ct->regs.ack = GPIO_EDGE_CAUSE_OFF; |
576 | ct->type = IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING; | 604 | ct->type = IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING; |
577 | ct->chip.irq_ack = irq_gc_ack_clr_bit; | 605 | ct->chip.irq_ack = irq_gc_ack_clr_bit; |
578 | ct->chip.irq_mask = irq_gc_mask_clr_bit; | 606 | ct->chip.irq_mask = orion_gpio_mask_irq; |
579 | ct->chip.irq_unmask = irq_gc_mask_set_bit; | 607 | ct->chip.irq_unmask = orion_gpio_unmask_irq; |
580 | ct->chip.irq_set_type = gpio_irq_set_type; | 608 | ct->chip.irq_set_type = gpio_irq_set_type; |
581 | ct->handler = handle_edge_irq; | 609 | ct->handler = handle_edge_irq; |
582 | ct->chip.name = ochip->chip.label; | 610 | ct->chip.name = ochip->chip.label; |
diff --git a/arch/arm64/boot/dts/apm-storm.dtsi b/arch/arm64/boot/dts/apm-storm.dtsi index 295c72d52a1f..f1ad9c2ab2e9 100644 --- a/arch/arm64/boot/dts/apm-storm.dtsi +++ b/arch/arm64/boot/dts/apm-storm.dtsi | |||
@@ -599,7 +599,7 @@ | |||
599 | compatible = "apm,xgene-enet"; | 599 | compatible = "apm,xgene-enet"; |
600 | status = "disabled"; | 600 | status = "disabled"; |
601 | reg = <0x0 0x17020000 0x0 0xd100>, | 601 | reg = <0x0 0x17020000 0x0 0xd100>, |
602 | <0x0 0X17030000 0x0 0X400>, | 602 | <0x0 0X17030000 0x0 0Xc300>, |
603 | <0x0 0X10000000 0x0 0X200>; | 603 | <0x0 0X10000000 0x0 0X200>; |
604 | reg-names = "enet_csr", "ring_csr", "ring_cmd"; | 604 | reg-names = "enet_csr", "ring_csr", "ring_cmd"; |
605 | interrupts = <0x0 0x3c 0x4>; | 605 | interrupts = <0x0 0x3c 0x4>; |
@@ -624,9 +624,9 @@ | |||
624 | sgenet0: ethernet@1f210000 { | 624 | sgenet0: ethernet@1f210000 { |
625 | compatible = "apm,xgene-enet"; | 625 | compatible = "apm,xgene-enet"; |
626 | status = "disabled"; | 626 | status = "disabled"; |
627 | reg = <0x0 0x1f210000 0x0 0x10000>, | 627 | reg = <0x0 0x1f210000 0x0 0xd100>, |
628 | <0x0 0x1f200000 0x0 0X10000>, | 628 | <0x0 0x1f200000 0x0 0Xc300>, |
629 | <0x0 0x1B000000 0x0 0X20000>; | 629 | <0x0 0x1B000000 0x0 0X200>; |
630 | reg-names = "enet_csr", "ring_csr", "ring_cmd"; | 630 | reg-names = "enet_csr", "ring_csr", "ring_cmd"; |
631 | interrupts = <0x0 0xA0 0x4>; | 631 | interrupts = <0x0 0xA0 0x4>; |
632 | dma-coherent; | 632 | dma-coherent; |
@@ -639,7 +639,7 @@ | |||
639 | compatible = "apm,xgene-enet"; | 639 | compatible = "apm,xgene-enet"; |
640 | status = "disabled"; | 640 | status = "disabled"; |
641 | reg = <0x0 0x1f610000 0x0 0xd100>, | 641 | reg = <0x0 0x1f610000 0x0 0xd100>, |
642 | <0x0 0x1f600000 0x0 0X400>, | 642 | <0x0 0x1f600000 0x0 0Xc300>, |
643 | <0x0 0x18000000 0x0 0X200>; | 643 | <0x0 0x18000000 0x0 0X200>; |
644 | reg-names = "enet_csr", "ring_csr", "ring_cmd"; | 644 | reg-names = "enet_csr", "ring_csr", "ring_cmd"; |
645 | interrupts = <0x0 0x60 0x4>; | 645 | interrupts = <0x0 0x60 0x4>; |
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig index 4ce602c2c6de..dd301be89ecc 100644 --- a/arch/arm64/configs/defconfig +++ b/arch/arm64/configs/defconfig | |||
@@ -35,6 +35,9 @@ CONFIG_MODULE_UNLOAD=y | |||
35 | CONFIG_ARCH_THUNDER=y | 35 | CONFIG_ARCH_THUNDER=y |
36 | CONFIG_ARCH_VEXPRESS=y | 36 | CONFIG_ARCH_VEXPRESS=y |
37 | CONFIG_ARCH_XGENE=y | 37 | CONFIG_ARCH_XGENE=y |
38 | CONFIG_PCI=y | ||
39 | CONFIG_PCI_MSI=y | ||
40 | CONFIG_PCI_XGENE=y | ||
38 | CONFIG_SMP=y | 41 | CONFIG_SMP=y |
39 | CONFIG_PREEMPT=y | 42 | CONFIG_PREEMPT=y |
40 | CONFIG_KSM=y | 43 | CONFIG_KSM=y |
@@ -52,6 +55,7 @@ CONFIG_IP_PNP_DHCP=y | |||
52 | CONFIG_IP_PNP_BOOTP=y | 55 | CONFIG_IP_PNP_BOOTP=y |
53 | # CONFIG_INET_LRO is not set | 56 | # CONFIG_INET_LRO is not set |
54 | # CONFIG_IPV6 is not set | 57 | # CONFIG_IPV6 is not set |
58 | CONFIG_BPF_JIT=y | ||
55 | # CONFIG_WIRELESS is not set | 59 | # CONFIG_WIRELESS is not set |
56 | CONFIG_NET_9P=y | 60 | CONFIG_NET_9P=y |
57 | CONFIG_NET_9P_VIRTIO=y | 61 | CONFIG_NET_9P_VIRTIO=y |
@@ -65,16 +69,17 @@ CONFIG_VIRTIO_BLK=y | |||
65 | CONFIG_BLK_DEV_SD=y | 69 | CONFIG_BLK_DEV_SD=y |
66 | # CONFIG_SCSI_LOWLEVEL is not set | 70 | # CONFIG_SCSI_LOWLEVEL is not set |
67 | CONFIG_ATA=y | 71 | CONFIG_ATA=y |
72 | CONFIG_SATA_AHCI=y | ||
73 | CONFIG_SATA_AHCI_PLATFORM=y | ||
68 | CONFIG_AHCI_XGENE=y | 74 | CONFIG_AHCI_XGENE=y |
69 | CONFIG_PHY_XGENE=y | ||
70 | CONFIG_PATA_PLATFORM=y | 75 | CONFIG_PATA_PLATFORM=y |
71 | CONFIG_PATA_OF_PLATFORM=y | 76 | CONFIG_PATA_OF_PLATFORM=y |
72 | CONFIG_NETDEVICES=y | 77 | CONFIG_NETDEVICES=y |
73 | CONFIG_TUN=y | 78 | CONFIG_TUN=y |
74 | CONFIG_VIRTIO_NET=y | 79 | CONFIG_VIRTIO_NET=y |
80 | CONFIG_NET_XGENE=y | ||
75 | CONFIG_SMC91X=y | 81 | CONFIG_SMC91X=y |
76 | CONFIG_SMSC911X=y | 82 | CONFIG_SMSC911X=y |
77 | CONFIG_NET_XGENE=y | ||
78 | # CONFIG_WLAN is not set | 83 | # CONFIG_WLAN is not set |
79 | CONFIG_INPUT_EVDEV=y | 84 | CONFIG_INPUT_EVDEV=y |
80 | # CONFIG_SERIO_SERPORT is not set | 85 | # CONFIG_SERIO_SERPORT is not set |
@@ -87,6 +92,11 @@ CONFIG_SERIAL_AMBA_PL011_CONSOLE=y | |||
87 | CONFIG_SERIAL_OF_PLATFORM=y | 92 | CONFIG_SERIAL_OF_PLATFORM=y |
88 | CONFIG_VIRTIO_CONSOLE=y | 93 | CONFIG_VIRTIO_CONSOLE=y |
89 | # CONFIG_HW_RANDOM is not set | 94 | # CONFIG_HW_RANDOM is not set |
95 | # CONFIG_HMC_DRV is not set | ||
96 | CONFIG_SPI=y | ||
97 | CONFIG_SPI_PL022=y | ||
98 | CONFIG_GPIO_PL061=y | ||
99 | CONFIG_GPIO_XGENE=y | ||
90 | # CONFIG_HWMON is not set | 100 | # CONFIG_HWMON is not set |
91 | CONFIG_REGULATOR=y | 101 | CONFIG_REGULATOR=y |
92 | CONFIG_REGULATOR_FIXED_VOLTAGE=y | 102 | CONFIG_REGULATOR_FIXED_VOLTAGE=y |
@@ -97,13 +107,25 @@ CONFIG_LOGO=y | |||
97 | # CONFIG_LOGO_LINUX_MONO is not set | 107 | # CONFIG_LOGO_LINUX_MONO is not set |
98 | # CONFIG_LOGO_LINUX_VGA16 is not set | 108 | # CONFIG_LOGO_LINUX_VGA16 is not set |
99 | CONFIG_USB=y | 109 | CONFIG_USB=y |
110 | CONFIG_USB_EHCI_HCD=y | ||
111 | CONFIG_USB_EHCI_HCD_PLATFORM=y | ||
100 | CONFIG_USB_ISP1760_HCD=y | 112 | CONFIG_USB_ISP1760_HCD=y |
113 | CONFIG_USB_OHCI_HCD=y | ||
114 | CONFIG_USB_OHCI_HCD_PLATFORM=y | ||
101 | CONFIG_USB_STORAGE=y | 115 | CONFIG_USB_STORAGE=y |
116 | CONFIG_USB_ULPI=y | ||
102 | CONFIG_MMC=y | 117 | CONFIG_MMC=y |
103 | CONFIG_MMC_ARMMMCI=y | 118 | CONFIG_MMC_ARMMMCI=y |
119 | CONFIG_MMC_SDHCI=y | ||
120 | CONFIG_MMC_SDHCI_PLTFM=y | ||
121 | CONFIG_MMC_SPI=y | ||
122 | CONFIG_RTC_CLASS=y | ||
123 | CONFIG_RTC_DRV_EFI=y | ||
124 | CONFIG_RTC_DRV_XGENE=y | ||
104 | CONFIG_VIRTIO_BALLOON=y | 125 | CONFIG_VIRTIO_BALLOON=y |
105 | CONFIG_VIRTIO_MMIO=y | 126 | CONFIG_VIRTIO_MMIO=y |
106 | # CONFIG_IOMMU_SUPPORT is not set | 127 | # CONFIG_IOMMU_SUPPORT is not set |
128 | CONFIG_PHY_XGENE=y | ||
107 | CONFIG_EXT2_FS=y | 129 | CONFIG_EXT2_FS=y |
108 | CONFIG_EXT3_FS=y | 130 | CONFIG_EXT3_FS=y |
109 | # CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set | 131 | # CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set |
diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h index ccc7087d3c4e..a62cd077457b 100644 --- a/arch/arm64/include/asm/memory.h +++ b/arch/arm64/include/asm/memory.h | |||
@@ -142,7 +142,7 @@ static inline void *phys_to_virt(phys_addr_t x) | |||
142 | * virt_to_page(k) convert a _valid_ virtual address to struct page * | 142 | * virt_to_page(k) convert a _valid_ virtual address to struct page * |
143 | * virt_addr_valid(k) indicates whether a virtual address is valid | 143 | * virt_addr_valid(k) indicates whether a virtual address is valid |
144 | */ | 144 | */ |
145 | #define ARCH_PFN_OFFSET PHYS_PFN_OFFSET | 145 | #define ARCH_PFN_OFFSET ((unsigned long)PHYS_PFN_OFFSET) |
146 | 146 | ||
147 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) | 147 | #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) |
148 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) | 148 | #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) |
diff --git a/arch/arm64/include/asm/unistd32.h b/arch/arm64/include/asm/unistd32.h index da1f06b535e3..9dfdac4a74a1 100644 --- a/arch/arm64/include/asm/unistd32.h +++ b/arch/arm64/include/asm/unistd32.h | |||
@@ -792,3 +792,5 @@ __SYSCALL(__NR_renameat2, sys_renameat2) | |||
792 | __SYSCALL(__NR_getrandom, sys_getrandom) | 792 | __SYSCALL(__NR_getrandom, sys_getrandom) |
793 | #define __NR_memfd_create 385 | 793 | #define __NR_memfd_create 385 |
794 | __SYSCALL(__NR_memfd_create, sys_memfd_create) | 794 | __SYSCALL(__NR_memfd_create, sys_memfd_create) |
795 | #define __NR_bpf 386 | ||
796 | __SYSCALL(__NR_bpf, sys_bpf) | ||
diff --git a/arch/arm64/kernel/efi-entry.S b/arch/arm64/kernel/efi-entry.S index 619b1dd7bcde..d18a44940968 100644 --- a/arch/arm64/kernel/efi-entry.S +++ b/arch/arm64/kernel/efi-entry.S | |||
@@ -54,18 +54,17 @@ ENTRY(efi_stub_entry) | |||
54 | b.eq efi_load_fail | 54 | b.eq efi_load_fail |
55 | 55 | ||
56 | /* | 56 | /* |
57 | * efi_entry() will have relocated the kernel image if necessary | 57 | * efi_entry() will have copied the kernel image if necessary and we |
58 | * and we return here with device tree address in x0 and the kernel | 58 | * return here with device tree address in x0 and the kernel entry |
59 | * entry point stored at *image_addr. Save those values in registers | 59 | * point stored at *image_addr. Save those values in registers which |
60 | * which are callee preserved. | 60 | * are callee preserved. |
61 | */ | 61 | */ |
62 | mov x20, x0 // DTB address | 62 | mov x20, x0 // DTB address |
63 | ldr x0, [sp, #16] // relocated _text address | 63 | ldr x0, [sp, #16] // relocated _text address |
64 | mov x21, x0 | 64 | mov x21, x0 |
65 | 65 | ||
66 | /* | 66 | /* |
67 | * Flush dcache covering current runtime addresses | 67 | * Calculate size of the kernel Image (same for original and copy). |
68 | * of kernel text/data. Then flush all of icache. | ||
69 | */ | 68 | */ |
70 | adrp x1, _text | 69 | adrp x1, _text |
71 | add x1, x1, #:lo12:_text | 70 | add x1, x1, #:lo12:_text |
@@ -73,9 +72,24 @@ ENTRY(efi_stub_entry) | |||
73 | add x2, x2, #:lo12:_edata | 72 | add x2, x2, #:lo12:_edata |
74 | sub x1, x2, x1 | 73 | sub x1, x2, x1 |
75 | 74 | ||
75 | /* | ||
76 | * Flush the copied Image to the PoC, and ensure it is not shadowed by | ||
77 | * stale icache entries from before relocation. | ||
78 | */ | ||
76 | bl __flush_dcache_area | 79 | bl __flush_dcache_area |
77 | ic ialluis | 80 | ic ialluis |
78 | 81 | ||
82 | /* | ||
83 | * Ensure that the rest of this function (in the original Image) is | ||
84 | * visible when the caches are disabled. The I-cache can't have stale | ||
85 | * entries for the VA range of the current image, so no maintenance is | ||
86 | * necessary. | ||
87 | */ | ||
88 | adr x0, efi_stub_entry | ||
89 | adr x1, efi_stub_entry_end | ||
90 | sub x1, x1, x0 | ||
91 | bl __flush_dcache_area | ||
92 | |||
79 | /* Turn off Dcache and MMU */ | 93 | /* Turn off Dcache and MMU */ |
80 | mrs x0, CurrentEL | 94 | mrs x0, CurrentEL |
81 | cmp x0, #CurrentEL_EL2 | 95 | cmp x0, #CurrentEL_EL2 |
@@ -105,4 +119,5 @@ efi_load_fail: | |||
105 | ldp x29, x30, [sp], #32 | 119 | ldp x29, x30, [sp], #32 |
106 | ret | 120 | ret |
107 | 121 | ||
122 | efi_stub_entry_end: | ||
108 | ENDPROC(efi_stub_entry) | 123 | ENDPROC(efi_stub_entry) |
diff --git a/arch/arm64/kernel/insn.c b/arch/arm64/kernel/insn.c index e007714ded04..8cd27fedc8b6 100644 --- a/arch/arm64/kernel/insn.c +++ b/arch/arm64/kernel/insn.c | |||
@@ -163,9 +163,10 @@ static int __kprobes aarch64_insn_patch_text_cb(void *arg) | |||
163 | * which ends with "dsb; isb" pair guaranteeing global | 163 | * which ends with "dsb; isb" pair guaranteeing global |
164 | * visibility. | 164 | * visibility. |
165 | */ | 165 | */ |
166 | atomic_set(&pp->cpu_count, -1); | 166 | /* Notify other processors with an additional increment. */ |
167 | atomic_inc(&pp->cpu_count); | ||
167 | } else { | 168 | } else { |
168 | while (atomic_read(&pp->cpu_count) != -1) | 169 | while (atomic_read(&pp->cpu_count) <= num_online_cpus()) |
169 | cpu_relax(); | 170 | cpu_relax(); |
170 | isb(); | 171 | isb(); |
171 | } | 172 | } |
diff --git a/arch/arm64/kernel/psci.c b/arch/arm64/kernel/psci.c index 866c1c821860..663da771580a 100644 --- a/arch/arm64/kernel/psci.c +++ b/arch/arm64/kernel/psci.c | |||
@@ -528,7 +528,7 @@ static int __maybe_unused cpu_psci_cpu_suspend(unsigned long index) | |||
528 | if (WARN_ON_ONCE(!index)) | 528 | if (WARN_ON_ONCE(!index)) |
529 | return -EINVAL; | 529 | return -EINVAL; |
530 | 530 | ||
531 | if (state->type == PSCI_POWER_STATE_TYPE_STANDBY) | 531 | if (state[index - 1].type == PSCI_POWER_STATE_TYPE_STANDBY) |
532 | ret = psci_ops.cpu_suspend(state[index - 1], 0); | 532 | ret = psci_ops.cpu_suspend(state[index - 1], 0); |
533 | else | 533 | else |
534 | ret = __cpu_suspend(index, psci_suspend_finisher); | 534 | ret = __cpu_suspend(index, psci_suspend_finisher); |
diff --git a/arch/arm64/lib/clear_user.S b/arch/arm64/lib/clear_user.S index 6e0ed93d51fe..c17967fdf5f6 100644 --- a/arch/arm64/lib/clear_user.S +++ b/arch/arm64/lib/clear_user.S | |||
@@ -46,7 +46,7 @@ USER(9f, strh wzr, [x0], #2 ) | |||
46 | sub x1, x1, #2 | 46 | sub x1, x1, #2 |
47 | 4: adds x1, x1, #1 | 47 | 4: adds x1, x1, #1 |
48 | b.mi 5f | 48 | b.mi 5f |
49 | strb wzr, [x0] | 49 | USER(9f, strb wzr, [x0] ) |
50 | 5: mov x0, #0 | 50 | 5: mov x0, #0 |
51 | ret | 51 | ret |
52 | ENDPROC(__clear_user) | 52 | ENDPROC(__clear_user) |
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index 0bf90d26e745..f4f8b500f74c 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c | |||
@@ -202,7 +202,7 @@ static void __init alloc_init_pmd(pud_t *pud, unsigned long addr, | |||
202 | } | 202 | } |
203 | 203 | ||
204 | static void __init alloc_init_pud(pgd_t *pgd, unsigned long addr, | 204 | static void __init alloc_init_pud(pgd_t *pgd, unsigned long addr, |
205 | unsigned long end, unsigned long phys, | 205 | unsigned long end, phys_addr_t phys, |
206 | int map_io) | 206 | int map_io) |
207 | { | 207 | { |
208 | pud_t *pud; | 208 | pud_t *pud; |
diff --git a/arch/m68k/include/asm/unistd.h b/arch/m68k/include/asm/unistd.h index 4ef7a54813e6..75e75d7b1702 100644 --- a/arch/m68k/include/asm/unistd.h +++ b/arch/m68k/include/asm/unistd.h | |||
@@ -4,7 +4,7 @@ | |||
4 | #include <uapi/asm/unistd.h> | 4 | #include <uapi/asm/unistd.h> |
5 | 5 | ||
6 | 6 | ||
7 | #define NR_syscalls 354 | 7 | #define NR_syscalls 355 |
8 | 8 | ||
9 | #define __ARCH_WANT_OLD_READDIR | 9 | #define __ARCH_WANT_OLD_READDIR |
10 | #define __ARCH_WANT_OLD_STAT | 10 | #define __ARCH_WANT_OLD_STAT |
diff --git a/arch/m68k/include/uapi/asm/unistd.h b/arch/m68k/include/uapi/asm/unistd.h index b419c6b7ac37..2c1bec9a14b6 100644 --- a/arch/m68k/include/uapi/asm/unistd.h +++ b/arch/m68k/include/uapi/asm/unistd.h | |||
@@ -359,5 +359,6 @@ | |||
359 | #define __NR_renameat2 351 | 359 | #define __NR_renameat2 351 |
360 | #define __NR_getrandom 352 | 360 | #define __NR_getrandom 352 |
361 | #define __NR_memfd_create 353 | 361 | #define __NR_memfd_create 353 |
362 | #define __NR_bpf 354 | ||
362 | 363 | ||
363 | #endif /* _UAPI_ASM_M68K_UNISTD_H_ */ | 364 | #endif /* _UAPI_ASM_M68K_UNISTD_H_ */ |
diff --git a/arch/m68k/kernel/syscalltable.S b/arch/m68k/kernel/syscalltable.S index 05b46c2b08b8..2ca219e184cd 100644 --- a/arch/m68k/kernel/syscalltable.S +++ b/arch/m68k/kernel/syscalltable.S | |||
@@ -374,4 +374,5 @@ ENTRY(sys_call_table) | |||
374 | .long sys_renameat2 | 374 | .long sys_renameat2 |
375 | .long sys_getrandom | 375 | .long sys_getrandom |
376 | .long sys_memfd_create | 376 | .long sys_memfd_create |
377 | .long sys_bpf | ||
377 | 378 | ||
diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig index 6feded3b0c4c..a7736fa0580c 100644 --- a/arch/microblaze/Kconfig +++ b/arch/microblaze/Kconfig | |||
@@ -129,6 +129,10 @@ endmenu | |||
129 | 129 | ||
130 | menu "Kernel features" | 130 | menu "Kernel features" |
131 | 131 | ||
132 | config NR_CPUS | ||
133 | int | ||
134 | default "1" | ||
135 | |||
132 | config ADVANCED_OPTIONS | 136 | config ADVANCED_OPTIONS |
133 | bool "Prompt for advanced kernel configuration options" | 137 | bool "Prompt for advanced kernel configuration options" |
134 | help | 138 | help |
diff --git a/arch/microblaze/include/asm/unistd.h b/arch/microblaze/include/asm/unistd.h index ea4b233647c1..0a53362d5548 100644 --- a/arch/microblaze/include/asm/unistd.h +++ b/arch/microblaze/include/asm/unistd.h | |||
@@ -38,6 +38,6 @@ | |||
38 | 38 | ||
39 | #endif /* __ASSEMBLY__ */ | 39 | #endif /* __ASSEMBLY__ */ |
40 | 40 | ||
41 | #define __NR_syscalls 387 | 41 | #define __NR_syscalls 388 |
42 | 42 | ||
43 | #endif /* _ASM_MICROBLAZE_UNISTD_H */ | 43 | #endif /* _ASM_MICROBLAZE_UNISTD_H */ |
diff --git a/arch/microblaze/include/uapi/asm/unistd.h b/arch/microblaze/include/uapi/asm/unistd.h index 1c2380bf8fe6..c712677f8a2a 100644 --- a/arch/microblaze/include/uapi/asm/unistd.h +++ b/arch/microblaze/include/uapi/asm/unistd.h | |||
@@ -402,5 +402,6 @@ | |||
402 | #define __NR_seccomp 384 | 402 | #define __NR_seccomp 384 |
403 | #define __NR_getrandom 385 | 403 | #define __NR_getrandom 385 |
404 | #define __NR_memfd_create 386 | 404 | #define __NR_memfd_create 386 |
405 | #define __NR_bpf 387 | ||
405 | 406 | ||
406 | #endif /* _UAPI_ASM_MICROBLAZE_UNISTD_H */ | 407 | #endif /* _UAPI_ASM_MICROBLAZE_UNISTD_H */ |
diff --git a/arch/microblaze/kernel/syscall_table.S b/arch/microblaze/kernel/syscall_table.S index de59ee1d7010..0166e890486c 100644 --- a/arch/microblaze/kernel/syscall_table.S +++ b/arch/microblaze/kernel/syscall_table.S | |||
@@ -387,3 +387,4 @@ ENTRY(sys_call_table) | |||
387 | .long sys_seccomp | 387 | .long sys_seccomp |
388 | .long sys_getrandom /* 385 */ | 388 | .long sys_getrandom /* 385 */ |
389 | .long sys_memfd_create | 389 | .long sys_memfd_create |
390 | .long sys_bpf | ||
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c index 9037914f6985..b30e41c0c033 100644 --- a/arch/microblaze/pci/pci-common.c +++ b/arch/microblaze/pci/pci-common.c | |||
@@ -660,8 +660,13 @@ void pci_process_bridge_OF_ranges(struct pci_controller *hose, | |||
660 | res = &hose->mem_resources[memno++]; | 660 | res = &hose->mem_resources[memno++]; |
661 | break; | 661 | break; |
662 | } | 662 | } |
663 | if (res != NULL) | 663 | if (res != NULL) { |
664 | of_pci_range_to_resource(&range, dev, res); | 664 | res->name = dev->full_name; |
665 | res->flags = range.flags; | ||
666 | res->start = range.cpu_addr; | ||
667 | res->end = range.cpu_addr + range.size - 1; | ||
668 | res->parent = res->child = res->sibling = NULL; | ||
669 | } | ||
665 | } | 670 | } |
666 | 671 | ||
667 | /* If there's an ISA hole and the pci_mem_offset is -not- matching | 672 | /* If there's an ISA hole and the pci_mem_offset is -not- matching |
diff --git a/arch/mips/Makefile b/arch/mips/Makefile index 23cb94806fbc..58076472bdd8 100644 --- a/arch/mips/Makefile +++ b/arch/mips/Makefile | |||
@@ -93,6 +93,15 @@ LDFLAGS_vmlinux += -G 0 -static -n -nostdlib | |||
93 | KBUILD_AFLAGS_MODULE += -mlong-calls | 93 | KBUILD_AFLAGS_MODULE += -mlong-calls |
94 | KBUILD_CFLAGS_MODULE += -mlong-calls | 94 | KBUILD_CFLAGS_MODULE += -mlong-calls |
95 | 95 | ||
96 | # | ||
97 | # pass -msoft-float to GAS if it supports it. However on newer binutils | ||
98 | # (specifically newer than 2.24.51.20140728) we then also need to explicitly | ||
99 | # set ".set hardfloat" in all files which manipulate floating point registers. | ||
100 | # | ||
101 | ifneq ($(call as-option,-Wa$(comma)-msoft-float,),) | ||
102 | cflags-y += -DGAS_HAS_SET_HARDFLOAT -Wa,-msoft-float | ||
103 | endif | ||
104 | |||
96 | cflags-y += -ffreestanding | 105 | cflags-y += -ffreestanding |
97 | 106 | ||
98 | # | 107 | # |
diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c index 741734049675..2bc4aa95944e 100644 --- a/arch/mips/cavium-octeon/octeon-irq.c +++ b/arch/mips/cavium-octeon/octeon-irq.c | |||
@@ -809,6 +809,7 @@ static struct irq_chip octeon_irq_chip_ciu_gpio_v2 = { | |||
809 | .irq_set_type = octeon_irq_ciu_gpio_set_type, | 809 | .irq_set_type = octeon_irq_ciu_gpio_set_type, |
810 | #ifdef CONFIG_SMP | 810 | #ifdef CONFIG_SMP |
811 | .irq_set_affinity = octeon_irq_ciu_set_affinity_v2, | 811 | .irq_set_affinity = octeon_irq_ciu_set_affinity_v2, |
812 | .irq_cpu_offline = octeon_irq_cpu_offline_ciu, | ||
812 | #endif | 813 | #endif |
813 | .flags = IRQCHIP_SET_TYPE_MASKED, | 814 | .flags = IRQCHIP_SET_TYPE_MASKED, |
814 | }; | 815 | }; |
@@ -823,6 +824,7 @@ static struct irq_chip octeon_irq_chip_ciu_gpio = { | |||
823 | .irq_set_type = octeon_irq_ciu_gpio_set_type, | 824 | .irq_set_type = octeon_irq_ciu_gpio_set_type, |
824 | #ifdef CONFIG_SMP | 825 | #ifdef CONFIG_SMP |
825 | .irq_set_affinity = octeon_irq_ciu_set_affinity, | 826 | .irq_set_affinity = octeon_irq_ciu_set_affinity, |
827 | .irq_cpu_offline = octeon_irq_cpu_offline_ciu, | ||
826 | #endif | 828 | #endif |
827 | .flags = IRQCHIP_SET_TYPE_MASKED, | 829 | .flags = IRQCHIP_SET_TYPE_MASKED, |
828 | }; | 830 | }; |
diff --git a/arch/mips/include/asm/asmmacro-32.h b/arch/mips/include/asm/asmmacro-32.h index e38c2811d4e2..cdac7b3eeaf7 100644 --- a/arch/mips/include/asm/asmmacro-32.h +++ b/arch/mips/include/asm/asmmacro-32.h | |||
@@ -13,6 +13,8 @@ | |||
13 | #include <asm/mipsregs.h> | 13 | #include <asm/mipsregs.h> |
14 | 14 | ||
15 | .macro fpu_save_single thread tmp=t0 | 15 | .macro fpu_save_single thread tmp=t0 |
16 | .set push | ||
17 | SET_HARDFLOAT | ||
16 | cfc1 \tmp, fcr31 | 18 | cfc1 \tmp, fcr31 |
17 | swc1 $f0, THREAD_FPR0_LS64(\thread) | 19 | swc1 $f0, THREAD_FPR0_LS64(\thread) |
18 | swc1 $f1, THREAD_FPR1_LS64(\thread) | 20 | swc1 $f1, THREAD_FPR1_LS64(\thread) |
@@ -47,9 +49,12 @@ | |||
47 | swc1 $f30, THREAD_FPR30_LS64(\thread) | 49 | swc1 $f30, THREAD_FPR30_LS64(\thread) |
48 | swc1 $f31, THREAD_FPR31_LS64(\thread) | 50 | swc1 $f31, THREAD_FPR31_LS64(\thread) |
49 | sw \tmp, THREAD_FCR31(\thread) | 51 | sw \tmp, THREAD_FCR31(\thread) |
52 | .set pop | ||
50 | .endm | 53 | .endm |
51 | 54 | ||
52 | .macro fpu_restore_single thread tmp=t0 | 55 | .macro fpu_restore_single thread tmp=t0 |
56 | .set push | ||
57 | SET_HARDFLOAT | ||
53 | lw \tmp, THREAD_FCR31(\thread) | 58 | lw \tmp, THREAD_FCR31(\thread) |
54 | lwc1 $f0, THREAD_FPR0_LS64(\thread) | 59 | lwc1 $f0, THREAD_FPR0_LS64(\thread) |
55 | lwc1 $f1, THREAD_FPR1_LS64(\thread) | 60 | lwc1 $f1, THREAD_FPR1_LS64(\thread) |
@@ -84,6 +89,7 @@ | |||
84 | lwc1 $f30, THREAD_FPR30_LS64(\thread) | 89 | lwc1 $f30, THREAD_FPR30_LS64(\thread) |
85 | lwc1 $f31, THREAD_FPR31_LS64(\thread) | 90 | lwc1 $f31, THREAD_FPR31_LS64(\thread) |
86 | ctc1 \tmp, fcr31 | 91 | ctc1 \tmp, fcr31 |
92 | .set pop | ||
87 | .endm | 93 | .endm |
88 | 94 | ||
89 | .macro cpu_save_nonscratch thread | 95 | .macro cpu_save_nonscratch thread |
diff --git a/arch/mips/include/asm/asmmacro.h b/arch/mips/include/asm/asmmacro.h index cd9a98bc8f60..6caf8766b80f 100644 --- a/arch/mips/include/asm/asmmacro.h +++ b/arch/mips/include/asm/asmmacro.h | |||
@@ -57,6 +57,8 @@ | |||
57 | #endif /* CONFIG_CPU_MIPSR2 */ | 57 | #endif /* CONFIG_CPU_MIPSR2 */ |
58 | 58 | ||
59 | .macro fpu_save_16even thread tmp=t0 | 59 | .macro fpu_save_16even thread tmp=t0 |
60 | .set push | ||
61 | SET_HARDFLOAT | ||
60 | cfc1 \tmp, fcr31 | 62 | cfc1 \tmp, fcr31 |
61 | sdc1 $f0, THREAD_FPR0_LS64(\thread) | 63 | sdc1 $f0, THREAD_FPR0_LS64(\thread) |
62 | sdc1 $f2, THREAD_FPR2_LS64(\thread) | 64 | sdc1 $f2, THREAD_FPR2_LS64(\thread) |
@@ -75,11 +77,13 @@ | |||
75 | sdc1 $f28, THREAD_FPR28_LS64(\thread) | 77 | sdc1 $f28, THREAD_FPR28_LS64(\thread) |
76 | sdc1 $f30, THREAD_FPR30_LS64(\thread) | 78 | sdc1 $f30, THREAD_FPR30_LS64(\thread) |
77 | sw \tmp, THREAD_FCR31(\thread) | 79 | sw \tmp, THREAD_FCR31(\thread) |
80 | .set pop | ||
78 | .endm | 81 | .endm |
79 | 82 | ||
80 | .macro fpu_save_16odd thread | 83 | .macro fpu_save_16odd thread |
81 | .set push | 84 | .set push |
82 | .set mips64r2 | 85 | .set mips64r2 |
86 | SET_HARDFLOAT | ||
83 | sdc1 $f1, THREAD_FPR1_LS64(\thread) | 87 | sdc1 $f1, THREAD_FPR1_LS64(\thread) |
84 | sdc1 $f3, THREAD_FPR3_LS64(\thread) | 88 | sdc1 $f3, THREAD_FPR3_LS64(\thread) |
85 | sdc1 $f5, THREAD_FPR5_LS64(\thread) | 89 | sdc1 $f5, THREAD_FPR5_LS64(\thread) |
@@ -110,6 +114,8 @@ | |||
110 | .endm | 114 | .endm |
111 | 115 | ||
112 | .macro fpu_restore_16even thread tmp=t0 | 116 | .macro fpu_restore_16even thread tmp=t0 |
117 | .set push | ||
118 | SET_HARDFLOAT | ||
113 | lw \tmp, THREAD_FCR31(\thread) | 119 | lw \tmp, THREAD_FCR31(\thread) |
114 | ldc1 $f0, THREAD_FPR0_LS64(\thread) | 120 | ldc1 $f0, THREAD_FPR0_LS64(\thread) |
115 | ldc1 $f2, THREAD_FPR2_LS64(\thread) | 121 | ldc1 $f2, THREAD_FPR2_LS64(\thread) |
@@ -133,6 +139,7 @@ | |||
133 | .macro fpu_restore_16odd thread | 139 | .macro fpu_restore_16odd thread |
134 | .set push | 140 | .set push |
135 | .set mips64r2 | 141 | .set mips64r2 |
142 | SET_HARDFLOAT | ||
136 | ldc1 $f1, THREAD_FPR1_LS64(\thread) | 143 | ldc1 $f1, THREAD_FPR1_LS64(\thread) |
137 | ldc1 $f3, THREAD_FPR3_LS64(\thread) | 144 | ldc1 $f3, THREAD_FPR3_LS64(\thread) |
138 | ldc1 $f5, THREAD_FPR5_LS64(\thread) | 145 | ldc1 $f5, THREAD_FPR5_LS64(\thread) |
@@ -277,6 +284,7 @@ | |||
277 | .macro cfcmsa rd, cs | 284 | .macro cfcmsa rd, cs |
278 | .set push | 285 | .set push |
279 | .set noat | 286 | .set noat |
287 | SET_HARDFLOAT | ||
280 | .insn | 288 | .insn |
281 | .word CFC_MSA_INSN | (\cs << 11) | 289 | .word CFC_MSA_INSN | (\cs << 11) |
282 | move \rd, $1 | 290 | move \rd, $1 |
@@ -286,6 +294,7 @@ | |||
286 | .macro ctcmsa cd, rs | 294 | .macro ctcmsa cd, rs |
287 | .set push | 295 | .set push |
288 | .set noat | 296 | .set noat |
297 | SET_HARDFLOAT | ||
289 | move $1, \rs | 298 | move $1, \rs |
290 | .word CTC_MSA_INSN | (\cd << 6) | 299 | .word CTC_MSA_INSN | (\cd << 6) |
291 | .set pop | 300 | .set pop |
@@ -294,6 +303,7 @@ | |||
294 | .macro ld_d wd, off, base | 303 | .macro ld_d wd, off, base |
295 | .set push | 304 | .set push |
296 | .set noat | 305 | .set noat |
306 | SET_HARDFLOAT | ||
297 | add $1, \base, \off | 307 | add $1, \base, \off |
298 | .word LDD_MSA_INSN | (\wd << 6) | 308 | .word LDD_MSA_INSN | (\wd << 6) |
299 | .set pop | 309 | .set pop |
@@ -302,6 +312,7 @@ | |||
302 | .macro st_d wd, off, base | 312 | .macro st_d wd, off, base |
303 | .set push | 313 | .set push |
304 | .set noat | 314 | .set noat |
315 | SET_HARDFLOAT | ||
305 | add $1, \base, \off | 316 | add $1, \base, \off |
306 | .word STD_MSA_INSN | (\wd << 6) | 317 | .word STD_MSA_INSN | (\wd << 6) |
307 | .set pop | 318 | .set pop |
@@ -310,6 +321,7 @@ | |||
310 | .macro copy_u_w rd, ws, n | 321 | .macro copy_u_w rd, ws, n |
311 | .set push | 322 | .set push |
312 | .set noat | 323 | .set noat |
324 | SET_HARDFLOAT | ||
313 | .insn | 325 | .insn |
314 | .word COPY_UW_MSA_INSN | (\n << 16) | (\ws << 11) | 326 | .word COPY_UW_MSA_INSN | (\n << 16) | (\ws << 11) |
315 | /* move triggers an assembler bug... */ | 327 | /* move triggers an assembler bug... */ |
@@ -320,6 +332,7 @@ | |||
320 | .macro copy_u_d rd, ws, n | 332 | .macro copy_u_d rd, ws, n |
321 | .set push | 333 | .set push |
322 | .set noat | 334 | .set noat |
335 | SET_HARDFLOAT | ||
323 | .insn | 336 | .insn |
324 | .word COPY_UD_MSA_INSN | (\n << 16) | (\ws << 11) | 337 | .word COPY_UD_MSA_INSN | (\n << 16) | (\ws << 11) |
325 | /* move triggers an assembler bug... */ | 338 | /* move triggers an assembler bug... */ |
@@ -330,6 +343,7 @@ | |||
330 | .macro insert_w wd, n, rs | 343 | .macro insert_w wd, n, rs |
331 | .set push | 344 | .set push |
332 | .set noat | 345 | .set noat |
346 | SET_HARDFLOAT | ||
333 | /* move triggers an assembler bug... */ | 347 | /* move triggers an assembler bug... */ |
334 | or $1, \rs, zero | 348 | or $1, \rs, zero |
335 | .word INSERT_W_MSA_INSN | (\n << 16) | (\wd << 6) | 349 | .word INSERT_W_MSA_INSN | (\n << 16) | (\wd << 6) |
@@ -339,6 +353,7 @@ | |||
339 | .macro insert_d wd, n, rs | 353 | .macro insert_d wd, n, rs |
340 | .set push | 354 | .set push |
341 | .set noat | 355 | .set noat |
356 | SET_HARDFLOAT | ||
342 | /* move triggers an assembler bug... */ | 357 | /* move triggers an assembler bug... */ |
343 | or $1, \rs, zero | 358 | or $1, \rs, zero |
344 | .word INSERT_D_MSA_INSN | (\n << 16) | (\wd << 6) | 359 | .word INSERT_D_MSA_INSN | (\n << 16) | (\wd << 6) |
@@ -381,6 +396,7 @@ | |||
381 | st_d 31, THREAD_FPR31, \thread | 396 | st_d 31, THREAD_FPR31, \thread |
382 | .set push | 397 | .set push |
383 | .set noat | 398 | .set noat |
399 | SET_HARDFLOAT | ||
384 | cfcmsa $1, MSA_CSR | 400 | cfcmsa $1, MSA_CSR |
385 | sw $1, THREAD_MSA_CSR(\thread) | 401 | sw $1, THREAD_MSA_CSR(\thread) |
386 | .set pop | 402 | .set pop |
@@ -389,6 +405,7 @@ | |||
389 | .macro msa_restore_all thread | 405 | .macro msa_restore_all thread |
390 | .set push | 406 | .set push |
391 | .set noat | 407 | .set noat |
408 | SET_HARDFLOAT | ||
392 | lw $1, THREAD_MSA_CSR(\thread) | 409 | lw $1, THREAD_MSA_CSR(\thread) |
393 | ctcmsa MSA_CSR, $1 | 410 | ctcmsa MSA_CSR, $1 |
394 | .set pop | 411 | .set pop |
@@ -441,6 +458,7 @@ | |||
441 | .macro msa_init_all_upper | 458 | .macro msa_init_all_upper |
442 | .set push | 459 | .set push |
443 | .set noat | 460 | .set noat |
461 | SET_HARDFLOAT | ||
444 | not $1, zero | 462 | not $1, zero |
445 | msa_init_upper 0 | 463 | msa_init_upper 0 |
446 | .set pop | 464 | .set pop |
diff --git a/arch/mips/include/asm/fpregdef.h b/arch/mips/include/asm/fpregdef.h index 429481f9028d..f184ba088532 100644 --- a/arch/mips/include/asm/fpregdef.h +++ b/arch/mips/include/asm/fpregdef.h | |||
@@ -14,6 +14,20 @@ | |||
14 | 14 | ||
15 | #include <asm/sgidefs.h> | 15 | #include <asm/sgidefs.h> |
16 | 16 | ||
17 | /* | ||
18 | * starting with binutils 2.24.51.20140729, MIPS binutils warn about mixing | ||
19 | * hardfloat and softfloat object files. The kernel build uses soft-float by | ||
20 | * default, so we also need to pass -msoft-float along to GAS if it supports it. | ||
21 | * But this in turn causes assembler errors in files which access hardfloat | ||
22 | * registers. We detect if GAS supports "-msoft-float" in the Makefile and | ||
23 | * explicitly put ".set hardfloat" where floating point registers are touched. | ||
24 | */ | ||
25 | #ifdef GAS_HAS_SET_HARDFLOAT | ||
26 | #define SET_HARDFLOAT .set hardfloat | ||
27 | #else | ||
28 | #define SET_HARDFLOAT | ||
29 | #endif | ||
30 | |||
17 | #if _MIPS_SIM == _MIPS_SIM_ABI32 | 31 | #if _MIPS_SIM == _MIPS_SIM_ABI32 |
18 | 32 | ||
19 | /* | 33 | /* |
diff --git a/arch/mips/include/asm/fpu.h b/arch/mips/include/asm/fpu.h index 4d0aeda68397..dd562414cd5e 100644 --- a/arch/mips/include/asm/fpu.h +++ b/arch/mips/include/asm/fpu.h | |||
@@ -145,8 +145,8 @@ static inline void lose_fpu(int save) | |||
145 | if (is_msa_enabled()) { | 145 | if (is_msa_enabled()) { |
146 | if (save) { | 146 | if (save) { |
147 | save_msa(current); | 147 | save_msa(current); |
148 | asm volatile("cfc1 %0, $31" | 148 | current->thread.fpu.fcr31 = |
149 | : "=r"(current->thread.fpu.fcr31)); | 149 | read_32bit_cp1_register(CP1_STATUS); |
150 | } | 150 | } |
151 | disable_msa(); | 151 | disable_msa(); |
152 | clear_thread_flag(TIF_USEDMSA); | 152 | clear_thread_flag(TIF_USEDMSA); |
diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h index cf3b580c3df6..b46cd220a018 100644 --- a/arch/mips/include/asm/mipsregs.h +++ b/arch/mips/include/asm/mipsregs.h | |||
@@ -1324,7 +1324,7 @@ do { \ | |||
1324 | /* | 1324 | /* |
1325 | * Macros to access the floating point coprocessor control registers | 1325 | * Macros to access the floating point coprocessor control registers |
1326 | */ | 1326 | */ |
1327 | #define read_32bit_cp1_register(source) \ | 1327 | #define _read_32bit_cp1_register(source, gas_hardfloat) \ |
1328 | ({ \ | 1328 | ({ \ |
1329 | int __res; \ | 1329 | int __res; \ |
1330 | \ | 1330 | \ |
@@ -1334,12 +1334,21 @@ do { \ | |||
1334 | " # gas fails to assemble cfc1 for some archs, \n" \ | 1334 | " # gas fails to assemble cfc1 for some archs, \n" \ |
1335 | " # like Octeon. \n" \ | 1335 | " # like Octeon. \n" \ |
1336 | " .set mips1 \n" \ | 1336 | " .set mips1 \n" \ |
1337 | " "STR(gas_hardfloat)" \n" \ | ||
1337 | " cfc1 %0,"STR(source)" \n" \ | 1338 | " cfc1 %0,"STR(source)" \n" \ |
1338 | " .set pop \n" \ | 1339 | " .set pop \n" \ |
1339 | : "=r" (__res)); \ | 1340 | : "=r" (__res)); \ |
1340 | __res; \ | 1341 | __res; \ |
1341 | }) | 1342 | }) |
1342 | 1343 | ||
1344 | #ifdef GAS_HAS_SET_HARDFLOAT | ||
1345 | #define read_32bit_cp1_register(source) \ | ||
1346 | _read_32bit_cp1_register(source, .set hardfloat) | ||
1347 | #else | ||
1348 | #define read_32bit_cp1_register(source) \ | ||
1349 | _read_32bit_cp1_register(source, ) | ||
1350 | #endif | ||
1351 | |||
1343 | #ifdef HAVE_AS_DSP | 1352 | #ifdef HAVE_AS_DSP |
1344 | #define rddsp(mask) \ | 1353 | #define rddsp(mask) \ |
1345 | ({ \ | 1354 | ({ \ |
diff --git a/arch/mips/include/uapi/asm/unistd.h b/arch/mips/include/uapi/asm/unistd.h index fdb4923777d1..9dc58568f230 100644 --- a/arch/mips/include/uapi/asm/unistd.h +++ b/arch/mips/include/uapi/asm/unistd.h | |||
@@ -375,16 +375,17 @@ | |||
375 | #define __NR_seccomp (__NR_Linux + 352) | 375 | #define __NR_seccomp (__NR_Linux + 352) |
376 | #define __NR_getrandom (__NR_Linux + 353) | 376 | #define __NR_getrandom (__NR_Linux + 353) |
377 | #define __NR_memfd_create (__NR_Linux + 354) | 377 | #define __NR_memfd_create (__NR_Linux + 354) |
378 | #define __NR_bpf (__NR_Linux + 355) | ||
378 | 379 | ||
379 | /* | 380 | /* |
380 | * Offset of the last Linux o32 flavoured syscall | 381 | * Offset of the last Linux o32 flavoured syscall |
381 | */ | 382 | */ |
382 | #define __NR_Linux_syscalls 354 | 383 | #define __NR_Linux_syscalls 355 |
383 | 384 | ||
384 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ | 385 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ |
385 | 386 | ||
386 | #define __NR_O32_Linux 4000 | 387 | #define __NR_O32_Linux 4000 |
387 | #define __NR_O32_Linux_syscalls 354 | 388 | #define __NR_O32_Linux_syscalls 355 |
388 | 389 | ||
389 | #if _MIPS_SIM == _MIPS_SIM_ABI64 | 390 | #if _MIPS_SIM == _MIPS_SIM_ABI64 |
390 | 391 | ||
@@ -707,16 +708,17 @@ | |||
707 | #define __NR_seccomp (__NR_Linux + 312) | 708 | #define __NR_seccomp (__NR_Linux + 312) |
708 | #define __NR_getrandom (__NR_Linux + 313) | 709 | #define __NR_getrandom (__NR_Linux + 313) |
709 | #define __NR_memfd_create (__NR_Linux + 314) | 710 | #define __NR_memfd_create (__NR_Linux + 314) |
711 | #define __NR_bpf (__NR_Linux + 315) | ||
710 | 712 | ||
711 | /* | 713 | /* |
712 | * Offset of the last Linux 64-bit flavoured syscall | 714 | * Offset of the last Linux 64-bit flavoured syscall |
713 | */ | 715 | */ |
714 | #define __NR_Linux_syscalls 314 | 716 | #define __NR_Linux_syscalls 315 |
715 | 717 | ||
716 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ | 718 | #endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ |
717 | 719 | ||
718 | #define __NR_64_Linux 5000 | 720 | #define __NR_64_Linux 5000 |
719 | #define __NR_64_Linux_syscalls 314 | 721 | #define __NR_64_Linux_syscalls 315 |
720 | 722 | ||
721 | #if _MIPS_SIM == _MIPS_SIM_NABI32 | 723 | #if _MIPS_SIM == _MIPS_SIM_NABI32 |
722 | 724 | ||
@@ -1043,15 +1045,16 @@ | |||
1043 | #define __NR_seccomp (__NR_Linux + 316) | 1045 | #define __NR_seccomp (__NR_Linux + 316) |
1044 | #define __NR_getrandom (__NR_Linux + 317) | 1046 | #define __NR_getrandom (__NR_Linux + 317) |
1045 | #define __NR_memfd_create (__NR_Linux + 318) | 1047 | #define __NR_memfd_create (__NR_Linux + 318) |
1048 | #define __NR_memfd_create (__NR_Linux + 319) | ||
1046 | 1049 | ||
1047 | /* | 1050 | /* |
1048 | * Offset of the last N32 flavoured syscall | 1051 | * Offset of the last N32 flavoured syscall |
1049 | */ | 1052 | */ |
1050 | #define __NR_Linux_syscalls 318 | 1053 | #define __NR_Linux_syscalls 319 |
1051 | 1054 | ||
1052 | #endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ | 1055 | #endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ |
1053 | 1056 | ||
1054 | #define __NR_N32_Linux 6000 | 1057 | #define __NR_N32_Linux 6000 |
1055 | #define __NR_N32_Linux_syscalls 318 | 1058 | #define __NR_N32_Linux_syscalls 319 |
1056 | 1059 | ||
1057 | #endif /* _UAPI_ASM_UNISTD_H */ | 1060 | #endif /* _UAPI_ASM_UNISTD_H */ |
diff --git a/arch/mips/kernel/branch.c b/arch/mips/kernel/branch.c index 7b2df224f041..4d7d99d601cc 100644 --- a/arch/mips/kernel/branch.c +++ b/arch/mips/kernel/branch.c | |||
@@ -144,7 +144,7 @@ int __mm_isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn, | |||
144 | case mm_bc1t_op: | 144 | case mm_bc1t_op: |
145 | preempt_disable(); | 145 | preempt_disable(); |
146 | if (is_fpu_owner()) | 146 | if (is_fpu_owner()) |
147 | asm volatile("cfc1\t%0,$31" : "=r" (fcr31)); | 147 | fcr31 = read_32bit_cp1_register(CP1_STATUS); |
148 | else | 148 | else |
149 | fcr31 = current->thread.fpu.fcr31; | 149 | fcr31 = current->thread.fpu.fcr31; |
150 | preempt_enable(); | 150 | preempt_enable(); |
@@ -562,11 +562,7 @@ int __compute_return_epc_for_insn(struct pt_regs *regs, | |||
562 | case cop1_op: | 562 | case cop1_op: |
563 | preempt_disable(); | 563 | preempt_disable(); |
564 | if (is_fpu_owner()) | 564 | if (is_fpu_owner()) |
565 | asm volatile( | 565 | fcr31 = read_32bit_cp1_register(CP1_STATUS); |
566 | ".set push\n" | ||
567 | "\t.set mips1\n" | ||
568 | "\tcfc1\t%0,$31\n" | ||
569 | "\t.set pop" : "=r" (fcr31)); | ||
570 | else | 566 | else |
571 | fcr31 = current->thread.fpu.fcr31; | 567 | fcr31 = current->thread.fpu.fcr31; |
572 | preempt_enable(); | 568 | preempt_enable(); |
diff --git a/arch/mips/kernel/genex.S b/arch/mips/kernel/genex.S index ac35e12cb1f3..a5e26dd90592 100644 --- a/arch/mips/kernel/genex.S +++ b/arch/mips/kernel/genex.S | |||
@@ -358,6 +358,7 @@ NESTED(nmi_handler, PT_SIZE, sp) | |||
358 | .set push | 358 | .set push |
359 | /* gas fails to assemble cfc1 for some archs (octeon).*/ \ | 359 | /* gas fails to assemble cfc1 for some archs (octeon).*/ \ |
360 | .set mips1 | 360 | .set mips1 |
361 | SET_HARDFLOAT | ||
361 | cfc1 a1, fcr31 | 362 | cfc1 a1, fcr31 |
362 | li a2, ~(0x3f << 12) | 363 | li a2, ~(0x3f << 12) |
363 | and a2, a1 | 364 | and a2, a1 |
diff --git a/arch/mips/kernel/r2300_fpu.S b/arch/mips/kernel/r2300_fpu.S index f31063dbdaeb..5ce3b746cedc 100644 --- a/arch/mips/kernel/r2300_fpu.S +++ b/arch/mips/kernel/r2300_fpu.S | |||
@@ -28,6 +28,8 @@ | |||
28 | .set mips1 | 28 | .set mips1 |
29 | /* Save floating point context */ | 29 | /* Save floating point context */ |
30 | LEAF(_save_fp_context) | 30 | LEAF(_save_fp_context) |
31 | .set push | ||
32 | SET_HARDFLOAT | ||
31 | li v0, 0 # assume success | 33 | li v0, 0 # assume success |
32 | cfc1 t1,fcr31 | 34 | cfc1 t1,fcr31 |
33 | EX(swc1 $f0,(SC_FPREGS+0)(a0)) | 35 | EX(swc1 $f0,(SC_FPREGS+0)(a0)) |
@@ -65,6 +67,7 @@ LEAF(_save_fp_context) | |||
65 | EX(sw t1,(SC_FPC_CSR)(a0)) | 67 | EX(sw t1,(SC_FPC_CSR)(a0)) |
66 | cfc1 t0,$0 # implementation/version | 68 | cfc1 t0,$0 # implementation/version |
67 | jr ra | 69 | jr ra |
70 | .set pop | ||
68 | .set nomacro | 71 | .set nomacro |
69 | EX(sw t0,(SC_FPC_EIR)(a0)) | 72 | EX(sw t0,(SC_FPC_EIR)(a0)) |
70 | .set macro | 73 | .set macro |
@@ -80,6 +83,8 @@ LEAF(_save_fp_context) | |||
80 | * stack frame which might have been changed by the user. | 83 | * stack frame which might have been changed by the user. |
81 | */ | 84 | */ |
82 | LEAF(_restore_fp_context) | 85 | LEAF(_restore_fp_context) |
86 | .set push | ||
87 | SET_HARDFLOAT | ||
83 | li v0, 0 # assume success | 88 | li v0, 0 # assume success |
84 | EX(lw t0,(SC_FPC_CSR)(a0)) | 89 | EX(lw t0,(SC_FPC_CSR)(a0)) |
85 | EX(lwc1 $f0,(SC_FPREGS+0)(a0)) | 90 | EX(lwc1 $f0,(SC_FPREGS+0)(a0)) |
@@ -116,6 +121,7 @@ LEAF(_restore_fp_context) | |||
116 | EX(lwc1 $f31,(SC_FPREGS+248)(a0)) | 121 | EX(lwc1 $f31,(SC_FPREGS+248)(a0)) |
117 | jr ra | 122 | jr ra |
118 | ctc1 t0,fcr31 | 123 | ctc1 t0,fcr31 |
124 | .set pop | ||
119 | END(_restore_fp_context) | 125 | END(_restore_fp_context) |
120 | .set reorder | 126 | .set reorder |
121 | 127 | ||
diff --git a/arch/mips/kernel/r2300_switch.S b/arch/mips/kernel/r2300_switch.S index 20b7b040e76f..435ea652f5fa 100644 --- a/arch/mips/kernel/r2300_switch.S +++ b/arch/mips/kernel/r2300_switch.S | |||
@@ -120,6 +120,9 @@ LEAF(_restore_fp) | |||
120 | 120 | ||
121 | #define FPU_DEFAULT 0x00000000 | 121 | #define FPU_DEFAULT 0x00000000 |
122 | 122 | ||
123 | .set push | ||
124 | SET_HARDFLOAT | ||
125 | |||
123 | LEAF(_init_fpu) | 126 | LEAF(_init_fpu) |
124 | mfc0 t0, CP0_STATUS | 127 | mfc0 t0, CP0_STATUS |
125 | li t1, ST0_CU1 | 128 | li t1, ST0_CU1 |
@@ -165,3 +168,5 @@ LEAF(_init_fpu) | |||
165 | mtc1 t0, $f31 | 168 | mtc1 t0, $f31 |
166 | jr ra | 169 | jr ra |
167 | END(_init_fpu) | 170 | END(_init_fpu) |
171 | |||
172 | .set pop | ||
diff --git a/arch/mips/kernel/r4k_fpu.S b/arch/mips/kernel/r4k_fpu.S index 8352523568e6..6c160c67984c 100644 --- a/arch/mips/kernel/r4k_fpu.S +++ b/arch/mips/kernel/r4k_fpu.S | |||
@@ -19,8 +19,12 @@ | |||
19 | #include <asm/asm-offsets.h> | 19 | #include <asm/asm-offsets.h> |
20 | #include <asm/regdef.h> | 20 | #include <asm/regdef.h> |
21 | 21 | ||
22 | /* preprocessor replaces the fp in ".set fp=64" with $30 otherwise */ | ||
23 | #undef fp | ||
24 | |||
22 | .macro EX insn, reg, src | 25 | .macro EX insn, reg, src |
23 | .set push | 26 | .set push |
27 | SET_HARDFLOAT | ||
24 | .set nomacro | 28 | .set nomacro |
25 | .ex\@: \insn \reg, \src | 29 | .ex\@: \insn \reg, \src |
26 | .set pop | 30 | .set pop |
@@ -33,12 +37,17 @@ | |||
33 | .set arch=r4000 | 37 | .set arch=r4000 |
34 | 38 | ||
35 | LEAF(_save_fp_context) | 39 | LEAF(_save_fp_context) |
40 | .set push | ||
41 | SET_HARDFLOAT | ||
36 | cfc1 t1, fcr31 | 42 | cfc1 t1, fcr31 |
43 | .set pop | ||
37 | 44 | ||
38 | #if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPS32_R2) | 45 | #if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPS32_R2) |
39 | .set push | 46 | .set push |
47 | SET_HARDFLOAT | ||
40 | #ifdef CONFIG_CPU_MIPS32_R2 | 48 | #ifdef CONFIG_CPU_MIPS32_R2 |
41 | .set mips64r2 | 49 | .set mips32r2 |
50 | .set fp=64 | ||
42 | mfc0 t0, CP0_STATUS | 51 | mfc0 t0, CP0_STATUS |
43 | sll t0, t0, 5 | 52 | sll t0, t0, 5 |
44 | bgez t0, 1f # skip storing odd if FR=0 | 53 | bgez t0, 1f # skip storing odd if FR=0 |
@@ -64,6 +73,8 @@ LEAF(_save_fp_context) | |||
64 | 1: .set pop | 73 | 1: .set pop |
65 | #endif | 74 | #endif |
66 | 75 | ||
76 | .set push | ||
77 | SET_HARDFLOAT | ||
67 | /* Store the 16 even double precision registers */ | 78 | /* Store the 16 even double precision registers */ |
68 | EX sdc1 $f0, SC_FPREGS+0(a0) | 79 | EX sdc1 $f0, SC_FPREGS+0(a0) |
69 | EX sdc1 $f2, SC_FPREGS+16(a0) | 80 | EX sdc1 $f2, SC_FPREGS+16(a0) |
@@ -84,11 +95,14 @@ LEAF(_save_fp_context) | |||
84 | EX sw t1, SC_FPC_CSR(a0) | 95 | EX sw t1, SC_FPC_CSR(a0) |
85 | jr ra | 96 | jr ra |
86 | li v0, 0 # success | 97 | li v0, 0 # success |
98 | .set pop | ||
87 | END(_save_fp_context) | 99 | END(_save_fp_context) |
88 | 100 | ||
89 | #ifdef CONFIG_MIPS32_COMPAT | 101 | #ifdef CONFIG_MIPS32_COMPAT |
90 | /* Save 32-bit process floating point context */ | 102 | /* Save 32-bit process floating point context */ |
91 | LEAF(_save_fp_context32) | 103 | LEAF(_save_fp_context32) |
104 | .set push | ||
105 | SET_HARDFLOAT | ||
92 | cfc1 t1, fcr31 | 106 | cfc1 t1, fcr31 |
93 | 107 | ||
94 | mfc0 t0, CP0_STATUS | 108 | mfc0 t0, CP0_STATUS |
@@ -134,6 +148,7 @@ LEAF(_save_fp_context32) | |||
134 | EX sw t1, SC32_FPC_CSR(a0) | 148 | EX sw t1, SC32_FPC_CSR(a0) |
135 | cfc1 t0, $0 # implementation/version | 149 | cfc1 t0, $0 # implementation/version |
136 | EX sw t0, SC32_FPC_EIR(a0) | 150 | EX sw t0, SC32_FPC_EIR(a0) |
151 | .set pop | ||
137 | 152 | ||
138 | jr ra | 153 | jr ra |
139 | li v0, 0 # success | 154 | li v0, 0 # success |
@@ -150,8 +165,10 @@ LEAF(_restore_fp_context) | |||
150 | 165 | ||
151 | #if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPS32_R2) | 166 | #if defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPS32_R2) |
152 | .set push | 167 | .set push |
168 | SET_HARDFLOAT | ||
153 | #ifdef CONFIG_CPU_MIPS32_R2 | 169 | #ifdef CONFIG_CPU_MIPS32_R2 |
154 | .set mips64r2 | 170 | .set mips32r2 |
171 | .set fp=64 | ||
155 | mfc0 t0, CP0_STATUS | 172 | mfc0 t0, CP0_STATUS |
156 | sll t0, t0, 5 | 173 | sll t0, t0, 5 |
157 | bgez t0, 1f # skip loading odd if FR=0 | 174 | bgez t0, 1f # skip loading odd if FR=0 |
@@ -175,6 +192,8 @@ LEAF(_restore_fp_context) | |||
175 | EX ldc1 $f31, SC_FPREGS+248(a0) | 192 | EX ldc1 $f31, SC_FPREGS+248(a0) |
176 | 1: .set pop | 193 | 1: .set pop |
177 | #endif | 194 | #endif |
195 | .set push | ||
196 | SET_HARDFLOAT | ||
178 | EX ldc1 $f0, SC_FPREGS+0(a0) | 197 | EX ldc1 $f0, SC_FPREGS+0(a0) |
179 | EX ldc1 $f2, SC_FPREGS+16(a0) | 198 | EX ldc1 $f2, SC_FPREGS+16(a0) |
180 | EX ldc1 $f4, SC_FPREGS+32(a0) | 199 | EX ldc1 $f4, SC_FPREGS+32(a0) |
@@ -192,6 +211,7 @@ LEAF(_restore_fp_context) | |||
192 | EX ldc1 $f28, SC_FPREGS+224(a0) | 211 | EX ldc1 $f28, SC_FPREGS+224(a0) |
193 | EX ldc1 $f30, SC_FPREGS+240(a0) | 212 | EX ldc1 $f30, SC_FPREGS+240(a0) |
194 | ctc1 t1, fcr31 | 213 | ctc1 t1, fcr31 |
214 | .set pop | ||
195 | jr ra | 215 | jr ra |
196 | li v0, 0 # success | 216 | li v0, 0 # success |
197 | END(_restore_fp_context) | 217 | END(_restore_fp_context) |
@@ -199,6 +219,8 @@ LEAF(_restore_fp_context) | |||
199 | #ifdef CONFIG_MIPS32_COMPAT | 219 | #ifdef CONFIG_MIPS32_COMPAT |
200 | LEAF(_restore_fp_context32) | 220 | LEAF(_restore_fp_context32) |
201 | /* Restore an o32 sigcontext. */ | 221 | /* Restore an o32 sigcontext. */ |
222 | .set push | ||
223 | SET_HARDFLOAT | ||
202 | EX lw t1, SC32_FPC_CSR(a0) | 224 | EX lw t1, SC32_FPC_CSR(a0) |
203 | 225 | ||
204 | mfc0 t0, CP0_STATUS | 226 | mfc0 t0, CP0_STATUS |
@@ -242,6 +264,7 @@ LEAF(_restore_fp_context32) | |||
242 | ctc1 t1, fcr31 | 264 | ctc1 t1, fcr31 |
243 | jr ra | 265 | jr ra |
244 | li v0, 0 # success | 266 | li v0, 0 # success |
267 | .set pop | ||
245 | END(_restore_fp_context32) | 268 | END(_restore_fp_context32) |
246 | #endif | 269 | #endif |
247 | 270 | ||
diff --git a/arch/mips/kernel/r4k_switch.S b/arch/mips/kernel/r4k_switch.S index 4c4ec1812420..64591e671878 100644 --- a/arch/mips/kernel/r4k_switch.S +++ b/arch/mips/kernel/r4k_switch.S | |||
@@ -22,6 +22,9 @@ | |||
22 | 22 | ||
23 | #include <asm/asmmacro.h> | 23 | #include <asm/asmmacro.h> |
24 | 24 | ||
25 | /* preprocessor replaces the fp in ".set fp=64" with $30 otherwise */ | ||
26 | #undef fp | ||
27 | |||
25 | /* | 28 | /* |
26 | * Offset to the current process status flags, the first 32 bytes of the | 29 | * Offset to the current process status flags, the first 32 bytes of the |
27 | * stack are not used. | 30 | * stack are not used. |
@@ -65,8 +68,12 @@ | |||
65 | bgtz a3, 1f | 68 | bgtz a3, 1f |
66 | 69 | ||
67 | /* Save 128b MSA vector context + scalar FP control & status. */ | 70 | /* Save 128b MSA vector context + scalar FP control & status. */ |
71 | .set push | ||
72 | SET_HARDFLOAT | ||
68 | cfc1 t1, fcr31 | 73 | cfc1 t1, fcr31 |
69 | msa_save_all a0 | 74 | msa_save_all a0 |
75 | .set pop /* SET_HARDFLOAT */ | ||
76 | |||
70 | sw t1, THREAD_FCR31(a0) | 77 | sw t1, THREAD_FCR31(a0) |
71 | b 2f | 78 | b 2f |
72 | 79 | ||
@@ -161,6 +168,9 @@ LEAF(_init_msa_upper) | |||
161 | 168 | ||
162 | #define FPU_DEFAULT 0x00000000 | 169 | #define FPU_DEFAULT 0x00000000 |
163 | 170 | ||
171 | .set push | ||
172 | SET_HARDFLOAT | ||
173 | |||
164 | LEAF(_init_fpu) | 174 | LEAF(_init_fpu) |
165 | mfc0 t0, CP0_STATUS | 175 | mfc0 t0, CP0_STATUS |
166 | li t1, ST0_CU1 | 176 | li t1, ST0_CU1 |
@@ -232,7 +242,8 @@ LEAF(_init_fpu) | |||
232 | 242 | ||
233 | #ifdef CONFIG_CPU_MIPS32_R2 | 243 | #ifdef CONFIG_CPU_MIPS32_R2 |
234 | .set push | 244 | .set push |
235 | .set mips64r2 | 245 | .set mips32r2 |
246 | .set fp=64 | ||
236 | sll t0, t0, 5 # is Status.FR set? | 247 | sll t0, t0, 5 # is Status.FR set? |
237 | bgez t0, 1f # no: skip setting upper 32b | 248 | bgez t0, 1f # no: skip setting upper 32b |
238 | 249 | ||
@@ -291,3 +302,5 @@ LEAF(_init_fpu) | |||
291 | #endif | 302 | #endif |
292 | jr ra | 303 | jr ra |
293 | END(_init_fpu) | 304 | END(_init_fpu) |
305 | |||
306 | .set pop /* SET_HARDFLOAT */ | ||
diff --git a/arch/mips/kernel/r6000_fpu.S b/arch/mips/kernel/r6000_fpu.S index da0fbe46d83b..47077380c15c 100644 --- a/arch/mips/kernel/r6000_fpu.S +++ b/arch/mips/kernel/r6000_fpu.S | |||
@@ -18,6 +18,9 @@ | |||
18 | 18 | ||
19 | .set noreorder | 19 | .set noreorder |
20 | .set mips2 | 20 | .set mips2 |
21 | .set push | ||
22 | SET_HARDFLOAT | ||
23 | |||
21 | /* Save floating point context */ | 24 | /* Save floating point context */ |
22 | LEAF(_save_fp_context) | 25 | LEAF(_save_fp_context) |
23 | mfc0 t0,CP0_STATUS | 26 | mfc0 t0,CP0_STATUS |
@@ -85,3 +88,5 @@ | |||
85 | 1: jr ra | 88 | 1: jr ra |
86 | nop | 89 | nop |
87 | END(_restore_fp_context) | 90 | END(_restore_fp_context) |
91 | |||
92 | .set pop /* SET_HARDFLOAT */ | ||
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S index 744cd10ba599..00cad1005a16 100644 --- a/arch/mips/kernel/scall32-o32.S +++ b/arch/mips/kernel/scall32-o32.S | |||
@@ -579,3 +579,4 @@ EXPORT(sys_call_table) | |||
579 | PTR sys_seccomp | 579 | PTR sys_seccomp |
580 | PTR sys_getrandom | 580 | PTR sys_getrandom |
581 | PTR sys_memfd_create | 581 | PTR sys_memfd_create |
582 | PTR sys_bpf /* 4355 */ | ||
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S index 002b1bc09c38..5251565e344b 100644 --- a/arch/mips/kernel/scall64-64.S +++ b/arch/mips/kernel/scall64-64.S | |||
@@ -434,4 +434,5 @@ EXPORT(sys_call_table) | |||
434 | PTR sys_seccomp | 434 | PTR sys_seccomp |
435 | PTR sys_getrandom | 435 | PTR sys_getrandom |
436 | PTR sys_memfd_create | 436 | PTR sys_memfd_create |
437 | PTR sys_bpf /* 5315 */ | ||
437 | .size sys_call_table,.-sys_call_table | 438 | .size sys_call_table,.-sys_call_table |
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S index ca6cbbe9805b..77e74398b828 100644 --- a/arch/mips/kernel/scall64-n32.S +++ b/arch/mips/kernel/scall64-n32.S | |||
@@ -427,4 +427,5 @@ EXPORT(sysn32_call_table) | |||
427 | PTR sys_seccomp | 427 | PTR sys_seccomp |
428 | PTR sys_getrandom | 428 | PTR sys_getrandom |
429 | PTR sys_memfd_create | 429 | PTR sys_memfd_create |
430 | PTR sys_bpf | ||
430 | .size sysn32_call_table,.-sysn32_call_table | 431 | .size sysn32_call_table,.-sysn32_call_table |
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S index 9e10d11fbb84..6f8db9f728e8 100644 --- a/arch/mips/kernel/scall64-o32.S +++ b/arch/mips/kernel/scall64-o32.S | |||
@@ -564,4 +564,5 @@ EXPORT(sys32_call_table) | |||
564 | PTR sys_seccomp | 564 | PTR sys_seccomp |
565 | PTR sys_getrandom | 565 | PTR sys_getrandom |
566 | PTR sys_memfd_create | 566 | PTR sys_memfd_create |
567 | PTR sys_bpf /* 4355 */ | ||
567 | .size sys32_call_table,.-sys32_call_table | 568 | .size sys32_call_table,.-sys32_call_table |
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index b3b8f0d9d4a7..d21ec57b6e95 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c | |||
@@ -683,7 +683,8 @@ static void __init arch_mem_init(char **cmdline_p) | |||
683 | dma_contiguous_reserve(PFN_PHYS(max_low_pfn)); | 683 | dma_contiguous_reserve(PFN_PHYS(max_low_pfn)); |
684 | /* Tell bootmem about cma reserved memblock section */ | 684 | /* Tell bootmem about cma reserved memblock section */ |
685 | for_each_memblock(reserved, reg) | 685 | for_each_memblock(reserved, reg) |
686 | reserve_bootmem(reg->base, reg->size, BOOTMEM_DEFAULT); | 686 | if (reg->size != 0) |
687 | reserve_bootmem(reg->base, reg->size, BOOTMEM_DEFAULT); | ||
687 | } | 688 | } |
688 | 689 | ||
689 | static void __init resource_init(void) | 690 | static void __init resource_init(void) |
diff --git a/arch/mips/lib/r3k_dump_tlb.c b/arch/mips/lib/r3k_dump_tlb.c index 91615c2ef0cf..1ef365ab3cd3 100644 --- a/arch/mips/lib/r3k_dump_tlb.c +++ b/arch/mips/lib/r3k_dump_tlb.c | |||
@@ -34,7 +34,7 @@ static void dump_tlb(int first, int last) | |||
34 | entrylo0 = read_c0_entrylo0(); | 34 | entrylo0 = read_c0_entrylo0(); |
35 | 35 | ||
36 | /* Unused entries have a virtual address of KSEG0. */ | 36 | /* Unused entries have a virtual address of KSEG0. */ |
37 | if ((entryhi & 0xffffe000) != 0x80000000 | 37 | if ((entryhi & 0xfffff000) != 0x80000000 |
38 | && (entryhi & 0xfc0) == asid) { | 38 | && (entryhi & 0xfc0) == asid) { |
39 | /* | 39 | /* |
40 | * Only print entries in use | 40 | * Only print entries in use |
@@ -43,7 +43,7 @@ static void dump_tlb(int first, int last) | |||
43 | 43 | ||
44 | printk("va=%08lx asid=%08lx" | 44 | printk("va=%08lx asid=%08lx" |
45 | " [pa=%06lx n=%d d=%d v=%d g=%d]", | 45 | " [pa=%06lx n=%d d=%d v=%d g=%d]", |
46 | (entryhi & 0xffffe000), | 46 | (entryhi & 0xfffff000), |
47 | entryhi & 0xfc0, | 47 | entryhi & 0xfc0, |
48 | entrylo0 & PAGE_MASK, | 48 | entrylo0 & PAGE_MASK, |
49 | (entrylo0 & (1 << 11)) ? 1 : 0, | 49 | (entrylo0 & (1 << 11)) ? 1 : 0, |
diff --git a/arch/mips/lib/strnlen_user.S b/arch/mips/lib/strnlen_user.S index f3af6995e2a6..7d12c0dded3d 100644 --- a/arch/mips/lib/strnlen_user.S +++ b/arch/mips/lib/strnlen_user.S | |||
@@ -40,9 +40,11 @@ FEXPORT(__strnlen_\func\()_nocheck_asm) | |||
40 | .else | 40 | .else |
41 | EX(lbe, t0, (v0), .Lfault\@) | 41 | EX(lbe, t0, (v0), .Lfault\@) |
42 | .endif | 42 | .endif |
43 | PTR_ADDIU v0, 1 | 43 | .set noreorder |
44 | bnez t0, 1b | 44 | bnez t0, 1b |
45 | 1: PTR_SUBU v0, a0 | 45 | 1: PTR_ADDIU v0, 1 |
46 | .set reorder | ||
47 | PTR_SUBU v0, a0 | ||
46 | jr ra | 48 | jr ra |
47 | END(__strnlen_\func\()_asm) | 49 | END(__strnlen_\func\()_asm) |
48 | 50 | ||
diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c index 51a0fde4bec1..cac529a405b8 100644 --- a/arch/mips/math-emu/cp1emu.c +++ b/arch/mips/math-emu/cp1emu.c | |||
@@ -584,11 +584,7 @@ static int isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn, | |||
584 | if (insn.i_format.rs == bc_op) { | 584 | if (insn.i_format.rs == bc_op) { |
585 | preempt_disable(); | 585 | preempt_disable(); |
586 | if (is_fpu_owner()) | 586 | if (is_fpu_owner()) |
587 | asm volatile( | 587 | fcr31 = read_32bit_cp1_register(CP1_STATUS); |
588 | ".set push\n" | ||
589 | "\t.set mips1\n" | ||
590 | "\tcfc1\t%0,$31\n" | ||
591 | "\t.set pop" : "=r" (fcr31)); | ||
592 | else | 588 | else |
593 | fcr31 = current->thread.fpu.fcr31; | 589 | fcr31 = current->thread.fpu.fcr31; |
594 | preempt_enable(); | 590 | preempt_enable(); |
diff --git a/arch/mips/pci/msi-xlp.c b/arch/mips/pci/msi-xlp.c index fa374fe3746b..f7ac3edda1b2 100644 --- a/arch/mips/pci/msi-xlp.c +++ b/arch/mips/pci/msi-xlp.c | |||
@@ -443,10 +443,8 @@ static int xlp_setup_msix(uint64_t lnkbase, int node, int link, | |||
443 | msg.data = 0xc00 | msixvec; | 443 | msg.data = 0xc00 | msixvec; |
444 | 444 | ||
445 | ret = irq_set_msi_desc(xirq, desc); | 445 | ret = irq_set_msi_desc(xirq, desc); |
446 | if (ret < 0) { | 446 | if (ret < 0) |
447 | destroy_irq(xirq); | ||
448 | return ret; | 447 | return ret; |
449 | } | ||
450 | 448 | ||
451 | write_msi_msg(xirq, &msg); | 449 | write_msi_msg(xirq, &msg); |
452 | return 0; | 450 | return 0; |
diff --git a/arch/parisc/include/asm/uaccess.h b/arch/parisc/include/asm/uaccess.h index 4006964d8e12..a5cb070b54bf 100644 --- a/arch/parisc/include/asm/uaccess.h +++ b/arch/parisc/include/asm/uaccess.h | |||
@@ -9,6 +9,8 @@ | |||
9 | #include <asm/errno.h> | 9 | #include <asm/errno.h> |
10 | #include <asm-generic/uaccess-unaligned.h> | 10 | #include <asm-generic/uaccess-unaligned.h> |
11 | 11 | ||
12 | #include <linux/bug.h> | ||
13 | |||
12 | #define VERIFY_READ 0 | 14 | #define VERIFY_READ 0 |
13 | #define VERIFY_WRITE 1 | 15 | #define VERIFY_WRITE 1 |
14 | 16 | ||
@@ -28,11 +30,6 @@ | |||
28 | * that put_user is the same as __put_user, etc. | 30 | * that put_user is the same as __put_user, etc. |
29 | */ | 31 | */ |
30 | 32 | ||
31 | extern int __get_kernel_bad(void); | ||
32 | extern int __get_user_bad(void); | ||
33 | extern int __put_kernel_bad(void); | ||
34 | extern int __put_user_bad(void); | ||
35 | |||
36 | static inline long access_ok(int type, const void __user * addr, | 33 | static inline long access_ok(int type, const void __user * addr, |
37 | unsigned long size) | 34 | unsigned long size) |
38 | { | 35 | { |
@@ -43,8 +40,8 @@ static inline long access_ok(int type, const void __user * addr, | |||
43 | #define get_user __get_user | 40 | #define get_user __get_user |
44 | 41 | ||
45 | #if !defined(CONFIG_64BIT) | 42 | #if !defined(CONFIG_64BIT) |
46 | #define LDD_KERNEL(ptr) __get_kernel_bad(); | 43 | #define LDD_KERNEL(ptr) BUILD_BUG() |
47 | #define LDD_USER(ptr) __get_user_bad(); | 44 | #define LDD_USER(ptr) BUILD_BUG() |
48 | #define STD_KERNEL(x, ptr) __put_kernel_asm64(x,ptr) | 45 | #define STD_KERNEL(x, ptr) __put_kernel_asm64(x,ptr) |
49 | #define STD_USER(x, ptr) __put_user_asm64(x,ptr) | 46 | #define STD_USER(x, ptr) __put_user_asm64(x,ptr) |
50 | #define ASM_WORD_INSN ".word\t" | 47 | #define ASM_WORD_INSN ".word\t" |
@@ -94,7 +91,7 @@ struct exception_data { | |||
94 | case 2: __get_kernel_asm("ldh",ptr); break; \ | 91 | case 2: __get_kernel_asm("ldh",ptr); break; \ |
95 | case 4: __get_kernel_asm("ldw",ptr); break; \ | 92 | case 4: __get_kernel_asm("ldw",ptr); break; \ |
96 | case 8: LDD_KERNEL(ptr); break; \ | 93 | case 8: LDD_KERNEL(ptr); break; \ |
97 | default: __get_kernel_bad(); break; \ | 94 | default: BUILD_BUG(); break; \ |
98 | } \ | 95 | } \ |
99 | } \ | 96 | } \ |
100 | else { \ | 97 | else { \ |
@@ -103,7 +100,7 @@ struct exception_data { | |||
103 | case 2: __get_user_asm("ldh",ptr); break; \ | 100 | case 2: __get_user_asm("ldh",ptr); break; \ |
104 | case 4: __get_user_asm("ldw",ptr); break; \ | 101 | case 4: __get_user_asm("ldw",ptr); break; \ |
105 | case 8: LDD_USER(ptr); break; \ | 102 | case 8: LDD_USER(ptr); break; \ |
106 | default: __get_user_bad(); break; \ | 103 | default: BUILD_BUG(); break; \ |
107 | } \ | 104 | } \ |
108 | } \ | 105 | } \ |
109 | \ | 106 | \ |
@@ -136,7 +133,7 @@ struct exception_data { | |||
136 | case 2: __put_kernel_asm("sth",__x,ptr); break; \ | 133 | case 2: __put_kernel_asm("sth",__x,ptr); break; \ |
137 | case 4: __put_kernel_asm("stw",__x,ptr); break; \ | 134 | case 4: __put_kernel_asm("stw",__x,ptr); break; \ |
138 | case 8: STD_KERNEL(__x,ptr); break; \ | 135 | case 8: STD_KERNEL(__x,ptr); break; \ |
139 | default: __put_kernel_bad(); break; \ | 136 | default: BUILD_BUG(); break; \ |
140 | } \ | 137 | } \ |
141 | } \ | 138 | } \ |
142 | else { \ | 139 | else { \ |
@@ -145,7 +142,7 @@ struct exception_data { | |||
145 | case 2: __put_user_asm("sth",__x,ptr); break; \ | 142 | case 2: __put_user_asm("sth",__x,ptr); break; \ |
146 | case 4: __put_user_asm("stw",__x,ptr); break; \ | 143 | case 4: __put_user_asm("stw",__x,ptr); break; \ |
147 | case 8: STD_USER(__x,ptr); break; \ | 144 | case 8: STD_USER(__x,ptr); break; \ |
148 | default: __put_user_bad(); break; \ | 145 | default: BUILD_BUG(); break; \ |
149 | } \ | 146 | } \ |
150 | } \ | 147 | } \ |
151 | \ | 148 | \ |
diff --git a/arch/parisc/include/uapi/asm/bitsperlong.h b/arch/parisc/include/uapi/asm/bitsperlong.h index 75196b415d3f..e0a23c7bdd43 100644 --- a/arch/parisc/include/uapi/asm/bitsperlong.h +++ b/arch/parisc/include/uapi/asm/bitsperlong.h | |||
@@ -1,13 +1,7 @@ | |||
1 | #ifndef __ASM_PARISC_BITSPERLONG_H | 1 | #ifndef __ASM_PARISC_BITSPERLONG_H |
2 | #define __ASM_PARISC_BITSPERLONG_H | 2 | #define __ASM_PARISC_BITSPERLONG_H |
3 | 3 | ||
4 | /* | 4 | #if defined(__LP64__) |
5 | * using CONFIG_* outside of __KERNEL__ is wrong, | ||
6 | * __LP64__ was also removed from headers, so what | ||
7 | * is the right approach on parisc? | ||
8 | * -arnd | ||
9 | */ | ||
10 | #if (defined(__KERNEL__) && defined(CONFIG_64BIT)) || defined (__LP64__) | ||
11 | #define __BITS_PER_LONG 64 | 5 | #define __BITS_PER_LONG 64 |
12 | #define SHIFT_PER_LONG 6 | 6 | #define SHIFT_PER_LONG 6 |
13 | #else | 7 | #else |
diff --git a/arch/parisc/include/uapi/asm/msgbuf.h b/arch/parisc/include/uapi/asm/msgbuf.h index fe88f2649418..342138983914 100644 --- a/arch/parisc/include/uapi/asm/msgbuf.h +++ b/arch/parisc/include/uapi/asm/msgbuf.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef _PARISC_MSGBUF_H | 1 | #ifndef _PARISC_MSGBUF_H |
2 | #define _PARISC_MSGBUF_H | 2 | #define _PARISC_MSGBUF_H |
3 | 3 | ||
4 | #include <asm/bitsperlong.h> | ||
5 | |||
4 | /* | 6 | /* |
5 | * The msqid64_ds structure for parisc architecture, copied from sparc. | 7 | * The msqid64_ds structure for parisc architecture, copied from sparc. |
6 | * Note extra padding because this structure is passed back and forth | 8 | * Note extra padding because this structure is passed back and forth |
@@ -13,15 +15,15 @@ | |||
13 | 15 | ||
14 | struct msqid64_ds { | 16 | struct msqid64_ds { |
15 | struct ipc64_perm msg_perm; | 17 | struct ipc64_perm msg_perm; |
16 | #ifndef CONFIG_64BIT | 18 | #if __BITS_PER_LONG != 64 |
17 | unsigned int __pad1; | 19 | unsigned int __pad1; |
18 | #endif | 20 | #endif |
19 | __kernel_time_t msg_stime; /* last msgsnd time */ | 21 | __kernel_time_t msg_stime; /* last msgsnd time */ |
20 | #ifndef CONFIG_64BIT | 22 | #if __BITS_PER_LONG != 64 |
21 | unsigned int __pad2; | 23 | unsigned int __pad2; |
22 | #endif | 24 | #endif |
23 | __kernel_time_t msg_rtime; /* last msgrcv time */ | 25 | __kernel_time_t msg_rtime; /* last msgrcv time */ |
24 | #ifndef CONFIG_64BIT | 26 | #if __BITS_PER_LONG != 64 |
25 | unsigned int __pad3; | 27 | unsigned int __pad3; |
26 | #endif | 28 | #endif |
27 | __kernel_time_t msg_ctime; /* last change time */ | 29 | __kernel_time_t msg_ctime; /* last change time */ |
diff --git a/arch/parisc/include/uapi/asm/sembuf.h b/arch/parisc/include/uapi/asm/sembuf.h index 1e59ffd3bd1e..f01d89e30d73 100644 --- a/arch/parisc/include/uapi/asm/sembuf.h +++ b/arch/parisc/include/uapi/asm/sembuf.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef _PARISC_SEMBUF_H | 1 | #ifndef _PARISC_SEMBUF_H |
2 | #define _PARISC_SEMBUF_H | 2 | #define _PARISC_SEMBUF_H |
3 | 3 | ||
4 | #include <asm/bitsperlong.h> | ||
5 | |||
4 | /* | 6 | /* |
5 | * The semid64_ds structure for parisc architecture. | 7 | * The semid64_ds structure for parisc architecture. |
6 | * Note extra padding because this structure is passed back and forth | 8 | * Note extra padding because this structure is passed back and forth |
@@ -13,11 +15,11 @@ | |||
13 | 15 | ||
14 | struct semid64_ds { | 16 | struct semid64_ds { |
15 | struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ | 17 | struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ |
16 | #ifndef CONFIG_64BIT | 18 | #if __BITS_PER_LONG != 64 |
17 | unsigned int __pad1; | 19 | unsigned int __pad1; |
18 | #endif | 20 | #endif |
19 | __kernel_time_t sem_otime; /* last semop time */ | 21 | __kernel_time_t sem_otime; /* last semop time */ |
20 | #ifndef CONFIG_64BIT | 22 | #if __BITS_PER_LONG != 64 |
21 | unsigned int __pad2; | 23 | unsigned int __pad2; |
22 | #endif | 24 | #endif |
23 | __kernel_time_t sem_ctime; /* last change time */ | 25 | __kernel_time_t sem_ctime; /* last change time */ |
diff --git a/arch/parisc/include/uapi/asm/shmbuf.h b/arch/parisc/include/uapi/asm/shmbuf.h index 0a3eada1863b..8496c38560c6 100644 --- a/arch/parisc/include/uapi/asm/shmbuf.h +++ b/arch/parisc/include/uapi/asm/shmbuf.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef _PARISC_SHMBUF_H | 1 | #ifndef _PARISC_SHMBUF_H |
2 | #define _PARISC_SHMBUF_H | 2 | #define _PARISC_SHMBUF_H |
3 | 3 | ||
4 | #include <asm/bitsperlong.h> | ||
5 | |||
4 | /* | 6 | /* |
5 | * The shmid64_ds structure for parisc architecture. | 7 | * The shmid64_ds structure for parisc architecture. |
6 | * Note extra padding because this structure is passed back and forth | 8 | * Note extra padding because this structure is passed back and forth |
@@ -13,19 +15,19 @@ | |||
13 | 15 | ||
14 | struct shmid64_ds { | 16 | struct shmid64_ds { |
15 | struct ipc64_perm shm_perm; /* operation perms */ | 17 | struct ipc64_perm shm_perm; /* operation perms */ |
16 | #ifndef CONFIG_64BIT | 18 | #if __BITS_PER_LONG != 64 |
17 | unsigned int __pad1; | 19 | unsigned int __pad1; |
18 | #endif | 20 | #endif |
19 | __kernel_time_t shm_atime; /* last attach time */ | 21 | __kernel_time_t shm_atime; /* last attach time */ |
20 | #ifndef CONFIG_64BIT | 22 | #if __BITS_PER_LONG != 64 |
21 | unsigned int __pad2; | 23 | unsigned int __pad2; |
22 | #endif | 24 | #endif |
23 | __kernel_time_t shm_dtime; /* last detach time */ | 25 | __kernel_time_t shm_dtime; /* last detach time */ |
24 | #ifndef CONFIG_64BIT | 26 | #if __BITS_PER_LONG != 64 |
25 | unsigned int __pad3; | 27 | unsigned int __pad3; |
26 | #endif | 28 | #endif |
27 | __kernel_time_t shm_ctime; /* last change time */ | 29 | __kernel_time_t shm_ctime; /* last change time */ |
28 | #ifndef CONFIG_64BIT | 30 | #if __BITS_PER_LONG != 64 |
29 | unsigned int __pad4; | 31 | unsigned int __pad4; |
30 | #endif | 32 | #endif |
31 | size_t shm_segsz; /* size of segment (bytes) */ | 33 | size_t shm_segsz; /* size of segment (bytes) */ |
@@ -36,23 +38,16 @@ struct shmid64_ds { | |||
36 | unsigned int __unused2; | 38 | unsigned int __unused2; |
37 | }; | 39 | }; |
38 | 40 | ||
39 | #ifdef CONFIG_64BIT | ||
40 | /* The 'unsigned int' (formerly 'unsigned long') data types below will | ||
41 | * ensure that a 32-bit app calling shmctl(*,IPC_INFO,*) will work on | ||
42 | * a wide kernel, but if some of these values are meant to contain pointers | ||
43 | * they may need to be 'long long' instead. -PB XXX FIXME | ||
44 | */ | ||
45 | #endif | ||
46 | struct shminfo64 { | 41 | struct shminfo64 { |
47 | unsigned int shmmax; | 42 | unsigned long shmmax; |
48 | unsigned int shmmin; | 43 | unsigned long shmmin; |
49 | unsigned int shmmni; | 44 | unsigned long shmmni; |
50 | unsigned int shmseg; | 45 | unsigned long shmseg; |
51 | unsigned int shmall; | 46 | unsigned long shmall; |
52 | unsigned int __unused1; | 47 | unsigned long __unused1; |
53 | unsigned int __unused2; | 48 | unsigned long __unused2; |
54 | unsigned int __unused3; | 49 | unsigned long __unused3; |
55 | unsigned int __unused4; | 50 | unsigned long __unused4; |
56 | }; | 51 | }; |
57 | 52 | ||
58 | #endif /* _PARISC_SHMBUF_H */ | 53 | #endif /* _PARISC_SHMBUF_H */ |
diff --git a/arch/parisc/include/uapi/asm/signal.h b/arch/parisc/include/uapi/asm/signal.h index 10df7079f4cd..e26043b73f5d 100644 --- a/arch/parisc/include/uapi/asm/signal.h +++ b/arch/parisc/include/uapi/asm/signal.h | |||
@@ -85,7 +85,7 @@ | |||
85 | struct siginfo; | 85 | struct siginfo; |
86 | 86 | ||
87 | /* Type of a signal handler. */ | 87 | /* Type of a signal handler. */ |
88 | #ifdef CONFIG_64BIT | 88 | #if defined(__LP64__) |
89 | /* function pointers on 64-bit parisc are pointers to little structs and the | 89 | /* function pointers on 64-bit parisc are pointers to little structs and the |
90 | * compiler doesn't support code which changes or tests the address of | 90 | * compiler doesn't support code which changes or tests the address of |
91 | * the function in the little struct. This is really ugly -PB | 91 | * the function in the little struct. This is really ugly -PB |
diff --git a/arch/parisc/include/uapi/asm/unistd.h b/arch/parisc/include/uapi/asm/unistd.h index 8667f18be238..5f5c0373de63 100644 --- a/arch/parisc/include/uapi/asm/unistd.h +++ b/arch/parisc/include/uapi/asm/unistd.h | |||
@@ -833,8 +833,9 @@ | |||
833 | #define __NR_seccomp (__NR_Linux + 338) | 833 | #define __NR_seccomp (__NR_Linux + 338) |
834 | #define __NR_getrandom (__NR_Linux + 339) | 834 | #define __NR_getrandom (__NR_Linux + 339) |
835 | #define __NR_memfd_create (__NR_Linux + 340) | 835 | #define __NR_memfd_create (__NR_Linux + 340) |
836 | #define __NR_bpf (__NR_Linux + 341) | ||
836 | 837 | ||
837 | #define __NR_Linux_syscalls (__NR_memfd_create + 1) | 838 | #define __NR_Linux_syscalls (__NR_bpf + 1) |
838 | 839 | ||
839 | 840 | ||
840 | #define __IGNORE_select /* newselect */ | 841 | #define __IGNORE_select /* newselect */ |
diff --git a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S index b563d9c8268b..fe4f0b89bf8f 100644 --- a/arch/parisc/kernel/syscall_table.S +++ b/arch/parisc/kernel/syscall_table.S | |||
@@ -286,11 +286,11 @@ | |||
286 | ENTRY_COMP(msgsnd) | 286 | ENTRY_COMP(msgsnd) |
287 | ENTRY_COMP(msgrcv) | 287 | ENTRY_COMP(msgrcv) |
288 | ENTRY_SAME(msgget) /* 190 */ | 288 | ENTRY_SAME(msgget) /* 190 */ |
289 | ENTRY_SAME(msgctl) | 289 | ENTRY_COMP(msgctl) |
290 | ENTRY_SAME(shmat) | 290 | ENTRY_COMP(shmat) |
291 | ENTRY_SAME(shmdt) | 291 | ENTRY_SAME(shmdt) |
292 | ENTRY_SAME(shmget) | 292 | ENTRY_SAME(shmget) |
293 | ENTRY_SAME(shmctl) /* 195 */ | 293 | ENTRY_COMP(shmctl) /* 195 */ |
294 | ENTRY_SAME(ni_syscall) /* streams1 */ | 294 | ENTRY_SAME(ni_syscall) /* streams1 */ |
295 | ENTRY_SAME(ni_syscall) /* streams2 */ | 295 | ENTRY_SAME(ni_syscall) /* streams2 */ |
296 | ENTRY_SAME(lstat64) | 296 | ENTRY_SAME(lstat64) |
@@ -323,7 +323,7 @@ | |||
323 | ENTRY_SAME(epoll_ctl) /* 225 */ | 323 | ENTRY_SAME(epoll_ctl) /* 225 */ |
324 | ENTRY_SAME(epoll_wait) | 324 | ENTRY_SAME(epoll_wait) |
325 | ENTRY_SAME(remap_file_pages) | 325 | ENTRY_SAME(remap_file_pages) |
326 | ENTRY_SAME(semtimedop) | 326 | ENTRY_COMP(semtimedop) |
327 | ENTRY_COMP(mq_open) | 327 | ENTRY_COMP(mq_open) |
328 | ENTRY_SAME(mq_unlink) /* 230 */ | 328 | ENTRY_SAME(mq_unlink) /* 230 */ |
329 | ENTRY_COMP(mq_timedsend) | 329 | ENTRY_COMP(mq_timedsend) |
@@ -436,6 +436,7 @@ | |||
436 | ENTRY_SAME(seccomp) | 436 | ENTRY_SAME(seccomp) |
437 | ENTRY_SAME(getrandom) | 437 | ENTRY_SAME(getrandom) |
438 | ENTRY_SAME(memfd_create) /* 340 */ | 438 | ENTRY_SAME(memfd_create) /* 340 */ |
439 | ENTRY_SAME(bpf) | ||
439 | 440 | ||
440 | /* Nothing yet */ | 441 | /* Nothing yet */ |
441 | 442 | ||
diff --git a/arch/powerpc/include/asm/fadump.h b/arch/powerpc/include/asm/fadump.h index a6774560afe3..493e72f64b35 100644 --- a/arch/powerpc/include/asm/fadump.h +++ b/arch/powerpc/include/asm/fadump.h | |||
@@ -70,39 +70,39 @@ | |||
70 | #define CPU_UNKNOWN (~((u32)0)) | 70 | #define CPU_UNKNOWN (~((u32)0)) |
71 | 71 | ||
72 | /* Utility macros */ | 72 | /* Utility macros */ |
73 | #define SKIP_TO_NEXT_CPU(reg_entry) \ | 73 | #define SKIP_TO_NEXT_CPU(reg_entry) \ |
74 | ({ \ | 74 | ({ \ |
75 | while (reg_entry->reg_id != REG_ID("CPUEND")) \ | 75 | while (be64_to_cpu(reg_entry->reg_id) != REG_ID("CPUEND")) \ |
76 | reg_entry++; \ | 76 | reg_entry++; \ |
77 | reg_entry++; \ | 77 | reg_entry++; \ |
78 | }) | 78 | }) |
79 | 79 | ||
80 | /* Kernel Dump section info */ | 80 | /* Kernel Dump section info */ |
81 | struct fadump_section { | 81 | struct fadump_section { |
82 | u32 request_flag; | 82 | __be32 request_flag; |
83 | u16 source_data_type; | 83 | __be16 source_data_type; |
84 | u16 error_flags; | 84 | __be16 error_flags; |
85 | u64 source_address; | 85 | __be64 source_address; |
86 | u64 source_len; | 86 | __be64 source_len; |
87 | u64 bytes_dumped; | 87 | __be64 bytes_dumped; |
88 | u64 destination_address; | 88 | __be64 destination_address; |
89 | }; | 89 | }; |
90 | 90 | ||
91 | /* ibm,configure-kernel-dump header. */ | 91 | /* ibm,configure-kernel-dump header. */ |
92 | struct fadump_section_header { | 92 | struct fadump_section_header { |
93 | u32 dump_format_version; | 93 | __be32 dump_format_version; |
94 | u16 dump_num_sections; | 94 | __be16 dump_num_sections; |
95 | u16 dump_status_flag; | 95 | __be16 dump_status_flag; |
96 | u32 offset_first_dump_section; | 96 | __be32 offset_first_dump_section; |
97 | 97 | ||
98 | /* Fields for disk dump option. */ | 98 | /* Fields for disk dump option. */ |
99 | u32 dd_block_size; | 99 | __be32 dd_block_size; |
100 | u64 dd_block_offset; | 100 | __be64 dd_block_offset; |
101 | u64 dd_num_blocks; | 101 | __be64 dd_num_blocks; |
102 | u32 dd_offset_disk_path; | 102 | __be32 dd_offset_disk_path; |
103 | 103 | ||
104 | /* Maximum time allowed to prevent an automatic dump-reboot. */ | 104 | /* Maximum time allowed to prevent an automatic dump-reboot. */ |
105 | u32 max_time_auto; | 105 | __be32 max_time_auto; |
106 | }; | 106 | }; |
107 | 107 | ||
108 | /* | 108 | /* |
@@ -174,15 +174,15 @@ static inline u64 str_to_u64(const char *str) | |||
174 | 174 | ||
175 | /* Register save area header. */ | 175 | /* Register save area header. */ |
176 | struct fadump_reg_save_area_header { | 176 | struct fadump_reg_save_area_header { |
177 | u64 magic_number; | 177 | __be64 magic_number; |
178 | u32 version; | 178 | __be32 version; |
179 | u32 num_cpu_offset; | 179 | __be32 num_cpu_offset; |
180 | }; | 180 | }; |
181 | 181 | ||
182 | /* Register entry. */ | 182 | /* Register entry. */ |
183 | struct fadump_reg_entry { | 183 | struct fadump_reg_entry { |
184 | u64 reg_id; | 184 | __be64 reg_id; |
185 | u64 reg_value; | 185 | __be64 reg_value; |
186 | }; | 186 | }; |
187 | 187 | ||
188 | /* fadump crash info structure */ | 188 | /* fadump crash info structure */ |
diff --git a/arch/powerpc/include/asm/hugetlb.h b/arch/powerpc/include/asm/hugetlb.h index 623f2971ce0e..766b77d527ac 100644 --- a/arch/powerpc/include/asm/hugetlb.h +++ b/arch/powerpc/include/asm/hugetlb.h | |||
@@ -71,7 +71,7 @@ pte_t *huge_pte_offset_and_shift(struct mm_struct *mm, | |||
71 | 71 | ||
72 | void flush_dcache_icache_hugepage(struct page *page); | 72 | void flush_dcache_icache_hugepage(struct page *page); |
73 | 73 | ||
74 | #if defined(CONFIG_PPC_MM_SLICES) || defined(CONFIG_PPC_SUBPAGE_PROT) | 74 | #if defined(CONFIG_PPC_MM_SLICES) |
75 | int is_hugepage_only_range(struct mm_struct *mm, unsigned long addr, | 75 | int is_hugepage_only_range(struct mm_struct *mm, unsigned long addr, |
76 | unsigned long len); | 76 | unsigned long len); |
77 | #else | 77 | #else |
diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h index 7d8a60068805..ce9577d693be 100644 --- a/arch/powerpc/include/asm/systbl.h +++ b/arch/powerpc/include/asm/systbl.h | |||
@@ -365,3 +365,4 @@ SYSCALL_SPU(renameat2) | |||
365 | SYSCALL_SPU(seccomp) | 365 | SYSCALL_SPU(seccomp) |
366 | SYSCALL_SPU(getrandom) | 366 | SYSCALL_SPU(getrandom) |
367 | SYSCALL_SPU(memfd_create) | 367 | SYSCALL_SPU(memfd_create) |
368 | SYSCALL_SPU(bpf) | ||
diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h index 4e9af3fd43e7..e0da021caa00 100644 --- a/arch/powerpc/include/asm/unistd.h +++ b/arch/powerpc/include/asm/unistd.h | |||
@@ -12,7 +12,7 @@ | |||
12 | #include <uapi/asm/unistd.h> | 12 | #include <uapi/asm/unistd.h> |
13 | 13 | ||
14 | 14 | ||
15 | #define __NR_syscalls 361 | 15 | #define __NR_syscalls 362 |
16 | 16 | ||
17 | #define __NR__exit __NR_exit | 17 | #define __NR__exit __NR_exit |
18 | #define NR_syscalls __NR_syscalls | 18 | #define NR_syscalls __NR_syscalls |
diff --git a/arch/powerpc/include/uapi/asm/unistd.h b/arch/powerpc/include/uapi/asm/unistd.h index 0688fc06e183..f55351f2e66e 100644 --- a/arch/powerpc/include/uapi/asm/unistd.h +++ b/arch/powerpc/include/uapi/asm/unistd.h | |||
@@ -383,5 +383,6 @@ | |||
383 | #define __NR_seccomp 358 | 383 | #define __NR_seccomp 358 |
384 | #define __NR_getrandom 359 | 384 | #define __NR_getrandom 359 |
385 | #define __NR_memfd_create 360 | 385 | #define __NR_memfd_create 360 |
386 | #define __NR_bpf 361 | ||
386 | 387 | ||
387 | #endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */ | 388 | #endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */ |
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S index 5bbd1bc8c3b0..0905c8da90f1 100644 --- a/arch/powerpc/kernel/entry_64.S +++ b/arch/powerpc/kernel/entry_64.S | |||
@@ -659,7 +659,13 @@ _GLOBAL(ret_from_except_lite) | |||
659 | 3: | 659 | 3: |
660 | #endif | 660 | #endif |
661 | bl save_nvgprs | 661 | bl save_nvgprs |
662 | /* | ||
663 | * Use a non volatile GPR to save and restore our thread_info flags | ||
664 | * across the call to restore_interrupts. | ||
665 | */ | ||
666 | mr r30,r4 | ||
662 | bl restore_interrupts | 667 | bl restore_interrupts |
668 | mr r4,r30 | ||
663 | addi r3,r1,STACK_FRAME_OVERHEAD | 669 | addi r3,r1,STACK_FRAME_OVERHEAD |
664 | bl do_notify_resume | 670 | bl do_notify_resume |
665 | b ret_from_except | 671 | b ret_from_except |
diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c index 742694c1d852..26d091a1a54c 100644 --- a/arch/powerpc/kernel/fadump.c +++ b/arch/powerpc/kernel/fadump.c | |||
@@ -58,7 +58,7 @@ int __init early_init_dt_scan_fw_dump(unsigned long node, | |||
58 | const __be32 *sections; | 58 | const __be32 *sections; |
59 | int i, num_sections; | 59 | int i, num_sections; |
60 | int size; | 60 | int size; |
61 | const int *token; | 61 | const __be32 *token; |
62 | 62 | ||
63 | if (depth != 1 || strcmp(uname, "rtas") != 0) | 63 | if (depth != 1 || strcmp(uname, "rtas") != 0) |
64 | return 0; | 64 | return 0; |
@@ -72,7 +72,7 @@ int __init early_init_dt_scan_fw_dump(unsigned long node, | |||
72 | return 1; | 72 | return 1; |
73 | 73 | ||
74 | fw_dump.fadump_supported = 1; | 74 | fw_dump.fadump_supported = 1; |
75 | fw_dump.ibm_configure_kernel_dump = *token; | 75 | fw_dump.ibm_configure_kernel_dump = be32_to_cpu(*token); |
76 | 76 | ||
77 | /* | 77 | /* |
78 | * The 'ibm,kernel-dump' rtas node is present only if there is | 78 | * The 'ibm,kernel-dump' rtas node is present only if there is |
@@ -147,11 +147,11 @@ static unsigned long init_fadump_mem_struct(struct fadump_mem_struct *fdm, | |||
147 | memset(fdm, 0, sizeof(struct fadump_mem_struct)); | 147 | memset(fdm, 0, sizeof(struct fadump_mem_struct)); |
148 | addr = addr & PAGE_MASK; | 148 | addr = addr & PAGE_MASK; |
149 | 149 | ||
150 | fdm->header.dump_format_version = 0x00000001; | 150 | fdm->header.dump_format_version = cpu_to_be32(0x00000001); |
151 | fdm->header.dump_num_sections = 3; | 151 | fdm->header.dump_num_sections = cpu_to_be16(3); |
152 | fdm->header.dump_status_flag = 0; | 152 | fdm->header.dump_status_flag = 0; |
153 | fdm->header.offset_first_dump_section = | 153 | fdm->header.offset_first_dump_section = |
154 | (u32)offsetof(struct fadump_mem_struct, cpu_state_data); | 154 | cpu_to_be32((u32)offsetof(struct fadump_mem_struct, cpu_state_data)); |
155 | 155 | ||
156 | /* | 156 | /* |
157 | * Fields for disk dump option. | 157 | * Fields for disk dump option. |
@@ -167,27 +167,27 @@ static unsigned long init_fadump_mem_struct(struct fadump_mem_struct *fdm, | |||
167 | 167 | ||
168 | /* Kernel dump sections */ | 168 | /* Kernel dump sections */ |
169 | /* cpu state data section. */ | 169 | /* cpu state data section. */ |
170 | fdm->cpu_state_data.request_flag = FADUMP_REQUEST_FLAG; | 170 | fdm->cpu_state_data.request_flag = cpu_to_be32(FADUMP_REQUEST_FLAG); |
171 | fdm->cpu_state_data.source_data_type = FADUMP_CPU_STATE_DATA; | 171 | fdm->cpu_state_data.source_data_type = cpu_to_be16(FADUMP_CPU_STATE_DATA); |
172 | fdm->cpu_state_data.source_address = 0; | 172 | fdm->cpu_state_data.source_address = 0; |
173 | fdm->cpu_state_data.source_len = fw_dump.cpu_state_data_size; | 173 | fdm->cpu_state_data.source_len = cpu_to_be64(fw_dump.cpu_state_data_size); |
174 | fdm->cpu_state_data.destination_address = addr; | 174 | fdm->cpu_state_data.destination_address = cpu_to_be64(addr); |
175 | addr += fw_dump.cpu_state_data_size; | 175 | addr += fw_dump.cpu_state_data_size; |
176 | 176 | ||
177 | /* hpte region section */ | 177 | /* hpte region section */ |
178 | fdm->hpte_region.request_flag = FADUMP_REQUEST_FLAG; | 178 | fdm->hpte_region.request_flag = cpu_to_be32(FADUMP_REQUEST_FLAG); |
179 | fdm->hpte_region.source_data_type = FADUMP_HPTE_REGION; | 179 | fdm->hpte_region.source_data_type = cpu_to_be16(FADUMP_HPTE_REGION); |
180 | fdm->hpte_region.source_address = 0; | 180 | fdm->hpte_region.source_address = 0; |
181 | fdm->hpte_region.source_len = fw_dump.hpte_region_size; | 181 | fdm->hpte_region.source_len = cpu_to_be64(fw_dump.hpte_region_size); |
182 | fdm->hpte_region.destination_address = addr; | 182 | fdm->hpte_region.destination_address = cpu_to_be64(addr); |
183 | addr += fw_dump.hpte_region_size; | 183 | addr += fw_dump.hpte_region_size; |
184 | 184 | ||
185 | /* RMA region section */ | 185 | /* RMA region section */ |
186 | fdm->rmr_region.request_flag = FADUMP_REQUEST_FLAG; | 186 | fdm->rmr_region.request_flag = cpu_to_be32(FADUMP_REQUEST_FLAG); |
187 | fdm->rmr_region.source_data_type = FADUMP_REAL_MODE_REGION; | 187 | fdm->rmr_region.source_data_type = cpu_to_be16(FADUMP_REAL_MODE_REGION); |
188 | fdm->rmr_region.source_address = RMA_START; | 188 | fdm->rmr_region.source_address = cpu_to_be64(RMA_START); |
189 | fdm->rmr_region.source_len = fw_dump.boot_memory_size; | 189 | fdm->rmr_region.source_len = cpu_to_be64(fw_dump.boot_memory_size); |
190 | fdm->rmr_region.destination_address = addr; | 190 | fdm->rmr_region.destination_address = cpu_to_be64(addr); |
191 | addr += fw_dump.boot_memory_size; | 191 | addr += fw_dump.boot_memory_size; |
192 | 192 | ||
193 | return addr; | 193 | return addr; |
@@ -272,7 +272,7 @@ int __init fadump_reserve_mem(void) | |||
272 | * first kernel. | 272 | * first kernel. |
273 | */ | 273 | */ |
274 | if (fdm_active) | 274 | if (fdm_active) |
275 | fw_dump.boot_memory_size = fdm_active->rmr_region.source_len; | 275 | fw_dump.boot_memory_size = be64_to_cpu(fdm_active->rmr_region.source_len); |
276 | else | 276 | else |
277 | fw_dump.boot_memory_size = fadump_calculate_reserve_size(); | 277 | fw_dump.boot_memory_size = fadump_calculate_reserve_size(); |
278 | 278 | ||
@@ -314,8 +314,8 @@ int __init fadump_reserve_mem(void) | |||
314 | (unsigned long)(base >> 20)); | 314 | (unsigned long)(base >> 20)); |
315 | 315 | ||
316 | fw_dump.fadumphdr_addr = | 316 | fw_dump.fadumphdr_addr = |
317 | fdm_active->rmr_region.destination_address + | 317 | be64_to_cpu(fdm_active->rmr_region.destination_address) + |
318 | fdm_active->rmr_region.source_len; | 318 | be64_to_cpu(fdm_active->rmr_region.source_len); |
319 | pr_debug("fadumphdr_addr = %p\n", | 319 | pr_debug("fadumphdr_addr = %p\n", |
320 | (void *) fw_dump.fadumphdr_addr); | 320 | (void *) fw_dump.fadumphdr_addr); |
321 | } else { | 321 | } else { |
@@ -472,9 +472,9 @@ fadump_read_registers(struct fadump_reg_entry *reg_entry, struct pt_regs *regs) | |||
472 | { | 472 | { |
473 | memset(regs, 0, sizeof(struct pt_regs)); | 473 | memset(regs, 0, sizeof(struct pt_regs)); |
474 | 474 | ||
475 | while (reg_entry->reg_id != REG_ID("CPUEND")) { | 475 | while (be64_to_cpu(reg_entry->reg_id) != REG_ID("CPUEND")) { |
476 | fadump_set_regval(regs, reg_entry->reg_id, | 476 | fadump_set_regval(regs, be64_to_cpu(reg_entry->reg_id), |
477 | reg_entry->reg_value); | 477 | be64_to_cpu(reg_entry->reg_value)); |
478 | reg_entry++; | 478 | reg_entry++; |
479 | } | 479 | } |
480 | reg_entry++; | 480 | reg_entry++; |
@@ -603,20 +603,20 @@ static int __init fadump_build_cpu_notes(const struct fadump_mem_struct *fdm) | |||
603 | if (!fdm->cpu_state_data.bytes_dumped) | 603 | if (!fdm->cpu_state_data.bytes_dumped) |
604 | return -EINVAL; | 604 | return -EINVAL; |
605 | 605 | ||
606 | addr = fdm->cpu_state_data.destination_address; | 606 | addr = be64_to_cpu(fdm->cpu_state_data.destination_address); |
607 | vaddr = __va(addr); | 607 | vaddr = __va(addr); |
608 | 608 | ||
609 | reg_header = vaddr; | 609 | reg_header = vaddr; |
610 | if (reg_header->magic_number != REGSAVE_AREA_MAGIC) { | 610 | if (be64_to_cpu(reg_header->magic_number) != REGSAVE_AREA_MAGIC) { |
611 | printk(KERN_ERR "Unable to read register save area.\n"); | 611 | printk(KERN_ERR "Unable to read register save area.\n"); |
612 | return -ENOENT; | 612 | return -ENOENT; |
613 | } | 613 | } |
614 | pr_debug("--------CPU State Data------------\n"); | 614 | pr_debug("--------CPU State Data------------\n"); |
615 | pr_debug("Magic Number: %llx\n", reg_header->magic_number); | 615 | pr_debug("Magic Number: %llx\n", be64_to_cpu(reg_header->magic_number)); |
616 | pr_debug("NumCpuOffset: %x\n", reg_header->num_cpu_offset); | 616 | pr_debug("NumCpuOffset: %x\n", be32_to_cpu(reg_header->num_cpu_offset)); |
617 | 617 | ||
618 | vaddr += reg_header->num_cpu_offset; | 618 | vaddr += be32_to_cpu(reg_header->num_cpu_offset); |
619 | num_cpus = *((u32 *)(vaddr)); | 619 | num_cpus = be32_to_cpu(*((__be32 *)(vaddr))); |
620 | pr_debug("NumCpus : %u\n", num_cpus); | 620 | pr_debug("NumCpus : %u\n", num_cpus); |
621 | vaddr += sizeof(u32); | 621 | vaddr += sizeof(u32); |
622 | reg_entry = (struct fadump_reg_entry *)vaddr; | 622 | reg_entry = (struct fadump_reg_entry *)vaddr; |
@@ -639,13 +639,13 @@ static int __init fadump_build_cpu_notes(const struct fadump_mem_struct *fdm) | |||
639 | fdh = __va(fw_dump.fadumphdr_addr); | 639 | fdh = __va(fw_dump.fadumphdr_addr); |
640 | 640 | ||
641 | for (i = 0; i < num_cpus; i++) { | 641 | for (i = 0; i < num_cpus; i++) { |
642 | if (reg_entry->reg_id != REG_ID("CPUSTRT")) { | 642 | if (be64_to_cpu(reg_entry->reg_id) != REG_ID("CPUSTRT")) { |
643 | printk(KERN_ERR "Unable to read CPU state data\n"); | 643 | printk(KERN_ERR "Unable to read CPU state data\n"); |
644 | rc = -ENOENT; | 644 | rc = -ENOENT; |
645 | goto error_out; | 645 | goto error_out; |
646 | } | 646 | } |
647 | /* Lower 4 bytes of reg_value contains logical cpu id */ | 647 | /* Lower 4 bytes of reg_value contains logical cpu id */ |
648 | cpu = reg_entry->reg_value & FADUMP_CPU_ID_MASK; | 648 | cpu = be64_to_cpu(reg_entry->reg_value) & FADUMP_CPU_ID_MASK; |
649 | if (fdh && !cpumask_test_cpu(cpu, &fdh->cpu_online_mask)) { | 649 | if (fdh && !cpumask_test_cpu(cpu, &fdh->cpu_online_mask)) { |
650 | SKIP_TO_NEXT_CPU(reg_entry); | 650 | SKIP_TO_NEXT_CPU(reg_entry); |
651 | continue; | 651 | continue; |
@@ -692,7 +692,7 @@ static int __init process_fadump(const struct fadump_mem_struct *fdm_active) | |||
692 | return -EINVAL; | 692 | return -EINVAL; |
693 | 693 | ||
694 | /* Check if the dump data is valid. */ | 694 | /* Check if the dump data is valid. */ |
695 | if ((fdm_active->header.dump_status_flag == FADUMP_ERROR_FLAG) || | 695 | if ((be16_to_cpu(fdm_active->header.dump_status_flag) == FADUMP_ERROR_FLAG) || |
696 | (fdm_active->cpu_state_data.error_flags != 0) || | 696 | (fdm_active->cpu_state_data.error_flags != 0) || |
697 | (fdm_active->rmr_region.error_flags != 0)) { | 697 | (fdm_active->rmr_region.error_flags != 0)) { |
698 | printk(KERN_ERR "Dump taken by platform is not valid\n"); | 698 | printk(KERN_ERR "Dump taken by platform is not valid\n"); |
@@ -828,7 +828,7 @@ static void fadump_setup_crash_memory_ranges(void) | |||
828 | static inline unsigned long fadump_relocate(unsigned long paddr) | 828 | static inline unsigned long fadump_relocate(unsigned long paddr) |
829 | { | 829 | { |
830 | if (paddr > RMA_START && paddr < fw_dump.boot_memory_size) | 830 | if (paddr > RMA_START && paddr < fw_dump.boot_memory_size) |
831 | return fdm.rmr_region.destination_address + paddr; | 831 | return be64_to_cpu(fdm.rmr_region.destination_address) + paddr; |
832 | else | 832 | else |
833 | return paddr; | 833 | return paddr; |
834 | } | 834 | } |
@@ -902,7 +902,7 @@ static int fadump_create_elfcore_headers(char *bufp) | |||
902 | * to the specified destination_address. Hence set | 902 | * to the specified destination_address. Hence set |
903 | * the correct offset. | 903 | * the correct offset. |
904 | */ | 904 | */ |
905 | phdr->p_offset = fdm.rmr_region.destination_address; | 905 | phdr->p_offset = be64_to_cpu(fdm.rmr_region.destination_address); |
906 | } | 906 | } |
907 | 907 | ||
908 | phdr->p_paddr = mbase; | 908 | phdr->p_paddr = mbase; |
@@ -951,7 +951,7 @@ static void register_fadump(void) | |||
951 | 951 | ||
952 | fadump_setup_crash_memory_ranges(); | 952 | fadump_setup_crash_memory_ranges(); |
953 | 953 | ||
954 | addr = fdm.rmr_region.destination_address + fdm.rmr_region.source_len; | 954 | addr = be64_to_cpu(fdm.rmr_region.destination_address) + be64_to_cpu(fdm.rmr_region.source_len); |
955 | /* Initialize fadump crash info header. */ | 955 | /* Initialize fadump crash info header. */ |
956 | addr = init_fadump_header(addr); | 956 | addr = init_fadump_header(addr); |
957 | vaddr = __va(addr); | 957 | vaddr = __va(addr); |
@@ -1023,7 +1023,7 @@ void fadump_cleanup(void) | |||
1023 | /* Invalidate the registration only if dump is active. */ | 1023 | /* Invalidate the registration only if dump is active. */ |
1024 | if (fw_dump.dump_active) { | 1024 | if (fw_dump.dump_active) { |
1025 | init_fadump_mem_struct(&fdm, | 1025 | init_fadump_mem_struct(&fdm, |
1026 | fdm_active->cpu_state_data.destination_address); | 1026 | be64_to_cpu(fdm_active->cpu_state_data.destination_address)); |
1027 | fadump_invalidate_dump(&fdm); | 1027 | fadump_invalidate_dump(&fdm); |
1028 | } | 1028 | } |
1029 | } | 1029 | } |
@@ -1063,7 +1063,7 @@ static void fadump_invalidate_release_mem(void) | |||
1063 | return; | 1063 | return; |
1064 | } | 1064 | } |
1065 | 1065 | ||
1066 | destination_address = fdm_active->cpu_state_data.destination_address; | 1066 | destination_address = be64_to_cpu(fdm_active->cpu_state_data.destination_address); |
1067 | fadump_cleanup(); | 1067 | fadump_cleanup(); |
1068 | mutex_unlock(&fadump_mutex); | 1068 | mutex_unlock(&fadump_mutex); |
1069 | 1069 | ||
@@ -1183,31 +1183,31 @@ static int fadump_region_show(struct seq_file *m, void *private) | |||
1183 | seq_printf(m, | 1183 | seq_printf(m, |
1184 | "CPU : [%#016llx-%#016llx] %#llx bytes, " | 1184 | "CPU : [%#016llx-%#016llx] %#llx bytes, " |
1185 | "Dumped: %#llx\n", | 1185 | "Dumped: %#llx\n", |
1186 | fdm_ptr->cpu_state_data.destination_address, | 1186 | be64_to_cpu(fdm_ptr->cpu_state_data.destination_address), |
1187 | fdm_ptr->cpu_state_data.destination_address + | 1187 | be64_to_cpu(fdm_ptr->cpu_state_data.destination_address) + |
1188 | fdm_ptr->cpu_state_data.source_len - 1, | 1188 | be64_to_cpu(fdm_ptr->cpu_state_data.source_len) - 1, |
1189 | fdm_ptr->cpu_state_data.source_len, | 1189 | be64_to_cpu(fdm_ptr->cpu_state_data.source_len), |
1190 | fdm_ptr->cpu_state_data.bytes_dumped); | 1190 | be64_to_cpu(fdm_ptr->cpu_state_data.bytes_dumped)); |
1191 | seq_printf(m, | 1191 | seq_printf(m, |
1192 | "HPTE: [%#016llx-%#016llx] %#llx bytes, " | 1192 | "HPTE: [%#016llx-%#016llx] %#llx bytes, " |
1193 | "Dumped: %#llx\n", | 1193 | "Dumped: %#llx\n", |
1194 | fdm_ptr->hpte_region.destination_address, | 1194 | be64_to_cpu(fdm_ptr->hpte_region.destination_address), |
1195 | fdm_ptr->hpte_region.destination_address + | 1195 | be64_to_cpu(fdm_ptr->hpte_region.destination_address) + |
1196 | fdm_ptr->hpte_region.source_len - 1, | 1196 | be64_to_cpu(fdm_ptr->hpte_region.source_len) - 1, |
1197 | fdm_ptr->hpte_region.source_len, | 1197 | be64_to_cpu(fdm_ptr->hpte_region.source_len), |
1198 | fdm_ptr->hpte_region.bytes_dumped); | 1198 | be64_to_cpu(fdm_ptr->hpte_region.bytes_dumped)); |
1199 | seq_printf(m, | 1199 | seq_printf(m, |
1200 | "DUMP: [%#016llx-%#016llx] %#llx bytes, " | 1200 | "DUMP: [%#016llx-%#016llx] %#llx bytes, " |
1201 | "Dumped: %#llx\n", | 1201 | "Dumped: %#llx\n", |
1202 | fdm_ptr->rmr_region.destination_address, | 1202 | be64_to_cpu(fdm_ptr->rmr_region.destination_address), |
1203 | fdm_ptr->rmr_region.destination_address + | 1203 | be64_to_cpu(fdm_ptr->rmr_region.destination_address) + |
1204 | fdm_ptr->rmr_region.source_len - 1, | 1204 | be64_to_cpu(fdm_ptr->rmr_region.source_len) - 1, |
1205 | fdm_ptr->rmr_region.source_len, | 1205 | be64_to_cpu(fdm_ptr->rmr_region.source_len), |
1206 | fdm_ptr->rmr_region.bytes_dumped); | 1206 | be64_to_cpu(fdm_ptr->rmr_region.bytes_dumped)); |
1207 | 1207 | ||
1208 | if (!fdm_active || | 1208 | if (!fdm_active || |
1209 | (fw_dump.reserve_dump_area_start == | 1209 | (fw_dump.reserve_dump_area_start == |
1210 | fdm_ptr->cpu_state_data.destination_address)) | 1210 | be64_to_cpu(fdm_ptr->cpu_state_data.destination_address))) |
1211 | goto out; | 1211 | goto out; |
1212 | 1212 | ||
1213 | /* Dump is active. Show reserved memory region. */ | 1213 | /* Dump is active. Show reserved memory region. */ |
@@ -1215,10 +1215,10 @@ static int fadump_region_show(struct seq_file *m, void *private) | |||
1215 | " : [%#016llx-%#016llx] %#llx bytes, " | 1215 | " : [%#016llx-%#016llx] %#llx bytes, " |
1216 | "Dumped: %#llx\n", | 1216 | "Dumped: %#llx\n", |
1217 | (unsigned long long)fw_dump.reserve_dump_area_start, | 1217 | (unsigned long long)fw_dump.reserve_dump_area_start, |
1218 | fdm_ptr->cpu_state_data.destination_address - 1, | 1218 | be64_to_cpu(fdm_ptr->cpu_state_data.destination_address) - 1, |
1219 | fdm_ptr->cpu_state_data.destination_address - | 1219 | be64_to_cpu(fdm_ptr->cpu_state_data.destination_address) - |
1220 | fw_dump.reserve_dump_area_start, | 1220 | fw_dump.reserve_dump_area_start, |
1221 | fdm_ptr->cpu_state_data.destination_address - | 1221 | be64_to_cpu(fdm_ptr->cpu_state_data.destination_address) - |
1222 | fw_dump.reserve_dump_area_start); | 1222 | fw_dump.reserve_dump_area_start); |
1223 | out: | 1223 | out: |
1224 | if (fdm_active) | 1224 | if (fdm_active) |
diff --git a/arch/powerpc/mm/copro_fault.c b/arch/powerpc/mm/copro_fault.c index 0f9939e693df..5a236f082c78 100644 --- a/arch/powerpc/mm/copro_fault.c +++ b/arch/powerpc/mm/copro_fault.c | |||
@@ -99,8 +99,6 @@ int copro_calculate_slb(struct mm_struct *mm, u64 ea, struct copro_slb *slb) | |||
99 | u64 vsid; | 99 | u64 vsid; |
100 | int psize, ssize; | 100 | int psize, ssize; |
101 | 101 | ||
102 | slb->esid = (ea & ESID_MASK) | SLB_ESID_V; | ||
103 | |||
104 | switch (REGION_ID(ea)) { | 102 | switch (REGION_ID(ea)) { |
105 | case USER_REGION_ID: | 103 | case USER_REGION_ID: |
106 | pr_devel("%s: 0x%llx -- USER_REGION_ID\n", __func__, ea); | 104 | pr_devel("%s: 0x%llx -- USER_REGION_ID\n", __func__, ea); |
@@ -133,6 +131,7 @@ int copro_calculate_slb(struct mm_struct *mm, u64 ea, struct copro_slb *slb) | |||
133 | vsid |= mmu_psize_defs[psize].sllp | | 131 | vsid |= mmu_psize_defs[psize].sllp | |
134 | ((ssize == MMU_SEGSIZE_1T) ? SLB_VSID_B_1T : 0); | 132 | ((ssize == MMU_SEGSIZE_1T) ? SLB_VSID_B_1T : 0); |
135 | 133 | ||
134 | slb->esid = (ea & (ssize == MMU_SEGSIZE_1T ? ESID_MASK_1T : ESID_MASK)) | SLB_ESID_V; | ||
136 | slb->vsid = vsid; | 135 | slb->vsid = vsid; |
137 | 136 | ||
138 | return 0; | 137 | return 0; |
diff --git a/arch/powerpc/mm/init_32.c b/arch/powerpc/mm/init_32.c index cad68ff8eca5..415a51b028b9 100644 --- a/arch/powerpc/mm/init_32.c +++ b/arch/powerpc/mm/init_32.c | |||
@@ -103,7 +103,7 @@ unsigned long __max_low_memory = MAX_LOW_MEM; | |||
103 | /* | 103 | /* |
104 | * Check for command-line options that affect what MMU_init will do. | 104 | * Check for command-line options that affect what MMU_init will do. |
105 | */ | 105 | */ |
106 | void MMU_setup(void) | 106 | void __init MMU_setup(void) |
107 | { | 107 | { |
108 | /* Check for nobats option (used in mapin_ram). */ | 108 | /* Check for nobats option (used in mapin_ram). */ |
109 | if (strstr(boot_command_line, "nobats")) { | 109 | if (strstr(boot_command_line, "nobats")) { |
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c index e5236c24dc07..b9d1dfdbe5bb 100644 --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c | |||
@@ -1509,11 +1509,14 @@ static int update_cpu_topology(void *data) | |||
1509 | cpu = smp_processor_id(); | 1509 | cpu = smp_processor_id(); |
1510 | 1510 | ||
1511 | for (update = data; update; update = update->next) { | 1511 | for (update = data; update; update = update->next) { |
1512 | int new_nid = update->new_nid; | ||
1512 | if (cpu != update->cpu) | 1513 | if (cpu != update->cpu) |
1513 | continue; | 1514 | continue; |
1514 | 1515 | ||
1515 | unmap_cpu_from_node(update->cpu); | 1516 | unmap_cpu_from_node(cpu); |
1516 | map_cpu_to_node(update->cpu, update->new_nid); | 1517 | map_cpu_to_node(cpu, new_nid); |
1518 | set_cpu_numa_node(cpu, new_nid); | ||
1519 | set_cpu_numa_mem(cpu, local_memory_node(new_nid)); | ||
1517 | vdso_getcpu_init(); | 1520 | vdso_getcpu_init(); |
1518 | } | 1521 | } |
1519 | 1522 | ||
diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c index 8d7bda94d196..ded0ea1afde4 100644 --- a/arch/powerpc/mm/slice.c +++ b/arch/powerpc/mm/slice.c | |||
@@ -682,6 +682,7 @@ void slice_set_range_psize(struct mm_struct *mm, unsigned long start, | |||
682 | slice_convert(mm, mask, psize); | 682 | slice_convert(mm, mask, psize); |
683 | } | 683 | } |
684 | 684 | ||
685 | #ifdef CONFIG_HUGETLB_PAGE | ||
685 | /* | 686 | /* |
686 | * is_hugepage_only_range() is used by generic code to verify whether | 687 | * is_hugepage_only_range() is used by generic code to verify whether |
687 | * a normal mmap mapping (non hugetlbfs) is valid on a given area. | 688 | * a normal mmap mapping (non hugetlbfs) is valid on a given area. |
@@ -726,4 +727,4 @@ int is_hugepage_only_range(struct mm_struct *mm, unsigned long addr, | |||
726 | #endif | 727 | #endif |
727 | return !slice_check_fit(mask, available); | 728 | return !slice_check_fit(mask, available); |
728 | } | 729 | } |
729 | 730 | #endif | |
diff --git a/arch/powerpc/perf/hv-24x7.c b/arch/powerpc/perf/hv-24x7.c index 6c8710dd90c9..dba34088da28 100644 --- a/arch/powerpc/perf/hv-24x7.c +++ b/arch/powerpc/perf/hv-24x7.c | |||
@@ -417,11 +417,6 @@ static int h_24x7_event_add(struct perf_event *event, int flags) | |||
417 | return 0; | 417 | return 0; |
418 | } | 418 | } |
419 | 419 | ||
420 | static int h_24x7_event_idx(struct perf_event *event) | ||
421 | { | ||
422 | return 0; | ||
423 | } | ||
424 | |||
425 | static struct pmu h_24x7_pmu = { | 420 | static struct pmu h_24x7_pmu = { |
426 | .task_ctx_nr = perf_invalid_context, | 421 | .task_ctx_nr = perf_invalid_context, |
427 | 422 | ||
@@ -433,7 +428,6 @@ static struct pmu h_24x7_pmu = { | |||
433 | .start = h_24x7_event_start, | 428 | .start = h_24x7_event_start, |
434 | .stop = h_24x7_event_stop, | 429 | .stop = h_24x7_event_stop, |
435 | .read = h_24x7_event_update, | 430 | .read = h_24x7_event_update, |
436 | .event_idx = h_24x7_event_idx, | ||
437 | }; | 431 | }; |
438 | 432 | ||
439 | static int hv_24x7_init(void) | 433 | static int hv_24x7_init(void) |
diff --git a/arch/powerpc/perf/hv-gpci.c b/arch/powerpc/perf/hv-gpci.c index 15fc76c93022..a051fe946c63 100644 --- a/arch/powerpc/perf/hv-gpci.c +++ b/arch/powerpc/perf/hv-gpci.c | |||
@@ -246,11 +246,6 @@ static int h_gpci_event_init(struct perf_event *event) | |||
246 | return 0; | 246 | return 0; |
247 | } | 247 | } |
248 | 248 | ||
249 | static int h_gpci_event_idx(struct perf_event *event) | ||
250 | { | ||
251 | return 0; | ||
252 | } | ||
253 | |||
254 | static struct pmu h_gpci_pmu = { | 249 | static struct pmu h_gpci_pmu = { |
255 | .task_ctx_nr = perf_invalid_context, | 250 | .task_ctx_nr = perf_invalid_context, |
256 | 251 | ||
@@ -262,7 +257,6 @@ static struct pmu h_gpci_pmu = { | |||
262 | .start = h_gpci_event_start, | 257 | .start = h_gpci_event_start, |
263 | .stop = h_gpci_event_stop, | 258 | .stop = h_gpci_event_stop, |
264 | .read = h_gpci_event_update, | 259 | .read = h_gpci_event_update, |
265 | .event_idx = h_gpci_event_idx, | ||
266 | }; | 260 | }; |
267 | 261 | ||
268 | static int hv_gpci_init(void) | 262 | static int hv_gpci_init(void) |
diff --git a/arch/powerpc/platforms/powernv/opal-lpc.c b/arch/powerpc/platforms/powernv/opal-lpc.c index dd2c285ad170..e4169d68cb32 100644 --- a/arch/powerpc/platforms/powernv/opal-lpc.c +++ b/arch/powerpc/platforms/powernv/opal-lpc.c | |||
@@ -191,7 +191,6 @@ static ssize_t lpc_debug_read(struct file *filp, char __user *ubuf, | |||
191 | { | 191 | { |
192 | struct lpc_debugfs_entry *lpc = filp->private_data; | 192 | struct lpc_debugfs_entry *lpc = filp->private_data; |
193 | u32 data, pos, len, todo; | 193 | u32 data, pos, len, todo; |
194 | __be32 bedata; | ||
195 | int rc; | 194 | int rc; |
196 | 195 | ||
197 | if (!access_ok(VERIFY_WRITE, ubuf, count)) | 196 | if (!access_ok(VERIFY_WRITE, ubuf, count)) |
@@ -214,18 +213,57 @@ static ssize_t lpc_debug_read(struct file *filp, char __user *ubuf, | |||
214 | len = 2; | 213 | len = 2; |
215 | } | 214 | } |
216 | rc = opal_lpc_read(opal_lpc_chip_id, lpc->lpc_type, pos, | 215 | rc = opal_lpc_read(opal_lpc_chip_id, lpc->lpc_type, pos, |
217 | &bedata, len); | 216 | &data, len); |
218 | if (rc) | 217 | if (rc) |
219 | return -ENXIO; | 218 | return -ENXIO; |
220 | data = be32_to_cpu(bedata); | 219 | |
220 | /* | ||
221 | * Now there is some trickery with the data returned by OPAL | ||
222 | * as it's the desired data right justified in a 32-bit BE | ||
223 | * word. | ||
224 | * | ||
225 | * This is a very bad interface and I'm to blame for it :-( | ||
226 | * | ||
227 | * So we can't just apply a 32-bit swap to what comes from OPAL, | ||
228 | * because user space expects the *bytes* to be in their proper | ||
229 | * respective positions (ie, LPC position). | ||
230 | * | ||
231 | * So what we really want to do here is to shift data right | ||
232 | * appropriately on a LE kernel. | ||
233 | * | ||
234 | * IE. If the LPC transaction has bytes B0, B1, B2 and B3 in that | ||
235 | * order, we have in memory written to by OPAL at the "data" | ||
236 | * pointer: | ||
237 | * | ||
238 | * Bytes: OPAL "data" LE "data" | ||
239 | * 32-bit: B0 B1 B2 B3 B0B1B2B3 B3B2B1B0 | ||
240 | * 16-bit: B0 B1 0000B0B1 B1B00000 | ||
241 | * 8-bit: B0 000000B0 B0000000 | ||
242 | * | ||
243 | * So a BE kernel will have the leftmost of the above in the MSB | ||
244 | * and rightmost in the LSB and can just then "cast" the u32 "data" | ||
245 | * down to the appropriate quantity and write it. | ||
246 | * | ||
247 | * However, an LE kernel can't. It doesn't need to swap because a | ||
248 | * load from data followed by a store to user are going to preserve | ||
249 | * the byte ordering which is the wire byte order which is what the | ||
250 | * user wants, but in order to "crop" to the right size, we need to | ||
251 | * shift right first. | ||
252 | */ | ||
221 | switch(len) { | 253 | switch(len) { |
222 | case 4: | 254 | case 4: |
223 | rc = __put_user((u32)data, (u32 __user *)ubuf); | 255 | rc = __put_user((u32)data, (u32 __user *)ubuf); |
224 | break; | 256 | break; |
225 | case 2: | 257 | case 2: |
258 | #ifdef __LITTLE_ENDIAN__ | ||
259 | data >>= 16; | ||
260 | #endif | ||
226 | rc = __put_user((u16)data, (u16 __user *)ubuf); | 261 | rc = __put_user((u16)data, (u16 __user *)ubuf); |
227 | break; | 262 | break; |
228 | default: | 263 | default: |
264 | #ifdef __LITTLE_ENDIAN__ | ||
265 | data >>= 24; | ||
266 | #endif | ||
229 | rc = __put_user((u8)data, (u8 __user *)ubuf); | 267 | rc = __put_user((u8)data, (u8 __user *)ubuf); |
230 | break; | 268 | break; |
231 | } | 269 | } |
@@ -265,12 +303,31 @@ static ssize_t lpc_debug_write(struct file *filp, const char __user *ubuf, | |||
265 | else if (todo > 1 && (pos & 1) == 0) | 303 | else if (todo > 1 && (pos & 1) == 0) |
266 | len = 2; | 304 | len = 2; |
267 | } | 305 | } |
306 | |||
307 | /* | ||
308 | * Similarly to the read case, we have some trickery here but | ||
309 | * it's different to handle. We need to pass the value to OPAL in | ||
310 | * a register whose layout depends on the access size. We want | ||
311 | * to reproduce the memory layout of the user, however we aren't | ||
312 | * doing a load from user and a store to another memory location | ||
313 | * which would achieve that. Here we pass the value to OPAL via | ||
314 | * a register which is expected to contain the "BE" interpretation | ||
315 | * of the byte sequence. IE: for a 32-bit access, byte 0 should be | ||
316 | * in the MSB. So here we *do* need to byteswap on LE. | ||
317 | * | ||
318 | * User bytes: LE "data" OPAL "data" | ||
319 | * 32-bit: B0 B1 B2 B3 B3B2B1B0 B0B1B2B3 | ||
320 | * 16-bit: B0 B1 0000B1B0 0000B0B1 | ||
321 | * 8-bit: B0 000000B0 000000B0 | ||
322 | */ | ||
268 | switch(len) { | 323 | switch(len) { |
269 | case 4: | 324 | case 4: |
270 | rc = __get_user(data, (u32 __user *)ubuf); | 325 | rc = __get_user(data, (u32 __user *)ubuf); |
326 | data = cpu_to_be32(data); | ||
271 | break; | 327 | break; |
272 | case 2: | 328 | case 2: |
273 | rc = __get_user(data, (u16 __user *)ubuf); | 329 | rc = __get_user(data, (u16 __user *)ubuf); |
330 | data = cpu_to_be16(data); | ||
274 | break; | 331 | break; |
275 | default: | 332 | default: |
276 | rc = __get_user(data, (u8 __user *)ubuf); | 333 | rc = __get_user(data, (u8 __user *)ubuf); |
diff --git a/arch/powerpc/platforms/powernv/opal-wrappers.S b/arch/powerpc/platforms/powernv/opal-wrappers.S index e9e2450c1fdd..feb549aa3eea 100644 --- a/arch/powerpc/platforms/powernv/opal-wrappers.S +++ b/arch/powerpc/platforms/powernv/opal-wrappers.S | |||
@@ -58,7 +58,7 @@ END_FTR_SECTION(0, 1); \ | |||
58 | */ | 58 | */ |
59 | 59 | ||
60 | #define OPAL_CALL(name, token) \ | 60 | #define OPAL_CALL(name, token) \ |
61 | _GLOBAL(name); \ | 61 | _GLOBAL_TOC(name); \ |
62 | mflr r0; \ | 62 | mflr r0; \ |
63 | std r0,16(r1); \ | 63 | std r0,16(r1); \ |
64 | li r0,token; \ | 64 | li r0,token; \ |
diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c index 6ad83bd11fe2..c22bb1b4beb8 100644 --- a/arch/powerpc/platforms/pseries/dlpar.c +++ b/arch/powerpc/platforms/pseries/dlpar.c | |||
@@ -382,7 +382,7 @@ static int dlpar_online_cpu(struct device_node *dn) | |||
382 | BUG_ON(get_cpu_current_state(cpu) | 382 | BUG_ON(get_cpu_current_state(cpu) |
383 | != CPU_STATE_OFFLINE); | 383 | != CPU_STATE_OFFLINE); |
384 | cpu_maps_update_done(); | 384 | cpu_maps_update_done(); |
385 | rc = cpu_up(cpu); | 385 | rc = device_online(get_cpu_device(cpu)); |
386 | if (rc) | 386 | if (rc) |
387 | goto out; | 387 | goto out; |
388 | cpu_maps_update_begin(); | 388 | cpu_maps_update_begin(); |
@@ -467,7 +467,7 @@ static int dlpar_offline_cpu(struct device_node *dn) | |||
467 | if (get_cpu_current_state(cpu) == CPU_STATE_ONLINE) { | 467 | if (get_cpu_current_state(cpu) == CPU_STATE_ONLINE) { |
468 | set_preferred_offline_state(cpu, CPU_STATE_OFFLINE); | 468 | set_preferred_offline_state(cpu, CPU_STATE_OFFLINE); |
469 | cpu_maps_update_done(); | 469 | cpu_maps_update_done(); |
470 | rc = cpu_down(cpu); | 470 | rc = device_offline(get_cpu_device(cpu)); |
471 | if (rc) | 471 | if (rc) |
472 | goto out; | 472 | goto out; |
473 | cpu_maps_update_begin(); | 473 | cpu_maps_update_begin(); |
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c index 8c509d5397c6..f6880d2a40fb 100644 --- a/arch/powerpc/platforms/pseries/lpar.c +++ b/arch/powerpc/platforms/pseries/lpar.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include <asm/trace.h> | 43 | #include <asm/trace.h> |
44 | #include <asm/firmware.h> | 44 | #include <asm/firmware.h> |
45 | #include <asm/plpar_wrappers.h> | 45 | #include <asm/plpar_wrappers.h> |
46 | #include <asm/fadump.h> | ||
46 | 47 | ||
47 | #include "pseries.h" | 48 | #include "pseries.h" |
48 | 49 | ||
@@ -247,8 +248,17 @@ static void pSeries_lpar_hptab_clear(void) | |||
247 | } | 248 | } |
248 | 249 | ||
249 | #ifdef __LITTLE_ENDIAN__ | 250 | #ifdef __LITTLE_ENDIAN__ |
250 | /* Reset exceptions to big endian */ | 251 | /* |
251 | if (firmware_has_feature(FW_FEATURE_SET_MODE)) { | 252 | * Reset exceptions to big endian. |
253 | * | ||
254 | * FIXME this is a hack for kexec, we need to reset the exception | ||
255 | * endian before starting the new kernel and this is a convenient place | ||
256 | * to do it. | ||
257 | * | ||
258 | * This is also called on boot when a fadump happens. In that case we | ||
259 | * must not change the exception endian mode. | ||
260 | */ | ||
261 | if (firmware_has_feature(FW_FEATURE_SET_MODE) && !is_fadump_active()) { | ||
252 | long rc; | 262 | long rc; |
253 | 263 | ||
254 | rc = pseries_big_endian_exceptions(); | 264 | rc = pseries_big_endian_exceptions(); |
diff --git a/arch/s390/configs/default_defconfig b/arch/s390/configs/default_defconfig index 9d94fdd9f525..9432d0f202ef 100644 --- a/arch/s390/configs/default_defconfig +++ b/arch/s390/configs/default_defconfig | |||
@@ -35,7 +35,6 @@ CONFIG_MODULE_UNLOAD=y | |||
35 | CONFIG_MODULE_FORCE_UNLOAD=y | 35 | CONFIG_MODULE_FORCE_UNLOAD=y |
36 | CONFIG_MODVERSIONS=y | 36 | CONFIG_MODVERSIONS=y |
37 | CONFIG_MODULE_SRCVERSION_ALL=y | 37 | CONFIG_MODULE_SRCVERSION_ALL=y |
38 | CONFIG_BLK_DEV_INTEGRITY=y | ||
39 | CONFIG_BLK_DEV_THROTTLING=y | 38 | CONFIG_BLK_DEV_THROTTLING=y |
40 | CONFIG_PARTITION_ADVANCED=y | 39 | CONFIG_PARTITION_ADVANCED=y |
41 | CONFIG_IBM_PARTITION=y | 40 | CONFIG_IBM_PARTITION=y |
@@ -245,6 +244,7 @@ CONFIG_NF_TABLES_IPV4=m | |||
245 | CONFIG_NFT_CHAIN_ROUTE_IPV4=m | 244 | CONFIG_NFT_CHAIN_ROUTE_IPV4=m |
246 | CONFIG_NFT_CHAIN_NAT_IPV4=m | 245 | CONFIG_NFT_CHAIN_NAT_IPV4=m |
247 | CONFIG_NF_TABLES_ARP=m | 246 | CONFIG_NF_TABLES_ARP=m |
247 | CONFIG_NF_NAT_IPV4=m | ||
248 | CONFIG_IP_NF_IPTABLES=m | 248 | CONFIG_IP_NF_IPTABLES=m |
249 | CONFIG_IP_NF_MATCH_AH=m | 249 | CONFIG_IP_NF_MATCH_AH=m |
250 | CONFIG_IP_NF_MATCH_ECN=m | 250 | CONFIG_IP_NF_MATCH_ECN=m |
@@ -252,11 +252,6 @@ CONFIG_IP_NF_MATCH_RPFILTER=m | |||
252 | CONFIG_IP_NF_MATCH_TTL=m | 252 | CONFIG_IP_NF_MATCH_TTL=m |
253 | CONFIG_IP_NF_FILTER=m | 253 | CONFIG_IP_NF_FILTER=m |
254 | CONFIG_IP_NF_TARGET_REJECT=m | 254 | CONFIG_IP_NF_TARGET_REJECT=m |
255 | CONFIG_IP_NF_TARGET_ULOG=m | ||
256 | CONFIG_NF_NAT_IPV4=m | ||
257 | CONFIG_IP_NF_TARGET_MASQUERADE=m | ||
258 | CONFIG_IP_NF_TARGET_NETMAP=m | ||
259 | CONFIG_IP_NF_TARGET_REDIRECT=m | ||
260 | CONFIG_IP_NF_MANGLE=m | 255 | CONFIG_IP_NF_MANGLE=m |
261 | CONFIG_IP_NF_TARGET_CLUSTERIP=m | 256 | CONFIG_IP_NF_TARGET_CLUSTERIP=m |
262 | CONFIG_IP_NF_TARGET_ECN=m | 257 | CONFIG_IP_NF_TARGET_ECN=m |
@@ -270,6 +265,7 @@ CONFIG_NF_CONNTRACK_IPV6=m | |||
270 | CONFIG_NF_TABLES_IPV6=m | 265 | CONFIG_NF_TABLES_IPV6=m |
271 | CONFIG_NFT_CHAIN_ROUTE_IPV6=m | 266 | CONFIG_NFT_CHAIN_ROUTE_IPV6=m |
272 | CONFIG_NFT_CHAIN_NAT_IPV6=m | 267 | CONFIG_NFT_CHAIN_NAT_IPV6=m |
268 | CONFIG_NF_NAT_IPV6=m | ||
273 | CONFIG_IP6_NF_IPTABLES=m | 269 | CONFIG_IP6_NF_IPTABLES=m |
274 | CONFIG_IP6_NF_MATCH_AH=m | 270 | CONFIG_IP6_NF_MATCH_AH=m |
275 | CONFIG_IP6_NF_MATCH_EUI64=m | 271 | CONFIG_IP6_NF_MATCH_EUI64=m |
@@ -286,9 +282,6 @@ CONFIG_IP6_NF_TARGET_REJECT=m | |||
286 | CONFIG_IP6_NF_MANGLE=m | 282 | CONFIG_IP6_NF_MANGLE=m |
287 | CONFIG_IP6_NF_RAW=m | 283 | CONFIG_IP6_NF_RAW=m |
288 | CONFIG_IP6_NF_SECURITY=m | 284 | CONFIG_IP6_NF_SECURITY=m |
289 | CONFIG_NF_NAT_IPV6=m | ||
290 | CONFIG_IP6_NF_TARGET_MASQUERADE=m | ||
291 | CONFIG_IP6_NF_TARGET_NPT=m | ||
292 | CONFIG_NF_TABLES_BRIDGE=m | 285 | CONFIG_NF_TABLES_BRIDGE=m |
293 | CONFIG_NET_SCTPPROBE=m | 286 | CONFIG_NET_SCTPPROBE=m |
294 | CONFIG_RDS=m | 287 | CONFIG_RDS=m |
@@ -374,14 +367,13 @@ CONFIG_BLK_DEV_SR=m | |||
374 | CONFIG_CHR_DEV_SG=y | 367 | CONFIG_CHR_DEV_SG=y |
375 | CONFIG_CHR_DEV_SCH=m | 368 | CONFIG_CHR_DEV_SCH=m |
376 | CONFIG_SCSI_ENCLOSURE=m | 369 | CONFIG_SCSI_ENCLOSURE=m |
377 | CONFIG_SCSI_MULTI_LUN=y | ||
378 | CONFIG_SCSI_CONSTANTS=y | 370 | CONFIG_SCSI_CONSTANTS=y |
379 | CONFIG_SCSI_LOGGING=y | 371 | CONFIG_SCSI_LOGGING=y |
380 | CONFIG_SCSI_SPI_ATTRS=m | 372 | CONFIG_SCSI_SPI_ATTRS=m |
373 | CONFIG_SCSI_FC_ATTRS=y | ||
381 | CONFIG_SCSI_SAS_LIBSAS=m | 374 | CONFIG_SCSI_SAS_LIBSAS=m |
382 | CONFIG_SCSI_SRP_ATTRS=m | 375 | CONFIG_SCSI_SRP_ATTRS=m |
383 | CONFIG_ISCSI_TCP=m | 376 | CONFIG_ISCSI_TCP=m |
384 | CONFIG_LIBFCOE=m | ||
385 | CONFIG_SCSI_DEBUG=m | 377 | CONFIG_SCSI_DEBUG=m |
386 | CONFIG_ZFCP=y | 378 | CONFIG_ZFCP=y |
387 | CONFIG_SCSI_VIRTIO=m | 379 | CONFIG_SCSI_VIRTIO=m |
@@ -427,7 +419,6 @@ CONFIG_VIRTIO_NET=m | |||
427 | CONFIG_NLMON=m | 419 | CONFIG_NLMON=m |
428 | CONFIG_VHOST_NET=m | 420 | CONFIG_VHOST_NET=m |
429 | # CONFIG_NET_VENDOR_ARC is not set | 421 | # CONFIG_NET_VENDOR_ARC is not set |
430 | # CONFIG_NET_CADENCE is not set | ||
431 | # CONFIG_NET_VENDOR_CHELSIO is not set | 422 | # CONFIG_NET_VENDOR_CHELSIO is not set |
432 | # CONFIG_NET_VENDOR_INTEL is not set | 423 | # CONFIG_NET_VENDOR_INTEL is not set |
433 | # CONFIG_NET_VENDOR_MARVELL is not set | 424 | # CONFIG_NET_VENDOR_MARVELL is not set |
@@ -481,14 +472,14 @@ CONFIG_JFS_FS=m | |||
481 | CONFIG_JFS_POSIX_ACL=y | 472 | CONFIG_JFS_POSIX_ACL=y |
482 | CONFIG_JFS_SECURITY=y | 473 | CONFIG_JFS_SECURITY=y |
483 | CONFIG_JFS_STATISTICS=y | 474 | CONFIG_JFS_STATISTICS=y |
484 | CONFIG_XFS_FS=m | 475 | CONFIG_XFS_FS=y |
485 | CONFIG_XFS_QUOTA=y | 476 | CONFIG_XFS_QUOTA=y |
486 | CONFIG_XFS_POSIX_ACL=y | 477 | CONFIG_XFS_POSIX_ACL=y |
487 | CONFIG_XFS_RT=y | 478 | CONFIG_XFS_RT=y |
488 | CONFIG_XFS_DEBUG=y | 479 | CONFIG_XFS_DEBUG=y |
489 | CONFIG_GFS2_FS=m | 480 | CONFIG_GFS2_FS=m |
490 | CONFIG_OCFS2_FS=m | 481 | CONFIG_OCFS2_FS=m |
491 | CONFIG_BTRFS_FS=m | 482 | CONFIG_BTRFS_FS=y |
492 | CONFIG_BTRFS_FS_POSIX_ACL=y | 483 | CONFIG_BTRFS_FS_POSIX_ACL=y |
493 | CONFIG_NILFS2_FS=m | 484 | CONFIG_NILFS2_FS=m |
494 | CONFIG_FANOTIFY=y | 485 | CONFIG_FANOTIFY=y |
@@ -574,7 +565,6 @@ CONFIG_DEBUG_SHIRQ=y | |||
574 | CONFIG_DETECT_HUNG_TASK=y | 565 | CONFIG_DETECT_HUNG_TASK=y |
575 | CONFIG_TIMER_STATS=y | 566 | CONFIG_TIMER_STATS=y |
576 | CONFIG_DEBUG_RT_MUTEXES=y | 567 | CONFIG_DEBUG_RT_MUTEXES=y |
577 | CONFIG_RT_MUTEX_TESTER=y | ||
578 | CONFIG_DEBUG_WW_MUTEX_SLOWPATH=y | 568 | CONFIG_DEBUG_WW_MUTEX_SLOWPATH=y |
579 | CONFIG_PROVE_LOCKING=y | 569 | CONFIG_PROVE_LOCKING=y |
580 | CONFIG_LOCK_STAT=y | 570 | CONFIG_LOCK_STAT=y |
@@ -600,8 +590,13 @@ CONFIG_FAULT_INJECTION_DEBUG_FS=y | |||
600 | CONFIG_FAULT_INJECTION_STACKTRACE_FILTER=y | 590 | CONFIG_FAULT_INJECTION_STACKTRACE_FILTER=y |
601 | CONFIG_LATENCYTOP=y | 591 | CONFIG_LATENCYTOP=y |
602 | CONFIG_DEBUG_STRICT_USER_COPY_CHECKS=y | 592 | CONFIG_DEBUG_STRICT_USER_COPY_CHECKS=y |
593 | CONFIG_IRQSOFF_TRACER=y | ||
594 | CONFIG_PREEMPT_TRACER=y | ||
595 | CONFIG_SCHED_TRACER=y | ||
596 | CONFIG_FTRACE_SYSCALLS=y | ||
597 | CONFIG_STACK_TRACER=y | ||
603 | CONFIG_BLK_DEV_IO_TRACE=y | 598 | CONFIG_BLK_DEV_IO_TRACE=y |
604 | # CONFIG_KPROBE_EVENT is not set | 599 | CONFIG_UPROBE_EVENT=y |
605 | CONFIG_LKDTM=m | 600 | CONFIG_LKDTM=m |
606 | CONFIG_TEST_LIST_SORT=y | 601 | CONFIG_TEST_LIST_SORT=y |
607 | CONFIG_KPROBES_SANITY_TEST=y | 602 | CONFIG_KPROBES_SANITY_TEST=y |
@@ -609,7 +604,10 @@ CONFIG_RBTREE_TEST=y | |||
609 | CONFIG_INTERVAL_TREE_TEST=m | 604 | CONFIG_INTERVAL_TREE_TEST=m |
610 | CONFIG_PERCPU_TEST=m | 605 | CONFIG_PERCPU_TEST=m |
611 | CONFIG_ATOMIC64_SELFTEST=y | 606 | CONFIG_ATOMIC64_SELFTEST=y |
607 | CONFIG_TEST_STRING_HELPERS=y | ||
608 | CONFIG_TEST_KSTRTOX=y | ||
612 | CONFIG_DMA_API_DEBUG=y | 609 | CONFIG_DMA_API_DEBUG=y |
610 | CONFIG_TEST_BPF=m | ||
613 | # CONFIG_STRICT_DEVMEM is not set | 611 | # CONFIG_STRICT_DEVMEM is not set |
614 | CONFIG_S390_PTDUMP=y | 612 | CONFIG_S390_PTDUMP=y |
615 | CONFIG_ENCRYPTED_KEYS=m | 613 | CONFIG_ENCRYPTED_KEYS=m |
@@ -673,12 +671,6 @@ CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=m | |||
673 | CONFIG_X509_CERTIFICATE_PARSER=m | 671 | CONFIG_X509_CERTIFICATE_PARSER=m |
674 | CONFIG_CRC7=m | 672 | CONFIG_CRC7=m |
675 | CONFIG_CRC8=m | 673 | CONFIG_CRC8=m |
676 | CONFIG_XZ_DEC_X86=y | ||
677 | CONFIG_XZ_DEC_POWERPC=y | ||
678 | CONFIG_XZ_DEC_IA64=y | ||
679 | CONFIG_XZ_DEC_ARM=y | ||
680 | CONFIG_XZ_DEC_ARMTHUMB=y | ||
681 | CONFIG_XZ_DEC_SPARC=y | ||
682 | CONFIG_CORDIC=m | 674 | CONFIG_CORDIC=m |
683 | CONFIG_CMM=m | 675 | CONFIG_CMM=m |
684 | CONFIG_APPLDATA_BASE=y | 676 | CONFIG_APPLDATA_BASE=y |
diff --git a/arch/s390/configs/gcov_defconfig b/arch/s390/configs/gcov_defconfig index 90f514baa37d..219dca6ea926 100644 --- a/arch/s390/configs/gcov_defconfig +++ b/arch/s390/configs/gcov_defconfig | |||
@@ -35,7 +35,6 @@ CONFIG_MODULE_UNLOAD=y | |||
35 | CONFIG_MODULE_FORCE_UNLOAD=y | 35 | CONFIG_MODULE_FORCE_UNLOAD=y |
36 | CONFIG_MODVERSIONS=y | 36 | CONFIG_MODVERSIONS=y |
37 | CONFIG_MODULE_SRCVERSION_ALL=y | 37 | CONFIG_MODULE_SRCVERSION_ALL=y |
38 | CONFIG_BLK_DEV_INTEGRITY=y | ||
39 | CONFIG_BLK_DEV_THROTTLING=y | 38 | CONFIG_BLK_DEV_THROTTLING=y |
40 | CONFIG_PARTITION_ADVANCED=y | 39 | CONFIG_PARTITION_ADVANCED=y |
41 | CONFIG_IBM_PARTITION=y | 40 | CONFIG_IBM_PARTITION=y |
@@ -243,6 +242,7 @@ CONFIG_NF_TABLES_IPV4=m | |||
243 | CONFIG_NFT_CHAIN_ROUTE_IPV4=m | 242 | CONFIG_NFT_CHAIN_ROUTE_IPV4=m |
244 | CONFIG_NFT_CHAIN_NAT_IPV4=m | 243 | CONFIG_NFT_CHAIN_NAT_IPV4=m |
245 | CONFIG_NF_TABLES_ARP=m | 244 | CONFIG_NF_TABLES_ARP=m |
245 | CONFIG_NF_NAT_IPV4=m | ||
246 | CONFIG_IP_NF_IPTABLES=m | 246 | CONFIG_IP_NF_IPTABLES=m |
247 | CONFIG_IP_NF_MATCH_AH=m | 247 | CONFIG_IP_NF_MATCH_AH=m |
248 | CONFIG_IP_NF_MATCH_ECN=m | 248 | CONFIG_IP_NF_MATCH_ECN=m |
@@ -250,11 +250,6 @@ CONFIG_IP_NF_MATCH_RPFILTER=m | |||
250 | CONFIG_IP_NF_MATCH_TTL=m | 250 | CONFIG_IP_NF_MATCH_TTL=m |
251 | CONFIG_IP_NF_FILTER=m | 251 | CONFIG_IP_NF_FILTER=m |
252 | CONFIG_IP_NF_TARGET_REJECT=m | 252 | CONFIG_IP_NF_TARGET_REJECT=m |
253 | CONFIG_IP_NF_TARGET_ULOG=m | ||
254 | CONFIG_NF_NAT_IPV4=m | ||
255 | CONFIG_IP_NF_TARGET_MASQUERADE=m | ||
256 | CONFIG_IP_NF_TARGET_NETMAP=m | ||
257 | CONFIG_IP_NF_TARGET_REDIRECT=m | ||
258 | CONFIG_IP_NF_MANGLE=m | 253 | CONFIG_IP_NF_MANGLE=m |
259 | CONFIG_IP_NF_TARGET_CLUSTERIP=m | 254 | CONFIG_IP_NF_TARGET_CLUSTERIP=m |
260 | CONFIG_IP_NF_TARGET_ECN=m | 255 | CONFIG_IP_NF_TARGET_ECN=m |
@@ -268,6 +263,7 @@ CONFIG_NF_CONNTRACK_IPV6=m | |||
268 | CONFIG_NF_TABLES_IPV6=m | 263 | CONFIG_NF_TABLES_IPV6=m |
269 | CONFIG_NFT_CHAIN_ROUTE_IPV6=m | 264 | CONFIG_NFT_CHAIN_ROUTE_IPV6=m |
270 | CONFIG_NFT_CHAIN_NAT_IPV6=m | 265 | CONFIG_NFT_CHAIN_NAT_IPV6=m |
266 | CONFIG_NF_NAT_IPV6=m | ||
271 | CONFIG_IP6_NF_IPTABLES=m | 267 | CONFIG_IP6_NF_IPTABLES=m |
272 | CONFIG_IP6_NF_MATCH_AH=m | 268 | CONFIG_IP6_NF_MATCH_AH=m |
273 | CONFIG_IP6_NF_MATCH_EUI64=m | 269 | CONFIG_IP6_NF_MATCH_EUI64=m |
@@ -284,9 +280,6 @@ CONFIG_IP6_NF_TARGET_REJECT=m | |||
284 | CONFIG_IP6_NF_MANGLE=m | 280 | CONFIG_IP6_NF_MANGLE=m |
285 | CONFIG_IP6_NF_RAW=m | 281 | CONFIG_IP6_NF_RAW=m |
286 | CONFIG_IP6_NF_SECURITY=m | 282 | CONFIG_IP6_NF_SECURITY=m |
287 | CONFIG_NF_NAT_IPV6=m | ||
288 | CONFIG_IP6_NF_TARGET_MASQUERADE=m | ||
289 | CONFIG_IP6_NF_TARGET_NPT=m | ||
290 | CONFIG_NF_TABLES_BRIDGE=m | 283 | CONFIG_NF_TABLES_BRIDGE=m |
291 | CONFIG_NET_SCTPPROBE=m | 284 | CONFIG_NET_SCTPPROBE=m |
292 | CONFIG_RDS=m | 285 | CONFIG_RDS=m |
@@ -371,14 +364,13 @@ CONFIG_BLK_DEV_SR=m | |||
371 | CONFIG_CHR_DEV_SG=y | 364 | CONFIG_CHR_DEV_SG=y |
372 | CONFIG_CHR_DEV_SCH=m | 365 | CONFIG_CHR_DEV_SCH=m |
373 | CONFIG_SCSI_ENCLOSURE=m | 366 | CONFIG_SCSI_ENCLOSURE=m |
374 | CONFIG_SCSI_MULTI_LUN=y | ||
375 | CONFIG_SCSI_CONSTANTS=y | 367 | CONFIG_SCSI_CONSTANTS=y |
376 | CONFIG_SCSI_LOGGING=y | 368 | CONFIG_SCSI_LOGGING=y |
377 | CONFIG_SCSI_SPI_ATTRS=m | 369 | CONFIG_SCSI_SPI_ATTRS=m |
370 | CONFIG_SCSI_FC_ATTRS=y | ||
378 | CONFIG_SCSI_SAS_LIBSAS=m | 371 | CONFIG_SCSI_SAS_LIBSAS=m |
379 | CONFIG_SCSI_SRP_ATTRS=m | 372 | CONFIG_SCSI_SRP_ATTRS=m |
380 | CONFIG_ISCSI_TCP=m | 373 | CONFIG_ISCSI_TCP=m |
381 | CONFIG_LIBFCOE=m | ||
382 | CONFIG_SCSI_DEBUG=m | 374 | CONFIG_SCSI_DEBUG=m |
383 | CONFIG_ZFCP=y | 375 | CONFIG_ZFCP=y |
384 | CONFIG_SCSI_VIRTIO=m | 376 | CONFIG_SCSI_VIRTIO=m |
@@ -424,7 +416,6 @@ CONFIG_VIRTIO_NET=m | |||
424 | CONFIG_NLMON=m | 416 | CONFIG_NLMON=m |
425 | CONFIG_VHOST_NET=m | 417 | CONFIG_VHOST_NET=m |
426 | # CONFIG_NET_VENDOR_ARC is not set | 418 | # CONFIG_NET_VENDOR_ARC is not set |
427 | # CONFIG_NET_CADENCE is not set | ||
428 | # CONFIG_NET_VENDOR_CHELSIO is not set | 419 | # CONFIG_NET_VENDOR_CHELSIO is not set |
429 | # CONFIG_NET_VENDOR_INTEL is not set | 420 | # CONFIG_NET_VENDOR_INTEL is not set |
430 | # CONFIG_NET_VENDOR_MARVELL is not set | 421 | # CONFIG_NET_VENDOR_MARVELL is not set |
@@ -478,13 +469,13 @@ CONFIG_JFS_FS=m | |||
478 | CONFIG_JFS_POSIX_ACL=y | 469 | CONFIG_JFS_POSIX_ACL=y |
479 | CONFIG_JFS_SECURITY=y | 470 | CONFIG_JFS_SECURITY=y |
480 | CONFIG_JFS_STATISTICS=y | 471 | CONFIG_JFS_STATISTICS=y |
481 | CONFIG_XFS_FS=m | 472 | CONFIG_XFS_FS=y |
482 | CONFIG_XFS_QUOTA=y | 473 | CONFIG_XFS_QUOTA=y |
483 | CONFIG_XFS_POSIX_ACL=y | 474 | CONFIG_XFS_POSIX_ACL=y |
484 | CONFIG_XFS_RT=y | 475 | CONFIG_XFS_RT=y |
485 | CONFIG_GFS2_FS=m | 476 | CONFIG_GFS2_FS=m |
486 | CONFIG_OCFS2_FS=m | 477 | CONFIG_OCFS2_FS=m |
487 | CONFIG_BTRFS_FS=m | 478 | CONFIG_BTRFS_FS=y |
488 | CONFIG_BTRFS_FS_POSIX_ACL=y | 479 | CONFIG_BTRFS_FS_POSIX_ACL=y |
489 | CONFIG_NILFS2_FS=m | 480 | CONFIG_NILFS2_FS=m |
490 | CONFIG_FANOTIFY=y | 481 | CONFIG_FANOTIFY=y |
@@ -626,12 +617,6 @@ CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=m | |||
626 | CONFIG_X509_CERTIFICATE_PARSER=m | 617 | CONFIG_X509_CERTIFICATE_PARSER=m |
627 | CONFIG_CRC7=m | 618 | CONFIG_CRC7=m |
628 | CONFIG_CRC8=m | 619 | CONFIG_CRC8=m |
629 | CONFIG_XZ_DEC_X86=y | ||
630 | CONFIG_XZ_DEC_POWERPC=y | ||
631 | CONFIG_XZ_DEC_IA64=y | ||
632 | CONFIG_XZ_DEC_ARM=y | ||
633 | CONFIG_XZ_DEC_ARMTHUMB=y | ||
634 | CONFIG_XZ_DEC_SPARC=y | ||
635 | CONFIG_CORDIC=m | 620 | CONFIG_CORDIC=m |
636 | CONFIG_CMM=m | 621 | CONFIG_CMM=m |
637 | CONFIG_APPLDATA_BASE=y | 622 | CONFIG_APPLDATA_BASE=y |
diff --git a/arch/s390/configs/performance_defconfig b/arch/s390/configs/performance_defconfig index 13559d32af69..822c2f2e0c25 100644 --- a/arch/s390/configs/performance_defconfig +++ b/arch/s390/configs/performance_defconfig | |||
@@ -33,7 +33,6 @@ CONFIG_MODULE_UNLOAD=y | |||
33 | CONFIG_MODULE_FORCE_UNLOAD=y | 33 | CONFIG_MODULE_FORCE_UNLOAD=y |
34 | CONFIG_MODVERSIONS=y | 34 | CONFIG_MODVERSIONS=y |
35 | CONFIG_MODULE_SRCVERSION_ALL=y | 35 | CONFIG_MODULE_SRCVERSION_ALL=y |
36 | CONFIG_BLK_DEV_INTEGRITY=y | ||
37 | CONFIG_BLK_DEV_THROTTLING=y | 36 | CONFIG_BLK_DEV_THROTTLING=y |
38 | CONFIG_PARTITION_ADVANCED=y | 37 | CONFIG_PARTITION_ADVANCED=y |
39 | CONFIG_IBM_PARTITION=y | 38 | CONFIG_IBM_PARTITION=y |
@@ -241,6 +240,7 @@ CONFIG_NF_TABLES_IPV4=m | |||
241 | CONFIG_NFT_CHAIN_ROUTE_IPV4=m | 240 | CONFIG_NFT_CHAIN_ROUTE_IPV4=m |
242 | CONFIG_NFT_CHAIN_NAT_IPV4=m | 241 | CONFIG_NFT_CHAIN_NAT_IPV4=m |
243 | CONFIG_NF_TABLES_ARP=m | 242 | CONFIG_NF_TABLES_ARP=m |
243 | CONFIG_NF_NAT_IPV4=m | ||
244 | CONFIG_IP_NF_IPTABLES=m | 244 | CONFIG_IP_NF_IPTABLES=m |
245 | CONFIG_IP_NF_MATCH_AH=m | 245 | CONFIG_IP_NF_MATCH_AH=m |
246 | CONFIG_IP_NF_MATCH_ECN=m | 246 | CONFIG_IP_NF_MATCH_ECN=m |
@@ -248,11 +248,6 @@ CONFIG_IP_NF_MATCH_RPFILTER=m | |||
248 | CONFIG_IP_NF_MATCH_TTL=m | 248 | CONFIG_IP_NF_MATCH_TTL=m |
249 | CONFIG_IP_NF_FILTER=m | 249 | CONFIG_IP_NF_FILTER=m |
250 | CONFIG_IP_NF_TARGET_REJECT=m | 250 | CONFIG_IP_NF_TARGET_REJECT=m |
251 | CONFIG_IP_NF_TARGET_ULOG=m | ||
252 | CONFIG_NF_NAT_IPV4=m | ||
253 | CONFIG_IP_NF_TARGET_MASQUERADE=m | ||
254 | CONFIG_IP_NF_TARGET_NETMAP=m | ||
255 | CONFIG_IP_NF_TARGET_REDIRECT=m | ||
256 | CONFIG_IP_NF_MANGLE=m | 251 | CONFIG_IP_NF_MANGLE=m |
257 | CONFIG_IP_NF_TARGET_CLUSTERIP=m | 252 | CONFIG_IP_NF_TARGET_CLUSTERIP=m |
258 | CONFIG_IP_NF_TARGET_ECN=m | 253 | CONFIG_IP_NF_TARGET_ECN=m |
@@ -266,6 +261,7 @@ CONFIG_NF_CONNTRACK_IPV6=m | |||
266 | CONFIG_NF_TABLES_IPV6=m | 261 | CONFIG_NF_TABLES_IPV6=m |
267 | CONFIG_NFT_CHAIN_ROUTE_IPV6=m | 262 | CONFIG_NFT_CHAIN_ROUTE_IPV6=m |
268 | CONFIG_NFT_CHAIN_NAT_IPV6=m | 263 | CONFIG_NFT_CHAIN_NAT_IPV6=m |
264 | CONFIG_NF_NAT_IPV6=m | ||
269 | CONFIG_IP6_NF_IPTABLES=m | 265 | CONFIG_IP6_NF_IPTABLES=m |
270 | CONFIG_IP6_NF_MATCH_AH=m | 266 | CONFIG_IP6_NF_MATCH_AH=m |
271 | CONFIG_IP6_NF_MATCH_EUI64=m | 267 | CONFIG_IP6_NF_MATCH_EUI64=m |
@@ -282,9 +278,6 @@ CONFIG_IP6_NF_TARGET_REJECT=m | |||
282 | CONFIG_IP6_NF_MANGLE=m | 278 | CONFIG_IP6_NF_MANGLE=m |
283 | CONFIG_IP6_NF_RAW=m | 279 | CONFIG_IP6_NF_RAW=m |
284 | CONFIG_IP6_NF_SECURITY=m | 280 | CONFIG_IP6_NF_SECURITY=m |
285 | CONFIG_NF_NAT_IPV6=m | ||
286 | CONFIG_IP6_NF_TARGET_MASQUERADE=m | ||
287 | CONFIG_IP6_NF_TARGET_NPT=m | ||
288 | CONFIG_NF_TABLES_BRIDGE=m | 281 | CONFIG_NF_TABLES_BRIDGE=m |
289 | CONFIG_NET_SCTPPROBE=m | 282 | CONFIG_NET_SCTPPROBE=m |
290 | CONFIG_RDS=m | 283 | CONFIG_RDS=m |
@@ -369,14 +362,13 @@ CONFIG_BLK_DEV_SR=m | |||
369 | CONFIG_CHR_DEV_SG=y | 362 | CONFIG_CHR_DEV_SG=y |
370 | CONFIG_CHR_DEV_SCH=m | 363 | CONFIG_CHR_DEV_SCH=m |
371 | CONFIG_SCSI_ENCLOSURE=m | 364 | CONFIG_SCSI_ENCLOSURE=m |
372 | CONFIG_SCSI_MULTI_LUN=y | ||
373 | CONFIG_SCSI_CONSTANTS=y | 365 | CONFIG_SCSI_CONSTANTS=y |
374 | CONFIG_SCSI_LOGGING=y | 366 | CONFIG_SCSI_LOGGING=y |
375 | CONFIG_SCSI_SPI_ATTRS=m | 367 | CONFIG_SCSI_SPI_ATTRS=m |
368 | CONFIG_SCSI_FC_ATTRS=y | ||
376 | CONFIG_SCSI_SAS_LIBSAS=m | 369 | CONFIG_SCSI_SAS_LIBSAS=m |
377 | CONFIG_SCSI_SRP_ATTRS=m | 370 | CONFIG_SCSI_SRP_ATTRS=m |
378 | CONFIG_ISCSI_TCP=m | 371 | CONFIG_ISCSI_TCP=m |
379 | CONFIG_LIBFCOE=m | ||
380 | CONFIG_SCSI_DEBUG=m | 372 | CONFIG_SCSI_DEBUG=m |
381 | CONFIG_ZFCP=y | 373 | CONFIG_ZFCP=y |
382 | CONFIG_SCSI_VIRTIO=m | 374 | CONFIG_SCSI_VIRTIO=m |
@@ -422,7 +414,6 @@ CONFIG_VIRTIO_NET=m | |||
422 | CONFIG_NLMON=m | 414 | CONFIG_NLMON=m |
423 | CONFIG_VHOST_NET=m | 415 | CONFIG_VHOST_NET=m |
424 | # CONFIG_NET_VENDOR_ARC is not set | 416 | # CONFIG_NET_VENDOR_ARC is not set |
425 | # CONFIG_NET_CADENCE is not set | ||
426 | # CONFIG_NET_VENDOR_CHELSIO is not set | 417 | # CONFIG_NET_VENDOR_CHELSIO is not set |
427 | # CONFIG_NET_VENDOR_INTEL is not set | 418 | # CONFIG_NET_VENDOR_INTEL is not set |
428 | # CONFIG_NET_VENDOR_MARVELL is not set | 419 | # CONFIG_NET_VENDOR_MARVELL is not set |
@@ -476,13 +467,13 @@ CONFIG_JFS_FS=m | |||
476 | CONFIG_JFS_POSIX_ACL=y | 467 | CONFIG_JFS_POSIX_ACL=y |
477 | CONFIG_JFS_SECURITY=y | 468 | CONFIG_JFS_SECURITY=y |
478 | CONFIG_JFS_STATISTICS=y | 469 | CONFIG_JFS_STATISTICS=y |
479 | CONFIG_XFS_FS=m | 470 | CONFIG_XFS_FS=y |
480 | CONFIG_XFS_QUOTA=y | 471 | CONFIG_XFS_QUOTA=y |
481 | CONFIG_XFS_POSIX_ACL=y | 472 | CONFIG_XFS_POSIX_ACL=y |
482 | CONFIG_XFS_RT=y | 473 | CONFIG_XFS_RT=y |
483 | CONFIG_GFS2_FS=m | 474 | CONFIG_GFS2_FS=m |
484 | CONFIG_OCFS2_FS=m | 475 | CONFIG_OCFS2_FS=m |
485 | CONFIG_BTRFS_FS=m | 476 | CONFIG_BTRFS_FS=y |
486 | CONFIG_BTRFS_FS_POSIX_ACL=y | 477 | CONFIG_BTRFS_FS_POSIX_ACL=y |
487 | CONFIG_NILFS2_FS=m | 478 | CONFIG_NILFS2_FS=m |
488 | CONFIG_FANOTIFY=y | 479 | CONFIG_FANOTIFY=y |
@@ -550,8 +541,11 @@ CONFIG_TIMER_STATS=y | |||
550 | CONFIG_RCU_TORTURE_TEST=m | 541 | CONFIG_RCU_TORTURE_TEST=m |
551 | CONFIG_RCU_CPU_STALL_TIMEOUT=60 | 542 | CONFIG_RCU_CPU_STALL_TIMEOUT=60 |
552 | CONFIG_LATENCYTOP=y | 543 | CONFIG_LATENCYTOP=y |
544 | CONFIG_SCHED_TRACER=y | ||
545 | CONFIG_FTRACE_SYSCALLS=y | ||
546 | CONFIG_STACK_TRACER=y | ||
553 | CONFIG_BLK_DEV_IO_TRACE=y | 547 | CONFIG_BLK_DEV_IO_TRACE=y |
554 | # CONFIG_KPROBE_EVENT is not set | 548 | CONFIG_UPROBE_EVENT=y |
555 | CONFIG_LKDTM=m | 549 | CONFIG_LKDTM=m |
556 | CONFIG_PERCPU_TEST=m | 550 | CONFIG_PERCPU_TEST=m |
557 | CONFIG_ATOMIC64_SELFTEST=y | 551 | CONFIG_ATOMIC64_SELFTEST=y |
@@ -618,12 +612,6 @@ CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE=m | |||
618 | CONFIG_X509_CERTIFICATE_PARSER=m | 612 | CONFIG_X509_CERTIFICATE_PARSER=m |
619 | CONFIG_CRC7=m | 613 | CONFIG_CRC7=m |
620 | CONFIG_CRC8=m | 614 | CONFIG_CRC8=m |
621 | CONFIG_XZ_DEC_X86=y | ||
622 | CONFIG_XZ_DEC_POWERPC=y | ||
623 | CONFIG_XZ_DEC_IA64=y | ||
624 | CONFIG_XZ_DEC_ARM=y | ||
625 | CONFIG_XZ_DEC_ARMTHUMB=y | ||
626 | CONFIG_XZ_DEC_SPARC=y | ||
627 | CONFIG_CORDIC=m | 615 | CONFIG_CORDIC=m |
628 | CONFIG_CMM=m | 616 | CONFIG_CMM=m |
629 | CONFIG_APPLDATA_BASE=y | 617 | CONFIG_APPLDATA_BASE=y |
diff --git a/arch/s390/configs/zfcpdump_defconfig b/arch/s390/configs/zfcpdump_defconfig index e376789f2d8d..9d63051ebec4 100644 --- a/arch/s390/configs/zfcpdump_defconfig +++ b/arch/s390/configs/zfcpdump_defconfig | |||
@@ -22,8 +22,8 @@ CONFIG_HZ_100=y | |||
22 | CONFIG_CRASH_DUMP=y | 22 | CONFIG_CRASH_DUMP=y |
23 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set | 23 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set |
24 | # CONFIG_SECCOMP is not set | 24 | # CONFIG_SECCOMP is not set |
25 | # CONFIG_IUCV is not set | ||
26 | CONFIG_NET=y | 25 | CONFIG_NET=y |
26 | # CONFIG_IUCV is not set | ||
27 | CONFIG_ATM=y | 27 | CONFIG_ATM=y |
28 | CONFIG_ATM_LANE=y | 28 | CONFIG_ATM_LANE=y |
29 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | 29 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" |
@@ -36,9 +36,9 @@ CONFIG_ENCLOSURE_SERVICES=y | |||
36 | CONFIG_SCSI=y | 36 | CONFIG_SCSI=y |
37 | CONFIG_BLK_DEV_SD=y | 37 | CONFIG_BLK_DEV_SD=y |
38 | CONFIG_SCSI_ENCLOSURE=y | 38 | CONFIG_SCSI_ENCLOSURE=y |
39 | CONFIG_SCSI_MULTI_LUN=y | ||
40 | CONFIG_SCSI_CONSTANTS=y | 39 | CONFIG_SCSI_CONSTANTS=y |
41 | CONFIG_SCSI_LOGGING=y | 40 | CONFIG_SCSI_LOGGING=y |
41 | CONFIG_SCSI_FC_ATTRS=y | ||
42 | CONFIG_SCSI_SRP_ATTRS=y | 42 | CONFIG_SCSI_SRP_ATTRS=y |
43 | CONFIG_ZFCP=y | 43 | CONFIG_ZFCP=y |
44 | # CONFIG_INPUT_MOUSEDEV_PSAUX is not set | 44 | # CONFIG_INPUT_MOUSEDEV_PSAUX is not set |
@@ -75,12 +75,6 @@ CONFIG_DEBUG_KERNEL=y | |||
75 | CONFIG_RCU_CPU_STALL_TIMEOUT=60 | 75 | CONFIG_RCU_CPU_STALL_TIMEOUT=60 |
76 | # CONFIG_FTRACE is not set | 76 | # CONFIG_FTRACE is not set |
77 | # CONFIG_STRICT_DEVMEM is not set | 77 | # CONFIG_STRICT_DEVMEM is not set |
78 | CONFIG_XZ_DEC_X86=y | ||
79 | CONFIG_XZ_DEC_POWERPC=y | ||
80 | CONFIG_XZ_DEC_IA64=y | ||
81 | CONFIG_XZ_DEC_ARM=y | ||
82 | CONFIG_XZ_DEC_ARMTHUMB=y | ||
83 | CONFIG_XZ_DEC_SPARC=y | ||
84 | # CONFIG_PFAULT is not set | 78 | # CONFIG_PFAULT is not set |
85 | # CONFIG_S390_HYPFS_FS is not set | 79 | # CONFIG_S390_HYPFS_FS is not set |
86 | # CONFIG_VIRTUALIZATION is not set | 80 | # CONFIG_VIRTUALIZATION is not set |
diff --git a/arch/s390/defconfig b/arch/s390/defconfig index fab35a8efa4f..785c5f24d6f9 100644 --- a/arch/s390/defconfig +++ b/arch/s390/defconfig | |||
@@ -92,10 +92,10 @@ CONFIG_CHR_DEV_ST=y | |||
92 | CONFIG_BLK_DEV_SR=y | 92 | CONFIG_BLK_DEV_SR=y |
93 | CONFIG_BLK_DEV_SR_VENDOR=y | 93 | CONFIG_BLK_DEV_SR_VENDOR=y |
94 | CONFIG_CHR_DEV_SG=y | 94 | CONFIG_CHR_DEV_SG=y |
95 | CONFIG_SCSI_MULTI_LUN=y | ||
96 | CONFIG_SCSI_CONSTANTS=y | 95 | CONFIG_SCSI_CONSTANTS=y |
97 | CONFIG_SCSI_LOGGING=y | 96 | CONFIG_SCSI_LOGGING=y |
98 | CONFIG_SCSI_SCAN_ASYNC=y | 97 | CONFIG_SCSI_SCAN_ASYNC=y |
98 | CONFIG_SCSI_FC_ATTRS=y | ||
99 | CONFIG_ZFCP=y | 99 | CONFIG_ZFCP=y |
100 | CONFIG_SCSI_VIRTIO=y | 100 | CONFIG_SCSI_VIRTIO=y |
101 | CONFIG_NETDEVICES=y | 101 | CONFIG_NETDEVICES=y |
@@ -164,14 +164,13 @@ CONFIG_CRYPTO_CMAC=m | |||
164 | CONFIG_CRYPTO_XCBC=m | 164 | CONFIG_CRYPTO_XCBC=m |
165 | CONFIG_CRYPTO_VMAC=m | 165 | CONFIG_CRYPTO_VMAC=m |
166 | CONFIG_CRYPTO_CRC32=m | 166 | CONFIG_CRYPTO_CRC32=m |
167 | CONFIG_CRYPTO_CRCT10DIF=m | ||
168 | CONFIG_CRYPTO_MD4=m | 167 | CONFIG_CRYPTO_MD4=m |
169 | CONFIG_CRYPTO_MICHAEL_MIC=m | 168 | CONFIG_CRYPTO_MICHAEL_MIC=m |
170 | CONFIG_CRYPTO_RMD128=m | 169 | CONFIG_CRYPTO_RMD128=m |
171 | CONFIG_CRYPTO_RMD160=m | 170 | CONFIG_CRYPTO_RMD160=m |
172 | CONFIG_CRYPTO_RMD256=m | 171 | CONFIG_CRYPTO_RMD256=m |
173 | CONFIG_CRYPTO_RMD320=m | 172 | CONFIG_CRYPTO_RMD320=m |
174 | CONFIG_CRYPTO_SHA256=m | 173 | CONFIG_CRYPTO_SHA256=y |
175 | CONFIG_CRYPTO_SHA512=m | 174 | CONFIG_CRYPTO_SHA512=m |
176 | CONFIG_CRYPTO_TGR192=m | 175 | CONFIG_CRYPTO_TGR192=m |
177 | CONFIG_CRYPTO_WP512=m | 176 | CONFIG_CRYPTO_WP512=m |
diff --git a/arch/s390/kernel/ftrace.c b/arch/s390/kernel/ftrace.c index 51d14fe5eb9a..ca1cabb3a96c 100644 --- a/arch/s390/kernel/ftrace.c +++ b/arch/s390/kernel/ftrace.c | |||
@@ -121,6 +121,8 @@ unsigned long __kprobes prepare_ftrace_return(unsigned long parent, | |||
121 | { | 121 | { |
122 | struct ftrace_graph_ent trace; | 122 | struct ftrace_graph_ent trace; |
123 | 123 | ||
124 | if (unlikely(ftrace_graph_is_dead())) | ||
125 | goto out; | ||
124 | if (unlikely(atomic_read(¤t->tracing_graph_pause))) | 126 | if (unlikely(atomic_read(¤t->tracing_graph_pause))) |
125 | goto out; | 127 | goto out; |
126 | ip = (ip & PSW_ADDR_INSN) - MCOUNT_INSN_SIZE; | 128 | ip = (ip & PSW_ADDR_INSN) - MCOUNT_INSN_SIZE; |
diff --git a/arch/s390/kernel/perf_cpum_sf.c b/arch/s390/kernel/perf_cpum_sf.c index 08e761318c17..b878f12a9597 100644 --- a/arch/s390/kernel/perf_cpum_sf.c +++ b/arch/s390/kernel/perf_cpum_sf.c | |||
@@ -1411,11 +1411,6 @@ static void cpumsf_pmu_del(struct perf_event *event, int flags) | |||
1411 | perf_pmu_enable(event->pmu); | 1411 | perf_pmu_enable(event->pmu); |
1412 | } | 1412 | } |
1413 | 1413 | ||
1414 | static int cpumsf_pmu_event_idx(struct perf_event *event) | ||
1415 | { | ||
1416 | return event->hw.idx; | ||
1417 | } | ||
1418 | |||
1419 | CPUMF_EVENT_ATTR(SF, SF_CYCLES_BASIC, PERF_EVENT_CPUM_SF); | 1414 | CPUMF_EVENT_ATTR(SF, SF_CYCLES_BASIC, PERF_EVENT_CPUM_SF); |
1420 | CPUMF_EVENT_ATTR(SF, SF_CYCLES_BASIC_DIAG, PERF_EVENT_CPUM_SF_DIAG); | 1415 | CPUMF_EVENT_ATTR(SF, SF_CYCLES_BASIC_DIAG, PERF_EVENT_CPUM_SF_DIAG); |
1421 | 1416 | ||
@@ -1458,7 +1453,6 @@ static struct pmu cpumf_sampling = { | |||
1458 | .stop = cpumsf_pmu_stop, | 1453 | .stop = cpumsf_pmu_stop, |
1459 | .read = cpumsf_pmu_read, | 1454 | .read = cpumsf_pmu_read, |
1460 | 1455 | ||
1461 | .event_idx = cpumsf_pmu_event_idx, | ||
1462 | .attr_groups = cpumsf_pmu_attr_groups, | 1456 | .attr_groups = cpumsf_pmu_attr_groups, |
1463 | }; | 1457 | }; |
1464 | 1458 | ||
diff --git a/arch/s390/kernel/vdso32/clock_gettime.S b/arch/s390/kernel/vdso32/clock_gettime.S index 48c2206a3956..5eec9afbb5b5 100644 --- a/arch/s390/kernel/vdso32/clock_gettime.S +++ b/arch/s390/kernel/vdso32/clock_gettime.S | |||
@@ -19,6 +19,7 @@ | |||
19 | .type __kernel_clock_gettime,@function | 19 | .type __kernel_clock_gettime,@function |
20 | __kernel_clock_gettime: | 20 | __kernel_clock_gettime: |
21 | .cfi_startproc | 21 | .cfi_startproc |
22 | ahi %r15,-16 | ||
22 | basr %r5,0 | 23 | basr %r5,0 |
23 | 0: al %r5,21f-0b(%r5) /* get &_vdso_data */ | 24 | 0: al %r5,21f-0b(%r5) /* get &_vdso_data */ |
24 | chi %r2,__CLOCK_REALTIME_COARSE | 25 | chi %r2,__CLOCK_REALTIME_COARSE |
@@ -34,8 +35,8 @@ __kernel_clock_gettime: | |||
34 | 1: l %r4,__VDSO_UPD_COUNT+4(%r5) /* load update counter */ | 35 | 1: l %r4,__VDSO_UPD_COUNT+4(%r5) /* load update counter */ |
35 | tml %r4,0x0001 /* pending update ? loop */ | 36 | tml %r4,0x0001 /* pending update ? loop */ |
36 | jnz 1b | 37 | jnz 1b |
37 | stcke 24(%r15) /* Store TOD clock */ | 38 | stcke 0(%r15) /* Store TOD clock */ |
38 | lm %r0,%r1,25(%r15) | 39 | lm %r0,%r1,1(%r15) |
39 | s %r0,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ | 40 | s %r0,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ |
40 | sl %r1,__VDSO_XTIME_STAMP+4(%r5) | 41 | sl %r1,__VDSO_XTIME_STAMP+4(%r5) |
41 | brc 3,2f | 42 | brc 3,2f |
@@ -70,6 +71,7 @@ __kernel_clock_gettime: | |||
70 | 8: st %r2,0(%r3) /* store tp->tv_sec */ | 71 | 8: st %r2,0(%r3) /* store tp->tv_sec */ |
71 | st %r1,4(%r3) /* store tp->tv_nsec */ | 72 | st %r1,4(%r3) /* store tp->tv_nsec */ |
72 | lhi %r2,0 | 73 | lhi %r2,0 |
74 | ahi %r15,16 | ||
73 | br %r14 | 75 | br %r14 |
74 | 76 | ||
75 | /* CLOCK_MONOTONIC_COARSE */ | 77 | /* CLOCK_MONOTONIC_COARSE */ |
@@ -96,8 +98,8 @@ __kernel_clock_gettime: | |||
96 | 11: l %r4,__VDSO_UPD_COUNT+4(%r5) /* load update counter */ | 98 | 11: l %r4,__VDSO_UPD_COUNT+4(%r5) /* load update counter */ |
97 | tml %r4,0x0001 /* pending update ? loop */ | 99 | tml %r4,0x0001 /* pending update ? loop */ |
98 | jnz 11b | 100 | jnz 11b |
99 | stcke 24(%r15) /* Store TOD clock */ | 101 | stcke 0(%r15) /* Store TOD clock */ |
100 | lm %r0,%r1,25(%r15) | 102 | lm %r0,%r1,1(%r15) |
101 | s %r0,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ | 103 | s %r0,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ |
102 | sl %r1,__VDSO_XTIME_STAMP+4(%r5) | 104 | sl %r1,__VDSO_XTIME_STAMP+4(%r5) |
103 | brc 3,12f | 105 | brc 3,12f |
@@ -132,11 +134,13 @@ __kernel_clock_gettime: | |||
132 | 17: st %r2,0(%r3) /* store tp->tv_sec */ | 134 | 17: st %r2,0(%r3) /* store tp->tv_sec */ |
133 | st %r1,4(%r3) /* store tp->tv_nsec */ | 135 | st %r1,4(%r3) /* store tp->tv_nsec */ |
134 | lhi %r2,0 | 136 | lhi %r2,0 |
137 | ahi %r15,16 | ||
135 | br %r14 | 138 | br %r14 |
136 | 139 | ||
137 | /* Fallback to system call */ | 140 | /* Fallback to system call */ |
138 | 19: lhi %r1,__NR_clock_gettime | 141 | 19: lhi %r1,__NR_clock_gettime |
139 | svc 0 | 142 | svc 0 |
143 | ahi %r15,16 | ||
140 | br %r14 | 144 | br %r14 |
141 | 145 | ||
142 | 20: .long 1000000000 | 146 | 20: .long 1000000000 |
diff --git a/arch/s390/kernel/vdso32/gettimeofday.S b/arch/s390/kernel/vdso32/gettimeofday.S index 60def5f562db..719de6186b20 100644 --- a/arch/s390/kernel/vdso32/gettimeofday.S +++ b/arch/s390/kernel/vdso32/gettimeofday.S | |||
@@ -19,6 +19,7 @@ | |||
19 | .type __kernel_gettimeofday,@function | 19 | .type __kernel_gettimeofday,@function |
20 | __kernel_gettimeofday: | 20 | __kernel_gettimeofday: |
21 | .cfi_startproc | 21 | .cfi_startproc |
22 | ahi %r15,-16 | ||
22 | basr %r5,0 | 23 | basr %r5,0 |
23 | 0: al %r5,13f-0b(%r5) /* get &_vdso_data */ | 24 | 0: al %r5,13f-0b(%r5) /* get &_vdso_data */ |
24 | 1: ltr %r3,%r3 /* check if tz is NULL */ | 25 | 1: ltr %r3,%r3 /* check if tz is NULL */ |
@@ -29,30 +30,30 @@ __kernel_gettimeofday: | |||
29 | l %r4,__VDSO_UPD_COUNT+4(%r5) /* load update counter */ | 30 | l %r4,__VDSO_UPD_COUNT+4(%r5) /* load update counter */ |
30 | tml %r4,0x0001 /* pending update ? loop */ | 31 | tml %r4,0x0001 /* pending update ? loop */ |
31 | jnz 1b | 32 | jnz 1b |
32 | stcke 24(%r15) /* Store TOD clock */ | 33 | stcke 0(%r15) /* Store TOD clock */ |
33 | lm %r0,%r1,25(%r15) | 34 | lm %r0,%r1,1(%r15) |
34 | s %r0,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ | 35 | s %r0,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ |
35 | sl %r1,__VDSO_XTIME_STAMP+4(%r5) | 36 | sl %r1,__VDSO_XTIME_STAMP+4(%r5) |
36 | brc 3,3f | 37 | brc 3,3f |
37 | ahi %r0,-1 | 38 | ahi %r0,-1 |
38 | 3: ms %r0,__VDSO_TK_MULT(%r5) /* * tk->mult */ | 39 | 3: ms %r0,__VDSO_TK_MULT(%r5) /* * tk->mult */ |
39 | st %r0,24(%r15) | 40 | st %r0,0(%r15) |
40 | l %r0,__VDSO_TK_MULT(%r5) | 41 | l %r0,__VDSO_TK_MULT(%r5) |
41 | ltr %r1,%r1 | 42 | ltr %r1,%r1 |
42 | mr %r0,%r0 | 43 | mr %r0,%r0 |
43 | jnm 4f | 44 | jnm 4f |
44 | a %r0,__VDSO_TK_MULT(%r5) | 45 | a %r0,__VDSO_TK_MULT(%r5) |
45 | 4: al %r0,24(%r15) | 46 | 4: al %r0,0(%r15) |
46 | al %r0,__VDSO_XTIME_NSEC(%r5) /* + xtime */ | 47 | al %r0,__VDSO_XTIME_NSEC(%r5) /* + xtime */ |
47 | al %r1,__VDSO_XTIME_NSEC+4(%r5) | 48 | al %r1,__VDSO_XTIME_NSEC+4(%r5) |
48 | brc 12,5f | 49 | brc 12,5f |
49 | ahi %r0,1 | 50 | ahi %r0,1 |
50 | 5: mvc 24(4,%r15),__VDSO_XTIME_SEC+4(%r5) | 51 | 5: mvc 0(4,%r15),__VDSO_XTIME_SEC+4(%r5) |
51 | cl %r4,__VDSO_UPD_COUNT+4(%r5) /* check update counter */ | 52 | cl %r4,__VDSO_UPD_COUNT+4(%r5) /* check update counter */ |
52 | jne 1b | 53 | jne 1b |
53 | l %r4,__VDSO_TK_SHIFT(%r5) /* Timekeeper shift */ | 54 | l %r4,__VDSO_TK_SHIFT(%r5) /* Timekeeper shift */ |
54 | srdl %r0,0(%r4) /* >> tk->shift */ | 55 | srdl %r0,0(%r4) /* >> tk->shift */ |
55 | l %r4,24(%r15) /* get tv_sec from stack */ | 56 | l %r4,0(%r15) /* get tv_sec from stack */ |
56 | basr %r5,0 | 57 | basr %r5,0 |
57 | 6: ltr %r0,%r0 | 58 | 6: ltr %r0,%r0 |
58 | jnz 7f | 59 | jnz 7f |
@@ -71,6 +72,7 @@ __kernel_gettimeofday: | |||
71 | 9: srl %r0,6 | 72 | 9: srl %r0,6 |
72 | st %r0,4(%r2) /* store tv->tv_usec */ | 73 | st %r0,4(%r2) /* store tv->tv_usec */ |
73 | 10: slr %r2,%r2 | 74 | 10: slr %r2,%r2 |
75 | ahi %r15,16 | ||
74 | br %r14 | 76 | br %r14 |
75 | 11: .long 1000000000 | 77 | 11: .long 1000000000 |
76 | 12: .long 274877907 | 78 | 12: .long 274877907 |
diff --git a/arch/s390/kernel/vdso64/clock_gettime.S b/arch/s390/kernel/vdso64/clock_gettime.S index 9d9761f8e110..7699e735ae28 100644 --- a/arch/s390/kernel/vdso64/clock_gettime.S +++ b/arch/s390/kernel/vdso64/clock_gettime.S | |||
@@ -19,6 +19,7 @@ | |||
19 | .type __kernel_clock_gettime,@function | 19 | .type __kernel_clock_gettime,@function |
20 | __kernel_clock_gettime: | 20 | __kernel_clock_gettime: |
21 | .cfi_startproc | 21 | .cfi_startproc |
22 | aghi %r15,-16 | ||
22 | larl %r5,_vdso_data | 23 | larl %r5,_vdso_data |
23 | cghi %r2,__CLOCK_REALTIME_COARSE | 24 | cghi %r2,__CLOCK_REALTIME_COARSE |
24 | je 4f | 25 | je 4f |
@@ -37,10 +38,10 @@ __kernel_clock_gettime: | |||
37 | 0: lg %r4,__VDSO_UPD_COUNT(%r5) /* load update counter */ | 38 | 0: lg %r4,__VDSO_UPD_COUNT(%r5) /* load update counter */ |
38 | tmll %r4,0x0001 /* pending update ? loop */ | 39 | tmll %r4,0x0001 /* pending update ? loop */ |
39 | jnz 0b | 40 | jnz 0b |
40 | stcke 48(%r15) /* Store TOD clock */ | 41 | stcke 0(%r15) /* Store TOD clock */ |
41 | lgf %r2,__VDSO_TK_SHIFT(%r5) /* Timekeeper shift */ | 42 | lgf %r2,__VDSO_TK_SHIFT(%r5) /* Timekeeper shift */ |
42 | lg %r0,__VDSO_WTOM_SEC(%r5) | 43 | lg %r0,__VDSO_WTOM_SEC(%r5) |
43 | lg %r1,49(%r15) | 44 | lg %r1,1(%r15) |
44 | sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ | 45 | sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ |
45 | msgf %r1,__VDSO_TK_MULT(%r5) /* * tk->mult */ | 46 | msgf %r1,__VDSO_TK_MULT(%r5) /* * tk->mult */ |
46 | alg %r1,__VDSO_WTOM_NSEC(%r5) | 47 | alg %r1,__VDSO_WTOM_NSEC(%r5) |
@@ -56,6 +57,7 @@ __kernel_clock_gettime: | |||
56 | 2: stg %r0,0(%r3) /* store tp->tv_sec */ | 57 | 2: stg %r0,0(%r3) /* store tp->tv_sec */ |
57 | stg %r1,8(%r3) /* store tp->tv_nsec */ | 58 | stg %r1,8(%r3) /* store tp->tv_nsec */ |
58 | lghi %r2,0 | 59 | lghi %r2,0 |
60 | aghi %r15,16 | ||
59 | br %r14 | 61 | br %r14 |
60 | 62 | ||
61 | /* CLOCK_MONOTONIC_COARSE */ | 63 | /* CLOCK_MONOTONIC_COARSE */ |
@@ -82,9 +84,9 @@ __kernel_clock_gettime: | |||
82 | 5: lg %r4,__VDSO_UPD_COUNT(%r5) /* load update counter */ | 84 | 5: lg %r4,__VDSO_UPD_COUNT(%r5) /* load update counter */ |
83 | tmll %r4,0x0001 /* pending update ? loop */ | 85 | tmll %r4,0x0001 /* pending update ? loop */ |
84 | jnz 5b | 86 | jnz 5b |
85 | stcke 48(%r15) /* Store TOD clock */ | 87 | stcke 0(%r15) /* Store TOD clock */ |
86 | lgf %r2,__VDSO_TK_SHIFT(%r5) /* Timekeeper shift */ | 88 | lgf %r2,__VDSO_TK_SHIFT(%r5) /* Timekeeper shift */ |
87 | lg %r1,49(%r15) | 89 | lg %r1,1(%r15) |
88 | sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ | 90 | sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ |
89 | msgf %r1,__VDSO_TK_MULT(%r5) /* * tk->mult */ | 91 | msgf %r1,__VDSO_TK_MULT(%r5) /* * tk->mult */ |
90 | alg %r1,__VDSO_XTIME_NSEC(%r5) /* + tk->xtime_nsec */ | 92 | alg %r1,__VDSO_XTIME_NSEC(%r5) /* + tk->xtime_nsec */ |
@@ -101,6 +103,7 @@ __kernel_clock_gettime: | |||
101 | 7: stg %r0,0(%r3) /* store tp->tv_sec */ | 103 | 7: stg %r0,0(%r3) /* store tp->tv_sec */ |
102 | stg %r1,8(%r3) /* store tp->tv_nsec */ | 104 | stg %r1,8(%r3) /* store tp->tv_nsec */ |
103 | lghi %r2,0 | 105 | lghi %r2,0 |
106 | aghi %r15,16 | ||
104 | br %r14 | 107 | br %r14 |
105 | 108 | ||
106 | /* CLOCK_THREAD_CPUTIME_ID for this thread */ | 109 | /* CLOCK_THREAD_CPUTIME_ID for this thread */ |
@@ -134,11 +137,13 @@ __kernel_clock_gettime: | |||
134 | slgr %r4,%r0 /* r4 = tv_nsec */ | 137 | slgr %r4,%r0 /* r4 = tv_nsec */ |
135 | stg %r4,8(%r3) | 138 | stg %r4,8(%r3) |
136 | lghi %r2,0 | 139 | lghi %r2,0 |
140 | aghi %r15,16 | ||
137 | br %r14 | 141 | br %r14 |
138 | 142 | ||
139 | /* Fallback to system call */ | 143 | /* Fallback to system call */ |
140 | 12: lghi %r1,__NR_clock_gettime | 144 | 12: lghi %r1,__NR_clock_gettime |
141 | svc 0 | 145 | svc 0 |
146 | aghi %r15,16 | ||
142 | br %r14 | 147 | br %r14 |
143 | 148 | ||
144 | 13: .quad 1000000000 | 149 | 13: .quad 1000000000 |
diff --git a/arch/s390/kernel/vdso64/gettimeofday.S b/arch/s390/kernel/vdso64/gettimeofday.S index 7a344995a97f..6ce46707663c 100644 --- a/arch/s390/kernel/vdso64/gettimeofday.S +++ b/arch/s390/kernel/vdso64/gettimeofday.S | |||
@@ -19,6 +19,7 @@ | |||
19 | .type __kernel_gettimeofday,@function | 19 | .type __kernel_gettimeofday,@function |
20 | __kernel_gettimeofday: | 20 | __kernel_gettimeofday: |
21 | .cfi_startproc | 21 | .cfi_startproc |
22 | aghi %r15,-16 | ||
22 | larl %r5,_vdso_data | 23 | larl %r5,_vdso_data |
23 | 0: ltgr %r3,%r3 /* check if tz is NULL */ | 24 | 0: ltgr %r3,%r3 /* check if tz is NULL */ |
24 | je 1f | 25 | je 1f |
@@ -28,8 +29,8 @@ __kernel_gettimeofday: | |||
28 | lg %r4,__VDSO_UPD_COUNT(%r5) /* load update counter */ | 29 | lg %r4,__VDSO_UPD_COUNT(%r5) /* load update counter */ |
29 | tmll %r4,0x0001 /* pending update ? loop */ | 30 | tmll %r4,0x0001 /* pending update ? loop */ |
30 | jnz 0b | 31 | jnz 0b |
31 | stcke 48(%r15) /* Store TOD clock */ | 32 | stcke 0(%r15) /* Store TOD clock */ |
32 | lg %r1,49(%r15) | 33 | lg %r1,1(%r15) |
33 | sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ | 34 | sg %r1,__VDSO_XTIME_STAMP(%r5) /* TOD - cycle_last */ |
34 | msgf %r1,__VDSO_TK_MULT(%r5) /* * tk->mult */ | 35 | msgf %r1,__VDSO_TK_MULT(%r5) /* * tk->mult */ |
35 | alg %r1,__VDSO_XTIME_NSEC(%r5) /* + tk->xtime_nsec */ | 36 | alg %r1,__VDSO_XTIME_NSEC(%r5) /* + tk->xtime_nsec */ |
@@ -50,6 +51,7 @@ __kernel_gettimeofday: | |||
50 | srlg %r0,%r0,6 | 51 | srlg %r0,%r0,6 |
51 | stg %r0,8(%r2) /* store tv->tv_usec */ | 52 | stg %r0,8(%r2) /* store tv->tv_usec */ |
52 | 4: lghi %r2,0 | 53 | 4: lghi %r2,0 |
54 | aghi %r15,16 | ||
53 | br %r14 | 55 | br %r14 |
54 | 5: .quad 1000000000 | 56 | 5: .quad 1000000000 |
55 | .long 274877907 | 57 | .long 274877907 |
diff --git a/arch/s390/kernel/vtime.c b/arch/s390/kernel/vtime.c index 416f2a323ba5..7f0089d9a4aa 100644 --- a/arch/s390/kernel/vtime.c +++ b/arch/s390/kernel/vtime.c | |||
@@ -66,7 +66,11 @@ static int do_account_vtime(struct task_struct *tsk, int hardirq_offset) | |||
66 | clock = S390_lowcore.last_update_clock; | 66 | clock = S390_lowcore.last_update_clock; |
67 | asm volatile( | 67 | asm volatile( |
68 | " stpt %0\n" /* Store current cpu timer value */ | 68 | " stpt %0\n" /* Store current cpu timer value */ |
69 | #ifdef CONFIG_HAVE_MARCH_Z9_109_FEATURES | ||
70 | " stckf %1" /* Store current tod clock value */ | ||
71 | #else | ||
69 | " stck %1" /* Store current tod clock value */ | 72 | " stck %1" /* Store current tod clock value */ |
73 | #endif | ||
70 | : "=m" (S390_lowcore.last_update_timer), | 74 | : "=m" (S390_lowcore.last_update_timer), |
71 | "=m" (S390_lowcore.last_update_clock)); | 75 | "=m" (S390_lowcore.last_update_clock)); |
72 | S390_lowcore.system_timer += timer - S390_lowcore.last_update_timer; | 76 | S390_lowcore.system_timer += timer - S390_lowcore.last_update_timer; |
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh770x.c b/arch/sh/kernel/cpu/sh3/setup-sh770x.c index 9139d14b9c53..538c10db3537 100644 --- a/arch/sh/kernel/cpu/sh3/setup-sh770x.c +++ b/arch/sh/kernel/cpu/sh3/setup-sh770x.c | |||
@@ -118,7 +118,7 @@ static struct plat_sci_port scif0_platform_data = { | |||
118 | }; | 118 | }; |
119 | 119 | ||
120 | static struct resource scif0_resources[] = { | 120 | static struct resource scif0_resources[] = { |
121 | DEFINE_RES_MEM(0xfffffe80, 0x100), | 121 | DEFINE_RES_MEM(0xfffffe80, 0x10), |
122 | DEFINE_RES_IRQ(evt2irq(0x4e0)), | 122 | DEFINE_RES_IRQ(evt2irq(0x4e0)), |
123 | }; | 123 | }; |
124 | 124 | ||
@@ -143,7 +143,7 @@ static struct plat_sci_port scif1_platform_data = { | |||
143 | }; | 143 | }; |
144 | 144 | ||
145 | static struct resource scif1_resources[] = { | 145 | static struct resource scif1_resources[] = { |
146 | DEFINE_RES_MEM(0xa4000150, 0x100), | 146 | DEFINE_RES_MEM(0xa4000150, 0x10), |
147 | DEFINE_RES_IRQ(evt2irq(0x900)), | 147 | DEFINE_RES_IRQ(evt2irq(0x900)), |
148 | }; | 148 | }; |
149 | 149 | ||
@@ -169,7 +169,7 @@ static struct plat_sci_port scif2_platform_data = { | |||
169 | }; | 169 | }; |
170 | 170 | ||
171 | static struct resource scif2_resources[] = { | 171 | static struct resource scif2_resources[] = { |
172 | DEFINE_RES_MEM(0xa4000140, 0x100), | 172 | DEFINE_RES_MEM(0xa4000140, 0x10), |
173 | DEFINE_RES_IRQ(evt2irq(0x880)), | 173 | DEFINE_RES_IRQ(evt2irq(0x880)), |
174 | }; | 174 | }; |
175 | 175 | ||
diff --git a/arch/sparc/include/asm/atomic_32.h b/arch/sparc/include/asm/atomic_32.h index 765c1776ec9f..0e69b7e7a439 100644 --- a/arch/sparc/include/asm/atomic_32.h +++ b/arch/sparc/include/asm/atomic_32.h | |||
@@ -22,7 +22,7 @@ | |||
22 | 22 | ||
23 | int atomic_add_return(int, atomic_t *); | 23 | int atomic_add_return(int, atomic_t *); |
24 | int atomic_cmpxchg(atomic_t *, int, int); | 24 | int atomic_cmpxchg(atomic_t *, int, int); |
25 | #define atomic_xchg(v, new) (xchg(&((v)->counter), new)) | 25 | int atomic_xchg(atomic_t *, int); |
26 | int __atomic_add_unless(atomic_t *, int, int); | 26 | int __atomic_add_unless(atomic_t *, int, int); |
27 | void atomic_set(atomic_t *, int); | 27 | void atomic_set(atomic_t *, int); |
28 | 28 | ||
diff --git a/arch/sparc/include/asm/cmpxchg_32.h b/arch/sparc/include/asm/cmpxchg_32.h index 32c29a133f9d..d38b52dca216 100644 --- a/arch/sparc/include/asm/cmpxchg_32.h +++ b/arch/sparc/include/asm/cmpxchg_32.h | |||
@@ -11,22 +11,14 @@ | |||
11 | #ifndef __ARCH_SPARC_CMPXCHG__ | 11 | #ifndef __ARCH_SPARC_CMPXCHG__ |
12 | #define __ARCH_SPARC_CMPXCHG__ | 12 | #define __ARCH_SPARC_CMPXCHG__ |
13 | 13 | ||
14 | static inline unsigned long xchg_u32(__volatile__ unsigned long *m, unsigned long val) | 14 | unsigned long __xchg_u32(volatile u32 *m, u32 new); |
15 | { | ||
16 | __asm__ __volatile__("swap [%2], %0" | ||
17 | : "=&r" (val) | ||
18 | : "0" (val), "r" (m) | ||
19 | : "memory"); | ||
20 | return val; | ||
21 | } | ||
22 | |||
23 | void __xchg_called_with_bad_pointer(void); | 15 | void __xchg_called_with_bad_pointer(void); |
24 | 16 | ||
25 | static inline unsigned long __xchg(unsigned long x, __volatile__ void * ptr, int size) | 17 | static inline unsigned long __xchg(unsigned long x, __volatile__ void * ptr, int size) |
26 | { | 18 | { |
27 | switch (size) { | 19 | switch (size) { |
28 | case 4: | 20 | case 4: |
29 | return xchg_u32(ptr, x); | 21 | return __xchg_u32(ptr, x); |
30 | } | 22 | } |
31 | __xchg_called_with_bad_pointer(); | 23 | __xchg_called_with_bad_pointer(); |
32 | return x; | 24 | return x; |
diff --git a/arch/sparc/include/uapi/asm/swab.h b/arch/sparc/include/uapi/asm/swab.h index a34ad079487e..4c7c12d69bea 100644 --- a/arch/sparc/include/uapi/asm/swab.h +++ b/arch/sparc/include/uapi/asm/swab.h | |||
@@ -9,9 +9,9 @@ static inline __u16 __arch_swab16p(const __u16 *addr) | |||
9 | { | 9 | { |
10 | __u16 ret; | 10 | __u16 ret; |
11 | 11 | ||
12 | __asm__ __volatile__ ("lduha [%1] %2, %0" | 12 | __asm__ __volatile__ ("lduha [%2] %3, %0" |
13 | : "=r" (ret) | 13 | : "=r" (ret) |
14 | : "r" (addr), "i" (ASI_PL)); | 14 | : "m" (*addr), "r" (addr), "i" (ASI_PL)); |
15 | return ret; | 15 | return ret; |
16 | } | 16 | } |
17 | #define __arch_swab16p __arch_swab16p | 17 | #define __arch_swab16p __arch_swab16p |
@@ -20,9 +20,9 @@ static inline __u32 __arch_swab32p(const __u32 *addr) | |||
20 | { | 20 | { |
21 | __u32 ret; | 21 | __u32 ret; |
22 | 22 | ||
23 | __asm__ __volatile__ ("lduwa [%1] %2, %0" | 23 | __asm__ __volatile__ ("lduwa [%2] %3, %0" |
24 | : "=r" (ret) | 24 | : "=r" (ret) |
25 | : "r" (addr), "i" (ASI_PL)); | 25 | : "m" (*addr), "r" (addr), "i" (ASI_PL)); |
26 | return ret; | 26 | return ret; |
27 | } | 27 | } |
28 | #define __arch_swab32p __arch_swab32p | 28 | #define __arch_swab32p __arch_swab32p |
@@ -31,9 +31,9 @@ static inline __u64 __arch_swab64p(const __u64 *addr) | |||
31 | { | 31 | { |
32 | __u64 ret; | 32 | __u64 ret; |
33 | 33 | ||
34 | __asm__ __volatile__ ("ldxa [%1] %2, %0" | 34 | __asm__ __volatile__ ("ldxa [%2] %3, %0" |
35 | : "=r" (ret) | 35 | : "=r" (ret) |
36 | : "r" (addr), "i" (ASI_PL)); | 36 | : "m" (*addr), "r" (addr), "i" (ASI_PL)); |
37 | return ret; | 37 | return ret; |
38 | } | 38 | } |
39 | #define __arch_swab64p __arch_swab64p | 39 | #define __arch_swab64p __arch_swab64p |
diff --git a/arch/sparc/include/uapi/asm/unistd.h b/arch/sparc/include/uapi/asm/unistd.h index c842a89b1190..46d83842eddc 100644 --- a/arch/sparc/include/uapi/asm/unistd.h +++ b/arch/sparc/include/uapi/asm/unistd.h | |||
@@ -414,8 +414,9 @@ | |||
414 | #define __NR_seccomp 346 | 414 | #define __NR_seccomp 346 |
415 | #define __NR_getrandom 347 | 415 | #define __NR_getrandom 347 |
416 | #define __NR_memfd_create 348 | 416 | #define __NR_memfd_create 348 |
417 | #define __NR_bpf 349 | ||
417 | 418 | ||
418 | #define NR_syscalls 349 | 419 | #define NR_syscalls 350 |
419 | 420 | ||
420 | /* Bitmask values returned from kern_features system call. */ | 421 | /* Bitmask values returned from kern_features system call. */ |
421 | #define KERN_FEATURE_MIXED_MODE_STACK 0x00000001 | 422 | #define KERN_FEATURE_MIXED_MODE_STACK 0x00000001 |
diff --git a/arch/sparc/kernel/pci_schizo.c b/arch/sparc/kernel/pci_schizo.c index 8f76f23dac38..f9c6813c132d 100644 --- a/arch/sparc/kernel/pci_schizo.c +++ b/arch/sparc/kernel/pci_schizo.c | |||
@@ -581,7 +581,7 @@ static irqreturn_t schizo_pcierr_intr_other(struct pci_pbm_info *pbm) | |||
581 | { | 581 | { |
582 | unsigned long csr_reg, csr, csr_error_bits; | 582 | unsigned long csr_reg, csr, csr_error_bits; |
583 | irqreturn_t ret = IRQ_NONE; | 583 | irqreturn_t ret = IRQ_NONE; |
584 | u16 stat; | 584 | u32 stat; |
585 | 585 | ||
586 | csr_reg = pbm->pbm_regs + SCHIZO_PCI_CTRL; | 586 | csr_reg = pbm->pbm_regs + SCHIZO_PCI_CTRL; |
587 | csr = upa_readq(csr_reg); | 587 | csr = upa_readq(csr_reg); |
@@ -617,7 +617,7 @@ static irqreturn_t schizo_pcierr_intr_other(struct pci_pbm_info *pbm) | |||
617 | pbm->name); | 617 | pbm->name); |
618 | ret = IRQ_HANDLED; | 618 | ret = IRQ_HANDLED; |
619 | } | 619 | } |
620 | pci_read_config_word(pbm->pci_bus->self, PCI_STATUS, &stat); | 620 | pbm->pci_ops->read(pbm->pci_bus, 0, PCI_STATUS, 2, &stat); |
621 | if (stat & (PCI_STATUS_PARITY | | 621 | if (stat & (PCI_STATUS_PARITY | |
622 | PCI_STATUS_SIG_TARGET_ABORT | | 622 | PCI_STATUS_SIG_TARGET_ABORT | |
623 | PCI_STATUS_REC_TARGET_ABORT | | 623 | PCI_STATUS_REC_TARGET_ABORT | |
@@ -625,7 +625,7 @@ static irqreturn_t schizo_pcierr_intr_other(struct pci_pbm_info *pbm) | |||
625 | PCI_STATUS_SIG_SYSTEM_ERROR)) { | 625 | PCI_STATUS_SIG_SYSTEM_ERROR)) { |
626 | printk("%s: PCI bus error, PCI_STATUS[%04x]\n", | 626 | printk("%s: PCI bus error, PCI_STATUS[%04x]\n", |
627 | pbm->name, stat); | 627 | pbm->name, stat); |
628 | pci_write_config_word(pbm->pci_bus->self, PCI_STATUS, 0xffff); | 628 | pbm->pci_ops->write(pbm->pci_bus, 0, PCI_STATUS, 2, 0xffff); |
629 | ret = IRQ_HANDLED; | 629 | ret = IRQ_HANDLED; |
630 | } | 630 | } |
631 | return ret; | 631 | return ret; |
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c index 302c476413d5..da6f1a7fc4db 100644 --- a/arch/sparc/kernel/smp_64.c +++ b/arch/sparc/kernel/smp_64.c | |||
@@ -816,13 +816,17 @@ void arch_send_call_function_single_ipi(int cpu) | |||
816 | void __irq_entry smp_call_function_client(int irq, struct pt_regs *regs) | 816 | void __irq_entry smp_call_function_client(int irq, struct pt_regs *regs) |
817 | { | 817 | { |
818 | clear_softint(1 << irq); | 818 | clear_softint(1 << irq); |
819 | irq_enter(); | ||
819 | generic_smp_call_function_interrupt(); | 820 | generic_smp_call_function_interrupt(); |
821 | irq_exit(); | ||
820 | } | 822 | } |
821 | 823 | ||
822 | void __irq_entry smp_call_function_single_client(int irq, struct pt_regs *regs) | 824 | void __irq_entry smp_call_function_single_client(int irq, struct pt_regs *regs) |
823 | { | 825 | { |
824 | clear_softint(1 << irq); | 826 | clear_softint(1 << irq); |
827 | irq_enter(); | ||
825 | generic_smp_call_function_single_interrupt(); | 828 | generic_smp_call_function_single_interrupt(); |
829 | irq_exit(); | ||
826 | } | 830 | } |
827 | 831 | ||
828 | static void tsb_sync(void *info) | 832 | static void tsb_sync(void *info) |
diff --git a/arch/sparc/kernel/systbls_32.S b/arch/sparc/kernel/systbls_32.S index 6a873c344bc0..ad0cdf497b78 100644 --- a/arch/sparc/kernel/systbls_32.S +++ b/arch/sparc/kernel/systbls_32.S | |||
@@ -86,4 +86,4 @@ sys_call_table: | |||
86 | /*330*/ .long sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime | 86 | /*330*/ .long sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime |
87 | /*335*/ .long sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev | 87 | /*335*/ .long sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev |
88 | /*340*/ .long sys_ni_syscall, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr | 88 | /*340*/ .long sys_ni_syscall, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr |
89 | /*345*/ .long sys_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create | 89 | /*345*/ .long sys_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create, sys_bpf |
diff --git a/arch/sparc/kernel/systbls_64.S b/arch/sparc/kernel/systbls_64.S index d9151b6490d8..580cde9370c9 100644 --- a/arch/sparc/kernel/systbls_64.S +++ b/arch/sparc/kernel/systbls_64.S | |||
@@ -87,7 +87,7 @@ sys_call_table32: | |||
87 | /*330*/ .word compat_sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, compat_sys_open_by_handle_at, compat_sys_clock_adjtime | 87 | /*330*/ .word compat_sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, compat_sys_open_by_handle_at, compat_sys_clock_adjtime |
88 | .word sys_syncfs, compat_sys_sendmmsg, sys_setns, compat_sys_process_vm_readv, compat_sys_process_vm_writev | 88 | .word sys_syncfs, compat_sys_sendmmsg, sys_setns, compat_sys_process_vm_readv, compat_sys_process_vm_writev |
89 | /*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr | 89 | /*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr |
90 | .word sys32_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create | 90 | .word sys32_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create, sys_bpf |
91 | 91 | ||
92 | #endif /* CONFIG_COMPAT */ | 92 | #endif /* CONFIG_COMPAT */ |
93 | 93 | ||
@@ -166,4 +166,4 @@ sys_call_table: | |||
166 | /*330*/ .word sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime | 166 | /*330*/ .word sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime |
167 | .word sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev | 167 | .word sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev |
168 | /*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr | 168 | /*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr |
169 | .word sys_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create | 169 | .word sys_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create, sys_bpf |
diff --git a/arch/sparc/lib/atomic32.c b/arch/sparc/lib/atomic32.c index a7c418ac26af..71cd65ab200c 100644 --- a/arch/sparc/lib/atomic32.c +++ b/arch/sparc/lib/atomic32.c | |||
@@ -45,6 +45,19 @@ ATOMIC_OP(add, +=) | |||
45 | 45 | ||
46 | #undef ATOMIC_OP | 46 | #undef ATOMIC_OP |
47 | 47 | ||
48 | int atomic_xchg(atomic_t *v, int new) | ||
49 | { | ||
50 | int ret; | ||
51 | unsigned long flags; | ||
52 | |||
53 | spin_lock_irqsave(ATOMIC_HASH(v), flags); | ||
54 | ret = v->counter; | ||
55 | v->counter = new; | ||
56 | spin_unlock_irqrestore(ATOMIC_HASH(v), flags); | ||
57 | return ret; | ||
58 | } | ||
59 | EXPORT_SYMBOL(atomic_xchg); | ||
60 | |||
48 | int atomic_cmpxchg(atomic_t *v, int old, int new) | 61 | int atomic_cmpxchg(atomic_t *v, int old, int new) |
49 | { | 62 | { |
50 | int ret; | 63 | int ret; |
@@ -137,3 +150,17 @@ unsigned long __cmpxchg_u32(volatile u32 *ptr, u32 old, u32 new) | |||
137 | return (unsigned long)prev; | 150 | return (unsigned long)prev; |
138 | } | 151 | } |
139 | EXPORT_SYMBOL(__cmpxchg_u32); | 152 | EXPORT_SYMBOL(__cmpxchg_u32); |
153 | |||
154 | unsigned long __xchg_u32(volatile u32 *ptr, u32 new) | ||
155 | { | ||
156 | unsigned long flags; | ||
157 | u32 prev; | ||
158 | |||
159 | spin_lock_irqsave(ATOMIC_HASH(ptr), flags); | ||
160 | prev = *ptr; | ||
161 | *ptr = new; | ||
162 | spin_unlock_irqrestore(ATOMIC_HASH(ptr), flags); | ||
163 | |||
164 | return (unsigned long)prev; | ||
165 | } | ||
166 | EXPORT_SYMBOL(__xchg_u32); | ||
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index f2327e88e07c..ded8a6774ac9 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -142,6 +142,10 @@ config INSTRUCTION_DECODER | |||
142 | def_bool y | 142 | def_bool y |
143 | depends on KPROBES || PERF_EVENTS || UPROBES | 143 | depends on KPROBES || PERF_EVENTS || UPROBES |
144 | 144 | ||
145 | config PERF_EVENTS_INTEL_UNCORE | ||
146 | def_bool y | ||
147 | depends on PERF_EVENTS && SUP_SUP_INTEL && PCI | ||
148 | |||
145 | config OUTPUT_FORMAT | 149 | config OUTPUT_FORMAT |
146 | string | 150 | string |
147 | default "elf32-i386" if X86_32 | 151 | default "elf32-i386" if X86_32 |
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile index 704f58aa79cd..be1e07d4b596 100644 --- a/arch/x86/boot/compressed/Makefile +++ b/arch/x86/boot/compressed/Makefile | |||
@@ -76,8 +76,10 @@ suffix-$(CONFIG_KERNEL_XZ) := xz | |||
76 | suffix-$(CONFIG_KERNEL_LZO) := lzo | 76 | suffix-$(CONFIG_KERNEL_LZO) := lzo |
77 | suffix-$(CONFIG_KERNEL_LZ4) := lz4 | 77 | suffix-$(CONFIG_KERNEL_LZ4) := lz4 |
78 | 78 | ||
79 | RUN_SIZE = $(shell objdump -h vmlinux | \ | ||
80 | perl $(srctree)/arch/x86/tools/calc_run_size.pl) | ||
79 | quiet_cmd_mkpiggy = MKPIGGY $@ | 81 | quiet_cmd_mkpiggy = MKPIGGY $@ |
80 | cmd_mkpiggy = $(obj)/mkpiggy $< > $@ || ( rm -f $@ ; false ) | 82 | cmd_mkpiggy = $(obj)/mkpiggy $< $(RUN_SIZE) > $@ || ( rm -f $@ ; false ) |
81 | 83 | ||
82 | targets += piggy.S | 84 | targets += piggy.S |
83 | $(obj)/piggy.S: $(obj)/vmlinux.bin.$(suffix-y) $(obj)/mkpiggy FORCE | 85 | $(obj)/piggy.S: $(obj)/vmlinux.bin.$(suffix-y) $(obj)/mkpiggy FORCE |
diff --git a/arch/x86/boot/compressed/head_32.S b/arch/x86/boot/compressed/head_32.S index cbed1407a5cd..1d7fbbcc196d 100644 --- a/arch/x86/boot/compressed/head_32.S +++ b/arch/x86/boot/compressed/head_32.S | |||
@@ -207,7 +207,8 @@ relocated: | |||
207 | * Do the decompression, and jump to the new kernel.. | 207 | * Do the decompression, and jump to the new kernel.. |
208 | */ | 208 | */ |
209 | /* push arguments for decompress_kernel: */ | 209 | /* push arguments for decompress_kernel: */ |
210 | pushl $z_output_len /* decompressed length */ | 210 | pushl $z_run_size /* size of kernel with .bss and .brk */ |
211 | pushl $z_output_len /* decompressed length, end of relocs */ | ||
211 | leal z_extract_offset_negative(%ebx), %ebp | 212 | leal z_extract_offset_negative(%ebx), %ebp |
212 | pushl %ebp /* output address */ | 213 | pushl %ebp /* output address */ |
213 | pushl $z_input_len /* input_len */ | 214 | pushl $z_input_len /* input_len */ |
@@ -217,7 +218,7 @@ relocated: | |||
217 | pushl %eax /* heap area */ | 218 | pushl %eax /* heap area */ |
218 | pushl %esi /* real mode pointer */ | 219 | pushl %esi /* real mode pointer */ |
219 | call decompress_kernel /* returns kernel location in %eax */ | 220 | call decompress_kernel /* returns kernel location in %eax */ |
220 | addl $24, %esp | 221 | addl $28, %esp |
221 | 222 | ||
222 | /* | 223 | /* |
223 | * Jump to the decompressed kernel. | 224 | * Jump to the decompressed kernel. |
diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S index 2884e0c3e8a5..6b1766c6c082 100644 --- a/arch/x86/boot/compressed/head_64.S +++ b/arch/x86/boot/compressed/head_64.S | |||
@@ -402,13 +402,16 @@ relocated: | |||
402 | * Do the decompression, and jump to the new kernel.. | 402 | * Do the decompression, and jump to the new kernel.. |
403 | */ | 403 | */ |
404 | pushq %rsi /* Save the real mode argument */ | 404 | pushq %rsi /* Save the real mode argument */ |
405 | movq $z_run_size, %r9 /* size of kernel with .bss and .brk */ | ||
406 | pushq %r9 | ||
405 | movq %rsi, %rdi /* real mode address */ | 407 | movq %rsi, %rdi /* real mode address */ |
406 | leaq boot_heap(%rip), %rsi /* malloc area for uncompression */ | 408 | leaq boot_heap(%rip), %rsi /* malloc area for uncompression */ |
407 | leaq input_data(%rip), %rdx /* input_data */ | 409 | leaq input_data(%rip), %rdx /* input_data */ |
408 | movl $z_input_len, %ecx /* input_len */ | 410 | movl $z_input_len, %ecx /* input_len */ |
409 | movq %rbp, %r8 /* output target address */ | 411 | movq %rbp, %r8 /* output target address */ |
410 | movq $z_output_len, %r9 /* decompressed length */ | 412 | movq $z_output_len, %r9 /* decompressed length, end of relocs */ |
411 | call decompress_kernel /* returns kernel location in %rax */ | 413 | call decompress_kernel /* returns kernel location in %rax */ |
414 | popq %r9 | ||
412 | popq %rsi | 415 | popq %rsi |
413 | 416 | ||
414 | /* | 417 | /* |
diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c index 57ab74df7eea..30dd59a9f0b4 100644 --- a/arch/x86/boot/compressed/misc.c +++ b/arch/x86/boot/compressed/misc.c | |||
@@ -358,7 +358,8 @@ asmlinkage __visible void *decompress_kernel(void *rmode, memptr heap, | |||
358 | unsigned char *input_data, | 358 | unsigned char *input_data, |
359 | unsigned long input_len, | 359 | unsigned long input_len, |
360 | unsigned char *output, | 360 | unsigned char *output, |
361 | unsigned long output_len) | 361 | unsigned long output_len, |
362 | unsigned long run_size) | ||
362 | { | 363 | { |
363 | real_mode = rmode; | 364 | real_mode = rmode; |
364 | 365 | ||
@@ -381,8 +382,14 @@ asmlinkage __visible void *decompress_kernel(void *rmode, memptr heap, | |||
381 | free_mem_ptr = heap; /* Heap */ | 382 | free_mem_ptr = heap; /* Heap */ |
382 | free_mem_end_ptr = heap + BOOT_HEAP_SIZE; | 383 | free_mem_end_ptr = heap + BOOT_HEAP_SIZE; |
383 | 384 | ||
384 | output = choose_kernel_location(input_data, input_len, | 385 | /* |
385 | output, output_len); | 386 | * The memory hole needed for the kernel is the larger of either |
387 | * the entire decompressed kernel plus relocation table, or the | ||
388 | * entire decompressed kernel plus .bss and .brk sections. | ||
389 | */ | ||
390 | output = choose_kernel_location(input_data, input_len, output, | ||
391 | output_len > run_size ? output_len | ||
392 | : run_size); | ||
386 | 393 | ||
387 | /* Validate memory location choices. */ | 394 | /* Validate memory location choices. */ |
388 | if ((unsigned long)output & (MIN_KERNEL_ALIGN - 1)) | 395 | if ((unsigned long)output & (MIN_KERNEL_ALIGN - 1)) |
diff --git a/arch/x86/boot/compressed/mkpiggy.c b/arch/x86/boot/compressed/mkpiggy.c index b669ab65bf6c..d8222f213182 100644 --- a/arch/x86/boot/compressed/mkpiggy.c +++ b/arch/x86/boot/compressed/mkpiggy.c | |||
@@ -36,11 +36,13 @@ int main(int argc, char *argv[]) | |||
36 | uint32_t olen; | 36 | uint32_t olen; |
37 | long ilen; | 37 | long ilen; |
38 | unsigned long offs; | 38 | unsigned long offs; |
39 | unsigned long run_size; | ||
39 | FILE *f = NULL; | 40 | FILE *f = NULL; |
40 | int retval = 1; | 41 | int retval = 1; |
41 | 42 | ||
42 | if (argc < 2) { | 43 | if (argc < 3) { |
43 | fprintf(stderr, "Usage: %s compressed_file\n", argv[0]); | 44 | fprintf(stderr, "Usage: %s compressed_file run_size\n", |
45 | argv[0]); | ||
44 | goto bail; | 46 | goto bail; |
45 | } | 47 | } |
46 | 48 | ||
@@ -74,6 +76,7 @@ int main(int argc, char *argv[]) | |||
74 | offs += olen >> 12; /* Add 8 bytes for each 32K block */ | 76 | offs += olen >> 12; /* Add 8 bytes for each 32K block */ |
75 | offs += 64*1024 + 128; /* Add 64K + 128 bytes slack */ | 77 | offs += 64*1024 + 128; /* Add 64K + 128 bytes slack */ |
76 | offs = (offs+4095) & ~4095; /* Round to a 4K boundary */ | 78 | offs = (offs+4095) & ~4095; /* Round to a 4K boundary */ |
79 | run_size = atoi(argv[2]); | ||
77 | 80 | ||
78 | printf(".section \".rodata..compressed\",\"a\",@progbits\n"); | 81 | printf(".section \".rodata..compressed\",\"a\",@progbits\n"); |
79 | printf(".globl z_input_len\n"); | 82 | printf(".globl z_input_len\n"); |
@@ -85,6 +88,8 @@ int main(int argc, char *argv[]) | |||
85 | /* z_extract_offset_negative allows simplification of head_32.S */ | 88 | /* z_extract_offset_negative allows simplification of head_32.S */ |
86 | printf(".globl z_extract_offset_negative\n"); | 89 | printf(".globl z_extract_offset_negative\n"); |
87 | printf("z_extract_offset_negative = -0x%lx\n", offs); | 90 | printf("z_extract_offset_negative = -0x%lx\n", offs); |
91 | printf(".globl z_run_size\n"); | ||
92 | printf("z_run_size = %lu\n", run_size); | ||
88 | 93 | ||
89 | printf(".globl input_data, input_data_end\n"); | 94 | printf(".globl input_data, input_data_end\n"); |
90 | printf("input_data:\n"); | 95 | printf("input_data:\n"); |
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S index 8ffba18395c8..ffe71228fc10 100644 --- a/arch/x86/ia32/ia32entry.S +++ b/arch/x86/ia32/ia32entry.S | |||
@@ -157,7 +157,7 @@ ENTRY(ia32_sysenter_target) | |||
157 | * ourselves. To save a few cycles, we can check whether | 157 | * ourselves. To save a few cycles, we can check whether |
158 | * NT was set instead of doing an unconditional popfq. | 158 | * NT was set instead of doing an unconditional popfq. |
159 | */ | 159 | */ |
160 | testl $X86_EFLAGS_NT,EFLAGS(%rsp) /* saved EFLAGS match cpu */ | 160 | testl $X86_EFLAGS_NT,EFLAGS-ARGOFFSET(%rsp) |
161 | jnz sysenter_fix_flags | 161 | jnz sysenter_fix_flags |
162 | sysenter_flags_fixed: | 162 | sysenter_flags_fixed: |
163 | 163 | ||
diff --git a/arch/x86/include/asm/preempt.h b/arch/x86/include/asm/preempt.h index 7024c12f7bfe..400873450e33 100644 --- a/arch/x86/include/asm/preempt.h +++ b/arch/x86/include/asm/preempt.h | |||
@@ -105,6 +105,7 @@ static __always_inline bool should_resched(void) | |||
105 | # ifdef CONFIG_CONTEXT_TRACKING | 105 | # ifdef CONFIG_CONTEXT_TRACKING |
106 | extern asmlinkage void ___preempt_schedule_context(void); | 106 | extern asmlinkage void ___preempt_schedule_context(void); |
107 | # define __preempt_schedule_context() asm ("call ___preempt_schedule_context") | 107 | # define __preempt_schedule_context() asm ("call ___preempt_schedule_context") |
108 | extern asmlinkage void preempt_schedule_context(void); | ||
108 | # endif | 109 | # endif |
109 | #endif | 110 | #endif |
110 | 111 | ||
diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h index 8cd27e08e23c..8cd1cc3bc835 100644 --- a/arch/x86/include/asm/smp.h +++ b/arch/x86/include/asm/smp.h | |||
@@ -150,6 +150,7 @@ static inline void arch_send_call_function_ipi_mask(const struct cpumask *mask) | |||
150 | } | 150 | } |
151 | 151 | ||
152 | void cpu_disable_common(void); | 152 | void cpu_disable_common(void); |
153 | void cpu_die_common(unsigned int cpu); | ||
153 | void native_smp_prepare_boot_cpu(void); | 154 | void native_smp_prepare_boot_cpu(void); |
154 | void native_smp_prepare_cpus(unsigned int max_cpus); | 155 | void native_smp_prepare_cpus(unsigned int max_cpus); |
155 | void native_smp_cpus_done(unsigned int max_cpus); | 156 | void native_smp_cpus_done(unsigned int max_cpus); |
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index b436fc735aa4..a142e77693e1 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c | |||
@@ -397,7 +397,7 @@ static int mp_register_gsi(struct device *dev, u32 gsi, int trigger, | |||
397 | 397 | ||
398 | /* Don't set up the ACPI SCI because it's already set up */ | 398 | /* Don't set up the ACPI SCI because it's already set up */ |
399 | if (acpi_gbl_FADT.sci_interrupt == gsi) | 399 | if (acpi_gbl_FADT.sci_interrupt == gsi) |
400 | return gsi; | 400 | return mp_map_gsi_to_irq(gsi, IOAPIC_MAP_ALLOC); |
401 | 401 | ||
402 | trigger = trigger == ACPI_EDGE_SENSITIVE ? 0 : 1; | 402 | trigger = trigger == ACPI_EDGE_SENSITIVE ? 0 : 1; |
403 | polarity = polarity == ACPI_ACTIVE_HIGH ? 0 : 1; | 403 | polarity = polarity == ACPI_ACTIVE_HIGH ? 0 : 1; |
@@ -604,14 +604,18 @@ void __init acpi_pic_sci_set_trigger(unsigned int irq, u16 trigger) | |||
604 | 604 | ||
605 | int acpi_gsi_to_irq(u32 gsi, unsigned int *irqp) | 605 | int acpi_gsi_to_irq(u32 gsi, unsigned int *irqp) |
606 | { | 606 | { |
607 | int irq = mp_map_gsi_to_irq(gsi, IOAPIC_MAP_ALLOC | IOAPIC_MAP_CHECK); | 607 | int irq; |
608 | 608 | ||
609 | if (irq >= 0) { | 609 | if (acpi_irq_model == ACPI_IRQ_MODEL_PIC) { |
610 | *irqp = gsi; | ||
611 | } else { | ||
612 | irq = mp_map_gsi_to_irq(gsi, | ||
613 | IOAPIC_MAP_ALLOC | IOAPIC_MAP_CHECK); | ||
614 | if (irq < 0) | ||
615 | return -1; | ||
610 | *irqp = irq; | 616 | *irqp = irq; |
611 | return 0; | ||
612 | } | 617 | } |
613 | 618 | return 0; | |
614 | return -1; | ||
615 | } | 619 | } |
616 | EXPORT_SYMBOL_GPL(acpi_gsi_to_irq); | 620 | EXPORT_SYMBOL_GPL(acpi_gsi_to_irq); |
617 | 621 | ||
diff --git a/arch/x86/kernel/apb_timer.c b/arch/x86/kernel/apb_timer.c index 5972b108f15a..b708738d016e 100644 --- a/arch/x86/kernel/apb_timer.c +++ b/arch/x86/kernel/apb_timer.c | |||
@@ -185,8 +185,6 @@ static void apbt_setup_irq(struct apbt_dev *adev) | |||
185 | 185 | ||
186 | irq_modify_status(adev->irq, 0, IRQ_MOVE_PCNTXT); | 186 | irq_modify_status(adev->irq, 0, IRQ_MOVE_PCNTXT); |
187 | irq_set_affinity(adev->irq, cpumask_of(adev->cpu)); | 187 | irq_set_affinity(adev->irq, cpumask_of(adev->cpu)); |
188 | /* APB timer irqs are set up as mp_irqs, timer is edge type */ | ||
189 | __irq_set_handler(adev->irq, handle_edge_irq, 0, "edge"); | ||
190 | } | 188 | } |
191 | 189 | ||
192 | /* Should be called with per cpu */ | 190 | /* Should be called with per cpu */ |
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 00853b254ab0..ba6cc041edb1 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c | |||
@@ -1297,7 +1297,7 @@ void setup_local_APIC(void) | |||
1297 | unsigned int value, queued; | 1297 | unsigned int value, queued; |
1298 | int i, j, acked = 0; | 1298 | int i, j, acked = 0; |
1299 | unsigned long long tsc = 0, ntsc; | 1299 | unsigned long long tsc = 0, ntsc; |
1300 | long long max_loops = cpu_khz; | 1300 | long long max_loops = cpu_khz ? cpu_khz : 1000000; |
1301 | 1301 | ||
1302 | if (cpu_has_tsc) | 1302 | if (cpu_has_tsc) |
1303 | rdtscll(tsc); | 1303 | rdtscll(tsc); |
@@ -1383,7 +1383,7 @@ void setup_local_APIC(void) | |||
1383 | break; | 1383 | break; |
1384 | } | 1384 | } |
1385 | if (queued) { | 1385 | if (queued) { |
1386 | if (cpu_has_tsc) { | 1386 | if (cpu_has_tsc && cpu_khz) { |
1387 | rdtscll(ntsc); | 1387 | rdtscll(ntsc); |
1388 | max_loops = (cpu_khz << 10) - (ntsc - tsc); | 1388 | max_loops = (cpu_khz << 10) - (ntsc - tsc); |
1389 | } else | 1389 | } else |
diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile index 01d5453b5502..e27b49d7c922 100644 --- a/arch/x86/kernel/cpu/Makefile +++ b/arch/x86/kernel/cpu/Makefile | |||
@@ -39,9 +39,12 @@ obj-$(CONFIG_CPU_SUP_AMD) += perf_event_amd_iommu.o | |||
39 | endif | 39 | endif |
40 | obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_p6.o perf_event_knc.o perf_event_p4.o | 40 | obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_p6.o perf_event_knc.o perf_event_p4.o |
41 | obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_intel_lbr.o perf_event_intel_ds.o perf_event_intel.o | 41 | obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_intel_lbr.o perf_event_intel_ds.o perf_event_intel.o |
42 | obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_intel_uncore.o perf_event_intel_uncore_snb.o | ||
43 | obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_intel_uncore_snbep.o perf_event_intel_uncore_nhmex.o | ||
44 | obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_intel_rapl.o | 42 | obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_intel_rapl.o |
43 | |||
44 | obj-$(CONFIG_PERF_EVENTS_INTEL_UNCORE) += perf_event_intel_uncore.o \ | ||
45 | perf_event_intel_uncore_snb.o \ | ||
46 | perf_event_intel_uncore_snbep.o \ | ||
47 | perf_event_intel_uncore_nhmex.o | ||
45 | endif | 48 | endif |
46 | 49 | ||
47 | 50 | ||
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c index 1ef456273172..9cc6b6f25f42 100644 --- a/arch/x86/kernel/cpu/intel.c +++ b/arch/x86/kernel/cpu/intel.c | |||
@@ -213,12 +213,13 @@ static void intel_workarounds(struct cpuinfo_x86 *c) | |||
213 | { | 213 | { |
214 | #ifdef CONFIG_X86_F00F_BUG | 214 | #ifdef CONFIG_X86_F00F_BUG |
215 | /* | 215 | /* |
216 | * All current models of Pentium and Pentium with MMX technology CPUs | 216 | * All models of Pentium and Pentium with MMX technology CPUs |
217 | * have the F0 0F bug, which lets nonprivileged users lock up the | 217 | * have the F0 0F bug, which lets nonprivileged users lock up the |
218 | * system. Announce that the fault handler will be checking for it. | 218 | * system. Announce that the fault handler will be checking for it. |
219 | * The Quark is also family 5, but does not have the same bug. | ||
219 | */ | 220 | */ |
220 | clear_cpu_bug(c, X86_BUG_F00F); | 221 | clear_cpu_bug(c, X86_BUG_F00F); |
221 | if (!paravirt_enabled() && c->x86 == 5) { | 222 | if (!paravirt_enabled() && c->x86 == 5 && c->x86_model < 9) { |
222 | static int f00f_workaround_enabled; | 223 | static int f00f_workaround_enabled; |
223 | 224 | ||
224 | set_cpu_bug(c, X86_BUG_F00F); | 225 | set_cpu_bug(c, X86_BUG_F00F); |
diff --git a/arch/x86/kernel/cpu/microcode/amd_early.c b/arch/x86/kernel/cpu/microcode/amd_early.c index 7aa1acc79789..06674473b0e6 100644 --- a/arch/x86/kernel/cpu/microcode/amd_early.c +++ b/arch/x86/kernel/cpu/microcode/amd_early.c | |||
@@ -108,12 +108,13 @@ static size_t compute_container_size(u8 *data, u32 total_size) | |||
108 | * load_microcode_amd() to save equivalent cpu table and microcode patches in | 108 | * load_microcode_amd() to save equivalent cpu table and microcode patches in |
109 | * kernel heap memory. | 109 | * kernel heap memory. |
110 | */ | 110 | */ |
111 | static void apply_ucode_in_initrd(void *ucode, size_t size) | 111 | static void apply_ucode_in_initrd(void *ucode, size_t size, bool save_patch) |
112 | { | 112 | { |
113 | struct equiv_cpu_entry *eq; | 113 | struct equiv_cpu_entry *eq; |
114 | size_t *cont_sz; | 114 | size_t *cont_sz; |
115 | u32 *header; | 115 | u32 *header; |
116 | u8 *data, **cont; | 116 | u8 *data, **cont; |
117 | u8 (*patch)[PATCH_MAX_SIZE]; | ||
117 | u16 eq_id = 0; | 118 | u16 eq_id = 0; |
118 | int offset, left; | 119 | int offset, left; |
119 | u32 rev, eax, ebx, ecx, edx; | 120 | u32 rev, eax, ebx, ecx, edx; |
@@ -123,10 +124,12 @@ static void apply_ucode_in_initrd(void *ucode, size_t size) | |||
123 | new_rev = (u32 *)__pa_nodebug(&ucode_new_rev); | 124 | new_rev = (u32 *)__pa_nodebug(&ucode_new_rev); |
124 | cont_sz = (size_t *)__pa_nodebug(&container_size); | 125 | cont_sz = (size_t *)__pa_nodebug(&container_size); |
125 | cont = (u8 **)__pa_nodebug(&container); | 126 | cont = (u8 **)__pa_nodebug(&container); |
127 | patch = (u8 (*)[PATCH_MAX_SIZE])__pa_nodebug(&amd_ucode_patch); | ||
126 | #else | 128 | #else |
127 | new_rev = &ucode_new_rev; | 129 | new_rev = &ucode_new_rev; |
128 | cont_sz = &container_size; | 130 | cont_sz = &container_size; |
129 | cont = &container; | 131 | cont = &container; |
132 | patch = &amd_ucode_patch; | ||
130 | #endif | 133 | #endif |
131 | 134 | ||
132 | data = ucode; | 135 | data = ucode; |
@@ -213,9 +216,9 @@ static void apply_ucode_in_initrd(void *ucode, size_t size) | |||
213 | rev = mc->hdr.patch_id; | 216 | rev = mc->hdr.patch_id; |
214 | *new_rev = rev; | 217 | *new_rev = rev; |
215 | 218 | ||
216 | /* save ucode patch */ | 219 | if (save_patch) |
217 | memcpy(amd_ucode_patch, mc, | 220 | memcpy(patch, mc, |
218 | min_t(u32, header[1], PATCH_MAX_SIZE)); | 221 | min_t(u32, header[1], PATCH_MAX_SIZE)); |
219 | } | 222 | } |
220 | } | 223 | } |
221 | 224 | ||
@@ -246,7 +249,7 @@ void __init load_ucode_amd_bsp(void) | |||
246 | *data = cp.data; | 249 | *data = cp.data; |
247 | *size = cp.size; | 250 | *size = cp.size; |
248 | 251 | ||
249 | apply_ucode_in_initrd(cp.data, cp.size); | 252 | apply_ucode_in_initrd(cp.data, cp.size, true); |
250 | } | 253 | } |
251 | 254 | ||
252 | #ifdef CONFIG_X86_32 | 255 | #ifdef CONFIG_X86_32 |
@@ -263,7 +266,7 @@ void load_ucode_amd_ap(void) | |||
263 | size_t *usize; | 266 | size_t *usize; |
264 | void **ucode; | 267 | void **ucode; |
265 | 268 | ||
266 | mc = (struct microcode_amd *)__pa(amd_ucode_patch); | 269 | mc = (struct microcode_amd *)__pa_nodebug(amd_ucode_patch); |
267 | if (mc->hdr.patch_id && mc->hdr.processor_rev_id) { | 270 | if (mc->hdr.patch_id && mc->hdr.processor_rev_id) { |
268 | __apply_microcode_amd(mc); | 271 | __apply_microcode_amd(mc); |
269 | return; | 272 | return; |
@@ -275,7 +278,7 @@ void load_ucode_amd_ap(void) | |||
275 | if (!*ucode || !*usize) | 278 | if (!*ucode || !*usize) |
276 | return; | 279 | return; |
277 | 280 | ||
278 | apply_ucode_in_initrd(*ucode, *usize); | 281 | apply_ucode_in_initrd(*ucode, *usize, false); |
279 | } | 282 | } |
280 | 283 | ||
281 | static void __init collect_cpu_sig_on_bsp(void *arg) | 284 | static void __init collect_cpu_sig_on_bsp(void *arg) |
@@ -339,7 +342,7 @@ void load_ucode_amd_ap(void) | |||
339 | * AP has a different equivalence ID than BSP, looks like | 342 | * AP has a different equivalence ID than BSP, looks like |
340 | * mixed-steppings silicon so go through the ucode blob anew. | 343 | * mixed-steppings silicon so go through the ucode blob anew. |
341 | */ | 344 | */ |
342 | apply_ucode_in_initrd(ucode_cpio.data, ucode_cpio.size); | 345 | apply_ucode_in_initrd(ucode_cpio.data, ucode_cpio.size, false); |
343 | } | 346 | } |
344 | } | 347 | } |
345 | #endif | 348 | #endif |
@@ -347,7 +350,9 @@ void load_ucode_amd_ap(void) | |||
347 | int __init save_microcode_in_initrd_amd(void) | 350 | int __init save_microcode_in_initrd_amd(void) |
348 | { | 351 | { |
349 | unsigned long cont; | 352 | unsigned long cont; |
353 | int retval = 0; | ||
350 | enum ucode_state ret; | 354 | enum ucode_state ret; |
355 | u8 *cont_va; | ||
351 | u32 eax; | 356 | u32 eax; |
352 | 357 | ||
353 | if (!container) | 358 | if (!container) |
@@ -355,13 +360,15 @@ int __init save_microcode_in_initrd_amd(void) | |||
355 | 360 | ||
356 | #ifdef CONFIG_X86_32 | 361 | #ifdef CONFIG_X86_32 |
357 | get_bsp_sig(); | 362 | get_bsp_sig(); |
358 | cont = (unsigned long)container; | 363 | cont = (unsigned long)container; |
364 | cont_va = __va(container); | ||
359 | #else | 365 | #else |
360 | /* | 366 | /* |
361 | * We need the physical address of the container for both bitness since | 367 | * We need the physical address of the container for both bitness since |
362 | * boot_params.hdr.ramdisk_image is a physical address. | 368 | * boot_params.hdr.ramdisk_image is a physical address. |
363 | */ | 369 | */ |
364 | cont = __pa(container); | 370 | cont = __pa(container); |
371 | cont_va = container; | ||
365 | #endif | 372 | #endif |
366 | 373 | ||
367 | /* | 374 | /* |
@@ -372,6 +379,8 @@ int __init save_microcode_in_initrd_amd(void) | |||
372 | if (relocated_ramdisk) | 379 | if (relocated_ramdisk) |
373 | container = (u8 *)(__va(relocated_ramdisk) + | 380 | container = (u8 *)(__va(relocated_ramdisk) + |
374 | (cont - boot_params.hdr.ramdisk_image)); | 381 | (cont - boot_params.hdr.ramdisk_image)); |
382 | else | ||
383 | container = cont_va; | ||
375 | 384 | ||
376 | if (ucode_new_rev) | 385 | if (ucode_new_rev) |
377 | pr_info("microcode: updated early to new patch_level=0x%08x\n", | 386 | pr_info("microcode: updated early to new patch_level=0x%08x\n", |
@@ -382,7 +391,7 @@ int __init save_microcode_in_initrd_amd(void) | |||
382 | 391 | ||
383 | ret = load_microcode_amd(eax, container, container_size); | 392 | ret = load_microcode_amd(eax, container, container_size); |
384 | if (ret != UCODE_OK) | 393 | if (ret != UCODE_OK) |
385 | return -EINVAL; | 394 | retval = -EINVAL; |
386 | 395 | ||
387 | /* | 396 | /* |
388 | * This will be freed any msec now, stash patches for the current | 397 | * This will be freed any msec now, stash patches for the current |
@@ -391,5 +400,5 @@ int __init save_microcode_in_initrd_amd(void) | |||
391 | container = NULL; | 400 | container = NULL; |
392 | container_size = 0; | 401 | container_size = 0; |
393 | 402 | ||
394 | return 0; | 403 | return retval; |
395 | } | 404 | } |
diff --git a/arch/x86/kernel/cpu/microcode/core_early.c b/arch/x86/kernel/cpu/microcode/core_early.c index 5f28a64e71ea..2c017f242a78 100644 --- a/arch/x86/kernel/cpu/microcode/core_early.c +++ b/arch/x86/kernel/cpu/microcode/core_early.c | |||
@@ -124,7 +124,7 @@ void __init load_ucode_bsp(void) | |||
124 | static bool check_loader_disabled_ap(void) | 124 | static bool check_loader_disabled_ap(void) |
125 | { | 125 | { |
126 | #ifdef CONFIG_X86_32 | 126 | #ifdef CONFIG_X86_32 |
127 | return __pa_nodebug(dis_ucode_ldr); | 127 | return *((bool *)__pa_nodebug(&dis_ucode_ldr)); |
128 | #else | 128 | #else |
129 | return dis_ucode_ldr; | 129 | return dis_ucode_ldr; |
130 | #endif | 130 | #endif |
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index 1b8299dd3d91..143e5f5dc855 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c | |||
@@ -243,8 +243,9 @@ static bool check_hw_exists(void) | |||
243 | 243 | ||
244 | msr_fail: | 244 | msr_fail: |
245 | printk(KERN_CONT "Broken PMU hardware detected, using software events only.\n"); | 245 | printk(KERN_CONT "Broken PMU hardware detected, using software events only.\n"); |
246 | printk(boot_cpu_has(X86_FEATURE_HYPERVISOR) ? KERN_INFO : KERN_ERR | 246 | printk("%sFailed to access perfctr msr (MSR %x is %Lx)\n", |
247 | "Failed to access perfctr msr (MSR %x is %Lx)\n", reg, val_new); | 247 | boot_cpu_has(X86_FEATURE_HYPERVISOR) ? KERN_INFO : KERN_ERR, |
248 | reg, val_new); | ||
248 | 249 | ||
249 | return false; | 250 | return false; |
250 | } | 251 | } |
@@ -444,12 +445,6 @@ int x86_pmu_hw_config(struct perf_event *event) | |||
444 | if (event->attr.type == PERF_TYPE_RAW) | 445 | if (event->attr.type == PERF_TYPE_RAW) |
445 | event->hw.config |= event->attr.config & X86_RAW_EVENT_MASK; | 446 | event->hw.config |= event->attr.config & X86_RAW_EVENT_MASK; |
446 | 447 | ||
447 | if (event->attr.sample_period && x86_pmu.limit_period) { | ||
448 | if (x86_pmu.limit_period(event, event->attr.sample_period) > | ||
449 | event->attr.sample_period) | ||
450 | return -EINVAL; | ||
451 | } | ||
452 | |||
453 | return x86_setup_perfctr(event); | 448 | return x86_setup_perfctr(event); |
454 | } | 449 | } |
455 | 450 | ||
@@ -987,9 +982,6 @@ int x86_perf_event_set_period(struct perf_event *event) | |||
987 | if (left > x86_pmu.max_period) | 982 | if (left > x86_pmu.max_period) |
988 | left = x86_pmu.max_period; | 983 | left = x86_pmu.max_period; |
989 | 984 | ||
990 | if (x86_pmu.limit_period) | ||
991 | left = x86_pmu.limit_period(event, left); | ||
992 | |||
993 | per_cpu(pmc_prev_left[idx], smp_processor_id()) = left; | 985 | per_cpu(pmc_prev_left[idx], smp_processor_id()) = left; |
994 | 986 | ||
995 | /* | 987 | /* |
diff --git a/arch/x86/kernel/cpu/perf_event.h b/arch/x86/kernel/cpu/perf_event.h index d98a34d435d7..fc5eb390b368 100644 --- a/arch/x86/kernel/cpu/perf_event.h +++ b/arch/x86/kernel/cpu/perf_event.h | |||
@@ -445,7 +445,6 @@ struct x86_pmu { | |||
445 | struct x86_pmu_quirk *quirks; | 445 | struct x86_pmu_quirk *quirks; |
446 | int perfctr_second_write; | 446 | int perfctr_second_write; |
447 | bool late_ack; | 447 | bool late_ack; |
448 | unsigned (*limit_period)(struct perf_event *event, unsigned l); | ||
449 | 448 | ||
450 | /* | 449 | /* |
451 | * sysfs attrs | 450 | * sysfs attrs |
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c index a73947c53b65..944bf019b74f 100644 --- a/arch/x86/kernel/cpu/perf_event_intel.c +++ b/arch/x86/kernel/cpu/perf_event_intel.c | |||
@@ -220,15 +220,6 @@ static struct event_constraint intel_hsw_event_constraints[] = { | |||
220 | EVENT_CONSTRAINT_END | 220 | EVENT_CONSTRAINT_END |
221 | }; | 221 | }; |
222 | 222 | ||
223 | static struct event_constraint intel_bdw_event_constraints[] = { | ||
224 | FIXED_EVENT_CONSTRAINT(0x00c0, 0), /* INST_RETIRED.ANY */ | ||
225 | FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */ | ||
226 | FIXED_EVENT_CONSTRAINT(0x0300, 2), /* CPU_CLK_UNHALTED.REF */ | ||
227 | INTEL_UEVENT_CONSTRAINT(0x148, 0x4), /* L1D_PEND_MISS.PENDING */ | ||
228 | INTEL_EVENT_CONSTRAINT(0xa3, 0x4), /* CYCLE_ACTIVITY.* */ | ||
229 | EVENT_CONSTRAINT_END | ||
230 | }; | ||
231 | |||
232 | static u64 intel_pmu_event_map(int hw_event) | 223 | static u64 intel_pmu_event_map(int hw_event) |
233 | { | 224 | { |
234 | return intel_perfmon_event_map[hw_event]; | 225 | return intel_perfmon_event_map[hw_event]; |
@@ -424,126 +415,6 @@ static __initconst const u64 snb_hw_cache_event_ids | |||
424 | 415 | ||
425 | }; | 416 | }; |
426 | 417 | ||
427 | static __initconst const u64 hsw_hw_cache_event_ids | ||
428 | [PERF_COUNT_HW_CACHE_MAX] | ||
429 | [PERF_COUNT_HW_CACHE_OP_MAX] | ||
430 | [PERF_COUNT_HW_CACHE_RESULT_MAX] = | ||
431 | { | ||
432 | [ C(L1D ) ] = { | ||
433 | [ C(OP_READ) ] = { | ||
434 | [ C(RESULT_ACCESS) ] = 0x81d0, /* MEM_UOPS_RETIRED.ALL_LOADS */ | ||
435 | [ C(RESULT_MISS) ] = 0x151, /* L1D.REPLACEMENT */ | ||
436 | }, | ||
437 | [ C(OP_WRITE) ] = { | ||
438 | [ C(RESULT_ACCESS) ] = 0x82d0, /* MEM_UOPS_RETIRED.ALL_STORES */ | ||
439 | [ C(RESULT_MISS) ] = 0x0, | ||
440 | }, | ||
441 | [ C(OP_PREFETCH) ] = { | ||
442 | [ C(RESULT_ACCESS) ] = 0x0, | ||
443 | [ C(RESULT_MISS) ] = 0x0, | ||
444 | }, | ||
445 | }, | ||
446 | [ C(L1I ) ] = { | ||
447 | [ C(OP_READ) ] = { | ||
448 | [ C(RESULT_ACCESS) ] = 0x0, | ||
449 | [ C(RESULT_MISS) ] = 0x280, /* ICACHE.MISSES */ | ||
450 | }, | ||
451 | [ C(OP_WRITE) ] = { | ||
452 | [ C(RESULT_ACCESS) ] = -1, | ||
453 | [ C(RESULT_MISS) ] = -1, | ||
454 | }, | ||
455 | [ C(OP_PREFETCH) ] = { | ||
456 | [ C(RESULT_ACCESS) ] = 0x0, | ||
457 | [ C(RESULT_MISS) ] = 0x0, | ||
458 | }, | ||
459 | }, | ||
460 | [ C(LL ) ] = { | ||
461 | [ C(OP_READ) ] = { | ||
462 | /* OFFCORE_RESPONSE:ALL_DATA_RD|ALL_CODE_RD */ | ||
463 | [ C(RESULT_ACCESS) ] = 0x1b7, | ||
464 | /* OFFCORE_RESPONSE:ALL_DATA_RD|ALL_CODE_RD|SUPPLIER_NONE| | ||
465 | L3_MISS|ANY_SNOOP */ | ||
466 | [ C(RESULT_MISS) ] = 0x1b7, | ||
467 | }, | ||
468 | [ C(OP_WRITE) ] = { | ||
469 | [ C(RESULT_ACCESS) ] = 0x1b7, /* OFFCORE_RESPONSE:ALL_RFO */ | ||
470 | /* OFFCORE_RESPONSE:ALL_RFO|SUPPLIER_NONE|L3_MISS|ANY_SNOOP */ | ||
471 | [ C(RESULT_MISS) ] = 0x1b7, | ||
472 | }, | ||
473 | [ C(OP_PREFETCH) ] = { | ||
474 | [ C(RESULT_ACCESS) ] = 0x0, | ||
475 | [ C(RESULT_MISS) ] = 0x0, | ||
476 | }, | ||
477 | }, | ||
478 | [ C(DTLB) ] = { | ||
479 | [ C(OP_READ) ] = { | ||
480 | [ C(RESULT_ACCESS) ] = 0x81d0, /* MEM_UOPS_RETIRED.ALL_LOADS */ | ||
481 | [ C(RESULT_MISS) ] = 0x108, /* DTLB_LOAD_MISSES.MISS_CAUSES_A_WALK */ | ||
482 | }, | ||
483 | [ C(OP_WRITE) ] = { | ||
484 | [ C(RESULT_ACCESS) ] = 0x82d0, /* MEM_UOPS_RETIRED.ALL_STORES */ | ||
485 | [ C(RESULT_MISS) ] = 0x149, /* DTLB_STORE_MISSES.MISS_CAUSES_A_WALK */ | ||
486 | }, | ||
487 | [ C(OP_PREFETCH) ] = { | ||
488 | [ C(RESULT_ACCESS) ] = 0x0, | ||
489 | [ C(RESULT_MISS) ] = 0x0, | ||
490 | }, | ||
491 | }, | ||
492 | [ C(ITLB) ] = { | ||
493 | [ C(OP_READ) ] = { | ||
494 | [ C(RESULT_ACCESS) ] = 0x6085, /* ITLB_MISSES.STLB_HIT */ | ||
495 | [ C(RESULT_MISS) ] = 0x185, /* ITLB_MISSES.MISS_CAUSES_A_WALK */ | ||
496 | }, | ||
497 | [ C(OP_WRITE) ] = { | ||
498 | [ C(RESULT_ACCESS) ] = -1, | ||
499 | [ C(RESULT_MISS) ] = -1, | ||
500 | }, | ||
501 | [ C(OP_PREFETCH) ] = { | ||
502 | [ C(RESULT_ACCESS) ] = -1, | ||
503 | [ C(RESULT_MISS) ] = -1, | ||
504 | }, | ||
505 | }, | ||
506 | [ C(BPU ) ] = { | ||
507 | [ C(OP_READ) ] = { | ||
508 | [ C(RESULT_ACCESS) ] = 0xc4, /* BR_INST_RETIRED.ALL_BRANCHES */ | ||
509 | [ C(RESULT_MISS) ] = 0xc5, /* BR_MISP_RETIRED.ALL_BRANCHES */ | ||
510 | }, | ||
511 | [ C(OP_WRITE) ] = { | ||
512 | [ C(RESULT_ACCESS) ] = -1, | ||
513 | [ C(RESULT_MISS) ] = -1, | ||
514 | }, | ||
515 | [ C(OP_PREFETCH) ] = { | ||
516 | [ C(RESULT_ACCESS) ] = -1, | ||
517 | [ C(RESULT_MISS) ] = -1, | ||
518 | }, | ||
519 | }, | ||
520 | }; | ||
521 | |||
522 | static __initconst const u64 hsw_hw_cache_extra_regs | ||
523 | [PERF_COUNT_HW_CACHE_MAX] | ||
524 | [PERF_COUNT_HW_CACHE_OP_MAX] | ||
525 | [PERF_COUNT_HW_CACHE_RESULT_MAX] = | ||
526 | { | ||
527 | [ C(LL ) ] = { | ||
528 | [ C(OP_READ) ] = { | ||
529 | /* OFFCORE_RESPONSE:ALL_DATA_RD|ALL_CODE_RD */ | ||
530 | [ C(RESULT_ACCESS) ] = 0x2d5, | ||
531 | /* OFFCORE_RESPONSE:ALL_DATA_RD|ALL_CODE_RD|SUPPLIER_NONE| | ||
532 | L3_MISS|ANY_SNOOP */ | ||
533 | [ C(RESULT_MISS) ] = 0x3fbc0202d5ull, | ||
534 | }, | ||
535 | [ C(OP_WRITE) ] = { | ||
536 | [ C(RESULT_ACCESS) ] = 0x122, /* OFFCORE_RESPONSE:ALL_RFO */ | ||
537 | /* OFFCORE_RESPONSE:ALL_RFO|SUPPLIER_NONE|L3_MISS|ANY_SNOOP */ | ||
538 | [ C(RESULT_MISS) ] = 0x3fbc020122ull, | ||
539 | }, | ||
540 | [ C(OP_PREFETCH) ] = { | ||
541 | [ C(RESULT_ACCESS) ] = 0x0, | ||
542 | [ C(RESULT_MISS) ] = 0x0, | ||
543 | }, | ||
544 | }, | ||
545 | }; | ||
546 | |||
547 | static __initconst const u64 westmere_hw_cache_event_ids | 418 | static __initconst const u64 westmere_hw_cache_event_ids |
548 | [PERF_COUNT_HW_CACHE_MAX] | 419 | [PERF_COUNT_HW_CACHE_MAX] |
549 | [PERF_COUNT_HW_CACHE_OP_MAX] | 420 | [PERF_COUNT_HW_CACHE_OP_MAX] |
@@ -2034,24 +1905,6 @@ hsw_get_event_constraints(struct cpu_hw_events *cpuc, struct perf_event *event) | |||
2034 | return c; | 1905 | return c; |
2035 | } | 1906 | } |
2036 | 1907 | ||
2037 | /* | ||
2038 | * Broadwell: | ||
2039 | * The INST_RETIRED.ALL period always needs to have lowest | ||
2040 | * 6bits cleared (BDM57). It shall not use a period smaller | ||
2041 | * than 100 (BDM11). We combine the two to enforce | ||
2042 | * a min-period of 128. | ||
2043 | */ | ||
2044 | static unsigned bdw_limit_period(struct perf_event *event, unsigned left) | ||
2045 | { | ||
2046 | if ((event->hw.config & INTEL_ARCH_EVENT_MASK) == | ||
2047 | X86_CONFIG(.event=0xc0, .umask=0x01)) { | ||
2048 | if (left < 128) | ||
2049 | left = 128; | ||
2050 | left &= ~0x3fu; | ||
2051 | } | ||
2052 | return left; | ||
2053 | } | ||
2054 | |||
2055 | PMU_FORMAT_ATTR(event, "config:0-7" ); | 1908 | PMU_FORMAT_ATTR(event, "config:0-7" ); |
2056 | PMU_FORMAT_ATTR(umask, "config:8-15" ); | 1909 | PMU_FORMAT_ATTR(umask, "config:8-15" ); |
2057 | PMU_FORMAT_ATTR(edge, "config:18" ); | 1910 | PMU_FORMAT_ATTR(edge, "config:18" ); |
@@ -2692,8 +2545,8 @@ __init int intel_pmu_init(void) | |||
2692 | case 69: /* 22nm Haswell ULT */ | 2545 | case 69: /* 22nm Haswell ULT */ |
2693 | case 70: /* 22nm Haswell + GT3e (Intel Iris Pro graphics) */ | 2546 | case 70: /* 22nm Haswell + GT3e (Intel Iris Pro graphics) */ |
2694 | x86_pmu.late_ack = true; | 2547 | x86_pmu.late_ack = true; |
2695 | memcpy(hw_cache_event_ids, hsw_hw_cache_event_ids, sizeof(hw_cache_event_ids)); | 2548 | memcpy(hw_cache_event_ids, snb_hw_cache_event_ids, sizeof(hw_cache_event_ids)); |
2696 | memcpy(hw_cache_extra_regs, hsw_hw_cache_extra_regs, sizeof(hw_cache_extra_regs)); | 2549 | memcpy(hw_cache_extra_regs, snb_hw_cache_extra_regs, sizeof(hw_cache_extra_regs)); |
2697 | 2550 | ||
2698 | intel_pmu_lbr_init_snb(); | 2551 | intel_pmu_lbr_init_snb(); |
2699 | 2552 | ||
@@ -2712,28 +2565,6 @@ __init int intel_pmu_init(void) | |||
2712 | pr_cont("Haswell events, "); | 2565 | pr_cont("Haswell events, "); |
2713 | break; | 2566 | break; |
2714 | 2567 | ||
2715 | case 61: /* 14nm Broadwell Core-M */ | ||
2716 | x86_pmu.late_ack = true; | ||
2717 | memcpy(hw_cache_event_ids, hsw_hw_cache_event_ids, sizeof(hw_cache_event_ids)); | ||
2718 | memcpy(hw_cache_extra_regs, hsw_hw_cache_extra_regs, sizeof(hw_cache_extra_regs)); | ||
2719 | |||
2720 | intel_pmu_lbr_init_snb(); | ||
2721 | |||
2722 | x86_pmu.event_constraints = intel_bdw_event_constraints; | ||
2723 | x86_pmu.pebs_constraints = intel_hsw_pebs_event_constraints; | ||
2724 | x86_pmu.extra_regs = intel_snbep_extra_regs; | ||
2725 | x86_pmu.pebs_aliases = intel_pebs_aliases_snb; | ||
2726 | /* all extra regs are per-cpu when HT is on */ | ||
2727 | x86_pmu.er_flags |= ERF_HAS_RSP_1; | ||
2728 | x86_pmu.er_flags |= ERF_NO_HT_SHARING; | ||
2729 | |||
2730 | x86_pmu.hw_config = hsw_hw_config; | ||
2731 | x86_pmu.get_event_constraints = hsw_get_event_constraints; | ||
2732 | x86_pmu.cpu_events = hsw_events_attrs; | ||
2733 | x86_pmu.limit_period = bdw_limit_period; | ||
2734 | pr_cont("Broadwell events, "); | ||
2735 | break; | ||
2736 | |||
2737 | default: | 2568 | default: |
2738 | switch (x86_pmu.version) { | 2569 | switch (x86_pmu.version) { |
2739 | case 1: | 2570 | case 1: |
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S index b553ed89e5f5..344b63f18d14 100644 --- a/arch/x86/kernel/entry_32.S +++ b/arch/x86/kernel/entry_32.S | |||
@@ -447,15 +447,14 @@ sysenter_exit: | |||
447 | sysenter_audit: | 447 | sysenter_audit: |
448 | testl $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT),TI_flags(%ebp) | 448 | testl $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT),TI_flags(%ebp) |
449 | jnz syscall_trace_entry | 449 | jnz syscall_trace_entry |
450 | addl $4,%esp | 450 | /* movl PT_EAX(%esp), %eax already set, syscall number: 1st arg to audit */ |
451 | CFI_ADJUST_CFA_OFFSET -4 | 451 | movl PT_EBX(%esp), %edx /* ebx/a0: 2nd arg to audit */ |
452 | movl %esi,4(%esp) /* 5th arg: 4th syscall arg */ | 452 | /* movl PT_ECX(%esp), %ecx already set, a1: 3nd arg to audit */ |
453 | movl %edx,(%esp) /* 4th arg: 3rd syscall arg */ | 453 | pushl_cfi PT_ESI(%esp) /* a3: 5th arg */ |
454 | /* %ecx already in %ecx 3rd arg: 2nd syscall arg */ | 454 | pushl_cfi PT_EDX+4(%esp) /* a2: 4th arg */ |
455 | movl %ebx,%edx /* 2nd arg: 1st syscall arg */ | ||
456 | /* %eax already in %eax 1st arg: syscall number */ | ||
457 | call __audit_syscall_entry | 455 | call __audit_syscall_entry |
458 | pushl_cfi %ebx | 456 | popl_cfi %ecx /* get that remapped edx off the stack */ |
457 | popl_cfi %ecx /* get that remapped esi off the stack */ | ||
459 | movl PT_EAX(%esp),%eax /* reload syscall number */ | 458 | movl PT_EAX(%esp),%eax /* reload syscall number */ |
460 | jmp sysenter_do_call | 459 | jmp sysenter_do_call |
461 | 460 | ||
diff --git a/arch/x86/kernel/i8259.c b/arch/x86/kernel/i8259.c index 8af817105e29..e7cc5370cd2f 100644 --- a/arch/x86/kernel/i8259.c +++ b/arch/x86/kernel/i8259.c | |||
@@ -111,8 +111,7 @@ static void make_8259A_irq(unsigned int irq) | |||
111 | { | 111 | { |
112 | disable_irq_nosync(irq); | 112 | disable_irq_nosync(irq); |
113 | io_apic_irqs &= ~(1<<irq); | 113 | io_apic_irqs &= ~(1<<irq); |
114 | irq_set_chip_and_handler_name(irq, &i8259A_chip, handle_level_irq, | 114 | irq_set_chip_and_handler(irq, &i8259A_chip, handle_level_irq); |
115 | i8259A_chip.name); | ||
116 | enable_irq(irq); | 115 | enable_irq(irq); |
117 | } | 116 | } |
118 | 117 | ||
diff --git a/arch/x86/kernel/irqinit.c b/arch/x86/kernel/irqinit.c index 44f1ed42fdf2..4de73ee78361 100644 --- a/arch/x86/kernel/irqinit.c +++ b/arch/x86/kernel/irqinit.c | |||
@@ -70,7 +70,6 @@ int vector_used_by_percpu_irq(unsigned int vector) | |||
70 | void __init init_ISA_irqs(void) | 70 | void __init init_ISA_irqs(void) |
71 | { | 71 | { |
72 | struct irq_chip *chip = legacy_pic->chip; | 72 | struct irq_chip *chip = legacy_pic->chip; |
73 | const char *name = chip->name; | ||
74 | int i; | 73 | int i; |
75 | 74 | ||
76 | #if defined(CONFIG_X86_64) || defined(CONFIG_X86_LOCAL_APIC) | 75 | #if defined(CONFIG_X86_64) || defined(CONFIG_X86_LOCAL_APIC) |
@@ -79,7 +78,7 @@ void __init init_ISA_irqs(void) | |||
79 | legacy_pic->init(0); | 78 | legacy_pic->init(0); |
80 | 79 | ||
81 | for (i = 0; i < nr_legacy_irqs(); i++) | 80 | for (i = 0; i < nr_legacy_irqs(); i++) |
82 | irq_set_chip_and_handler_name(i, chip, handle_level_irq, name); | 81 | irq_set_chip_and_handler(i, chip, handle_level_irq); |
83 | } | 82 | } |
84 | 83 | ||
85 | void __init init_IRQ(void) | 84 | void __init init_IRQ(void) |
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 235cfd39e0d7..ab08aa2276fb 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
@@ -1128,7 +1128,6 @@ void __init setup_arch(char **cmdline_p) | |||
1128 | setup_real_mode(); | 1128 | setup_real_mode(); |
1129 | 1129 | ||
1130 | memblock_set_current_limit(get_max_mapped()); | 1130 | memblock_set_current_limit(get_max_mapped()); |
1131 | dma_contiguous_reserve(max_pfn_mapped << PAGE_SHIFT); | ||
1132 | 1131 | ||
1133 | /* | 1132 | /* |
1134 | * NOTE: On x86-32, only from this point on, fixmaps are ready for use. | 1133 | * NOTE: On x86-32, only from this point on, fixmaps are ready for use. |
@@ -1159,6 +1158,7 @@ void __init setup_arch(char **cmdline_p) | |||
1159 | early_acpi_boot_init(); | 1158 | early_acpi_boot_init(); |
1160 | 1159 | ||
1161 | initmem_init(); | 1160 | initmem_init(); |
1161 | dma_contiguous_reserve(max_pfn_mapped << PAGE_SHIFT); | ||
1162 | 1162 | ||
1163 | /* | 1163 | /* |
1164 | * Reserve memory for crash kernel after SRAT is parsed so that it | 1164 | * Reserve memory for crash kernel after SRAT is parsed so that it |
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 2d5200e56357..668d8f2a8781 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c | |||
@@ -102,8 +102,6 @@ DEFINE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_llc_shared_map); | |||
102 | DEFINE_PER_CPU_SHARED_ALIGNED(struct cpuinfo_x86, cpu_info); | 102 | DEFINE_PER_CPU_SHARED_ALIGNED(struct cpuinfo_x86, cpu_info); |
103 | EXPORT_PER_CPU_SYMBOL(cpu_info); | 103 | EXPORT_PER_CPU_SYMBOL(cpu_info); |
104 | 104 | ||
105 | static DEFINE_PER_CPU(struct completion, die_complete); | ||
106 | |||
107 | atomic_t init_deasserted; | 105 | atomic_t init_deasserted; |
108 | 106 | ||
109 | /* | 107 | /* |
@@ -1305,10 +1303,14 @@ static void __ref remove_cpu_from_maps(int cpu) | |||
1305 | numa_remove_cpu(cpu); | 1303 | numa_remove_cpu(cpu); |
1306 | } | 1304 | } |
1307 | 1305 | ||
1306 | static DEFINE_PER_CPU(struct completion, die_complete); | ||
1307 | |||
1308 | void cpu_disable_common(void) | 1308 | void cpu_disable_common(void) |
1309 | { | 1309 | { |
1310 | int cpu = smp_processor_id(); | 1310 | int cpu = smp_processor_id(); |
1311 | 1311 | ||
1312 | init_completion(&per_cpu(die_complete, smp_processor_id())); | ||
1313 | |||
1312 | remove_siblinginfo(cpu); | 1314 | remove_siblinginfo(cpu); |
1313 | 1315 | ||
1314 | /* It's now safe to remove this processor from the online map */ | 1316 | /* It's now safe to remove this processor from the online map */ |
@@ -1327,16 +1329,21 @@ int native_cpu_disable(void) | |||
1327 | return ret; | 1329 | return ret; |
1328 | 1330 | ||
1329 | clear_local_APIC(); | 1331 | clear_local_APIC(); |
1330 | init_completion(&per_cpu(die_complete, smp_processor_id())); | ||
1331 | cpu_disable_common(); | 1332 | cpu_disable_common(); |
1332 | 1333 | ||
1333 | return 0; | 1334 | return 0; |
1334 | } | 1335 | } |
1335 | 1336 | ||
1337 | void cpu_die_common(unsigned int cpu) | ||
1338 | { | ||
1339 | wait_for_completion_timeout(&per_cpu(die_complete, cpu), HZ); | ||
1340 | } | ||
1341 | |||
1336 | void native_cpu_die(unsigned int cpu) | 1342 | void native_cpu_die(unsigned int cpu) |
1337 | { | 1343 | { |
1338 | /* We don't do anything here: idle task is faking death itself. */ | 1344 | /* We don't do anything here: idle task is faking death itself. */ |
1339 | wait_for_completion_timeout(&per_cpu(die_complete, cpu), HZ); | 1345 | |
1346 | cpu_die_common(cpu); | ||
1340 | 1347 | ||
1341 | /* They ack this in play_dead() by setting CPU_DEAD */ | 1348 | /* They ack this in play_dead() by setting CPU_DEAD */ |
1342 | if (per_cpu(cpu_state, cpu) == CPU_DEAD) { | 1349 | if (per_cpu(cpu_state, cpu) == CPU_DEAD) { |
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index b6025f9e36c6..b7e50bba3bbb 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c | |||
@@ -1166,14 +1166,17 @@ void __init tsc_init(void) | |||
1166 | 1166 | ||
1167 | x86_init.timers.tsc_pre_init(); | 1167 | x86_init.timers.tsc_pre_init(); |
1168 | 1168 | ||
1169 | if (!cpu_has_tsc) | 1169 | if (!cpu_has_tsc) { |
1170 | setup_clear_cpu_cap(X86_FEATURE_TSC_DEADLINE_TIMER); | ||
1170 | return; | 1171 | return; |
1172 | } | ||
1171 | 1173 | ||
1172 | tsc_khz = x86_platform.calibrate_tsc(); | 1174 | tsc_khz = x86_platform.calibrate_tsc(); |
1173 | cpu_khz = tsc_khz; | 1175 | cpu_khz = tsc_khz; |
1174 | 1176 | ||
1175 | if (!tsc_khz) { | 1177 | if (!tsc_khz) { |
1176 | mark_tsc_unstable("could not calculate TSC khz"); | 1178 | mark_tsc_unstable("could not calculate TSC khz"); |
1179 | setup_clear_cpu_cap(X86_FEATURE_TSC_DEADLINE_TIMER); | ||
1177 | return; | 1180 | return; |
1178 | } | 1181 | } |
1179 | 1182 | ||
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c index 749f9fa38254..9f8a2faf5040 100644 --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c | |||
@@ -574,12 +574,14 @@ static inline int assign_eip_far(struct x86_emulate_ctxt *ctxt, ulong dst, | |||
574 | case 4: | 574 | case 4: |
575 | ctxt->_eip = (u32)dst; | 575 | ctxt->_eip = (u32)dst; |
576 | break; | 576 | break; |
577 | #ifdef CONFIG_X86_64 | ||
577 | case 8: | 578 | case 8: |
578 | if ((cs_l && is_noncanonical_address(dst)) || | 579 | if ((cs_l && is_noncanonical_address(dst)) || |
579 | (!cs_l && (dst & ~(u32)-1))) | 580 | (!cs_l && (dst >> 32) != 0)) |
580 | return emulate_gp(ctxt, 0); | 581 | return emulate_gp(ctxt, 0); |
581 | ctxt->_eip = dst; | 582 | ctxt->_eip = dst; |
582 | break; | 583 | break; |
584 | #endif | ||
583 | default: | 585 | default: |
584 | WARN(1, "unsupported eip assignment size\n"); | 586 | WARN(1, "unsupported eip assignment size\n"); |
585 | } | 587 | } |
@@ -641,7 +643,8 @@ static bool insn_aligned(struct x86_emulate_ctxt *ctxt, unsigned size) | |||
641 | 643 | ||
642 | static int __linearize(struct x86_emulate_ctxt *ctxt, | 644 | static int __linearize(struct x86_emulate_ctxt *ctxt, |
643 | struct segmented_address addr, | 645 | struct segmented_address addr, |
644 | unsigned size, bool write, bool fetch, | 646 | unsigned *max_size, unsigned size, |
647 | bool write, bool fetch, | ||
645 | ulong *linear) | 648 | ulong *linear) |
646 | { | 649 | { |
647 | struct desc_struct desc; | 650 | struct desc_struct desc; |
@@ -652,10 +655,15 @@ static int __linearize(struct x86_emulate_ctxt *ctxt, | |||
652 | unsigned cpl; | 655 | unsigned cpl; |
653 | 656 | ||
654 | la = seg_base(ctxt, addr.seg) + addr.ea; | 657 | la = seg_base(ctxt, addr.seg) + addr.ea; |
658 | *max_size = 0; | ||
655 | switch (ctxt->mode) { | 659 | switch (ctxt->mode) { |
656 | case X86EMUL_MODE_PROT64: | 660 | case X86EMUL_MODE_PROT64: |
657 | if (((signed long)la << 16) >> 16 != la) | 661 | if (((signed long)la << 16) >> 16 != la) |
658 | return emulate_gp(ctxt, 0); | 662 | return emulate_gp(ctxt, 0); |
663 | |||
664 | *max_size = min_t(u64, ~0u, (1ull << 48) - la); | ||
665 | if (size > *max_size) | ||
666 | goto bad; | ||
659 | break; | 667 | break; |
660 | default: | 668 | default: |
661 | usable = ctxt->ops->get_segment(ctxt, &sel, &desc, NULL, | 669 | usable = ctxt->ops->get_segment(ctxt, &sel, &desc, NULL, |
@@ -673,20 +681,25 @@ static int __linearize(struct x86_emulate_ctxt *ctxt, | |||
673 | if ((ctxt->mode == X86EMUL_MODE_REAL) && !fetch && | 681 | if ((ctxt->mode == X86EMUL_MODE_REAL) && !fetch && |
674 | (ctxt->d & NoBigReal)) { | 682 | (ctxt->d & NoBigReal)) { |
675 | /* la is between zero and 0xffff */ | 683 | /* la is between zero and 0xffff */ |
676 | if (la > 0xffff || (u32)(la + size - 1) > 0xffff) | 684 | if (la > 0xffff) |
677 | goto bad; | 685 | goto bad; |
686 | *max_size = 0x10000 - la; | ||
678 | } else if ((desc.type & 8) || !(desc.type & 4)) { | 687 | } else if ((desc.type & 8) || !(desc.type & 4)) { |
679 | /* expand-up segment */ | 688 | /* expand-up segment */ |
680 | if (addr.ea > lim || (u32)(addr.ea + size - 1) > lim) | 689 | if (addr.ea > lim) |
681 | goto bad; | 690 | goto bad; |
691 | *max_size = min_t(u64, ~0u, (u64)lim + 1 - addr.ea); | ||
682 | } else { | 692 | } else { |
683 | /* expand-down segment */ | 693 | /* expand-down segment */ |
684 | if (addr.ea <= lim || (u32)(addr.ea + size - 1) <= lim) | 694 | if (addr.ea <= lim) |
685 | goto bad; | 695 | goto bad; |
686 | lim = desc.d ? 0xffffffff : 0xffff; | 696 | lim = desc.d ? 0xffffffff : 0xffff; |
687 | if (addr.ea > lim || (u32)(addr.ea + size - 1) > lim) | 697 | if (addr.ea > lim) |
688 | goto bad; | 698 | goto bad; |
699 | *max_size = min_t(u64, ~0u, (u64)lim + 1 - addr.ea); | ||
689 | } | 700 | } |
701 | if (size > *max_size) | ||
702 | goto bad; | ||
690 | cpl = ctxt->ops->cpl(ctxt); | 703 | cpl = ctxt->ops->cpl(ctxt); |
691 | if (!(desc.type & 8)) { | 704 | if (!(desc.type & 8)) { |
692 | /* data segment */ | 705 | /* data segment */ |
@@ -711,9 +724,9 @@ static int __linearize(struct x86_emulate_ctxt *ctxt, | |||
711 | return X86EMUL_CONTINUE; | 724 | return X86EMUL_CONTINUE; |
712 | bad: | 725 | bad: |
713 | if (addr.seg == VCPU_SREG_SS) | 726 | if (addr.seg == VCPU_SREG_SS) |
714 | return emulate_ss(ctxt, sel); | 727 | return emulate_ss(ctxt, 0); |
715 | else | 728 | else |
716 | return emulate_gp(ctxt, sel); | 729 | return emulate_gp(ctxt, 0); |
717 | } | 730 | } |
718 | 731 | ||
719 | static int linearize(struct x86_emulate_ctxt *ctxt, | 732 | static int linearize(struct x86_emulate_ctxt *ctxt, |
@@ -721,7 +734,8 @@ static int linearize(struct x86_emulate_ctxt *ctxt, | |||
721 | unsigned size, bool write, | 734 | unsigned size, bool write, |
722 | ulong *linear) | 735 | ulong *linear) |
723 | { | 736 | { |
724 | return __linearize(ctxt, addr, size, write, false, linear); | 737 | unsigned max_size; |
738 | return __linearize(ctxt, addr, &max_size, size, write, false, linear); | ||
725 | } | 739 | } |
726 | 740 | ||
727 | 741 | ||
@@ -746,17 +760,27 @@ static int segmented_read_std(struct x86_emulate_ctxt *ctxt, | |||
746 | static int __do_insn_fetch_bytes(struct x86_emulate_ctxt *ctxt, int op_size) | 760 | static int __do_insn_fetch_bytes(struct x86_emulate_ctxt *ctxt, int op_size) |
747 | { | 761 | { |
748 | int rc; | 762 | int rc; |
749 | unsigned size; | 763 | unsigned size, max_size; |
750 | unsigned long linear; | 764 | unsigned long linear; |
751 | int cur_size = ctxt->fetch.end - ctxt->fetch.data; | 765 | int cur_size = ctxt->fetch.end - ctxt->fetch.data; |
752 | struct segmented_address addr = { .seg = VCPU_SREG_CS, | 766 | struct segmented_address addr = { .seg = VCPU_SREG_CS, |
753 | .ea = ctxt->eip + cur_size }; | 767 | .ea = ctxt->eip + cur_size }; |
754 | 768 | ||
755 | size = 15UL ^ cur_size; | 769 | /* |
756 | rc = __linearize(ctxt, addr, size, false, true, &linear); | 770 | * We do not know exactly how many bytes will be needed, and |
771 | * __linearize is expensive, so fetch as much as possible. We | ||
772 | * just have to avoid going beyond the 15 byte limit, the end | ||
773 | * of the segment, or the end of the page. | ||
774 | * | ||
775 | * __linearize is called with size 0 so that it does not do any | ||
776 | * boundary check itself. Instead, we use max_size to check | ||
777 | * against op_size. | ||
778 | */ | ||
779 | rc = __linearize(ctxt, addr, &max_size, 0, false, true, &linear); | ||
757 | if (unlikely(rc != X86EMUL_CONTINUE)) | 780 | if (unlikely(rc != X86EMUL_CONTINUE)) |
758 | return rc; | 781 | return rc; |
759 | 782 | ||
783 | size = min_t(unsigned, 15UL ^ cur_size, max_size); | ||
760 | size = min_t(unsigned, size, PAGE_SIZE - offset_in_page(linear)); | 784 | size = min_t(unsigned, size, PAGE_SIZE - offset_in_page(linear)); |
761 | 785 | ||
762 | /* | 786 | /* |
@@ -766,7 +790,8 @@ static int __do_insn_fetch_bytes(struct x86_emulate_ctxt *ctxt, int op_size) | |||
766 | * still, we must have hit the 15-byte boundary. | 790 | * still, we must have hit the 15-byte boundary. |
767 | */ | 791 | */ |
768 | if (unlikely(size < op_size)) | 792 | if (unlikely(size < op_size)) |
769 | return X86EMUL_UNHANDLEABLE; | 793 | return emulate_gp(ctxt, 0); |
794 | |||
770 | rc = ctxt->ops->fetch(ctxt, linear, ctxt->fetch.end, | 795 | rc = ctxt->ops->fetch(ctxt, linear, ctxt->fetch.end, |
771 | size, &ctxt->exception); | 796 | size, &ctxt->exception); |
772 | if (unlikely(rc != X86EMUL_CONTINUE)) | 797 | if (unlikely(rc != X86EMUL_CONTINUE)) |
@@ -2012,7 +2037,7 @@ static int em_jmp_far(struct x86_emulate_ctxt *ctxt) | |||
2012 | 2037 | ||
2013 | rc = assign_eip_far(ctxt, ctxt->src.val, new_desc.l); | 2038 | rc = assign_eip_far(ctxt, ctxt->src.val, new_desc.l); |
2014 | if (rc != X86EMUL_CONTINUE) { | 2039 | if (rc != X86EMUL_CONTINUE) { |
2015 | WARN_ON(!ctxt->mode != X86EMUL_MODE_PROT64); | 2040 | WARN_ON(ctxt->mode != X86EMUL_MODE_PROT64); |
2016 | /* assigning eip failed; restore the old cs */ | 2041 | /* assigning eip failed; restore the old cs */ |
2017 | ops->set_segment(ctxt, old_sel, &old_desc, 0, VCPU_SREG_CS); | 2042 | ops->set_segment(ctxt, old_sel, &old_desc, 0, VCPU_SREG_CS); |
2018 | return rc; | 2043 | return rc; |
@@ -2109,7 +2134,7 @@ static int em_ret_far(struct x86_emulate_ctxt *ctxt) | |||
2109 | return rc; | 2134 | return rc; |
2110 | rc = assign_eip_far(ctxt, eip, new_desc.l); | 2135 | rc = assign_eip_far(ctxt, eip, new_desc.l); |
2111 | if (rc != X86EMUL_CONTINUE) { | 2136 | if (rc != X86EMUL_CONTINUE) { |
2112 | WARN_ON(!ctxt->mode != X86EMUL_MODE_PROT64); | 2137 | WARN_ON(ctxt->mode != X86EMUL_MODE_PROT64); |
2113 | ops->set_segment(ctxt, old_cs, &old_desc, 0, VCPU_SREG_CS); | 2138 | ops->set_segment(ctxt, old_cs, &old_desc, 0, VCPU_SREG_CS); |
2114 | } | 2139 | } |
2115 | return rc; | 2140 | return rc; |
@@ -4262,6 +4287,7 @@ static int decode_operand(struct x86_emulate_ctxt *ctxt, struct operand *op, | |||
4262 | fetch_register_operand(op); | 4287 | fetch_register_operand(op); |
4263 | break; | 4288 | break; |
4264 | case OpCL: | 4289 | case OpCL: |
4290 | op->type = OP_IMM; | ||
4265 | op->bytes = 1; | 4291 | op->bytes = 1; |
4266 | op->val = reg_read(ctxt, VCPU_REGS_RCX) & 0xff; | 4292 | op->val = reg_read(ctxt, VCPU_REGS_RCX) & 0xff; |
4267 | break; | 4293 | break; |
@@ -4269,6 +4295,7 @@ static int decode_operand(struct x86_emulate_ctxt *ctxt, struct operand *op, | |||
4269 | rc = decode_imm(ctxt, op, 1, true); | 4295 | rc = decode_imm(ctxt, op, 1, true); |
4270 | break; | 4296 | break; |
4271 | case OpOne: | 4297 | case OpOne: |
4298 | op->type = OP_IMM; | ||
4272 | op->bytes = 1; | 4299 | op->bytes = 1; |
4273 | op->val = 1; | 4300 | op->val = 1; |
4274 | break; | 4301 | break; |
@@ -4327,21 +4354,27 @@ static int decode_operand(struct x86_emulate_ctxt *ctxt, struct operand *op, | |||
4327 | ctxt->memop.bytes = ctxt->op_bytes + 2; | 4354 | ctxt->memop.bytes = ctxt->op_bytes + 2; |
4328 | goto mem_common; | 4355 | goto mem_common; |
4329 | case OpES: | 4356 | case OpES: |
4357 | op->type = OP_IMM; | ||
4330 | op->val = VCPU_SREG_ES; | 4358 | op->val = VCPU_SREG_ES; |
4331 | break; | 4359 | break; |
4332 | case OpCS: | 4360 | case OpCS: |
4361 | op->type = OP_IMM; | ||
4333 | op->val = VCPU_SREG_CS; | 4362 | op->val = VCPU_SREG_CS; |
4334 | break; | 4363 | break; |
4335 | case OpSS: | 4364 | case OpSS: |
4365 | op->type = OP_IMM; | ||
4336 | op->val = VCPU_SREG_SS; | 4366 | op->val = VCPU_SREG_SS; |
4337 | break; | 4367 | break; |
4338 | case OpDS: | 4368 | case OpDS: |
4369 | op->type = OP_IMM; | ||
4339 | op->val = VCPU_SREG_DS; | 4370 | op->val = VCPU_SREG_DS; |
4340 | break; | 4371 | break; |
4341 | case OpFS: | 4372 | case OpFS: |
4373 | op->type = OP_IMM; | ||
4342 | op->val = VCPU_SREG_FS; | 4374 | op->val = VCPU_SREG_FS; |
4343 | break; | 4375 | break; |
4344 | case OpGS: | 4376 | case OpGS: |
4377 | op->type = OP_IMM; | ||
4345 | op->val = VCPU_SREG_GS; | 4378 | op->val = VCPU_SREG_GS; |
4346 | break; | 4379 | break; |
4347 | case OpImplicit: | 4380 | case OpImplicit: |
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index a8b76c4c95e2..3e556c68351b 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -4579,7 +4579,7 @@ static void vmx_vcpu_reset(struct kvm_vcpu *vcpu) | |||
4579 | vmcs_write32(TPR_THRESHOLD, 0); | 4579 | vmcs_write32(TPR_THRESHOLD, 0); |
4580 | } | 4580 | } |
4581 | 4581 | ||
4582 | kvm_vcpu_reload_apic_access_page(vcpu); | 4582 | kvm_make_request(KVM_REQ_APIC_PAGE_RELOAD, vcpu); |
4583 | 4583 | ||
4584 | if (vmx_vm_has_apicv(vcpu->kvm)) | 4584 | if (vmx_vm_has_apicv(vcpu->kvm)) |
4585 | memset(&vmx->pi_desc, 0, sizeof(struct pi_desc)); | 4585 | memset(&vmx->pi_desc, 0, sizeof(struct pi_desc)); |
@@ -6426,6 +6426,8 @@ static void copy_shadow_to_vmcs12(struct vcpu_vmx *vmx) | |||
6426 | const unsigned long *fields = shadow_read_write_fields; | 6426 | const unsigned long *fields = shadow_read_write_fields; |
6427 | const int num_fields = max_shadow_read_write_fields; | 6427 | const int num_fields = max_shadow_read_write_fields; |
6428 | 6428 | ||
6429 | preempt_disable(); | ||
6430 | |||
6429 | vmcs_load(shadow_vmcs); | 6431 | vmcs_load(shadow_vmcs); |
6430 | 6432 | ||
6431 | for (i = 0; i < num_fields; i++) { | 6433 | for (i = 0; i < num_fields; i++) { |
@@ -6449,6 +6451,8 @@ static void copy_shadow_to_vmcs12(struct vcpu_vmx *vmx) | |||
6449 | 6451 | ||
6450 | vmcs_clear(shadow_vmcs); | 6452 | vmcs_clear(shadow_vmcs); |
6451 | vmcs_load(vmx->loaded_vmcs->vmcs); | 6453 | vmcs_load(vmx->loaded_vmcs->vmcs); |
6454 | |||
6455 | preempt_enable(); | ||
6452 | } | 6456 | } |
6453 | 6457 | ||
6454 | static void copy_vmcs12_to_shadow(struct vcpu_vmx *vmx) | 6458 | static void copy_vmcs12_to_shadow(struct vcpu_vmx *vmx) |
diff --git a/arch/x86/lib/csum-wrappers_64.c b/arch/x86/lib/csum-wrappers_64.c index 7609e0e421ec..1318f75d56e4 100644 --- a/arch/x86/lib/csum-wrappers_64.c +++ b/arch/x86/lib/csum-wrappers_64.c | |||
@@ -41,9 +41,8 @@ csum_partial_copy_from_user(const void __user *src, void *dst, | |||
41 | while (((unsigned long)src & 6) && len >= 2) { | 41 | while (((unsigned long)src & 6) && len >= 2) { |
42 | __u16 val16; | 42 | __u16 val16; |
43 | 43 | ||
44 | *errp = __get_user(val16, (const __u16 __user *)src); | 44 | if (__get_user(val16, (const __u16 __user *)src)) |
45 | if (*errp) | 45 | goto out_err; |
46 | return isum; | ||
47 | 46 | ||
48 | *(__u16 *)dst = val16; | 47 | *(__u16 *)dst = val16; |
49 | isum = (__force __wsum)add32_with_carry( | 48 | isum = (__force __wsum)add32_with_carry( |
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index ae242a7c11c7..36de293caf25 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c | |||
@@ -409,7 +409,7 @@ phys_addr_t slow_virt_to_phys(void *__virt_addr) | |||
409 | psize = page_level_size(level); | 409 | psize = page_level_size(level); |
410 | pmask = page_level_mask(level); | 410 | pmask = page_level_mask(level); |
411 | offset = virt_addr & ~pmask; | 411 | offset = virt_addr & ~pmask; |
412 | phys_addr = pte_pfn(*pte) << PAGE_SHIFT; | 412 | phys_addr = (phys_addr_t)pte_pfn(*pte) << PAGE_SHIFT; |
413 | return (phys_addr | offset); | 413 | return (phys_addr | offset); |
414 | } | 414 | } |
415 | EXPORT_SYMBOL_GPL(slow_virt_to_phys); | 415 | EXPORT_SYMBOL_GPL(slow_virt_to_phys); |
diff --git a/arch/x86/platform/intel-mid/sfi.c b/arch/x86/platform/intel-mid/sfi.c index 3c53a90fdb18..c14ad34776c4 100644 --- a/arch/x86/platform/intel-mid/sfi.c +++ b/arch/x86/platform/intel-mid/sfi.c | |||
@@ -106,6 +106,7 @@ int __init sfi_parse_mtmr(struct sfi_table_header *table) | |||
106 | mp_irq.dstapic = MP_APIC_ALL; | 106 | mp_irq.dstapic = MP_APIC_ALL; |
107 | mp_irq.dstirq = pentry->irq; | 107 | mp_irq.dstirq = pentry->irq; |
108 | mp_save_irq(&mp_irq); | 108 | mp_save_irq(&mp_irq); |
109 | mp_map_gsi_to_irq(pentry->irq, IOAPIC_MAP_ALLOC); | ||
109 | } | 110 | } |
110 | 111 | ||
111 | return 0; | 112 | return 0; |
@@ -176,6 +177,7 @@ int __init sfi_parse_mrtc(struct sfi_table_header *table) | |||
176 | mp_irq.dstapic = MP_APIC_ALL; | 177 | mp_irq.dstapic = MP_APIC_ALL; |
177 | mp_irq.dstirq = pentry->irq; | 178 | mp_irq.dstirq = pentry->irq; |
178 | mp_save_irq(&mp_irq); | 179 | mp_save_irq(&mp_irq); |
180 | mp_map_gsi_to_irq(pentry->irq, IOAPIC_MAP_ALLOC); | ||
179 | } | 181 | } |
180 | return 0; | 182 | return 0; |
181 | } | 183 | } |
diff --git a/arch/x86/tools/calc_run_size.pl b/arch/x86/tools/calc_run_size.pl new file mode 100644 index 000000000000..0b0b124d3ece --- /dev/null +++ b/arch/x86/tools/calc_run_size.pl | |||
@@ -0,0 +1,30 @@ | |||
1 | #!/usr/bin/perl | ||
2 | # | ||
3 | # Calculate the amount of space needed to run the kernel, including room for | ||
4 | # the .bss and .brk sections. | ||
5 | # | ||
6 | # Usage: | ||
7 | # objdump -h a.out | perl calc_run_size.pl | ||
8 | use strict; | ||
9 | |||
10 | my $mem_size = 0; | ||
11 | my $file_offset = 0; | ||
12 | |||
13 | my $sections=" *[0-9]+ \.(?:bss|brk) +"; | ||
14 | while (<>) { | ||
15 | if (/^$sections([0-9a-f]+) +(?:[0-9a-f]+ +){2}([0-9a-f]+)/) { | ||
16 | my $size = hex($1); | ||
17 | my $offset = hex($2); | ||
18 | $mem_size += $size; | ||
19 | if ($file_offset == 0) { | ||
20 | $file_offset = $offset; | ||
21 | } elsif ($file_offset != $offset) { | ||
22 | die ".bss and .brk lack common file offset\n"; | ||
23 | } | ||
24 | } | ||
25 | } | ||
26 | |||
27 | if ($file_offset == 0) { | ||
28 | die "Never found .bss or .brk file offset\n"; | ||
29 | } | ||
30 | printf("%d\n", $mem_size + $file_offset); | ||
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c index 8650cdb53209..4c071aeb8417 100644 --- a/arch/x86/xen/smp.c +++ b/arch/x86/xen/smp.c | |||
@@ -510,6 +510,9 @@ static void xen_cpu_die(unsigned int cpu) | |||
510 | current->state = TASK_UNINTERRUPTIBLE; | 510 | current->state = TASK_UNINTERRUPTIBLE; |
511 | schedule_timeout(HZ/10); | 511 | schedule_timeout(HZ/10); |
512 | } | 512 | } |
513 | |||
514 | cpu_die_common(cpu); | ||
515 | |||
513 | xen_smp_intr_free(cpu); | 516 | xen_smp_intr_free(cpu); |
514 | xen_uninit_lock_cpu(cpu); | 517 | xen_uninit_lock_cpu(cpu); |
515 | xen_teardown_timer(cpu); | 518 | xen_teardown_timer(cpu); |
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig index 49c6c3d94449..81f57e8c8f1b 100644 --- a/arch/xtensa/Kconfig +++ b/arch/xtensa/Kconfig | |||
@@ -319,8 +319,8 @@ config XTENSA_PLATFORM_S6105 | |||
319 | 319 | ||
320 | config XTENSA_PLATFORM_XTFPGA | 320 | config XTENSA_PLATFORM_XTFPGA |
321 | bool "XTFPGA" | 321 | bool "XTFPGA" |
322 | select ETHOC if ETHERNET | ||
322 | select SERIAL_CONSOLE | 323 | select SERIAL_CONSOLE |
323 | select ETHOC | ||
324 | select XTENSA_CALIBRATE_CCOUNT | 324 | select XTENSA_CALIBRATE_CCOUNT |
325 | help | 325 | help |
326 | XTFPGA is the name of Tensilica board family (LX60, LX110, LX200, ML605). | 326 | XTFPGA is the name of Tensilica board family (LX60, LX110, LX200, ML605). |
@@ -367,7 +367,7 @@ config BUILTIN_DTB | |||
367 | config BLK_DEV_SIMDISK | 367 | config BLK_DEV_SIMDISK |
368 | tristate "Host file-based simulated block device support" | 368 | tristate "Host file-based simulated block device support" |
369 | default n | 369 | default n |
370 | depends on XTENSA_PLATFORM_ISS | 370 | depends on XTENSA_PLATFORM_ISS && BLOCK |
371 | help | 371 | help |
372 | Create block devices that map to files in the host file system. | 372 | Create block devices that map to files in the host file system. |
373 | Device binding to host file may be changed at runtime via proc | 373 | Device binding to host file may be changed at runtime via proc |
diff --git a/arch/xtensa/boot/dts/lx200mx.dts b/arch/xtensa/boot/dts/lx200mx.dts new file mode 100644 index 000000000000..249822b99bd6 --- /dev/null +++ b/arch/xtensa/boot/dts/lx200mx.dts | |||
@@ -0,0 +1,16 @@ | |||
1 | /dts-v1/; | ||
2 | /include/ "xtfpga.dtsi" | ||
3 | /include/ "xtfpga-flash-16m.dtsi" | ||
4 | |||
5 | / { | ||
6 | compatible = "cdns,xtensa-lx200"; | ||
7 | memory@0 { | ||
8 | device_type = "memory"; | ||
9 | reg = <0x00000000 0x06000000>; | ||
10 | }; | ||
11 | pic: pic { | ||
12 | compatible = "cdns,xtensa-mx"; | ||
13 | #interrupt-cells = <2>; | ||
14 | interrupt-controller; | ||
15 | }; | ||
16 | }; | ||
diff --git a/arch/xtensa/configs/generic_kc705_defconfig b/arch/xtensa/configs/generic_kc705_defconfig new file mode 100644 index 000000000000..f4b7b3888da8 --- /dev/null +++ b/arch/xtensa/configs/generic_kc705_defconfig | |||
@@ -0,0 +1,131 @@ | |||
1 | CONFIG_SYSVIPC=y | ||
2 | CONFIG_POSIX_MQUEUE=y | ||
3 | CONFIG_FHANDLE=y | ||
4 | CONFIG_IRQ_DOMAIN_DEBUG=y | ||
5 | CONFIG_NO_HZ_IDLE=y | ||
6 | CONFIG_HIGH_RES_TIMERS=y | ||
7 | CONFIG_IRQ_TIME_ACCOUNTING=y | ||
8 | CONFIG_BSD_PROCESS_ACCT=y | ||
9 | CONFIG_CGROUP_DEBUG=y | ||
10 | CONFIG_CGROUP_FREEZER=y | ||
11 | CONFIG_CGROUP_DEVICE=y | ||
12 | CONFIG_CPUSETS=y | ||
13 | CONFIG_CGROUP_CPUACCT=y | ||
14 | CONFIG_RESOURCE_COUNTERS=y | ||
15 | CONFIG_MEMCG=y | ||
16 | CONFIG_NAMESPACES=y | ||
17 | CONFIG_SCHED_AUTOGROUP=y | ||
18 | CONFIG_RELAY=y | ||
19 | CONFIG_BLK_DEV_INITRD=y | ||
20 | CONFIG_EXPERT=y | ||
21 | CONFIG_SYSCTL_SYSCALL=y | ||
22 | CONFIG_KALLSYMS_ALL=y | ||
23 | CONFIG_PROFILING=y | ||
24 | CONFIG_OPROFILE=y | ||
25 | CONFIG_MODULES=y | ||
26 | CONFIG_MODULE_UNLOAD=y | ||
27 | # CONFIG_IOSCHED_DEADLINE is not set | ||
28 | # CONFIG_IOSCHED_CFQ is not set | ||
29 | CONFIG_XTENSA_VARIANT_DC233C=y | ||
30 | CONFIG_XTENSA_UNALIGNED_USER=y | ||
31 | CONFIG_PREEMPT=y | ||
32 | CONFIG_HIGHMEM=y | ||
33 | # CONFIG_PCI is not set | ||
34 | CONFIG_XTENSA_PLATFORM_XTFPGA=y | ||
35 | CONFIG_CMDLINE_BOOL=y | ||
36 | CONFIG_CMDLINE="earlycon=uart8250,mmio32,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug" | ||
37 | CONFIG_USE_OF=y | ||
38 | CONFIG_BUILTIN_DTB="kc705" | ||
39 | # CONFIG_COMPACTION is not set | ||
40 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set | ||
41 | CONFIG_NET=y | ||
42 | CONFIG_PACKET=y | ||
43 | CONFIG_UNIX=y | ||
44 | CONFIG_INET=y | ||
45 | CONFIG_IP_MULTICAST=y | ||
46 | CONFIG_IP_PNP=y | ||
47 | CONFIG_IP_PNP_DHCP=y | ||
48 | CONFIG_IP_PNP_BOOTP=y | ||
49 | CONFIG_IP_PNP_RARP=y | ||
50 | # CONFIG_IPV6 is not set | ||
51 | CONFIG_NETFILTER=y | ||
52 | # CONFIG_WIRELESS is not set | ||
53 | CONFIG_DEVTMPFS=y | ||
54 | CONFIG_DEVTMPFS_MOUNT=y | ||
55 | # CONFIG_STANDALONE is not set | ||
56 | CONFIG_MTD=y | ||
57 | CONFIG_MTD_CFI=y | ||
58 | CONFIG_MTD_JEDECPROBE=y | ||
59 | CONFIG_MTD_CFI_INTELEXT=y | ||
60 | CONFIG_MTD_CFI_AMDSTD=y | ||
61 | CONFIG_MTD_CFI_STAA=y | ||
62 | CONFIG_MTD_PHYSMAP_OF=y | ||
63 | CONFIG_MTD_UBI=y | ||
64 | CONFIG_BLK_DEV_LOOP=y | ||
65 | CONFIG_BLK_DEV_RAM=y | ||
66 | CONFIG_SCSI=y | ||
67 | CONFIG_BLK_DEV_SD=y | ||
68 | CONFIG_NETDEVICES=y | ||
69 | # CONFIG_NET_VENDOR_ARC is not set | ||
70 | # CONFIG_NET_VENDOR_BROADCOM is not set | ||
71 | # CONFIG_NET_VENDOR_INTEL is not set | ||
72 | # CONFIG_NET_VENDOR_MARVELL is not set | ||
73 | # CONFIG_NET_VENDOR_MICREL is not set | ||
74 | # CONFIG_NET_VENDOR_NATSEMI is not set | ||
75 | # CONFIG_NET_VENDOR_SAMSUNG is not set | ||
76 | # CONFIG_NET_VENDOR_SEEQ is not set | ||
77 | # CONFIG_NET_VENDOR_SMSC is not set | ||
78 | # CONFIG_NET_VENDOR_STMICRO is not set | ||
79 | # CONFIG_NET_VENDOR_VIA is not set | ||
80 | # CONFIG_NET_VENDOR_WIZNET is not set | ||
81 | CONFIG_MARVELL_PHY=y | ||
82 | # CONFIG_WLAN is not set | ||
83 | # CONFIG_INPUT_MOUSEDEV is not set | ||
84 | # CONFIG_INPUT_KEYBOARD is not set | ||
85 | # CONFIG_INPUT_MOUSE is not set | ||
86 | # CONFIG_SERIO is not set | ||
87 | CONFIG_SERIAL_8250=y | ||
88 | # CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set | ||
89 | CONFIG_SERIAL_8250_CONSOLE=y | ||
90 | CONFIG_SERIAL_OF_PLATFORM=y | ||
91 | CONFIG_HW_RANDOM=y | ||
92 | # CONFIG_HWMON is not set | ||
93 | CONFIG_WATCHDOG=y | ||
94 | CONFIG_WATCHDOG_NOWAYOUT=y | ||
95 | CONFIG_SOFT_WATCHDOG=y | ||
96 | # CONFIG_VGA_CONSOLE is not set | ||
97 | # CONFIG_USB_SUPPORT is not set | ||
98 | # CONFIG_IOMMU_SUPPORT is not set | ||
99 | CONFIG_EXT3_FS=y | ||
100 | CONFIG_EXT4_FS=y | ||
101 | CONFIG_FANOTIFY=y | ||
102 | CONFIG_VFAT_FS=y | ||
103 | CONFIG_PROC_KCORE=y | ||
104 | CONFIG_TMPFS=y | ||
105 | CONFIG_TMPFS_POSIX_ACL=y | ||
106 | CONFIG_UBIFS_FS=y | ||
107 | CONFIG_NFS_FS=y | ||
108 | CONFIG_NFS_V4=y | ||
109 | CONFIG_NFS_SWAP=y | ||
110 | CONFIG_ROOT_NFS=y | ||
111 | CONFIG_SUNRPC_DEBUG=y | ||
112 | CONFIG_NLS_CODEPAGE_437=y | ||
113 | CONFIG_NLS_ISO8859_1=y | ||
114 | CONFIG_PRINTK_TIME=y | ||
115 | CONFIG_DYNAMIC_DEBUG=y | ||
116 | CONFIG_DEBUG_INFO=y | ||
117 | CONFIG_MAGIC_SYSRQ=y | ||
118 | CONFIG_LOCKUP_DETECTOR=y | ||
119 | # CONFIG_SCHED_DEBUG is not set | ||
120 | CONFIG_SCHEDSTATS=y | ||
121 | CONFIG_TIMER_STATS=y | ||
122 | CONFIG_DEBUG_RT_MUTEXES=y | ||
123 | CONFIG_DEBUG_SPINLOCK=y | ||
124 | CONFIG_DEBUG_MUTEXES=y | ||
125 | CONFIG_DEBUG_ATOMIC_SLEEP=y | ||
126 | CONFIG_STACKTRACE=y | ||
127 | CONFIG_RCU_TRACE=y | ||
128 | # CONFIG_FTRACE is not set | ||
129 | CONFIG_LD_NO_RELAX=y | ||
130 | # CONFIG_S32C1I_SELFTEST is not set | ||
131 | CONFIG_CRYPTO_ANSI_CPRNG=y | ||
diff --git a/arch/xtensa/configs/smp_lx200_defconfig b/arch/xtensa/configs/smp_lx200_defconfig new file mode 100644 index 000000000000..22eeacba37cc --- /dev/null +++ b/arch/xtensa/configs/smp_lx200_defconfig | |||
@@ -0,0 +1,135 @@ | |||
1 | CONFIG_SYSVIPC=y | ||
2 | CONFIG_POSIX_MQUEUE=y | ||
3 | CONFIG_FHANDLE=y | ||
4 | CONFIG_IRQ_DOMAIN_DEBUG=y | ||
5 | CONFIG_NO_HZ_IDLE=y | ||
6 | CONFIG_HIGH_RES_TIMERS=y | ||
7 | CONFIG_IRQ_TIME_ACCOUNTING=y | ||
8 | CONFIG_BSD_PROCESS_ACCT=y | ||
9 | CONFIG_CGROUP_DEBUG=y | ||
10 | CONFIG_CGROUP_FREEZER=y | ||
11 | CONFIG_CGROUP_DEVICE=y | ||
12 | CONFIG_CPUSETS=y | ||
13 | CONFIG_CGROUP_CPUACCT=y | ||
14 | CONFIG_RESOURCE_COUNTERS=y | ||
15 | CONFIG_MEMCG=y | ||
16 | CONFIG_NAMESPACES=y | ||
17 | CONFIG_SCHED_AUTOGROUP=y | ||
18 | CONFIG_RELAY=y | ||
19 | CONFIG_BLK_DEV_INITRD=y | ||
20 | CONFIG_EXPERT=y | ||
21 | CONFIG_SYSCTL_SYSCALL=y | ||
22 | CONFIG_KALLSYMS_ALL=y | ||
23 | CONFIG_PROFILING=y | ||
24 | CONFIG_OPROFILE=y | ||
25 | CONFIG_MODULES=y | ||
26 | CONFIG_MODULE_UNLOAD=y | ||
27 | # CONFIG_IOSCHED_DEADLINE is not set | ||
28 | # CONFIG_IOSCHED_CFQ is not set | ||
29 | CONFIG_XTENSA_VARIANT_CUSTOM=y | ||
30 | CONFIG_XTENSA_VARIANT_CUSTOM_NAME="test_mmuhifi_c3" | ||
31 | CONFIG_XTENSA_UNALIGNED_USER=y | ||
32 | CONFIG_PREEMPT=y | ||
33 | CONFIG_HAVE_SMP=y | ||
34 | CONFIG_SMP=y | ||
35 | CONFIG_HOTPLUG_CPU=y | ||
36 | # CONFIG_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX is not set | ||
37 | # CONFIG_PCI is not set | ||
38 | CONFIG_XTENSA_PLATFORM_XTFPGA=y | ||
39 | CONFIG_CMDLINE_BOOL=y | ||
40 | CONFIG_CMDLINE="earlycon=uart8250,mmio32,0xfd050020,115200n8 console=ttyS0,115200n8 ip=dhcp root=/dev/nfs rw debug" | ||
41 | CONFIG_USE_OF=y | ||
42 | CONFIG_BUILTIN_DTB="lx200mx" | ||
43 | # CONFIG_COMPACTION is not set | ||
44 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set | ||
45 | CONFIG_NET=y | ||
46 | CONFIG_PACKET=y | ||
47 | CONFIG_UNIX=y | ||
48 | CONFIG_INET=y | ||
49 | CONFIG_IP_MULTICAST=y | ||
50 | CONFIG_IP_PNP=y | ||
51 | CONFIG_IP_PNP_DHCP=y | ||
52 | CONFIG_IP_PNP_BOOTP=y | ||
53 | CONFIG_IP_PNP_RARP=y | ||
54 | # CONFIG_IPV6 is not set | ||
55 | CONFIG_NETFILTER=y | ||
56 | # CONFIG_WIRELESS is not set | ||
57 | CONFIG_DEVTMPFS=y | ||
58 | CONFIG_DEVTMPFS_MOUNT=y | ||
59 | # CONFIG_STANDALONE is not set | ||
60 | CONFIG_MTD=y | ||
61 | CONFIG_MTD_CFI=y | ||
62 | CONFIG_MTD_JEDECPROBE=y | ||
63 | CONFIG_MTD_CFI_INTELEXT=y | ||
64 | CONFIG_MTD_CFI_AMDSTD=y | ||
65 | CONFIG_MTD_CFI_STAA=y | ||
66 | CONFIG_MTD_PHYSMAP_OF=y | ||
67 | CONFIG_MTD_UBI=y | ||
68 | CONFIG_BLK_DEV_LOOP=y | ||
69 | CONFIG_BLK_DEV_RAM=y | ||
70 | CONFIG_SCSI=y | ||
71 | CONFIG_BLK_DEV_SD=y | ||
72 | CONFIG_NETDEVICES=y | ||
73 | # CONFIG_NET_VENDOR_ARC is not set | ||
74 | # CONFIG_NET_VENDOR_BROADCOM is not set | ||
75 | # CONFIG_NET_VENDOR_INTEL is not set | ||
76 | # CONFIG_NET_VENDOR_MARVELL is not set | ||
77 | # CONFIG_NET_VENDOR_MICREL is not set | ||
78 | # CONFIG_NET_VENDOR_NATSEMI is not set | ||
79 | # CONFIG_NET_VENDOR_SAMSUNG is not set | ||
80 | # CONFIG_NET_VENDOR_SEEQ is not set | ||
81 | # CONFIG_NET_VENDOR_SMSC is not set | ||
82 | # CONFIG_NET_VENDOR_STMICRO is not set | ||
83 | # CONFIG_NET_VENDOR_VIA is not set | ||
84 | # CONFIG_NET_VENDOR_WIZNET is not set | ||
85 | CONFIG_MARVELL_PHY=y | ||
86 | # CONFIG_WLAN is not set | ||
87 | # CONFIG_INPUT_MOUSEDEV is not set | ||
88 | # CONFIG_INPUT_KEYBOARD is not set | ||
89 | # CONFIG_INPUT_MOUSE is not set | ||
90 | # CONFIG_SERIO is not set | ||
91 | CONFIG_SERIAL_8250=y | ||
92 | # CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set | ||
93 | CONFIG_SERIAL_8250_CONSOLE=y | ||
94 | CONFIG_SERIAL_OF_PLATFORM=y | ||
95 | CONFIG_HW_RANDOM=y | ||
96 | # CONFIG_HWMON is not set | ||
97 | CONFIG_WATCHDOG=y | ||
98 | CONFIG_WATCHDOG_NOWAYOUT=y | ||
99 | CONFIG_SOFT_WATCHDOG=y | ||
100 | # CONFIG_VGA_CONSOLE is not set | ||
101 | # CONFIG_USB_SUPPORT is not set | ||
102 | # CONFIG_IOMMU_SUPPORT is not set | ||
103 | CONFIG_EXT3_FS=y | ||
104 | CONFIG_EXT4_FS=y | ||
105 | CONFIG_FANOTIFY=y | ||
106 | CONFIG_VFAT_FS=y | ||
107 | CONFIG_PROC_KCORE=y | ||
108 | CONFIG_TMPFS=y | ||
109 | CONFIG_TMPFS_POSIX_ACL=y | ||
110 | CONFIG_UBIFS_FS=y | ||
111 | CONFIG_NFS_FS=y | ||
112 | CONFIG_NFS_V4=y | ||
113 | CONFIG_NFS_SWAP=y | ||
114 | CONFIG_ROOT_NFS=y | ||
115 | CONFIG_SUNRPC_DEBUG=y | ||
116 | CONFIG_NLS_CODEPAGE_437=y | ||
117 | CONFIG_NLS_ISO8859_1=y | ||
118 | CONFIG_PRINTK_TIME=y | ||
119 | CONFIG_DYNAMIC_DEBUG=y | ||
120 | CONFIG_DEBUG_INFO=y | ||
121 | CONFIG_MAGIC_SYSRQ=y | ||
122 | CONFIG_DEBUG_VM=y | ||
123 | CONFIG_LOCKUP_DETECTOR=y | ||
124 | CONFIG_SCHEDSTATS=y | ||
125 | CONFIG_TIMER_STATS=y | ||
126 | CONFIG_DEBUG_RT_MUTEXES=y | ||
127 | CONFIG_DEBUG_SPINLOCK=y | ||
128 | CONFIG_DEBUG_MUTEXES=y | ||
129 | CONFIG_DEBUG_ATOMIC_SLEEP=y | ||
130 | CONFIG_STACKTRACE=y | ||
131 | CONFIG_RCU_TRACE=y | ||
132 | # CONFIG_FTRACE is not set | ||
133 | CONFIG_LD_NO_RELAX=y | ||
134 | # CONFIG_S32C1I_SELFTEST is not set | ||
135 | CONFIG_CRYPTO_ANSI_CPRNG=y | ||
diff --git a/arch/xtensa/include/asm/pgtable.h b/arch/xtensa/include/asm/pgtable.h index b2173e5da601..0383aed59121 100644 --- a/arch/xtensa/include/asm/pgtable.h +++ b/arch/xtensa/include/asm/pgtable.h | |||
@@ -277,6 +277,8 @@ static inline pte_t pte_mkwrite(pte_t pte) | |||
277 | static inline pte_t pte_mkspecial(pte_t pte) | 277 | static inline pte_t pte_mkspecial(pte_t pte) |
278 | { return pte; } | 278 | { return pte; } |
279 | 279 | ||
280 | #define pgprot_noncached(prot) (__pgprot(pgprot_val(prot) & ~_PAGE_CA_MASK)) | ||
281 | |||
280 | /* | 282 | /* |
281 | * Conversion functions: convert a page and protection to a page entry, | 283 | * Conversion functions: convert a page and protection to a page entry, |
282 | * and a page entry and page directory to the page they refer to. | 284 | * and a page entry and page directory to the page they refer to. |
diff --git a/arch/xtensa/include/uapi/asm/unistd.h b/arch/xtensa/include/uapi/asm/unistd.h index 8883fc877c5c..db5bb72e2f4e 100644 --- a/arch/xtensa/include/uapi/asm/unistd.h +++ b/arch/xtensa/include/uapi/asm/unistd.h | |||
@@ -384,7 +384,8 @@ __SYSCALL(174, sys_chroot, 1) | |||
384 | #define __NR_pivot_root 175 | 384 | #define __NR_pivot_root 175 |
385 | __SYSCALL(175, sys_pivot_root, 2) | 385 | __SYSCALL(175, sys_pivot_root, 2) |
386 | #define __NR_umount 176 | 386 | #define __NR_umount 176 |
387 | __SYSCALL(176, sys_umount, 2) | 387 | __SYSCALL(176, sys_oldumount, 1) |
388 | #define __ARCH_WANT_SYS_OLDUMOUNT | ||
388 | #define __NR_swapoff 177 | 389 | #define __NR_swapoff 177 |
389 | __SYSCALL(177, sys_swapoff, 1) | 390 | __SYSCALL(177, sys_swapoff, 1) |
390 | #define __NR_sync 178 | 391 | #define __NR_sync 178 |
@@ -742,7 +743,14 @@ __SYSCALL(335, sys_sched_getattr, 3) | |||
742 | #define __NR_renameat2 336 | 743 | #define __NR_renameat2 336 |
743 | __SYSCALL(336, sys_renameat2, 5) | 744 | __SYSCALL(336, sys_renameat2, 5) |
744 | 745 | ||
745 | #define __NR_syscall_count 337 | 746 | #define __NR_seccomp 337 |
747 | __SYSCALL(337, sys_seccomp, 3) | ||
748 | #define __NR_getrandom 338 | ||
749 | __SYSCALL(338, sys_getrandom, 3) | ||
750 | #define __NR_memfd_create 339 | ||
751 | __SYSCALL(339, sys_memfd_create, 2) | ||
752 | |||
753 | #define __NR_syscall_count 340 | ||
746 | 754 | ||
747 | /* | 755 | /* |
748 | * sysxtensa syscall handler | 756 | * sysxtensa syscall handler |
diff --git a/block/blk-merge.c b/block/blk-merge.c index ba99351c0f58..89b97b5e0881 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c | |||
@@ -97,18 +97,22 @@ void blk_recalc_rq_segments(struct request *rq) | |||
97 | 97 | ||
98 | void blk_recount_segments(struct request_queue *q, struct bio *bio) | 98 | void blk_recount_segments(struct request_queue *q, struct bio *bio) |
99 | { | 99 | { |
100 | bool no_sg_merge = !!test_bit(QUEUE_FLAG_NO_SG_MERGE, | 100 | unsigned short seg_cnt; |
101 | &q->queue_flags); | 101 | |
102 | /* estimate segment number by bi_vcnt for non-cloned bio */ | ||
103 | if (bio_flagged(bio, BIO_CLONED)) | ||
104 | seg_cnt = bio_segments(bio); | ||
105 | else | ||
106 | seg_cnt = bio->bi_vcnt; | ||
102 | 107 | ||
103 | if (no_sg_merge && !bio_flagged(bio, BIO_CLONED) && | 108 | if (test_bit(QUEUE_FLAG_NO_SG_MERGE, &q->queue_flags) && |
104 | bio->bi_vcnt < queue_max_segments(q)) | 109 | (seg_cnt < queue_max_segments(q))) |
105 | bio->bi_phys_segments = bio->bi_vcnt; | 110 | bio->bi_phys_segments = seg_cnt; |
106 | else { | 111 | else { |
107 | struct bio *nxt = bio->bi_next; | 112 | struct bio *nxt = bio->bi_next; |
108 | 113 | ||
109 | bio->bi_next = NULL; | 114 | bio->bi_next = NULL; |
110 | bio->bi_phys_segments = __blk_recalc_rq_segments(q, bio, | 115 | bio->bi_phys_segments = __blk_recalc_rq_segments(q, bio, false); |
111 | no_sg_merge); | ||
112 | bio->bi_next = nxt; | 116 | bio->bi_next = nxt; |
113 | } | 117 | } |
114 | 118 | ||
diff --git a/block/blk-mq.c b/block/blk-mq.c index 68929bad9a6a..1d016fc9a8b6 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c | |||
@@ -107,11 +107,7 @@ static void blk_mq_usage_counter_release(struct percpu_ref *ref) | |||
107 | wake_up_all(&q->mq_freeze_wq); | 107 | wake_up_all(&q->mq_freeze_wq); |
108 | } | 108 | } |
109 | 109 | ||
110 | /* | 110 | static void blk_mq_freeze_queue_start(struct request_queue *q) |
111 | * Guarantee no request is in use, so we can change any data structure of | ||
112 | * the queue afterward. | ||
113 | */ | ||
114 | void blk_mq_freeze_queue(struct request_queue *q) | ||
115 | { | 111 | { |
116 | bool freeze; | 112 | bool freeze; |
117 | 113 | ||
@@ -123,9 +119,23 @@ void blk_mq_freeze_queue(struct request_queue *q) | |||
123 | percpu_ref_kill(&q->mq_usage_counter); | 119 | percpu_ref_kill(&q->mq_usage_counter); |
124 | blk_mq_run_queues(q, false); | 120 | blk_mq_run_queues(q, false); |
125 | } | 121 | } |
122 | } | ||
123 | |||
124 | static void blk_mq_freeze_queue_wait(struct request_queue *q) | ||
125 | { | ||
126 | wait_event(q->mq_freeze_wq, percpu_ref_is_zero(&q->mq_usage_counter)); | 126 | wait_event(q->mq_freeze_wq, percpu_ref_is_zero(&q->mq_usage_counter)); |
127 | } | 127 | } |
128 | 128 | ||
129 | /* | ||
130 | * Guarantee no request is in use, so we can change any data structure of | ||
131 | * the queue afterward. | ||
132 | */ | ||
133 | void blk_mq_freeze_queue(struct request_queue *q) | ||
134 | { | ||
135 | blk_mq_freeze_queue_start(q); | ||
136 | blk_mq_freeze_queue_wait(q); | ||
137 | } | ||
138 | |||
129 | static void blk_mq_unfreeze_queue(struct request_queue *q) | 139 | static void blk_mq_unfreeze_queue(struct request_queue *q) |
130 | { | 140 | { |
131 | bool wake; | 141 | bool wake; |
@@ -1921,7 +1931,7 @@ void blk_mq_free_queue(struct request_queue *q) | |||
1921 | /* Basically redo blk_mq_init_queue with queue frozen */ | 1931 | /* Basically redo blk_mq_init_queue with queue frozen */ |
1922 | static void blk_mq_queue_reinit(struct request_queue *q) | 1932 | static void blk_mq_queue_reinit(struct request_queue *q) |
1923 | { | 1933 | { |
1924 | blk_mq_freeze_queue(q); | 1934 | WARN_ON_ONCE(!q->mq_freeze_depth); |
1925 | 1935 | ||
1926 | blk_mq_sysfs_unregister(q); | 1936 | blk_mq_sysfs_unregister(q); |
1927 | 1937 | ||
@@ -1936,8 +1946,6 @@ static void blk_mq_queue_reinit(struct request_queue *q) | |||
1936 | blk_mq_map_swqueue(q); | 1946 | blk_mq_map_swqueue(q); |
1937 | 1947 | ||
1938 | blk_mq_sysfs_register(q); | 1948 | blk_mq_sysfs_register(q); |
1939 | |||
1940 | blk_mq_unfreeze_queue(q); | ||
1941 | } | 1949 | } |
1942 | 1950 | ||
1943 | static int blk_mq_queue_reinit_notify(struct notifier_block *nb, | 1951 | static int blk_mq_queue_reinit_notify(struct notifier_block *nb, |
@@ -1956,8 +1964,25 @@ static int blk_mq_queue_reinit_notify(struct notifier_block *nb, | |||
1956 | return NOTIFY_OK; | 1964 | return NOTIFY_OK; |
1957 | 1965 | ||
1958 | mutex_lock(&all_q_mutex); | 1966 | mutex_lock(&all_q_mutex); |
1967 | |||
1968 | /* | ||
1969 | * We need to freeze and reinit all existing queues. Freezing | ||
1970 | * involves synchronous wait for an RCU grace period and doing it | ||
1971 | * one by one may take a long time. Start freezing all queues in | ||
1972 | * one swoop and then wait for the completions so that freezing can | ||
1973 | * take place in parallel. | ||
1974 | */ | ||
1975 | list_for_each_entry(q, &all_q_list, all_q_node) | ||
1976 | blk_mq_freeze_queue_start(q); | ||
1977 | list_for_each_entry(q, &all_q_list, all_q_node) | ||
1978 | blk_mq_freeze_queue_wait(q); | ||
1979 | |||
1959 | list_for_each_entry(q, &all_q_list, all_q_node) | 1980 | list_for_each_entry(q, &all_q_list, all_q_node) |
1960 | blk_mq_queue_reinit(q); | 1981 | blk_mq_queue_reinit(q); |
1982 | |||
1983 | list_for_each_entry(q, &all_q_list, all_q_node) | ||
1984 | blk_mq_unfreeze_queue(q); | ||
1985 | |||
1961 | mutex_unlock(&all_q_mutex); | 1986 | mutex_unlock(&all_q_mutex); |
1962 | return NOTIFY_OK; | 1987 | return NOTIFY_OK; |
1963 | } | 1988 | } |
diff --git a/block/elevator.c b/block/elevator.c index 24c28b659bb3..afa3b037a17c 100644 --- a/block/elevator.c +++ b/block/elevator.c | |||
@@ -229,7 +229,9 @@ int elevator_init(struct request_queue *q, char *name) | |||
229 | } | 229 | } |
230 | 230 | ||
231 | err = e->ops.elevator_init_fn(q, e); | 231 | err = e->ops.elevator_init_fn(q, e); |
232 | return 0; | 232 | if (err) |
233 | elevator_put(e); | ||
234 | return err; | ||
233 | } | 235 | } |
234 | EXPORT_SYMBOL(elevator_init); | 236 | EXPORT_SYMBOL(elevator_init); |
235 | 237 | ||
diff --git a/block/ioprio.c b/block/ioprio.c index e50170ca7c33..31666c92b46a 100644 --- a/block/ioprio.c +++ b/block/ioprio.c | |||
@@ -157,14 +157,16 @@ out: | |||
157 | 157 | ||
158 | int ioprio_best(unsigned short aprio, unsigned short bprio) | 158 | int ioprio_best(unsigned short aprio, unsigned short bprio) |
159 | { | 159 | { |
160 | unsigned short aclass = IOPRIO_PRIO_CLASS(aprio); | 160 | unsigned short aclass; |
161 | unsigned short bclass = IOPRIO_PRIO_CLASS(bprio); | 161 | unsigned short bclass; |
162 | 162 | ||
163 | if (aclass == IOPRIO_CLASS_NONE) | 163 | if (!ioprio_valid(aprio)) |
164 | aclass = IOPRIO_CLASS_BE; | 164 | aprio = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE, IOPRIO_NORM); |
165 | if (bclass == IOPRIO_CLASS_NONE) | 165 | if (!ioprio_valid(bprio)) |
166 | bclass = IOPRIO_CLASS_BE; | 166 | bprio = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE, IOPRIO_NORM); |
167 | 167 | ||
168 | aclass = IOPRIO_PRIO_CLASS(aprio); | ||
169 | bclass = IOPRIO_PRIO_CLASS(bprio); | ||
168 | if (aclass == bclass) | 170 | if (aclass == bclass) |
169 | return min(aprio, bprio); | 171 | return min(aprio, bprio); |
170 | if (aclass > bclass) | 172 | if (aclass > bclass) |
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c index abb2e65b24cc..b0c2a616c8f9 100644 --- a/block/scsi_ioctl.c +++ b/block/scsi_ioctl.c | |||
@@ -458,7 +458,7 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode, | |||
458 | rq = blk_get_request(q, in_len ? WRITE : READ, __GFP_WAIT); | 458 | rq = blk_get_request(q, in_len ? WRITE : READ, __GFP_WAIT); |
459 | if (IS_ERR(rq)) { | 459 | if (IS_ERR(rq)) { |
460 | err = PTR_ERR(rq); | 460 | err = PTR_ERR(rq); |
461 | goto error; | 461 | goto error_free_buffer; |
462 | } | 462 | } |
463 | blk_rq_set_block_pc(rq); | 463 | blk_rq_set_block_pc(rq); |
464 | 464 | ||
@@ -508,7 +508,7 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode, | |||
508 | 508 | ||
509 | if (bytes && blk_rq_map_kern(q, rq, buffer, bytes, __GFP_WAIT)) { | 509 | if (bytes && blk_rq_map_kern(q, rq, buffer, bytes, __GFP_WAIT)) { |
510 | err = DRIVER_ERROR << 24; | 510 | err = DRIVER_ERROR << 24; |
511 | goto out; | 511 | goto error; |
512 | } | 512 | } |
513 | 513 | ||
514 | memset(sense, 0, sizeof(sense)); | 514 | memset(sense, 0, sizeof(sense)); |
@@ -517,7 +517,6 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode, | |||
517 | 517 | ||
518 | blk_execute_rq(q, disk, rq, 0); | 518 | blk_execute_rq(q, disk, rq, 0); |
519 | 519 | ||
520 | out: | ||
521 | err = rq->errors & 0xff; /* only 8 bit SCSI status */ | 520 | err = rq->errors & 0xff; /* only 8 bit SCSI status */ |
522 | if (err) { | 521 | if (err) { |
523 | if (rq->sense_len && rq->sense) { | 522 | if (rq->sense_len && rq->sense) { |
@@ -532,9 +531,11 @@ out: | |||
532 | } | 531 | } |
533 | 532 | ||
534 | error: | 533 | error: |
534 | blk_put_request(rq); | ||
535 | |||
536 | error_free_buffer: | ||
535 | kfree(buffer); | 537 | kfree(buffer); |
536 | if (rq) | 538 | |
537 | blk_put_request(rq); | ||
538 | return err; | 539 | return err; |
539 | } | 540 | } |
540 | EXPORT_SYMBOL_GPL(sg_scsi_ioctl); | 541 | EXPORT_SYMBOL_GPL(sg_scsi_ioctl); |
diff --git a/drivers/acpi/blacklist.c b/drivers/acpi/blacklist.c index ed122e17636e..7556e7c4a055 100644 --- a/drivers/acpi/blacklist.c +++ b/drivers/acpi/blacklist.c | |||
@@ -290,6 +290,14 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = { | |||
290 | DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 3446"), | 290 | DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 3446"), |
291 | }, | 291 | }, |
292 | }, | 292 | }, |
293 | { | ||
294 | .callback = dmi_disable_osi_win8, | ||
295 | .ident = "Dell Vostro 3546", | ||
296 | .matches = { | ||
297 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | ||
298 | DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 3546"), | ||
299 | }, | ||
300 | }, | ||
293 | 301 | ||
294 | /* | 302 | /* |
295 | * BIOS invocation of _OSI(Linux) is almost always a BIOS bug. | 303 | * BIOS invocation of _OSI(Linux) is almost always a BIOS bug. |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 3d304ff7f095..5f9b74b9b71f 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -126,6 +126,7 @@ static int EC_FLAGS_MSI; /* Out-of-spec MSI controller */ | |||
126 | static int EC_FLAGS_VALIDATE_ECDT; /* ASUStec ECDTs need to be validated */ | 126 | static int EC_FLAGS_VALIDATE_ECDT; /* ASUStec ECDTs need to be validated */ |
127 | static int EC_FLAGS_SKIP_DSDT_SCAN; /* Not all BIOS survive early DSDT scan */ | 127 | static int EC_FLAGS_SKIP_DSDT_SCAN; /* Not all BIOS survive early DSDT scan */ |
128 | static int EC_FLAGS_CLEAR_ON_RESUME; /* Needs acpi_ec_clear() on boot/resume */ | 128 | static int EC_FLAGS_CLEAR_ON_RESUME; /* Needs acpi_ec_clear() on boot/resume */ |
129 | static int EC_FLAGS_QUERY_HANDSHAKE; /* Needs QR_EC issued when SCI_EVT set */ | ||
129 | 130 | ||
130 | /* -------------------------------------------------------------------------- | 131 | /* -------------------------------------------------------------------------- |
131 | * Transaction Management | 132 | * Transaction Management |
@@ -236,13 +237,8 @@ static bool advance_transaction(struct acpi_ec *ec) | |||
236 | } | 237 | } |
237 | return wakeup; | 238 | return wakeup; |
238 | } else { | 239 | } else { |
239 | /* | 240 | if (EC_FLAGS_QUERY_HANDSHAKE && |
240 | * There is firmware refusing to respond QR_EC when SCI_EVT | 241 | !(status & ACPI_EC_FLAG_SCI) && |
241 | * is not set, for which case, we complete the QR_EC | ||
242 | * without issuing it to the firmware. | ||
243 | * https://bugzilla.kernel.org/show_bug.cgi?id=86211 | ||
244 | */ | ||
245 | if (!(status & ACPI_EC_FLAG_SCI) && | ||
246 | (t->command == ACPI_EC_COMMAND_QUERY)) { | 242 | (t->command == ACPI_EC_COMMAND_QUERY)) { |
247 | t->flags |= ACPI_EC_COMMAND_POLL; | 243 | t->flags |= ACPI_EC_COMMAND_POLL; |
248 | t->rdata[t->ri++] = 0x00; | 244 | t->rdata[t->ri++] = 0x00; |
@@ -334,13 +330,13 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, | |||
334 | pr_debug("***** Command(%s) started *****\n", | 330 | pr_debug("***** Command(%s) started *****\n", |
335 | acpi_ec_cmd_string(t->command)); | 331 | acpi_ec_cmd_string(t->command)); |
336 | start_transaction(ec); | 332 | start_transaction(ec); |
337 | spin_unlock_irqrestore(&ec->lock, tmp); | ||
338 | ret = ec_poll(ec); | ||
339 | spin_lock_irqsave(&ec->lock, tmp); | ||
340 | if (ec->curr->command == ACPI_EC_COMMAND_QUERY) { | 333 | if (ec->curr->command == ACPI_EC_COMMAND_QUERY) { |
341 | clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); | 334 | clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); |
342 | pr_debug("***** Event stopped *****\n"); | 335 | pr_debug("***** Event stopped *****\n"); |
343 | } | 336 | } |
337 | spin_unlock_irqrestore(&ec->lock, tmp); | ||
338 | ret = ec_poll(ec); | ||
339 | spin_lock_irqsave(&ec->lock, tmp); | ||
344 | pr_debug("***** Command(%s) stopped *****\n", | 340 | pr_debug("***** Command(%s) stopped *****\n", |
345 | acpi_ec_cmd_string(t->command)); | 341 | acpi_ec_cmd_string(t->command)); |
346 | ec->curr = NULL; | 342 | ec->curr = NULL; |
@@ -1012,6 +1008,18 @@ static int ec_enlarge_storm_threshold(const struct dmi_system_id *id) | |||
1012 | } | 1008 | } |
1013 | 1009 | ||
1014 | /* | 1010 | /* |
1011 | * Acer EC firmware refuses to respond QR_EC when SCI_EVT is not set, for | ||
1012 | * which case, we complete the QR_EC without issuing it to the firmware. | ||
1013 | * https://bugzilla.kernel.org/show_bug.cgi?id=86211 | ||
1014 | */ | ||
1015 | static int ec_flag_query_handshake(const struct dmi_system_id *id) | ||
1016 | { | ||
1017 | pr_debug("Detected the EC firmware requiring QR_EC issued when SCI_EVT set\n"); | ||
1018 | EC_FLAGS_QUERY_HANDSHAKE = 1; | ||
1019 | return 0; | ||
1020 | } | ||
1021 | |||
1022 | /* | ||
1015 | * On some hardware it is necessary to clear events accumulated by the EC during | 1023 | * On some hardware it is necessary to clear events accumulated by the EC during |
1016 | * sleep. These ECs stop reporting GPEs until they are manually polled, if too | 1024 | * sleep. These ECs stop reporting GPEs until they are manually polled, if too |
1017 | * many events are accumulated. (e.g. Samsung Series 5/9 notebooks) | 1025 | * many events are accumulated. (e.g. Samsung Series 5/9 notebooks) |
@@ -1085,6 +1093,9 @@ static struct dmi_system_id ec_dmi_table[] __initdata = { | |||
1085 | { | 1093 | { |
1086 | ec_clear_on_resume, "Samsung hardware", { | 1094 | ec_clear_on_resume, "Samsung hardware", { |
1087 | DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD.")}, NULL}, | 1095 | DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD.")}, NULL}, |
1096 | { | ||
1097 | ec_flag_query_handshake, "Acer hardware", { | ||
1098 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), }, NULL}, | ||
1088 | {}, | 1099 | {}, |
1089 | }; | 1100 | }; |
1090 | 1101 | ||
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index d670158a26c5..0476e90b2091 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -142,6 +142,53 @@ static int create_modalias(struct acpi_device *acpi_dev, char *modalias, | |||
142 | } | 142 | } |
143 | 143 | ||
144 | /* | 144 | /* |
145 | * acpi_companion_match() - Can we match via ACPI companion device | ||
146 | * @dev: Device in question | ||
147 | * | ||
148 | * Check if the given device has an ACPI companion and if that companion has | ||
149 | * a valid list of PNP IDs, and if the device is the first (primary) physical | ||
150 | * device associated with it. | ||
151 | * | ||
152 | * If multiple physical devices are attached to a single ACPI companion, we need | ||
153 | * to be careful. The usage scenario for this kind of relationship is that all | ||
154 | * of the physical devices in question use resources provided by the ACPI | ||
155 | * companion. A typical case is an MFD device where all the sub-devices share | ||
156 | * the parent's ACPI companion. In such cases we can only allow the primary | ||
157 | * (first) physical device to be matched with the help of the companion's PNP | ||
158 | * IDs. | ||
159 | * | ||
160 | * Additional physical devices sharing the ACPI companion can still use | ||
161 | * resources available from it but they will be matched normally using functions | ||
162 | * provided by their bus types (and analogously for their modalias). | ||
163 | */ | ||
164 | static bool acpi_companion_match(const struct device *dev) | ||
165 | { | ||
166 | struct acpi_device *adev; | ||
167 | bool ret; | ||
168 | |||
169 | adev = ACPI_COMPANION(dev); | ||
170 | if (!adev) | ||
171 | return false; | ||
172 | |||
173 | if (list_empty(&adev->pnp.ids)) | ||
174 | return false; | ||
175 | |||
176 | mutex_lock(&adev->physical_node_lock); | ||
177 | if (list_empty(&adev->physical_node_list)) { | ||
178 | ret = false; | ||
179 | } else { | ||
180 | const struct acpi_device_physical_node *node; | ||
181 | |||
182 | node = list_first_entry(&adev->physical_node_list, | ||
183 | struct acpi_device_physical_node, node); | ||
184 | ret = node->dev == dev; | ||
185 | } | ||
186 | mutex_unlock(&adev->physical_node_lock); | ||
187 | |||
188 | return ret; | ||
189 | } | ||
190 | |||
191 | /* | ||
145 | * Creates uevent modalias field for ACPI enumerated devices. | 192 | * Creates uevent modalias field for ACPI enumerated devices. |
146 | * Because the other buses does not support ACPI HIDs & CIDs. | 193 | * Because the other buses does not support ACPI HIDs & CIDs. |
147 | * e.g. for a device with hid:IBM0001 and cid:ACPI0001 you get: | 194 | * e.g. for a device with hid:IBM0001 and cid:ACPI0001 you get: |
@@ -149,20 +196,14 @@ static int create_modalias(struct acpi_device *acpi_dev, char *modalias, | |||
149 | */ | 196 | */ |
150 | int acpi_device_uevent_modalias(struct device *dev, struct kobj_uevent_env *env) | 197 | int acpi_device_uevent_modalias(struct device *dev, struct kobj_uevent_env *env) |
151 | { | 198 | { |
152 | struct acpi_device *acpi_dev; | ||
153 | int len; | 199 | int len; |
154 | 200 | ||
155 | acpi_dev = ACPI_COMPANION(dev); | 201 | if (!acpi_companion_match(dev)) |
156 | if (!acpi_dev) | ||
157 | return -ENODEV; | ||
158 | |||
159 | /* Fall back to bus specific way of modalias exporting */ | ||
160 | if (list_empty(&acpi_dev->pnp.ids)) | ||
161 | return -ENODEV; | 202 | return -ENODEV; |
162 | 203 | ||
163 | if (add_uevent_var(env, "MODALIAS=")) | 204 | if (add_uevent_var(env, "MODALIAS=")) |
164 | return -ENOMEM; | 205 | return -ENOMEM; |
165 | len = create_modalias(acpi_dev, &env->buf[env->buflen - 1], | 206 | len = create_modalias(ACPI_COMPANION(dev), &env->buf[env->buflen - 1], |
166 | sizeof(env->buf) - env->buflen); | 207 | sizeof(env->buf) - env->buflen); |
167 | if (len <= 0) | 208 | if (len <= 0) |
168 | return len; | 209 | return len; |
@@ -179,18 +220,12 @@ EXPORT_SYMBOL_GPL(acpi_device_uevent_modalias); | |||
179 | */ | 220 | */ |
180 | int acpi_device_modalias(struct device *dev, char *buf, int size) | 221 | int acpi_device_modalias(struct device *dev, char *buf, int size) |
181 | { | 222 | { |
182 | struct acpi_device *acpi_dev; | ||
183 | int len; | 223 | int len; |
184 | 224 | ||
185 | acpi_dev = ACPI_COMPANION(dev); | 225 | if (!acpi_companion_match(dev)) |
186 | if (!acpi_dev) | ||
187 | return -ENODEV; | 226 | return -ENODEV; |
188 | 227 | ||
189 | /* Fall back to bus specific way of modalias exporting */ | 228 | len = create_modalias(ACPI_COMPANION(dev), buf, size -1); |
190 | if (list_empty(&acpi_dev->pnp.ids)) | ||
191 | return -ENODEV; | ||
192 | |||
193 | len = create_modalias(acpi_dev, buf, size -1); | ||
194 | if (len <= 0) | 229 | if (len <= 0) |
195 | return len; | 230 | return len; |
196 | buf[len++] = '\n'; | 231 | buf[len++] = '\n'; |
@@ -853,6 +888,9 @@ const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids, | |||
853 | if (!ids || !handle || acpi_bus_get_device(handle, &adev)) | 888 | if (!ids || !handle || acpi_bus_get_device(handle, &adev)) |
854 | return NULL; | 889 | return NULL; |
855 | 890 | ||
891 | if (!acpi_companion_match(dev)) | ||
892 | return NULL; | ||
893 | |||
856 | return __acpi_match_device(adev, ids); | 894 | return __acpi_match_device(adev, ids); |
857 | } | 895 | } |
858 | EXPORT_SYMBOL_GPL(acpi_match_device); | 896 | EXPORT_SYMBOL_GPL(acpi_match_device); |
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 5f039f191067..e45f83789809 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -60,6 +60,7 @@ enum board_ids { | |||
60 | /* board IDs by feature in alphabetical order */ | 60 | /* board IDs by feature in alphabetical order */ |
61 | board_ahci, | 61 | board_ahci, |
62 | board_ahci_ign_iferr, | 62 | board_ahci_ign_iferr, |
63 | board_ahci_nomsi, | ||
63 | board_ahci_noncq, | 64 | board_ahci_noncq, |
64 | board_ahci_nosntf, | 65 | board_ahci_nosntf, |
65 | board_ahci_yes_fbs, | 66 | board_ahci_yes_fbs, |
@@ -121,6 +122,13 @@ static const struct ata_port_info ahci_port_info[] = { | |||
121 | .udma_mask = ATA_UDMA6, | 122 | .udma_mask = ATA_UDMA6, |
122 | .port_ops = &ahci_ops, | 123 | .port_ops = &ahci_ops, |
123 | }, | 124 | }, |
125 | [board_ahci_nomsi] = { | ||
126 | AHCI_HFLAGS (AHCI_HFLAG_NO_MSI), | ||
127 | .flags = AHCI_FLAG_COMMON, | ||
128 | .pio_mask = ATA_PIO4, | ||
129 | .udma_mask = ATA_UDMA6, | ||
130 | .port_ops = &ahci_ops, | ||
131 | }, | ||
124 | [board_ahci_noncq] = { | 132 | [board_ahci_noncq] = { |
125 | AHCI_HFLAGS (AHCI_HFLAG_NO_NCQ), | 133 | AHCI_HFLAGS (AHCI_HFLAG_NO_NCQ), |
126 | .flags = AHCI_FLAG_COMMON, | 134 | .flags = AHCI_FLAG_COMMON, |
@@ -313,6 +321,11 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
313 | { PCI_VDEVICE(INTEL, 0x8c87), board_ahci }, /* 9 Series RAID */ | 321 | { PCI_VDEVICE(INTEL, 0x8c87), board_ahci }, /* 9 Series RAID */ |
314 | { PCI_VDEVICE(INTEL, 0x8c8e), board_ahci }, /* 9 Series RAID */ | 322 | { PCI_VDEVICE(INTEL, 0x8c8e), board_ahci }, /* 9 Series RAID */ |
315 | { PCI_VDEVICE(INTEL, 0x8c8f), board_ahci }, /* 9 Series RAID */ | 323 | { PCI_VDEVICE(INTEL, 0x8c8f), board_ahci }, /* 9 Series RAID */ |
324 | { PCI_VDEVICE(INTEL, 0xa103), board_ahci }, /* Sunrise Point-H AHCI */ | ||
325 | { PCI_VDEVICE(INTEL, 0xa103), board_ahci }, /* Sunrise Point-H RAID */ | ||
326 | { PCI_VDEVICE(INTEL, 0xa105), board_ahci }, /* Sunrise Point-H RAID */ | ||
327 | { PCI_VDEVICE(INTEL, 0xa107), board_ahci }, /* Sunrise Point-H RAID */ | ||
328 | { PCI_VDEVICE(INTEL, 0xa10f), board_ahci }, /* Sunrise Point-H RAID */ | ||
316 | 329 | ||
317 | /* JMicron 360/1/3/5/6, match class to avoid IDE function */ | 330 | /* JMicron 360/1/3/5/6, match class to avoid IDE function */ |
318 | { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, | 331 | { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, |
@@ -475,10 +488,10 @@ static const struct pci_device_id ahci_pci_tbl[] = { | |||
475 | { PCI_VDEVICE(ASMEDIA, 0x0612), board_ahci }, /* ASM1062 */ | 488 | { PCI_VDEVICE(ASMEDIA, 0x0612), board_ahci }, /* ASM1062 */ |
476 | 489 | ||
477 | /* | 490 | /* |
478 | * Samsung SSDs found on some macbooks. NCQ times out. | 491 | * Samsung SSDs found on some macbooks. NCQ times out if MSI is |
479 | * https://bugzilla.kernel.org/show_bug.cgi?id=60731 | 492 | * enabled. https://bugzilla.kernel.org/show_bug.cgi?id=60731 |
480 | */ | 493 | */ |
481 | { PCI_VDEVICE(SAMSUNG, 0x1600), board_ahci_noncq }, | 494 | { PCI_VDEVICE(SAMSUNG, 0x1600), board_ahci_nomsi }, |
482 | 495 | ||
483 | /* Enmotus */ | 496 | /* Enmotus */ |
484 | { PCI_DEVICE(0x1c44, 0x8000), board_ahci }, | 497 | { PCI_DEVICE(0x1c44, 0x8000), board_ahci }, |
@@ -514,12 +527,9 @@ MODULE_PARM_DESC(marvell_enable, "Marvell SATA via AHCI (1 = enabled)"); | |||
514 | static void ahci_pci_save_initial_config(struct pci_dev *pdev, | 527 | static void ahci_pci_save_initial_config(struct pci_dev *pdev, |
515 | struct ahci_host_priv *hpriv) | 528 | struct ahci_host_priv *hpriv) |
516 | { | 529 | { |
517 | unsigned int force_port_map = 0; | ||
518 | unsigned int mask_port_map = 0; | ||
519 | |||
520 | if (pdev->vendor == PCI_VENDOR_ID_JMICRON && pdev->device == 0x2361) { | 530 | if (pdev->vendor == PCI_VENDOR_ID_JMICRON && pdev->device == 0x2361) { |
521 | dev_info(&pdev->dev, "JMB361 has only one port\n"); | 531 | dev_info(&pdev->dev, "JMB361 has only one port\n"); |
522 | force_port_map = 1; | 532 | hpriv->force_port_map = 1; |
523 | } | 533 | } |
524 | 534 | ||
525 | /* | 535 | /* |
@@ -529,9 +539,9 @@ static void ahci_pci_save_initial_config(struct pci_dev *pdev, | |||
529 | */ | 539 | */ |
530 | if (hpriv->flags & AHCI_HFLAG_MV_PATA) { | 540 | if (hpriv->flags & AHCI_HFLAG_MV_PATA) { |
531 | if (pdev->device == 0x6121) | 541 | if (pdev->device == 0x6121) |
532 | mask_port_map = 0x3; | 542 | hpriv->mask_port_map = 0x3; |
533 | else | 543 | else |
534 | mask_port_map = 0xf; | 544 | hpriv->mask_port_map = 0xf; |
535 | dev_info(&pdev->dev, | 545 | dev_info(&pdev->dev, |
536 | "Disabling your PATA port. Use the boot option 'ahci.marvell_enable=0' to avoid this.\n"); | 546 | "Disabling your PATA port. Use the boot option 'ahci.marvell_enable=0' to avoid this.\n"); |
537 | } | 547 | } |
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c index 5eb61c9e63da..97683e45ab04 100644 --- a/drivers/ata/libahci.c +++ b/drivers/ata/libahci.c | |||
@@ -1778,16 +1778,15 @@ static void ahci_handle_port_interrupt(struct ata_port *ap, | |||
1778 | } | 1778 | } |
1779 | } | 1779 | } |
1780 | 1780 | ||
1781 | static void ahci_update_intr_status(struct ata_port *ap) | 1781 | static void ahci_port_intr(struct ata_port *ap) |
1782 | { | 1782 | { |
1783 | void __iomem *port_mmio = ahci_port_base(ap); | 1783 | void __iomem *port_mmio = ahci_port_base(ap); |
1784 | struct ahci_port_priv *pp = ap->private_data; | ||
1785 | u32 status; | 1784 | u32 status; |
1786 | 1785 | ||
1787 | status = readl(port_mmio + PORT_IRQ_STAT); | 1786 | status = readl(port_mmio + PORT_IRQ_STAT); |
1788 | writel(status, port_mmio + PORT_IRQ_STAT); | 1787 | writel(status, port_mmio + PORT_IRQ_STAT); |
1789 | 1788 | ||
1790 | atomic_or(status, &pp->intr_status); | 1789 | ahci_handle_port_interrupt(ap, port_mmio, status); |
1791 | } | 1790 | } |
1792 | 1791 | ||
1793 | static irqreturn_t ahci_port_thread_fn(int irq, void *dev_instance) | 1792 | static irqreturn_t ahci_port_thread_fn(int irq, void *dev_instance) |
@@ -1808,34 +1807,6 @@ static irqreturn_t ahci_port_thread_fn(int irq, void *dev_instance) | |||
1808 | return IRQ_HANDLED; | 1807 | return IRQ_HANDLED; |
1809 | } | 1808 | } |
1810 | 1809 | ||
1811 | irqreturn_t ahci_thread_fn(int irq, void *dev_instance) | ||
1812 | { | ||
1813 | struct ata_host *host = dev_instance; | ||
1814 | struct ahci_host_priv *hpriv = host->private_data; | ||
1815 | u32 irq_masked = hpriv->port_map; | ||
1816 | unsigned int i; | ||
1817 | |||
1818 | for (i = 0; i < host->n_ports; i++) { | ||
1819 | struct ata_port *ap; | ||
1820 | |||
1821 | if (!(irq_masked & (1 << i))) | ||
1822 | continue; | ||
1823 | |||
1824 | ap = host->ports[i]; | ||
1825 | if (ap) { | ||
1826 | ahci_port_thread_fn(irq, ap); | ||
1827 | VPRINTK("port %u\n", i); | ||
1828 | } else { | ||
1829 | VPRINTK("port %u (no irq)\n", i); | ||
1830 | if (ata_ratelimit()) | ||
1831 | dev_warn(host->dev, | ||
1832 | "interrupt on disabled port %u\n", i); | ||
1833 | } | ||
1834 | } | ||
1835 | |||
1836 | return IRQ_HANDLED; | ||
1837 | } | ||
1838 | |||
1839 | static irqreturn_t ahci_multi_irqs_intr(int irq, void *dev_instance) | 1810 | static irqreturn_t ahci_multi_irqs_intr(int irq, void *dev_instance) |
1840 | { | 1811 | { |
1841 | struct ata_port *ap = dev_instance; | 1812 | struct ata_port *ap = dev_instance; |
@@ -1875,6 +1846,8 @@ static irqreturn_t ahci_single_irq_intr(int irq, void *dev_instance) | |||
1875 | 1846 | ||
1876 | irq_masked = irq_stat & hpriv->port_map; | 1847 | irq_masked = irq_stat & hpriv->port_map; |
1877 | 1848 | ||
1849 | spin_lock(&host->lock); | ||
1850 | |||
1878 | for (i = 0; i < host->n_ports; i++) { | 1851 | for (i = 0; i < host->n_ports; i++) { |
1879 | struct ata_port *ap; | 1852 | struct ata_port *ap; |
1880 | 1853 | ||
@@ -1883,7 +1856,7 @@ static irqreturn_t ahci_single_irq_intr(int irq, void *dev_instance) | |||
1883 | 1856 | ||
1884 | ap = host->ports[i]; | 1857 | ap = host->ports[i]; |
1885 | if (ap) { | 1858 | if (ap) { |
1886 | ahci_update_intr_status(ap); | 1859 | ahci_port_intr(ap); |
1887 | VPRINTK("port %u\n", i); | 1860 | VPRINTK("port %u\n", i); |
1888 | } else { | 1861 | } else { |
1889 | VPRINTK("port %u (no irq)\n", i); | 1862 | VPRINTK("port %u (no irq)\n", i); |
@@ -1906,9 +1879,11 @@ static irqreturn_t ahci_single_irq_intr(int irq, void *dev_instance) | |||
1906 | */ | 1879 | */ |
1907 | writel(irq_stat, mmio + HOST_IRQ_STAT); | 1880 | writel(irq_stat, mmio + HOST_IRQ_STAT); |
1908 | 1881 | ||
1882 | spin_unlock(&host->lock); | ||
1883 | |||
1909 | VPRINTK("EXIT\n"); | 1884 | VPRINTK("EXIT\n"); |
1910 | 1885 | ||
1911 | return handled ? IRQ_WAKE_THREAD : IRQ_NONE; | 1886 | return IRQ_RETVAL(handled); |
1912 | } | 1887 | } |
1913 | 1888 | ||
1914 | unsigned int ahci_qc_issue(struct ata_queued_cmd *qc) | 1889 | unsigned int ahci_qc_issue(struct ata_queued_cmd *qc) |
@@ -2320,8 +2295,13 @@ static int ahci_port_start(struct ata_port *ap) | |||
2320 | */ | 2295 | */ |
2321 | pp->intr_mask = DEF_PORT_IRQ; | 2296 | pp->intr_mask = DEF_PORT_IRQ; |
2322 | 2297 | ||
2323 | spin_lock_init(&pp->lock); | 2298 | /* |
2324 | ap->lock = &pp->lock; | 2299 | * Switch to per-port locking in case each port has its own MSI vector. |
2300 | */ | ||
2301 | if ((hpriv->flags & AHCI_HFLAG_MULTI_MSI)) { | ||
2302 | spin_lock_init(&pp->lock); | ||
2303 | ap->lock = &pp->lock; | ||
2304 | } | ||
2325 | 2305 | ||
2326 | ap->private_data = pp; | 2306 | ap->private_data = pp; |
2327 | 2307 | ||
@@ -2482,31 +2462,6 @@ out_free_irqs: | |||
2482 | return rc; | 2462 | return rc; |
2483 | } | 2463 | } |
2484 | 2464 | ||
2485 | static int ahci_host_activate_single_irq(struct ata_host *host, int irq, | ||
2486 | struct scsi_host_template *sht) | ||
2487 | { | ||
2488 | int i, rc; | ||
2489 | |||
2490 | rc = ata_host_start(host); | ||
2491 | if (rc) | ||
2492 | return rc; | ||
2493 | |||
2494 | rc = devm_request_threaded_irq(host->dev, irq, ahci_single_irq_intr, | ||
2495 | ahci_thread_fn, IRQF_SHARED, | ||
2496 | dev_driver_string(host->dev), host); | ||
2497 | if (rc) | ||
2498 | return rc; | ||
2499 | |||
2500 | for (i = 0; i < host->n_ports; i++) | ||
2501 | ata_port_desc(host->ports[i], "irq %d", irq); | ||
2502 | |||
2503 | rc = ata_host_register(host, sht); | ||
2504 | if (rc) | ||
2505 | devm_free_irq(host->dev, irq, host); | ||
2506 | |||
2507 | return rc; | ||
2508 | } | ||
2509 | |||
2510 | /** | 2465 | /** |
2511 | * ahci_host_activate - start AHCI host, request IRQs and register it | 2466 | * ahci_host_activate - start AHCI host, request IRQs and register it |
2512 | * @host: target ATA host | 2467 | * @host: target ATA host |
@@ -2532,7 +2487,8 @@ int ahci_host_activate(struct ata_host *host, int irq, | |||
2532 | if (hpriv->flags & AHCI_HFLAG_MULTI_MSI) | 2487 | if (hpriv->flags & AHCI_HFLAG_MULTI_MSI) |
2533 | rc = ahci_host_activate_multi_irqs(host, irq, sht); | 2488 | rc = ahci_host_activate_multi_irqs(host, irq, sht); |
2534 | else | 2489 | else |
2535 | rc = ahci_host_activate_single_irq(host, irq, sht); | 2490 | rc = ata_host_activate(host, irq, ahci_single_irq_intr, |
2491 | IRQF_SHARED, sht); | ||
2536 | return rc; | 2492 | return rc; |
2537 | } | 2493 | } |
2538 | EXPORT_SYMBOL_GPL(ahci_host_activate); | 2494 | EXPORT_SYMBOL_GPL(ahci_host_activate); |
diff --git a/drivers/ata/sata_rcar.c b/drivers/ata/sata_rcar.c index 61eb6d77dac7..ea1fbc1d4c5f 100644 --- a/drivers/ata/sata_rcar.c +++ b/drivers/ata/sata_rcar.c | |||
@@ -146,6 +146,7 @@ | |||
146 | enum sata_rcar_type { | 146 | enum sata_rcar_type { |
147 | RCAR_GEN1_SATA, | 147 | RCAR_GEN1_SATA, |
148 | RCAR_GEN2_SATA, | 148 | RCAR_GEN2_SATA, |
149 | RCAR_R8A7790_ES1_SATA, | ||
149 | }; | 150 | }; |
150 | 151 | ||
151 | struct sata_rcar_priv { | 152 | struct sata_rcar_priv { |
@@ -763,6 +764,9 @@ static void sata_rcar_setup_port(struct ata_host *host) | |||
763 | ap->udma_mask = ATA_UDMA6; | 764 | ap->udma_mask = ATA_UDMA6; |
764 | ap->flags |= ATA_FLAG_SATA; | 765 | ap->flags |= ATA_FLAG_SATA; |
765 | 766 | ||
767 | if (priv->type == RCAR_R8A7790_ES1_SATA) | ||
768 | ap->flags |= ATA_FLAG_NO_DIPM; | ||
769 | |||
766 | ioaddr->cmd_addr = base + SDATA_REG; | 770 | ioaddr->cmd_addr = base + SDATA_REG; |
767 | ioaddr->ctl_addr = base + SSDEVCON_REG; | 771 | ioaddr->ctl_addr = base + SSDEVCON_REG; |
768 | ioaddr->scr_addr = base + SCRSSTS_REG; | 772 | ioaddr->scr_addr = base + SCRSSTS_REG; |
@@ -792,6 +796,7 @@ static void sata_rcar_init_controller(struct ata_host *host) | |||
792 | sata_rcar_gen1_phy_init(priv); | 796 | sata_rcar_gen1_phy_init(priv); |
793 | break; | 797 | break; |
794 | case RCAR_GEN2_SATA: | 798 | case RCAR_GEN2_SATA: |
799 | case RCAR_R8A7790_ES1_SATA: | ||
795 | sata_rcar_gen2_phy_init(priv); | 800 | sata_rcar_gen2_phy_init(priv); |
796 | break; | 801 | break; |
797 | default: | 802 | default: |
@@ -838,9 +843,17 @@ static struct of_device_id sata_rcar_match[] = { | |||
838 | .data = (void *)RCAR_GEN2_SATA | 843 | .data = (void *)RCAR_GEN2_SATA |
839 | }, | 844 | }, |
840 | { | 845 | { |
846 | .compatible = "renesas,sata-r8a7790-es1", | ||
847 | .data = (void *)RCAR_R8A7790_ES1_SATA | ||
848 | }, | ||
849 | { | ||
841 | .compatible = "renesas,sata-r8a7791", | 850 | .compatible = "renesas,sata-r8a7791", |
842 | .data = (void *)RCAR_GEN2_SATA | 851 | .data = (void *)RCAR_GEN2_SATA |
843 | }, | 852 | }, |
853 | { | ||
854 | .compatible = "renesas,sata-r8a7793", | ||
855 | .data = (void *)RCAR_GEN2_SATA | ||
856 | }, | ||
844 | { }, | 857 | { }, |
845 | }; | 858 | }; |
846 | MODULE_DEVICE_TABLE(of, sata_rcar_match); | 859 | MODULE_DEVICE_TABLE(of, sata_rcar_match); |
@@ -849,7 +862,9 @@ static const struct platform_device_id sata_rcar_id_table[] = { | |||
849 | { "sata_rcar", RCAR_GEN1_SATA }, /* Deprecated by "sata-r8a7779" */ | 862 | { "sata_rcar", RCAR_GEN1_SATA }, /* Deprecated by "sata-r8a7779" */ |
850 | { "sata-r8a7779", RCAR_GEN1_SATA }, | 863 | { "sata-r8a7779", RCAR_GEN1_SATA }, |
851 | { "sata-r8a7790", RCAR_GEN2_SATA }, | 864 | { "sata-r8a7790", RCAR_GEN2_SATA }, |
865 | { "sata-r8a7790-es1", RCAR_R8A7790_ES1_SATA }, | ||
852 | { "sata-r8a7791", RCAR_GEN2_SATA }, | 866 | { "sata-r8a7791", RCAR_GEN2_SATA }, |
867 | { "sata-r8a7793", RCAR_GEN2_SATA }, | ||
853 | { }, | 868 | { }, |
854 | }; | 869 | }; |
855 | MODULE_DEVICE_TABLE(platform, sata_rcar_id_table); | 870 | MODULE_DEVICE_TABLE(platform, sata_rcar_id_table); |
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig index 61a33f4ba608..df04227d00cf 100644 --- a/drivers/base/Kconfig +++ b/drivers/base/Kconfig | |||
@@ -171,20 +171,23 @@ config WANT_DEV_COREDUMP | |||
171 | Drivers should "select" this option if they desire to use the | 171 | Drivers should "select" this option if they desire to use the |
172 | device coredump mechanism. | 172 | device coredump mechanism. |
173 | 173 | ||
174 | config DISABLE_DEV_COREDUMP | 174 | config ALLOW_DEV_COREDUMP |
175 | bool "Disable device coredump" if EXPERT | 175 | bool "Allow device coredump" if EXPERT |
176 | default y | ||
176 | help | 177 | help |
177 | Disable the device coredump mechanism despite drivers wanting to | 178 | This option controls if the device coredump mechanism is available or |
178 | use it; this allows for more sensitive systems or systems that | 179 | not; if disabled, the mechanism will be omitted even if drivers that |
179 | don't want to ever access the information to not have the code, | 180 | can use it are enabled. |
180 | nor keep any data. | 181 | Say 'N' for more sensitive systems or systems that don't want |
182 | to ever access the information to not have the code, nor keep any | ||
183 | data. | ||
181 | 184 | ||
182 | If unsure, say N. | 185 | If unsure, say Y. |
183 | 186 | ||
184 | config DEV_COREDUMP | 187 | config DEV_COREDUMP |
185 | bool | 188 | bool |
186 | default y if WANT_DEV_COREDUMP | 189 | default y if WANT_DEV_COREDUMP |
187 | depends on !DISABLE_DEV_COREDUMP | 190 | depends on ALLOW_DEV_COREDUMP |
188 | 191 | ||
189 | config DEBUG_DRIVER | 192 | config DEBUG_DRIVER |
190 | bool "Driver Core verbose debug messages" | 193 | bool "Driver Core verbose debug messages" |
diff --git a/drivers/base/core.c b/drivers/base/core.c index 14d162952c3b..842d04707de6 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -724,12 +724,12 @@ class_dir_create_and_add(struct class *class, struct kobject *parent_kobj) | |||
724 | return &dir->kobj; | 724 | return &dir->kobj; |
725 | } | 725 | } |
726 | 726 | ||
727 | static DEFINE_MUTEX(gdp_mutex); | ||
727 | 728 | ||
728 | static struct kobject *get_device_parent(struct device *dev, | 729 | static struct kobject *get_device_parent(struct device *dev, |
729 | struct device *parent) | 730 | struct device *parent) |
730 | { | 731 | { |
731 | if (dev->class) { | 732 | if (dev->class) { |
732 | static DEFINE_MUTEX(gdp_mutex); | ||
733 | struct kobject *kobj = NULL; | 733 | struct kobject *kobj = NULL; |
734 | struct kobject *parent_kobj; | 734 | struct kobject *parent_kobj; |
735 | struct kobject *k; | 735 | struct kobject *k; |
@@ -793,7 +793,9 @@ static void cleanup_glue_dir(struct device *dev, struct kobject *glue_dir) | |||
793 | glue_dir->kset != &dev->class->p->glue_dirs) | 793 | glue_dir->kset != &dev->class->p->glue_dirs) |
794 | return; | 794 | return; |
795 | 795 | ||
796 | mutex_lock(&gdp_mutex); | ||
796 | kobject_put(glue_dir); | 797 | kobject_put(glue_dir); |
798 | mutex_unlock(&gdp_mutex); | ||
797 | } | 799 | } |
798 | 800 | ||
799 | static void cleanup_device_parent(struct device *dev) | 801 | static void cleanup_device_parent(struct device *dev) |
diff --git a/drivers/base/dma-contiguous.c b/drivers/base/dma-contiguous.c index 473ff4892401..950fff9ce453 100644 --- a/drivers/base/dma-contiguous.c +++ b/drivers/base/dma-contiguous.c | |||
@@ -223,9 +223,10 @@ bool dma_release_from_contiguous(struct device *dev, struct page *pages, | |||
223 | #undef pr_fmt | 223 | #undef pr_fmt |
224 | #define pr_fmt(fmt) fmt | 224 | #define pr_fmt(fmt) fmt |
225 | 225 | ||
226 | static void rmem_cma_device_init(struct reserved_mem *rmem, struct device *dev) | 226 | static int rmem_cma_device_init(struct reserved_mem *rmem, struct device *dev) |
227 | { | 227 | { |
228 | dev_set_cma_area(dev, rmem->priv); | 228 | dev_set_cma_area(dev, rmem->priv); |
229 | return 0; | ||
229 | } | 230 | } |
230 | 231 | ||
231 | static void rmem_cma_device_release(struct reserved_mem *rmem, | 232 | static void rmem_cma_device_release(struct reserved_mem *rmem, |
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 40bc2f4072cc..fb83d4acd400 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c | |||
@@ -361,9 +361,19 @@ static int __pm_genpd_save_device(struct pm_domain_data *pdd, | |||
361 | struct device *dev = pdd->dev; | 361 | struct device *dev = pdd->dev; |
362 | int ret = 0; | 362 | int ret = 0; |
363 | 363 | ||
364 | if (gpd_data->need_restore) | 364 | if (gpd_data->need_restore > 0) |
365 | return 0; | 365 | return 0; |
366 | 366 | ||
367 | /* | ||
368 | * If the value of the need_restore flag is still unknown at this point, | ||
369 | * we trust that pm_genpd_poweroff() has verified that the device is | ||
370 | * already runtime PM suspended. | ||
371 | */ | ||
372 | if (gpd_data->need_restore < 0) { | ||
373 | gpd_data->need_restore = 1; | ||
374 | return 0; | ||
375 | } | ||
376 | |||
367 | mutex_unlock(&genpd->lock); | 377 | mutex_unlock(&genpd->lock); |
368 | 378 | ||
369 | genpd_start_dev(genpd, dev); | 379 | genpd_start_dev(genpd, dev); |
@@ -373,7 +383,7 @@ static int __pm_genpd_save_device(struct pm_domain_data *pdd, | |||
373 | mutex_lock(&genpd->lock); | 383 | mutex_lock(&genpd->lock); |
374 | 384 | ||
375 | if (!ret) | 385 | if (!ret) |
376 | gpd_data->need_restore = true; | 386 | gpd_data->need_restore = 1; |
377 | 387 | ||
378 | return ret; | 388 | return ret; |
379 | } | 389 | } |
@@ -389,12 +399,17 @@ static void __pm_genpd_restore_device(struct pm_domain_data *pdd, | |||
389 | { | 399 | { |
390 | struct generic_pm_domain_data *gpd_data = to_gpd_data(pdd); | 400 | struct generic_pm_domain_data *gpd_data = to_gpd_data(pdd); |
391 | struct device *dev = pdd->dev; | 401 | struct device *dev = pdd->dev; |
392 | bool need_restore = gpd_data->need_restore; | 402 | int need_restore = gpd_data->need_restore; |
393 | 403 | ||
394 | gpd_data->need_restore = false; | 404 | gpd_data->need_restore = 0; |
395 | mutex_unlock(&genpd->lock); | 405 | mutex_unlock(&genpd->lock); |
396 | 406 | ||
397 | genpd_start_dev(genpd, dev); | 407 | genpd_start_dev(genpd, dev); |
408 | |||
409 | /* | ||
410 | * Call genpd_restore_dev() for recently added devices too (need_restore | ||
411 | * is negative then). | ||
412 | */ | ||
398 | if (need_restore) | 413 | if (need_restore) |
399 | genpd_restore_dev(genpd, dev); | 414 | genpd_restore_dev(genpd, dev); |
400 | 415 | ||
@@ -603,6 +618,7 @@ static void genpd_power_off_work_fn(struct work_struct *work) | |||
603 | static int pm_genpd_runtime_suspend(struct device *dev) | 618 | static int pm_genpd_runtime_suspend(struct device *dev) |
604 | { | 619 | { |
605 | struct generic_pm_domain *genpd; | 620 | struct generic_pm_domain *genpd; |
621 | struct generic_pm_domain_data *gpd_data; | ||
606 | bool (*stop_ok)(struct device *__dev); | 622 | bool (*stop_ok)(struct device *__dev); |
607 | int ret; | 623 | int ret; |
608 | 624 | ||
@@ -628,6 +644,16 @@ static int pm_genpd_runtime_suspend(struct device *dev) | |||
628 | return 0; | 644 | return 0; |
629 | 645 | ||
630 | mutex_lock(&genpd->lock); | 646 | mutex_lock(&genpd->lock); |
647 | |||
648 | /* | ||
649 | * If we have an unknown state of the need_restore flag, it means none | ||
650 | * of the runtime PM callbacks has been invoked yet. Let's update the | ||
651 | * flag to reflect that the current state is active. | ||
652 | */ | ||
653 | gpd_data = to_gpd_data(dev->power.subsys_data->domain_data); | ||
654 | if (gpd_data->need_restore < 0) | ||
655 | gpd_data->need_restore = 0; | ||
656 | |||
631 | genpd->in_progress++; | 657 | genpd->in_progress++; |
632 | pm_genpd_poweroff(genpd); | 658 | pm_genpd_poweroff(genpd); |
633 | genpd->in_progress--; | 659 | genpd->in_progress--; |
@@ -1437,12 +1463,12 @@ int __pm_genpd_add_device(struct generic_pm_domain *genpd, struct device *dev, | |||
1437 | spin_unlock_irq(&dev->power.lock); | 1463 | spin_unlock_irq(&dev->power.lock); |
1438 | 1464 | ||
1439 | if (genpd->attach_dev) | 1465 | if (genpd->attach_dev) |
1440 | genpd->attach_dev(dev); | 1466 | genpd->attach_dev(genpd, dev); |
1441 | 1467 | ||
1442 | mutex_lock(&gpd_data->lock); | 1468 | mutex_lock(&gpd_data->lock); |
1443 | gpd_data->base.dev = dev; | 1469 | gpd_data->base.dev = dev; |
1444 | list_add_tail(&gpd_data->base.list_node, &genpd->dev_list); | 1470 | list_add_tail(&gpd_data->base.list_node, &genpd->dev_list); |
1445 | gpd_data->need_restore = genpd->status == GPD_STATE_POWER_OFF; | 1471 | gpd_data->need_restore = -1; |
1446 | gpd_data->td.constraint_changed = true; | 1472 | gpd_data->td.constraint_changed = true; |
1447 | gpd_data->td.effective_constraint_ns = -1; | 1473 | gpd_data->td.effective_constraint_ns = -1; |
1448 | mutex_unlock(&gpd_data->lock); | 1474 | mutex_unlock(&gpd_data->lock); |
@@ -1499,7 +1525,7 @@ int pm_genpd_remove_device(struct generic_pm_domain *genpd, | |||
1499 | genpd->max_off_time_changed = true; | 1525 | genpd->max_off_time_changed = true; |
1500 | 1526 | ||
1501 | if (genpd->detach_dev) | 1527 | if (genpd->detach_dev) |
1502 | genpd->detach_dev(dev); | 1528 | genpd->detach_dev(genpd, dev); |
1503 | 1529 | ||
1504 | spin_lock_irq(&dev->power.lock); | 1530 | spin_lock_irq(&dev->power.lock); |
1505 | 1531 | ||
@@ -1546,7 +1572,7 @@ void pm_genpd_dev_need_restore(struct device *dev, bool val) | |||
1546 | 1572 | ||
1547 | psd = dev_to_psd(dev); | 1573 | psd = dev_to_psd(dev); |
1548 | if (psd && psd->domain_data) | 1574 | if (psd && psd->domain_data) |
1549 | to_gpd_data(psd->domain_data)->need_restore = val; | 1575 | to_gpd_data(psd->domain_data)->need_restore = val ? 1 : 0; |
1550 | 1576 | ||
1551 | spin_unlock_irqrestore(&dev->power.lock, flags); | 1577 | spin_unlock_irqrestore(&dev->power.lock, flags); |
1552 | } | 1578 | } |
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 44973196d3fd..9717d5f20139 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
@@ -1266,6 +1266,8 @@ int dpm_suspend_late(pm_message_t state) | |||
1266 | } | 1266 | } |
1267 | mutex_unlock(&dpm_list_mtx); | 1267 | mutex_unlock(&dpm_list_mtx); |
1268 | async_synchronize_full(); | 1268 | async_synchronize_full(); |
1269 | if (!error) | ||
1270 | error = async_error; | ||
1269 | if (error) { | 1271 | if (error) { |
1270 | suspend_stats.failed_suspend_late++; | 1272 | suspend_stats.failed_suspend_late++; |
1271 | dpm_save_failed_step(SUSPEND_SUSPEND_LATE); | 1273 | dpm_save_failed_step(SUSPEND_SUSPEND_LATE); |
diff --git a/drivers/bcma/host_pci.c b/drivers/bcma/host_pci.c index 1e5ac0a79696..cd9161a8b3a1 100644 --- a/drivers/bcma/host_pci.c +++ b/drivers/bcma/host_pci.c | |||
@@ -275,7 +275,7 @@ static SIMPLE_DEV_PM_OPS(bcma_pm_ops, bcma_host_pci_suspend, | |||
275 | static const struct pci_device_id bcma_pci_bridge_tbl[] = { | 275 | static const struct pci_device_id bcma_pci_bridge_tbl[] = { |
276 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x0576) }, | 276 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x0576) }, |
277 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4313) }, | 277 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4313) }, |
278 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 43224) }, | 278 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 43224) }, /* 0xa8d8 */ |
279 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4331) }, | 279 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4331) }, |
280 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4353) }, | 280 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4353) }, |
281 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4357) }, | 281 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4357) }, |
@@ -285,7 +285,8 @@ static const struct pci_device_id bcma_pci_bridge_tbl[] = { | |||
285 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43a9) }, | 285 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43a9) }, |
286 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43aa) }, | 286 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x43aa) }, |
287 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4727) }, | 287 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4727) }, |
288 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 43227) }, /* 0xA8DB */ | 288 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 43227) }, /* 0xa8db, BCM43217 (sic!) */ |
289 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 43228) }, /* 0xa8dc */ | ||
289 | { 0, }, | 290 | { 0, }, |
290 | }; | 291 | }; |
291 | MODULE_DEVICE_TABLE(pci, bcma_pci_bridge_tbl); | 292 | MODULE_DEVICE_TABLE(pci, bcma_pci_bridge_tbl); |
diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c index d1656c2f70af..1000955ce09d 100644 --- a/drivers/bcma/main.c +++ b/drivers/bcma/main.c | |||
@@ -132,7 +132,7 @@ static bool bcma_is_core_needed_early(u16 core_id) | |||
132 | return false; | 132 | return false; |
133 | } | 133 | } |
134 | 134 | ||
135 | #ifdef CONFIG_OF | 135 | #if defined(CONFIG_OF) && defined(CONFIG_OF_ADDRESS) |
136 | static struct device_node *bcma_of_find_child_device(struct platform_device *parent, | 136 | static struct device_node *bcma_of_find_child_device(struct platform_device *parent, |
137 | struct bcma_device *core) | 137 | struct bcma_device *core) |
138 | { | 138 | { |
diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c index 2671a3f02f0c..8001e812018b 100644 --- a/drivers/block/null_blk.c +++ b/drivers/block/null_blk.c | |||
@@ -450,14 +450,10 @@ static int init_driver_queues(struct nullb *nullb) | |||
450 | 450 | ||
451 | ret = setup_commands(nq); | 451 | ret = setup_commands(nq); |
452 | if (ret) | 452 | if (ret) |
453 | goto err_queue; | 453 | return ret; |
454 | nullb->nr_queues++; | 454 | nullb->nr_queues++; |
455 | } | 455 | } |
456 | |||
457 | return 0; | 456 | return 0; |
458 | err_queue: | ||
459 | cleanup_queues(nullb); | ||
460 | return ret; | ||
461 | } | 457 | } |
462 | 458 | ||
463 | static int null_add_dev(void) | 459 | static int null_add_dev(void) |
@@ -507,7 +503,9 @@ static int null_add_dev(void) | |||
507 | goto out_cleanup_queues; | 503 | goto out_cleanup_queues; |
508 | } | 504 | } |
509 | blk_queue_make_request(nullb->q, null_queue_bio); | 505 | blk_queue_make_request(nullb->q, null_queue_bio); |
510 | init_driver_queues(nullb); | 506 | rv = init_driver_queues(nullb); |
507 | if (rv) | ||
508 | goto out_cleanup_blk_queue; | ||
511 | } else { | 509 | } else { |
512 | nullb->q = blk_init_queue_node(null_request_fn, &nullb->lock, home_node); | 510 | nullb->q = blk_init_queue_node(null_request_fn, &nullb->lock, home_node); |
513 | if (!nullb->q) { | 511 | if (!nullb->q) { |
@@ -516,7 +514,9 @@ static int null_add_dev(void) | |||
516 | } | 514 | } |
517 | blk_queue_prep_rq(nullb->q, null_rq_prep_fn); | 515 | blk_queue_prep_rq(nullb->q, null_rq_prep_fn); |
518 | blk_queue_softirq_done(nullb->q, null_softirq_done_fn); | 516 | blk_queue_softirq_done(nullb->q, null_softirq_done_fn); |
519 | init_driver_queues(nullb); | 517 | rv = init_driver_queues(nullb); |
518 | if (rv) | ||
519 | goto out_cleanup_blk_queue; | ||
520 | } | 520 | } |
521 | 521 | ||
522 | nullb->q->queuedata = nullb; | 522 | nullb->q->queuedata = nullb; |
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 0a54c588e433..27b71a0b72d0 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
@@ -342,7 +342,6 @@ struct rbd_device { | |||
342 | 342 | ||
343 | struct list_head rq_queue; /* incoming rq queue */ | 343 | struct list_head rq_queue; /* incoming rq queue */ |
344 | spinlock_t lock; /* queue, flags, open_count */ | 344 | spinlock_t lock; /* queue, flags, open_count */ |
345 | struct workqueue_struct *rq_wq; | ||
346 | struct work_struct rq_work; | 345 | struct work_struct rq_work; |
347 | 346 | ||
348 | struct rbd_image_header header; | 347 | struct rbd_image_header header; |
@@ -402,6 +401,8 @@ static struct kmem_cache *rbd_segment_name_cache; | |||
402 | static int rbd_major; | 401 | static int rbd_major; |
403 | static DEFINE_IDA(rbd_dev_id_ida); | 402 | static DEFINE_IDA(rbd_dev_id_ida); |
404 | 403 | ||
404 | static struct workqueue_struct *rbd_wq; | ||
405 | |||
405 | /* | 406 | /* |
406 | * Default to false for now, as single-major requires >= 0.75 version of | 407 | * Default to false for now, as single-major requires >= 0.75 version of |
407 | * userspace rbd utility. | 408 | * userspace rbd utility. |
@@ -3452,7 +3453,7 @@ static void rbd_request_fn(struct request_queue *q) | |||
3452 | } | 3453 | } |
3453 | 3454 | ||
3454 | if (queued) | 3455 | if (queued) |
3455 | queue_work(rbd_dev->rq_wq, &rbd_dev->rq_work); | 3456 | queue_work(rbd_wq, &rbd_dev->rq_work); |
3456 | } | 3457 | } |
3457 | 3458 | ||
3458 | /* | 3459 | /* |
@@ -3532,7 +3533,7 @@ static int rbd_obj_read_sync(struct rbd_device *rbd_dev, | |||
3532 | page_count = (u32) calc_pages_for(offset, length); | 3533 | page_count = (u32) calc_pages_for(offset, length); |
3533 | pages = ceph_alloc_page_vector(page_count, GFP_KERNEL); | 3534 | pages = ceph_alloc_page_vector(page_count, GFP_KERNEL); |
3534 | if (IS_ERR(pages)) | 3535 | if (IS_ERR(pages)) |
3535 | ret = PTR_ERR(pages); | 3536 | return PTR_ERR(pages); |
3536 | 3537 | ||
3537 | ret = -ENOMEM; | 3538 | ret = -ENOMEM; |
3538 | obj_request = rbd_obj_request_create(object_name, offset, length, | 3539 | obj_request = rbd_obj_request_create(object_name, offset, length, |
@@ -5242,16 +5243,9 @@ static int rbd_dev_device_setup(struct rbd_device *rbd_dev) | |||
5242 | set_capacity(rbd_dev->disk, rbd_dev->mapping.size / SECTOR_SIZE); | 5243 | set_capacity(rbd_dev->disk, rbd_dev->mapping.size / SECTOR_SIZE); |
5243 | set_disk_ro(rbd_dev->disk, rbd_dev->mapping.read_only); | 5244 | set_disk_ro(rbd_dev->disk, rbd_dev->mapping.read_only); |
5244 | 5245 | ||
5245 | rbd_dev->rq_wq = alloc_workqueue("%s", WQ_MEM_RECLAIM, 0, | ||
5246 | rbd_dev->disk->disk_name); | ||
5247 | if (!rbd_dev->rq_wq) { | ||
5248 | ret = -ENOMEM; | ||
5249 | goto err_out_mapping; | ||
5250 | } | ||
5251 | |||
5252 | ret = rbd_bus_add_dev(rbd_dev); | 5246 | ret = rbd_bus_add_dev(rbd_dev); |
5253 | if (ret) | 5247 | if (ret) |
5254 | goto err_out_workqueue; | 5248 | goto err_out_mapping; |
5255 | 5249 | ||
5256 | /* Everything's ready. Announce the disk to the world. */ | 5250 | /* Everything's ready. Announce the disk to the world. */ |
5257 | 5251 | ||
@@ -5263,9 +5257,6 @@ static int rbd_dev_device_setup(struct rbd_device *rbd_dev) | |||
5263 | 5257 | ||
5264 | return ret; | 5258 | return ret; |
5265 | 5259 | ||
5266 | err_out_workqueue: | ||
5267 | destroy_workqueue(rbd_dev->rq_wq); | ||
5268 | rbd_dev->rq_wq = NULL; | ||
5269 | err_out_mapping: | 5260 | err_out_mapping: |
5270 | rbd_dev_mapping_clear(rbd_dev); | 5261 | rbd_dev_mapping_clear(rbd_dev); |
5271 | err_out_disk: | 5262 | err_out_disk: |
@@ -5512,7 +5503,6 @@ static void rbd_dev_device_release(struct device *dev) | |||
5512 | { | 5503 | { |
5513 | struct rbd_device *rbd_dev = dev_to_rbd_dev(dev); | 5504 | struct rbd_device *rbd_dev = dev_to_rbd_dev(dev); |
5514 | 5505 | ||
5515 | destroy_workqueue(rbd_dev->rq_wq); | ||
5516 | rbd_free_disk(rbd_dev); | 5506 | rbd_free_disk(rbd_dev); |
5517 | clear_bit(RBD_DEV_FLAG_EXISTS, &rbd_dev->flags); | 5507 | clear_bit(RBD_DEV_FLAG_EXISTS, &rbd_dev->flags); |
5518 | rbd_dev_mapping_clear(rbd_dev); | 5508 | rbd_dev_mapping_clear(rbd_dev); |
@@ -5716,11 +5706,21 @@ static int __init rbd_init(void) | |||
5716 | if (rc) | 5706 | if (rc) |
5717 | return rc; | 5707 | return rc; |
5718 | 5708 | ||
5709 | /* | ||
5710 | * The number of active work items is limited by the number of | ||
5711 | * rbd devices, so leave @max_active at default. | ||
5712 | */ | ||
5713 | rbd_wq = alloc_workqueue(RBD_DRV_NAME, WQ_MEM_RECLAIM, 0); | ||
5714 | if (!rbd_wq) { | ||
5715 | rc = -ENOMEM; | ||
5716 | goto err_out_slab; | ||
5717 | } | ||
5718 | |||
5719 | if (single_major) { | 5719 | if (single_major) { |
5720 | rbd_major = register_blkdev(0, RBD_DRV_NAME); | 5720 | rbd_major = register_blkdev(0, RBD_DRV_NAME); |
5721 | if (rbd_major < 0) { | 5721 | if (rbd_major < 0) { |
5722 | rc = rbd_major; | 5722 | rc = rbd_major; |
5723 | goto err_out_slab; | 5723 | goto err_out_wq; |
5724 | } | 5724 | } |
5725 | } | 5725 | } |
5726 | 5726 | ||
@@ -5738,6 +5738,8 @@ static int __init rbd_init(void) | |||
5738 | err_out_blkdev: | 5738 | err_out_blkdev: |
5739 | if (single_major) | 5739 | if (single_major) |
5740 | unregister_blkdev(rbd_major, RBD_DRV_NAME); | 5740 | unregister_blkdev(rbd_major, RBD_DRV_NAME); |
5741 | err_out_wq: | ||
5742 | destroy_workqueue(rbd_wq); | ||
5741 | err_out_slab: | 5743 | err_out_slab: |
5742 | rbd_slab_exit(); | 5744 | rbd_slab_exit(); |
5743 | return rc; | 5745 | return rc; |
@@ -5749,6 +5751,7 @@ static void __exit rbd_exit(void) | |||
5749 | rbd_sysfs_cleanup(); | 5751 | rbd_sysfs_cleanup(); |
5750 | if (single_major) | 5752 | if (single_major) |
5751 | unregister_blkdev(rbd_major, RBD_DRV_NAME); | 5753 | unregister_blkdev(rbd_major, RBD_DRV_NAME); |
5754 | destroy_workqueue(rbd_wq); | ||
5752 | rbd_slab_exit(); | 5755 | rbd_slab_exit(); |
5753 | } | 5756 | } |
5754 | 5757 | ||
diff --git a/drivers/block/sunvdc.c b/drivers/block/sunvdc.c index 756b8ec00f16..0ebadf93b6c5 100644 --- a/drivers/block/sunvdc.c +++ b/drivers/block/sunvdc.c | |||
@@ -69,8 +69,6 @@ struct vdc_port { | |||
69 | u8 vdisk_mtype; | 69 | u8 vdisk_mtype; |
70 | 70 | ||
71 | char disk_name[32]; | 71 | char disk_name[32]; |
72 | |||
73 | struct vio_disk_vtoc label; | ||
74 | }; | 72 | }; |
75 | 73 | ||
76 | static inline struct vdc_port *to_vdc_port(struct vio_driver_state *vio) | 74 | static inline struct vdc_port *to_vdc_port(struct vio_driver_state *vio) |
@@ -710,13 +708,6 @@ static int probe_disk(struct vdc_port *port) | |||
710 | if (comp.err) | 708 | if (comp.err) |
711 | return comp.err; | 709 | return comp.err; |
712 | 710 | ||
713 | err = generic_request(port, VD_OP_GET_VTOC, | ||
714 | &port->label, sizeof(port->label)); | ||
715 | if (err < 0) { | ||
716 | printk(KERN_ERR PFX "VD_OP_GET_VTOC returns error %d\n", err); | ||
717 | return err; | ||
718 | } | ||
719 | |||
720 | if (vdc_version_supported(port, 1, 1)) { | 711 | if (vdc_version_supported(port, 1, 1)) { |
721 | /* vdisk_size should be set during the handshake, if it wasn't | 712 | /* vdisk_size should be set during the handshake, if it wasn't |
722 | * then the underlying disk is reserved by another system | 713 | * then the underlying disk is reserved by another system |
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 0e63e8aa8279..3920ee45aa59 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c | |||
@@ -99,11 +99,12 @@ static ssize_t mem_used_total_show(struct device *dev, | |||
99 | { | 99 | { |
100 | u64 val = 0; | 100 | u64 val = 0; |
101 | struct zram *zram = dev_to_zram(dev); | 101 | struct zram *zram = dev_to_zram(dev); |
102 | struct zram_meta *meta = zram->meta; | ||
103 | 102 | ||
104 | down_read(&zram->init_lock); | 103 | down_read(&zram->init_lock); |
105 | if (init_done(zram)) | 104 | if (init_done(zram)) { |
105 | struct zram_meta *meta = zram->meta; | ||
106 | val = zs_get_total_pages(meta->mem_pool); | 106 | val = zs_get_total_pages(meta->mem_pool); |
107 | } | ||
107 | up_read(&zram->init_lock); | 108 | up_read(&zram->init_lock); |
108 | 109 | ||
109 | return scnprintf(buf, PAGE_SIZE, "%llu\n", val << PAGE_SHIFT); | 110 | return scnprintf(buf, PAGE_SIZE, "%llu\n", val << PAGE_SHIFT); |
@@ -173,16 +174,17 @@ static ssize_t mem_used_max_store(struct device *dev, | |||
173 | int err; | 174 | int err; |
174 | unsigned long val; | 175 | unsigned long val; |
175 | struct zram *zram = dev_to_zram(dev); | 176 | struct zram *zram = dev_to_zram(dev); |
176 | struct zram_meta *meta = zram->meta; | ||
177 | 177 | ||
178 | err = kstrtoul(buf, 10, &val); | 178 | err = kstrtoul(buf, 10, &val); |
179 | if (err || val != 0) | 179 | if (err || val != 0) |
180 | return -EINVAL; | 180 | return -EINVAL; |
181 | 181 | ||
182 | down_read(&zram->init_lock); | 182 | down_read(&zram->init_lock); |
183 | if (init_done(zram)) | 183 | if (init_done(zram)) { |
184 | struct zram_meta *meta = zram->meta; | ||
184 | atomic_long_set(&zram->stats.max_used_pages, | 185 | atomic_long_set(&zram->stats.max_used_pages, |
185 | zs_get_total_pages(meta->mem_pool)); | 186 | zs_get_total_pages(meta->mem_pool)); |
187 | } | ||
186 | up_read(&zram->init_lock); | 188 | up_read(&zram->init_lock); |
187 | 189 | ||
188 | return len; | 190 | return len; |
@@ -558,7 +560,8 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index, | |||
558 | } | 560 | } |
559 | 561 | ||
560 | if (page_zero_filled(uncmem)) { | 562 | if (page_zero_filled(uncmem)) { |
561 | kunmap_atomic(user_mem); | 563 | if (user_mem) |
564 | kunmap_atomic(user_mem); | ||
562 | /* Free memory associated with this sector now. */ | 565 | /* Free memory associated with this sector now. */ |
563 | bit_spin_lock(ZRAM_ACCESS, &meta->table[index].value); | 566 | bit_spin_lock(ZRAM_ACCESS, &meta->table[index].value); |
564 | zram_free_page(zram, index); | 567 | zram_free_page(zram, index); |
diff --git a/drivers/char/hw_random/pseries-rng.c b/drivers/char/hw_random/pseries-rng.c index 6226aa08c36a..bcf86f91800a 100644 --- a/drivers/char/hw_random/pseries-rng.c +++ b/drivers/char/hw_random/pseries-rng.c | |||
@@ -25,18 +25,21 @@ | |||
25 | #include <asm/vio.h> | 25 | #include <asm/vio.h> |
26 | 26 | ||
27 | 27 | ||
28 | static int pseries_rng_data_read(struct hwrng *rng, u32 *data) | 28 | static int pseries_rng_read(struct hwrng *rng, void *data, size_t max, bool wait) |
29 | { | 29 | { |
30 | u64 buffer[PLPAR_HCALL_BUFSIZE]; | ||
31 | size_t size = max < 8 ? max : 8; | ||
30 | int rc; | 32 | int rc; |
31 | 33 | ||
32 | rc = plpar_hcall(H_RANDOM, (unsigned long *)data); | 34 | rc = plpar_hcall(H_RANDOM, (unsigned long *)buffer); |
33 | if (rc != H_SUCCESS) { | 35 | if (rc != H_SUCCESS) { |
34 | pr_err_ratelimited("H_RANDOM call failed %d\n", rc); | 36 | pr_err_ratelimited("H_RANDOM call failed %d\n", rc); |
35 | return -EIO; | 37 | return -EIO; |
36 | } | 38 | } |
39 | memcpy(data, buffer, size); | ||
37 | 40 | ||
38 | /* The hypervisor interface returns 64 bits */ | 41 | /* The hypervisor interface returns 64 bits */ |
39 | return 8; | 42 | return size; |
40 | } | 43 | } |
41 | 44 | ||
42 | /** | 45 | /** |
@@ -55,7 +58,7 @@ static unsigned long pseries_rng_get_desired_dma(struct vio_dev *vdev) | |||
55 | 58 | ||
56 | static struct hwrng pseries_rng = { | 59 | static struct hwrng pseries_rng = { |
57 | .name = KBUILD_MODNAME, | 60 | .name = KBUILD_MODNAME, |
58 | .data_read = pseries_rng_data_read, | 61 | .read = pseries_rng_read, |
59 | }; | 62 | }; |
60 | 63 | ||
61 | static int __init pseries_rng_probe(struct vio_dev *dev, | 64 | static int __init pseries_rng_probe(struct vio_dev *dev, |
diff --git a/drivers/char/raw.c b/drivers/char/raw.c index 0102dc788608..a24891b97547 100644 --- a/drivers/char/raw.c +++ b/drivers/char/raw.c | |||
@@ -285,7 +285,7 @@ static long raw_ctl_compat_ioctl(struct file *file, unsigned int cmd, | |||
285 | 285 | ||
286 | static const struct file_operations raw_fops = { | 286 | static const struct file_operations raw_fops = { |
287 | .read = new_sync_read, | 287 | .read = new_sync_read, |
288 | .read_iter = generic_file_read_iter, | 288 | .read_iter = blkdev_read_iter, |
289 | .write = new_sync_write, | 289 | .write = new_sync_write, |
290 | .write_iter = blkdev_write_iter, | 290 | .write_iter = blkdev_write_iter, |
291 | .fsync = blkdev_fsync, | 291 | .fsync = blkdev_fsync, |
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index bfa640023e64..cf7a561fad7c 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
@@ -1449,8 +1449,6 @@ static int add_port(struct ports_device *portdev, u32 id) | |||
1449 | spin_lock_init(&port->outvq_lock); | 1449 | spin_lock_init(&port->outvq_lock); |
1450 | init_waitqueue_head(&port->waitqueue); | 1450 | init_waitqueue_head(&port->waitqueue); |
1451 | 1451 | ||
1452 | virtio_device_ready(portdev->vdev); | ||
1453 | |||
1454 | /* Fill the in_vq with buffers so the host can send us data. */ | 1452 | /* Fill the in_vq with buffers so the host can send us data. */ |
1455 | nr_added_bufs = fill_queue(port->in_vq, &port->inbuf_lock); | 1453 | nr_added_bufs = fill_queue(port->in_vq, &port->inbuf_lock); |
1456 | if (!nr_added_bufs) { | 1454 | if (!nr_added_bufs) { |
@@ -2026,6 +2024,8 @@ static int virtcons_probe(struct virtio_device *vdev) | |||
2026 | spin_lock_init(&portdev->ports_lock); | 2024 | spin_lock_init(&portdev->ports_lock); |
2027 | INIT_LIST_HEAD(&portdev->ports); | 2025 | INIT_LIST_HEAD(&portdev->ports); |
2028 | 2026 | ||
2027 | virtio_device_ready(portdev->vdev); | ||
2028 | |||
2029 | if (multiport) { | 2029 | if (multiport) { |
2030 | unsigned int nr_added_bufs; | 2030 | unsigned int nr_added_bufs; |
2031 | 2031 | ||
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index 2133f9d59d06..43005d4d3348 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c | |||
@@ -660,11 +660,11 @@ static bool __init | |||
660 | arch_timer_probed(int type, const struct of_device_id *matches) | 660 | arch_timer_probed(int type, const struct of_device_id *matches) |
661 | { | 661 | { |
662 | struct device_node *dn; | 662 | struct device_node *dn; |
663 | bool probed = false; | 663 | bool probed = true; |
664 | 664 | ||
665 | dn = of_find_matching_node(NULL, matches); | 665 | dn = of_find_matching_node(NULL, matches); |
666 | if (dn && of_device_is_available(dn) && (arch_timers_present & type)) | 666 | if (dn && of_device_is_available(dn) && !(arch_timers_present & type)) |
667 | probed = true; | 667 | probed = false; |
668 | of_node_put(dn); | 668 | of_node_put(dn); |
669 | 669 | ||
670 | return probed; | 670 | return probed; |
diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c index 92c162af5045..f657c571b18e 100644 --- a/drivers/cpufreq/cpufreq-dt.c +++ b/drivers/cpufreq/cpufreq-dt.c | |||
@@ -166,8 +166,8 @@ try_again: | |||
166 | if (ret == -EPROBE_DEFER) | 166 | if (ret == -EPROBE_DEFER) |
167 | dev_dbg(cpu_dev, "cpu%d clock not ready, retry\n", cpu); | 167 | dev_dbg(cpu_dev, "cpu%d clock not ready, retry\n", cpu); |
168 | else | 168 | else |
169 | dev_err(cpu_dev, "failed to get cpu%d clock: %d\n", ret, | 169 | dev_err(cpu_dev, "failed to get cpu%d clock: %d\n", cpu, |
170 | cpu); | 170 | ret); |
171 | } else { | 171 | } else { |
172 | *cdev = cpu_dev; | 172 | *cdev = cpu_dev; |
173 | *creg = cpu_reg; | 173 | *creg = cpu_reg; |
@@ -187,6 +187,7 @@ static int cpufreq_init(struct cpufreq_policy *policy) | |||
187 | struct device *cpu_dev; | 187 | struct device *cpu_dev; |
188 | struct regulator *cpu_reg; | 188 | struct regulator *cpu_reg; |
189 | struct clk *cpu_clk; | 189 | struct clk *cpu_clk; |
190 | unsigned long min_uV = ~0, max_uV = 0; | ||
190 | unsigned int transition_latency; | 191 | unsigned int transition_latency; |
191 | int ret; | 192 | int ret; |
192 | 193 | ||
@@ -206,16 +207,10 @@ static int cpufreq_init(struct cpufreq_policy *policy) | |||
206 | /* OPPs might be populated at runtime, don't check for error here */ | 207 | /* OPPs might be populated at runtime, don't check for error here */ |
207 | of_init_opp_table(cpu_dev); | 208 | of_init_opp_table(cpu_dev); |
208 | 209 | ||
209 | ret = dev_pm_opp_init_cpufreq_table(cpu_dev, &freq_table); | ||
210 | if (ret) { | ||
211 | dev_err(cpu_dev, "failed to init cpufreq table: %d\n", ret); | ||
212 | goto out_put_node; | ||
213 | } | ||
214 | |||
215 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); | 210 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); |
216 | if (!priv) { | 211 | if (!priv) { |
217 | ret = -ENOMEM; | 212 | ret = -ENOMEM; |
218 | goto out_free_table; | 213 | goto out_put_node; |
219 | } | 214 | } |
220 | 215 | ||
221 | of_property_read_u32(np, "voltage-tolerance", &priv->voltage_tolerance); | 216 | of_property_read_u32(np, "voltage-tolerance", &priv->voltage_tolerance); |
@@ -224,30 +219,51 @@ static int cpufreq_init(struct cpufreq_policy *policy) | |||
224 | transition_latency = CPUFREQ_ETERNAL; | 219 | transition_latency = CPUFREQ_ETERNAL; |
225 | 220 | ||
226 | if (!IS_ERR(cpu_reg)) { | 221 | if (!IS_ERR(cpu_reg)) { |
227 | struct dev_pm_opp *opp; | 222 | unsigned long opp_freq = 0; |
228 | unsigned long min_uV, max_uV; | ||
229 | int i; | ||
230 | 223 | ||
231 | /* | 224 | /* |
232 | * OPP is maintained in order of increasing frequency, and | 225 | * Disable any OPPs where the connected regulator isn't able to |
233 | * freq_table initialised from OPP is therefore sorted in the | 226 | * provide the specified voltage and record minimum and maximum |
234 | * same order. | 227 | * voltage levels. |
235 | */ | 228 | */ |
236 | for (i = 0; freq_table[i].frequency != CPUFREQ_TABLE_END; i++) | 229 | while (1) { |
237 | ; | 230 | struct dev_pm_opp *opp; |
238 | rcu_read_lock(); | 231 | unsigned long opp_uV, tol_uV; |
239 | opp = dev_pm_opp_find_freq_exact(cpu_dev, | 232 | |
240 | freq_table[0].frequency * 1000, true); | 233 | rcu_read_lock(); |
241 | min_uV = dev_pm_opp_get_voltage(opp); | 234 | opp = dev_pm_opp_find_freq_ceil(cpu_dev, &opp_freq); |
242 | opp = dev_pm_opp_find_freq_exact(cpu_dev, | 235 | if (IS_ERR(opp)) { |
243 | freq_table[i-1].frequency * 1000, true); | 236 | rcu_read_unlock(); |
244 | max_uV = dev_pm_opp_get_voltage(opp); | 237 | break; |
245 | rcu_read_unlock(); | 238 | } |
239 | opp_uV = dev_pm_opp_get_voltage(opp); | ||
240 | rcu_read_unlock(); | ||
241 | |||
242 | tol_uV = opp_uV * priv->voltage_tolerance / 100; | ||
243 | if (regulator_is_supported_voltage(cpu_reg, opp_uV, | ||
244 | opp_uV + tol_uV)) { | ||
245 | if (opp_uV < min_uV) | ||
246 | min_uV = opp_uV; | ||
247 | if (opp_uV > max_uV) | ||
248 | max_uV = opp_uV; | ||
249 | } else { | ||
250 | dev_pm_opp_disable(cpu_dev, opp_freq); | ||
251 | } | ||
252 | |||
253 | opp_freq++; | ||
254 | } | ||
255 | |||
246 | ret = regulator_set_voltage_time(cpu_reg, min_uV, max_uV); | 256 | ret = regulator_set_voltage_time(cpu_reg, min_uV, max_uV); |
247 | if (ret > 0) | 257 | if (ret > 0) |
248 | transition_latency += ret * 1000; | 258 | transition_latency += ret * 1000; |
249 | } | 259 | } |
250 | 260 | ||
261 | ret = dev_pm_opp_init_cpufreq_table(cpu_dev, &freq_table); | ||
262 | if (ret) { | ||
263 | pr_err("failed to init cpufreq table: %d\n", ret); | ||
264 | goto out_free_priv; | ||
265 | } | ||
266 | |||
251 | /* | 267 | /* |
252 | * For now, just loading the cooling device; | 268 | * For now, just loading the cooling device; |
253 | * thermal DT code takes care of matching them. | 269 | * thermal DT code takes care of matching them. |
@@ -277,7 +293,7 @@ static int cpufreq_init(struct cpufreq_policy *policy) | |||
277 | policy->cpuinfo.transition_latency = transition_latency; | 293 | policy->cpuinfo.transition_latency = transition_latency; |
278 | 294 | ||
279 | pd = cpufreq_get_driver_data(); | 295 | pd = cpufreq_get_driver_data(); |
280 | if (pd && !pd->independent_clocks) | 296 | if (!pd || !pd->independent_clocks) |
281 | cpumask_setall(policy->cpus); | 297 | cpumask_setall(policy->cpus); |
282 | 298 | ||
283 | of_node_put(np); | 299 | of_node_put(np); |
@@ -286,9 +302,9 @@ static int cpufreq_init(struct cpufreq_policy *policy) | |||
286 | 302 | ||
287 | out_cooling_unregister: | 303 | out_cooling_unregister: |
288 | cpufreq_cooling_unregister(priv->cdev); | 304 | cpufreq_cooling_unregister(priv->cdev); |
289 | kfree(priv); | ||
290 | out_free_table: | ||
291 | dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table); | 305 | dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table); |
306 | out_free_priv: | ||
307 | kfree(priv); | ||
292 | out_put_node: | 308 | out_put_node: |
293 | of_node_put(np); | 309 | of_node_put(np); |
294 | out_put_reg_clk: | 310 | out_put_reg_clk: |
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 644b54e1e7d1..4473eba1d6b0 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -1022,7 +1022,8 @@ static struct cpufreq_policy *cpufreq_policy_restore(unsigned int cpu) | |||
1022 | 1022 | ||
1023 | read_unlock_irqrestore(&cpufreq_driver_lock, flags); | 1023 | read_unlock_irqrestore(&cpufreq_driver_lock, flags); |
1024 | 1024 | ||
1025 | policy->governor = NULL; | 1025 | if (policy) |
1026 | policy->governor = NULL; | ||
1026 | 1027 | ||
1027 | return policy; | 1028 | return policy; |
1028 | } | 1029 | } |
diff --git a/drivers/crypto/caam/key_gen.c b/drivers/crypto/caam/key_gen.c index 871703c49d2c..e1eaf4ff9762 100644 --- a/drivers/crypto/caam/key_gen.c +++ b/drivers/crypto/caam/key_gen.c | |||
@@ -48,23 +48,29 @@ int gen_split_key(struct device *jrdev, u8 *key_out, int split_key_len, | |||
48 | u32 *desc; | 48 | u32 *desc; |
49 | struct split_key_result result; | 49 | struct split_key_result result; |
50 | dma_addr_t dma_addr_in, dma_addr_out; | 50 | dma_addr_t dma_addr_in, dma_addr_out; |
51 | int ret = 0; | 51 | int ret = -ENOMEM; |
52 | 52 | ||
53 | desc = kmalloc(CAAM_CMD_SZ * 6 + CAAM_PTR_SZ * 2, GFP_KERNEL | GFP_DMA); | 53 | desc = kmalloc(CAAM_CMD_SZ * 6 + CAAM_PTR_SZ * 2, GFP_KERNEL | GFP_DMA); |
54 | if (!desc) { | 54 | if (!desc) { |
55 | dev_err(jrdev, "unable to allocate key input memory\n"); | 55 | dev_err(jrdev, "unable to allocate key input memory\n"); |
56 | return -ENOMEM; | 56 | return ret; |
57 | } | 57 | } |
58 | 58 | ||
59 | init_job_desc(desc, 0); | ||
60 | |||
61 | dma_addr_in = dma_map_single(jrdev, (void *)key_in, keylen, | 59 | dma_addr_in = dma_map_single(jrdev, (void *)key_in, keylen, |
62 | DMA_TO_DEVICE); | 60 | DMA_TO_DEVICE); |
63 | if (dma_mapping_error(jrdev, dma_addr_in)) { | 61 | if (dma_mapping_error(jrdev, dma_addr_in)) { |
64 | dev_err(jrdev, "unable to map key input memory\n"); | 62 | dev_err(jrdev, "unable to map key input memory\n"); |
65 | kfree(desc); | 63 | goto out_free; |
66 | return -ENOMEM; | ||
67 | } | 64 | } |
65 | |||
66 | dma_addr_out = dma_map_single(jrdev, key_out, split_key_pad_len, | ||
67 | DMA_FROM_DEVICE); | ||
68 | if (dma_mapping_error(jrdev, dma_addr_out)) { | ||
69 | dev_err(jrdev, "unable to map key output memory\n"); | ||
70 | goto out_unmap_in; | ||
71 | } | ||
72 | |||
73 | init_job_desc(desc, 0); | ||
68 | append_key(desc, dma_addr_in, keylen, CLASS_2 | KEY_DEST_CLASS_REG); | 74 | append_key(desc, dma_addr_in, keylen, CLASS_2 | KEY_DEST_CLASS_REG); |
69 | 75 | ||
70 | /* Sets MDHA up into an HMAC-INIT */ | 76 | /* Sets MDHA up into an HMAC-INIT */ |
@@ -81,13 +87,6 @@ int gen_split_key(struct device *jrdev, u8 *key_out, int split_key_len, | |||
81 | * FIFO_STORE with the explicit split-key content store | 87 | * FIFO_STORE with the explicit split-key content store |
82 | * (0x26 output type) | 88 | * (0x26 output type) |
83 | */ | 89 | */ |
84 | dma_addr_out = dma_map_single(jrdev, key_out, split_key_pad_len, | ||
85 | DMA_FROM_DEVICE); | ||
86 | if (dma_mapping_error(jrdev, dma_addr_out)) { | ||
87 | dev_err(jrdev, "unable to map key output memory\n"); | ||
88 | kfree(desc); | ||
89 | return -ENOMEM; | ||
90 | } | ||
91 | append_fifo_store(desc, dma_addr_out, split_key_len, | 90 | append_fifo_store(desc, dma_addr_out, split_key_len, |
92 | LDST_CLASS_2_CCB | FIFOST_TYPE_SPLIT_KEK); | 91 | LDST_CLASS_2_CCB | FIFOST_TYPE_SPLIT_KEK); |
93 | 92 | ||
@@ -115,10 +114,10 @@ int gen_split_key(struct device *jrdev, u8 *key_out, int split_key_len, | |||
115 | 114 | ||
116 | dma_unmap_single(jrdev, dma_addr_out, split_key_pad_len, | 115 | dma_unmap_single(jrdev, dma_addr_out, split_key_pad_len, |
117 | DMA_FROM_DEVICE); | 116 | DMA_FROM_DEVICE); |
117 | out_unmap_in: | ||
118 | dma_unmap_single(jrdev, dma_addr_in, keylen, DMA_TO_DEVICE); | 118 | dma_unmap_single(jrdev, dma_addr_in, keylen, DMA_TO_DEVICE); |
119 | 119 | out_free: | |
120 | kfree(desc); | 120 | kfree(desc); |
121 | |||
122 | return ret; | 121 | return ret; |
123 | } | 122 | } |
124 | EXPORT_SYMBOL(gen_split_key); | 123 | EXPORT_SYMBOL(gen_split_key); |
diff --git a/drivers/crypto/qat/qat_common/adf_accel_devices.h b/drivers/crypto/qat/qat_common/adf_accel_devices.h index 9282381b03ce..fe7b3f06f6e6 100644 --- a/drivers/crypto/qat/qat_common/adf_accel_devices.h +++ b/drivers/crypto/qat/qat_common/adf_accel_devices.h | |||
@@ -198,8 +198,7 @@ struct adf_accel_dev { | |||
198 | struct dentry *debugfs_dir; | 198 | struct dentry *debugfs_dir; |
199 | struct list_head list; | 199 | struct list_head list; |
200 | struct module *owner; | 200 | struct module *owner; |
201 | uint8_t accel_id; | ||
202 | uint8_t numa_node; | ||
203 | struct adf_accel_pci accel_pci_dev; | 201 | struct adf_accel_pci accel_pci_dev; |
202 | uint8_t accel_id; | ||
204 | } __packed; | 203 | } __packed; |
205 | #endif | 204 | #endif |
diff --git a/drivers/crypto/qat/qat_common/adf_transport.c b/drivers/crypto/qat/qat_common/adf_transport.c index 5f3fa45348b4..9dd2cb72a4e8 100644 --- a/drivers/crypto/qat/qat_common/adf_transport.c +++ b/drivers/crypto/qat/qat_common/adf_transport.c | |||
@@ -419,9 +419,10 @@ static int adf_init_bank(struct adf_accel_dev *accel_dev, | |||
419 | WRITE_CSR_RING_BASE(csr_addr, bank_num, i, 0); | 419 | WRITE_CSR_RING_BASE(csr_addr, bank_num, i, 0); |
420 | ring = &bank->rings[i]; | 420 | ring = &bank->rings[i]; |
421 | if (hw_data->tx_rings_mask & (1 << i)) { | 421 | if (hw_data->tx_rings_mask & (1 << i)) { |
422 | ring->inflights = kzalloc_node(sizeof(atomic_t), | 422 | ring->inflights = |
423 | GFP_KERNEL, | 423 | kzalloc_node(sizeof(atomic_t), |
424 | accel_dev->numa_node); | 424 | GFP_KERNEL, |
425 | dev_to_node(&GET_DEV(accel_dev))); | ||
425 | if (!ring->inflights) | 426 | if (!ring->inflights) |
426 | goto err; | 427 | goto err; |
427 | } else { | 428 | } else { |
@@ -469,13 +470,14 @@ int adf_init_etr_data(struct adf_accel_dev *accel_dev) | |||
469 | int i, ret; | 470 | int i, ret; |
470 | 471 | ||
471 | etr_data = kzalloc_node(sizeof(*etr_data), GFP_KERNEL, | 472 | etr_data = kzalloc_node(sizeof(*etr_data), GFP_KERNEL, |
472 | accel_dev->numa_node); | 473 | dev_to_node(&GET_DEV(accel_dev))); |
473 | if (!etr_data) | 474 | if (!etr_data) |
474 | return -ENOMEM; | 475 | return -ENOMEM; |
475 | 476 | ||
476 | num_banks = GET_MAX_BANKS(accel_dev); | 477 | num_banks = GET_MAX_BANKS(accel_dev); |
477 | size = num_banks * sizeof(struct adf_etr_bank_data); | 478 | size = num_banks * sizeof(struct adf_etr_bank_data); |
478 | etr_data->banks = kzalloc_node(size, GFP_KERNEL, accel_dev->numa_node); | 479 | etr_data->banks = kzalloc_node(size, GFP_KERNEL, |
480 | dev_to_node(&GET_DEV(accel_dev))); | ||
479 | if (!etr_data->banks) { | 481 | if (!etr_data->banks) { |
480 | ret = -ENOMEM; | 482 | ret = -ENOMEM; |
481 | goto err_bank; | 483 | goto err_bank; |
diff --git a/drivers/crypto/qat/qat_common/qat_algs.c b/drivers/crypto/qat/qat_common/qat_algs.c index f2e2f158cfbe..9e9619cd4a79 100644 --- a/drivers/crypto/qat/qat_common/qat_algs.c +++ b/drivers/crypto/qat/qat_common/qat_algs.c | |||
@@ -596,7 +596,8 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, | |||
596 | if (unlikely(!n)) | 596 | if (unlikely(!n)) |
597 | return -EINVAL; | 597 | return -EINVAL; |
598 | 598 | ||
599 | bufl = kmalloc_node(sz, GFP_ATOMIC, inst->accel_dev->numa_node); | 599 | bufl = kmalloc_node(sz, GFP_ATOMIC, |
600 | dev_to_node(&GET_DEV(inst->accel_dev))); | ||
600 | if (unlikely(!bufl)) | 601 | if (unlikely(!bufl)) |
601 | return -ENOMEM; | 602 | return -ENOMEM; |
602 | 603 | ||
@@ -605,6 +606,8 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, | |||
605 | goto err; | 606 | goto err; |
606 | 607 | ||
607 | for_each_sg(assoc, sg, assoc_n, i) { | 608 | for_each_sg(assoc, sg, assoc_n, i) { |
609 | if (!sg->length) | ||
610 | continue; | ||
608 | bufl->bufers[bufs].addr = dma_map_single(dev, | 611 | bufl->bufers[bufs].addr = dma_map_single(dev, |
609 | sg_virt(sg), | 612 | sg_virt(sg), |
610 | sg->length, | 613 | sg->length, |
@@ -640,7 +643,7 @@ static int qat_alg_sgl_to_bufl(struct qat_crypto_instance *inst, | |||
640 | struct qat_alg_buf *bufers; | 643 | struct qat_alg_buf *bufers; |
641 | 644 | ||
642 | buflout = kmalloc_node(sz, GFP_ATOMIC, | 645 | buflout = kmalloc_node(sz, GFP_ATOMIC, |
643 | inst->accel_dev->numa_node); | 646 | dev_to_node(&GET_DEV(inst->accel_dev))); |
644 | if (unlikely(!buflout)) | 647 | if (unlikely(!buflout)) |
645 | goto err; | 648 | goto err; |
646 | bloutp = dma_map_single(dev, buflout, sz, DMA_TO_DEVICE); | 649 | bloutp = dma_map_single(dev, buflout, sz, DMA_TO_DEVICE); |
diff --git a/drivers/crypto/qat/qat_common/qat_crypto.c b/drivers/crypto/qat/qat_common/qat_crypto.c index 0d59bcb50de1..828f2a686aab 100644 --- a/drivers/crypto/qat/qat_common/qat_crypto.c +++ b/drivers/crypto/qat/qat_common/qat_crypto.c | |||
@@ -109,12 +109,14 @@ struct qat_crypto_instance *qat_crypto_get_instance_node(int node) | |||
109 | 109 | ||
110 | list_for_each(itr, adf_devmgr_get_head()) { | 110 | list_for_each(itr, adf_devmgr_get_head()) { |
111 | accel_dev = list_entry(itr, struct adf_accel_dev, list); | 111 | accel_dev = list_entry(itr, struct adf_accel_dev, list); |
112 | if (accel_dev->numa_node == node && adf_dev_started(accel_dev)) | 112 | if ((node == dev_to_node(&GET_DEV(accel_dev)) || |
113 | dev_to_node(&GET_DEV(accel_dev)) < 0) | ||
114 | && adf_dev_started(accel_dev)) | ||
113 | break; | 115 | break; |
114 | accel_dev = NULL; | 116 | accel_dev = NULL; |
115 | } | 117 | } |
116 | if (!accel_dev) { | 118 | if (!accel_dev) { |
117 | pr_err("QAT: Could not find device on give node\n"); | 119 | pr_err("QAT: Could not find device on node %d\n", node); |
118 | accel_dev = adf_devmgr_get_first(); | 120 | accel_dev = adf_devmgr_get_first(); |
119 | } | 121 | } |
120 | if (!accel_dev || !adf_dev_started(accel_dev)) | 122 | if (!accel_dev || !adf_dev_started(accel_dev)) |
@@ -164,7 +166,7 @@ static int qat_crypto_create_instances(struct adf_accel_dev *accel_dev) | |||
164 | 166 | ||
165 | for (i = 0; i < num_inst; i++) { | 167 | for (i = 0; i < num_inst; i++) { |
166 | inst = kzalloc_node(sizeof(*inst), GFP_KERNEL, | 168 | inst = kzalloc_node(sizeof(*inst), GFP_KERNEL, |
167 | accel_dev->numa_node); | 169 | dev_to_node(&GET_DEV(accel_dev))); |
168 | if (!inst) | 170 | if (!inst) |
169 | goto err; | 171 | goto err; |
170 | 172 | ||
diff --git a/drivers/crypto/qat/qat_dh895xcc/adf_admin.c b/drivers/crypto/qat/qat_dh895xcc/adf_admin.c index 978d6c56639d..53c491b59f07 100644 --- a/drivers/crypto/qat/qat_dh895xcc/adf_admin.c +++ b/drivers/crypto/qat/qat_dh895xcc/adf_admin.c | |||
@@ -108,7 +108,7 @@ int adf_init_admin_comms(struct adf_accel_dev *accel_dev) | |||
108 | uint64_t reg_val; | 108 | uint64_t reg_val; |
109 | 109 | ||
110 | admin = kzalloc_node(sizeof(*accel_dev->admin), GFP_KERNEL, | 110 | admin = kzalloc_node(sizeof(*accel_dev->admin), GFP_KERNEL, |
111 | accel_dev->numa_node); | 111 | dev_to_node(&GET_DEV(accel_dev))); |
112 | if (!admin) | 112 | if (!admin) |
113 | return -ENOMEM; | 113 | return -ENOMEM; |
114 | admin->virt_addr = dma_zalloc_coherent(&GET_DEV(accel_dev), PAGE_SIZE, | 114 | admin->virt_addr = dma_zalloc_coherent(&GET_DEV(accel_dev), PAGE_SIZE, |
diff --git a/drivers/crypto/qat/qat_dh895xcc/adf_drv.c b/drivers/crypto/qat/qat_dh895xcc/adf_drv.c index 0d0435a41be9..948f66be262b 100644 --- a/drivers/crypto/qat/qat_dh895xcc/adf_drv.c +++ b/drivers/crypto/qat/qat_dh895xcc/adf_drv.c | |||
@@ -119,21 +119,6 @@ static void adf_cleanup_accel(struct adf_accel_dev *accel_dev) | |||
119 | kfree(accel_dev); | 119 | kfree(accel_dev); |
120 | } | 120 | } |
121 | 121 | ||
122 | static uint8_t adf_get_dev_node_id(struct pci_dev *pdev) | ||
123 | { | ||
124 | unsigned int bus_per_cpu = 0; | ||
125 | struct cpuinfo_x86 *c = &cpu_data(num_online_cpus() - 1); | ||
126 | |||
127 | if (!c->phys_proc_id) | ||
128 | return 0; | ||
129 | |||
130 | bus_per_cpu = 256 / (c->phys_proc_id + 1); | ||
131 | |||
132 | if (bus_per_cpu != 0) | ||
133 | return pdev->bus->number / bus_per_cpu; | ||
134 | return 0; | ||
135 | } | ||
136 | |||
137 | static int qat_dev_start(struct adf_accel_dev *accel_dev) | 122 | static int qat_dev_start(struct adf_accel_dev *accel_dev) |
138 | { | 123 | { |
139 | int cpus = num_online_cpus(); | 124 | int cpus = num_online_cpus(); |
@@ -235,7 +220,6 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
235 | void __iomem *pmisc_bar_addr = NULL; | 220 | void __iomem *pmisc_bar_addr = NULL; |
236 | char name[ADF_DEVICE_NAME_LENGTH]; | 221 | char name[ADF_DEVICE_NAME_LENGTH]; |
237 | unsigned int i, bar_nr; | 222 | unsigned int i, bar_nr; |
238 | uint8_t node; | ||
239 | int ret; | 223 | int ret; |
240 | 224 | ||
241 | switch (ent->device) { | 225 | switch (ent->device) { |
@@ -246,12 +230,19 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
246 | return -ENODEV; | 230 | return -ENODEV; |
247 | } | 231 | } |
248 | 232 | ||
249 | node = adf_get_dev_node_id(pdev); | 233 | if (num_possible_nodes() > 1 && dev_to_node(&pdev->dev) < 0) { |
250 | accel_dev = kzalloc_node(sizeof(*accel_dev), GFP_KERNEL, node); | 234 | /* If the accelerator is connected to a node with no memory |
235 | * there is no point in using the accelerator since the remote | ||
236 | * memory transaction will be very slow. */ | ||
237 | dev_err(&pdev->dev, "Invalid NUMA configuration.\n"); | ||
238 | return -EINVAL; | ||
239 | } | ||
240 | |||
241 | accel_dev = kzalloc_node(sizeof(*accel_dev), GFP_KERNEL, | ||
242 | dev_to_node(&pdev->dev)); | ||
251 | if (!accel_dev) | 243 | if (!accel_dev) |
252 | return -ENOMEM; | 244 | return -ENOMEM; |
253 | 245 | ||
254 | accel_dev->numa_node = node; | ||
255 | INIT_LIST_HEAD(&accel_dev->crypto_list); | 246 | INIT_LIST_HEAD(&accel_dev->crypto_list); |
256 | 247 | ||
257 | /* Add accel device to accel table. | 248 | /* Add accel device to accel table. |
@@ -264,7 +255,8 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
264 | 255 | ||
265 | accel_dev->owner = THIS_MODULE; | 256 | accel_dev->owner = THIS_MODULE; |
266 | /* Allocate and configure device configuration structure */ | 257 | /* Allocate and configure device configuration structure */ |
267 | hw_data = kzalloc_node(sizeof(*hw_data), GFP_KERNEL, node); | 258 | hw_data = kzalloc_node(sizeof(*hw_data), GFP_KERNEL, |
259 | dev_to_node(&pdev->dev)); | ||
268 | if (!hw_data) { | 260 | if (!hw_data) { |
269 | ret = -ENOMEM; | 261 | ret = -ENOMEM; |
270 | goto out_err; | 262 | goto out_err; |
diff --git a/drivers/crypto/qat/qat_dh895xcc/adf_isr.c b/drivers/crypto/qat/qat_dh895xcc/adf_isr.c index 67ec61e51185..d96ee21b9b77 100644 --- a/drivers/crypto/qat/qat_dh895xcc/adf_isr.c +++ b/drivers/crypto/qat/qat_dh895xcc/adf_isr.c | |||
@@ -168,7 +168,7 @@ static int adf_isr_alloc_msix_entry_table(struct adf_accel_dev *accel_dev) | |||
168 | uint32_t msix_num_entries = hw_data->num_banks + 1; | 168 | uint32_t msix_num_entries = hw_data->num_banks + 1; |
169 | 169 | ||
170 | entries = kzalloc_node(msix_num_entries * sizeof(*entries), | 170 | entries = kzalloc_node(msix_num_entries * sizeof(*entries), |
171 | GFP_KERNEL, accel_dev->numa_node); | 171 | GFP_KERNEL, dev_to_node(&GET_DEV(accel_dev))); |
172 | if (!entries) | 172 | if (!entries) |
173 | return -ENOMEM; | 173 | return -ENOMEM; |
174 | 174 | ||
diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c index 123f578d6dd3..4cfaaa5a49be 100644 --- a/drivers/dma/edma.c +++ b/drivers/dma/edma.c | |||
@@ -1107,52 +1107,14 @@ bool edma_filter_fn(struct dma_chan *chan, void *param) | |||
1107 | } | 1107 | } |
1108 | EXPORT_SYMBOL(edma_filter_fn); | 1108 | EXPORT_SYMBOL(edma_filter_fn); |
1109 | 1109 | ||
1110 | static struct platform_device *pdev0, *pdev1; | ||
1111 | |||
1112 | static const struct platform_device_info edma_dev_info0 = { | ||
1113 | .name = "edma-dma-engine", | ||
1114 | .id = 0, | ||
1115 | .dma_mask = DMA_BIT_MASK(32), | ||
1116 | }; | ||
1117 | |||
1118 | static const struct platform_device_info edma_dev_info1 = { | ||
1119 | .name = "edma-dma-engine", | ||
1120 | .id = 1, | ||
1121 | .dma_mask = DMA_BIT_MASK(32), | ||
1122 | }; | ||
1123 | |||
1124 | static int edma_init(void) | 1110 | static int edma_init(void) |
1125 | { | 1111 | { |
1126 | int ret = platform_driver_register(&edma_driver); | 1112 | return platform_driver_register(&edma_driver); |
1127 | |||
1128 | if (ret == 0) { | ||
1129 | pdev0 = platform_device_register_full(&edma_dev_info0); | ||
1130 | if (IS_ERR(pdev0)) { | ||
1131 | platform_driver_unregister(&edma_driver); | ||
1132 | ret = PTR_ERR(pdev0); | ||
1133 | goto out; | ||
1134 | } | ||
1135 | } | ||
1136 | |||
1137 | if (!of_have_populated_dt() && EDMA_CTLRS == 2) { | ||
1138 | pdev1 = platform_device_register_full(&edma_dev_info1); | ||
1139 | if (IS_ERR(pdev1)) { | ||
1140 | platform_driver_unregister(&edma_driver); | ||
1141 | platform_device_unregister(pdev0); | ||
1142 | ret = PTR_ERR(pdev1); | ||
1143 | } | ||
1144 | } | ||
1145 | |||
1146 | out: | ||
1147 | return ret; | ||
1148 | } | 1113 | } |
1149 | subsys_initcall(edma_init); | 1114 | subsys_initcall(edma_init); |
1150 | 1115 | ||
1151 | static void __exit edma_exit(void) | 1116 | static void __exit edma_exit(void) |
1152 | { | 1117 | { |
1153 | platform_device_unregister(pdev0); | ||
1154 | if (pdev1) | ||
1155 | platform_device_unregister(pdev1); | ||
1156 | platform_driver_unregister(&edma_driver); | 1118 | platform_driver_unregister(&edma_driver); |
1157 | } | 1119 | } |
1158 | module_exit(edma_exit); | 1120 | module_exit(edma_exit); |
diff --git a/drivers/edac/cpc925_edac.c b/drivers/edac/cpc925_edac.c index df6575f1430d..682288ced4ac 100644 --- a/drivers/edac/cpc925_edac.c +++ b/drivers/edac/cpc925_edac.c | |||
@@ -562,7 +562,7 @@ static void cpc925_mc_check(struct mem_ctl_info *mci) | |||
562 | 562 | ||
563 | if (apiexcp & UECC_EXCP_DETECTED) { | 563 | if (apiexcp & UECC_EXCP_DETECTED) { |
564 | cpc925_mc_printk(mci, KERN_INFO, "DRAM UECC Fault\n"); | 564 | cpc925_mc_printk(mci, KERN_INFO, "DRAM UECC Fault\n"); |
565 | edac_mc_handle_error(HW_EVENT_ERR_CORRECTED, mci, 1, | 565 | edac_mc_handle_error(HW_EVENT_ERR_UNCORRECTED, mci, 1, |
566 | pfn, offset, 0, | 566 | pfn, offset, 0, |
567 | csrow, -1, -1, | 567 | csrow, -1, -1, |
568 | mci->ctl_name, ""); | 568 | mci->ctl_name, ""); |
diff --git a/drivers/edac/e7xxx_edac.c b/drivers/edac/e7xxx_edac.c index 3cda79bc8b00..ece3aef16bb1 100644 --- a/drivers/edac/e7xxx_edac.c +++ b/drivers/edac/e7xxx_edac.c | |||
@@ -226,7 +226,7 @@ static void process_ce(struct mem_ctl_info *mci, struct e7xxx_error_info *info) | |||
226 | static void process_ce_no_info(struct mem_ctl_info *mci) | 226 | static void process_ce_no_info(struct mem_ctl_info *mci) |
227 | { | 227 | { |
228 | edac_dbg(3, "\n"); | 228 | edac_dbg(3, "\n"); |
229 | edac_mc_handle_error(HW_EVENT_ERR_UNCORRECTED, mci, 1, 0, 0, 0, -1, -1, -1, | 229 | edac_mc_handle_error(HW_EVENT_ERR_CORRECTED, mci, 1, 0, 0, 0, -1, -1, -1, |
230 | "e7xxx CE log register overflow", ""); | 230 | "e7xxx CE log register overflow", ""); |
231 | } | 231 | } |
232 | 232 | ||
diff --git a/drivers/edac/i3200_edac.c b/drivers/edac/i3200_edac.c index 022a70273ada..aa98b136f5d0 100644 --- a/drivers/edac/i3200_edac.c +++ b/drivers/edac/i3200_edac.c | |||
@@ -242,11 +242,11 @@ static void i3200_process_error_info(struct mem_ctl_info *mci, | |||
242 | -1, -1, | 242 | -1, -1, |
243 | "i3000 UE", ""); | 243 | "i3000 UE", ""); |
244 | } else if (log & I3200_ECCERRLOG_CE) { | 244 | } else if (log & I3200_ECCERRLOG_CE) { |
245 | edac_mc_handle_error(HW_EVENT_ERR_UNCORRECTED, mci, 1, | 245 | edac_mc_handle_error(HW_EVENT_ERR_CORRECTED, mci, 1, |
246 | 0, 0, eccerrlog_syndrome(log), | 246 | 0, 0, eccerrlog_syndrome(log), |
247 | eccerrlog_row(channel, log), | 247 | eccerrlog_row(channel, log), |
248 | -1, -1, | 248 | -1, -1, |
249 | "i3000 UE", ""); | 249 | "i3000 CE", ""); |
250 | } | 250 | } |
251 | } | 251 | } |
252 | } | 252 | } |
diff --git a/drivers/edac/i82860_edac.c b/drivers/edac/i82860_edac.c index 3382f6344e42..4382343a7c60 100644 --- a/drivers/edac/i82860_edac.c +++ b/drivers/edac/i82860_edac.c | |||
@@ -124,7 +124,7 @@ static int i82860_process_error_info(struct mem_ctl_info *mci, | |||
124 | dimm->location[0], dimm->location[1], -1, | 124 | dimm->location[0], dimm->location[1], -1, |
125 | "i82860 UE", ""); | 125 | "i82860 UE", ""); |
126 | else | 126 | else |
127 | edac_mc_handle_error(HW_EVENT_ERR_UNCORRECTED, mci, 1, | 127 | edac_mc_handle_error(HW_EVENT_ERR_CORRECTED, mci, 1, |
128 | info->eap, 0, info->derrsyn, | 128 | info->eap, 0, info->derrsyn, |
129 | dimm->location[0], dimm->location[1], -1, | 129 | dimm->location[0], dimm->location[1], -1, |
130 | "i82860 CE", ""); | 130 | "i82860 CE", ""); |
diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c index 5d997a33907e..2a3973a7c441 100644 --- a/drivers/firewire/core-cdev.c +++ b/drivers/firewire/core-cdev.c | |||
@@ -1637,8 +1637,7 @@ static int dispatch_ioctl(struct client *client, | |||
1637 | _IOC_SIZE(cmd) > sizeof(buffer)) | 1637 | _IOC_SIZE(cmd) > sizeof(buffer)) |
1638 | return -ENOTTY; | 1638 | return -ENOTTY; |
1639 | 1639 | ||
1640 | if (_IOC_DIR(cmd) == _IOC_READ) | 1640 | memset(&buffer, 0, sizeof(buffer)); |
1641 | memset(&buffer, 0, _IOC_SIZE(cmd)); | ||
1642 | 1641 | ||
1643 | if (_IOC_DIR(cmd) & _IOC_WRITE) | 1642 | if (_IOC_DIR(cmd) & _IOC_WRITE) |
1644 | if (copy_from_user(&buffer, arg, _IOC_SIZE(cmd))) | 1643 | if (copy_from_user(&buffer, arg, _IOC_SIZE(cmd))) |
diff --git a/drivers/gpu/drm/armada/armada_crtc.c b/drivers/gpu/drm/armada/armada_crtc.c index 9a0cc09e6653..e4a1490b42c2 100644 --- a/drivers/gpu/drm/armada/armada_crtc.c +++ b/drivers/gpu/drm/armada/armada_crtc.c | |||
@@ -260,7 +260,7 @@ static void armada_drm_vblank_off(struct armada_crtc *dcrtc) | |||
260 | * Tell the DRM core that vblank IRQs aren't going to happen for | 260 | * Tell the DRM core that vblank IRQs aren't going to happen for |
261 | * a while. This cleans up any pending vblank events for us. | 261 | * a while. This cleans up any pending vblank events for us. |
262 | */ | 262 | */ |
263 | drm_vblank_off(dev, dcrtc->num); | 263 | drm_crtc_vblank_off(&dcrtc->crtc); |
264 | 264 | ||
265 | /* Handle any pending flip event. */ | 265 | /* Handle any pending flip event. */ |
266 | spin_lock_irq(&dev->event_lock); | 266 | spin_lock_irq(&dev->event_lock); |
@@ -289,6 +289,8 @@ static void armada_drm_crtc_dpms(struct drm_crtc *crtc, int dpms) | |||
289 | armada_drm_crtc_update(dcrtc); | 289 | armada_drm_crtc_update(dcrtc); |
290 | if (dpms_blanked(dpms)) | 290 | if (dpms_blanked(dpms)) |
291 | armada_drm_vblank_off(dcrtc); | 291 | armada_drm_vblank_off(dcrtc); |
292 | else | ||
293 | drm_crtc_vblank_on(&dcrtc->crtc); | ||
292 | } | 294 | } |
293 | } | 295 | } |
294 | 296 | ||
@@ -526,7 +528,7 @@ static int armada_drm_crtc_mode_set(struct drm_crtc *crtc, | |||
526 | /* Wait for pending flips to complete */ | 528 | /* Wait for pending flips to complete */ |
527 | wait_event(dcrtc->frame_wait, !dcrtc->frame_work); | 529 | wait_event(dcrtc->frame_wait, !dcrtc->frame_work); |
528 | 530 | ||
529 | drm_vblank_pre_modeset(crtc->dev, dcrtc->num); | 531 | drm_crtc_vblank_off(crtc); |
530 | 532 | ||
531 | crtc->mode = *adj; | 533 | crtc->mode = *adj; |
532 | 534 | ||
@@ -617,7 +619,7 @@ static int armada_drm_crtc_mode_set(struct drm_crtc *crtc, | |||
617 | 619 | ||
618 | armada_drm_crtc_update(dcrtc); | 620 | armada_drm_crtc_update(dcrtc); |
619 | 621 | ||
620 | drm_vblank_post_modeset(crtc->dev, dcrtc->num); | 622 | drm_crtc_vblank_on(crtc); |
621 | armada_drm_crtc_finish_fb(dcrtc, old_fb, dpms_blanked(dcrtc->dpms)); | 623 | armada_drm_crtc_finish_fb(dcrtc, old_fb, dpms_blanked(dcrtc->dpms)); |
622 | 624 | ||
623 | return 0; | 625 | return 0; |
@@ -945,18 +947,15 @@ static int armada_drm_crtc_page_flip(struct drm_crtc *crtc, | |||
945 | armada_reg_queue_end(work->regs, i); | 947 | armada_reg_queue_end(work->regs, i); |
946 | 948 | ||
947 | /* | 949 | /* |
948 | * Hold the old framebuffer for the work - DRM appears to drop our | 950 | * Ensure that we hold a reference on the new framebuffer. |
949 | * reference to the old framebuffer in drm_mode_page_flip_ioctl(). | 951 | * This has to match the behaviour in mode_set. |
950 | */ | 952 | */ |
951 | drm_framebuffer_reference(work->old_fb); | 953 | drm_framebuffer_reference(fb); |
952 | 954 | ||
953 | ret = armada_drm_crtc_queue_frame_work(dcrtc, work); | 955 | ret = armada_drm_crtc_queue_frame_work(dcrtc, work); |
954 | if (ret) { | 956 | if (ret) { |
955 | /* | 957 | /* Undo our reference above */ |
956 | * Undo our reference above; DRM does not drop the reference | 958 | drm_framebuffer_unreference(fb); |
957 | * to this object on error, so that's okay. | ||
958 | */ | ||
959 | drm_framebuffer_unreference(work->old_fb); | ||
960 | kfree(work); | 959 | kfree(work); |
961 | return ret; | 960 | return ret; |
962 | } | 961 | } |
diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c index f672e6ad8afa..908e5316eac4 100644 --- a/drivers/gpu/drm/armada/armada_drv.c +++ b/drivers/gpu/drm/armada/armada_drv.c | |||
@@ -190,6 +190,7 @@ static int armada_drm_load(struct drm_device *dev, unsigned long flags) | |||
190 | if (ret) | 190 | if (ret) |
191 | goto err_comp; | 191 | goto err_comp; |
192 | 192 | ||
193 | dev->irq_enabled = true; | ||
193 | dev->vblank_disable_allowed = 1; | 194 | dev->vblank_disable_allowed = 1; |
194 | 195 | ||
195 | ret = armada_fbdev_init(dev); | 196 | ret = armada_fbdev_init(dev); |
@@ -331,7 +332,7 @@ static struct drm_driver armada_drm_driver = { | |||
331 | .desc = "Armada SoC DRM", | 332 | .desc = "Armada SoC DRM", |
332 | .date = "20120730", | 333 | .date = "20120730", |
333 | .driver_features = DRIVER_GEM | DRIVER_MODESET | | 334 | .driver_features = DRIVER_GEM | DRIVER_MODESET | |
334 | DRIVER_PRIME, | 335 | DRIVER_HAVE_IRQ | DRIVER_PRIME, |
335 | .ioctls = armada_ioctls, | 336 | .ioctls = armada_ioctls, |
336 | .fops = &armada_drm_fops, | 337 | .fops = &armada_drm_fops, |
337 | }; | 338 | }; |
diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c index cd50ece31601..6adb1e5cfb08 100644 --- a/drivers/gpu/drm/exynos/exynos_dp_core.c +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c | |||
@@ -1355,13 +1355,8 @@ static void exynos_dp_unbind(struct device *dev, struct device *master, | |||
1355 | void *data) | 1355 | void *data) |
1356 | { | 1356 | { |
1357 | struct exynos_drm_display *display = dev_get_drvdata(dev); | 1357 | struct exynos_drm_display *display = dev_get_drvdata(dev); |
1358 | struct exynos_dp_device *dp = display->ctx; | ||
1359 | struct drm_encoder *encoder = dp->encoder; | ||
1360 | 1358 | ||
1361 | exynos_dp_dpms(display, DRM_MODE_DPMS_OFF); | 1359 | exynos_dp_dpms(display, DRM_MODE_DPMS_OFF); |
1362 | |||
1363 | exynos_dp_connector_destroy(&dp->connector); | ||
1364 | encoder->funcs->destroy(encoder); | ||
1365 | } | 1360 | } |
1366 | 1361 | ||
1367 | static const struct component_ops exynos_dp_ops = { | 1362 | static const struct component_ops exynos_dp_ops = { |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c index 8e38e9f8e542..45026e693225 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c | |||
@@ -71,13 +71,16 @@ static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
71 | !atomic_read(&exynos_crtc->pending_flip), | 71 | !atomic_read(&exynos_crtc->pending_flip), |
72 | HZ/20)) | 72 | HZ/20)) |
73 | atomic_set(&exynos_crtc->pending_flip, 0); | 73 | atomic_set(&exynos_crtc->pending_flip, 0); |
74 | drm_vblank_off(crtc->dev, exynos_crtc->pipe); | 74 | drm_crtc_vblank_off(crtc); |
75 | } | 75 | } |
76 | 76 | ||
77 | if (manager->ops->dpms) | 77 | if (manager->ops->dpms) |
78 | manager->ops->dpms(manager, mode); | 78 | manager->ops->dpms(manager, mode); |
79 | 79 | ||
80 | exynos_crtc->dpms = mode; | 80 | exynos_crtc->dpms = mode; |
81 | |||
82 | if (mode == DRM_MODE_DPMS_ON) | ||
83 | drm_crtc_vblank_on(crtc); | ||
81 | } | 84 | } |
82 | 85 | ||
83 | static void exynos_drm_crtc_prepare(struct drm_crtc *crtc) | 86 | static void exynos_drm_crtc_prepare(struct drm_crtc *crtc) |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dpi.c b/drivers/gpu/drm/exynos/exynos_drm_dpi.c index 96c87db388fb..3dc678ed9949 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dpi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dpi.c | |||
@@ -338,14 +338,10 @@ err_del_component: | |||
338 | 338 | ||
339 | int exynos_dpi_remove(struct device *dev) | 339 | int exynos_dpi_remove(struct device *dev) |
340 | { | 340 | { |
341 | struct drm_encoder *encoder = exynos_dpi_display.encoder; | ||
342 | struct exynos_dpi *ctx = exynos_dpi_display.ctx; | 341 | struct exynos_dpi *ctx = exynos_dpi_display.ctx; |
343 | 342 | ||
344 | exynos_dpi_dpms(&exynos_dpi_display, DRM_MODE_DPMS_OFF); | 343 | exynos_dpi_dpms(&exynos_dpi_display, DRM_MODE_DPMS_OFF); |
345 | 344 | ||
346 | exynos_dpi_connector_destroy(&ctx->connector); | ||
347 | encoder->funcs->destroy(encoder); | ||
348 | |||
349 | if (ctx->panel) | 345 | if (ctx->panel) |
350 | drm_panel_detach(ctx->panel); | 346 | drm_panel_detach(ctx->panel); |
351 | 347 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index 443a2069858a..e5c4c6c8c967 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c | |||
@@ -87,16 +87,12 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags) | |||
87 | 87 | ||
88 | plane = exynos_plane_init(dev, possible_crtcs, | 88 | plane = exynos_plane_init(dev, possible_crtcs, |
89 | DRM_PLANE_TYPE_OVERLAY); | 89 | DRM_PLANE_TYPE_OVERLAY); |
90 | if (IS_ERR(plane)) | 90 | if (!IS_ERR(plane)) |
91 | goto err_mode_config_cleanup; | 91 | continue; |
92 | } | ||
93 | |||
94 | /* init kms poll for handling hpd */ | ||
95 | drm_kms_helper_poll_init(dev); | ||
96 | 92 | ||
97 | ret = drm_vblank_init(dev, MAX_CRTC); | 93 | ret = PTR_ERR(plane); |
98 | if (ret) | ||
99 | goto err_mode_config_cleanup; | 94 | goto err_mode_config_cleanup; |
95 | } | ||
100 | 96 | ||
101 | /* setup possible_clones. */ | 97 | /* setup possible_clones. */ |
102 | exynos_drm_encoder_setup(dev); | 98 | exynos_drm_encoder_setup(dev); |
@@ -106,15 +102,16 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags) | |||
106 | /* Try to bind all sub drivers. */ | 102 | /* Try to bind all sub drivers. */ |
107 | ret = component_bind_all(dev->dev, dev); | 103 | ret = component_bind_all(dev->dev, dev); |
108 | if (ret) | 104 | if (ret) |
109 | goto err_cleanup_vblank; | 105 | goto err_mode_config_cleanup; |
110 | 106 | ||
111 | /* Probe non kms sub drivers and virtual display driver. */ | 107 | ret = drm_vblank_init(dev, dev->mode_config.num_crtc); |
112 | ret = exynos_drm_device_subdrv_probe(dev); | ||
113 | if (ret) | 108 | if (ret) |
114 | goto err_unbind_all; | 109 | goto err_unbind_all; |
115 | 110 | ||
116 | /* force connectors detection */ | 111 | /* Probe non kms sub drivers and virtual display driver. */ |
117 | drm_helper_hpd_irq_event(dev); | 112 | ret = exynos_drm_device_subdrv_probe(dev); |
113 | if (ret) | ||
114 | goto err_cleanup_vblank; | ||
118 | 115 | ||
119 | /* | 116 | /* |
120 | * enable drm irq mode. | 117 | * enable drm irq mode. |
@@ -133,12 +130,18 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags) | |||
133 | */ | 130 | */ |
134 | dev->vblank_disable_allowed = true; | 131 | dev->vblank_disable_allowed = true; |
135 | 132 | ||
133 | /* init kms poll for handling hpd */ | ||
134 | drm_kms_helper_poll_init(dev); | ||
135 | |||
136 | /* force connectors detection */ | ||
137 | drm_helper_hpd_irq_event(dev); | ||
138 | |||
136 | return 0; | 139 | return 0; |
137 | 140 | ||
138 | err_unbind_all: | ||
139 | component_unbind_all(dev->dev, dev); | ||
140 | err_cleanup_vblank: | 141 | err_cleanup_vblank: |
141 | drm_vblank_cleanup(dev); | 142 | drm_vblank_cleanup(dev); |
143 | err_unbind_all: | ||
144 | component_unbind_all(dev->dev, dev); | ||
142 | err_mode_config_cleanup: | 145 | err_mode_config_cleanup: |
143 | drm_mode_config_cleanup(dev); | 146 | drm_mode_config_cleanup(dev); |
144 | drm_release_iommu_mapping(dev); | 147 | drm_release_iommu_mapping(dev); |
@@ -155,8 +158,8 @@ static int exynos_drm_unload(struct drm_device *dev) | |||
155 | exynos_drm_fbdev_fini(dev); | 158 | exynos_drm_fbdev_fini(dev); |
156 | drm_kms_helper_poll_fini(dev); | 159 | drm_kms_helper_poll_fini(dev); |
157 | 160 | ||
158 | component_unbind_all(dev->dev, dev); | ||
159 | drm_vblank_cleanup(dev); | 161 | drm_vblank_cleanup(dev); |
162 | component_unbind_all(dev->dev, dev); | ||
160 | drm_mode_config_cleanup(dev); | 163 | drm_mode_config_cleanup(dev); |
161 | drm_release_iommu_mapping(dev); | 164 | drm_release_iommu_mapping(dev); |
162 | 165 | ||
@@ -191,8 +194,12 @@ static int exynos_drm_resume(struct drm_device *dev) | |||
191 | 194 | ||
192 | drm_modeset_lock_all(dev); | 195 | drm_modeset_lock_all(dev); |
193 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { | 196 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { |
194 | if (connector->funcs->dpms) | 197 | if (connector->funcs->dpms) { |
195 | connector->funcs->dpms(connector, connector->dpms); | 198 | int dpms = connector->dpms; |
199 | |||
200 | connector->dpms = DRM_MODE_DPMS_OFF; | ||
201 | connector->funcs->dpms(connector, dpms); | ||
202 | } | ||
196 | } | 203 | } |
197 | drm_modeset_unlock_all(dev); | 204 | drm_modeset_unlock_all(dev); |
198 | 205 | ||
@@ -488,6 +495,12 @@ static struct component_match *exynos_drm_match_add(struct device *dev) | |||
488 | 495 | ||
489 | mutex_lock(&drm_component_lock); | 496 | mutex_lock(&drm_component_lock); |
490 | 497 | ||
498 | /* Do not retry to probe if there is no any kms driver regitered. */ | ||
499 | if (list_empty(&drm_component_list)) { | ||
500 | mutex_unlock(&drm_component_lock); | ||
501 | return ERR_PTR(-ENODEV); | ||
502 | } | ||
503 | |||
491 | list_for_each_entry(cdev, &drm_component_list, list) { | 504 | list_for_each_entry(cdev, &drm_component_list, list) { |
492 | /* | 505 | /* |
493 | * Add components to master only in case that crtc and | 506 | * Add components to master only in case that crtc and |
@@ -578,10 +591,21 @@ static int exynos_drm_platform_probe(struct platform_device *pdev) | |||
578 | goto err_unregister_mixer_drv; | 591 | goto err_unregister_mixer_drv; |
579 | #endif | 592 | #endif |
580 | 593 | ||
594 | match = exynos_drm_match_add(&pdev->dev); | ||
595 | if (IS_ERR(match)) { | ||
596 | ret = PTR_ERR(match); | ||
597 | goto err_unregister_hdmi_drv; | ||
598 | } | ||
599 | |||
600 | ret = component_master_add_with_match(&pdev->dev, &exynos_drm_ops, | ||
601 | match); | ||
602 | if (ret < 0) | ||
603 | goto err_unregister_hdmi_drv; | ||
604 | |||
581 | #ifdef CONFIG_DRM_EXYNOS_G2D | 605 | #ifdef CONFIG_DRM_EXYNOS_G2D |
582 | ret = platform_driver_register(&g2d_driver); | 606 | ret = platform_driver_register(&g2d_driver); |
583 | if (ret < 0) | 607 | if (ret < 0) |
584 | goto err_unregister_hdmi_drv; | 608 | goto err_del_component_master; |
585 | #endif | 609 | #endif |
586 | 610 | ||
587 | #ifdef CONFIG_DRM_EXYNOS_FIMC | 611 | #ifdef CONFIG_DRM_EXYNOS_FIMC |
@@ -612,23 +636,9 @@ static int exynos_drm_platform_probe(struct platform_device *pdev) | |||
612 | goto err_unregister_ipp_drv; | 636 | goto err_unregister_ipp_drv; |
613 | #endif | 637 | #endif |
614 | 638 | ||
615 | match = exynos_drm_match_add(&pdev->dev); | ||
616 | if (IS_ERR(match)) { | ||
617 | ret = PTR_ERR(match); | ||
618 | goto err_unregister_resources; | ||
619 | } | ||
620 | |||
621 | ret = component_master_add_with_match(&pdev->dev, &exynos_drm_ops, | ||
622 | match); | ||
623 | if (ret < 0) | ||
624 | goto err_unregister_resources; | ||
625 | |||
626 | return ret; | 639 | return ret; |
627 | 640 | ||
628 | err_unregister_resources: | ||
629 | |||
630 | #ifdef CONFIG_DRM_EXYNOS_IPP | 641 | #ifdef CONFIG_DRM_EXYNOS_IPP |
631 | exynos_platform_device_ipp_unregister(); | ||
632 | err_unregister_ipp_drv: | 642 | err_unregister_ipp_drv: |
633 | platform_driver_unregister(&ipp_driver); | 643 | platform_driver_unregister(&ipp_driver); |
634 | err_unregister_gsc_drv: | 644 | err_unregister_gsc_drv: |
@@ -651,9 +661,11 @@ err_unregister_g2d_drv: | |||
651 | 661 | ||
652 | #ifdef CONFIG_DRM_EXYNOS_G2D | 662 | #ifdef CONFIG_DRM_EXYNOS_G2D |
653 | platform_driver_unregister(&g2d_driver); | 663 | platform_driver_unregister(&g2d_driver); |
654 | err_unregister_hdmi_drv: | 664 | err_del_component_master: |
655 | #endif | 665 | #endif |
666 | component_master_del(&pdev->dev, &exynos_drm_ops); | ||
656 | 667 | ||
668 | err_unregister_hdmi_drv: | ||
657 | #ifdef CONFIG_DRM_EXYNOS_HDMI | 669 | #ifdef CONFIG_DRM_EXYNOS_HDMI |
658 | platform_driver_unregister(&hdmi_driver); | 670 | platform_driver_unregister(&hdmi_driver); |
659 | err_unregister_mixer_drv: | 671 | err_unregister_mixer_drv: |
@@ -734,6 +746,18 @@ static int exynos_drm_init(void) | |||
734 | { | 746 | { |
735 | int ret; | 747 | int ret; |
736 | 748 | ||
749 | /* | ||
750 | * Register device object only in case of Exynos SoC. | ||
751 | * | ||
752 | * Below codes resolves temporarily infinite loop issue incurred | ||
753 | * by Exynos drm driver when using multi-platform kernel. | ||
754 | * So these codes will be replaced with more generic way later. | ||
755 | */ | ||
756 | if (!of_machine_is_compatible("samsung,exynos3") && | ||
757 | !of_machine_is_compatible("samsung,exynos4") && | ||
758 | !of_machine_is_compatible("samsung,exynos5")) | ||
759 | return -ENODEV; | ||
760 | |||
737 | exynos_drm_pdev = platform_device_register_simple("exynos-drm", -1, | 761 | exynos_drm_pdev = platform_device_register_simple("exynos-drm", -1, |
738 | NULL, 0); | 762 | NULL, 0); |
739 | if (IS_ERR(exynos_drm_pdev)) | 763 | if (IS_ERR(exynos_drm_pdev)) |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c index 24741d8758e8..acf7e9e39dcd 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c | |||
@@ -1660,13 +1660,9 @@ static void exynos_dsi_unbind(struct device *dev, struct device *master, | |||
1660 | void *data) | 1660 | void *data) |
1661 | { | 1661 | { |
1662 | struct exynos_dsi *dsi = exynos_dsi_display.ctx; | 1662 | struct exynos_dsi *dsi = exynos_dsi_display.ctx; |
1663 | struct drm_encoder *encoder = dsi->encoder; | ||
1664 | 1663 | ||
1665 | exynos_dsi_dpms(&exynos_dsi_display, DRM_MODE_DPMS_OFF); | 1664 | exynos_dsi_dpms(&exynos_dsi_display, DRM_MODE_DPMS_OFF); |
1666 | 1665 | ||
1667 | exynos_dsi_connector_destroy(&dsi->connector); | ||
1668 | encoder->funcs->destroy(encoder); | ||
1669 | |||
1670 | mipi_dsi_host_unregister(&dsi->dsi_host); | 1666 | mipi_dsi_host_unregister(&dsi->dsi_host); |
1671 | } | 1667 | } |
1672 | 1668 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c index df7a77d3eff8..6ff8599f6cbf 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c +++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c | |||
@@ -302,9 +302,12 @@ static void g2d_fini_cmdlist(struct g2d_data *g2d) | |||
302 | struct exynos_drm_subdrv *subdrv = &g2d->subdrv; | 302 | struct exynos_drm_subdrv *subdrv = &g2d->subdrv; |
303 | 303 | ||
304 | kfree(g2d->cmdlist_node); | 304 | kfree(g2d->cmdlist_node); |
305 | dma_free_attrs(subdrv->drm_dev->dev, G2D_CMDLIST_POOL_SIZE, | 305 | |
306 | g2d->cmdlist_pool_virt, | 306 | if (g2d->cmdlist_pool_virt && g2d->cmdlist_pool) { |
307 | g2d->cmdlist_pool, &g2d->cmdlist_dma_attrs); | 307 | dma_free_attrs(subdrv->drm_dev->dev, G2D_CMDLIST_POOL_SIZE, |
308 | g2d->cmdlist_pool_virt, | ||
309 | g2d->cmdlist_pool, &g2d->cmdlist_dma_attrs); | ||
310 | } | ||
308 | } | 311 | } |
309 | 312 | ||
310 | static struct g2d_cmdlist_node *g2d_get_cmdlist(struct g2d_data *g2d) | 313 | static struct g2d_cmdlist_node *g2d_get_cmdlist(struct g2d_data *g2d) |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c index d565207040a2..50faf913e574 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c | |||
@@ -630,7 +630,6 @@ static int vidi_remove(struct platform_device *pdev) | |||
630 | { | 630 | { |
631 | struct exynos_drm_manager *mgr = platform_get_drvdata(pdev); | 631 | struct exynos_drm_manager *mgr = platform_get_drvdata(pdev); |
632 | struct vidi_context *ctx = mgr->ctx; | 632 | struct vidi_context *ctx = mgr->ctx; |
633 | struct drm_encoder *encoder = ctx->encoder; | ||
634 | 633 | ||
635 | if (ctx->raw_edid != (struct edid *)fake_edid_info) { | 634 | if (ctx->raw_edid != (struct edid *)fake_edid_info) { |
636 | kfree(ctx->raw_edid); | 635 | kfree(ctx->raw_edid); |
@@ -639,9 +638,6 @@ static int vidi_remove(struct platform_device *pdev) | |||
639 | return -EINVAL; | 638 | return -EINVAL; |
640 | } | 639 | } |
641 | 640 | ||
642 | encoder->funcs->destroy(encoder); | ||
643 | drm_connector_cleanup(&ctx->connector); | ||
644 | |||
645 | return 0; | 641 | return 0; |
646 | } | 642 | } |
647 | 643 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index 7910fb37d9bb..563a19e62eb2 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c | |||
@@ -2312,12 +2312,6 @@ static int hdmi_bind(struct device *dev, struct device *master, void *data) | |||
2312 | 2312 | ||
2313 | static void hdmi_unbind(struct device *dev, struct device *master, void *data) | 2313 | static void hdmi_unbind(struct device *dev, struct device *master, void *data) |
2314 | { | 2314 | { |
2315 | struct exynos_drm_display *display = get_hdmi_display(dev); | ||
2316 | struct drm_encoder *encoder = display->encoder; | ||
2317 | struct hdmi_context *hdata = display->ctx; | ||
2318 | |||
2319 | hdmi_connector_destroy(&hdata->connector); | ||
2320 | encoder->funcs->destroy(encoder); | ||
2321 | } | 2315 | } |
2322 | 2316 | ||
2323 | static const struct component_ops hdmi_component_ops = { | 2317 | static const struct component_ops hdmi_component_ops = { |
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 055d5e7fbf12..2318b4c7a8f8 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -986,6 +986,15 @@ static int i915_pm_freeze(struct device *dev) | |||
986 | return i915_drm_freeze(drm_dev); | 986 | return i915_drm_freeze(drm_dev); |
987 | } | 987 | } |
988 | 988 | ||
989 | static int i915_pm_freeze_late(struct device *dev) | ||
990 | { | ||
991 | struct pci_dev *pdev = to_pci_dev(dev); | ||
992 | struct drm_device *drm_dev = pci_get_drvdata(pdev); | ||
993 | struct drm_i915_private *dev_priv = drm_dev->dev_private; | ||
994 | |||
995 | return intel_suspend_complete(dev_priv); | ||
996 | } | ||
997 | |||
989 | static int i915_pm_thaw_early(struct device *dev) | 998 | static int i915_pm_thaw_early(struct device *dev) |
990 | { | 999 | { |
991 | struct pci_dev *pdev = to_pci_dev(dev); | 1000 | struct pci_dev *pdev = to_pci_dev(dev); |
@@ -1570,6 +1579,7 @@ static const struct dev_pm_ops i915_pm_ops = { | |||
1570 | .resume_early = i915_pm_resume_early, | 1579 | .resume_early = i915_pm_resume_early, |
1571 | .resume = i915_pm_resume, | 1580 | .resume = i915_pm_resume, |
1572 | .freeze = i915_pm_freeze, | 1581 | .freeze = i915_pm_freeze, |
1582 | .freeze_late = i915_pm_freeze_late, | ||
1573 | .thaw_early = i915_pm_thaw_early, | 1583 | .thaw_early = i915_pm_thaw_early, |
1574 | .thaw = i915_pm_thaw, | 1584 | .thaw = i915_pm_thaw, |
1575 | .poweroff = i915_pm_poweroff, | 1585 | .poweroff = i915_pm_poweroff, |
diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c index b672b843fd5e..728938f02341 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c | |||
@@ -1902,6 +1902,22 @@ static void bdw_setup_private_ppat(struct drm_i915_private *dev_priv) | |||
1902 | GEN8_PPAT(6, GEN8_PPAT_WB | GEN8_PPAT_LLCELLC | GEN8_PPAT_AGE(2)) | | 1902 | GEN8_PPAT(6, GEN8_PPAT_WB | GEN8_PPAT_LLCELLC | GEN8_PPAT_AGE(2)) | |
1903 | GEN8_PPAT(7, GEN8_PPAT_WB | GEN8_PPAT_LLCELLC | GEN8_PPAT_AGE(3)); | 1903 | GEN8_PPAT(7, GEN8_PPAT_WB | GEN8_PPAT_LLCELLC | GEN8_PPAT_AGE(3)); |
1904 | 1904 | ||
1905 | if (!USES_PPGTT(dev_priv->dev)) | ||
1906 | /* Spec: "For GGTT, there is NO pat_sel[2:0] from the entry, | ||
1907 | * so RTL will always use the value corresponding to | ||
1908 | * pat_sel = 000". | ||
1909 | * So let's disable cache for GGTT to avoid screen corruptions. | ||
1910 | * MOCS still can be used though. | ||
1911 | * - System agent ggtt writes (i.e. cpu gtt mmaps) already work | ||
1912 | * before this patch, i.e. the same uncached + snooping access | ||
1913 | * like on gen6/7 seems to be in effect. | ||
1914 | * - So this just fixes blitter/render access. Again it looks | ||
1915 | * like it's not just uncached access, but uncached + snooping. | ||
1916 | * So we can still hold onto all our assumptions wrt cpu | ||
1917 | * clflushing on LLC machines. | ||
1918 | */ | ||
1919 | pat = GEN8_PPAT(0, GEN8_PPAT_UC); | ||
1920 | |||
1905 | /* XXX: spec defines this as 2 distinct registers. It's unclear if a 64b | 1921 | /* XXX: spec defines this as 2 distinct registers. It's unclear if a 64b |
1906 | * write would work. */ | 1922 | * write would work. */ |
1907 | I915_WRITE(GEN8_PRIVATE_PAT, pat); | 1923 | I915_WRITE(GEN8_PRIVATE_PAT, pat); |
diff --git a/drivers/gpu/drm/i915/i915_gem_tiling.c b/drivers/gpu/drm/i915/i915_gem_tiling.c index 2cefb597df6d..2b1eaa29ada4 100644 --- a/drivers/gpu/drm/i915/i915_gem_tiling.c +++ b/drivers/gpu/drm/i915/i915_gem_tiling.c | |||
@@ -364,22 +364,9 @@ i915_gem_set_tiling(struct drm_device *dev, void *data, | |||
364 | * has to also include the unfenced register the GPU uses | 364 | * has to also include the unfenced register the GPU uses |
365 | * whilst executing a fenced command for an untiled object. | 365 | * whilst executing a fenced command for an untiled object. |
366 | */ | 366 | */ |
367 | 367 | if (obj->map_and_fenceable && | |
368 | obj->map_and_fenceable = | 368 | !i915_gem_object_fence_ok(obj, args->tiling_mode)) |
369 | !i915_gem_obj_ggtt_bound(obj) || | 369 | ret = i915_gem_object_ggtt_unbind(obj); |
370 | (i915_gem_obj_ggtt_offset(obj) + | ||
371 | obj->base.size <= dev_priv->gtt.mappable_end && | ||
372 | i915_gem_object_fence_ok(obj, args->tiling_mode)); | ||
373 | |||
374 | /* Rebind if we need a change of alignment */ | ||
375 | if (!obj->map_and_fenceable) { | ||
376 | u32 unfenced_align = | ||
377 | i915_gem_get_gtt_alignment(dev, obj->base.size, | ||
378 | args->tiling_mode, | ||
379 | false); | ||
380 | if (i915_gem_obj_ggtt_offset(obj) & (unfenced_align - 1)) | ||
381 | ret = i915_gem_object_ggtt_unbind(obj); | ||
382 | } | ||
383 | 370 | ||
384 | if (ret == 0) { | 371 | if (ret == 0) { |
385 | obj->fence_dirty = | 372 | obj->fence_dirty = |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index c9e220963a78..f0a1a56406eb 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -4585,7 +4585,7 @@ static void vlv_update_cdclk(struct drm_device *dev) | |||
4585 | * BSpec erroneously claims we should aim for 4MHz, but | 4585 | * BSpec erroneously claims we should aim for 4MHz, but |
4586 | * in fact 1MHz is the correct frequency. | 4586 | * in fact 1MHz is the correct frequency. |
4587 | */ | 4587 | */ |
4588 | I915_WRITE(GMBUSFREQ_VLV, dev_priv->vlv_cdclk_freq); | 4588 | I915_WRITE(GMBUSFREQ_VLV, DIV_ROUND_UP(dev_priv->vlv_cdclk_freq, 1000)); |
4589 | } | 4589 | } |
4590 | 4590 | ||
4591 | /* Adjust CDclk dividers to allow high res or save power if possible */ | 4591 | /* Adjust CDclk dividers to allow high res or save power if possible */ |
@@ -12885,6 +12885,9 @@ static struct intel_quirk intel_quirks[] = { | |||
12885 | /* Acer C720 Chromebook (Core i3 4005U) */ | 12885 | /* Acer C720 Chromebook (Core i3 4005U) */ |
12886 | { 0x0a16, 0x1025, 0x0a11, quirk_backlight_present }, | 12886 | { 0x0a16, 0x1025, 0x0a11, quirk_backlight_present }, |
12887 | 12887 | ||
12888 | /* Apple Macbook 2,1 (Core 2 T7400) */ | ||
12889 | { 0x27a2, 0x8086, 0x7270, quirk_backlight_present }, | ||
12890 | |||
12888 | /* Toshiba CB35 Chromebook (Celeron 2955U) */ | 12891 | /* Toshiba CB35 Chromebook (Celeron 2955U) */ |
12889 | { 0x0a06, 0x1179, 0x0a88, quirk_backlight_present }, | 12892 | { 0x0a06, 0x1179, 0x0a88, quirk_backlight_present }, |
12890 | 12893 | ||
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index f6a3fdd5589e..5ad45bfff3fe 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -2806,6 +2806,13 @@ intel_dp_dpcd_read_wake(struct drm_dp_aux *aux, unsigned int offset, | |||
2806 | ssize_t ret; | 2806 | ssize_t ret; |
2807 | int i; | 2807 | int i; |
2808 | 2808 | ||
2809 | /* | ||
2810 | * Sometime we just get the same incorrect byte repeated | ||
2811 | * over the entire buffer. Doing just one throw away read | ||
2812 | * initially seems to "solve" it. | ||
2813 | */ | ||
2814 | drm_dp_dpcd_read(aux, DP_DPCD_REV, buffer, 1); | ||
2815 | |||
2809 | for (i = 0; i < 3; i++) { | 2816 | for (i = 0; i < 3; i++) { |
2810 | ret = drm_dp_dpcd_read(aux, offset, buffer, size); | 2817 | ret = drm_dp_dpcd_read(aux, offset, buffer, size); |
2811 | if (ret == size) | 2818 | if (ret == size) |
@@ -3724,9 +3731,10 @@ intel_dp_get_dpcd(struct intel_dp *intel_dp) | |||
3724 | } | 3731 | } |
3725 | } | 3732 | } |
3726 | 3733 | ||
3727 | /* Training Pattern 3 support */ | 3734 | /* Training Pattern 3 support, both source and sink */ |
3728 | if (intel_dp->dpcd[DP_DPCD_REV] >= 0x12 && | 3735 | if (intel_dp->dpcd[DP_DPCD_REV] >= 0x12 && |
3729 | intel_dp->dpcd[DP_MAX_LANE_COUNT] & DP_TPS3_SUPPORTED) { | 3736 | intel_dp->dpcd[DP_MAX_LANE_COUNT] & DP_TPS3_SUPPORTED && |
3737 | (IS_HASWELL(dev_priv) || INTEL_INFO(dev_priv)->gen >= 8)) { | ||
3730 | intel_dp->use_tps3 = true; | 3738 | intel_dp->use_tps3 = true; |
3731 | DRM_DEBUG_KMS("Displayport TPS3 supported\n"); | 3739 | DRM_DEBUG_KMS("Displayport TPS3 supported\n"); |
3732 | } else | 3740 | } else |
@@ -4491,6 +4499,18 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd) | |||
4491 | if (intel_dig_port->base.type != INTEL_OUTPUT_EDP) | 4499 | if (intel_dig_port->base.type != INTEL_OUTPUT_EDP) |
4492 | intel_dig_port->base.type = INTEL_OUTPUT_DISPLAYPORT; | 4500 | intel_dig_port->base.type = INTEL_OUTPUT_DISPLAYPORT; |
4493 | 4501 | ||
4502 | if (long_hpd && intel_dig_port->base.type == INTEL_OUTPUT_EDP) { | ||
4503 | /* | ||
4504 | * vdd off can generate a long pulse on eDP which | ||
4505 | * would require vdd on to handle it, and thus we | ||
4506 | * would end up in an endless cycle of | ||
4507 | * "vdd off -> long hpd -> vdd on -> detect -> vdd off -> ..." | ||
4508 | */ | ||
4509 | DRM_DEBUG_KMS("ignoring long hpd on eDP port %c\n", | ||
4510 | port_name(intel_dig_port->port)); | ||
4511 | return false; | ||
4512 | } | ||
4513 | |||
4494 | DRM_DEBUG_KMS("got hpd irq on port %c - %s\n", | 4514 | DRM_DEBUG_KMS("got hpd irq on port %c - %s\n", |
4495 | port_name(intel_dig_port->port), | 4515 | port_name(intel_dig_port->port), |
4496 | long_hpd ? "long" : "short"); | 4516 | long_hpd ? "long" : "short"); |
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index 0e018cb49147..41b3be217493 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c | |||
@@ -1098,12 +1098,25 @@ static u32 get_backlight_min_vbt(struct intel_connector *connector) | |||
1098 | struct drm_device *dev = connector->base.dev; | 1098 | struct drm_device *dev = connector->base.dev; |
1099 | struct drm_i915_private *dev_priv = dev->dev_private; | 1099 | struct drm_i915_private *dev_priv = dev->dev_private; |
1100 | struct intel_panel *panel = &connector->panel; | 1100 | struct intel_panel *panel = &connector->panel; |
1101 | int min; | ||
1101 | 1102 | ||
1102 | WARN_ON(panel->backlight.max == 0); | 1103 | WARN_ON(panel->backlight.max == 0); |
1103 | 1104 | ||
1105 | /* | ||
1106 | * XXX: If the vbt value is 255, it makes min equal to max, which leads | ||
1107 | * to problems. There are such machines out there. Either our | ||
1108 | * interpretation is wrong or the vbt has bogus data. Or both. Safeguard | ||
1109 | * against this by letting the minimum be at most (arbitrarily chosen) | ||
1110 | * 25% of the max. | ||
1111 | */ | ||
1112 | min = clamp_t(int, dev_priv->vbt.backlight.min_brightness, 0, 64); | ||
1113 | if (min != dev_priv->vbt.backlight.min_brightness) { | ||
1114 | DRM_DEBUG_KMS("clamping VBT min backlight %d/255 to %d/255\n", | ||
1115 | dev_priv->vbt.backlight.min_brightness, min); | ||
1116 | } | ||
1117 | |||
1104 | /* vbt value is a coefficient in range [0..255] */ | 1118 | /* vbt value is a coefficient in range [0..255] */ |
1105 | return scale(dev_priv->vbt.backlight.min_brightness, 0, 255, | 1119 | return scale(min, 0, 255, 0, panel->backlight.max); |
1106 | 0, panel->backlight.max); | ||
1107 | } | 1120 | } |
1108 | 1121 | ||
1109 | static int bdw_setup_backlight(struct intel_connector *connector) | 1122 | static int bdw_setup_backlight(struct intel_connector *connector) |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/gk20a.c b/drivers/gpu/drm/nouveau/core/subdev/fb/gk20a.c index a16024a74771..fde42e4d1b56 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/gk20a.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/gk20a.c | |||
@@ -27,6 +27,20 @@ struct gk20a_fb_priv { | |||
27 | }; | 27 | }; |
28 | 28 | ||
29 | static int | 29 | static int |
30 | gk20a_fb_init(struct nouveau_object *object) | ||
31 | { | ||
32 | struct gk20a_fb_priv *priv = (void *)object; | ||
33 | int ret; | ||
34 | |||
35 | ret = nouveau_fb_init(&priv->base); | ||
36 | if (ret) | ||
37 | return ret; | ||
38 | |||
39 | nv_mask(priv, 0x100c80, 0x00000001, 0x00000000); /* 128KiB lpg */ | ||
40 | return 0; | ||
41 | } | ||
42 | |||
43 | static int | ||
30 | gk20a_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, | 44 | gk20a_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, |
31 | struct nouveau_oclass *oclass, void *data, u32 size, | 45 | struct nouveau_oclass *oclass, void *data, u32 size, |
32 | struct nouveau_object **pobject) | 46 | struct nouveau_object **pobject) |
@@ -48,7 +62,7 @@ gk20a_fb_oclass = &(struct nouveau_fb_impl) { | |||
48 | .base.ofuncs = &(struct nouveau_ofuncs) { | 62 | .base.ofuncs = &(struct nouveau_ofuncs) { |
49 | .ctor = gk20a_fb_ctor, | 63 | .ctor = gk20a_fb_ctor, |
50 | .dtor = _nouveau_fb_dtor, | 64 | .dtor = _nouveau_fb_dtor, |
51 | .init = _nouveau_fb_init, | 65 | .init = gk20a_fb_init, |
52 | .fini = _nouveau_fb_fini, | 66 | .fini = _nouveau_fb_fini, |
53 | }, | 67 | }, |
54 | .memtype = nvc0_fb_memtype_valid, | 68 | .memtype = nvc0_fb_memtype_valid, |
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c index ae873d1a8d46..eb8b36714fa1 100644 --- a/drivers/gpu/drm/nouveau/nv50_display.c +++ b/drivers/gpu/drm/nouveau/nv50_display.c | |||
@@ -791,6 +791,22 @@ nv50_crtc_set_scale(struct nouveau_crtc *nv_crtc, bool update) | |||
791 | } | 791 | } |
792 | 792 | ||
793 | static int | 793 | static int |
794 | nv50_crtc_set_raster_vblank_dmi(struct nouveau_crtc *nv_crtc, u32 usec) | ||
795 | { | ||
796 | struct nv50_mast *mast = nv50_mast(nv_crtc->base.dev); | ||
797 | u32 *push; | ||
798 | |||
799 | push = evo_wait(mast, 8); | ||
800 | if (!push) | ||
801 | return -ENOMEM; | ||
802 | |||
803 | evo_mthd(push, 0x0828 + (nv_crtc->index * 0x400), 1); | ||
804 | evo_data(push, usec); | ||
805 | evo_kick(push, mast); | ||
806 | return 0; | ||
807 | } | ||
808 | |||
809 | static int | ||
794 | nv50_crtc_set_color_vibrance(struct nouveau_crtc *nv_crtc, bool update) | 810 | nv50_crtc_set_color_vibrance(struct nouveau_crtc *nv_crtc, bool update) |
795 | { | 811 | { |
796 | struct nv50_mast *mast = nv50_mast(nv_crtc->base.dev); | 812 | struct nv50_mast *mast = nv50_mast(nv_crtc->base.dev); |
@@ -1104,14 +1120,14 @@ nv50_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *umode, | |||
1104 | evo_mthd(push, 0x0804 + (nv_crtc->index * 0x400), 2); | 1120 | evo_mthd(push, 0x0804 + (nv_crtc->index * 0x400), 2); |
1105 | evo_data(push, 0x00800000 | mode->clock); | 1121 | evo_data(push, 0x00800000 | mode->clock); |
1106 | evo_data(push, (ilace == 2) ? 2 : 0); | 1122 | evo_data(push, (ilace == 2) ? 2 : 0); |
1107 | evo_mthd(push, 0x0810 + (nv_crtc->index * 0x400), 8); | 1123 | evo_mthd(push, 0x0810 + (nv_crtc->index * 0x400), 6); |
1108 | evo_data(push, 0x00000000); | 1124 | evo_data(push, 0x00000000); |
1109 | evo_data(push, (vactive << 16) | hactive); | 1125 | evo_data(push, (vactive << 16) | hactive); |
1110 | evo_data(push, ( vsynce << 16) | hsynce); | 1126 | evo_data(push, ( vsynce << 16) | hsynce); |
1111 | evo_data(push, (vblanke << 16) | hblanke); | 1127 | evo_data(push, (vblanke << 16) | hblanke); |
1112 | evo_data(push, (vblanks << 16) | hblanks); | 1128 | evo_data(push, (vblanks << 16) | hblanks); |
1113 | evo_data(push, (vblan2e << 16) | vblan2s); | 1129 | evo_data(push, (vblan2e << 16) | vblan2s); |
1114 | evo_data(push, vblankus); | 1130 | evo_mthd(push, 0x082c + (nv_crtc->index * 0x400), 1); |
1115 | evo_data(push, 0x00000000); | 1131 | evo_data(push, 0x00000000); |
1116 | evo_mthd(push, 0x0900 + (nv_crtc->index * 0x400), 2); | 1132 | evo_mthd(push, 0x0900 + (nv_crtc->index * 0x400), 2); |
1117 | evo_data(push, 0x00000311); | 1133 | evo_data(push, 0x00000311); |
@@ -1141,6 +1157,11 @@ nv50_crtc_mode_set(struct drm_crtc *crtc, struct drm_display_mode *umode, | |||
1141 | nv_connector = nouveau_crtc_connector_get(nv_crtc); | 1157 | nv_connector = nouveau_crtc_connector_get(nv_crtc); |
1142 | nv50_crtc_set_dither(nv_crtc, false); | 1158 | nv50_crtc_set_dither(nv_crtc, false); |
1143 | nv50_crtc_set_scale(nv_crtc, false); | 1159 | nv50_crtc_set_scale(nv_crtc, false); |
1160 | |||
1161 | /* G94 only accepts this after setting scale */ | ||
1162 | if (nv50_vers(mast) < GF110_DISP_CORE_CHANNEL_DMA) | ||
1163 | nv50_crtc_set_raster_vblank_dmi(nv_crtc, vblankus); | ||
1164 | |||
1144 | nv50_crtc_set_color_vibrance(nv_crtc, false); | 1165 | nv50_crtc_set_color_vibrance(nv_crtc, false); |
1145 | nv50_crtc_set_image(nv_crtc, crtc->primary->fb, x, y, false); | 1166 | nv50_crtc_set_image(nv_crtc, crtc->primary->fb, x, y, false); |
1146 | return 0; | 1167 | return 0; |
diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c index 15da7ef344a4..ec1593a6a561 100644 --- a/drivers/gpu/drm/radeon/atom.c +++ b/drivers/gpu/drm/radeon/atom.c | |||
@@ -1217,7 +1217,7 @@ free: | |||
1217 | return ret; | 1217 | return ret; |
1218 | } | 1218 | } |
1219 | 1219 | ||
1220 | int atom_execute_table(struct atom_context *ctx, int index, uint32_t * params) | 1220 | int atom_execute_table_scratch_unlocked(struct atom_context *ctx, int index, uint32_t * params) |
1221 | { | 1221 | { |
1222 | int r; | 1222 | int r; |
1223 | 1223 | ||
@@ -1238,6 +1238,15 @@ int atom_execute_table(struct atom_context *ctx, int index, uint32_t * params) | |||
1238 | return r; | 1238 | return r; |
1239 | } | 1239 | } |
1240 | 1240 | ||
1241 | int atom_execute_table(struct atom_context *ctx, int index, uint32_t * params) | ||
1242 | { | ||
1243 | int r; | ||
1244 | mutex_lock(&ctx->scratch_mutex); | ||
1245 | r = atom_execute_table_scratch_unlocked(ctx, index, params); | ||
1246 | mutex_unlock(&ctx->scratch_mutex); | ||
1247 | return r; | ||
1248 | } | ||
1249 | |||
1241 | static int atom_iio_len[] = { 1, 2, 3, 3, 3, 3, 4, 4, 4, 3 }; | 1250 | static int atom_iio_len[] = { 1, 2, 3, 3, 3, 3, 4, 4, 4, 3 }; |
1242 | 1251 | ||
1243 | static void atom_index_iio(struct atom_context *ctx, int base) | 1252 | static void atom_index_iio(struct atom_context *ctx, int base) |
diff --git a/drivers/gpu/drm/radeon/atom.h b/drivers/gpu/drm/radeon/atom.h index feba6b8d36b3..6d014ddb6b78 100644 --- a/drivers/gpu/drm/radeon/atom.h +++ b/drivers/gpu/drm/radeon/atom.h | |||
@@ -125,6 +125,7 @@ struct card_info { | |||
125 | struct atom_context { | 125 | struct atom_context { |
126 | struct card_info *card; | 126 | struct card_info *card; |
127 | struct mutex mutex; | 127 | struct mutex mutex; |
128 | struct mutex scratch_mutex; | ||
128 | void *bios; | 129 | void *bios; |
129 | uint32_t cmd_table, data_table; | 130 | uint32_t cmd_table, data_table; |
130 | uint16_t *iio; | 131 | uint16_t *iio; |
@@ -145,6 +146,7 @@ extern int atom_debug; | |||
145 | 146 | ||
146 | struct atom_context *atom_parse(struct card_info *, void *); | 147 | struct atom_context *atom_parse(struct card_info *, void *); |
147 | int atom_execute_table(struct atom_context *, int, uint32_t *); | 148 | int atom_execute_table(struct atom_context *, int, uint32_t *); |
149 | int atom_execute_table_scratch_unlocked(struct atom_context *, int, uint32_t *); | ||
148 | int atom_asic_init(struct atom_context *); | 150 | int atom_asic_init(struct atom_context *); |
149 | void atom_destroy(struct atom_context *); | 151 | void atom_destroy(struct atom_context *); |
150 | bool atom_parse_data_header(struct atom_context *ctx, int index, uint16_t *size, | 152 | bool atom_parse_data_header(struct atom_context *ctx, int index, uint16_t *size, |
diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c index 95d5d4ab3335..11ba9d21b89b 100644 --- a/drivers/gpu/drm/radeon/atombios_dp.c +++ b/drivers/gpu/drm/radeon/atombios_dp.c | |||
@@ -100,6 +100,7 @@ static int radeon_process_aux_ch(struct radeon_i2c_chan *chan, | |||
100 | memset(&args, 0, sizeof(args)); | 100 | memset(&args, 0, sizeof(args)); |
101 | 101 | ||
102 | mutex_lock(&chan->mutex); | 102 | mutex_lock(&chan->mutex); |
103 | mutex_lock(&rdev->mode_info.atom_context->scratch_mutex); | ||
103 | 104 | ||
104 | base = (unsigned char *)(rdev->mode_info.atom_context->scratch + 1); | 105 | base = (unsigned char *)(rdev->mode_info.atom_context->scratch + 1); |
105 | 106 | ||
@@ -113,7 +114,7 @@ static int radeon_process_aux_ch(struct radeon_i2c_chan *chan, | |||
113 | if (ASIC_IS_DCE4(rdev)) | 114 | if (ASIC_IS_DCE4(rdev)) |
114 | args.v2.ucHPD_ID = chan->rec.hpd; | 115 | args.v2.ucHPD_ID = chan->rec.hpd; |
115 | 116 | ||
116 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); | 117 | atom_execute_table_scratch_unlocked(rdev->mode_info.atom_context, index, (uint32_t *)&args); |
117 | 118 | ||
118 | *ack = args.v1.ucReplyStatus; | 119 | *ack = args.v1.ucReplyStatus; |
119 | 120 | ||
@@ -147,6 +148,7 @@ static int radeon_process_aux_ch(struct radeon_i2c_chan *chan, | |||
147 | 148 | ||
148 | r = recv_bytes; | 149 | r = recv_bytes; |
149 | done: | 150 | done: |
151 | mutex_unlock(&rdev->mode_info.atom_context->scratch_mutex); | ||
150 | mutex_unlock(&chan->mutex); | 152 | mutex_unlock(&chan->mutex); |
151 | 153 | ||
152 | return r; | 154 | return r; |
diff --git a/drivers/gpu/drm/radeon/atombios_i2c.c b/drivers/gpu/drm/radeon/atombios_i2c.c index 9c570fb15b8c..4157780585a0 100644 --- a/drivers/gpu/drm/radeon/atombios_i2c.c +++ b/drivers/gpu/drm/radeon/atombios_i2c.c | |||
@@ -48,6 +48,7 @@ static int radeon_process_i2c_ch(struct radeon_i2c_chan *chan, | |||
48 | memset(&args, 0, sizeof(args)); | 48 | memset(&args, 0, sizeof(args)); |
49 | 49 | ||
50 | mutex_lock(&chan->mutex); | 50 | mutex_lock(&chan->mutex); |
51 | mutex_lock(&rdev->mode_info.atom_context->scratch_mutex); | ||
51 | 52 | ||
52 | base = (unsigned char *)rdev->mode_info.atom_context->scratch; | 53 | base = (unsigned char *)rdev->mode_info.atom_context->scratch; |
53 | 54 | ||
@@ -82,7 +83,7 @@ static int radeon_process_i2c_ch(struct radeon_i2c_chan *chan, | |||
82 | args.ucSlaveAddr = slave_addr << 1; | 83 | args.ucSlaveAddr = slave_addr << 1; |
83 | args.ucLineNumber = chan->rec.i2c_id; | 84 | args.ucLineNumber = chan->rec.i2c_id; |
84 | 85 | ||
85 | atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); | 86 | atom_execute_table_scratch_unlocked(rdev->mode_info.atom_context, index, (uint32_t *)&args); |
86 | 87 | ||
87 | /* error */ | 88 | /* error */ |
88 | if (args.ucStatus != HW_ASSISTED_I2C_STATUS_SUCCESS) { | 89 | if (args.ucStatus != HW_ASSISTED_I2C_STATUS_SUCCESS) { |
@@ -95,6 +96,7 @@ static int radeon_process_i2c_ch(struct radeon_i2c_chan *chan, | |||
95 | radeon_atom_copy_swap(buf, base, num, false); | 96 | radeon_atom_copy_swap(buf, base, num, false); |
96 | 97 | ||
97 | done: | 98 | done: |
99 | mutex_unlock(&rdev->mode_info.atom_context->scratch_mutex); | ||
98 | mutex_unlock(&chan->mutex); | 100 | mutex_unlock(&chan->mutex); |
99 | 101 | ||
100 | return r; | 102 | return r; |
diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c index 377afa504d2b..89c01fa6dd8e 100644 --- a/drivers/gpu/drm/radeon/cik.c +++ b/drivers/gpu/drm/radeon/cik.c | |||
@@ -4313,8 +4313,8 @@ static int cik_cp_gfx_start(struct radeon_device *rdev) | |||
4313 | /* init the CE partitions. CE only used for gfx on CIK */ | 4313 | /* init the CE partitions. CE only used for gfx on CIK */ |
4314 | radeon_ring_write(ring, PACKET3(PACKET3_SET_BASE, 2)); | 4314 | radeon_ring_write(ring, PACKET3(PACKET3_SET_BASE, 2)); |
4315 | radeon_ring_write(ring, PACKET3_BASE_INDEX(CE_PARTITION_BASE)); | 4315 | radeon_ring_write(ring, PACKET3_BASE_INDEX(CE_PARTITION_BASE)); |
4316 | radeon_ring_write(ring, 0xc000); | 4316 | radeon_ring_write(ring, 0x8000); |
4317 | radeon_ring_write(ring, 0xc000); | 4317 | radeon_ring_write(ring, 0x8000); |
4318 | 4318 | ||
4319 | /* setup clear context state */ | 4319 | /* setup clear context state */ |
4320 | radeon_ring_write(ring, PACKET3(PACKET3_PREAMBLE_CNTL, 0)); | 4320 | radeon_ring_write(ring, PACKET3(PACKET3_PREAMBLE_CNTL, 0)); |
@@ -9447,6 +9447,9 @@ void dce8_bandwidth_update(struct radeon_device *rdev) | |||
9447 | u32 num_heads = 0, lb_size; | 9447 | u32 num_heads = 0, lb_size; |
9448 | int i; | 9448 | int i; |
9449 | 9449 | ||
9450 | if (!rdev->mode_info.mode_config_initialized) | ||
9451 | return; | ||
9452 | |||
9450 | radeon_update_display_priority(rdev); | 9453 | radeon_update_display_priority(rdev); |
9451 | 9454 | ||
9452 | for (i = 0; i < rdev->num_crtc; i++) { | 9455 | for (i = 0; i < rdev->num_crtc; i++) { |
diff --git a/drivers/gpu/drm/radeon/cik_sdma.c b/drivers/gpu/drm/radeon/cik_sdma.c index 4e8432d07f15..d748963af08b 100644 --- a/drivers/gpu/drm/radeon/cik_sdma.c +++ b/drivers/gpu/drm/radeon/cik_sdma.c | |||
@@ -667,17 +667,20 @@ int cik_sdma_ib_test(struct radeon_device *rdev, struct radeon_ring *ring) | |||
667 | { | 667 | { |
668 | struct radeon_ib ib; | 668 | struct radeon_ib ib; |
669 | unsigned i; | 669 | unsigned i; |
670 | unsigned index; | ||
670 | int r; | 671 | int r; |
671 | void __iomem *ptr = (void *)rdev->vram_scratch.ptr; | ||
672 | u32 tmp = 0; | 672 | u32 tmp = 0; |
673 | u64 gpu_addr; | ||
673 | 674 | ||
674 | if (!ptr) { | 675 | if (ring->idx == R600_RING_TYPE_DMA_INDEX) |
675 | DRM_ERROR("invalid vram scratch pointer\n"); | 676 | index = R600_WB_DMA_RING_TEST_OFFSET; |
676 | return -EINVAL; | 677 | else |
677 | } | 678 | index = CAYMAN_WB_DMA1_RING_TEST_OFFSET; |
679 | |||
680 | gpu_addr = rdev->wb.gpu_addr + index; | ||
678 | 681 | ||
679 | tmp = 0xCAFEDEAD; | 682 | tmp = 0xCAFEDEAD; |
680 | writel(tmp, ptr); | 683 | rdev->wb.wb[index/4] = cpu_to_le32(tmp); |
681 | 684 | ||
682 | r = radeon_ib_get(rdev, ring->idx, &ib, NULL, 256); | 685 | r = radeon_ib_get(rdev, ring->idx, &ib, NULL, 256); |
683 | if (r) { | 686 | if (r) { |
@@ -686,8 +689,8 @@ int cik_sdma_ib_test(struct radeon_device *rdev, struct radeon_ring *ring) | |||
686 | } | 689 | } |
687 | 690 | ||
688 | ib.ptr[0] = SDMA_PACKET(SDMA_OPCODE_WRITE, SDMA_WRITE_SUB_OPCODE_LINEAR, 0); | 691 | ib.ptr[0] = SDMA_PACKET(SDMA_OPCODE_WRITE, SDMA_WRITE_SUB_OPCODE_LINEAR, 0); |
689 | ib.ptr[1] = rdev->vram_scratch.gpu_addr & 0xfffffffc; | 692 | ib.ptr[1] = lower_32_bits(gpu_addr); |
690 | ib.ptr[2] = upper_32_bits(rdev->vram_scratch.gpu_addr); | 693 | ib.ptr[2] = upper_32_bits(gpu_addr); |
691 | ib.ptr[3] = 1; | 694 | ib.ptr[3] = 1; |
692 | ib.ptr[4] = 0xDEADBEEF; | 695 | ib.ptr[4] = 0xDEADBEEF; |
693 | ib.length_dw = 5; | 696 | ib.length_dw = 5; |
@@ -704,7 +707,7 @@ int cik_sdma_ib_test(struct radeon_device *rdev, struct radeon_ring *ring) | |||
704 | return r; | 707 | return r; |
705 | } | 708 | } |
706 | for (i = 0; i < rdev->usec_timeout; i++) { | 709 | for (i = 0; i < rdev->usec_timeout; i++) { |
707 | tmp = readl(ptr); | 710 | tmp = le32_to_cpu(rdev->wb.wb[index/4]); |
708 | if (tmp == 0xDEADBEEF) | 711 | if (tmp == 0xDEADBEEF) |
709 | break; | 712 | break; |
710 | DRM_UDELAY(1); | 713 | DRM_UDELAY(1); |
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index a31f1ca40c6a..85995b4e3338 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -2345,6 +2345,9 @@ void evergreen_bandwidth_update(struct radeon_device *rdev) | |||
2345 | u32 num_heads = 0, lb_size; | 2345 | u32 num_heads = 0, lb_size; |
2346 | int i; | 2346 | int i; |
2347 | 2347 | ||
2348 | if (!rdev->mode_info.mode_config_initialized) | ||
2349 | return; | ||
2350 | |||
2348 | radeon_update_display_priority(rdev); | 2351 | radeon_update_display_priority(rdev); |
2349 | 2352 | ||
2350 | for (i = 0; i < rdev->num_crtc; i++) { | 2353 | for (i = 0; i < rdev->num_crtc; i++) { |
@@ -2552,6 +2555,7 @@ void evergreen_mc_stop(struct radeon_device *rdev, struct evergreen_mc_save *sav | |||
2552 | WREG32(EVERGREEN_CRTC_UPDATE_LOCK + crtc_offsets[i], 1); | 2555 | WREG32(EVERGREEN_CRTC_UPDATE_LOCK + crtc_offsets[i], 1); |
2553 | tmp |= EVERGREEN_CRTC_BLANK_DATA_EN; | 2556 | tmp |= EVERGREEN_CRTC_BLANK_DATA_EN; |
2554 | WREG32(EVERGREEN_CRTC_BLANK_CONTROL + crtc_offsets[i], tmp); | 2557 | WREG32(EVERGREEN_CRTC_BLANK_CONTROL + crtc_offsets[i], tmp); |
2558 | WREG32(EVERGREEN_CRTC_UPDATE_LOCK + crtc_offsets[i], 0); | ||
2555 | } | 2559 | } |
2556 | } else { | 2560 | } else { |
2557 | tmp = RREG32(EVERGREEN_CRTC_CONTROL + crtc_offsets[i]); | 2561 | tmp = RREG32(EVERGREEN_CRTC_CONTROL + crtc_offsets[i]); |
@@ -3005,7 +3009,7 @@ static void evergreen_gpu_init(struct radeon_device *rdev) | |||
3005 | u32 vgt_cache_invalidation; | 3009 | u32 vgt_cache_invalidation; |
3006 | u32 hdp_host_path_cntl, tmp; | 3010 | u32 hdp_host_path_cntl, tmp; |
3007 | u32 disabled_rb_mask; | 3011 | u32 disabled_rb_mask; |
3008 | int i, j, num_shader_engines, ps_thread_count; | 3012 | int i, j, ps_thread_count; |
3009 | 3013 | ||
3010 | switch (rdev->family) { | 3014 | switch (rdev->family) { |
3011 | case CHIP_CYPRESS: | 3015 | case CHIP_CYPRESS: |
@@ -3303,8 +3307,6 @@ static void evergreen_gpu_init(struct radeon_device *rdev) | |||
3303 | rdev->config.evergreen.tile_config |= | 3307 | rdev->config.evergreen.tile_config |= |
3304 | ((gb_addr_config & 0x30000000) >> 28) << 12; | 3308 | ((gb_addr_config & 0x30000000) >> 28) << 12; |
3305 | 3309 | ||
3306 | num_shader_engines = (gb_addr_config & NUM_SHADER_ENGINES(3) >> 12) + 1; | ||
3307 | |||
3308 | if ((rdev->family >= CHIP_CEDAR) && (rdev->family <= CHIP_HEMLOCK)) { | 3310 | if ((rdev->family >= CHIP_CEDAR) && (rdev->family <= CHIP_HEMLOCK)) { |
3309 | u32 efuse_straps_4; | 3311 | u32 efuse_straps_4; |
3310 | u32 efuse_straps_3; | 3312 | u32 efuse_straps_3; |
diff --git a/drivers/gpu/drm/radeon/kv_dpm.c b/drivers/gpu/drm/radeon/kv_dpm.c index 1dd976f447fa..9b42001295ba 100644 --- a/drivers/gpu/drm/radeon/kv_dpm.c +++ b/drivers/gpu/drm/radeon/kv_dpm.c | |||
@@ -2725,7 +2725,11 @@ int kv_dpm_init(struct radeon_device *rdev) | |||
2725 | 2725 | ||
2726 | pi->sram_end = SMC_RAM_END; | 2726 | pi->sram_end = SMC_RAM_END; |
2727 | 2727 | ||
2728 | pi->enable_nb_dpm = true; | 2728 | /* Enabling nb dpm on an asrock system prevents dpm from working */ |
2729 | if (rdev->pdev->subsystem_vendor == 0x1849) | ||
2730 | pi->enable_nb_dpm = false; | ||
2731 | else | ||
2732 | pi->enable_nb_dpm = true; | ||
2729 | 2733 | ||
2730 | pi->caps_power_containment = true; | 2734 | pi->caps_power_containment = true; |
2731 | pi->caps_cac = true; | 2735 | pi->caps_cac = true; |
@@ -2740,10 +2744,19 @@ int kv_dpm_init(struct radeon_device *rdev) | |||
2740 | pi->caps_sclk_ds = true; | 2744 | pi->caps_sclk_ds = true; |
2741 | pi->enable_auto_thermal_throttling = true; | 2745 | pi->enable_auto_thermal_throttling = true; |
2742 | pi->disable_nb_ps3_in_battery = false; | 2746 | pi->disable_nb_ps3_in_battery = false; |
2743 | if (radeon_bapm == 0) | 2747 | if (radeon_bapm == -1) { |
2748 | /* There are stability issues reported on with | ||
2749 | * bapm enabled on an asrock system. | ||
2750 | */ | ||
2751 | if (rdev->pdev->subsystem_vendor == 0x1849) | ||
2752 | pi->bapm_enable = false; | ||
2753 | else | ||
2754 | pi->bapm_enable = true; | ||
2755 | } else if (radeon_bapm == 0) { | ||
2744 | pi->bapm_enable = false; | 2756 | pi->bapm_enable = false; |
2745 | else | 2757 | } else { |
2746 | pi->bapm_enable = true; | 2758 | pi->bapm_enable = true; |
2759 | } | ||
2747 | pi->voltage_drop_t = 0; | 2760 | pi->voltage_drop_t = 0; |
2748 | pi->caps_sclk_throttle_low_notification = false; | 2761 | pi->caps_sclk_throttle_low_notification = false; |
2749 | pi->caps_fps = false; /* true? */ | 2762 | pi->caps_fps = false; /* true? */ |
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index 10f8be0ee173..b53b31a7b76f 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c | |||
@@ -3207,6 +3207,9 @@ void r100_bandwidth_update(struct radeon_device *rdev) | |||
3207 | uint32_t pixel_bytes1 = 0; | 3207 | uint32_t pixel_bytes1 = 0; |
3208 | uint32_t pixel_bytes2 = 0; | 3208 | uint32_t pixel_bytes2 = 0; |
3209 | 3209 | ||
3210 | if (!rdev->mode_info.mode_config_initialized) | ||
3211 | return; | ||
3212 | |||
3210 | radeon_update_display_priority(rdev); | 3213 | radeon_update_display_priority(rdev); |
3211 | 3214 | ||
3212 | if (rdev->mode_info.crtcs[0]->base.enabled) { | 3215 | if (rdev->mode_info.crtcs[0]->base.enabled) { |
diff --git a/drivers/gpu/drm/radeon/r600_dma.c b/drivers/gpu/drm/radeon/r600_dma.c index aabc343b9a8f..cf0df45d455e 100644 --- a/drivers/gpu/drm/radeon/r600_dma.c +++ b/drivers/gpu/drm/radeon/r600_dma.c | |||
@@ -338,17 +338,17 @@ int r600_dma_ib_test(struct radeon_device *rdev, struct radeon_ring *ring) | |||
338 | { | 338 | { |
339 | struct radeon_ib ib; | 339 | struct radeon_ib ib; |
340 | unsigned i; | 340 | unsigned i; |
341 | unsigned index; | ||
341 | int r; | 342 | int r; |
342 | void __iomem *ptr = (void *)rdev->vram_scratch.ptr; | ||
343 | u32 tmp = 0; | 343 | u32 tmp = 0; |
344 | u64 gpu_addr; | ||
344 | 345 | ||
345 | if (!ptr) { | 346 | if (ring->idx == R600_RING_TYPE_DMA_INDEX) |
346 | DRM_ERROR("invalid vram scratch pointer\n"); | 347 | index = R600_WB_DMA_RING_TEST_OFFSET; |
347 | return -EINVAL; | 348 | else |
348 | } | 349 | index = CAYMAN_WB_DMA1_RING_TEST_OFFSET; |
349 | 350 | ||
350 | tmp = 0xCAFEDEAD; | 351 | gpu_addr = rdev->wb.gpu_addr + index; |
351 | writel(tmp, ptr); | ||
352 | 352 | ||
353 | r = radeon_ib_get(rdev, ring->idx, &ib, NULL, 256); | 353 | r = radeon_ib_get(rdev, ring->idx, &ib, NULL, 256); |
354 | if (r) { | 354 | if (r) { |
@@ -357,8 +357,8 @@ int r600_dma_ib_test(struct radeon_device *rdev, struct radeon_ring *ring) | |||
357 | } | 357 | } |
358 | 358 | ||
359 | ib.ptr[0] = DMA_PACKET(DMA_PACKET_WRITE, 0, 0, 1); | 359 | ib.ptr[0] = DMA_PACKET(DMA_PACKET_WRITE, 0, 0, 1); |
360 | ib.ptr[1] = rdev->vram_scratch.gpu_addr & 0xfffffffc; | 360 | ib.ptr[1] = lower_32_bits(gpu_addr); |
361 | ib.ptr[2] = upper_32_bits(rdev->vram_scratch.gpu_addr) & 0xff; | 361 | ib.ptr[2] = upper_32_bits(gpu_addr) & 0xff; |
362 | ib.ptr[3] = 0xDEADBEEF; | 362 | ib.ptr[3] = 0xDEADBEEF; |
363 | ib.length_dw = 4; | 363 | ib.length_dw = 4; |
364 | 364 | ||
@@ -374,7 +374,7 @@ int r600_dma_ib_test(struct radeon_device *rdev, struct radeon_ring *ring) | |||
374 | return r; | 374 | return r; |
375 | } | 375 | } |
376 | for (i = 0; i < rdev->usec_timeout; i++) { | 376 | for (i = 0; i < rdev->usec_timeout; i++) { |
377 | tmp = readl(ptr); | 377 | tmp = le32_to_cpu(rdev->wb.wb[index/4]); |
378 | if (tmp == 0xDEADBEEF) | 378 | if (tmp == 0xDEADBEEF) |
379 | break; | 379 | break; |
380 | DRM_UDELAY(1); | 380 | DRM_UDELAY(1); |
diff --git a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c index 6a03624fadaa..63ccb8fa799c 100644 --- a/drivers/gpu/drm/radeon/radeon_bios.c +++ b/drivers/gpu/drm/radeon/radeon_bios.c | |||
@@ -658,12 +658,10 @@ bool radeon_get_bios(struct radeon_device *rdev) | |||
658 | r = igp_read_bios_from_vram(rdev); | 658 | r = igp_read_bios_from_vram(rdev); |
659 | if (r == false) | 659 | if (r == false) |
660 | r = radeon_read_bios(rdev); | 660 | r = radeon_read_bios(rdev); |
661 | if (r == false) { | 661 | if (r == false) |
662 | r = radeon_read_disabled_bios(rdev); | 662 | r = radeon_read_disabled_bios(rdev); |
663 | } | 663 | if (r == false) |
664 | if (r == false) { | ||
665 | r = radeon_read_platform_bios(rdev); | 664 | r = radeon_read_platform_bios(rdev); |
666 | } | ||
667 | if (r == false || rdev->bios == NULL) { | 665 | if (r == false || rdev->bios == NULL) { |
668 | DRM_ERROR("Unable to locate a BIOS ROM\n"); | 666 | DRM_ERROR("Unable to locate a BIOS ROM\n"); |
669 | rdev->bios = NULL; | 667 | rdev->bios = NULL; |
diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c index 1c893447d7cd..a3e7aed7e680 100644 --- a/drivers/gpu/drm/radeon/radeon_cs.c +++ b/drivers/gpu/drm/radeon/radeon_cs.c | |||
@@ -450,7 +450,7 @@ static void radeon_cs_parser_fini(struct radeon_cs_parser *parser, int error, bo | |||
450 | kfree(parser->track); | 450 | kfree(parser->track); |
451 | kfree(parser->relocs); | 451 | kfree(parser->relocs); |
452 | kfree(parser->relocs_ptr); | 452 | kfree(parser->relocs_ptr); |
453 | kfree(parser->vm_bos); | 453 | drm_free_large(parser->vm_bos); |
454 | for (i = 0; i < parser->nchunks; i++) | 454 | for (i = 0; i < parser->nchunks; i++) |
455 | drm_free_large(parser->chunks[i].kdata); | 455 | drm_free_large(parser->chunks[i].kdata); |
456 | kfree(parser->chunks); | 456 | kfree(parser->chunks); |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index ea2676954dde..995a8b1770dd 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -952,6 +952,7 @@ int radeon_atombios_init(struct radeon_device *rdev) | |||
952 | } | 952 | } |
953 | 953 | ||
954 | mutex_init(&rdev->mode_info.atom_context->mutex); | 954 | mutex_init(&rdev->mode_info.atom_context->mutex); |
955 | mutex_init(&rdev->mode_info.atom_context->scratch_mutex); | ||
955 | radeon_atom_initialize_bios_scratch_regs(rdev->ddev); | 956 | radeon_atom_initialize_bios_scratch_regs(rdev->ddev); |
956 | atom_allocate_fb_scratch(rdev->mode_info.atom_context); | 957 | atom_allocate_fb_scratch(rdev->mode_info.atom_context); |
957 | return 0; | 958 | return 0; |
diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c index 3d17af34afa7..2456f69efd23 100644 --- a/drivers/gpu/drm/radeon/radeon_ring.c +++ b/drivers/gpu/drm/radeon/radeon_ring.c | |||
@@ -314,7 +314,7 @@ unsigned radeon_ring_backup(struct radeon_device *rdev, struct radeon_ring *ring | |||
314 | } | 314 | } |
315 | 315 | ||
316 | /* and then save the content of the ring */ | 316 | /* and then save the content of the ring */ |
317 | *data = kmalloc_array(size, sizeof(uint32_t), GFP_KERNEL); | 317 | *data = drm_malloc_ab(size, sizeof(uint32_t)); |
318 | if (!*data) { | 318 | if (!*data) { |
319 | mutex_unlock(&rdev->ring_lock); | 319 | mutex_unlock(&rdev->ring_lock); |
320 | return 0; | 320 | return 0; |
@@ -356,7 +356,7 @@ int radeon_ring_restore(struct radeon_device *rdev, struct radeon_ring *ring, | |||
356 | } | 356 | } |
357 | 357 | ||
358 | radeon_ring_unlock_commit(rdev, ring, false); | 358 | radeon_ring_unlock_commit(rdev, ring, false); |
359 | kfree(data); | 359 | drm_free_large(data); |
360 | return 0; | 360 | return 0; |
361 | } | 361 | } |
362 | 362 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_vm.c b/drivers/gpu/drm/radeon/radeon_vm.c index 4532cc76a0a6..dfde266529e2 100644 --- a/drivers/gpu/drm/radeon/radeon_vm.c +++ b/drivers/gpu/drm/radeon/radeon_vm.c | |||
@@ -132,8 +132,8 @@ struct radeon_cs_reloc *radeon_vm_get_bos(struct radeon_device *rdev, | |||
132 | struct radeon_cs_reloc *list; | 132 | struct radeon_cs_reloc *list; |
133 | unsigned i, idx; | 133 | unsigned i, idx; |
134 | 134 | ||
135 | list = kmalloc_array(vm->max_pde_used + 2, | 135 | list = drm_malloc_ab(vm->max_pde_used + 2, |
136 | sizeof(struct radeon_cs_reloc), GFP_KERNEL); | 136 | sizeof(struct radeon_cs_reloc)); |
137 | if (!list) | 137 | if (!list) |
138 | return NULL; | 138 | return NULL; |
139 | 139 | ||
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c index 5f6db4629aaa..9acb1c3c005b 100644 --- a/drivers/gpu/drm/radeon/rs600.c +++ b/drivers/gpu/drm/radeon/rs600.c | |||
@@ -879,6 +879,9 @@ void rs600_bandwidth_update(struct radeon_device *rdev) | |||
879 | u32 d1mode_priority_a_cnt, d2mode_priority_a_cnt; | 879 | u32 d1mode_priority_a_cnt, d2mode_priority_a_cnt; |
880 | /* FIXME: implement full support */ | 880 | /* FIXME: implement full support */ |
881 | 881 | ||
882 | if (!rdev->mode_info.mode_config_initialized) | ||
883 | return; | ||
884 | |||
882 | radeon_update_display_priority(rdev); | 885 | radeon_update_display_priority(rdev); |
883 | 886 | ||
884 | if (rdev->mode_info.crtcs[0]->base.enabled) | 887 | if (rdev->mode_info.crtcs[0]->base.enabled) |
diff --git a/drivers/gpu/drm/radeon/rs690.c b/drivers/gpu/drm/radeon/rs690.c index 3462b64369bf..0a2d36e81108 100644 --- a/drivers/gpu/drm/radeon/rs690.c +++ b/drivers/gpu/drm/radeon/rs690.c | |||
@@ -579,6 +579,9 @@ void rs690_bandwidth_update(struct radeon_device *rdev) | |||
579 | u32 d1mode_priority_a_cnt, d1mode_priority_b_cnt; | 579 | u32 d1mode_priority_a_cnt, d1mode_priority_b_cnt; |
580 | u32 d2mode_priority_a_cnt, d2mode_priority_b_cnt; | 580 | u32 d2mode_priority_a_cnt, d2mode_priority_b_cnt; |
581 | 581 | ||
582 | if (!rdev->mode_info.mode_config_initialized) | ||
583 | return; | ||
584 | |||
582 | radeon_update_display_priority(rdev); | 585 | radeon_update_display_priority(rdev); |
583 | 586 | ||
584 | if (rdev->mode_info.crtcs[0]->base.enabled) | 587 | if (rdev->mode_info.crtcs[0]->base.enabled) |
diff --git a/drivers/gpu/drm/radeon/rv515.c b/drivers/gpu/drm/radeon/rv515.c index 8a477bf1fdb3..c55d653aaf5f 100644 --- a/drivers/gpu/drm/radeon/rv515.c +++ b/drivers/gpu/drm/radeon/rv515.c | |||
@@ -1277,6 +1277,9 @@ void rv515_bandwidth_update(struct radeon_device *rdev) | |||
1277 | struct drm_display_mode *mode0 = NULL; | 1277 | struct drm_display_mode *mode0 = NULL; |
1278 | struct drm_display_mode *mode1 = NULL; | 1278 | struct drm_display_mode *mode1 = NULL; |
1279 | 1279 | ||
1280 | if (!rdev->mode_info.mode_config_initialized) | ||
1281 | return; | ||
1282 | |||
1280 | radeon_update_display_priority(rdev); | 1283 | radeon_update_display_priority(rdev); |
1281 | 1284 | ||
1282 | if (rdev->mode_info.crtcs[0]->base.enabled) | 1285 | if (rdev->mode_info.crtcs[0]->base.enabled) |
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index eeea5b6a1775..7d5083dc4acb 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c | |||
@@ -2384,6 +2384,9 @@ void dce6_bandwidth_update(struct radeon_device *rdev) | |||
2384 | u32 num_heads = 0, lb_size; | 2384 | u32 num_heads = 0, lb_size; |
2385 | int i; | 2385 | int i; |
2386 | 2386 | ||
2387 | if (!rdev->mode_info.mode_config_initialized) | ||
2388 | return; | ||
2389 | |||
2387 | radeon_update_display_priority(rdev); | 2390 | radeon_update_display_priority(rdev); |
2388 | 2391 | ||
2389 | for (i = 0; i < rdev->num_crtc; i++) { | 2392 | for (i = 0; i < rdev->num_crtc; i++) { |
diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c index a53c2e79d9cb..676e6c2ba90a 100644 --- a/drivers/gpu/drm/radeon/si_dpm.c +++ b/drivers/gpu/drm/radeon/si_dpm.c | |||
@@ -6256,7 +6256,7 @@ static void si_parse_pplib_clock_info(struct radeon_device *rdev, | |||
6256 | if ((rps->class2 & ATOM_PPLIB_CLASSIFICATION2_ULV) && | 6256 | if ((rps->class2 & ATOM_PPLIB_CLASSIFICATION2_ULV) && |
6257 | index == 0) { | 6257 | index == 0) { |
6258 | /* XXX disable for A0 tahiti */ | 6258 | /* XXX disable for A0 tahiti */ |
6259 | si_pi->ulv.supported = true; | 6259 | si_pi->ulv.supported = false; |
6260 | si_pi->ulv.pl = *pl; | 6260 | si_pi->ulv.pl = *pl; |
6261 | si_pi->ulv.one_pcie_lane_in_ulv = false; | 6261 | si_pi->ulv.one_pcie_lane_in_ulv = false; |
6262 | si_pi->ulv.volt_change_delay = SISLANDS_ULVVOLTAGECHANGEDELAY_DFLT; | 6262 | si_pi->ulv.volt_change_delay = SISLANDS_ULVVOLTAGECHANGEDELAY_DFLT; |
diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index 6553fd238685..054a79f143ae 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c | |||
@@ -736,7 +736,6 @@ static const struct drm_crtc_funcs tegra_crtc_funcs = { | |||
736 | 736 | ||
737 | static void tegra_crtc_disable(struct drm_crtc *crtc) | 737 | static void tegra_crtc_disable(struct drm_crtc *crtc) |
738 | { | 738 | { |
739 | struct tegra_dc *dc = to_tegra_dc(crtc); | ||
740 | struct drm_device *drm = crtc->dev; | 739 | struct drm_device *drm = crtc->dev; |
741 | struct drm_plane *plane; | 740 | struct drm_plane *plane; |
742 | 741 | ||
@@ -752,7 +751,7 @@ static void tegra_crtc_disable(struct drm_crtc *crtc) | |||
752 | } | 751 | } |
753 | } | 752 | } |
754 | 753 | ||
755 | drm_vblank_off(drm, dc->pipe); | 754 | drm_crtc_vblank_off(crtc); |
756 | } | 755 | } |
757 | 756 | ||
758 | static bool tegra_crtc_mode_fixup(struct drm_crtc *crtc, | 757 | static bool tegra_crtc_mode_fixup(struct drm_crtc *crtc, |
@@ -841,8 +840,6 @@ static int tegra_crtc_mode_set(struct drm_crtc *crtc, | |||
841 | u32 value; | 840 | u32 value; |
842 | int err; | 841 | int err; |
843 | 842 | ||
844 | drm_vblank_pre_modeset(crtc->dev, dc->pipe); | ||
845 | |||
846 | err = tegra_crtc_setup_clk(crtc, mode); | 843 | err = tegra_crtc_setup_clk(crtc, mode); |
847 | if (err) { | 844 | if (err) { |
848 | dev_err(dc->dev, "failed to setup clock for CRTC: %d\n", err); | 845 | dev_err(dc->dev, "failed to setup clock for CRTC: %d\n", err); |
@@ -896,6 +893,8 @@ static void tegra_crtc_prepare(struct drm_crtc *crtc) | |||
896 | unsigned int syncpt; | 893 | unsigned int syncpt; |
897 | unsigned long value; | 894 | unsigned long value; |
898 | 895 | ||
896 | drm_crtc_vblank_off(crtc); | ||
897 | |||
899 | /* hardware initialization */ | 898 | /* hardware initialization */ |
900 | reset_control_deassert(dc->rst); | 899 | reset_control_deassert(dc->rst); |
901 | usleep_range(10000, 20000); | 900 | usleep_range(10000, 20000); |
@@ -943,7 +942,7 @@ static void tegra_crtc_commit(struct drm_crtc *crtc) | |||
943 | value = GENERAL_ACT_REQ | WIN_A_ACT_REQ; | 942 | value = GENERAL_ACT_REQ | WIN_A_ACT_REQ; |
944 | tegra_dc_writel(dc, value, DC_CMD_STATE_CONTROL); | 943 | tegra_dc_writel(dc, value, DC_CMD_STATE_CONTROL); |
945 | 944 | ||
946 | drm_vblank_post_modeset(crtc->dev, dc->pipe); | 945 | drm_crtc_vblank_on(crtc); |
947 | } | 946 | } |
948 | 947 | ||
949 | static void tegra_crtc_load_lut(struct drm_crtc *crtc) | 948 | static void tegra_crtc_load_lut(struct drm_crtc *crtc) |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c b/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c index bfeb4b1f2acf..21e9b7f8dad0 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf_res.c | |||
@@ -246,7 +246,8 @@ int vmw_cmdbuf_res_remove(struct vmw_cmdbuf_res_manager *man, | |||
246 | struct drm_hash_item *hash; | 246 | struct drm_hash_item *hash; |
247 | int ret; | 247 | int ret; |
248 | 248 | ||
249 | ret = drm_ht_find_item(&man->resources, user_key, &hash); | 249 | ret = drm_ht_find_item(&man->resources, user_key | (res_type << 24), |
250 | &hash); | ||
250 | if (likely(ret != 0)) | 251 | if (likely(ret != 0)) |
251 | return -EINVAL; | 252 | return -EINVAL; |
252 | 253 | ||
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c index 7197af157313..25f3c250fd98 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | |||
@@ -688,7 +688,11 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) | |||
688 | goto out_err0; | 688 | goto out_err0; |
689 | } | 689 | } |
690 | 690 | ||
691 | if (unlikely(dev_priv->prim_bb_mem < dev_priv->vram_size)) | 691 | /* |
692 | * Limit back buffer size to VRAM size. Remove this once | ||
693 | * screen targets are implemented. | ||
694 | */ | ||
695 | if (dev_priv->prim_bb_mem > dev_priv->vram_size) | ||
692 | dev_priv->prim_bb_mem = dev_priv->vram_size; | 696 | dev_priv->prim_bb_mem = dev_priv->vram_size; |
693 | 697 | ||
694 | mutex_unlock(&dev_priv->hw_mutex); | 698 | mutex_unlock(&dev_priv->hw_mutex); |
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c index d2bc2b03d4c6..941a7bc0b791 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | |||
@@ -187,7 +187,7 @@ int vmw_du_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv, | |||
187 | * can do this since the caller in the drm core doesn't check anything | 187 | * can do this since the caller in the drm core doesn't check anything |
188 | * which is protected by any looks. | 188 | * which is protected by any looks. |
189 | */ | 189 | */ |
190 | drm_modeset_unlock(&crtc->mutex); | 190 | drm_modeset_unlock_crtc(crtc); |
191 | drm_modeset_lock_all(dev_priv->dev); | 191 | drm_modeset_lock_all(dev_priv->dev); |
192 | 192 | ||
193 | /* A lot of the code assumes this */ | 193 | /* A lot of the code assumes this */ |
@@ -252,7 +252,7 @@ int vmw_du_crtc_cursor_set(struct drm_crtc *crtc, struct drm_file *file_priv, | |||
252 | ret = 0; | 252 | ret = 0; |
253 | out: | 253 | out: |
254 | drm_modeset_unlock_all(dev_priv->dev); | 254 | drm_modeset_unlock_all(dev_priv->dev); |
255 | drm_modeset_lock(&crtc->mutex, NULL); | 255 | drm_modeset_lock_crtc(crtc); |
256 | 256 | ||
257 | return ret; | 257 | return ret; |
258 | } | 258 | } |
@@ -273,7 +273,7 @@ int vmw_du_crtc_cursor_move(struct drm_crtc *crtc, int x, int y) | |||
273 | * can do this since the caller in the drm core doesn't check anything | 273 | * can do this since the caller in the drm core doesn't check anything |
274 | * which is protected by any looks. | 274 | * which is protected by any looks. |
275 | */ | 275 | */ |
276 | drm_modeset_unlock(&crtc->mutex); | 276 | drm_modeset_unlock_crtc(crtc); |
277 | drm_modeset_lock_all(dev_priv->dev); | 277 | drm_modeset_lock_all(dev_priv->dev); |
278 | 278 | ||
279 | vmw_cursor_update_position(dev_priv, shown, | 279 | vmw_cursor_update_position(dev_priv, shown, |
@@ -281,7 +281,7 @@ int vmw_du_crtc_cursor_move(struct drm_crtc *crtc, int x, int y) | |||
281 | du->cursor_y + du->hotspot_y); | 281 | du->cursor_y + du->hotspot_y); |
282 | 282 | ||
283 | drm_modeset_unlock_all(dev_priv->dev); | 283 | drm_modeset_unlock_all(dev_priv->dev); |
284 | drm_modeset_lock(&crtc->mutex, NULL); | 284 | drm_modeset_lock_crtc(crtc); |
285 | 285 | ||
286 | return 0; | 286 | return 0; |
287 | } | 287 | } |
@@ -1950,6 +1950,14 @@ int vmw_du_connector_fill_modes(struct drm_connector *connector, | |||
1950 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) | 1950 | DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) |
1951 | }; | 1951 | }; |
1952 | int i; | 1952 | int i; |
1953 | u32 assumed_bpp = 2; | ||
1954 | |||
1955 | /* | ||
1956 | * If using screen objects, then assume 32-bpp because that's what the | ||
1957 | * SVGA device is assuming | ||
1958 | */ | ||
1959 | if (dev_priv->sou_priv) | ||
1960 | assumed_bpp = 4; | ||
1953 | 1961 | ||
1954 | /* Add preferred mode */ | 1962 | /* Add preferred mode */ |
1955 | { | 1963 | { |
@@ -1960,8 +1968,9 @@ int vmw_du_connector_fill_modes(struct drm_connector *connector, | |||
1960 | mode->vdisplay = du->pref_height; | 1968 | mode->vdisplay = du->pref_height; |
1961 | vmw_guess_mode_timing(mode); | 1969 | vmw_guess_mode_timing(mode); |
1962 | 1970 | ||
1963 | if (vmw_kms_validate_mode_vram(dev_priv, mode->hdisplay * 2, | 1971 | if (vmw_kms_validate_mode_vram(dev_priv, |
1964 | mode->vdisplay)) { | 1972 | mode->hdisplay * assumed_bpp, |
1973 | mode->vdisplay)) { | ||
1965 | drm_mode_probed_add(connector, mode); | 1974 | drm_mode_probed_add(connector, mode); |
1966 | } else { | 1975 | } else { |
1967 | drm_mode_destroy(dev, mode); | 1976 | drm_mode_destroy(dev, mode); |
@@ -1983,7 +1992,8 @@ int vmw_du_connector_fill_modes(struct drm_connector *connector, | |||
1983 | bmode->vdisplay > max_height) | 1992 | bmode->vdisplay > max_height) |
1984 | continue; | 1993 | continue; |
1985 | 1994 | ||
1986 | if (!vmw_kms_validate_mode_vram(dev_priv, bmode->hdisplay * 2, | 1995 | if (!vmw_kms_validate_mode_vram(dev_priv, |
1996 | bmode->hdisplay * assumed_bpp, | ||
1987 | bmode->vdisplay)) | 1997 | bmode->vdisplay)) |
1988 | continue; | 1998 | continue; |
1989 | 1999 | ||
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 73bd9e2e42bc..3402033fa52a 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -1659,6 +1659,7 @@ void hid_disconnect(struct hid_device *hdev) | |||
1659 | hdev->hiddev_disconnect(hdev); | 1659 | hdev->hiddev_disconnect(hdev); |
1660 | if (hdev->claimed & HID_CLAIMED_HIDRAW) | 1660 | if (hdev->claimed & HID_CLAIMED_HIDRAW) |
1661 | hidraw_disconnect(hdev); | 1661 | hidraw_disconnect(hdev); |
1662 | hdev->claimed = 0; | ||
1662 | } | 1663 | } |
1663 | EXPORT_SYMBOL_GPL(hid_disconnect); | 1664 | EXPORT_SYMBOL_GPL(hid_disconnect); |
1664 | 1665 | ||
diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c index 84c3cb15ccdd..8bf61d295ffd 100644 --- a/drivers/hid/hid-debug.c +++ b/drivers/hid/hid-debug.c | |||
@@ -946,6 +946,12 @@ static const char *keys[KEY_MAX + 1] = { | |||
946 | [KEY_BRIGHTNESS_MIN] = "BrightnessMin", | 946 | [KEY_BRIGHTNESS_MIN] = "BrightnessMin", |
947 | [KEY_BRIGHTNESS_MAX] = "BrightnessMax", | 947 | [KEY_BRIGHTNESS_MAX] = "BrightnessMax", |
948 | [KEY_BRIGHTNESS_AUTO] = "BrightnessAuto", | 948 | [KEY_BRIGHTNESS_AUTO] = "BrightnessAuto", |
949 | [KEY_KBDINPUTASSIST_PREV] = "KbdInputAssistPrev", | ||
950 | [KEY_KBDINPUTASSIST_NEXT] = "KbdInputAssistNext", | ||
951 | [KEY_KBDINPUTASSIST_PREVGROUP] = "KbdInputAssistPrevGroup", | ||
952 | [KEY_KBDINPUTASSIST_NEXTGROUP] = "KbdInputAssistNextGroup", | ||
953 | [KEY_KBDINPUTASSIST_ACCEPT] = "KbdInputAssistAccept", | ||
954 | [KEY_KBDINPUTASSIST_CANCEL] = "KbdInputAssistCancel", | ||
949 | }; | 955 | }; |
950 | 956 | ||
951 | static const char *relatives[REL_MAX + 1] = { | 957 | static const char *relatives[REL_MAX + 1] = { |
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index cd9c9e96cf0e..7c863738e419 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
@@ -298,6 +298,9 @@ | |||
298 | 298 | ||
299 | #define USB_VENDOR_ID_ELAN 0x04f3 | 299 | #define USB_VENDOR_ID_ELAN 0x04f3 |
300 | #define USB_DEVICE_ID_ELAN_TOUCHSCREEN 0x0089 | 300 | #define USB_DEVICE_ID_ELAN_TOUCHSCREEN 0x0089 |
301 | #define USB_DEVICE_ID_ELAN_TOUCHSCREEN_009B 0x009b | ||
302 | #define USB_DEVICE_ID_ELAN_TOUCHSCREEN_0103 0x0103 | ||
303 | #define USB_DEVICE_ID_ELAN_TOUCHSCREEN_016F 0x016f | ||
301 | 304 | ||
302 | #define USB_VENDOR_ID_ELECOM 0x056e | 305 | #define USB_VENDOR_ID_ELECOM 0x056e |
303 | #define USB_DEVICE_ID_ELECOM_BM084 0x0061 | 306 | #define USB_DEVICE_ID_ELECOM_BM084 0x0061 |
diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index 2df7fddbd119..725f22ca47fc 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c | |||
@@ -695,7 +695,10 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel | |||
695 | break; | 695 | break; |
696 | 696 | ||
697 | case 0x5b: /* TransducerSerialNumber */ | 697 | case 0x5b: /* TransducerSerialNumber */ |
698 | set_bit(MSC_SERIAL, input->mscbit); | 698 | usage->type = EV_MSC; |
699 | usage->code = MSC_SERIAL; | ||
700 | bit = input->mscbit; | ||
701 | max = MSC_MAX; | ||
699 | break; | 702 | break; |
700 | 703 | ||
701 | default: goto unknown; | 704 | default: goto unknown; |
@@ -862,6 +865,13 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel | |||
862 | case 0x28b: map_key_clear(KEY_FORWARDMAIL); break; | 865 | case 0x28b: map_key_clear(KEY_FORWARDMAIL); break; |
863 | case 0x28c: map_key_clear(KEY_SEND); break; | 866 | case 0x28c: map_key_clear(KEY_SEND); break; |
864 | 867 | ||
868 | case 0x2c7: map_key_clear(KEY_KBDINPUTASSIST_PREV); break; | ||
869 | case 0x2c8: map_key_clear(KEY_KBDINPUTASSIST_NEXT); break; | ||
870 | case 0x2c9: map_key_clear(KEY_KBDINPUTASSIST_PREVGROUP); break; | ||
871 | case 0x2ca: map_key_clear(KEY_KBDINPUTASSIST_NEXTGROUP); break; | ||
872 | case 0x2cb: map_key_clear(KEY_KBDINPUTASSIST_ACCEPT); break; | ||
873 | case 0x2cc: map_key_clear(KEY_KBDINPUTASSIST_CANCEL); break; | ||
874 | |||
865 | default: goto ignore; | 875 | default: goto ignore; |
866 | } | 876 | } |
867 | break; | 877 | break; |
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index f3cb5b0a4345..552671ee7c5d 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c | |||
@@ -71,6 +71,9 @@ static const struct hid_blacklist { | |||
71 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_AXIS_295, HID_QUIRK_NOGET }, | 71 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_AXIS_295, HID_QUIRK_NOGET }, |
72 | { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET }, | 72 | { USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET }, |
73 | { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN, HID_QUIRK_ALWAYS_POLL }, | 73 | { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN, HID_QUIRK_ALWAYS_POLL }, |
74 | { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_009B, HID_QUIRK_ALWAYS_POLL }, | ||
75 | { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_0103, HID_QUIRK_ALWAYS_POLL }, | ||
76 | { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_016F, HID_QUIRK_ALWAYS_POLL }, | ||
74 | { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET }, | 77 | { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET }, |
75 | { USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS }, | 78 | { USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS }, |
76 | { USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET }, | 79 | { USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET }, |
diff --git a/drivers/hwmon/fam15h_power.c b/drivers/hwmon/fam15h_power.c index fcdbde4ec692..3057dfc7e3bc 100644 --- a/drivers/hwmon/fam15h_power.c +++ b/drivers/hwmon/fam15h_power.c | |||
@@ -234,7 +234,7 @@ static const struct pci_device_id fam15h_power_id_table[] = { | |||
234 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) }, | 234 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) }, |
235 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_M30H_NB_F4) }, | 235 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_M30H_NB_F4) }, |
236 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_16H_NB_F4) }, | 236 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_16H_NB_F4) }, |
237 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_16H_M30H_NB_F3) }, | 237 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_16H_M30H_NB_F4) }, |
238 | {} | 238 | {} |
239 | }; | 239 | }; |
240 | MODULE_DEVICE_TABLE(pci, fam15h_power_id_table); | 240 | MODULE_DEVICE_TABLE(pci, fam15h_power_id_table); |
diff --git a/drivers/hwmon/ibmpowernv.c b/drivers/hwmon/ibmpowernv.c index d2bf2c97ae70..6a30eeea94be 100644 --- a/drivers/hwmon/ibmpowernv.c +++ b/drivers/hwmon/ibmpowernv.c | |||
@@ -181,7 +181,7 @@ static int __init populate_attr_groups(struct platform_device *pdev) | |||
181 | 181 | ||
182 | opal = of_find_node_by_path("/ibm,opal/sensors"); | 182 | opal = of_find_node_by_path("/ibm,opal/sensors"); |
183 | if (!opal) { | 183 | if (!opal) { |
184 | dev_err(&pdev->dev, "Opal node 'sensors' not found\n"); | 184 | dev_dbg(&pdev->dev, "Opal node 'sensors' not found\n"); |
185 | return -ENODEV; | 185 | return -ENODEV; |
186 | } | 186 | } |
187 | 187 | ||
@@ -335,7 +335,9 @@ static int __init ibmpowernv_init(void) | |||
335 | 335 | ||
336 | err = platform_driver_probe(&ibmpowernv_driver, ibmpowernv_probe); | 336 | err = platform_driver_probe(&ibmpowernv_driver, ibmpowernv_probe); |
337 | if (err) { | 337 | if (err) { |
338 | pr_err("Platfrom driver probe failed\n"); | 338 | if (err != -ENODEV) |
339 | pr_err("Platform driver probe failed (%d)\n", err); | ||
340 | |||
339 | goto exit_device_del; | 341 | goto exit_device_del; |
340 | } | 342 | } |
341 | 343 | ||
diff --git a/drivers/hwmon/pwm-fan.c b/drivers/hwmon/pwm-fan.c index 823c877a1ec0..1991d9032c38 100644 --- a/drivers/hwmon/pwm-fan.c +++ b/drivers/hwmon/pwm-fan.c | |||
@@ -161,10 +161,17 @@ static int pwm_fan_suspend(struct device *dev) | |||
161 | static int pwm_fan_resume(struct device *dev) | 161 | static int pwm_fan_resume(struct device *dev) |
162 | { | 162 | { |
163 | struct pwm_fan_ctx *ctx = dev_get_drvdata(dev); | 163 | struct pwm_fan_ctx *ctx = dev_get_drvdata(dev); |
164 | unsigned long duty; | ||
165 | int ret; | ||
164 | 166 | ||
165 | if (ctx->pwm_value) | 167 | if (ctx->pwm_value == 0) |
166 | return pwm_enable(ctx->pwm); | 168 | return 0; |
167 | return 0; | 169 | |
170 | duty = DIV_ROUND_UP(ctx->pwm_value * (ctx->pwm->period - 1), MAX_PWM); | ||
171 | ret = pwm_config(ctx->pwm, duty, ctx->pwm->period); | ||
172 | if (ret) | ||
173 | return ret; | ||
174 | return pwm_enable(ctx->pwm); | ||
168 | } | 175 | } |
169 | #endif | 176 | #endif |
170 | 177 | ||
diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c index 65ef9664d5da..899bede81b31 100644 --- a/drivers/i2c/algos/i2c-algo-bit.c +++ b/drivers/i2c/algos/i2c-algo-bit.c | |||
@@ -12,11 +12,6 @@ | |||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program; if not, write to the Free Software | ||
18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||
19 | MA 02110-1301 USA. | ||
20 | * ------------------------------------------------------------------------- */ | 15 | * ------------------------------------------------------------------------- */ |
21 | 16 | ||
22 | /* With some changes from Frodo Looijaard <frodol@dds.nl>, Kyösti Mälkki | 17 | /* With some changes from Frodo Looijaard <frodol@dds.nl>, Kyösti Mälkki |
diff --git a/drivers/i2c/algos/i2c-algo-pca.c b/drivers/i2c/algos/i2c-algo-pca.c index 8b10f88b13d9..580dbf05c148 100644 --- a/drivers/i2c/algos/i2c-algo-pca.c +++ b/drivers/i2c/algos/i2c-algo-pca.c | |||
@@ -12,11 +12,6 @@ | |||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | * GNU General Public License for more details. | 14 | * GNU General Public License for more details. |
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||
19 | * MA 02110-1301 USA. | ||
20 | */ | 15 | */ |
21 | 16 | ||
22 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
diff --git a/drivers/i2c/algos/i2c-algo-pcf.c b/drivers/i2c/algos/i2c-algo-pcf.c index 34370090b753..270d84bfc2c6 100644 --- a/drivers/i2c/algos/i2c-algo-pcf.c +++ b/drivers/i2c/algos/i2c-algo-pcf.c | |||
@@ -14,11 +14,6 @@ | |||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * GNU General Public License for more details. | 15 | * GNU General Public License for more details. |
16 | * | 16 | * |
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||
20 | * MA 02110-1301 USA. | ||
21 | * | ||
22 | * With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and | 17 | * With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and |
23 | * Frodo Looijaard <frodol@dds.nl>, and also from Martin Bailey | 18 | * Frodo Looijaard <frodol@dds.nl>, and also from Martin Bailey |
24 | * <mbailey@littlefeet-inc.com> | 19 | * <mbailey@littlefeet-inc.com> |
diff --git a/drivers/i2c/algos/i2c-algo-pcf.h b/drivers/i2c/algos/i2c-algo-pcf.h index 1ec703ee788d..262ee801975b 100644 --- a/drivers/i2c/algos/i2c-algo-pcf.h +++ b/drivers/i2c/algos/i2c-algo-pcf.h | |||
@@ -12,12 +12,7 @@ | |||
12 | This program is distributed in the hope that it will be useful, | 12 | This program is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. */ |
16 | |||
17 | You should have received a copy of the GNU General Public License | ||
18 | along with this program; if not, write to the Free Software | ||
19 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||
20 | MA 02110-1301 USA. */ | ||
21 | /* -------------------------------------------------------------------- */ | 16 | /* -------------------------------------------------------------------- */ |
22 | 17 | ||
23 | /* With some changes from Frodo Looijaard <frodol@dds.nl> */ | 18 | /* With some changes from Frodo Looijaard <frodol@dds.nl> */ |
diff --git a/drivers/i2c/busses/i2c-ali1535.c b/drivers/i2c/busses/i2c-ali1535.c index 451e305f7971..4f2d78868281 100644 --- a/drivers/i2c/busses/i2c-ali1535.c +++ b/drivers/i2c/busses/i2c-ali1535.c | |||
@@ -14,10 +14,6 @@ | |||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | * GNU General Public License for more details. | 16 | * GNU General Public License for more details. |
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
21 | */ | 17 | */ |
22 | 18 | ||
23 | /* | 19 | /* |
diff --git a/drivers/i2c/busses/i2c-ali15x3.c b/drivers/i2c/busses/i2c-ali15x3.c index 2fa21ce9682b..45c5c4883022 100644 --- a/drivers/i2c/busses/i2c-ali15x3.c +++ b/drivers/i2c/busses/i2c-ali15x3.c | |||
@@ -12,10 +12,6 @@ | |||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program; if not, write to the Free Software | ||
18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
19 | */ | 15 | */ |
20 | 16 | ||
21 | /* | 17 | /* |
diff --git a/drivers/i2c/busses/i2c-amd756-s4882.c b/drivers/i2c/busses/i2c-amd756-s4882.c index 41fc6837fb8b..65e324054970 100644 --- a/drivers/i2c/busses/i2c-amd756-s4882.c +++ b/drivers/i2c/busses/i2c-amd756-s4882.c | |||
@@ -12,10 +12,6 @@ | |||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | * GNU General Public License for more details. | 14 | * GNU General Public License for more details. |
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
19 | */ | 15 | */ |
20 | 16 | ||
21 | /* | 17 | /* |
diff --git a/drivers/i2c/busses/i2c-amd756.c b/drivers/i2c/busses/i2c-amd756.c index a16f72891358..6c7113d990f8 100644 --- a/drivers/i2c/busses/i2c-amd756.c +++ b/drivers/i2c/busses/i2c-amd756.c | |||
@@ -15,10 +15,6 @@ | |||
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17 | GNU General Public License for more details. | 17 | GNU General Public License for more details. |
18 | |||
19 | You should have received a copy of the GNU General Public License | ||
20 | along with this program; if not, write to the Free Software | ||
21 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
22 | */ | 18 | */ |
23 | 19 | ||
24 | /* | 20 | /* |
diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c index 917d54588d95..e05a672db3e5 100644 --- a/drivers/i2c/busses/i2c-at91.c +++ b/drivers/i2c/busses/i2c-at91.c | |||
@@ -434,7 +434,7 @@ static int at91_do_twi_transfer(struct at91_twi_dev *dev) | |||
434 | } | 434 | } |
435 | } | 435 | } |
436 | 436 | ||
437 | ret = wait_for_completion_io_timeout(&dev->cmd_complete, | 437 | ret = wait_for_completion_timeout(&dev->cmd_complete, |
438 | dev->adapter.timeout); | 438 | dev->adapter.timeout); |
439 | if (ret == 0) { | 439 | if (ret == 0) { |
440 | dev_err(dev->dev, "controller timed out\n"); | 440 | dev_err(dev->dev, "controller timed out\n"); |
diff --git a/drivers/i2c/busses/i2c-au1550.c b/drivers/i2c/busses/i2c-au1550.c index 8762458ca7da..6f8c0756e350 100644 --- a/drivers/i2c/busses/i2c-au1550.c +++ b/drivers/i2c/busses/i2c-au1550.c | |||
@@ -21,10 +21,6 @@ | |||
21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
23 | * GNU General Public License for more details. | 23 | * GNU General Public License for more details. |
24 | * | ||
25 | * You should have received a copy of the GNU General Public License | ||
26 | * along with this program; if not, write to the Free Software | ||
27 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
28 | */ | 24 | */ |
29 | 25 | ||
30 | #include <linux/delay.h> | 26 | #include <linux/delay.h> |
diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c index f3b89a4698b6..5bdbc71698d0 100644 --- a/drivers/i2c/busses/i2c-cpm.c +++ b/drivers/i2c/busses/i2c-cpm.c | |||
@@ -23,10 +23,6 @@ | |||
23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
25 | * GNU General Public License for more details. | 25 | * GNU General Public License for more details. |
26 | * | ||
27 | * You should have received a copy of the GNU General Public License | ||
28 | * along with this program; if not, write to the Free Software | ||
29 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
30 | */ | 26 | */ |
31 | 27 | ||
32 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c index 4d9614719128..d15b7c9b9219 100644 --- a/drivers/i2c/busses/i2c-davinci.c +++ b/drivers/i2c/busses/i2c-davinci.c | |||
@@ -17,10 +17,6 @@ | |||
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
19 | * GNU General Public License for more details. | 19 | * GNU General Public License for more details. |
20 | * | ||
21 | * You should have received a copy of the GNU General Public License | ||
22 | * along with this program; if not, write to the Free Software | ||
23 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
24 | * ---------------------------------------------------------------------------- | 20 | * ---------------------------------------------------------------------------- |
25 | * | 21 | * |
26 | */ | 22 | */ |
diff --git a/drivers/i2c/busses/i2c-designware-core.c b/drivers/i2c/busses/i2c-designware-core.c index 3c20e4bd6dd1..edca99dbba23 100644 --- a/drivers/i2c/busses/i2c-designware-core.c +++ b/drivers/i2c/busses/i2c-designware-core.c | |||
@@ -18,10 +18,6 @@ | |||
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
20 | * GNU General Public License for more details. | 20 | * GNU General Public License for more details. |
21 | * | ||
22 | * You should have received a copy of the GNU General Public License | ||
23 | * along with this program; if not, write to the Free Software | ||
24 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
25 | * ---------------------------------------------------------------------------- | 21 | * ---------------------------------------------------------------------------- |
26 | * | 22 | * |
27 | */ | 23 | */ |
diff --git a/drivers/i2c/busses/i2c-designware-core.h b/drivers/i2c/busses/i2c-designware-core.h index d66b6cbc9edc..5a410ef17abd 100644 --- a/drivers/i2c/busses/i2c-designware-core.h +++ b/drivers/i2c/busses/i2c-designware-core.h | |||
@@ -18,10 +18,6 @@ | |||
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
20 | * GNU General Public License for more details. | 20 | * GNU General Public License for more details. |
21 | * | ||
22 | * You should have received a copy of the GNU General Public License | ||
23 | * along with this program; if not, write to the Free Software | ||
24 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
25 | * ---------------------------------------------------------------------------- | 21 | * ---------------------------------------------------------------------------- |
26 | * | 22 | * |
27 | */ | 23 | */ |
diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c index d31d313ab4f7..acb40f95db78 100644 --- a/drivers/i2c/busses/i2c-designware-pcidrv.c +++ b/drivers/i2c/busses/i2c-designware-pcidrv.c | |||
@@ -19,10 +19,6 @@ | |||
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
21 | * GNU General Public License for more details. | 21 | * GNU General Public License for more details. |
22 | * | ||
23 | * You should have received a copy of the GNU General Public License | ||
24 | * along with this program; if not, write to the Free Software | ||
25 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
26 | * ---------------------------------------------------------------------------- | 22 | * ---------------------------------------------------------------------------- |
27 | * | 23 | * |
28 | */ | 24 | */ |
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c index a7431150acf7..373dd4d47765 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c | |||
@@ -18,10 +18,6 @@ | |||
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
20 | * GNU General Public License for more details. | 20 | * GNU General Public License for more details. |
21 | * | ||
22 | * You should have received a copy of the GNU General Public License | ||
23 | * along with this program; if not, write to the Free Software | ||
24 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
25 | * ---------------------------------------------------------------------------- | 21 | * ---------------------------------------------------------------------------- |
26 | * | 22 | * |
27 | */ | 23 | */ |
diff --git a/drivers/i2c/busses/i2c-eg20t.c b/drivers/i2c/busses/i2c-eg20t.c index a44ea13d1434..76e699f9ed97 100644 --- a/drivers/i2c/busses/i2c-eg20t.c +++ b/drivers/i2c/busses/i2c-eg20t.c | |||
@@ -9,10 +9,6 @@ | |||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 | * GNU General Public License for more details. | 11 | * GNU General Public License for more details. |
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program; if not, write to the Free Software | ||
15 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. | ||
16 | */ | 12 | */ |
17 | 13 | ||
18 | #include <linux/module.h> | 14 | #include <linux/module.h> |
diff --git a/drivers/i2c/busses/i2c-elektor.c b/drivers/i2c/busses/i2c-elektor.c index 485497066ed7..92e8c0ce1625 100644 --- a/drivers/i2c/busses/i2c-elektor.c +++ b/drivers/i2c/busses/i2c-elektor.c | |||
@@ -12,11 +12,7 @@ | |||
12 | This program is distributed in the hope that it will be useful, | 12 | This program is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. */ |
16 | |||
17 | You should have received a copy of the GNU General Public License | ||
18 | along with this program; if not, write to the Free Software | ||
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | ||
20 | /* ------------------------------------------------------------------------- */ | 16 | /* ------------------------------------------------------------------------- */ |
21 | 17 | ||
22 | /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even | 18 | /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi> and even |
diff --git a/drivers/i2c/busses/i2c-hydra.c b/drivers/i2c/busses/i2c-hydra.c index 14d2b76de25f..b7864cf42a72 100644 --- a/drivers/i2c/busses/i2c-hydra.c +++ b/drivers/i2c/busses/i2c-hydra.c | |||
@@ -15,10 +15,6 @@ | |||
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17 | GNU General Public License for more details. | 17 | GNU General Public License for more details. |
18 | |||
19 | You should have received a copy of the GNU General Public License | ||
20 | along with this program; if not, write to the Free Software | ||
21 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
22 | */ | 18 | */ |
23 | 19 | ||
24 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 7cfc183b3d63..6ab4f1cb21f3 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c | |||
@@ -15,10 +15,6 @@ | |||
15 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17 | GNU General Public License for more details. | 17 | GNU General Public License for more details. |
18 | |||
19 | You should have received a copy of the GNU General Public License | ||
20 | along with this program; if not, write to the Free Software | ||
21 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
22 | */ | 18 | */ |
23 | 19 | ||
24 | /* | 20 | /* |
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c index c48e46af670a..e9fb7cf78612 100644 --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c | |||
@@ -11,11 +11,6 @@ | |||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | * GNU General Public License for more details. | 12 | * GNU General Public License for more details. |
13 | * | 13 | * |
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | ||
17 | * USA. | ||
18 | * | ||
19 | * Author: | 14 | * Author: |
20 | * Darius Augulis, Teltonika Inc. | 15 | * Darius Augulis, Teltonika Inc. |
21 | * | 16 | * |
diff --git a/drivers/i2c/busses/i2c-iop3xx.h b/drivers/i2c/busses/i2c-iop3xx.h index 097e270955d0..2d6929c2bd92 100644 --- a/drivers/i2c/busses/i2c-iop3xx.h +++ b/drivers/i2c/busses/i2c-iop3xx.h | |||
@@ -11,11 +11,7 @@ | |||
11 | This program is distributed in the hope that it will be useful, | 11 | This program is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. */ |
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program; if not, write to the Free Software | ||
18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ | ||
19 | /* ------------------------------------------------------------------------- */ | 15 | /* ------------------------------------------------------------------------- */ |
20 | 16 | ||
21 | 17 | ||
diff --git a/drivers/i2c/busses/i2c-isch.c b/drivers/i2c/busses/i2c-isch.c index cf99dbf21fd1..113293d275f6 100644 --- a/drivers/i2c/busses/i2c-isch.c +++ b/drivers/i2c/busses/i2c-isch.c | |||
@@ -14,10 +14,6 @@ | |||
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. | 16 | GNU General Public License for more details. |
17 | |||
18 | You should have received a copy of the GNU General Public License | ||
19 | along with this program; if not, write to the Free Software | ||
20 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
21 | */ | 17 | */ |
22 | 18 | ||
23 | /* | 19 | /* |
diff --git a/drivers/i2c/busses/i2c-ismt.c b/drivers/i2c/busses/i2c-ismt.c index 3f6ecbfb9a56..f2b0ff011631 100644 --- a/drivers/i2c/busses/i2c-ismt.c +++ b/drivers/i2c/busses/i2c-ismt.c | |||
@@ -14,10 +14,6 @@ | |||
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 | * General Public License for more details. | 16 | * General Public License for more details. |
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
21 | * The full GNU General Public License is included in this distribution | 17 | * The full GNU General Public License is included in this distribution |
22 | * in the file called LICENSE.GPL. | 18 | * in the file called LICENSE.GPL. |
23 | * | 19 | * |
diff --git a/drivers/i2c/busses/i2c-nforce2-s4985.c b/drivers/i2c/busses/i2c-nforce2-s4985.c index b170bdffb5de..88eda09e73c0 100644 --- a/drivers/i2c/busses/i2c-nforce2-s4985.c +++ b/drivers/i2c/busses/i2c-nforce2-s4985.c | |||
@@ -12,10 +12,6 @@ | |||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | * GNU General Public License for more details. | 14 | * GNU General Public License for more details. |
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
19 | */ | 15 | */ |
20 | 16 | ||
21 | /* | 17 | /* |
diff --git a/drivers/i2c/busses/i2c-nforce2.c b/drivers/i2c/busses/i2c-nforce2.c index ee3a76c7ae97..70b3c9158509 100644 --- a/drivers/i2c/busses/i2c-nforce2.c +++ b/drivers/i2c/busses/i2c-nforce2.c | |||
@@ -17,10 +17,6 @@ | |||
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
19 | GNU General Public License for more details. | 19 | GNU General Public License for more details. |
20 | |||
21 | You should have received a copy of the GNU General Public License | ||
22 | along with this program; if not, write to the Free Software | ||
23 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
24 | */ | 20 | */ |
25 | 21 | ||
26 | /* | 22 | /* |
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index 0dffb0e62c3b..26942c159de1 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c | |||
@@ -22,10 +22,6 @@ | |||
22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
24 | * GNU General Public License for more details. | 24 | * GNU General Public License for more details. |
25 | * | ||
26 | * You should have received a copy of the GNU General Public License | ||
27 | * along with this program; if not, write to the Free Software | ||
28 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
29 | */ | 25 | */ |
30 | 26 | ||
31 | #include <linux/module.h> | 27 | #include <linux/module.h> |
diff --git a/drivers/i2c/busses/i2c-parport-light.c b/drivers/i2c/busses/i2c-parport-light.c index 62f55fe624cb..d1f625f923c7 100644 --- a/drivers/i2c/busses/i2c-parport-light.c +++ b/drivers/i2c/busses/i2c-parport-light.c | |||
@@ -18,10 +18,6 @@ | |||
18 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
20 | GNU General Public License for more details. | 20 | GNU General Public License for more details. |
21 | |||
22 | You should have received a copy of the GNU General Public License | ||
23 | along with this program; if not, write to the Free Software | ||
24 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
25 | * ------------------------------------------------------------------------ */ | 21 | * ------------------------------------------------------------------------ */ |
26 | 22 | ||
27 | #include <linux/kernel.h> | 23 | #include <linux/kernel.h> |
diff --git a/drivers/i2c/busses/i2c-parport.c b/drivers/i2c/busses/i2c-parport.c index a27aae2d6757..a1fac5aa9bae 100644 --- a/drivers/i2c/busses/i2c-parport.c +++ b/drivers/i2c/busses/i2c-parport.c | |||
@@ -18,10 +18,6 @@ | |||
18 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
20 | GNU General Public License for more details. | 20 | GNU General Public License for more details. |
21 | |||
22 | You should have received a copy of the GNU General Public License | ||
23 | along with this program; if not, write to the Free Software | ||
24 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
25 | * ------------------------------------------------------------------------ */ | 21 | * ------------------------------------------------------------------------ */ |
26 | 22 | ||
27 | #include <linux/kernel.h> | 23 | #include <linux/kernel.h> |
diff --git a/drivers/i2c/busses/i2c-parport.h b/drivers/i2c/busses/i2c-parport.h index e572f3aac0f7..4e1294536805 100644 --- a/drivers/i2c/busses/i2c-parport.h +++ b/drivers/i2c/busses/i2c-parport.h | |||
@@ -12,10 +12,6 @@ | |||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program; if not, write to the Free Software | ||
18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
19 | * ------------------------------------------------------------------------ */ | 15 | * ------------------------------------------------------------------------ */ |
20 | 16 | ||
21 | #define PORT_DATA 0 | 17 | #define PORT_DATA 0 |
diff --git a/drivers/i2c/busses/i2c-pasemi.c b/drivers/i2c/busses/i2c-pasemi.c index 7a9dce43e115..df1dbc92a024 100644 --- a/drivers/i2c/busses/i2c-pasemi.c +++ b/drivers/i2c/busses/i2c-pasemi.c | |||
@@ -11,10 +11,6 @@ | |||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | 14 | */ |
19 | 15 | ||
20 | #include <linux/module.h> | 16 | #include <linux/module.h> |
diff --git a/drivers/i2c/busses/i2c-pca-isa.c b/drivers/i2c/busses/i2c-pca-isa.c index 323f061a3163..e0eb4ca0102e 100644 --- a/drivers/i2c/busses/i2c-pca-isa.c +++ b/drivers/i2c/busses/i2c-pca-isa.c | |||
@@ -12,10 +12,6 @@ | |||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | * GNU General Public License for more details. | 14 | * GNU General Public License for more details. |
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
19 | */ | 15 | */ |
20 | 16 | ||
21 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c index a6f54ba27e2a..67cbec6796a0 100644 --- a/drivers/i2c/busses/i2c-piix4.c +++ b/drivers/i2c/busses/i2c-piix4.c | |||
@@ -11,10 +11,6 @@ | |||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with this program; if not, write to the Free Software | ||
17 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
18 | */ | 14 | */ |
19 | 15 | ||
20 | /* | 16 | /* |
diff --git a/drivers/i2c/busses/i2c-pmcmsp.c b/drivers/i2c/busses/i2c-pmcmsp.c index 8564768fee32..177834e2d841 100644 --- a/drivers/i2c/busses/i2c-pmcmsp.c +++ b/drivers/i2c/busses/i2c-pmcmsp.c | |||
@@ -18,10 +18,6 @@ | |||
18 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 18 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
19 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 19 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
20 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 20 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
21 | * | ||
22 | * You should have received a copy of the GNU General Public License along | ||
23 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
24 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
25 | */ | 21 | */ |
26 | 22 | ||
27 | #include <linux/kernel.h> | 23 | #include <linux/kernel.h> |
diff --git a/drivers/i2c/busses/i2c-powermac.c b/drivers/i2c/busses/i2c-powermac.c index 01e967763c2a..60a53c169ed2 100644 --- a/drivers/i2c/busses/i2c-powermac.c +++ b/drivers/i2c/busses/i2c-powermac.c | |||
@@ -14,10 +14,6 @@ | |||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. |
16 | 16 | ||
17 | You should have received a copy of the GNU General Public License | ||
18 | along with this program; if not, write to the Free Software | ||
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
20 | |||
21 | */ | 17 | */ |
22 | 18 | ||
23 | #include <linux/module.h> | 19 | #include <linux/module.h> |
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c index e3b0337faeb7..65244774bfa3 100644 --- a/drivers/i2c/busses/i2c-s3c2410.c +++ b/drivers/i2c/busses/i2c-s3c2410.c | |||
@@ -14,10 +14,6 @@ | |||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | * GNU General Public License for more details. | 16 | * GNU General Public License for more details. |
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | */ | 17 | */ |
22 | 18 | ||
23 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c index 8b5e79cb4468..4855188747c9 100644 --- a/drivers/i2c/busses/i2c-sh_mobile.c +++ b/drivers/i2c/busses/i2c-sh_mobile.c | |||
@@ -14,10 +14,6 @@ | |||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | * GNU General Public License for more details. | 16 | * GNU General Public License for more details. |
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | */ | 17 | */ |
22 | 18 | ||
23 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
diff --git a/drivers/i2c/busses/i2c-sibyte.c b/drivers/i2c/busses/i2c-sibyte.c index 0fe505d7abe9..2b6219d86b0f 100644 --- a/drivers/i2c/busses/i2c-sibyte.c +++ b/drivers/i2c/busses/i2c-sibyte.c | |||
@@ -12,10 +12,6 @@ | |||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | * GNU General Public License for more details. | 14 | * GNU General Public License for more details. |
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
19 | */ | 15 | */ |
20 | 16 | ||
21 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
diff --git a/drivers/i2c/busses/i2c-simtec.c b/drivers/i2c/busses/i2c-simtec.c index 964e5c6f84ab..15ac8395dcd3 100644 --- a/drivers/i2c/busses/i2c-simtec.c +++ b/drivers/i2c/busses/i2c-simtec.c | |||
@@ -12,10 +12,6 @@ | |||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | * GNU General Public License for more details. | 14 | * GNU General Public License for more details. |
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | 15 | */ |
20 | 16 | ||
21 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
diff --git a/drivers/i2c/busses/i2c-sis5595.c b/drivers/i2c/busses/i2c-sis5595.c index ac9bc33acef4..7d58a40faf2d 100644 --- a/drivers/i2c/busses/i2c-sis5595.c +++ b/drivers/i2c/busses/i2c-sis5595.c | |||
@@ -11,10 +11,6 @@ | |||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with this program; if not, write to the Free Software | ||
17 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
18 | */ | 14 | */ |
19 | 15 | ||
20 | /* Note: we assume there can only be one SIS5595 with one SMBus interface */ | 16 | /* Note: we assume there can only be one SIS5595 with one SMBus interface */ |
diff --git a/drivers/i2c/busses/i2c-sis630.c b/drivers/i2c/busses/i2c-sis630.c index c6366733008d..1e6805b5cef2 100644 --- a/drivers/i2c/busses/i2c-sis630.c +++ b/drivers/i2c/busses/i2c-sis630.c | |||
@@ -10,10 +10,6 @@ | |||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU General Public License for more details. | 12 | GNU General Public License for more details. |
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program; if not, write to the Free Software | ||
16 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
17 | */ | 13 | */ |
18 | 14 | ||
19 | /* | 15 | /* |
diff --git a/drivers/i2c/busses/i2c-sis96x.c b/drivers/i2c/busses/i2c-sis96x.c index 8dc2fc5f74ff..44b904426073 100644 --- a/drivers/i2c/busses/i2c-sis96x.c +++ b/drivers/i2c/busses/i2c-sis96x.c | |||
@@ -10,10 +10,6 @@ | |||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU General Public License for more details. | 12 | GNU General Public License for more details. |
13 | |||
14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program; if not, write to the Free Software | ||
16 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
17 | */ | 13 | */ |
18 | 14 | ||
19 | /* | 15 | /* |
diff --git a/drivers/i2c/busses/i2c-taos-evm.c b/drivers/i2c/busses/i2c-taos-evm.c index 10855a0b7e7f..4c7fc2d47014 100644 --- a/drivers/i2c/busses/i2c-taos-evm.c +++ b/drivers/i2c/busses/i2c-taos-evm.c | |||
@@ -13,10 +13,6 @@ | |||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * GNU General Public License for more details. | 15 | * GNU General Public License for more details. |
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
20 | */ | 16 | */ |
21 | 17 | ||
22 | #include <linux/delay.h> | 18 | #include <linux/delay.h> |
diff --git a/drivers/i2c/busses/i2c-via.c b/drivers/i2c/busses/i2c-via.c index f4a1ed757612..59b1d233ca7b 100644 --- a/drivers/i2c/busses/i2c-via.c +++ b/drivers/i2c/busses/i2c-via.c | |||
@@ -12,10 +12,6 @@ | |||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | GNU General Public License for more details. | 14 | GNU General Public License for more details. |
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program; if not, write to the Free Software | ||
18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
19 | */ | 15 | */ |
20 | 16 | ||
21 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
diff --git a/drivers/i2c/busses/i2c-viapro.c b/drivers/i2c/busses/i2c-viapro.c index 6841200b6e50..0ee2646f3b00 100644 --- a/drivers/i2c/busses/i2c-viapro.c +++ b/drivers/i2c/busses/i2c-viapro.c | |||
@@ -13,10 +13,6 @@ | |||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. |
16 | |||
17 | You should have received a copy of the GNU General Public License | ||
18 | along with this program; if not, write to the Free Software | ||
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
20 | */ | 16 | */ |
21 | 17 | ||
22 | /* | 18 | /* |
diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c index ade9223912d3..cc65ea0b818f 100644 --- a/drivers/i2c/busses/i2c-xiic.c +++ b/drivers/i2c/busses/i2c-xiic.c | |||
@@ -12,10 +12,6 @@ | |||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
18 | * | ||
19 | * | 15 | * |
20 | * This code was implemented by Mocean Laboratories AB when porting linux | 16 | * This code was implemented by Mocean Laboratories AB when porting linux |
21 | * to the automotive development board Russellville. The copyright holder | 17 | * to the automotive development board Russellville. The copyright holder |
diff --git a/drivers/i2c/busses/scx200_acb.c b/drivers/i2c/busses/scx200_acb.c index ff3f5747e43b..5153354b1a6b 100644 --- a/drivers/i2c/busses/scx200_acb.c +++ b/drivers/i2c/busses/scx200_acb.c | |||
@@ -17,10 +17,6 @@ | |||
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
19 | General Public License for more details. | 19 | General Public License for more details. |
20 | |||
21 | You should have received a copy of the GNU General Public License | ||
22 | along with this program; if not, write to the Free Software | ||
23 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
24 | */ | 20 | */ |
25 | 21 | ||
26 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | 22 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
diff --git a/drivers/i2c/i2c-boardinfo.c b/drivers/i2c/i2c-boardinfo.c index f24cc64e2e8c..90e322959303 100644 --- a/drivers/i2c/i2c-boardinfo.c +++ b/drivers/i2c/i2c-boardinfo.c | |||
@@ -10,11 +10,6 @@ | |||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | * GNU General Public License for more details. | 12 | * GNU General Public License for more details. |
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||
17 | * MA 02110-1301 USA. | ||
18 | */ | 13 | */ |
19 | 14 | ||
20 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 2f90ac6a7f79..f43b4e11647a 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -10,12 +10,7 @@ | |||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. */ |
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with this program; if not, write to the Free Software | ||
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||
18 | MA 02110-1301 USA. */ | ||
19 | /* ------------------------------------------------------------------------- */ | 14 | /* ------------------------------------------------------------------------- */ |
20 | 15 | ||
21 | /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi>. | 16 | /* With some changes from Kyösti Mälkki <kmalkki@cc.hut.fi>. |
@@ -670,6 +665,9 @@ static int i2c_device_remove(struct device *dev) | |||
670 | status = driver->remove(client); | 665 | status = driver->remove(client); |
671 | } | 666 | } |
672 | 667 | ||
668 | if (dev->of_node) | ||
669 | irq_dispose_mapping(client->irq); | ||
670 | |||
673 | dev_pm_domain_detach(&client->dev, true); | 671 | dev_pm_domain_detach(&client->dev, true); |
674 | return status; | 672 | return status; |
675 | } | 673 | } |
diff --git a/drivers/i2c/i2c-core.h b/drivers/i2c/i2c-core.h index 18a8fd21d2c2..17700bfddcf5 100644 --- a/drivers/i2c/i2c-core.h +++ b/drivers/i2c/i2c-core.h | |||
@@ -10,11 +10,6 @@ | |||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | * GNU General Public License for more details. | 12 | * GNU General Public License for more details. |
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||
17 | * MA 02110-1301 USA. | ||
18 | */ | 13 | */ |
19 | 14 | ||
20 | #include <linux/rwsem.h> | 15 | #include <linux/rwsem.h> |
diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c index 80b47e8ce030..71c7a3975b62 100644 --- a/drivers/i2c/i2c-dev.c +++ b/drivers/i2c/i2c-dev.c | |||
@@ -14,11 +14,6 @@ | |||
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. | 16 | GNU General Public License for more details. |
17 | |||
18 | You should have received a copy of the GNU General Public License | ||
19 | along with this program; if not, write to the Free Software | ||
20 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||
21 | MA 02110-1301 USA. | ||
22 | */ | 17 | */ |
23 | 18 | ||
24 | /* Note that this is a complete rewrite of Simon Vogl's i2c-dev module. | 19 | /* Note that this is a complete rewrite of Simon Vogl's i2c-dev module. |
diff --git a/drivers/i2c/i2c-smbus.c b/drivers/i2c/i2c-smbus.c index fc99f0d6b4a5..9ebf9cb4ad7a 100644 --- a/drivers/i2c/i2c-smbus.c +++ b/drivers/i2c/i2c-smbus.c | |||
@@ -13,11 +13,6 @@ | |||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | * GNU General Public License for more details. | 15 | * GNU General Public License for more details. |
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||
20 | * MA 02110-1301 USA. | ||
21 | */ | 16 | */ |
22 | 17 | ||
23 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
diff --git a/drivers/i2c/i2c-stub.c b/drivers/i2c/i2c-stub.c index d241aa295d96..af2a94e1140b 100644 --- a/drivers/i2c/i2c-stub.c +++ b/drivers/i2c/i2c-stub.c | |||
@@ -13,10 +13,6 @@ | |||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | GNU General Public License for more details. | 15 | GNU General Public License for more details. |
16 | |||
17 | You should have received a copy of the GNU General Public License | ||
18 | along with this program; if not, write to the Free Software | ||
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
20 | */ | 16 | */ |
21 | 17 | ||
22 | #define DEBUG 1 | 18 | #define DEBUG 1 |
diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c index 98909a9e284e..a23e58c4ed99 100644 --- a/drivers/iio/accel/kxcjk-1013.c +++ b/drivers/iio/accel/kxcjk-1013.c | |||
@@ -894,7 +894,7 @@ static const struct attribute_group kxcjk1013_attrs_group = { | |||
894 | 894 | ||
895 | static const struct iio_event_spec kxcjk1013_event = { | 895 | static const struct iio_event_spec kxcjk1013_event = { |
896 | .type = IIO_EV_TYPE_THRESH, | 896 | .type = IIO_EV_TYPE_THRESH, |
897 | .dir = IIO_EV_DIR_RISING | IIO_EV_DIR_FALLING, | 897 | .dir = IIO_EV_DIR_EITHER, |
898 | .mask_separate = BIT(IIO_EV_INFO_VALUE) | | 898 | .mask_separate = BIT(IIO_EV_INFO_VALUE) | |
899 | BIT(IIO_EV_INFO_ENABLE) | | 899 | BIT(IIO_EV_INFO_ENABLE) | |
900 | BIT(IIO_EV_INFO_PERIOD) | 900 | BIT(IIO_EV_INFO_PERIOD) |
diff --git a/drivers/iio/common/st_sensors/st_sensors_buffer.c b/drivers/iio/common/st_sensors/st_sensors_buffer.c index 1665c8e4b62b..e18bc6782256 100644 --- a/drivers/iio/common/st_sensors/st_sensors_buffer.c +++ b/drivers/iio/common/st_sensors/st_sensors_buffer.c | |||
@@ -71,7 +71,7 @@ int st_sensors_get_buffer_element(struct iio_dev *indio_dev, u8 *buf) | |||
71 | goto st_sensors_free_memory; | 71 | goto st_sensors_free_memory; |
72 | } | 72 | } |
73 | 73 | ||
74 | for (i = 0; i < n * num_data_channels; i++) { | 74 | for (i = 0; i < n * byte_for_channel; i++) { |
75 | if (i < n) | 75 | if (i < n) |
76 | buf[i] = rx_array[i]; | 76 | buf[i] = rx_array[i]; |
77 | else | 77 | else |
diff --git a/drivers/iio/light/tsl4531.c b/drivers/iio/light/tsl4531.c index a15006efa137..0763b8632573 100644 --- a/drivers/iio/light/tsl4531.c +++ b/drivers/iio/light/tsl4531.c | |||
@@ -230,9 +230,12 @@ static int tsl4531_resume(struct device *dev) | |||
230 | return i2c_smbus_write_byte_data(to_i2c_client(dev), TSL4531_CONTROL, | 230 | return i2c_smbus_write_byte_data(to_i2c_client(dev), TSL4531_CONTROL, |
231 | TSL4531_MODE_NORMAL); | 231 | TSL4531_MODE_NORMAL); |
232 | } | 232 | } |
233 | #endif | ||
234 | 233 | ||
235 | static SIMPLE_DEV_PM_OPS(tsl4531_pm_ops, tsl4531_suspend, tsl4531_resume); | 234 | static SIMPLE_DEV_PM_OPS(tsl4531_pm_ops, tsl4531_suspend, tsl4531_resume); |
235 | #define TSL4531_PM_OPS (&tsl4531_pm_ops) | ||
236 | #else | ||
237 | #define TSL4531_PM_OPS NULL | ||
238 | #endif | ||
236 | 239 | ||
237 | static const struct i2c_device_id tsl4531_id[] = { | 240 | static const struct i2c_device_id tsl4531_id[] = { |
238 | { "tsl4531", 0 }, | 241 | { "tsl4531", 0 }, |
@@ -243,7 +246,7 @@ MODULE_DEVICE_TABLE(i2c, tsl4531_id); | |||
243 | static struct i2c_driver tsl4531_driver = { | 246 | static struct i2c_driver tsl4531_driver = { |
244 | .driver = { | 247 | .driver = { |
245 | .name = TSL4531_DRV_NAME, | 248 | .name = TSL4531_DRV_NAME, |
246 | .pm = &tsl4531_pm_ops, | 249 | .pm = TSL4531_PM_OPS, |
247 | .owner = THIS_MODULE, | 250 | .owner = THIS_MODULE, |
248 | }, | 251 | }, |
249 | .probe = tsl4531_probe, | 252 | .probe = tsl4531_probe, |
diff --git a/drivers/iio/proximity/as3935.c b/drivers/iio/proximity/as3935.c index 5e780ef206f3..8349cc0fdf66 100644 --- a/drivers/iio/proximity/as3935.c +++ b/drivers/iio/proximity/as3935.c | |||
@@ -330,7 +330,7 @@ static int as3935_probe(struct spi_device *spi) | |||
330 | return -EINVAL; | 330 | return -EINVAL; |
331 | } | 331 | } |
332 | 332 | ||
333 | indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(st)); | 333 | indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); |
334 | if (!indio_dev) | 334 | if (!indio_dev) |
335 | return -ENOMEM; | 335 | return -ENOMEM; |
336 | 336 | ||
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index bda5994ceb68..8b72cf392b34 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
@@ -1173,18 +1173,24 @@ static struct ib_flow *mlx4_ib_create_flow(struct ib_qp *qp, | |||
1173 | err = __mlx4_ib_create_flow(qp, flow_attr, domain, type[i], | 1173 | err = __mlx4_ib_create_flow(qp, flow_attr, domain, type[i], |
1174 | &mflow->reg_id[i]); | 1174 | &mflow->reg_id[i]); |
1175 | if (err) | 1175 | if (err) |
1176 | goto err_free; | 1176 | goto err_create_flow; |
1177 | i++; | 1177 | i++; |
1178 | } | 1178 | } |
1179 | 1179 | ||
1180 | if (i < ARRAY_SIZE(type) && flow_attr->type == IB_FLOW_ATTR_NORMAL) { | 1180 | if (i < ARRAY_SIZE(type) && flow_attr->type == IB_FLOW_ATTR_NORMAL) { |
1181 | err = mlx4_ib_tunnel_steer_add(qp, flow_attr, &mflow->reg_id[i]); | 1181 | err = mlx4_ib_tunnel_steer_add(qp, flow_attr, &mflow->reg_id[i]); |
1182 | if (err) | 1182 | if (err) |
1183 | goto err_free; | 1183 | goto err_create_flow; |
1184 | i++; | ||
1184 | } | 1185 | } |
1185 | 1186 | ||
1186 | return &mflow->ibflow; | 1187 | return &mflow->ibflow; |
1187 | 1188 | ||
1189 | err_create_flow: | ||
1190 | while (i) { | ||
1191 | (void)__mlx4_ib_destroy_flow(to_mdev(qp->device)->dev, mflow->reg_id[i]); | ||
1192 | i--; | ||
1193 | } | ||
1188 | err_free: | 1194 | err_free: |
1189 | kfree(mflow); | 1195 | kfree(mflow); |
1190 | return ERR_PTR(err); | 1196 | return ERR_PTR(err); |
diff --git a/drivers/input/keyboard/opencores-kbd.c b/drivers/input/keyboard/opencores-kbd.c index 62abe2c16670..f8502bb29176 100644 --- a/drivers/input/keyboard/opencores-kbd.c +++ b/drivers/input/keyboard/opencores-kbd.c | |||
@@ -70,7 +70,7 @@ static int opencores_kbd_probe(struct platform_device *pdev) | |||
70 | 70 | ||
71 | opencores_kbd->addr = devm_ioremap_resource(&pdev->dev, res); | 71 | opencores_kbd->addr = devm_ioremap_resource(&pdev->dev, res); |
72 | if (IS_ERR(opencores_kbd->addr)) | 72 | if (IS_ERR(opencores_kbd->addr)) |
73 | error = PTR_ERR(opencores_kbd->addr); | 73 | return PTR_ERR(opencores_kbd->addr); |
74 | 74 | ||
75 | input->name = pdev->name; | 75 | input->name = pdev->name; |
76 | input->phys = "opencores-kbd/input0"; | 76 | input->phys = "opencores-kbd/input0"; |
diff --git a/drivers/input/keyboard/stmpe-keypad.c b/drivers/input/keyboard/stmpe-keypad.c index c6727dda68f2..ef5e67fb567e 100644 --- a/drivers/input/keyboard/stmpe-keypad.c +++ b/drivers/input/keyboard/stmpe-keypad.c | |||
@@ -86,7 +86,7 @@ static const struct stmpe_keypad_variant stmpe_keypad_variants[] = { | |||
86 | .max_cols = 8, | 86 | .max_cols = 8, |
87 | .max_rows = 12, | 87 | .max_rows = 12, |
88 | .col_gpios = 0x0000ff, /* GPIO 0 - 7*/ | 88 | .col_gpios = 0x0000ff, /* GPIO 0 - 7*/ |
89 | .row_gpios = 0x1fef00, /* GPIO 8-14, 16-20 */ | 89 | .row_gpios = 0x1f7f00, /* GPIO 8-14, 16-20 */ |
90 | }, | 90 | }, |
91 | [STMPE2403] = { | 91 | [STMPE2403] = { |
92 | .auto_increment = true, | 92 | .auto_increment = true, |
diff --git a/drivers/input/misc/ims-pcu.c b/drivers/input/misc/ims-pcu.c index 719410feb84b..afed8e2b2f94 100644 --- a/drivers/input/misc/ims-pcu.c +++ b/drivers/input/misc/ims-pcu.c | |||
@@ -1381,7 +1381,7 @@ static ssize_t ims_pcu_ofn_reg_addr_store(struct device *dev, | |||
1381 | pcu->ofn_reg_addr = value; | 1381 | pcu->ofn_reg_addr = value; |
1382 | mutex_unlock(&pcu->cmd_mutex); | 1382 | mutex_unlock(&pcu->cmd_mutex); |
1383 | 1383 | ||
1384 | return error ?: count; | 1384 | return count; |
1385 | } | 1385 | } |
1386 | 1386 | ||
1387 | static DEVICE_ATTR(reg_addr, S_IRUGO | S_IWUSR, | 1387 | static DEVICE_ATTR(reg_addr, S_IRUGO | S_IWUSR, |
diff --git a/drivers/input/misc/max77693-haptic.c b/drivers/input/misc/max77693-haptic.c index 7b1fde93799e..ef6a9d650d69 100644 --- a/drivers/input/misc/max77693-haptic.c +++ b/drivers/input/misc/max77693-haptic.c | |||
@@ -194,7 +194,7 @@ static int max77693_haptic_play_effect(struct input_dev *dev, void *data, | |||
194 | struct ff_effect *effect) | 194 | struct ff_effect *effect) |
195 | { | 195 | { |
196 | struct max77693_haptic *haptic = input_get_drvdata(dev); | 196 | struct max77693_haptic *haptic = input_get_drvdata(dev); |
197 | uint64_t period_mag_multi; | 197 | u64 period_mag_multi; |
198 | 198 | ||
199 | haptic->magnitude = effect->u.rumble.strong_magnitude; | 199 | haptic->magnitude = effect->u.rumble.strong_magnitude; |
200 | if (!haptic->magnitude) | 200 | if (!haptic->magnitude) |
@@ -205,8 +205,7 @@ static int max77693_haptic_play_effect(struct input_dev *dev, void *data, | |||
205 | * The formula to convert magnitude to pwm_duty as follows: | 205 | * The formula to convert magnitude to pwm_duty as follows: |
206 | * - pwm_duty = (magnitude * pwm_period) / MAX_MAGNITUDE(0xFFFF) | 206 | * - pwm_duty = (magnitude * pwm_period) / MAX_MAGNITUDE(0xFFFF) |
207 | */ | 207 | */ |
208 | period_mag_multi = (int64_t)(haptic->pwm_dev->period * | 208 | period_mag_multi = (u64)haptic->pwm_dev->period * haptic->magnitude; |
209 | haptic->magnitude); | ||
210 | haptic->pwm_duty = (unsigned int)(period_mag_multi >> | 209 | haptic->pwm_duty = (unsigned int)(period_mag_multi >> |
211 | MAX_MAGNITUDE_SHIFT); | 210 | MAX_MAGNITUDE_SHIFT); |
212 | 211 | ||
diff --git a/drivers/input/misc/soc_button_array.c b/drivers/input/misc/soc_button_array.c index 735604753568..e097f1ab427f 100644 --- a/drivers/input/misc/soc_button_array.c +++ b/drivers/input/misc/soc_button_array.c | |||
@@ -55,7 +55,7 @@ static int soc_button_lookup_gpio(struct device *dev, int acpi_index) | |||
55 | struct gpio_desc *desc; | 55 | struct gpio_desc *desc; |
56 | int gpio; | 56 | int gpio; |
57 | 57 | ||
58 | desc = gpiod_get_index(dev, KBUILD_MODNAME, acpi_index); | 58 | desc = gpiod_get_index(dev, KBUILD_MODNAME, acpi_index, GPIOD_ASIS); |
59 | if (IS_ERR(desc)) | 59 | if (IS_ERR(desc)) |
60 | return PTR_ERR(desc); | 60 | return PTR_ERR(desc); |
61 | 61 | ||
diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c index fb3b63b2f85c..8400a1a34d87 100644 --- a/drivers/input/misc/twl4030-pwrbutton.c +++ b/drivers/input/misc/twl4030-pwrbutton.c | |||
@@ -85,6 +85,7 @@ static int twl4030_pwrbutton_probe(struct platform_device *pdev) | |||
85 | } | 85 | } |
86 | 86 | ||
87 | platform_set_drvdata(pdev, pwr); | 87 | platform_set_drvdata(pdev, pwr); |
88 | device_init_wakeup(&pdev->dev, true); | ||
88 | 89 | ||
89 | return 0; | 90 | return 0; |
90 | } | 91 | } |
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index 2b0ae8cc8e51..d125a019383f 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c | |||
@@ -1156,7 +1156,13 @@ static psmouse_ret_t alps_process_byte(struct psmouse *psmouse) | |||
1156 | { | 1156 | { |
1157 | struct alps_data *priv = psmouse->private; | 1157 | struct alps_data *priv = psmouse->private; |
1158 | 1158 | ||
1159 | if ((psmouse->packet[0] & 0xc8) == 0x08) { /* PS/2 packet */ | 1159 | /* |
1160 | * Check if we are dealing with a bare PS/2 packet, presumably from | ||
1161 | * a device connected to the external PS/2 port. Because bare PS/2 | ||
1162 | * protocol does not have enough constant bits to self-synchronize | ||
1163 | * properly we only do this if the device is fully synchronized. | ||
1164 | */ | ||
1165 | if (!psmouse->out_of_sync_cnt && (psmouse->packet[0] & 0xc8) == 0x08) { | ||
1160 | if (psmouse->pktcnt == 3) { | 1166 | if (psmouse->pktcnt == 3) { |
1161 | alps_report_bare_ps2_packet(psmouse, psmouse->packet, | 1167 | alps_report_bare_ps2_packet(psmouse, psmouse->packet, |
1162 | true); | 1168 | true); |
@@ -1180,12 +1186,27 @@ static psmouse_ret_t alps_process_byte(struct psmouse *psmouse) | |||
1180 | } | 1186 | } |
1181 | 1187 | ||
1182 | /* Bytes 2 - pktsize should have 0 in the highest bit */ | 1188 | /* Bytes 2 - pktsize should have 0 in the highest bit */ |
1183 | if ((priv->proto_version < ALPS_PROTO_V5) && | 1189 | if (priv->proto_version < ALPS_PROTO_V5 && |
1184 | psmouse->pktcnt >= 2 && psmouse->pktcnt <= psmouse->pktsize && | 1190 | psmouse->pktcnt >= 2 && psmouse->pktcnt <= psmouse->pktsize && |
1185 | (psmouse->packet[psmouse->pktcnt - 1] & 0x80)) { | 1191 | (psmouse->packet[psmouse->pktcnt - 1] & 0x80)) { |
1186 | psmouse_dbg(psmouse, "refusing packet[%i] = %x\n", | 1192 | psmouse_dbg(psmouse, "refusing packet[%i] = %x\n", |
1187 | psmouse->pktcnt - 1, | 1193 | psmouse->pktcnt - 1, |
1188 | psmouse->packet[psmouse->pktcnt - 1]); | 1194 | psmouse->packet[psmouse->pktcnt - 1]); |
1195 | |||
1196 | if (priv->proto_version == ALPS_PROTO_V3 && | ||
1197 | psmouse->pktcnt == psmouse->pktsize) { | ||
1198 | /* | ||
1199 | * Some Dell boxes, such as Latitude E6440 or E7440 | ||
1200 | * with closed lid, quite often smash last byte of | ||
1201 | * otherwise valid packet with 0xff. Given that the | ||
1202 | * next packet is very likely to be valid let's | ||
1203 | * report PSMOUSE_FULL_PACKET but not process data, | ||
1204 | * rather than reporting PSMOUSE_BAD_DATA and | ||
1205 | * filling the logs. | ||
1206 | */ | ||
1207 | return PSMOUSE_FULL_PACKET; | ||
1208 | } | ||
1209 | |||
1189 | return PSMOUSE_BAD_DATA; | 1210 | return PSMOUSE_BAD_DATA; |
1190 | } | 1211 | } |
1191 | 1212 | ||
@@ -2389,6 +2410,9 @@ int alps_init(struct psmouse *psmouse) | |||
2389 | /* We are having trouble resyncing ALPS touchpads so disable it for now */ | 2410 | /* We are having trouble resyncing ALPS touchpads so disable it for now */ |
2390 | psmouse->resync_time = 0; | 2411 | psmouse->resync_time = 0; |
2391 | 2412 | ||
2413 | /* Allow 2 invalid packets without resetting device */ | ||
2414 | psmouse->resetafter = psmouse->pktsize * 2; | ||
2415 | |||
2392 | return 0; | 2416 | return 0; |
2393 | 2417 | ||
2394 | init_fail: | 2418 | init_fail: |
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index 06fc6e76ffbe..3fcb6b3cb0bd 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c | |||
@@ -563,6 +563,7 @@ static void elantech_input_sync_v4(struct psmouse *psmouse) | |||
563 | } else { | 563 | } else { |
564 | input_report_key(dev, BTN_LEFT, packet[0] & 0x01); | 564 | input_report_key(dev, BTN_LEFT, packet[0] & 0x01); |
565 | input_report_key(dev, BTN_RIGHT, packet[0] & 0x02); | 565 | input_report_key(dev, BTN_RIGHT, packet[0] & 0x02); |
566 | input_report_key(dev, BTN_MIDDLE, packet[0] & 0x04); | ||
566 | } | 567 | } |
567 | 568 | ||
568 | input_mt_report_pointer_emulation(dev, true); | 569 | input_mt_report_pointer_emulation(dev, true); |
@@ -792,6 +793,9 @@ static int elantech_packet_check_v4(struct psmouse *psmouse) | |||
792 | unsigned char packet_type = packet[3] & 0x03; | 793 | unsigned char packet_type = packet[3] & 0x03; |
793 | bool sanity_check; | 794 | bool sanity_check; |
794 | 795 | ||
796 | if ((packet[3] & 0x0f) == 0x06) | ||
797 | return PACKET_TRACKPOINT; | ||
798 | |||
795 | /* | 799 | /* |
796 | * Sanity check based on the constant bits of a packet. | 800 | * Sanity check based on the constant bits of a packet. |
797 | * The constant bits change depending on the value of | 801 | * The constant bits change depending on the value of |
@@ -877,10 +881,19 @@ static psmouse_ret_t elantech_process_byte(struct psmouse *psmouse) | |||
877 | 881 | ||
878 | case 4: | 882 | case 4: |
879 | packet_type = elantech_packet_check_v4(psmouse); | 883 | packet_type = elantech_packet_check_v4(psmouse); |
880 | if (packet_type == PACKET_UNKNOWN) | 884 | switch (packet_type) { |
885 | case PACKET_UNKNOWN: | ||
881 | return PSMOUSE_BAD_DATA; | 886 | return PSMOUSE_BAD_DATA; |
882 | 887 | ||
883 | elantech_report_absolute_v4(psmouse, packet_type); | 888 | case PACKET_TRACKPOINT: |
889 | elantech_report_trackpoint(psmouse, packet_type); | ||
890 | break; | ||
891 | |||
892 | default: | ||
893 | elantech_report_absolute_v4(psmouse, packet_type); | ||
894 | break; | ||
895 | } | ||
896 | |||
884 | break; | 897 | break; |
885 | } | 898 | } |
886 | 899 | ||
@@ -1120,6 +1133,22 @@ static void elantech_set_buttonpad_prop(struct psmouse *psmouse) | |||
1120 | } | 1133 | } |
1121 | 1134 | ||
1122 | /* | 1135 | /* |
1136 | * Some hw_version 4 models do have a middle button | ||
1137 | */ | ||
1138 | static const struct dmi_system_id elantech_dmi_has_middle_button[] = { | ||
1139 | #if defined(CONFIG_DMI) && defined(CONFIG_X86) | ||
1140 | { | ||
1141 | /* Fujitsu H730 has a middle button */ | ||
1142 | .matches = { | ||
1143 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), | ||
1144 | DMI_MATCH(DMI_PRODUCT_NAME, "CELSIUS H730"), | ||
1145 | }, | ||
1146 | }, | ||
1147 | #endif | ||
1148 | { } | ||
1149 | }; | ||
1150 | |||
1151 | /* | ||
1123 | * Set the appropriate event bits for the input subsystem | 1152 | * Set the appropriate event bits for the input subsystem |
1124 | */ | 1153 | */ |
1125 | static int elantech_set_input_params(struct psmouse *psmouse) | 1154 | static int elantech_set_input_params(struct psmouse *psmouse) |
@@ -1138,6 +1167,8 @@ static int elantech_set_input_params(struct psmouse *psmouse) | |||
1138 | __clear_bit(EV_REL, dev->evbit); | 1167 | __clear_bit(EV_REL, dev->evbit); |
1139 | 1168 | ||
1140 | __set_bit(BTN_LEFT, dev->keybit); | 1169 | __set_bit(BTN_LEFT, dev->keybit); |
1170 | if (dmi_check_system(elantech_dmi_has_middle_button)) | ||
1171 | __set_bit(BTN_MIDDLE, dev->keybit); | ||
1141 | __set_bit(BTN_RIGHT, dev->keybit); | 1172 | __set_bit(BTN_RIGHT, dev->keybit); |
1142 | 1173 | ||
1143 | __set_bit(BTN_TOUCH, dev->keybit); | 1174 | __set_bit(BTN_TOUCH, dev->keybit); |
@@ -1299,6 +1330,7 @@ ELANTECH_INT_ATTR(reg_25, 0x25); | |||
1299 | ELANTECH_INT_ATTR(reg_26, 0x26); | 1330 | ELANTECH_INT_ATTR(reg_26, 0x26); |
1300 | ELANTECH_INT_ATTR(debug, 0); | 1331 | ELANTECH_INT_ATTR(debug, 0); |
1301 | ELANTECH_INT_ATTR(paritycheck, 0); | 1332 | ELANTECH_INT_ATTR(paritycheck, 0); |
1333 | ELANTECH_INT_ATTR(crc_enabled, 0); | ||
1302 | 1334 | ||
1303 | static struct attribute *elantech_attrs[] = { | 1335 | static struct attribute *elantech_attrs[] = { |
1304 | &psmouse_attr_reg_07.dattr.attr, | 1336 | &psmouse_attr_reg_07.dattr.attr, |
@@ -1313,6 +1345,7 @@ static struct attribute *elantech_attrs[] = { | |||
1313 | &psmouse_attr_reg_26.dattr.attr, | 1345 | &psmouse_attr_reg_26.dattr.attr, |
1314 | &psmouse_attr_debug.dattr.attr, | 1346 | &psmouse_attr_debug.dattr.attr, |
1315 | &psmouse_attr_paritycheck.dattr.attr, | 1347 | &psmouse_attr_paritycheck.dattr.attr, |
1348 | &psmouse_attr_crc_enabled.dattr.attr, | ||
1316 | NULL | 1349 | NULL |
1317 | }; | 1350 | }; |
1318 | 1351 | ||
@@ -1439,6 +1472,22 @@ static int elantech_reconnect(struct psmouse *psmouse) | |||
1439 | } | 1472 | } |
1440 | 1473 | ||
1441 | /* | 1474 | /* |
1475 | * Some hw_version 4 models do not work with crc_disabled | ||
1476 | */ | ||
1477 | static const struct dmi_system_id elantech_dmi_force_crc_enabled[] = { | ||
1478 | #if defined(CONFIG_DMI) && defined(CONFIG_X86) | ||
1479 | { | ||
1480 | /* Fujitsu H730 does not work with crc_enabled == 0 */ | ||
1481 | .matches = { | ||
1482 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), | ||
1483 | DMI_MATCH(DMI_PRODUCT_NAME, "CELSIUS H730"), | ||
1484 | }, | ||
1485 | }, | ||
1486 | #endif | ||
1487 | { } | ||
1488 | }; | ||
1489 | |||
1490 | /* | ||
1442 | * Some hw_version 3 models go into error state when we try to set | 1491 | * Some hw_version 3 models go into error state when we try to set |
1443 | * bit 3 and/or bit 1 of r10. | 1492 | * bit 3 and/or bit 1 of r10. |
1444 | */ | 1493 | */ |
@@ -1513,7 +1562,8 @@ static int elantech_set_properties(struct elantech_data *etd) | |||
1513 | * The signatures of v3 and v4 packets change depending on the | 1562 | * The signatures of v3 and v4 packets change depending on the |
1514 | * value of this hardware flag. | 1563 | * value of this hardware flag. |
1515 | */ | 1564 | */ |
1516 | etd->crc_enabled = ((etd->fw_version & 0x4000) == 0x4000); | 1565 | etd->crc_enabled = (etd->fw_version & 0x4000) == 0x4000 || |
1566 | dmi_check_system(elantech_dmi_force_crc_enabled); | ||
1517 | 1567 | ||
1518 | /* Enable real hardware resolution on hw_version 3 ? */ | 1568 | /* Enable real hardware resolution on hw_version 3 ? */ |
1519 | etd->set_hw_resolution = !dmi_check_system(no_hw_res_dmi_table); | 1569 | etd->set_hw_resolution = !dmi_check_system(no_hw_res_dmi_table); |
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c index 26994f6a2b2a..95a3a6e2faf6 100644 --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c | |||
@@ -1536,16 +1536,9 @@ static int psmouse_reconnect(struct serio *serio) | |||
1536 | { | 1536 | { |
1537 | struct psmouse *psmouse = serio_get_drvdata(serio); | 1537 | struct psmouse *psmouse = serio_get_drvdata(serio); |
1538 | struct psmouse *parent = NULL; | 1538 | struct psmouse *parent = NULL; |
1539 | struct serio_driver *drv = serio->drv; | ||
1540 | unsigned char type; | 1539 | unsigned char type; |
1541 | int rc = -1; | 1540 | int rc = -1; |
1542 | 1541 | ||
1543 | if (!drv || !psmouse) { | ||
1544 | psmouse_dbg(psmouse, | ||
1545 | "reconnect request, but serio is disconnected, ignoring...\n"); | ||
1546 | return -1; | ||
1547 | } | ||
1548 | |||
1549 | mutex_lock(&psmouse_mutex); | 1542 | mutex_lock(&psmouse_mutex); |
1550 | 1543 | ||
1551 | if (serio->parent && serio->id.type == SERIO_PS_PSTHRU) { | 1544 | if (serio->parent && serio->id.type == SERIO_PS_PSTHRU) { |
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index 9031a0a28ea4..2a7a9174c702 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c | |||
@@ -135,8 +135,8 @@ static const struct min_max_quirk min_max_pnpid_table[] = { | |||
135 | 1232, 5710, 1156, 4696 | 135 | 1232, 5710, 1156, 4696 |
136 | }, | 136 | }, |
137 | { | 137 | { |
138 | (const char * const []){"LEN0034", "LEN0036", "LEN2002", | 138 | (const char * const []){"LEN0034", "LEN0036", "LEN0039", |
139 | "LEN2004", NULL}, | 139 | "LEN2002", "LEN2004", NULL}, |
140 | 1024, 5112, 2024, 4832 | 140 | 1024, 5112, 2024, 4832 |
141 | }, | 141 | }, |
142 | { | 142 | { |
@@ -163,6 +163,7 @@ static const char * const topbuttonpad_pnp_ids[] = { | |||
163 | "LEN0036", /* T440 */ | 163 | "LEN0036", /* T440 */ |
164 | "LEN0037", | 164 | "LEN0037", |
165 | "LEN0038", | 165 | "LEN0038", |
166 | "LEN0039", /* T440s */ | ||
166 | "LEN0041", | 167 | "LEN0041", |
167 | "LEN0042", /* Yoga */ | 168 | "LEN0042", /* Yoga */ |
168 | "LEN0045", | 169 | "LEN0045", |
diff --git a/drivers/input/mouse/vsxxxaa.c b/drivers/input/mouse/vsxxxaa.c index 38298232124f..abd494411e69 100644 --- a/drivers/input/mouse/vsxxxaa.c +++ b/drivers/input/mouse/vsxxxaa.c | |||
@@ -128,7 +128,7 @@ static void vsxxxaa_drop_bytes(struct vsxxxaa *mouse, int num) | |||
128 | if (num >= mouse->count) { | 128 | if (num >= mouse->count) { |
129 | mouse->count = 0; | 129 | mouse->count = 0; |
130 | } else { | 130 | } else { |
131 | memmove(mouse->buf, mouse->buf + num - 1, BUFLEN - num); | 131 | memmove(mouse->buf, mouse->buf + num, BUFLEN - num); |
132 | mouse->count -= num; | 132 | mouse->count -= num; |
133 | } | 133 | } |
134 | } | 134 | } |
diff --git a/drivers/input/serio/altera_ps2.c b/drivers/input/serio/altera_ps2.c index cce69d6b9587..58781c8a8aec 100644 --- a/drivers/input/serio/altera_ps2.c +++ b/drivers/input/serio/altera_ps2.c | |||
@@ -37,7 +37,7 @@ static irqreturn_t altera_ps2_rxint(int irq, void *dev_id) | |||
37 | { | 37 | { |
38 | struct ps2if *ps2if = dev_id; | 38 | struct ps2if *ps2if = dev_id; |
39 | unsigned int status; | 39 | unsigned int status; |
40 | int handled = IRQ_NONE; | 40 | irqreturn_t handled = IRQ_NONE; |
41 | 41 | ||
42 | while ((status = readl(ps2if->base)) & 0xffff0000) { | 42 | while ((status = readl(ps2if->base)) & 0xffff0000) { |
43 | serio_interrupt(ps2if->io, status & 0xff, 0); | 43 | serio_interrupt(ps2if->io, status & 0xff, 0); |
@@ -74,7 +74,7 @@ static void altera_ps2_close(struct serio *io) | |||
74 | { | 74 | { |
75 | struct ps2if *ps2if = io->port_data; | 75 | struct ps2if *ps2if = io->port_data; |
76 | 76 | ||
77 | writel(0, ps2if->base); /* disable rx irq */ | 77 | writel(0, ps2if->base + 4); /* disable rx irq */ |
78 | } | 78 | } |
79 | 79 | ||
80 | /* | 80 | /* |
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h index a0bcbb64d06d..faeeb1372462 100644 --- a/drivers/input/serio/i8042-x86ia64io.h +++ b/drivers/input/serio/i8042-x86ia64io.h | |||
@@ -207,17 +207,282 @@ static const struct dmi_system_id __initconst i8042_dmi_noloop_table[] = { | |||
207 | }; | 207 | }; |
208 | 208 | ||
209 | /* | 209 | /* |
210 | * Some laptops do implement active multiplexing mode correctly; | 210 | * Some Fujitsu notebooks are having trouble with touchpads if |
211 | * unfortunately they are in minority. | 211 | * active multiplexing mode is activated. Luckily they don't have |
212 | * external PS/2 ports so we can safely disable it. | ||
213 | * ... apparently some Toshibas don't like MUX mode either and | ||
214 | * die horrible death on reboot. | ||
212 | */ | 215 | */ |
213 | static const struct dmi_system_id __initconst i8042_dmi_mux_table[] = { | 216 | static const struct dmi_system_id __initconst i8042_dmi_nomux_table[] = { |
217 | { | ||
218 | /* Fujitsu Lifebook P7010/P7010D */ | ||
219 | .matches = { | ||
220 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), | ||
221 | DMI_MATCH(DMI_PRODUCT_NAME, "P7010"), | ||
222 | }, | ||
223 | }, | ||
224 | { | ||
225 | /* Fujitsu Lifebook P7010 */ | ||
226 | .matches = { | ||
227 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), | ||
228 | DMI_MATCH(DMI_PRODUCT_NAME, "0000000000"), | ||
229 | }, | ||
230 | }, | ||
231 | { | ||
232 | /* Fujitsu Lifebook P5020D */ | ||
233 | .matches = { | ||
234 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), | ||
235 | DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook P Series"), | ||
236 | }, | ||
237 | }, | ||
238 | { | ||
239 | /* Fujitsu Lifebook S2000 */ | ||
240 | .matches = { | ||
241 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), | ||
242 | DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook S Series"), | ||
243 | }, | ||
244 | }, | ||
245 | { | ||
246 | /* Fujitsu Lifebook S6230 */ | ||
247 | .matches = { | ||
248 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), | ||
249 | DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook S6230"), | ||
250 | }, | ||
251 | }, | ||
252 | { | ||
253 | /* Fujitsu T70H */ | ||
254 | .matches = { | ||
255 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), | ||
256 | DMI_MATCH(DMI_PRODUCT_NAME, "FMVLT70H"), | ||
257 | }, | ||
258 | }, | ||
259 | { | ||
260 | /* Fujitsu-Siemens Lifebook T3010 */ | ||
261 | .matches = { | ||
262 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), | ||
263 | DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK T3010"), | ||
264 | }, | ||
265 | }, | ||
266 | { | ||
267 | /* Fujitsu-Siemens Lifebook E4010 */ | ||
268 | .matches = { | ||
269 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), | ||
270 | DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E4010"), | ||
271 | }, | ||
272 | }, | ||
273 | { | ||
274 | /* Fujitsu-Siemens Amilo Pro 2010 */ | ||
275 | .matches = { | ||
276 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), | ||
277 | DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pro V2010"), | ||
278 | }, | ||
279 | }, | ||
280 | { | ||
281 | /* Fujitsu-Siemens Amilo Pro 2030 */ | ||
282 | .matches = { | ||
283 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), | ||
284 | DMI_MATCH(DMI_PRODUCT_NAME, "AMILO PRO V2030"), | ||
285 | }, | ||
286 | }, | ||
287 | { | ||
288 | /* | ||
289 | * No data is coming from the touchscreen unless KBC | ||
290 | * is in legacy mode. | ||
291 | */ | ||
292 | /* Panasonic CF-29 */ | ||
293 | .matches = { | ||
294 | DMI_MATCH(DMI_SYS_VENDOR, "Matsushita"), | ||
295 | DMI_MATCH(DMI_PRODUCT_NAME, "CF-29"), | ||
296 | }, | ||
297 | }, | ||
298 | { | ||
299 | /* | ||
300 | * HP Pavilion DV4017EA - | ||
301 | * errors on MUX ports are reported without raising AUXDATA | ||
302 | * causing "spurious NAK" messages. | ||
303 | */ | ||
304 | .matches = { | ||
305 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
306 | DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion dv4000 (EA032EA#ABF)"), | ||
307 | }, | ||
308 | }, | ||
309 | { | ||
310 | /* | ||
311 | * HP Pavilion ZT1000 - | ||
312 | * like DV4017EA does not raise AUXERR for errors on MUX ports. | ||
313 | */ | ||
314 | .matches = { | ||
315 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
316 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion Notebook PC"), | ||
317 | DMI_MATCH(DMI_PRODUCT_VERSION, "HP Pavilion Notebook ZT1000"), | ||
318 | }, | ||
319 | }, | ||
320 | { | ||
321 | /* | ||
322 | * HP Pavilion DV4270ca - | ||
323 | * like DV4017EA does not raise AUXERR for errors on MUX ports. | ||
324 | */ | ||
325 | .matches = { | ||
326 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
327 | DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion dv4000 (EH476UA#ABL)"), | ||
328 | }, | ||
329 | }, | ||
330 | { | ||
331 | .matches = { | ||
332 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | ||
333 | DMI_MATCH(DMI_PRODUCT_NAME, "Satellite P10"), | ||
334 | }, | ||
335 | }, | ||
336 | { | ||
337 | .matches = { | ||
338 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | ||
339 | DMI_MATCH(DMI_PRODUCT_NAME, "EQUIUM A110"), | ||
340 | }, | ||
341 | }, | ||
342 | { | ||
343 | .matches = { | ||
344 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | ||
345 | DMI_MATCH(DMI_PRODUCT_NAME, "SATELLITE C850D"), | ||
346 | }, | ||
347 | }, | ||
348 | { | ||
349 | .matches = { | ||
350 | DMI_MATCH(DMI_SYS_VENDOR, "ALIENWARE"), | ||
351 | DMI_MATCH(DMI_PRODUCT_NAME, "Sentia"), | ||
352 | }, | ||
353 | }, | ||
354 | { | ||
355 | /* Sharp Actius MM20 */ | ||
356 | .matches = { | ||
357 | DMI_MATCH(DMI_SYS_VENDOR, "SHARP"), | ||
358 | DMI_MATCH(DMI_PRODUCT_NAME, "PC-MM20 Series"), | ||
359 | }, | ||
360 | }, | ||
361 | { | ||
362 | /* Sony Vaio FS-115b */ | ||
363 | .matches = { | ||
364 | DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), | ||
365 | DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FS115B"), | ||
366 | }, | ||
367 | }, | ||
368 | { | ||
369 | /* | ||
370 | * Sony Vaio FZ-240E - | ||
371 | * reset and GET ID commands issued via KBD port are | ||
372 | * sometimes being delivered to AUX3. | ||
373 | */ | ||
374 | .matches = { | ||
375 | DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), | ||
376 | DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FZ240E"), | ||
377 | }, | ||
378 | }, | ||
214 | { | 379 | { |
215 | /* | 380 | /* |
216 | * Panasonic CF-18 needs to be in MUX mode since the | 381 | * Most (all?) VAIOs do not have external PS/2 ports nor |
217 | * touchscreen is on serio3 and it also has touchpad. | 382 | * they implement active multiplexing properly, and |
383 | * MUX discovery usually messes up keyboard/touchpad. | ||
218 | */ | 384 | */ |
219 | .matches = { | 385 | .matches = { |
220 | DMI_MATCH(DMI_PRODUCT_NAME, "CF-18"), | 386 | DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), |
387 | DMI_MATCH(DMI_BOARD_NAME, "VAIO"), | ||
388 | }, | ||
389 | }, | ||
390 | { | ||
391 | /* Amoi M636/A737 */ | ||
392 | .matches = { | ||
393 | DMI_MATCH(DMI_SYS_VENDOR, "Amoi Electronics CO.,LTD."), | ||
394 | DMI_MATCH(DMI_PRODUCT_NAME, "M636/A737 platform"), | ||
395 | }, | ||
396 | }, | ||
397 | { | ||
398 | /* Lenovo 3000 n100 */ | ||
399 | .matches = { | ||
400 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | ||
401 | DMI_MATCH(DMI_PRODUCT_NAME, "076804U"), | ||
402 | }, | ||
403 | }, | ||
404 | { | ||
405 | .matches = { | ||
406 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | ||
407 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 1360"), | ||
408 | }, | ||
409 | }, | ||
410 | { | ||
411 | /* Acer Aspire 5710 */ | ||
412 | .matches = { | ||
413 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | ||
414 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5710"), | ||
415 | }, | ||
416 | }, | ||
417 | { | ||
418 | /* Gericom Bellagio */ | ||
419 | .matches = { | ||
420 | DMI_MATCH(DMI_SYS_VENDOR, "Gericom"), | ||
421 | DMI_MATCH(DMI_PRODUCT_NAME, "N34AS6"), | ||
422 | }, | ||
423 | }, | ||
424 | { | ||
425 | /* IBM 2656 */ | ||
426 | .matches = { | ||
427 | DMI_MATCH(DMI_SYS_VENDOR, "IBM"), | ||
428 | DMI_MATCH(DMI_PRODUCT_NAME, "2656"), | ||
429 | }, | ||
430 | }, | ||
431 | { | ||
432 | /* Dell XPS M1530 */ | ||
433 | .matches = { | ||
434 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | ||
435 | DMI_MATCH(DMI_PRODUCT_NAME, "XPS M1530"), | ||
436 | }, | ||
437 | }, | ||
438 | { | ||
439 | /* Compal HEL80I */ | ||
440 | .matches = { | ||
441 | DMI_MATCH(DMI_SYS_VENDOR, "COMPAL"), | ||
442 | DMI_MATCH(DMI_PRODUCT_NAME, "HEL80I"), | ||
443 | }, | ||
444 | }, | ||
445 | { | ||
446 | /* Dell Vostro 1510 */ | ||
447 | .matches = { | ||
448 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | ||
449 | DMI_MATCH(DMI_PRODUCT_NAME, "Vostro1510"), | ||
450 | }, | ||
451 | }, | ||
452 | { | ||
453 | /* Acer Aspire 5536 */ | ||
454 | .matches = { | ||
455 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | ||
456 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5536"), | ||
457 | DMI_MATCH(DMI_PRODUCT_VERSION, "0100"), | ||
458 | }, | ||
459 | }, | ||
460 | { | ||
461 | /* Dell Vostro V13 */ | ||
462 | .matches = { | ||
463 | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), | ||
464 | DMI_MATCH(DMI_PRODUCT_NAME, "Vostro V13"), | ||
465 | }, | ||
466 | }, | ||
467 | { | ||
468 | /* Newer HP Pavilion dv4 models */ | ||
469 | .matches = { | ||
470 | DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
471 | DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv4 Notebook PC"), | ||
472 | }, | ||
473 | }, | ||
474 | { | ||
475 | /* Asus X450LCP */ | ||
476 | .matches = { | ||
477 | DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), | ||
478 | DMI_MATCH(DMI_PRODUCT_NAME, "X450LCP"), | ||
479 | }, | ||
480 | }, | ||
481 | { | ||
482 | /* Avatar AVIU-145A6 */ | ||
483 | .matches = { | ||
484 | DMI_MATCH(DMI_SYS_VENDOR, "Intel"), | ||
485 | DMI_MATCH(DMI_PRODUCT_NAME, "IC4I"), | ||
221 | }, | 486 | }, |
222 | }, | 487 | }, |
223 | { } | 488 | { } |
@@ -364,6 +629,22 @@ static const struct dmi_system_id __initconst i8042_dmi_notimeout_table[] = { | |||
364 | }, | 629 | }, |
365 | }, | 630 | }, |
366 | { | 631 | { |
632 | /* Fujitsu A544 laptop */ | ||
633 | /* https://bugzilla.redhat.com/show_bug.cgi?id=1111138 */ | ||
634 | .matches = { | ||
635 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), | ||
636 | DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK A544"), | ||
637 | }, | ||
638 | }, | ||
639 | { | ||
640 | /* Fujitsu AH544 laptop */ | ||
641 | /* https://bugzilla.kernel.org/show_bug.cgi?id=69731 */ | ||
642 | .matches = { | ||
643 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"), | ||
644 | DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK AH544"), | ||
645 | }, | ||
646 | }, | ||
647 | { | ||
367 | /* Fujitsu U574 laptop */ | 648 | /* Fujitsu U574 laptop */ |
368 | /* https://bugzilla.kernel.org/show_bug.cgi?id=69731 */ | 649 | /* https://bugzilla.kernel.org/show_bug.cgi?id=69731 */ |
369 | .matches = { | 650 | .matches = { |
@@ -740,8 +1021,8 @@ static int __init i8042_platform_init(void) | |||
740 | if (dmi_check_system(i8042_dmi_noloop_table)) | 1021 | if (dmi_check_system(i8042_dmi_noloop_table)) |
741 | i8042_noloop = true; | 1022 | i8042_noloop = true; |
742 | 1023 | ||
743 | if (dmi_check_system(i8042_dmi_mux_table)) | 1024 | if (dmi_check_system(i8042_dmi_nomux_table)) |
744 | i8042_nomux = false; | 1025 | i8042_nomux = true; |
745 | 1026 | ||
746 | if (dmi_check_system(i8042_dmi_notimeout_table)) | 1027 | if (dmi_check_system(i8042_dmi_notimeout_table)) |
747 | i8042_notimeout = true; | 1028 | i8042_notimeout = true; |
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c index 9a97c2b10926..f5a98af3b325 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c | |||
@@ -39,7 +39,7 @@ static bool i8042_noaux; | |||
39 | module_param_named(noaux, i8042_noaux, bool, 0); | 39 | module_param_named(noaux, i8042_noaux, bool, 0); |
40 | MODULE_PARM_DESC(noaux, "Do not probe or use AUX (mouse) port."); | 40 | MODULE_PARM_DESC(noaux, "Do not probe or use AUX (mouse) port."); |
41 | 41 | ||
42 | static bool i8042_nomux = true; | 42 | static bool i8042_nomux; |
43 | module_param_named(nomux, i8042_nomux, bool, 0); | 43 | module_param_named(nomux, i8042_nomux, bool, 0); |
44 | MODULE_PARM_DESC(nomux, "Do not check whether an active multiplexing controller is present."); | 44 | MODULE_PARM_DESC(nomux, "Do not check whether an active multiplexing controller is present."); |
45 | 45 | ||
diff --git a/drivers/input/touchscreen/wm97xx-core.c b/drivers/input/touchscreen/wm97xx-core.c index d0ef91fc87d1..b1ae77995968 100644 --- a/drivers/input/touchscreen/wm97xx-core.c +++ b/drivers/input/touchscreen/wm97xx-core.c | |||
@@ -70,11 +70,11 @@ | |||
70 | * Documentation/input/input-programming.txt for more details. | 70 | * Documentation/input/input-programming.txt for more details. |
71 | */ | 71 | */ |
72 | 72 | ||
73 | static int abs_x[3] = {350, 3900, 5}; | 73 | static int abs_x[3] = {150, 4000, 5}; |
74 | module_param_array(abs_x, int, NULL, 0); | 74 | module_param_array(abs_x, int, NULL, 0); |
75 | MODULE_PARM_DESC(abs_x, "Touchscreen absolute X min, max, fuzz"); | 75 | MODULE_PARM_DESC(abs_x, "Touchscreen absolute X min, max, fuzz"); |
76 | 76 | ||
77 | static int abs_y[3] = {320, 3750, 40}; | 77 | static int abs_y[3] = {200, 4000, 40}; |
78 | module_param_array(abs_y, int, NULL, 0); | 78 | module_param_array(abs_y, int, NULL, 0); |
79 | MODULE_PARM_DESC(abs_y, "Touchscreen absolute Y min, max, fuzz"); | 79 | MODULE_PARM_DESC(abs_y, "Touchscreen absolute Y min, max, fuzz"); |
80 | 80 | ||
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c index 3e238cd049e6..6a2e168c3ab0 100644 --- a/drivers/irqchip/irq-armada-370-xp.c +++ b/drivers/irqchip/irq-armada-370-xp.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #define ARMADA_370_XP_INT_CLEAR_ENABLE_OFFS (0x34) | 43 | #define ARMADA_370_XP_INT_CLEAR_ENABLE_OFFS (0x34) |
44 | #define ARMADA_370_XP_INT_SOURCE_CTL(irq) (0x100 + irq*4) | 44 | #define ARMADA_370_XP_INT_SOURCE_CTL(irq) (0x100 + irq*4) |
45 | #define ARMADA_370_XP_INT_SOURCE_CPU_MASK 0xF | 45 | #define ARMADA_370_XP_INT_SOURCE_CPU_MASK 0xF |
46 | #define ARMADA_370_XP_INT_IRQ_FIQ_MASK(cpuid) ((BIT(0) | BIT(8)) << cpuid) | ||
46 | 47 | ||
47 | #define ARMADA_370_XP_CPU_INTACK_OFFS (0x44) | 48 | #define ARMADA_370_XP_CPU_INTACK_OFFS (0x44) |
48 | #define ARMADA_375_PPI_CAUSE (0x10) | 49 | #define ARMADA_375_PPI_CAUSE (0x10) |
@@ -406,19 +407,29 @@ static void armada_370_xp_mpic_handle_cascade_irq(unsigned int irq, | |||
406 | struct irq_desc *desc) | 407 | struct irq_desc *desc) |
407 | { | 408 | { |
408 | struct irq_chip *chip = irq_get_chip(irq); | 409 | struct irq_chip *chip = irq_get_chip(irq); |
409 | unsigned long irqmap, irqn; | 410 | unsigned long irqmap, irqn, irqsrc, cpuid; |
410 | unsigned int cascade_irq; | 411 | unsigned int cascade_irq; |
411 | 412 | ||
412 | chained_irq_enter(chip, desc); | 413 | chained_irq_enter(chip, desc); |
413 | 414 | ||
414 | irqmap = readl_relaxed(per_cpu_int_base + ARMADA_375_PPI_CAUSE); | 415 | irqmap = readl_relaxed(per_cpu_int_base + ARMADA_375_PPI_CAUSE); |
415 | 416 | cpuid = cpu_logical_map(smp_processor_id()); | |
416 | if (irqmap & BIT(0)) { | ||
417 | armada_370_xp_handle_msi_irq(NULL, true); | ||
418 | irqmap &= ~BIT(0); | ||
419 | } | ||
420 | 417 | ||
421 | for_each_set_bit(irqn, &irqmap, BITS_PER_LONG) { | 418 | for_each_set_bit(irqn, &irqmap, BITS_PER_LONG) { |
419 | irqsrc = readl_relaxed(main_int_base + | ||
420 | ARMADA_370_XP_INT_SOURCE_CTL(irqn)); | ||
421 | |||
422 | /* Check if the interrupt is not masked on current CPU. | ||
423 | * Test IRQ (0-1) and FIQ (8-9) mask bits. | ||
424 | */ | ||
425 | if (!(irqsrc & ARMADA_370_XP_INT_IRQ_FIQ_MASK(cpuid))) | ||
426 | continue; | ||
427 | |||
428 | if (irqn == 1) { | ||
429 | armada_370_xp_handle_msi_irq(NULL, true); | ||
430 | continue; | ||
431 | } | ||
432 | |||
422 | cascade_irq = irq_find_mapping(armada_370_xp_mpic_domain, irqn); | 433 | cascade_irq = irq_find_mapping(armada_370_xp_mpic_domain, irqn); |
423 | generic_handle_irq(cascade_irq); | 434 | generic_handle_irq(cascade_irq); |
424 | } | 435 | } |
diff --git a/drivers/md/dm-bufio.c b/drivers/md/dm-bufio.c index 825ca1f87639..afe79719ea32 100644 --- a/drivers/md/dm-bufio.c +++ b/drivers/md/dm-bufio.c | |||
@@ -1434,9 +1434,9 @@ static void drop_buffers(struct dm_bufio_client *c) | |||
1434 | 1434 | ||
1435 | /* | 1435 | /* |
1436 | * Test if the buffer is unused and too old, and commit it. | 1436 | * Test if the buffer is unused and too old, and commit it. |
1437 | * At if noio is set, we must not do any I/O because we hold | 1437 | * And if GFP_NOFS is used, we must not do any I/O because we hold |
1438 | * dm_bufio_clients_lock and we would risk deadlock if the I/O gets rerouted to | 1438 | * dm_bufio_clients_lock and we would risk deadlock if the I/O gets |
1439 | * different bufio client. | 1439 | * rerouted to different bufio client. |
1440 | */ | 1440 | */ |
1441 | static int __cleanup_old_buffer(struct dm_buffer *b, gfp_t gfp, | 1441 | static int __cleanup_old_buffer(struct dm_buffer *b, gfp_t gfp, |
1442 | unsigned long max_jiffies) | 1442 | unsigned long max_jiffies) |
@@ -1444,7 +1444,7 @@ static int __cleanup_old_buffer(struct dm_buffer *b, gfp_t gfp, | |||
1444 | if (jiffies - b->last_accessed < max_jiffies) | 1444 | if (jiffies - b->last_accessed < max_jiffies) |
1445 | return 0; | 1445 | return 0; |
1446 | 1446 | ||
1447 | if (!(gfp & __GFP_IO)) { | 1447 | if (!(gfp & __GFP_FS)) { |
1448 | if (test_bit(B_READING, &b->state) || | 1448 | if (test_bit(B_READING, &b->state) || |
1449 | test_bit(B_WRITING, &b->state) || | 1449 | test_bit(B_WRITING, &b->state) || |
1450 | test_bit(B_DIRTY, &b->state)) | 1450 | test_bit(B_DIRTY, &b->state)) |
@@ -1486,7 +1486,7 @@ dm_bufio_shrink_scan(struct shrinker *shrink, struct shrink_control *sc) | |||
1486 | unsigned long freed; | 1486 | unsigned long freed; |
1487 | 1487 | ||
1488 | c = container_of(shrink, struct dm_bufio_client, shrinker); | 1488 | c = container_of(shrink, struct dm_bufio_client, shrinker); |
1489 | if (sc->gfp_mask & __GFP_IO) | 1489 | if (sc->gfp_mask & __GFP_FS) |
1490 | dm_bufio_lock(c); | 1490 | dm_bufio_lock(c); |
1491 | else if (!dm_bufio_trylock(c)) | 1491 | else if (!dm_bufio_trylock(c)) |
1492 | return SHRINK_STOP; | 1492 | return SHRINK_STOP; |
@@ -1503,7 +1503,7 @@ dm_bufio_shrink_count(struct shrinker *shrink, struct shrink_control *sc) | |||
1503 | unsigned long count; | 1503 | unsigned long count; |
1504 | 1504 | ||
1505 | c = container_of(shrink, struct dm_bufio_client, shrinker); | 1505 | c = container_of(shrink, struct dm_bufio_client, shrinker); |
1506 | if (sc->gfp_mask & __GFP_IO) | 1506 | if (sc->gfp_mask & __GFP_FS) |
1507 | dm_bufio_lock(c); | 1507 | dm_bufio_lock(c); |
1508 | else if (!dm_bufio_trylock(c)) | 1508 | else if (!dm_bufio_trylock(c)) |
1509 | return 0; | 1509 | return 0; |
diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c index 4857fa4a5484..07c0fa0fa284 100644 --- a/drivers/md/dm-raid.c +++ b/drivers/md/dm-raid.c | |||
@@ -789,8 +789,7 @@ struct dm_raid_superblock { | |||
789 | __le32 layout; | 789 | __le32 layout; |
790 | __le32 stripe_sectors; | 790 | __le32 stripe_sectors; |
791 | 791 | ||
792 | __u8 pad[452]; /* Round struct to 512 bytes. */ | 792 | /* Remainder of a logical block is zero-filled when writing (see super_sync()). */ |
793 | /* Always set to 0 when writing. */ | ||
794 | } __packed; | 793 | } __packed; |
795 | 794 | ||
796 | static int read_disk_sb(struct md_rdev *rdev, int size) | 795 | static int read_disk_sb(struct md_rdev *rdev, int size) |
@@ -827,7 +826,7 @@ static void super_sync(struct mddev *mddev, struct md_rdev *rdev) | |||
827 | test_bit(Faulty, &(rs->dev[i].rdev.flags))) | 826 | test_bit(Faulty, &(rs->dev[i].rdev.flags))) |
828 | failed_devices |= (1ULL << i); | 827 | failed_devices |= (1ULL << i); |
829 | 828 | ||
830 | memset(sb, 0, sizeof(*sb)); | 829 | memset(sb + 1, 0, rdev->sb_size - sizeof(*sb)); |
831 | 830 | ||
832 | sb->magic = cpu_to_le32(DM_RAID_MAGIC); | 831 | sb->magic = cpu_to_le32(DM_RAID_MAGIC); |
833 | sb->features = cpu_to_le32(0); /* No features yet */ | 832 | sb->features = cpu_to_le32(0); /* No features yet */ |
@@ -862,7 +861,11 @@ static int super_load(struct md_rdev *rdev, struct md_rdev *refdev) | |||
862 | uint64_t events_sb, events_refsb; | 861 | uint64_t events_sb, events_refsb; |
863 | 862 | ||
864 | rdev->sb_start = 0; | 863 | rdev->sb_start = 0; |
865 | rdev->sb_size = sizeof(*sb); | 864 | rdev->sb_size = bdev_logical_block_size(rdev->meta_bdev); |
865 | if (rdev->sb_size < sizeof(*sb) || rdev->sb_size > PAGE_SIZE) { | ||
866 | DMERR("superblock size of a logical block is no longer valid"); | ||
867 | return -EINVAL; | ||
868 | } | ||
866 | 869 | ||
867 | ret = read_disk_sb(rdev, rdev->sb_size); | 870 | ret = read_disk_sb(rdev, rdev->sb_size); |
868 | if (ret) | 871 | if (ret) |
@@ -1169,8 +1172,12 @@ static void configure_discard_support(struct dm_target *ti, struct raid_set *rs) | |||
1169 | raid456 = (rs->md.level == 4 || rs->md.level == 5 || rs->md.level == 6); | 1172 | raid456 = (rs->md.level == 4 || rs->md.level == 5 || rs->md.level == 6); |
1170 | 1173 | ||
1171 | for (i = 0; i < rs->md.raid_disks; i++) { | 1174 | for (i = 0; i < rs->md.raid_disks; i++) { |
1172 | struct request_queue *q = bdev_get_queue(rs->dev[i].rdev.bdev); | 1175 | struct request_queue *q; |
1176 | |||
1177 | if (!rs->dev[i].rdev.bdev) | ||
1178 | continue; | ||
1173 | 1179 | ||
1180 | q = bdev_get_queue(rs->dev[i].rdev.bdev); | ||
1174 | if (!q || !blk_queue_discard(q)) | 1181 | if (!q || !blk_queue_discard(q)) |
1175 | return; | 1182 | return; |
1176 | 1183 | ||
diff --git a/drivers/md/dm-stripe.c b/drivers/md/dm-stripe.c index d1600d2aa2e2..f8b37d4c05d8 100644 --- a/drivers/md/dm-stripe.c +++ b/drivers/md/dm-stripe.c | |||
@@ -159,8 +159,10 @@ static int stripe_ctr(struct dm_target *ti, unsigned int argc, char **argv) | |||
159 | sc->stripes_shift = __ffs(stripes); | 159 | sc->stripes_shift = __ffs(stripes); |
160 | 160 | ||
161 | r = dm_set_target_max_io_len(ti, chunk_size); | 161 | r = dm_set_target_max_io_len(ti, chunk_size); |
162 | if (r) | 162 | if (r) { |
163 | kfree(sc); | ||
163 | return r; | 164 | return r; |
165 | } | ||
164 | 166 | ||
165 | ti->num_flush_bios = stripes; | 167 | ti->num_flush_bios = stripes; |
166 | ti->num_discard_bios = stripes; | 168 | ti->num_discard_bios = stripes; |
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index 4843801173fe..0f86d802b533 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c | |||
@@ -1936,6 +1936,14 @@ static int thin_bio_map(struct dm_target *ti, struct bio *bio) | |||
1936 | return DM_MAPIO_SUBMITTED; | 1936 | return DM_MAPIO_SUBMITTED; |
1937 | } | 1937 | } |
1938 | 1938 | ||
1939 | /* | ||
1940 | * We must hold the virtual cell before doing the lookup, otherwise | ||
1941 | * there's a race with discard. | ||
1942 | */ | ||
1943 | build_virtual_key(tc->td, block, &key); | ||
1944 | if (dm_bio_detain(tc->pool->prison, &key, bio, &cell1, &cell_result)) | ||
1945 | return DM_MAPIO_SUBMITTED; | ||
1946 | |||
1939 | r = dm_thin_find_block(td, block, 0, &result); | 1947 | r = dm_thin_find_block(td, block, 0, &result); |
1940 | 1948 | ||
1941 | /* | 1949 | /* |
@@ -1959,13 +1967,10 @@ static int thin_bio_map(struct dm_target *ti, struct bio *bio) | |||
1959 | * shared flag will be set in their case. | 1967 | * shared flag will be set in their case. |
1960 | */ | 1968 | */ |
1961 | thin_defer_bio(tc, bio); | 1969 | thin_defer_bio(tc, bio); |
1970 | cell_defer_no_holder_no_free(tc, &cell1); | ||
1962 | return DM_MAPIO_SUBMITTED; | 1971 | return DM_MAPIO_SUBMITTED; |
1963 | } | 1972 | } |
1964 | 1973 | ||
1965 | build_virtual_key(tc->td, block, &key); | ||
1966 | if (dm_bio_detain(tc->pool->prison, &key, bio, &cell1, &cell_result)) | ||
1967 | return DM_MAPIO_SUBMITTED; | ||
1968 | |||
1969 | build_data_key(tc->td, result.block, &key); | 1974 | build_data_key(tc->td, result.block, &key); |
1970 | if (dm_bio_detain(tc->pool->prison, &key, bio, &cell2, &cell_result)) { | 1975 | if (dm_bio_detain(tc->pool->prison, &key, bio, &cell2, &cell_result)) { |
1971 | cell_defer_no_holder_no_free(tc, &cell1); | 1976 | cell_defer_no_holder_no_free(tc, &cell1); |
@@ -1986,6 +1991,7 @@ static int thin_bio_map(struct dm_target *ti, struct bio *bio) | |||
1986 | * of doing so. | 1991 | * of doing so. |
1987 | */ | 1992 | */ |
1988 | handle_unserviceable_bio(tc->pool, bio); | 1993 | handle_unserviceable_bio(tc->pool, bio); |
1994 | cell_defer_no_holder_no_free(tc, &cell1); | ||
1989 | return DM_MAPIO_SUBMITTED; | 1995 | return DM_MAPIO_SUBMITTED; |
1990 | } | 1996 | } |
1991 | /* fall through */ | 1997 | /* fall through */ |
@@ -1996,6 +2002,7 @@ static int thin_bio_map(struct dm_target *ti, struct bio *bio) | |||
1996 | * provide the hint to load the metadata into cache. | 2002 | * provide the hint to load the metadata into cache. |
1997 | */ | 2003 | */ |
1998 | thin_defer_bio(tc, bio); | 2004 | thin_defer_bio(tc, bio); |
2005 | cell_defer_no_holder_no_free(tc, &cell1); | ||
1999 | return DM_MAPIO_SUBMITTED; | 2006 | return DM_MAPIO_SUBMITTED; |
2000 | 2007 | ||
2001 | default: | 2008 | default: |
@@ -2005,6 +2012,7 @@ static int thin_bio_map(struct dm_target *ti, struct bio *bio) | |||
2005 | * pool is switched to fail-io mode. | 2012 | * pool is switched to fail-io mode. |
2006 | */ | 2013 | */ |
2007 | bio_io_error(bio); | 2014 | bio_io_error(bio); |
2015 | cell_defer_no_holder_no_free(tc, &cell1); | ||
2008 | return DM_MAPIO_SUBMITTED; | 2016 | return DM_MAPIO_SUBMITTED; |
2009 | } | 2017 | } |
2010 | } | 2018 | } |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 4dfa15da9cb8..9233c71138f1 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -5121,6 +5121,7 @@ static int md_set_readonly(struct mddev *mddev, struct block_device *bdev) | |||
5121 | printk("md: %s still in use.\n",mdname(mddev)); | 5121 | printk("md: %s still in use.\n",mdname(mddev)); |
5122 | if (did_freeze) { | 5122 | if (did_freeze) { |
5123 | clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); | 5123 | clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); |
5124 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); | ||
5124 | md_wakeup_thread(mddev->thread); | 5125 | md_wakeup_thread(mddev->thread); |
5125 | } | 5126 | } |
5126 | err = -EBUSY; | 5127 | err = -EBUSY; |
@@ -5135,6 +5136,8 @@ static int md_set_readonly(struct mddev *mddev, struct block_device *bdev) | |||
5135 | mddev->ro = 1; | 5136 | mddev->ro = 1; |
5136 | set_disk_ro(mddev->gendisk, 1); | 5137 | set_disk_ro(mddev->gendisk, 1); |
5137 | clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); | 5138 | clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); |
5139 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); | ||
5140 | md_wakeup_thread(mddev->thread); | ||
5138 | sysfs_notify_dirent_safe(mddev->sysfs_state); | 5141 | sysfs_notify_dirent_safe(mddev->sysfs_state); |
5139 | err = 0; | 5142 | err = 0; |
5140 | } | 5143 | } |
@@ -5178,6 +5181,7 @@ static int do_md_stop(struct mddev *mddev, int mode, | |||
5178 | mutex_unlock(&mddev->open_mutex); | 5181 | mutex_unlock(&mddev->open_mutex); |
5179 | if (did_freeze) { | 5182 | if (did_freeze) { |
5180 | clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); | 5183 | clear_bit(MD_RECOVERY_FROZEN, &mddev->recovery); |
5184 | set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); | ||
5181 | md_wakeup_thread(mddev->thread); | 5185 | md_wakeup_thread(mddev->thread); |
5182 | } | 5186 | } |
5183 | return -EBUSY; | 5187 | return -EBUSY; |
diff --git a/drivers/md/persistent-data/dm-btree-internal.h b/drivers/md/persistent-data/dm-btree-internal.h index 37d367bb9aa8..bf2b80d5c470 100644 --- a/drivers/md/persistent-data/dm-btree-internal.h +++ b/drivers/md/persistent-data/dm-btree-internal.h | |||
@@ -42,6 +42,12 @@ struct btree_node { | |||
42 | } __packed; | 42 | } __packed; |
43 | 43 | ||
44 | 44 | ||
45 | /* | ||
46 | * Locks a block using the btree node validator. | ||
47 | */ | ||
48 | int bn_read_lock(struct dm_btree_info *info, dm_block_t b, | ||
49 | struct dm_block **result); | ||
50 | |||
45 | void inc_children(struct dm_transaction_manager *tm, struct btree_node *n, | 51 | void inc_children(struct dm_transaction_manager *tm, struct btree_node *n, |
46 | struct dm_btree_value_type *vt); | 52 | struct dm_btree_value_type *vt); |
47 | 53 | ||
diff --git a/drivers/md/persistent-data/dm-btree-spine.c b/drivers/md/persistent-data/dm-btree-spine.c index cf9fd676ae44..1b5e13ec7f96 100644 --- a/drivers/md/persistent-data/dm-btree-spine.c +++ b/drivers/md/persistent-data/dm-btree-spine.c | |||
@@ -92,7 +92,7 @@ struct dm_block_validator btree_node_validator = { | |||
92 | 92 | ||
93 | /*----------------------------------------------------------------*/ | 93 | /*----------------------------------------------------------------*/ |
94 | 94 | ||
95 | static int bn_read_lock(struct dm_btree_info *info, dm_block_t b, | 95 | int bn_read_lock(struct dm_btree_info *info, dm_block_t b, |
96 | struct dm_block **result) | 96 | struct dm_block **result) |
97 | { | 97 | { |
98 | return dm_tm_read_lock(info->tm, b, &btree_node_validator, result); | 98 | return dm_tm_read_lock(info->tm, b, &btree_node_validator, result); |
diff --git a/drivers/md/persistent-data/dm-btree.c b/drivers/md/persistent-data/dm-btree.c index 416060c25709..200ac12a1d40 100644 --- a/drivers/md/persistent-data/dm-btree.c +++ b/drivers/md/persistent-data/dm-btree.c | |||
@@ -847,22 +847,26 @@ EXPORT_SYMBOL_GPL(dm_btree_find_lowest_key); | |||
847 | * FIXME: We shouldn't use a recursive algorithm when we have limited stack | 847 | * FIXME: We shouldn't use a recursive algorithm when we have limited stack |
848 | * space. Also this only works for single level trees. | 848 | * space. Also this only works for single level trees. |
849 | */ | 849 | */ |
850 | static int walk_node(struct ro_spine *s, dm_block_t block, | 850 | static int walk_node(struct dm_btree_info *info, dm_block_t block, |
851 | int (*fn)(void *context, uint64_t *keys, void *leaf), | 851 | int (*fn)(void *context, uint64_t *keys, void *leaf), |
852 | void *context) | 852 | void *context) |
853 | { | 853 | { |
854 | int r; | 854 | int r; |
855 | unsigned i, nr; | 855 | unsigned i, nr; |
856 | struct dm_block *node; | ||
856 | struct btree_node *n; | 857 | struct btree_node *n; |
857 | uint64_t keys; | 858 | uint64_t keys; |
858 | 859 | ||
859 | r = ro_step(s, block); | 860 | r = bn_read_lock(info, block, &node); |
860 | n = ro_node(s); | 861 | if (r) |
862 | return r; | ||
863 | |||
864 | n = dm_block_data(node); | ||
861 | 865 | ||
862 | nr = le32_to_cpu(n->header.nr_entries); | 866 | nr = le32_to_cpu(n->header.nr_entries); |
863 | for (i = 0; i < nr; i++) { | 867 | for (i = 0; i < nr; i++) { |
864 | if (le32_to_cpu(n->header.flags) & INTERNAL_NODE) { | 868 | if (le32_to_cpu(n->header.flags) & INTERNAL_NODE) { |
865 | r = walk_node(s, value64(n, i), fn, context); | 869 | r = walk_node(info, value64(n, i), fn, context); |
866 | if (r) | 870 | if (r) |
867 | goto out; | 871 | goto out; |
868 | } else { | 872 | } else { |
@@ -874,7 +878,7 @@ static int walk_node(struct ro_spine *s, dm_block_t block, | |||
874 | } | 878 | } |
875 | 879 | ||
876 | out: | 880 | out: |
877 | ro_pop(s); | 881 | dm_tm_unlock(info->tm, node); |
878 | return r; | 882 | return r; |
879 | } | 883 | } |
880 | 884 | ||
@@ -882,15 +886,7 @@ int dm_btree_walk(struct dm_btree_info *info, dm_block_t root, | |||
882 | int (*fn)(void *context, uint64_t *keys, void *leaf), | 886 | int (*fn)(void *context, uint64_t *keys, void *leaf), |
883 | void *context) | 887 | void *context) |
884 | { | 888 | { |
885 | int r; | ||
886 | struct ro_spine spine; | ||
887 | |||
888 | BUG_ON(info->levels > 1); | 889 | BUG_ON(info->levels > 1); |
889 | 890 | return walk_node(info, root, fn, context); | |
890 | init_ro_spine(&spine, info); | ||
891 | r = walk_node(&spine, root, fn, context); | ||
892 | exit_ro_spine(&spine); | ||
893 | |||
894 | return r; | ||
895 | } | 891 | } |
896 | EXPORT_SYMBOL_GPL(dm_btree_walk); | 892 | EXPORT_SYMBOL_GPL(dm_btree_walk); |
diff --git a/drivers/media/common/saa7146/saa7146_core.c b/drivers/media/common/saa7146/saa7146_core.c index 97afee672d07..4418119cf707 100644 --- a/drivers/media/common/saa7146/saa7146_core.c +++ b/drivers/media/common/saa7146/saa7146_core.c | |||
@@ -364,6 +364,9 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent | |||
364 | goto out; | 364 | goto out; |
365 | } | 365 | } |
366 | 366 | ||
367 | /* create a nice device name */ | ||
368 | sprintf(dev->name, "saa7146 (%d)", saa7146_num); | ||
369 | |||
367 | DEB_EE("pci:%p\n", pci); | 370 | DEB_EE("pci:%p\n", pci); |
368 | 371 | ||
369 | err = pci_enable_device(pci); | 372 | err = pci_enable_device(pci); |
@@ -438,9 +441,6 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent | |||
438 | 441 | ||
439 | /* the rest + print status message */ | 442 | /* the rest + print status message */ |
440 | 443 | ||
441 | /* create a nice device name */ | ||
442 | sprintf(dev->name, "saa7146 (%d)", saa7146_num); | ||
443 | |||
444 | pr_info("found saa7146 @ mem %p (revision %d, irq %d) (0x%04x,0x%04x)\n", | 444 | pr_info("found saa7146 @ mem %p (revision %d, irq %d) (0x%04x,0x%04x)\n", |
445 | dev->mem, dev->revision, pci->irq, | 445 | dev->mem, dev->revision, pci->irq, |
446 | pci->subsystem_vendor, pci->subsystem_device); | 446 | pci->subsystem_vendor, pci->subsystem_device); |
diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index b8579ee68bd6..2cf30576bf39 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c | |||
@@ -962,6 +962,11 @@ static int dvb_frontend_clear_cache(struct dvb_frontend *fe) | |||
962 | case SYS_ATSC: | 962 | case SYS_ATSC: |
963 | c->modulation = VSB_8; | 963 | c->modulation = VSB_8; |
964 | break; | 964 | break; |
965 | case SYS_ISDBS: | ||
966 | c->symbol_rate = 28860000; | ||
967 | c->rolloff = ROLLOFF_35; | ||
968 | c->bandwidth_hz = c->symbol_rate / 100 * 135; | ||
969 | break; | ||
965 | default: | 970 | default: |
966 | c->modulation = QAM_AUTO; | 971 | c->modulation = QAM_AUTO; |
967 | break; | 972 | break; |
@@ -2072,6 +2077,7 @@ static int dtv_set_frontend(struct dvb_frontend *fe) | |||
2072 | break; | 2077 | break; |
2073 | case SYS_DVBS: | 2078 | case SYS_DVBS: |
2074 | case SYS_TURBO: | 2079 | case SYS_TURBO: |
2080 | case SYS_ISDBS: | ||
2075 | rolloff = 135; | 2081 | rolloff = 135; |
2076 | break; | 2082 | break; |
2077 | case SYS_DVBS2: | 2083 | case SYS_DVBS2: |
diff --git a/drivers/media/dvb-frontends/ds3000.c b/drivers/media/dvb-frontends/ds3000.c index 335daeff91b9..9d0d0347758f 100644 --- a/drivers/media/dvb-frontends/ds3000.c +++ b/drivers/media/dvb-frontends/ds3000.c | |||
@@ -864,6 +864,13 @@ struct dvb_frontend *ds3000_attach(const struct ds3000_config *config, | |||
864 | memcpy(&state->frontend.ops, &ds3000_ops, | 864 | memcpy(&state->frontend.ops, &ds3000_ops, |
865 | sizeof(struct dvb_frontend_ops)); | 865 | sizeof(struct dvb_frontend_ops)); |
866 | state->frontend.demodulator_priv = state; | 866 | state->frontend.demodulator_priv = state; |
867 | |||
868 | /* | ||
869 | * Some devices like T480 starts with voltage on. Be sure | ||
870 | * to turn voltage off during init, as this can otherwise | ||
871 | * interfere with Unicable SCR systems. | ||
872 | */ | ||
873 | ds3000_set_voltage(&state->frontend, SEC_VOLTAGE_OFF); | ||
867 | return &state->frontend; | 874 | return &state->frontend; |
868 | 875 | ||
869 | error3: | 876 | error3: |
diff --git a/drivers/media/dvb-frontends/sp2.c b/drivers/media/dvb-frontends/sp2.c index 9b684d5c8f91..15bf4318cb74 100644 --- a/drivers/media/dvb-frontends/sp2.c +++ b/drivers/media/dvb-frontends/sp2.c | |||
@@ -266,7 +266,7 @@ int sp2_ci_poll_slot_status(struct dvb_ca_en50221 *en50221, | |||
266 | return s->status; | 266 | return s->status; |
267 | } | 267 | } |
268 | 268 | ||
269 | int sp2_init(struct sp2 *s) | 269 | static int sp2_init(struct sp2 *s) |
270 | { | 270 | { |
271 | int ret = 0; | 271 | int ret = 0; |
272 | u8 buf; | 272 | u8 buf; |
@@ -348,7 +348,7 @@ err: | |||
348 | return ret; | 348 | return ret; |
349 | } | 349 | } |
350 | 350 | ||
351 | int sp2_exit(struct i2c_client *client) | 351 | static int sp2_exit(struct i2c_client *client) |
352 | { | 352 | { |
353 | struct sp2 *s; | 353 | struct sp2 *s; |
354 | 354 | ||
diff --git a/drivers/media/dvb-frontends/tc90522.c b/drivers/media/dvb-frontends/tc90522.c index d9905fb52f84..b35d65c9cc05 100644 --- a/drivers/media/dvb-frontends/tc90522.c +++ b/drivers/media/dvb-frontends/tc90522.c | |||
@@ -216,32 +216,30 @@ static int tc90522s_get_frontend(struct dvb_frontend *fe) | |||
216 | c->delivery_system = SYS_ISDBS; | 216 | c->delivery_system = SYS_ISDBS; |
217 | 217 | ||
218 | layers = 0; | 218 | layers = 0; |
219 | ret = reg_read(state, 0xe8, val, 3); | 219 | ret = reg_read(state, 0xe6, val, 5); |
220 | if (ret == 0) { | 220 | if (ret == 0) { |
221 | int slots; | ||
222 | u8 v; | 221 | u8 v; |
223 | 222 | ||
223 | c->stream_id = val[0] << 8 | val[1]; | ||
224 | |||
224 | /* high/single layer */ | 225 | /* high/single layer */ |
225 | v = (val[0] & 0x70) >> 4; | 226 | v = (val[2] & 0x70) >> 4; |
226 | c->modulation = (v == 7) ? PSK_8 : QPSK; | 227 | c->modulation = (v == 7) ? PSK_8 : QPSK; |
227 | c->fec_inner = fec_conv_sat[v]; | 228 | c->fec_inner = fec_conv_sat[v]; |
228 | c->layer[0].fec = c->fec_inner; | 229 | c->layer[0].fec = c->fec_inner; |
229 | c->layer[0].modulation = c->modulation; | 230 | c->layer[0].modulation = c->modulation; |
230 | c->layer[0].segment_count = val[1] & 0x3f; /* slots */ | 231 | c->layer[0].segment_count = val[3] & 0x3f; /* slots */ |
231 | 232 | ||
232 | /* low layer */ | 233 | /* low layer */ |
233 | v = (val[0] & 0x07); | 234 | v = (val[2] & 0x07); |
234 | c->layer[1].fec = fec_conv_sat[v]; | 235 | c->layer[1].fec = fec_conv_sat[v]; |
235 | if (v == 0) /* no low layer */ | 236 | if (v == 0) /* no low layer */ |
236 | c->layer[1].segment_count = 0; | 237 | c->layer[1].segment_count = 0; |
237 | else | 238 | else |
238 | c->layer[1].segment_count = val[2] & 0x3f; /* slots */ | 239 | c->layer[1].segment_count = val[4] & 0x3f; /* slots */ |
239 | /* actually, BPSK if v==1, but not defined in fe_modulation_t */ | 240 | /* actually, BPSK if v==1, but not defined in fe_modulation_t */ |
240 | c->layer[1].modulation = QPSK; | 241 | c->layer[1].modulation = QPSK; |
241 | layers = (v > 0) ? 2 : 1; | 242 | layers = (v > 0) ? 2 : 1; |
242 | |||
243 | slots = c->layer[0].segment_count + c->layer[1].segment_count; | ||
244 | c->symbol_rate = 28860000 * slots / 48; | ||
245 | } | 243 | } |
246 | 244 | ||
247 | /* statistics */ | 245 | /* statistics */ |
@@ -363,7 +361,7 @@ static int tc90522t_get_frontend(struct dvb_frontend *fe) | |||
363 | u8 v; | 361 | u8 v; |
364 | 362 | ||
365 | c->isdbt_partial_reception = val[0] & 0x01; | 363 | c->isdbt_partial_reception = val[0] & 0x01; |
366 | c->isdbt_sb_mode = (val[0] & 0xc0) == 0x01; | 364 | c->isdbt_sb_mode = (val[0] & 0xc0) == 0x40; |
367 | 365 | ||
368 | /* layer A */ | 366 | /* layer A */ |
369 | v = (val[2] & 0x78) >> 3; | 367 | v = (val[2] & 0x78) >> 3; |
diff --git a/drivers/media/pci/cx23885/cx23885-dvb.c b/drivers/media/pci/cx23885/cx23885-dvb.c index 13734b8c7917..4cb90317ff45 100644 --- a/drivers/media/pci/cx23885/cx23885-dvb.c +++ b/drivers/media/pci/cx23885/cx23885-dvb.c | |||
@@ -1600,6 +1600,7 @@ static int dvb_register(struct cx23885_tsport *port) | |||
1600 | break; | 1600 | break; |
1601 | 1601 | ||
1602 | /* attach tuner */ | 1602 | /* attach tuner */ |
1603 | memset(&m88ts2022_config, 0, sizeof(m88ts2022_config)); | ||
1603 | m88ts2022_config.fe = fe0->dvb.frontend; | 1604 | m88ts2022_config.fe = fe0->dvb.frontend; |
1604 | m88ts2022_config.clock = 27000000; | 1605 | m88ts2022_config.clock = 27000000; |
1605 | memset(&info, 0, sizeof(struct i2c_board_info)); | 1606 | memset(&info, 0, sizeof(struct i2c_board_info)); |
@@ -1635,6 +1636,7 @@ static int dvb_register(struct cx23885_tsport *port) | |||
1635 | /* port c - terrestrial/cable */ | 1636 | /* port c - terrestrial/cable */ |
1636 | case 2: | 1637 | case 2: |
1637 | /* attach frontend */ | 1638 | /* attach frontend */ |
1639 | memset(&si2168_config, 0, sizeof(si2168_config)); | ||
1638 | si2168_config.i2c_adapter = &adapter; | 1640 | si2168_config.i2c_adapter = &adapter; |
1639 | si2168_config.fe = &fe0->dvb.frontend; | 1641 | si2168_config.fe = &fe0->dvb.frontend; |
1640 | si2168_config.ts_mode = SI2168_TS_SERIAL; | 1642 | si2168_config.ts_mode = SI2168_TS_SERIAL; |
@@ -1654,6 +1656,7 @@ static int dvb_register(struct cx23885_tsport *port) | |||
1654 | port->i2c_client_demod = client_demod; | 1656 | port->i2c_client_demod = client_demod; |
1655 | 1657 | ||
1656 | /* attach tuner */ | 1658 | /* attach tuner */ |
1659 | memset(&si2157_config, 0, sizeof(si2157_config)); | ||
1657 | si2157_config.fe = fe0->dvb.frontend; | 1660 | si2157_config.fe = fe0->dvb.frontend; |
1658 | memset(&info, 0, sizeof(struct i2c_board_info)); | 1661 | memset(&info, 0, sizeof(struct i2c_board_info)); |
1659 | strlcpy(info.type, "si2157", I2C_NAME_SIZE); | 1662 | strlcpy(info.type, "si2157", I2C_NAME_SIZE); |
diff --git a/drivers/media/pci/tw68/Kconfig b/drivers/media/pci/tw68/Kconfig index 5425ba1e320d..95d5d5202048 100644 --- a/drivers/media/pci/tw68/Kconfig +++ b/drivers/media/pci/tw68/Kconfig | |||
@@ -1,7 +1,6 @@ | |||
1 | config VIDEO_TW68 | 1 | config VIDEO_TW68 |
2 | tristate "Techwell tw68x Video For Linux" | 2 | tristate "Techwell tw68x Video For Linux" |
3 | depends on VIDEO_DEV && PCI && VIDEO_V4L2 | 3 | depends on VIDEO_DEV && PCI && VIDEO_V4L2 |
4 | select I2C_ALGOBIT | ||
5 | select VIDEOBUF2_DMA_SG | 4 | select VIDEOBUF2_DMA_SG |
6 | ---help--- | 5 | ---help--- |
7 | Support for Techwell tw68xx based frame grabber boards. | 6 | Support for Techwell tw68xx based frame grabber boards. |
diff --git a/drivers/media/pci/tw68/tw68-core.c b/drivers/media/pci/tw68/tw68-core.c index a6fb48cf7aae..63f0b64057cb 100644 --- a/drivers/media/pci/tw68/tw68-core.c +++ b/drivers/media/pci/tw68/tw68-core.c | |||
@@ -306,7 +306,7 @@ static int tw68_initdev(struct pci_dev *pci_dev, | |||
306 | 306 | ||
307 | /* get irq */ | 307 | /* get irq */ |
308 | err = devm_request_irq(&pci_dev->dev, pci_dev->irq, tw68_irq, | 308 | err = devm_request_irq(&pci_dev->dev, pci_dev->irq, tw68_irq, |
309 | IRQF_SHARED | IRQF_DISABLED, dev->name, dev); | 309 | IRQF_SHARED, dev->name, dev); |
310 | if (err < 0) { | 310 | if (err < 0) { |
311 | pr_err("%s: can't get IRQ %d\n", | 311 | pr_err("%s: can't get IRQ %d\n", |
312 | dev->name, pci_dev->irq); | 312 | dev->name, pci_dev->irq); |
diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig index bee9074ebc13..3aac88f1d54a 100644 --- a/drivers/media/platform/Kconfig +++ b/drivers/media/platform/Kconfig | |||
@@ -166,7 +166,7 @@ config VIDEO_MEM2MEM_DEINTERLACE | |||
166 | config VIDEO_SAMSUNG_S5P_G2D | 166 | config VIDEO_SAMSUNG_S5P_G2D |
167 | tristate "Samsung S5P and EXYNOS4 G2D 2d graphics accelerator driver" | 167 | tristate "Samsung S5P and EXYNOS4 G2D 2d graphics accelerator driver" |
168 | depends on VIDEO_DEV && VIDEO_V4L2 | 168 | depends on VIDEO_DEV && VIDEO_V4L2 |
169 | depends on PLAT_S5P || ARCH_EXYNOS || COMPILE_TEST | 169 | depends on ARCH_S5PV210 || ARCH_EXYNOS || COMPILE_TEST |
170 | depends on HAS_DMA | 170 | depends on HAS_DMA |
171 | select VIDEOBUF2_DMA_CONTIG | 171 | select VIDEOBUF2_DMA_CONTIG |
172 | select V4L2_MEM2MEM_DEV | 172 | select V4L2_MEM2MEM_DEV |
@@ -178,7 +178,7 @@ config VIDEO_SAMSUNG_S5P_G2D | |||
178 | config VIDEO_SAMSUNG_S5P_JPEG | 178 | config VIDEO_SAMSUNG_S5P_JPEG |
179 | tristate "Samsung S5P/Exynos3250/Exynos4 JPEG codec driver" | 179 | tristate "Samsung S5P/Exynos3250/Exynos4 JPEG codec driver" |
180 | depends on VIDEO_DEV && VIDEO_V4L2 | 180 | depends on VIDEO_DEV && VIDEO_V4L2 |
181 | depends on PLAT_S5P || ARCH_EXYNOS || COMPILE_TEST | 181 | depends on ARCH_S5PV210 || ARCH_EXYNOS || COMPILE_TEST |
182 | depends on HAS_DMA | 182 | depends on HAS_DMA |
183 | select VIDEOBUF2_DMA_CONTIG | 183 | select VIDEOBUF2_DMA_CONTIG |
184 | select V4L2_MEM2MEM_DEV | 184 | select V4L2_MEM2MEM_DEV |
@@ -189,7 +189,7 @@ config VIDEO_SAMSUNG_S5P_JPEG | |||
189 | config VIDEO_SAMSUNG_S5P_MFC | 189 | config VIDEO_SAMSUNG_S5P_MFC |
190 | tristate "Samsung S5P MFC Video Codec" | 190 | tristate "Samsung S5P MFC Video Codec" |
191 | depends on VIDEO_DEV && VIDEO_V4L2 | 191 | depends on VIDEO_DEV && VIDEO_V4L2 |
192 | depends on PLAT_S5P || ARCH_EXYNOS || COMPILE_TEST | 192 | depends on ARCH_S5PV210 || ARCH_EXYNOS || COMPILE_TEST |
193 | depends on HAS_DMA | 193 | depends on HAS_DMA |
194 | select VIDEOBUF2_DMA_CONTIG | 194 | select VIDEOBUF2_DMA_CONTIG |
195 | default n | 195 | default n |
diff --git a/drivers/media/platform/exynos4-is/Kconfig b/drivers/media/platform/exynos4-is/Kconfig index 77c951237744..b7b2e472240a 100644 --- a/drivers/media/platform/exynos4-is/Kconfig +++ b/drivers/media/platform/exynos4-is/Kconfig | |||
@@ -2,7 +2,7 @@ | |||
2 | config VIDEO_SAMSUNG_EXYNOS4_IS | 2 | config VIDEO_SAMSUNG_EXYNOS4_IS |
3 | bool "Samsung S5P/EXYNOS4 SoC series Camera Subsystem driver" | 3 | bool "Samsung S5P/EXYNOS4 SoC series Camera Subsystem driver" |
4 | depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API | 4 | depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API |
5 | depends on (PLAT_S5P || ARCH_EXYNOS || COMPILE_TEST) | 5 | depends on ARCH_S5PV210 || ARCH_EXYNOS || COMPILE_TEST |
6 | depends on OF && COMMON_CLK | 6 | depends on OF && COMMON_CLK |
7 | help | 7 | help |
8 | Say Y here to enable camera host interface devices for | 8 | Say Y here to enable camera host interface devices for |
diff --git a/drivers/media/platform/exynos4-is/fimc-core.c b/drivers/media/platform/exynos4-is/fimc-core.c index b70fd996d794..aee92d908e49 100644 --- a/drivers/media/platform/exynos4-is/fimc-core.c +++ b/drivers/media/platform/exynos4-is/fimc-core.c | |||
@@ -832,6 +832,7 @@ err: | |||
832 | return -ENXIO; | 832 | return -ENXIO; |
833 | } | 833 | } |
834 | 834 | ||
835 | #if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP) | ||
835 | static int fimc_m2m_suspend(struct fimc_dev *fimc) | 836 | static int fimc_m2m_suspend(struct fimc_dev *fimc) |
836 | { | 837 | { |
837 | unsigned long flags; | 838 | unsigned long flags; |
@@ -870,6 +871,7 @@ static int fimc_m2m_resume(struct fimc_dev *fimc) | |||
870 | 871 | ||
871 | return 0; | 872 | return 0; |
872 | } | 873 | } |
874 | #endif /* CONFIG_PM_RUNTIME || CONFIG_PM_SLEEP */ | ||
873 | 875 | ||
874 | static const struct of_device_id fimc_of_match[]; | 876 | static const struct of_device_id fimc_of_match[]; |
875 | 877 | ||
diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c index e525a7c8d885..6fcc7f072ace 100644 --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c | |||
@@ -893,7 +893,7 @@ static bool s5p_jpeg_parse_hdr(struct s5p_jpeg_q_data *result, | |||
893 | unsigned long buffer, unsigned long size, | 893 | unsigned long buffer, unsigned long size, |
894 | struct s5p_jpeg_ctx *ctx) | 894 | struct s5p_jpeg_ctx *ctx) |
895 | { | 895 | { |
896 | int c, components, notfound; | 896 | int c, components = 0, notfound; |
897 | unsigned int height, width, word, subsampling = 0; | 897 | unsigned int height, width, word, subsampling = 0; |
898 | long length; | 898 | long length; |
899 | struct s5p_jpeg_buffer jpeg_buffer; | 899 | struct s5p_jpeg_buffer jpeg_buffer; |
@@ -2632,6 +2632,7 @@ static int s5p_jpeg_remove(struct platform_device *pdev) | |||
2632 | return 0; | 2632 | return 0; |
2633 | } | 2633 | } |
2634 | 2634 | ||
2635 | #if defined(CONFIG_PM_RUNTIME) || defined(CONFIG_PM_SLEEP) | ||
2635 | static int s5p_jpeg_runtime_suspend(struct device *dev) | 2636 | static int s5p_jpeg_runtime_suspend(struct device *dev) |
2636 | { | 2637 | { |
2637 | struct s5p_jpeg *jpeg = dev_get_drvdata(dev); | 2638 | struct s5p_jpeg *jpeg = dev_get_drvdata(dev); |
@@ -2681,7 +2682,9 @@ static int s5p_jpeg_runtime_resume(struct device *dev) | |||
2681 | 2682 | ||
2682 | return 0; | 2683 | return 0; |
2683 | } | 2684 | } |
2685 | #endif /* CONFIG_PM_RUNTIME || CONFIG_PM_SLEEP */ | ||
2684 | 2686 | ||
2687 | #ifdef CONFIG_PM_SLEEP | ||
2685 | static int s5p_jpeg_suspend(struct device *dev) | 2688 | static int s5p_jpeg_suspend(struct device *dev) |
2686 | { | 2689 | { |
2687 | if (pm_runtime_suspended(dev)) | 2690 | if (pm_runtime_suspended(dev)) |
@@ -2697,6 +2700,7 @@ static int s5p_jpeg_resume(struct device *dev) | |||
2697 | 2700 | ||
2698 | return s5p_jpeg_runtime_resume(dev); | 2701 | return s5p_jpeg_runtime_resume(dev); |
2699 | } | 2702 | } |
2703 | #endif | ||
2700 | 2704 | ||
2701 | static const struct dev_pm_ops s5p_jpeg_pm_ops = { | 2705 | static const struct dev_pm_ops s5p_jpeg_pm_ops = { |
2702 | SET_SYSTEM_SLEEP_PM_OPS(s5p_jpeg_suspend, s5p_jpeg_resume) | 2706 | SET_SYSTEM_SLEEP_PM_OPS(s5p_jpeg_suspend, s5p_jpeg_resume) |
diff --git a/drivers/media/platform/s5p-tv/Kconfig b/drivers/media/platform/s5p-tv/Kconfig index a9d56f8936b4..beb180e71ba0 100644 --- a/drivers/media/platform/s5p-tv/Kconfig +++ b/drivers/media/platform/s5p-tv/Kconfig | |||
@@ -9,7 +9,7 @@ | |||
9 | config VIDEO_SAMSUNG_S5P_TV | 9 | config VIDEO_SAMSUNG_S5P_TV |
10 | bool "Samsung TV driver for S5P platform" | 10 | bool "Samsung TV driver for S5P platform" |
11 | depends on PM_RUNTIME | 11 | depends on PM_RUNTIME |
12 | depends on PLAT_S5P || ARCH_EXYNOS || COMPILE_TEST | 12 | depends on ARCH_S5PV210 || ARCH_EXYNOS || COMPILE_TEST |
13 | default n | 13 | default n |
14 | ---help--- | 14 | ---help--- |
15 | Say Y here to enable selecting the TV output devices for | 15 | Say Y here to enable selecting the TV output devices for |
diff --git a/drivers/media/platform/vivid/Kconfig b/drivers/media/platform/vivid/Kconfig index d71139a2ae00..c3090932f06d 100644 --- a/drivers/media/platform/vivid/Kconfig +++ b/drivers/media/platform/vivid/Kconfig | |||
@@ -1,8 +1,11 @@ | |||
1 | config VIDEO_VIVID | 1 | config VIDEO_VIVID |
2 | tristate "Virtual Video Test Driver" | 2 | tristate "Virtual Video Test Driver" |
3 | depends on VIDEO_DEV && VIDEO_V4L2 && !SPARC32 && !SPARC64 | 3 | depends on VIDEO_DEV && VIDEO_V4L2 && !SPARC32 && !SPARC64 && FB |
4 | select FONT_SUPPORT | 4 | select FONT_SUPPORT |
5 | select FONT_8x16 | 5 | select FONT_8x16 |
6 | select FB_CFB_FILLRECT | ||
7 | select FB_CFB_COPYAREA | ||
8 | select FB_CFB_IMAGEBLIT | ||
6 | select VIDEOBUF2_VMALLOC | 9 | select VIDEOBUF2_VMALLOC |
7 | default n | 10 | default n |
8 | ---help--- | 11 | ---help--- |
diff --git a/drivers/media/platform/vivid/vivid-core.c b/drivers/media/platform/vivid/vivid-core.c index 2c61a62ab48b..686c3c2ad05b 100644 --- a/drivers/media/platform/vivid/vivid-core.c +++ b/drivers/media/platform/vivid/vivid-core.c | |||
@@ -100,11 +100,9 @@ MODULE_PARM_DESC(ccs_out_mode, " output crop/compose/scale mode:\n" | |||
100 | "\t\t bit 0=crop, 1=compose, 2=scale,\n" | 100 | "\t\t bit 0=crop, 1=compose, 2=scale,\n" |
101 | "\t\t -1=user-controlled (default)"); | 101 | "\t\t -1=user-controlled (default)"); |
102 | 102 | ||
103 | static unsigned multiplanar[VIVID_MAX_DEVS]; | 103 | static unsigned multiplanar[VIVID_MAX_DEVS] = { [0 ... (VIVID_MAX_DEVS - 1)] = 1 }; |
104 | module_param_array(multiplanar, uint, NULL, 0444); | 104 | module_param_array(multiplanar, uint, NULL, 0444); |
105 | MODULE_PARM_DESC(multiplanar, " 0 (default) is alternating single and multiplanar devices,\n" | 105 | MODULE_PARM_DESC(multiplanar, " 1 (default) creates a single planar device, 2 creates a multiplanar device."); |
106 | "\t\t 1 is single planar devices,\n" | ||
107 | "\t\t 2 is multiplanar devices"); | ||
108 | 106 | ||
109 | /* Default: video + vbi-cap (raw and sliced) + radio rx + radio tx + sdr + vbi-out + vid-out */ | 107 | /* Default: video + vbi-cap (raw and sliced) + radio rx + radio tx + sdr + vbi-out + vid-out */ |
110 | static unsigned node_types[VIVID_MAX_DEVS] = { [0 ... (VIVID_MAX_DEVS - 1)] = 0x1d3d }; | 108 | static unsigned node_types[VIVID_MAX_DEVS] = { [0 ... (VIVID_MAX_DEVS - 1)] = 0x1d3d }; |
@@ -669,10 +667,7 @@ static int __init vivid_create_instance(int inst) | |||
669 | /* start detecting feature set */ | 667 | /* start detecting feature set */ |
670 | 668 | ||
671 | /* do we use single- or multi-planar? */ | 669 | /* do we use single- or multi-planar? */ |
672 | if (multiplanar[inst] == 0) | 670 | dev->multiplanar = multiplanar[inst] > 1; |
673 | dev->multiplanar = inst & 1; | ||
674 | else | ||
675 | dev->multiplanar = multiplanar[inst] > 1; | ||
676 | v4l2_info(&dev->v4l2_dev, "using %splanar format API\n", | 671 | v4l2_info(&dev->v4l2_dev, "using %splanar format API\n", |
677 | dev->multiplanar ? "multi" : "single "); | 672 | dev->multiplanar ? "multi" : "single "); |
678 | 673 | ||
diff --git a/drivers/media/platform/vivid/vivid-tpg.c b/drivers/media/platform/vivid/vivid-tpg.c index 0c6fa53fa646..cbcd6250e7b2 100644 --- a/drivers/media/platform/vivid/vivid-tpg.c +++ b/drivers/media/platform/vivid/vivid-tpg.c | |||
@@ -136,7 +136,7 @@ int tpg_alloc(struct tpg_data *tpg, unsigned max_w) | |||
136 | tpg->black_line[plane] = vzalloc(max_w * pixelsz); | 136 | tpg->black_line[plane] = vzalloc(max_w * pixelsz); |
137 | if (!tpg->black_line[plane]) | 137 | if (!tpg->black_line[plane]) |
138 | return -ENOMEM; | 138 | return -ENOMEM; |
139 | tpg->random_line[plane] = vzalloc(max_w * pixelsz); | 139 | tpg->random_line[plane] = vzalloc(max_w * 2 * pixelsz); |
140 | if (!tpg->random_line[plane]) | 140 | if (!tpg->random_line[plane]) |
141 | return -ENOMEM; | 141 | return -ENOMEM; |
142 | } | 142 | } |
diff --git a/drivers/media/radio/wl128x/fmdrv_common.c b/drivers/media/radio/wl128x/fmdrv_common.c index 6f28f6e02ea5..704397f3c106 100644 --- a/drivers/media/radio/wl128x/fmdrv_common.c +++ b/drivers/media/radio/wl128x/fmdrv_common.c | |||
@@ -1256,7 +1256,7 @@ static int fm_download_firmware(struct fmdev *fmdev, const u8 *fw_name) | |||
1256 | fmerr("Unable to read firmware(%s) content\n", fw_name); | 1256 | fmerr("Unable to read firmware(%s) content\n", fw_name); |
1257 | return ret; | 1257 | return ret; |
1258 | } | 1258 | } |
1259 | fmdbg("Firmware(%s) length : %d bytes\n", fw_name, fw_entry->size); | 1259 | fmdbg("Firmware(%s) length : %zu bytes\n", fw_name, fw_entry->size); |
1260 | 1260 | ||
1261 | fw_data = (void *)fw_entry->data; | 1261 | fw_data = (void *)fw_entry->data; |
1262 | fw_len = fw_entry->size; | 1262 | fw_len = fw_entry->size; |
diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c index b8837dd39bb2..65f80b8b9f7a 100644 --- a/drivers/media/rc/imon.c +++ b/drivers/media/rc/imon.c | |||
@@ -1678,7 +1678,8 @@ static void imon_incoming_packet(struct imon_context *ictx, | |||
1678 | if (press_type == 0) | 1678 | if (press_type == 0) |
1679 | rc_keyup(ictx->rdev); | 1679 | rc_keyup(ictx->rdev); |
1680 | else { | 1680 | else { |
1681 | if (ictx->rc_type == RC_BIT_RC6_MCE) | 1681 | if (ictx->rc_type == RC_BIT_RC6_MCE || |
1682 | ictx->rc_type == RC_BIT_OTHER) | ||
1682 | rc_keydown(ictx->rdev, | 1683 | rc_keydown(ictx->rdev, |
1683 | ictx->rc_type == RC_BIT_RC6_MCE ? RC_TYPE_RC6_MCE : RC_TYPE_OTHER, | 1684 | ictx->rc_type == RC_BIT_RC6_MCE ? RC_TYPE_RC6_MCE : RC_TYPE_OTHER, |
1684 | ictx->rc_scancode, ictx->rc_toggle); | 1685 | ictx->rc_scancode, ictx->rc_toggle); |
diff --git a/drivers/media/rc/ir-hix5hd2.c b/drivers/media/rc/ir-hix5hd2.c index 08bbd4f508cd..b0df62961c14 100644 --- a/drivers/media/rc/ir-hix5hd2.c +++ b/drivers/media/rc/ir-hix5hd2.c | |||
@@ -297,7 +297,7 @@ static int hix5hd2_ir_remove(struct platform_device *pdev) | |||
297 | return 0; | 297 | return 0; |
298 | } | 298 | } |
299 | 299 | ||
300 | #ifdef CONFIG_PM | 300 | #ifdef CONFIG_PM_SLEEP |
301 | static int hix5hd2_ir_suspend(struct device *dev) | 301 | static int hix5hd2_ir_suspend(struct device *dev) |
302 | { | 302 | { |
303 | struct hix5hd2_ir_priv *priv = dev_get_drvdata(dev); | 303 | struct hix5hd2_ir_priv *priv = dev_get_drvdata(dev); |
diff --git a/drivers/media/rc/ir-rc5-decoder.c b/drivers/media/rc/ir-rc5-decoder.c index 2ef763928ca4..84fa6e9b59a1 100644 --- a/drivers/media/rc/ir-rc5-decoder.c +++ b/drivers/media/rc/ir-rc5-decoder.c | |||
@@ -53,7 +53,7 @@ static int ir_rc5_decode(struct rc_dev *dev, struct ir_raw_event ev) | |||
53 | u32 scancode; | 53 | u32 scancode; |
54 | enum rc_type protocol; | 54 | enum rc_type protocol; |
55 | 55 | ||
56 | if (!(dev->enabled_protocols & (RC_BIT_RC5 | RC_BIT_RC5X))) | 56 | if (!(dev->enabled_protocols & (RC_BIT_RC5 | RC_BIT_RC5X | RC_BIT_RC5_SZ))) |
57 | return 0; | 57 | return 0; |
58 | 58 | ||
59 | if (!is_timing_event(ev)) { | 59 | if (!is_timing_event(ev)) { |
diff --git a/drivers/media/rc/rc-ir-raw.c b/drivers/media/rc/rc-ir-raw.c index e8fff2add265..b732ac6a26d8 100644 --- a/drivers/media/rc/rc-ir-raw.c +++ b/drivers/media/rc/rc-ir-raw.c | |||
@@ -262,7 +262,6 @@ int ir_raw_event_register(struct rc_dev *dev) | |||
262 | return -ENOMEM; | 262 | return -ENOMEM; |
263 | 263 | ||
264 | dev->raw->dev = dev; | 264 | dev->raw->dev = dev; |
265 | dev->enabled_protocols = ~0; | ||
266 | dev->change_protocol = change_protocol; | 265 | dev->change_protocol = change_protocol; |
267 | rc = kfifo_alloc(&dev->raw->kfifo, | 266 | rc = kfifo_alloc(&dev->raw->kfifo, |
268 | sizeof(struct ir_raw_event) * MAX_IR_EVENT_SIZE, | 267 | sizeof(struct ir_raw_event) * MAX_IR_EVENT_SIZE, |
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index a7991c7d010a..8d3b74c5a717 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c | |||
@@ -1421,6 +1421,8 @@ int rc_register_device(struct rc_dev *dev) | |||
1421 | 1421 | ||
1422 | if (dev->change_protocol) { | 1422 | if (dev->change_protocol) { |
1423 | u64 rc_type = (1 << rc_map->rc_type); | 1423 | u64 rc_type = (1 << rc_map->rc_type); |
1424 | if (dev->driver_type == RC_DRIVER_IR_RAW) | ||
1425 | rc_type |= RC_BIT_LIRC; | ||
1424 | rc = dev->change_protocol(dev, &rc_type); | 1426 | rc = dev->change_protocol(dev, &rc_type); |
1425 | if (rc < 0) | 1427 | if (rc < 0) |
1426 | goto out_raw; | 1428 | goto out_raw; |
diff --git a/drivers/media/tuners/xc5000.c b/drivers/media/tuners/xc5000.c index e44c8aba6074..803a0e63d47e 100644 --- a/drivers/media/tuners/xc5000.c +++ b/drivers/media/tuners/xc5000.c | |||
@@ -1333,9 +1333,9 @@ static int xc5000_release(struct dvb_frontend *fe) | |||
1333 | 1333 | ||
1334 | if (priv) { | 1334 | if (priv) { |
1335 | cancel_delayed_work(&priv->timer_sleep); | 1335 | cancel_delayed_work(&priv->timer_sleep); |
1336 | hybrid_tuner_release_state(priv); | ||
1337 | if (priv->firmware) | 1336 | if (priv->firmware) |
1338 | release_firmware(priv->firmware); | 1337 | release_firmware(priv->firmware); |
1338 | hybrid_tuner_release_state(priv); | ||
1339 | } | 1339 | } |
1340 | 1340 | ||
1341 | mutex_unlock(&xc5000_list_mutex); | 1341 | mutex_unlock(&xc5000_list_mutex); |
diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c index 00758c83eec7..1896ab218b11 100644 --- a/drivers/media/usb/dvb-usb-v2/af9035.c +++ b/drivers/media/usb/dvb-usb-v2/af9035.c | |||
@@ -193,8 +193,8 @@ static int af9035_wr_reg_mask(struct dvb_usb_device *d, u32 reg, u8 val, | |||
193 | return af9035_wr_regs(d, reg, &val, 1); | 193 | return af9035_wr_regs(d, reg, &val, 1); |
194 | } | 194 | } |
195 | 195 | ||
196 | static int af9035_add_i2c_dev(struct dvb_usb_device *d, char *type, u8 addr, | 196 | static int af9035_add_i2c_dev(struct dvb_usb_device *d, const char *type, |
197 | void *platform_data, struct i2c_adapter *adapter) | 197 | u8 addr, void *platform_data, struct i2c_adapter *adapter) |
198 | { | 198 | { |
199 | int ret, num; | 199 | int ret, num; |
200 | struct state *state = d_to_priv(d); | 200 | struct state *state = d_to_priv(d); |
@@ -221,7 +221,7 @@ static int af9035_add_i2c_dev(struct dvb_usb_device *d, char *type, u8 addr, | |||
221 | goto err; | 221 | goto err; |
222 | } | 222 | } |
223 | 223 | ||
224 | request_module(board_info.type); | 224 | request_module("%s", board_info.type); |
225 | 225 | ||
226 | /* register I2C device */ | 226 | /* register I2C device */ |
227 | client = i2c_new_device(adapter, &board_info); | 227 | client = i2c_new_device(adapter, &board_info); |
diff --git a/drivers/media/usb/dvb-usb-v2/anysee.c b/drivers/media/usb/dvb-usb-v2/anysee.c index d3c5f230e97a..ae917c042a52 100644 --- a/drivers/media/usb/dvb-usb-v2/anysee.c +++ b/drivers/media/usb/dvb-usb-v2/anysee.c | |||
@@ -630,8 +630,8 @@ error: | |||
630 | return ret; | 630 | return ret; |
631 | } | 631 | } |
632 | 632 | ||
633 | static int anysee_add_i2c_dev(struct dvb_usb_device *d, char *type, u8 addr, | 633 | static int anysee_add_i2c_dev(struct dvb_usb_device *d, const char *type, |
634 | void *platform_data) | 634 | u8 addr, void *platform_data) |
635 | { | 635 | { |
636 | int ret, num; | 636 | int ret, num; |
637 | struct anysee_state *state = d_to_priv(d); | 637 | struct anysee_state *state = d_to_priv(d); |
@@ -659,7 +659,7 @@ static int anysee_add_i2c_dev(struct dvb_usb_device *d, char *type, u8 addr, | |||
659 | goto err; | 659 | goto err; |
660 | } | 660 | } |
661 | 661 | ||
662 | request_module(board_info.type); | 662 | request_module("%s", board_info.type); |
663 | 663 | ||
664 | /* register I2C device */ | 664 | /* register I2C device */ |
665 | client = i2c_new_device(adapter, &board_info); | 665 | client = i2c_new_device(adapter, &board_info); |
diff --git a/drivers/media/usb/em28xx/em28xx-core.c b/drivers/media/usb/em28xx/em28xx-core.c index b5e52fe7957a..901cf2b952d7 100644 --- a/drivers/media/usb/em28xx/em28xx-core.c +++ b/drivers/media/usb/em28xx/em28xx-core.c | |||
@@ -504,7 +504,7 @@ EXPORT_SYMBOL_GPL(em28xx_audio_analog_set); | |||
504 | int em28xx_audio_setup(struct em28xx *dev) | 504 | int em28xx_audio_setup(struct em28xx *dev) |
505 | { | 505 | { |
506 | int vid1, vid2, feat, cfg; | 506 | int vid1, vid2, feat, cfg; |
507 | u32 vid; | 507 | u32 vid = 0; |
508 | u8 i2s_samplerates; | 508 | u8 i2s_samplerates; |
509 | 509 | ||
510 | if (dev->chip_id == CHIP_ID_EM2870 || | 510 | if (dev->chip_id == CHIP_ID_EM2870 || |
diff --git a/drivers/media/usb/em28xx/em28xx-input.c b/drivers/media/usb/em28xx/em28xx-input.c index 581f6dad4ca9..23f8f6afa2e0 100644 --- a/drivers/media/usb/em28xx/em28xx-input.c +++ b/drivers/media/usb/em28xx/em28xx-input.c | |||
@@ -712,8 +712,10 @@ static int em28xx_ir_init(struct em28xx *dev) | |||
712 | em28xx_info("Registering input extension\n"); | 712 | em28xx_info("Registering input extension\n"); |
713 | 713 | ||
714 | ir = kzalloc(sizeof(*ir), GFP_KERNEL); | 714 | ir = kzalloc(sizeof(*ir), GFP_KERNEL); |
715 | if (!ir) | ||
716 | return -ENOMEM; | ||
715 | rc = rc_allocate_device(); | 717 | rc = rc_allocate_device(); |
716 | if (!ir || !rc) | 718 | if (!rc) |
717 | goto error; | 719 | goto error; |
718 | 720 | ||
719 | /* record handles to ourself */ | 721 | /* record handles to ourself */ |
diff --git a/drivers/media/usb/hackrf/hackrf.c b/drivers/media/usb/hackrf/hackrf.c index 328b5ba47a0a..fd1fa412e094 100644 --- a/drivers/media/usb/hackrf/hackrf.c +++ b/drivers/media/usb/hackrf/hackrf.c | |||
@@ -932,7 +932,7 @@ static int hackrf_set_bandwidth(struct hackrf_dev *dev) | |||
932 | dev->bandwidth->val = bandwidth; | 932 | dev->bandwidth->val = bandwidth; |
933 | dev->bandwidth->cur.val = bandwidth; | 933 | dev->bandwidth->cur.val = bandwidth; |
934 | 934 | ||
935 | dev_dbg(dev->dev, "bandwidth selected=%d\n", bandwidth_lut[i].freq); | 935 | dev_dbg(dev->dev, "bandwidth selected=%d\n", bandwidth); |
936 | 936 | ||
937 | u16tmp = 0; | 937 | u16tmp = 0; |
938 | u16tmp |= ((bandwidth >> 0) & 0xff) << 0; | 938 | u16tmp |= ((bandwidth >> 0) & 0xff) << 0; |
diff --git a/drivers/media/usb/usbvision/usbvision-video.c b/drivers/media/usb/usbvision/usbvision-video.c index 68bc9615660e..9bfa041e3316 100644 --- a/drivers/media/usb/usbvision/usbvision-video.c +++ b/drivers/media/usb/usbvision/usbvision-video.c | |||
@@ -446,6 +446,7 @@ static int usbvision_v4l2_close(struct file *file) | |||
446 | if (usbvision->remove_pending) { | 446 | if (usbvision->remove_pending) { |
447 | printk(KERN_INFO "%s: Final disconnect\n", __func__); | 447 | printk(KERN_INFO "%s: Final disconnect\n", __func__); |
448 | usbvision_release(usbvision); | 448 | usbvision_release(usbvision); |
449 | return 0; | ||
449 | } | 450 | } |
450 | mutex_unlock(&usbvision->v4l2_lock); | 451 | mutex_unlock(&usbvision->v4l2_lock); |
451 | 452 | ||
@@ -1221,6 +1222,7 @@ static int usbvision_radio_close(struct file *file) | |||
1221 | if (usbvision->remove_pending) { | 1222 | if (usbvision->remove_pending) { |
1222 | printk(KERN_INFO "%s: Final disconnect\n", __func__); | 1223 | printk(KERN_INFO "%s: Final disconnect\n", __func__); |
1223 | usbvision_release(usbvision); | 1224 | usbvision_release(usbvision); |
1225 | return err_code; | ||
1224 | } | 1226 | } |
1225 | 1227 | ||
1226 | mutex_unlock(&usbvision->v4l2_lock); | 1228 | mutex_unlock(&usbvision->v4l2_lock); |
diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c index 60a8e2c3631e..378ae02e593b 100644 --- a/drivers/media/usb/uvc/uvc_v4l2.c +++ b/drivers/media/usb/uvc/uvc_v4l2.c | |||
@@ -318,7 +318,6 @@ static int uvc_v4l2_set_format(struct uvc_streaming *stream, | |||
318 | stream->ctrl = probe; | 318 | stream->ctrl = probe; |
319 | stream->cur_format = format; | 319 | stream->cur_format = format; |
320 | stream->cur_frame = frame; | 320 | stream->cur_frame = frame; |
321 | stream->frame_size = fmt->fmt.pix.sizeimage; | ||
322 | 321 | ||
323 | done: | 322 | done: |
324 | mutex_unlock(&stream->mutex); | 323 | mutex_unlock(&stream->mutex); |
diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c index 9ace520bb079..df81b9c4faf1 100644 --- a/drivers/media/usb/uvc/uvc_video.c +++ b/drivers/media/usb/uvc/uvc_video.c | |||
@@ -1143,7 +1143,7 @@ static int uvc_video_encode_data(struct uvc_streaming *stream, | |||
1143 | static void uvc_video_validate_buffer(const struct uvc_streaming *stream, | 1143 | static void uvc_video_validate_buffer(const struct uvc_streaming *stream, |
1144 | struct uvc_buffer *buf) | 1144 | struct uvc_buffer *buf) |
1145 | { | 1145 | { |
1146 | if (stream->frame_size != buf->bytesused && | 1146 | if (stream->ctrl.dwMaxVideoFrameSize != buf->bytesused && |
1147 | !(stream->cur_format->flags & UVC_FMT_FLAG_COMPRESSED)) | 1147 | !(stream->cur_format->flags & UVC_FMT_FLAG_COMPRESSED)) |
1148 | buf->error = 1; | 1148 | buf->error = 1; |
1149 | } | 1149 | } |
diff --git a/drivers/media/usb/uvc/uvcvideo.h b/drivers/media/usb/uvc/uvcvideo.h index 6f676c29ec09..864ada740360 100644 --- a/drivers/media/usb/uvc/uvcvideo.h +++ b/drivers/media/usb/uvc/uvcvideo.h | |||
@@ -457,7 +457,6 @@ struct uvc_streaming { | |||
457 | struct uvc_format *def_format; | 457 | struct uvc_format *def_format; |
458 | struct uvc_format *cur_format; | 458 | struct uvc_format *cur_format; |
459 | struct uvc_frame *cur_frame; | 459 | struct uvc_frame *cur_frame; |
460 | size_t frame_size; | ||
461 | 460 | ||
462 | /* Protect access to ctrl, cur_format, cur_frame and hardware video | 461 | /* Protect access to ctrl, cur_format, cur_frame and hardware video |
463 | * probe control. | 462 | * probe control. |
diff --git a/drivers/media/v4l2-core/videobuf-dma-contig.c b/drivers/media/v4l2-core/videobuf-dma-contig.c index bf80f0f7dfb8..e02353e340dd 100644 --- a/drivers/media/v4l2-core/videobuf-dma-contig.c +++ b/drivers/media/v4l2-core/videobuf-dma-contig.c | |||
@@ -305,6 +305,15 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q, | |||
305 | /* Try to remap memory */ | 305 | /* Try to remap memory */ |
306 | size = vma->vm_end - vma->vm_start; | 306 | size = vma->vm_end - vma->vm_start; |
307 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); | 307 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); |
308 | |||
309 | /* the "vm_pgoff" is just used in v4l2 to find the | ||
310 | * corresponding buffer data structure which is allocated | ||
311 | * earlier and it does not mean the offset from the physical | ||
312 | * buffer start address as usual. So set it to 0 to pass | ||
313 | * the sanity check in vm_iomap_memory(). | ||
314 | */ | ||
315 | vma->vm_pgoff = 0; | ||
316 | |||
308 | retval = vm_iomap_memory(vma, mem->dma_handle, size); | 317 | retval = vm_iomap_memory(vma, mem->dma_handle, size); |
309 | if (retval) { | 318 | if (retval) { |
310 | dev_err(q->dev, "mmap: remap failed with error %d. ", | 319 | dev_err(q->dev, "mmap: remap failed with error %d. ", |
diff --git a/drivers/mfd/max77693.c b/drivers/mfd/max77693.c index cf008f45968c..711773e8e64b 100644 --- a/drivers/mfd/max77693.c +++ b/drivers/mfd/max77693.c | |||
@@ -240,7 +240,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c, | |||
240 | goto err_irq_charger; | 240 | goto err_irq_charger; |
241 | } | 241 | } |
242 | 242 | ||
243 | ret = regmap_add_irq_chip(max77693->regmap, max77693->irq, | 243 | ret = regmap_add_irq_chip(max77693->regmap_muic, max77693->irq, |
244 | IRQF_ONESHOT | IRQF_SHARED | | 244 | IRQF_ONESHOT | IRQF_SHARED | |
245 | IRQF_TRIGGER_FALLING, 0, | 245 | IRQF_TRIGGER_FALLING, 0, |
246 | &max77693_muic_irq_chip, | 246 | &max77693_muic_irq_chip, |
@@ -250,6 +250,17 @@ static int max77693_i2c_probe(struct i2c_client *i2c, | |||
250 | goto err_irq_muic; | 250 | goto err_irq_muic; |
251 | } | 251 | } |
252 | 252 | ||
253 | /* Unmask interrupts from all blocks in interrupt source register */ | ||
254 | ret = regmap_update_bits(max77693->regmap, | ||
255 | MAX77693_PMIC_REG_INTSRC_MASK, | ||
256 | SRC_IRQ_ALL, (unsigned int)~SRC_IRQ_ALL); | ||
257 | if (ret < 0) { | ||
258 | dev_err(max77693->dev, | ||
259 | "Could not unmask interrupts in INTSRC: %d\n", | ||
260 | ret); | ||
261 | goto err_intsrc; | ||
262 | } | ||
263 | |||
253 | pm_runtime_set_active(max77693->dev); | 264 | pm_runtime_set_active(max77693->dev); |
254 | 265 | ||
255 | ret = mfd_add_devices(max77693->dev, -1, max77693_devs, | 266 | ret = mfd_add_devices(max77693->dev, -1, max77693_devs, |
@@ -261,6 +272,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c, | |||
261 | 272 | ||
262 | err_mfd: | 273 | err_mfd: |
263 | mfd_remove_devices(max77693->dev); | 274 | mfd_remove_devices(max77693->dev); |
275 | err_intsrc: | ||
264 | regmap_del_irq_chip(max77693->irq, max77693->irq_data_muic); | 276 | regmap_del_irq_chip(max77693->irq, max77693->irq_data_muic); |
265 | err_irq_muic: | 277 | err_irq_muic: |
266 | regmap_del_irq_chip(max77693->irq, max77693->irq_data_charger); | 278 | regmap_del_irq_chip(max77693->irq, max77693->irq_data_charger); |
diff --git a/drivers/mfd/rtsx_pcr.c b/drivers/mfd/rtsx_pcr.c index f2643c221d34..30f7ca89a0e6 100644 --- a/drivers/mfd/rtsx_pcr.c +++ b/drivers/mfd/rtsx_pcr.c | |||
@@ -947,6 +947,7 @@ static void rtsx_pci_idle_work(struct work_struct *work) | |||
947 | mutex_unlock(&pcr->pcr_mutex); | 947 | mutex_unlock(&pcr->pcr_mutex); |
948 | } | 948 | } |
949 | 949 | ||
950 | #ifdef CONFIG_PM | ||
950 | static void rtsx_pci_power_off(struct rtsx_pcr *pcr, u8 pm_state) | 951 | static void rtsx_pci_power_off(struct rtsx_pcr *pcr, u8 pm_state) |
951 | { | 952 | { |
952 | if (pcr->ops->turn_off_led) | 953 | if (pcr->ops->turn_off_led) |
@@ -961,6 +962,7 @@ static void rtsx_pci_power_off(struct rtsx_pcr *pcr, u8 pm_state) | |||
961 | if (pcr->ops->force_power_down) | 962 | if (pcr->ops->force_power_down) |
962 | pcr->ops->force_power_down(pcr, pm_state); | 963 | pcr->ops->force_power_down(pcr, pm_state); |
963 | } | 964 | } |
965 | #endif | ||
964 | 966 | ||
965 | static int rtsx_pci_init_hw(struct rtsx_pcr *pcr) | 967 | static int rtsx_pci_init_hw(struct rtsx_pcr *pcr) |
966 | { | 968 | { |
diff --git a/drivers/mfd/stmpe.h b/drivers/mfd/stmpe.h index 2d045f26f193..bee0abf82040 100644 --- a/drivers/mfd/stmpe.h +++ b/drivers/mfd/stmpe.h | |||
@@ -269,7 +269,7 @@ int stmpe_remove(struct stmpe *stmpe); | |||
269 | #define STMPE24XX_REG_CHIP_ID 0x80 | 269 | #define STMPE24XX_REG_CHIP_ID 0x80 |
270 | #define STMPE24XX_REG_IEGPIOR_LSB 0x18 | 270 | #define STMPE24XX_REG_IEGPIOR_LSB 0x18 |
271 | #define STMPE24XX_REG_ISGPIOR_MSB 0x19 | 271 | #define STMPE24XX_REG_ISGPIOR_MSB 0x19 |
272 | #define STMPE24XX_REG_GPMR_LSB 0xA5 | 272 | #define STMPE24XX_REG_GPMR_LSB 0xA4 |
273 | #define STMPE24XX_REG_GPSR_LSB 0x85 | 273 | #define STMPE24XX_REG_GPSR_LSB 0x85 |
274 | #define STMPE24XX_REG_GPCR_LSB 0x88 | 274 | #define STMPE24XX_REG_GPCR_LSB 0x88 |
275 | #define STMPE24XX_REG_GPDR_LSB 0x8B | 275 | #define STMPE24XX_REG_GPDR_LSB 0x8B |
diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c index cf92a6d1c532..50f9091bcd38 100644 --- a/drivers/mfd/twl4030-power.c +++ b/drivers/mfd/twl4030-power.c | |||
@@ -44,6 +44,15 @@ static u8 twl4030_start_script_address = 0x2b; | |||
44 | #define PWR_DEVSLP BIT(1) | 44 | #define PWR_DEVSLP BIT(1) |
45 | #define PWR_DEVOFF BIT(0) | 45 | #define PWR_DEVOFF BIT(0) |
46 | 46 | ||
47 | /* Register bits for CFG_P1_TRANSITION (also for P2 and P3) */ | ||
48 | #define STARTON_SWBUG BIT(7) /* Start on watchdog */ | ||
49 | #define STARTON_VBUS BIT(5) /* Start on VBUS */ | ||
50 | #define STARTON_VBAT BIT(4) /* Start on battery insert */ | ||
51 | #define STARTON_RTC BIT(3) /* Start on RTC */ | ||
52 | #define STARTON_USB BIT(2) /* Start on USB host */ | ||
53 | #define STARTON_CHG BIT(1) /* Start on charger */ | ||
54 | #define STARTON_PWON BIT(0) /* Start on PWRON button */ | ||
55 | |||
47 | #define SEQ_OFFSYNC (1 << 0) | 56 | #define SEQ_OFFSYNC (1 << 0) |
48 | 57 | ||
49 | #define PHY_TO_OFF_PM_MASTER(p) (p - 0x36) | 58 | #define PHY_TO_OFF_PM_MASTER(p) (p - 0x36) |
@@ -606,6 +615,44 @@ twl4030_power_configure_resources(const struct twl4030_power_data *pdata) | |||
606 | return 0; | 615 | return 0; |
607 | } | 616 | } |
608 | 617 | ||
618 | static int twl4030_starton_mask_and_set(u8 bitmask, u8 bitvalues) | ||
619 | { | ||
620 | u8 regs[3] = { TWL4030_PM_MASTER_CFG_P1_TRANSITION, | ||
621 | TWL4030_PM_MASTER_CFG_P2_TRANSITION, | ||
622 | TWL4030_PM_MASTER_CFG_P3_TRANSITION, }; | ||
623 | u8 val; | ||
624 | int i, err; | ||
625 | |||
626 | err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, TWL4030_PM_MASTER_KEY_CFG1, | ||
627 | TWL4030_PM_MASTER_PROTECT_KEY); | ||
628 | if (err) | ||
629 | goto relock; | ||
630 | err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, | ||
631 | TWL4030_PM_MASTER_KEY_CFG2, | ||
632 | TWL4030_PM_MASTER_PROTECT_KEY); | ||
633 | if (err) | ||
634 | goto relock; | ||
635 | |||
636 | for (i = 0; i < sizeof(regs); i++) { | ||
637 | err = twl_i2c_read_u8(TWL_MODULE_PM_MASTER, | ||
638 | &val, regs[i]); | ||
639 | if (err) | ||
640 | break; | ||
641 | val = (~bitmask & val) | (bitmask & bitvalues); | ||
642 | err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, | ||
643 | val, regs[i]); | ||
644 | if (err) | ||
645 | break; | ||
646 | } | ||
647 | |||
648 | if (err) | ||
649 | pr_err("TWL4030 Register access failed: %i\n", err); | ||
650 | |||
651 | relock: | ||
652 | return twl_i2c_write_u8(TWL_MODULE_PM_MASTER, 0, | ||
653 | TWL4030_PM_MASTER_PROTECT_KEY); | ||
654 | } | ||
655 | |||
609 | /* | 656 | /* |
610 | * In master mode, start the power off sequence. | 657 | * In master mode, start the power off sequence. |
611 | * After a successful execution, TWL shuts down the power to the SoC | 658 | * After a successful execution, TWL shuts down the power to the SoC |
@@ -615,6 +662,11 @@ void twl4030_power_off(void) | |||
615 | { | 662 | { |
616 | int err; | 663 | int err; |
617 | 664 | ||
665 | /* Disable start on charger or VBUS as it can break poweroff */ | ||
666 | err = twl4030_starton_mask_and_set(STARTON_VBUS | STARTON_CHG, 0); | ||
667 | if (err) | ||
668 | pr_err("TWL4030 Unable to configure start-up\n"); | ||
669 | |||
618 | err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, PWR_DEVOFF, | 670 | err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, PWR_DEVOFF, |
619 | TWL4030_PM_MASTER_P1_SW_EVENTS); | 671 | TWL4030_PM_MASTER_P1_SW_EVENTS); |
620 | if (err) | 672 | if (err) |
diff --git a/drivers/mfd/viperboard.c b/drivers/mfd/viperboard.c index e00f5340ed87..3c2b8f9e3c84 100644 --- a/drivers/mfd/viperboard.c +++ b/drivers/mfd/viperboard.c | |||
@@ -93,8 +93,9 @@ static int vprbrd_probe(struct usb_interface *interface, | |||
93 | version >> 8, version & 0xff, | 93 | version >> 8, version & 0xff, |
94 | vb->usb_dev->bus->busnum, vb->usb_dev->devnum); | 94 | vb->usb_dev->bus->busnum, vb->usb_dev->devnum); |
95 | 95 | ||
96 | ret = mfd_add_devices(&interface->dev, -1, vprbrd_devs, | 96 | ret = mfd_add_devices(&interface->dev, PLATFORM_DEVID_AUTO, |
97 | ARRAY_SIZE(vprbrd_devs), NULL, 0, NULL); | 97 | vprbrd_devs, ARRAY_SIZE(vprbrd_devs), NULL, 0, |
98 | NULL); | ||
98 | if (ret != 0) { | 99 | if (ret != 0) { |
99 | dev_err(&interface->dev, "Failed to add mfd devices to core."); | 100 | dev_err(&interface->dev, "Failed to add mfd devices to core."); |
100 | goto error; | 101 | goto error; |
diff --git a/drivers/misc/cxl/fault.c b/drivers/misc/cxl/fault.c index 69506ebd4d07..c99e896604ee 100644 --- a/drivers/misc/cxl/fault.c +++ b/drivers/misc/cxl/fault.c | |||
@@ -21,60 +21,64 @@ | |||
21 | 21 | ||
22 | #include "cxl.h" | 22 | #include "cxl.h" |
23 | 23 | ||
24 | static struct cxl_sste* find_free_sste(struct cxl_sste *primary_group, | 24 | static bool sste_matches(struct cxl_sste *sste, struct copro_slb *slb) |
25 | bool sec_hash, | ||
26 | struct cxl_sste *secondary_group, | ||
27 | unsigned int *lru) | ||
28 | { | 25 | { |
29 | unsigned int i, entry; | 26 | return ((sste->vsid_data == cpu_to_be64(slb->vsid)) && |
30 | struct cxl_sste *sste, *group = primary_group; | 27 | (sste->esid_data == cpu_to_be64(slb->esid))); |
31 | 28 | } | |
32 | for (i = 0; i < 2; i++) { | 29 | |
33 | for (entry = 0; entry < 8; entry++) { | 30 | /* |
34 | sste = group + entry; | 31 | * This finds a free SSTE for the given SLB, or returns NULL if it's already in |
35 | if (!(be64_to_cpu(sste->esid_data) & SLB_ESID_V)) | 32 | * the segment table. |
36 | return sste; | 33 | */ |
37 | } | 34 | static struct cxl_sste* find_free_sste(struct cxl_context *ctx, |
38 | if (!sec_hash) | 35 | struct copro_slb *slb) |
39 | break; | 36 | { |
40 | group = secondary_group; | 37 | struct cxl_sste *primary, *sste, *ret = NULL; |
38 | unsigned int mask = (ctx->sst_size >> 7) - 1; /* SSTP0[SegTableSize] */ | ||
39 | unsigned int entry; | ||
40 | unsigned int hash; | ||
41 | |||
42 | if (slb->vsid & SLB_VSID_B_1T) | ||
43 | hash = (slb->esid >> SID_SHIFT_1T) & mask; | ||
44 | else /* 256M */ | ||
45 | hash = (slb->esid >> SID_SHIFT) & mask; | ||
46 | |||
47 | primary = ctx->sstp + (hash << 3); | ||
48 | |||
49 | for (entry = 0, sste = primary; entry < 8; entry++, sste++) { | ||
50 | if (!ret && !(be64_to_cpu(sste->esid_data) & SLB_ESID_V)) | ||
51 | ret = sste; | ||
52 | if (sste_matches(sste, slb)) | ||
53 | return NULL; | ||
41 | } | 54 | } |
55 | if (ret) | ||
56 | return ret; | ||
57 | |||
42 | /* Nothing free, select an entry to cast out */ | 58 | /* Nothing free, select an entry to cast out */ |
43 | if (sec_hash && (*lru & 0x8)) | 59 | ret = primary + ctx->sst_lru; |
44 | sste = secondary_group + (*lru & 0x7); | 60 | ctx->sst_lru = (ctx->sst_lru + 1) & 0x7; |
45 | else | ||
46 | sste = primary_group + (*lru & 0x7); | ||
47 | *lru = (*lru + 1) & 0xf; | ||
48 | 61 | ||
49 | return sste; | 62 | return ret; |
50 | } | 63 | } |
51 | 64 | ||
52 | static void cxl_load_segment(struct cxl_context *ctx, struct copro_slb *slb) | 65 | static void cxl_load_segment(struct cxl_context *ctx, struct copro_slb *slb) |
53 | { | 66 | { |
54 | /* mask is the group index, we search primary and secondary here. */ | 67 | /* mask is the group index, we search primary and secondary here. */ |
55 | unsigned int mask = (ctx->sst_size >> 7)-1; /* SSTP0[SegTableSize] */ | ||
56 | bool sec_hash = 1; | ||
57 | struct cxl_sste *sste; | 68 | struct cxl_sste *sste; |
58 | unsigned int hash; | ||
59 | unsigned long flags; | 69 | unsigned long flags; |
60 | 70 | ||
61 | |||
62 | sec_hash = !!(cxl_p1n_read(ctx->afu, CXL_PSL_SR_An) & CXL_PSL_SR_An_SC); | ||
63 | |||
64 | if (slb->vsid & SLB_VSID_B_1T) | ||
65 | hash = (slb->esid >> SID_SHIFT_1T) & mask; | ||
66 | else /* 256M */ | ||
67 | hash = (slb->esid >> SID_SHIFT) & mask; | ||
68 | |||
69 | spin_lock_irqsave(&ctx->sste_lock, flags); | 71 | spin_lock_irqsave(&ctx->sste_lock, flags); |
70 | sste = find_free_sste(ctx->sstp + (hash << 3), sec_hash, | 72 | sste = find_free_sste(ctx, slb); |
71 | ctx->sstp + ((~hash & mask) << 3), &ctx->sst_lru); | 73 | if (!sste) |
74 | goto out_unlock; | ||
72 | 75 | ||
73 | pr_devel("CXL Populating SST[%li]: %#llx %#llx\n", | 76 | pr_devel("CXL Populating SST[%li]: %#llx %#llx\n", |
74 | sste - ctx->sstp, slb->vsid, slb->esid); | 77 | sste - ctx->sstp, slb->vsid, slb->esid); |
75 | 78 | ||
76 | sste->vsid_data = cpu_to_be64(slb->vsid); | 79 | sste->vsid_data = cpu_to_be64(slb->vsid); |
77 | sste->esid_data = cpu_to_be64(slb->esid); | 80 | sste->esid_data = cpu_to_be64(slb->esid); |
81 | out_unlock: | ||
78 | spin_unlock_irqrestore(&ctx->sste_lock, flags); | 82 | spin_unlock_irqrestore(&ctx->sste_lock, flags); |
79 | } | 83 | } |
80 | 84 | ||
diff --git a/drivers/misc/cxl/native.c b/drivers/misc/cxl/native.c index 623286a77114..d47532e8f4f1 100644 --- a/drivers/misc/cxl/native.c +++ b/drivers/misc/cxl/native.c | |||
@@ -417,7 +417,7 @@ static int attach_afu_directed(struct cxl_context *ctx, u64 wed, u64 amr) | |||
417 | ctx->elem->haurp = 0; /* disable */ | 417 | ctx->elem->haurp = 0; /* disable */ |
418 | ctx->elem->sdr = cpu_to_be64(mfspr(SPRN_SDR1)); | 418 | ctx->elem->sdr = cpu_to_be64(mfspr(SPRN_SDR1)); |
419 | 419 | ||
420 | sr = CXL_PSL_SR_An_SC; | 420 | sr = 0; |
421 | if (ctx->master) | 421 | if (ctx->master) |
422 | sr |= CXL_PSL_SR_An_MP; | 422 | sr |= CXL_PSL_SR_An_MP; |
423 | if (mfspr(SPRN_LPCR) & LPCR_TC) | 423 | if (mfspr(SPRN_LPCR) & LPCR_TC) |
@@ -508,7 +508,7 @@ static int attach_dedicated(struct cxl_context *ctx, u64 wed, u64 amr) | |||
508 | u64 sr; | 508 | u64 sr; |
509 | int rc; | 509 | int rc; |
510 | 510 | ||
511 | sr = CXL_PSL_SR_An_SC; | 511 | sr = 0; |
512 | set_endian(sr); | 512 | set_endian(sr); |
513 | if (ctx->master) | 513 | if (ctx->master) |
514 | sr |= CXL_PSL_SR_An_MP; | 514 | sr |= CXL_PSL_SR_An_MP; |
diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index 03c53b72a2d6..270d58a4c43d 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c | |||
@@ -311,7 +311,8 @@ int mmc_of_parse(struct mmc_host *host) | |||
311 | struct device_node *np; | 311 | struct device_node *np; |
312 | u32 bus_width; | 312 | u32 bus_width; |
313 | int len, ret; | 313 | int len, ret; |
314 | bool cap_invert, gpio_invert; | 314 | bool cd_cap_invert, cd_gpio_invert = false; |
315 | bool ro_cap_invert, ro_gpio_invert = false; | ||
315 | 316 | ||
316 | if (!host->parent || !host->parent->of_node) | 317 | if (!host->parent || !host->parent->of_node) |
317 | return 0; | 318 | return 0; |
@@ -359,16 +360,13 @@ int mmc_of_parse(struct mmc_host *host) | |||
359 | if (of_find_property(np, "non-removable", &len)) { | 360 | if (of_find_property(np, "non-removable", &len)) { |
360 | host->caps |= MMC_CAP_NONREMOVABLE; | 361 | host->caps |= MMC_CAP_NONREMOVABLE; |
361 | } else { | 362 | } else { |
362 | if (of_property_read_bool(np, "cd-inverted")) | 363 | cd_cap_invert = of_property_read_bool(np, "cd-inverted"); |
363 | cap_invert = true; | ||
364 | else | ||
365 | cap_invert = false; | ||
366 | 364 | ||
367 | if (of_find_property(np, "broken-cd", &len)) | 365 | if (of_find_property(np, "broken-cd", &len)) |
368 | host->caps |= MMC_CAP_NEEDS_POLL; | 366 | host->caps |= MMC_CAP_NEEDS_POLL; |
369 | 367 | ||
370 | ret = mmc_gpiod_request_cd(host, "cd", 0, true, | 368 | ret = mmc_gpiod_request_cd(host, "cd", 0, true, |
371 | 0, &gpio_invert); | 369 | 0, &cd_gpio_invert); |
372 | if (ret) { | 370 | if (ret) { |
373 | if (ret == -EPROBE_DEFER) | 371 | if (ret == -EPROBE_DEFER) |
374 | return ret; | 372 | return ret; |
@@ -391,17 +389,14 @@ int mmc_of_parse(struct mmc_host *host) | |||
391 | * both inverted, the end result is that the CD line is | 389 | * both inverted, the end result is that the CD line is |
392 | * not inverted. | 390 | * not inverted. |
393 | */ | 391 | */ |
394 | if (cap_invert ^ gpio_invert) | 392 | if (cd_cap_invert ^ cd_gpio_invert) |
395 | host->caps2 |= MMC_CAP2_CD_ACTIVE_HIGH; | 393 | host->caps2 |= MMC_CAP2_CD_ACTIVE_HIGH; |
396 | } | 394 | } |
397 | 395 | ||
398 | /* Parse Write Protection */ | 396 | /* Parse Write Protection */ |
399 | if (of_property_read_bool(np, "wp-inverted")) | 397 | ro_cap_invert = of_property_read_bool(np, "wp-inverted"); |
400 | cap_invert = true; | ||
401 | else | ||
402 | cap_invert = false; | ||
403 | 398 | ||
404 | ret = mmc_gpiod_request_ro(host, "wp", 0, false, 0, &gpio_invert); | 399 | ret = mmc_gpiod_request_ro(host, "wp", 0, false, 0, &ro_gpio_invert); |
405 | if (ret) { | 400 | if (ret) { |
406 | if (ret == -EPROBE_DEFER) | 401 | if (ret == -EPROBE_DEFER) |
407 | goto out; | 402 | goto out; |
@@ -414,7 +409,7 @@ int mmc_of_parse(struct mmc_host *host) | |||
414 | dev_info(host->parent, "Got WP GPIO\n"); | 409 | dev_info(host->parent, "Got WP GPIO\n"); |
415 | 410 | ||
416 | /* See the comment on CD inversion above */ | 411 | /* See the comment on CD inversion above */ |
417 | if (cap_invert ^ gpio_invert) | 412 | if (ro_cap_invert ^ ro_gpio_invert) |
418 | host->caps2 |= MMC_CAP2_RO_ACTIVE_HIGH; | 413 | host->caps2 |= MMC_CAP2_RO_ACTIVE_HIGH; |
419 | 414 | ||
420 | if (of_find_property(np, "cap-sd-highspeed", &len)) | 415 | if (of_find_property(np, "cap-sd-highspeed", &len)) |
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c index a7543ba3e190..3096f3ded3ad 100644 --- a/drivers/mtd/chips/cfi_cmdset_0001.c +++ b/drivers/mtd/chips/cfi_cmdset_0001.c | |||
@@ -2590,6 +2590,8 @@ static void cfi_intelext_resume(struct mtd_info *mtd) | |||
2590 | 2590 | ||
2591 | /* Go to known state. Chip may have been power cycled */ | 2591 | /* Go to known state. Chip may have been power cycled */ |
2592 | if (chip->state == FL_PM_SUSPENDED) { | 2592 | if (chip->state == FL_PM_SUSPENDED) { |
2593 | /* Refresh LH28F640BF Partition Config. Register */ | ||
2594 | fixup_LH28F640BF(mtd); | ||
2593 | map_write(map, CMD(0xFF), cfi->chips[i].start); | 2595 | map_write(map, CMD(0xFF), cfi->chips[i].start); |
2594 | chip->oldstate = chip->state = FL_READY; | 2596 | chip->oldstate = chip->state = FL_READY; |
2595 | wake_up(&chip->wq); | 2597 | wake_up(&chip->wq); |
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c index dcda6287228d..ed827cf894e4 100644 --- a/drivers/mtd/devices/m25p80.c +++ b/drivers/mtd/devices/m25p80.c | |||
@@ -193,10 +193,10 @@ static int m25p_probe(struct spi_device *spi) | |||
193 | { | 193 | { |
194 | struct mtd_part_parser_data ppdata; | 194 | struct mtd_part_parser_data ppdata; |
195 | struct flash_platform_data *data; | 195 | struct flash_platform_data *data; |
196 | const struct spi_device_id *id = NULL; | ||
197 | struct m25p *flash; | 196 | struct m25p *flash; |
198 | struct spi_nor *nor; | 197 | struct spi_nor *nor; |
199 | enum read_mode mode = SPI_NOR_NORMAL; | 198 | enum read_mode mode = SPI_NOR_NORMAL; |
199 | char *flash_name = NULL; | ||
200 | int ret; | 200 | int ret; |
201 | 201 | ||
202 | data = dev_get_platdata(&spi->dev); | 202 | data = dev_get_platdata(&spi->dev); |
@@ -236,13 +236,11 @@ static int m25p_probe(struct spi_device *spi) | |||
236 | * If that's the case, respect "type" and ignore a "name". | 236 | * If that's the case, respect "type" and ignore a "name". |
237 | */ | 237 | */ |
238 | if (data && data->type) | 238 | if (data && data->type) |
239 | id = spi_nor_match_id(data->type); | 239 | flash_name = data->type; |
240 | else | ||
241 | flash_name = spi->modalias; | ||
240 | 242 | ||
241 | /* If we didn't get name from platform, simply use "modalias". */ | 243 | ret = spi_nor_scan(nor, flash_name, mode); |
242 | if (!id) | ||
243 | id = spi_get_device_id(spi); | ||
244 | |||
245 | ret = spi_nor_scan(nor, id, mode); | ||
246 | if (ret) | 244 | if (ret) |
247 | return ret; | 245 | return ret; |
248 | 246 | ||
@@ -263,12 +261,62 @@ static int m25p_remove(struct spi_device *spi) | |||
263 | } | 261 | } |
264 | 262 | ||
265 | 263 | ||
264 | /* | ||
265 | * XXX This needs to be kept in sync with spi_nor_ids. We can't share | ||
266 | * it with spi-nor, because if this is built as a module then modpost | ||
267 | * won't be able to read it and add appropriate aliases. | ||
268 | */ | ||
269 | static const struct spi_device_id m25p_ids[] = { | ||
270 | {"at25fs010"}, {"at25fs040"}, {"at25df041a"}, {"at25df321a"}, | ||
271 | {"at25df641"}, {"at26f004"}, {"at26df081a"}, {"at26df161a"}, | ||
272 | {"at26df321"}, {"at45db081d"}, | ||
273 | {"en25f32"}, {"en25p32"}, {"en25q32b"}, {"en25p64"}, | ||
274 | {"en25q64"}, {"en25qh128"}, {"en25qh256"}, | ||
275 | {"f25l32pa"}, | ||
276 | {"mr25h256"}, {"mr25h10"}, | ||
277 | {"gd25q32"}, {"gd25q64"}, | ||
278 | {"160s33b"}, {"320s33b"}, {"640s33b"}, | ||
279 | {"mx25l2005a"}, {"mx25l4005a"}, {"mx25l8005"}, {"mx25l1606e"}, | ||
280 | {"mx25l3205d"}, {"mx25l3255e"}, {"mx25l6405d"}, {"mx25l12805d"}, | ||
281 | {"mx25l12855e"},{"mx25l25635e"},{"mx25l25655e"},{"mx66l51235l"}, | ||
282 | {"mx66l1g55g"}, | ||
283 | {"n25q064"}, {"n25q128a11"}, {"n25q128a13"}, {"n25q256a"}, | ||
284 | {"n25q512a"}, {"n25q512ax3"}, {"n25q00"}, | ||
285 | {"pm25lv512"}, {"pm25lv010"}, {"pm25lq032"}, | ||
286 | {"s25sl032p"}, {"s25sl064p"}, {"s25fl256s0"}, {"s25fl256s1"}, | ||
287 | {"s25fl512s"}, {"s70fl01gs"}, {"s25sl12800"}, {"s25sl12801"}, | ||
288 | {"s25fl129p0"}, {"s25fl129p1"}, {"s25sl004a"}, {"s25sl008a"}, | ||
289 | {"s25sl016a"}, {"s25sl032a"}, {"s25sl064a"}, {"s25fl008k"}, | ||
290 | {"s25fl016k"}, {"s25fl064k"}, | ||
291 | {"sst25vf040b"},{"sst25vf080b"},{"sst25vf016b"},{"sst25vf032b"}, | ||
292 | {"sst25vf064c"},{"sst25wf512"}, {"sst25wf010"}, {"sst25wf020"}, | ||
293 | {"sst25wf040"}, | ||
294 | {"m25p05"}, {"m25p10"}, {"m25p20"}, {"m25p40"}, | ||
295 | {"m25p80"}, {"m25p16"}, {"m25p32"}, {"m25p64"}, | ||
296 | {"m25p128"}, {"n25q032"}, | ||
297 | {"m25p05-nonjedec"}, {"m25p10-nonjedec"}, {"m25p20-nonjedec"}, | ||
298 | {"m25p40-nonjedec"}, {"m25p80-nonjedec"}, {"m25p16-nonjedec"}, | ||
299 | {"m25p32-nonjedec"}, {"m25p64-nonjedec"}, {"m25p128-nonjedec"}, | ||
300 | {"m45pe10"}, {"m45pe80"}, {"m45pe16"}, | ||
301 | {"m25pe20"}, {"m25pe80"}, {"m25pe16"}, | ||
302 | {"m25px16"}, {"m25px32"}, {"m25px32-s0"}, {"m25px32-s1"}, | ||
303 | {"m25px64"}, | ||
304 | {"w25x10"}, {"w25x20"}, {"w25x40"}, {"w25x80"}, | ||
305 | {"w25x16"}, {"w25x32"}, {"w25q32"}, {"w25q32dw"}, | ||
306 | {"w25x64"}, {"w25q64"}, {"w25q128"}, {"w25q80"}, | ||
307 | {"w25q80bl"}, {"w25q128"}, {"w25q256"}, {"cat25c11"}, | ||
308 | {"cat25c03"}, {"cat25c09"}, {"cat25c17"}, {"cat25128"}, | ||
309 | { }, | ||
310 | }; | ||
311 | MODULE_DEVICE_TABLE(spi, m25p_ids); | ||
312 | |||
313 | |||
266 | static struct spi_driver m25p80_driver = { | 314 | static struct spi_driver m25p80_driver = { |
267 | .driver = { | 315 | .driver = { |
268 | .name = "m25p80", | 316 | .name = "m25p80", |
269 | .owner = THIS_MODULE, | 317 | .owner = THIS_MODULE, |
270 | }, | 318 | }, |
271 | .id_table = spi_nor_ids, | 319 | .id_table = m25p_ids, |
272 | .probe = m25p_probe, | 320 | .probe = m25p_probe, |
273 | .remove = m25p_remove, | 321 | .remove = m25p_remove, |
274 | 322 | ||
diff --git a/drivers/mtd/nand/omap_elm.c b/drivers/mtd/nand/omap_elm.c index b4f61c7fc161..058531044ceb 100644 --- a/drivers/mtd/nand/omap_elm.c +++ b/drivers/mtd/nand/omap_elm.c | |||
@@ -115,7 +115,7 @@ int elm_config(struct device *dev, enum bch_ecc bch_type, | |||
115 | 115 | ||
116 | if (!info) { | 116 | if (!info) { |
117 | dev_err(dev, "Unable to configure elm - device not probed?\n"); | 117 | dev_err(dev, "Unable to configure elm - device not probed?\n"); |
118 | return -ENODEV; | 118 | return -EPROBE_DEFER; |
119 | } | 119 | } |
120 | /* ELM cannot detect ECC errors for chunks > 1KB */ | 120 | /* ELM cannot detect ECC errors for chunks > 1KB */ |
121 | if (ecc_step_size > ((ELM_ECC_SIZE + 1) / 2)) { | 121 | if (ecc_step_size > ((ELM_ECC_SIZE + 1) / 2)) { |
diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c index 8d659a2888d5..d5269a26c839 100644 --- a/drivers/mtd/spi-nor/fsl-quadspi.c +++ b/drivers/mtd/spi-nor/fsl-quadspi.c | |||
@@ -881,7 +881,6 @@ static int fsl_qspi_probe(struct platform_device *pdev) | |||
881 | 881 | ||
882 | /* iterate the subnodes. */ | 882 | /* iterate the subnodes. */ |
883 | for_each_available_child_of_node(dev->of_node, np) { | 883 | for_each_available_child_of_node(dev->of_node, np) { |
884 | const struct spi_device_id *id; | ||
885 | char modalias[40]; | 884 | char modalias[40]; |
886 | 885 | ||
887 | /* skip the holes */ | 886 | /* skip the holes */ |
@@ -909,10 +908,6 @@ static int fsl_qspi_probe(struct platform_device *pdev) | |||
909 | if (of_modalias_node(np, modalias, sizeof(modalias)) < 0) | 908 | if (of_modalias_node(np, modalias, sizeof(modalias)) < 0) |
910 | goto map_failed; | 909 | goto map_failed; |
911 | 910 | ||
912 | id = spi_nor_match_id(modalias); | ||
913 | if (!id) | ||
914 | goto map_failed; | ||
915 | |||
916 | ret = of_property_read_u32(np, "spi-max-frequency", | 911 | ret = of_property_read_u32(np, "spi-max-frequency", |
917 | &q->clk_rate); | 912 | &q->clk_rate); |
918 | if (ret < 0) | 913 | if (ret < 0) |
@@ -921,7 +916,7 @@ static int fsl_qspi_probe(struct platform_device *pdev) | |||
921 | /* set the chip address for READID */ | 916 | /* set the chip address for READID */ |
922 | fsl_qspi_set_base_addr(q, nor); | 917 | fsl_qspi_set_base_addr(q, nor); |
923 | 918 | ||
924 | ret = spi_nor_scan(nor, id, SPI_NOR_QUAD); | 919 | ret = spi_nor_scan(nor, modalias, SPI_NOR_QUAD); |
925 | if (ret) | 920 | if (ret) |
926 | goto map_failed; | 921 | goto map_failed; |
927 | 922 | ||
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c index ae16aa2f6885..c51ee52386a7 100644 --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c | |||
@@ -28,6 +28,8 @@ | |||
28 | 28 | ||
29 | #define JEDEC_MFR(_jedec_id) ((_jedec_id) >> 16) | 29 | #define JEDEC_MFR(_jedec_id) ((_jedec_id) >> 16) |
30 | 30 | ||
31 | static const struct spi_device_id *spi_nor_match_id(const char *name); | ||
32 | |||
31 | /* | 33 | /* |
32 | * Read the status register, returning its value in the location | 34 | * Read the status register, returning its value in the location |
33 | * Return the status register value. | 35 | * Return the status register value. |
@@ -473,7 +475,7 @@ struct flash_info { | |||
473 | * more nor chips. This current list focusses on newer chips, which | 475 | * more nor chips. This current list focusses on newer chips, which |
474 | * have been converging on command sets which including JEDEC ID. | 476 | * have been converging on command sets which including JEDEC ID. |
475 | */ | 477 | */ |
476 | const struct spi_device_id spi_nor_ids[] = { | 478 | static const struct spi_device_id spi_nor_ids[] = { |
477 | /* Atmel -- some are (confusingly) marketed as "DataFlash" */ | 479 | /* Atmel -- some are (confusingly) marketed as "DataFlash" */ |
478 | { "at25fs010", INFO(0x1f6601, 0, 32 * 1024, 4, SECT_4K) }, | 480 | { "at25fs010", INFO(0x1f6601, 0, 32 * 1024, 4, SECT_4K) }, |
479 | { "at25fs040", INFO(0x1f6604, 0, 64 * 1024, 8, SECT_4K) }, | 481 | { "at25fs040", INFO(0x1f6604, 0, 64 * 1024, 8, SECT_4K) }, |
@@ -637,7 +639,6 @@ const struct spi_device_id spi_nor_ids[] = { | |||
637 | { "cat25128", CAT25_INFO(2048, 8, 64, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) }, | 639 | { "cat25128", CAT25_INFO(2048, 8, 64, 2, SPI_NOR_NO_ERASE | SPI_NOR_NO_FR) }, |
638 | { }, | 640 | { }, |
639 | }; | 641 | }; |
640 | EXPORT_SYMBOL_GPL(spi_nor_ids); | ||
641 | 642 | ||
642 | static const struct spi_device_id *spi_nor_read_id(struct spi_nor *nor) | 643 | static const struct spi_device_id *spi_nor_read_id(struct spi_nor *nor) |
643 | { | 644 | { |
@@ -911,9 +912,9 @@ static int spi_nor_check(struct spi_nor *nor) | |||
911 | return 0; | 912 | return 0; |
912 | } | 913 | } |
913 | 914 | ||
914 | int spi_nor_scan(struct spi_nor *nor, const struct spi_device_id *id, | 915 | int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode) |
915 | enum read_mode mode) | ||
916 | { | 916 | { |
917 | const struct spi_device_id *id = NULL; | ||
917 | struct flash_info *info; | 918 | struct flash_info *info; |
918 | struct device *dev = nor->dev; | 919 | struct device *dev = nor->dev; |
919 | struct mtd_info *mtd = nor->mtd; | 920 | struct mtd_info *mtd = nor->mtd; |
@@ -925,6 +926,10 @@ int spi_nor_scan(struct spi_nor *nor, const struct spi_device_id *id, | |||
925 | if (ret) | 926 | if (ret) |
926 | return ret; | 927 | return ret; |
927 | 928 | ||
929 | id = spi_nor_match_id(name); | ||
930 | if (!id) | ||
931 | return -ENOENT; | ||
932 | |||
928 | info = (void *)id->driver_data; | 933 | info = (void *)id->driver_data; |
929 | 934 | ||
930 | if (info->jedec_id) { | 935 | if (info->jedec_id) { |
@@ -1113,7 +1118,7 @@ int spi_nor_scan(struct spi_nor *nor, const struct spi_device_id *id, | |||
1113 | } | 1118 | } |
1114 | EXPORT_SYMBOL_GPL(spi_nor_scan); | 1119 | EXPORT_SYMBOL_GPL(spi_nor_scan); |
1115 | 1120 | ||
1116 | const struct spi_device_id *spi_nor_match_id(char *name) | 1121 | static const struct spi_device_id *spi_nor_match_id(const char *name) |
1117 | { | 1122 | { |
1118 | const struct spi_device_id *id = spi_nor_ids; | 1123 | const struct spi_device_id *id = spi_nor_ids; |
1119 | 1124 | ||
@@ -1124,7 +1129,6 @@ const struct spi_device_id *spi_nor_match_id(char *name) | |||
1124 | } | 1129 | } |
1125 | return NULL; | 1130 | return NULL; |
1126 | } | 1131 | } |
1127 | EXPORT_SYMBOL_GPL(spi_nor_match_id); | ||
1128 | 1132 | ||
1129 | MODULE_LICENSE("GPL"); | 1133 | MODULE_LICENSE("GPL"); |
1130 | MODULE_AUTHOR("Huang Shijie <shijie8@gmail.com>"); | 1134 | MODULE_AUTHOR("Huang Shijie <shijie8@gmail.com>"); |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 4706386b7d34..f9009be3f307 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -135,6 +135,7 @@ config MACVLAN | |||
135 | config MACVTAP | 135 | config MACVTAP |
136 | tristate "MAC-VLAN based tap driver" | 136 | tristate "MAC-VLAN based tap driver" |
137 | depends on MACVLAN | 137 | depends on MACVLAN |
138 | depends on INET | ||
138 | help | 139 | help |
139 | This adds a specialized tap character device driver that is based | 140 | This adds a specialized tap character device driver that is based |
140 | on the MAC-VLAN network interface, called macvtap. A macvtap device | 141 | on the MAC-VLAN network interface, called macvtap. A macvtap device |
@@ -200,6 +201,7 @@ config RIONET_RX_SIZE | |||
200 | 201 | ||
201 | config TUN | 202 | config TUN |
202 | tristate "Universal TUN/TAP device driver support" | 203 | tristate "Universal TUN/TAP device driver support" |
204 | depends on INET | ||
203 | select CRC32 | 205 | select CRC32 |
204 | ---help--- | 206 | ---help--- |
205 | TUN/TAP provides packet reception and transmission for user space | 207 | TUN/TAP provides packet reception and transmission for user space |
diff --git a/drivers/net/dsa/mv88e6171.c b/drivers/net/dsa/mv88e6171.c index 1020a7af67cf..78d8e876f3aa 100644 --- a/drivers/net/dsa/mv88e6171.c +++ b/drivers/net/dsa/mv88e6171.c | |||
@@ -395,7 +395,7 @@ static int mv88e6171_get_sset_count(struct dsa_switch *ds) | |||
395 | } | 395 | } |
396 | 396 | ||
397 | struct dsa_switch_driver mv88e6171_switch_driver = { | 397 | struct dsa_switch_driver mv88e6171_switch_driver = { |
398 | .tag_protocol = DSA_TAG_PROTO_DSA, | 398 | .tag_protocol = DSA_TAG_PROTO_EDSA, |
399 | .priv_size = sizeof(struct mv88e6xxx_priv_state), | 399 | .priv_size = sizeof(struct mv88e6xxx_priv_state), |
400 | .probe = mv88e6171_probe, | 400 | .probe = mv88e6171_probe, |
401 | .setup = mv88e6171_setup, | 401 | .setup = mv88e6171_setup, |
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c index 29554992215a..2349ea970255 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c | |||
@@ -1465,7 +1465,7 @@ static int xgbe_set_features(struct net_device *netdev, | |||
1465 | { | 1465 | { |
1466 | struct xgbe_prv_data *pdata = netdev_priv(netdev); | 1466 | struct xgbe_prv_data *pdata = netdev_priv(netdev); |
1467 | struct xgbe_hw_if *hw_if = &pdata->hw_if; | 1467 | struct xgbe_hw_if *hw_if = &pdata->hw_if; |
1468 | unsigned int rxcsum, rxvlan, rxvlan_filter; | 1468 | netdev_features_t rxcsum, rxvlan, rxvlan_filter; |
1469 | 1469 | ||
1470 | rxcsum = pdata->netdev_features & NETIF_F_RXCSUM; | 1470 | rxcsum = pdata->netdev_features & NETIF_F_RXCSUM; |
1471 | rxvlan = pdata->netdev_features & NETIF_F_HW_VLAN_CTAG_RX; | 1471 | rxvlan = pdata->netdev_features & NETIF_F_HW_VLAN_CTAG_RX; |
@@ -1598,7 +1598,8 @@ static int xgbe_rx_poll(struct xgbe_channel *channel, int budget) | |||
1598 | struct skb_shared_hwtstamps *hwtstamps; | 1598 | struct skb_shared_hwtstamps *hwtstamps; |
1599 | unsigned int incomplete, error, context_next, context; | 1599 | unsigned int incomplete, error, context_next, context; |
1600 | unsigned int len, put_len, max_len; | 1600 | unsigned int len, put_len, max_len; |
1601 | int received = 0; | 1601 | unsigned int received = 0; |
1602 | int packet_count = 0; | ||
1602 | 1603 | ||
1603 | DBGPR("-->xgbe_rx_poll: budget=%d\n", budget); | 1604 | DBGPR("-->xgbe_rx_poll: budget=%d\n", budget); |
1604 | 1605 | ||
@@ -1608,7 +1609,7 @@ static int xgbe_rx_poll(struct xgbe_channel *channel, int budget) | |||
1608 | 1609 | ||
1609 | rdata = XGBE_GET_DESC_DATA(ring, ring->cur); | 1610 | rdata = XGBE_GET_DESC_DATA(ring, ring->cur); |
1610 | packet = &ring->packet_data; | 1611 | packet = &ring->packet_data; |
1611 | while (received < budget) { | 1612 | while (packet_count < budget) { |
1612 | DBGPR(" cur = %d\n", ring->cur); | 1613 | DBGPR(" cur = %d\n", ring->cur); |
1613 | 1614 | ||
1614 | /* First time in loop see if we need to restore state */ | 1615 | /* First time in loop see if we need to restore state */ |
@@ -1662,7 +1663,7 @@ read_again: | |||
1662 | if (packet->errors) | 1663 | if (packet->errors) |
1663 | DBGPR("Error in received packet\n"); | 1664 | DBGPR("Error in received packet\n"); |
1664 | dev_kfree_skb(skb); | 1665 | dev_kfree_skb(skb); |
1665 | continue; | 1666 | goto next_packet; |
1666 | } | 1667 | } |
1667 | 1668 | ||
1668 | if (!context) { | 1669 | if (!context) { |
@@ -1677,7 +1678,7 @@ read_again: | |||
1677 | } | 1678 | } |
1678 | 1679 | ||
1679 | dev_kfree_skb(skb); | 1680 | dev_kfree_skb(skb); |
1680 | continue; | 1681 | goto next_packet; |
1681 | } | 1682 | } |
1682 | memcpy(skb_tail_pointer(skb), rdata->skb->data, | 1683 | memcpy(skb_tail_pointer(skb), rdata->skb->data, |
1683 | put_len); | 1684 | put_len); |
@@ -1694,7 +1695,7 @@ read_again: | |||
1694 | 1695 | ||
1695 | /* Stray Context Descriptor? */ | 1696 | /* Stray Context Descriptor? */ |
1696 | if (!skb) | 1697 | if (!skb) |
1697 | continue; | 1698 | goto next_packet; |
1698 | 1699 | ||
1699 | /* Be sure we don't exceed the configured MTU */ | 1700 | /* Be sure we don't exceed the configured MTU */ |
1700 | max_len = netdev->mtu + ETH_HLEN; | 1701 | max_len = netdev->mtu + ETH_HLEN; |
@@ -1705,7 +1706,7 @@ read_again: | |||
1705 | if (skb->len > max_len) { | 1706 | if (skb->len > max_len) { |
1706 | DBGPR("packet length exceeds configured MTU\n"); | 1707 | DBGPR("packet length exceeds configured MTU\n"); |
1707 | dev_kfree_skb(skb); | 1708 | dev_kfree_skb(skb); |
1708 | continue; | 1709 | goto next_packet; |
1709 | } | 1710 | } |
1710 | 1711 | ||
1711 | #ifdef XGMAC_ENABLE_RX_PKT_DUMP | 1712 | #ifdef XGMAC_ENABLE_RX_PKT_DUMP |
@@ -1739,6 +1740,9 @@ read_again: | |||
1739 | 1740 | ||
1740 | netdev->last_rx = jiffies; | 1741 | netdev->last_rx = jiffies; |
1741 | napi_gro_receive(&pdata->napi, skb); | 1742 | napi_gro_receive(&pdata->napi, skb); |
1743 | |||
1744 | next_packet: | ||
1745 | packet_count++; | ||
1742 | } | 1746 | } |
1743 | 1747 | ||
1744 | /* Check if we need to save state before leaving */ | 1748 | /* Check if we need to save state before leaving */ |
@@ -1752,9 +1756,9 @@ read_again: | |||
1752 | rdata->state.error = error; | 1756 | rdata->state.error = error; |
1753 | } | 1757 | } |
1754 | 1758 | ||
1755 | DBGPR("<--xgbe_rx_poll: received = %d\n", received); | 1759 | DBGPR("<--xgbe_rx_poll: packet_count = %d\n", packet_count); |
1756 | 1760 | ||
1757 | return received; | 1761 | return packet_count; |
1758 | } | 1762 | } |
1759 | 1763 | ||
1760 | static int xgbe_poll(struct napi_struct *napi, int budget) | 1764 | static int xgbe_poll(struct napi_struct *napi, int budget) |
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c index 63ea1941e973..7ba83ffb08ac 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c | |||
@@ -575,10 +575,24 @@ static void xgene_gmac_tx_disable(struct xgene_enet_pdata *pdata) | |||
575 | xgene_enet_wr_mcx_mac(pdata, MAC_CONFIG_1_ADDR, data & ~TX_EN); | 575 | xgene_enet_wr_mcx_mac(pdata, MAC_CONFIG_1_ADDR, data & ~TX_EN); |
576 | } | 576 | } |
577 | 577 | ||
578 | static void xgene_enet_reset(struct xgene_enet_pdata *pdata) | 578 | bool xgene_ring_mgr_init(struct xgene_enet_pdata *p) |
579 | { | ||
580 | if (!ioread32(p->ring_csr_addr + CLKEN_ADDR)) | ||
581 | return false; | ||
582 | |||
583 | if (ioread32(p->ring_csr_addr + SRST_ADDR)) | ||
584 | return false; | ||
585 | |||
586 | return true; | ||
587 | } | ||
588 | |||
589 | static int xgene_enet_reset(struct xgene_enet_pdata *pdata) | ||
579 | { | 590 | { |
580 | u32 val; | 591 | u32 val; |
581 | 592 | ||
593 | if (!xgene_ring_mgr_init(pdata)) | ||
594 | return -ENODEV; | ||
595 | |||
582 | clk_prepare_enable(pdata->clk); | 596 | clk_prepare_enable(pdata->clk); |
583 | clk_disable_unprepare(pdata->clk); | 597 | clk_disable_unprepare(pdata->clk); |
584 | clk_prepare_enable(pdata->clk); | 598 | clk_prepare_enable(pdata->clk); |
@@ -590,6 +604,8 @@ static void xgene_enet_reset(struct xgene_enet_pdata *pdata) | |||
590 | val |= SCAN_AUTO_INCR; | 604 | val |= SCAN_AUTO_INCR; |
591 | MGMT_CLOCK_SEL_SET(&val, 1); | 605 | MGMT_CLOCK_SEL_SET(&val, 1); |
592 | xgene_enet_wr_mcx_mac(pdata, MII_MGMT_CONFIG_ADDR, val); | 606 | xgene_enet_wr_mcx_mac(pdata, MII_MGMT_CONFIG_ADDR, val); |
607 | |||
608 | return 0; | ||
593 | } | 609 | } |
594 | 610 | ||
595 | static void xgene_gport_shutdown(struct xgene_enet_pdata *pdata) | 611 | static void xgene_gport_shutdown(struct xgene_enet_pdata *pdata) |
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h index 38558584080e..ec45f3256f0e 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.h | |||
@@ -104,6 +104,9 @@ enum xgene_enet_rm { | |||
104 | #define BLOCK_ETH_MAC_OFFSET 0x0000 | 104 | #define BLOCK_ETH_MAC_OFFSET 0x0000 |
105 | #define BLOCK_ETH_MAC_CSR_OFFSET 0x2800 | 105 | #define BLOCK_ETH_MAC_CSR_OFFSET 0x2800 |
106 | 106 | ||
107 | #define CLKEN_ADDR 0xc208 | ||
108 | #define SRST_ADDR 0xc200 | ||
109 | |||
107 | #define MAC_ADDR_REG_OFFSET 0x00 | 110 | #define MAC_ADDR_REG_OFFSET 0x00 |
108 | #define MAC_COMMAND_REG_OFFSET 0x04 | 111 | #define MAC_COMMAND_REG_OFFSET 0x04 |
109 | #define MAC_WRITE_REG_OFFSET 0x08 | 112 | #define MAC_WRITE_REG_OFFSET 0x08 |
@@ -318,6 +321,7 @@ void xgene_enet_parse_error(struct xgene_enet_desc_ring *ring, | |||
318 | 321 | ||
319 | int xgene_enet_mdio_config(struct xgene_enet_pdata *pdata); | 322 | int xgene_enet_mdio_config(struct xgene_enet_pdata *pdata); |
320 | void xgene_enet_mdio_remove(struct xgene_enet_pdata *pdata); | 323 | void xgene_enet_mdio_remove(struct xgene_enet_pdata *pdata); |
324 | bool xgene_ring_mgr_init(struct xgene_enet_pdata *p); | ||
321 | 325 | ||
322 | extern struct xgene_mac_ops xgene_gmac_ops; | 326 | extern struct xgene_mac_ops xgene_gmac_ops; |
323 | extern struct xgene_port_ops xgene_gport_ops; | 327 | extern struct xgene_port_ops xgene_gport_ops; |
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c index 3c208cc6f6bb..123669696184 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c | |||
@@ -639,9 +639,9 @@ static int xgene_enet_create_desc_rings(struct net_device *ndev) | |||
639 | struct device *dev = ndev_to_dev(ndev); | 639 | struct device *dev = ndev_to_dev(ndev); |
640 | struct xgene_enet_desc_ring *rx_ring, *tx_ring, *cp_ring; | 640 | struct xgene_enet_desc_ring *rx_ring, *tx_ring, *cp_ring; |
641 | struct xgene_enet_desc_ring *buf_pool = NULL; | 641 | struct xgene_enet_desc_ring *buf_pool = NULL; |
642 | u8 cpu_bufnum = 0, eth_bufnum = 0; | 642 | u8 cpu_bufnum = 0, eth_bufnum = START_ETH_BUFNUM; |
643 | u8 bp_bufnum = 0x20; | 643 | u8 bp_bufnum = START_BP_BUFNUM; |
644 | u16 ring_id, ring_num = 0; | 644 | u16 ring_id, ring_num = START_RING_NUM; |
645 | int ret; | 645 | int ret; |
646 | 646 | ||
647 | /* allocate rx descriptor ring */ | 647 | /* allocate rx descriptor ring */ |
@@ -852,7 +852,9 @@ static int xgene_enet_init_hw(struct xgene_enet_pdata *pdata) | |||
852 | u16 dst_ring_num; | 852 | u16 dst_ring_num; |
853 | int ret; | 853 | int ret; |
854 | 854 | ||
855 | pdata->port_ops->reset(pdata); | 855 | ret = pdata->port_ops->reset(pdata); |
856 | if (ret) | ||
857 | return ret; | ||
856 | 858 | ||
857 | ret = xgene_enet_create_desc_rings(ndev); | 859 | ret = xgene_enet_create_desc_rings(ndev); |
858 | if (ret) { | 860 | if (ret) { |
@@ -954,6 +956,7 @@ static int xgene_enet_probe(struct platform_device *pdev) | |||
954 | 956 | ||
955 | return ret; | 957 | return ret; |
956 | err: | 958 | err: |
959 | unregister_netdev(ndev); | ||
957 | free_netdev(ndev); | 960 | free_netdev(ndev); |
958 | return ret; | 961 | return ret; |
959 | } | 962 | } |
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.h b/drivers/net/ethernet/apm/xgene/xgene_enet_main.h index 874e5a01161f..f9958fae6ffd 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.h +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.h | |||
@@ -38,6 +38,9 @@ | |||
38 | #define SKB_BUFFER_SIZE (XGENE_ENET_MAX_MTU - NET_IP_ALIGN) | 38 | #define SKB_BUFFER_SIZE (XGENE_ENET_MAX_MTU - NET_IP_ALIGN) |
39 | #define NUM_PKT_BUF 64 | 39 | #define NUM_PKT_BUF 64 |
40 | #define NUM_BUFPOOL 32 | 40 | #define NUM_BUFPOOL 32 |
41 | #define START_ETH_BUFNUM 2 | ||
42 | #define START_BP_BUFNUM 0x22 | ||
43 | #define START_RING_NUM 8 | ||
41 | 44 | ||
42 | #define PHY_POLL_LINK_ON (10 * HZ) | 45 | #define PHY_POLL_LINK_ON (10 * HZ) |
43 | #define PHY_POLL_LINK_OFF (PHY_POLL_LINK_ON / 5) | 46 | #define PHY_POLL_LINK_OFF (PHY_POLL_LINK_ON / 5) |
@@ -83,7 +86,7 @@ struct xgene_mac_ops { | |||
83 | }; | 86 | }; |
84 | 87 | ||
85 | struct xgene_port_ops { | 88 | struct xgene_port_ops { |
86 | void (*reset)(struct xgene_enet_pdata *pdata); | 89 | int (*reset)(struct xgene_enet_pdata *pdata); |
87 | void (*cle_bypass)(struct xgene_enet_pdata *pdata, | 90 | void (*cle_bypass)(struct xgene_enet_pdata *pdata, |
88 | u32 dst_ring_num, u16 bufpool_id); | 91 | u32 dst_ring_num, u16 bufpool_id); |
89 | void (*shutdown)(struct xgene_enet_pdata *pdata); | 92 | void (*shutdown)(struct xgene_enet_pdata *pdata); |
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c b/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c index e6d24c210198..f5d4f68c288c 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c | |||
@@ -124,20 +124,18 @@ static int xgene_enet_ecc_init(struct xgene_enet_pdata *p) | |||
124 | { | 124 | { |
125 | struct net_device *ndev = p->ndev; | 125 | struct net_device *ndev = p->ndev; |
126 | u32 data; | 126 | u32 data; |
127 | int i; | 127 | int i = 0; |
128 | 128 | ||
129 | xgene_enet_wr_diag_csr(p, ENET_CFG_MEM_RAM_SHUTDOWN_ADDR, 0); | 129 | xgene_enet_wr_diag_csr(p, ENET_CFG_MEM_RAM_SHUTDOWN_ADDR, 0); |
130 | for (i = 0; i < 10 && data != ~0U ; i++) { | 130 | do { |
131 | usleep_range(100, 110); | 131 | usleep_range(100, 110); |
132 | data = xgene_enet_rd_diag_csr(p, ENET_BLOCK_MEM_RDY_ADDR); | 132 | data = xgene_enet_rd_diag_csr(p, ENET_BLOCK_MEM_RDY_ADDR); |
133 | } | 133 | if (data == ~0U) |
134 | 134 | return 0; | |
135 | if (data != ~0U) { | 135 | } while (++i < 10); |
136 | netdev_err(ndev, "Failed to release memory from shutdown\n"); | ||
137 | return -ENODEV; | ||
138 | } | ||
139 | 136 | ||
140 | return 0; | 137 | netdev_err(ndev, "Failed to release memory from shutdown\n"); |
138 | return -ENODEV; | ||
141 | } | 139 | } |
142 | 140 | ||
143 | static void xgene_enet_config_ring_if_assoc(struct xgene_enet_pdata *p) | 141 | static void xgene_enet_config_ring_if_assoc(struct xgene_enet_pdata *p) |
@@ -313,14 +311,19 @@ static void xgene_sgmac_tx_disable(struct xgene_enet_pdata *p) | |||
313 | xgene_sgmac_rxtx(p, TX_EN, false); | 311 | xgene_sgmac_rxtx(p, TX_EN, false); |
314 | } | 312 | } |
315 | 313 | ||
316 | static void xgene_enet_reset(struct xgene_enet_pdata *p) | 314 | static int xgene_enet_reset(struct xgene_enet_pdata *p) |
317 | { | 315 | { |
316 | if (!xgene_ring_mgr_init(p)) | ||
317 | return -ENODEV; | ||
318 | |||
318 | clk_prepare_enable(p->clk); | 319 | clk_prepare_enable(p->clk); |
319 | clk_disable_unprepare(p->clk); | 320 | clk_disable_unprepare(p->clk); |
320 | clk_prepare_enable(p->clk); | 321 | clk_prepare_enable(p->clk); |
321 | 322 | ||
322 | xgene_enet_ecc_init(p); | 323 | xgene_enet_ecc_init(p); |
323 | xgene_enet_config_ring_if_assoc(p); | 324 | xgene_enet_config_ring_if_assoc(p); |
325 | |||
326 | return 0; | ||
324 | } | 327 | } |
325 | 328 | ||
326 | static void xgene_enet_cle_bypass(struct xgene_enet_pdata *p, | 329 | static void xgene_enet_cle_bypass(struct xgene_enet_pdata *p, |
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c index 67d07206b3c7..a18a9d1f1143 100644 --- a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c | |||
@@ -252,14 +252,19 @@ static void xgene_xgmac_tx_disable(struct xgene_enet_pdata *pdata) | |||
252 | xgene_enet_wr_mac(pdata, AXGMAC_CONFIG_1, data & ~HSTTFEN); | 252 | xgene_enet_wr_mac(pdata, AXGMAC_CONFIG_1, data & ~HSTTFEN); |
253 | } | 253 | } |
254 | 254 | ||
255 | static void xgene_enet_reset(struct xgene_enet_pdata *pdata) | 255 | static int xgene_enet_reset(struct xgene_enet_pdata *pdata) |
256 | { | 256 | { |
257 | if (!xgene_ring_mgr_init(pdata)) | ||
258 | return -ENODEV; | ||
259 | |||
257 | clk_prepare_enable(pdata->clk); | 260 | clk_prepare_enable(pdata->clk); |
258 | clk_disable_unprepare(pdata->clk); | 261 | clk_disable_unprepare(pdata->clk); |
259 | clk_prepare_enable(pdata->clk); | 262 | clk_prepare_enable(pdata->clk); |
260 | 263 | ||
261 | xgene_enet_ecc_init(pdata); | 264 | xgene_enet_ecc_init(pdata); |
262 | xgene_enet_config_ring_if_assoc(pdata); | 265 | xgene_enet_config_ring_if_assoc(pdata); |
266 | |||
267 | return 0; | ||
263 | } | 268 | } |
264 | 269 | ||
265 | static void xgene_enet_xgcle_bypass(struct xgene_enet_pdata *pdata, | 270 | static void xgene_enet_xgcle_bypass(struct xgene_enet_pdata *pdata, |
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c index 9ae36979bdee..531bb7c57531 100644 --- a/drivers/net/ethernet/broadcom/bcmsysport.c +++ b/drivers/net/ethernet/broadcom/bcmsysport.c | |||
@@ -1110,7 +1110,8 @@ static int bcm_sysport_init_tx_ring(struct bcm_sysport_priv *priv, | |||
1110 | /* We just need one DMA descriptor which is DMA-able, since writing to | 1110 | /* We just need one DMA descriptor which is DMA-able, since writing to |
1111 | * the port will allocate a new descriptor in its internal linked-list | 1111 | * the port will allocate a new descriptor in its internal linked-list |
1112 | */ | 1112 | */ |
1113 | p = dma_zalloc_coherent(kdev, 1, &ring->desc_dma, GFP_KERNEL); | 1113 | p = dma_zalloc_coherent(kdev, sizeof(struct dma_desc), &ring->desc_dma, |
1114 | GFP_KERNEL); | ||
1114 | if (!p) { | 1115 | if (!p) { |
1115 | netif_err(priv, hw, priv->netdev, "DMA alloc failed\n"); | 1116 | netif_err(priv, hw, priv->netdev, "DMA alloc failed\n"); |
1116 | return -ENOMEM; | 1117 | return -ENOMEM; |
@@ -1174,6 +1175,13 @@ static void bcm_sysport_fini_tx_ring(struct bcm_sysport_priv *priv, | |||
1174 | if (!(reg & TDMA_DISABLED)) | 1175 | if (!(reg & TDMA_DISABLED)) |
1175 | netdev_warn(priv->netdev, "TDMA not stopped!\n"); | 1176 | netdev_warn(priv->netdev, "TDMA not stopped!\n"); |
1176 | 1177 | ||
1178 | /* ring->cbs is the last part in bcm_sysport_init_tx_ring which could | ||
1179 | * fail, so by checking this pointer we know whether the TX ring was | ||
1180 | * fully initialized or not. | ||
1181 | */ | ||
1182 | if (!ring->cbs) | ||
1183 | return; | ||
1184 | |||
1177 | napi_disable(&ring->napi); | 1185 | napi_disable(&ring->napi); |
1178 | netif_napi_del(&ring->napi); | 1186 | netif_napi_del(&ring->napi); |
1179 | 1187 | ||
@@ -1183,7 +1191,8 @@ static void bcm_sysport_fini_tx_ring(struct bcm_sysport_priv *priv, | |||
1183 | ring->cbs = NULL; | 1191 | ring->cbs = NULL; |
1184 | 1192 | ||
1185 | if (ring->desc_dma) { | 1193 | if (ring->desc_dma) { |
1186 | dma_free_coherent(kdev, 1, ring->desc_cpu, ring->desc_dma); | 1194 | dma_free_coherent(kdev, sizeof(struct dma_desc), |
1195 | ring->desc_cpu, ring->desc_dma); | ||
1187 | ring->desc_dma = 0; | 1196 | ring->desc_dma = 0; |
1188 | } | 1197 | } |
1189 | ring->size = 0; | 1198 | ring->size = 0; |
@@ -1397,6 +1406,9 @@ static void bcm_sysport_netif_start(struct net_device *dev) | |||
1397 | /* Enable NAPI */ | 1406 | /* Enable NAPI */ |
1398 | napi_enable(&priv->napi); | 1407 | napi_enable(&priv->napi); |
1399 | 1408 | ||
1409 | /* Enable RX interrupt and TX ring full interrupt */ | ||
1410 | intrl2_0_mask_clear(priv, INTRL2_0_RDMA_MBDONE | INTRL2_0_TX_RING_FULL); | ||
1411 | |||
1400 | phy_start(priv->phydev); | 1412 | phy_start(priv->phydev); |
1401 | 1413 | ||
1402 | /* Enable TX interrupts for the 32 TXQs */ | 1414 | /* Enable TX interrupts for the 32 TXQs */ |
@@ -1499,9 +1511,6 @@ static int bcm_sysport_open(struct net_device *dev) | |||
1499 | if (ret) | 1511 | if (ret) |
1500 | goto out_free_rx_ring; | 1512 | goto out_free_rx_ring; |
1501 | 1513 | ||
1502 | /* Enable RX interrupt and TX ring full interrupt */ | ||
1503 | intrl2_0_mask_clear(priv, INTRL2_0_RDMA_MBDONE | INTRL2_0_TX_RING_FULL); | ||
1504 | |||
1505 | /* Turn on TDMA */ | 1514 | /* Turn on TDMA */ |
1506 | ret = tdma_enable_set(priv, 1); | 1515 | ret = tdma_enable_set(priv, 1); |
1507 | if (ret) | 1516 | if (ret) |
@@ -1858,6 +1867,8 @@ static int bcm_sysport_resume(struct device *d) | |||
1858 | if (!netif_running(dev)) | 1867 | if (!netif_running(dev)) |
1859 | return 0; | 1868 | return 0; |
1860 | 1869 | ||
1870 | umac_reset(priv); | ||
1871 | |||
1861 | /* We may have been suspended and never received a WOL event that | 1872 | /* We may have been suspended and never received a WOL event that |
1862 | * would turn off MPD detection, take care of that now | 1873 | * would turn off MPD detection, take care of that now |
1863 | */ | 1874 | */ |
@@ -1885,9 +1896,6 @@ static int bcm_sysport_resume(struct device *d) | |||
1885 | 1896 | ||
1886 | netif_device_attach(dev); | 1897 | netif_device_attach(dev); |
1887 | 1898 | ||
1888 | /* Enable RX interrupt and TX ring full interrupt */ | ||
1889 | intrl2_0_mask_clear(priv, INTRL2_0_RDMA_MBDONE | INTRL2_0_TX_RING_FULL); | ||
1890 | |||
1891 | /* RX pipe enable */ | 1899 | /* RX pipe enable */ |
1892 | topctrl_writel(priv, 0, RX_FLUSH_CNTL); | 1900 | topctrl_writel(priv, 0, RX_FLUSH_CNTL); |
1893 | 1901 | ||
diff --git a/drivers/net/ethernet/broadcom/cnic.c b/drivers/net/ethernet/broadcom/cnic.c index 23f23c97c2ad..f05fab65d78a 100644 --- a/drivers/net/ethernet/broadcom/cnic.c +++ b/drivers/net/ethernet/broadcom/cnic.c | |||
@@ -382,10 +382,8 @@ static int cnic_iscsi_nl_msg_recv(struct cnic_dev *dev, u32 msg_type, | |||
382 | if (l5_cid >= MAX_CM_SK_TBL_SZ) | 382 | if (l5_cid >= MAX_CM_SK_TBL_SZ) |
383 | break; | 383 | break; |
384 | 384 | ||
385 | rcu_read_lock(); | ||
386 | if (!rcu_access_pointer(cp->ulp_ops[CNIC_ULP_L4])) { | 385 | if (!rcu_access_pointer(cp->ulp_ops[CNIC_ULP_L4])) { |
387 | rc = -ENODEV; | 386 | rc = -ENODEV; |
388 | rcu_read_unlock(); | ||
389 | break; | 387 | break; |
390 | } | 388 | } |
391 | csk = &cp->csk_tbl[l5_cid]; | 389 | csk = &cp->csk_tbl[l5_cid]; |
@@ -414,7 +412,6 @@ static int cnic_iscsi_nl_msg_recv(struct cnic_dev *dev, u32 msg_type, | |||
414 | } | 412 | } |
415 | } | 413 | } |
416 | csk_put(csk); | 414 | csk_put(csk); |
417 | rcu_read_unlock(); | ||
418 | rc = 0; | 415 | rc = 0; |
419 | } | 416 | } |
420 | } | 417 | } |
@@ -615,7 +612,7 @@ static int cnic_unregister_device(struct cnic_dev *dev, int ulp_type) | |||
615 | cnic_send_nlmsg(cp, ISCSI_KEVENT_IF_DOWN, NULL); | 612 | cnic_send_nlmsg(cp, ISCSI_KEVENT_IF_DOWN, NULL); |
616 | 613 | ||
617 | mutex_lock(&cnic_lock); | 614 | mutex_lock(&cnic_lock); |
618 | if (rcu_dereference(cp->ulp_ops[ulp_type])) { | 615 | if (rcu_access_pointer(cp->ulp_ops[ulp_type])) { |
619 | RCU_INIT_POINTER(cp->ulp_ops[ulp_type], NULL); | 616 | RCU_INIT_POINTER(cp->ulp_ops[ulp_type], NULL); |
620 | cnic_put(dev); | 617 | cnic_put(dev); |
621 | } else { | 618 | } else { |
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c index fdc9ec09e453..da1a2500c91c 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c | |||
@@ -2140,6 +2140,12 @@ static int bcmgenet_open(struct net_device *dev) | |||
2140 | goto err_irq0; | 2140 | goto err_irq0; |
2141 | } | 2141 | } |
2142 | 2142 | ||
2143 | /* Re-configure the port multiplexer towards the PHY device */ | ||
2144 | bcmgenet_mii_config(priv->dev, false); | ||
2145 | |||
2146 | phy_connect_direct(dev, priv->phydev, bcmgenet_mii_setup, | ||
2147 | priv->phy_interface); | ||
2148 | |||
2143 | bcmgenet_netif_start(dev); | 2149 | bcmgenet_netif_start(dev); |
2144 | 2150 | ||
2145 | return 0; | 2151 | return 0; |
@@ -2184,6 +2190,9 @@ static int bcmgenet_close(struct net_device *dev) | |||
2184 | 2190 | ||
2185 | bcmgenet_netif_stop(dev); | 2191 | bcmgenet_netif_stop(dev); |
2186 | 2192 | ||
2193 | /* Really kill the PHY state machine and disconnect from it */ | ||
2194 | phy_disconnect(priv->phydev); | ||
2195 | |||
2187 | /* Disable MAC receive */ | 2196 | /* Disable MAC receive */ |
2188 | umac_enable_set(priv, CMD_RX_EN, false); | 2197 | umac_enable_set(priv, CMD_RX_EN, false); |
2189 | 2198 | ||
@@ -2685,7 +2694,7 @@ static int bcmgenet_resume(struct device *d) | |||
2685 | 2694 | ||
2686 | phy_init_hw(priv->phydev); | 2695 | phy_init_hw(priv->phydev); |
2687 | /* Speed settings must be restored */ | 2696 | /* Speed settings must be restored */ |
2688 | bcmgenet_mii_config(priv->dev); | 2697 | bcmgenet_mii_config(priv->dev, false); |
2689 | 2698 | ||
2690 | /* disable ethernet MAC while updating its registers */ | 2699 | /* disable ethernet MAC while updating its registers */ |
2691 | umac_enable_set(priv, CMD_TX_EN | CMD_RX_EN, false); | 2700 | umac_enable_set(priv, CMD_TX_EN | CMD_RX_EN, false); |
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.h b/drivers/net/ethernet/broadcom/genet/bcmgenet.h index dbf524ea3b19..31b2da5f9b82 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.h +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.h | |||
@@ -617,9 +617,10 @@ GENET_IO_MACRO(rbuf, GENET_RBUF_OFF); | |||
617 | 617 | ||
618 | /* MDIO routines */ | 618 | /* MDIO routines */ |
619 | int bcmgenet_mii_init(struct net_device *dev); | 619 | int bcmgenet_mii_init(struct net_device *dev); |
620 | int bcmgenet_mii_config(struct net_device *dev); | 620 | int bcmgenet_mii_config(struct net_device *dev, bool init); |
621 | void bcmgenet_mii_exit(struct net_device *dev); | 621 | void bcmgenet_mii_exit(struct net_device *dev); |
622 | void bcmgenet_mii_reset(struct net_device *dev); | 622 | void bcmgenet_mii_reset(struct net_device *dev); |
623 | void bcmgenet_mii_setup(struct net_device *dev); | ||
623 | 624 | ||
624 | /* Wake-on-LAN routines */ | 625 | /* Wake-on-LAN routines */ |
625 | void bcmgenet_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol); | 626 | void bcmgenet_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol); |
diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c index 9ff799a9f801..933cd7e7cd33 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmmii.c +++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c | |||
@@ -77,7 +77,7 @@ static int bcmgenet_mii_write(struct mii_bus *bus, int phy_id, | |||
77 | /* setup netdev link state when PHY link status change and | 77 | /* setup netdev link state when PHY link status change and |
78 | * update UMAC and RGMII block when link up | 78 | * update UMAC and RGMII block when link up |
79 | */ | 79 | */ |
80 | static void bcmgenet_mii_setup(struct net_device *dev) | 80 | void bcmgenet_mii_setup(struct net_device *dev) |
81 | { | 81 | { |
82 | struct bcmgenet_priv *priv = netdev_priv(dev); | 82 | struct bcmgenet_priv *priv = netdev_priv(dev); |
83 | struct phy_device *phydev = priv->phydev; | 83 | struct phy_device *phydev = priv->phydev; |
@@ -211,7 +211,7 @@ static void bcmgenet_moca_phy_setup(struct bcmgenet_priv *priv) | |||
211 | bcmgenet_sys_writel(priv, reg, SYS_PORT_CTRL); | 211 | bcmgenet_sys_writel(priv, reg, SYS_PORT_CTRL); |
212 | } | 212 | } |
213 | 213 | ||
214 | int bcmgenet_mii_config(struct net_device *dev) | 214 | int bcmgenet_mii_config(struct net_device *dev, bool init) |
215 | { | 215 | { |
216 | struct bcmgenet_priv *priv = netdev_priv(dev); | 216 | struct bcmgenet_priv *priv = netdev_priv(dev); |
217 | struct phy_device *phydev = priv->phydev; | 217 | struct phy_device *phydev = priv->phydev; |
@@ -298,7 +298,8 @@ int bcmgenet_mii_config(struct net_device *dev) | |||
298 | return -EINVAL; | 298 | return -EINVAL; |
299 | } | 299 | } |
300 | 300 | ||
301 | dev_info(kdev, "configuring instance for %s\n", phy_name); | 301 | if (init) |
302 | dev_info(kdev, "configuring instance for %s\n", phy_name); | ||
302 | 303 | ||
303 | return 0; | 304 | return 0; |
304 | } | 305 | } |
@@ -350,7 +351,7 @@ static int bcmgenet_mii_probe(struct net_device *dev) | |||
350 | * PHY speed which is needed for bcmgenet_mii_config() to configure | 351 | * PHY speed which is needed for bcmgenet_mii_config() to configure |
351 | * things appropriately. | 352 | * things appropriately. |
352 | */ | 353 | */ |
353 | ret = bcmgenet_mii_config(dev); | 354 | ret = bcmgenet_mii_config(dev, true); |
354 | if (ret) { | 355 | if (ret) { |
355 | phy_disconnect(priv->phydev); | 356 | phy_disconnect(priv->phydev); |
356 | return ret; | 357 | return ret; |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c index 8edf0f5bd679..cca604994003 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_dcb.c | |||
@@ -60,6 +60,43 @@ void cxgb4_dcb_version_init(struct net_device *dev) | |||
60 | dcb->dcb_version = FW_PORT_DCB_VER_AUTO; | 60 | dcb->dcb_version = FW_PORT_DCB_VER_AUTO; |
61 | } | 61 | } |
62 | 62 | ||
63 | static void cxgb4_dcb_cleanup_apps(struct net_device *dev) | ||
64 | { | ||
65 | struct port_info *pi = netdev2pinfo(dev); | ||
66 | struct adapter *adap = pi->adapter; | ||
67 | struct port_dcb_info *dcb = &pi->dcb; | ||
68 | struct dcb_app app; | ||
69 | int i, err; | ||
70 | |||
71 | /* zero priority implies remove */ | ||
72 | app.priority = 0; | ||
73 | |||
74 | for (i = 0; i < CXGB4_MAX_DCBX_APP_SUPPORTED; i++) { | ||
75 | /* Check if app list is exhausted */ | ||
76 | if (!dcb->app_priority[i].protocolid) | ||
77 | break; | ||
78 | |||
79 | app.protocol = dcb->app_priority[i].protocolid; | ||
80 | |||
81 | if (dcb->dcb_version == FW_PORT_DCB_VER_IEEE) { | ||
82 | app.priority = dcb->app_priority[i].user_prio_map; | ||
83 | app.selector = dcb->app_priority[i].sel_field + 1; | ||
84 | err = dcb_ieee_delapp(dev, &app); | ||
85 | } else { | ||
86 | app.selector = !!(dcb->app_priority[i].sel_field); | ||
87 | err = dcb_setapp(dev, &app); | ||
88 | } | ||
89 | |||
90 | if (err) { | ||
91 | dev_err(adap->pdev_dev, | ||
92 | "Failed DCB Clear %s Application Priority: sel=%d, prot=%d, , err=%d\n", | ||
93 | dcb_ver_array[dcb->dcb_version], app.selector, | ||
94 | app.protocol, -err); | ||
95 | break; | ||
96 | } | ||
97 | } | ||
98 | } | ||
99 | |||
63 | /* Finite State machine for Data Center Bridging. | 100 | /* Finite State machine for Data Center Bridging. |
64 | */ | 101 | */ |
65 | void cxgb4_dcb_state_fsm(struct net_device *dev, | 102 | void cxgb4_dcb_state_fsm(struct net_device *dev, |
@@ -80,14 +117,17 @@ void cxgb4_dcb_state_fsm(struct net_device *dev, | |||
80 | /* we're going to use Host DCB */ | 117 | /* we're going to use Host DCB */ |
81 | dcb->state = CXGB4_DCB_STATE_HOST; | 118 | dcb->state = CXGB4_DCB_STATE_HOST; |
82 | dcb->supported = CXGB4_DCBX_HOST_SUPPORT; | 119 | dcb->supported = CXGB4_DCBX_HOST_SUPPORT; |
83 | dcb->enabled = 1; | ||
84 | break; | 120 | break; |
85 | } | 121 | } |
86 | 122 | ||
87 | case CXGB4_DCB_INPUT_FW_ENABLED: { | 123 | case CXGB4_DCB_INPUT_FW_ENABLED: { |
88 | /* we're going to use Firmware DCB */ | 124 | /* we're going to use Firmware DCB */ |
89 | dcb->state = CXGB4_DCB_STATE_FW_INCOMPLETE; | 125 | dcb->state = CXGB4_DCB_STATE_FW_INCOMPLETE; |
90 | dcb->supported = CXGB4_DCBX_FW_SUPPORT; | 126 | dcb->supported = DCB_CAP_DCBX_LLD_MANAGED; |
127 | if (dcb->dcb_version == FW_PORT_DCB_VER_IEEE) | ||
128 | dcb->supported |= DCB_CAP_DCBX_VER_IEEE; | ||
129 | else | ||
130 | dcb->supported |= DCB_CAP_DCBX_VER_CEE; | ||
91 | break; | 131 | break; |
92 | } | 132 | } |
93 | 133 | ||
@@ -145,6 +185,7 @@ void cxgb4_dcb_state_fsm(struct net_device *dev, | |||
145 | * state. We need to reset back to a ground state | 185 | * state. We need to reset back to a ground state |
146 | * of incomplete. | 186 | * of incomplete. |
147 | */ | 187 | */ |
188 | cxgb4_dcb_cleanup_apps(dev); | ||
148 | cxgb4_dcb_state_init(dev); | 189 | cxgb4_dcb_state_init(dev); |
149 | dcb->state = CXGB4_DCB_STATE_FW_INCOMPLETE; | 190 | dcb->state = CXGB4_DCB_STATE_FW_INCOMPLETE; |
150 | dcb->supported = CXGB4_DCBX_FW_SUPPORT; | 191 | dcb->supported = CXGB4_DCBX_FW_SUPPORT; |
@@ -349,6 +390,12 @@ static u8 cxgb4_setstate(struct net_device *dev, u8 enabled) | |||
349 | { | 390 | { |
350 | struct port_info *pi = netdev2pinfo(dev); | 391 | struct port_info *pi = netdev2pinfo(dev); |
351 | 392 | ||
393 | /* If DCBx is host-managed, dcb is enabled by outside lldp agents */ | ||
394 | if (pi->dcb.state == CXGB4_DCB_STATE_HOST) { | ||
395 | pi->dcb.enabled = enabled; | ||
396 | return 0; | ||
397 | } | ||
398 | |||
352 | /* Firmware doesn't provide any mechanism to control the DCB state. | 399 | /* Firmware doesn't provide any mechanism to control the DCB state. |
353 | */ | 400 | */ |
354 | if (enabled != (pi->dcb.state == CXGB4_DCB_STATE_FW_ALLSYNCED)) | 401 | if (enabled != (pi->dcb.state == CXGB4_DCB_STATE_FW_ALLSYNCED)) |
@@ -394,14 +441,17 @@ static void cxgb4_getpgtccfg(struct net_device *dev, int tc, | |||
394 | *up_tc_map = (1 << tc); | 441 | *up_tc_map = (1 << tc); |
395 | 442 | ||
396 | /* prio_type is link strict */ | 443 | /* prio_type is link strict */ |
397 | *prio_type = 0x2; | 444 | if (*pgid != 0xF) |
445 | *prio_type = 0x2; | ||
398 | } | 446 | } |
399 | 447 | ||
400 | static void cxgb4_getpgtccfg_tx(struct net_device *dev, int tc, | 448 | static void cxgb4_getpgtccfg_tx(struct net_device *dev, int tc, |
401 | u8 *prio_type, u8 *pgid, u8 *bw_per, | 449 | u8 *prio_type, u8 *pgid, u8 *bw_per, |
402 | u8 *up_tc_map) | 450 | u8 *up_tc_map) |
403 | { | 451 | { |
404 | return cxgb4_getpgtccfg(dev, tc, prio_type, pgid, bw_per, up_tc_map, 1); | 452 | /* tc 0 is written at MSB position */ |
453 | return cxgb4_getpgtccfg(dev, (7 - tc), prio_type, pgid, bw_per, | ||
454 | up_tc_map, 1); | ||
405 | } | 455 | } |
406 | 456 | ||
407 | 457 | ||
@@ -409,7 +459,9 @@ static void cxgb4_getpgtccfg_rx(struct net_device *dev, int tc, | |||
409 | u8 *prio_type, u8 *pgid, u8 *bw_per, | 459 | u8 *prio_type, u8 *pgid, u8 *bw_per, |
410 | u8 *up_tc_map) | 460 | u8 *up_tc_map) |
411 | { | 461 | { |
412 | return cxgb4_getpgtccfg(dev, tc, prio_type, pgid, bw_per, up_tc_map, 0); | 462 | /* tc 0 is written at MSB position */ |
463 | return cxgb4_getpgtccfg(dev, (7 - tc), prio_type, pgid, bw_per, | ||
464 | up_tc_map, 0); | ||
413 | } | 465 | } |
414 | 466 | ||
415 | static void cxgb4_setpgtccfg_tx(struct net_device *dev, int tc, | 467 | static void cxgb4_setpgtccfg_tx(struct net_device *dev, int tc, |
@@ -419,6 +471,7 @@ static void cxgb4_setpgtccfg_tx(struct net_device *dev, int tc, | |||
419 | struct fw_port_cmd pcmd; | 471 | struct fw_port_cmd pcmd; |
420 | struct port_info *pi = netdev2pinfo(dev); | 472 | struct port_info *pi = netdev2pinfo(dev); |
421 | struct adapter *adap = pi->adapter; | 473 | struct adapter *adap = pi->adapter; |
474 | int fw_tc = 7 - tc; | ||
422 | u32 _pgid; | 475 | u32 _pgid; |
423 | int err; | 476 | int err; |
424 | 477 | ||
@@ -437,8 +490,8 @@ static void cxgb4_setpgtccfg_tx(struct net_device *dev, int tc, | |||
437 | } | 490 | } |
438 | 491 | ||
439 | _pgid = be32_to_cpu(pcmd.u.dcb.pgid.pgid); | 492 | _pgid = be32_to_cpu(pcmd.u.dcb.pgid.pgid); |
440 | _pgid &= ~(0xF << (tc * 4)); | 493 | _pgid &= ~(0xF << (fw_tc * 4)); |
441 | _pgid |= pgid << (tc * 4); | 494 | _pgid |= pgid << (fw_tc * 4); |
442 | pcmd.u.dcb.pgid.pgid = cpu_to_be32(_pgid); | 495 | pcmd.u.dcb.pgid.pgid = cpu_to_be32(_pgid); |
443 | 496 | ||
444 | INIT_PORT_DCB_WRITE_CMD(pcmd, pi->port_id); | 497 | INIT_PORT_DCB_WRITE_CMD(pcmd, pi->port_id); |
@@ -551,7 +604,7 @@ static void cxgb4_getpfccfg(struct net_device *dev, int priority, u8 *pfccfg) | |||
551 | priority >= CXGB4_MAX_PRIORITY) | 604 | priority >= CXGB4_MAX_PRIORITY) |
552 | *pfccfg = 0; | 605 | *pfccfg = 0; |
553 | else | 606 | else |
554 | *pfccfg = (pi->dcb.pfcen >> priority) & 1; | 607 | *pfccfg = (pi->dcb.pfcen >> (7 - priority)) & 1; |
555 | } | 608 | } |
556 | 609 | ||
557 | /* Enable/disable Priority Pause Frames for the specified Traffic Class | 610 | /* Enable/disable Priority Pause Frames for the specified Traffic Class |
@@ -576,9 +629,9 @@ static void cxgb4_setpfccfg(struct net_device *dev, int priority, u8 pfccfg) | |||
576 | pcmd.u.dcb.pfc.pfcen = pi->dcb.pfcen; | 629 | pcmd.u.dcb.pfc.pfcen = pi->dcb.pfcen; |
577 | 630 | ||
578 | if (pfccfg) | 631 | if (pfccfg) |
579 | pcmd.u.dcb.pfc.pfcen |= (1 << priority); | 632 | pcmd.u.dcb.pfc.pfcen |= (1 << (7 - priority)); |
580 | else | 633 | else |
581 | pcmd.u.dcb.pfc.pfcen &= (~(1 << priority)); | 634 | pcmd.u.dcb.pfc.pfcen &= (~(1 << (7 - priority))); |
582 | 635 | ||
583 | err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); | 636 | err = t4_wr_mbox(adap, adap->mbox, &pcmd, sizeof(pcmd), &pcmd); |
584 | if (err != FW_PORT_DCB_CFG_SUCCESS) { | 637 | if (err != FW_PORT_DCB_CFG_SUCCESS) { |
@@ -833,11 +886,16 @@ static int cxgb4_setapp(struct net_device *dev, u8 app_idtype, u16 app_id, | |||
833 | 886 | ||
834 | /* Return whether IEEE Data Center Bridging has been negotiated. | 887 | /* Return whether IEEE Data Center Bridging has been negotiated. |
835 | */ | 888 | */ |
836 | static inline int cxgb4_ieee_negotiation_complete(struct net_device *dev) | 889 | static inline int |
890 | cxgb4_ieee_negotiation_complete(struct net_device *dev, | ||
891 | enum cxgb4_dcb_fw_msgs dcb_subtype) | ||
837 | { | 892 | { |
838 | struct port_info *pi = netdev2pinfo(dev); | 893 | struct port_info *pi = netdev2pinfo(dev); |
839 | struct port_dcb_info *dcb = &pi->dcb; | 894 | struct port_dcb_info *dcb = &pi->dcb; |
840 | 895 | ||
896 | if (dcb_subtype && !(dcb->msgs & dcb_subtype)) | ||
897 | return 0; | ||
898 | |||
841 | return (dcb->state == CXGB4_DCB_STATE_FW_ALLSYNCED && | 899 | return (dcb->state == CXGB4_DCB_STATE_FW_ALLSYNCED && |
842 | (dcb->supported & DCB_CAP_DCBX_VER_IEEE)); | 900 | (dcb->supported & DCB_CAP_DCBX_VER_IEEE)); |
843 | } | 901 | } |
@@ -850,7 +908,7 @@ static int cxgb4_ieee_getapp(struct net_device *dev, struct dcb_app *app) | |||
850 | { | 908 | { |
851 | int prio; | 909 | int prio; |
852 | 910 | ||
853 | if (!cxgb4_ieee_negotiation_complete(dev)) | 911 | if (!cxgb4_ieee_negotiation_complete(dev, CXGB4_DCB_FW_APP_ID)) |
854 | return -EINVAL; | 912 | return -EINVAL; |
855 | if (!(app->selector && app->protocol)) | 913 | if (!(app->selector && app->protocol)) |
856 | return -EINVAL; | 914 | return -EINVAL; |
@@ -872,7 +930,7 @@ static int cxgb4_ieee_setapp(struct net_device *dev, struct dcb_app *app) | |||
872 | { | 930 | { |
873 | int ret; | 931 | int ret; |
874 | 932 | ||
875 | if (!cxgb4_ieee_negotiation_complete(dev)) | 933 | if (!cxgb4_ieee_negotiation_complete(dev, CXGB4_DCB_FW_APP_ID)) |
876 | return -EINVAL; | 934 | return -EINVAL; |
877 | if (!(app->selector && app->protocol)) | 935 | if (!(app->selector && app->protocol)) |
878 | return -EINVAL; | 936 | return -EINVAL; |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index 3f60070f2519..8520d5529df8 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | |||
@@ -694,7 +694,11 @@ int cxgb4_dcb_enabled(const struct net_device *dev) | |||
694 | #ifdef CONFIG_CHELSIO_T4_DCB | 694 | #ifdef CONFIG_CHELSIO_T4_DCB |
695 | struct port_info *pi = netdev_priv(dev); | 695 | struct port_info *pi = netdev_priv(dev); |
696 | 696 | ||
697 | return pi->dcb.state == CXGB4_DCB_STATE_FW_ALLSYNCED; | 697 | if (!pi->dcb.enabled) |
698 | return 0; | ||
699 | |||
700 | return ((pi->dcb.state == CXGB4_DCB_STATE_FW_ALLSYNCED) || | ||
701 | (pi->dcb.state == CXGB4_DCB_STATE_HOST)); | ||
698 | #else | 702 | #else |
699 | return 0; | 703 | return 0; |
700 | #endif | 704 | #endif |
@@ -6610,6 +6614,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
6610 | 6614 | ||
6611 | spin_lock_init(&adapter->stats_lock); | 6615 | spin_lock_init(&adapter->stats_lock); |
6612 | spin_lock_init(&adapter->tid_release_lock); | 6616 | spin_lock_init(&adapter->tid_release_lock); |
6617 | spin_lock_init(&adapter->win0_lock); | ||
6613 | 6618 | ||
6614 | INIT_WORK(&adapter->tid_release_task, process_tid_release_list); | 6619 | INIT_WORK(&adapter->tid_release_task, process_tid_release_list); |
6615 | INIT_WORK(&adapter->db_full_task, process_db_full); | 6620 | INIT_WORK(&adapter->db_full_task, process_db_full); |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/sge.c b/drivers/net/ethernet/chelsio/cxgb4/sge.c index 5e1b314e11af..39f2b13e66c7 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/sge.c +++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c | |||
@@ -2914,7 +2914,8 @@ static int t4_sge_init_hard(struct adapter *adap) | |||
2914 | int t4_sge_init(struct adapter *adap) | 2914 | int t4_sge_init(struct adapter *adap) |
2915 | { | 2915 | { |
2916 | struct sge *s = &adap->sge; | 2916 | struct sge *s = &adap->sge; |
2917 | u32 sge_control, sge_conm_ctrl; | 2917 | u32 sge_control, sge_control2, sge_conm_ctrl; |
2918 | unsigned int ingpadboundary, ingpackboundary; | ||
2918 | int ret, egress_threshold; | 2919 | int ret, egress_threshold; |
2919 | 2920 | ||
2920 | /* | 2921 | /* |
@@ -2924,8 +2925,31 @@ int t4_sge_init(struct adapter *adap) | |||
2924 | sge_control = t4_read_reg(adap, SGE_CONTROL); | 2925 | sge_control = t4_read_reg(adap, SGE_CONTROL); |
2925 | s->pktshift = PKTSHIFT_GET(sge_control); | 2926 | s->pktshift = PKTSHIFT_GET(sge_control); |
2926 | s->stat_len = (sge_control & EGRSTATUSPAGESIZE_MASK) ? 128 : 64; | 2927 | s->stat_len = (sge_control & EGRSTATUSPAGESIZE_MASK) ? 128 : 64; |
2927 | s->fl_align = 1 << (INGPADBOUNDARY_GET(sge_control) + | 2928 | |
2928 | X_INGPADBOUNDARY_SHIFT); | 2929 | /* T4 uses a single control field to specify both the PCIe Padding and |
2930 | * Packing Boundary. T5 introduced the ability to specify these | ||
2931 | * separately. The actual Ingress Packet Data alignment boundary | ||
2932 | * within Packed Buffer Mode is the maximum of these two | ||
2933 | * specifications. | ||
2934 | */ | ||
2935 | ingpadboundary = 1 << (INGPADBOUNDARY_GET(sge_control) + | ||
2936 | X_INGPADBOUNDARY_SHIFT); | ||
2937 | if (is_t4(adap->params.chip)) { | ||
2938 | s->fl_align = ingpadboundary; | ||
2939 | } else { | ||
2940 | /* T5 has a different interpretation of one of the PCIe Packing | ||
2941 | * Boundary values. | ||
2942 | */ | ||
2943 | sge_control2 = t4_read_reg(adap, SGE_CONTROL2_A); | ||
2944 | ingpackboundary = INGPACKBOUNDARY_G(sge_control2); | ||
2945 | if (ingpackboundary == INGPACKBOUNDARY_16B_X) | ||
2946 | ingpackboundary = 16; | ||
2947 | else | ||
2948 | ingpackboundary = 1 << (ingpackboundary + | ||
2949 | INGPACKBOUNDARY_SHIFT_X); | ||
2950 | |||
2951 | s->fl_align = max(ingpadboundary, ingpackboundary); | ||
2952 | } | ||
2929 | 2953 | ||
2930 | if (adap->flags & USING_SOFT_PARAMS) | 2954 | if (adap->flags & USING_SOFT_PARAMS) |
2931 | ret = t4_sge_init_soft(adap); | 2955 | ret = t4_sge_init_soft(adap); |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c index a9d9d74e4f09..163a2a14948c 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | |||
@@ -3129,12 +3129,51 @@ int t4_fixup_host_params(struct adapter *adap, unsigned int page_size, | |||
3129 | HOSTPAGESIZEPF6(sge_hps) | | 3129 | HOSTPAGESIZEPF6(sge_hps) | |
3130 | HOSTPAGESIZEPF7(sge_hps)); | 3130 | HOSTPAGESIZEPF7(sge_hps)); |
3131 | 3131 | ||
3132 | t4_set_reg_field(adap, SGE_CONTROL, | 3132 | if (is_t4(adap->params.chip)) { |
3133 | INGPADBOUNDARY_MASK | | 3133 | t4_set_reg_field(adap, SGE_CONTROL, |
3134 | EGRSTATUSPAGESIZE_MASK, | 3134 | INGPADBOUNDARY_MASK | |
3135 | INGPADBOUNDARY(fl_align_log - 5) | | 3135 | EGRSTATUSPAGESIZE_MASK, |
3136 | EGRSTATUSPAGESIZE(stat_len != 64)); | 3136 | INGPADBOUNDARY(fl_align_log - 5) | |
3137 | 3137 | EGRSTATUSPAGESIZE(stat_len != 64)); | |
3138 | } else { | ||
3139 | /* T5 introduced the separation of the Free List Padding and | ||
3140 | * Packing Boundaries. Thus, we can select a smaller Padding | ||
3141 | * Boundary to avoid uselessly chewing up PCIe Link and Memory | ||
3142 | * Bandwidth, and use a Packing Boundary which is large enough | ||
3143 | * to avoid false sharing between CPUs, etc. | ||
3144 | * | ||
3145 | * For the PCI Link, the smaller the Padding Boundary the | ||
3146 | * better. For the Memory Controller, a smaller Padding | ||
3147 | * Boundary is better until we cross under the Memory Line | ||
3148 | * Size (the minimum unit of transfer to/from Memory). If we | ||
3149 | * have a Padding Boundary which is smaller than the Memory | ||
3150 | * Line Size, that'll involve a Read-Modify-Write cycle on the | ||
3151 | * Memory Controller which is never good. For T5 the smallest | ||
3152 | * Padding Boundary which we can select is 32 bytes which is | ||
3153 | * larger than any known Memory Controller Line Size so we'll | ||
3154 | * use that. | ||
3155 | * | ||
3156 | * T5 has a different interpretation of the "0" value for the | ||
3157 | * Packing Boundary. This corresponds to 16 bytes instead of | ||
3158 | * the expected 32 bytes. We never have a Packing Boundary | ||
3159 | * less than 32 bytes so we can't use that special value but | ||
3160 | * on the other hand, if we wanted 32 bytes, the best we can | ||
3161 | * really do is 64 bytes. | ||
3162 | */ | ||
3163 | if (fl_align <= 32) { | ||
3164 | fl_align = 64; | ||
3165 | fl_align_log = 6; | ||
3166 | } | ||
3167 | t4_set_reg_field(adap, SGE_CONTROL, | ||
3168 | INGPADBOUNDARY_MASK | | ||
3169 | EGRSTATUSPAGESIZE_MASK, | ||
3170 | INGPADBOUNDARY(INGPCIEBOUNDARY_32B_X) | | ||
3171 | EGRSTATUSPAGESIZE(stat_len != 64)); | ||
3172 | t4_set_reg_field(adap, SGE_CONTROL2_A, | ||
3173 | INGPACKBOUNDARY_V(INGPACKBOUNDARY_M), | ||
3174 | INGPACKBOUNDARY_V(fl_align_log - | ||
3175 | INGPACKBOUNDARY_SHIFT_X)); | ||
3176 | } | ||
3138 | /* | 3177 | /* |
3139 | * Adjust various SGE Free List Host Buffer Sizes. | 3178 | * Adjust various SGE Free List Host Buffer Sizes. |
3140 | * | 3179 | * |
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h b/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h index a1024db5dc13..8d2de1006b08 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_regs.h | |||
@@ -95,6 +95,7 @@ | |||
95 | #define X_INGPADBOUNDARY_SHIFT 5 | 95 | #define X_INGPADBOUNDARY_SHIFT 5 |
96 | 96 | ||
97 | #define SGE_CONTROL 0x1008 | 97 | #define SGE_CONTROL 0x1008 |
98 | #define SGE_CONTROL2_A 0x1124 | ||
98 | #define DCASYSTYPE 0x00080000U | 99 | #define DCASYSTYPE 0x00080000U |
99 | #define RXPKTCPLMODE_MASK 0x00040000U | 100 | #define RXPKTCPLMODE_MASK 0x00040000U |
100 | #define RXPKTCPLMODE_SHIFT 18 | 101 | #define RXPKTCPLMODE_SHIFT 18 |
@@ -106,6 +107,7 @@ | |||
106 | #define PKTSHIFT_SHIFT 10 | 107 | #define PKTSHIFT_SHIFT 10 |
107 | #define PKTSHIFT(x) ((x) << PKTSHIFT_SHIFT) | 108 | #define PKTSHIFT(x) ((x) << PKTSHIFT_SHIFT) |
108 | #define PKTSHIFT_GET(x) (((x) & PKTSHIFT_MASK) >> PKTSHIFT_SHIFT) | 109 | #define PKTSHIFT_GET(x) (((x) & PKTSHIFT_MASK) >> PKTSHIFT_SHIFT) |
110 | #define INGPCIEBOUNDARY_32B_X 0 | ||
109 | #define INGPCIEBOUNDARY_MASK 0x00000380U | 111 | #define INGPCIEBOUNDARY_MASK 0x00000380U |
110 | #define INGPCIEBOUNDARY_SHIFT 7 | 112 | #define INGPCIEBOUNDARY_SHIFT 7 |
111 | #define INGPCIEBOUNDARY(x) ((x) << INGPCIEBOUNDARY_SHIFT) | 113 | #define INGPCIEBOUNDARY(x) ((x) << INGPCIEBOUNDARY_SHIFT) |
@@ -114,6 +116,14 @@ | |||
114 | #define INGPADBOUNDARY(x) ((x) << INGPADBOUNDARY_SHIFT) | 116 | #define INGPADBOUNDARY(x) ((x) << INGPADBOUNDARY_SHIFT) |
115 | #define INGPADBOUNDARY_GET(x) (((x) & INGPADBOUNDARY_MASK) \ | 117 | #define INGPADBOUNDARY_GET(x) (((x) & INGPADBOUNDARY_MASK) \ |
116 | >> INGPADBOUNDARY_SHIFT) | 118 | >> INGPADBOUNDARY_SHIFT) |
119 | #define INGPACKBOUNDARY_16B_X 0 | ||
120 | #define INGPACKBOUNDARY_SHIFT_X 5 | ||
121 | |||
122 | #define INGPACKBOUNDARY_S 16 | ||
123 | #define INGPACKBOUNDARY_M 0x7U | ||
124 | #define INGPACKBOUNDARY_V(x) ((x) << INGPACKBOUNDARY_S) | ||
125 | #define INGPACKBOUNDARY_G(x) (((x) >> INGPACKBOUNDARY_S) \ | ||
126 | & INGPACKBOUNDARY_M) | ||
117 | #define EGRPCIEBOUNDARY_MASK 0x0000000eU | 127 | #define EGRPCIEBOUNDARY_MASK 0x0000000eU |
118 | #define EGRPCIEBOUNDARY_SHIFT 1 | 128 | #define EGRPCIEBOUNDARY_SHIFT 1 |
119 | #define EGRPCIEBOUNDARY(x) ((x) << EGRPCIEBOUNDARY_SHIFT) | 129 | #define EGRPCIEBOUNDARY(x) ((x) << EGRPCIEBOUNDARY_SHIFT) |
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/adapter.h b/drivers/net/ethernet/chelsio/cxgb4vf/adapter.h index 68eaa9c88c7d..3d06e77d7121 100644 --- a/drivers/net/ethernet/chelsio/cxgb4vf/adapter.h +++ b/drivers/net/ethernet/chelsio/cxgb4vf/adapter.h | |||
@@ -299,6 +299,14 @@ struct sge { | |||
299 | u16 timer_val[SGE_NTIMERS]; /* interrupt holdoff timer array */ | 299 | u16 timer_val[SGE_NTIMERS]; /* interrupt holdoff timer array */ |
300 | u8 counter_val[SGE_NCOUNTERS]; /* interrupt RX threshold array */ | 300 | u8 counter_val[SGE_NCOUNTERS]; /* interrupt RX threshold array */ |
301 | 301 | ||
302 | /* Decoded Adapter Parameters. | ||
303 | */ | ||
304 | u32 fl_pg_order; /* large page allocation size */ | ||
305 | u32 stat_len; /* length of status page at ring end */ | ||
306 | u32 pktshift; /* padding between CPL & packet data */ | ||
307 | u32 fl_align; /* response queue message alignment */ | ||
308 | u32 fl_starve_thres; /* Free List starvation threshold */ | ||
309 | |||
302 | /* | 310 | /* |
303 | * Reverse maps from Absolute Queue IDs to associated queue pointers. | 311 | * Reverse maps from Absolute Queue IDs to associated queue pointers. |
304 | * The absolute Queue IDs are in a compact range which start at a | 312 | * The absolute Queue IDs are in a compact range which start at a |
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c index bfa398d91826..0b42bddaf284 100644 --- a/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c | |||
@@ -2929,14 +2929,14 @@ static const struct pci_device_id cxgb4vf_pci_tbl[] = { | |||
2929 | CH_DEVICE(0x480d), /* T480-cr */ | 2929 | CH_DEVICE(0x480d), /* T480-cr */ |
2930 | CH_DEVICE(0x480e), /* T440-lp-cr */ | 2930 | CH_DEVICE(0x480e), /* T440-lp-cr */ |
2931 | CH_DEVICE(0x4880), | 2931 | CH_DEVICE(0x4880), |
2932 | CH_DEVICE(0x4880), | 2932 | CH_DEVICE(0x4881), |
2933 | CH_DEVICE(0x4880), | 2933 | CH_DEVICE(0x4882), |
2934 | CH_DEVICE(0x4880), | 2934 | CH_DEVICE(0x4883), |
2935 | CH_DEVICE(0x4880), | 2935 | CH_DEVICE(0x4884), |
2936 | CH_DEVICE(0x4880), | 2936 | CH_DEVICE(0x4885), |
2937 | CH_DEVICE(0x4880), | 2937 | CH_DEVICE(0x4886), |
2938 | CH_DEVICE(0x4880), | 2938 | CH_DEVICE(0x4887), |
2939 | CH_DEVICE(0x4880), | 2939 | CH_DEVICE(0x4888), |
2940 | CH_DEVICE(0x5801), /* T520-cr */ | 2940 | CH_DEVICE(0x5801), /* T520-cr */ |
2941 | CH_DEVICE(0x5802), /* T522-cr */ | 2941 | CH_DEVICE(0x5802), /* T522-cr */ |
2942 | CH_DEVICE(0x5803), /* T540-cr */ | 2942 | CH_DEVICE(0x5803), /* T540-cr */ |
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c index 85036e6b42c4..fdd078d7d82c 100644 --- a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c +++ b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c | |||
@@ -51,14 +51,6 @@ | |||
51 | #include "../cxgb4/t4_msg.h" | 51 | #include "../cxgb4/t4_msg.h" |
52 | 52 | ||
53 | /* | 53 | /* |
54 | * Decoded Adapter Parameters. | ||
55 | */ | ||
56 | static u32 FL_PG_ORDER; /* large page allocation size */ | ||
57 | static u32 STAT_LEN; /* length of status page at ring end */ | ||
58 | static u32 PKTSHIFT; /* padding between CPL and packet data */ | ||
59 | static u32 FL_ALIGN; /* response queue message alignment */ | ||
60 | |||
61 | /* | ||
62 | * Constants ... | 54 | * Constants ... |
63 | */ | 55 | */ |
64 | enum { | 56 | enum { |
@@ -102,12 +94,6 @@ enum { | |||
102 | MAX_TIMER_TX_RECLAIM = 100, | 94 | MAX_TIMER_TX_RECLAIM = 100, |
103 | 95 | ||
104 | /* | 96 | /* |
105 | * An FL with <= FL_STARVE_THRES buffers is starving and a periodic | ||
106 | * timer will attempt to refill it. | ||
107 | */ | ||
108 | FL_STARVE_THRES = 4, | ||
109 | |||
110 | /* | ||
111 | * Suspend an Ethernet TX queue with fewer available descriptors than | 97 | * Suspend an Ethernet TX queue with fewer available descriptors than |
112 | * this. We always want to have room for a maximum sized packet: | 98 | * this. We always want to have room for a maximum sized packet: |
113 | * inline immediate data + MAX_SKB_FRAGS. This is the same as | 99 | * inline immediate data + MAX_SKB_FRAGS. This is the same as |
@@ -264,15 +250,19 @@ static inline unsigned int fl_cap(const struct sge_fl *fl) | |||
264 | 250 | ||
265 | /** | 251 | /** |
266 | * fl_starving - return whether a Free List is starving. | 252 | * fl_starving - return whether a Free List is starving. |
253 | * @adapter: pointer to the adapter | ||
267 | * @fl: the Free List | 254 | * @fl: the Free List |
268 | * | 255 | * |
269 | * Tests specified Free List to see whether the number of buffers | 256 | * Tests specified Free List to see whether the number of buffers |
270 | * available to the hardware has falled below our "starvation" | 257 | * available to the hardware has falled below our "starvation" |
271 | * threshold. | 258 | * threshold. |
272 | */ | 259 | */ |
273 | static inline bool fl_starving(const struct sge_fl *fl) | 260 | static inline bool fl_starving(const struct adapter *adapter, |
261 | const struct sge_fl *fl) | ||
274 | { | 262 | { |
275 | return fl->avail - fl->pend_cred <= FL_STARVE_THRES; | 263 | const struct sge *s = &adapter->sge; |
264 | |||
265 | return fl->avail - fl->pend_cred <= s->fl_starve_thres; | ||
276 | } | 266 | } |
277 | 267 | ||
278 | /** | 268 | /** |
@@ -457,13 +447,16 @@ static inline void reclaim_completed_tx(struct adapter *adapter, | |||
457 | 447 | ||
458 | /** | 448 | /** |
459 | * get_buf_size - return the size of an RX Free List buffer. | 449 | * get_buf_size - return the size of an RX Free List buffer. |
450 | * @adapter: pointer to the associated adapter | ||
460 | * @sdesc: pointer to the software buffer descriptor | 451 | * @sdesc: pointer to the software buffer descriptor |
461 | */ | 452 | */ |
462 | static inline int get_buf_size(const struct rx_sw_desc *sdesc) | 453 | static inline int get_buf_size(const struct adapter *adapter, |
454 | const struct rx_sw_desc *sdesc) | ||
463 | { | 455 | { |
464 | return FL_PG_ORDER > 0 && (sdesc->dma_addr & RX_LARGE_BUF) | 456 | const struct sge *s = &adapter->sge; |
465 | ? (PAGE_SIZE << FL_PG_ORDER) | 457 | |
466 | : PAGE_SIZE; | 458 | return (s->fl_pg_order > 0 && (sdesc->dma_addr & RX_LARGE_BUF) |
459 | ? (PAGE_SIZE << s->fl_pg_order) : PAGE_SIZE); | ||
467 | } | 460 | } |
468 | 461 | ||
469 | /** | 462 | /** |
@@ -483,7 +476,8 @@ static void free_rx_bufs(struct adapter *adapter, struct sge_fl *fl, int n) | |||
483 | 476 | ||
484 | if (is_buf_mapped(sdesc)) | 477 | if (is_buf_mapped(sdesc)) |
485 | dma_unmap_page(adapter->pdev_dev, get_buf_addr(sdesc), | 478 | dma_unmap_page(adapter->pdev_dev, get_buf_addr(sdesc), |
486 | get_buf_size(sdesc), PCI_DMA_FROMDEVICE); | 479 | get_buf_size(adapter, sdesc), |
480 | PCI_DMA_FROMDEVICE); | ||
487 | put_page(sdesc->page); | 481 | put_page(sdesc->page); |
488 | sdesc->page = NULL; | 482 | sdesc->page = NULL; |
489 | if (++fl->cidx == fl->size) | 483 | if (++fl->cidx == fl->size) |
@@ -511,7 +505,8 @@ static void unmap_rx_buf(struct adapter *adapter, struct sge_fl *fl) | |||
511 | 505 | ||
512 | if (is_buf_mapped(sdesc)) | 506 | if (is_buf_mapped(sdesc)) |
513 | dma_unmap_page(adapter->pdev_dev, get_buf_addr(sdesc), | 507 | dma_unmap_page(adapter->pdev_dev, get_buf_addr(sdesc), |
514 | get_buf_size(sdesc), PCI_DMA_FROMDEVICE); | 508 | get_buf_size(adapter, sdesc), |
509 | PCI_DMA_FROMDEVICE); | ||
515 | sdesc->page = NULL; | 510 | sdesc->page = NULL; |
516 | if (++fl->cidx == fl->size) | 511 | if (++fl->cidx == fl->size) |
517 | fl->cidx = 0; | 512 | fl->cidx = 0; |
@@ -589,6 +584,7 @@ static inline void poison_buf(struct page *page, size_t sz) | |||
589 | static unsigned int refill_fl(struct adapter *adapter, struct sge_fl *fl, | 584 | static unsigned int refill_fl(struct adapter *adapter, struct sge_fl *fl, |
590 | int n, gfp_t gfp) | 585 | int n, gfp_t gfp) |
591 | { | 586 | { |
587 | struct sge *s = &adapter->sge; | ||
592 | struct page *page; | 588 | struct page *page; |
593 | dma_addr_t dma_addr; | 589 | dma_addr_t dma_addr; |
594 | unsigned int cred = fl->avail; | 590 | unsigned int cred = fl->avail; |
@@ -608,12 +604,12 @@ static unsigned int refill_fl(struct adapter *adapter, struct sge_fl *fl, | |||
608 | * If we don't support large pages, drop directly into the small page | 604 | * If we don't support large pages, drop directly into the small page |
609 | * allocation code. | 605 | * allocation code. |
610 | */ | 606 | */ |
611 | if (FL_PG_ORDER == 0) | 607 | if (s->fl_pg_order == 0) |
612 | goto alloc_small_pages; | 608 | goto alloc_small_pages; |
613 | 609 | ||
614 | while (n) { | 610 | while (n) { |
615 | page = alloc_pages(gfp | __GFP_COMP | __GFP_NOWARN, | 611 | page = alloc_pages(gfp | __GFP_COMP | __GFP_NOWARN, |
616 | FL_PG_ORDER); | 612 | s->fl_pg_order); |
617 | if (unlikely(!page)) { | 613 | if (unlikely(!page)) { |
618 | /* | 614 | /* |
619 | * We've failed inour attempt to allocate a "large | 615 | * We've failed inour attempt to allocate a "large |
@@ -623,10 +619,10 @@ static unsigned int refill_fl(struct adapter *adapter, struct sge_fl *fl, | |||
623 | fl->large_alloc_failed++; | 619 | fl->large_alloc_failed++; |
624 | break; | 620 | break; |
625 | } | 621 | } |
626 | poison_buf(page, PAGE_SIZE << FL_PG_ORDER); | 622 | poison_buf(page, PAGE_SIZE << s->fl_pg_order); |
627 | 623 | ||
628 | dma_addr = dma_map_page(adapter->pdev_dev, page, 0, | 624 | dma_addr = dma_map_page(adapter->pdev_dev, page, 0, |
629 | PAGE_SIZE << FL_PG_ORDER, | 625 | PAGE_SIZE << s->fl_pg_order, |
630 | PCI_DMA_FROMDEVICE); | 626 | PCI_DMA_FROMDEVICE); |
631 | if (unlikely(dma_mapping_error(adapter->pdev_dev, dma_addr))) { | 627 | if (unlikely(dma_mapping_error(adapter->pdev_dev, dma_addr))) { |
632 | /* | 628 | /* |
@@ -637,7 +633,7 @@ static unsigned int refill_fl(struct adapter *adapter, struct sge_fl *fl, | |||
637 | * because DMA mapping resources are typically | 633 | * because DMA mapping resources are typically |
638 | * critical resources once they become scarse. | 634 | * critical resources once they become scarse. |
639 | */ | 635 | */ |
640 | __free_pages(page, FL_PG_ORDER); | 636 | __free_pages(page, s->fl_pg_order); |
641 | goto out; | 637 | goto out; |
642 | } | 638 | } |
643 | dma_addr |= RX_LARGE_BUF; | 639 | dma_addr |= RX_LARGE_BUF; |
@@ -693,7 +689,7 @@ out: | |||
693 | fl->pend_cred += cred; | 689 | fl->pend_cred += cred; |
694 | ring_fl_db(adapter, fl); | 690 | ring_fl_db(adapter, fl); |
695 | 691 | ||
696 | if (unlikely(fl_starving(fl))) { | 692 | if (unlikely(fl_starving(adapter, fl))) { |
697 | smp_wmb(); | 693 | smp_wmb(); |
698 | set_bit(fl->cntxt_id, adapter->sge.starving_fl); | 694 | set_bit(fl->cntxt_id, adapter->sge.starving_fl); |
699 | } | 695 | } |
@@ -1468,6 +1464,8 @@ static void t4vf_pktgl_free(const struct pkt_gl *gl) | |||
1468 | static void do_gro(struct sge_eth_rxq *rxq, const struct pkt_gl *gl, | 1464 | static void do_gro(struct sge_eth_rxq *rxq, const struct pkt_gl *gl, |
1469 | const struct cpl_rx_pkt *pkt) | 1465 | const struct cpl_rx_pkt *pkt) |
1470 | { | 1466 | { |
1467 | struct adapter *adapter = rxq->rspq.adapter; | ||
1468 | struct sge *s = &adapter->sge; | ||
1471 | int ret; | 1469 | int ret; |
1472 | struct sk_buff *skb; | 1470 | struct sk_buff *skb; |
1473 | 1471 | ||
@@ -1478,8 +1476,8 @@ static void do_gro(struct sge_eth_rxq *rxq, const struct pkt_gl *gl, | |||
1478 | return; | 1476 | return; |
1479 | } | 1477 | } |
1480 | 1478 | ||
1481 | copy_frags(skb, gl, PKTSHIFT); | 1479 | copy_frags(skb, gl, s->pktshift); |
1482 | skb->len = gl->tot_len - PKTSHIFT; | 1480 | skb->len = gl->tot_len - s->pktshift; |
1483 | skb->data_len = skb->len; | 1481 | skb->data_len = skb->len; |
1484 | skb->truesize += skb->data_len; | 1482 | skb->truesize += skb->data_len; |
1485 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 1483 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
@@ -1516,6 +1514,8 @@ int t4vf_ethrx_handler(struct sge_rspq *rspq, const __be64 *rsp, | |||
1516 | bool csum_ok = pkt->csum_calc && !pkt->err_vec && | 1514 | bool csum_ok = pkt->csum_calc && !pkt->err_vec && |
1517 | (rspq->netdev->features & NETIF_F_RXCSUM); | 1515 | (rspq->netdev->features & NETIF_F_RXCSUM); |
1518 | struct sge_eth_rxq *rxq = container_of(rspq, struct sge_eth_rxq, rspq); | 1516 | struct sge_eth_rxq *rxq = container_of(rspq, struct sge_eth_rxq, rspq); |
1517 | struct adapter *adapter = rspq->adapter; | ||
1518 | struct sge *s = &adapter->sge; | ||
1519 | 1519 | ||
1520 | /* | 1520 | /* |
1521 | * If this is a good TCP packet and we have Generic Receive Offload | 1521 | * If this is a good TCP packet and we have Generic Receive Offload |
@@ -1537,7 +1537,7 @@ int t4vf_ethrx_handler(struct sge_rspq *rspq, const __be64 *rsp, | |||
1537 | rxq->stats.rx_drops++; | 1537 | rxq->stats.rx_drops++; |
1538 | return 0; | 1538 | return 0; |
1539 | } | 1539 | } |
1540 | __skb_pull(skb, PKTSHIFT); | 1540 | __skb_pull(skb, s->pktshift); |
1541 | skb->protocol = eth_type_trans(skb, rspq->netdev); | 1541 | skb->protocol = eth_type_trans(skb, rspq->netdev); |
1542 | skb_record_rx_queue(skb, rspq->idx); | 1542 | skb_record_rx_queue(skb, rspq->idx); |
1543 | rxq->stats.pkts++; | 1543 | rxq->stats.pkts++; |
@@ -1648,6 +1648,8 @@ static inline void rspq_next(struct sge_rspq *rspq) | |||
1648 | static int process_responses(struct sge_rspq *rspq, int budget) | 1648 | static int process_responses(struct sge_rspq *rspq, int budget) |
1649 | { | 1649 | { |
1650 | struct sge_eth_rxq *rxq = container_of(rspq, struct sge_eth_rxq, rspq); | 1650 | struct sge_eth_rxq *rxq = container_of(rspq, struct sge_eth_rxq, rspq); |
1651 | struct adapter *adapter = rspq->adapter; | ||
1652 | struct sge *s = &adapter->sge; | ||
1651 | int budget_left = budget; | 1653 | int budget_left = budget; |
1652 | 1654 | ||
1653 | while (likely(budget_left)) { | 1655 | while (likely(budget_left)) { |
@@ -1697,7 +1699,7 @@ static int process_responses(struct sge_rspq *rspq, int budget) | |||
1697 | BUG_ON(frag >= MAX_SKB_FRAGS); | 1699 | BUG_ON(frag >= MAX_SKB_FRAGS); |
1698 | BUG_ON(rxq->fl.avail == 0); | 1700 | BUG_ON(rxq->fl.avail == 0); |
1699 | sdesc = &rxq->fl.sdesc[rxq->fl.cidx]; | 1701 | sdesc = &rxq->fl.sdesc[rxq->fl.cidx]; |
1700 | bufsz = get_buf_size(sdesc); | 1702 | bufsz = get_buf_size(adapter, sdesc); |
1701 | fp->page = sdesc->page; | 1703 | fp->page = sdesc->page; |
1702 | fp->offset = rspq->offset; | 1704 | fp->offset = rspq->offset; |
1703 | fp->size = min(bufsz, len); | 1705 | fp->size = min(bufsz, len); |
@@ -1726,7 +1728,7 @@ static int process_responses(struct sge_rspq *rspq, int budget) | |||
1726 | */ | 1728 | */ |
1727 | ret = rspq->handler(rspq, rspq->cur_desc, &gl); | 1729 | ret = rspq->handler(rspq, rspq->cur_desc, &gl); |
1728 | if (likely(ret == 0)) | 1730 | if (likely(ret == 0)) |
1729 | rspq->offset += ALIGN(fp->size, FL_ALIGN); | 1731 | rspq->offset += ALIGN(fp->size, s->fl_align); |
1730 | else | 1732 | else |
1731 | restore_rx_bufs(&gl, &rxq->fl, frag); | 1733 | restore_rx_bufs(&gl, &rxq->fl, frag); |
1732 | } else if (likely(rsp_type == RSP_TYPE_CPL)) { | 1734 | } else if (likely(rsp_type == RSP_TYPE_CPL)) { |
@@ -1963,7 +1965,7 @@ static void sge_rx_timer_cb(unsigned long data) | |||
1963 | * schedule napi but the FL is no longer starving. | 1965 | * schedule napi but the FL is no longer starving. |
1964 | * No biggie. | 1966 | * No biggie. |
1965 | */ | 1967 | */ |
1966 | if (fl_starving(fl)) { | 1968 | if (fl_starving(adapter, fl)) { |
1967 | struct sge_eth_rxq *rxq; | 1969 | struct sge_eth_rxq *rxq; |
1968 | 1970 | ||
1969 | rxq = container_of(fl, struct sge_eth_rxq, fl); | 1971 | rxq = container_of(fl, struct sge_eth_rxq, fl); |
@@ -2047,6 +2049,7 @@ int t4vf_sge_alloc_rxq(struct adapter *adapter, struct sge_rspq *rspq, | |||
2047 | int intr_dest, | 2049 | int intr_dest, |
2048 | struct sge_fl *fl, rspq_handler_t hnd) | 2050 | struct sge_fl *fl, rspq_handler_t hnd) |
2049 | { | 2051 | { |
2052 | struct sge *s = &adapter->sge; | ||
2050 | struct port_info *pi = netdev_priv(dev); | 2053 | struct port_info *pi = netdev_priv(dev); |
2051 | struct fw_iq_cmd cmd, rpl; | 2054 | struct fw_iq_cmd cmd, rpl; |
2052 | int ret, iqandst, flsz = 0; | 2055 | int ret, iqandst, flsz = 0; |
@@ -2117,7 +2120,7 @@ int t4vf_sge_alloc_rxq(struct adapter *adapter, struct sge_rspq *rspq, | |||
2117 | fl->size = roundup(fl->size, FL_PER_EQ_UNIT); | 2120 | fl->size = roundup(fl->size, FL_PER_EQ_UNIT); |
2118 | fl->desc = alloc_ring(adapter->pdev_dev, fl->size, | 2121 | fl->desc = alloc_ring(adapter->pdev_dev, fl->size, |
2119 | sizeof(__be64), sizeof(struct rx_sw_desc), | 2122 | sizeof(__be64), sizeof(struct rx_sw_desc), |
2120 | &fl->addr, &fl->sdesc, STAT_LEN); | 2123 | &fl->addr, &fl->sdesc, s->stat_len); |
2121 | if (!fl->desc) { | 2124 | if (!fl->desc) { |
2122 | ret = -ENOMEM; | 2125 | ret = -ENOMEM; |
2123 | goto err; | 2126 | goto err; |
@@ -2129,7 +2132,7 @@ int t4vf_sge_alloc_rxq(struct adapter *adapter, struct sge_rspq *rspq, | |||
2129 | * free list ring) in Egress Queue Units. | 2132 | * free list ring) in Egress Queue Units. |
2130 | */ | 2133 | */ |
2131 | flsz = (fl->size / FL_PER_EQ_UNIT + | 2134 | flsz = (fl->size / FL_PER_EQ_UNIT + |
2132 | STAT_LEN / EQ_UNIT); | 2135 | s->stat_len / EQ_UNIT); |
2133 | 2136 | ||
2134 | /* | 2137 | /* |
2135 | * Fill in all the relevant firmware Ingress Queue Command | 2138 | * Fill in all the relevant firmware Ingress Queue Command |
@@ -2217,6 +2220,7 @@ int t4vf_sge_alloc_eth_txq(struct adapter *adapter, struct sge_eth_txq *txq, | |||
2217 | struct net_device *dev, struct netdev_queue *devq, | 2220 | struct net_device *dev, struct netdev_queue *devq, |
2218 | unsigned int iqid) | 2221 | unsigned int iqid) |
2219 | { | 2222 | { |
2223 | struct sge *s = &adapter->sge; | ||
2220 | int ret, nentries; | 2224 | int ret, nentries; |
2221 | struct fw_eq_eth_cmd cmd, rpl; | 2225 | struct fw_eq_eth_cmd cmd, rpl; |
2222 | struct port_info *pi = netdev_priv(dev); | 2226 | struct port_info *pi = netdev_priv(dev); |
@@ -2225,7 +2229,7 @@ int t4vf_sge_alloc_eth_txq(struct adapter *adapter, struct sge_eth_txq *txq, | |||
2225 | * Calculate the size of the hardware TX Queue (including the Status | 2229 | * Calculate the size of the hardware TX Queue (including the Status |
2226 | * Page on the end of the TX Queue) in units of TX Descriptors. | 2230 | * Page on the end of the TX Queue) in units of TX Descriptors. |
2227 | */ | 2231 | */ |
2228 | nentries = txq->q.size + STAT_LEN / sizeof(struct tx_desc); | 2232 | nentries = txq->q.size + s->stat_len / sizeof(struct tx_desc); |
2229 | 2233 | ||
2230 | /* | 2234 | /* |
2231 | * Allocate the hardware ring for the TX ring (with space for its | 2235 | * Allocate the hardware ring for the TX ring (with space for its |
@@ -2234,7 +2238,7 @@ int t4vf_sge_alloc_eth_txq(struct adapter *adapter, struct sge_eth_txq *txq, | |||
2234 | txq->q.desc = alloc_ring(adapter->pdev_dev, txq->q.size, | 2238 | txq->q.desc = alloc_ring(adapter->pdev_dev, txq->q.size, |
2235 | sizeof(struct tx_desc), | 2239 | sizeof(struct tx_desc), |
2236 | sizeof(struct tx_sw_desc), | 2240 | sizeof(struct tx_sw_desc), |
2237 | &txq->q.phys_addr, &txq->q.sdesc, STAT_LEN); | 2241 | &txq->q.phys_addr, &txq->q.sdesc, s->stat_len); |
2238 | if (!txq->q.desc) | 2242 | if (!txq->q.desc) |
2239 | return -ENOMEM; | 2243 | return -ENOMEM; |
2240 | 2244 | ||
@@ -2307,8 +2311,10 @@ int t4vf_sge_alloc_eth_txq(struct adapter *adapter, struct sge_eth_txq *txq, | |||
2307 | */ | 2311 | */ |
2308 | static void free_txq(struct adapter *adapter, struct sge_txq *tq) | 2312 | static void free_txq(struct adapter *adapter, struct sge_txq *tq) |
2309 | { | 2313 | { |
2314 | struct sge *s = &adapter->sge; | ||
2315 | |||
2310 | dma_free_coherent(adapter->pdev_dev, | 2316 | dma_free_coherent(adapter->pdev_dev, |
2311 | tq->size * sizeof(*tq->desc) + STAT_LEN, | 2317 | tq->size * sizeof(*tq->desc) + s->stat_len, |
2312 | tq->desc, tq->phys_addr); | 2318 | tq->desc, tq->phys_addr); |
2313 | tq->cntxt_id = 0; | 2319 | tq->cntxt_id = 0; |
2314 | tq->sdesc = NULL; | 2320 | tq->sdesc = NULL; |
@@ -2322,6 +2328,7 @@ static void free_txq(struct adapter *adapter, struct sge_txq *tq) | |||
2322 | static void free_rspq_fl(struct adapter *adapter, struct sge_rspq *rspq, | 2328 | static void free_rspq_fl(struct adapter *adapter, struct sge_rspq *rspq, |
2323 | struct sge_fl *fl) | 2329 | struct sge_fl *fl) |
2324 | { | 2330 | { |
2331 | struct sge *s = &adapter->sge; | ||
2325 | unsigned int flid = fl ? fl->cntxt_id : 0xffff; | 2332 | unsigned int flid = fl ? fl->cntxt_id : 0xffff; |
2326 | 2333 | ||
2327 | t4vf_iq_free(adapter, FW_IQ_TYPE_FL_INT_CAP, | 2334 | t4vf_iq_free(adapter, FW_IQ_TYPE_FL_INT_CAP, |
@@ -2337,7 +2344,7 @@ static void free_rspq_fl(struct adapter *adapter, struct sge_rspq *rspq, | |||
2337 | if (fl) { | 2344 | if (fl) { |
2338 | free_rx_bufs(adapter, fl, fl->avail); | 2345 | free_rx_bufs(adapter, fl, fl->avail); |
2339 | dma_free_coherent(adapter->pdev_dev, | 2346 | dma_free_coherent(adapter->pdev_dev, |
2340 | fl->size * sizeof(*fl->desc) + STAT_LEN, | 2347 | fl->size * sizeof(*fl->desc) + s->stat_len, |
2341 | fl->desc, fl->addr); | 2348 | fl->desc, fl->addr); |
2342 | kfree(fl->sdesc); | 2349 | kfree(fl->sdesc); |
2343 | fl->sdesc = NULL; | 2350 | fl->sdesc = NULL; |
@@ -2423,6 +2430,7 @@ int t4vf_sge_init(struct adapter *adapter) | |||
2423 | u32 fl0 = sge_params->sge_fl_buffer_size[0]; | 2430 | u32 fl0 = sge_params->sge_fl_buffer_size[0]; |
2424 | u32 fl1 = sge_params->sge_fl_buffer_size[1]; | 2431 | u32 fl1 = sge_params->sge_fl_buffer_size[1]; |
2425 | struct sge *s = &adapter->sge; | 2432 | struct sge *s = &adapter->sge; |
2433 | unsigned int ingpadboundary, ingpackboundary; | ||
2426 | 2434 | ||
2427 | /* | 2435 | /* |
2428 | * Start by vetting the basic SGE parameters which have been set up by | 2436 | * Start by vetting the basic SGE parameters which have been set up by |
@@ -2443,12 +2451,48 @@ int t4vf_sge_init(struct adapter *adapter) | |||
2443 | * Now translate the adapter parameters into our internal forms. | 2451 | * Now translate the adapter parameters into our internal forms. |
2444 | */ | 2452 | */ |
2445 | if (fl1) | 2453 | if (fl1) |
2446 | FL_PG_ORDER = ilog2(fl1) - PAGE_SHIFT; | 2454 | s->fl_pg_order = ilog2(fl1) - PAGE_SHIFT; |
2447 | STAT_LEN = ((sge_params->sge_control & EGRSTATUSPAGESIZE_MASK) | 2455 | s->stat_len = ((sge_params->sge_control & EGRSTATUSPAGESIZE_MASK) |
2448 | ? 128 : 64); | 2456 | ? 128 : 64); |
2449 | PKTSHIFT = PKTSHIFT_GET(sge_params->sge_control); | 2457 | s->pktshift = PKTSHIFT_GET(sge_params->sge_control); |
2450 | FL_ALIGN = 1 << (INGPADBOUNDARY_GET(sge_params->sge_control) + | 2458 | |
2451 | SGE_INGPADBOUNDARY_SHIFT); | 2459 | /* T4 uses a single control field to specify both the PCIe Padding and |
2460 | * Packing Boundary. T5 introduced the ability to specify these | ||
2461 | * separately. The actual Ingress Packet Data alignment boundary | ||
2462 | * within Packed Buffer Mode is the maximum of these two | ||
2463 | * specifications. (Note that it makes no real practical sense to | ||
2464 | * have the Pading Boudary be larger than the Packing Boundary but you | ||
2465 | * could set the chip up that way and, in fact, legacy T4 code would | ||
2466 | * end doing this because it would initialize the Padding Boundary and | ||
2467 | * leave the Packing Boundary initialized to 0 (16 bytes).) | ||
2468 | */ | ||
2469 | ingpadboundary = 1 << (INGPADBOUNDARY_GET(sge_params->sge_control) + | ||
2470 | X_INGPADBOUNDARY_SHIFT); | ||
2471 | if (is_t4(adapter->params.chip)) { | ||
2472 | s->fl_align = ingpadboundary; | ||
2473 | } else { | ||
2474 | /* T5 has a different interpretation of one of the PCIe Packing | ||
2475 | * Boundary values. | ||
2476 | */ | ||
2477 | ingpackboundary = INGPACKBOUNDARY_G(sge_params->sge_control2); | ||
2478 | if (ingpackboundary == INGPACKBOUNDARY_16B_X) | ||
2479 | ingpackboundary = 16; | ||
2480 | else | ||
2481 | ingpackboundary = 1 << (ingpackboundary + | ||
2482 | INGPACKBOUNDARY_SHIFT_X); | ||
2483 | |||
2484 | s->fl_align = max(ingpadboundary, ingpackboundary); | ||
2485 | } | ||
2486 | |||
2487 | /* A FL with <= fl_starve_thres buffers is starving and a periodic | ||
2488 | * timer will attempt to refill it. This needs to be larger than the | ||
2489 | * SGE's Egress Congestion Threshold. If it isn't, then we can get | ||
2490 | * stuck waiting for new packets while the SGE is waiting for us to | ||
2491 | * give it more Free List entries. (Note that the SGE's Egress | ||
2492 | * Congestion Threshold is in units of 2 Free List pointers.) | ||
2493 | */ | ||
2494 | s->fl_starve_thres | ||
2495 | = EGRTHRESHOLD_GET(sge_params->sge_congestion_control)*2 + 1; | ||
2452 | 2496 | ||
2453 | /* | 2497 | /* |
2454 | * Set up tasklet timers. | 2498 | * Set up tasklet timers. |
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_common.h b/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_common.h index 95df61dcb4ce..4b6a6d14d86d 100644 --- a/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_common.h +++ b/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_common.h | |||
@@ -134,11 +134,13 @@ struct dev_params { | |||
134 | */ | 134 | */ |
135 | struct sge_params { | 135 | struct sge_params { |
136 | u32 sge_control; /* padding, boundaries, lengths, etc. */ | 136 | u32 sge_control; /* padding, boundaries, lengths, etc. */ |
137 | u32 sge_control2; /* T5: more of the same */ | ||
137 | u32 sge_host_page_size; /* RDMA page sizes */ | 138 | u32 sge_host_page_size; /* RDMA page sizes */ |
138 | u32 sge_queues_per_page; /* RDMA queues/page */ | 139 | u32 sge_queues_per_page; /* RDMA queues/page */ |
139 | u32 sge_user_mode_limits; /* limits for BAR2 user mode accesses */ | 140 | u32 sge_user_mode_limits; /* limits for BAR2 user mode accesses */ |
140 | u32 sge_fl_buffer_size[16]; /* free list buffer sizes */ | 141 | u32 sge_fl_buffer_size[16]; /* free list buffer sizes */ |
141 | u32 sge_ingress_rx_threshold; /* RX counter interrupt threshold[4] */ | 142 | u32 sge_ingress_rx_threshold; /* RX counter interrupt threshold[4] */ |
143 | u32 sge_congestion_control; /* congestion thresholds, etc. */ | ||
142 | u32 sge_timer_value_0_and_1; /* interrupt coalescing timer values */ | 144 | u32 sge_timer_value_0_and_1; /* interrupt coalescing timer values */ |
143 | u32 sge_timer_value_2_and_3; | 145 | u32 sge_timer_value_2_and_3; |
144 | u32 sge_timer_value_4_and_5; | 146 | u32 sge_timer_value_4_and_5; |
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c b/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c index e984fdc48ba2..1e896b923234 100644 --- a/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c +++ b/drivers/net/ethernet/chelsio/cxgb4vf/t4vf_hw.c | |||
@@ -468,12 +468,38 @@ int t4vf_get_sge_params(struct adapter *adapter) | |||
468 | sge_params->sge_timer_value_2_and_3 = vals[5]; | 468 | sge_params->sge_timer_value_2_and_3 = vals[5]; |
469 | sge_params->sge_timer_value_4_and_5 = vals[6]; | 469 | sge_params->sge_timer_value_4_and_5 = vals[6]; |
470 | 470 | ||
471 | /* T4 uses a single control field to specify both the PCIe Padding and | ||
472 | * Packing Boundary. T5 introduced the ability to specify these | ||
473 | * separately with the Padding Boundary in SGE_CONTROL and and Packing | ||
474 | * Boundary in SGE_CONTROL2. So for T5 and later we need to grab | ||
475 | * SGE_CONTROL in order to determine how ingress packet data will be | ||
476 | * laid out in Packed Buffer Mode. Unfortunately, older versions of | ||
477 | * the firmware won't let us retrieve SGE_CONTROL2 so if we get a | ||
478 | * failure grabbing it we throw an error since we can't figure out the | ||
479 | * right value. | ||
480 | */ | ||
481 | if (!is_t4(adapter->params.chip)) { | ||
482 | params[0] = (FW_PARAMS_MNEM(FW_PARAMS_MNEM_REG) | | ||
483 | FW_PARAMS_PARAM_XYZ(SGE_CONTROL2_A)); | ||
484 | v = t4vf_query_params(adapter, 1, params, vals); | ||
485 | if (v != FW_SUCCESS) { | ||
486 | dev_err(adapter->pdev_dev, | ||
487 | "Unable to get SGE Control2; " | ||
488 | "probably old firmware.\n"); | ||
489 | return v; | ||
490 | } | ||
491 | sge_params->sge_control2 = vals[0]; | ||
492 | } | ||
493 | |||
471 | params[0] = (FW_PARAMS_MNEM(FW_PARAMS_MNEM_REG) | | 494 | params[0] = (FW_PARAMS_MNEM(FW_PARAMS_MNEM_REG) | |
472 | FW_PARAMS_PARAM_XYZ(SGE_INGRESS_RX_THRESHOLD)); | 495 | FW_PARAMS_PARAM_XYZ(SGE_INGRESS_RX_THRESHOLD)); |
473 | v = t4vf_query_params(adapter, 1, params, vals); | 496 | params[1] = (FW_PARAMS_MNEM(FW_PARAMS_MNEM_REG) | |
497 | FW_PARAMS_PARAM_XYZ(SGE_CONM_CTRL)); | ||
498 | v = t4vf_query_params(adapter, 2, params, vals); | ||
474 | if (v) | 499 | if (v) |
475 | return v; | 500 | return v; |
476 | sge_params->sge_ingress_rx_threshold = vals[0]; | 501 | sge_params->sge_ingress_rx_threshold = vals[0]; |
502 | sge_params->sge_congestion_control = vals[1]; | ||
477 | 503 | ||
478 | return 0; | 504 | return 0; |
479 | } | 505 | } |
diff --git a/drivers/net/ethernet/cisco/enic/enic_clsf.c b/drivers/net/ethernet/cisco/enic/enic_clsf.c index 69dfd3c9e529..0be6850be8a2 100644 --- a/drivers/net/ethernet/cisco/enic/enic_clsf.c +++ b/drivers/net/ethernet/cisco/enic/enic_clsf.c | |||
@@ -86,7 +86,7 @@ void enic_rfs_flw_tbl_free(struct enic *enic) | |||
86 | int i; | 86 | int i; |
87 | 87 | ||
88 | enic_rfs_timer_stop(enic); | 88 | enic_rfs_timer_stop(enic); |
89 | spin_lock(&enic->rfs_h.lock); | 89 | spin_lock_bh(&enic->rfs_h.lock); |
90 | enic->rfs_h.free = 0; | 90 | enic->rfs_h.free = 0; |
91 | for (i = 0; i < (1 << ENIC_RFS_FLW_BITSHIFT); i++) { | 91 | for (i = 0; i < (1 << ENIC_RFS_FLW_BITSHIFT); i++) { |
92 | struct hlist_head *hhead; | 92 | struct hlist_head *hhead; |
@@ -100,7 +100,7 @@ void enic_rfs_flw_tbl_free(struct enic *enic) | |||
100 | kfree(n); | 100 | kfree(n); |
101 | } | 101 | } |
102 | } | 102 | } |
103 | spin_unlock(&enic->rfs_h.lock); | 103 | spin_unlock_bh(&enic->rfs_h.lock); |
104 | } | 104 | } |
105 | 105 | ||
106 | struct enic_rfs_fltr_node *htbl_fltr_search(struct enic *enic, u16 fltr_id) | 106 | struct enic_rfs_fltr_node *htbl_fltr_search(struct enic *enic, u16 fltr_id) |
@@ -128,7 +128,7 @@ void enic_flow_may_expire(unsigned long data) | |||
128 | bool res; | 128 | bool res; |
129 | int j; | 129 | int j; |
130 | 130 | ||
131 | spin_lock(&enic->rfs_h.lock); | 131 | spin_lock_bh(&enic->rfs_h.lock); |
132 | for (j = 0; j < ENIC_CLSF_EXPIRE_COUNT; j++) { | 132 | for (j = 0; j < ENIC_CLSF_EXPIRE_COUNT; j++) { |
133 | struct hlist_head *hhead; | 133 | struct hlist_head *hhead; |
134 | struct hlist_node *tmp; | 134 | struct hlist_node *tmp; |
@@ -148,7 +148,7 @@ void enic_flow_may_expire(unsigned long data) | |||
148 | } | 148 | } |
149 | } | 149 | } |
150 | } | 150 | } |
151 | spin_unlock(&enic->rfs_h.lock); | 151 | spin_unlock_bh(&enic->rfs_h.lock); |
152 | mod_timer(&enic->rfs_h.rfs_may_expire, jiffies + HZ/4); | 152 | mod_timer(&enic->rfs_h.rfs_may_expire, jiffies + HZ/4); |
153 | } | 153 | } |
154 | 154 | ||
@@ -183,7 +183,7 @@ int enic_rx_flow_steer(struct net_device *dev, const struct sk_buff *skb, | |||
183 | return -EPROTONOSUPPORT; | 183 | return -EPROTONOSUPPORT; |
184 | 184 | ||
185 | tbl_idx = skb_get_hash_raw(skb) & ENIC_RFS_FLW_MASK; | 185 | tbl_idx = skb_get_hash_raw(skb) & ENIC_RFS_FLW_MASK; |
186 | spin_lock(&enic->rfs_h.lock); | 186 | spin_lock_bh(&enic->rfs_h.lock); |
187 | n = htbl_key_search(&enic->rfs_h.ht_head[tbl_idx], &keys); | 187 | n = htbl_key_search(&enic->rfs_h.ht_head[tbl_idx], &keys); |
188 | 188 | ||
189 | if (n) { /* entry already present */ | 189 | if (n) { /* entry already present */ |
@@ -277,7 +277,7 @@ int enic_rx_flow_steer(struct net_device *dev, const struct sk_buff *skb, | |||
277 | } | 277 | } |
278 | 278 | ||
279 | ret_unlock: | 279 | ret_unlock: |
280 | spin_unlock(&enic->rfs_h.lock); | 280 | spin_unlock_bh(&enic->rfs_h.lock); |
281 | return res; | 281 | return res; |
282 | } | 282 | } |
283 | 283 | ||
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c index 929bfe70080a..73cf1653a4a3 100644 --- a/drivers/net/ethernet/cisco/enic/enic_main.c +++ b/drivers/net/ethernet/cisco/enic/enic_main.c | |||
@@ -940,18 +940,8 @@ static int enic_rq_alloc_buf(struct vnic_rq *rq) | |||
940 | struct vnic_rq_buf *buf = rq->to_use; | 940 | struct vnic_rq_buf *buf = rq->to_use; |
941 | 941 | ||
942 | if (buf->os_buf) { | 942 | if (buf->os_buf) { |
943 | buf = buf->next; | 943 | enic_queue_rq_desc(rq, buf->os_buf, os_buf_index, buf->dma_addr, |
944 | rq->to_use = buf; | 944 | buf->len); |
945 | rq->ring.desc_avail--; | ||
946 | if ((buf->index & VNIC_RQ_RETURN_RATE) == 0) { | ||
947 | /* Adding write memory barrier prevents compiler and/or | ||
948 | * CPU reordering, thus avoiding descriptor posting | ||
949 | * before descriptor is initialized. Otherwise, hardware | ||
950 | * can read stale descriptor fields. | ||
951 | */ | ||
952 | wmb(); | ||
953 | iowrite32(buf->index, &rq->ctrl->posted_index); | ||
954 | } | ||
955 | 945 | ||
956 | return 0; | 946 | return 0; |
957 | } | 947 | } |
@@ -1037,7 +1027,10 @@ static void enic_rq_indicate_buf(struct vnic_rq *rq, | |||
1037 | enic->rq_truncated_pkts++; | 1027 | enic->rq_truncated_pkts++; |
1038 | } | 1028 | } |
1039 | 1029 | ||
1030 | pci_unmap_single(enic->pdev, buf->dma_addr, buf->len, | ||
1031 | PCI_DMA_FROMDEVICE); | ||
1040 | dev_kfree_skb_any(skb); | 1032 | dev_kfree_skb_any(skb); |
1033 | buf->os_buf = NULL; | ||
1041 | 1034 | ||
1042 | return; | 1035 | return; |
1043 | } | 1036 | } |
@@ -1088,7 +1081,10 @@ static void enic_rq_indicate_buf(struct vnic_rq *rq, | |||
1088 | /* Buffer overflow | 1081 | /* Buffer overflow |
1089 | */ | 1082 | */ |
1090 | 1083 | ||
1084 | pci_unmap_single(enic->pdev, buf->dma_addr, buf->len, | ||
1085 | PCI_DMA_FROMDEVICE); | ||
1091 | dev_kfree_skb_any(skb); | 1086 | dev_kfree_skb_any(skb); |
1087 | buf->os_buf = NULL; | ||
1092 | } | 1088 | } |
1093 | } | 1089 | } |
1094 | 1090 | ||
@@ -1674,13 +1670,13 @@ static int enic_stop(struct net_device *netdev) | |||
1674 | 1670 | ||
1675 | enic_dev_disable(enic); | 1671 | enic_dev_disable(enic); |
1676 | 1672 | ||
1677 | local_bh_disable(); | ||
1678 | for (i = 0; i < enic->rq_count; i++) { | 1673 | for (i = 0; i < enic->rq_count; i++) { |
1679 | napi_disable(&enic->napi[i]); | 1674 | napi_disable(&enic->napi[i]); |
1675 | local_bh_disable(); | ||
1680 | while (!enic_poll_lock_napi(&enic->rq[i])) | 1676 | while (!enic_poll_lock_napi(&enic->rq[i])) |
1681 | mdelay(1); | 1677 | mdelay(1); |
1678 | local_bh_enable(); | ||
1682 | } | 1679 | } |
1683 | local_bh_enable(); | ||
1684 | 1680 | ||
1685 | netif_carrier_off(netdev); | 1681 | netif_carrier_off(netdev); |
1686 | netif_tx_disable(netdev); | 1682 | netif_tx_disable(netdev); |
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 81b96cf87574..3dca494797bd 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c | |||
@@ -298,6 +298,16 @@ static void *swap_buffer(void *bufaddr, int len) | |||
298 | return bufaddr; | 298 | return bufaddr; |
299 | } | 299 | } |
300 | 300 | ||
301 | static void swap_buffer2(void *dst_buf, void *src_buf, int len) | ||
302 | { | ||
303 | int i; | ||
304 | unsigned int *src = src_buf; | ||
305 | unsigned int *dst = dst_buf; | ||
306 | |||
307 | for (i = 0; i < len; i += 4, src++, dst++) | ||
308 | *dst = swab32p(src); | ||
309 | } | ||
310 | |||
301 | static void fec_dump(struct net_device *ndev) | 311 | static void fec_dump(struct net_device *ndev) |
302 | { | 312 | { |
303 | struct fec_enet_private *fep = netdev_priv(ndev); | 313 | struct fec_enet_private *fep = netdev_priv(ndev); |
@@ -1307,7 +1317,7 @@ fec_enet_new_rxbdp(struct net_device *ndev, struct bufdesc *bdp, struct sk_buff | |||
1307 | } | 1317 | } |
1308 | 1318 | ||
1309 | static bool fec_enet_copybreak(struct net_device *ndev, struct sk_buff **skb, | 1319 | static bool fec_enet_copybreak(struct net_device *ndev, struct sk_buff **skb, |
1310 | struct bufdesc *bdp, u32 length) | 1320 | struct bufdesc *bdp, u32 length, bool swap) |
1311 | { | 1321 | { |
1312 | struct fec_enet_private *fep = netdev_priv(ndev); | 1322 | struct fec_enet_private *fep = netdev_priv(ndev); |
1313 | struct sk_buff *new_skb; | 1323 | struct sk_buff *new_skb; |
@@ -1322,7 +1332,10 @@ static bool fec_enet_copybreak(struct net_device *ndev, struct sk_buff **skb, | |||
1322 | dma_sync_single_for_cpu(&fep->pdev->dev, bdp->cbd_bufaddr, | 1332 | dma_sync_single_for_cpu(&fep->pdev->dev, bdp->cbd_bufaddr, |
1323 | FEC_ENET_RX_FRSIZE - fep->rx_align, | 1333 | FEC_ENET_RX_FRSIZE - fep->rx_align, |
1324 | DMA_FROM_DEVICE); | 1334 | DMA_FROM_DEVICE); |
1325 | memcpy(new_skb->data, (*skb)->data, length); | 1335 | if (!swap) |
1336 | memcpy(new_skb->data, (*skb)->data, length); | ||
1337 | else | ||
1338 | swap_buffer2(new_skb->data, (*skb)->data, length); | ||
1326 | *skb = new_skb; | 1339 | *skb = new_skb; |
1327 | 1340 | ||
1328 | return true; | 1341 | return true; |
@@ -1352,6 +1365,7 @@ fec_enet_rx_queue(struct net_device *ndev, int budget, u16 queue_id) | |||
1352 | u16 vlan_tag; | 1365 | u16 vlan_tag; |
1353 | int index = 0; | 1366 | int index = 0; |
1354 | bool is_copybreak; | 1367 | bool is_copybreak; |
1368 | bool need_swap = id_entry->driver_data & FEC_QUIRK_SWAP_FRAME; | ||
1355 | 1369 | ||
1356 | #ifdef CONFIG_M532x | 1370 | #ifdef CONFIG_M532x |
1357 | flush_cache_all(); | 1371 | flush_cache_all(); |
@@ -1415,7 +1429,8 @@ fec_enet_rx_queue(struct net_device *ndev, int budget, u16 queue_id) | |||
1415 | * include that when passing upstream as it messes up | 1429 | * include that when passing upstream as it messes up |
1416 | * bridging applications. | 1430 | * bridging applications. |
1417 | */ | 1431 | */ |
1418 | is_copybreak = fec_enet_copybreak(ndev, &skb, bdp, pkt_len - 4); | 1432 | is_copybreak = fec_enet_copybreak(ndev, &skb, bdp, pkt_len - 4, |
1433 | need_swap); | ||
1419 | if (!is_copybreak) { | 1434 | if (!is_copybreak) { |
1420 | skb_new = netdev_alloc_skb(ndev, FEC_ENET_RX_FRSIZE); | 1435 | skb_new = netdev_alloc_skb(ndev, FEC_ENET_RX_FRSIZE); |
1421 | if (unlikely(!skb_new)) { | 1436 | if (unlikely(!skb_new)) { |
@@ -1430,7 +1445,7 @@ fec_enet_rx_queue(struct net_device *ndev, int budget, u16 queue_id) | |||
1430 | prefetch(skb->data - NET_IP_ALIGN); | 1445 | prefetch(skb->data - NET_IP_ALIGN); |
1431 | skb_put(skb, pkt_len - 4); | 1446 | skb_put(skb, pkt_len - 4); |
1432 | data = skb->data; | 1447 | data = skb->data; |
1433 | if (id_entry->driver_data & FEC_QUIRK_SWAP_FRAME) | 1448 | if (!is_copybreak && need_swap) |
1434 | swap_buffer(data, pkt_len); | 1449 | swap_buffer(data, pkt_len); |
1435 | 1450 | ||
1436 | /* Extract the enhanced buffer descriptor */ | 1451 | /* Extract the enhanced buffer descriptor */ |
@@ -1581,7 +1596,8 @@ fec_enet_interrupt(int irq, void *dev_id) | |||
1581 | complete(&fep->mdio_done); | 1596 | complete(&fep->mdio_done); |
1582 | } | 1597 | } |
1583 | 1598 | ||
1584 | fec_ptp_check_pps_event(fep); | 1599 | if (fep->ptp_clock) |
1600 | fec_ptp_check_pps_event(fep); | ||
1585 | 1601 | ||
1586 | return ret; | 1602 | return ret; |
1587 | } | 1603 | } |
@@ -3342,12 +3358,11 @@ static int __maybe_unused fec_suspend(struct device *dev) | |||
3342 | netif_device_detach(ndev); | 3358 | netif_device_detach(ndev); |
3343 | netif_tx_unlock_bh(ndev); | 3359 | netif_tx_unlock_bh(ndev); |
3344 | fec_stop(ndev); | 3360 | fec_stop(ndev); |
3361 | fec_enet_clk_enable(ndev, false); | ||
3362 | pinctrl_pm_select_sleep_state(&fep->pdev->dev); | ||
3345 | } | 3363 | } |
3346 | rtnl_unlock(); | 3364 | rtnl_unlock(); |
3347 | 3365 | ||
3348 | fec_enet_clk_enable(ndev, false); | ||
3349 | pinctrl_pm_select_sleep_state(&fep->pdev->dev); | ||
3350 | |||
3351 | if (fep->reg_phy) | 3366 | if (fep->reg_phy) |
3352 | regulator_disable(fep->reg_phy); | 3367 | regulator_disable(fep->reg_phy); |
3353 | 3368 | ||
@@ -3366,13 +3381,14 @@ static int __maybe_unused fec_resume(struct device *dev) | |||
3366 | return ret; | 3381 | return ret; |
3367 | } | 3382 | } |
3368 | 3383 | ||
3369 | pinctrl_pm_select_default_state(&fep->pdev->dev); | ||
3370 | ret = fec_enet_clk_enable(ndev, true); | ||
3371 | if (ret) | ||
3372 | goto failed_clk; | ||
3373 | |||
3374 | rtnl_lock(); | 3384 | rtnl_lock(); |
3375 | if (netif_running(ndev)) { | 3385 | if (netif_running(ndev)) { |
3386 | pinctrl_pm_select_default_state(&fep->pdev->dev); | ||
3387 | ret = fec_enet_clk_enable(ndev, true); | ||
3388 | if (ret) { | ||
3389 | rtnl_unlock(); | ||
3390 | goto failed_clk; | ||
3391 | } | ||
3376 | fec_restart(ndev); | 3392 | fec_restart(ndev); |
3377 | netif_tx_lock_bh(ndev); | 3393 | netif_tx_lock_bh(ndev); |
3378 | netif_device_attach(ndev); | 3394 | netif_device_attach(ndev); |
diff --git a/drivers/net/ethernet/freescale/fs_enet/mac-fec.c b/drivers/net/ethernet/freescale/fs_enet/mac-fec.c index 3d4e08be1709..b34214e2df5f 100644 --- a/drivers/net/ethernet/freescale/fs_enet/mac-fec.c +++ b/drivers/net/ethernet/freescale/fs_enet/mac-fec.c | |||
@@ -341,6 +341,9 @@ static void restart(struct net_device *dev) | |||
341 | FC(fecp, x_cntrl, FEC_TCNTRL_FDEN); /* FD disable */ | 341 | FC(fecp, x_cntrl, FEC_TCNTRL_FDEN); /* FD disable */ |
342 | } | 342 | } |
343 | 343 | ||
344 | /* Restore multicast and promiscuous settings */ | ||
345 | set_multicast_list(dev); | ||
346 | |||
344 | /* | 347 | /* |
345 | * Enable interrupts we wish to service. | 348 | * Enable interrupts we wish to service. |
346 | */ | 349 | */ |
diff --git a/drivers/net/ethernet/freescale/fs_enet/mac-scc.c b/drivers/net/ethernet/freescale/fs_enet/mac-scc.c index f30411f0701f..7a184e8816a4 100644 --- a/drivers/net/ethernet/freescale/fs_enet/mac-scc.c +++ b/drivers/net/ethernet/freescale/fs_enet/mac-scc.c | |||
@@ -355,6 +355,9 @@ static void restart(struct net_device *dev) | |||
355 | if (fep->phydev->duplex) | 355 | if (fep->phydev->duplex) |
356 | S16(sccp, scc_psmr, SCC_PSMR_LPB | SCC_PSMR_FDE); | 356 | S16(sccp, scc_psmr, SCC_PSMR_LPB | SCC_PSMR_FDE); |
357 | 357 | ||
358 | /* Restore multicast and promiscuous settings */ | ||
359 | set_multicast_list(dev); | ||
360 | |||
358 | S32(sccp, scc_gsmrl, SCC_GSMRL_ENR | SCC_GSMRL_ENT); | 361 | S32(sccp, scc_gsmrl, SCC_GSMRL_ENR | SCC_GSMRL_ENT); |
359 | } | 362 | } |
360 | 363 | ||
diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c index 5f6aded512f5..24f3986cfae2 100644 --- a/drivers/net/ethernet/intel/e1000/e1000_main.c +++ b/drivers/net/ethernet/intel/e1000/e1000_main.c | |||
@@ -1075,7 +1075,10 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1075 | NETIF_F_HW_CSUM | | 1075 | NETIF_F_HW_CSUM | |
1076 | NETIF_F_SG); | 1076 | NETIF_F_SG); |
1077 | 1077 | ||
1078 | netdev->priv_flags |= IFF_UNICAST_FLT; | 1078 | /* Do not set IFF_UNICAST_FLT for VMWare's 82545EM */ |
1079 | if (hw->device_id != E1000_DEV_ID_82545EM_COPPER || | ||
1080 | hw->subsystem_vendor_id != PCI_VENDOR_ID_VMWARE) | ||
1081 | netdev->priv_flags |= IFF_UNICAST_FLT; | ||
1079 | 1082 | ||
1080 | adapter->en_mng_pt = e1000_enable_mng_pass_thru(hw); | 1083 | adapter->en_mng_pt = e1000_enable_mng_pass_thru(hw); |
1081 | 1084 | ||
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c index ed5f1c15fb0f..c3a7f4a4b775 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c | |||
@@ -6151,7 +6151,7 @@ static void i40e_handle_mdd_event(struct i40e_pf *pf) | |||
6151 | I40E_GL_MDET_TX_PF_NUM_SHIFT; | 6151 | I40E_GL_MDET_TX_PF_NUM_SHIFT; |
6152 | u8 vf_num = (reg & I40E_GL_MDET_TX_VF_NUM_MASK) >> | 6152 | u8 vf_num = (reg & I40E_GL_MDET_TX_VF_NUM_MASK) >> |
6153 | I40E_GL_MDET_TX_VF_NUM_SHIFT; | 6153 | I40E_GL_MDET_TX_VF_NUM_SHIFT; |
6154 | u8 event = (reg & I40E_GL_MDET_TX_EVENT_SHIFT) >> | 6154 | u8 event = (reg & I40E_GL_MDET_TX_EVENT_MASK) >> |
6155 | I40E_GL_MDET_TX_EVENT_SHIFT; | 6155 | I40E_GL_MDET_TX_EVENT_SHIFT; |
6156 | u8 queue = (reg & I40E_GL_MDET_TX_QUEUE_MASK) >> | 6156 | u8 queue = (reg & I40E_GL_MDET_TX_QUEUE_MASK) >> |
6157 | I40E_GL_MDET_TX_QUEUE_SHIFT; | 6157 | I40E_GL_MDET_TX_QUEUE_SHIFT; |
@@ -6165,7 +6165,7 @@ static void i40e_handle_mdd_event(struct i40e_pf *pf) | |||
6165 | if (reg & I40E_GL_MDET_RX_VALID_MASK) { | 6165 | if (reg & I40E_GL_MDET_RX_VALID_MASK) { |
6166 | u8 func = (reg & I40E_GL_MDET_RX_FUNCTION_MASK) >> | 6166 | u8 func = (reg & I40E_GL_MDET_RX_FUNCTION_MASK) >> |
6167 | I40E_GL_MDET_RX_FUNCTION_SHIFT; | 6167 | I40E_GL_MDET_RX_FUNCTION_SHIFT; |
6168 | u8 event = (reg & I40E_GL_MDET_RX_EVENT_SHIFT) >> | 6168 | u8 event = (reg & I40E_GL_MDET_RX_EVENT_MASK) >> |
6169 | I40E_GL_MDET_RX_EVENT_SHIFT; | 6169 | I40E_GL_MDET_RX_EVENT_SHIFT; |
6170 | u8 queue = (reg & I40E_GL_MDET_RX_QUEUE_MASK) >> | 6170 | u8 queue = (reg & I40E_GL_MDET_RX_QUEUE_MASK) >> |
6171 | I40E_GL_MDET_RX_QUEUE_SHIFT; | 6171 | I40E_GL_MDET_RX_QUEUE_SHIFT; |
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index a21b14495ebd..a2d72a87cbde 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c | |||
@@ -6537,6 +6537,9 @@ static bool igb_can_reuse_rx_page(struct igb_rx_buffer *rx_buffer, | |||
6537 | if (unlikely(page_to_nid(page) != numa_node_id())) | 6537 | if (unlikely(page_to_nid(page) != numa_node_id())) |
6538 | return false; | 6538 | return false; |
6539 | 6539 | ||
6540 | if (unlikely(page->pfmemalloc)) | ||
6541 | return false; | ||
6542 | |||
6540 | #if (PAGE_SIZE < 8192) | 6543 | #if (PAGE_SIZE < 8192) |
6541 | /* if we are only owner of page we can reuse it */ | 6544 | /* if we are only owner of page we can reuse it */ |
6542 | if (unlikely(page_count(page) != 1)) | 6545 | if (unlikely(page_count(page) != 1)) |
@@ -6603,7 +6606,8 @@ static bool igb_add_rx_frag(struct igb_ring *rx_ring, | |||
6603 | memcpy(__skb_put(skb, size), va, ALIGN(size, sizeof(long))); | 6606 | memcpy(__skb_put(skb, size), va, ALIGN(size, sizeof(long))); |
6604 | 6607 | ||
6605 | /* we can reuse buffer as-is, just make sure it is local */ | 6608 | /* we can reuse buffer as-is, just make sure it is local */ |
6606 | if (likely(page_to_nid(page) == numa_node_id())) | 6609 | if (likely((page_to_nid(page) == numa_node_id()) && |
6610 | !page->pfmemalloc)) | ||
6607 | return true; | 6611 | return true; |
6608 | 6612 | ||
6609 | /* this page cannot be reused so discard it */ | 6613 | /* this page cannot be reused so discard it */ |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c index 3ce4a258f945..0ae038b9af90 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | |||
@@ -342,12 +342,16 @@ static int ixgbe_set_settings(struct net_device *netdev, | |||
342 | if (old == advertised) | 342 | if (old == advertised) |
343 | return err; | 343 | return err; |
344 | /* this sets the link speed and restarts auto-neg */ | 344 | /* this sets the link speed and restarts auto-neg */ |
345 | while (test_and_set_bit(__IXGBE_IN_SFP_INIT, &adapter->state)) | ||
346 | usleep_range(1000, 2000); | ||
347 | |||
345 | hw->mac.autotry_restart = true; | 348 | hw->mac.autotry_restart = true; |
346 | err = hw->mac.ops.setup_link(hw, advertised, true); | 349 | err = hw->mac.ops.setup_link(hw, advertised, true); |
347 | if (err) { | 350 | if (err) { |
348 | e_info(probe, "setup link failed with code %d\n", err); | 351 | e_info(probe, "setup link failed with code %d\n", err); |
349 | hw->mac.ops.setup_link(hw, old, true); | 352 | hw->mac.ops.setup_link(hw, old, true); |
350 | } | 353 | } |
354 | clear_bit(__IXGBE_IN_SFP_INIT, &adapter->state); | ||
351 | } else { | 355 | } else { |
352 | /* in this case we currently only support 10Gb/FULL */ | 356 | /* in this case we currently only support 10Gb/FULL */ |
353 | u32 speed = ethtool_cmd_speed(ecmd); | 357 | u32 speed = ethtool_cmd_speed(ecmd); |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index fec5212d4337..d2df4e3d1032 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
@@ -4321,8 +4321,8 @@ static void ixgbe_clean_rx_ring(struct ixgbe_ring *rx_ring) | |||
4321 | IXGBE_CB(skb)->page_released = false; | 4321 | IXGBE_CB(skb)->page_released = false; |
4322 | } | 4322 | } |
4323 | dev_kfree_skb(skb); | 4323 | dev_kfree_skb(skb); |
4324 | rx_buffer->skb = NULL; | ||
4324 | } | 4325 | } |
4325 | rx_buffer->skb = NULL; | ||
4326 | if (rx_buffer->dma) | 4326 | if (rx_buffer->dma) |
4327 | dma_unmap_page(dev, rx_buffer->dma, | 4327 | dma_unmap_page(dev, rx_buffer->dma, |
4328 | ixgbe_rx_pg_size(rx_ring), | 4328 | ixgbe_rx_pg_size(rx_ring), |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c index d47b19f27c35..28b81ae09b5a 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c | |||
@@ -635,7 +635,6 @@ s32 ixgbe_check_phy_link_tnx(struct ixgbe_hw *hw, ixgbe_link_speed *speed, | |||
635 | **/ | 635 | **/ |
636 | s32 ixgbe_setup_phy_link_tnx(struct ixgbe_hw *hw) | 636 | s32 ixgbe_setup_phy_link_tnx(struct ixgbe_hw *hw) |
637 | { | 637 | { |
638 | s32 status; | ||
639 | u16 autoneg_reg = IXGBE_MII_AUTONEG_REG; | 638 | u16 autoneg_reg = IXGBE_MII_AUTONEG_REG; |
640 | bool autoneg = false; | 639 | bool autoneg = false; |
641 | ixgbe_link_speed speed; | 640 | ixgbe_link_speed speed; |
@@ -700,8 +699,7 @@ s32 ixgbe_setup_phy_link_tnx(struct ixgbe_hw *hw) | |||
700 | 699 | ||
701 | hw->phy.ops.write_reg(hw, MDIO_CTRL1, | 700 | hw->phy.ops.write_reg(hw, MDIO_CTRL1, |
702 | MDIO_MMD_AN, autoneg_reg); | 701 | MDIO_MMD_AN, autoneg_reg); |
703 | 702 | return 0; | |
704 | return status; | ||
705 | } | 703 | } |
706 | 704 | ||
707 | /** | 705 | /** |
diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c index b151a949f352..d44560d1d268 100644 --- a/drivers/net/ethernet/marvell/mv643xx_eth.c +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c | |||
@@ -1047,7 +1047,6 @@ static int txq_reclaim(struct tx_queue *txq, int budget, int force) | |||
1047 | int tx_index; | 1047 | int tx_index; |
1048 | struct tx_desc *desc; | 1048 | struct tx_desc *desc; |
1049 | u32 cmd_sts; | 1049 | u32 cmd_sts; |
1050 | struct sk_buff *skb; | ||
1051 | 1050 | ||
1052 | tx_index = txq->tx_used_desc; | 1051 | tx_index = txq->tx_used_desc; |
1053 | desc = &txq->tx_desc_area[tx_index]; | 1052 | desc = &txq->tx_desc_area[tx_index]; |
@@ -1066,19 +1065,22 @@ static int txq_reclaim(struct tx_queue *txq, int budget, int force) | |||
1066 | reclaimed++; | 1065 | reclaimed++; |
1067 | txq->tx_desc_count--; | 1066 | txq->tx_desc_count--; |
1068 | 1067 | ||
1069 | skb = NULL; | 1068 | if (!IS_TSO_HEADER(txq, desc->buf_ptr)) |
1070 | if (cmd_sts & TX_LAST_DESC) | 1069 | dma_unmap_single(mp->dev->dev.parent, desc->buf_ptr, |
1071 | skb = __skb_dequeue(&txq->tx_skb); | 1070 | desc->byte_cnt, DMA_TO_DEVICE); |
1071 | |||
1072 | if (cmd_sts & TX_ENABLE_INTERRUPT) { | ||
1073 | struct sk_buff *skb = __skb_dequeue(&txq->tx_skb); | ||
1074 | |||
1075 | if (!WARN_ON(!skb)) | ||
1076 | dev_kfree_skb(skb); | ||
1077 | } | ||
1072 | 1078 | ||
1073 | if (cmd_sts & ERROR_SUMMARY) { | 1079 | if (cmd_sts & ERROR_SUMMARY) { |
1074 | netdev_info(mp->dev, "tx error\n"); | 1080 | netdev_info(mp->dev, "tx error\n"); |
1075 | mp->dev->stats.tx_errors++; | 1081 | mp->dev->stats.tx_errors++; |
1076 | } | 1082 | } |
1077 | 1083 | ||
1078 | if (!IS_TSO_HEADER(txq, desc->buf_ptr)) | ||
1079 | dma_unmap_single(mp->dev->dev.parent, desc->buf_ptr, | ||
1080 | desc->byte_cnt, DMA_TO_DEVICE); | ||
1081 | dev_kfree_skb(skb); | ||
1082 | } | 1084 | } |
1083 | 1085 | ||
1084 | __netif_tx_unlock_bh(nq); | 1086 | __netif_tx_unlock_bh(nq); |
diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c index ece83f101526..fdf3e382e464 100644 --- a/drivers/net/ethernet/marvell/mvpp2.c +++ b/drivers/net/ethernet/marvell/mvpp2.c | |||
@@ -1692,6 +1692,7 @@ static int mvpp2_prs_vlan_add(struct mvpp2 *priv, unsigned short tpid, int ai, | |||
1692 | { | 1692 | { |
1693 | struct mvpp2_prs_entry *pe; | 1693 | struct mvpp2_prs_entry *pe; |
1694 | int tid_aux, tid; | 1694 | int tid_aux, tid; |
1695 | int ret = 0; | ||
1695 | 1696 | ||
1696 | pe = mvpp2_prs_vlan_find(priv, tpid, ai); | 1697 | pe = mvpp2_prs_vlan_find(priv, tpid, ai); |
1697 | 1698 | ||
@@ -1723,8 +1724,10 @@ static int mvpp2_prs_vlan_add(struct mvpp2 *priv, unsigned short tpid, int ai, | |||
1723 | break; | 1724 | break; |
1724 | } | 1725 | } |
1725 | 1726 | ||
1726 | if (tid <= tid_aux) | 1727 | if (tid <= tid_aux) { |
1727 | return -EINVAL; | 1728 | ret = -EINVAL; |
1729 | goto error; | ||
1730 | } | ||
1728 | 1731 | ||
1729 | memset(pe, 0 , sizeof(struct mvpp2_prs_entry)); | 1732 | memset(pe, 0 , sizeof(struct mvpp2_prs_entry)); |
1730 | mvpp2_prs_tcam_lu_set(pe, MVPP2_PRS_LU_VLAN); | 1733 | mvpp2_prs_tcam_lu_set(pe, MVPP2_PRS_LU_VLAN); |
@@ -1756,9 +1759,10 @@ static int mvpp2_prs_vlan_add(struct mvpp2 *priv, unsigned short tpid, int ai, | |||
1756 | 1759 | ||
1757 | mvpp2_prs_hw_write(priv, pe); | 1760 | mvpp2_prs_hw_write(priv, pe); |
1758 | 1761 | ||
1762 | error: | ||
1759 | kfree(pe); | 1763 | kfree(pe); |
1760 | 1764 | ||
1761 | return 0; | 1765 | return ret; |
1762 | } | 1766 | } |
1763 | 1767 | ||
1764 | /* Get first free double vlan ai number */ | 1768 | /* Get first free double vlan ai number */ |
@@ -1821,7 +1825,7 @@ static int mvpp2_prs_double_vlan_add(struct mvpp2 *priv, unsigned short tpid1, | |||
1821 | unsigned int port_map) | 1825 | unsigned int port_map) |
1822 | { | 1826 | { |
1823 | struct mvpp2_prs_entry *pe; | 1827 | struct mvpp2_prs_entry *pe; |
1824 | int tid_aux, tid, ai; | 1828 | int tid_aux, tid, ai, ret = 0; |
1825 | 1829 | ||
1826 | pe = mvpp2_prs_double_vlan_find(priv, tpid1, tpid2); | 1830 | pe = mvpp2_prs_double_vlan_find(priv, tpid1, tpid2); |
1827 | 1831 | ||
@@ -1838,8 +1842,10 @@ static int mvpp2_prs_double_vlan_add(struct mvpp2 *priv, unsigned short tpid1, | |||
1838 | 1842 | ||
1839 | /* Set ai value for new double vlan entry */ | 1843 | /* Set ai value for new double vlan entry */ |
1840 | ai = mvpp2_prs_double_vlan_ai_free_get(priv); | 1844 | ai = mvpp2_prs_double_vlan_ai_free_get(priv); |
1841 | if (ai < 0) | 1845 | if (ai < 0) { |
1842 | return ai; | 1846 | ret = ai; |
1847 | goto error; | ||
1848 | } | ||
1843 | 1849 | ||
1844 | /* Get first single/triple vlan tid */ | 1850 | /* Get first single/triple vlan tid */ |
1845 | for (tid_aux = MVPP2_PE_FIRST_FREE_TID; | 1851 | for (tid_aux = MVPP2_PE_FIRST_FREE_TID; |
@@ -1859,8 +1865,10 @@ static int mvpp2_prs_double_vlan_add(struct mvpp2 *priv, unsigned short tpid1, | |||
1859 | break; | 1865 | break; |
1860 | } | 1866 | } |
1861 | 1867 | ||
1862 | if (tid >= tid_aux) | 1868 | if (tid >= tid_aux) { |
1863 | return -ERANGE; | 1869 | ret = -ERANGE; |
1870 | goto error; | ||
1871 | } | ||
1864 | 1872 | ||
1865 | memset(pe, 0, sizeof(struct mvpp2_prs_entry)); | 1873 | memset(pe, 0, sizeof(struct mvpp2_prs_entry)); |
1866 | mvpp2_prs_tcam_lu_set(pe, MVPP2_PRS_LU_VLAN); | 1874 | mvpp2_prs_tcam_lu_set(pe, MVPP2_PRS_LU_VLAN); |
@@ -1887,8 +1895,9 @@ static int mvpp2_prs_double_vlan_add(struct mvpp2 *priv, unsigned short tpid1, | |||
1887 | mvpp2_prs_tcam_port_map_set(pe, port_map); | 1895 | mvpp2_prs_tcam_port_map_set(pe, port_map); |
1888 | mvpp2_prs_hw_write(priv, pe); | 1896 | mvpp2_prs_hw_write(priv, pe); |
1889 | 1897 | ||
1898 | error: | ||
1890 | kfree(pe); | 1899 | kfree(pe); |
1891 | return 0; | 1900 | return ret; |
1892 | } | 1901 | } |
1893 | 1902 | ||
1894 | /* IPv4 header parsing for fragmentation and L4 offset */ | 1903 | /* IPv4 header parsing for fragmentation and L4 offset */ |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c index f3032fec8fce..02266e3de514 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c | |||
@@ -2281,8 +2281,16 @@ static void mlx4_en_add_vxlan_offloads(struct work_struct *work) | |||
2281 | ret = mlx4_SET_PORT_VXLAN(priv->mdev->dev, priv->port, | 2281 | ret = mlx4_SET_PORT_VXLAN(priv->mdev->dev, priv->port, |
2282 | VXLAN_STEER_BY_OUTER_MAC, 1); | 2282 | VXLAN_STEER_BY_OUTER_MAC, 1); |
2283 | out: | 2283 | out: |
2284 | if (ret) | 2284 | if (ret) { |
2285 | en_err(priv, "failed setting L2 tunnel configuration ret %d\n", ret); | 2285 | en_err(priv, "failed setting L2 tunnel configuration ret %d\n", ret); |
2286 | return; | ||
2287 | } | ||
2288 | |||
2289 | /* set offloads */ | ||
2290 | priv->dev->hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_RXCSUM | | ||
2291 | NETIF_F_TSO | NETIF_F_GSO_UDP_TUNNEL; | ||
2292 | priv->dev->hw_features |= NETIF_F_GSO_UDP_TUNNEL; | ||
2293 | priv->dev->features |= NETIF_F_GSO_UDP_TUNNEL; | ||
2286 | } | 2294 | } |
2287 | 2295 | ||
2288 | static void mlx4_en_del_vxlan_offloads(struct work_struct *work) | 2296 | static void mlx4_en_del_vxlan_offloads(struct work_struct *work) |
@@ -2290,6 +2298,11 @@ static void mlx4_en_del_vxlan_offloads(struct work_struct *work) | |||
2290 | int ret; | 2298 | int ret; |
2291 | struct mlx4_en_priv *priv = container_of(work, struct mlx4_en_priv, | 2299 | struct mlx4_en_priv *priv = container_of(work, struct mlx4_en_priv, |
2292 | vxlan_del_task); | 2300 | vxlan_del_task); |
2301 | /* unset offloads */ | ||
2302 | priv->dev->hw_enc_features &= ~(NETIF_F_IP_CSUM | NETIF_F_RXCSUM | | ||
2303 | NETIF_F_TSO | NETIF_F_GSO_UDP_TUNNEL); | ||
2304 | priv->dev->hw_features &= ~NETIF_F_GSO_UDP_TUNNEL; | ||
2305 | priv->dev->features &= ~NETIF_F_GSO_UDP_TUNNEL; | ||
2293 | 2306 | ||
2294 | ret = mlx4_SET_PORT_VXLAN(priv->mdev->dev, priv->port, | 2307 | ret = mlx4_SET_PORT_VXLAN(priv->mdev->dev, priv->port, |
2295 | VXLAN_STEER_BY_OUTER_MAC, 0); | 2308 | VXLAN_STEER_BY_OUTER_MAC, 0); |
@@ -2568,13 +2581,6 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port, | |||
2568 | if (mdev->dev->caps.steering_mode != MLX4_STEERING_MODE_A0) | 2581 | if (mdev->dev->caps.steering_mode != MLX4_STEERING_MODE_A0) |
2569 | dev->priv_flags |= IFF_UNICAST_FLT; | 2582 | dev->priv_flags |= IFF_UNICAST_FLT; |
2570 | 2583 | ||
2571 | if (mdev->dev->caps.tunnel_offload_mode == MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) { | ||
2572 | dev->hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_RXCSUM | | ||
2573 | NETIF_F_TSO | NETIF_F_GSO_UDP_TUNNEL; | ||
2574 | dev->hw_features |= NETIF_F_GSO_UDP_TUNNEL; | ||
2575 | dev->features |= NETIF_F_GSO_UDP_TUNNEL; | ||
2576 | } | ||
2577 | |||
2578 | mdev->pndev[port] = dev; | 2584 | mdev->pndev[port] = dev; |
2579 | 2585 | ||
2580 | netif_carrier_off(dev); | 2586 | netif_carrier_off(dev); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c index 34c137878545..454d9fea640e 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c | |||
@@ -836,8 +836,11 @@ netdev_tx_t mlx4_en_xmit(struct sk_buff *skb, struct net_device *dev) | |||
836 | * whether LSO is used */ | 836 | * whether LSO is used */ |
837 | tx_desc->ctrl.srcrb_flags = priv->ctrl_flags; | 837 | tx_desc->ctrl.srcrb_flags = priv->ctrl_flags; |
838 | if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) { | 838 | if (likely(skb->ip_summed == CHECKSUM_PARTIAL)) { |
839 | tx_desc->ctrl.srcrb_flags |= cpu_to_be32(MLX4_WQE_CTRL_IP_CSUM | | 839 | if (!skb->encapsulation) |
840 | MLX4_WQE_CTRL_TCP_UDP_CSUM); | 840 | tx_desc->ctrl.srcrb_flags |= cpu_to_be32(MLX4_WQE_CTRL_IP_CSUM | |
841 | MLX4_WQE_CTRL_TCP_UDP_CSUM); | ||
842 | else | ||
843 | tx_desc->ctrl.srcrb_flags |= cpu_to_be32(MLX4_WQE_CTRL_IP_CSUM); | ||
841 | ring->tx_csum++; | 844 | ring->tx_csum++; |
842 | } | 845 | } |
843 | 846 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/eq.c b/drivers/net/ethernet/mellanox/mlx4/eq.c index a49c9d11d8a5..49290a405903 100644 --- a/drivers/net/ethernet/mellanox/mlx4/eq.c +++ b/drivers/net/ethernet/mellanox/mlx4/eq.c | |||
@@ -1026,6 +1026,7 @@ static void mlx4_free_eq(struct mlx4_dev *dev, | |||
1026 | pr_cont("\n"); | 1026 | pr_cont("\n"); |
1027 | } | 1027 | } |
1028 | } | 1028 | } |
1029 | synchronize_irq(eq->irq); | ||
1029 | 1030 | ||
1030 | mlx4_mtt_cleanup(dev, &eq->mtt); | 1031 | mlx4_mtt_cleanup(dev, &eq->mtt); |
1031 | for (i = 0; i < npages; ++i) | 1032 | for (i = 0; i < npages; ++i) |
diff --git a/drivers/net/ethernet/mellanox/mlx4/mcg.c b/drivers/net/ethernet/mellanox/mlx4/mcg.c index ca0f98c95105..872843179f44 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mcg.c +++ b/drivers/net/ethernet/mellanox/mlx4/mcg.c | |||
@@ -955,6 +955,10 @@ static void mlx4_err_rule(struct mlx4_dev *dev, char *str, | |||
955 | cur->ib.dst_gid_msk); | 955 | cur->ib.dst_gid_msk); |
956 | break; | 956 | break; |
957 | 957 | ||
958 | case MLX4_NET_TRANS_RULE_ID_VXLAN: | ||
959 | len += snprintf(buf + len, BUF_SIZE - len, | ||
960 | "VNID = %d ", be32_to_cpu(cur->vxlan.vni)); | ||
961 | break; | ||
958 | case MLX4_NET_TRANS_RULE_ID_IPV6: | 962 | case MLX4_NET_TRANS_RULE_ID_IPV6: |
959 | break; | 963 | break; |
960 | 964 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/ethernet/mellanox/mlx5/core/eq.c index ed53291468f3..ad2c96a02a53 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c | |||
@@ -374,15 +374,14 @@ int mlx5_create_map_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq, u8 vecidx, | |||
374 | snprintf(eq->name, MLX5_MAX_EQ_NAME, "%s@pci:%s", | 374 | snprintf(eq->name, MLX5_MAX_EQ_NAME, "%s@pci:%s", |
375 | name, pci_name(dev->pdev)); | 375 | name, pci_name(dev->pdev)); |
376 | eq->eqn = out.eq_number; | 376 | eq->eqn = out.eq_number; |
377 | eq->irqn = vecidx; | ||
378 | eq->dev = dev; | ||
379 | eq->doorbell = uar->map + MLX5_EQ_DOORBEL_OFFSET; | ||
377 | err = request_irq(table->msix_arr[vecidx].vector, mlx5_msix_handler, 0, | 380 | err = request_irq(table->msix_arr[vecidx].vector, mlx5_msix_handler, 0, |
378 | eq->name, eq); | 381 | eq->name, eq); |
379 | if (err) | 382 | if (err) |
380 | goto err_eq; | 383 | goto err_eq; |
381 | 384 | ||
382 | eq->irqn = vecidx; | ||
383 | eq->dev = dev; | ||
384 | eq->doorbell = uar->map + MLX5_EQ_DOORBEL_OFFSET; | ||
385 | |||
386 | err = mlx5_debug_eq_add(dev, eq); | 385 | err = mlx5_debug_eq_add(dev, eq); |
387 | if (err) | 386 | if (err) |
388 | goto err_irq; | 387 | goto err_irq; |
@@ -420,6 +419,7 @@ int mlx5_destroy_unmap_eq(struct mlx5_core_dev *dev, struct mlx5_eq *eq) | |||
420 | if (err) | 419 | if (err) |
421 | mlx5_core_warn(dev, "failed to destroy a previously created eq: eqn %d\n", | 420 | mlx5_core_warn(dev, "failed to destroy a previously created eq: eqn %d\n", |
422 | eq->eqn); | 421 | eq->eqn); |
422 | synchronize_irq(table->msix_arr[eq->irqn].vector); | ||
423 | mlx5_buf_free(dev, &eq->buf); | 423 | mlx5_buf_free(dev, &eq->buf); |
424 | 424 | ||
425 | return err; | 425 | return err; |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c index 3d8e8e489b2d..71b10b210792 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c | |||
@@ -864,14 +864,14 @@ static int init_one(struct pci_dev *pdev, | |||
864 | dev->profile = &profile[prof_sel]; | 864 | dev->profile = &profile[prof_sel]; |
865 | dev->event = mlx5_core_event; | 865 | dev->event = mlx5_core_event; |
866 | 866 | ||
867 | INIT_LIST_HEAD(&priv->ctx_list); | ||
868 | spin_lock_init(&priv->ctx_lock); | ||
867 | err = mlx5_dev_init(dev, pdev); | 869 | err = mlx5_dev_init(dev, pdev); |
868 | if (err) { | 870 | if (err) { |
869 | dev_err(&pdev->dev, "mlx5_dev_init failed %d\n", err); | 871 | dev_err(&pdev->dev, "mlx5_dev_init failed %d\n", err); |
870 | goto out; | 872 | goto out; |
871 | } | 873 | } |
872 | 874 | ||
873 | INIT_LIST_HEAD(&priv->ctx_list); | ||
874 | spin_lock_init(&priv->ctx_lock); | ||
875 | err = mlx5_register_device(dev); | 875 | err = mlx5_register_device(dev); |
876 | if (err) { | 876 | if (err) { |
877 | dev_err(&pdev->dev, "mlx5_register_device failed %d\n", err); | 877 | dev_err(&pdev->dev, "mlx5_register_device failed %d\n", err); |
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c index 0b2a1ccd276d..613037584d08 100644 --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c | |||
@@ -2762,7 +2762,8 @@ netxen_fw_poll_work(struct work_struct *work) | |||
2762 | if (test_bit(__NX_RESETTING, &adapter->state)) | 2762 | if (test_bit(__NX_RESETTING, &adapter->state)) |
2763 | goto reschedule; | 2763 | goto reschedule; |
2764 | 2764 | ||
2765 | if (test_bit(__NX_DEV_UP, &adapter->state)) { | 2765 | if (test_bit(__NX_DEV_UP, &adapter->state) && |
2766 | !(adapter->capabilities & NX_FW_CAPABILITY_LINK_NOTIFICATION)) { | ||
2766 | if (!adapter->has_link_events) { | 2767 | if (!adapter->has_link_events) { |
2767 | 2768 | ||
2768 | netxen_nic_handle_phy_intr(adapter); | 2769 | netxen_nic_handle_phy_intr(adapter); |
diff --git a/drivers/net/ethernet/qualcomm/Kconfig b/drivers/net/ethernet/qualcomm/Kconfig index f3a47147937d..9a49f42ac2ba 100644 --- a/drivers/net/ethernet/qualcomm/Kconfig +++ b/drivers/net/ethernet/qualcomm/Kconfig | |||
@@ -5,7 +5,6 @@ | |||
5 | config NET_VENDOR_QUALCOMM | 5 | config NET_VENDOR_QUALCOMM |
6 | bool "Qualcomm devices" | 6 | bool "Qualcomm devices" |
7 | default y | 7 | default y |
8 | depends on SPI_MASTER && OF_GPIO | ||
9 | ---help--- | 8 | ---help--- |
10 | If you have a network (Ethernet) card belonging to this class, say Y | 9 | If you have a network (Ethernet) card belonging to this class, say Y |
11 | and read the Ethernet-HOWTO, available from | 10 | and read the Ethernet-HOWTO, available from |
@@ -20,7 +19,7 @@ if NET_VENDOR_QUALCOMM | |||
20 | 19 | ||
21 | config QCA7000 | 20 | config QCA7000 |
22 | tristate "Qualcomm Atheros QCA7000 support" | 21 | tristate "Qualcomm Atheros QCA7000 support" |
23 | depends on SPI_MASTER && OF_GPIO | 22 | depends on SPI_MASTER && OF |
24 | ---help--- | 23 | ---help--- |
25 | This SPI protocol driver supports the Qualcomm Atheros QCA7000. | 24 | This SPI protocol driver supports the Qualcomm Atheros QCA7000. |
26 | 25 | ||
diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c index 002d4cdc319f..a77f05ce8325 100644 --- a/drivers/net/ethernet/sfc/ef10.c +++ b/drivers/net/ethernet/sfc/ef10.c | |||
@@ -180,7 +180,8 @@ static int efx_ef10_probe(struct efx_nic *efx) | |||
180 | EFX_MAX_CHANNELS, | 180 | EFX_MAX_CHANNELS, |
181 | resource_size(&efx->pci_dev->resource[EFX_MEM_BAR]) / | 181 | resource_size(&efx->pci_dev->resource[EFX_MEM_BAR]) / |
182 | (EFX_VI_PAGE_SIZE * EFX_TXQ_TYPES)); | 182 | (EFX_VI_PAGE_SIZE * EFX_TXQ_TYPES)); |
183 | BUG_ON(efx->max_channels == 0); | 183 | if (WARN_ON(efx->max_channels == 0)) |
184 | return -EIO; | ||
184 | 185 | ||
185 | nic_data = kzalloc(sizeof(*nic_data), GFP_KERNEL); | 186 | nic_data = kzalloc(sizeof(*nic_data), GFP_KERNEL); |
186 | if (!nic_data) | 187 | if (!nic_data) |
diff --git a/drivers/net/ethernet/sfc/tx.c b/drivers/net/ethernet/sfc/tx.c index ee84a90e371c..aaf2987512b5 100644 --- a/drivers/net/ethernet/sfc/tx.c +++ b/drivers/net/ethernet/sfc/tx.c | |||
@@ -343,8 +343,6 @@ netdev_tx_t efx_enqueue_skb(struct efx_tx_queue *tx_queue, struct sk_buff *skb) | |||
343 | unsigned short dma_flags; | 343 | unsigned short dma_flags; |
344 | int i = 0; | 344 | int i = 0; |
345 | 345 | ||
346 | EFX_BUG_ON_PARANOID(tx_queue->write_count > tx_queue->insert_count); | ||
347 | |||
348 | if (skb_shinfo(skb)->gso_size) | 346 | if (skb_shinfo(skb)->gso_size) |
349 | return efx_enqueue_skb_tso(tx_queue, skb); | 347 | return efx_enqueue_skb_tso(tx_queue, skb); |
350 | 348 | ||
@@ -1258,8 +1256,6 @@ static int efx_enqueue_skb_tso(struct efx_tx_queue *tx_queue, | |||
1258 | /* Find the packet protocol and sanity-check it */ | 1256 | /* Find the packet protocol and sanity-check it */ |
1259 | state.protocol = efx_tso_check_protocol(skb); | 1257 | state.protocol = efx_tso_check_protocol(skb); |
1260 | 1258 | ||
1261 | EFX_BUG_ON_PARANOID(tx_queue->write_count > tx_queue->insert_count); | ||
1262 | |||
1263 | rc = tso_start(&state, efx, skb); | 1259 | rc = tso_start(&state, efx, skb); |
1264 | if (rc) | 1260 | if (rc) |
1265 | goto mem_err; | 1261 | goto mem_err; |
diff --git a/drivers/net/ethernet/smsc/smc91x.c b/drivers/net/ethernet/smsc/smc91x.c index 5e94d00b96b3..6cc3cf6f17c8 100644 --- a/drivers/net/ethernet/smsc/smc91x.c +++ b/drivers/net/ethernet/smsc/smc91x.c | |||
@@ -81,6 +81,7 @@ static const char version[] = | |||
81 | #include <linux/workqueue.h> | 81 | #include <linux/workqueue.h> |
82 | #include <linux/of.h> | 82 | #include <linux/of.h> |
83 | #include <linux/of_device.h> | 83 | #include <linux/of_device.h> |
84 | #include <linux/of_gpio.h> | ||
84 | 85 | ||
85 | #include <linux/netdevice.h> | 86 | #include <linux/netdevice.h> |
86 | #include <linux/etherdevice.h> | 87 | #include <linux/etherdevice.h> |
@@ -2188,6 +2189,41 @@ static const struct of_device_id smc91x_match[] = { | |||
2188 | {}, | 2189 | {}, |
2189 | }; | 2190 | }; |
2190 | MODULE_DEVICE_TABLE(of, smc91x_match); | 2191 | MODULE_DEVICE_TABLE(of, smc91x_match); |
2192 | |||
2193 | /** | ||
2194 | * of_try_set_control_gpio - configure a gpio if it exists | ||
2195 | */ | ||
2196 | static int try_toggle_control_gpio(struct device *dev, | ||
2197 | struct gpio_desc **desc, | ||
2198 | const char *name, int index, | ||
2199 | int value, unsigned int nsdelay) | ||
2200 | { | ||
2201 | struct gpio_desc *gpio = *desc; | ||
2202 | int res; | ||
2203 | |||
2204 | gpio = devm_gpiod_get_index(dev, name, index); | ||
2205 | if (IS_ERR(gpio)) { | ||
2206 | if (PTR_ERR(gpio) == -ENOENT) { | ||
2207 | *desc = NULL; | ||
2208 | return 0; | ||
2209 | } | ||
2210 | |||
2211 | return PTR_ERR(gpio); | ||
2212 | } | ||
2213 | res = gpiod_direction_output(gpio, !value); | ||
2214 | if (res) { | ||
2215 | dev_err(dev, "unable to toggle gpio %s: %i\n", name, res); | ||
2216 | devm_gpiod_put(dev, gpio); | ||
2217 | gpio = NULL; | ||
2218 | return res; | ||
2219 | } | ||
2220 | if (nsdelay) | ||
2221 | usleep_range(nsdelay, 2 * nsdelay); | ||
2222 | gpiod_set_value_cansleep(gpio, value); | ||
2223 | *desc = gpio; | ||
2224 | |||
2225 | return 0; | ||
2226 | } | ||
2191 | #endif | 2227 | #endif |
2192 | 2228 | ||
2193 | /* | 2229 | /* |
@@ -2207,9 +2243,10 @@ static int smc_drv_probe(struct platform_device *pdev) | |||
2207 | const struct of_device_id *match = NULL; | 2243 | const struct of_device_id *match = NULL; |
2208 | struct smc_local *lp; | 2244 | struct smc_local *lp; |
2209 | struct net_device *ndev; | 2245 | struct net_device *ndev; |
2210 | struct resource *res, *ires; | 2246 | struct resource *res; |
2211 | unsigned int __iomem *addr; | 2247 | unsigned int __iomem *addr; |
2212 | unsigned long irq_flags = SMC_IRQ_FLAGS; | 2248 | unsigned long irq_flags = SMC_IRQ_FLAGS; |
2249 | unsigned long irq_resflags; | ||
2213 | int ret; | 2250 | int ret; |
2214 | 2251 | ||
2215 | ndev = alloc_etherdev(sizeof(struct smc_local)); | 2252 | ndev = alloc_etherdev(sizeof(struct smc_local)); |
@@ -2237,6 +2274,28 @@ static int smc_drv_probe(struct platform_device *pdev) | |||
2237 | struct device_node *np = pdev->dev.of_node; | 2274 | struct device_node *np = pdev->dev.of_node; |
2238 | u32 val; | 2275 | u32 val; |
2239 | 2276 | ||
2277 | /* Optional pwrdwn GPIO configured? */ | ||
2278 | ret = try_toggle_control_gpio(&pdev->dev, &lp->power_gpio, | ||
2279 | "power", 0, 0, 100); | ||
2280 | if (ret) | ||
2281 | return ret; | ||
2282 | |||
2283 | /* | ||
2284 | * Optional reset GPIO configured? Minimum 100 ns reset needed | ||
2285 | * according to LAN91C96 datasheet page 14. | ||
2286 | */ | ||
2287 | ret = try_toggle_control_gpio(&pdev->dev, &lp->reset_gpio, | ||
2288 | "reset", 0, 0, 100); | ||
2289 | if (ret) | ||
2290 | return ret; | ||
2291 | |||
2292 | /* | ||
2293 | * Need to wait for optional EEPROM to load, max 750 us according | ||
2294 | * to LAN91C96 datasheet page 55. | ||
2295 | */ | ||
2296 | if (lp->reset_gpio) | ||
2297 | usleep_range(750, 1000); | ||
2298 | |||
2240 | /* Combination of IO widths supported, default to 16-bit */ | 2299 | /* Combination of IO widths supported, default to 16-bit */ |
2241 | if (!of_property_read_u32(np, "reg-io-width", &val)) { | 2300 | if (!of_property_read_u32(np, "reg-io-width", &val)) { |
2242 | if (val & 1) | 2301 | if (val & 1) |
@@ -2279,16 +2338,19 @@ static int smc_drv_probe(struct platform_device *pdev) | |||
2279 | goto out_free_netdev; | 2338 | goto out_free_netdev; |
2280 | } | 2339 | } |
2281 | 2340 | ||
2282 | ires = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | 2341 | ndev->irq = platform_get_irq(pdev, 0); |
2283 | if (!ires) { | 2342 | if (ndev->irq <= 0) { |
2284 | ret = -ENODEV; | 2343 | ret = -ENODEV; |
2285 | goto out_release_io; | 2344 | goto out_release_io; |
2286 | } | 2345 | } |
2287 | 2346 | /* | |
2288 | ndev->irq = ires->start; | 2347 | * If this platform does not specify any special irqflags, or if |
2289 | 2348 | * the resource supplies a trigger, override the irqflags with | |
2290 | if (irq_flags == -1 || ires->flags & IRQF_TRIGGER_MASK) | 2349 | * the trigger flags from the resource. |
2291 | irq_flags = ires->flags & IRQF_TRIGGER_MASK; | 2350 | */ |
2351 | irq_resflags = irqd_get_trigger_type(irq_get_irq_data(ndev->irq)); | ||
2352 | if (irq_flags == -1 || irq_resflags & IRQF_TRIGGER_MASK) | ||
2353 | irq_flags = irq_resflags & IRQF_TRIGGER_MASK; | ||
2292 | 2354 | ||
2293 | ret = smc_request_attrib(pdev, ndev); | 2355 | ret = smc_request_attrib(pdev, ndev); |
2294 | if (ret) | 2356 | if (ret) |
diff --git a/drivers/net/ethernet/smsc/smc91x.h b/drivers/net/ethernet/smsc/smc91x.h index 47dce918eb0f..2a38dacbbd27 100644 --- a/drivers/net/ethernet/smsc/smc91x.h +++ b/drivers/net/ethernet/smsc/smc91x.h | |||
@@ -298,6 +298,9 @@ struct smc_local { | |||
298 | struct sk_buff *pending_tx_skb; | 298 | struct sk_buff *pending_tx_skb; |
299 | struct tasklet_struct tx_task; | 299 | struct tasklet_struct tx_task; |
300 | 300 | ||
301 | struct gpio_desc *power_gpio; | ||
302 | struct gpio_desc *reset_gpio; | ||
303 | |||
301 | /* version/revision of the SMC91x chip */ | 304 | /* version/revision of the SMC91x chip */ |
302 | int version; | 305 | int version; |
303 | 306 | ||
diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c index affb29da353e..77ed74561e5f 100644 --- a/drivers/net/ethernet/smsc/smsc911x.c +++ b/drivers/net/ethernet/smsc/smsc911x.c | |||
@@ -1342,6 +1342,42 @@ static void smsc911x_rx_multicast_update_workaround(struct smsc911x_data *pdata) | |||
1342 | spin_unlock(&pdata->mac_lock); | 1342 | spin_unlock(&pdata->mac_lock); |
1343 | } | 1343 | } |
1344 | 1344 | ||
1345 | static int smsc911x_phy_general_power_up(struct smsc911x_data *pdata) | ||
1346 | { | ||
1347 | int rc = 0; | ||
1348 | |||
1349 | if (!pdata->phy_dev) | ||
1350 | return rc; | ||
1351 | |||
1352 | /* If the internal PHY is in General Power-Down mode, all, except the | ||
1353 | * management interface, is powered-down and stays in that condition as | ||
1354 | * long as Phy register bit 0.11 is HIGH. | ||
1355 | * | ||
1356 | * In that case, clear the bit 0.11, so the PHY powers up and we can | ||
1357 | * access to the phy registers. | ||
1358 | */ | ||
1359 | rc = phy_read(pdata->phy_dev, MII_BMCR); | ||
1360 | if (rc < 0) { | ||
1361 | SMSC_WARN(pdata, drv, "Failed reading PHY control reg"); | ||
1362 | return rc; | ||
1363 | } | ||
1364 | |||
1365 | /* If the PHY general power-down bit is not set is not necessary to | ||
1366 | * disable the general power down-mode. | ||
1367 | */ | ||
1368 | if (rc & BMCR_PDOWN) { | ||
1369 | rc = phy_write(pdata->phy_dev, MII_BMCR, rc & ~BMCR_PDOWN); | ||
1370 | if (rc < 0) { | ||
1371 | SMSC_WARN(pdata, drv, "Failed writing PHY control reg"); | ||
1372 | return rc; | ||
1373 | } | ||
1374 | |||
1375 | usleep_range(1000, 1500); | ||
1376 | } | ||
1377 | |||
1378 | return 0; | ||
1379 | } | ||
1380 | |||
1345 | static int smsc911x_phy_disable_energy_detect(struct smsc911x_data *pdata) | 1381 | static int smsc911x_phy_disable_energy_detect(struct smsc911x_data *pdata) |
1346 | { | 1382 | { |
1347 | int rc = 0; | 1383 | int rc = 0; |
@@ -1356,12 +1392,8 @@ static int smsc911x_phy_disable_energy_detect(struct smsc911x_data *pdata) | |||
1356 | return rc; | 1392 | return rc; |
1357 | } | 1393 | } |
1358 | 1394 | ||
1359 | /* | 1395 | /* Only disable if energy detect mode is already enabled */ |
1360 | * If energy is detected the PHY is already awake so is not necessary | 1396 | if (rc & MII_LAN83C185_EDPWRDOWN) { |
1361 | * to disable the energy detect power-down mode. | ||
1362 | */ | ||
1363 | if ((rc & MII_LAN83C185_EDPWRDOWN) && | ||
1364 | !(rc & MII_LAN83C185_ENERGYON)) { | ||
1365 | /* Disable energy detect mode for this SMSC Transceivers */ | 1397 | /* Disable energy detect mode for this SMSC Transceivers */ |
1366 | rc = phy_write(pdata->phy_dev, MII_LAN83C185_CTRL_STATUS, | 1398 | rc = phy_write(pdata->phy_dev, MII_LAN83C185_CTRL_STATUS, |
1367 | rc & (~MII_LAN83C185_EDPWRDOWN)); | 1399 | rc & (~MII_LAN83C185_EDPWRDOWN)); |
@@ -1370,8 +1402,8 @@ static int smsc911x_phy_disable_energy_detect(struct smsc911x_data *pdata) | |||
1370 | SMSC_WARN(pdata, drv, "Failed writing PHY control reg"); | 1402 | SMSC_WARN(pdata, drv, "Failed writing PHY control reg"); |
1371 | return rc; | 1403 | return rc; |
1372 | } | 1404 | } |
1373 | 1405 | /* Allow PHY to wakeup */ | |
1374 | mdelay(1); | 1406 | mdelay(2); |
1375 | } | 1407 | } |
1376 | 1408 | ||
1377 | return 0; | 1409 | return 0; |
@@ -1393,7 +1425,6 @@ static int smsc911x_phy_enable_energy_detect(struct smsc911x_data *pdata) | |||
1393 | 1425 | ||
1394 | /* Only enable if energy detect mode is already disabled */ | 1426 | /* Only enable if energy detect mode is already disabled */ |
1395 | if (!(rc & MII_LAN83C185_EDPWRDOWN)) { | 1427 | if (!(rc & MII_LAN83C185_EDPWRDOWN)) { |
1396 | mdelay(100); | ||
1397 | /* Enable energy detect mode for this SMSC Transceivers */ | 1428 | /* Enable energy detect mode for this SMSC Transceivers */ |
1398 | rc = phy_write(pdata->phy_dev, MII_LAN83C185_CTRL_STATUS, | 1429 | rc = phy_write(pdata->phy_dev, MII_LAN83C185_CTRL_STATUS, |
1399 | rc | MII_LAN83C185_EDPWRDOWN); | 1430 | rc | MII_LAN83C185_EDPWRDOWN); |
@@ -1402,8 +1433,6 @@ static int smsc911x_phy_enable_energy_detect(struct smsc911x_data *pdata) | |||
1402 | SMSC_WARN(pdata, drv, "Failed writing PHY control reg"); | 1433 | SMSC_WARN(pdata, drv, "Failed writing PHY control reg"); |
1403 | return rc; | 1434 | return rc; |
1404 | } | 1435 | } |
1405 | |||
1406 | mdelay(1); | ||
1407 | } | 1436 | } |
1408 | return 0; | 1437 | return 0; |
1409 | } | 1438 | } |
@@ -1415,6 +1444,16 @@ static int smsc911x_soft_reset(struct smsc911x_data *pdata) | |||
1415 | int ret; | 1444 | int ret; |
1416 | 1445 | ||
1417 | /* | 1446 | /* |
1447 | * Make sure to power-up the PHY chip before doing a reset, otherwise | ||
1448 | * the reset fails. | ||
1449 | */ | ||
1450 | ret = smsc911x_phy_general_power_up(pdata); | ||
1451 | if (ret) { | ||
1452 | SMSC_WARN(pdata, drv, "Failed to power-up the PHY chip"); | ||
1453 | return ret; | ||
1454 | } | ||
1455 | |||
1456 | /* | ||
1418 | * LAN9210/LAN9211/LAN9220/LAN9221 chips have an internal PHY that | 1457 | * LAN9210/LAN9211/LAN9220/LAN9221 chips have an internal PHY that |
1419 | * are initialized in a Energy Detect Power-Down mode that prevents | 1458 | * are initialized in a Energy Detect Power-Down mode that prevents |
1420 | * the MAC chip to be software reseted. So we have to wakeup the PHY | 1459 | * the MAC chip to be software reseted. So we have to wakeup the PHY |
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 6f77a46c7e2c..18c46bb0f3bf 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | |||
@@ -276,6 +276,7 @@ static void stmmac_eee_ctrl_timer(unsigned long arg) | |||
276 | bool stmmac_eee_init(struct stmmac_priv *priv) | 276 | bool stmmac_eee_init(struct stmmac_priv *priv) |
277 | { | 277 | { |
278 | char *phy_bus_name = priv->plat->phy_bus_name; | 278 | char *phy_bus_name = priv->plat->phy_bus_name; |
279 | unsigned long flags; | ||
279 | bool ret = false; | 280 | bool ret = false; |
280 | 281 | ||
281 | /* Using PCS we cannot dial with the phy registers at this stage | 282 | /* Using PCS we cannot dial with the phy registers at this stage |
@@ -300,6 +301,7 @@ bool stmmac_eee_init(struct stmmac_priv *priv) | |||
300 | * changed). | 301 | * changed). |
301 | * In that case the driver disable own timers. | 302 | * In that case the driver disable own timers. |
302 | */ | 303 | */ |
304 | spin_lock_irqsave(&priv->lock, flags); | ||
303 | if (priv->eee_active) { | 305 | if (priv->eee_active) { |
304 | pr_debug("stmmac: disable EEE\n"); | 306 | pr_debug("stmmac: disable EEE\n"); |
305 | del_timer_sync(&priv->eee_ctrl_timer); | 307 | del_timer_sync(&priv->eee_ctrl_timer); |
@@ -307,9 +309,11 @@ bool stmmac_eee_init(struct stmmac_priv *priv) | |||
307 | tx_lpi_timer); | 309 | tx_lpi_timer); |
308 | } | 310 | } |
309 | priv->eee_active = 0; | 311 | priv->eee_active = 0; |
312 | spin_unlock_irqrestore(&priv->lock, flags); | ||
310 | goto out; | 313 | goto out; |
311 | } | 314 | } |
312 | /* Activate the EEE and start timers */ | 315 | /* Activate the EEE and start timers */ |
316 | spin_lock_irqsave(&priv->lock, flags); | ||
313 | if (!priv->eee_active) { | 317 | if (!priv->eee_active) { |
314 | priv->eee_active = 1; | 318 | priv->eee_active = 1; |
315 | init_timer(&priv->eee_ctrl_timer); | 319 | init_timer(&priv->eee_ctrl_timer); |
@@ -325,9 +329,10 @@ bool stmmac_eee_init(struct stmmac_priv *priv) | |||
325 | /* Set HW EEE according to the speed */ | 329 | /* Set HW EEE according to the speed */ |
326 | priv->hw->mac->set_eee_pls(priv->hw, priv->phydev->link); | 330 | priv->hw->mac->set_eee_pls(priv->hw, priv->phydev->link); |
327 | 331 | ||
328 | pr_debug("stmmac: Energy-Efficient Ethernet initialized\n"); | ||
329 | |||
330 | ret = true; | 332 | ret = true; |
333 | spin_unlock_irqrestore(&priv->lock, flags); | ||
334 | |||
335 | pr_debug("stmmac: Energy-Efficient Ethernet initialized\n"); | ||
331 | } | 336 | } |
332 | out: | 337 | out: |
333 | return ret; | 338 | return ret; |
@@ -760,12 +765,12 @@ static void stmmac_adjust_link(struct net_device *dev) | |||
760 | if (new_state && netif_msg_link(priv)) | 765 | if (new_state && netif_msg_link(priv)) |
761 | phy_print_status(phydev); | 766 | phy_print_status(phydev); |
762 | 767 | ||
768 | spin_unlock_irqrestore(&priv->lock, flags); | ||
769 | |||
763 | /* At this stage, it could be needed to setup the EEE or adjust some | 770 | /* At this stage, it could be needed to setup the EEE or adjust some |
764 | * MAC related HW registers. | 771 | * MAC related HW registers. |
765 | */ | 772 | */ |
766 | priv->eee_enabled = stmmac_eee_init(priv); | 773 | priv->eee_enabled = stmmac_eee_init(priv); |
767 | |||
768 | spin_unlock_irqrestore(&priv->lock, flags); | ||
769 | } | 774 | } |
770 | 775 | ||
771 | /** | 776 | /** |
@@ -959,12 +964,12 @@ static void stmmac_clear_descriptors(struct stmmac_priv *priv) | |||
959 | } | 964 | } |
960 | 965 | ||
961 | static int stmmac_init_rx_buffers(struct stmmac_priv *priv, struct dma_desc *p, | 966 | static int stmmac_init_rx_buffers(struct stmmac_priv *priv, struct dma_desc *p, |
962 | int i) | 967 | int i, gfp_t flags) |
963 | { | 968 | { |
964 | struct sk_buff *skb; | 969 | struct sk_buff *skb; |
965 | 970 | ||
966 | skb = __netdev_alloc_skb(priv->dev, priv->dma_buf_sz + NET_IP_ALIGN, | 971 | skb = __netdev_alloc_skb(priv->dev, priv->dma_buf_sz + NET_IP_ALIGN, |
967 | GFP_KERNEL); | 972 | flags); |
968 | if (!skb) { | 973 | if (!skb) { |
969 | pr_err("%s: Rx init fails; skb is NULL\n", __func__); | 974 | pr_err("%s: Rx init fails; skb is NULL\n", __func__); |
970 | return -ENOMEM; | 975 | return -ENOMEM; |
@@ -1006,7 +1011,7 @@ static void stmmac_free_rx_buffers(struct stmmac_priv *priv, int i) | |||
1006 | * and allocates the socket buffers. It suppors the chained and ring | 1011 | * and allocates the socket buffers. It suppors the chained and ring |
1007 | * modes. | 1012 | * modes. |
1008 | */ | 1013 | */ |
1009 | static int init_dma_desc_rings(struct net_device *dev) | 1014 | static int init_dma_desc_rings(struct net_device *dev, gfp_t flags) |
1010 | { | 1015 | { |
1011 | int i; | 1016 | int i; |
1012 | struct stmmac_priv *priv = netdev_priv(dev); | 1017 | struct stmmac_priv *priv = netdev_priv(dev); |
@@ -1041,7 +1046,7 @@ static int init_dma_desc_rings(struct net_device *dev) | |||
1041 | else | 1046 | else |
1042 | p = priv->dma_rx + i; | 1047 | p = priv->dma_rx + i; |
1043 | 1048 | ||
1044 | ret = stmmac_init_rx_buffers(priv, p, i); | 1049 | ret = stmmac_init_rx_buffers(priv, p, i, flags); |
1045 | if (ret) | 1050 | if (ret) |
1046 | goto err_init_rx_buffers; | 1051 | goto err_init_rx_buffers; |
1047 | 1052 | ||
@@ -1647,11 +1652,6 @@ static int stmmac_hw_setup(struct net_device *dev) | |||
1647 | struct stmmac_priv *priv = netdev_priv(dev); | 1652 | struct stmmac_priv *priv = netdev_priv(dev); |
1648 | int ret; | 1653 | int ret; |
1649 | 1654 | ||
1650 | ret = init_dma_desc_rings(dev); | ||
1651 | if (ret < 0) { | ||
1652 | pr_err("%s: DMA descriptors initialization failed\n", __func__); | ||
1653 | return ret; | ||
1654 | } | ||
1655 | /* DMA initialization and SW reset */ | 1655 | /* DMA initialization and SW reset */ |
1656 | ret = stmmac_init_dma_engine(priv); | 1656 | ret = stmmac_init_dma_engine(priv); |
1657 | if (ret < 0) { | 1657 | if (ret < 0) { |
@@ -1705,10 +1705,6 @@ static int stmmac_hw_setup(struct net_device *dev) | |||
1705 | } | 1705 | } |
1706 | priv->tx_lpi_timer = STMMAC_DEFAULT_TWT_LS; | 1706 | priv->tx_lpi_timer = STMMAC_DEFAULT_TWT_LS; |
1707 | 1707 | ||
1708 | priv->eee_enabled = stmmac_eee_init(priv); | ||
1709 | |||
1710 | stmmac_init_tx_coalesce(priv); | ||
1711 | |||
1712 | if ((priv->use_riwt) && (priv->hw->dma->rx_watchdog)) { | 1708 | if ((priv->use_riwt) && (priv->hw->dma->rx_watchdog)) { |
1713 | priv->rx_riwt = MAX_DMA_RIWT; | 1709 | priv->rx_riwt = MAX_DMA_RIWT; |
1714 | priv->hw->dma->rx_watchdog(priv->ioaddr, MAX_DMA_RIWT); | 1710 | priv->hw->dma->rx_watchdog(priv->ioaddr, MAX_DMA_RIWT); |
@@ -1761,12 +1757,20 @@ static int stmmac_open(struct net_device *dev) | |||
1761 | goto dma_desc_error; | 1757 | goto dma_desc_error; |
1762 | } | 1758 | } |
1763 | 1759 | ||
1760 | ret = init_dma_desc_rings(dev, GFP_KERNEL); | ||
1761 | if (ret < 0) { | ||
1762 | pr_err("%s: DMA descriptors initialization failed\n", __func__); | ||
1763 | goto init_error; | ||
1764 | } | ||
1765 | |||
1764 | ret = stmmac_hw_setup(dev); | 1766 | ret = stmmac_hw_setup(dev); |
1765 | if (ret < 0) { | 1767 | if (ret < 0) { |
1766 | pr_err("%s: Hw setup failed\n", __func__); | 1768 | pr_err("%s: Hw setup failed\n", __func__); |
1767 | goto init_error; | 1769 | goto init_error; |
1768 | } | 1770 | } |
1769 | 1771 | ||
1772 | stmmac_init_tx_coalesce(priv); | ||
1773 | |||
1770 | if (priv->phydev) | 1774 | if (priv->phydev) |
1771 | phy_start(priv->phydev); | 1775 | phy_start(priv->phydev); |
1772 | 1776 | ||
@@ -1894,7 +1898,10 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1894 | unsigned int nopaged_len = skb_headlen(skb); | 1898 | unsigned int nopaged_len = skb_headlen(skb); |
1895 | unsigned int enh_desc = priv->plat->enh_desc; | 1899 | unsigned int enh_desc = priv->plat->enh_desc; |
1896 | 1900 | ||
1901 | spin_lock(&priv->tx_lock); | ||
1902 | |||
1897 | if (unlikely(stmmac_tx_avail(priv) < nfrags + 1)) { | 1903 | if (unlikely(stmmac_tx_avail(priv) < nfrags + 1)) { |
1904 | spin_unlock(&priv->tx_lock); | ||
1898 | if (!netif_queue_stopped(dev)) { | 1905 | if (!netif_queue_stopped(dev)) { |
1899 | netif_stop_queue(dev); | 1906 | netif_stop_queue(dev); |
1900 | /* This is a hard error, log it. */ | 1907 | /* This is a hard error, log it. */ |
@@ -1903,8 +1910,6 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1903 | return NETDEV_TX_BUSY; | 1910 | return NETDEV_TX_BUSY; |
1904 | } | 1911 | } |
1905 | 1912 | ||
1906 | spin_lock(&priv->tx_lock); | ||
1907 | |||
1908 | if (priv->tx_path_in_lpi_mode) | 1913 | if (priv->tx_path_in_lpi_mode) |
1909 | stmmac_disable_eee_mode(priv); | 1914 | stmmac_disable_eee_mode(priv); |
1910 | 1915 | ||
@@ -2025,6 +2030,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2025 | return NETDEV_TX_OK; | 2030 | return NETDEV_TX_OK; |
2026 | 2031 | ||
2027 | dma_map_err: | 2032 | dma_map_err: |
2033 | spin_unlock(&priv->tx_lock); | ||
2028 | dev_err(priv->device, "Tx dma map failed\n"); | 2034 | dev_err(priv->device, "Tx dma map failed\n"); |
2029 | dev_kfree_skb(skb); | 2035 | dev_kfree_skb(skb); |
2030 | priv->dev->stats.tx_dropped++; | 2036 | priv->dev->stats.tx_dropped++; |
@@ -2281,9 +2287,7 @@ static void stmmac_set_rx_mode(struct net_device *dev) | |||
2281 | { | 2287 | { |
2282 | struct stmmac_priv *priv = netdev_priv(dev); | 2288 | struct stmmac_priv *priv = netdev_priv(dev); |
2283 | 2289 | ||
2284 | spin_lock(&priv->lock); | ||
2285 | priv->hw->mac->set_filter(priv->hw, dev); | 2290 | priv->hw->mac->set_filter(priv->hw, dev); |
2286 | spin_unlock(&priv->lock); | ||
2287 | } | 2291 | } |
2288 | 2292 | ||
2289 | /** | 2293 | /** |
@@ -2950,7 +2954,7 @@ int stmmac_suspend(struct net_device *ndev) | |||
2950 | stmmac_set_mac(priv->ioaddr, false); | 2954 | stmmac_set_mac(priv->ioaddr, false); |
2951 | pinctrl_pm_select_sleep_state(priv->device); | 2955 | pinctrl_pm_select_sleep_state(priv->device); |
2952 | /* Disable clock in case of PWM is off */ | 2956 | /* Disable clock in case of PWM is off */ |
2953 | clk_disable_unprepare(priv->stmmac_clk); | 2957 | clk_disable(priv->stmmac_clk); |
2954 | } | 2958 | } |
2955 | spin_unlock_irqrestore(&priv->lock, flags); | 2959 | spin_unlock_irqrestore(&priv->lock, flags); |
2956 | 2960 | ||
@@ -2982,7 +2986,7 @@ int stmmac_resume(struct net_device *ndev) | |||
2982 | } else { | 2986 | } else { |
2983 | pinctrl_pm_select_default_state(priv->device); | 2987 | pinctrl_pm_select_default_state(priv->device); |
2984 | /* enable the clk prevously disabled */ | 2988 | /* enable the clk prevously disabled */ |
2985 | clk_prepare_enable(priv->stmmac_clk); | 2989 | clk_enable(priv->stmmac_clk); |
2986 | /* reset the phy so that it's ready */ | 2990 | /* reset the phy so that it's ready */ |
2987 | if (priv->mii) | 2991 | if (priv->mii) |
2988 | stmmac_mdio_reset(priv->mii); | 2992 | stmmac_mdio_reset(priv->mii); |
@@ -2990,7 +2994,9 @@ int stmmac_resume(struct net_device *ndev) | |||
2990 | 2994 | ||
2991 | netif_device_attach(ndev); | 2995 | netif_device_attach(ndev); |
2992 | 2996 | ||
2997 | init_dma_desc_rings(ndev, GFP_ATOMIC); | ||
2993 | stmmac_hw_setup(ndev); | 2998 | stmmac_hw_setup(ndev); |
2999 | stmmac_init_tx_coalesce(priv); | ||
2994 | 3000 | ||
2995 | napi_enable(&priv->napi); | 3001 | napi_enable(&priv->napi); |
2996 | 3002 | ||
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c index 655a23bbc451..e17a970eaf2b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | |||
@@ -33,6 +33,7 @@ static struct stmmac_dma_cfg dma_cfg; | |||
33 | static void stmmac_default_data(void) | 33 | static void stmmac_default_data(void) |
34 | { | 34 | { |
35 | memset(&plat_dat, 0, sizeof(struct plat_stmmacenet_data)); | 35 | memset(&plat_dat, 0, sizeof(struct plat_stmmacenet_data)); |
36 | |||
36 | plat_dat.bus_id = 1; | 37 | plat_dat.bus_id = 1; |
37 | plat_dat.phy_addr = 0; | 38 | plat_dat.phy_addr = 0; |
38 | plat_dat.interface = PHY_INTERFACE_MODE_GMII; | 39 | plat_dat.interface = PHY_INTERFACE_MODE_GMII; |
@@ -47,6 +48,12 @@ static void stmmac_default_data(void) | |||
47 | dma_cfg.pbl = 32; | 48 | dma_cfg.pbl = 32; |
48 | dma_cfg.burst_len = DMA_AXI_BLEN_256; | 49 | dma_cfg.burst_len = DMA_AXI_BLEN_256; |
49 | plat_dat.dma_cfg = &dma_cfg; | 50 | plat_dat.dma_cfg = &dma_cfg; |
51 | |||
52 | /* Set default value for multicast hash bins */ | ||
53 | plat_dat.multicast_filter_bins = HASH_TABLE_SIZE; | ||
54 | |||
55 | /* Set default value for unicast filter entries */ | ||
56 | plat_dat.unicast_filter_entries = 1; | ||
50 | } | 57 | } |
51 | 58 | ||
52 | /** | 59 | /** |
diff --git a/drivers/net/ethernet/sun/sunhme.c b/drivers/net/ethernet/sun/sunhme.c index 72c8525d5457..9c014803b03b 100644 --- a/drivers/net/ethernet/sun/sunhme.c +++ b/drivers/net/ethernet/sun/sunhme.c | |||
@@ -1262,6 +1262,7 @@ static void happy_meal_init_rings(struct happy_meal *hp) | |||
1262 | HMD(("init rxring, ")); | 1262 | HMD(("init rxring, ")); |
1263 | for (i = 0; i < RX_RING_SIZE; i++) { | 1263 | for (i = 0; i < RX_RING_SIZE; i++) { |
1264 | struct sk_buff *skb; | 1264 | struct sk_buff *skb; |
1265 | u32 mapping; | ||
1265 | 1266 | ||
1266 | skb = happy_meal_alloc_skb(RX_BUF_ALLOC_SIZE, GFP_ATOMIC); | 1267 | skb = happy_meal_alloc_skb(RX_BUF_ALLOC_SIZE, GFP_ATOMIC); |
1267 | if (!skb) { | 1268 | if (!skb) { |
@@ -1272,10 +1273,16 @@ static void happy_meal_init_rings(struct happy_meal *hp) | |||
1272 | 1273 | ||
1273 | /* Because we reserve afterwards. */ | 1274 | /* Because we reserve afterwards. */ |
1274 | skb_put(skb, (ETH_FRAME_LEN + RX_OFFSET + 4)); | 1275 | skb_put(skb, (ETH_FRAME_LEN + RX_OFFSET + 4)); |
1276 | mapping = dma_map_single(hp->dma_dev, skb->data, RX_BUF_ALLOC_SIZE, | ||
1277 | DMA_FROM_DEVICE); | ||
1278 | if (dma_mapping_error(hp->dma_dev, mapping)) { | ||
1279 | dev_kfree_skb_any(skb); | ||
1280 | hme_write_rxd(hp, &hb->happy_meal_rxd[i], 0, 0); | ||
1281 | continue; | ||
1282 | } | ||
1275 | hme_write_rxd(hp, &hb->happy_meal_rxd[i], | 1283 | hme_write_rxd(hp, &hb->happy_meal_rxd[i], |
1276 | (RXFLAG_OWN | ((RX_BUF_ALLOC_SIZE - RX_OFFSET) << 16)), | 1284 | (RXFLAG_OWN | ((RX_BUF_ALLOC_SIZE - RX_OFFSET) << 16)), |
1277 | dma_map_single(hp->dma_dev, skb->data, RX_BUF_ALLOC_SIZE, | 1285 | mapping); |
1278 | DMA_FROM_DEVICE)); | ||
1279 | skb_reserve(skb, RX_OFFSET); | 1286 | skb_reserve(skb, RX_OFFSET); |
1280 | } | 1287 | } |
1281 | 1288 | ||
@@ -2020,6 +2027,7 @@ static void happy_meal_rx(struct happy_meal *hp, struct net_device *dev) | |||
2020 | skb = hp->rx_skbs[elem]; | 2027 | skb = hp->rx_skbs[elem]; |
2021 | if (len > RX_COPY_THRESHOLD) { | 2028 | if (len > RX_COPY_THRESHOLD) { |
2022 | struct sk_buff *new_skb; | 2029 | struct sk_buff *new_skb; |
2030 | u32 mapping; | ||
2023 | 2031 | ||
2024 | /* Now refill the entry, if we can. */ | 2032 | /* Now refill the entry, if we can. */ |
2025 | new_skb = happy_meal_alloc_skb(RX_BUF_ALLOC_SIZE, GFP_ATOMIC); | 2033 | new_skb = happy_meal_alloc_skb(RX_BUF_ALLOC_SIZE, GFP_ATOMIC); |
@@ -2027,13 +2035,21 @@ static void happy_meal_rx(struct happy_meal *hp, struct net_device *dev) | |||
2027 | drops++; | 2035 | drops++; |
2028 | goto drop_it; | 2036 | goto drop_it; |
2029 | } | 2037 | } |
2038 | skb_put(new_skb, (ETH_FRAME_LEN + RX_OFFSET + 4)); | ||
2039 | mapping = dma_map_single(hp->dma_dev, new_skb->data, | ||
2040 | RX_BUF_ALLOC_SIZE, | ||
2041 | DMA_FROM_DEVICE); | ||
2042 | if (unlikely(dma_mapping_error(hp->dma_dev, mapping))) { | ||
2043 | dev_kfree_skb_any(new_skb); | ||
2044 | drops++; | ||
2045 | goto drop_it; | ||
2046 | } | ||
2047 | |||
2030 | dma_unmap_single(hp->dma_dev, dma_addr, RX_BUF_ALLOC_SIZE, DMA_FROM_DEVICE); | 2048 | dma_unmap_single(hp->dma_dev, dma_addr, RX_BUF_ALLOC_SIZE, DMA_FROM_DEVICE); |
2031 | hp->rx_skbs[elem] = new_skb; | 2049 | hp->rx_skbs[elem] = new_skb; |
2032 | skb_put(new_skb, (ETH_FRAME_LEN + RX_OFFSET + 4)); | ||
2033 | hme_write_rxd(hp, this, | 2050 | hme_write_rxd(hp, this, |
2034 | (RXFLAG_OWN|((RX_BUF_ALLOC_SIZE-RX_OFFSET)<<16)), | 2051 | (RXFLAG_OWN|((RX_BUF_ALLOC_SIZE-RX_OFFSET)<<16)), |
2035 | dma_map_single(hp->dma_dev, new_skb->data, RX_BUF_ALLOC_SIZE, | 2052 | mapping); |
2036 | DMA_FROM_DEVICE)); | ||
2037 | skb_reserve(new_skb, RX_OFFSET); | 2053 | skb_reserve(new_skb, RX_OFFSET); |
2038 | 2054 | ||
2039 | /* Trim the original skb for the netif. */ | 2055 | /* Trim the original skb for the netif. */ |
@@ -2248,6 +2264,25 @@ static void happy_meal_tx_timeout(struct net_device *dev) | |||
2248 | netif_wake_queue(dev); | 2264 | netif_wake_queue(dev); |
2249 | } | 2265 | } |
2250 | 2266 | ||
2267 | static void unmap_partial_tx_skb(struct happy_meal *hp, u32 first_mapping, | ||
2268 | u32 first_len, u32 first_entry, u32 entry) | ||
2269 | { | ||
2270 | struct happy_meal_txd *txbase = &hp->happy_block->happy_meal_txd[0]; | ||
2271 | |||
2272 | dma_unmap_single(hp->dma_dev, first_mapping, first_len, DMA_TO_DEVICE); | ||
2273 | |||
2274 | first_entry = NEXT_TX(first_entry); | ||
2275 | while (first_entry != entry) { | ||
2276 | struct happy_meal_txd *this = &txbase[first_entry]; | ||
2277 | u32 addr, len; | ||
2278 | |||
2279 | addr = hme_read_desc32(hp, &this->tx_addr); | ||
2280 | len = hme_read_desc32(hp, &this->tx_flags); | ||
2281 | len &= TXFLAG_SIZE; | ||
2282 | dma_unmap_page(hp->dma_dev, addr, len, DMA_TO_DEVICE); | ||
2283 | } | ||
2284 | } | ||
2285 | |||
2251 | static netdev_tx_t happy_meal_start_xmit(struct sk_buff *skb, | 2286 | static netdev_tx_t happy_meal_start_xmit(struct sk_buff *skb, |
2252 | struct net_device *dev) | 2287 | struct net_device *dev) |
2253 | { | 2288 | { |
@@ -2284,6 +2319,8 @@ static netdev_tx_t happy_meal_start_xmit(struct sk_buff *skb, | |||
2284 | 2319 | ||
2285 | len = skb->len; | 2320 | len = skb->len; |
2286 | mapping = dma_map_single(hp->dma_dev, skb->data, len, DMA_TO_DEVICE); | 2321 | mapping = dma_map_single(hp->dma_dev, skb->data, len, DMA_TO_DEVICE); |
2322 | if (unlikely(dma_mapping_error(hp->dma_dev, mapping))) | ||
2323 | goto out_dma_error; | ||
2287 | tx_flags |= (TXFLAG_SOP | TXFLAG_EOP); | 2324 | tx_flags |= (TXFLAG_SOP | TXFLAG_EOP); |
2288 | hme_write_txd(hp, &hp->happy_block->happy_meal_txd[entry], | 2325 | hme_write_txd(hp, &hp->happy_block->happy_meal_txd[entry], |
2289 | (tx_flags | (len & TXFLAG_SIZE)), | 2326 | (tx_flags | (len & TXFLAG_SIZE)), |
@@ -2299,6 +2336,8 @@ static netdev_tx_t happy_meal_start_xmit(struct sk_buff *skb, | |||
2299 | first_len = skb_headlen(skb); | 2336 | first_len = skb_headlen(skb); |
2300 | first_mapping = dma_map_single(hp->dma_dev, skb->data, first_len, | 2337 | first_mapping = dma_map_single(hp->dma_dev, skb->data, first_len, |
2301 | DMA_TO_DEVICE); | 2338 | DMA_TO_DEVICE); |
2339 | if (unlikely(dma_mapping_error(hp->dma_dev, first_mapping))) | ||
2340 | goto out_dma_error; | ||
2302 | entry = NEXT_TX(entry); | 2341 | entry = NEXT_TX(entry); |
2303 | 2342 | ||
2304 | for (frag = 0; frag < skb_shinfo(skb)->nr_frags; frag++) { | 2343 | for (frag = 0; frag < skb_shinfo(skb)->nr_frags; frag++) { |
@@ -2308,6 +2347,11 @@ static netdev_tx_t happy_meal_start_xmit(struct sk_buff *skb, | |||
2308 | len = skb_frag_size(this_frag); | 2347 | len = skb_frag_size(this_frag); |
2309 | mapping = skb_frag_dma_map(hp->dma_dev, this_frag, | 2348 | mapping = skb_frag_dma_map(hp->dma_dev, this_frag, |
2310 | 0, len, DMA_TO_DEVICE); | 2349 | 0, len, DMA_TO_DEVICE); |
2350 | if (unlikely(dma_mapping_error(hp->dma_dev, mapping))) { | ||
2351 | unmap_partial_tx_skb(hp, first_mapping, first_len, | ||
2352 | first_entry, entry); | ||
2353 | goto out_dma_error; | ||
2354 | } | ||
2311 | this_txflags = tx_flags; | 2355 | this_txflags = tx_flags; |
2312 | if (frag == skb_shinfo(skb)->nr_frags - 1) | 2356 | if (frag == skb_shinfo(skb)->nr_frags - 1) |
2313 | this_txflags |= TXFLAG_EOP; | 2357 | this_txflags |= TXFLAG_EOP; |
@@ -2333,6 +2377,14 @@ static netdev_tx_t happy_meal_start_xmit(struct sk_buff *skb, | |||
2333 | 2377 | ||
2334 | tx_add_log(hp, TXLOG_ACTION_TXMIT, 0); | 2378 | tx_add_log(hp, TXLOG_ACTION_TXMIT, 0); |
2335 | return NETDEV_TX_OK; | 2379 | return NETDEV_TX_OK; |
2380 | |||
2381 | out_dma_error: | ||
2382 | hp->tx_skbs[hp->tx_new] = NULL; | ||
2383 | spin_unlock_irq(&hp->happy_lock); | ||
2384 | |||
2385 | dev_kfree_skb_any(skb); | ||
2386 | dev->stats.tx_dropped++; | ||
2387 | return NETDEV_TX_OK; | ||
2336 | } | 2388 | } |
2337 | 2389 | ||
2338 | static struct net_device_stats *happy_meal_get_stats(struct net_device *dev) | 2390 | static struct net_device_stats *happy_meal_get_stats(struct net_device *dev) |
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 952e1e4764b7..d8794488f80a 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
@@ -591,8 +591,8 @@ static void cpsw_set_promiscious(struct net_device *ndev, bool enable) | |||
591 | if (enable) { | 591 | if (enable) { |
592 | unsigned long timeout = jiffies + HZ; | 592 | unsigned long timeout = jiffies + HZ; |
593 | 593 | ||
594 | /* Disable Learn for all ports */ | 594 | /* Disable Learn for all ports (host is port 0 and slaves are port 1 and up */ |
595 | for (i = 0; i < priv->data.slaves; i++) { | 595 | for (i = 0; i <= priv->data.slaves; i++) { |
596 | cpsw_ale_control_set(ale, i, | 596 | cpsw_ale_control_set(ale, i, |
597 | ALE_PORT_NOLEARN, 1); | 597 | ALE_PORT_NOLEARN, 1); |
598 | cpsw_ale_control_set(ale, i, | 598 | cpsw_ale_control_set(ale, i, |
@@ -616,11 +616,11 @@ static void cpsw_set_promiscious(struct net_device *ndev, bool enable) | |||
616 | cpsw_ale_control_set(ale, 0, ALE_P0_UNI_FLOOD, 1); | 616 | cpsw_ale_control_set(ale, 0, ALE_P0_UNI_FLOOD, 1); |
617 | dev_dbg(&ndev->dev, "promiscuity enabled\n"); | 617 | dev_dbg(&ndev->dev, "promiscuity enabled\n"); |
618 | } else { | 618 | } else { |
619 | /* Flood All Unicast Packets to Host port */ | 619 | /* Don't Flood All Unicast Packets to Host port */ |
620 | cpsw_ale_control_set(ale, 0, ALE_P0_UNI_FLOOD, 0); | 620 | cpsw_ale_control_set(ale, 0, ALE_P0_UNI_FLOOD, 0); |
621 | 621 | ||
622 | /* Enable Learn for all ports */ | 622 | /* Enable Learn for all ports (host is port 0 and slaves are port 1 and up */ |
623 | for (i = 0; i < priv->data.slaves; i++) { | 623 | for (i = 0; i <= priv->data.slaves; i++) { |
624 | cpsw_ale_control_set(ale, i, | 624 | cpsw_ale_control_set(ale, i, |
625 | ALE_PORT_NOLEARN, 0); | 625 | ALE_PORT_NOLEARN, 0); |
626 | cpsw_ale_control_set(ale, i, | 626 | cpsw_ale_control_set(ale, i, |
@@ -638,12 +638,16 @@ static void cpsw_ndo_set_rx_mode(struct net_device *ndev) | |||
638 | if (ndev->flags & IFF_PROMISC) { | 638 | if (ndev->flags & IFF_PROMISC) { |
639 | /* Enable promiscuous mode */ | 639 | /* Enable promiscuous mode */ |
640 | cpsw_set_promiscious(ndev, true); | 640 | cpsw_set_promiscious(ndev, true); |
641 | cpsw_ale_set_allmulti(priv->ale, IFF_ALLMULTI); | ||
641 | return; | 642 | return; |
642 | } else { | 643 | } else { |
643 | /* Disable promiscuous mode */ | 644 | /* Disable promiscuous mode */ |
644 | cpsw_set_promiscious(ndev, false); | 645 | cpsw_set_promiscious(ndev, false); |
645 | } | 646 | } |
646 | 647 | ||
648 | /* Restore allmulti on vlans if necessary */ | ||
649 | cpsw_ale_set_allmulti(priv->ale, priv->ndev->flags & IFF_ALLMULTI); | ||
650 | |||
647 | /* Clear all mcast from ALE */ | 651 | /* Clear all mcast from ALE */ |
648 | cpsw_ale_flush_multicast(priv->ale, ALE_ALL_PORTS << priv->host_port); | 652 | cpsw_ale_flush_multicast(priv->ale, ALE_ALL_PORTS << priv->host_port); |
649 | 653 | ||
@@ -1149,6 +1153,7 @@ static inline void cpsw_add_default_vlan(struct cpsw_priv *priv) | |||
1149 | const int port = priv->host_port; | 1153 | const int port = priv->host_port; |
1150 | u32 reg; | 1154 | u32 reg; |
1151 | int i; | 1155 | int i; |
1156 | int unreg_mcast_mask; | ||
1152 | 1157 | ||
1153 | reg = (priv->version == CPSW_VERSION_1) ? CPSW1_PORT_VLAN : | 1158 | reg = (priv->version == CPSW_VERSION_1) ? CPSW1_PORT_VLAN : |
1154 | CPSW2_PORT_VLAN; | 1159 | CPSW2_PORT_VLAN; |
@@ -1158,9 +1163,14 @@ static inline void cpsw_add_default_vlan(struct cpsw_priv *priv) | |||
1158 | for (i = 0; i < priv->data.slaves; i++) | 1163 | for (i = 0; i < priv->data.slaves; i++) |
1159 | slave_write(priv->slaves + i, vlan, reg); | 1164 | slave_write(priv->slaves + i, vlan, reg); |
1160 | 1165 | ||
1166 | if (priv->ndev->flags & IFF_ALLMULTI) | ||
1167 | unreg_mcast_mask = ALE_ALL_PORTS; | ||
1168 | else | ||
1169 | unreg_mcast_mask = ALE_PORT_1 | ALE_PORT_2; | ||
1170 | |||
1161 | cpsw_ale_add_vlan(priv->ale, vlan, ALE_ALL_PORTS << port, | 1171 | cpsw_ale_add_vlan(priv->ale, vlan, ALE_ALL_PORTS << port, |
1162 | ALE_ALL_PORTS << port, ALE_ALL_PORTS << port, | 1172 | ALE_ALL_PORTS << port, ALE_ALL_PORTS << port, |
1163 | (ALE_PORT_1 | ALE_PORT_2) << port); | 1173 | unreg_mcast_mask << port); |
1164 | } | 1174 | } |
1165 | 1175 | ||
1166 | static void cpsw_init_host_port(struct cpsw_priv *priv) | 1176 | static void cpsw_init_host_port(struct cpsw_priv *priv) |
@@ -1620,11 +1630,17 @@ static inline int cpsw_add_vlan_ale_entry(struct cpsw_priv *priv, | |||
1620 | unsigned short vid) | 1630 | unsigned short vid) |
1621 | { | 1631 | { |
1622 | int ret; | 1632 | int ret; |
1633 | int unreg_mcast_mask; | ||
1634 | |||
1635 | if (priv->ndev->flags & IFF_ALLMULTI) | ||
1636 | unreg_mcast_mask = ALE_ALL_PORTS; | ||
1637 | else | ||
1638 | unreg_mcast_mask = ALE_PORT_1 | ALE_PORT_2; | ||
1623 | 1639 | ||
1624 | ret = cpsw_ale_add_vlan(priv->ale, vid, | 1640 | ret = cpsw_ale_add_vlan(priv->ale, vid, |
1625 | ALE_ALL_PORTS << priv->host_port, | 1641 | ALE_ALL_PORTS << priv->host_port, |
1626 | 0, ALE_ALL_PORTS << priv->host_port, | 1642 | 0, ALE_ALL_PORTS << priv->host_port, |
1627 | (ALE_PORT_1 | ALE_PORT_2) << priv->host_port); | 1643 | unreg_mcast_mask << priv->host_port); |
1628 | if (ret != 0) | 1644 | if (ret != 0) |
1629 | return ret; | 1645 | return ret; |
1630 | 1646 | ||
@@ -2006,7 +2022,7 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data, | |||
2006 | parp = of_get_property(slave_node, "phy_id", &lenp); | 2022 | parp = of_get_property(slave_node, "phy_id", &lenp); |
2007 | if ((parp == NULL) || (lenp != (sizeof(void *) * 2))) { | 2023 | if ((parp == NULL) || (lenp != (sizeof(void *) * 2))) { |
2008 | dev_err(&pdev->dev, "Missing slave[%d] phy_id property\n", i); | 2024 | dev_err(&pdev->dev, "Missing slave[%d] phy_id property\n", i); |
2009 | return -EINVAL; | 2025 | goto no_phy_slave; |
2010 | } | 2026 | } |
2011 | mdio_node = of_find_node_by_phandle(be32_to_cpup(parp)); | 2027 | mdio_node = of_find_node_by_phandle(be32_to_cpup(parp)); |
2012 | phyid = be32_to_cpup(parp+1); | 2028 | phyid = be32_to_cpup(parp+1); |
@@ -2019,6 +2035,14 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data, | |||
2019 | snprintf(slave_data->phy_id, sizeof(slave_data->phy_id), | 2035 | snprintf(slave_data->phy_id, sizeof(slave_data->phy_id), |
2020 | PHY_ID_FMT, mdio->name, phyid); | 2036 | PHY_ID_FMT, mdio->name, phyid); |
2021 | 2037 | ||
2038 | slave_data->phy_if = of_get_phy_mode(slave_node); | ||
2039 | if (slave_data->phy_if < 0) { | ||
2040 | dev_err(&pdev->dev, "Missing or malformed slave[%d] phy-mode property\n", | ||
2041 | i); | ||
2042 | return slave_data->phy_if; | ||
2043 | } | ||
2044 | |||
2045 | no_phy_slave: | ||
2022 | mac_addr = of_get_mac_address(slave_node); | 2046 | mac_addr = of_get_mac_address(slave_node); |
2023 | if (mac_addr) { | 2047 | if (mac_addr) { |
2024 | memcpy(slave_data->mac_addr, mac_addr, ETH_ALEN); | 2048 | memcpy(slave_data->mac_addr, mac_addr, ETH_ALEN); |
@@ -2030,14 +2054,6 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data, | |||
2030 | return ret; | 2054 | return ret; |
2031 | } | 2055 | } |
2032 | } | 2056 | } |
2033 | |||
2034 | slave_data->phy_if = of_get_phy_mode(slave_node); | ||
2035 | if (slave_data->phy_if < 0) { | ||
2036 | dev_err(&pdev->dev, "Missing or malformed slave[%d] phy-mode property\n", | ||
2037 | i); | ||
2038 | return slave_data->phy_if; | ||
2039 | } | ||
2040 | |||
2041 | if (data->dual_emac) { | 2057 | if (data->dual_emac) { |
2042 | if (of_property_read_u32(slave_node, "dual_emac_res_vlan", | 2058 | if (of_property_read_u32(slave_node, "dual_emac_res_vlan", |
2043 | &prop)) { | 2059 | &prop)) { |
diff --git a/drivers/net/ethernet/ti/cpsw_ale.c b/drivers/net/ethernet/ti/cpsw_ale.c index 0579b2243bb6..097ebe7077ac 100644 --- a/drivers/net/ethernet/ti/cpsw_ale.c +++ b/drivers/net/ethernet/ti/cpsw_ale.c | |||
@@ -443,6 +443,35 @@ int cpsw_ale_del_vlan(struct cpsw_ale *ale, u16 vid, int port_mask) | |||
443 | return 0; | 443 | return 0; |
444 | } | 444 | } |
445 | 445 | ||
446 | void cpsw_ale_set_allmulti(struct cpsw_ale *ale, int allmulti) | ||
447 | { | ||
448 | u32 ale_entry[ALE_ENTRY_WORDS]; | ||
449 | int type, idx; | ||
450 | int unreg_mcast = 0; | ||
451 | |||
452 | /* Only bother doing the work if the setting is actually changing */ | ||
453 | if (ale->allmulti == allmulti) | ||
454 | return; | ||
455 | |||
456 | /* Remember the new setting to check against next time */ | ||
457 | ale->allmulti = allmulti; | ||
458 | |||
459 | for (idx = 0; idx < ale->params.ale_entries; idx++) { | ||
460 | cpsw_ale_read(ale, idx, ale_entry); | ||
461 | type = cpsw_ale_get_entry_type(ale_entry); | ||
462 | if (type != ALE_TYPE_VLAN) | ||
463 | continue; | ||
464 | |||
465 | unreg_mcast = cpsw_ale_get_vlan_unreg_mcast(ale_entry); | ||
466 | if (allmulti) | ||
467 | unreg_mcast |= 1; | ||
468 | else | ||
469 | unreg_mcast &= ~1; | ||
470 | cpsw_ale_set_vlan_unreg_mcast(ale_entry, unreg_mcast); | ||
471 | cpsw_ale_write(ale, idx, ale_entry); | ||
472 | } | ||
473 | } | ||
474 | |||
446 | struct ale_control_info { | 475 | struct ale_control_info { |
447 | const char *name; | 476 | const char *name; |
448 | int offset, port_offset; | 477 | int offset, port_offset; |
@@ -756,7 +785,6 @@ int cpsw_ale_destroy(struct cpsw_ale *ale) | |||
756 | { | 785 | { |
757 | if (!ale) | 786 | if (!ale) |
758 | return -EINVAL; | 787 | return -EINVAL; |
759 | cpsw_ale_stop(ale); | ||
760 | cpsw_ale_control_set(ale, 0, ALE_ENABLE, 0); | 788 | cpsw_ale_control_set(ale, 0, ALE_ENABLE, 0); |
761 | kfree(ale); | 789 | kfree(ale); |
762 | return 0; | 790 | return 0; |
diff --git a/drivers/net/ethernet/ti/cpsw_ale.h b/drivers/net/ethernet/ti/cpsw_ale.h index 31cf43cab42e..c0d4127aa549 100644 --- a/drivers/net/ethernet/ti/cpsw_ale.h +++ b/drivers/net/ethernet/ti/cpsw_ale.h | |||
@@ -27,6 +27,7 @@ struct cpsw_ale { | |||
27 | struct cpsw_ale_params params; | 27 | struct cpsw_ale_params params; |
28 | struct timer_list timer; | 28 | struct timer_list timer; |
29 | unsigned long ageout; | 29 | unsigned long ageout; |
30 | int allmulti; | ||
30 | }; | 31 | }; |
31 | 32 | ||
32 | enum cpsw_ale_control { | 33 | enum cpsw_ale_control { |
@@ -103,6 +104,7 @@ int cpsw_ale_del_mcast(struct cpsw_ale *ale, u8 *addr, int port_mask, | |||
103 | int cpsw_ale_add_vlan(struct cpsw_ale *ale, u16 vid, int port, int untag, | 104 | int cpsw_ale_add_vlan(struct cpsw_ale *ale, u16 vid, int port, int untag, |
104 | int reg_mcast, int unreg_mcast); | 105 | int reg_mcast, int unreg_mcast); |
105 | int cpsw_ale_del_vlan(struct cpsw_ale *ale, u16 vid, int port); | 106 | int cpsw_ale_del_vlan(struct cpsw_ale *ale, u16 vid, int port); |
107 | void cpsw_ale_set_allmulti(struct cpsw_ale *ale, int allmulti); | ||
106 | 108 | ||
107 | int cpsw_ale_control_get(struct cpsw_ale *ale, int port, int control); | 109 | int cpsw_ale_control_get(struct cpsw_ale *ale, int port, int control); |
108 | int cpsw_ale_control_set(struct cpsw_ale *ale, int port, | 110 | int cpsw_ale_control_set(struct cpsw_ale *ale, int port, |
diff --git a/drivers/net/ethernet/ti/cpts.c b/drivers/net/ethernet/ti/cpts.c index ab92f67da035..4a4388b813ac 100644 --- a/drivers/net/ethernet/ti/cpts.c +++ b/drivers/net/ethernet/ti/cpts.c | |||
@@ -264,7 +264,7 @@ static int cpts_match(struct sk_buff *skb, unsigned int ptp_class, | |||
264 | 264 | ||
265 | switch (ptp_class & PTP_CLASS_PMASK) { | 265 | switch (ptp_class & PTP_CLASS_PMASK) { |
266 | case PTP_CLASS_IPV4: | 266 | case PTP_CLASS_IPV4: |
267 | offset += ETH_HLEN + IPV4_HLEN(data) + UDP_HLEN; | 267 | offset += ETH_HLEN + IPV4_HLEN(data + offset) + UDP_HLEN; |
268 | break; | 268 | break; |
269 | case PTP_CLASS_IPV6: | 269 | case PTP_CLASS_IPV6: |
270 | offset += ETH_HLEN + IP6_HLEN + UDP_HLEN; | 270 | offset += ETH_HLEN + IP6_HLEN + UDP_HLEN; |
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 9e17d1a91e71..78ec33f5100b 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c | |||
@@ -550,6 +550,7 @@ do_lso: | |||
550 | do_send: | 550 | do_send: |
551 | /* Start filling in the page buffers with the rndis hdr */ | 551 | /* Start filling in the page buffers with the rndis hdr */ |
552 | rndis_msg->msg_len += rndis_msg_size; | 552 | rndis_msg->msg_len += rndis_msg_size; |
553 | packet->total_data_buflen = rndis_msg->msg_len; | ||
553 | packet->page_buf_cnt = init_page_array(rndis_msg, rndis_msg_size, | 554 | packet->page_buf_cnt = init_page_array(rndis_msg, rndis_msg_size, |
554 | skb, &packet->page_buf[0]); | 555 | skb, &packet->page_buf[0]); |
555 | 556 | ||
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 29b3bb410781..bfb0b6ec8c56 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
@@ -272,7 +272,7 @@ static void macvlan_process_broadcast(struct work_struct *w) | |||
272 | struct sk_buff *skb; | 272 | struct sk_buff *skb; |
273 | struct sk_buff_head list; | 273 | struct sk_buff_head list; |
274 | 274 | ||
275 | skb_queue_head_init(&list); | 275 | __skb_queue_head_init(&list); |
276 | 276 | ||
277 | spin_lock_bh(&port->bc_queue.lock); | 277 | spin_lock_bh(&port->bc_queue.lock); |
278 | skb_queue_splice_tail_init(&port->bc_queue, &list); | 278 | skb_queue_splice_tail_init(&port->bc_queue, &list); |
@@ -1082,9 +1082,15 @@ static void macvlan_port_destroy(struct net_device *dev) | |||
1082 | { | 1082 | { |
1083 | struct macvlan_port *port = macvlan_port_get_rtnl(dev); | 1083 | struct macvlan_port *port = macvlan_port_get_rtnl(dev); |
1084 | 1084 | ||
1085 | cancel_work_sync(&port->bc_work); | ||
1086 | dev->priv_flags &= ~IFF_MACVLAN_PORT; | 1085 | dev->priv_flags &= ~IFF_MACVLAN_PORT; |
1087 | netdev_rx_handler_unregister(dev); | 1086 | netdev_rx_handler_unregister(dev); |
1087 | |||
1088 | /* After this point, no packet can schedule bc_work anymore, | ||
1089 | * but we need to cancel it and purge left skbs if any. | ||
1090 | */ | ||
1091 | cancel_work_sync(&port->bc_work); | ||
1092 | __skb_queue_purge(&port->bc_queue); | ||
1093 | |||
1088 | kfree_rcu(port, rcu); | 1094 | kfree_rcu(port, rcu); |
1089 | } | 1095 | } |
1090 | 1096 | ||
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c index 65e2892342bd..880cc090dc44 100644 --- a/drivers/net/macvtap.c +++ b/drivers/net/macvtap.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/idr.h> | 16 | #include <linux/idr.h> |
17 | #include <linux/fs.h> | 17 | #include <linux/fs.h> |
18 | 18 | ||
19 | #include <net/ipv6.h> | ||
19 | #include <net/net_namespace.h> | 20 | #include <net/net_namespace.h> |
20 | #include <net/rtnetlink.h> | 21 | #include <net/rtnetlink.h> |
21 | #include <net/sock.h> | 22 | #include <net/sock.h> |
@@ -65,7 +66,7 @@ static struct cdev macvtap_cdev; | |||
65 | static const struct proto_ops macvtap_socket_ops; | 66 | static const struct proto_ops macvtap_socket_ops; |
66 | 67 | ||
67 | #define TUN_OFFLOADS (NETIF_F_HW_CSUM | NETIF_F_TSO_ECN | NETIF_F_TSO | \ | 68 | #define TUN_OFFLOADS (NETIF_F_HW_CSUM | NETIF_F_TSO_ECN | NETIF_F_TSO | \ |
68 | NETIF_F_TSO6 | NETIF_F_UFO) | 69 | NETIF_F_TSO6) |
69 | #define RX_OFFLOADS (NETIF_F_GRO | NETIF_F_LRO) | 70 | #define RX_OFFLOADS (NETIF_F_GRO | NETIF_F_LRO) |
70 | #define TAP_FEATURES (NETIF_F_GSO | NETIF_F_SG) | 71 | #define TAP_FEATURES (NETIF_F_GSO | NETIF_F_SG) |
71 | 72 | ||
@@ -569,7 +570,11 @@ static int macvtap_skb_from_vnet_hdr(struct sk_buff *skb, | |||
569 | gso_type = SKB_GSO_TCPV6; | 570 | gso_type = SKB_GSO_TCPV6; |
570 | break; | 571 | break; |
571 | case VIRTIO_NET_HDR_GSO_UDP: | 572 | case VIRTIO_NET_HDR_GSO_UDP: |
573 | pr_warn_once("macvtap: %s: using disabled UFO feature; please fix this program\n", | ||
574 | current->comm); | ||
572 | gso_type = SKB_GSO_UDP; | 575 | gso_type = SKB_GSO_UDP; |
576 | if (skb->protocol == htons(ETH_P_IPV6)) | ||
577 | ipv6_proxy_select_ident(skb); | ||
573 | break; | 578 | break; |
574 | default: | 579 | default: |
575 | return -EINVAL; | 580 | return -EINVAL; |
@@ -614,8 +619,6 @@ static void macvtap_skb_to_vnet_hdr(const struct sk_buff *skb, | |||
614 | vnet_hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV4; | 619 | vnet_hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV4; |
615 | else if (sinfo->gso_type & SKB_GSO_TCPV6) | 620 | else if (sinfo->gso_type & SKB_GSO_TCPV6) |
616 | vnet_hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV6; | 621 | vnet_hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV6; |
617 | else if (sinfo->gso_type & SKB_GSO_UDP) | ||
618 | vnet_hdr->gso_type = VIRTIO_NET_HDR_GSO_UDP; | ||
619 | else | 622 | else |
620 | BUG(); | 623 | BUG(); |
621 | if (sinfo->gso_type & SKB_GSO_TCP_ECN) | 624 | if (sinfo->gso_type & SKB_GSO_TCP_ECN) |
@@ -626,6 +629,8 @@ static void macvtap_skb_to_vnet_hdr(const struct sk_buff *skb, | |||
626 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 629 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
627 | vnet_hdr->flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; | 630 | vnet_hdr->flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; |
628 | vnet_hdr->csum_start = skb_checksum_start_offset(skb); | 631 | vnet_hdr->csum_start = skb_checksum_start_offset(skb); |
632 | if (vlan_tx_tag_present(skb)) | ||
633 | vnet_hdr->csum_start += VLAN_HLEN; | ||
629 | vnet_hdr->csum_offset = skb->csum_offset; | 634 | vnet_hdr->csum_offset = skb->csum_offset; |
630 | } else if (skb->ip_summed == CHECKSUM_UNNECESSARY) { | 635 | } else if (skb->ip_summed == CHECKSUM_UNNECESSARY) { |
631 | vnet_hdr->flags = VIRTIO_NET_HDR_F_DATA_VALID; | 636 | vnet_hdr->flags = VIRTIO_NET_HDR_F_DATA_VALID; |
@@ -950,9 +955,6 @@ static int set_offload(struct macvtap_queue *q, unsigned long arg) | |||
950 | if (arg & TUN_F_TSO6) | 955 | if (arg & TUN_F_TSO6) |
951 | feature_mask |= NETIF_F_TSO6; | 956 | feature_mask |= NETIF_F_TSO6; |
952 | } | 957 | } |
953 | |||
954 | if (arg & TUN_F_UFO) | ||
955 | feature_mask |= NETIF_F_UFO; | ||
956 | } | 958 | } |
957 | 959 | ||
958 | /* tun/tap driver inverts the usage for TSO offloads, where | 960 | /* tun/tap driver inverts the usage for TSO offloads, where |
@@ -963,7 +965,7 @@ static int set_offload(struct macvtap_queue *q, unsigned long arg) | |||
963 | * When user space turns off TSO, we turn off GSO/LRO so that | 965 | * When user space turns off TSO, we turn off GSO/LRO so that |
964 | * user-space will not receive TSO frames. | 966 | * user-space will not receive TSO frames. |
965 | */ | 967 | */ |
966 | if (feature_mask & (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_UFO)) | 968 | if (feature_mask & (NETIF_F_TSO | NETIF_F_TSO6)) |
967 | features |= RX_OFFLOADS; | 969 | features |= RX_OFFLOADS; |
968 | else | 970 | else |
969 | features &= ~RX_OFFLOADS; | 971 | features &= ~RX_OFFLOADS; |
@@ -1064,7 +1066,7 @@ static long macvtap_ioctl(struct file *file, unsigned int cmd, | |||
1064 | case TUNSETOFFLOAD: | 1066 | case TUNSETOFFLOAD: |
1065 | /* let the user check for future flags */ | 1067 | /* let the user check for future flags */ |
1066 | if (arg & ~(TUN_F_CSUM | TUN_F_TSO4 | TUN_F_TSO6 | | 1068 | if (arg & ~(TUN_F_CSUM | TUN_F_TSO4 | TUN_F_TSO6 | |
1067 | TUN_F_TSO_ECN | TUN_F_UFO)) | 1069 | TUN_F_TSO_ECN)) |
1068 | return -EINVAL; | 1070 | return -EINVAL; |
1069 | 1071 | ||
1070 | rtnl_lock(); | 1072 | rtnl_lock(); |
diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c index 2954052706e8..e22e602beef3 100644 --- a/drivers/net/phy/dp83640.c +++ b/drivers/net/phy/dp83640.c | |||
@@ -791,7 +791,7 @@ static int match(struct sk_buff *skb, unsigned int type, struct rxts *rxts) | |||
791 | 791 | ||
792 | switch (type & PTP_CLASS_PMASK) { | 792 | switch (type & PTP_CLASS_PMASK) { |
793 | case PTP_CLASS_IPV4: | 793 | case PTP_CLASS_IPV4: |
794 | offset += ETH_HLEN + IPV4_HLEN(data) + UDP_HLEN; | 794 | offset += ETH_HLEN + IPV4_HLEN(data + offset) + UDP_HLEN; |
795 | break; | 795 | break; |
796 | case PTP_CLASS_IPV6: | 796 | case PTP_CLASS_IPV6: |
797 | offset += ETH_HLEN + IP6_HLEN + UDP_HLEN; | 797 | offset += ETH_HLEN + IP6_HLEN + UDP_HLEN; |
@@ -934,7 +934,7 @@ static int is_sync(struct sk_buff *skb, int type) | |||
934 | 934 | ||
935 | switch (type & PTP_CLASS_PMASK) { | 935 | switch (type & PTP_CLASS_PMASK) { |
936 | case PTP_CLASS_IPV4: | 936 | case PTP_CLASS_IPV4: |
937 | offset += ETH_HLEN + IPV4_HLEN(data) + UDP_HLEN; | 937 | offset += ETH_HLEN + IPV4_HLEN(data + offset) + UDP_HLEN; |
938 | break; | 938 | break; |
939 | case PTP_CLASS_IPV6: | 939 | case PTP_CLASS_IPV6: |
940 | offset += ETH_HLEN + IP6_HLEN + UDP_HLEN; | 940 | offset += ETH_HLEN + IP6_HLEN + UDP_HLEN; |
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index bd37e45c89c0..225c033b08f3 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c | |||
@@ -50,10 +50,15 @@ | |||
50 | #define MII_M1011_PHY_SCR 0x10 | 50 | #define MII_M1011_PHY_SCR 0x10 |
51 | #define MII_M1011_PHY_SCR_AUTO_CROSS 0x0060 | 51 | #define MII_M1011_PHY_SCR_AUTO_CROSS 0x0060 |
52 | 52 | ||
53 | #define MII_M1145_PHY_EXT_SR 0x1b | ||
53 | #define MII_M1145_PHY_EXT_CR 0x14 | 54 | #define MII_M1145_PHY_EXT_CR 0x14 |
54 | #define MII_M1145_RGMII_RX_DELAY 0x0080 | 55 | #define MII_M1145_RGMII_RX_DELAY 0x0080 |
55 | #define MII_M1145_RGMII_TX_DELAY 0x0002 | 56 | #define MII_M1145_RGMII_TX_DELAY 0x0002 |
56 | 57 | ||
58 | #define MII_M1145_HWCFG_MODE_SGMII_NO_CLK 0x4 | ||
59 | #define MII_M1145_HWCFG_MODE_MASK 0xf | ||
60 | #define MII_M1145_HWCFG_FIBER_COPPER_AUTO 0x8000 | ||
61 | |||
57 | #define MII_M1111_PHY_LED_CONTROL 0x18 | 62 | #define MII_M1111_PHY_LED_CONTROL 0x18 |
58 | #define MII_M1111_PHY_LED_DIRECT 0x4100 | 63 | #define MII_M1111_PHY_LED_DIRECT 0x4100 |
59 | #define MII_M1111_PHY_LED_COMBINE 0x411c | 64 | #define MII_M1111_PHY_LED_COMBINE 0x411c |
@@ -676,6 +681,20 @@ static int m88e1145_config_init(struct phy_device *phydev) | |||
676 | } | 681 | } |
677 | } | 682 | } |
678 | 683 | ||
684 | if (phydev->interface == PHY_INTERFACE_MODE_SGMII) { | ||
685 | int temp = phy_read(phydev, MII_M1145_PHY_EXT_SR); | ||
686 | if (temp < 0) | ||
687 | return temp; | ||
688 | |||
689 | temp &= ~MII_M1145_HWCFG_MODE_MASK; | ||
690 | temp |= MII_M1145_HWCFG_MODE_SGMII_NO_CLK; | ||
691 | temp |= MII_M1145_HWCFG_FIBER_COPPER_AUTO; | ||
692 | |||
693 | err = phy_write(phydev, MII_M1145_PHY_EXT_SR, temp); | ||
694 | if (err < 0) | ||
695 | return err; | ||
696 | } | ||
697 | |||
679 | err = marvell_of_reg_init(phydev); | 698 | err = marvell_of_reg_init(phydev); |
680 | if (err < 0) | 699 | if (err < 0) |
681 | return err; | 700 | return err; |
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 1dfffdc9dfc3..767cd110f496 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c | |||
@@ -352,6 +352,7 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd) | |||
352 | { | 352 | { |
353 | struct mii_ioctl_data *mii_data = if_mii(ifr); | 353 | struct mii_ioctl_data *mii_data = if_mii(ifr); |
354 | u16 val = mii_data->val_in; | 354 | u16 val = mii_data->val_in; |
355 | bool change_autoneg = false; | ||
355 | 356 | ||
356 | switch (cmd) { | 357 | switch (cmd) { |
357 | case SIOCGMIIPHY: | 358 | case SIOCGMIIPHY: |
@@ -367,22 +368,29 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd) | |||
367 | if (mii_data->phy_id == phydev->addr) { | 368 | if (mii_data->phy_id == phydev->addr) { |
368 | switch (mii_data->reg_num) { | 369 | switch (mii_data->reg_num) { |
369 | case MII_BMCR: | 370 | case MII_BMCR: |
370 | if ((val & (BMCR_RESET | BMCR_ANENABLE)) == 0) | 371 | if ((val & (BMCR_RESET | BMCR_ANENABLE)) == 0) { |
372 | if (phydev->autoneg == AUTONEG_ENABLE) | ||
373 | change_autoneg = true; | ||
371 | phydev->autoneg = AUTONEG_DISABLE; | 374 | phydev->autoneg = AUTONEG_DISABLE; |
372 | else | 375 | if (val & BMCR_FULLDPLX) |
376 | phydev->duplex = DUPLEX_FULL; | ||
377 | else | ||
378 | phydev->duplex = DUPLEX_HALF; | ||
379 | if (val & BMCR_SPEED1000) | ||
380 | phydev->speed = SPEED_1000; | ||
381 | else if (val & BMCR_SPEED100) | ||
382 | phydev->speed = SPEED_100; | ||
383 | else phydev->speed = SPEED_10; | ||
384 | } | ||
385 | else { | ||
386 | if (phydev->autoneg == AUTONEG_DISABLE) | ||
387 | change_autoneg = true; | ||
373 | phydev->autoneg = AUTONEG_ENABLE; | 388 | phydev->autoneg = AUTONEG_ENABLE; |
374 | if (!phydev->autoneg && (val & BMCR_FULLDPLX)) | 389 | } |
375 | phydev->duplex = DUPLEX_FULL; | ||
376 | else | ||
377 | phydev->duplex = DUPLEX_HALF; | ||
378 | if (!phydev->autoneg && (val & BMCR_SPEED1000)) | ||
379 | phydev->speed = SPEED_1000; | ||
380 | else if (!phydev->autoneg && | ||
381 | (val & BMCR_SPEED100)) | ||
382 | phydev->speed = SPEED_100; | ||
383 | break; | 390 | break; |
384 | case MII_ADVERTISE: | 391 | case MII_ADVERTISE: |
385 | phydev->advertising = val; | 392 | phydev->advertising = mii_adv_to_ethtool_adv_t(val); |
393 | change_autoneg = true; | ||
386 | break; | 394 | break; |
387 | default: | 395 | default: |
388 | /* do nothing */ | 396 | /* do nothing */ |
@@ -396,6 +404,10 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd) | |||
396 | if (mii_data->reg_num == MII_BMCR && | 404 | if (mii_data->reg_num == MII_BMCR && |
397 | val & BMCR_RESET) | 405 | val & BMCR_RESET) |
398 | return phy_init_hw(phydev); | 406 | return phy_init_hw(phydev); |
407 | |||
408 | if (change_autoneg) | ||
409 | return phy_start_aneg(phydev); | ||
410 | |||
399 | return 0; | 411 | return 0; |
400 | 412 | ||
401 | case SIOCSHWTSTAMP: | 413 | case SIOCSHWTSTAMP: |
diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c index 68c3a3f4e0ab..794a47329368 100644 --- a/drivers/net/ppp/ppp_generic.c +++ b/drivers/net/ppp/ppp_generic.c | |||
@@ -755,23 +755,23 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
755 | 755 | ||
756 | err = get_filter(argp, &code); | 756 | err = get_filter(argp, &code); |
757 | if (err >= 0) { | 757 | if (err >= 0) { |
758 | struct bpf_prog *pass_filter = NULL; | ||
758 | struct sock_fprog_kern fprog = { | 759 | struct sock_fprog_kern fprog = { |
759 | .len = err, | 760 | .len = err, |
760 | .filter = code, | 761 | .filter = code, |
761 | }; | 762 | }; |
762 | 763 | ||
763 | ppp_lock(ppp); | 764 | err = 0; |
764 | if (ppp->pass_filter) { | 765 | if (fprog.filter) |
765 | bpf_prog_destroy(ppp->pass_filter); | 766 | err = bpf_prog_create(&pass_filter, &fprog); |
766 | ppp->pass_filter = NULL; | 767 | if (!err) { |
768 | ppp_lock(ppp); | ||
769 | if (ppp->pass_filter) | ||
770 | bpf_prog_destroy(ppp->pass_filter); | ||
771 | ppp->pass_filter = pass_filter; | ||
772 | ppp_unlock(ppp); | ||
767 | } | 773 | } |
768 | if (fprog.filter != NULL) | ||
769 | err = bpf_prog_create(&ppp->pass_filter, | ||
770 | &fprog); | ||
771 | else | ||
772 | err = 0; | ||
773 | kfree(code); | 774 | kfree(code); |
774 | ppp_unlock(ppp); | ||
775 | } | 775 | } |
776 | break; | 776 | break; |
777 | } | 777 | } |
@@ -781,23 +781,23 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
781 | 781 | ||
782 | err = get_filter(argp, &code); | 782 | err = get_filter(argp, &code); |
783 | if (err >= 0) { | 783 | if (err >= 0) { |
784 | struct bpf_prog *active_filter = NULL; | ||
784 | struct sock_fprog_kern fprog = { | 785 | struct sock_fprog_kern fprog = { |
785 | .len = err, | 786 | .len = err, |
786 | .filter = code, | 787 | .filter = code, |
787 | }; | 788 | }; |
788 | 789 | ||
789 | ppp_lock(ppp); | 790 | err = 0; |
790 | if (ppp->active_filter) { | 791 | if (fprog.filter) |
791 | bpf_prog_destroy(ppp->active_filter); | 792 | err = bpf_prog_create(&active_filter, &fprog); |
792 | ppp->active_filter = NULL; | 793 | if (!err) { |
794 | ppp_lock(ppp); | ||
795 | if (ppp->active_filter) | ||
796 | bpf_prog_destroy(ppp->active_filter); | ||
797 | ppp->active_filter = active_filter; | ||
798 | ppp_unlock(ppp); | ||
793 | } | 799 | } |
794 | if (fprog.filter != NULL) | ||
795 | err = bpf_prog_create(&ppp->active_filter, | ||
796 | &fprog); | ||
797 | else | ||
798 | err = 0; | ||
799 | kfree(code); | 800 | kfree(code); |
800 | ppp_unlock(ppp); | ||
801 | } | 801 | } |
802 | break; | 802 | break; |
803 | } | 803 | } |
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 186ce541c657..9dd3746994a4 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -65,6 +65,7 @@ | |||
65 | #include <linux/nsproxy.h> | 65 | #include <linux/nsproxy.h> |
66 | #include <linux/virtio_net.h> | 66 | #include <linux/virtio_net.h> |
67 | #include <linux/rcupdate.h> | 67 | #include <linux/rcupdate.h> |
68 | #include <net/ipv6.h> | ||
68 | #include <net/net_namespace.h> | 69 | #include <net/net_namespace.h> |
69 | #include <net/netns/generic.h> | 70 | #include <net/netns/generic.h> |
70 | #include <net/rtnetlink.h> | 71 | #include <net/rtnetlink.h> |
@@ -174,7 +175,7 @@ struct tun_struct { | |||
174 | struct net_device *dev; | 175 | struct net_device *dev; |
175 | netdev_features_t set_features; | 176 | netdev_features_t set_features; |
176 | #define TUN_USER_FEATURES (NETIF_F_HW_CSUM|NETIF_F_TSO_ECN|NETIF_F_TSO| \ | 177 | #define TUN_USER_FEATURES (NETIF_F_HW_CSUM|NETIF_F_TSO_ECN|NETIF_F_TSO| \ |
177 | NETIF_F_TSO6|NETIF_F_UFO) | 178 | NETIF_F_TSO6) |
178 | 179 | ||
179 | int vnet_hdr_sz; | 180 | int vnet_hdr_sz; |
180 | int sndbuf; | 181 | int sndbuf; |
@@ -1139,6 +1140,8 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, | |||
1139 | break; | 1140 | break; |
1140 | } | 1141 | } |
1141 | 1142 | ||
1143 | skb_reset_network_header(skb); | ||
1144 | |||
1142 | if (gso.gso_type != VIRTIO_NET_HDR_GSO_NONE) { | 1145 | if (gso.gso_type != VIRTIO_NET_HDR_GSO_NONE) { |
1143 | pr_debug("GSO!\n"); | 1146 | pr_debug("GSO!\n"); |
1144 | switch (gso.gso_type & ~VIRTIO_NET_HDR_GSO_ECN) { | 1147 | switch (gso.gso_type & ~VIRTIO_NET_HDR_GSO_ECN) { |
@@ -1149,8 +1152,20 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, | |||
1149 | skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6; | 1152 | skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6; |
1150 | break; | 1153 | break; |
1151 | case VIRTIO_NET_HDR_GSO_UDP: | 1154 | case VIRTIO_NET_HDR_GSO_UDP: |
1155 | { | ||
1156 | static bool warned; | ||
1157 | |||
1158 | if (!warned) { | ||
1159 | warned = true; | ||
1160 | netdev_warn(tun->dev, | ||
1161 | "%s: using disabled UFO feature; please fix this program\n", | ||
1162 | current->comm); | ||
1163 | } | ||
1152 | skb_shinfo(skb)->gso_type = SKB_GSO_UDP; | 1164 | skb_shinfo(skb)->gso_type = SKB_GSO_UDP; |
1165 | if (skb->protocol == htons(ETH_P_IPV6)) | ||
1166 | ipv6_proxy_select_ident(skb); | ||
1153 | break; | 1167 | break; |
1168 | } | ||
1154 | default: | 1169 | default: |
1155 | tun->dev->stats.rx_frame_errors++; | 1170 | tun->dev->stats.rx_frame_errors++; |
1156 | kfree_skb(skb); | 1171 | kfree_skb(skb); |
@@ -1179,7 +1194,6 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, | |||
1179 | skb_shinfo(skb)->tx_flags |= SKBTX_SHARED_FRAG; | 1194 | skb_shinfo(skb)->tx_flags |= SKBTX_SHARED_FRAG; |
1180 | } | 1195 | } |
1181 | 1196 | ||
1182 | skb_reset_network_header(skb); | ||
1183 | skb_probe_transport_header(skb, 0); | 1197 | skb_probe_transport_header(skb, 0); |
1184 | 1198 | ||
1185 | rxhash = skb_get_hash(skb); | 1199 | rxhash = skb_get_hash(skb); |
@@ -1221,12 +1235,20 @@ static ssize_t tun_put_user(struct tun_struct *tun, | |||
1221 | struct tun_pi pi = { 0, skb->protocol }; | 1235 | struct tun_pi pi = { 0, skb->protocol }; |
1222 | ssize_t total = 0; | 1236 | ssize_t total = 0; |
1223 | int vlan_offset = 0, copied; | 1237 | int vlan_offset = 0, copied; |
1238 | int vlan_hlen = 0; | ||
1239 | int vnet_hdr_sz = 0; | ||
1240 | |||
1241 | if (vlan_tx_tag_present(skb)) | ||
1242 | vlan_hlen = VLAN_HLEN; | ||
1243 | |||
1244 | if (tun->flags & TUN_VNET_HDR) | ||
1245 | vnet_hdr_sz = tun->vnet_hdr_sz; | ||
1224 | 1246 | ||
1225 | if (!(tun->flags & TUN_NO_PI)) { | 1247 | if (!(tun->flags & TUN_NO_PI)) { |
1226 | if ((len -= sizeof(pi)) < 0) | 1248 | if ((len -= sizeof(pi)) < 0) |
1227 | return -EINVAL; | 1249 | return -EINVAL; |
1228 | 1250 | ||
1229 | if (len < skb->len) { | 1251 | if (len < skb->len + vlan_hlen + vnet_hdr_sz) { |
1230 | /* Packet will be striped */ | 1252 | /* Packet will be striped */ |
1231 | pi.flags |= TUN_PKT_STRIP; | 1253 | pi.flags |= TUN_PKT_STRIP; |
1232 | } | 1254 | } |
@@ -1236,9 +1258,9 @@ static ssize_t tun_put_user(struct tun_struct *tun, | |||
1236 | total += sizeof(pi); | 1258 | total += sizeof(pi); |
1237 | } | 1259 | } |
1238 | 1260 | ||
1239 | if (tun->flags & TUN_VNET_HDR) { | 1261 | if (vnet_hdr_sz) { |
1240 | struct virtio_net_hdr gso = { 0 }; /* no info leak */ | 1262 | struct virtio_net_hdr gso = { 0 }; /* no info leak */ |
1241 | if ((len -= tun->vnet_hdr_sz) < 0) | 1263 | if ((len -= vnet_hdr_sz) < 0) |
1242 | return -EINVAL; | 1264 | return -EINVAL; |
1243 | 1265 | ||
1244 | if (skb_is_gso(skb)) { | 1266 | if (skb_is_gso(skb)) { |
@@ -1251,8 +1273,6 @@ static ssize_t tun_put_user(struct tun_struct *tun, | |||
1251 | gso.gso_type = VIRTIO_NET_HDR_GSO_TCPV4; | 1273 | gso.gso_type = VIRTIO_NET_HDR_GSO_TCPV4; |
1252 | else if (sinfo->gso_type & SKB_GSO_TCPV6) | 1274 | else if (sinfo->gso_type & SKB_GSO_TCPV6) |
1253 | gso.gso_type = VIRTIO_NET_HDR_GSO_TCPV6; | 1275 | gso.gso_type = VIRTIO_NET_HDR_GSO_TCPV6; |
1254 | else if (sinfo->gso_type & SKB_GSO_UDP) | ||
1255 | gso.gso_type = VIRTIO_NET_HDR_GSO_UDP; | ||
1256 | else { | 1276 | else { |
1257 | pr_err("unexpected GSO type: " | 1277 | pr_err("unexpected GSO type: " |
1258 | "0x%x, gso_size %d, hdr_len %d\n", | 1278 | "0x%x, gso_size %d, hdr_len %d\n", |
@@ -1272,7 +1292,8 @@ static ssize_t tun_put_user(struct tun_struct *tun, | |||
1272 | 1292 | ||
1273 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 1293 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
1274 | gso.flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; | 1294 | gso.flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; |
1275 | gso.csum_start = skb_checksum_start_offset(skb); | 1295 | gso.csum_start = skb_checksum_start_offset(skb) + |
1296 | vlan_hlen; | ||
1276 | gso.csum_offset = skb->csum_offset; | 1297 | gso.csum_offset = skb->csum_offset; |
1277 | } else if (skb->ip_summed == CHECKSUM_UNNECESSARY) { | 1298 | } else if (skb->ip_summed == CHECKSUM_UNNECESSARY) { |
1278 | gso.flags = VIRTIO_NET_HDR_F_DATA_VALID; | 1299 | gso.flags = VIRTIO_NET_HDR_F_DATA_VALID; |
@@ -1281,14 +1302,13 @@ static ssize_t tun_put_user(struct tun_struct *tun, | |||
1281 | if (unlikely(memcpy_toiovecend(iv, (void *)&gso, total, | 1302 | if (unlikely(memcpy_toiovecend(iv, (void *)&gso, total, |
1282 | sizeof(gso)))) | 1303 | sizeof(gso)))) |
1283 | return -EFAULT; | 1304 | return -EFAULT; |
1284 | total += tun->vnet_hdr_sz; | 1305 | total += vnet_hdr_sz; |
1285 | } | 1306 | } |
1286 | 1307 | ||
1287 | copied = total; | 1308 | copied = total; |
1288 | total += skb->len; | 1309 | len = min_t(int, skb->len + vlan_hlen, len); |
1289 | if (!vlan_tx_tag_present(skb)) { | 1310 | total += skb->len + vlan_hlen; |
1290 | len = min_t(int, skb->len, len); | 1311 | if (vlan_hlen) { |
1291 | } else { | ||
1292 | int copy, ret; | 1312 | int copy, ret; |
1293 | struct { | 1313 | struct { |
1294 | __be16 h_vlan_proto; | 1314 | __be16 h_vlan_proto; |
@@ -1299,8 +1319,6 @@ static ssize_t tun_put_user(struct tun_struct *tun, | |||
1299 | veth.h_vlan_TCI = htons(vlan_tx_tag_get(skb)); | 1319 | veth.h_vlan_TCI = htons(vlan_tx_tag_get(skb)); |
1300 | 1320 | ||
1301 | vlan_offset = offsetof(struct vlan_ethhdr, h_vlan_proto); | 1321 | vlan_offset = offsetof(struct vlan_ethhdr, h_vlan_proto); |
1302 | len = min_t(int, skb->len + VLAN_HLEN, len); | ||
1303 | total += VLAN_HLEN; | ||
1304 | 1322 | ||
1305 | copy = min_t(int, vlan_offset, len); | 1323 | copy = min_t(int, vlan_offset, len); |
1306 | ret = skb_copy_datagram_const_iovec(skb, 0, iv, copied, copy); | 1324 | ret = skb_copy_datagram_const_iovec(skb, 0, iv, copied, copy); |
@@ -1762,11 +1780,6 @@ static int set_offload(struct tun_struct *tun, unsigned long arg) | |||
1762 | features |= NETIF_F_TSO6; | 1780 | features |= NETIF_F_TSO6; |
1763 | arg &= ~(TUN_F_TSO4|TUN_F_TSO6); | 1781 | arg &= ~(TUN_F_TSO4|TUN_F_TSO6); |
1764 | } | 1782 | } |
1765 | |||
1766 | if (arg & TUN_F_UFO) { | ||
1767 | features |= NETIF_F_UFO; | ||
1768 | arg &= ~TUN_F_UFO; | ||
1769 | } | ||
1770 | } | 1783 | } |
1771 | 1784 | ||
1772 | /* This gives the user a way to test for new features in future by | 1785 | /* This gives the user a way to test for new features in future by |
diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c index 2c05f6cdb12f..816d511e34d3 100644 --- a/drivers/net/usb/asix_devices.c +++ b/drivers/net/usb/asix_devices.c | |||
@@ -465,19 +465,7 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) | |||
465 | return ret; | 465 | return ret; |
466 | } | 466 | } |
467 | 467 | ||
468 | ret = asix_sw_reset(dev, AX_SWRESET_IPPD | AX_SWRESET_PRL); | 468 | ax88772_reset(dev); |
469 | if (ret < 0) | ||
470 | return ret; | ||
471 | |||
472 | msleep(150); | ||
473 | |||
474 | ret = asix_sw_reset(dev, AX_SWRESET_CLEAR); | ||
475 | if (ret < 0) | ||
476 | return ret; | ||
477 | |||
478 | msleep(150); | ||
479 | |||
480 | ret = asix_sw_reset(dev, embd_phy ? AX_SWRESET_IPRL : AX_SWRESET_PRTE); | ||
481 | 469 | ||
482 | /* Read PHYID register *AFTER* the PHY was reset properly */ | 470 | /* Read PHYID register *AFTER* the PHY was reset properly */ |
483 | phyid = asix_get_phyid(dev); | 471 | phyid = asix_get_phyid(dev); |
diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c index be4275721039..e6338c16081a 100644 --- a/drivers/net/usb/ax88179_178a.c +++ b/drivers/net/usb/ax88179_178a.c | |||
@@ -937,6 +937,7 @@ static int ax88179_set_mac_addr(struct net_device *net, void *p) | |||
937 | { | 937 | { |
938 | struct usbnet *dev = netdev_priv(net); | 938 | struct usbnet *dev = netdev_priv(net); |
939 | struct sockaddr *addr = p; | 939 | struct sockaddr *addr = p; |
940 | int ret; | ||
940 | 941 | ||
941 | if (netif_running(net)) | 942 | if (netif_running(net)) |
942 | return -EBUSY; | 943 | return -EBUSY; |
@@ -946,8 +947,12 @@ static int ax88179_set_mac_addr(struct net_device *net, void *p) | |||
946 | memcpy(net->dev_addr, addr->sa_data, ETH_ALEN); | 947 | memcpy(net->dev_addr, addr->sa_data, ETH_ALEN); |
947 | 948 | ||
948 | /* Set the MAC address */ | 949 | /* Set the MAC address */ |
949 | return ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_NODE_ID, ETH_ALEN, | 950 | ret = ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_NODE_ID, ETH_ALEN, |
950 | ETH_ALEN, net->dev_addr); | 951 | ETH_ALEN, net->dev_addr); |
952 | if (ret < 0) | ||
953 | return ret; | ||
954 | |||
955 | return 0; | ||
951 | } | 956 | } |
952 | 957 | ||
953 | static const struct net_device_ops ax88179_netdev_ops = { | 958 | static const struct net_device_ops ax88179_netdev_ops = { |
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c index 2a32d9167d3b..d3920b54a92c 100644 --- a/drivers/net/usb/cdc_ether.c +++ b/drivers/net/usb/cdc_ether.c | |||
@@ -67,6 +67,35 @@ static const u8 mbm_guid[16] = { | |||
67 | 0xa6, 0x07, 0xc0, 0xff, 0xcb, 0x7e, 0x39, 0x2a, | 67 | 0xa6, 0x07, 0xc0, 0xff, 0xcb, 0x7e, 0x39, 0x2a, |
68 | }; | 68 | }; |
69 | 69 | ||
70 | static void usbnet_cdc_update_filter(struct usbnet *dev) | ||
71 | { | ||
72 | struct cdc_state *info = (void *) &dev->data; | ||
73 | struct usb_interface *intf = info->control; | ||
74 | |||
75 | u16 cdc_filter = | ||
76 | USB_CDC_PACKET_TYPE_ALL_MULTICAST | USB_CDC_PACKET_TYPE_DIRECTED | | ||
77 | USB_CDC_PACKET_TYPE_BROADCAST; | ||
78 | |||
79 | if (dev->net->flags & IFF_PROMISC) | ||
80 | cdc_filter |= USB_CDC_PACKET_TYPE_PROMISCUOUS; | ||
81 | |||
82 | /* FIXME cdc-ether has some multicast code too, though it complains | ||
83 | * in routine cases. info->ether describes the multicast support. | ||
84 | * Implement that here, manipulating the cdc filter as needed. | ||
85 | */ | ||
86 | |||
87 | usb_control_msg(dev->udev, | ||
88 | usb_sndctrlpipe(dev->udev, 0), | ||
89 | USB_CDC_SET_ETHERNET_PACKET_FILTER, | ||
90 | USB_TYPE_CLASS | USB_RECIP_INTERFACE, | ||
91 | cdc_filter, | ||
92 | intf->cur_altsetting->desc.bInterfaceNumber, | ||
93 | NULL, | ||
94 | 0, | ||
95 | USB_CTRL_SET_TIMEOUT | ||
96 | ); | ||
97 | } | ||
98 | |||
70 | /* probes control interface, claims data interface, collects the bulk | 99 | /* probes control interface, claims data interface, collects the bulk |
71 | * endpoints, activates data interface (if needed), maybe sets MTU. | 100 | * endpoints, activates data interface (if needed), maybe sets MTU. |
72 | * all pure cdc, except for certain firmware workarounds, and knowing | 101 | * all pure cdc, except for certain firmware workarounds, and knowing |
@@ -347,16 +376,8 @@ next_desc: | |||
347 | * don't do reset all the way. So the packet filter should | 376 | * don't do reset all the way. So the packet filter should |
348 | * be set to a sane initial value. | 377 | * be set to a sane initial value. |
349 | */ | 378 | */ |
350 | usb_control_msg(dev->udev, | 379 | usbnet_cdc_update_filter(dev); |
351 | usb_sndctrlpipe(dev->udev, 0), | 380 | |
352 | USB_CDC_SET_ETHERNET_PACKET_FILTER, | ||
353 | USB_TYPE_CLASS | USB_RECIP_INTERFACE, | ||
354 | USB_CDC_PACKET_TYPE_ALL_MULTICAST | USB_CDC_PACKET_TYPE_DIRECTED | USB_CDC_PACKET_TYPE_BROADCAST, | ||
355 | intf->cur_altsetting->desc.bInterfaceNumber, | ||
356 | NULL, | ||
357 | 0, | ||
358 | USB_CTRL_SET_TIMEOUT | ||
359 | ); | ||
360 | return 0; | 381 | return 0; |
361 | 382 | ||
362 | bad_desc: | 383 | bad_desc: |
@@ -468,10 +489,6 @@ int usbnet_cdc_bind(struct usbnet *dev, struct usb_interface *intf) | |||
468 | return status; | 489 | return status; |
469 | } | 490 | } |
470 | 491 | ||
471 | /* FIXME cdc-ether has some multicast code too, though it complains | ||
472 | * in routine cases. info->ether describes the multicast support. | ||
473 | * Implement that here, manipulating the cdc filter as needed. | ||
474 | */ | ||
475 | return 0; | 492 | return 0; |
476 | } | 493 | } |
477 | EXPORT_SYMBOL_GPL(usbnet_cdc_bind); | 494 | EXPORT_SYMBOL_GPL(usbnet_cdc_bind); |
@@ -482,6 +499,7 @@ static const struct driver_info cdc_info = { | |||
482 | .bind = usbnet_cdc_bind, | 499 | .bind = usbnet_cdc_bind, |
483 | .unbind = usbnet_cdc_unbind, | 500 | .unbind = usbnet_cdc_unbind, |
484 | .status = usbnet_cdc_status, | 501 | .status = usbnet_cdc_status, |
502 | .set_rx_mode = usbnet_cdc_update_filter, | ||
485 | .manage_power = usbnet_manage_power, | 503 | .manage_power = usbnet_manage_power, |
486 | }; | 504 | }; |
487 | 505 | ||
@@ -491,6 +509,7 @@ static const struct driver_info wwan_info = { | |||
491 | .bind = usbnet_cdc_bind, | 509 | .bind = usbnet_cdc_bind, |
492 | .unbind = usbnet_cdc_unbind, | 510 | .unbind = usbnet_cdc_unbind, |
493 | .status = usbnet_cdc_status, | 511 | .status = usbnet_cdc_status, |
512 | .set_rx_mode = usbnet_cdc_update_filter, | ||
494 | .manage_power = usbnet_manage_power, | 513 | .manage_power = usbnet_manage_power, |
495 | }; | 514 | }; |
496 | 515 | ||
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index e3d84c322e4e..c6554c7a8147 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c | |||
@@ -1162,6 +1162,9 @@ static void intr_callback(struct urb *urb) | |||
1162 | case -ESHUTDOWN: | 1162 | case -ESHUTDOWN: |
1163 | netif_device_detach(tp->netdev); | 1163 | netif_device_detach(tp->netdev); |
1164 | case -ENOENT: | 1164 | case -ENOENT: |
1165 | case -EPROTO: | ||
1166 | netif_info(tp, intr, tp->netdev, | ||
1167 | "Stop submitting intr, status %d\n", status); | ||
1165 | return; | 1168 | return; |
1166 | case -EOVERFLOW: | 1169 | case -EOVERFLOW: |
1167 | netif_info(tp, intr, tp->netdev, "intr status -EOVERFLOW\n"); | 1170 | netif_info(tp, intr, tp->netdev, "intr status -EOVERFLOW\n"); |
@@ -2891,6 +2894,9 @@ static int rtl8152_open(struct net_device *netdev) | |||
2891 | if (res) | 2894 | if (res) |
2892 | goto out; | 2895 | goto out; |
2893 | 2896 | ||
2897 | /* set speed to 0 to avoid autoresume try to submit rx */ | ||
2898 | tp->speed = 0; | ||
2899 | |||
2894 | res = usb_autopm_get_interface(tp->intf); | 2900 | res = usb_autopm_get_interface(tp->intf); |
2895 | if (res < 0) { | 2901 | if (res < 0) { |
2896 | free_all_mem(tp); | 2902 | free_all_mem(tp); |
@@ -2904,6 +2910,8 @@ static int rtl8152_open(struct net_device *netdev) | |||
2904 | clear_bit(WORK_ENABLE, &tp->flags); | 2910 | clear_bit(WORK_ENABLE, &tp->flags); |
2905 | usb_kill_urb(tp->intr_urb); | 2911 | usb_kill_urb(tp->intr_urb); |
2906 | cancel_delayed_work_sync(&tp->schedule); | 2912 | cancel_delayed_work_sync(&tp->schedule); |
2913 | |||
2914 | /* disable the tx/rx, if the workqueue has enabled them. */ | ||
2907 | if (tp->speed & LINK_STATUS) | 2915 | if (tp->speed & LINK_STATUS) |
2908 | tp->rtl_ops.disable(tp); | 2916 | tp->rtl_ops.disable(tp); |
2909 | } | 2917 | } |
@@ -2955,10 +2963,7 @@ static int rtl8152_close(struct net_device *netdev) | |||
2955 | * be disable when autoresume occurs, because the | 2963 | * be disable when autoresume occurs, because the |
2956 | * netif_running() would be false. | 2964 | * netif_running() would be false. |
2957 | */ | 2965 | */ |
2958 | if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { | 2966 | rtl_runtime_suspend_enable(tp, false); |
2959 | rtl_runtime_suspend_enable(tp, false); | ||
2960 | clear_bit(SELECTIVE_SUSPEND, &tp->flags); | ||
2961 | } | ||
2962 | 2967 | ||
2963 | tasklet_disable(&tp->tl); | 2968 | tasklet_disable(&tp->tl); |
2964 | tp->rtl_ops.down(tp); | 2969 | tp->rtl_ops.down(tp); |
@@ -3205,7 +3210,7 @@ static int rtl8152_suspend(struct usb_interface *intf, pm_message_t message) | |||
3205 | netif_device_detach(netdev); | 3210 | netif_device_detach(netdev); |
3206 | } | 3211 | } |
3207 | 3212 | ||
3208 | if (netif_running(netdev)) { | 3213 | if (netif_running(netdev) && test_bit(WORK_ENABLE, &tp->flags)) { |
3209 | clear_bit(WORK_ENABLE, &tp->flags); | 3214 | clear_bit(WORK_ENABLE, &tp->flags); |
3210 | usb_kill_urb(tp->intr_urb); | 3215 | usb_kill_urb(tp->intr_urb); |
3211 | tasklet_disable(&tp->tl); | 3216 | tasklet_disable(&tp->tl); |
@@ -3253,6 +3258,8 @@ static int rtl8152_resume(struct usb_interface *intf) | |||
3253 | set_bit(WORK_ENABLE, &tp->flags); | 3258 | set_bit(WORK_ENABLE, &tp->flags); |
3254 | } | 3259 | } |
3255 | usb_submit_urb(tp->intr_urb, GFP_KERNEL); | 3260 | usb_submit_urb(tp->intr_urb, GFP_KERNEL); |
3261 | } else if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { | ||
3262 | clear_bit(SELECTIVE_SUSPEND, &tp->flags); | ||
3256 | } | 3263 | } |
3257 | 3264 | ||
3258 | mutex_unlock(&tp->control); | 3265 | mutex_unlock(&tp->control); |
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index 20615bbd693b..3a6770a65d78 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c | |||
@@ -1052,6 +1052,21 @@ static void __handle_link_change(struct usbnet *dev) | |||
1052 | clear_bit(EVENT_LINK_CHANGE, &dev->flags); | 1052 | clear_bit(EVENT_LINK_CHANGE, &dev->flags); |
1053 | } | 1053 | } |
1054 | 1054 | ||
1055 | static void usbnet_set_rx_mode(struct net_device *net) | ||
1056 | { | ||
1057 | struct usbnet *dev = netdev_priv(net); | ||
1058 | |||
1059 | usbnet_defer_kevent(dev, EVENT_SET_RX_MODE); | ||
1060 | } | ||
1061 | |||
1062 | static void __handle_set_rx_mode(struct usbnet *dev) | ||
1063 | { | ||
1064 | if (dev->driver_info->set_rx_mode) | ||
1065 | (dev->driver_info->set_rx_mode)(dev); | ||
1066 | |||
1067 | clear_bit(EVENT_SET_RX_MODE, &dev->flags); | ||
1068 | } | ||
1069 | |||
1055 | /* work that cannot be done in interrupt context uses keventd. | 1070 | /* work that cannot be done in interrupt context uses keventd. |
1056 | * | 1071 | * |
1057 | * NOTE: with 2.5 we could do more of this using completion callbacks, | 1072 | * NOTE: with 2.5 we could do more of this using completion callbacks, |
@@ -1157,6 +1172,10 @@ skip_reset: | |||
1157 | if (test_bit (EVENT_LINK_CHANGE, &dev->flags)) | 1172 | if (test_bit (EVENT_LINK_CHANGE, &dev->flags)) |
1158 | __handle_link_change(dev); | 1173 | __handle_link_change(dev); |
1159 | 1174 | ||
1175 | if (test_bit (EVENT_SET_RX_MODE, &dev->flags)) | ||
1176 | __handle_set_rx_mode(dev); | ||
1177 | |||
1178 | |||
1160 | if (dev->flags) | 1179 | if (dev->flags) |
1161 | netdev_dbg(dev->net, "kevent done, flags = 0x%lx\n", dev->flags); | 1180 | netdev_dbg(dev->net, "kevent done, flags = 0x%lx\n", dev->flags); |
1162 | } | 1181 | } |
@@ -1525,6 +1544,7 @@ static const struct net_device_ops usbnet_netdev_ops = { | |||
1525 | .ndo_stop = usbnet_stop, | 1544 | .ndo_stop = usbnet_stop, |
1526 | .ndo_start_xmit = usbnet_start_xmit, | 1545 | .ndo_start_xmit = usbnet_start_xmit, |
1527 | .ndo_tx_timeout = usbnet_tx_timeout, | 1546 | .ndo_tx_timeout = usbnet_tx_timeout, |
1547 | .ndo_set_rx_mode = usbnet_set_rx_mode, | ||
1528 | .ndo_change_mtu = usbnet_change_mtu, | 1548 | .ndo_change_mtu = usbnet_change_mtu, |
1529 | .ndo_set_mac_address = eth_mac_addr, | 1549 | .ndo_set_mac_address = eth_mac_addr, |
1530 | .ndo_validate_addr = eth_validate_addr, | 1550 | .ndo_validate_addr = eth_validate_addr, |
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index d75256bd1a6a..ec2a8b41ed41 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -491,8 +491,17 @@ static void receive_buf(struct receive_queue *rq, void *buf, unsigned int len) | |||
491 | skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4; | 491 | skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4; |
492 | break; | 492 | break; |
493 | case VIRTIO_NET_HDR_GSO_UDP: | 493 | case VIRTIO_NET_HDR_GSO_UDP: |
494 | { | ||
495 | static bool warned; | ||
496 | |||
497 | if (!warned) { | ||
498 | warned = true; | ||
499 | netdev_warn(dev, | ||
500 | "host using disabled UFO feature; please fix it\n"); | ||
501 | } | ||
494 | skb_shinfo(skb)->gso_type = SKB_GSO_UDP; | 502 | skb_shinfo(skb)->gso_type = SKB_GSO_UDP; |
495 | break; | 503 | break; |
504 | } | ||
496 | case VIRTIO_NET_HDR_GSO_TCPV6: | 505 | case VIRTIO_NET_HDR_GSO_TCPV6: |
497 | skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6; | 506 | skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6; |
498 | break; | 507 | break; |
@@ -881,8 +890,6 @@ static int xmit_skb(struct send_queue *sq, struct sk_buff *skb) | |||
881 | hdr->hdr.gso_type = VIRTIO_NET_HDR_GSO_TCPV4; | 890 | hdr->hdr.gso_type = VIRTIO_NET_HDR_GSO_TCPV4; |
882 | else if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6) | 891 | else if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6) |
883 | hdr->hdr.gso_type = VIRTIO_NET_HDR_GSO_TCPV6; | 892 | hdr->hdr.gso_type = VIRTIO_NET_HDR_GSO_TCPV6; |
884 | else if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP) | ||
885 | hdr->hdr.gso_type = VIRTIO_NET_HDR_GSO_UDP; | ||
886 | else | 893 | else |
887 | BUG(); | 894 | BUG(); |
888 | if (skb_shinfo(skb)->gso_type & SKB_GSO_TCP_ECN) | 895 | if (skb_shinfo(skb)->gso_type & SKB_GSO_TCP_ECN) |
@@ -1705,7 +1712,7 @@ static int virtnet_probe(struct virtio_device *vdev) | |||
1705 | dev->features |= NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST; | 1712 | dev->features |= NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST; |
1706 | 1713 | ||
1707 | if (virtio_has_feature(vdev, VIRTIO_NET_F_GSO)) { | 1714 | if (virtio_has_feature(vdev, VIRTIO_NET_F_GSO)) { |
1708 | dev->hw_features |= NETIF_F_TSO | NETIF_F_UFO | 1715 | dev->hw_features |= NETIF_F_TSO |
1709 | | NETIF_F_TSO_ECN | NETIF_F_TSO6; | 1716 | | NETIF_F_TSO_ECN | NETIF_F_TSO6; |
1710 | } | 1717 | } |
1711 | /* Individual feature bits: what can host handle? */ | 1718 | /* Individual feature bits: what can host handle? */ |
@@ -1715,11 +1722,9 @@ static int virtnet_probe(struct virtio_device *vdev) | |||
1715 | dev->hw_features |= NETIF_F_TSO6; | 1722 | dev->hw_features |= NETIF_F_TSO6; |
1716 | if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_ECN)) | 1723 | if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_ECN)) |
1717 | dev->hw_features |= NETIF_F_TSO_ECN; | 1724 | dev->hw_features |= NETIF_F_TSO_ECN; |
1718 | if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_UFO)) | ||
1719 | dev->hw_features |= NETIF_F_UFO; | ||
1720 | 1725 | ||
1721 | if (gso) | 1726 | if (gso) |
1722 | dev->features |= dev->hw_features & (NETIF_F_ALL_TSO|NETIF_F_UFO); | 1727 | dev->features |= dev->hw_features & NETIF_F_ALL_TSO; |
1723 | /* (!csum && gso) case will be fixed by register_netdev() */ | 1728 | /* (!csum && gso) case will be fixed by register_netdev() */ |
1724 | } | 1729 | } |
1725 | if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_CSUM)) | 1730 | if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_CSUM)) |
@@ -1757,8 +1762,7 @@ static int virtnet_probe(struct virtio_device *vdev) | |||
1757 | /* If we can receive ANY GSO packets, we must allocate large ones. */ | 1762 | /* If we can receive ANY GSO packets, we must allocate large ones. */ |
1758 | if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO4) || | 1763 | if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO4) || |
1759 | virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO6) || | 1764 | virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO6) || |
1760 | virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_ECN) || | 1765 | virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_ECN)) |
1761 | virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_UFO)) | ||
1762 | vi->big_packets = true; | 1766 | vi->big_packets = true; |
1763 | 1767 | ||
1764 | if (virtio_has_feature(vdev, VIRTIO_NET_F_MRG_RXBUF)) | 1768 | if (virtio_has_feature(vdev, VIRTIO_NET_F_MRG_RXBUF)) |
@@ -1952,9 +1956,9 @@ static struct virtio_device_id id_table[] = { | |||
1952 | static unsigned int features[] = { | 1956 | static unsigned int features[] = { |
1953 | VIRTIO_NET_F_CSUM, VIRTIO_NET_F_GUEST_CSUM, | 1957 | VIRTIO_NET_F_CSUM, VIRTIO_NET_F_GUEST_CSUM, |
1954 | VIRTIO_NET_F_GSO, VIRTIO_NET_F_MAC, | 1958 | VIRTIO_NET_F_GSO, VIRTIO_NET_F_MAC, |
1955 | VIRTIO_NET_F_HOST_TSO4, VIRTIO_NET_F_HOST_UFO, VIRTIO_NET_F_HOST_TSO6, | 1959 | VIRTIO_NET_F_HOST_TSO4, VIRTIO_NET_F_HOST_TSO6, |
1956 | VIRTIO_NET_F_HOST_ECN, VIRTIO_NET_F_GUEST_TSO4, VIRTIO_NET_F_GUEST_TSO6, | 1960 | VIRTIO_NET_F_HOST_ECN, VIRTIO_NET_F_GUEST_TSO4, VIRTIO_NET_F_GUEST_TSO6, |
1957 | VIRTIO_NET_F_GUEST_ECN, VIRTIO_NET_F_GUEST_UFO, | 1961 | VIRTIO_NET_F_GUEST_ECN, |
1958 | VIRTIO_NET_F_MRG_RXBUF, VIRTIO_NET_F_STATUS, VIRTIO_NET_F_CTRL_VQ, | 1962 | VIRTIO_NET_F_MRG_RXBUF, VIRTIO_NET_F_STATUS, VIRTIO_NET_F_CTRL_VQ, |
1959 | VIRTIO_NET_F_CTRL_RX, VIRTIO_NET_F_CTRL_VLAN, | 1963 | VIRTIO_NET_F_CTRL_RX, VIRTIO_NET_F_CTRL_VLAN, |
1960 | VIRTIO_NET_F_GUEST_ANNOUNCE, VIRTIO_NET_F_MQ, | 1964 | VIRTIO_NET_F_GUEST_ANNOUNCE, VIRTIO_NET_F_MQ, |
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index ca309820d39e..fa9dc45b75a6 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
@@ -275,13 +275,15 @@ static inline struct vxlan_rdst *first_remote_rtnl(struct vxlan_fdb *fdb) | |||
275 | return list_first_entry(&fdb->remotes, struct vxlan_rdst, list); | 275 | return list_first_entry(&fdb->remotes, struct vxlan_rdst, list); |
276 | } | 276 | } |
277 | 277 | ||
278 | /* Find VXLAN socket based on network namespace and UDP port */ | 278 | /* Find VXLAN socket based on network namespace, address family and UDP port */ |
279 | static struct vxlan_sock *vxlan_find_sock(struct net *net, __be16 port) | 279 | static struct vxlan_sock *vxlan_find_sock(struct net *net, |
280 | sa_family_t family, __be16 port) | ||
280 | { | 281 | { |
281 | struct vxlan_sock *vs; | 282 | struct vxlan_sock *vs; |
282 | 283 | ||
283 | hlist_for_each_entry_rcu(vs, vs_head(net, port), hlist) { | 284 | hlist_for_each_entry_rcu(vs, vs_head(net, port), hlist) { |
284 | if (inet_sk(vs->sock->sk)->inet_sport == port) | 285 | if (inet_sk(vs->sock->sk)->inet_sport == port && |
286 | inet_sk(vs->sock->sk)->sk.sk_family == family) | ||
285 | return vs; | 287 | return vs; |
286 | } | 288 | } |
287 | return NULL; | 289 | return NULL; |
@@ -300,11 +302,12 @@ static struct vxlan_dev *vxlan_vs_find_vni(struct vxlan_sock *vs, u32 id) | |||
300 | } | 302 | } |
301 | 303 | ||
302 | /* Look up VNI in a per net namespace table */ | 304 | /* Look up VNI in a per net namespace table */ |
303 | static struct vxlan_dev *vxlan_find_vni(struct net *net, u32 id, __be16 port) | 305 | static struct vxlan_dev *vxlan_find_vni(struct net *net, u32 id, |
306 | sa_family_t family, __be16 port) | ||
304 | { | 307 | { |
305 | struct vxlan_sock *vs; | 308 | struct vxlan_sock *vs; |
306 | 309 | ||
307 | vs = vxlan_find_sock(net, port); | 310 | vs = vxlan_find_sock(net, family, port); |
308 | if (!vs) | 311 | if (!vs) |
309 | return NULL; | 312 | return NULL; |
310 | 313 | ||
@@ -621,6 +624,8 @@ static int vxlan_gro_complete(struct sk_buff *skb, int nhoff) | |||
621 | int vxlan_len = sizeof(struct vxlanhdr) + sizeof(struct ethhdr); | 624 | int vxlan_len = sizeof(struct vxlanhdr) + sizeof(struct ethhdr); |
622 | int err = -ENOSYS; | 625 | int err = -ENOSYS; |
623 | 626 | ||
627 | udp_tunnel_gro_complete(skb, nhoff); | ||
628 | |||
624 | eh = (struct ethhdr *)(skb->data + nhoff + sizeof(struct vxlanhdr)); | 629 | eh = (struct ethhdr *)(skb->data + nhoff + sizeof(struct vxlanhdr)); |
625 | type = eh->h_proto; | 630 | type = eh->h_proto; |
626 | 631 | ||
@@ -1771,7 +1776,8 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, | |||
1771 | struct vxlan_dev *dst_vxlan; | 1776 | struct vxlan_dev *dst_vxlan; |
1772 | 1777 | ||
1773 | ip_rt_put(rt); | 1778 | ip_rt_put(rt); |
1774 | dst_vxlan = vxlan_find_vni(vxlan->net, vni, dst_port); | 1779 | dst_vxlan = vxlan_find_vni(vxlan->net, vni, |
1780 | dst->sa.sa_family, dst_port); | ||
1775 | if (!dst_vxlan) | 1781 | if (!dst_vxlan) |
1776 | goto tx_error; | 1782 | goto tx_error; |
1777 | vxlan_encap_bypass(skb, vxlan, dst_vxlan); | 1783 | vxlan_encap_bypass(skb, vxlan, dst_vxlan); |
@@ -1825,7 +1831,8 @@ static void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, | |||
1825 | struct vxlan_dev *dst_vxlan; | 1831 | struct vxlan_dev *dst_vxlan; |
1826 | 1832 | ||
1827 | dst_release(ndst); | 1833 | dst_release(ndst); |
1828 | dst_vxlan = vxlan_find_vni(vxlan->net, vni, dst_port); | 1834 | dst_vxlan = vxlan_find_vni(vxlan->net, vni, |
1835 | dst->sa.sa_family, dst_port); | ||
1829 | if (!dst_vxlan) | 1836 | if (!dst_vxlan) |
1830 | goto tx_error; | 1837 | goto tx_error; |
1831 | vxlan_encap_bypass(skb, vxlan, dst_vxlan); | 1838 | vxlan_encap_bypass(skb, vxlan, dst_vxlan); |
@@ -1985,13 +1992,15 @@ static int vxlan_init(struct net_device *dev) | |||
1985 | struct vxlan_dev *vxlan = netdev_priv(dev); | 1992 | struct vxlan_dev *vxlan = netdev_priv(dev); |
1986 | struct vxlan_net *vn = net_generic(vxlan->net, vxlan_net_id); | 1993 | struct vxlan_net *vn = net_generic(vxlan->net, vxlan_net_id); |
1987 | struct vxlan_sock *vs; | 1994 | struct vxlan_sock *vs; |
1995 | bool ipv6 = vxlan->flags & VXLAN_F_IPV6; | ||
1988 | 1996 | ||
1989 | dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); | 1997 | dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); |
1990 | if (!dev->tstats) | 1998 | if (!dev->tstats) |
1991 | return -ENOMEM; | 1999 | return -ENOMEM; |
1992 | 2000 | ||
1993 | spin_lock(&vn->sock_lock); | 2001 | spin_lock(&vn->sock_lock); |
1994 | vs = vxlan_find_sock(vxlan->net, vxlan->dst_port); | 2002 | vs = vxlan_find_sock(vxlan->net, ipv6 ? AF_INET6 : AF_INET, |
2003 | vxlan->dst_port); | ||
1995 | if (vs) { | 2004 | if (vs) { |
1996 | /* If we have a socket with same port already, reuse it */ | 2005 | /* If we have a socket with same port already, reuse it */ |
1997 | atomic_inc(&vs->refcnt); | 2006 | atomic_inc(&vs->refcnt); |
@@ -2382,6 +2391,7 @@ struct vxlan_sock *vxlan_sock_add(struct net *net, __be16 port, | |||
2382 | { | 2391 | { |
2383 | struct vxlan_net *vn = net_generic(net, vxlan_net_id); | 2392 | struct vxlan_net *vn = net_generic(net, vxlan_net_id); |
2384 | struct vxlan_sock *vs; | 2393 | struct vxlan_sock *vs; |
2394 | bool ipv6 = flags & VXLAN_F_IPV6; | ||
2385 | 2395 | ||
2386 | vs = vxlan_socket_create(net, port, rcv, data, flags); | 2396 | vs = vxlan_socket_create(net, port, rcv, data, flags); |
2387 | if (!IS_ERR(vs)) | 2397 | if (!IS_ERR(vs)) |
@@ -2391,7 +2401,7 @@ struct vxlan_sock *vxlan_sock_add(struct net *net, __be16 port, | |||
2391 | return vs; | 2401 | return vs; |
2392 | 2402 | ||
2393 | spin_lock(&vn->sock_lock); | 2403 | spin_lock(&vn->sock_lock); |
2394 | vs = vxlan_find_sock(net, port); | 2404 | vs = vxlan_find_sock(net, ipv6 ? AF_INET6 : AF_INET, port); |
2395 | if (vs) { | 2405 | if (vs) { |
2396 | if (vs->rcv == rcv) | 2406 | if (vs->rcv == rcv) |
2397 | atomic_inc(&vs->refcnt); | 2407 | atomic_inc(&vs->refcnt); |
@@ -2550,7 +2560,8 @@ static int vxlan_newlink(struct net *net, struct net_device *dev, | |||
2550 | nla_get_u8(data[IFLA_VXLAN_UDP_ZERO_CSUM6_RX])) | 2560 | nla_get_u8(data[IFLA_VXLAN_UDP_ZERO_CSUM6_RX])) |
2551 | vxlan->flags |= VXLAN_F_UDP_ZERO_CSUM6_RX; | 2561 | vxlan->flags |= VXLAN_F_UDP_ZERO_CSUM6_RX; |
2552 | 2562 | ||
2553 | if (vxlan_find_vni(net, vni, vxlan->dst_port)) { | 2563 | if (vxlan_find_vni(net, vni, use_ipv6 ? AF_INET6 : AF_INET, |
2564 | vxlan->dst_port)) { | ||
2554 | pr_info("duplicate VNI %u\n", vni); | 2565 | pr_info("duplicate VNI %u\n", vni); |
2555 | return -EEXIST; | 2566 | return -EEXIST; |
2556 | } | 2567 | } |
diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h index e5ba6faf3281..86907e5ba6ca 100644 --- a/drivers/net/wireless/ath/ath.h +++ b/drivers/net/wireless/ath/ath.h | |||
@@ -80,6 +80,7 @@ struct reg_dmn_pair_mapping { | |||
80 | 80 | ||
81 | struct ath_regulatory { | 81 | struct ath_regulatory { |
82 | char alpha2[2]; | 82 | char alpha2[2]; |
83 | enum nl80211_dfs_regions region; | ||
83 | u16 country_code; | 84 | u16 country_code; |
84 | u16 max_power_level; | 85 | u16 max_power_level; |
85 | u16 current_rd; | 86 | u16 current_rd; |
diff --git a/drivers/net/wireless/ath/ath9k/common.c b/drivers/net/wireless/ath/ath9k/common.c index c6dd7f1fed65..33b0c7aef2ea 100644 --- a/drivers/net/wireless/ath/ath9k/common.c +++ b/drivers/net/wireless/ath/ath9k/common.c | |||
@@ -368,11 +368,11 @@ void ath9k_cmn_update_txpow(struct ath_hw *ah, u16 cur_txpow, | |||
368 | { | 368 | { |
369 | struct ath_regulatory *reg = ath9k_hw_regulatory(ah); | 369 | struct ath_regulatory *reg = ath9k_hw_regulatory(ah); |
370 | 370 | ||
371 | if (reg->power_limit != new_txpow) { | 371 | if (reg->power_limit != new_txpow) |
372 | ath9k_hw_set_txpowerlimit(ah, new_txpow, false); | 372 | ath9k_hw_set_txpowerlimit(ah, new_txpow, false); |
373 | /* read back in case value is clamped */ | 373 | |
374 | *txpower = reg->max_power_level; | 374 | /* read back in case value is clamped */ |
375 | } | 375 | *txpower = reg->max_power_level; |
376 | } | 376 | } |
377 | EXPORT_SYMBOL(ath9k_cmn_update_txpow); | 377 | EXPORT_SYMBOL(ath9k_cmn_update_txpow); |
378 | 378 | ||
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c index 46f20a309b5f..5c45e787814e 100644 --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c | |||
@@ -455,7 +455,7 @@ static ssize_t read_file_dma(struct file *file, char __user *user_buf, | |||
455 | "%2d %2x %1x %2x %2x\n", | 455 | "%2d %2x %1x %2x %2x\n", |
456 | i, (*qcuBase & (0x7 << qcuOffset)) >> qcuOffset, | 456 | i, (*qcuBase & (0x7 << qcuOffset)) >> qcuOffset, |
457 | (*qcuBase & (0x8 << qcuOffset)) >> (qcuOffset + 3), | 457 | (*qcuBase & (0x8 << qcuOffset)) >> (qcuOffset + 3), |
458 | val[2] & (0x7 << (i * 3)) >> (i * 3), | 458 | (val[2] & (0x7 << (i * 3))) >> (i * 3), |
459 | (*dcuBase & (0x1f << dcuOffset)) >> dcuOffset); | 459 | (*dcuBase & (0x1f << dcuOffset)) >> dcuOffset); |
460 | } | 460 | } |
461 | 461 | ||
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c index 156a944134dc..3bd030494986 100644 --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c | |||
@@ -734,6 +734,32 @@ static const struct ieee80211_iface_combination if_comb[] = { | |||
734 | #endif | 734 | #endif |
735 | }; | 735 | }; |
736 | 736 | ||
737 | #ifdef CONFIG_ATH9K_CHANNEL_CONTEXT | ||
738 | static void ath9k_set_mcc_capab(struct ath_softc *sc, struct ieee80211_hw *hw) | ||
739 | { | ||
740 | struct ath_hw *ah = sc->sc_ah; | ||
741 | struct ath_common *common = ath9k_hw_common(ah); | ||
742 | |||
743 | if (!ath9k_is_chanctx_enabled()) | ||
744 | return; | ||
745 | |||
746 | hw->flags |= IEEE80211_HW_QUEUE_CONTROL; | ||
747 | hw->queues = ATH9K_NUM_TX_QUEUES; | ||
748 | hw->offchannel_tx_hw_queue = hw->queues - 1; | ||
749 | hw->wiphy->interface_modes &= ~ BIT(NL80211_IFTYPE_WDS); | ||
750 | hw->wiphy->iface_combinations = if_comb_multi; | ||
751 | hw->wiphy->n_iface_combinations = ARRAY_SIZE(if_comb_multi); | ||
752 | hw->wiphy->max_scan_ssids = 255; | ||
753 | hw->wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN; | ||
754 | hw->wiphy->max_remain_on_channel_duration = 10000; | ||
755 | hw->chanctx_data_size = sizeof(void *); | ||
756 | hw->extra_beacon_tailroom = | ||
757 | sizeof(struct ieee80211_p2p_noa_attr) + 9; | ||
758 | |||
759 | ath_dbg(common, CHAN_CTX, "Use channel contexts\n"); | ||
760 | } | ||
761 | #endif /* CONFIG_ATH9K_CHANNEL_CONTEXT */ | ||
762 | |||
737 | static void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) | 763 | static void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) |
738 | { | 764 | { |
739 | struct ath_hw *ah = sc->sc_ah; | 765 | struct ath_hw *ah = sc->sc_ah; |
@@ -746,7 +772,6 @@ static void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) | |||
746 | IEEE80211_HW_SPECTRUM_MGMT | | 772 | IEEE80211_HW_SPECTRUM_MGMT | |
747 | IEEE80211_HW_REPORTS_TX_ACK_STATUS | | 773 | IEEE80211_HW_REPORTS_TX_ACK_STATUS | |
748 | IEEE80211_HW_SUPPORTS_RC_TABLE | | 774 | IEEE80211_HW_SUPPORTS_RC_TABLE | |
749 | IEEE80211_HW_QUEUE_CONTROL | | ||
750 | IEEE80211_HW_SUPPORTS_HT_CCK_RATES; | 775 | IEEE80211_HW_SUPPORTS_HT_CCK_RATES; |
751 | 776 | ||
752 | if (ath9k_ps_enable) | 777 | if (ath9k_ps_enable) |
@@ -781,24 +806,6 @@ static void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) | |||
781 | hw->wiphy->n_iface_combinations = ARRAY_SIZE(if_comb); | 806 | hw->wiphy->n_iface_combinations = ARRAY_SIZE(if_comb); |
782 | } | 807 | } |
783 | 808 | ||
784 | #ifdef CONFIG_ATH9K_CHANNEL_CONTEXT | ||
785 | |||
786 | if (ath9k_is_chanctx_enabled()) { | ||
787 | hw->wiphy->interface_modes &= ~ BIT(NL80211_IFTYPE_WDS); | ||
788 | hw->wiphy->iface_combinations = if_comb_multi; | ||
789 | hw->wiphy->n_iface_combinations = ARRAY_SIZE(if_comb_multi); | ||
790 | hw->wiphy->max_scan_ssids = 255; | ||
791 | hw->wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN; | ||
792 | hw->wiphy->max_remain_on_channel_duration = 10000; | ||
793 | hw->chanctx_data_size = sizeof(void *); | ||
794 | hw->extra_beacon_tailroom = | ||
795 | sizeof(struct ieee80211_p2p_noa_attr) + 9; | ||
796 | |||
797 | ath_dbg(common, CHAN_CTX, "Use channel contexts\n"); | ||
798 | } | ||
799 | |||
800 | #endif /* CONFIG_ATH9K_CHANNEL_CONTEXT */ | ||
801 | |||
802 | hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; | 809 | hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; |
803 | 810 | ||
804 | hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; | 811 | hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; |
@@ -808,12 +815,7 @@ static void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) | |||
808 | hw->wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH; | 815 | hw->wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH; |
809 | hw->wiphy->flags |= WIPHY_FLAG_AP_UAPSD; | 816 | hw->wiphy->flags |= WIPHY_FLAG_AP_UAPSD; |
810 | 817 | ||
811 | /* allow 4 queues per channel context + | 818 | hw->queues = 4; |
812 | * 1 cab queue + 1 offchannel tx queue | ||
813 | */ | ||
814 | hw->queues = ATH9K_NUM_TX_QUEUES; | ||
815 | /* last queue for offchannel */ | ||
816 | hw->offchannel_tx_hw_queue = hw->queues - 1; | ||
817 | hw->max_rates = 4; | 819 | hw->max_rates = 4; |
818 | hw->max_listen_interval = 10; | 820 | hw->max_listen_interval = 10; |
819 | hw->max_rate_tries = 10; | 821 | hw->max_rate_tries = 10; |
@@ -837,6 +839,9 @@ static void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) | |||
837 | hw->wiphy->bands[IEEE80211_BAND_5GHZ] = | 839 | hw->wiphy->bands[IEEE80211_BAND_5GHZ] = |
838 | &common->sbands[IEEE80211_BAND_5GHZ]; | 840 | &common->sbands[IEEE80211_BAND_5GHZ]; |
839 | 841 | ||
842 | #ifdef CONFIG_ATH9K_CHANNEL_CONTEXT | ||
843 | ath9k_set_mcc_capab(sc, hw); | ||
844 | #endif | ||
840 | ath9k_init_wow(hw); | 845 | ath9k_init_wow(hw); |
841 | ath9k_cmn_reload_chainmask(ah); | 846 | ath9k_cmn_reload_chainmask(ah); |
842 | 847 | ||
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 6f6a974f7fdb..30c66dfcd7a0 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -1162,6 +1162,9 @@ static void ath9k_assign_hw_queues(struct ieee80211_hw *hw, | |||
1162 | { | 1162 | { |
1163 | int i; | 1163 | int i; |
1164 | 1164 | ||
1165 | if (!ath9k_is_chanctx_enabled()) | ||
1166 | return; | ||
1167 | |||
1165 | for (i = 0; i < IEEE80211_NUM_ACS; i++) | 1168 | for (i = 0; i < IEEE80211_NUM_ACS; i++) |
1166 | vif->hw_queue[i] = i; | 1169 | vif->hw_queue[i] = i; |
1167 | 1170 | ||
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index 493a183d0aaf..d6e54a3c88f6 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c | |||
@@ -169,7 +169,10 @@ static void ath_txq_skb_done(struct ath_softc *sc, struct ath_txq *txq, | |||
169 | 169 | ||
170 | if (txq->stopped && | 170 | if (txq->stopped && |
171 | txq->pending_frames < sc->tx.txq_max_pending[q]) { | 171 | txq->pending_frames < sc->tx.txq_max_pending[q]) { |
172 | ieee80211_wake_queue(sc->hw, info->hw_queue); | 172 | if (ath9k_is_chanctx_enabled()) |
173 | ieee80211_wake_queue(sc->hw, info->hw_queue); | ||
174 | else | ||
175 | ieee80211_wake_queue(sc->hw, q); | ||
173 | txq->stopped = false; | 176 | txq->stopped = false; |
174 | } | 177 | } |
175 | } | 178 | } |
@@ -2247,7 +2250,10 @@ int ath_tx_start(struct ieee80211_hw *hw, struct sk_buff *skb, | |||
2247 | fi->txq = q; | 2250 | fi->txq = q; |
2248 | if (++txq->pending_frames > sc->tx.txq_max_pending[q] && | 2251 | if (++txq->pending_frames > sc->tx.txq_max_pending[q] && |
2249 | !txq->stopped) { | 2252 | !txq->stopped) { |
2250 | ieee80211_stop_queue(sc->hw, info->hw_queue); | 2253 | if (ath9k_is_chanctx_enabled()) |
2254 | ieee80211_stop_queue(sc->hw, info->hw_queue); | ||
2255 | else | ||
2256 | ieee80211_stop_queue(sc->hw, q); | ||
2251 | txq->stopped = true; | 2257 | txq->stopped = true; |
2252 | } | 2258 | } |
2253 | } | 2259 | } |
diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c index 415393dfb6fc..06ea6cc9e30a 100644 --- a/drivers/net/wireless/ath/regd.c +++ b/drivers/net/wireless/ath/regd.c | |||
@@ -515,6 +515,7 @@ void ath_reg_notifier_apply(struct wiphy *wiphy, | |||
515 | if (!request) | 515 | if (!request) |
516 | return; | 516 | return; |
517 | 517 | ||
518 | reg->region = request->dfs_region; | ||
518 | switch (request->initiator) { | 519 | switch (request->initiator) { |
519 | case NL80211_REGDOM_SET_BY_CORE: | 520 | case NL80211_REGDOM_SET_BY_CORE: |
520 | /* | 521 | /* |
@@ -779,6 +780,19 @@ u32 ath_regd_get_band_ctl(struct ath_regulatory *reg, | |||
779 | return SD_NO_CTL; | 780 | return SD_NO_CTL; |
780 | } | 781 | } |
781 | 782 | ||
783 | if (ath_regd_get_eepromRD(reg) == CTRY_DEFAULT) { | ||
784 | switch (reg->region) { | ||
785 | case NL80211_DFS_FCC: | ||
786 | return CTL_FCC; | ||
787 | case NL80211_DFS_ETSI: | ||
788 | return CTL_ETSI; | ||
789 | case NL80211_DFS_JP: | ||
790 | return CTL_MKK; | ||
791 | default: | ||
792 | break; | ||
793 | } | ||
794 | } | ||
795 | |||
782 | switch (band) { | 796 | switch (band) { |
783 | case IEEE80211_BAND_2GHZ: | 797 | case IEEE80211_BAND_2GHZ: |
784 | return reg->regpair->reg_2ghz_ctl; | 798 | return reg->regpair->reg_2ghz_ctl; |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c index f55f625fd06b..d20d4e6f391a 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c | |||
@@ -670,7 +670,6 @@ static int brcmf_sdio_get_fwnames(struct brcmf_chip *ci, | |||
670 | struct brcmf_sdio_dev *sdiodev) | 670 | struct brcmf_sdio_dev *sdiodev) |
671 | { | 671 | { |
672 | int i; | 672 | int i; |
673 | uint fw_len, nv_len; | ||
674 | char end; | 673 | char end; |
675 | 674 | ||
676 | for (i = 0; i < ARRAY_SIZE(brcmf_fwname_data); i++) { | 675 | for (i = 0; i < ARRAY_SIZE(brcmf_fwname_data); i++) { |
@@ -684,25 +683,25 @@ static int brcmf_sdio_get_fwnames(struct brcmf_chip *ci, | |||
684 | return -ENODEV; | 683 | return -ENODEV; |
685 | } | 684 | } |
686 | 685 | ||
687 | fw_len = sizeof(sdiodev->fw_name) - 1; | ||
688 | nv_len = sizeof(sdiodev->nvram_name) - 1; | ||
689 | /* check if firmware path is provided by module parameter */ | 686 | /* check if firmware path is provided by module parameter */ |
690 | if (brcmf_firmware_path[0] != '\0') { | 687 | if (brcmf_firmware_path[0] != '\0') { |
691 | strncpy(sdiodev->fw_name, brcmf_firmware_path, fw_len); | 688 | strlcpy(sdiodev->fw_name, brcmf_firmware_path, |
692 | strncpy(sdiodev->nvram_name, brcmf_firmware_path, nv_len); | 689 | sizeof(sdiodev->fw_name)); |
693 | fw_len -= strlen(sdiodev->fw_name); | 690 | strlcpy(sdiodev->nvram_name, brcmf_firmware_path, |
694 | nv_len -= strlen(sdiodev->nvram_name); | 691 | sizeof(sdiodev->nvram_name)); |
695 | 692 | ||
696 | end = brcmf_firmware_path[strlen(brcmf_firmware_path) - 1]; | 693 | end = brcmf_firmware_path[strlen(brcmf_firmware_path) - 1]; |
697 | if (end != '/') { | 694 | if (end != '/') { |
698 | strncat(sdiodev->fw_name, "/", fw_len); | 695 | strlcat(sdiodev->fw_name, "/", |
699 | strncat(sdiodev->nvram_name, "/", nv_len); | 696 | sizeof(sdiodev->fw_name)); |
700 | fw_len--; | 697 | strlcat(sdiodev->nvram_name, "/", |
701 | nv_len--; | 698 | sizeof(sdiodev->nvram_name)); |
702 | } | 699 | } |
703 | } | 700 | } |
704 | strncat(sdiodev->fw_name, brcmf_fwname_data[i].bin, fw_len); | 701 | strlcat(sdiodev->fw_name, brcmf_fwname_data[i].bin, |
705 | strncat(sdiodev->nvram_name, brcmf_fwname_data[i].nv, nv_len); | 702 | sizeof(sdiodev->fw_name)); |
703 | strlcat(sdiodev->nvram_name, brcmf_fwname_data[i].nv, | ||
704 | sizeof(sdiodev->nvram_name)); | ||
706 | 705 | ||
707 | return 0; | 706 | return 0; |
708 | } | 707 | } |
diff --git a/drivers/net/wireless/iwlwifi/dvm/mac80211.c b/drivers/net/wireless/iwlwifi/dvm/mac80211.c index 2364a3c09b9e..cae692ff1013 100644 --- a/drivers/net/wireless/iwlwifi/dvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/dvm/mac80211.c | |||
@@ -1095,6 +1095,7 @@ static void iwlagn_mac_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | |||
1095 | u32 queues, bool drop) | 1095 | u32 queues, bool drop) |
1096 | { | 1096 | { |
1097 | struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); | 1097 | struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); |
1098 | u32 scd_queues; | ||
1098 | 1099 | ||
1099 | mutex_lock(&priv->mutex); | 1100 | mutex_lock(&priv->mutex); |
1100 | IWL_DEBUG_MAC80211(priv, "enter\n"); | 1101 | IWL_DEBUG_MAC80211(priv, "enter\n"); |
@@ -1108,18 +1109,19 @@ static void iwlagn_mac_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | |||
1108 | goto done; | 1109 | goto done; |
1109 | } | 1110 | } |
1110 | 1111 | ||
1111 | /* | 1112 | scd_queues = BIT(priv->cfg->base_params->num_of_queues) - 1; |
1112 | * mac80211 will not push any more frames for transmit | 1113 | scd_queues &= ~(BIT(IWL_IPAN_CMD_QUEUE_NUM) | |
1113 | * until the flush is completed | 1114 | BIT(IWL_DEFAULT_CMD_QUEUE_NUM)); |
1114 | */ | 1115 | |
1115 | if (drop) { | 1116 | if (vif) |
1116 | IWL_DEBUG_MAC80211(priv, "send flush command\n"); | 1117 | scd_queues &= ~BIT(vif->hw_queue[IEEE80211_AC_VO]); |
1117 | if (iwlagn_txfifo_flush(priv, 0)) { | 1118 | |
1118 | IWL_ERR(priv, "flush request fail\n"); | 1119 | IWL_DEBUG_TX_QUEUES(priv, "Flushing SCD queues: 0x%x\n", scd_queues); |
1119 | goto done; | 1120 | if (iwlagn_txfifo_flush(priv, scd_queues)) { |
1120 | } | 1121 | IWL_ERR(priv, "flush request fail\n"); |
1122 | goto done; | ||
1121 | } | 1123 | } |
1122 | IWL_DEBUG_MAC80211(priv, "wait transmit/flush all frames\n"); | 1124 | IWL_DEBUG_TX_QUEUES(priv, "wait transmit/flush all frames\n"); |
1123 | iwl_trans_wait_tx_queue_empty(priv->trans, 0xffffffff); | 1125 | iwl_trans_wait_tx_queue_empty(priv->trans, 0xffffffff); |
1124 | done: | 1126 | done: |
1125 | mutex_unlock(&priv->mutex); | 1127 | mutex_unlock(&priv->mutex); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-8000.c b/drivers/net/wireless/iwlwifi/iwl-8000.c index e4351487ca72..d2b7234b1c73 100644 --- a/drivers/net/wireless/iwlwifi/iwl-8000.c +++ b/drivers/net/wireless/iwlwifi/iwl-8000.c | |||
@@ -82,7 +82,8 @@ | |||
82 | #define IWL8000_TX_POWER_VERSION 0xffff /* meaningless */ | 82 | #define IWL8000_TX_POWER_VERSION 0xffff /* meaningless */ |
83 | 83 | ||
84 | #define IWL8000_FW_PRE "iwlwifi-8000" | 84 | #define IWL8000_FW_PRE "iwlwifi-8000" |
85 | #define IWL8000_MODULE_FIRMWARE(api) IWL8000_FW_PRE __stringify(api) ".ucode" | 85 | #define IWL8000_MODULE_FIRMWARE(api) \ |
86 | IWL8000_FW_PRE "-" __stringify(api) ".ucode" | ||
86 | 87 | ||
87 | #define NVM_HW_SECTION_NUM_FAMILY_8000 10 | 88 | #define NVM_HW_SECTION_NUM_FAMILY_8000 10 |
88 | #define DEFAULT_NVM_FILE_FAMILY_8000 "iwl_nvm_8000.bin" | 89 | #define DEFAULT_NVM_FILE_FAMILY_8000 "iwl_nvm_8000.bin" |
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h index 9eb85249e89c..d8fc548c0d6c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-trans.h +++ b/drivers/net/wireless/iwlwifi/iwl-trans.h | |||
@@ -563,6 +563,7 @@ enum iwl_trans_state { | |||
563 | * Set during transport allocation. | 563 | * Set during transport allocation. |
564 | * @hw_id_str: a string with info about HW ID. Set during transport allocation. | 564 | * @hw_id_str: a string with info about HW ID. Set during transport allocation. |
565 | * @pm_support: set to true in start_hw if link pm is supported | 565 | * @pm_support: set to true in start_hw if link pm is supported |
566 | * @ltr_enabled: set to true if the LTR is enabled | ||
566 | * @dev_cmd_pool: pool for Tx cmd allocation - for internal use only. | 567 | * @dev_cmd_pool: pool for Tx cmd allocation - for internal use only. |
567 | * The user should use iwl_trans_{alloc,free}_tx_cmd. | 568 | * The user should use iwl_trans_{alloc,free}_tx_cmd. |
568 | * @dev_cmd_headroom: room needed for the transport's private use before the | 569 | * @dev_cmd_headroom: room needed for the transport's private use before the |
@@ -589,6 +590,7 @@ struct iwl_trans { | |||
589 | u8 rx_mpdu_cmd, rx_mpdu_cmd_hdr_size; | 590 | u8 rx_mpdu_cmd, rx_mpdu_cmd_hdr_size; |
590 | 591 | ||
591 | bool pm_support; | 592 | bool pm_support; |
593 | bool ltr_enabled; | ||
592 | 594 | ||
593 | /* The following fields are internal only */ | 595 | /* The following fields are internal only */ |
594 | struct kmem_cache *dev_cmd_pool; | 596 | struct kmem_cache *dev_cmd_pool; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/coex.c b/drivers/net/wireless/iwlwifi/mvm/coex.c index 8df2021f9856..da2ffb785194 100644 --- a/drivers/net/wireless/iwlwifi/mvm/coex.c +++ b/drivers/net/wireless/iwlwifi/mvm/coex.c | |||
@@ -303,8 +303,8 @@ static const __le64 iwl_ci_mask[][3] = { | |||
303 | }; | 303 | }; |
304 | 304 | ||
305 | static const __le32 iwl_bt_mprio_lut[BT_COEX_MULTI_PRIO_LUT_SIZE] = { | 305 | static const __le32 iwl_bt_mprio_lut[BT_COEX_MULTI_PRIO_LUT_SIZE] = { |
306 | cpu_to_le32(0x28412201), | 306 | cpu_to_le32(0x2e402280), |
307 | cpu_to_le32(0x11118451), | 307 | cpu_to_le32(0x7711a751), |
308 | }; | 308 | }; |
309 | 309 | ||
310 | struct corunning_block_luts { | 310 | struct corunning_block_luts { |
diff --git a/drivers/net/wireless/iwlwifi/mvm/coex_legacy.c b/drivers/net/wireless/iwlwifi/mvm/coex_legacy.c index 585c0ab4a3ec..8a1d2f33d5b7 100644 --- a/drivers/net/wireless/iwlwifi/mvm/coex_legacy.c +++ b/drivers/net/wireless/iwlwifi/mvm/coex_legacy.c | |||
@@ -291,8 +291,8 @@ static const __le64 iwl_ci_mask[][3] = { | |||
291 | }; | 291 | }; |
292 | 292 | ||
293 | static const __le32 iwl_bt_mprio_lut[BT_COEX_MULTI_PRIO_LUT_SIZE] = { | 293 | static const __le32 iwl_bt_mprio_lut[BT_COEX_MULTI_PRIO_LUT_SIZE] = { |
294 | cpu_to_le32(0x28412201), | 294 | cpu_to_le32(0x2e402280), |
295 | cpu_to_le32(0x11118451), | 295 | cpu_to_le32(0x7711a751), |
296 | }; | 296 | }; |
297 | 297 | ||
298 | struct corunning_block_luts { | 298 | struct corunning_block_luts { |
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api-power.h b/drivers/net/wireless/iwlwifi/mvm/fw-api-power.h index 27dd86395b39..2fd8ad4633e0 100644 --- a/drivers/net/wireless/iwlwifi/mvm/fw-api-power.h +++ b/drivers/net/wireless/iwlwifi/mvm/fw-api-power.h | |||
@@ -68,13 +68,46 @@ | |||
68 | 68 | ||
69 | /* Power Management Commands, Responses, Notifications */ | 69 | /* Power Management Commands, Responses, Notifications */ |
70 | 70 | ||
71 | /** | ||
72 | * enum iwl_ltr_config_flags - masks for LTR config command flags | ||
73 | * @LTR_CFG_FLAG_FEATURE_ENABLE: Feature operational status | ||
74 | * @LTR_CFG_FLAG_HW_DIS_ON_SHADOW_REG_ACCESS: allow LTR change on shadow | ||
75 | * memory access | ||
76 | * @LTR_CFG_FLAG_HW_EN_SHRT_WR_THROUGH: allow LTR msg send on ANY LTR | ||
77 | * reg change | ||
78 | * @LTR_CFG_FLAG_HW_DIS_ON_D0_2_D3: allow LTR msg send on transition from | ||
79 | * D0 to D3 | ||
80 | * @LTR_CFG_FLAG_SW_SET_SHORT: fixed static short LTR register | ||
81 | * @LTR_CFG_FLAG_SW_SET_LONG: fixed static short LONG register | ||
82 | * @LTR_CFG_FLAG_DENIE_C10_ON_PD: allow going into C10 on PD | ||
83 | */ | ||
84 | enum iwl_ltr_config_flags { | ||
85 | LTR_CFG_FLAG_FEATURE_ENABLE = BIT(0), | ||
86 | LTR_CFG_FLAG_HW_DIS_ON_SHADOW_REG_ACCESS = BIT(1), | ||
87 | LTR_CFG_FLAG_HW_EN_SHRT_WR_THROUGH = BIT(2), | ||
88 | LTR_CFG_FLAG_HW_DIS_ON_D0_2_D3 = BIT(3), | ||
89 | LTR_CFG_FLAG_SW_SET_SHORT = BIT(4), | ||
90 | LTR_CFG_FLAG_SW_SET_LONG = BIT(5), | ||
91 | LTR_CFG_FLAG_DENIE_C10_ON_PD = BIT(6), | ||
92 | }; | ||
93 | |||
94 | /** | ||
95 | * struct iwl_ltr_config_cmd - configures the LTR | ||
96 | * @flags: See %enum iwl_ltr_config_flags | ||
97 | */ | ||
98 | struct iwl_ltr_config_cmd { | ||
99 | __le32 flags; | ||
100 | __le32 static_long; | ||
101 | __le32 static_short; | ||
102 | } __packed; | ||
103 | |||
71 | /* Radio LP RX Energy Threshold measured in dBm */ | 104 | /* Radio LP RX Energy Threshold measured in dBm */ |
72 | #define POWER_LPRX_RSSI_THRESHOLD 75 | 105 | #define POWER_LPRX_RSSI_THRESHOLD 75 |
73 | #define POWER_LPRX_RSSI_THRESHOLD_MAX 94 | 106 | #define POWER_LPRX_RSSI_THRESHOLD_MAX 94 |
74 | #define POWER_LPRX_RSSI_THRESHOLD_MIN 30 | 107 | #define POWER_LPRX_RSSI_THRESHOLD_MIN 30 |
75 | 108 | ||
76 | /** | 109 | /** |
77 | * enum iwl_scan_flags - masks for power table command flags | 110 | * enum iwl_power_flags - masks for power table command flags |
78 | * @POWER_FLAGS_POWER_SAVE_ENA_MSK: '1' Allow to save power by turning off | 111 | * @POWER_FLAGS_POWER_SAVE_ENA_MSK: '1' Allow to save power by turning off |
79 | * receiver and transmitter. '0' - does not allow. | 112 | * receiver and transmitter. '0' - does not allow. |
80 | * @POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK: '0' Driver disables power management, | 113 | * @POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK: '0' Driver disables power management, |
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw-api.h b/drivers/net/wireless/iwlwifi/mvm/fw-api.h index 667a92274c87..c62575d86bcd 100644 --- a/drivers/net/wireless/iwlwifi/mvm/fw-api.h +++ b/drivers/net/wireless/iwlwifi/mvm/fw-api.h | |||
@@ -157,6 +157,7 @@ enum { | |||
157 | /* Power - legacy power table command */ | 157 | /* Power - legacy power table command */ |
158 | POWER_TABLE_CMD = 0x77, | 158 | POWER_TABLE_CMD = 0x77, |
159 | PSM_UAPSD_AP_MISBEHAVING_NOTIFICATION = 0x78, | 159 | PSM_UAPSD_AP_MISBEHAVING_NOTIFICATION = 0x78, |
160 | LTR_CONFIG = 0xee, | ||
160 | 161 | ||
161 | /* Thermal Throttling*/ | 162 | /* Thermal Throttling*/ |
162 | REPLY_THERMAL_MNG_BACKOFF = 0x7e, | 163 | REPLY_THERMAL_MNG_BACKOFF = 0x7e, |
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw.c b/drivers/net/wireless/iwlwifi/mvm/fw.c index 23fd711a67e4..eb03943f8463 100644 --- a/drivers/net/wireless/iwlwifi/mvm/fw.c +++ b/drivers/net/wireless/iwlwifi/mvm/fw.c | |||
@@ -284,7 +284,7 @@ int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm) | |||
284 | 284 | ||
285 | lockdep_assert_held(&mvm->mutex); | 285 | lockdep_assert_held(&mvm->mutex); |
286 | 286 | ||
287 | if (WARN_ON_ONCE(mvm->init_ucode_complete)) | 287 | if (WARN_ON_ONCE(mvm->init_ucode_complete || mvm->calibrating)) |
288 | return 0; | 288 | return 0; |
289 | 289 | ||
290 | iwl_init_notification_wait(&mvm->notif_wait, | 290 | iwl_init_notification_wait(&mvm->notif_wait, |
@@ -334,6 +334,8 @@ int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm) | |||
334 | goto out; | 334 | goto out; |
335 | } | 335 | } |
336 | 336 | ||
337 | mvm->calibrating = true; | ||
338 | |||
337 | /* Send TX valid antennas before triggering calibrations */ | 339 | /* Send TX valid antennas before triggering calibrations */ |
338 | ret = iwl_send_tx_ant_cfg(mvm, mvm->fw->valid_tx_ant); | 340 | ret = iwl_send_tx_ant_cfg(mvm, mvm->fw->valid_tx_ant); |
339 | if (ret) | 341 | if (ret) |
@@ -358,11 +360,17 @@ int iwl_run_init_mvm_ucode(struct iwl_mvm *mvm, bool read_nvm) | |||
358 | MVM_UCODE_CALIB_TIMEOUT); | 360 | MVM_UCODE_CALIB_TIMEOUT); |
359 | if (!ret) | 361 | if (!ret) |
360 | mvm->init_ucode_complete = true; | 362 | mvm->init_ucode_complete = true; |
363 | |||
364 | if (ret && iwl_mvm_is_radio_killed(mvm)) { | ||
365 | IWL_DEBUG_RF_KILL(mvm, "RFKILL while calibrating.\n"); | ||
366 | ret = 1; | ||
367 | } | ||
361 | goto out; | 368 | goto out; |
362 | 369 | ||
363 | error: | 370 | error: |
364 | iwl_remove_notification(&mvm->notif_wait, &calib_wait); | 371 | iwl_remove_notification(&mvm->notif_wait, &calib_wait); |
365 | out: | 372 | out: |
373 | mvm->calibrating = false; | ||
366 | if (iwlmvm_mod_params.init_dbg && !mvm->nvm_data) { | 374 | if (iwlmvm_mod_params.init_dbg && !mvm->nvm_data) { |
367 | /* we want to debug INIT and we have no NVM - fake */ | 375 | /* we want to debug INIT and we have no NVM - fake */ |
368 | mvm->nvm_data = kzalloc(sizeof(struct iwl_nvm_data) + | 376 | mvm->nvm_data = kzalloc(sizeof(struct iwl_nvm_data) + |
@@ -480,6 +488,15 @@ int iwl_mvm_up(struct iwl_mvm *mvm) | |||
480 | /* Initialize tx backoffs to the minimal possible */ | 488 | /* Initialize tx backoffs to the minimal possible */ |
481 | iwl_mvm_tt_tx_backoff(mvm, 0); | 489 | iwl_mvm_tt_tx_backoff(mvm, 0); |
482 | 490 | ||
491 | if (mvm->trans->ltr_enabled) { | ||
492 | struct iwl_ltr_config_cmd cmd = { | ||
493 | .flags = cpu_to_le32(LTR_CFG_FLAG_FEATURE_ENABLE), | ||
494 | }; | ||
495 | |||
496 | WARN_ON(iwl_mvm_send_cmd_pdu(mvm, LTR_CONFIG, 0, | ||
497 | sizeof(cmd), &cmd)); | ||
498 | } | ||
499 | |||
483 | ret = iwl_mvm_power_update_device(mvm); | 500 | ret = iwl_mvm_power_update_device(mvm); |
484 | if (ret) | 501 | if (ret) |
485 | goto error; | 502 | goto error; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c index c7a73c68bdab..b62405865b25 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c | |||
@@ -526,7 +526,8 @@ static void iwl_mvm_mac_tx(struct ieee80211_hw *hw, | |||
526 | } | 526 | } |
527 | 527 | ||
528 | if (IEEE80211_SKB_CB(skb)->hw_queue == IWL_MVM_OFFCHANNEL_QUEUE && | 528 | if (IEEE80211_SKB_CB(skb)->hw_queue == IWL_MVM_OFFCHANNEL_QUEUE && |
529 | !test_bit(IWL_MVM_STATUS_ROC_RUNNING, &mvm->status)) | 529 | !test_bit(IWL_MVM_STATUS_ROC_RUNNING, &mvm->status) && |
530 | !test_bit(IWL_MVM_STATUS_ROC_AUX_RUNNING, &mvm->status)) | ||
530 | goto drop; | 531 | goto drop; |
531 | 532 | ||
532 | /* treat non-bufferable MMPDUs as broadcast if sta is sleeping */ | 533 | /* treat non-bufferable MMPDUs as broadcast if sta is sleeping */ |
@@ -787,6 +788,7 @@ static void iwl_mvm_restart_cleanup(struct iwl_mvm *mvm) | |||
787 | 788 | ||
788 | mvm->scan_status = IWL_MVM_SCAN_NONE; | 789 | mvm->scan_status = IWL_MVM_SCAN_NONE; |
789 | mvm->ps_disabled = false; | 790 | mvm->ps_disabled = false; |
791 | mvm->calibrating = false; | ||
790 | 792 | ||
791 | /* just in case one was running */ | 793 | /* just in case one was running */ |
792 | ieee80211_remain_on_channel_expired(mvm->hw); | 794 | ieee80211_remain_on_channel_expired(mvm->hw); |
@@ -1734,6 +1736,13 @@ iwl_mvm_bss_info_changed_ap_ibss(struct iwl_mvm *mvm, | |||
1734 | if (changes & BSS_CHANGED_BEACON && | 1736 | if (changes & BSS_CHANGED_BEACON && |
1735 | iwl_mvm_mac_ctxt_beacon_changed(mvm, vif)) | 1737 | iwl_mvm_mac_ctxt_beacon_changed(mvm, vif)) |
1736 | IWL_WARN(mvm, "Failed updating beacon data\n"); | 1738 | IWL_WARN(mvm, "Failed updating beacon data\n"); |
1739 | |||
1740 | if (changes & BSS_CHANGED_TXPOWER) { | ||
1741 | IWL_DEBUG_CALIB(mvm, "Changing TX Power to %d\n", | ||
1742 | bss_conf->txpower); | ||
1743 | iwl_mvm_set_tx_power(mvm, vif, bss_conf->txpower); | ||
1744 | } | ||
1745 | |||
1737 | } | 1746 | } |
1738 | 1747 | ||
1739 | static void iwl_mvm_bss_info_changed(struct ieee80211_hw *hw, | 1748 | static void iwl_mvm_bss_info_changed(struct ieee80211_hw *hw, |
@@ -2367,14 +2376,19 @@ static int iwl_mvm_send_aux_roc_cmd(struct iwl_mvm *mvm, | |||
2367 | /* Set the node address */ | 2376 | /* Set the node address */ |
2368 | memcpy(aux_roc_req.node_addr, vif->addr, ETH_ALEN); | 2377 | memcpy(aux_roc_req.node_addr, vif->addr, ETH_ALEN); |
2369 | 2378 | ||
2379 | lockdep_assert_held(&mvm->mutex); | ||
2380 | |||
2381 | spin_lock_bh(&mvm->time_event_lock); | ||
2382 | |||
2383 | if (WARN_ON(te_data->id == HOT_SPOT_CMD)) { | ||
2384 | spin_unlock_bh(&mvm->time_event_lock); | ||
2385 | return -EIO; | ||
2386 | } | ||
2387 | |||
2370 | te_data->vif = vif; | 2388 | te_data->vif = vif; |
2371 | te_data->duration = duration; | 2389 | te_data->duration = duration; |
2372 | te_data->id = HOT_SPOT_CMD; | 2390 | te_data->id = HOT_SPOT_CMD; |
2373 | 2391 | ||
2374 | lockdep_assert_held(&mvm->mutex); | ||
2375 | |||
2376 | spin_lock_bh(&mvm->time_event_lock); | ||
2377 | list_add_tail(&te_data->list, &mvm->time_event_list); | ||
2378 | spin_unlock_bh(&mvm->time_event_lock); | 2392 | spin_unlock_bh(&mvm->time_event_lock); |
2379 | 2393 | ||
2380 | /* | 2394 | /* |
@@ -2430,22 +2444,23 @@ static int iwl_mvm_roc(struct ieee80211_hw *hw, | |||
2430 | IWL_DEBUG_MAC80211(mvm, "enter (%d, %d, %d)\n", channel->hw_value, | 2444 | IWL_DEBUG_MAC80211(mvm, "enter (%d, %d, %d)\n", channel->hw_value, |
2431 | duration, type); | 2445 | duration, type); |
2432 | 2446 | ||
2447 | mutex_lock(&mvm->mutex); | ||
2448 | |||
2433 | switch (vif->type) { | 2449 | switch (vif->type) { |
2434 | case NL80211_IFTYPE_STATION: | 2450 | case NL80211_IFTYPE_STATION: |
2435 | /* Use aux roc framework (HS20) */ | 2451 | /* Use aux roc framework (HS20) */ |
2436 | ret = iwl_mvm_send_aux_roc_cmd(mvm, channel, | 2452 | ret = iwl_mvm_send_aux_roc_cmd(mvm, channel, |
2437 | vif, duration); | 2453 | vif, duration); |
2438 | return ret; | 2454 | goto out_unlock; |
2439 | case NL80211_IFTYPE_P2P_DEVICE: | 2455 | case NL80211_IFTYPE_P2P_DEVICE: |
2440 | /* handle below */ | 2456 | /* handle below */ |
2441 | break; | 2457 | break; |
2442 | default: | 2458 | default: |
2443 | IWL_ERR(mvm, "vif isn't P2P_DEVICE: %d\n", vif->type); | 2459 | IWL_ERR(mvm, "vif isn't P2P_DEVICE: %d\n", vif->type); |
2444 | return -EINVAL; | 2460 | ret = -EINVAL; |
2461 | goto out_unlock; | ||
2445 | } | 2462 | } |
2446 | 2463 | ||
2447 | mutex_lock(&mvm->mutex); | ||
2448 | |||
2449 | for (i = 0; i < NUM_PHY_CTX; i++) { | 2464 | for (i = 0; i < NUM_PHY_CTX; i++) { |
2450 | phy_ctxt = &mvm->phy_ctxts[i]; | 2465 | phy_ctxt = &mvm->phy_ctxts[i]; |
2451 | if (phy_ctxt->ref == 0 || mvmvif->phy_ctxt == phy_ctxt) | 2466 | if (phy_ctxt->ref == 0 || mvmvif->phy_ctxt == phy_ctxt) |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h b/drivers/net/wireless/iwlwifi/mvm/mvm.h index b153ced7015b..845429c88cf4 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h | |||
@@ -548,6 +548,7 @@ struct iwl_mvm { | |||
548 | enum iwl_ucode_type cur_ucode; | 548 | enum iwl_ucode_type cur_ucode; |
549 | bool ucode_loaded; | 549 | bool ucode_loaded; |
550 | bool init_ucode_complete; | 550 | bool init_ucode_complete; |
551 | bool calibrating; | ||
551 | u32 error_event_table; | 552 | u32 error_event_table; |
552 | u32 log_event_table; | 553 | u32 log_event_table; |
553 | u32 umac_error_event_table; | 554 | u32 umac_error_event_table; |
diff --git a/drivers/net/wireless/iwlwifi/mvm/ops.c b/drivers/net/wireless/iwlwifi/mvm/ops.c index 15aa298ee79c..5b719ee8e789 100644 --- a/drivers/net/wireless/iwlwifi/mvm/ops.c +++ b/drivers/net/wireless/iwlwifi/mvm/ops.c | |||
@@ -336,6 +336,7 @@ static const char *const iwl_mvm_cmd_strings[REPLY_MAX] = { | |||
336 | CMD(DTS_MEASUREMENT_NOTIFICATION), | 336 | CMD(DTS_MEASUREMENT_NOTIFICATION), |
337 | CMD(REPLY_THERMAL_MNG_BACKOFF), | 337 | CMD(REPLY_THERMAL_MNG_BACKOFF), |
338 | CMD(MAC_PM_POWER_TABLE), | 338 | CMD(MAC_PM_POWER_TABLE), |
339 | CMD(LTR_CONFIG), | ||
339 | CMD(BT_COEX_CI), | 340 | CMD(BT_COEX_CI), |
340 | CMD(BT_COEX_UPDATE_SW_BOOST), | 341 | CMD(BT_COEX_UPDATE_SW_BOOST), |
341 | CMD(BT_COEX_UPDATE_CORUN_LUT), | 342 | CMD(BT_COEX_UPDATE_CORUN_LUT), |
@@ -423,6 +424,7 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg, | |||
423 | } | 424 | } |
424 | mvm->sf_state = SF_UNINIT; | 425 | mvm->sf_state = SF_UNINIT; |
425 | mvm->low_latency_agg_frame_limit = 6; | 426 | mvm->low_latency_agg_frame_limit = 6; |
427 | mvm->cur_ucode = IWL_UCODE_INIT; | ||
426 | 428 | ||
427 | mutex_init(&mvm->mutex); | 429 | mutex_init(&mvm->mutex); |
428 | mutex_init(&mvm->d0i3_suspend_mutex); | 430 | mutex_init(&mvm->d0i3_suspend_mutex); |
@@ -751,6 +753,7 @@ void iwl_mvm_set_hw_ctkill_state(struct iwl_mvm *mvm, bool state) | |||
751 | static bool iwl_mvm_set_hw_rfkill_state(struct iwl_op_mode *op_mode, bool state) | 753 | static bool iwl_mvm_set_hw_rfkill_state(struct iwl_op_mode *op_mode, bool state) |
752 | { | 754 | { |
753 | struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); | 755 | struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); |
756 | bool calibrating = ACCESS_ONCE(mvm->calibrating); | ||
754 | 757 | ||
755 | if (state) | 758 | if (state) |
756 | set_bit(IWL_MVM_STATUS_HW_RFKILL, &mvm->status); | 759 | set_bit(IWL_MVM_STATUS_HW_RFKILL, &mvm->status); |
@@ -759,7 +762,15 @@ static bool iwl_mvm_set_hw_rfkill_state(struct iwl_op_mode *op_mode, bool state) | |||
759 | 762 | ||
760 | wiphy_rfkill_set_hw_state(mvm->hw->wiphy, iwl_mvm_is_radio_killed(mvm)); | 763 | wiphy_rfkill_set_hw_state(mvm->hw->wiphy, iwl_mvm_is_radio_killed(mvm)); |
761 | 764 | ||
762 | return state && mvm->cur_ucode != IWL_UCODE_INIT; | 765 | /* iwl_run_init_mvm_ucode is waiting for results, abort it */ |
766 | if (calibrating) | ||
767 | iwl_abort_notification_waits(&mvm->notif_wait); | ||
768 | |||
769 | /* | ||
770 | * Stop the device if we run OPERATIONAL firmware or if we are in the | ||
771 | * middle of the calibrations. | ||
772 | */ | ||
773 | return state && (mvm->cur_ucode != IWL_UCODE_INIT || calibrating); | ||
763 | } | 774 | } |
764 | 775 | ||
765 | static void iwl_mvm_free_skb(struct iwl_op_mode *op_mode, struct sk_buff *skb) | 776 | static void iwl_mvm_free_skb(struct iwl_op_mode *op_mode, struct sk_buff *skb) |
diff --git a/drivers/net/wireless/iwlwifi/mvm/scan.c b/drivers/net/wireless/iwlwifi/mvm/scan.c index cb85e63c20aa..b280d5d87127 100644 --- a/drivers/net/wireless/iwlwifi/mvm/scan.c +++ b/drivers/net/wireless/iwlwifi/mvm/scan.c | |||
@@ -459,7 +459,8 @@ int iwl_mvm_scan_request(struct iwl_mvm *mvm, | |||
459 | basic_ssid ? 1 : 0); | 459 | basic_ssid ? 1 : 0); |
460 | 460 | ||
461 | cmd->tx_cmd.tx_flags = cpu_to_le32(TX_CMD_FLG_SEQ_CTL | | 461 | cmd->tx_cmd.tx_flags = cpu_to_le32(TX_CMD_FLG_SEQ_CTL | |
462 | TX_CMD_FLG_BT_DIS); | 462 | 3 << TX_CMD_FLG_BT_PRIO_POS); |
463 | |||
463 | cmd->tx_cmd.sta_id = mvm->aux_sta.sta_id; | 464 | cmd->tx_cmd.sta_id = mvm->aux_sta.sta_id; |
464 | cmd->tx_cmd.life_time = cpu_to_le32(TX_CMD_LIFE_TIME_INFINITE); | 465 | cmd->tx_cmd.life_time = cpu_to_le32(TX_CMD_LIFE_TIME_INFINITE); |
465 | cmd->tx_cmd.rate_n_flags = | 466 | cmd->tx_cmd.rate_n_flags = |
diff --git a/drivers/net/wireless/iwlwifi/mvm/time-event.c b/drivers/net/wireless/iwlwifi/mvm/time-event.c index b7f9e61d14e2..6dfad230be5e 100644 --- a/drivers/net/wireless/iwlwifi/mvm/time-event.c +++ b/drivers/net/wireless/iwlwifi/mvm/time-event.c | |||
@@ -305,8 +305,8 @@ static int iwl_mvm_aux_roc_te_handle_notif(struct iwl_mvm *mvm, | |||
305 | te_data->running = false; | 305 | te_data->running = false; |
306 | te_data->vif = NULL; | 306 | te_data->vif = NULL; |
307 | te_data->uid = 0; | 307 | te_data->uid = 0; |
308 | te_data->id = TE_MAX; | ||
308 | } else if (le32_to_cpu(notif->action) == TE_V2_NOTIF_HOST_EVENT_START) { | 309 | } else if (le32_to_cpu(notif->action) == TE_V2_NOTIF_HOST_EVENT_START) { |
309 | set_bit(IWL_MVM_STATUS_ROC_RUNNING, &mvm->status); | ||
310 | set_bit(IWL_MVM_STATUS_ROC_AUX_RUNNING, &mvm->status); | 310 | set_bit(IWL_MVM_STATUS_ROC_AUX_RUNNING, &mvm->status); |
311 | te_data->running = true; | 311 | te_data->running = true; |
312 | ieee80211_ready_on_channel(mvm->hw); /* Start TE */ | 312 | ieee80211_ready_on_channel(mvm->hw); /* Start TE */ |
diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c b/drivers/net/wireless/iwlwifi/mvm/tx.c index 1cb793a498ac..c6a517c771df 100644 --- a/drivers/net/wireless/iwlwifi/mvm/tx.c +++ b/drivers/net/wireless/iwlwifi/mvm/tx.c | |||
@@ -175,14 +175,10 @@ static void iwl_mvm_set_tx_cmd_rate(struct iwl_mvm *mvm, | |||
175 | 175 | ||
176 | /* | 176 | /* |
177 | * for data packets, rate info comes from the table inside the fw. This | 177 | * for data packets, rate info comes from the table inside the fw. This |
178 | * table is controlled by LINK_QUALITY commands. Exclude ctrl port | 178 | * table is controlled by LINK_QUALITY commands |
179 | * frames like EAPOLs which should be treated as mgmt frames. This | ||
180 | * avoids them being sent initially in high rates which increases the | ||
181 | * chances for completion of the 4-Way handshake. | ||
182 | */ | 179 | */ |
183 | 180 | ||
184 | if (ieee80211_is_data(fc) && sta && | 181 | if (ieee80211_is_data(fc) && sta) { |
185 | !(info->control.flags & IEEE80211_TX_CTRL_PORT_CTRL_PROTO)) { | ||
186 | tx_cmd->initial_rate_index = 0; | 182 | tx_cmd->initial_rate_index = 0; |
187 | tx_cmd->tx_flags |= cpu_to_le32(TX_CMD_FLG_STA_RATE); | 183 | tx_cmd->tx_flags |= cpu_to_le32(TX_CMD_FLG_STA_RATE); |
188 | return; | 184 | return; |
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c index 1393bac0025c..160c3ebc48d0 100644 --- a/drivers/net/wireless/iwlwifi/pcie/trans.c +++ b/drivers/net/wireless/iwlwifi/pcie/trans.c | |||
@@ -174,6 +174,7 @@ static void iwl_pcie_apm_config(struct iwl_trans *trans) | |||
174 | { | 174 | { |
175 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); | 175 | struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); |
176 | u16 lctl; | 176 | u16 lctl; |
177 | u16 cap; | ||
177 | 178 | ||
178 | /* | 179 | /* |
179 | * HW bug W/A for instability in PCIe bus L0S->L1 transition. | 180 | * HW bug W/A for instability in PCIe bus L0S->L1 transition. |
@@ -184,16 +185,17 @@ static void iwl_pcie_apm_config(struct iwl_trans *trans) | |||
184 | * power savings, even without L1. | 185 | * power savings, even without L1. |
185 | */ | 186 | */ |
186 | pcie_capability_read_word(trans_pcie->pci_dev, PCI_EXP_LNKCTL, &lctl); | 187 | pcie_capability_read_word(trans_pcie->pci_dev, PCI_EXP_LNKCTL, &lctl); |
187 | if (lctl & PCI_EXP_LNKCTL_ASPM_L1) { | 188 | if (lctl & PCI_EXP_LNKCTL_ASPM_L1) |
188 | /* L1-ASPM enabled; disable(!) L0S */ | ||
189 | iwl_set_bit(trans, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED); | 189 | iwl_set_bit(trans, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED); |
190 | dev_info(trans->dev, "L1 Enabled; Disabling L0S\n"); | 190 | else |
191 | } else { | ||
192 | /* L1-ASPM disabled; enable(!) L0S */ | ||
193 | iwl_clear_bit(trans, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED); | 191 | iwl_clear_bit(trans, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED); |
194 | dev_info(trans->dev, "L1 Disabled; Enabling L0S\n"); | ||
195 | } | ||
196 | trans->pm_support = !(lctl & PCI_EXP_LNKCTL_ASPM_L0S); | 192 | trans->pm_support = !(lctl & PCI_EXP_LNKCTL_ASPM_L0S); |
193 | |||
194 | pcie_capability_read_word(trans_pcie->pci_dev, PCI_EXP_DEVCTL2, &cap); | ||
195 | trans->ltr_enabled = cap & PCI_EXP_DEVCTL2_LTR_EN; | ||
196 | dev_info(trans->dev, "L1 %sabled - LTR %sabled\n", | ||
197 | (lctl & PCI_EXP_LNKCTL_ASPM_L1) ? "En" : "Dis", | ||
198 | trans->ltr_enabled ? "En" : "Dis"); | ||
197 | } | 199 | } |
198 | 200 | ||
199 | /* | 201 | /* |
@@ -428,7 +430,7 @@ static int iwl_pcie_apm_stop_master(struct iwl_trans *trans) | |||
428 | ret = iwl_poll_bit(trans, CSR_RESET, | 430 | ret = iwl_poll_bit(trans, CSR_RESET, |
429 | CSR_RESET_REG_FLAG_MASTER_DISABLED, | 431 | CSR_RESET_REG_FLAG_MASTER_DISABLED, |
430 | CSR_RESET_REG_FLAG_MASTER_DISABLED, 100); | 432 | CSR_RESET_REG_FLAG_MASTER_DISABLED, 100); |
431 | if (ret) | 433 | if (ret < 0) |
432 | IWL_WARN(trans, "Master Disable Timed Out, 100 usec\n"); | 434 | IWL_WARN(trans, "Master Disable Timed Out, 100 usec\n"); |
433 | 435 | ||
434 | IWL_DEBUG_INFO(trans, "stop master\n"); | 436 | IWL_DEBUG_INFO(trans, "stop master\n"); |
@@ -544,7 +546,7 @@ static int iwl_pcie_prepare_card_hw(struct iwl_trans *trans) | |||
544 | msleep(25); | 546 | msleep(25); |
545 | } | 547 | } |
546 | 548 | ||
547 | IWL_DEBUG_INFO(trans, "got NIC after %d iterations\n", iter); | 549 | IWL_ERR(trans, "Couldn't prepare the card\n"); |
548 | 550 | ||
549 | return ret; | 551 | return ret; |
550 | } | 552 | } |
@@ -913,7 +915,8 @@ static void iwl_trans_pcie_stop_device(struct iwl_trans *trans) | |||
913 | * restart. So don't process again if the device is | 915 | * restart. So don't process again if the device is |
914 | * already dead. | 916 | * already dead. |
915 | */ | 917 | */ |
916 | if (test_bit(STATUS_DEVICE_ENABLED, &trans->status)) { | 918 | if (test_and_clear_bit(STATUS_DEVICE_ENABLED, &trans->status)) { |
919 | IWL_DEBUG_INFO(trans, "DEVICE_ENABLED bit was set and is now cleared\n"); | ||
917 | iwl_pcie_tx_stop(trans); | 920 | iwl_pcie_tx_stop(trans); |
918 | iwl_pcie_rx_stop(trans); | 921 | iwl_pcie_rx_stop(trans); |
919 | 922 | ||
@@ -943,7 +946,6 @@ static void iwl_trans_pcie_stop_device(struct iwl_trans *trans) | |||
943 | /* clear all status bits */ | 946 | /* clear all status bits */ |
944 | clear_bit(STATUS_SYNC_HCMD_ACTIVE, &trans->status); | 947 | clear_bit(STATUS_SYNC_HCMD_ACTIVE, &trans->status); |
945 | clear_bit(STATUS_INT_ENABLED, &trans->status); | 948 | clear_bit(STATUS_INT_ENABLED, &trans->status); |
946 | clear_bit(STATUS_DEVICE_ENABLED, &trans->status); | ||
947 | clear_bit(STATUS_TPOWER_PMI, &trans->status); | 949 | clear_bit(STATUS_TPOWER_PMI, &trans->status); |
948 | clear_bit(STATUS_RFKILL, &trans->status); | 950 | clear_bit(STATUS_RFKILL, &trans->status); |
949 | 951 | ||
@@ -1043,7 +1045,7 @@ static int iwl_trans_pcie_d3_resume(struct iwl_trans *trans, | |||
1043 | CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, | 1045 | CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, |
1044 | CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, | 1046 | CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, |
1045 | 25000); | 1047 | 25000); |
1046 | if (ret) { | 1048 | if (ret < 0) { |
1047 | IWL_ERR(trans, "Failed to resume the device (mac ready)\n"); | 1049 | IWL_ERR(trans, "Failed to resume the device (mac ready)\n"); |
1048 | return ret; | 1050 | return ret; |
1049 | } | 1051 | } |
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index babbdc1ce741..c9ad4cf1adfb 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c | |||
@@ -1987,7 +1987,7 @@ static int mac80211_hwsim_create_radio(int channels, const char *reg_alpha2, | |||
1987 | if (err != 0) { | 1987 | if (err != 0) { |
1988 | printk(KERN_DEBUG "mac80211_hwsim: device_bind_driver failed (%d)\n", | 1988 | printk(KERN_DEBUG "mac80211_hwsim: device_bind_driver failed (%d)\n", |
1989 | err); | 1989 | err); |
1990 | goto failed_hw; | 1990 | goto failed_bind; |
1991 | } | 1991 | } |
1992 | 1992 | ||
1993 | skb_queue_head_init(&data->pending); | 1993 | skb_queue_head_init(&data->pending); |
@@ -2183,6 +2183,8 @@ static int mac80211_hwsim_create_radio(int channels, const char *reg_alpha2, | |||
2183 | return idx; | 2183 | return idx; |
2184 | 2184 | ||
2185 | failed_hw: | 2185 | failed_hw: |
2186 | device_release_driver(data->dev); | ||
2187 | failed_bind: | ||
2186 | device_unregister(data->dev); | 2188 | device_unregister(data->dev); |
2187 | failed_drvdata: | 2189 | failed_drvdata: |
2188 | ieee80211_free_hw(hw); | 2190 | ieee80211_free_hw(hw); |
diff --git a/drivers/net/wireless/mwifiex/11n_rxreorder.c b/drivers/net/wireless/mwifiex/11n_rxreorder.c index 40057079ffb9..5ef5a0eeba50 100644 --- a/drivers/net/wireless/mwifiex/11n_rxreorder.c +++ b/drivers/net/wireless/mwifiex/11n_rxreorder.c | |||
@@ -196,6 +196,7 @@ mwifiex_del_rx_reorder_entry(struct mwifiex_private *priv, | |||
196 | mwifiex_11n_dispatch_pkt_until_start_win(priv, tbl, start_win); | 196 | mwifiex_11n_dispatch_pkt_until_start_win(priv, tbl, start_win); |
197 | 197 | ||
198 | del_timer_sync(&tbl->timer_context.timer); | 198 | del_timer_sync(&tbl->timer_context.timer); |
199 | tbl->timer_context.timer_is_set = false; | ||
199 | 200 | ||
200 | spin_lock_irqsave(&priv->rx_reorder_tbl_lock, flags); | 201 | spin_lock_irqsave(&priv->rx_reorder_tbl_lock, flags); |
201 | list_del(&tbl->list); | 202 | list_del(&tbl->list); |
@@ -297,6 +298,7 @@ mwifiex_flush_data(unsigned long context) | |||
297 | (struct reorder_tmr_cnxt *) context; | 298 | (struct reorder_tmr_cnxt *) context; |
298 | int start_win, seq_num; | 299 | int start_win, seq_num; |
299 | 300 | ||
301 | ctx->timer_is_set = false; | ||
300 | seq_num = mwifiex_11n_find_last_seq_num(ctx); | 302 | seq_num = mwifiex_11n_find_last_seq_num(ctx); |
301 | 303 | ||
302 | if (seq_num < 0) | 304 | if (seq_num < 0) |
@@ -385,6 +387,7 @@ mwifiex_11n_create_rx_reorder_tbl(struct mwifiex_private *priv, u8 *ta, | |||
385 | 387 | ||
386 | new_node->timer_context.ptr = new_node; | 388 | new_node->timer_context.ptr = new_node; |
387 | new_node->timer_context.priv = priv; | 389 | new_node->timer_context.priv = priv; |
390 | new_node->timer_context.timer_is_set = false; | ||
388 | 391 | ||
389 | init_timer(&new_node->timer_context.timer); | 392 | init_timer(&new_node->timer_context.timer); |
390 | new_node->timer_context.timer.function = mwifiex_flush_data; | 393 | new_node->timer_context.timer.function = mwifiex_flush_data; |
@@ -399,6 +402,22 @@ mwifiex_11n_create_rx_reorder_tbl(struct mwifiex_private *priv, u8 *ta, | |||
399 | spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock, flags); | 402 | spin_unlock_irqrestore(&priv->rx_reorder_tbl_lock, flags); |
400 | } | 403 | } |
401 | 404 | ||
405 | static void | ||
406 | mwifiex_11n_rxreorder_timer_restart(struct mwifiex_rx_reorder_tbl *tbl) | ||
407 | { | ||
408 | u32 min_flush_time; | ||
409 | |||
410 | if (tbl->win_size >= MWIFIEX_BA_WIN_SIZE_32) | ||
411 | min_flush_time = MIN_FLUSH_TIMER_15_MS; | ||
412 | else | ||
413 | min_flush_time = MIN_FLUSH_TIMER_MS; | ||
414 | |||
415 | mod_timer(&tbl->timer_context.timer, | ||
416 | jiffies + msecs_to_jiffies(min_flush_time * tbl->win_size)); | ||
417 | |||
418 | tbl->timer_context.timer_is_set = true; | ||
419 | } | ||
420 | |||
402 | /* | 421 | /* |
403 | * This function prepares command for adding a BA request. | 422 | * This function prepares command for adding a BA request. |
404 | * | 423 | * |
@@ -523,31 +542,31 @@ int mwifiex_11n_rx_reorder_pkt(struct mwifiex_private *priv, | |||
523 | u8 *ta, u8 pkt_type, void *payload) | 542 | u8 *ta, u8 pkt_type, void *payload) |
524 | { | 543 | { |
525 | struct mwifiex_rx_reorder_tbl *tbl; | 544 | struct mwifiex_rx_reorder_tbl *tbl; |
526 | int start_win, end_win, win_size; | 545 | int prev_start_win, start_win, end_win, win_size; |
527 | u16 pkt_index; | 546 | u16 pkt_index; |
528 | bool init_window_shift = false; | 547 | bool init_window_shift = false; |
548 | int ret = 0; | ||
529 | 549 | ||
530 | tbl = mwifiex_11n_get_rx_reorder_tbl(priv, tid, ta); | 550 | tbl = mwifiex_11n_get_rx_reorder_tbl(priv, tid, ta); |
531 | if (!tbl) { | 551 | if (!tbl) { |
532 | if (pkt_type != PKT_TYPE_BAR) | 552 | if (pkt_type != PKT_TYPE_BAR) |
533 | mwifiex_11n_dispatch_pkt(priv, payload); | 553 | mwifiex_11n_dispatch_pkt(priv, payload); |
534 | return 0; | 554 | return ret; |
535 | } | 555 | } |
536 | 556 | ||
537 | if ((pkt_type == PKT_TYPE_AMSDU) && !tbl->amsdu) { | 557 | if ((pkt_type == PKT_TYPE_AMSDU) && !tbl->amsdu) { |
538 | mwifiex_11n_dispatch_pkt(priv, payload); | 558 | mwifiex_11n_dispatch_pkt(priv, payload); |
539 | return 0; | 559 | return ret; |
540 | } | 560 | } |
541 | 561 | ||
542 | start_win = tbl->start_win; | 562 | start_win = tbl->start_win; |
563 | prev_start_win = start_win; | ||
543 | win_size = tbl->win_size; | 564 | win_size = tbl->win_size; |
544 | end_win = ((start_win + win_size) - 1) & (MAX_TID_VALUE - 1); | 565 | end_win = ((start_win + win_size) - 1) & (MAX_TID_VALUE - 1); |
545 | if (tbl->flags & RXREOR_INIT_WINDOW_SHIFT) { | 566 | if (tbl->flags & RXREOR_INIT_WINDOW_SHIFT) { |
546 | init_window_shift = true; | 567 | init_window_shift = true; |
547 | tbl->flags &= ~RXREOR_INIT_WINDOW_SHIFT; | 568 | tbl->flags &= ~RXREOR_INIT_WINDOW_SHIFT; |
548 | } | 569 | } |
549 | mod_timer(&tbl->timer_context.timer, | ||
550 | jiffies + msecs_to_jiffies(MIN_FLUSH_TIMER_MS * win_size)); | ||
551 | 570 | ||
552 | if (tbl->flags & RXREOR_FORCE_NO_DROP) { | 571 | if (tbl->flags & RXREOR_FORCE_NO_DROP) { |
553 | dev_dbg(priv->adapter->dev, | 572 | dev_dbg(priv->adapter->dev, |
@@ -568,11 +587,14 @@ int mwifiex_11n_rx_reorder_pkt(struct mwifiex_private *priv, | |||
568 | if ((start_win + TWOPOW11) > (MAX_TID_VALUE - 1)) { | 587 | if ((start_win + TWOPOW11) > (MAX_TID_VALUE - 1)) { |
569 | if (seq_num >= ((start_win + TWOPOW11) & | 588 | if (seq_num >= ((start_win + TWOPOW11) & |
570 | (MAX_TID_VALUE - 1)) && | 589 | (MAX_TID_VALUE - 1)) && |
571 | seq_num < start_win) | 590 | seq_num < start_win) { |
572 | return -1; | 591 | ret = -1; |
592 | goto done; | ||
593 | } | ||
573 | } else if ((seq_num < start_win) || | 594 | } else if ((seq_num < start_win) || |
574 | (seq_num > (start_win + TWOPOW11))) { | 595 | (seq_num >= (start_win + TWOPOW11))) { |
575 | return -1; | 596 | ret = -1; |
597 | goto done; | ||
576 | } | 598 | } |
577 | } | 599 | } |
578 | 600 | ||
@@ -601,8 +623,10 @@ int mwifiex_11n_rx_reorder_pkt(struct mwifiex_private *priv, | |||
601 | else | 623 | else |
602 | pkt_index = (seq_num+MAX_TID_VALUE) - start_win; | 624 | pkt_index = (seq_num+MAX_TID_VALUE) - start_win; |
603 | 625 | ||
604 | if (tbl->rx_reorder_ptr[pkt_index]) | 626 | if (tbl->rx_reorder_ptr[pkt_index]) { |
605 | return -1; | 627 | ret = -1; |
628 | goto done; | ||
629 | } | ||
606 | 630 | ||
607 | tbl->rx_reorder_ptr[pkt_index] = payload; | 631 | tbl->rx_reorder_ptr[pkt_index] = payload; |
608 | } | 632 | } |
@@ -613,7 +637,11 @@ int mwifiex_11n_rx_reorder_pkt(struct mwifiex_private *priv, | |||
613 | */ | 637 | */ |
614 | mwifiex_11n_scan_and_dispatch(priv, tbl); | 638 | mwifiex_11n_scan_and_dispatch(priv, tbl); |
615 | 639 | ||
616 | return 0; | 640 | done: |
641 | if (!tbl->timer_context.timer_is_set || | ||
642 | prev_start_win != tbl->start_win) | ||
643 | mwifiex_11n_rxreorder_timer_restart(tbl); | ||
644 | return ret; | ||
617 | } | 645 | } |
618 | 646 | ||
619 | /* | 647 | /* |
diff --git a/drivers/net/wireless/mwifiex/11n_rxreorder.h b/drivers/net/wireless/mwifiex/11n_rxreorder.h index 3a87bb0e3a62..63ecea89b4ab 100644 --- a/drivers/net/wireless/mwifiex/11n_rxreorder.h +++ b/drivers/net/wireless/mwifiex/11n_rxreorder.h | |||
@@ -21,6 +21,8 @@ | |||
21 | #define _MWIFIEX_11N_RXREORDER_H_ | 21 | #define _MWIFIEX_11N_RXREORDER_H_ |
22 | 22 | ||
23 | #define MIN_FLUSH_TIMER_MS 50 | 23 | #define MIN_FLUSH_TIMER_MS 50 |
24 | #define MIN_FLUSH_TIMER_15_MS 15 | ||
25 | #define MWIFIEX_BA_WIN_SIZE_32 32 | ||
24 | 26 | ||
25 | #define PKT_TYPE_BAR 0xE7 | 27 | #define PKT_TYPE_BAR 0xE7 |
26 | #define MAX_TID_VALUE (2 << 11) | 28 | #define MAX_TID_VALUE (2 << 11) |
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h index e2635747d966..f55658d15c60 100644 --- a/drivers/net/wireless/mwifiex/main.h +++ b/drivers/net/wireless/mwifiex/main.h | |||
@@ -592,6 +592,7 @@ struct reorder_tmr_cnxt { | |||
592 | struct timer_list timer; | 592 | struct timer_list timer; |
593 | struct mwifiex_rx_reorder_tbl *ptr; | 593 | struct mwifiex_rx_reorder_tbl *ptr; |
594 | struct mwifiex_private *priv; | 594 | struct mwifiex_private *priv; |
595 | u8 timer_is_set; | ||
595 | }; | 596 | }; |
596 | 597 | ||
597 | struct mwifiex_rx_reorder_tbl { | 598 | struct mwifiex_rx_reorder_tbl { |
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index 573897b8e878..8444313eabe2 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
@@ -1111,6 +1111,7 @@ static struct usb_device_id rt2800usb_device_table[] = { | |||
1111 | /* Ovislink */ | 1111 | /* Ovislink */ |
1112 | { USB_DEVICE(0x1b75, 0x3071) }, | 1112 | { USB_DEVICE(0x1b75, 0x3071) }, |
1113 | { USB_DEVICE(0x1b75, 0x3072) }, | 1113 | { USB_DEVICE(0x1b75, 0x3072) }, |
1114 | { USB_DEVICE(0x1b75, 0xa200) }, | ||
1114 | /* Para */ | 1115 | /* Para */ |
1115 | { USB_DEVICE(0x20b8, 0x8888) }, | 1116 | { USB_DEVICE(0x20b8, 0x8888) }, |
1116 | /* Pegatron */ | 1117 | /* Pegatron */ |
diff --git a/drivers/net/wireless/rtlwifi/base.c b/drivers/net/wireless/rtlwifi/base.c index 58ba71830886..40b6d1d006d7 100644 --- a/drivers/net/wireless/rtlwifi/base.c +++ b/drivers/net/wireless/rtlwifi/base.c | |||
@@ -467,7 +467,7 @@ static void _rtl_init_deferred_work(struct ieee80211_hw *hw) | |||
467 | rtl_easy_concurrent_retrytimer_callback, (unsigned long)hw); | 467 | rtl_easy_concurrent_retrytimer_callback, (unsigned long)hw); |
468 | /* <2> work queue */ | 468 | /* <2> work queue */ |
469 | rtlpriv->works.hw = hw; | 469 | rtlpriv->works.hw = hw; |
470 | rtlpriv->works.rtl_wq = alloc_workqueue(rtlpriv->cfg->name, 0, 0); | 470 | rtlpriv->works.rtl_wq = alloc_workqueue("%s", 0, 0, rtlpriv->cfg->name); |
471 | INIT_DELAYED_WORK(&rtlpriv->works.watchdog_wq, | 471 | INIT_DELAYED_WORK(&rtlpriv->works.watchdog_wq, |
472 | (void *)rtl_watchdog_wq_callback); | 472 | (void *)rtl_watchdog_wq_callback); |
473 | INIT_DELAYED_WORK(&rtlpriv->works.ips_nic_off_wq, | 473 | INIT_DELAYED_WORK(&rtlpriv->works.ips_nic_off_wq, |
diff --git a/drivers/net/wireless/rtlwifi/core.c b/drivers/net/wireless/rtlwifi/core.c index f6179bc06086..07dae0d44abc 100644 --- a/drivers/net/wireless/rtlwifi/core.c +++ b/drivers/net/wireless/rtlwifi/core.c | |||
@@ -1828,3 +1828,9 @@ const struct ieee80211_ops rtl_ops = { | |||
1828 | .flush = rtl_op_flush, | 1828 | .flush = rtl_op_flush, |
1829 | }; | 1829 | }; |
1830 | EXPORT_SYMBOL_GPL(rtl_ops); | 1830 | EXPORT_SYMBOL_GPL(rtl_ops); |
1831 | |||
1832 | bool rtl_btc_status_false(void) | ||
1833 | { | ||
1834 | return false; | ||
1835 | } | ||
1836 | EXPORT_SYMBOL_GPL(rtl_btc_status_false); | ||
diff --git a/drivers/net/wireless/rtlwifi/core.h b/drivers/net/wireless/rtlwifi/core.h index 59cd3b9dca25..624e1dc16d31 100644 --- a/drivers/net/wireless/rtlwifi/core.h +++ b/drivers/net/wireless/rtlwifi/core.h | |||
@@ -42,5 +42,6 @@ void rtl_rfreg_delay(struct ieee80211_hw *hw, enum radio_path rfpath, u32 addr, | |||
42 | u32 mask, u32 data); | 42 | u32 mask, u32 data); |
43 | void rtl_bb_delay(struct ieee80211_hw *hw, u32 addr, u32 data); | 43 | void rtl_bb_delay(struct ieee80211_hw *hw, u32 addr, u32 data); |
44 | bool rtl_cmd_send_packet(struct ieee80211_hw *hw, struct sk_buff *skb); | 44 | bool rtl_cmd_send_packet(struct ieee80211_hw *hw, struct sk_buff *skb); |
45 | bool rtl_btc_status_false(void); | ||
45 | 46 | ||
46 | #endif | 47 | #endif |
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c index 667aba81246c..25daa8715219 100644 --- a/drivers/net/wireless/rtlwifi/pci.c +++ b/drivers/net/wireless/rtlwifi/pci.c | |||
@@ -1796,7 +1796,8 @@ static int rtl_pci_start(struct ieee80211_hw *hw) | |||
1796 | rtl_pci_reset_trx_ring(hw); | 1796 | rtl_pci_reset_trx_ring(hw); |
1797 | 1797 | ||
1798 | rtlpci->driver_is_goingto_unload = false; | 1798 | rtlpci->driver_is_goingto_unload = false; |
1799 | if (rtlpriv->cfg->ops->get_btc_status()) { | 1799 | if (rtlpriv->cfg->ops->get_btc_status && |
1800 | rtlpriv->cfg->ops->get_btc_status()) { | ||
1800 | rtlpriv->btcoexist.btc_ops->btc_init_variables(rtlpriv); | 1801 | rtlpriv->btcoexist.btc_ops->btc_init_variables(rtlpriv); |
1801 | rtlpriv->btcoexist.btc_ops->btc_init_hal_vars(rtlpriv); | 1802 | rtlpriv->btcoexist.btc_ops->btc_init_hal_vars(rtlpriv); |
1802 | } | 1803 | } |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c b/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c index a00861b26ece..29983bc96a89 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c +++ b/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c | |||
@@ -656,7 +656,8 @@ static u8 reserved_page_packet[TOTAL_RESERVED_PKT_LEN] = { | |||
656 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 656 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
657 | }; | 657 | }; |
658 | 658 | ||
659 | void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished) | 659 | void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, |
660 | bool (*cmd_send_packet)(struct ieee80211_hw *, struct sk_buff *)) | ||
660 | { | 661 | { |
661 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 662 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
662 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); | 663 | struct rtl_mac *mac = rtl_mac(rtl_priv(hw)); |
@@ -722,7 +723,10 @@ void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished) | |||
722 | memcpy((u8 *)skb_put(skb, totalpacketlen), | 723 | memcpy((u8 *)skb_put(skb, totalpacketlen), |
723 | &reserved_page_packet, totalpacketlen); | 724 | &reserved_page_packet, totalpacketlen); |
724 | 725 | ||
725 | rtstatus = rtl_cmd_send_packet(hw, skb); | 726 | if (cmd_send_packet) |
727 | rtstatus = cmd_send_packet(hw, skb); | ||
728 | else | ||
729 | rtstatus = rtl_cmd_send_packet(hw, skb); | ||
726 | 730 | ||
727 | if (rtstatus) | 731 | if (rtstatus) |
728 | b_dlok = true; | 732 | b_dlok = true; |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.h b/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.h index a815bd6273da..b64ae45dc674 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.h +++ b/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.h | |||
@@ -109,7 +109,9 @@ void rtl92c_fill_h2c_cmd(struct ieee80211_hw *hw, u8 element_id, | |||
109 | u32 cmd_len, u8 *p_cmdbuffer); | 109 | u32 cmd_len, u8 *p_cmdbuffer); |
110 | void rtl92c_firmware_selfreset(struct ieee80211_hw *hw); | 110 | void rtl92c_firmware_selfreset(struct ieee80211_hw *hw); |
111 | void rtl92c_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode); | 111 | void rtl92c_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode); |
112 | void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool b_dl_finished); | 112 | void rtl92c_set_fw_rsvdpagepkt |
113 | (struct ieee80211_hw *hw, | ||
114 | bool (*cmd_send_packet)(struct ieee80211_hw *, struct sk_buff *)); | ||
113 | void rtl92c_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, u8 mstatus); | 115 | void rtl92c_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, u8 mstatus); |
114 | void usb_writeN_async(struct rtl_priv *rtlpriv, u32 addr, void *data, u16 len); | 116 | void usb_writeN_async(struct rtl_priv *rtlpriv, u32 addr, void *data, u16 len); |
115 | void rtl92c_set_p2p_ps_offload_cmd(struct ieee80211_hw *hw, u8 p2p_ps_state); | 117 | void rtl92c_set_p2p_ps_offload_cmd(struct ieee80211_hw *hw, u8 p2p_ps_state); |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/def.h b/drivers/net/wireless/rtlwifi/rtl8192ce/def.h index 831df101d7b7..9b660df6fd71 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/def.h +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/def.h | |||
@@ -114,6 +114,8 @@ | |||
114 | LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 16, 4) | 114 | LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 16, 4) |
115 | #define GET_C2H_CMD_FEEDBACK_CCX_SEQ(__pcmdfbhdr) \ | 115 | #define GET_C2H_CMD_FEEDBACK_CCX_SEQ(__pcmdfbhdr) \ |
116 | LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 20, 12) | 116 | LE_BITS_TO_4BYTE(((__pcmdfbhdr) + 4), 20, 12) |
117 | #define GET_RX_STATUS_DESC_BUFF_ADDR(__pdesc) \ | ||
118 | SHIFT_AND_MASK_LE(__pdesc + 24, 0, 32) | ||
117 | 119 | ||
118 | #define CHIP_VER_B BIT(4) | 120 | #define CHIP_VER_B BIT(4) |
119 | #define CHIP_BONDING_IDENTIFIER(_value) (((_value) >> 22) & 0x3) | 121 | #define CHIP_BONDING_IDENTIFIER(_value) (((_value) >> 22) & 0x3) |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c index 8ec0f031f48a..55357d69397a 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/hw.c | |||
@@ -459,7 +459,7 @@ void rtl92ce_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) | |||
459 | rtl_write_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 2, | 459 | rtl_write_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 2, |
460 | tmp_reg422 & (~BIT(6))); | 460 | tmp_reg422 & (~BIT(6))); |
461 | 461 | ||
462 | rtl92c_set_fw_rsvdpagepkt(hw, 0); | 462 | rtl92c_set_fw_rsvdpagepkt(hw, NULL); |
463 | 463 | ||
464 | _rtl92ce_set_bcn_ctrl_reg(hw, BIT(3), 0); | 464 | _rtl92ce_set_bcn_ctrl_reg(hw, BIT(3), 0); |
465 | _rtl92ce_set_bcn_ctrl_reg(hw, 0, BIT(4)); | 465 | _rtl92ce_set_bcn_ctrl_reg(hw, 0, BIT(4)); |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c b/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c index d86b5b566444..46ea07605eb4 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/sw.c | |||
@@ -244,6 +244,7 @@ static struct rtl_hal_ops rtl8192ce_hal_ops = { | |||
244 | .phy_lc_calibrate = _rtl92ce_phy_lc_calibrate, | 244 | .phy_lc_calibrate = _rtl92ce_phy_lc_calibrate, |
245 | .phy_set_bw_mode_callback = rtl92ce_phy_set_bw_mode_callback, | 245 | .phy_set_bw_mode_callback = rtl92ce_phy_set_bw_mode_callback, |
246 | .dm_dynamic_txpower = rtl92ce_dm_dynamic_txpower, | 246 | .dm_dynamic_txpower = rtl92ce_dm_dynamic_txpower, |
247 | .get_btc_status = rtl_btc_status_false, | ||
247 | }; | 248 | }; |
248 | 249 | ||
249 | static struct rtl_mod_params rtl92ce_mod_params = { | 250 | static struct rtl_mod_params rtl92ce_mod_params = { |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c b/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c index 2fb9c7acb76a..dc3d20b17a26 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c +++ b/drivers/net/wireless/rtlwifi/rtl8192ce/trx.c | |||
@@ -728,6 +728,9 @@ u32 rtl92ce_get_desc(u8 *p_desc, bool istx, u8 desc_name) | |||
728 | case HW_DESC_RXPKT_LEN: | 728 | case HW_DESC_RXPKT_LEN: |
729 | ret = GET_RX_DESC_PKT_LEN(pdesc); | 729 | ret = GET_RX_DESC_PKT_LEN(pdesc); |
730 | break; | 730 | break; |
731 | case HW_DESC_RXBUFF_ADDR: | ||
732 | ret = GET_RX_STATUS_DESC_BUFF_ADDR(pdesc); | ||
733 | break; | ||
731 | default: | 734 | default: |
732 | RT_ASSERT(false, "ERR rxdesc :%d not process\n", | 735 | RT_ASSERT(false, "ERR rxdesc :%d not process\n", |
733 | desc_name); | 736 | desc_name); |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c index 04aa0b5f5b3d..873363acbacf 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.c | |||
@@ -1592,6 +1592,20 @@ void rtl92cu_get_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) | |||
1592 | } | 1592 | } |
1593 | } | 1593 | } |
1594 | 1594 | ||
1595 | bool usb_cmd_send_packet(struct ieee80211_hw *hw, struct sk_buff *skb) | ||
1596 | { | ||
1597 | /* Currently nothing happens here. | ||
1598 | * Traffic stops after some seconds in WPA2 802.11n mode. | ||
1599 | * Maybe because rtl8192cu chip should be set from here? | ||
1600 | * If I understand correctly, the realtek vendor driver sends some urbs | ||
1601 | * if its "here". | ||
1602 | * | ||
1603 | * This is maybe necessary: | ||
1604 | * rtlpriv->cfg->ops->fill_tx_cmddesc(hw, buffer, 1, 1, skb); | ||
1605 | */ | ||
1606 | return true; | ||
1607 | } | ||
1608 | |||
1595 | void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) | 1609 | void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) |
1596 | { | 1610 | { |
1597 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 1611 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
@@ -1939,7 +1953,8 @@ void rtl92cu_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) | |||
1939 | recover = true; | 1953 | recover = true; |
1940 | rtl_write_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 2, | 1954 | rtl_write_byte(rtlpriv, REG_FWHW_TXQ_CTRL + 2, |
1941 | tmp_reg422 & (~BIT(6))); | 1955 | tmp_reg422 & (~BIT(6))); |
1942 | rtl92c_set_fw_rsvdpagepkt(hw, 0); | 1956 | rtl92c_set_fw_rsvdpagepkt(hw, |
1957 | &usb_cmd_send_packet); | ||
1943 | _rtl92cu_set_bcn_ctrl_reg(hw, BIT(3), 0); | 1958 | _rtl92cu_set_bcn_ctrl_reg(hw, BIT(3), 0); |
1944 | _rtl92cu_set_bcn_ctrl_reg(hw, 0, BIT(4)); | 1959 | _rtl92cu_set_bcn_ctrl_reg(hw, 0, BIT(4)); |
1945 | if (recover) | 1960 | if (recover) |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h index 0f7812e0c8aa..c1e33b0228c0 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/hw.h | |||
@@ -104,7 +104,6 @@ bool rtl92cu_gpio_radio_on_off_checking(struct ieee80211_hw *hw, u8 * valid); | |||
104 | void rtl92cu_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid); | 104 | void rtl92cu_set_check_bssid(struct ieee80211_hw *hw, bool check_bssid); |
105 | int rtl92c_download_fw(struct ieee80211_hw *hw); | 105 | int rtl92c_download_fw(struct ieee80211_hw *hw); |
106 | void rtl92c_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode); | 106 | void rtl92c_set_fw_pwrmode_cmd(struct ieee80211_hw *hw, u8 mode); |
107 | void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool dl_finished); | ||
108 | void rtl92c_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, u8 mstatus); | 107 | void rtl92c_set_fw_joinbss_report_cmd(struct ieee80211_hw *hw, u8 mstatus); |
109 | void rtl92c_fill_h2c_cmd(struct ieee80211_hw *hw, | 108 | void rtl92c_fill_h2c_cmd(struct ieee80211_hw *hw, |
110 | u8 element_id, u32 cmd_len, u8 *p_cmdbuffer); | 109 | u8 element_id, u32 cmd_len, u8 *p_cmdbuffer); |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c index 7c5fbaf5fee0..e06bafee37f9 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c | |||
@@ -101,6 +101,12 @@ static void rtl92cu_deinit_sw_vars(struct ieee80211_hw *hw) | |||
101 | } | 101 | } |
102 | } | 102 | } |
103 | 103 | ||
104 | /* get bt coexist status */ | ||
105 | static bool rtl92cu_get_btc_status(void) | ||
106 | { | ||
107 | return false; | ||
108 | } | ||
109 | |||
104 | static struct rtl_hal_ops rtl8192cu_hal_ops = { | 110 | static struct rtl_hal_ops rtl8192cu_hal_ops = { |
105 | .init_sw_vars = rtl92cu_init_sw_vars, | 111 | .init_sw_vars = rtl92cu_init_sw_vars, |
106 | .deinit_sw_vars = rtl92cu_deinit_sw_vars, | 112 | .deinit_sw_vars = rtl92cu_deinit_sw_vars, |
@@ -148,6 +154,7 @@ static struct rtl_hal_ops rtl8192cu_hal_ops = { | |||
148 | .phy_set_bw_mode_callback = rtl92cu_phy_set_bw_mode_callback, | 154 | .phy_set_bw_mode_callback = rtl92cu_phy_set_bw_mode_callback, |
149 | .dm_dynamic_txpower = rtl92cu_dm_dynamic_txpower, | 155 | .dm_dynamic_txpower = rtl92cu_dm_dynamic_txpower, |
150 | .fill_h2c_cmd = rtl92c_fill_h2c_cmd, | 156 | .fill_h2c_cmd = rtl92c_fill_h2c_cmd, |
157 | .get_btc_status = rtl92cu_get_btc_status, | ||
151 | }; | 158 | }; |
152 | 159 | ||
153 | static struct rtl_mod_params rtl92cu_mod_params = { | 160 | static struct rtl_mod_params rtl92cu_mod_params = { |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/sw.c b/drivers/net/wireless/rtlwifi/rtl8192de/sw.c index edab5a5351b5..a0aba088259a 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192de/sw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192de/sw.c | |||
@@ -251,6 +251,7 @@ static struct rtl_hal_ops rtl8192de_hal_ops = { | |||
251 | .get_rfreg = rtl92d_phy_query_rf_reg, | 251 | .get_rfreg = rtl92d_phy_query_rf_reg, |
252 | .set_rfreg = rtl92d_phy_set_rf_reg, | 252 | .set_rfreg = rtl92d_phy_set_rf_reg, |
253 | .linked_set_reg = rtl92d_linked_set_reg, | 253 | .linked_set_reg = rtl92d_linked_set_reg, |
254 | .get_btc_status = rtl_btc_status_false, | ||
254 | }; | 255 | }; |
255 | 256 | ||
256 | static struct rtl_mod_params rtl92de_mod_params = { | 257 | static struct rtl_mod_params rtl92de_mod_params = { |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192ee/hw.c b/drivers/net/wireless/rtlwifi/rtl8192ee/hw.c index dfdc9b20e4ad..1a87edca2c3f 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192ee/hw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192ee/hw.c | |||
@@ -362,7 +362,7 @@ void rtl92ee_get_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) | |||
362 | } | 362 | } |
363 | break; | 363 | break; |
364 | default: | 364 | default: |
365 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, | 365 | RT_TRACE(rtlpriv, COMP_ERR, DBG_DMESG, |
366 | "switch case not process %x\n", variable); | 366 | "switch case not process %x\n", variable); |
367 | break; | 367 | break; |
368 | } | 368 | } |
@@ -591,7 +591,7 @@ void rtl92ee_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) | |||
591 | acm_ctrl &= (~ACMHW_BEQEN); | 591 | acm_ctrl &= (~ACMHW_BEQEN); |
592 | break; | 592 | break; |
593 | default: | 593 | default: |
594 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, | 594 | RT_TRACE(rtlpriv, COMP_ERR, DBG_DMESG, |
595 | "switch case not process\n"); | 595 | "switch case not process\n"); |
596 | break; | 596 | break; |
597 | } | 597 | } |
@@ -710,7 +710,7 @@ void rtl92ee_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val) | |||
710 | } | 710 | } |
711 | break; | 711 | break; |
712 | default: | 712 | default: |
713 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, | 713 | RT_TRACE(rtlpriv, COMP_ERR, DBG_DMESG, |
714 | "switch case not process %x\n", variable); | 714 | "switch case not process %x\n", variable); |
715 | break; | 715 | break; |
716 | } | 716 | } |
@@ -2424,7 +2424,7 @@ void rtl92ee_set_key(struct ieee80211_hw *hw, u32 key_index, | |||
2424 | enc_algo = CAM_AES; | 2424 | enc_algo = CAM_AES; |
2425 | break; | 2425 | break; |
2426 | default: | 2426 | default: |
2427 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, | 2427 | RT_TRACE(rtlpriv, COMP_ERR, DBG_DMESG, |
2428 | "switch case not process\n"); | 2428 | "switch case not process\n"); |
2429 | enc_algo = CAM_TKIP; | 2429 | enc_algo = CAM_TKIP; |
2430 | break; | 2430 | break; |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/def.h b/drivers/net/wireless/rtlwifi/rtl8192se/def.h index 83c98674bfd3..6e7a70b43949 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192se/def.h +++ b/drivers/net/wireless/rtlwifi/rtl8192se/def.h | |||
@@ -446,6 +446,8 @@ | |||
446 | /* DWORD 6 */ | 446 | /* DWORD 6 */ |
447 | #define SET_RX_STATUS__DESC_BUFF_ADDR(__pdesc, __val) \ | 447 | #define SET_RX_STATUS__DESC_BUFF_ADDR(__pdesc, __val) \ |
448 | SET_BITS_OFFSET_LE(__pdesc + 24, 0, 32, __val) | 448 | SET_BITS_OFFSET_LE(__pdesc + 24, 0, 32, __val) |
449 | #define GET_RX_STATUS_DESC_BUFF_ADDR(__pdesc) \ | ||
450 | SHIFT_AND_MASK_LE(__pdesc + 24, 0, 32) | ||
449 | 451 | ||
450 | #define SE_RX_HAL_IS_CCK_RATE(_pdesc)\ | 452 | #define SE_RX_HAL_IS_CCK_RATE(_pdesc)\ |
451 | (GET_RX_STATUS_DESC_RX_MCS(_pdesc) == DESC92_RATE1M || \ | 453 | (GET_RX_STATUS_DESC_RX_MCS(_pdesc) == DESC92_RATE1M || \ |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/sw.c b/drivers/net/wireless/rtlwifi/rtl8192se/sw.c index 1bff2a0f7600..aadba29c167a 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192se/sw.c +++ b/drivers/net/wireless/rtlwifi/rtl8192se/sw.c | |||
@@ -87,11 +87,8 @@ static void rtl92s_init_aspm_vars(struct ieee80211_hw *hw) | |||
87 | static void rtl92se_fw_cb(const struct firmware *firmware, void *context) | 87 | static void rtl92se_fw_cb(const struct firmware *firmware, void *context) |
88 | { | 88 | { |
89 | struct ieee80211_hw *hw = context; | 89 | struct ieee80211_hw *hw = context; |
90 | struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); | ||
91 | struct rtl_priv *rtlpriv = rtl_priv(hw); | 90 | struct rtl_priv *rtlpriv = rtl_priv(hw); |
92 | struct rtl_pci *rtlpci = rtl_pcidev(pcipriv); | ||
93 | struct rt_firmware *pfirmware = NULL; | 91 | struct rt_firmware *pfirmware = NULL; |
94 | int err; | ||
95 | 92 | ||
96 | RT_TRACE(rtlpriv, COMP_ERR, DBG_LOUD, | 93 | RT_TRACE(rtlpriv, COMP_ERR, DBG_LOUD, |
97 | "Firmware callback routine entered!\n"); | 94 | "Firmware callback routine entered!\n"); |
@@ -112,20 +109,6 @@ static void rtl92se_fw_cb(const struct firmware *firmware, void *context) | |||
112 | memcpy(pfirmware->sz_fw_tmpbuffer, firmware->data, firmware->size); | 109 | memcpy(pfirmware->sz_fw_tmpbuffer, firmware->data, firmware->size); |
113 | pfirmware->sz_fw_tmpbufferlen = firmware->size; | 110 | pfirmware->sz_fw_tmpbufferlen = firmware->size; |
114 | release_firmware(firmware); | 111 | release_firmware(firmware); |
115 | |||
116 | err = ieee80211_register_hw(hw); | ||
117 | if (err) { | ||
118 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, | ||
119 | "Can't register mac80211 hw\n"); | ||
120 | return; | ||
121 | } else { | ||
122 | rtlpriv->mac80211.mac80211_registered = 1; | ||
123 | } | ||
124 | rtlpci->irq_alloc = 1; | ||
125 | set_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status); | ||
126 | |||
127 | /*init rfkill */ | ||
128 | rtl_init_rfkill(hw); | ||
129 | } | 112 | } |
130 | 113 | ||
131 | static int rtl92s_init_sw_vars(struct ieee80211_hw *hw) | 114 | static int rtl92s_init_sw_vars(struct ieee80211_hw *hw) |
@@ -226,8 +209,8 @@ static int rtl92s_init_sw_vars(struct ieee80211_hw *hw) | |||
226 | if (!rtlpriv->rtlhal.pfirmware) | 209 | if (!rtlpriv->rtlhal.pfirmware) |
227 | return 1; | 210 | return 1; |
228 | 211 | ||
229 | rtlpriv->max_fw_size = RTL8190_MAX_RAW_FIRMWARE_CODE_SIZE; | 212 | rtlpriv->max_fw_size = RTL8190_MAX_FIRMWARE_CODE_SIZE*2 + |
230 | 213 | sizeof(struct fw_hdr); | |
231 | pr_info("Driver for Realtek RTL8192SE/RTL8191SE\n" | 214 | pr_info("Driver for Realtek RTL8192SE/RTL8191SE\n" |
232 | "Loading firmware %s\n", rtlpriv->cfg->fw_name); | 215 | "Loading firmware %s\n", rtlpriv->cfg->fw_name); |
233 | /* request fw */ | 216 | /* request fw */ |
@@ -294,6 +277,7 @@ static struct rtl_hal_ops rtl8192se_hal_ops = { | |||
294 | .set_bbreg = rtl92s_phy_set_bb_reg, | 277 | .set_bbreg = rtl92s_phy_set_bb_reg, |
295 | .get_rfreg = rtl92s_phy_query_rf_reg, | 278 | .get_rfreg = rtl92s_phy_query_rf_reg, |
296 | .set_rfreg = rtl92s_phy_set_rf_reg, | 279 | .set_rfreg = rtl92s_phy_set_rf_reg, |
280 | .get_btc_status = rtl_btc_status_false, | ||
297 | }; | 281 | }; |
298 | 282 | ||
299 | static struct rtl_mod_params rtl92se_mod_params = { | 283 | static struct rtl_mod_params rtl92se_mod_params = { |
diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/trx.c b/drivers/net/wireless/rtlwifi/rtl8192se/trx.c index b358ebce8942..672fd3b02835 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192se/trx.c +++ b/drivers/net/wireless/rtlwifi/rtl8192se/trx.c | |||
@@ -640,6 +640,9 @@ u32 rtl92se_get_desc(u8 *desc, bool istx, u8 desc_name) | |||
640 | case HW_DESC_RXPKT_LEN: | 640 | case HW_DESC_RXPKT_LEN: |
641 | ret = GET_RX_STATUS_DESC_PKT_LEN(desc); | 641 | ret = GET_RX_STATUS_DESC_PKT_LEN(desc); |
642 | break; | 642 | break; |
643 | case HW_DESC_RXBUFF_ADDR: | ||
644 | ret = GET_RX_STATUS_DESC_BUFF_ADDR(desc); | ||
645 | break; | ||
643 | default: | 646 | default: |
644 | RT_ASSERT(false, "ERR rxdesc :%d not process\n", | 647 | RT_ASSERT(false, "ERR rxdesc :%d not process\n", |
645 | desc_name); | 648 | desc_name); |
diff --git a/drivers/net/wireless/rtlwifi/rtl8821ae/phy.c b/drivers/net/wireless/rtlwifi/rtl8821ae/phy.c index 9786313dc62f..1e9570fa874f 100644 --- a/drivers/net/wireless/rtlwifi/rtl8821ae/phy.c +++ b/drivers/net/wireless/rtlwifi/rtl8821ae/phy.c | |||
@@ -1889,15 +1889,18 @@ static void _rtl8821ae_store_tx_power_by_rate(struct ieee80211_hw *hw, | |||
1889 | struct rtl_phy *rtlphy = &rtlpriv->phy; | 1889 | struct rtl_phy *rtlphy = &rtlpriv->phy; |
1890 | u8 rate_section = _rtl8821ae_get_rate_section_index(regaddr); | 1890 | u8 rate_section = _rtl8821ae_get_rate_section_index(regaddr); |
1891 | 1891 | ||
1892 | if (band != BAND_ON_2_4G && band != BAND_ON_5G) | 1892 | if (band != BAND_ON_2_4G && band != BAND_ON_5G) { |
1893 | RT_TRACE(rtlpriv, COMP_INIT, DBG_WARNING, "Invalid Band %d\n", band); | 1893 | RT_TRACE(rtlpriv, COMP_INIT, DBG_WARNING, "Invalid Band %d\n", band); |
1894 | 1894 | band = BAND_ON_2_4G; | |
1895 | if (rfpath >= MAX_RF_PATH) | 1895 | } |
1896 | if (rfpath >= MAX_RF_PATH) { | ||
1896 | RT_TRACE(rtlpriv, COMP_INIT, DBG_WARNING, "Invalid RfPath %d\n", rfpath); | 1897 | RT_TRACE(rtlpriv, COMP_INIT, DBG_WARNING, "Invalid RfPath %d\n", rfpath); |
1897 | 1898 | rfpath = MAX_RF_PATH - 1; | |
1898 | if (txnum >= MAX_RF_PATH) | 1899 | } |
1900 | if (txnum >= MAX_RF_PATH) { | ||
1899 | RT_TRACE(rtlpriv, COMP_INIT, DBG_WARNING, "Invalid TxNum %d\n", txnum); | 1901 | RT_TRACE(rtlpriv, COMP_INIT, DBG_WARNING, "Invalid TxNum %d\n", txnum); |
1900 | 1902 | txnum = MAX_RF_PATH - 1; | |
1903 | } | ||
1901 | rtlphy->tx_power_by_rate_offset[band][rfpath][txnum][rate_section] = data; | 1904 | rtlphy->tx_power_by_rate_offset[band][rfpath][txnum][rate_section] = data; |
1902 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, | 1905 | RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD, |
1903 | "TxPwrByRateOffset[Band %d][RfPath %d][TxNum %d][RateSection %d] = 0x%x\n", | 1906 | "TxPwrByRateOffset[Band %d][RfPath %d][TxNum %d][RateSection %d] = 0x%x\n", |
diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c index 10cf69c4bc42..46ee956d0235 100644 --- a/drivers/net/wireless/rtlwifi/usb.c +++ b/drivers/net/wireless/rtlwifi/usb.c | |||
@@ -1117,7 +1117,18 @@ int rtl_usb_probe(struct usb_interface *intf, | |||
1117 | } | 1117 | } |
1118 | rtlpriv->cfg->ops->init_sw_leds(hw); | 1118 | rtlpriv->cfg->ops->init_sw_leds(hw); |
1119 | 1119 | ||
1120 | err = ieee80211_register_hw(hw); | ||
1121 | if (err) { | ||
1122 | RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG, | ||
1123 | "Can't register mac80211 hw.\n"); | ||
1124 | err = -ENODEV; | ||
1125 | goto error_out; | ||
1126 | } | ||
1127 | rtlpriv->mac80211.mac80211_registered = 1; | ||
1128 | |||
1129 | set_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status); | ||
1120 | return 0; | 1130 | return 0; |
1131 | |||
1121 | error_out: | 1132 | error_out: |
1122 | rtl_deinit_core(hw); | 1133 | rtl_deinit_core(hw); |
1123 | _rtl_usb_io_handler_release(hw); | 1134 | _rtl_usb_io_handler_release(hw); |
diff --git a/drivers/net/xen-netback/common.h b/drivers/net/xen-netback/common.h index d4eb8d2e9cb7..083ecc93fe5e 100644 --- a/drivers/net/xen-netback/common.h +++ b/drivers/net/xen-netback/common.h | |||
@@ -176,10 +176,11 @@ struct xenvif_queue { /* Per-queue data for xenvif */ | |||
176 | char rx_irq_name[IRQ_NAME_SIZE]; /* DEVNAME-qN-rx */ | 176 | char rx_irq_name[IRQ_NAME_SIZE]; /* DEVNAME-qN-rx */ |
177 | struct xen_netif_rx_back_ring rx; | 177 | struct xen_netif_rx_back_ring rx; |
178 | struct sk_buff_head rx_queue; | 178 | struct sk_buff_head rx_queue; |
179 | RING_IDX rx_last_skb_slots; | ||
180 | unsigned long status; | ||
181 | 179 | ||
182 | struct timer_list rx_stalled; | 180 | unsigned int rx_queue_max; |
181 | unsigned int rx_queue_len; | ||
182 | unsigned long last_rx_time; | ||
183 | bool stalled; | ||
183 | 184 | ||
184 | struct gnttab_copy grant_copy_op[MAX_GRANT_COPY_OPS]; | 185 | struct gnttab_copy grant_copy_op[MAX_GRANT_COPY_OPS]; |
185 | 186 | ||
@@ -199,18 +200,14 @@ struct xenvif_queue { /* Per-queue data for xenvif */ | |||
199 | struct xenvif_stats stats; | 200 | struct xenvif_stats stats; |
200 | }; | 201 | }; |
201 | 202 | ||
203 | /* Maximum number of Rx slots a to-guest packet may use, including the | ||
204 | * slot needed for GSO meta-data. | ||
205 | */ | ||
206 | #define XEN_NETBK_RX_SLOTS_MAX (MAX_SKB_FRAGS + 1) | ||
207 | |||
202 | enum state_bit_shift { | 208 | enum state_bit_shift { |
203 | /* This bit marks that the vif is connected */ | 209 | /* This bit marks that the vif is connected */ |
204 | VIF_STATUS_CONNECTED, | 210 | VIF_STATUS_CONNECTED, |
205 | /* This bit signals the RX thread that queuing was stopped (in | ||
206 | * start_xmit), and either the timer fired or an RX interrupt came | ||
207 | */ | ||
208 | QUEUE_STATUS_RX_PURGE_EVENT, | ||
209 | /* This bit tells the interrupt handler that this queue was the reason | ||
210 | * for the carrier off, so it should kick the thread. Only queues which | ||
211 | * brought it down can turn on the carrier. | ||
212 | */ | ||
213 | QUEUE_STATUS_RX_STALLED | ||
214 | }; | 211 | }; |
215 | 212 | ||
216 | struct xenvif { | 213 | struct xenvif { |
@@ -228,9 +225,6 @@ struct xenvif { | |||
228 | u8 ip_csum:1; | 225 | u8 ip_csum:1; |
229 | u8 ipv6_csum:1; | 226 | u8 ipv6_csum:1; |
230 | 227 | ||
231 | /* Internal feature information. */ | ||
232 | u8 can_queue:1; /* can queue packets for receiver? */ | ||
233 | |||
234 | /* Is this interface disabled? True when backend discovers | 228 | /* Is this interface disabled? True when backend discovers |
235 | * frontend is rogue. | 229 | * frontend is rogue. |
236 | */ | 230 | */ |
@@ -240,6 +234,9 @@ struct xenvif { | |||
240 | /* Queues */ | 234 | /* Queues */ |
241 | struct xenvif_queue *queues; | 235 | struct xenvif_queue *queues; |
242 | unsigned int num_queues; /* active queues, resource allocated */ | 236 | unsigned int num_queues; /* active queues, resource allocated */ |
237 | unsigned int stalled_queues; | ||
238 | |||
239 | spinlock_t lock; | ||
243 | 240 | ||
244 | #ifdef CONFIG_DEBUG_FS | 241 | #ifdef CONFIG_DEBUG_FS |
245 | struct dentry *xenvif_dbg_root; | 242 | struct dentry *xenvif_dbg_root; |
@@ -249,6 +246,14 @@ struct xenvif { | |||
249 | struct net_device *dev; | 246 | struct net_device *dev; |
250 | }; | 247 | }; |
251 | 248 | ||
249 | struct xenvif_rx_cb { | ||
250 | unsigned long expires; | ||
251 | int meta_slots_used; | ||
252 | bool full_coalesce; | ||
253 | }; | ||
254 | |||
255 | #define XENVIF_RX_CB(skb) ((struct xenvif_rx_cb *)(skb)->cb) | ||
256 | |||
252 | static inline struct xenbus_device *xenvif_to_xenbus_device(struct xenvif *vif) | 257 | static inline struct xenbus_device *xenvif_to_xenbus_device(struct xenvif *vif) |
253 | { | 258 | { |
254 | return to_xenbus_device(vif->dev->dev.parent); | 259 | return to_xenbus_device(vif->dev->dev.parent); |
@@ -272,8 +277,6 @@ void xenvif_xenbus_fini(void); | |||
272 | 277 | ||
273 | int xenvif_schedulable(struct xenvif *vif); | 278 | int xenvif_schedulable(struct xenvif *vif); |
274 | 279 | ||
275 | int xenvif_must_stop_queue(struct xenvif_queue *queue); | ||
276 | |||
277 | int xenvif_queue_stopped(struct xenvif_queue *queue); | 280 | int xenvif_queue_stopped(struct xenvif_queue *queue); |
278 | void xenvif_wake_queue(struct xenvif_queue *queue); | 281 | void xenvif_wake_queue(struct xenvif_queue *queue); |
279 | 282 | ||
@@ -296,6 +299,8 @@ void xenvif_kick_thread(struct xenvif_queue *queue); | |||
296 | 299 | ||
297 | int xenvif_dealloc_kthread(void *data); | 300 | int xenvif_dealloc_kthread(void *data); |
298 | 301 | ||
302 | void xenvif_rx_queue_tail(struct xenvif_queue *queue, struct sk_buff *skb); | ||
303 | |||
299 | /* Determine whether the needed number of slots (req) are available, | 304 | /* Determine whether the needed number of slots (req) are available, |
300 | * and set req_event if not. | 305 | * and set req_event if not. |
301 | */ | 306 | */ |
diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c index f379689dde30..895fe84011e7 100644 --- a/drivers/net/xen-netback/interface.c +++ b/drivers/net/xen-netback/interface.c | |||
@@ -43,6 +43,9 @@ | |||
43 | #define XENVIF_QUEUE_LENGTH 32 | 43 | #define XENVIF_QUEUE_LENGTH 32 |
44 | #define XENVIF_NAPI_WEIGHT 64 | 44 | #define XENVIF_NAPI_WEIGHT 64 |
45 | 45 | ||
46 | /* Number of bytes allowed on the internal guest Rx queue. */ | ||
47 | #define XENVIF_RX_QUEUE_BYTES (XEN_NETIF_RX_RING_SIZE/2 * PAGE_SIZE) | ||
48 | |||
46 | /* This function is used to set SKBTX_DEV_ZEROCOPY as well as | 49 | /* This function is used to set SKBTX_DEV_ZEROCOPY as well as |
47 | * increasing the inflight counter. We need to increase the inflight | 50 | * increasing the inflight counter. We need to increase the inflight |
48 | * counter because core driver calls into xenvif_zerocopy_callback | 51 | * counter because core driver calls into xenvif_zerocopy_callback |
@@ -60,20 +63,11 @@ void xenvif_skb_zerocopy_complete(struct xenvif_queue *queue) | |||
60 | atomic_dec(&queue->inflight_packets); | 63 | atomic_dec(&queue->inflight_packets); |
61 | } | 64 | } |
62 | 65 | ||
63 | static inline void xenvif_stop_queue(struct xenvif_queue *queue) | ||
64 | { | ||
65 | struct net_device *dev = queue->vif->dev; | ||
66 | |||
67 | if (!queue->vif->can_queue) | ||
68 | return; | ||
69 | |||
70 | netif_tx_stop_queue(netdev_get_tx_queue(dev, queue->id)); | ||
71 | } | ||
72 | |||
73 | int xenvif_schedulable(struct xenvif *vif) | 66 | int xenvif_schedulable(struct xenvif *vif) |
74 | { | 67 | { |
75 | return netif_running(vif->dev) && | 68 | return netif_running(vif->dev) && |
76 | test_bit(VIF_STATUS_CONNECTED, &vif->status); | 69 | test_bit(VIF_STATUS_CONNECTED, &vif->status) && |
70 | !vif->disabled; | ||
77 | } | 71 | } |
78 | 72 | ||
79 | static irqreturn_t xenvif_tx_interrupt(int irq, void *dev_id) | 73 | static irqreturn_t xenvif_tx_interrupt(int irq, void *dev_id) |
@@ -114,16 +108,7 @@ int xenvif_poll(struct napi_struct *napi, int budget) | |||
114 | static irqreturn_t xenvif_rx_interrupt(int irq, void *dev_id) | 108 | static irqreturn_t xenvif_rx_interrupt(int irq, void *dev_id) |
115 | { | 109 | { |
116 | struct xenvif_queue *queue = dev_id; | 110 | struct xenvif_queue *queue = dev_id; |
117 | struct netdev_queue *net_queue = | ||
118 | netdev_get_tx_queue(queue->vif->dev, queue->id); | ||
119 | 111 | ||
120 | /* QUEUE_STATUS_RX_PURGE_EVENT is only set if either QDisc was off OR | ||
121 | * the carrier went down and this queue was previously blocked | ||
122 | */ | ||
123 | if (unlikely(netif_tx_queue_stopped(net_queue) || | ||
124 | (!netif_carrier_ok(queue->vif->dev) && | ||
125 | test_bit(QUEUE_STATUS_RX_STALLED, &queue->status)))) | ||
126 | set_bit(QUEUE_STATUS_RX_PURGE_EVENT, &queue->status); | ||
127 | xenvif_kick_thread(queue); | 112 | xenvif_kick_thread(queue); |
128 | 113 | ||
129 | return IRQ_HANDLED; | 114 | return IRQ_HANDLED; |
@@ -151,24 +136,13 @@ void xenvif_wake_queue(struct xenvif_queue *queue) | |||
151 | netif_tx_wake_queue(netdev_get_tx_queue(dev, id)); | 136 | netif_tx_wake_queue(netdev_get_tx_queue(dev, id)); |
152 | } | 137 | } |
153 | 138 | ||
154 | /* Callback to wake the queue's thread and turn the carrier off on timeout */ | ||
155 | static void xenvif_rx_stalled(unsigned long data) | ||
156 | { | ||
157 | struct xenvif_queue *queue = (struct xenvif_queue *)data; | ||
158 | |||
159 | if (xenvif_queue_stopped(queue)) { | ||
160 | set_bit(QUEUE_STATUS_RX_PURGE_EVENT, &queue->status); | ||
161 | xenvif_kick_thread(queue); | ||
162 | } | ||
163 | } | ||
164 | |||
165 | static int xenvif_start_xmit(struct sk_buff *skb, struct net_device *dev) | 139 | static int xenvif_start_xmit(struct sk_buff *skb, struct net_device *dev) |
166 | { | 140 | { |
167 | struct xenvif *vif = netdev_priv(dev); | 141 | struct xenvif *vif = netdev_priv(dev); |
168 | struct xenvif_queue *queue = NULL; | 142 | struct xenvif_queue *queue = NULL; |
169 | unsigned int num_queues = vif->num_queues; | 143 | unsigned int num_queues = vif->num_queues; |
170 | u16 index; | 144 | u16 index; |
171 | int min_slots_needed; | 145 | struct xenvif_rx_cb *cb; |
172 | 146 | ||
173 | BUG_ON(skb->dev != dev); | 147 | BUG_ON(skb->dev != dev); |
174 | 148 | ||
@@ -191,30 +165,10 @@ static int xenvif_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
191 | !xenvif_schedulable(vif)) | 165 | !xenvif_schedulable(vif)) |
192 | goto drop; | 166 | goto drop; |
193 | 167 | ||
194 | /* At best we'll need one slot for the header and one for each | 168 | cb = XENVIF_RX_CB(skb); |
195 | * frag. | 169 | cb->expires = jiffies + rx_drain_timeout_jiffies; |
196 | */ | ||
197 | min_slots_needed = 1 + skb_shinfo(skb)->nr_frags; | ||
198 | |||
199 | /* If the skb is GSO then we'll also need an extra slot for the | ||
200 | * metadata. | ||
201 | */ | ||
202 | if (skb_is_gso(skb)) | ||
203 | min_slots_needed++; | ||
204 | 170 | ||
205 | /* If the skb can't possibly fit in the remaining slots | 171 | xenvif_rx_queue_tail(queue, skb); |
206 | * then turn off the queue to give the ring a chance to | ||
207 | * drain. | ||
208 | */ | ||
209 | if (!xenvif_rx_ring_slots_available(queue, min_slots_needed)) { | ||
210 | queue->rx_stalled.function = xenvif_rx_stalled; | ||
211 | queue->rx_stalled.data = (unsigned long)queue; | ||
212 | xenvif_stop_queue(queue); | ||
213 | mod_timer(&queue->rx_stalled, | ||
214 | jiffies + rx_drain_timeout_jiffies); | ||
215 | } | ||
216 | |||
217 | skb_queue_tail(&queue->rx_queue, skb); | ||
218 | xenvif_kick_thread(queue); | 172 | xenvif_kick_thread(queue); |
219 | 173 | ||
220 | return NETDEV_TX_OK; | 174 | return NETDEV_TX_OK; |
@@ -465,6 +419,8 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid, | |||
465 | vif->queues = NULL; | 419 | vif->queues = NULL; |
466 | vif->num_queues = 0; | 420 | vif->num_queues = 0; |
467 | 421 | ||
422 | spin_lock_init(&vif->lock); | ||
423 | |||
468 | dev->netdev_ops = &xenvif_netdev_ops; | 424 | dev->netdev_ops = &xenvif_netdev_ops; |
469 | dev->hw_features = NETIF_F_SG | | 425 | dev->hw_features = NETIF_F_SG | |
470 | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | | 426 | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | |
@@ -508,6 +464,8 @@ int xenvif_init_queue(struct xenvif_queue *queue) | |||
508 | init_timer(&queue->credit_timeout); | 464 | init_timer(&queue->credit_timeout); |
509 | queue->credit_window_start = get_jiffies_64(); | 465 | queue->credit_window_start = get_jiffies_64(); |
510 | 466 | ||
467 | queue->rx_queue_max = XENVIF_RX_QUEUE_BYTES; | ||
468 | |||
511 | skb_queue_head_init(&queue->rx_queue); | 469 | skb_queue_head_init(&queue->rx_queue); |
512 | skb_queue_head_init(&queue->tx_queue); | 470 | skb_queue_head_init(&queue->tx_queue); |
513 | 471 | ||
@@ -539,8 +497,6 @@ int xenvif_init_queue(struct xenvif_queue *queue) | |||
539 | queue->grant_tx_handle[i] = NETBACK_INVALID_HANDLE; | 497 | queue->grant_tx_handle[i] = NETBACK_INVALID_HANDLE; |
540 | } | 498 | } |
541 | 499 | ||
542 | init_timer(&queue->rx_stalled); | ||
543 | |||
544 | return 0; | 500 | return 0; |
545 | } | 501 | } |
546 | 502 | ||
@@ -551,7 +507,6 @@ void xenvif_carrier_on(struct xenvif *vif) | |||
551 | dev_set_mtu(vif->dev, ETH_DATA_LEN); | 507 | dev_set_mtu(vif->dev, ETH_DATA_LEN); |
552 | netdev_update_features(vif->dev); | 508 | netdev_update_features(vif->dev); |
553 | set_bit(VIF_STATUS_CONNECTED, &vif->status); | 509 | set_bit(VIF_STATUS_CONNECTED, &vif->status); |
554 | netif_carrier_on(vif->dev); | ||
555 | if (netif_running(vif->dev)) | 510 | if (netif_running(vif->dev)) |
556 | xenvif_up(vif); | 511 | xenvif_up(vif); |
557 | rtnl_unlock(); | 512 | rtnl_unlock(); |
@@ -611,6 +566,8 @@ int xenvif_connect(struct xenvif_queue *queue, unsigned long tx_ring_ref, | |||
611 | disable_irq(queue->rx_irq); | 566 | disable_irq(queue->rx_irq); |
612 | } | 567 | } |
613 | 568 | ||
569 | queue->stalled = true; | ||
570 | |||
614 | task = kthread_create(xenvif_kthread_guest_rx, | 571 | task = kthread_create(xenvif_kthread_guest_rx, |
615 | (void *)queue, "%s-guest-rx", queue->name); | 572 | (void *)queue, "%s-guest-rx", queue->name); |
616 | if (IS_ERR(task)) { | 573 | if (IS_ERR(task)) { |
@@ -674,7 +631,6 @@ void xenvif_disconnect(struct xenvif *vif) | |||
674 | netif_napi_del(&queue->napi); | 631 | netif_napi_del(&queue->napi); |
675 | 632 | ||
676 | if (queue->task) { | 633 | if (queue->task) { |
677 | del_timer_sync(&queue->rx_stalled); | ||
678 | kthread_stop(queue->task); | 634 | kthread_stop(queue->task); |
679 | queue->task = NULL; | 635 | queue->task = NULL; |
680 | } | 636 | } |
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c index 08f65996534c..6563f0713fc0 100644 --- a/drivers/net/xen-netback/netback.c +++ b/drivers/net/xen-netback/netback.c | |||
@@ -55,13 +55,20 @@ | |||
55 | bool separate_tx_rx_irq = 1; | 55 | bool separate_tx_rx_irq = 1; |
56 | module_param(separate_tx_rx_irq, bool, 0644); | 56 | module_param(separate_tx_rx_irq, bool, 0644); |
57 | 57 | ||
58 | /* When guest ring is filled up, qdisc queues the packets for us, but we have | 58 | /* The time that packets can stay on the guest Rx internal queue |
59 | * to timeout them, otherwise other guests' packets can get stuck there | 59 | * before they are dropped. |
60 | */ | 60 | */ |
61 | unsigned int rx_drain_timeout_msecs = 10000; | 61 | unsigned int rx_drain_timeout_msecs = 10000; |
62 | module_param(rx_drain_timeout_msecs, uint, 0444); | 62 | module_param(rx_drain_timeout_msecs, uint, 0444); |
63 | unsigned int rx_drain_timeout_jiffies; | 63 | unsigned int rx_drain_timeout_jiffies; |
64 | 64 | ||
65 | /* The length of time before the frontend is considered unresponsive | ||
66 | * because it isn't providing Rx slots. | ||
67 | */ | ||
68 | static unsigned int rx_stall_timeout_msecs = 60000; | ||
69 | module_param(rx_stall_timeout_msecs, uint, 0444); | ||
70 | static unsigned int rx_stall_timeout_jiffies; | ||
71 | |||
65 | unsigned int xenvif_max_queues; | 72 | unsigned int xenvif_max_queues; |
66 | module_param_named(max_queues, xenvif_max_queues, uint, 0644); | 73 | module_param_named(max_queues, xenvif_max_queues, uint, 0644); |
67 | MODULE_PARM_DESC(max_queues, | 74 | MODULE_PARM_DESC(max_queues, |
@@ -83,7 +90,6 @@ static void make_tx_response(struct xenvif_queue *queue, | |||
83 | s8 st); | 90 | s8 st); |
84 | 91 | ||
85 | static inline int tx_work_todo(struct xenvif_queue *queue); | 92 | static inline int tx_work_todo(struct xenvif_queue *queue); |
86 | static inline int rx_work_todo(struct xenvif_queue *queue); | ||
87 | 93 | ||
88 | static struct xen_netif_rx_response *make_rx_response(struct xenvif_queue *queue, | 94 | static struct xen_netif_rx_response *make_rx_response(struct xenvif_queue *queue, |
89 | u16 id, | 95 | u16 id, |
@@ -163,6 +169,69 @@ bool xenvif_rx_ring_slots_available(struct xenvif_queue *queue, int needed) | |||
163 | return false; | 169 | return false; |
164 | } | 170 | } |
165 | 171 | ||
172 | void xenvif_rx_queue_tail(struct xenvif_queue *queue, struct sk_buff *skb) | ||
173 | { | ||
174 | unsigned long flags; | ||
175 | |||
176 | spin_lock_irqsave(&queue->rx_queue.lock, flags); | ||
177 | |||
178 | __skb_queue_tail(&queue->rx_queue, skb); | ||
179 | |||
180 | queue->rx_queue_len += skb->len; | ||
181 | if (queue->rx_queue_len > queue->rx_queue_max) | ||
182 | netif_tx_stop_queue(netdev_get_tx_queue(queue->vif->dev, queue->id)); | ||
183 | |||
184 | spin_unlock_irqrestore(&queue->rx_queue.lock, flags); | ||
185 | } | ||
186 | |||
187 | static struct sk_buff *xenvif_rx_dequeue(struct xenvif_queue *queue) | ||
188 | { | ||
189 | struct sk_buff *skb; | ||
190 | |||
191 | spin_lock_irq(&queue->rx_queue.lock); | ||
192 | |||
193 | skb = __skb_dequeue(&queue->rx_queue); | ||
194 | if (skb) | ||
195 | queue->rx_queue_len -= skb->len; | ||
196 | |||
197 | spin_unlock_irq(&queue->rx_queue.lock); | ||
198 | |||
199 | return skb; | ||
200 | } | ||
201 | |||
202 | static void xenvif_rx_queue_maybe_wake(struct xenvif_queue *queue) | ||
203 | { | ||
204 | spin_lock_irq(&queue->rx_queue.lock); | ||
205 | |||
206 | if (queue->rx_queue_len < queue->rx_queue_max) | ||
207 | netif_tx_wake_queue(netdev_get_tx_queue(queue->vif->dev, queue->id)); | ||
208 | |||
209 | spin_unlock_irq(&queue->rx_queue.lock); | ||
210 | } | ||
211 | |||
212 | |||
213 | static void xenvif_rx_queue_purge(struct xenvif_queue *queue) | ||
214 | { | ||
215 | struct sk_buff *skb; | ||
216 | while ((skb = xenvif_rx_dequeue(queue)) != NULL) | ||
217 | kfree_skb(skb); | ||
218 | } | ||
219 | |||
220 | static void xenvif_rx_queue_drop_expired(struct xenvif_queue *queue) | ||
221 | { | ||
222 | struct sk_buff *skb; | ||
223 | |||
224 | for(;;) { | ||
225 | skb = skb_peek(&queue->rx_queue); | ||
226 | if (!skb) | ||
227 | break; | ||
228 | if (time_before(jiffies, XENVIF_RX_CB(skb)->expires)) | ||
229 | break; | ||
230 | xenvif_rx_dequeue(queue); | ||
231 | kfree_skb(skb); | ||
232 | } | ||
233 | } | ||
234 | |||
166 | /* | 235 | /* |
167 | * Returns true if we should start a new receive buffer instead of | 236 | * Returns true if we should start a new receive buffer instead of |
168 | * adding 'size' bytes to a buffer which currently contains 'offset' | 237 | * adding 'size' bytes to a buffer which currently contains 'offset' |
@@ -237,13 +306,6 @@ static struct xenvif_rx_meta *get_next_rx_buffer(struct xenvif_queue *queue, | |||
237 | return meta; | 306 | return meta; |
238 | } | 307 | } |
239 | 308 | ||
240 | struct xenvif_rx_cb { | ||
241 | int meta_slots_used; | ||
242 | bool full_coalesce; | ||
243 | }; | ||
244 | |||
245 | #define XENVIF_RX_CB(skb) ((struct xenvif_rx_cb *)(skb)->cb) | ||
246 | |||
247 | /* | 309 | /* |
248 | * Set up the grant operations for this fragment. If it's a flipping | 310 | * Set up the grant operations for this fragment. If it's a flipping |
249 | * interface, we also set up the unmap request from here. | 311 | * interface, we also set up the unmap request from here. |
@@ -587,12 +649,15 @@ static void xenvif_rx_action(struct xenvif_queue *queue) | |||
587 | 649 | ||
588 | skb_queue_head_init(&rxq); | 650 | skb_queue_head_init(&rxq); |
589 | 651 | ||
590 | while ((skb = skb_dequeue(&queue->rx_queue)) != NULL) { | 652 | while (xenvif_rx_ring_slots_available(queue, XEN_NETBK_RX_SLOTS_MAX) |
653 | && (skb = xenvif_rx_dequeue(queue)) != NULL) { | ||
591 | RING_IDX max_slots_needed; | 654 | RING_IDX max_slots_needed; |
592 | RING_IDX old_req_cons; | 655 | RING_IDX old_req_cons; |
593 | RING_IDX ring_slots_used; | 656 | RING_IDX ring_slots_used; |
594 | int i; | 657 | int i; |
595 | 658 | ||
659 | queue->last_rx_time = jiffies; | ||
660 | |||
596 | /* We need a cheap worse case estimate for the number of | 661 | /* We need a cheap worse case estimate for the number of |
597 | * slots we'll use. | 662 | * slots we'll use. |
598 | */ | 663 | */ |
@@ -634,15 +699,6 @@ static void xenvif_rx_action(struct xenvif_queue *queue) | |||
634 | skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6)) | 699 | skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6)) |
635 | max_slots_needed++; | 700 | max_slots_needed++; |
636 | 701 | ||
637 | /* If the skb may not fit then bail out now */ | ||
638 | if (!xenvif_rx_ring_slots_available(queue, max_slots_needed)) { | ||
639 | skb_queue_head(&queue->rx_queue, skb); | ||
640 | need_to_notify = true; | ||
641 | queue->rx_last_skb_slots = max_slots_needed; | ||
642 | break; | ||
643 | } else | ||
644 | queue->rx_last_skb_slots = 0; | ||
645 | |||
646 | old_req_cons = queue->rx.req_cons; | 702 | old_req_cons = queue->rx.req_cons; |
647 | XENVIF_RX_CB(skb)->meta_slots_used = xenvif_gop_skb(skb, &npo, queue); | 703 | XENVIF_RX_CB(skb)->meta_slots_used = xenvif_gop_skb(skb, &npo, queue); |
648 | ring_slots_used = queue->rx.req_cons - old_req_cons; | 704 | ring_slots_used = queue->rx.req_cons - old_req_cons; |
@@ -1869,12 +1925,6 @@ void xenvif_idx_unmap(struct xenvif_queue *queue, u16 pending_idx) | |||
1869 | } | 1925 | } |
1870 | } | 1926 | } |
1871 | 1927 | ||
1872 | static inline int rx_work_todo(struct xenvif_queue *queue) | ||
1873 | { | ||
1874 | return (!skb_queue_empty(&queue->rx_queue) && | ||
1875 | xenvif_rx_ring_slots_available(queue, queue->rx_last_skb_slots)); | ||
1876 | } | ||
1877 | |||
1878 | static inline int tx_work_todo(struct xenvif_queue *queue) | 1928 | static inline int tx_work_todo(struct xenvif_queue *queue) |
1879 | { | 1929 | { |
1880 | if (likely(RING_HAS_UNCONSUMED_REQUESTS(&queue->tx))) | 1930 | if (likely(RING_HAS_UNCONSUMED_REQUESTS(&queue->tx))) |
@@ -1931,92 +1981,121 @@ err: | |||
1931 | return err; | 1981 | return err; |
1932 | } | 1982 | } |
1933 | 1983 | ||
1934 | static void xenvif_start_queue(struct xenvif_queue *queue) | 1984 | static void xenvif_queue_carrier_off(struct xenvif_queue *queue) |
1935 | { | 1985 | { |
1936 | if (xenvif_schedulable(queue->vif)) | 1986 | struct xenvif *vif = queue->vif; |
1937 | xenvif_wake_queue(queue); | 1987 | |
1988 | queue->stalled = true; | ||
1989 | |||
1990 | /* At least one queue has stalled? Disable the carrier. */ | ||
1991 | spin_lock(&vif->lock); | ||
1992 | if (vif->stalled_queues++ == 0) { | ||
1993 | netdev_info(vif->dev, "Guest Rx stalled"); | ||
1994 | netif_carrier_off(vif->dev); | ||
1995 | } | ||
1996 | spin_unlock(&vif->lock); | ||
1938 | } | 1997 | } |
1939 | 1998 | ||
1940 | /* Only called from the queue's thread, it handles the situation when the guest | 1999 | static void xenvif_queue_carrier_on(struct xenvif_queue *queue) |
1941 | * doesn't post enough requests on the receiving ring. | ||
1942 | * First xenvif_start_xmit disables QDisc and start a timer, and then either the | ||
1943 | * timer fires, or the guest send an interrupt after posting new request. If it | ||
1944 | * is the timer, the carrier is turned off here. | ||
1945 | * */ | ||
1946 | static void xenvif_rx_purge_event(struct xenvif_queue *queue) | ||
1947 | { | 2000 | { |
1948 | /* Either the last unsuccesful skb or at least 1 slot should fit */ | 2001 | struct xenvif *vif = queue->vif; |
1949 | int needed = queue->rx_last_skb_slots ? | ||
1950 | queue->rx_last_skb_slots : 1; | ||
1951 | 2002 | ||
1952 | /* It is assumed that if the guest post new slots after this, the RX | 2003 | queue->last_rx_time = jiffies; /* Reset Rx stall detection. */ |
1953 | * interrupt will set the QUEUE_STATUS_RX_PURGE_EVENT bit and wake up | 2004 | queue->stalled = false; |
1954 | * the thread again | ||
1955 | */ | ||
1956 | set_bit(QUEUE_STATUS_RX_STALLED, &queue->status); | ||
1957 | if (!xenvif_rx_ring_slots_available(queue, needed)) { | ||
1958 | rtnl_lock(); | ||
1959 | if (netif_carrier_ok(queue->vif->dev)) { | ||
1960 | /* Timer fired and there are still no slots. Turn off | ||
1961 | * everything except the interrupts | ||
1962 | */ | ||
1963 | netif_carrier_off(queue->vif->dev); | ||
1964 | skb_queue_purge(&queue->rx_queue); | ||
1965 | queue->rx_last_skb_slots = 0; | ||
1966 | if (net_ratelimit()) | ||
1967 | netdev_err(queue->vif->dev, "Carrier off due to lack of guest response on queue %d\n", queue->id); | ||
1968 | } else { | ||
1969 | /* Probably an another queue already turned the carrier | ||
1970 | * off, make sure nothing is stucked in the internal | ||
1971 | * queue of this queue | ||
1972 | */ | ||
1973 | skb_queue_purge(&queue->rx_queue); | ||
1974 | queue->rx_last_skb_slots = 0; | ||
1975 | } | ||
1976 | rtnl_unlock(); | ||
1977 | } else if (!netif_carrier_ok(queue->vif->dev)) { | ||
1978 | unsigned int num_queues = queue->vif->num_queues; | ||
1979 | unsigned int i; | ||
1980 | /* The carrier was down, but an interrupt kicked | ||
1981 | * the thread again after new requests were | ||
1982 | * posted | ||
1983 | */ | ||
1984 | clear_bit(QUEUE_STATUS_RX_STALLED, | ||
1985 | &queue->status); | ||
1986 | rtnl_lock(); | ||
1987 | netif_carrier_on(queue->vif->dev); | ||
1988 | netif_tx_wake_all_queues(queue->vif->dev); | ||
1989 | rtnl_unlock(); | ||
1990 | 2005 | ||
1991 | for (i = 0; i < num_queues; i++) { | 2006 | /* All queues are ready? Enable the carrier. */ |
1992 | struct xenvif_queue *temp = &queue->vif->queues[i]; | 2007 | spin_lock(&vif->lock); |
2008 | if (--vif->stalled_queues == 0) { | ||
2009 | netdev_info(vif->dev, "Guest Rx ready"); | ||
2010 | netif_carrier_on(vif->dev); | ||
2011 | } | ||
2012 | spin_unlock(&vif->lock); | ||
2013 | } | ||
1993 | 2014 | ||
1994 | xenvif_napi_schedule_or_enable_events(temp); | 2015 | static bool xenvif_rx_queue_stalled(struct xenvif_queue *queue) |
1995 | } | 2016 | { |
1996 | if (net_ratelimit()) | 2017 | RING_IDX prod, cons; |
1997 | netdev_err(queue->vif->dev, "Carrier on again\n"); | 2018 | |
1998 | } else { | 2019 | prod = queue->rx.sring->req_prod; |
1999 | /* Queuing were stopped, but the guest posted | 2020 | cons = queue->rx.req_cons; |
2000 | * new requests and sent an interrupt | 2021 | |
2001 | */ | 2022 | return !queue->stalled |
2002 | clear_bit(QUEUE_STATUS_RX_STALLED, | 2023 | && prod - cons < XEN_NETBK_RX_SLOTS_MAX |
2003 | &queue->status); | 2024 | && time_after(jiffies, |
2004 | del_timer_sync(&queue->rx_stalled); | 2025 | queue->last_rx_time + rx_stall_timeout_jiffies); |
2005 | xenvif_start_queue(queue); | 2026 | } |
2027 | |||
2028 | static bool xenvif_rx_queue_ready(struct xenvif_queue *queue) | ||
2029 | { | ||
2030 | RING_IDX prod, cons; | ||
2031 | |||
2032 | prod = queue->rx.sring->req_prod; | ||
2033 | cons = queue->rx.req_cons; | ||
2034 | |||
2035 | return queue->stalled | ||
2036 | && prod - cons >= XEN_NETBK_RX_SLOTS_MAX; | ||
2037 | } | ||
2038 | |||
2039 | static bool xenvif_have_rx_work(struct xenvif_queue *queue) | ||
2040 | { | ||
2041 | return (!skb_queue_empty(&queue->rx_queue) | ||
2042 | && xenvif_rx_ring_slots_available(queue, XEN_NETBK_RX_SLOTS_MAX)) | ||
2043 | || xenvif_rx_queue_stalled(queue) | ||
2044 | || xenvif_rx_queue_ready(queue) | ||
2045 | || kthread_should_stop() | ||
2046 | || queue->vif->disabled; | ||
2047 | } | ||
2048 | |||
2049 | static long xenvif_rx_queue_timeout(struct xenvif_queue *queue) | ||
2050 | { | ||
2051 | struct sk_buff *skb; | ||
2052 | long timeout; | ||
2053 | |||
2054 | skb = skb_peek(&queue->rx_queue); | ||
2055 | if (!skb) | ||
2056 | return MAX_SCHEDULE_TIMEOUT; | ||
2057 | |||
2058 | timeout = XENVIF_RX_CB(skb)->expires - jiffies; | ||
2059 | return timeout < 0 ? 0 : timeout; | ||
2060 | } | ||
2061 | |||
2062 | /* Wait until the guest Rx thread has work. | ||
2063 | * | ||
2064 | * The timeout needs to be adjusted based on the current head of the | ||
2065 | * queue (and not just the head at the beginning). In particular, if | ||
2066 | * the queue is initially empty an infinite timeout is used and this | ||
2067 | * needs to be reduced when a skb is queued. | ||
2068 | * | ||
2069 | * This cannot be done with wait_event_timeout() because it only | ||
2070 | * calculates the timeout once. | ||
2071 | */ | ||
2072 | static void xenvif_wait_for_rx_work(struct xenvif_queue *queue) | ||
2073 | { | ||
2074 | DEFINE_WAIT(wait); | ||
2075 | |||
2076 | if (xenvif_have_rx_work(queue)) | ||
2077 | return; | ||
2078 | |||
2079 | for (;;) { | ||
2080 | long ret; | ||
2081 | |||
2082 | prepare_to_wait(&queue->wq, &wait, TASK_INTERRUPTIBLE); | ||
2083 | if (xenvif_have_rx_work(queue)) | ||
2084 | break; | ||
2085 | ret = schedule_timeout(xenvif_rx_queue_timeout(queue)); | ||
2086 | if (!ret) | ||
2087 | break; | ||
2006 | } | 2088 | } |
2089 | finish_wait(&queue->wq, &wait); | ||
2007 | } | 2090 | } |
2008 | 2091 | ||
2009 | int xenvif_kthread_guest_rx(void *data) | 2092 | int xenvif_kthread_guest_rx(void *data) |
2010 | { | 2093 | { |
2011 | struct xenvif_queue *queue = data; | 2094 | struct xenvif_queue *queue = data; |
2012 | struct sk_buff *skb; | 2095 | struct xenvif *vif = queue->vif; |
2013 | 2096 | ||
2014 | while (!kthread_should_stop()) { | 2097 | for (;;) { |
2015 | wait_event_interruptible(queue->wq, | 2098 | xenvif_wait_for_rx_work(queue); |
2016 | rx_work_todo(queue) || | ||
2017 | queue->vif->disabled || | ||
2018 | test_bit(QUEUE_STATUS_RX_PURGE_EVENT, &queue->status) || | ||
2019 | kthread_should_stop()); | ||
2020 | 2099 | ||
2021 | if (kthread_should_stop()) | 2100 | if (kthread_should_stop()) |
2022 | break; | 2101 | break; |
@@ -2028,35 +2107,38 @@ int xenvif_kthread_guest_rx(void *data) | |||
2028 | * context so we defer it here, if this thread is | 2107 | * context so we defer it here, if this thread is |
2029 | * associated with queue 0. | 2108 | * associated with queue 0. |
2030 | */ | 2109 | */ |
2031 | if (unlikely(queue->vif->disabled && queue->id == 0)) { | 2110 | if (unlikely(vif->disabled && queue->id == 0)) { |
2032 | xenvif_carrier_off(queue->vif); | 2111 | xenvif_carrier_off(vif); |
2033 | } else if (unlikely(queue->vif->disabled)) { | 2112 | xenvif_rx_queue_purge(queue); |
2034 | /* kthread_stop() would be called upon this thread soon, | 2113 | continue; |
2035 | * be a bit proactive | ||
2036 | */ | ||
2037 | skb_queue_purge(&queue->rx_queue); | ||
2038 | queue->rx_last_skb_slots = 0; | ||
2039 | } else if (unlikely(test_and_clear_bit(QUEUE_STATUS_RX_PURGE_EVENT, | ||
2040 | &queue->status))) { | ||
2041 | xenvif_rx_purge_event(queue); | ||
2042 | } else if (!netif_carrier_ok(queue->vif->dev)) { | ||
2043 | /* Another queue stalled and turned the carrier off, so | ||
2044 | * purge the internal queue of queues which were not | ||
2045 | * blocked | ||
2046 | */ | ||
2047 | skb_queue_purge(&queue->rx_queue); | ||
2048 | queue->rx_last_skb_slots = 0; | ||
2049 | } | 2114 | } |
2050 | 2115 | ||
2051 | if (!skb_queue_empty(&queue->rx_queue)) | 2116 | if (!skb_queue_empty(&queue->rx_queue)) |
2052 | xenvif_rx_action(queue); | 2117 | xenvif_rx_action(queue); |
2053 | 2118 | ||
2119 | /* If the guest hasn't provided any Rx slots for a | ||
2120 | * while it's probably not responsive, drop the | ||
2121 | * carrier so packets are dropped earlier. | ||
2122 | */ | ||
2123 | if (xenvif_rx_queue_stalled(queue)) | ||
2124 | xenvif_queue_carrier_off(queue); | ||
2125 | else if (xenvif_rx_queue_ready(queue)) | ||
2126 | xenvif_queue_carrier_on(queue); | ||
2127 | |||
2128 | /* Queued packets may have foreign pages from other | ||
2129 | * domains. These cannot be queued indefinitely as | ||
2130 | * this would starve guests of grant refs and transmit | ||
2131 | * slots. | ||
2132 | */ | ||
2133 | xenvif_rx_queue_drop_expired(queue); | ||
2134 | |||
2135 | xenvif_rx_queue_maybe_wake(queue); | ||
2136 | |||
2054 | cond_resched(); | 2137 | cond_resched(); |
2055 | } | 2138 | } |
2056 | 2139 | ||
2057 | /* Bin any remaining skbs */ | 2140 | /* Bin any remaining skbs */ |
2058 | while ((skb = skb_dequeue(&queue->rx_queue)) != NULL) | 2141 | xenvif_rx_queue_purge(queue); |
2059 | dev_kfree_skb(skb); | ||
2060 | 2142 | ||
2061 | return 0; | 2143 | return 0; |
2062 | } | 2144 | } |
@@ -2113,6 +2195,7 @@ static int __init netback_init(void) | |||
2113 | goto failed_init; | 2195 | goto failed_init; |
2114 | 2196 | ||
2115 | rx_drain_timeout_jiffies = msecs_to_jiffies(rx_drain_timeout_msecs); | 2197 | rx_drain_timeout_jiffies = msecs_to_jiffies(rx_drain_timeout_msecs); |
2198 | rx_stall_timeout_jiffies = msecs_to_jiffies(rx_stall_timeout_msecs); | ||
2116 | 2199 | ||
2117 | #ifdef CONFIG_DEBUG_FS | 2200 | #ifdef CONFIG_DEBUG_FS |
2118 | xen_netback_dbg_root = debugfs_create_dir("xen-netback", NULL); | 2201 | xen_netback_dbg_root = debugfs_create_dir("xen-netback", NULL); |
diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c index 8079c31ac5e6..4e56a27f9689 100644 --- a/drivers/net/xen-netback/xenbus.c +++ b/drivers/net/xen-netback/xenbus.c | |||
@@ -52,6 +52,7 @@ static int xenvif_read_io_ring(struct seq_file *m, void *v) | |||
52 | struct xenvif_queue *queue = m->private; | 52 | struct xenvif_queue *queue = m->private; |
53 | struct xen_netif_tx_back_ring *tx_ring = &queue->tx; | 53 | struct xen_netif_tx_back_ring *tx_ring = &queue->tx; |
54 | struct xen_netif_rx_back_ring *rx_ring = &queue->rx; | 54 | struct xen_netif_rx_back_ring *rx_ring = &queue->rx; |
55 | struct netdev_queue *dev_queue; | ||
55 | 56 | ||
56 | if (tx_ring->sring) { | 57 | if (tx_ring->sring) { |
57 | struct xen_netif_tx_sring *sring = tx_ring->sring; | 58 | struct xen_netif_tx_sring *sring = tx_ring->sring; |
@@ -112,6 +113,13 @@ static int xenvif_read_io_ring(struct seq_file *m, void *v) | |||
112 | queue->credit_timeout.expires, | 113 | queue->credit_timeout.expires, |
113 | jiffies); | 114 | jiffies); |
114 | 115 | ||
116 | dev_queue = netdev_get_tx_queue(queue->vif->dev, queue->id); | ||
117 | |||
118 | seq_printf(m, "\nRx internal queue: len %u max %u pkts %u %s\n", | ||
119 | queue->rx_queue_len, queue->rx_queue_max, | ||
120 | skb_queue_len(&queue->rx_queue), | ||
121 | netif_tx_queue_stopped(dev_queue) ? "stopped" : "running"); | ||
122 | |||
115 | return 0; | 123 | return 0; |
116 | } | 124 | } |
117 | 125 | ||
@@ -703,6 +711,7 @@ static void connect(struct backend_info *be) | |||
703 | be->vif->queues = vzalloc(requested_num_queues * | 711 | be->vif->queues = vzalloc(requested_num_queues * |
704 | sizeof(struct xenvif_queue)); | 712 | sizeof(struct xenvif_queue)); |
705 | be->vif->num_queues = requested_num_queues; | 713 | be->vif->num_queues = requested_num_queues; |
714 | be->vif->stalled_queues = requested_num_queues; | ||
706 | 715 | ||
707 | for (queue_index = 0; queue_index < requested_num_queues; ++queue_index) { | 716 | for (queue_index = 0; queue_index < requested_num_queues; ++queue_index) { |
708 | queue = &be->vif->queues[queue_index]; | 717 | queue = &be->vif->queues[queue_index]; |
@@ -873,15 +882,10 @@ static int read_xenbus_vif_flags(struct backend_info *be) | |||
873 | if (!rx_copy) | 882 | if (!rx_copy) |
874 | return -EOPNOTSUPP; | 883 | return -EOPNOTSUPP; |
875 | 884 | ||
876 | if (vif->dev->tx_queue_len != 0) { | 885 | if (xenbus_scanf(XBT_NIL, dev->otherend, |
877 | if (xenbus_scanf(XBT_NIL, dev->otherend, | 886 | "feature-rx-notify", "%d", &val) < 0 || val == 0) { |
878 | "feature-rx-notify", "%d", &val) < 0) | 887 | xenbus_dev_fatal(dev, -EINVAL, "feature-rx-notify is mandatory"); |
879 | val = 0; | 888 | return -EINVAL; |
880 | if (val) | ||
881 | vif->can_queue = 1; | ||
882 | else | ||
883 | /* Must be non-zero for pfifo_fast to work. */ | ||
884 | vif->dev->tx_queue_len = 1; | ||
885 | } | 889 | } |
886 | 890 | ||
887 | if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-sg", | 891 | if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-sg", |
diff --git a/drivers/of/base.c b/drivers/of/base.c index 2305dc0382bc..3823edf2d012 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c | |||
@@ -1280,52 +1280,6 @@ int of_property_read_string(struct device_node *np, const char *propname, | |||
1280 | EXPORT_SYMBOL_GPL(of_property_read_string); | 1280 | EXPORT_SYMBOL_GPL(of_property_read_string); |
1281 | 1281 | ||
1282 | /** | 1282 | /** |
1283 | * of_property_read_string_index - Find and read a string from a multiple | ||
1284 | * strings property. | ||
1285 | * @np: device node from which the property value is to be read. | ||
1286 | * @propname: name of the property to be searched. | ||
1287 | * @index: index of the string in the list of strings | ||
1288 | * @out_string: pointer to null terminated return string, modified only if | ||
1289 | * return value is 0. | ||
1290 | * | ||
1291 | * Search for a property in a device tree node and retrieve a null | ||
1292 | * terminated string value (pointer to data, not a copy) in the list of strings | ||
1293 | * contained in that property. | ||
1294 | * Returns 0 on success, -EINVAL if the property does not exist, -ENODATA if | ||
1295 | * property does not have a value, and -EILSEQ if the string is not | ||
1296 | * null-terminated within the length of the property data. | ||
1297 | * | ||
1298 | * The out_string pointer is modified only if a valid string can be decoded. | ||
1299 | */ | ||
1300 | int of_property_read_string_index(struct device_node *np, const char *propname, | ||
1301 | int index, const char **output) | ||
1302 | { | ||
1303 | struct property *prop = of_find_property(np, propname, NULL); | ||
1304 | int i = 0; | ||
1305 | size_t l = 0, total = 0; | ||
1306 | const char *p; | ||
1307 | |||
1308 | if (!prop) | ||
1309 | return -EINVAL; | ||
1310 | if (!prop->value) | ||
1311 | return -ENODATA; | ||
1312 | if (strnlen(prop->value, prop->length) >= prop->length) | ||
1313 | return -EILSEQ; | ||
1314 | |||
1315 | p = prop->value; | ||
1316 | |||
1317 | for (i = 0; total < prop->length; total += l, p += l) { | ||
1318 | l = strlen(p) + 1; | ||
1319 | if (i++ == index) { | ||
1320 | *output = p; | ||
1321 | return 0; | ||
1322 | } | ||
1323 | } | ||
1324 | return -ENODATA; | ||
1325 | } | ||
1326 | EXPORT_SYMBOL_GPL(of_property_read_string_index); | ||
1327 | |||
1328 | /** | ||
1329 | * of_property_match_string() - Find string in a list and return index | 1283 | * of_property_match_string() - Find string in a list and return index |
1330 | * @np: pointer to node containing string list property | 1284 | * @np: pointer to node containing string list property |
1331 | * @propname: string list property name | 1285 | * @propname: string list property name |
@@ -1351,7 +1305,7 @@ int of_property_match_string(struct device_node *np, const char *propname, | |||
1351 | end = p + prop->length; | 1305 | end = p + prop->length; |
1352 | 1306 | ||
1353 | for (i = 0; p < end; i++, p += l) { | 1307 | for (i = 0; p < end; i++, p += l) { |
1354 | l = strlen(p) + 1; | 1308 | l = strnlen(p, end - p) + 1; |
1355 | if (p + l > end) | 1309 | if (p + l > end) |
1356 | return -EILSEQ; | 1310 | return -EILSEQ; |
1357 | pr_debug("comparing %s with %s\n", string, p); | 1311 | pr_debug("comparing %s with %s\n", string, p); |
@@ -1363,39 +1317,41 @@ int of_property_match_string(struct device_node *np, const char *propname, | |||
1363 | EXPORT_SYMBOL_GPL(of_property_match_string); | 1317 | EXPORT_SYMBOL_GPL(of_property_match_string); |
1364 | 1318 | ||
1365 | /** | 1319 | /** |
1366 | * of_property_count_strings - Find and return the number of strings from a | 1320 | * of_property_read_string_util() - Utility helper for parsing string properties |
1367 | * multiple strings property. | ||
1368 | * @np: device node from which the property value is to be read. | 1321 | * @np: device node from which the property value is to be read. |
1369 | * @propname: name of the property to be searched. | 1322 | * @propname: name of the property to be searched. |
1323 | * @out_strs: output array of string pointers. | ||
1324 | * @sz: number of array elements to read. | ||
1325 | * @skip: Number of strings to skip over at beginning of list. | ||
1370 | * | 1326 | * |
1371 | * Search for a property in a device tree node and retrieve the number of null | 1327 | * Don't call this function directly. It is a utility helper for the |
1372 | * terminated string contain in it. Returns the number of strings on | 1328 | * of_property_read_string*() family of functions. |
1373 | * success, -EINVAL if the property does not exist, -ENODATA if property | ||
1374 | * does not have a value, and -EILSEQ if the string is not null-terminated | ||
1375 | * within the length of the property data. | ||
1376 | */ | 1329 | */ |
1377 | int of_property_count_strings(struct device_node *np, const char *propname) | 1330 | int of_property_read_string_helper(struct device_node *np, const char *propname, |
1331 | const char **out_strs, size_t sz, int skip) | ||
1378 | { | 1332 | { |
1379 | struct property *prop = of_find_property(np, propname, NULL); | 1333 | struct property *prop = of_find_property(np, propname, NULL); |
1380 | int i = 0; | 1334 | int l = 0, i = 0; |
1381 | size_t l = 0, total = 0; | 1335 | const char *p, *end; |
1382 | const char *p; | ||
1383 | 1336 | ||
1384 | if (!prop) | 1337 | if (!prop) |
1385 | return -EINVAL; | 1338 | return -EINVAL; |
1386 | if (!prop->value) | 1339 | if (!prop->value) |
1387 | return -ENODATA; | 1340 | return -ENODATA; |
1388 | if (strnlen(prop->value, prop->length) >= prop->length) | ||
1389 | return -EILSEQ; | ||
1390 | |||
1391 | p = prop->value; | 1341 | p = prop->value; |
1342 | end = p + prop->length; | ||
1392 | 1343 | ||
1393 | for (i = 0; total < prop->length; total += l, p += l, i++) | 1344 | for (i = 0; p < end && (!out_strs || i < skip + sz); i++, p += l) { |
1394 | l = strlen(p) + 1; | 1345 | l = strnlen(p, end - p) + 1; |
1395 | 1346 | if (p + l > end) | |
1396 | return i; | 1347 | return -EILSEQ; |
1348 | if (out_strs && i >= skip) | ||
1349 | *out_strs++ = p; | ||
1350 | } | ||
1351 | i -= skip; | ||
1352 | return i <= 0 ? -ENODATA : i; | ||
1397 | } | 1353 | } |
1398 | EXPORT_SYMBOL_GPL(of_property_count_strings); | 1354 | EXPORT_SYMBOL_GPL(of_property_read_string_helper); |
1399 | 1355 | ||
1400 | void of_print_phandle_args(const char *msg, const struct of_phandle_args *args) | 1356 | void of_print_phandle_args(const char *msg, const struct of_phandle_args *args) |
1401 | { | 1357 | { |
diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c index 59fb12e84e6b..dc566b38645f 100644 --- a/drivers/of/of_reserved_mem.c +++ b/drivers/of/of_reserved_mem.c | |||
@@ -243,23 +243,27 @@ static inline struct reserved_mem *__find_rmem(struct device_node *node) | |||
243 | * This function assign memory region pointed by "memory-region" device tree | 243 | * This function assign memory region pointed by "memory-region" device tree |
244 | * property to the given device. | 244 | * property to the given device. |
245 | */ | 245 | */ |
246 | void of_reserved_mem_device_init(struct device *dev) | 246 | int of_reserved_mem_device_init(struct device *dev) |
247 | { | 247 | { |
248 | struct reserved_mem *rmem; | 248 | struct reserved_mem *rmem; |
249 | struct device_node *np; | 249 | struct device_node *np; |
250 | int ret; | ||
250 | 251 | ||
251 | np = of_parse_phandle(dev->of_node, "memory-region", 0); | 252 | np = of_parse_phandle(dev->of_node, "memory-region", 0); |
252 | if (!np) | 253 | if (!np) |
253 | return; | 254 | return -ENODEV; |
254 | 255 | ||
255 | rmem = __find_rmem(np); | 256 | rmem = __find_rmem(np); |
256 | of_node_put(np); | 257 | of_node_put(np); |
257 | 258 | ||
258 | if (!rmem || !rmem->ops || !rmem->ops->device_init) | 259 | if (!rmem || !rmem->ops || !rmem->ops->device_init) |
259 | return; | 260 | return -EINVAL; |
261 | |||
262 | ret = rmem->ops->device_init(rmem, dev); | ||
263 | if (ret == 0) | ||
264 | dev_info(dev, "assigned reserved memory node %s\n", rmem->name); | ||
260 | 265 | ||
261 | rmem->ops->device_init(rmem, dev); | 266 | return ret; |
262 | dev_info(dev, "assigned reserved memory node %s\n", rmem->name); | ||
263 | } | 267 | } |
264 | 268 | ||
265 | /** | 269 | /** |
diff --git a/drivers/of/selftest.c b/drivers/of/selftest.c index 78001270a598..11b873c54a77 100644 --- a/drivers/of/selftest.c +++ b/drivers/of/selftest.c | |||
@@ -339,8 +339,9 @@ static void __init of_selftest_parse_phandle_with_args(void) | |||
339 | selftest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); | 339 | selftest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc); |
340 | } | 340 | } |
341 | 341 | ||
342 | static void __init of_selftest_property_match_string(void) | 342 | static void __init of_selftest_property_string(void) |
343 | { | 343 | { |
344 | const char *strings[4]; | ||
344 | struct device_node *np; | 345 | struct device_node *np; |
345 | int rc; | 346 | int rc; |
346 | 347 | ||
@@ -357,13 +358,66 @@ static void __init of_selftest_property_match_string(void) | |||
357 | rc = of_property_match_string(np, "phandle-list-names", "third"); | 358 | rc = of_property_match_string(np, "phandle-list-names", "third"); |
358 | selftest(rc == 2, "third expected:0 got:%i\n", rc); | 359 | selftest(rc == 2, "third expected:0 got:%i\n", rc); |
359 | rc = of_property_match_string(np, "phandle-list-names", "fourth"); | 360 | rc = of_property_match_string(np, "phandle-list-names", "fourth"); |
360 | selftest(rc == -ENODATA, "unmatched string; rc=%i", rc); | 361 | selftest(rc == -ENODATA, "unmatched string; rc=%i\n", rc); |
361 | rc = of_property_match_string(np, "missing-property", "blah"); | 362 | rc = of_property_match_string(np, "missing-property", "blah"); |
362 | selftest(rc == -EINVAL, "missing property; rc=%i", rc); | 363 | selftest(rc == -EINVAL, "missing property; rc=%i\n", rc); |
363 | rc = of_property_match_string(np, "empty-property", "blah"); | 364 | rc = of_property_match_string(np, "empty-property", "blah"); |
364 | selftest(rc == -ENODATA, "empty property; rc=%i", rc); | 365 | selftest(rc == -ENODATA, "empty property; rc=%i\n", rc); |
365 | rc = of_property_match_string(np, "unterminated-string", "blah"); | 366 | rc = of_property_match_string(np, "unterminated-string", "blah"); |
366 | selftest(rc == -EILSEQ, "unterminated string; rc=%i", rc); | 367 | selftest(rc == -EILSEQ, "unterminated string; rc=%i\n", rc); |
368 | |||
369 | /* of_property_count_strings() tests */ | ||
370 | rc = of_property_count_strings(np, "string-property"); | ||
371 | selftest(rc == 1, "Incorrect string count; rc=%i\n", rc); | ||
372 | rc = of_property_count_strings(np, "phandle-list-names"); | ||
373 | selftest(rc == 3, "Incorrect string count; rc=%i\n", rc); | ||
374 | rc = of_property_count_strings(np, "unterminated-string"); | ||
375 | selftest(rc == -EILSEQ, "unterminated string; rc=%i\n", rc); | ||
376 | rc = of_property_count_strings(np, "unterminated-string-list"); | ||
377 | selftest(rc == -EILSEQ, "unterminated string array; rc=%i\n", rc); | ||
378 | |||
379 | /* of_property_read_string_index() tests */ | ||
380 | rc = of_property_read_string_index(np, "string-property", 0, strings); | ||
381 | selftest(rc == 0 && !strcmp(strings[0], "foobar"), "of_property_read_string_index() failure; rc=%i\n", rc); | ||
382 | strings[0] = NULL; | ||
383 | rc = of_property_read_string_index(np, "string-property", 1, strings); | ||
384 | selftest(rc == -ENODATA && strings[0] == NULL, "of_property_read_string_index() failure; rc=%i\n", rc); | ||
385 | rc = of_property_read_string_index(np, "phandle-list-names", 0, strings); | ||
386 | selftest(rc == 0 && !strcmp(strings[0], "first"), "of_property_read_string_index() failure; rc=%i\n", rc); | ||
387 | rc = of_property_read_string_index(np, "phandle-list-names", 1, strings); | ||
388 | selftest(rc == 0 && !strcmp(strings[0], "second"), "of_property_read_string_index() failure; rc=%i\n", rc); | ||
389 | rc = of_property_read_string_index(np, "phandle-list-names", 2, strings); | ||
390 | selftest(rc == 0 && !strcmp(strings[0], "third"), "of_property_read_string_index() failure; rc=%i\n", rc); | ||
391 | strings[0] = NULL; | ||
392 | rc = of_property_read_string_index(np, "phandle-list-names", 3, strings); | ||
393 | selftest(rc == -ENODATA && strings[0] == NULL, "of_property_read_string_index() failure; rc=%i\n", rc); | ||
394 | strings[0] = NULL; | ||
395 | rc = of_property_read_string_index(np, "unterminated-string", 0, strings); | ||
396 | selftest(rc == -EILSEQ && strings[0] == NULL, "of_property_read_string_index() failure; rc=%i\n", rc); | ||
397 | rc = of_property_read_string_index(np, "unterminated-string-list", 0, strings); | ||
398 | selftest(rc == 0 && !strcmp(strings[0], "first"), "of_property_read_string_index() failure; rc=%i\n", rc); | ||
399 | strings[0] = NULL; | ||
400 | rc = of_property_read_string_index(np, "unterminated-string-list", 2, strings); /* should fail */ | ||
401 | selftest(rc == -EILSEQ && strings[0] == NULL, "of_property_read_string_index() failure; rc=%i\n", rc); | ||
402 | strings[1] = NULL; | ||
403 | |||
404 | /* of_property_read_string_array() tests */ | ||
405 | rc = of_property_read_string_array(np, "string-property", strings, 4); | ||
406 | selftest(rc == 1, "Incorrect string count; rc=%i\n", rc); | ||
407 | rc = of_property_read_string_array(np, "phandle-list-names", strings, 4); | ||
408 | selftest(rc == 3, "Incorrect string count; rc=%i\n", rc); | ||
409 | rc = of_property_read_string_array(np, "unterminated-string", strings, 4); | ||
410 | selftest(rc == -EILSEQ, "unterminated string; rc=%i\n", rc); | ||
411 | /* -- An incorrectly formed string should cause a failure */ | ||
412 | rc = of_property_read_string_array(np, "unterminated-string-list", strings, 4); | ||
413 | selftest(rc == -EILSEQ, "unterminated string array; rc=%i\n", rc); | ||
414 | /* -- parsing the correctly formed strings should still work: */ | ||
415 | strings[2] = NULL; | ||
416 | rc = of_property_read_string_array(np, "unterminated-string-list", strings, 2); | ||
417 | selftest(rc == 2 && strings[2] == NULL, "of_property_read_string_array() failure; rc=%i\n", rc); | ||
418 | strings[1] = NULL; | ||
419 | rc = of_property_read_string_array(np, "phandle-list-names", strings, 1); | ||
420 | selftest(rc == 1 && strings[1] == NULL, "Overwrote end of string array; rc=%i, str='%s'\n", rc, strings[1]); | ||
367 | } | 421 | } |
368 | 422 | ||
369 | #define propcmp(p1, p2) (((p1)->length == (p2)->length) && \ | 423 | #define propcmp(p1, p2) (((p1)->length == (p2)->length) && \ |
@@ -881,7 +935,7 @@ static int __init of_selftest(void) | |||
881 | of_selftest_find_node_by_name(); | 935 | of_selftest_find_node_by_name(); |
882 | of_selftest_dynamic(); | 936 | of_selftest_dynamic(); |
883 | of_selftest_parse_phandle_with_args(); | 937 | of_selftest_parse_phandle_with_args(); |
884 | of_selftest_property_match_string(); | 938 | of_selftest_property_string(); |
885 | of_selftest_property_copy(); | 939 | of_selftest_property_copy(); |
886 | of_selftest_changeset(); | 940 | of_selftest_changeset(); |
887 | of_selftest_parse_interrupts(); | 941 | of_selftest_parse_interrupts(); |
diff --git a/drivers/of/testcase-data/tests-phandle.dtsi b/drivers/of/testcase-data/tests-phandle.dtsi index ce0fe083d406..5b1527e8a7fb 100644 --- a/drivers/of/testcase-data/tests-phandle.dtsi +++ b/drivers/of/testcase-data/tests-phandle.dtsi | |||
@@ -39,7 +39,9 @@ | |||
39 | phandle-list-bad-args = <&provider2 1 0>, | 39 | phandle-list-bad-args = <&provider2 1 0>, |
40 | <&provider3 0>; | 40 | <&provider3 0>; |
41 | empty-property; | 41 | empty-property; |
42 | string-property = "foobar"; | ||
42 | unterminated-string = [40 41 42 43]; | 43 | unterminated-string = [40 41 42 43]; |
44 | unterminated-string-list = "first", "second", [40 41 42 43]; | ||
43 | }; | 45 | }; |
44 | }; | 46 | }; |
45 | }; | 47 | }; |
diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c index 233fe8a88264..69202d1eb8fb 100644 --- a/drivers/pci/host/pci-imx6.c +++ b/drivers/pci/host/pci-imx6.c | |||
@@ -275,15 +275,22 @@ static int imx6_pcie_deassert_core_reset(struct pcie_port *pp) | |||
275 | goto err_pcie; | 275 | goto err_pcie; |
276 | } | 276 | } |
277 | 277 | ||
278 | /* allow the clocks to stabilize */ | ||
279 | usleep_range(200, 500); | ||
280 | |||
281 | /* power up core phy and enable ref clock */ | 278 | /* power up core phy and enable ref clock */ |
282 | regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, | 279 | regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, |
283 | IMX6Q_GPR1_PCIE_TEST_PD, 0 << 18); | 280 | IMX6Q_GPR1_PCIE_TEST_PD, 0 << 18); |
281 | /* | ||
282 | * the async reset input need ref clock to sync internally, | ||
283 | * when the ref clock comes after reset, internal synced | ||
284 | * reset time is too short, cannot meet the requirement. | ||
285 | * add one ~10us delay here. | ||
286 | */ | ||
287 | udelay(10); | ||
284 | regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, | 288 | regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, |
285 | IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16); | 289 | IMX6Q_GPR1_PCIE_REF_CLK_EN, 1 << 16); |
286 | 290 | ||
291 | /* allow the clocks to stabilize */ | ||
292 | usleep_range(200, 500); | ||
293 | |||
287 | /* Some boards don't have PCIe reset GPIO. */ | 294 | /* Some boards don't have PCIe reset GPIO. */ |
288 | if (gpio_is_valid(imx6_pcie->reset_gpio)) { | 295 | if (gpio_is_valid(imx6_pcie->reset_gpio)) { |
289 | gpio_set_value(imx6_pcie->reset_gpio, 0); | 296 | gpio_set_value(imx6_pcie->reset_gpio, 0); |
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c index 3a5e7e28b874..07aa722bb12c 100644 --- a/drivers/pci/hotplug/pciehp_core.c +++ b/drivers/pci/hotplug/pciehp_core.c | |||
@@ -262,13 +262,6 @@ static int pciehp_probe(struct pcie_device *dev) | |||
262 | goto err_out_none; | 262 | goto err_out_none; |
263 | } | 263 | } |
264 | 264 | ||
265 | if (!dev->port->subordinate) { | ||
266 | /* Can happen if we run out of bus numbers during probe */ | ||
267 | dev_err(&dev->device, | ||
268 | "Hotplug bridge without secondary bus, ignoring\n"); | ||
269 | goto err_out_none; | ||
270 | } | ||
271 | |||
272 | ctrl = pcie_init(dev); | 265 | ctrl = pcie_init(dev); |
273 | if (!ctrl) { | 266 | if (!ctrl) { |
274 | dev_err(&dev->device, "Controller initialization failed\n"); | 267 | dev_err(&dev->device, "Controller initialization failed\n"); |
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index 92b6d9ab00e4..2c6643fdc0cf 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c | |||
@@ -185,7 +185,7 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, | |||
185 | } | 185 | } |
186 | static DEVICE_ATTR_RO(modalias); | 186 | static DEVICE_ATTR_RO(modalias); |
187 | 187 | ||
188 | static ssize_t enabled_store(struct device *dev, struct device_attribute *attr, | 188 | static ssize_t enable_store(struct device *dev, struct device_attribute *attr, |
189 | const char *buf, size_t count) | 189 | const char *buf, size_t count) |
190 | { | 190 | { |
191 | struct pci_dev *pdev = to_pci_dev(dev); | 191 | struct pci_dev *pdev = to_pci_dev(dev); |
@@ -210,7 +210,7 @@ static ssize_t enabled_store(struct device *dev, struct device_attribute *attr, | |||
210 | return result < 0 ? result : count; | 210 | return result < 0 ? result : count; |
211 | } | 211 | } |
212 | 212 | ||
213 | static ssize_t enabled_show(struct device *dev, struct device_attribute *attr, | 213 | static ssize_t enable_show(struct device *dev, struct device_attribute *attr, |
214 | char *buf) | 214 | char *buf) |
215 | { | 215 | { |
216 | struct pci_dev *pdev; | 216 | struct pci_dev *pdev; |
@@ -218,7 +218,7 @@ static ssize_t enabled_show(struct device *dev, struct device_attribute *attr, | |||
218 | pdev = to_pci_dev(dev); | 218 | pdev = to_pci_dev(dev); |
219 | return sprintf(buf, "%u\n", atomic_read(&pdev->enable_cnt)); | 219 | return sprintf(buf, "%u\n", atomic_read(&pdev->enable_cnt)); |
220 | } | 220 | } |
221 | static DEVICE_ATTR_RW(enabled); | 221 | static DEVICE_ATTR_RW(enable); |
222 | 222 | ||
223 | #ifdef CONFIG_NUMA | 223 | #ifdef CONFIG_NUMA |
224 | static ssize_t numa_node_show(struct device *dev, struct device_attribute *attr, | 224 | static ssize_t numa_node_show(struct device *dev, struct device_attribute *attr, |
@@ -563,7 +563,7 @@ static struct attribute *pci_dev_attrs[] = { | |||
563 | #endif | 563 | #endif |
564 | &dev_attr_dma_mask_bits.attr, | 564 | &dev_attr_dma_mask_bits.attr, |
565 | &dev_attr_consistent_dma_mask_bits.attr, | 565 | &dev_attr_consistent_dma_mask_bits.attr, |
566 | &dev_attr_enabled.attr, | 566 | &dev_attr_enable.attr, |
567 | &dev_attr_broken_parity_status.attr, | 567 | &dev_attr_broken_parity_status.attr, |
568 | &dev_attr_msi_bus.attr, | 568 | &dev_attr_msi_bus.attr, |
569 | #if defined(CONFIG_PM_RUNTIME) && defined(CONFIG_ACPI) | 569 | #if defined(CONFIG_PM_RUNTIME) && defined(CONFIG_ACPI) |
diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c index 8c842980834a..f091576b6449 100644 --- a/drivers/phy/phy-omap-usb2.c +++ b/drivers/phy/phy-omap-usb2.c | |||
@@ -258,14 +258,16 @@ static int omap_usb2_probe(struct platform_device *pdev) | |||
258 | otg->phy = &phy->phy; | 258 | otg->phy = &phy->phy; |
259 | 259 | ||
260 | platform_set_drvdata(pdev, phy); | 260 | platform_set_drvdata(pdev, phy); |
261 | pm_runtime_enable(phy->dev); | ||
261 | 262 | ||
262 | generic_phy = devm_phy_create(phy->dev, NULL, &ops, NULL); | 263 | generic_phy = devm_phy_create(phy->dev, NULL, &ops, NULL); |
263 | if (IS_ERR(generic_phy)) | 264 | if (IS_ERR(generic_phy)) { |
265 | pm_runtime_disable(phy->dev); | ||
264 | return PTR_ERR(generic_phy); | 266 | return PTR_ERR(generic_phy); |
267 | } | ||
265 | 268 | ||
266 | phy_set_drvdata(generic_phy, phy); | 269 | phy_set_drvdata(generic_phy, phy); |
267 | 270 | ||
268 | pm_runtime_enable(phy->dev); | ||
269 | phy_provider = devm_of_phy_provider_register(phy->dev, | 271 | phy_provider = devm_of_phy_provider_register(phy->dev, |
270 | of_phy_simple_xlate); | 272 | of_phy_simple_xlate); |
271 | if (IS_ERR(phy_provider)) { | 273 | if (IS_ERR(phy_provider)) { |
diff --git a/drivers/pinctrl/pinctrl-baytrail.c b/drivers/pinctrl/pinctrl-baytrail.c index e12e5b07f6d7..9dc38140194b 100644 --- a/drivers/pinctrl/pinctrl-baytrail.c +++ b/drivers/pinctrl/pinctrl-baytrail.c | |||
@@ -227,10 +227,14 @@ static int byt_irq_type(struct irq_data *d, unsigned type) | |||
227 | spin_lock_irqsave(&vg->lock, flags); | 227 | spin_lock_irqsave(&vg->lock, flags); |
228 | value = readl(reg); | 228 | value = readl(reg); |
229 | 229 | ||
230 | WARN(value & BYT_DIRECT_IRQ_EN, | ||
231 | "Bad pad config for io mode, force direct_irq_en bit clearing"); | ||
232 | |||
230 | /* For level trigges the BYT_TRIG_POS and BYT_TRIG_NEG bits | 233 | /* For level trigges the BYT_TRIG_POS and BYT_TRIG_NEG bits |
231 | * are used to indicate high and low level triggering | 234 | * are used to indicate high and low level triggering |
232 | */ | 235 | */ |
233 | value &= ~(BYT_TRIG_POS | BYT_TRIG_NEG | BYT_TRIG_LVL); | 236 | value &= ~(BYT_DIRECT_IRQ_EN | BYT_TRIG_POS | BYT_TRIG_NEG | |
237 | BYT_TRIG_LVL); | ||
234 | 238 | ||
235 | switch (type) { | 239 | switch (type) { |
236 | case IRQ_TYPE_LEVEL_HIGH: | 240 | case IRQ_TYPE_LEVEL_HIGH: |
@@ -318,7 +322,7 @@ static int byt_gpio_direction_output(struct gpio_chip *chip, | |||
318 | "Potential Error: Setting GPIO with direct_irq_en to output"); | 322 | "Potential Error: Setting GPIO with direct_irq_en to output"); |
319 | 323 | ||
320 | reg_val = readl(reg) | BYT_DIR_MASK; | 324 | reg_val = readl(reg) | BYT_DIR_MASK; |
321 | reg_val &= ~BYT_OUTPUT_EN; | 325 | reg_val &= ~(BYT_OUTPUT_EN | BYT_INPUT_EN); |
322 | 326 | ||
323 | if (value) | 327 | if (value) |
324 | writel(reg_val | BYT_LEVEL, reg); | 328 | writel(reg_val | BYT_LEVEL, reg); |
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig index 4dcfb7116a04..a2eabe6ff9ad 100644 --- a/drivers/platform/x86/Kconfig +++ b/drivers/platform/x86/Kconfig | |||
@@ -202,6 +202,7 @@ config TC1100_WMI | |||
202 | config HP_ACCEL | 202 | config HP_ACCEL |
203 | tristate "HP laptop accelerometer" | 203 | tristate "HP laptop accelerometer" |
204 | depends on INPUT && ACPI | 204 | depends on INPUT && ACPI |
205 | depends on SERIO_I8042 | ||
205 | select SENSORS_LIS3LV02D | 206 | select SENSORS_LIS3LV02D |
206 | select NEW_LEDS | 207 | select NEW_LEDS |
207 | select LEDS_CLASS | 208 | select LEDS_CLASS |
diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index 96a0b75c52c9..26c4fd1394da 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c | |||
@@ -579,6 +579,17 @@ static const struct dmi_system_id video_vendor_dmi_table[] __initconst = { | |||
579 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5741"), | 579 | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5741"), |
580 | }, | 580 | }, |
581 | }, | 581 | }, |
582 | { | ||
583 | /* | ||
584 | * Note no video_set_backlight_video_vendor, we must use the | ||
585 | * acer interface, as there is no native backlight interface. | ||
586 | */ | ||
587 | .ident = "Acer KAV80", | ||
588 | .matches = { | ||
589 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | ||
590 | DMI_MATCH(DMI_PRODUCT_NAME, "KAV80"), | ||
591 | }, | ||
592 | }, | ||
582 | {} | 593 | {} |
583 | }; | 594 | }; |
584 | 595 | ||
diff --git a/drivers/platform/x86/asus-nb-wmi.c b/drivers/platform/x86/asus-nb-wmi.c index 3a4951f46065..c1a6cd66af42 100644 --- a/drivers/platform/x86/asus-nb-wmi.c +++ b/drivers/platform/x86/asus-nb-wmi.c | |||
@@ -182,6 +182,15 @@ static const struct dmi_system_id asus_quirks[] = { | |||
182 | }, | 182 | }, |
183 | { | 183 | { |
184 | .callback = dmi_matched, | 184 | .callback = dmi_matched, |
185 | .ident = "ASUSTeK COMPUTER INC. X550VB", | ||
186 | .matches = { | ||
187 | DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), | ||
188 | DMI_MATCH(DMI_PRODUCT_NAME, "X550VB"), | ||
189 | }, | ||
190 | .driver_data = &quirk_asus_wapf4, | ||
191 | }, | ||
192 | { | ||
193 | .callback = dmi_matched, | ||
185 | .ident = "ASUSTeK COMPUTER INC. X55A", | 194 | .ident = "ASUSTeK COMPUTER INC. X55A", |
186 | .matches = { | 195 | .matches = { |
187 | DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), | 196 | DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), |
diff --git a/drivers/platform/x86/hp_accel.c b/drivers/platform/x86/hp_accel.c index 13e14ec1d3d7..6bec745b6b92 100644 --- a/drivers/platform/x86/hp_accel.c +++ b/drivers/platform/x86/hp_accel.c | |||
@@ -37,6 +37,8 @@ | |||
37 | #include <linux/leds.h> | 37 | #include <linux/leds.h> |
38 | #include <linux/atomic.h> | 38 | #include <linux/atomic.h> |
39 | #include <linux/acpi.h> | 39 | #include <linux/acpi.h> |
40 | #include <linux/i8042.h> | ||
41 | #include <linux/serio.h> | ||
40 | #include "../../misc/lis3lv02d/lis3lv02d.h" | 42 | #include "../../misc/lis3lv02d/lis3lv02d.h" |
41 | 43 | ||
42 | #define DRIVER_NAME "hp_accel" | 44 | #define DRIVER_NAME "hp_accel" |
@@ -73,6 +75,13 @@ static inline void delayed_sysfs_set(struct led_classdev *led_cdev, | |||
73 | 75 | ||
74 | /* HP-specific accelerometer driver ------------------------------------ */ | 76 | /* HP-specific accelerometer driver ------------------------------------ */ |
75 | 77 | ||
78 | /* e0 25, e0 26, e0 27, e0 28 are scan codes that the accelerometer with acpi id | ||
79 | * HPQ6000 sends through the keyboard bus */ | ||
80 | #define ACCEL_1 0x25 | ||
81 | #define ACCEL_2 0x26 | ||
82 | #define ACCEL_3 0x27 | ||
83 | #define ACCEL_4 0x28 | ||
84 | |||
76 | /* For automatic insertion of the module */ | 85 | /* For automatic insertion of the module */ |
77 | static const struct acpi_device_id lis3lv02d_device_ids[] = { | 86 | static const struct acpi_device_id lis3lv02d_device_ids[] = { |
78 | {"HPQ0004", 0}, /* HP Mobile Data Protection System PNP */ | 87 | {"HPQ0004", 0}, /* HP Mobile Data Protection System PNP */ |
@@ -294,6 +303,35 @@ static void lis3lv02d_enum_resources(struct acpi_device *device) | |||
294 | printk(KERN_DEBUG DRIVER_NAME ": Error getting resources\n"); | 303 | printk(KERN_DEBUG DRIVER_NAME ": Error getting resources\n"); |
295 | } | 304 | } |
296 | 305 | ||
306 | static bool hp_accel_i8042_filter(unsigned char data, unsigned char str, | ||
307 | struct serio *port) | ||
308 | { | ||
309 | static bool extended; | ||
310 | |||
311 | if (str & I8042_STR_AUXDATA) | ||
312 | return false; | ||
313 | |||
314 | if (data == 0xe0) { | ||
315 | extended = true; | ||
316 | return true; | ||
317 | } else if (unlikely(extended)) { | ||
318 | extended = false; | ||
319 | |||
320 | switch (data) { | ||
321 | case ACCEL_1: | ||
322 | case ACCEL_2: | ||
323 | case ACCEL_3: | ||
324 | case ACCEL_4: | ||
325 | return true; | ||
326 | default: | ||
327 | serio_interrupt(port, 0xe0, 0); | ||
328 | return false; | ||
329 | } | ||
330 | } | ||
331 | |||
332 | return false; | ||
333 | } | ||
334 | |||
297 | static int lis3lv02d_add(struct acpi_device *device) | 335 | static int lis3lv02d_add(struct acpi_device *device) |
298 | { | 336 | { |
299 | int ret; | 337 | int ret; |
@@ -326,6 +364,11 @@ static int lis3lv02d_add(struct acpi_device *device) | |||
326 | if (ret) | 364 | if (ret) |
327 | return ret; | 365 | return ret; |
328 | 366 | ||
367 | /* filter to remove HPQ6000 accelerometer data | ||
368 | * from keyboard bus stream */ | ||
369 | if (strstr(dev_name(&device->dev), "HPQ6000")) | ||
370 | i8042_install_filter(hp_accel_i8042_filter); | ||
371 | |||
329 | INIT_WORK(&hpled_led.work, delayed_set_status_worker); | 372 | INIT_WORK(&hpled_led.work, delayed_set_status_worker); |
330 | ret = led_classdev_register(NULL, &hpled_led.led_classdev); | 373 | ret = led_classdev_register(NULL, &hpled_led.led_classdev); |
331 | if (ret) { | 374 | if (ret) { |
@@ -343,6 +386,7 @@ static int lis3lv02d_remove(struct acpi_device *device) | |||
343 | if (!device) | 386 | if (!device) |
344 | return -EINVAL; | 387 | return -EINVAL; |
345 | 388 | ||
389 | i8042_remove_filter(hp_accel_i8042_filter); | ||
346 | lis3lv02d_joystick_disable(&lis3_dev); | 390 | lis3lv02d_joystick_disable(&lis3_dev); |
347 | lis3lv02d_poweroff(&lis3_dev); | 391 | lis3lv02d_poweroff(&lis3_dev); |
348 | 392 | ||
diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index 02152de135b5..ed494f37c40f 100644 --- a/drivers/platform/x86/ideapad-laptop.c +++ b/drivers/platform/x86/ideapad-laptop.c | |||
@@ -837,6 +837,13 @@ static const struct dmi_system_id no_hw_rfkill_list[] = { | |||
837 | DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo Yoga 2"), | 837 | DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo Yoga 2"), |
838 | }, | 838 | }, |
839 | }, | 839 | }, |
840 | { | ||
841 | .ident = "Lenovo Yoga 3 Pro 1370", | ||
842 | .matches = { | ||
843 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | ||
844 | DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo YOGA 3 Pro-1370"), | ||
845 | }, | ||
846 | }, | ||
840 | {} | 847 | {} |
841 | }; | 848 | }; |
842 | 849 | ||
diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c index 5a5966512277..ff765d8e1a09 100644 --- a/drivers/platform/x86/samsung-laptop.c +++ b/drivers/platform/x86/samsung-laptop.c | |||
@@ -1561,6 +1561,16 @@ static struct dmi_system_id __initdata samsung_dmi_table[] = { | |||
1561 | }, | 1561 | }, |
1562 | { | 1562 | { |
1563 | .callback = samsung_dmi_matched, | 1563 | .callback = samsung_dmi_matched, |
1564 | .ident = "NC210", | ||
1565 | .matches = { | ||
1566 | DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), | ||
1567 | DMI_MATCH(DMI_PRODUCT_NAME, "NC210/NC110"), | ||
1568 | DMI_MATCH(DMI_BOARD_NAME, "NC210/NC110"), | ||
1569 | }, | ||
1570 | .driver_data = &samsung_broken_acpi_video, | ||
1571 | }, | ||
1572 | { | ||
1573 | .callback = samsung_dmi_matched, | ||
1564 | .ident = "730U3E/740U3E", | 1574 | .ident = "730U3E/740U3E", |
1565 | .matches = { | 1575 | .matches = { |
1566 | DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), | 1576 | DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), |
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c index ef3a1904e92f..ab6151f05420 100644 --- a/drivers/platform/x86/toshiba_acpi.c +++ b/drivers/platform/x86/toshiba_acpi.c | |||
@@ -240,6 +240,12 @@ static const struct dmi_system_id toshiba_alt_keymap_dmi[] = { | |||
240 | DMI_MATCH(DMI_PRODUCT_NAME, "Qosmio X75-A"), | 240 | DMI_MATCH(DMI_PRODUCT_NAME, "Qosmio X75-A"), |
241 | }, | 241 | }, |
242 | }, | 242 | }, |
243 | { | ||
244 | .matches = { | ||
245 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | ||
246 | DMI_MATCH(DMI_PRODUCT_NAME, "TECRA A50-A"), | ||
247 | }, | ||
248 | }, | ||
243 | {} | 249 | {} |
244 | }; | 250 | }; |
245 | 251 | ||
diff --git a/drivers/power/ab8500_fg.c b/drivers/power/ab8500_fg.c index 217da4b2ca86..99a78d365ceb 100644 --- a/drivers/power/ab8500_fg.c +++ b/drivers/power/ab8500_fg.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <linux/delay.h> | 26 | #include <linux/delay.h> |
27 | #include <linux/time.h> | 27 | #include <linux/time.h> |
28 | #include <linux/time64.h> | ||
28 | #include <linux/of.h> | 29 | #include <linux/of.h> |
29 | #include <linux/completion.h> | 30 | #include <linux/completion.h> |
30 | #include <linux/mfd/core.h> | 31 | #include <linux/mfd/core.h> |
@@ -108,7 +109,7 @@ enum ab8500_fg_calibration_state { | |||
108 | struct ab8500_fg_avg_cap { | 109 | struct ab8500_fg_avg_cap { |
109 | int avg; | 110 | int avg; |
110 | int samples[NBR_AVG_SAMPLES]; | 111 | int samples[NBR_AVG_SAMPLES]; |
111 | __kernel_time_t time_stamps[NBR_AVG_SAMPLES]; | 112 | time64_t time_stamps[NBR_AVG_SAMPLES]; |
112 | int pos; | 113 | int pos; |
113 | int nbr_samples; | 114 | int nbr_samples; |
114 | int sum; | 115 | int sum; |
@@ -386,15 +387,15 @@ static int ab8500_fg_is_low_curr(struct ab8500_fg *di, int curr) | |||
386 | */ | 387 | */ |
387 | static int ab8500_fg_add_cap_sample(struct ab8500_fg *di, int sample) | 388 | static int ab8500_fg_add_cap_sample(struct ab8500_fg *di, int sample) |
388 | { | 389 | { |
389 | struct timespec ts; | 390 | struct timespec64 ts64; |
390 | struct ab8500_fg_avg_cap *avg = &di->avg_cap; | 391 | struct ab8500_fg_avg_cap *avg = &di->avg_cap; |
391 | 392 | ||
392 | getnstimeofday(&ts); | 393 | getnstimeofday64(&ts64); |
393 | 394 | ||
394 | do { | 395 | do { |
395 | avg->sum += sample - avg->samples[avg->pos]; | 396 | avg->sum += sample - avg->samples[avg->pos]; |
396 | avg->samples[avg->pos] = sample; | 397 | avg->samples[avg->pos] = sample; |
397 | avg->time_stamps[avg->pos] = ts.tv_sec; | 398 | avg->time_stamps[avg->pos] = ts64.tv_sec; |
398 | avg->pos++; | 399 | avg->pos++; |
399 | 400 | ||
400 | if (avg->pos == NBR_AVG_SAMPLES) | 401 | if (avg->pos == NBR_AVG_SAMPLES) |
@@ -407,7 +408,7 @@ static int ab8500_fg_add_cap_sample(struct ab8500_fg *di, int sample) | |||
407 | * Check the time stamp for each sample. If too old, | 408 | * Check the time stamp for each sample. If too old, |
408 | * replace with latest sample | 409 | * replace with latest sample |
409 | */ | 410 | */ |
410 | } while (ts.tv_sec - VALID_CAPACITY_SEC > avg->time_stamps[avg->pos]); | 411 | } while (ts64.tv_sec - VALID_CAPACITY_SEC > avg->time_stamps[avg->pos]); |
411 | 412 | ||
412 | avg->avg = avg->sum / avg->nbr_samples; | 413 | avg->avg = avg->sum / avg->nbr_samples; |
413 | 414 | ||
@@ -446,14 +447,14 @@ static void ab8500_fg_clear_cap_samples(struct ab8500_fg *di) | |||
446 | static void ab8500_fg_fill_cap_sample(struct ab8500_fg *di, int sample) | 447 | static void ab8500_fg_fill_cap_sample(struct ab8500_fg *di, int sample) |
447 | { | 448 | { |
448 | int i; | 449 | int i; |
449 | struct timespec ts; | 450 | struct timespec64 ts64; |
450 | struct ab8500_fg_avg_cap *avg = &di->avg_cap; | 451 | struct ab8500_fg_avg_cap *avg = &di->avg_cap; |
451 | 452 | ||
452 | getnstimeofday(&ts); | 453 | getnstimeofday64(&ts64); |
453 | 454 | ||
454 | for (i = 0; i < NBR_AVG_SAMPLES; i++) { | 455 | for (i = 0; i < NBR_AVG_SAMPLES; i++) { |
455 | avg->samples[i] = sample; | 456 | avg->samples[i] = sample; |
456 | avg->time_stamps[i] = ts.tv_sec; | 457 | avg->time_stamps[i] = ts64.tv_sec; |
457 | } | 458 | } |
458 | 459 | ||
459 | avg->pos = 0; | 460 | avg->pos = 0; |
diff --git a/drivers/power/bq2415x_charger.c b/drivers/power/bq2415x_charger.c index e384844a1ae1..1f49986fc605 100644 --- a/drivers/power/bq2415x_charger.c +++ b/drivers/power/bq2415x_charger.c | |||
@@ -1579,8 +1579,15 @@ static int bq2415x_probe(struct i2c_client *client, | |||
1579 | if (np) { | 1579 | if (np) { |
1580 | bq->notify_psy = power_supply_get_by_phandle(np, "ti,usb-charger-detection"); | 1580 | bq->notify_psy = power_supply_get_by_phandle(np, "ti,usb-charger-detection"); |
1581 | 1581 | ||
1582 | if (!bq->notify_psy) | 1582 | if (IS_ERR(bq->notify_psy)) { |
1583 | return -EPROBE_DEFER; | 1583 | dev_info(&client->dev, |
1584 | "no 'ti,usb-charger-detection' property (err=%ld)\n", | ||
1585 | PTR_ERR(bq->notify_psy)); | ||
1586 | bq->notify_psy = NULL; | ||
1587 | } else if (!bq->notify_psy) { | ||
1588 | ret = -EPROBE_DEFER; | ||
1589 | goto error_2; | ||
1590 | } | ||
1584 | } | 1591 | } |
1585 | else if (pdata->notify_device) | 1592 | else if (pdata->notify_device) |
1586 | bq->notify_psy = power_supply_get_by_name(pdata->notify_device); | 1593 | bq->notify_psy = power_supply_get_by_name(pdata->notify_device); |
@@ -1602,27 +1609,27 @@ static int bq2415x_probe(struct i2c_client *client, | |||
1602 | ret = of_property_read_u32(np, "ti,current-limit", | 1609 | ret = of_property_read_u32(np, "ti,current-limit", |
1603 | &bq->init_data.current_limit); | 1610 | &bq->init_data.current_limit); |
1604 | if (ret) | 1611 | if (ret) |
1605 | return ret; | 1612 | goto error_2; |
1606 | ret = of_property_read_u32(np, "ti,weak-battery-voltage", | 1613 | ret = of_property_read_u32(np, "ti,weak-battery-voltage", |
1607 | &bq->init_data.weak_battery_voltage); | 1614 | &bq->init_data.weak_battery_voltage); |
1608 | if (ret) | 1615 | if (ret) |
1609 | return ret; | 1616 | goto error_2; |
1610 | ret = of_property_read_u32(np, "ti,battery-regulation-voltage", | 1617 | ret = of_property_read_u32(np, "ti,battery-regulation-voltage", |
1611 | &bq->init_data.battery_regulation_voltage); | 1618 | &bq->init_data.battery_regulation_voltage); |
1612 | if (ret) | 1619 | if (ret) |
1613 | return ret; | 1620 | goto error_2; |
1614 | ret = of_property_read_u32(np, "ti,charge-current", | 1621 | ret = of_property_read_u32(np, "ti,charge-current", |
1615 | &bq->init_data.charge_current); | 1622 | &bq->init_data.charge_current); |
1616 | if (ret) | 1623 | if (ret) |
1617 | return ret; | 1624 | goto error_2; |
1618 | ret = of_property_read_u32(np, "ti,termination-current", | 1625 | ret = of_property_read_u32(np, "ti,termination-current", |
1619 | &bq->init_data.termination_current); | 1626 | &bq->init_data.termination_current); |
1620 | if (ret) | 1627 | if (ret) |
1621 | return ret; | 1628 | goto error_2; |
1622 | ret = of_property_read_u32(np, "ti,resistor-sense", | 1629 | ret = of_property_read_u32(np, "ti,resistor-sense", |
1623 | &bq->init_data.resistor_sense); | 1630 | &bq->init_data.resistor_sense); |
1624 | if (ret) | 1631 | if (ret) |
1625 | return ret; | 1632 | goto error_2; |
1626 | } else { | 1633 | } else { |
1627 | memcpy(&bq->init_data, pdata, sizeof(bq->init_data)); | 1634 | memcpy(&bq->init_data, pdata, sizeof(bq->init_data)); |
1628 | } | 1635 | } |
diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c index 7098a1ce2d3c..ef8094a61f1e 100644 --- a/drivers/power/charger-manager.c +++ b/drivers/power/charger-manager.c | |||
@@ -97,6 +97,7 @@ static struct charger_global_desc *g_desc; /* init with setup_charger_manager */ | |||
97 | static bool is_batt_present(struct charger_manager *cm) | 97 | static bool is_batt_present(struct charger_manager *cm) |
98 | { | 98 | { |
99 | union power_supply_propval val; | 99 | union power_supply_propval val; |
100 | struct power_supply *psy; | ||
100 | bool present = false; | 101 | bool present = false; |
101 | int i, ret; | 102 | int i, ret; |
102 | 103 | ||
@@ -107,16 +108,27 @@ static bool is_batt_present(struct charger_manager *cm) | |||
107 | case CM_NO_BATTERY: | 108 | case CM_NO_BATTERY: |
108 | break; | 109 | break; |
109 | case CM_FUEL_GAUGE: | 110 | case CM_FUEL_GAUGE: |
110 | ret = cm->fuel_gauge->get_property(cm->fuel_gauge, | 111 | psy = power_supply_get_by_name(cm->desc->psy_fuel_gauge); |
112 | if (!psy) | ||
113 | break; | ||
114 | |||
115 | ret = psy->get_property(psy, | ||
111 | POWER_SUPPLY_PROP_PRESENT, &val); | 116 | POWER_SUPPLY_PROP_PRESENT, &val); |
112 | if (ret == 0 && val.intval) | 117 | if (ret == 0 && val.intval) |
113 | present = true; | 118 | present = true; |
114 | break; | 119 | break; |
115 | case CM_CHARGER_STAT: | 120 | case CM_CHARGER_STAT: |
116 | for (i = 0; cm->charger_stat[i]; i++) { | 121 | for (i = 0; cm->desc->psy_charger_stat[i]; i++) { |
117 | ret = cm->charger_stat[i]->get_property( | 122 | psy = power_supply_get_by_name( |
118 | cm->charger_stat[i], | 123 | cm->desc->psy_charger_stat[i]); |
119 | POWER_SUPPLY_PROP_PRESENT, &val); | 124 | if (!psy) { |
125 | dev_err(cm->dev, "Cannot find power supply \"%s\"\n", | ||
126 | cm->desc->psy_charger_stat[i]); | ||
127 | continue; | ||
128 | } | ||
129 | |||
130 | ret = psy->get_property(psy, POWER_SUPPLY_PROP_PRESENT, | ||
131 | &val); | ||
120 | if (ret == 0 && val.intval) { | 132 | if (ret == 0 && val.intval) { |
121 | present = true; | 133 | present = true; |
122 | break; | 134 | break; |
@@ -139,14 +151,20 @@ static bool is_batt_present(struct charger_manager *cm) | |||
139 | static bool is_ext_pwr_online(struct charger_manager *cm) | 151 | static bool is_ext_pwr_online(struct charger_manager *cm) |
140 | { | 152 | { |
141 | union power_supply_propval val; | 153 | union power_supply_propval val; |
154 | struct power_supply *psy; | ||
142 | bool online = false; | 155 | bool online = false; |
143 | int i, ret; | 156 | int i, ret; |
144 | 157 | ||
145 | /* If at least one of them has one, it's yes. */ | 158 | /* If at least one of them has one, it's yes. */ |
146 | for (i = 0; cm->charger_stat[i]; i++) { | 159 | for (i = 0; cm->desc->psy_charger_stat[i]; i++) { |
147 | ret = cm->charger_stat[i]->get_property( | 160 | psy = power_supply_get_by_name(cm->desc->psy_charger_stat[i]); |
148 | cm->charger_stat[i], | 161 | if (!psy) { |
149 | POWER_SUPPLY_PROP_ONLINE, &val); | 162 | dev_err(cm->dev, "Cannot find power supply \"%s\"\n", |
163 | cm->desc->psy_charger_stat[i]); | ||
164 | continue; | ||
165 | } | ||
166 | |||
167 | ret = psy->get_property(psy, POWER_SUPPLY_PROP_ONLINE, &val); | ||
150 | if (ret == 0 && val.intval) { | 168 | if (ret == 0 && val.intval) { |
151 | online = true; | 169 | online = true; |
152 | break; | 170 | break; |
@@ -167,12 +185,14 @@ static bool is_ext_pwr_online(struct charger_manager *cm) | |||
167 | static int get_batt_uV(struct charger_manager *cm, int *uV) | 185 | static int get_batt_uV(struct charger_manager *cm, int *uV) |
168 | { | 186 | { |
169 | union power_supply_propval val; | 187 | union power_supply_propval val; |
188 | struct power_supply *fuel_gauge; | ||
170 | int ret; | 189 | int ret; |
171 | 190 | ||
172 | if (!cm->fuel_gauge) | 191 | fuel_gauge = power_supply_get_by_name(cm->desc->psy_fuel_gauge); |
192 | if (!fuel_gauge) | ||
173 | return -ENODEV; | 193 | return -ENODEV; |
174 | 194 | ||
175 | ret = cm->fuel_gauge->get_property(cm->fuel_gauge, | 195 | ret = fuel_gauge->get_property(fuel_gauge, |
176 | POWER_SUPPLY_PROP_VOLTAGE_NOW, &val); | 196 | POWER_SUPPLY_PROP_VOLTAGE_NOW, &val); |
177 | if (ret) | 197 | if (ret) |
178 | return ret; | 198 | return ret; |
@@ -189,6 +209,7 @@ static bool is_charging(struct charger_manager *cm) | |||
189 | { | 209 | { |
190 | int i, ret; | 210 | int i, ret; |
191 | bool charging = false; | 211 | bool charging = false; |
212 | struct power_supply *psy; | ||
192 | union power_supply_propval val; | 213 | union power_supply_propval val; |
193 | 214 | ||
194 | /* If there is no battery, it cannot be charged */ | 215 | /* If there is no battery, it cannot be charged */ |
@@ -196,17 +217,22 @@ static bool is_charging(struct charger_manager *cm) | |||
196 | return false; | 217 | return false; |
197 | 218 | ||
198 | /* If at least one of the charger is charging, return yes */ | 219 | /* If at least one of the charger is charging, return yes */ |
199 | for (i = 0; cm->charger_stat[i]; i++) { | 220 | for (i = 0; cm->desc->psy_charger_stat[i]; i++) { |
200 | /* 1. The charger sholuld not be DISABLED */ | 221 | /* 1. The charger sholuld not be DISABLED */ |
201 | if (cm->emergency_stop) | 222 | if (cm->emergency_stop) |
202 | continue; | 223 | continue; |
203 | if (!cm->charger_enabled) | 224 | if (!cm->charger_enabled) |
204 | continue; | 225 | continue; |
205 | 226 | ||
227 | psy = power_supply_get_by_name(cm->desc->psy_charger_stat[i]); | ||
228 | if (!psy) { | ||
229 | dev_err(cm->dev, "Cannot find power supply \"%s\"\n", | ||
230 | cm->desc->psy_charger_stat[i]); | ||
231 | continue; | ||
232 | } | ||
233 | |||
206 | /* 2. The charger should be online (ext-power) */ | 234 | /* 2. The charger should be online (ext-power) */ |
207 | ret = cm->charger_stat[i]->get_property( | 235 | ret = psy->get_property(psy, POWER_SUPPLY_PROP_ONLINE, &val); |
208 | cm->charger_stat[i], | ||
209 | POWER_SUPPLY_PROP_ONLINE, &val); | ||
210 | if (ret) { | 236 | if (ret) { |
211 | dev_warn(cm->dev, "Cannot read ONLINE value from %s\n", | 237 | dev_warn(cm->dev, "Cannot read ONLINE value from %s\n", |
212 | cm->desc->psy_charger_stat[i]); | 238 | cm->desc->psy_charger_stat[i]); |
@@ -219,9 +245,7 @@ static bool is_charging(struct charger_manager *cm) | |||
219 | * 3. The charger should not be FULL, DISCHARGING, | 245 | * 3. The charger should not be FULL, DISCHARGING, |
220 | * or NOT_CHARGING. | 246 | * or NOT_CHARGING. |
221 | */ | 247 | */ |
222 | ret = cm->charger_stat[i]->get_property( | 248 | ret = psy->get_property(psy, POWER_SUPPLY_PROP_STATUS, &val); |
223 | cm->charger_stat[i], | ||
224 | POWER_SUPPLY_PROP_STATUS, &val); | ||
225 | if (ret) { | 249 | if (ret) { |
226 | dev_warn(cm->dev, "Cannot read STATUS value from %s\n", | 250 | dev_warn(cm->dev, "Cannot read STATUS value from %s\n", |
227 | cm->desc->psy_charger_stat[i]); | 251 | cm->desc->psy_charger_stat[i]); |
@@ -248,6 +272,7 @@ static bool is_full_charged(struct charger_manager *cm) | |||
248 | { | 272 | { |
249 | struct charger_desc *desc = cm->desc; | 273 | struct charger_desc *desc = cm->desc; |
250 | union power_supply_propval val; | 274 | union power_supply_propval val; |
275 | struct power_supply *fuel_gauge; | ||
251 | int ret = 0; | 276 | int ret = 0; |
252 | int uV; | 277 | int uV; |
253 | 278 | ||
@@ -255,11 +280,15 @@ static bool is_full_charged(struct charger_manager *cm) | |||
255 | if (!is_batt_present(cm)) | 280 | if (!is_batt_present(cm)) |
256 | return false; | 281 | return false; |
257 | 282 | ||
258 | if (cm->fuel_gauge && desc->fullbatt_full_capacity > 0) { | 283 | fuel_gauge = power_supply_get_by_name(cm->desc->psy_fuel_gauge); |
284 | if (!fuel_gauge) | ||
285 | return false; | ||
286 | |||
287 | if (desc->fullbatt_full_capacity > 0) { | ||
259 | val.intval = 0; | 288 | val.intval = 0; |
260 | 289 | ||
261 | /* Not full if capacity of fuel gauge isn't full */ | 290 | /* Not full if capacity of fuel gauge isn't full */ |
262 | ret = cm->fuel_gauge->get_property(cm->fuel_gauge, | 291 | ret = fuel_gauge->get_property(fuel_gauge, |
263 | POWER_SUPPLY_PROP_CHARGE_FULL, &val); | 292 | POWER_SUPPLY_PROP_CHARGE_FULL, &val); |
264 | if (!ret && val.intval > desc->fullbatt_full_capacity) | 293 | if (!ret && val.intval > desc->fullbatt_full_capacity) |
265 | return true; | 294 | return true; |
@@ -273,10 +302,10 @@ static bool is_full_charged(struct charger_manager *cm) | |||
273 | } | 302 | } |
274 | 303 | ||
275 | /* Full, if the capacity is more than fullbatt_soc */ | 304 | /* Full, if the capacity is more than fullbatt_soc */ |
276 | if (cm->fuel_gauge && desc->fullbatt_soc > 0) { | 305 | if (desc->fullbatt_soc > 0) { |
277 | val.intval = 0; | 306 | val.intval = 0; |
278 | 307 | ||
279 | ret = cm->fuel_gauge->get_property(cm->fuel_gauge, | 308 | ret = fuel_gauge->get_property(fuel_gauge, |
280 | POWER_SUPPLY_PROP_CAPACITY, &val); | 309 | POWER_SUPPLY_PROP_CAPACITY, &val); |
281 | if (!ret && val.intval >= desc->fullbatt_soc) | 310 | if (!ret && val.intval >= desc->fullbatt_soc) |
282 | return true; | 311 | return true; |
@@ -551,6 +580,20 @@ static int check_charging_duration(struct charger_manager *cm) | |||
551 | return ret; | 580 | return ret; |
552 | } | 581 | } |
553 | 582 | ||
583 | static int cm_get_battery_temperature_by_psy(struct charger_manager *cm, | ||
584 | int *temp) | ||
585 | { | ||
586 | struct power_supply *fuel_gauge; | ||
587 | |||
588 | fuel_gauge = power_supply_get_by_name(cm->desc->psy_fuel_gauge); | ||
589 | if (!fuel_gauge) | ||
590 | return -ENODEV; | ||
591 | |||
592 | return fuel_gauge->get_property(fuel_gauge, | ||
593 | POWER_SUPPLY_PROP_TEMP, | ||
594 | (union power_supply_propval *)temp); | ||
595 | } | ||
596 | |||
554 | static int cm_get_battery_temperature(struct charger_manager *cm, | 597 | static int cm_get_battery_temperature(struct charger_manager *cm, |
555 | int *temp) | 598 | int *temp) |
556 | { | 599 | { |
@@ -560,15 +603,18 @@ static int cm_get_battery_temperature(struct charger_manager *cm, | |||
560 | return -ENODEV; | 603 | return -ENODEV; |
561 | 604 | ||
562 | #ifdef CONFIG_THERMAL | 605 | #ifdef CONFIG_THERMAL |
563 | ret = thermal_zone_get_temp(cm->tzd_batt, (unsigned long *)temp); | 606 | if (cm->tzd_batt) { |
564 | if (!ret) | 607 | ret = thermal_zone_get_temp(cm->tzd_batt, (unsigned long *)temp); |
565 | /* Calibrate temperature unit */ | 608 | if (!ret) |
566 | *temp /= 100; | 609 | /* Calibrate temperature unit */ |
567 | #else | 610 | *temp /= 100; |
568 | ret = cm->fuel_gauge->get_property(cm->fuel_gauge, | 611 | } else |
569 | POWER_SUPPLY_PROP_TEMP, | ||
570 | (union power_supply_propval *)temp); | ||
571 | #endif | 612 | #endif |
613 | { | ||
614 | /* if-else continued from CONFIG_THERMAL */ | ||
615 | ret = cm_get_battery_temperature_by_psy(cm, temp); | ||
616 | } | ||
617 | |||
572 | return ret; | 618 | return ret; |
573 | } | 619 | } |
574 | 620 | ||
@@ -827,6 +873,7 @@ static int charger_get_property(struct power_supply *psy, | |||
827 | struct charger_manager *cm = container_of(psy, | 873 | struct charger_manager *cm = container_of(psy, |
828 | struct charger_manager, charger_psy); | 874 | struct charger_manager, charger_psy); |
829 | struct charger_desc *desc = cm->desc; | 875 | struct charger_desc *desc = cm->desc; |
876 | struct power_supply *fuel_gauge; | ||
830 | int ret = 0; | 877 | int ret = 0; |
831 | int uV; | 878 | int uV; |
832 | 879 | ||
@@ -857,14 +904,20 @@ static int charger_get_property(struct power_supply *psy, | |||
857 | ret = get_batt_uV(cm, &val->intval); | 904 | ret = get_batt_uV(cm, &val->intval); |
858 | break; | 905 | break; |
859 | case POWER_SUPPLY_PROP_CURRENT_NOW: | 906 | case POWER_SUPPLY_PROP_CURRENT_NOW: |
860 | ret = cm->fuel_gauge->get_property(cm->fuel_gauge, | 907 | fuel_gauge = power_supply_get_by_name(cm->desc->psy_fuel_gauge); |
908 | if (!fuel_gauge) { | ||
909 | ret = -ENODEV; | ||
910 | break; | ||
911 | } | ||
912 | ret = fuel_gauge->get_property(fuel_gauge, | ||
861 | POWER_SUPPLY_PROP_CURRENT_NOW, val); | 913 | POWER_SUPPLY_PROP_CURRENT_NOW, val); |
862 | break; | 914 | break; |
863 | case POWER_SUPPLY_PROP_TEMP: | 915 | case POWER_SUPPLY_PROP_TEMP: |
864 | case POWER_SUPPLY_PROP_TEMP_AMBIENT: | 916 | case POWER_SUPPLY_PROP_TEMP_AMBIENT: |
865 | return cm_get_battery_temperature(cm, &val->intval); | 917 | return cm_get_battery_temperature(cm, &val->intval); |
866 | case POWER_SUPPLY_PROP_CAPACITY: | 918 | case POWER_SUPPLY_PROP_CAPACITY: |
867 | if (!cm->fuel_gauge) { | 919 | fuel_gauge = power_supply_get_by_name(cm->desc->psy_fuel_gauge); |
920 | if (!fuel_gauge) { | ||
868 | ret = -ENODEV; | 921 | ret = -ENODEV; |
869 | break; | 922 | break; |
870 | } | 923 | } |
@@ -875,7 +928,7 @@ static int charger_get_property(struct power_supply *psy, | |||
875 | break; | 928 | break; |
876 | } | 929 | } |
877 | 930 | ||
878 | ret = cm->fuel_gauge->get_property(cm->fuel_gauge, | 931 | ret = fuel_gauge->get_property(fuel_gauge, |
879 | POWER_SUPPLY_PROP_CAPACITY, val); | 932 | POWER_SUPPLY_PROP_CAPACITY, val); |
880 | if (ret) | 933 | if (ret) |
881 | break; | 934 | break; |
@@ -924,7 +977,14 @@ static int charger_get_property(struct power_supply *psy, | |||
924 | break; | 977 | break; |
925 | case POWER_SUPPLY_PROP_CHARGE_NOW: | 978 | case POWER_SUPPLY_PROP_CHARGE_NOW: |
926 | if (is_charging(cm)) { | 979 | if (is_charging(cm)) { |
927 | ret = cm->fuel_gauge->get_property(cm->fuel_gauge, | 980 | fuel_gauge = power_supply_get_by_name( |
981 | cm->desc->psy_fuel_gauge); | ||
982 | if (!fuel_gauge) { | ||
983 | ret = -ENODEV; | ||
984 | break; | ||
985 | } | ||
986 | |||
987 | ret = fuel_gauge->get_property(fuel_gauge, | ||
928 | POWER_SUPPLY_PROP_CHARGE_NOW, | 988 | POWER_SUPPLY_PROP_CHARGE_NOW, |
929 | val); | 989 | val); |
930 | if (ret) { | 990 | if (ret) { |
@@ -970,6 +1030,7 @@ static struct power_supply psy_default = { | |||
970 | .properties = default_charger_props, | 1030 | .properties = default_charger_props, |
971 | .num_properties = ARRAY_SIZE(default_charger_props), | 1031 | .num_properties = ARRAY_SIZE(default_charger_props), |
972 | .get_property = charger_get_property, | 1032 | .get_property = charger_get_property, |
1033 | .no_thermal = true, | ||
973 | }; | 1034 | }; |
974 | 1035 | ||
975 | /** | 1036 | /** |
@@ -1485,14 +1546,15 @@ err: | |||
1485 | return ret; | 1546 | return ret; |
1486 | } | 1547 | } |
1487 | 1548 | ||
1488 | static int cm_init_thermal_data(struct charger_manager *cm) | 1549 | static int cm_init_thermal_data(struct charger_manager *cm, |
1550 | struct power_supply *fuel_gauge) | ||
1489 | { | 1551 | { |
1490 | struct charger_desc *desc = cm->desc; | 1552 | struct charger_desc *desc = cm->desc; |
1491 | union power_supply_propval val; | 1553 | union power_supply_propval val; |
1492 | int ret; | 1554 | int ret; |
1493 | 1555 | ||
1494 | /* Verify whether fuel gauge provides battery temperature */ | 1556 | /* Verify whether fuel gauge provides battery temperature */ |
1495 | ret = cm->fuel_gauge->get_property(cm->fuel_gauge, | 1557 | ret = fuel_gauge->get_property(fuel_gauge, |
1496 | POWER_SUPPLY_PROP_TEMP, &val); | 1558 | POWER_SUPPLY_PROP_TEMP, &val); |
1497 | 1559 | ||
1498 | if (!ret) { | 1560 | if (!ret) { |
@@ -1502,8 +1564,6 @@ static int cm_init_thermal_data(struct charger_manager *cm) | |||
1502 | cm->desc->measure_battery_temp = true; | 1564 | cm->desc->measure_battery_temp = true; |
1503 | } | 1565 | } |
1504 | #ifdef CONFIG_THERMAL | 1566 | #ifdef CONFIG_THERMAL |
1505 | cm->tzd_batt = cm->fuel_gauge->tzd; | ||
1506 | |||
1507 | if (ret && desc->thermal_zone) { | 1567 | if (ret && desc->thermal_zone) { |
1508 | cm->tzd_batt = | 1568 | cm->tzd_batt = |
1509 | thermal_zone_get_zone_by_name(desc->thermal_zone); | 1569 | thermal_zone_get_zone_by_name(desc->thermal_zone); |
@@ -1666,6 +1726,7 @@ static int charger_manager_probe(struct platform_device *pdev) | |||
1666 | int ret = 0, i = 0; | 1726 | int ret = 0, i = 0; |
1667 | int j = 0; | 1727 | int j = 0; |
1668 | union power_supply_propval val; | 1728 | union power_supply_propval val; |
1729 | struct power_supply *fuel_gauge; | ||
1669 | 1730 | ||
1670 | if (g_desc && !rtc_dev && g_desc->rtc_name) { | 1731 | if (g_desc && !rtc_dev && g_desc->rtc_name) { |
1671 | rtc_dev = rtc_class_open(g_desc->rtc_name); | 1732 | rtc_dev = rtc_class_open(g_desc->rtc_name); |
@@ -1729,23 +1790,20 @@ static int charger_manager_probe(struct platform_device *pdev) | |||
1729 | while (desc->psy_charger_stat[i]) | 1790 | while (desc->psy_charger_stat[i]) |
1730 | i++; | 1791 | i++; |
1731 | 1792 | ||
1732 | cm->charger_stat = devm_kzalloc(&pdev->dev, | 1793 | /* Check if charger's supplies are present at probe */ |
1733 | sizeof(struct power_supply *) * i, GFP_KERNEL); | ||
1734 | if (!cm->charger_stat) | ||
1735 | return -ENOMEM; | ||
1736 | |||
1737 | for (i = 0; desc->psy_charger_stat[i]; i++) { | 1794 | for (i = 0; desc->psy_charger_stat[i]; i++) { |
1738 | cm->charger_stat[i] = power_supply_get_by_name( | 1795 | struct power_supply *psy; |
1739 | desc->psy_charger_stat[i]); | 1796 | |
1740 | if (!cm->charger_stat[i]) { | 1797 | psy = power_supply_get_by_name(desc->psy_charger_stat[i]); |
1798 | if (!psy) { | ||
1741 | dev_err(&pdev->dev, "Cannot find power supply \"%s\"\n", | 1799 | dev_err(&pdev->dev, "Cannot find power supply \"%s\"\n", |
1742 | desc->psy_charger_stat[i]); | 1800 | desc->psy_charger_stat[i]); |
1743 | return -ENODEV; | 1801 | return -ENODEV; |
1744 | } | 1802 | } |
1745 | } | 1803 | } |
1746 | 1804 | ||
1747 | cm->fuel_gauge = power_supply_get_by_name(desc->psy_fuel_gauge); | 1805 | fuel_gauge = power_supply_get_by_name(desc->psy_fuel_gauge); |
1748 | if (!cm->fuel_gauge) { | 1806 | if (!fuel_gauge) { |
1749 | dev_err(&pdev->dev, "Cannot find power supply \"%s\"\n", | 1807 | dev_err(&pdev->dev, "Cannot find power supply \"%s\"\n", |
1750 | desc->psy_fuel_gauge); | 1808 | desc->psy_fuel_gauge); |
1751 | return -ENODEV; | 1809 | return -ENODEV; |
@@ -1788,13 +1846,13 @@ static int charger_manager_probe(struct platform_device *pdev) | |||
1788 | cm->charger_psy.num_properties = psy_default.num_properties; | 1846 | cm->charger_psy.num_properties = psy_default.num_properties; |
1789 | 1847 | ||
1790 | /* Find which optional psy-properties are available */ | 1848 | /* Find which optional psy-properties are available */ |
1791 | if (!cm->fuel_gauge->get_property(cm->fuel_gauge, | 1849 | if (!fuel_gauge->get_property(fuel_gauge, |
1792 | POWER_SUPPLY_PROP_CHARGE_NOW, &val)) { | 1850 | POWER_SUPPLY_PROP_CHARGE_NOW, &val)) { |
1793 | cm->charger_psy.properties[cm->charger_psy.num_properties] = | 1851 | cm->charger_psy.properties[cm->charger_psy.num_properties] = |
1794 | POWER_SUPPLY_PROP_CHARGE_NOW; | 1852 | POWER_SUPPLY_PROP_CHARGE_NOW; |
1795 | cm->charger_psy.num_properties++; | 1853 | cm->charger_psy.num_properties++; |
1796 | } | 1854 | } |
1797 | if (!cm->fuel_gauge->get_property(cm->fuel_gauge, | 1855 | if (!fuel_gauge->get_property(fuel_gauge, |
1798 | POWER_SUPPLY_PROP_CURRENT_NOW, | 1856 | POWER_SUPPLY_PROP_CURRENT_NOW, |
1799 | &val)) { | 1857 | &val)) { |
1800 | cm->charger_psy.properties[cm->charger_psy.num_properties] = | 1858 | cm->charger_psy.properties[cm->charger_psy.num_properties] = |
@@ -1802,7 +1860,7 @@ static int charger_manager_probe(struct platform_device *pdev) | |||
1802 | cm->charger_psy.num_properties++; | 1860 | cm->charger_psy.num_properties++; |
1803 | } | 1861 | } |
1804 | 1862 | ||
1805 | ret = cm_init_thermal_data(cm); | 1863 | ret = cm_init_thermal_data(cm, fuel_gauge); |
1806 | if (ret) { | 1864 | if (ret) { |
1807 | dev_err(&pdev->dev, "Failed to initialize thermal data\n"); | 1865 | dev_err(&pdev->dev, "Failed to initialize thermal data\n"); |
1808 | cm->desc->measure_battery_temp = false; | 1866 | cm->desc->measure_battery_temp = false; |
@@ -2066,8 +2124,8 @@ static bool find_power_supply(struct charger_manager *cm, | |||
2066 | int i; | 2124 | int i; |
2067 | bool found = false; | 2125 | bool found = false; |
2068 | 2126 | ||
2069 | for (i = 0; cm->charger_stat[i]; i++) { | 2127 | for (i = 0; cm->desc->psy_charger_stat[i]; i++) { |
2070 | if (psy == cm->charger_stat[i]) { | 2128 | if (!strcmp(psy->name, cm->desc->psy_charger_stat[i])) { |
2071 | found = true; | 2129 | found = true; |
2072 | break; | 2130 | break; |
2073 | } | 2131 | } |
diff --git a/drivers/power/power_supply_core.c b/drivers/power/power_supply_core.c index 6cb7fe5c022d..694e8cddd5c1 100644 --- a/drivers/power/power_supply_core.c +++ b/drivers/power/power_supply_core.c | |||
@@ -417,6 +417,9 @@ static int psy_register_thermal(struct power_supply *psy) | |||
417 | { | 417 | { |
418 | int i; | 418 | int i; |
419 | 419 | ||
420 | if (psy->no_thermal) | ||
421 | return 0; | ||
422 | |||
420 | /* Register battery zone device psy reports temperature */ | 423 | /* Register battery zone device psy reports temperature */ |
421 | for (i = 0; i < psy->num_properties; i++) { | 424 | for (i = 0; i < psy->num_properties; i++) { |
422 | if (psy->properties[i] == POWER_SUPPLY_PROP_TEMP) { | 425 | if (psy->properties[i] == POWER_SUPPLY_PROP_TEMP) { |
diff --git a/drivers/regulator/max1586.c b/drivers/regulator/max1586.c index 86db310d5304..d2a8c64cae42 100644 --- a/drivers/regulator/max1586.c +++ b/drivers/regulator/max1586.c | |||
@@ -163,7 +163,7 @@ static int of_get_max1586_platform_data(struct device *dev, | |||
163 | struct max1586_platform_data *pdata) | 163 | struct max1586_platform_data *pdata) |
164 | { | 164 | { |
165 | struct max1586_subdev_data *sub; | 165 | struct max1586_subdev_data *sub; |
166 | struct of_regulator_match rmatch[ARRAY_SIZE(max1586_reg)]; | 166 | struct of_regulator_match rmatch[ARRAY_SIZE(max1586_reg)] = { }; |
167 | struct device_node *np = dev->of_node; | 167 | struct device_node *np = dev->of_node; |
168 | int i, matched; | 168 | int i, matched; |
169 | 169 | ||
diff --git a/drivers/regulator/max77686.c b/drivers/regulator/max77686.c index ef1af2debbd2..f69320e1738f 100644 --- a/drivers/regulator/max77686.c +++ b/drivers/regulator/max77686.c | |||
@@ -395,7 +395,7 @@ static int max77686_pmic_dt_parse_pdata(struct platform_device *pdev, | |||
395 | struct max77686_dev *iodev = dev_get_drvdata(pdev->dev.parent); | 395 | struct max77686_dev *iodev = dev_get_drvdata(pdev->dev.parent); |
396 | struct device_node *pmic_np, *regulators_np; | 396 | struct device_node *pmic_np, *regulators_np; |
397 | struct max77686_regulator_data *rdata; | 397 | struct max77686_regulator_data *rdata; |
398 | struct of_regulator_match rmatch; | 398 | struct of_regulator_match rmatch = { }; |
399 | unsigned int i; | 399 | unsigned int i; |
400 | 400 | ||
401 | pmic_np = iodev->dev->of_node; | 401 | pmic_np = iodev->dev->of_node; |
diff --git a/drivers/regulator/max77693.c b/drivers/regulator/max77693.c index c67ff05fc1dd..d158f71fa128 100644 --- a/drivers/regulator/max77693.c +++ b/drivers/regulator/max77693.c | |||
@@ -227,7 +227,7 @@ static int max77693_pmic_probe(struct platform_device *pdev) | |||
227 | struct max77693_dev *iodev = dev_get_drvdata(pdev->dev.parent); | 227 | struct max77693_dev *iodev = dev_get_drvdata(pdev->dev.parent); |
228 | struct max77693_regulator_data *rdata = NULL; | 228 | struct max77693_regulator_data *rdata = NULL; |
229 | int num_rdata, i; | 229 | int num_rdata, i; |
230 | struct regulator_config config; | 230 | struct regulator_config config = { }; |
231 | 231 | ||
232 | num_rdata = max77693_pmic_init_rdata(&pdev->dev, &rdata); | 232 | num_rdata = max77693_pmic_init_rdata(&pdev->dev, &rdata); |
233 | if (!rdata || num_rdata <= 0) { | 233 | if (!rdata || num_rdata <= 0) { |
diff --git a/drivers/regulator/max77802.c b/drivers/regulator/max77802.c index d89792b084e9..45fa240fe243 100644 --- a/drivers/regulator/max77802.c +++ b/drivers/regulator/max77802.c | |||
@@ -454,7 +454,7 @@ static int max77802_pmic_dt_parse_pdata(struct platform_device *pdev, | |||
454 | struct max77686_dev *iodev = dev_get_drvdata(pdev->dev.parent); | 454 | struct max77686_dev *iodev = dev_get_drvdata(pdev->dev.parent); |
455 | struct device_node *pmic_np, *regulators_np; | 455 | struct device_node *pmic_np, *regulators_np; |
456 | struct max77686_regulator_data *rdata; | 456 | struct max77686_regulator_data *rdata; |
457 | struct of_regulator_match rmatch; | 457 | struct of_regulator_match rmatch = { }; |
458 | unsigned int i; | 458 | unsigned int i; |
459 | 459 | ||
460 | pmic_np = iodev->dev->of_node; | 460 | pmic_np = iodev->dev->of_node; |
diff --git a/drivers/regulator/max8660.c b/drivers/regulator/max8660.c index 2fc411188794..7eee2ca18541 100644 --- a/drivers/regulator/max8660.c +++ b/drivers/regulator/max8660.c | |||
@@ -335,7 +335,7 @@ static int max8660_pdata_from_dt(struct device *dev, | |||
335 | int matched, i; | 335 | int matched, i; |
336 | struct device_node *np; | 336 | struct device_node *np; |
337 | struct max8660_subdev_data *sub; | 337 | struct max8660_subdev_data *sub; |
338 | struct of_regulator_match rmatch[ARRAY_SIZE(max8660_reg)]; | 338 | struct of_regulator_match rmatch[ARRAY_SIZE(max8660_reg)] = { }; |
339 | 339 | ||
340 | np = of_get_child_by_name(dev->of_node, "regulators"); | 340 | np = of_get_child_by_name(dev->of_node, "regulators"); |
341 | if (!np) { | 341 | if (!np) { |
diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c index 7a51814abdc5..5a1d4afa4776 100644 --- a/drivers/regulator/of_regulator.c +++ b/drivers/regulator/of_regulator.c | |||
@@ -211,7 +211,8 @@ struct regulator_init_data *regulator_of_get_init_data(struct device *dev, | |||
211 | search = dev->of_node; | 211 | search = dev->of_node; |
212 | 212 | ||
213 | if (!search) { | 213 | if (!search) { |
214 | dev_err(dev, "Failed to find regulator container node\n"); | 214 | dev_dbg(dev, "Failed to find regulator container node '%s'\n", |
215 | desc->regulators_node); | ||
215 | return NULL; | 216 | return NULL; |
216 | } | 217 | } |
217 | 218 | ||
diff --git a/drivers/regulator/rk808-regulator.c b/drivers/regulator/rk808-regulator.c index e305416d7697..196a5c8838c4 100644 --- a/drivers/regulator/rk808-regulator.c +++ b/drivers/regulator/rk808-regulator.c | |||
@@ -44,7 +44,7 @@ static const int rk808_buck_config_regs[] = { | |||
44 | }; | 44 | }; |
45 | 45 | ||
46 | static const struct regulator_linear_range rk808_buck_voltage_ranges[] = { | 46 | static const struct regulator_linear_range rk808_buck_voltage_ranges[] = { |
47 | REGULATOR_LINEAR_RANGE(700000, 0, 63, 12500), | 47 | REGULATOR_LINEAR_RANGE(712500, 0, 63, 12500), |
48 | }; | 48 | }; |
49 | 49 | ||
50 | static const struct regulator_linear_range rk808_buck4_voltage_ranges[] = { | 50 | static const struct regulator_linear_range rk808_buck4_voltage_ranges[] = { |
diff --git a/drivers/regulator/s2mpa01.c b/drivers/regulator/s2mpa01.c index 4acefa6b462e..7633b9bfbe6e 100644 --- a/drivers/regulator/s2mpa01.c +++ b/drivers/regulator/s2mpa01.c | |||
@@ -341,7 +341,7 @@ static int s2mpa01_pmic_probe(struct platform_device *pdev) | |||
341 | { | 341 | { |
342 | struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent); | 342 | struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent); |
343 | struct sec_platform_data *pdata = dev_get_platdata(iodev->dev); | 343 | struct sec_platform_data *pdata = dev_get_platdata(iodev->dev); |
344 | struct of_regulator_match rdata[S2MPA01_REGULATOR_MAX]; | 344 | struct of_regulator_match rdata[S2MPA01_REGULATOR_MAX] = { }; |
345 | struct device_node *reg_np = NULL; | 345 | struct device_node *reg_np = NULL; |
346 | struct regulator_config config = { }; | 346 | struct regulator_config config = { }; |
347 | struct s2mpa01_info *s2mpa01; | 347 | struct s2mpa01_info *s2mpa01; |
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index 94ae1798d48a..6dd12ddbabc6 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig | |||
@@ -1320,7 +1320,7 @@ config RTC_DRV_LPC32XX | |||
1320 | 1320 | ||
1321 | config RTC_DRV_PM8XXX | 1321 | config RTC_DRV_PM8XXX |
1322 | tristate "Qualcomm PMIC8XXX RTC" | 1322 | tristate "Qualcomm PMIC8XXX RTC" |
1323 | depends on MFD_PM8XXX | 1323 | depends on MFD_PM8XXX || MFD_SPMI_PMIC |
1324 | help | 1324 | help |
1325 | If you say yes here you get support for the | 1325 | If you say yes here you get support for the |
1326 | Qualcomm PMIC8XXX RTC. | 1326 | Qualcomm PMIC8XXX RTC. |
diff --git a/drivers/rtc/rtc-bq32k.c b/drivers/rtc/rtc-bq32k.c index 314129e66d6e..92679df6d6e2 100644 --- a/drivers/rtc/rtc-bq32k.c +++ b/drivers/rtc/rtc-bq32k.c | |||
@@ -160,7 +160,7 @@ static int trickle_charger_of_init(struct device *dev, struct device_node *node) | |||
160 | dev_err(dev, "bq32k: diode and resistor mismatch\n"); | 160 | dev_err(dev, "bq32k: diode and resistor mismatch\n"); |
161 | return -EINVAL; | 161 | return -EINVAL; |
162 | } | 162 | } |
163 | reg = 0x25; | 163 | reg = 0x45; |
164 | break; | 164 | break; |
165 | 165 | ||
166 | default: | 166 | default: |
diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c index 197699f358c7..5adcf111fc14 100644 --- a/drivers/rtc/rtc-pm8xxx.c +++ b/drivers/rtc/rtc-pm8xxx.c | |||
@@ -27,21 +27,36 @@ | |||
27 | 27 | ||
28 | /* RTC_CTRL register bit fields */ | 28 | /* RTC_CTRL register bit fields */ |
29 | #define PM8xxx_RTC_ENABLE BIT(7) | 29 | #define PM8xxx_RTC_ENABLE BIT(7) |
30 | #define PM8xxx_RTC_ALARM_ENABLE BIT(1) | ||
31 | #define PM8xxx_RTC_ALARM_CLEAR BIT(0) | 30 | #define PM8xxx_RTC_ALARM_CLEAR BIT(0) |
32 | 31 | ||
33 | #define NUM_8_BIT_RTC_REGS 0x4 | 32 | #define NUM_8_BIT_RTC_REGS 0x4 |
34 | 33 | ||
35 | /** | 34 | /** |
35 | * struct pm8xxx_rtc_regs - describe RTC registers per PMIC versions | ||
36 | * @ctrl: base address of control register | ||
37 | * @write: base address of write register | ||
38 | * @read: base address of read register | ||
39 | * @alarm_ctrl: base address of alarm control register | ||
40 | * @alarm_ctrl2: base address of alarm control2 register | ||
41 | * @alarm_rw: base address of alarm read-write register | ||
42 | * @alarm_en: alarm enable mask | ||
43 | */ | ||
44 | struct pm8xxx_rtc_regs { | ||
45 | unsigned int ctrl; | ||
46 | unsigned int write; | ||
47 | unsigned int read; | ||
48 | unsigned int alarm_ctrl; | ||
49 | unsigned int alarm_ctrl2; | ||
50 | unsigned int alarm_rw; | ||
51 | unsigned int alarm_en; | ||
52 | }; | ||
53 | |||
54 | /** | ||
36 | * struct pm8xxx_rtc - rtc driver internal structure | 55 | * struct pm8xxx_rtc - rtc driver internal structure |
37 | * @rtc: rtc device for this driver. | 56 | * @rtc: rtc device for this driver. |
38 | * @regmap: regmap used to access RTC registers | 57 | * @regmap: regmap used to access RTC registers |
39 | * @allow_set_time: indicates whether writing to the RTC is allowed | 58 | * @allow_set_time: indicates whether writing to the RTC is allowed |
40 | * @rtc_alarm_irq: rtc alarm irq number. | 59 | * @rtc_alarm_irq: rtc alarm irq number. |
41 | * @rtc_base: address of rtc control register. | ||
42 | * @rtc_read_base: base address of read registers. | ||
43 | * @rtc_write_base: base address of write registers. | ||
44 | * @alarm_rw_base: base address of alarm registers. | ||
45 | * @ctrl_reg: rtc control register. | 60 | * @ctrl_reg: rtc control register. |
46 | * @rtc_dev: device structure. | 61 | * @rtc_dev: device structure. |
47 | * @ctrl_reg_lock: spinlock protecting access to ctrl_reg. | 62 | * @ctrl_reg_lock: spinlock protecting access to ctrl_reg. |
@@ -51,11 +66,7 @@ struct pm8xxx_rtc { | |||
51 | struct regmap *regmap; | 66 | struct regmap *regmap; |
52 | bool allow_set_time; | 67 | bool allow_set_time; |
53 | int rtc_alarm_irq; | 68 | int rtc_alarm_irq; |
54 | int rtc_base; | 69 | const struct pm8xxx_rtc_regs *regs; |
55 | int rtc_read_base; | ||
56 | int rtc_write_base; | ||
57 | int alarm_rw_base; | ||
58 | u8 ctrl_reg; | ||
59 | struct device *rtc_dev; | 70 | struct device *rtc_dev; |
60 | spinlock_t ctrl_reg_lock; | 71 | spinlock_t ctrl_reg_lock; |
61 | }; | 72 | }; |
@@ -71,8 +82,10 @@ static int pm8xxx_rtc_set_time(struct device *dev, struct rtc_time *tm) | |||
71 | { | 82 | { |
72 | int rc, i; | 83 | int rc, i; |
73 | unsigned long secs, irq_flags; | 84 | unsigned long secs, irq_flags; |
74 | u8 value[NUM_8_BIT_RTC_REGS], alarm_enabled = 0, ctrl_reg; | 85 | u8 value[NUM_8_BIT_RTC_REGS], alarm_enabled = 0; |
86 | unsigned int ctrl_reg; | ||
75 | struct pm8xxx_rtc *rtc_dd = dev_get_drvdata(dev); | 87 | struct pm8xxx_rtc *rtc_dd = dev_get_drvdata(dev); |
88 | const struct pm8xxx_rtc_regs *regs = rtc_dd->regs; | ||
76 | 89 | ||
77 | if (!rtc_dd->allow_set_time) | 90 | if (!rtc_dd->allow_set_time) |
78 | return -EACCES; | 91 | return -EACCES; |
@@ -87,30 +100,30 @@ static int pm8xxx_rtc_set_time(struct device *dev, struct rtc_time *tm) | |||
87 | dev_dbg(dev, "Seconds value to be written to RTC = %lu\n", secs); | 100 | dev_dbg(dev, "Seconds value to be written to RTC = %lu\n", secs); |
88 | 101 | ||
89 | spin_lock_irqsave(&rtc_dd->ctrl_reg_lock, irq_flags); | 102 | spin_lock_irqsave(&rtc_dd->ctrl_reg_lock, irq_flags); |
90 | ctrl_reg = rtc_dd->ctrl_reg; | ||
91 | 103 | ||
92 | if (ctrl_reg & PM8xxx_RTC_ALARM_ENABLE) { | 104 | rc = regmap_read(rtc_dd->regmap, regs->ctrl, &ctrl_reg); |
105 | if (rc) | ||
106 | goto rtc_rw_fail; | ||
107 | |||
108 | if (ctrl_reg & regs->alarm_en) { | ||
93 | alarm_enabled = 1; | 109 | alarm_enabled = 1; |
94 | ctrl_reg &= ~PM8xxx_RTC_ALARM_ENABLE; | 110 | ctrl_reg &= ~regs->alarm_en; |
95 | rc = regmap_write(rtc_dd->regmap, rtc_dd->rtc_base, ctrl_reg); | 111 | rc = regmap_write(rtc_dd->regmap, regs->ctrl, ctrl_reg); |
96 | if (rc) { | 112 | if (rc) { |
97 | dev_err(dev, "Write to RTC control register failed\n"); | 113 | dev_err(dev, "Write to RTC control register failed\n"); |
98 | goto rtc_rw_fail; | 114 | goto rtc_rw_fail; |
99 | } | 115 | } |
100 | rtc_dd->ctrl_reg = ctrl_reg; | ||
101 | } else { | ||
102 | spin_unlock_irqrestore(&rtc_dd->ctrl_reg_lock, irq_flags); | ||
103 | } | 116 | } |
104 | 117 | ||
105 | /* Write 0 to Byte[0] */ | 118 | /* Write 0 to Byte[0] */ |
106 | rc = regmap_write(rtc_dd->regmap, rtc_dd->rtc_write_base, 0); | 119 | rc = regmap_write(rtc_dd->regmap, regs->write, 0); |
107 | if (rc) { | 120 | if (rc) { |
108 | dev_err(dev, "Write to RTC write data register failed\n"); | 121 | dev_err(dev, "Write to RTC write data register failed\n"); |
109 | goto rtc_rw_fail; | 122 | goto rtc_rw_fail; |
110 | } | 123 | } |
111 | 124 | ||
112 | /* Write Byte[1], Byte[2], Byte[3] */ | 125 | /* Write Byte[1], Byte[2], Byte[3] */ |
113 | rc = regmap_bulk_write(rtc_dd->regmap, rtc_dd->rtc_write_base + 1, | 126 | rc = regmap_bulk_write(rtc_dd->regmap, regs->write + 1, |
114 | &value[1], sizeof(value) - 1); | 127 | &value[1], sizeof(value) - 1); |
115 | if (rc) { | 128 | if (rc) { |
116 | dev_err(dev, "Write to RTC write data register failed\n"); | 129 | dev_err(dev, "Write to RTC write data register failed\n"); |
@@ -118,25 +131,23 @@ static int pm8xxx_rtc_set_time(struct device *dev, struct rtc_time *tm) | |||
118 | } | 131 | } |
119 | 132 | ||
120 | /* Write Byte[0] */ | 133 | /* Write Byte[0] */ |
121 | rc = regmap_write(rtc_dd->regmap, rtc_dd->rtc_write_base, value[0]); | 134 | rc = regmap_write(rtc_dd->regmap, regs->write, value[0]); |
122 | if (rc) { | 135 | if (rc) { |
123 | dev_err(dev, "Write to RTC write data register failed\n"); | 136 | dev_err(dev, "Write to RTC write data register failed\n"); |
124 | goto rtc_rw_fail; | 137 | goto rtc_rw_fail; |
125 | } | 138 | } |
126 | 139 | ||
127 | if (alarm_enabled) { | 140 | if (alarm_enabled) { |
128 | ctrl_reg |= PM8xxx_RTC_ALARM_ENABLE; | 141 | ctrl_reg |= regs->alarm_en; |
129 | rc = regmap_write(rtc_dd->regmap, rtc_dd->rtc_base, ctrl_reg); | 142 | rc = regmap_write(rtc_dd->regmap, regs->ctrl, ctrl_reg); |
130 | if (rc) { | 143 | if (rc) { |
131 | dev_err(dev, "Write to RTC control register failed\n"); | 144 | dev_err(dev, "Write to RTC control register failed\n"); |
132 | goto rtc_rw_fail; | 145 | goto rtc_rw_fail; |
133 | } | 146 | } |
134 | rtc_dd->ctrl_reg = ctrl_reg; | ||
135 | } | 147 | } |
136 | 148 | ||
137 | rtc_rw_fail: | 149 | rtc_rw_fail: |
138 | if (alarm_enabled) | 150 | spin_unlock_irqrestore(&rtc_dd->ctrl_reg_lock, irq_flags); |
139 | spin_unlock_irqrestore(&rtc_dd->ctrl_reg_lock, irq_flags); | ||
140 | 151 | ||
141 | return rc; | 152 | return rc; |
142 | } | 153 | } |
@@ -148,9 +159,9 @@ static int pm8xxx_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
148 | unsigned long secs; | 159 | unsigned long secs; |
149 | unsigned int reg; | 160 | unsigned int reg; |
150 | struct pm8xxx_rtc *rtc_dd = dev_get_drvdata(dev); | 161 | struct pm8xxx_rtc *rtc_dd = dev_get_drvdata(dev); |
162 | const struct pm8xxx_rtc_regs *regs = rtc_dd->regs; | ||
151 | 163 | ||
152 | rc = regmap_bulk_read(rtc_dd->regmap, rtc_dd->rtc_read_base, | 164 | rc = regmap_bulk_read(rtc_dd->regmap, regs->read, value, sizeof(value)); |
153 | value, sizeof(value)); | ||
154 | if (rc) { | 165 | if (rc) { |
155 | dev_err(dev, "RTC read data register failed\n"); | 166 | dev_err(dev, "RTC read data register failed\n"); |
156 | return rc; | 167 | return rc; |
@@ -160,14 +171,14 @@ static int pm8xxx_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
160 | * Read the LSB again and check if there has been a carry over. | 171 | * Read the LSB again and check if there has been a carry over. |
161 | * If there is, redo the read operation. | 172 | * If there is, redo the read operation. |
162 | */ | 173 | */ |
163 | rc = regmap_read(rtc_dd->regmap, rtc_dd->rtc_read_base, ®); | 174 | rc = regmap_read(rtc_dd->regmap, regs->read, ®); |
164 | if (rc < 0) { | 175 | if (rc < 0) { |
165 | dev_err(dev, "RTC read data register failed\n"); | 176 | dev_err(dev, "RTC read data register failed\n"); |
166 | return rc; | 177 | return rc; |
167 | } | 178 | } |
168 | 179 | ||
169 | if (unlikely(reg < value[0])) { | 180 | if (unlikely(reg < value[0])) { |
170 | rc = regmap_bulk_read(rtc_dd->regmap, rtc_dd->rtc_read_base, | 181 | rc = regmap_bulk_read(rtc_dd->regmap, regs->read, |
171 | value, sizeof(value)); | 182 | value, sizeof(value)); |
172 | if (rc) { | 183 | if (rc) { |
173 | dev_err(dev, "RTC read data register failed\n"); | 184 | dev_err(dev, "RTC read data register failed\n"); |
@@ -195,9 +206,11 @@ static int pm8xxx_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
195 | static int pm8xxx_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm) | 206 | static int pm8xxx_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm) |
196 | { | 207 | { |
197 | int rc, i; | 208 | int rc, i; |
198 | u8 value[NUM_8_BIT_RTC_REGS], ctrl_reg; | 209 | u8 value[NUM_8_BIT_RTC_REGS]; |
210 | unsigned int ctrl_reg; | ||
199 | unsigned long secs, irq_flags; | 211 | unsigned long secs, irq_flags; |
200 | struct pm8xxx_rtc *rtc_dd = dev_get_drvdata(dev); | 212 | struct pm8xxx_rtc *rtc_dd = dev_get_drvdata(dev); |
213 | const struct pm8xxx_rtc_regs *regs = rtc_dd->regs; | ||
201 | 214 | ||
202 | rtc_tm_to_time(&alarm->time, &secs); | 215 | rtc_tm_to_time(&alarm->time, &secs); |
203 | 216 | ||
@@ -208,28 +221,28 @@ static int pm8xxx_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm) | |||
208 | 221 | ||
209 | spin_lock_irqsave(&rtc_dd->ctrl_reg_lock, irq_flags); | 222 | spin_lock_irqsave(&rtc_dd->ctrl_reg_lock, irq_flags); |
210 | 223 | ||
211 | rc = regmap_bulk_write(rtc_dd->regmap, rtc_dd->alarm_rw_base, value, | 224 | rc = regmap_bulk_write(rtc_dd->regmap, regs->alarm_rw, value, |
212 | sizeof(value)); | 225 | sizeof(value)); |
213 | if (rc) { | 226 | if (rc) { |
214 | dev_err(dev, "Write to RTC ALARM register failed\n"); | 227 | dev_err(dev, "Write to RTC ALARM register failed\n"); |
215 | goto rtc_rw_fail; | 228 | goto rtc_rw_fail; |
216 | } | 229 | } |
217 | 230 | ||
218 | ctrl_reg = rtc_dd->ctrl_reg; | 231 | rc = regmap_read(rtc_dd->regmap, regs->alarm_ctrl, &ctrl_reg); |
232 | if (rc) | ||
233 | goto rtc_rw_fail; | ||
219 | 234 | ||
220 | if (alarm->enabled) | 235 | if (alarm->enabled) |
221 | ctrl_reg |= PM8xxx_RTC_ALARM_ENABLE; | 236 | ctrl_reg |= regs->alarm_en; |
222 | else | 237 | else |
223 | ctrl_reg &= ~PM8xxx_RTC_ALARM_ENABLE; | 238 | ctrl_reg &= ~regs->alarm_en; |
224 | 239 | ||
225 | rc = regmap_write(rtc_dd->regmap, rtc_dd->rtc_base, ctrl_reg); | 240 | rc = regmap_write(rtc_dd->regmap, regs->alarm_ctrl, ctrl_reg); |
226 | if (rc) { | 241 | if (rc) { |
227 | dev_err(dev, "Write to RTC control register failed\n"); | 242 | dev_err(dev, "Write to RTC alarm control register failed\n"); |
228 | goto rtc_rw_fail; | 243 | goto rtc_rw_fail; |
229 | } | 244 | } |
230 | 245 | ||
231 | rtc_dd->ctrl_reg = ctrl_reg; | ||
232 | |||
233 | dev_dbg(dev, "Alarm Set for h:r:s=%d:%d:%d, d/m/y=%d/%d/%d\n", | 246 | dev_dbg(dev, "Alarm Set for h:r:s=%d:%d:%d, d/m/y=%d/%d/%d\n", |
234 | alarm->time.tm_hour, alarm->time.tm_min, | 247 | alarm->time.tm_hour, alarm->time.tm_min, |
235 | alarm->time.tm_sec, alarm->time.tm_mday, | 248 | alarm->time.tm_sec, alarm->time.tm_mday, |
@@ -245,8 +258,9 @@ static int pm8xxx_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alarm) | |||
245 | u8 value[NUM_8_BIT_RTC_REGS]; | 258 | u8 value[NUM_8_BIT_RTC_REGS]; |
246 | unsigned long secs; | 259 | unsigned long secs; |
247 | struct pm8xxx_rtc *rtc_dd = dev_get_drvdata(dev); | 260 | struct pm8xxx_rtc *rtc_dd = dev_get_drvdata(dev); |
261 | const struct pm8xxx_rtc_regs *regs = rtc_dd->regs; | ||
248 | 262 | ||
249 | rc = regmap_bulk_read(rtc_dd->regmap, rtc_dd->alarm_rw_base, value, | 263 | rc = regmap_bulk_read(rtc_dd->regmap, regs->alarm_rw, value, |
250 | sizeof(value)); | 264 | sizeof(value)); |
251 | if (rc) { | 265 | if (rc) { |
252 | dev_err(dev, "RTC alarm time read failed\n"); | 266 | dev_err(dev, "RTC alarm time read failed\n"); |
@@ -276,25 +290,26 @@ static int pm8xxx_rtc_alarm_irq_enable(struct device *dev, unsigned int enable) | |||
276 | int rc; | 290 | int rc; |
277 | unsigned long irq_flags; | 291 | unsigned long irq_flags; |
278 | struct pm8xxx_rtc *rtc_dd = dev_get_drvdata(dev); | 292 | struct pm8xxx_rtc *rtc_dd = dev_get_drvdata(dev); |
279 | u8 ctrl_reg; | 293 | const struct pm8xxx_rtc_regs *regs = rtc_dd->regs; |
294 | unsigned int ctrl_reg; | ||
280 | 295 | ||
281 | spin_lock_irqsave(&rtc_dd->ctrl_reg_lock, irq_flags); | 296 | spin_lock_irqsave(&rtc_dd->ctrl_reg_lock, irq_flags); |
282 | 297 | ||
283 | ctrl_reg = rtc_dd->ctrl_reg; | 298 | rc = regmap_read(rtc_dd->regmap, regs->alarm_ctrl, &ctrl_reg); |
299 | if (rc) | ||
300 | goto rtc_rw_fail; | ||
284 | 301 | ||
285 | if (enable) | 302 | if (enable) |
286 | ctrl_reg |= PM8xxx_RTC_ALARM_ENABLE; | 303 | ctrl_reg |= regs->alarm_en; |
287 | else | 304 | else |
288 | ctrl_reg &= ~PM8xxx_RTC_ALARM_ENABLE; | 305 | ctrl_reg &= ~regs->alarm_en; |
289 | 306 | ||
290 | rc = regmap_write(rtc_dd->regmap, rtc_dd->rtc_base, ctrl_reg); | 307 | rc = regmap_write(rtc_dd->regmap, regs->alarm_ctrl, ctrl_reg); |
291 | if (rc) { | 308 | if (rc) { |
292 | dev_err(dev, "Write to RTC control register failed\n"); | 309 | dev_err(dev, "Write to RTC control register failed\n"); |
293 | goto rtc_rw_fail; | 310 | goto rtc_rw_fail; |
294 | } | 311 | } |
295 | 312 | ||
296 | rtc_dd->ctrl_reg = ctrl_reg; | ||
297 | |||
298 | rtc_rw_fail: | 313 | rtc_rw_fail: |
299 | spin_unlock_irqrestore(&rtc_dd->ctrl_reg_lock, irq_flags); | 314 | spin_unlock_irqrestore(&rtc_dd->ctrl_reg_lock, irq_flags); |
300 | return rc; | 315 | return rc; |
@@ -311,6 +326,7 @@ static const struct rtc_class_ops pm8xxx_rtc_ops = { | |||
311 | static irqreturn_t pm8xxx_alarm_trigger(int irq, void *dev_id) | 326 | static irqreturn_t pm8xxx_alarm_trigger(int irq, void *dev_id) |
312 | { | 327 | { |
313 | struct pm8xxx_rtc *rtc_dd = dev_id; | 328 | struct pm8xxx_rtc *rtc_dd = dev_id; |
329 | const struct pm8xxx_rtc_regs *regs = rtc_dd->regs; | ||
314 | unsigned int ctrl_reg; | 330 | unsigned int ctrl_reg; |
315 | int rc; | 331 | int rc; |
316 | unsigned long irq_flags; | 332 | unsigned long irq_flags; |
@@ -320,48 +336,100 @@ static irqreturn_t pm8xxx_alarm_trigger(int irq, void *dev_id) | |||
320 | spin_lock_irqsave(&rtc_dd->ctrl_reg_lock, irq_flags); | 336 | spin_lock_irqsave(&rtc_dd->ctrl_reg_lock, irq_flags); |
321 | 337 | ||
322 | /* Clear the alarm enable bit */ | 338 | /* Clear the alarm enable bit */ |
323 | ctrl_reg = rtc_dd->ctrl_reg; | 339 | rc = regmap_read(rtc_dd->regmap, regs->alarm_ctrl, &ctrl_reg); |
324 | ctrl_reg &= ~PM8xxx_RTC_ALARM_ENABLE; | 340 | if (rc) { |
341 | spin_unlock_irqrestore(&rtc_dd->ctrl_reg_lock, irq_flags); | ||
342 | goto rtc_alarm_handled; | ||
343 | } | ||
344 | |||
345 | ctrl_reg &= ~regs->alarm_en; | ||
325 | 346 | ||
326 | rc = regmap_write(rtc_dd->regmap, rtc_dd->rtc_base, ctrl_reg); | 347 | rc = regmap_write(rtc_dd->regmap, regs->alarm_ctrl, ctrl_reg); |
327 | if (rc) { | 348 | if (rc) { |
328 | spin_unlock_irqrestore(&rtc_dd->ctrl_reg_lock, irq_flags); | 349 | spin_unlock_irqrestore(&rtc_dd->ctrl_reg_lock, irq_flags); |
329 | dev_err(rtc_dd->rtc_dev, | 350 | dev_err(rtc_dd->rtc_dev, |
330 | "Write to RTC control register failed\n"); | 351 | "Write to alarm control register failed\n"); |
331 | goto rtc_alarm_handled; | 352 | goto rtc_alarm_handled; |
332 | } | 353 | } |
333 | 354 | ||
334 | rtc_dd->ctrl_reg = ctrl_reg; | ||
335 | spin_unlock_irqrestore(&rtc_dd->ctrl_reg_lock, irq_flags); | 355 | spin_unlock_irqrestore(&rtc_dd->ctrl_reg_lock, irq_flags); |
336 | 356 | ||
337 | /* Clear RTC alarm register */ | 357 | /* Clear RTC alarm register */ |
338 | rc = regmap_read(rtc_dd->regmap, | 358 | rc = regmap_read(rtc_dd->regmap, regs->alarm_ctrl2, &ctrl_reg); |
339 | rtc_dd->rtc_base + PM8XXX_ALARM_CTRL_OFFSET, | ||
340 | &ctrl_reg); | ||
341 | if (rc) { | 359 | if (rc) { |
342 | dev_err(rtc_dd->rtc_dev, | 360 | dev_err(rtc_dd->rtc_dev, |
343 | "RTC Alarm control register read failed\n"); | 361 | "RTC Alarm control2 register read failed\n"); |
344 | goto rtc_alarm_handled; | 362 | goto rtc_alarm_handled; |
345 | } | 363 | } |
346 | 364 | ||
347 | ctrl_reg &= ~PM8xxx_RTC_ALARM_CLEAR; | 365 | ctrl_reg |= PM8xxx_RTC_ALARM_CLEAR; |
348 | rc = regmap_write(rtc_dd->regmap, | 366 | rc = regmap_write(rtc_dd->regmap, regs->alarm_ctrl2, ctrl_reg); |
349 | rtc_dd->rtc_base + PM8XXX_ALARM_CTRL_OFFSET, | ||
350 | ctrl_reg); | ||
351 | if (rc) | 367 | if (rc) |
352 | dev_err(rtc_dd->rtc_dev, | 368 | dev_err(rtc_dd->rtc_dev, |
353 | "Write to RTC Alarm control register failed\n"); | 369 | "Write to RTC Alarm control2 register failed\n"); |
354 | 370 | ||
355 | rtc_alarm_handled: | 371 | rtc_alarm_handled: |
356 | return IRQ_HANDLED; | 372 | return IRQ_HANDLED; |
357 | } | 373 | } |
358 | 374 | ||
375 | static int pm8xxx_rtc_enable(struct pm8xxx_rtc *rtc_dd) | ||
376 | { | ||
377 | const struct pm8xxx_rtc_regs *regs = rtc_dd->regs; | ||
378 | unsigned int ctrl_reg; | ||
379 | int rc; | ||
380 | |||
381 | /* Check if the RTC is on, else turn it on */ | ||
382 | rc = regmap_read(rtc_dd->regmap, regs->ctrl, &ctrl_reg); | ||
383 | if (rc) | ||
384 | return rc; | ||
385 | |||
386 | if (!(ctrl_reg & PM8xxx_RTC_ENABLE)) { | ||
387 | ctrl_reg |= PM8xxx_RTC_ENABLE; | ||
388 | rc = regmap_write(rtc_dd->regmap, regs->ctrl, ctrl_reg); | ||
389 | if (rc) | ||
390 | return rc; | ||
391 | } | ||
392 | |||
393 | return 0; | ||
394 | } | ||
395 | |||
396 | static const struct pm8xxx_rtc_regs pm8921_regs = { | ||
397 | .ctrl = 0x11d, | ||
398 | .write = 0x11f, | ||
399 | .read = 0x123, | ||
400 | .alarm_rw = 0x127, | ||
401 | .alarm_ctrl = 0x11d, | ||
402 | .alarm_ctrl2 = 0x11e, | ||
403 | .alarm_en = BIT(1), | ||
404 | }; | ||
405 | |||
406 | static const struct pm8xxx_rtc_regs pm8058_regs = { | ||
407 | .ctrl = 0x1e8, | ||
408 | .write = 0x1ea, | ||
409 | .read = 0x1ee, | ||
410 | .alarm_rw = 0x1f2, | ||
411 | .alarm_ctrl = 0x1e8, | ||
412 | .alarm_ctrl2 = 0x1e9, | ||
413 | .alarm_en = BIT(1), | ||
414 | }; | ||
415 | |||
416 | static const struct pm8xxx_rtc_regs pm8941_regs = { | ||
417 | .ctrl = 0x6046, | ||
418 | .write = 0x6040, | ||
419 | .read = 0x6048, | ||
420 | .alarm_rw = 0x6140, | ||
421 | .alarm_ctrl = 0x6146, | ||
422 | .alarm_ctrl2 = 0x6148, | ||
423 | .alarm_en = BIT(7), | ||
424 | }; | ||
425 | |||
359 | /* | 426 | /* |
360 | * Hardcoded RTC bases until IORESOURCE_REG mapping is figured out | 427 | * Hardcoded RTC bases until IORESOURCE_REG mapping is figured out |
361 | */ | 428 | */ |
362 | static const struct of_device_id pm8xxx_id_table[] = { | 429 | static const struct of_device_id pm8xxx_id_table[] = { |
363 | { .compatible = "qcom,pm8921-rtc", .data = (void *) 0x11D }, | 430 | { .compatible = "qcom,pm8921-rtc", .data = &pm8921_regs }, |
364 | { .compatible = "qcom,pm8058-rtc", .data = (void *) 0x1E8 }, | 431 | { .compatible = "qcom,pm8058-rtc", .data = &pm8058_regs }, |
432 | { .compatible = "qcom,pm8941-rtc", .data = &pm8941_regs }, | ||
365 | { }, | 433 | { }, |
366 | }; | 434 | }; |
367 | MODULE_DEVICE_TABLE(of, pm8xxx_id_table); | 435 | MODULE_DEVICE_TABLE(of, pm8xxx_id_table); |
@@ -369,7 +437,6 @@ MODULE_DEVICE_TABLE(of, pm8xxx_id_table); | |||
369 | static int pm8xxx_rtc_probe(struct platform_device *pdev) | 437 | static int pm8xxx_rtc_probe(struct platform_device *pdev) |
370 | { | 438 | { |
371 | int rc; | 439 | int rc; |
372 | unsigned int ctrl_reg; | ||
373 | struct pm8xxx_rtc *rtc_dd; | 440 | struct pm8xxx_rtc *rtc_dd; |
374 | const struct of_device_id *match; | 441 | const struct of_device_id *match; |
375 | 442 | ||
@@ -399,33 +466,12 @@ static int pm8xxx_rtc_probe(struct platform_device *pdev) | |||
399 | rtc_dd->allow_set_time = of_property_read_bool(pdev->dev.of_node, | 466 | rtc_dd->allow_set_time = of_property_read_bool(pdev->dev.of_node, |
400 | "allow-set-time"); | 467 | "allow-set-time"); |
401 | 468 | ||
402 | rtc_dd->rtc_base = (long) match->data; | 469 | rtc_dd->regs = match->data; |
403 | |||
404 | /* Setup RTC register addresses */ | ||
405 | rtc_dd->rtc_write_base = rtc_dd->rtc_base + PM8XXX_RTC_WRITE_OFFSET; | ||
406 | rtc_dd->rtc_read_base = rtc_dd->rtc_base + PM8XXX_RTC_READ_OFFSET; | ||
407 | rtc_dd->alarm_rw_base = rtc_dd->rtc_base + PM8XXX_ALARM_RW_OFFSET; | ||
408 | |||
409 | rtc_dd->rtc_dev = &pdev->dev; | 470 | rtc_dd->rtc_dev = &pdev->dev; |
410 | 471 | ||
411 | /* Check if the RTC is on, else turn it on */ | 472 | rc = pm8xxx_rtc_enable(rtc_dd); |
412 | rc = regmap_read(rtc_dd->regmap, rtc_dd->rtc_base, &ctrl_reg); | 473 | if (rc) |
413 | if (rc) { | ||
414 | dev_err(&pdev->dev, "RTC control register read failed!\n"); | ||
415 | return rc; | 474 | return rc; |
416 | } | ||
417 | |||
418 | if (!(ctrl_reg & PM8xxx_RTC_ENABLE)) { | ||
419 | ctrl_reg |= PM8xxx_RTC_ENABLE; | ||
420 | rc = regmap_write(rtc_dd->regmap, rtc_dd->rtc_base, ctrl_reg); | ||
421 | if (rc) { | ||
422 | dev_err(&pdev->dev, | ||
423 | "Write to RTC control register failed\n"); | ||
424 | return rc; | ||
425 | } | ||
426 | } | ||
427 | |||
428 | rtc_dd->ctrl_reg = ctrl_reg; | ||
429 | 475 | ||
430 | platform_set_drvdata(pdev, rtc_dd); | 476 | platform_set_drvdata(pdev, rtc_dd); |
431 | 477 | ||
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index a6b1252c9941..806072238c00 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c | |||
@@ -535,13 +535,15 @@ static int s3c_rtc_probe(struct platform_device *pdev) | |||
535 | } | 535 | } |
536 | clk_prepare_enable(info->rtc_clk); | 536 | clk_prepare_enable(info->rtc_clk); |
537 | 537 | ||
538 | info->rtc_src_clk = devm_clk_get(&pdev->dev, "rtc_src"); | 538 | if (info->data->needs_src_clk) { |
539 | if (IS_ERR(info->rtc_src_clk)) { | 539 | info->rtc_src_clk = devm_clk_get(&pdev->dev, "rtc_src"); |
540 | dev_err(&pdev->dev, "failed to find rtc source clock\n"); | 540 | if (IS_ERR(info->rtc_src_clk)) { |
541 | return PTR_ERR(info->rtc_src_clk); | 541 | dev_err(&pdev->dev, |
542 | "failed to find rtc source clock\n"); | ||
543 | return PTR_ERR(info->rtc_src_clk); | ||
544 | } | ||
545 | clk_prepare_enable(info->rtc_src_clk); | ||
542 | } | 546 | } |
543 | clk_prepare_enable(info->rtc_src_clk); | ||
544 | |||
545 | 547 | ||
546 | /* check to see if everything is setup correctly */ | 548 | /* check to see if everything is setup correctly */ |
547 | if (info->data->enable) | 549 | if (info->data->enable) |
diff --git a/drivers/s390/kvm/virtio_ccw.c b/drivers/s390/kvm/virtio_ccw.c index 6cbe6ef3c889..bda52f18e967 100644 --- a/drivers/s390/kvm/virtio_ccw.c +++ b/drivers/s390/kvm/virtio_ccw.c | |||
@@ -888,7 +888,6 @@ static void virtio_ccw_int_handler(struct ccw_device *cdev, | |||
888 | struct virtio_ccw_device *vcdev = dev_get_drvdata(&cdev->dev); | 888 | struct virtio_ccw_device *vcdev = dev_get_drvdata(&cdev->dev); |
889 | int i; | 889 | int i; |
890 | struct virtqueue *vq; | 890 | struct virtqueue *vq; |
891 | struct virtio_driver *drv; | ||
892 | 891 | ||
893 | if (!vcdev) | 892 | if (!vcdev) |
894 | return; | 893 | return; |
diff --git a/drivers/scsi/bnx2fc/bnx2fc_els.c b/drivers/scsi/bnx2fc/bnx2fc_els.c index ca75c7ca2559..ef355c13ccc4 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_els.c +++ b/drivers/scsi/bnx2fc/bnx2fc_els.c | |||
@@ -480,9 +480,7 @@ void bnx2fc_rec_compl(struct bnx2fc_els_cb_arg *cb_arg) | |||
480 | bnx2fc_initiate_cleanup(orig_io_req); | 480 | bnx2fc_initiate_cleanup(orig_io_req); |
481 | /* Post a new IO req with the same sc_cmd */ | 481 | /* Post a new IO req with the same sc_cmd */ |
482 | BNX2FC_IO_DBG(rec_req, "Post IO request again\n"); | 482 | BNX2FC_IO_DBG(rec_req, "Post IO request again\n"); |
483 | spin_unlock_bh(&tgt->tgt_lock); | ||
484 | rc = bnx2fc_post_io_req(tgt, new_io_req); | 483 | rc = bnx2fc_post_io_req(tgt, new_io_req); |
485 | spin_lock_bh(&tgt->tgt_lock); | ||
486 | if (!rc) | 484 | if (!rc) |
487 | goto free_frame; | 485 | goto free_frame; |
488 | BNX2FC_IO_DBG(rec_req, "REC: io post err\n"); | 486 | BNX2FC_IO_DBG(rec_req, "REC: io post err\n"); |
diff --git a/drivers/scsi/bnx2fc/bnx2fc_io.c b/drivers/scsi/bnx2fc/bnx2fc_io.c index 0679782d9d15..5b99844ef6bf 100644 --- a/drivers/scsi/bnx2fc/bnx2fc_io.c +++ b/drivers/scsi/bnx2fc/bnx2fc_io.c | |||
@@ -1894,18 +1894,24 @@ int bnx2fc_queuecommand(struct Scsi_Host *host, | |||
1894 | goto exit_qcmd; | 1894 | goto exit_qcmd; |
1895 | } | 1895 | } |
1896 | } | 1896 | } |
1897 | |||
1898 | spin_lock_bh(&tgt->tgt_lock); | ||
1899 | |||
1897 | io_req = bnx2fc_cmd_alloc(tgt); | 1900 | io_req = bnx2fc_cmd_alloc(tgt); |
1898 | if (!io_req) { | 1901 | if (!io_req) { |
1899 | rc = SCSI_MLQUEUE_HOST_BUSY; | 1902 | rc = SCSI_MLQUEUE_HOST_BUSY; |
1900 | goto exit_qcmd; | 1903 | goto exit_qcmd_tgtlock; |
1901 | } | 1904 | } |
1902 | io_req->sc_cmd = sc_cmd; | 1905 | io_req->sc_cmd = sc_cmd; |
1903 | 1906 | ||
1904 | if (bnx2fc_post_io_req(tgt, io_req)) { | 1907 | if (bnx2fc_post_io_req(tgt, io_req)) { |
1905 | printk(KERN_ERR PFX "Unable to post io_req\n"); | 1908 | printk(KERN_ERR PFX "Unable to post io_req\n"); |
1906 | rc = SCSI_MLQUEUE_HOST_BUSY; | 1909 | rc = SCSI_MLQUEUE_HOST_BUSY; |
1907 | goto exit_qcmd; | 1910 | goto exit_qcmd_tgtlock; |
1908 | } | 1911 | } |
1912 | |||
1913 | exit_qcmd_tgtlock: | ||
1914 | spin_unlock_bh(&tgt->tgt_lock); | ||
1909 | exit_qcmd: | 1915 | exit_qcmd: |
1910 | return rc; | 1916 | return rc; |
1911 | } | 1917 | } |
@@ -2020,6 +2026,8 @@ int bnx2fc_post_io_req(struct bnx2fc_rport *tgt, | |||
2020 | int task_idx, index; | 2026 | int task_idx, index; |
2021 | u16 xid; | 2027 | u16 xid; |
2022 | 2028 | ||
2029 | /* bnx2fc_post_io_req() is called with the tgt_lock held */ | ||
2030 | |||
2023 | /* Initialize rest of io_req fields */ | 2031 | /* Initialize rest of io_req fields */ |
2024 | io_req->cmd_type = BNX2FC_SCSI_CMD; | 2032 | io_req->cmd_type = BNX2FC_SCSI_CMD; |
2025 | io_req->port = port; | 2033 | io_req->port = port; |
@@ -2047,9 +2055,7 @@ int bnx2fc_post_io_req(struct bnx2fc_rport *tgt, | |||
2047 | /* Build buffer descriptor list for firmware from sg list */ | 2055 | /* Build buffer descriptor list for firmware from sg list */ |
2048 | if (bnx2fc_build_bd_list_from_sg(io_req)) { | 2056 | if (bnx2fc_build_bd_list_from_sg(io_req)) { |
2049 | printk(KERN_ERR PFX "BD list creation failed\n"); | 2057 | printk(KERN_ERR PFX "BD list creation failed\n"); |
2050 | spin_lock_bh(&tgt->tgt_lock); | ||
2051 | kref_put(&io_req->refcount, bnx2fc_cmd_release); | 2058 | kref_put(&io_req->refcount, bnx2fc_cmd_release); |
2052 | spin_unlock_bh(&tgt->tgt_lock); | ||
2053 | return -EAGAIN; | 2059 | return -EAGAIN; |
2054 | } | 2060 | } |
2055 | 2061 | ||
@@ -2061,19 +2067,15 @@ int bnx2fc_post_io_req(struct bnx2fc_rport *tgt, | |||
2061 | task = &(task_page[index]); | 2067 | task = &(task_page[index]); |
2062 | bnx2fc_init_task(io_req, task); | 2068 | bnx2fc_init_task(io_req, task); |
2063 | 2069 | ||
2064 | spin_lock_bh(&tgt->tgt_lock); | ||
2065 | |||
2066 | if (tgt->flush_in_prog) { | 2070 | if (tgt->flush_in_prog) { |
2067 | printk(KERN_ERR PFX "Flush in progress..Host Busy\n"); | 2071 | printk(KERN_ERR PFX "Flush in progress..Host Busy\n"); |
2068 | kref_put(&io_req->refcount, bnx2fc_cmd_release); | 2072 | kref_put(&io_req->refcount, bnx2fc_cmd_release); |
2069 | spin_unlock_bh(&tgt->tgt_lock); | ||
2070 | return -EAGAIN; | 2073 | return -EAGAIN; |
2071 | } | 2074 | } |
2072 | 2075 | ||
2073 | if (!test_bit(BNX2FC_FLAG_SESSION_READY, &tgt->flags)) { | 2076 | if (!test_bit(BNX2FC_FLAG_SESSION_READY, &tgt->flags)) { |
2074 | printk(KERN_ERR PFX "Session not ready...post_io\n"); | 2077 | printk(KERN_ERR PFX "Session not ready...post_io\n"); |
2075 | kref_put(&io_req->refcount, bnx2fc_cmd_release); | 2078 | kref_put(&io_req->refcount, bnx2fc_cmd_release); |
2076 | spin_unlock_bh(&tgt->tgt_lock); | ||
2077 | return -EAGAIN; | 2079 | return -EAGAIN; |
2078 | } | 2080 | } |
2079 | 2081 | ||
@@ -2091,6 +2093,5 @@ int bnx2fc_post_io_req(struct bnx2fc_rport *tgt, | |||
2091 | 2093 | ||
2092 | /* Ring doorbell */ | 2094 | /* Ring doorbell */ |
2093 | bnx2fc_ring_doorbell(tgt); | 2095 | bnx2fc_ring_doorbell(tgt); |
2094 | spin_unlock_bh(&tgt->tgt_lock); | ||
2095 | return 0; | 2096 | return 0; |
2096 | } | 2097 | } |
diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c index 3e0a0d315f72..81bb3bd7909d 100644 --- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c +++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | |||
@@ -936,20 +936,23 @@ static void do_abort_req_rss(struct cxgbi_device *cdev, struct sk_buff *skb) | |||
936 | cxgbi_sock_get(csk); | 936 | cxgbi_sock_get(csk); |
937 | spin_lock_bh(&csk->lock); | 937 | spin_lock_bh(&csk->lock); |
938 | 938 | ||
939 | if (!cxgbi_sock_flag(csk, CTPF_ABORT_REQ_RCVD)) { | 939 | cxgbi_sock_clear_flag(csk, CTPF_ABORT_REQ_RCVD); |
940 | cxgbi_sock_set_flag(csk, CTPF_ABORT_REQ_RCVD); | 940 | |
941 | cxgbi_sock_set_state(csk, CTP_ABORTING); | 941 | if (!cxgbi_sock_flag(csk, CTPF_TX_DATA_SENT)) { |
942 | goto done; | 942 | send_tx_flowc_wr(csk); |
943 | cxgbi_sock_set_flag(csk, CTPF_TX_DATA_SENT); | ||
943 | } | 944 | } |
944 | 945 | ||
945 | cxgbi_sock_clear_flag(csk, CTPF_ABORT_REQ_RCVD); | 946 | cxgbi_sock_set_flag(csk, CTPF_ABORT_REQ_RCVD); |
947 | cxgbi_sock_set_state(csk, CTP_ABORTING); | ||
948 | |||
946 | send_abort_rpl(csk, rst_status); | 949 | send_abort_rpl(csk, rst_status); |
947 | 950 | ||
948 | if (!cxgbi_sock_flag(csk, CTPF_ABORT_RPL_PENDING)) { | 951 | if (!cxgbi_sock_flag(csk, CTPF_ABORT_RPL_PENDING)) { |
949 | csk->err = abort_status_to_errno(csk, req->status, &rst_status); | 952 | csk->err = abort_status_to_errno(csk, req->status, &rst_status); |
950 | cxgbi_sock_closed(csk); | 953 | cxgbi_sock_closed(csk); |
951 | } | 954 | } |
952 | done: | 955 | |
953 | spin_unlock_bh(&csk->lock); | 956 | spin_unlock_bh(&csk->lock); |
954 | cxgbi_sock_put(csk); | 957 | cxgbi_sock_put(csk); |
955 | rel_skb: | 958 | rel_skb: |
diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c index 54fa6e0bc1bb..13d869a92248 100644 --- a/drivers/scsi/cxgbi/libcxgbi.c +++ b/drivers/scsi/cxgbi/libcxgbi.c | |||
@@ -399,6 +399,35 @@ EXPORT_SYMBOL_GPL(cxgbi_hbas_add); | |||
399 | * If the source port is outside our allocation range, the caller is | 399 | * If the source port is outside our allocation range, the caller is |
400 | * responsible for keeping track of their port usage. | 400 | * responsible for keeping track of their port usage. |
401 | */ | 401 | */ |
402 | |||
403 | static struct cxgbi_sock *find_sock_on_port(struct cxgbi_device *cdev, | ||
404 | unsigned char port_id) | ||
405 | { | ||
406 | struct cxgbi_ports_map *pmap = &cdev->pmap; | ||
407 | unsigned int i; | ||
408 | unsigned int used; | ||
409 | |||
410 | if (!pmap->max_connect || !pmap->used) | ||
411 | return NULL; | ||
412 | |||
413 | spin_lock_bh(&pmap->lock); | ||
414 | used = pmap->used; | ||
415 | for (i = 0; used && i < pmap->max_connect; i++) { | ||
416 | struct cxgbi_sock *csk = pmap->port_csk[i]; | ||
417 | |||
418 | if (csk) { | ||
419 | if (csk->port_id == port_id) { | ||
420 | spin_unlock_bh(&pmap->lock); | ||
421 | return csk; | ||
422 | } | ||
423 | used--; | ||
424 | } | ||
425 | } | ||
426 | spin_unlock_bh(&pmap->lock); | ||
427 | |||
428 | return NULL; | ||
429 | } | ||
430 | |||
402 | static int sock_get_port(struct cxgbi_sock *csk) | 431 | static int sock_get_port(struct cxgbi_sock *csk) |
403 | { | 432 | { |
404 | struct cxgbi_device *cdev = csk->cdev; | 433 | struct cxgbi_device *cdev = csk->cdev; |
@@ -749,6 +778,7 @@ static struct cxgbi_sock *cxgbi_check_route6(struct sockaddr *dst_addr) | |||
749 | csk->daddr6.sin6_addr = daddr6->sin6_addr; | 778 | csk->daddr6.sin6_addr = daddr6->sin6_addr; |
750 | csk->daddr6.sin6_port = daddr6->sin6_port; | 779 | csk->daddr6.sin6_port = daddr6->sin6_port; |
751 | csk->daddr6.sin6_family = daddr6->sin6_family; | 780 | csk->daddr6.sin6_family = daddr6->sin6_family; |
781 | csk->saddr6.sin6_family = daddr6->sin6_family; | ||
752 | csk->saddr6.sin6_addr = pref_saddr; | 782 | csk->saddr6.sin6_addr = pref_saddr; |
753 | 783 | ||
754 | neigh_release(n); | 784 | neigh_release(n); |
@@ -875,18 +905,16 @@ void cxgbi_sock_rcv_abort_rpl(struct cxgbi_sock *csk) | |||
875 | { | 905 | { |
876 | cxgbi_sock_get(csk); | 906 | cxgbi_sock_get(csk); |
877 | spin_lock_bh(&csk->lock); | 907 | spin_lock_bh(&csk->lock); |
908 | |||
909 | cxgbi_sock_set_flag(csk, CTPF_ABORT_RPL_RCVD); | ||
878 | if (cxgbi_sock_flag(csk, CTPF_ABORT_RPL_PENDING)) { | 910 | if (cxgbi_sock_flag(csk, CTPF_ABORT_RPL_PENDING)) { |
879 | if (!cxgbi_sock_flag(csk, CTPF_ABORT_RPL_RCVD)) | 911 | cxgbi_sock_clear_flag(csk, CTPF_ABORT_RPL_PENDING); |
880 | cxgbi_sock_set_flag(csk, CTPF_ABORT_RPL_RCVD); | 912 | if (cxgbi_sock_flag(csk, CTPF_ABORT_REQ_RCVD)) |
881 | else { | 913 | pr_err("csk 0x%p,%u,0x%lx,%u,ABT_RPL_RSS.\n", |
882 | cxgbi_sock_clear_flag(csk, CTPF_ABORT_RPL_RCVD); | 914 | csk, csk->state, csk->flags, csk->tid); |
883 | cxgbi_sock_clear_flag(csk, CTPF_ABORT_RPL_PENDING); | 915 | cxgbi_sock_closed(csk); |
884 | if (cxgbi_sock_flag(csk, CTPF_ABORT_REQ_RCVD)) | ||
885 | pr_err("csk 0x%p,%u,0x%lx,%u,ABT_RPL_RSS.\n", | ||
886 | csk, csk->state, csk->flags, csk->tid); | ||
887 | cxgbi_sock_closed(csk); | ||
888 | } | ||
889 | } | 916 | } |
917 | |||
890 | spin_unlock_bh(&csk->lock); | 918 | spin_unlock_bh(&csk->lock); |
891 | cxgbi_sock_put(csk); | 919 | cxgbi_sock_put(csk); |
892 | } | 920 | } |
@@ -2647,12 +2675,14 @@ int cxgbi_get_host_param(struct Scsi_Host *shost, enum iscsi_host_param param, | |||
2647 | break; | 2675 | break; |
2648 | case ISCSI_HOST_PARAM_IPADDRESS: | 2676 | case ISCSI_HOST_PARAM_IPADDRESS: |
2649 | { | 2677 | { |
2650 | __be32 addr; | 2678 | struct cxgbi_sock *csk = find_sock_on_port(chba->cdev, |
2651 | 2679 | chba->port_id); | |
2652 | addr = cxgbi_get_iscsi_ipv4(chba); | 2680 | if (csk) { |
2653 | len = sprintf(buf, "%pI4", &addr); | 2681 | len = sprintf(buf, "%pIS", |
2682 | (struct sockaddr *)&csk->saddr); | ||
2683 | } | ||
2654 | log_debug(1 << CXGBI_DBG_ISCSI, | 2684 | log_debug(1 << CXGBI_DBG_ISCSI, |
2655 | "hba %s, ipv4 %pI4.\n", chba->ndev->name, &addr); | 2685 | "hba %s, addr %s.\n", chba->ndev->name, buf); |
2656 | break; | 2686 | break; |
2657 | } | 2687 | } |
2658 | default: | 2688 | default: |
diff --git a/drivers/scsi/cxgbi/libcxgbi.h b/drivers/scsi/cxgbi/libcxgbi.h index 1d98fad6a0ab..2c7cb1c0c453 100644 --- a/drivers/scsi/cxgbi/libcxgbi.h +++ b/drivers/scsi/cxgbi/libcxgbi.h | |||
@@ -700,11 +700,6 @@ static inline void cxgbi_set_iscsi_ipv4(struct cxgbi_hba *chba, __be32 ipaddr) | |||
700 | chba->ndev->name); | 700 | chba->ndev->name); |
701 | } | 701 | } |
702 | 702 | ||
703 | static inline __be32 cxgbi_get_iscsi_ipv4(struct cxgbi_hba *chba) | ||
704 | { | ||
705 | return chba->ipv4addr; | ||
706 | } | ||
707 | |||
708 | struct cxgbi_device *cxgbi_device_register(unsigned int, unsigned int); | 703 | struct cxgbi_device *cxgbi_device_register(unsigned int, unsigned int); |
709 | void cxgbi_device_unregister(struct cxgbi_device *); | 704 | void cxgbi_device_unregister(struct cxgbi_device *); |
710 | void cxgbi_device_unregister_all(unsigned int flag); | 705 | void cxgbi_device_unregister_all(unsigned int flag); |
diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c index e99507ed0e3c..fd78bdc53528 100644 --- a/drivers/scsi/device_handler/scsi_dh_alua.c +++ b/drivers/scsi/device_handler/scsi_dh_alua.c | |||
@@ -474,6 +474,13 @@ static int alua_check_sense(struct scsi_device *sdev, | |||
474 | * LUN Not Ready -- Offline | 474 | * LUN Not Ready -- Offline |
475 | */ | 475 | */ |
476 | return SUCCESS; | 476 | return SUCCESS; |
477 | if (sdev->allow_restart && | ||
478 | sense_hdr->asc == 0x04 && sense_hdr->ascq == 0x02) | ||
479 | /* | ||
480 | * if the device is not started, we need to wake | ||
481 | * the error handler to start the motor | ||
482 | */ | ||
483 | return FAILED; | ||
477 | break; | 484 | break; |
478 | case UNIT_ATTENTION: | 485 | case UNIT_ATTENTION: |
479 | if (sense_hdr->asc == 0x29 && sense_hdr->ascq == 0x00) | 486 | if (sense_hdr->asc == 0x29 && sense_hdr->ascq == 0x00) |
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index f6a69a3b1b3f..5640ad1c8214 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c | |||
@@ -4453,7 +4453,7 @@ static int megasas_init_fw(struct megasas_instance *instance) | |||
4453 | instance->msixentry[i].entry = i; | 4453 | instance->msixentry[i].entry = i; |
4454 | i = pci_enable_msix_range(instance->pdev, instance->msixentry, | 4454 | i = pci_enable_msix_range(instance->pdev, instance->msixentry, |
4455 | 1, instance->msix_vectors); | 4455 | 1, instance->msix_vectors); |
4456 | if (i) | 4456 | if (i > 0) |
4457 | instance->msix_vectors = i; | 4457 | instance->msix_vectors = i; |
4458 | else | 4458 | else |
4459 | instance->msix_vectors = 0; | 4459 | instance->msix_vectors = 0; |
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 9a6f8468225f..bc5ff6ff9c79 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c | |||
@@ -459,14 +459,6 @@ static int scsi_check_sense(struct scsi_cmnd *scmd) | |||
459 | if (! scsi_command_normalize_sense(scmd, &sshdr)) | 459 | if (! scsi_command_normalize_sense(scmd, &sshdr)) |
460 | return FAILED; /* no valid sense data */ | 460 | return FAILED; /* no valid sense data */ |
461 | 461 | ||
462 | if (scmd->cmnd[0] == TEST_UNIT_READY && scmd->scsi_done != scsi_eh_done) | ||
463 | /* | ||
464 | * nasty: for mid-layer issued TURs, we need to return the | ||
465 | * actual sense data without any recovery attempt. For eh | ||
466 | * issued ones, we need to try to recover and interpret | ||
467 | */ | ||
468 | return SUCCESS; | ||
469 | |||
470 | scsi_report_sense(sdev, &sshdr); | 462 | scsi_report_sense(sdev, &sshdr); |
471 | 463 | ||
472 | if (scsi_sense_is_deferred(&sshdr)) | 464 | if (scsi_sense_is_deferred(&sshdr)) |
@@ -482,6 +474,14 @@ static int scsi_check_sense(struct scsi_cmnd *scmd) | |||
482 | /* handler does not care. Drop down to default handling */ | 474 | /* handler does not care. Drop down to default handling */ |
483 | } | 475 | } |
484 | 476 | ||
477 | if (scmd->cmnd[0] == TEST_UNIT_READY && scmd->scsi_done != scsi_eh_done) | ||
478 | /* | ||
479 | * nasty: for mid-layer issued TURs, we need to return the | ||
480 | * actual sense data without any recovery attempt. For eh | ||
481 | * issued ones, we need to try to recover and interpret | ||
482 | */ | ||
483 | return SUCCESS; | ||
484 | |||
485 | /* | 485 | /* |
486 | * Previous logic looked for FILEMARK, EOM or ILI which are | 486 | * Previous logic looked for FILEMARK, EOM or ILI which are |
487 | * mainly associated with tapes and returned SUCCESS. | 487 | * mainly associated with tapes and returned SUCCESS. |
@@ -2001,8 +2001,10 @@ static void scsi_restart_operations(struct Scsi_Host *shost) | |||
2001 | * is no point trying to lock the door of an off-line device. | 2001 | * is no point trying to lock the door of an off-line device. |
2002 | */ | 2002 | */ |
2003 | shost_for_each_device(sdev, shost) { | 2003 | shost_for_each_device(sdev, shost) { |
2004 | if (scsi_device_online(sdev) && sdev->locked) | 2004 | if (scsi_device_online(sdev) && sdev->was_reset && sdev->locked) { |
2005 | scsi_eh_lock_door(sdev); | 2005 | scsi_eh_lock_door(sdev); |
2006 | sdev->was_reset = 0; | ||
2007 | } | ||
2006 | } | 2008 | } |
2007 | 2009 | ||
2008 | /* | 2010 | /* |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 9eff8a375132..50a6e1ac8d9c 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -1893,6 +1893,11 @@ static int scsi_queue_rq(struct blk_mq_hw_ctx *hctx, struct request *req, | |||
1893 | blk_mq_start_request(req); | 1893 | blk_mq_start_request(req); |
1894 | } | 1894 | } |
1895 | 1895 | ||
1896 | if (blk_queue_tagged(q)) | ||
1897 | req->cmd_flags |= REQ_QUEUED; | ||
1898 | else | ||
1899 | req->cmd_flags &= ~REQ_QUEUED; | ||
1900 | |||
1896 | scsi_init_cmd_errh(cmd); | 1901 | scsi_init_cmd_errh(cmd); |
1897 | cmd->scsi_done = scsi_mq_done; | 1902 | cmd->scsi_done = scsi_mq_done; |
1898 | 1903 | ||
diff --git a/drivers/soc/versatile/soc-realview.c b/drivers/soc/versatile/soc-realview.c index cea8ea3491d2..1a07bf540fec 100644 --- a/drivers/soc/versatile/soc-realview.c +++ b/drivers/soc/versatile/soc-realview.c | |||
@@ -26,6 +26,7 @@ static const struct of_device_id realview_soc_of_match[] = { | |||
26 | { .compatible = "arm,realview-pb11mp-soc", }, | 26 | { .compatible = "arm,realview-pb11mp-soc", }, |
27 | { .compatible = "arm,realview-pba8-soc", }, | 27 | { .compatible = "arm,realview-pba8-soc", }, |
28 | { .compatible = "arm,realview-pbx-soc", }, | 28 | { .compatible = "arm,realview-pbx-soc", }, |
29 | { } | ||
29 | }; | 30 | }; |
30 | 31 | ||
31 | static u32 realview_coreid; | 32 | static u32 realview_coreid; |
diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c index 729215885250..72e12bad14b9 100644 --- a/drivers/spi/spi-dw.c +++ b/drivers/spi/spi-dw.c | |||
@@ -669,6 +669,7 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws) | |||
669 | master->cleanup = dw_spi_cleanup; | 669 | master->cleanup = dw_spi_cleanup; |
670 | master->transfer_one_message = dw_spi_transfer_one_message; | 670 | master->transfer_one_message = dw_spi_transfer_one_message; |
671 | master->max_speed_hz = dws->max_freq; | 671 | master->max_speed_hz = dws->max_freq; |
672 | master->dev.of_node = dev->of_node; | ||
672 | 673 | ||
673 | /* Basic HW init */ | 674 | /* Basic HW init */ |
674 | spi_hw_init(dws); | 675 | spi_hw_init(dws); |
diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index 448216025ce8..831ceb4a91f6 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c | |||
@@ -46,7 +46,7 @@ | |||
46 | 46 | ||
47 | #define SPI_TCR 0x08 | 47 | #define SPI_TCR 0x08 |
48 | 48 | ||
49 | #define SPI_CTAR(x) (0x0c + (x * 4)) | 49 | #define SPI_CTAR(x) (0x0c + (((x) & 0x3) * 4)) |
50 | #define SPI_CTAR_FMSZ(x) (((x) & 0x0000000f) << 27) | 50 | #define SPI_CTAR_FMSZ(x) (((x) & 0x0000000f) << 27) |
51 | #define SPI_CTAR_CPOL(x) ((x) << 26) | 51 | #define SPI_CTAR_CPOL(x) ((x) << 26) |
52 | #define SPI_CTAR_CPHA(x) ((x) << 25) | 52 | #define SPI_CTAR_CPHA(x) ((x) << 25) |
@@ -70,7 +70,7 @@ | |||
70 | 70 | ||
71 | #define SPI_PUSHR 0x34 | 71 | #define SPI_PUSHR 0x34 |
72 | #define SPI_PUSHR_CONT (1 << 31) | 72 | #define SPI_PUSHR_CONT (1 << 31) |
73 | #define SPI_PUSHR_CTAS(x) (((x) & 0x00000007) << 28) | 73 | #define SPI_PUSHR_CTAS(x) (((x) & 0x00000003) << 28) |
74 | #define SPI_PUSHR_EOQ (1 << 27) | 74 | #define SPI_PUSHR_EOQ (1 << 27) |
75 | #define SPI_PUSHR_CTCNT (1 << 26) | 75 | #define SPI_PUSHR_CTCNT (1 << 26) |
76 | #define SPI_PUSHR_PCS(x) (((1 << x) & 0x0000003f) << 16) | 76 | #define SPI_PUSHR_PCS(x) (((1 << x) & 0x0000003f) << 16) |
diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c index 835cdda6f4f5..c76b7d7879df 100644 --- a/drivers/spi/spi-orion.c +++ b/drivers/spi/spi-orion.c | |||
@@ -454,7 +454,7 @@ static int orion_spi_probe(struct platform_device *pdev) | |||
454 | spi->master = master; | 454 | spi->master = master; |
455 | 455 | ||
456 | of_id = of_match_device(orion_spi_of_match_table, &pdev->dev); | 456 | of_id = of_match_device(orion_spi_of_match_table, &pdev->dev); |
457 | devdata = of_id->data; | 457 | devdata = (of_id) ? of_id->data : &orion_spi_dev_data; |
458 | spi->devdata = devdata; | 458 | spi->devdata = devdata; |
459 | 459 | ||
460 | spi->clk = devm_clk_get(&pdev->dev, NULL); | 460 | spi->clk = devm_clk_get(&pdev->dev, NULL); |
diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c index f35f723816ea..fc2dd8441608 100644 --- a/drivers/spi/spi-pl022.c +++ b/drivers/spi/spi-pl022.c | |||
@@ -1106,7 +1106,7 @@ err_rxdesc: | |||
1106 | pl022->sgt_tx.nents, DMA_TO_DEVICE); | 1106 | pl022->sgt_tx.nents, DMA_TO_DEVICE); |
1107 | err_tx_sgmap: | 1107 | err_tx_sgmap: |
1108 | dma_unmap_sg(rxchan->device->dev, pl022->sgt_rx.sgl, | 1108 | dma_unmap_sg(rxchan->device->dev, pl022->sgt_rx.sgl, |
1109 | pl022->sgt_tx.nents, DMA_FROM_DEVICE); | 1109 | pl022->sgt_rx.nents, DMA_FROM_DEVICE); |
1110 | err_rx_sgmap: | 1110 | err_rx_sgmap: |
1111 | sg_free_table(&pl022->sgt_tx); | 1111 | sg_free_table(&pl022->sgt_tx); |
1112 | err_alloc_tx_sg: | 1112 | err_alloc_tx_sg: |
diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index d8a105f76837..9e9e0f971e6c 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c | |||
@@ -1274,7 +1274,9 @@ static int pxa2xx_spi_suspend(struct device *dev) | |||
1274 | if (status != 0) | 1274 | if (status != 0) |
1275 | return status; | 1275 | return status; |
1276 | write_SSCR0(0, drv_data->ioaddr); | 1276 | write_SSCR0(0, drv_data->ioaddr); |
1277 | clk_disable_unprepare(ssp->clk); | 1277 | |
1278 | if (!pm_runtime_suspended(dev)) | ||
1279 | clk_disable_unprepare(ssp->clk); | ||
1278 | 1280 | ||
1279 | return 0; | 1281 | return 0; |
1280 | } | 1282 | } |
@@ -1288,7 +1290,8 @@ static int pxa2xx_spi_resume(struct device *dev) | |||
1288 | pxa2xx_spi_dma_resume(drv_data); | 1290 | pxa2xx_spi_dma_resume(drv_data); |
1289 | 1291 | ||
1290 | /* Enable the SSP clock */ | 1292 | /* Enable the SSP clock */ |
1291 | clk_prepare_enable(ssp->clk); | 1293 | if (!pm_runtime_suspended(dev)) |
1294 | clk_prepare_enable(ssp->clk); | ||
1292 | 1295 | ||
1293 | /* Restore LPSS private register bits */ | 1296 | /* Restore LPSS private register bits */ |
1294 | lpss_ssp_setup(drv_data); | 1297 | lpss_ssp_setup(drv_data); |
diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c index f96ea8a38d64..87bc16f491f0 100644 --- a/drivers/spi/spi-rockchip.c +++ b/drivers/spi/spi-rockchip.c | |||
@@ -145,6 +145,9 @@ | |||
145 | #define RXBUSY (1 << 0) | 145 | #define RXBUSY (1 << 0) |
146 | #define TXBUSY (1 << 1) | 146 | #define TXBUSY (1 << 1) |
147 | 147 | ||
148 | /* sclk_out: spi master internal logic in rk3x can support 50Mhz */ | ||
149 | #define MAX_SCLK_OUT 50000000 | ||
150 | |||
148 | enum rockchip_ssi_type { | 151 | enum rockchip_ssi_type { |
149 | SSI_MOTO_SPI = 0, | 152 | SSI_MOTO_SPI = 0, |
150 | SSI_TI_SSP, | 153 | SSI_TI_SSP, |
@@ -325,6 +328,8 @@ static int rockchip_spi_unprepare_message(struct spi_master *master, | |||
325 | 328 | ||
326 | spin_unlock_irqrestore(&rs->lock, flags); | 329 | spin_unlock_irqrestore(&rs->lock, flags); |
327 | 330 | ||
331 | spi_enable_chip(rs, 0); | ||
332 | |||
328 | return 0; | 333 | return 0; |
329 | } | 334 | } |
330 | 335 | ||
@@ -381,6 +386,8 @@ static int rockchip_spi_pio_transfer(struct rockchip_spi *rs) | |||
381 | if (rs->tx) | 386 | if (rs->tx) |
382 | wait_for_idle(rs); | 387 | wait_for_idle(rs); |
383 | 388 | ||
389 | spi_enable_chip(rs, 0); | ||
390 | |||
384 | return 0; | 391 | return 0; |
385 | } | 392 | } |
386 | 393 | ||
@@ -392,8 +399,10 @@ static void rockchip_spi_dma_rxcb(void *data) | |||
392 | spin_lock_irqsave(&rs->lock, flags); | 399 | spin_lock_irqsave(&rs->lock, flags); |
393 | 400 | ||
394 | rs->state &= ~RXBUSY; | 401 | rs->state &= ~RXBUSY; |
395 | if (!(rs->state & TXBUSY)) | 402 | if (!(rs->state & TXBUSY)) { |
403 | spi_enable_chip(rs, 0); | ||
396 | spi_finalize_current_transfer(rs->master); | 404 | spi_finalize_current_transfer(rs->master); |
405 | } | ||
397 | 406 | ||
398 | spin_unlock_irqrestore(&rs->lock, flags); | 407 | spin_unlock_irqrestore(&rs->lock, flags); |
399 | } | 408 | } |
@@ -409,8 +418,10 @@ static void rockchip_spi_dma_txcb(void *data) | |||
409 | spin_lock_irqsave(&rs->lock, flags); | 418 | spin_lock_irqsave(&rs->lock, flags); |
410 | 419 | ||
411 | rs->state &= ~TXBUSY; | 420 | rs->state &= ~TXBUSY; |
412 | if (!(rs->state & RXBUSY)) | 421 | if (!(rs->state & RXBUSY)) { |
422 | spi_enable_chip(rs, 0); | ||
413 | spi_finalize_current_transfer(rs->master); | 423 | spi_finalize_current_transfer(rs->master); |
424 | } | ||
414 | 425 | ||
415 | spin_unlock_irqrestore(&rs->lock, flags); | 426 | spin_unlock_irqrestore(&rs->lock, flags); |
416 | } | 427 | } |
@@ -496,12 +507,19 @@ static void rockchip_spi_config(struct rockchip_spi *rs) | |||
496 | dmacr |= RF_DMA_EN; | 507 | dmacr |= RF_DMA_EN; |
497 | } | 508 | } |
498 | 509 | ||
510 | if (WARN_ON(rs->speed > MAX_SCLK_OUT)) | ||
511 | rs->speed = MAX_SCLK_OUT; | ||
512 | |||
513 | /* the minimum divsor is 2 */ | ||
514 | if (rs->max_freq < 2 * rs->speed) { | ||
515 | clk_set_rate(rs->spiclk, 2 * rs->speed); | ||
516 | rs->max_freq = clk_get_rate(rs->spiclk); | ||
517 | } | ||
518 | |||
499 | /* div doesn't support odd number */ | 519 | /* div doesn't support odd number */ |
500 | div = max_t(u32, rs->max_freq / rs->speed, 1); | 520 | div = max_t(u32, rs->max_freq / rs->speed, 1); |
501 | div = (div + 1) & 0xfffe; | 521 | div = (div + 1) & 0xfffe; |
502 | 522 | ||
503 | spi_enable_chip(rs, 0); | ||
504 | |||
505 | writel_relaxed(cr0, rs->regs + ROCKCHIP_SPI_CTRLR0); | 523 | writel_relaxed(cr0, rs->regs + ROCKCHIP_SPI_CTRLR0); |
506 | 524 | ||
507 | writel_relaxed(rs->len - 1, rs->regs + ROCKCHIP_SPI_CTRLR1); | 525 | writel_relaxed(rs->len - 1, rs->regs + ROCKCHIP_SPI_CTRLR1); |
@@ -515,8 +533,6 @@ static void rockchip_spi_config(struct rockchip_spi *rs) | |||
515 | spi_set_clk(rs, div); | 533 | spi_set_clk(rs, div); |
516 | 534 | ||
517 | dev_dbg(rs->dev, "cr0 0x%x, div %d\n", cr0, div); | 535 | dev_dbg(rs->dev, "cr0 0x%x, div %d\n", cr0, div); |
518 | |||
519 | spi_enable_chip(rs, 1); | ||
520 | } | 536 | } |
521 | 537 | ||
522 | static int rockchip_spi_transfer_one( | 538 | static int rockchip_spi_transfer_one( |
@@ -524,7 +540,7 @@ static int rockchip_spi_transfer_one( | |||
524 | struct spi_device *spi, | 540 | struct spi_device *spi, |
525 | struct spi_transfer *xfer) | 541 | struct spi_transfer *xfer) |
526 | { | 542 | { |
527 | int ret = 0; | 543 | int ret = 1; |
528 | struct rockchip_spi *rs = spi_master_get_devdata(master); | 544 | struct rockchip_spi *rs = spi_master_get_devdata(master); |
529 | 545 | ||
530 | WARN_ON(readl_relaxed(rs->regs + ROCKCHIP_SPI_SSIENR) && | 546 | WARN_ON(readl_relaxed(rs->regs + ROCKCHIP_SPI_SSIENR) && |
@@ -556,17 +572,27 @@ static int rockchip_spi_transfer_one( | |||
556 | rs->tmode = CR0_XFM_RO; | 572 | rs->tmode = CR0_XFM_RO; |
557 | 573 | ||
558 | /* we need prepare dma before spi was enabled */ | 574 | /* we need prepare dma before spi was enabled */ |
559 | if (master->can_dma && master->can_dma(master, spi, xfer)) { | 575 | if (master->can_dma && master->can_dma(master, spi, xfer)) |
560 | rs->use_dma = 1; | 576 | rs->use_dma = 1; |
561 | rockchip_spi_prepare_dma(rs); | 577 | else |
562 | } else { | ||
563 | rs->use_dma = 0; | 578 | rs->use_dma = 0; |
564 | } | ||
565 | 579 | ||
566 | rockchip_spi_config(rs); | 580 | rockchip_spi_config(rs); |
567 | 581 | ||
568 | if (!rs->use_dma) | 582 | if (rs->use_dma) { |
583 | if (rs->tmode == CR0_XFM_RO) { | ||
584 | /* rx: dma must be prepared first */ | ||
585 | rockchip_spi_prepare_dma(rs); | ||
586 | spi_enable_chip(rs, 1); | ||
587 | } else { | ||
588 | /* tx or tr: spi must be enabled first */ | ||
589 | spi_enable_chip(rs, 1); | ||
590 | rockchip_spi_prepare_dma(rs); | ||
591 | } | ||
592 | } else { | ||
593 | spi_enable_chip(rs, 1); | ||
569 | ret = rockchip_spi_pio_transfer(rs); | 594 | ret = rockchip_spi_pio_transfer(rs); |
595 | } | ||
570 | 596 | ||
571 | return ret; | 597 | return ret; |
572 | } | 598 | } |
diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c index e3bc23bb5883..e50039fb1474 100644 --- a/drivers/spi/spidev.c +++ b/drivers/spi/spidev.c | |||
@@ -82,10 +82,11 @@ struct spidev_data { | |||
82 | struct spi_device *spi; | 82 | struct spi_device *spi; |
83 | struct list_head device_entry; | 83 | struct list_head device_entry; |
84 | 84 | ||
85 | /* buffer is NULL unless this device is open (users > 0) */ | 85 | /* TX/RX buffers are NULL unless this device is open (users > 0) */ |
86 | struct mutex buf_lock; | 86 | struct mutex buf_lock; |
87 | unsigned users; | 87 | unsigned users; |
88 | u8 *buffer; | 88 | u8 *tx_buffer; |
89 | u8 *rx_buffer; | ||
89 | }; | 90 | }; |
90 | 91 | ||
91 | static LIST_HEAD(device_list); | 92 | static LIST_HEAD(device_list); |
@@ -135,7 +136,7 @@ static inline ssize_t | |||
135 | spidev_sync_write(struct spidev_data *spidev, size_t len) | 136 | spidev_sync_write(struct spidev_data *spidev, size_t len) |
136 | { | 137 | { |
137 | struct spi_transfer t = { | 138 | struct spi_transfer t = { |
138 | .tx_buf = spidev->buffer, | 139 | .tx_buf = spidev->tx_buffer, |
139 | .len = len, | 140 | .len = len, |
140 | }; | 141 | }; |
141 | struct spi_message m; | 142 | struct spi_message m; |
@@ -149,7 +150,7 @@ static inline ssize_t | |||
149 | spidev_sync_read(struct spidev_data *spidev, size_t len) | 150 | spidev_sync_read(struct spidev_data *spidev, size_t len) |
150 | { | 151 | { |
151 | struct spi_transfer t = { | 152 | struct spi_transfer t = { |
152 | .rx_buf = spidev->buffer, | 153 | .rx_buf = spidev->rx_buffer, |
153 | .len = len, | 154 | .len = len, |
154 | }; | 155 | }; |
155 | struct spi_message m; | 156 | struct spi_message m; |
@@ -179,7 +180,7 @@ spidev_read(struct file *filp, char __user *buf, size_t count, loff_t *f_pos) | |||
179 | if (status > 0) { | 180 | if (status > 0) { |
180 | unsigned long missing; | 181 | unsigned long missing; |
181 | 182 | ||
182 | missing = copy_to_user(buf, spidev->buffer, status); | 183 | missing = copy_to_user(buf, spidev->rx_buffer, status); |
183 | if (missing == status) | 184 | if (missing == status) |
184 | status = -EFAULT; | 185 | status = -EFAULT; |
185 | else | 186 | else |
@@ -206,7 +207,7 @@ spidev_write(struct file *filp, const char __user *buf, | |||
206 | spidev = filp->private_data; | 207 | spidev = filp->private_data; |
207 | 208 | ||
208 | mutex_lock(&spidev->buf_lock); | 209 | mutex_lock(&spidev->buf_lock); |
209 | missing = copy_from_user(spidev->buffer, buf, count); | 210 | missing = copy_from_user(spidev->tx_buffer, buf, count); |
210 | if (missing == 0) | 211 | if (missing == 0) |
211 | status = spidev_sync_write(spidev, count); | 212 | status = spidev_sync_write(spidev, count); |
212 | else | 213 | else |
@@ -224,7 +225,7 @@ static int spidev_message(struct spidev_data *spidev, | |||
224 | struct spi_transfer *k_tmp; | 225 | struct spi_transfer *k_tmp; |
225 | struct spi_ioc_transfer *u_tmp; | 226 | struct spi_ioc_transfer *u_tmp; |
226 | unsigned n, total; | 227 | unsigned n, total; |
227 | u8 *buf; | 228 | u8 *tx_buf, *rx_buf; |
228 | int status = -EFAULT; | 229 | int status = -EFAULT; |
229 | 230 | ||
230 | spi_message_init(&msg); | 231 | spi_message_init(&msg); |
@@ -236,7 +237,8 @@ static int spidev_message(struct spidev_data *spidev, | |||
236 | * We walk the array of user-provided transfers, using each one | 237 | * We walk the array of user-provided transfers, using each one |
237 | * to initialize a kernel version of the same transfer. | 238 | * to initialize a kernel version of the same transfer. |
238 | */ | 239 | */ |
239 | buf = spidev->buffer; | 240 | tx_buf = spidev->tx_buffer; |
241 | rx_buf = spidev->rx_buffer; | ||
240 | total = 0; | 242 | total = 0; |
241 | for (n = n_xfers, k_tmp = k_xfers, u_tmp = u_xfers; | 243 | for (n = n_xfers, k_tmp = k_xfers, u_tmp = u_xfers; |
242 | n; | 244 | n; |
@@ -250,20 +252,21 @@ static int spidev_message(struct spidev_data *spidev, | |||
250 | } | 252 | } |
251 | 253 | ||
252 | if (u_tmp->rx_buf) { | 254 | if (u_tmp->rx_buf) { |
253 | k_tmp->rx_buf = buf; | 255 | k_tmp->rx_buf = rx_buf; |
254 | if (!access_ok(VERIFY_WRITE, (u8 __user *) | 256 | if (!access_ok(VERIFY_WRITE, (u8 __user *) |
255 | (uintptr_t) u_tmp->rx_buf, | 257 | (uintptr_t) u_tmp->rx_buf, |
256 | u_tmp->len)) | 258 | u_tmp->len)) |
257 | goto done; | 259 | goto done; |
258 | } | 260 | } |
259 | if (u_tmp->tx_buf) { | 261 | if (u_tmp->tx_buf) { |
260 | k_tmp->tx_buf = buf; | 262 | k_tmp->tx_buf = tx_buf; |
261 | if (copy_from_user(buf, (const u8 __user *) | 263 | if (copy_from_user(tx_buf, (const u8 __user *) |
262 | (uintptr_t) u_tmp->tx_buf, | 264 | (uintptr_t) u_tmp->tx_buf, |
263 | u_tmp->len)) | 265 | u_tmp->len)) |
264 | goto done; | 266 | goto done; |
265 | } | 267 | } |
266 | buf += k_tmp->len; | 268 | tx_buf += k_tmp->len; |
269 | rx_buf += k_tmp->len; | ||
267 | 270 | ||
268 | k_tmp->cs_change = !!u_tmp->cs_change; | 271 | k_tmp->cs_change = !!u_tmp->cs_change; |
269 | k_tmp->tx_nbits = u_tmp->tx_nbits; | 272 | k_tmp->tx_nbits = u_tmp->tx_nbits; |
@@ -290,17 +293,17 @@ static int spidev_message(struct spidev_data *spidev, | |||
290 | goto done; | 293 | goto done; |
291 | 294 | ||
292 | /* copy any rx data out of bounce buffer */ | 295 | /* copy any rx data out of bounce buffer */ |
293 | buf = spidev->buffer; | 296 | rx_buf = spidev->rx_buffer; |
294 | for (n = n_xfers, u_tmp = u_xfers; n; n--, u_tmp++) { | 297 | for (n = n_xfers, u_tmp = u_xfers; n; n--, u_tmp++) { |
295 | if (u_tmp->rx_buf) { | 298 | if (u_tmp->rx_buf) { |
296 | if (__copy_to_user((u8 __user *) | 299 | if (__copy_to_user((u8 __user *) |
297 | (uintptr_t) u_tmp->rx_buf, buf, | 300 | (uintptr_t) u_tmp->rx_buf, rx_buf, |
298 | u_tmp->len)) { | 301 | u_tmp->len)) { |
299 | status = -EFAULT; | 302 | status = -EFAULT; |
300 | goto done; | 303 | goto done; |
301 | } | 304 | } |
302 | } | 305 | } |
303 | buf += u_tmp->len; | 306 | rx_buf += u_tmp->len; |
304 | } | 307 | } |
305 | status = total; | 308 | status = total; |
306 | 309 | ||
@@ -508,22 +511,41 @@ static int spidev_open(struct inode *inode, struct file *filp) | |||
508 | break; | 511 | break; |
509 | } | 512 | } |
510 | } | 513 | } |
511 | if (status == 0) { | 514 | |
512 | if (!spidev->buffer) { | 515 | if (status) { |
513 | spidev->buffer = kmalloc(bufsiz, GFP_KERNEL); | 516 | pr_debug("spidev: nothing for minor %d\n", iminor(inode)); |
514 | if (!spidev->buffer) { | 517 | goto err_find_dev; |
518 | } | ||
519 | |||
520 | if (!spidev->tx_buffer) { | ||
521 | spidev->tx_buffer = kmalloc(bufsiz, GFP_KERNEL); | ||
522 | if (!spidev->tx_buffer) { | ||
515 | dev_dbg(&spidev->spi->dev, "open/ENOMEM\n"); | 523 | dev_dbg(&spidev->spi->dev, "open/ENOMEM\n"); |
516 | status = -ENOMEM; | 524 | status = -ENOMEM; |
525 | goto err_find_dev; | ||
517 | } | 526 | } |
518 | } | 527 | } |
519 | if (status == 0) { | 528 | |
520 | spidev->users++; | 529 | if (!spidev->rx_buffer) { |
521 | filp->private_data = spidev; | 530 | spidev->rx_buffer = kmalloc(bufsiz, GFP_KERNEL); |
522 | nonseekable_open(inode, filp); | 531 | if (!spidev->rx_buffer) { |
532 | dev_dbg(&spidev->spi->dev, "open/ENOMEM\n"); | ||
533 | status = -ENOMEM; | ||
534 | goto err_alloc_rx_buf; | ||
523 | } | 535 | } |
524 | } else | 536 | } |
525 | pr_debug("spidev: nothing for minor %d\n", iminor(inode)); | 537 | |
538 | spidev->users++; | ||
539 | filp->private_data = spidev; | ||
540 | nonseekable_open(inode, filp); | ||
541 | |||
542 | mutex_unlock(&device_list_lock); | ||
543 | return 0; | ||
526 | 544 | ||
545 | err_alloc_rx_buf: | ||
546 | kfree(spidev->tx_buffer); | ||
547 | spidev->tx_buffer = NULL; | ||
548 | err_find_dev: | ||
527 | mutex_unlock(&device_list_lock); | 549 | mutex_unlock(&device_list_lock); |
528 | return status; | 550 | return status; |
529 | } | 551 | } |
@@ -542,8 +564,11 @@ static int spidev_release(struct inode *inode, struct file *filp) | |||
542 | if (!spidev->users) { | 564 | if (!spidev->users) { |
543 | int dofree; | 565 | int dofree; |
544 | 566 | ||
545 | kfree(spidev->buffer); | 567 | kfree(spidev->tx_buffer); |
546 | spidev->buffer = NULL; | 568 | spidev->tx_buffer = NULL; |
569 | |||
570 | kfree(spidev->rx_buffer); | ||
571 | spidev->rx_buffer = NULL; | ||
547 | 572 | ||
548 | /* ... after we unbound from the underlying device? */ | 573 | /* ... after we unbound from the underlying device? */ |
549 | spin_lock_irq(&spidev->spi_lock); | 574 | spin_lock_irq(&spidev->spi_lock); |
diff --git a/drivers/staging/android/logger.c b/drivers/staging/android/logger.c index 28b93d39a94e..a673ffa34aa3 100644 --- a/drivers/staging/android/logger.c +++ b/drivers/staging/android/logger.c | |||
@@ -420,7 +420,7 @@ static ssize_t logger_write_iter(struct kiocb *iocb, struct iov_iter *from) | |||
420 | struct logger_log *log = file_get_log(iocb->ki_filp); | 420 | struct logger_log *log = file_get_log(iocb->ki_filp); |
421 | struct logger_entry header; | 421 | struct logger_entry header; |
422 | struct timespec now; | 422 | struct timespec now; |
423 | size_t len, count; | 423 | size_t len, count, w_off; |
424 | 424 | ||
425 | count = min_t(size_t, iocb->ki_nbytes, LOGGER_ENTRY_MAX_PAYLOAD); | 425 | count = min_t(size_t, iocb->ki_nbytes, LOGGER_ENTRY_MAX_PAYLOAD); |
426 | 426 | ||
@@ -452,11 +452,14 @@ static ssize_t logger_write_iter(struct kiocb *iocb, struct iov_iter *from) | |||
452 | memcpy(log->buffer + log->w_off, &header, len); | 452 | memcpy(log->buffer + log->w_off, &header, len); |
453 | memcpy(log->buffer, (char *)&header + len, sizeof(header) - len); | 453 | memcpy(log->buffer, (char *)&header + len, sizeof(header) - len); |
454 | 454 | ||
455 | len = min(count, log->size - log->w_off); | 455 | /* Work with a copy until we are ready to commit the whole entry */ |
456 | w_off = logger_offset(log, log->w_off + sizeof(struct logger_entry)); | ||
456 | 457 | ||
457 | if (copy_from_iter(log->buffer + log->w_off, len, from) != len) { | 458 | len = min(count, log->size - w_off); |
459 | |||
460 | if (copy_from_iter(log->buffer + w_off, len, from) != len) { | ||
458 | /* | 461 | /* |
459 | * Note that by not updating w_off, this abandons the | 462 | * Note that by not updating log->w_off, this abandons the |
460 | * portion of the new entry that *was* successfully | 463 | * portion of the new entry that *was* successfully |
461 | * copied, just above. This is intentional to avoid | 464 | * copied, just above. This is intentional to avoid |
462 | * message corruption from missing fragments. | 465 | * message corruption from missing fragments. |
@@ -470,7 +473,7 @@ static ssize_t logger_write_iter(struct kiocb *iocb, struct iov_iter *from) | |||
470 | return -EFAULT; | 473 | return -EFAULT; |
471 | } | 474 | } |
472 | 475 | ||
473 | log->w_off = logger_offset(log, log->w_off + count); | 476 | log->w_off = logger_offset(log, w_off + count); |
474 | mutex_unlock(&log->mutex); | 477 | mutex_unlock(&log->mutex); |
475 | 478 | ||
476 | /* wake up any blocked readers */ | 479 | /* wake up any blocked readers */ |
diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index a8bc2b567789..152f4c12ea43 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig | |||
@@ -426,6 +426,7 @@ config COMEDI_AIO_IIRO_16 | |||
426 | 426 | ||
427 | config COMEDI_II_PCI20KC | 427 | config COMEDI_II_PCI20KC |
428 | tristate "Intelligent Instruments PCI-20001C carrier support" | 428 | tristate "Intelligent Instruments PCI-20001C carrier support" |
429 | depends on HAS_IOMEM | ||
429 | ---help--- | 430 | ---help--- |
430 | Enable support for Intelligent Instruments PCI-20001C carrier | 431 | Enable support for Intelligent Instruments PCI-20001C carrier |
431 | PCI-20001, PCI-20006 and PCI-20341 | 432 | PCI-20001, PCI-20006 and PCI-20341 |
@@ -667,7 +668,6 @@ config COMEDI_ADDI_APCI_2200 | |||
667 | config COMEDI_ADDI_APCI_3120 | 668 | config COMEDI_ADDI_APCI_3120 |
668 | tristate "ADDI-DATA APCI_3120/3001 support" | 669 | tristate "ADDI-DATA APCI_3120/3001 support" |
669 | depends on HAS_DMA | 670 | depends on HAS_DMA |
670 | depends on VIRT_TO_BUS | ||
671 | ---help--- | 671 | ---help--- |
672 | Enable support for ADDI-DATA APCI_3120/3001 cards | 672 | Enable support for ADDI-DATA APCI_3120/3001 cards |
673 | 673 | ||
diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c index 495969f46e76..9c32f0276009 100644 --- a/drivers/staging/comedi/comedi_fops.c +++ b/drivers/staging/comedi/comedi_fops.c | |||
@@ -1462,10 +1462,7 @@ static int __comedi_get_user_chanlist(struct comedi_device *dev, | |||
1462 | unsigned int *chanlist; | 1462 | unsigned int *chanlist; |
1463 | int ret; | 1463 | int ret; |
1464 | 1464 | ||
1465 | /* user_chanlist could be NULL for do_cmdtest ioctls */ | 1465 | cmd->chanlist = NULL; |
1466 | if (!user_chanlist) | ||
1467 | return 0; | ||
1468 | |||
1469 | chanlist = memdup_user(user_chanlist, | 1466 | chanlist = memdup_user(user_chanlist, |
1470 | cmd->chanlist_len * sizeof(unsigned int)); | 1467 | cmd->chanlist_len * sizeof(unsigned int)); |
1471 | if (IS_ERR(chanlist)) | 1468 | if (IS_ERR(chanlist)) |
@@ -1609,13 +1606,18 @@ static int do_cmdtest_ioctl(struct comedi_device *dev, | |||
1609 | 1606 | ||
1610 | s = &dev->subdevices[cmd.subdev]; | 1607 | s = &dev->subdevices[cmd.subdev]; |
1611 | 1608 | ||
1612 | /* load channel/gain list */ | 1609 | /* user_chanlist can be NULL for COMEDI_CMDTEST ioctl */ |
1613 | ret = __comedi_get_user_chanlist(dev, s, user_chanlist, &cmd); | 1610 | if (user_chanlist) { |
1614 | if (ret) | 1611 | /* load channel/gain list */ |
1615 | return ret; | 1612 | ret = __comedi_get_user_chanlist(dev, s, user_chanlist, &cmd); |
1613 | if (ret) | ||
1614 | return ret; | ||
1615 | } | ||
1616 | 1616 | ||
1617 | ret = s->do_cmdtest(dev, s, &cmd); | 1617 | ret = s->do_cmdtest(dev, s, &cmd); |
1618 | 1618 | ||
1619 | kfree(cmd.chanlist); /* free kernel copy of user chanlist */ | ||
1620 | |||
1619 | /* restore chanlist pointer before copying back */ | 1621 | /* restore chanlist pointer before copying back */ |
1620 | cmd.chanlist = (unsigned int __force *)user_chanlist; | 1622 | cmd.chanlist = (unsigned int __force *)user_chanlist; |
1621 | 1623 | ||
@@ -1642,7 +1644,7 @@ static int do_cmdtest_ioctl(struct comedi_device *dev, | |||
1642 | 1644 | ||
1643 | */ | 1645 | */ |
1644 | 1646 | ||
1645 | static int do_lock_ioctl(struct comedi_device *dev, unsigned int arg, | 1647 | static int do_lock_ioctl(struct comedi_device *dev, unsigned long arg, |
1646 | void *file) | 1648 | void *file) |
1647 | { | 1649 | { |
1648 | int ret = 0; | 1650 | int ret = 0; |
@@ -1679,7 +1681,7 @@ static int do_lock_ioctl(struct comedi_device *dev, unsigned int arg, | |||
1679 | This function isn't protected by the semaphore, since | 1681 | This function isn't protected by the semaphore, since |
1680 | we already own the lock. | 1682 | we already own the lock. |
1681 | */ | 1683 | */ |
1682 | static int do_unlock_ioctl(struct comedi_device *dev, unsigned int arg, | 1684 | static int do_unlock_ioctl(struct comedi_device *dev, unsigned long arg, |
1683 | void *file) | 1685 | void *file) |
1684 | { | 1686 | { |
1685 | struct comedi_subdevice *s; | 1687 | struct comedi_subdevice *s; |
@@ -1714,7 +1716,7 @@ static int do_unlock_ioctl(struct comedi_device *dev, unsigned int arg, | |||
1714 | nothing | 1716 | nothing |
1715 | 1717 | ||
1716 | */ | 1718 | */ |
1717 | static int do_cancel_ioctl(struct comedi_device *dev, unsigned int arg, | 1719 | static int do_cancel_ioctl(struct comedi_device *dev, unsigned long arg, |
1718 | void *file) | 1720 | void *file) |
1719 | { | 1721 | { |
1720 | struct comedi_subdevice *s; | 1722 | struct comedi_subdevice *s; |
@@ -1751,7 +1753,7 @@ static int do_cancel_ioctl(struct comedi_device *dev, unsigned int arg, | |||
1751 | nothing | 1753 | nothing |
1752 | 1754 | ||
1753 | */ | 1755 | */ |
1754 | static int do_poll_ioctl(struct comedi_device *dev, unsigned int arg, | 1756 | static int do_poll_ioctl(struct comedi_device *dev, unsigned long arg, |
1755 | void *file) | 1757 | void *file) |
1756 | { | 1758 | { |
1757 | struct comedi_subdevice *s; | 1759 | struct comedi_subdevice *s; |
diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c index 32a19264a170..2a29b9baec0d 100644 --- a/drivers/staging/iio/adc/mxs-lradc.c +++ b/drivers/staging/iio/adc/mxs-lradc.c | |||
@@ -1559,14 +1559,16 @@ static int mxs_lradc_probe(struct platform_device *pdev) | |||
1559 | /* Grab all IRQ sources */ | 1559 | /* Grab all IRQ sources */ |
1560 | for (i = 0; i < of_cfg->irq_count; i++) { | 1560 | for (i = 0; i < of_cfg->irq_count; i++) { |
1561 | lradc->irq[i] = platform_get_irq(pdev, i); | 1561 | lradc->irq[i] = platform_get_irq(pdev, i); |
1562 | if (lradc->irq[i] < 0) | 1562 | if (lradc->irq[i] < 0) { |
1563 | return lradc->irq[i]; | 1563 | ret = lradc->irq[i]; |
1564 | goto err_clk; | ||
1565 | } | ||
1564 | 1566 | ||
1565 | ret = devm_request_irq(dev, lradc->irq[i], | 1567 | ret = devm_request_irq(dev, lradc->irq[i], |
1566 | mxs_lradc_handle_irq, 0, | 1568 | mxs_lradc_handle_irq, 0, |
1567 | of_cfg->irq_name[i], iio); | 1569 | of_cfg->irq_name[i], iio); |
1568 | if (ret) | 1570 | if (ret) |
1569 | return ret; | 1571 | goto err_clk; |
1570 | } | 1572 | } |
1571 | 1573 | ||
1572 | lradc->vref_mv = of_cfg->vref_mv; | 1574 | lradc->vref_mv = of_cfg->vref_mv; |
@@ -1588,7 +1590,7 @@ static int mxs_lradc_probe(struct platform_device *pdev) | |||
1588 | &mxs_lradc_trigger_handler, | 1590 | &mxs_lradc_trigger_handler, |
1589 | &mxs_lradc_buffer_ops); | 1591 | &mxs_lradc_buffer_ops); |
1590 | if (ret) | 1592 | if (ret) |
1591 | return ret; | 1593 | goto err_clk; |
1592 | 1594 | ||
1593 | ret = mxs_lradc_trigger_init(iio); | 1595 | ret = mxs_lradc_trigger_init(iio); |
1594 | if (ret) | 1596 | if (ret) |
@@ -1643,6 +1645,8 @@ err_dev: | |||
1643 | mxs_lradc_trigger_remove(iio); | 1645 | mxs_lradc_trigger_remove(iio); |
1644 | err_trig: | 1646 | err_trig: |
1645 | iio_triggered_buffer_cleanup(iio); | 1647 | iio_triggered_buffer_cleanup(iio); |
1648 | err_clk: | ||
1649 | clk_disable_unprepare(lradc->clk); | ||
1646 | return ret; | 1650 | return ret; |
1647 | } | 1651 | } |
1648 | 1652 | ||
diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c b/drivers/staging/iio/impedance-analyzer/ad5933.c index d0c89d0457de..b6bd609c3655 100644 --- a/drivers/staging/iio/impedance-analyzer/ad5933.c +++ b/drivers/staging/iio/impedance-analyzer/ad5933.c | |||
@@ -115,6 +115,7 @@ static const struct iio_chan_spec ad5933_channels[] = { | |||
115 | .channel = 0, | 115 | .channel = 0, |
116 | .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED), | 116 | .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED), |
117 | .address = AD5933_REG_TEMP_DATA, | 117 | .address = AD5933_REG_TEMP_DATA, |
118 | .scan_index = -1, | ||
118 | .scan_type = { | 119 | .scan_type = { |
119 | .sign = 's', | 120 | .sign = 's', |
120 | .realbits = 14, | 121 | .realbits = 14, |
@@ -124,9 +125,7 @@ static const struct iio_chan_spec ad5933_channels[] = { | |||
124 | .type = IIO_VOLTAGE, | 125 | .type = IIO_VOLTAGE, |
125 | .indexed = 1, | 126 | .indexed = 1, |
126 | .channel = 0, | 127 | .channel = 0, |
127 | .extend_name = "real_raw", | 128 | .extend_name = "real", |
128 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | | ||
129 | BIT(IIO_CHAN_INFO_SCALE), | ||
130 | .address = AD5933_REG_REAL_DATA, | 129 | .address = AD5933_REG_REAL_DATA, |
131 | .scan_index = 0, | 130 | .scan_index = 0, |
132 | .scan_type = { | 131 | .scan_type = { |
@@ -138,9 +137,7 @@ static const struct iio_chan_spec ad5933_channels[] = { | |||
138 | .type = IIO_VOLTAGE, | 137 | .type = IIO_VOLTAGE, |
139 | .indexed = 1, | 138 | .indexed = 1, |
140 | .channel = 0, | 139 | .channel = 0, |
141 | .extend_name = "imag_raw", | 140 | .extend_name = "imag", |
142 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | | ||
143 | BIT(IIO_CHAN_INFO_SCALE), | ||
144 | .address = AD5933_REG_IMAG_DATA, | 141 | .address = AD5933_REG_IMAG_DATA, |
145 | .scan_index = 1, | 142 | .scan_index = 1, |
146 | .scan_type = { | 143 | .scan_type = { |
@@ -749,14 +746,14 @@ static int ad5933_probe(struct i2c_client *client, | |||
749 | indio_dev->name = id->name; | 746 | indio_dev->name = id->name; |
750 | indio_dev->modes = INDIO_DIRECT_MODE; | 747 | indio_dev->modes = INDIO_DIRECT_MODE; |
751 | indio_dev->channels = ad5933_channels; | 748 | indio_dev->channels = ad5933_channels; |
752 | indio_dev->num_channels = 1; /* only register temp0_input */ | 749 | indio_dev->num_channels = ARRAY_SIZE(ad5933_channels); |
753 | 750 | ||
754 | ret = ad5933_register_ring_funcs_and_init(indio_dev); | 751 | ret = ad5933_register_ring_funcs_and_init(indio_dev); |
755 | if (ret) | 752 | if (ret) |
756 | goto error_disable_reg; | 753 | goto error_disable_reg; |
757 | 754 | ||
758 | /* skip temp0_input, register in0_(real|imag)_raw */ | 755 | ret = iio_buffer_register(indio_dev, ad5933_channels, |
759 | ret = iio_buffer_register(indio_dev, &ad5933_channels[1], 2); | 756 | ARRAY_SIZE(ad5933_channels)); |
760 | if (ret) | 757 | if (ret) |
761 | goto error_unreg_ring; | 758 | goto error_unreg_ring; |
762 | 759 | ||
diff --git a/drivers/staging/iio/meter/ade7758.h b/drivers/staging/iio/meter/ade7758.h index 07318203a836..e8c98cf57070 100644 --- a/drivers/staging/iio/meter/ade7758.h +++ b/drivers/staging/iio/meter/ade7758.h | |||
@@ -119,7 +119,6 @@ struct ade7758_state { | |||
119 | u8 *tx; | 119 | u8 *tx; |
120 | u8 *rx; | 120 | u8 *rx; |
121 | struct mutex buf_lock; | 121 | struct mutex buf_lock; |
122 | const struct iio_chan_spec *ade7758_ring_channels; | ||
123 | struct spi_transfer ring_xfer[4]; | 122 | struct spi_transfer ring_xfer[4]; |
124 | struct spi_message ring_msg; | 123 | struct spi_message ring_msg; |
125 | /* | 124 | /* |
diff --git a/drivers/staging/iio/meter/ade7758_core.c b/drivers/staging/iio/meter/ade7758_core.c index abc60067cd72..fb373b89dcc2 100644 --- a/drivers/staging/iio/meter/ade7758_core.c +++ b/drivers/staging/iio/meter/ade7758_core.c | |||
@@ -634,9 +634,6 @@ static const struct iio_chan_spec ade7758_channels[] = { | |||
634 | .type = IIO_VOLTAGE, | 634 | .type = IIO_VOLTAGE, |
635 | .indexed = 1, | 635 | .indexed = 1, |
636 | .channel = 0, | 636 | .channel = 0, |
637 | .extend_name = "raw", | ||
638 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), | ||
639 | .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), | ||
640 | .address = AD7758_WT(AD7758_PHASE_A, AD7758_VOLTAGE), | 637 | .address = AD7758_WT(AD7758_PHASE_A, AD7758_VOLTAGE), |
641 | .scan_index = 0, | 638 | .scan_index = 0, |
642 | .scan_type = { | 639 | .scan_type = { |
@@ -648,9 +645,6 @@ static const struct iio_chan_spec ade7758_channels[] = { | |||
648 | .type = IIO_CURRENT, | 645 | .type = IIO_CURRENT, |
649 | .indexed = 1, | 646 | .indexed = 1, |
650 | .channel = 0, | 647 | .channel = 0, |
651 | .extend_name = "raw", | ||
652 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), | ||
653 | .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), | ||
654 | .address = AD7758_WT(AD7758_PHASE_A, AD7758_CURRENT), | 648 | .address = AD7758_WT(AD7758_PHASE_A, AD7758_CURRENT), |
655 | .scan_index = 1, | 649 | .scan_index = 1, |
656 | .scan_type = { | 650 | .scan_type = { |
@@ -662,9 +656,7 @@ static const struct iio_chan_spec ade7758_channels[] = { | |||
662 | .type = IIO_POWER, | 656 | .type = IIO_POWER, |
663 | .indexed = 1, | 657 | .indexed = 1, |
664 | .channel = 0, | 658 | .channel = 0, |
665 | .extend_name = "apparent_raw", | 659 | .extend_name = "apparent", |
666 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), | ||
667 | .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), | ||
668 | .address = AD7758_WT(AD7758_PHASE_A, AD7758_APP_PWR), | 660 | .address = AD7758_WT(AD7758_PHASE_A, AD7758_APP_PWR), |
669 | .scan_index = 2, | 661 | .scan_index = 2, |
670 | .scan_type = { | 662 | .scan_type = { |
@@ -676,9 +668,7 @@ static const struct iio_chan_spec ade7758_channels[] = { | |||
676 | .type = IIO_POWER, | 668 | .type = IIO_POWER, |
677 | .indexed = 1, | 669 | .indexed = 1, |
678 | .channel = 0, | 670 | .channel = 0, |
679 | .extend_name = "active_raw", | 671 | .extend_name = "active", |
680 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), | ||
681 | .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), | ||
682 | .address = AD7758_WT(AD7758_PHASE_A, AD7758_ACT_PWR), | 672 | .address = AD7758_WT(AD7758_PHASE_A, AD7758_ACT_PWR), |
683 | .scan_index = 3, | 673 | .scan_index = 3, |
684 | .scan_type = { | 674 | .scan_type = { |
@@ -690,9 +680,7 @@ static const struct iio_chan_spec ade7758_channels[] = { | |||
690 | .type = IIO_POWER, | 680 | .type = IIO_POWER, |
691 | .indexed = 1, | 681 | .indexed = 1, |
692 | .channel = 0, | 682 | .channel = 0, |
693 | .extend_name = "reactive_raw", | 683 | .extend_name = "reactive", |
694 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), | ||
695 | .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), | ||
696 | .address = AD7758_WT(AD7758_PHASE_A, AD7758_REACT_PWR), | 684 | .address = AD7758_WT(AD7758_PHASE_A, AD7758_REACT_PWR), |
697 | .scan_index = 4, | 685 | .scan_index = 4, |
698 | .scan_type = { | 686 | .scan_type = { |
@@ -704,9 +692,6 @@ static const struct iio_chan_spec ade7758_channels[] = { | |||
704 | .type = IIO_VOLTAGE, | 692 | .type = IIO_VOLTAGE, |
705 | .indexed = 1, | 693 | .indexed = 1, |
706 | .channel = 1, | 694 | .channel = 1, |
707 | .extend_name = "raw", | ||
708 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), | ||
709 | .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), | ||
710 | .address = AD7758_WT(AD7758_PHASE_B, AD7758_VOLTAGE), | 695 | .address = AD7758_WT(AD7758_PHASE_B, AD7758_VOLTAGE), |
711 | .scan_index = 5, | 696 | .scan_index = 5, |
712 | .scan_type = { | 697 | .scan_type = { |
@@ -718,9 +703,6 @@ static const struct iio_chan_spec ade7758_channels[] = { | |||
718 | .type = IIO_CURRENT, | 703 | .type = IIO_CURRENT, |
719 | .indexed = 1, | 704 | .indexed = 1, |
720 | .channel = 1, | 705 | .channel = 1, |
721 | .extend_name = "raw", | ||
722 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), | ||
723 | .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), | ||
724 | .address = AD7758_WT(AD7758_PHASE_B, AD7758_CURRENT), | 706 | .address = AD7758_WT(AD7758_PHASE_B, AD7758_CURRENT), |
725 | .scan_index = 6, | 707 | .scan_index = 6, |
726 | .scan_type = { | 708 | .scan_type = { |
@@ -732,9 +714,7 @@ static const struct iio_chan_spec ade7758_channels[] = { | |||
732 | .type = IIO_POWER, | 714 | .type = IIO_POWER, |
733 | .indexed = 1, | 715 | .indexed = 1, |
734 | .channel = 1, | 716 | .channel = 1, |
735 | .extend_name = "apparent_raw", | 717 | .extend_name = "apparent", |
736 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), | ||
737 | .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), | ||
738 | .address = AD7758_WT(AD7758_PHASE_B, AD7758_APP_PWR), | 718 | .address = AD7758_WT(AD7758_PHASE_B, AD7758_APP_PWR), |
739 | .scan_index = 7, | 719 | .scan_index = 7, |
740 | .scan_type = { | 720 | .scan_type = { |
@@ -746,9 +726,7 @@ static const struct iio_chan_spec ade7758_channels[] = { | |||
746 | .type = IIO_POWER, | 726 | .type = IIO_POWER, |
747 | .indexed = 1, | 727 | .indexed = 1, |
748 | .channel = 1, | 728 | .channel = 1, |
749 | .extend_name = "active_raw", | 729 | .extend_name = "active", |
750 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), | ||
751 | .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), | ||
752 | .address = AD7758_WT(AD7758_PHASE_B, AD7758_ACT_PWR), | 730 | .address = AD7758_WT(AD7758_PHASE_B, AD7758_ACT_PWR), |
753 | .scan_index = 8, | 731 | .scan_index = 8, |
754 | .scan_type = { | 732 | .scan_type = { |
@@ -760,9 +738,7 @@ static const struct iio_chan_spec ade7758_channels[] = { | |||
760 | .type = IIO_POWER, | 738 | .type = IIO_POWER, |
761 | .indexed = 1, | 739 | .indexed = 1, |
762 | .channel = 1, | 740 | .channel = 1, |
763 | .extend_name = "reactive_raw", | 741 | .extend_name = "reactive", |
764 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), | ||
765 | .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), | ||
766 | .address = AD7758_WT(AD7758_PHASE_B, AD7758_REACT_PWR), | 742 | .address = AD7758_WT(AD7758_PHASE_B, AD7758_REACT_PWR), |
767 | .scan_index = 9, | 743 | .scan_index = 9, |
768 | .scan_type = { | 744 | .scan_type = { |
@@ -774,9 +750,6 @@ static const struct iio_chan_spec ade7758_channels[] = { | |||
774 | .type = IIO_VOLTAGE, | 750 | .type = IIO_VOLTAGE, |
775 | .indexed = 1, | 751 | .indexed = 1, |
776 | .channel = 2, | 752 | .channel = 2, |
777 | .extend_name = "raw", | ||
778 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), | ||
779 | .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), | ||
780 | .address = AD7758_WT(AD7758_PHASE_C, AD7758_VOLTAGE), | 753 | .address = AD7758_WT(AD7758_PHASE_C, AD7758_VOLTAGE), |
781 | .scan_index = 10, | 754 | .scan_index = 10, |
782 | .scan_type = { | 755 | .scan_type = { |
@@ -788,9 +761,6 @@ static const struct iio_chan_spec ade7758_channels[] = { | |||
788 | .type = IIO_CURRENT, | 761 | .type = IIO_CURRENT, |
789 | .indexed = 1, | 762 | .indexed = 1, |
790 | .channel = 2, | 763 | .channel = 2, |
791 | .extend_name = "raw", | ||
792 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), | ||
793 | .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), | ||
794 | .address = AD7758_WT(AD7758_PHASE_C, AD7758_CURRENT), | 764 | .address = AD7758_WT(AD7758_PHASE_C, AD7758_CURRENT), |
795 | .scan_index = 11, | 765 | .scan_index = 11, |
796 | .scan_type = { | 766 | .scan_type = { |
@@ -802,9 +772,7 @@ static const struct iio_chan_spec ade7758_channels[] = { | |||
802 | .type = IIO_POWER, | 772 | .type = IIO_POWER, |
803 | .indexed = 1, | 773 | .indexed = 1, |
804 | .channel = 2, | 774 | .channel = 2, |
805 | .extend_name = "apparent_raw", | 775 | .extend_name = "apparent", |
806 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), | ||
807 | .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), | ||
808 | .address = AD7758_WT(AD7758_PHASE_C, AD7758_APP_PWR), | 776 | .address = AD7758_WT(AD7758_PHASE_C, AD7758_APP_PWR), |
809 | .scan_index = 12, | 777 | .scan_index = 12, |
810 | .scan_type = { | 778 | .scan_type = { |
@@ -816,9 +784,7 @@ static const struct iio_chan_spec ade7758_channels[] = { | |||
816 | .type = IIO_POWER, | 784 | .type = IIO_POWER, |
817 | .indexed = 1, | 785 | .indexed = 1, |
818 | .channel = 2, | 786 | .channel = 2, |
819 | .extend_name = "active_raw", | 787 | .extend_name = "active", |
820 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), | ||
821 | .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), | ||
822 | .address = AD7758_WT(AD7758_PHASE_C, AD7758_ACT_PWR), | 788 | .address = AD7758_WT(AD7758_PHASE_C, AD7758_ACT_PWR), |
823 | .scan_index = 13, | 789 | .scan_index = 13, |
824 | .scan_type = { | 790 | .scan_type = { |
@@ -830,9 +796,7 @@ static const struct iio_chan_spec ade7758_channels[] = { | |||
830 | .type = IIO_POWER, | 796 | .type = IIO_POWER, |
831 | .indexed = 1, | 797 | .indexed = 1, |
832 | .channel = 2, | 798 | .channel = 2, |
833 | .extend_name = "reactive_raw", | 799 | .extend_name = "reactive", |
834 | .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), | ||
835 | .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), | ||
836 | .address = AD7758_WT(AD7758_PHASE_C, AD7758_REACT_PWR), | 800 | .address = AD7758_WT(AD7758_PHASE_C, AD7758_REACT_PWR), |
837 | .scan_index = 14, | 801 | .scan_index = 14, |
838 | .scan_type = { | 802 | .scan_type = { |
@@ -873,13 +837,14 @@ static int ade7758_probe(struct spi_device *spi) | |||
873 | goto error_free_rx; | 837 | goto error_free_rx; |
874 | } | 838 | } |
875 | st->us = spi; | 839 | st->us = spi; |
876 | st->ade7758_ring_channels = &ade7758_channels[0]; | ||
877 | mutex_init(&st->buf_lock); | 840 | mutex_init(&st->buf_lock); |
878 | 841 | ||
879 | indio_dev->name = spi->dev.driver->name; | 842 | indio_dev->name = spi->dev.driver->name; |
880 | indio_dev->dev.parent = &spi->dev; | 843 | indio_dev->dev.parent = &spi->dev; |
881 | indio_dev->info = &ade7758_info; | 844 | indio_dev->info = &ade7758_info; |
882 | indio_dev->modes = INDIO_DIRECT_MODE; | 845 | indio_dev->modes = INDIO_DIRECT_MODE; |
846 | indio_dev->channels = ade7758_channels; | ||
847 | indio_dev->num_channels = ARRAY_SIZE(ade7758_channels); | ||
883 | 848 | ||
884 | ret = ade7758_configure_ring(indio_dev); | 849 | ret = ade7758_configure_ring(indio_dev); |
885 | if (ret) | 850 | if (ret) |
diff --git a/drivers/staging/iio/meter/ade7758_ring.c b/drivers/staging/iio/meter/ade7758_ring.c index c0accf8cce93..6e9006490742 100644 --- a/drivers/staging/iio/meter/ade7758_ring.c +++ b/drivers/staging/iio/meter/ade7758_ring.c | |||
@@ -85,17 +85,16 @@ static irqreturn_t ade7758_trigger_handler(int irq, void *p) | |||
85 | **/ | 85 | **/ |
86 | static int ade7758_ring_preenable(struct iio_dev *indio_dev) | 86 | static int ade7758_ring_preenable(struct iio_dev *indio_dev) |
87 | { | 87 | { |
88 | struct ade7758_state *st = iio_priv(indio_dev); | ||
89 | unsigned channel; | 88 | unsigned channel; |
90 | 89 | ||
91 | if (!bitmap_empty(indio_dev->active_scan_mask, indio_dev->masklength)) | 90 | if (bitmap_empty(indio_dev->active_scan_mask, indio_dev->masklength)) |
92 | return -EINVAL; | 91 | return -EINVAL; |
93 | 92 | ||
94 | channel = find_first_bit(indio_dev->active_scan_mask, | 93 | channel = find_first_bit(indio_dev->active_scan_mask, |
95 | indio_dev->masklength); | 94 | indio_dev->masklength); |
96 | 95 | ||
97 | ade7758_write_waveform_type(&indio_dev->dev, | 96 | ade7758_write_waveform_type(&indio_dev->dev, |
98 | st->ade7758_ring_channels[channel].address); | 97 | indio_dev->channels[channel].address); |
99 | 98 | ||
100 | return 0; | 99 | return 0; |
101 | } | 100 | } |
diff --git a/drivers/staging/rtl8723au/include/rtw_eeprom.h b/drivers/staging/rtl8723au/include/rtw_eeprom.h index e5121a2a64b4..a86f36e49dd1 100644 --- a/drivers/staging/rtl8723au/include/rtw_eeprom.h +++ b/drivers/staging/rtl8723au/include/rtw_eeprom.h | |||
@@ -107,12 +107,12 @@ enum rt_customer_id | |||
107 | }; | 107 | }; |
108 | 108 | ||
109 | struct eeprom_priv { | 109 | struct eeprom_priv { |
110 | u8 mac_addr[6]; /* PermanentAddress */ | ||
110 | u8 bautoload_fail_flag; | 111 | u8 bautoload_fail_flag; |
111 | u8 bloadfile_fail_flag; | 112 | u8 bloadfile_fail_flag; |
112 | u8 bloadmac_fail_flag; | 113 | u8 bloadmac_fail_flag; |
113 | /* u8 bempty; */ | 114 | /* u8 bempty; */ |
114 | /* u8 sys_config; */ | 115 | /* u8 sys_config; */ |
115 | u8 mac_addr[6]; /* PermanentAddress */ | ||
116 | /* u8 config0; */ | 116 | /* u8 config0; */ |
117 | u16 channel_plan; | 117 | u16 channel_plan; |
118 | /* u8 country_string[3]; */ | 118 | /* u8 country_string[3]; */ |
diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c index 461bf3d033a0..5a1f1070b702 100644 --- a/drivers/thermal/imx_thermal.c +++ b/drivers/thermal/imx_thermal.c | |||
@@ -459,6 +459,10 @@ static int imx_thermal_probe(struct platform_device *pdev) | |||
459 | int measure_freq; | 459 | int measure_freq; |
460 | int ret; | 460 | int ret; |
461 | 461 | ||
462 | if (!cpufreq_get_current_driver()) { | ||
463 | dev_dbg(&pdev->dev, "no cpufreq driver!"); | ||
464 | return -EPROBE_DEFER; | ||
465 | } | ||
462 | data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); | 466 | data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); |
463 | if (!data) | 467 | if (!data) |
464 | return -ENOMEM; | 468 | return -ENOMEM; |
@@ -521,6 +525,30 @@ static int imx_thermal_probe(struct platform_device *pdev) | |||
521 | return ret; | 525 | return ret; |
522 | } | 526 | } |
523 | 527 | ||
528 | data->thermal_clk = devm_clk_get(&pdev->dev, NULL); | ||
529 | if (IS_ERR(data->thermal_clk)) { | ||
530 | ret = PTR_ERR(data->thermal_clk); | ||
531 | if (ret != -EPROBE_DEFER) | ||
532 | dev_err(&pdev->dev, | ||
533 | "failed to get thermal clk: %d\n", ret); | ||
534 | cpufreq_cooling_unregister(data->cdev); | ||
535 | return ret; | ||
536 | } | ||
537 | |||
538 | /* | ||
539 | * Thermal sensor needs clk on to get correct value, normally | ||
540 | * we should enable its clk before taking measurement and disable | ||
541 | * clk after measurement is done, but if alarm function is enabled, | ||
542 | * hardware will auto measure the temperature periodically, so we | ||
543 | * need to keep the clk always on for alarm function. | ||
544 | */ | ||
545 | ret = clk_prepare_enable(data->thermal_clk); | ||
546 | if (ret) { | ||
547 | dev_err(&pdev->dev, "failed to enable thermal clk: %d\n", ret); | ||
548 | cpufreq_cooling_unregister(data->cdev); | ||
549 | return ret; | ||
550 | } | ||
551 | |||
524 | data->tz = thermal_zone_device_register("imx_thermal_zone", | 552 | data->tz = thermal_zone_device_register("imx_thermal_zone", |
525 | IMX_TRIP_NUM, | 553 | IMX_TRIP_NUM, |
526 | BIT(IMX_TRIP_PASSIVE), data, | 554 | BIT(IMX_TRIP_PASSIVE), data, |
@@ -531,26 +559,11 @@ static int imx_thermal_probe(struct platform_device *pdev) | |||
531 | ret = PTR_ERR(data->tz); | 559 | ret = PTR_ERR(data->tz); |
532 | dev_err(&pdev->dev, | 560 | dev_err(&pdev->dev, |
533 | "failed to register thermal zone device %d\n", ret); | 561 | "failed to register thermal zone device %d\n", ret); |
562 | clk_disable_unprepare(data->thermal_clk); | ||
534 | cpufreq_cooling_unregister(data->cdev); | 563 | cpufreq_cooling_unregister(data->cdev); |
535 | return ret; | 564 | return ret; |
536 | } | 565 | } |
537 | 566 | ||
538 | data->thermal_clk = devm_clk_get(&pdev->dev, NULL); | ||
539 | if (IS_ERR(data->thermal_clk)) { | ||
540 | dev_warn(&pdev->dev, "failed to get thermal clk!\n"); | ||
541 | } else { | ||
542 | /* | ||
543 | * Thermal sensor needs clk on to get correct value, normally | ||
544 | * we should enable its clk before taking measurement and disable | ||
545 | * clk after measurement is done, but if alarm function is enabled, | ||
546 | * hardware will auto measure the temperature periodically, so we | ||
547 | * need to keep the clk always on for alarm function. | ||
548 | */ | ||
549 | ret = clk_prepare_enable(data->thermal_clk); | ||
550 | if (ret) | ||
551 | dev_warn(&pdev->dev, "failed to enable thermal clk: %d\n", ret); | ||
552 | } | ||
553 | |||
554 | /* Enable measurements at ~ 10 Hz */ | 567 | /* Enable measurements at ~ 10 Hz */ |
555 | regmap_write(map, TEMPSENSE1 + REG_CLR, TEMPSENSE1_MEASURE_FREQ); | 568 | regmap_write(map, TEMPSENSE1 + REG_CLR, TEMPSENSE1_MEASURE_FREQ); |
556 | measure_freq = DIV_ROUND_UP(32768, 10); /* 10 Hz */ | 569 | measure_freq = DIV_ROUND_UP(32768, 10); /* 10 Hz */ |
diff --git a/drivers/thermal/int340x_thermal/int3403_thermal.c b/drivers/thermal/int340x_thermal/int3403_thermal.c index d20dba986f0f..6e9fb62eb817 100644 --- a/drivers/thermal/int340x_thermal/int3403_thermal.c +++ b/drivers/thermal/int340x_thermal/int3403_thermal.c | |||
@@ -92,7 +92,13 @@ static int sys_get_trip_hyst(struct thermal_zone_device *tzone, | |||
92 | if (ACPI_FAILURE(status)) | 92 | if (ACPI_FAILURE(status)) |
93 | return -EIO; | 93 | return -EIO; |
94 | 94 | ||
95 | *temp = DECI_KELVIN_TO_MILLI_CELSIUS(hyst, KELVIN_OFFSET); | 95 | /* |
96 | * Thermal hysteresis represents a temperature difference. | ||
97 | * Kelvin and Celsius have same degree size. So the | ||
98 | * conversion here between tenths of degree Kelvin unit | ||
99 | * and Milli-Celsius unit is just to multiply 100. | ||
100 | */ | ||
101 | *temp = hyst * 100; | ||
96 | 102 | ||
97 | return 0; | 103 | return 0; |
98 | } | 104 | } |
diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c index f8eb625b8400..62143ba31001 100644 --- a/drivers/thermal/of-thermal.c +++ b/drivers/thermal/of-thermal.c | |||
@@ -387,15 +387,18 @@ thermal_zone_of_sensor_register(struct device *dev, int sensor_id, | |||
387 | int (*get_trend)(void *, long *)) | 387 | int (*get_trend)(void *, long *)) |
388 | { | 388 | { |
389 | struct device_node *np, *child, *sensor_np; | 389 | struct device_node *np, *child, *sensor_np; |
390 | struct thermal_zone_device *tzd = ERR_PTR(-ENODEV); | ||
390 | 391 | ||
391 | np = of_find_node_by_name(NULL, "thermal-zones"); | 392 | np = of_find_node_by_name(NULL, "thermal-zones"); |
392 | if (!np) | 393 | if (!np) |
393 | return ERR_PTR(-ENODEV); | 394 | return ERR_PTR(-ENODEV); |
394 | 395 | ||
395 | if (!dev || !dev->of_node) | 396 | if (!dev || !dev->of_node) { |
397 | of_node_put(np); | ||
396 | return ERR_PTR(-EINVAL); | 398 | return ERR_PTR(-EINVAL); |
399 | } | ||
397 | 400 | ||
398 | sensor_np = dev->of_node; | 401 | sensor_np = of_node_get(dev->of_node); |
399 | 402 | ||
400 | for_each_child_of_node(np, child) { | 403 | for_each_child_of_node(np, child) { |
401 | struct of_phandle_args sensor_specs; | 404 | struct of_phandle_args sensor_specs; |
@@ -422,16 +425,21 @@ thermal_zone_of_sensor_register(struct device *dev, int sensor_id, | |||
422 | } | 425 | } |
423 | 426 | ||
424 | if (sensor_specs.np == sensor_np && id == sensor_id) { | 427 | if (sensor_specs.np == sensor_np && id == sensor_id) { |
425 | of_node_put(np); | 428 | tzd = thermal_zone_of_add_sensor(child, sensor_np, |
426 | return thermal_zone_of_add_sensor(child, sensor_np, | 429 | data, |
427 | data, | 430 | get_temp, |
428 | get_temp, | 431 | get_trend); |
429 | get_trend); | 432 | of_node_put(sensor_specs.np); |
433 | of_node_put(child); | ||
434 | goto exit; | ||
430 | } | 435 | } |
436 | of_node_put(sensor_specs.np); | ||
431 | } | 437 | } |
438 | exit: | ||
439 | of_node_put(sensor_np); | ||
432 | of_node_put(np); | 440 | of_node_put(np); |
433 | 441 | ||
434 | return ERR_PTR(-ENODEV); | 442 | return tzd; |
435 | } | 443 | } |
436 | EXPORT_SYMBOL_GPL(thermal_zone_of_sensor_register); | 444 | EXPORT_SYMBOL_GPL(thermal_zone_of_sensor_register); |
437 | 445 | ||
@@ -623,6 +631,7 @@ static int thermal_of_populate_trip(struct device_node *np, | |||
623 | 631 | ||
624 | /* Required for cooling map matching */ | 632 | /* Required for cooling map matching */ |
625 | trip->np = np; | 633 | trip->np = np; |
634 | of_node_get(np); | ||
626 | 635 | ||
627 | return 0; | 636 | return 0; |
628 | } | 637 | } |
@@ -730,9 +739,14 @@ finish: | |||
730 | return tz; | 739 | return tz; |
731 | 740 | ||
732 | free_tbps: | 741 | free_tbps: |
742 | for (i = 0; i < tz->num_tbps; i++) | ||
743 | of_node_put(tz->tbps[i].cooling_device); | ||
733 | kfree(tz->tbps); | 744 | kfree(tz->tbps); |
734 | free_trips: | 745 | free_trips: |
746 | for (i = 0; i < tz->ntrips; i++) | ||
747 | of_node_put(tz->trips[i].np); | ||
735 | kfree(tz->trips); | 748 | kfree(tz->trips); |
749 | of_node_put(gchild); | ||
736 | free_tz: | 750 | free_tz: |
737 | kfree(tz); | 751 | kfree(tz); |
738 | of_node_put(child); | 752 | of_node_put(child); |
@@ -742,7 +756,13 @@ free_tz: | |||
742 | 756 | ||
743 | static inline void of_thermal_free_zone(struct __thermal_zone *tz) | 757 | static inline void of_thermal_free_zone(struct __thermal_zone *tz) |
744 | { | 758 | { |
759 | int i; | ||
760 | |||
761 | for (i = 0; i < tz->num_tbps; i++) | ||
762 | of_node_put(tz->tbps[i].cooling_device); | ||
745 | kfree(tz->tbps); | 763 | kfree(tz->tbps); |
764 | for (i = 0; i < tz->ntrips; i++) | ||
765 | of_node_put(tz->trips[i].np); | ||
746 | kfree(tz->trips); | 766 | kfree(tz->trips); |
747 | kfree(tz); | 767 | kfree(tz); |
748 | } | 768 | } |
@@ -814,10 +834,13 @@ int __init of_parse_thermal_zones(void) | |||
814 | /* attempting to build remaining zones still */ | 834 | /* attempting to build remaining zones still */ |
815 | } | 835 | } |
816 | } | 836 | } |
837 | of_node_put(np); | ||
817 | 838 | ||
818 | return 0; | 839 | return 0; |
819 | 840 | ||
820 | exit_free: | 841 | exit_free: |
842 | of_node_put(child); | ||
843 | of_node_put(np); | ||
821 | of_thermal_free_zone(tz); | 844 | of_thermal_free_zone(tz); |
822 | 845 | ||
823 | /* no memory available, so free what we have built */ | 846 | /* no memory available, so free what we have built */ |
@@ -859,4 +882,5 @@ void of_thermal_destroy_zones(void) | |||
859 | kfree(zone->ops); | 882 | kfree(zone->ops); |
860 | of_thermal_free_zone(zone->devdata); | 883 | of_thermal_free_zone(zone->devdata); |
861 | } | 884 | } |
885 | of_node_put(np); | ||
862 | } | 886 | } |
diff --git a/drivers/thermal/samsung/exynos_thermal_common.h b/drivers/thermal/samsung/exynos_thermal_common.h index 3eb2ed9ea3a4..158f5aa8dc5d 100644 --- a/drivers/thermal/samsung/exynos_thermal_common.h +++ b/drivers/thermal/samsung/exynos_thermal_common.h | |||
@@ -27,7 +27,7 @@ | |||
27 | #define SENSOR_NAME_LEN 16 | 27 | #define SENSOR_NAME_LEN 16 |
28 | #define MAX_TRIP_COUNT 8 | 28 | #define MAX_TRIP_COUNT 8 |
29 | #define MAX_COOLING_DEVICE 4 | 29 | #define MAX_COOLING_DEVICE 4 |
30 | #define MAX_THRESHOLD_LEVS 5 | 30 | #define MAX_TRIMINFO_CTRL_REG 2 |
31 | 31 | ||
32 | #define ACTIVE_INTERVAL 500 | 32 | #define ACTIVE_INTERVAL 500 |
33 | #define IDLE_INTERVAL 10000 | 33 | #define IDLE_INTERVAL 10000 |
diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index acbff14da3a4..49c09243fd38 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c | |||
@@ -77,16 +77,6 @@ static int temp_to_code(struct exynos_tmu_data *data, u8 temp) | |||
77 | struct exynos_tmu_platform_data *pdata = data->pdata; | 77 | struct exynos_tmu_platform_data *pdata = data->pdata; |
78 | int temp_code; | 78 | int temp_code; |
79 | 79 | ||
80 | if (pdata->cal_mode == HW_MODE) | ||
81 | return temp; | ||
82 | |||
83 | if (data->soc == SOC_ARCH_EXYNOS4210) | ||
84 | /* temp should range between 25 and 125 */ | ||
85 | if (temp < 25 || temp > 125) { | ||
86 | temp_code = -EINVAL; | ||
87 | goto out; | ||
88 | } | ||
89 | |||
90 | switch (pdata->cal_type) { | 80 | switch (pdata->cal_type) { |
91 | case TYPE_TWO_POINT_TRIMMING: | 81 | case TYPE_TWO_POINT_TRIMMING: |
92 | temp_code = (temp - pdata->first_point_trim) * | 82 | temp_code = (temp - pdata->first_point_trim) * |
@@ -101,7 +91,7 @@ static int temp_to_code(struct exynos_tmu_data *data, u8 temp) | |||
101 | temp_code = temp + pdata->default_temp_offset; | 91 | temp_code = temp + pdata->default_temp_offset; |
102 | break; | 92 | break; |
103 | } | 93 | } |
104 | out: | 94 | |
105 | return temp_code; | 95 | return temp_code; |
106 | } | 96 | } |
107 | 97 | ||
@@ -114,16 +104,6 @@ static int code_to_temp(struct exynos_tmu_data *data, u8 temp_code) | |||
114 | struct exynos_tmu_platform_data *pdata = data->pdata; | 104 | struct exynos_tmu_platform_data *pdata = data->pdata; |
115 | int temp; | 105 | int temp; |
116 | 106 | ||
117 | if (pdata->cal_mode == HW_MODE) | ||
118 | return temp_code; | ||
119 | |||
120 | if (data->soc == SOC_ARCH_EXYNOS4210) | ||
121 | /* temp_code should range between 75 and 175 */ | ||
122 | if (temp_code < 75 || temp_code > 175) { | ||
123 | temp = -ENODATA; | ||
124 | goto out; | ||
125 | } | ||
126 | |||
127 | switch (pdata->cal_type) { | 107 | switch (pdata->cal_type) { |
128 | case TYPE_TWO_POINT_TRIMMING: | 108 | case TYPE_TWO_POINT_TRIMMING: |
129 | temp = (temp_code - data->temp_error1) * | 109 | temp = (temp_code - data->temp_error1) * |
@@ -138,18 +118,35 @@ static int code_to_temp(struct exynos_tmu_data *data, u8 temp_code) | |||
138 | temp = temp_code - pdata->default_temp_offset; | 118 | temp = temp_code - pdata->default_temp_offset; |
139 | break; | 119 | break; |
140 | } | 120 | } |
141 | out: | 121 | |
142 | return temp; | 122 | return temp; |
143 | } | 123 | } |
144 | 124 | ||
125 | static void exynos_tmu_clear_irqs(struct exynos_tmu_data *data) | ||
126 | { | ||
127 | const struct exynos_tmu_registers *reg = data->pdata->registers; | ||
128 | unsigned int val_irq; | ||
129 | |||
130 | val_irq = readl(data->base + reg->tmu_intstat); | ||
131 | /* | ||
132 | * Clear the interrupts. Please note that the documentation for | ||
133 | * Exynos3250, Exynos4412, Exynos5250 and Exynos5260 incorrectly | ||
134 | * states that INTCLEAR register has a different placing of bits | ||
135 | * responsible for FALL IRQs than INTSTAT register. Exynos5420 | ||
136 | * and Exynos5440 documentation is correct (Exynos4210 doesn't | ||
137 | * support FALL IRQs at all). | ||
138 | */ | ||
139 | writel(val_irq, data->base + reg->tmu_intclear); | ||
140 | } | ||
141 | |||
145 | static int exynos_tmu_initialize(struct platform_device *pdev) | 142 | static int exynos_tmu_initialize(struct platform_device *pdev) |
146 | { | 143 | { |
147 | struct exynos_tmu_data *data = platform_get_drvdata(pdev); | 144 | struct exynos_tmu_data *data = platform_get_drvdata(pdev); |
148 | struct exynos_tmu_platform_data *pdata = data->pdata; | 145 | struct exynos_tmu_platform_data *pdata = data->pdata; |
149 | const struct exynos_tmu_registers *reg = pdata->registers; | 146 | const struct exynos_tmu_registers *reg = pdata->registers; |
150 | unsigned int status, trim_info = 0, con; | 147 | unsigned int status, trim_info = 0, con, ctrl; |
151 | unsigned int rising_threshold = 0, falling_threshold = 0; | 148 | unsigned int rising_threshold = 0, falling_threshold = 0; |
152 | int ret = 0, threshold_code, i, trigger_levs = 0; | 149 | int ret = 0, threshold_code, i; |
153 | 150 | ||
154 | mutex_lock(&data->lock); | 151 | mutex_lock(&data->lock); |
155 | clk_enable(data->clk); | 152 | clk_enable(data->clk); |
@@ -164,11 +161,17 @@ static int exynos_tmu_initialize(struct platform_device *pdev) | |||
164 | } | 161 | } |
165 | } | 162 | } |
166 | 163 | ||
167 | if (TMU_SUPPORTS(pdata, TRIM_RELOAD)) | 164 | if (TMU_SUPPORTS(pdata, TRIM_RELOAD)) { |
168 | __raw_writel(1, data->base + reg->triminfo_ctrl); | 165 | for (i = 0; i < reg->triminfo_ctrl_count; i++) { |
169 | 166 | if (pdata->triminfo_reload[i]) { | |
170 | if (pdata->cal_mode == HW_MODE) | 167 | ctrl = readl(data->base + |
171 | goto skip_calib_data; | 168 | reg->triminfo_ctrl[i]); |
169 | ctrl |= pdata->triminfo_reload[i]; | ||
170 | writel(ctrl, data->base + | ||
171 | reg->triminfo_ctrl[i]); | ||
172 | } | ||
173 | } | ||
174 | } | ||
172 | 175 | ||
173 | /* Save trimming info in order to perform calibration */ | 176 | /* Save trimming info in order to perform calibration */ |
174 | if (data->soc == SOC_ARCH_EXYNOS5440) { | 177 | if (data->soc == SOC_ARCH_EXYNOS5440) { |
@@ -197,7 +200,7 @@ static int exynos_tmu_initialize(struct platform_device *pdev) | |||
197 | trim_info = readl(data->base + reg->triminfo_data); | 200 | trim_info = readl(data->base + reg->triminfo_data); |
198 | } | 201 | } |
199 | data->temp_error1 = trim_info & EXYNOS_TMU_TEMP_MASK; | 202 | data->temp_error1 = trim_info & EXYNOS_TMU_TEMP_MASK; |
200 | data->temp_error2 = ((trim_info >> reg->triminfo_85_shift) & | 203 | data->temp_error2 = ((trim_info >> EXYNOS_TRIMINFO_85_SHIFT) & |
201 | EXYNOS_TMU_TEMP_MASK); | 204 | EXYNOS_TMU_TEMP_MASK); |
202 | 205 | ||
203 | if (!data->temp_error1 || | 206 | if (!data->temp_error1 || |
@@ -207,67 +210,33 @@ static int exynos_tmu_initialize(struct platform_device *pdev) | |||
207 | 210 | ||
208 | if (!data->temp_error2) | 211 | if (!data->temp_error2) |
209 | data->temp_error2 = | 212 | data->temp_error2 = |
210 | (pdata->efuse_value >> reg->triminfo_85_shift) & | 213 | (pdata->efuse_value >> EXYNOS_TRIMINFO_85_SHIFT) & |
211 | EXYNOS_TMU_TEMP_MASK; | 214 | EXYNOS_TMU_TEMP_MASK; |
212 | 215 | ||
213 | skip_calib_data: | ||
214 | if (pdata->max_trigger_level > MAX_THRESHOLD_LEVS) { | ||
215 | dev_err(&pdev->dev, "Invalid max trigger level\n"); | ||
216 | ret = -EINVAL; | ||
217 | goto out; | ||
218 | } | ||
219 | |||
220 | for (i = 0; i < pdata->max_trigger_level; i++) { | ||
221 | if (!pdata->trigger_levels[i]) | ||
222 | continue; | ||
223 | |||
224 | if ((pdata->trigger_type[i] == HW_TRIP) && | ||
225 | (!pdata->trigger_levels[pdata->max_trigger_level - 1])) { | ||
226 | dev_err(&pdev->dev, "Invalid hw trigger level\n"); | ||
227 | ret = -EINVAL; | ||
228 | goto out; | ||
229 | } | ||
230 | |||
231 | /* Count trigger levels except the HW trip*/ | ||
232 | if (!(pdata->trigger_type[i] == HW_TRIP)) | ||
233 | trigger_levs++; | ||
234 | } | ||
235 | |||
236 | rising_threshold = readl(data->base + reg->threshold_th0); | 216 | rising_threshold = readl(data->base + reg->threshold_th0); |
237 | 217 | ||
238 | if (data->soc == SOC_ARCH_EXYNOS4210) { | 218 | if (data->soc == SOC_ARCH_EXYNOS4210) { |
239 | /* Write temperature code for threshold */ | 219 | /* Write temperature code for threshold */ |
240 | threshold_code = temp_to_code(data, pdata->threshold); | 220 | threshold_code = temp_to_code(data, pdata->threshold); |
241 | if (threshold_code < 0) { | ||
242 | ret = threshold_code; | ||
243 | goto out; | ||
244 | } | ||
245 | writeb(threshold_code, | 221 | writeb(threshold_code, |
246 | data->base + reg->threshold_temp); | 222 | data->base + reg->threshold_temp); |
247 | for (i = 0; i < trigger_levs; i++) | 223 | for (i = 0; i < pdata->non_hw_trigger_levels; i++) |
248 | writeb(pdata->trigger_levels[i], data->base + | 224 | writeb(pdata->trigger_levels[i], data->base + |
249 | reg->threshold_th0 + i * sizeof(reg->threshold_th0)); | 225 | reg->threshold_th0 + i * sizeof(reg->threshold_th0)); |
250 | 226 | ||
251 | writel(reg->intclr_rise_mask, data->base + reg->tmu_intclear); | 227 | exynos_tmu_clear_irqs(data); |
252 | } else { | 228 | } else { |
253 | /* Write temperature code for rising and falling threshold */ | 229 | /* Write temperature code for rising and falling threshold */ |
254 | for (i = 0; | 230 | for (i = 0; i < pdata->non_hw_trigger_levels; i++) { |
255 | i < trigger_levs && i < EXYNOS_MAX_TRIGGER_PER_REG; i++) { | ||
256 | threshold_code = temp_to_code(data, | 231 | threshold_code = temp_to_code(data, |
257 | pdata->trigger_levels[i]); | 232 | pdata->trigger_levels[i]); |
258 | if (threshold_code < 0) { | ||
259 | ret = threshold_code; | ||
260 | goto out; | ||
261 | } | ||
262 | rising_threshold &= ~(0xff << 8 * i); | 233 | rising_threshold &= ~(0xff << 8 * i); |
263 | rising_threshold |= threshold_code << 8 * i; | 234 | rising_threshold |= threshold_code << 8 * i; |
264 | if (pdata->threshold_falling) { | 235 | if (pdata->threshold_falling) { |
265 | threshold_code = temp_to_code(data, | 236 | threshold_code = temp_to_code(data, |
266 | pdata->trigger_levels[i] - | 237 | pdata->trigger_levels[i] - |
267 | pdata->threshold_falling); | 238 | pdata->threshold_falling); |
268 | if (threshold_code > 0) | 239 | falling_threshold |= threshold_code << 8 * i; |
269 | falling_threshold |= | ||
270 | threshold_code << 8 * i; | ||
271 | } | 240 | } |
272 | } | 241 | } |
273 | 242 | ||
@@ -276,9 +245,7 @@ skip_calib_data: | |||
276 | writel(falling_threshold, | 245 | writel(falling_threshold, |
277 | data->base + reg->threshold_th1); | 246 | data->base + reg->threshold_th1); |
278 | 247 | ||
279 | writel((reg->intclr_rise_mask << reg->intclr_rise_shift) | | 248 | exynos_tmu_clear_irqs(data); |
280 | (reg->intclr_fall_mask << reg->intclr_fall_shift), | ||
281 | data->base + reg->tmu_intclear); | ||
282 | 249 | ||
283 | /* if last threshold limit is also present */ | 250 | /* if last threshold limit is also present */ |
284 | i = pdata->max_trigger_level - 1; | 251 | i = pdata->max_trigger_level - 1; |
@@ -286,10 +253,6 @@ skip_calib_data: | |||
286 | (pdata->trigger_type[i] == HW_TRIP)) { | 253 | (pdata->trigger_type[i] == HW_TRIP)) { |
287 | threshold_code = temp_to_code(data, | 254 | threshold_code = temp_to_code(data, |
288 | pdata->trigger_levels[i]); | 255 | pdata->trigger_levels[i]); |
289 | if (threshold_code < 0) { | ||
290 | ret = threshold_code; | ||
291 | goto out; | ||
292 | } | ||
293 | if (i == EXYNOS_MAX_TRIGGER_PER_REG - 1) { | 256 | if (i == EXYNOS_MAX_TRIGGER_PER_REG - 1) { |
294 | /* 1-4 level to be assigned in th0 reg */ | 257 | /* 1-4 level to be assigned in th0 reg */ |
295 | rising_threshold &= ~(0xff << 8 * i); | 258 | rising_threshold &= ~(0xff << 8 * i); |
@@ -325,7 +288,7 @@ static void exynos_tmu_control(struct platform_device *pdev, bool on) | |||
325 | struct exynos_tmu_data *data = platform_get_drvdata(pdev); | 288 | struct exynos_tmu_data *data = platform_get_drvdata(pdev); |
326 | struct exynos_tmu_platform_data *pdata = data->pdata; | 289 | struct exynos_tmu_platform_data *pdata = data->pdata; |
327 | const struct exynos_tmu_registers *reg = pdata->registers; | 290 | const struct exynos_tmu_registers *reg = pdata->registers; |
328 | unsigned int con, interrupt_en, cal_val; | 291 | unsigned int con, interrupt_en; |
329 | 292 | ||
330 | mutex_lock(&data->lock); | 293 | mutex_lock(&data->lock); |
331 | clk_enable(data->clk); | 294 | clk_enable(data->clk); |
@@ -335,15 +298,11 @@ static void exynos_tmu_control(struct platform_device *pdev, bool on) | |||
335 | if (pdata->test_mux) | 298 | if (pdata->test_mux) |
336 | con |= (pdata->test_mux << reg->test_mux_addr_shift); | 299 | con |= (pdata->test_mux << reg->test_mux_addr_shift); |
337 | 300 | ||
338 | if (pdata->reference_voltage) { | 301 | con &= ~(EXYNOS_TMU_REF_VOLTAGE_MASK << EXYNOS_TMU_REF_VOLTAGE_SHIFT); |
339 | con &= ~(reg->buf_vref_sel_mask << reg->buf_vref_sel_shift); | 302 | con |= pdata->reference_voltage << EXYNOS_TMU_REF_VOLTAGE_SHIFT; |
340 | con |= pdata->reference_voltage << reg->buf_vref_sel_shift; | ||
341 | } | ||
342 | 303 | ||
343 | if (pdata->gain) { | 304 | con &= ~(EXYNOS_TMU_BUF_SLOPE_SEL_MASK << EXYNOS_TMU_BUF_SLOPE_SEL_SHIFT); |
344 | con &= ~(reg->buf_slope_sel_mask << reg->buf_slope_sel_shift); | 305 | con |= (pdata->gain << EXYNOS_TMU_BUF_SLOPE_SEL_SHIFT); |
345 | con |= (pdata->gain << reg->buf_slope_sel_shift); | ||
346 | } | ||
347 | 306 | ||
348 | if (pdata->noise_cancel_mode) { | 307 | if (pdata->noise_cancel_mode) { |
349 | con &= ~(reg->therm_trip_mode_mask << | 308 | con &= ~(reg->therm_trip_mode_mask << |
@@ -351,29 +310,8 @@ static void exynos_tmu_control(struct platform_device *pdev, bool on) | |||
351 | con |= (pdata->noise_cancel_mode << reg->therm_trip_mode_shift); | 310 | con |= (pdata->noise_cancel_mode << reg->therm_trip_mode_shift); |
352 | } | 311 | } |
353 | 312 | ||
354 | if (pdata->cal_mode == HW_MODE) { | ||
355 | con &= ~(reg->calib_mode_mask << reg->calib_mode_shift); | ||
356 | cal_val = 0; | ||
357 | switch (pdata->cal_type) { | ||
358 | case TYPE_TWO_POINT_TRIMMING: | ||
359 | cal_val = 3; | ||
360 | break; | ||
361 | case TYPE_ONE_POINT_TRIMMING_85: | ||
362 | cal_val = 2; | ||
363 | break; | ||
364 | case TYPE_ONE_POINT_TRIMMING_25: | ||
365 | cal_val = 1; | ||
366 | break; | ||
367 | case TYPE_NONE: | ||
368 | break; | ||
369 | default: | ||
370 | dev_err(&pdev->dev, "Invalid calibration type, using none\n"); | ||
371 | } | ||
372 | con |= cal_val << reg->calib_mode_shift; | ||
373 | } | ||
374 | |||
375 | if (on) { | 313 | if (on) { |
376 | con |= (1 << reg->core_en_shift); | 314 | con |= (1 << EXYNOS_TMU_CORE_EN_SHIFT); |
377 | interrupt_en = | 315 | interrupt_en = |
378 | pdata->trigger_enable[3] << reg->inten_rise3_shift | | 316 | pdata->trigger_enable[3] << reg->inten_rise3_shift | |
379 | pdata->trigger_enable[2] << reg->inten_rise2_shift | | 317 | pdata->trigger_enable[2] << reg->inten_rise2_shift | |
@@ -383,7 +321,7 @@ static void exynos_tmu_control(struct platform_device *pdev, bool on) | |||
383 | interrupt_en |= | 321 | interrupt_en |= |
384 | interrupt_en << reg->inten_fall0_shift; | 322 | interrupt_en << reg->inten_fall0_shift; |
385 | } else { | 323 | } else { |
386 | con &= ~(1 << reg->core_en_shift); | 324 | con &= ~(1 << EXYNOS_TMU_CORE_EN_SHIFT); |
387 | interrupt_en = 0; /* Disable all interrupts */ | 325 | interrupt_en = 0; /* Disable all interrupts */ |
388 | } | 326 | } |
389 | writel(interrupt_en, data->base + reg->tmu_inten); | 327 | writel(interrupt_en, data->base + reg->tmu_inten); |
@@ -404,8 +342,16 @@ static int exynos_tmu_read(struct exynos_tmu_data *data) | |||
404 | clk_enable(data->clk); | 342 | clk_enable(data->clk); |
405 | 343 | ||
406 | temp_code = readb(data->base + reg->tmu_cur_temp); | 344 | temp_code = readb(data->base + reg->tmu_cur_temp); |
407 | temp = code_to_temp(data, temp_code); | ||
408 | 345 | ||
346 | if (data->soc == SOC_ARCH_EXYNOS4210) | ||
347 | /* temp_code should range between 75 and 175 */ | ||
348 | if (temp_code < 75 || temp_code > 175) { | ||
349 | temp = -ENODATA; | ||
350 | goto out; | ||
351 | } | ||
352 | |||
353 | temp = code_to_temp(data, temp_code); | ||
354 | out: | ||
409 | clk_disable(data->clk); | 355 | clk_disable(data->clk); |
410 | mutex_unlock(&data->lock); | 356 | mutex_unlock(&data->lock); |
411 | 357 | ||
@@ -465,7 +411,7 @@ static void exynos_tmu_work(struct work_struct *work) | |||
465 | struct exynos_tmu_data, irq_work); | 411 | struct exynos_tmu_data, irq_work); |
466 | struct exynos_tmu_platform_data *pdata = data->pdata; | 412 | struct exynos_tmu_platform_data *pdata = data->pdata; |
467 | const struct exynos_tmu_registers *reg = pdata->registers; | 413 | const struct exynos_tmu_registers *reg = pdata->registers; |
468 | unsigned int val_irq, val_type; | 414 | unsigned int val_type; |
469 | 415 | ||
470 | if (!IS_ERR(data->clk_sec)) | 416 | if (!IS_ERR(data->clk_sec)) |
471 | clk_enable(data->clk_sec); | 417 | clk_enable(data->clk_sec); |
@@ -483,9 +429,7 @@ static void exynos_tmu_work(struct work_struct *work) | |||
483 | clk_enable(data->clk); | 429 | clk_enable(data->clk); |
484 | 430 | ||
485 | /* TODO: take action based on particular interrupt */ | 431 | /* TODO: take action based on particular interrupt */ |
486 | val_irq = readl(data->base + reg->tmu_intstat); | 432 | exynos_tmu_clear_irqs(data); |
487 | /* clear the interrupts */ | ||
488 | writel(val_irq, data->base + reg->tmu_intclear); | ||
489 | 433 | ||
490 | clk_disable(data->clk); | 434 | clk_disable(data->clk); |
491 | mutex_unlock(&data->lock); | 435 | mutex_unlock(&data->lock); |
diff --git a/drivers/thermal/samsung/exynos_tmu.h b/drivers/thermal/samsung/exynos_tmu.h index 1b4a6444ea61..c58c7663a3fe 100644 --- a/drivers/thermal/samsung/exynos_tmu.h +++ b/drivers/thermal/samsung/exynos_tmu.h | |||
@@ -34,11 +34,6 @@ enum calibration_type { | |||
34 | TYPE_NONE, | 34 | TYPE_NONE, |
35 | }; | 35 | }; |
36 | 36 | ||
37 | enum calibration_mode { | ||
38 | SW_MODE, | ||
39 | HW_MODE, | ||
40 | }; | ||
41 | |||
42 | enum soc_type { | 37 | enum soc_type { |
43 | SOC_ARCH_EXYNOS3250 = 1, | 38 | SOC_ARCH_EXYNOS3250 = 1, |
44 | SOC_ARCH_EXYNOS4210, | 39 | SOC_ARCH_EXYNOS4210, |
@@ -82,46 +77,19 @@ enum soc_type { | |||
82 | * bitfields. The register validity, offsets and bitfield values may vary | 77 | * bitfields. The register validity, offsets and bitfield values may vary |
83 | * slightly across different exynos SOC's. | 78 | * slightly across different exynos SOC's. |
84 | * @triminfo_data: register containing 2 pont trimming data | 79 | * @triminfo_data: register containing 2 pont trimming data |
85 | * @triminfo_25_shift: shift bit of the 25 C trim value in triminfo_data reg. | ||
86 | * @triminfo_85_shift: shift bit of the 85 C trim value in triminfo_data reg. | ||
87 | * @triminfo_ctrl: trim info controller register. | 80 | * @triminfo_ctrl: trim info controller register. |
88 | * @triminfo_reload_shift: shift of triminfo reload enable bit in triminfo_ctrl | 81 | * @triminfo_ctrl_count: the number of trim info controller register. |
89 | reg. | ||
90 | * @tmu_ctrl: TMU main controller register. | 82 | * @tmu_ctrl: TMU main controller register. |
91 | * @test_mux_addr_shift: shift bits of test mux address. | 83 | * @test_mux_addr_shift: shift bits of test mux address. |
92 | * @buf_vref_sel_shift: shift bits of reference voltage in tmu_ctrl register. | ||
93 | * @buf_vref_sel_mask: mask bits of reference voltage in tmu_ctrl register. | ||
94 | * @therm_trip_mode_shift: shift bits of tripping mode in tmu_ctrl register. | 84 | * @therm_trip_mode_shift: shift bits of tripping mode in tmu_ctrl register. |
95 | * @therm_trip_mode_mask: mask bits of tripping mode in tmu_ctrl register. | 85 | * @therm_trip_mode_mask: mask bits of tripping mode in tmu_ctrl register. |
96 | * @therm_trip_en_shift: shift bits of tripping enable in tmu_ctrl register. | 86 | * @therm_trip_en_shift: shift bits of tripping enable in tmu_ctrl register. |
97 | * @buf_slope_sel_shift: shift bits of amplifier gain value in tmu_ctrl | ||
98 | register. | ||
99 | * @buf_slope_sel_mask: mask bits of amplifier gain value in tmu_ctrl register. | ||
100 | * @calib_mode_shift: shift bits of calibration mode value in tmu_ctrl | ||
101 | register. | ||
102 | * @calib_mode_mask: mask bits of calibration mode value in tmu_ctrl | ||
103 | register. | ||
104 | * @therm_trip_tq_en_shift: shift bits of thermal trip enable by TQ pin in | ||
105 | tmu_ctrl register. | ||
106 | * @core_en_shift: shift bits of TMU core enable bit in tmu_ctrl register. | ||
107 | * @tmu_status: register drescribing the TMU status. | 87 | * @tmu_status: register drescribing the TMU status. |
108 | * @tmu_cur_temp: register containing the current temperature of the TMU. | 88 | * @tmu_cur_temp: register containing the current temperature of the TMU. |
109 | * @tmu_cur_temp_shift: shift bits of current temp value in tmu_cur_temp | ||
110 | register. | ||
111 | * @threshold_temp: register containing the base threshold level. | 89 | * @threshold_temp: register containing the base threshold level. |
112 | * @threshold_th0: Register containing first set of rising levels. | 90 | * @threshold_th0: Register containing first set of rising levels. |
113 | * @threshold_th0_l0_shift: shift bits of level0 threshold temperature. | ||
114 | * @threshold_th0_l1_shift: shift bits of level1 threshold temperature. | ||
115 | * @threshold_th0_l2_shift: shift bits of level2 threshold temperature. | ||
116 | * @threshold_th0_l3_shift: shift bits of level3 threshold temperature. | ||
117 | * @threshold_th1: Register containing second set of rising levels. | 91 | * @threshold_th1: Register containing second set of rising levels. |
118 | * @threshold_th1_l0_shift: shift bits of level0 threshold temperature. | ||
119 | * @threshold_th1_l1_shift: shift bits of level1 threshold temperature. | ||
120 | * @threshold_th1_l2_shift: shift bits of level2 threshold temperature. | ||
121 | * @threshold_th1_l3_shift: shift bits of level3 threshold temperature. | ||
122 | * @threshold_th2: Register containing third set of rising levels. | 92 | * @threshold_th2: Register containing third set of rising levels. |
123 | * @threshold_th2_l0_shift: shift bits of level0 threshold temperature. | ||
124 | * @threshold_th3: Register containing fourth set of rising levels. | ||
125 | * @threshold_th3_l0_shift: shift bits of level0 threshold temperature. | 93 | * @threshold_th3_l0_shift: shift bits of level0 threshold temperature. |
126 | * @tmu_inten: register containing the different threshold interrupt | 94 | * @tmu_inten: register containing the different threshold interrupt |
127 | enable bits. | 95 | enable bits. |
@@ -130,68 +98,35 @@ enum soc_type { | |||
130 | * @inten_rise2_shift: shift bits of rising 2 interrupt bits. | 98 | * @inten_rise2_shift: shift bits of rising 2 interrupt bits. |
131 | * @inten_rise3_shift: shift bits of rising 3 interrupt bits. | 99 | * @inten_rise3_shift: shift bits of rising 3 interrupt bits. |
132 | * @inten_fall0_shift: shift bits of falling 0 interrupt bits. | 100 | * @inten_fall0_shift: shift bits of falling 0 interrupt bits. |
133 | * @inten_fall1_shift: shift bits of falling 1 interrupt bits. | ||
134 | * @inten_fall2_shift: shift bits of falling 2 interrupt bits. | ||
135 | * @inten_fall3_shift: shift bits of falling 3 interrupt bits. | ||
136 | * @tmu_intstat: Register containing the interrupt status values. | 101 | * @tmu_intstat: Register containing the interrupt status values. |
137 | * @tmu_intclear: Register for clearing the raised interrupt status. | 102 | * @tmu_intclear: Register for clearing the raised interrupt status. |
138 | * @intclr_fall_shift: shift bits for interrupt clear fall 0 | ||
139 | * @intclr_rise_shift: shift bits of all rising interrupt bits. | ||
140 | * @intclr_rise_mask: mask bits of all rising interrupt bits. | ||
141 | * @intclr_fall_mask: mask bits of all rising interrupt bits. | ||
142 | * @emul_con: TMU emulation controller register. | 103 | * @emul_con: TMU emulation controller register. |
143 | * @emul_temp_shift: shift bits of emulation temperature. | 104 | * @emul_temp_shift: shift bits of emulation temperature. |
144 | * @emul_time_shift: shift bits of emulation time. | 105 | * @emul_time_shift: shift bits of emulation time. |
145 | * @emul_time_mask: mask bits of emulation time. | ||
146 | * @tmu_irqstatus: register to find which TMU generated interrupts. | 106 | * @tmu_irqstatus: register to find which TMU generated interrupts. |
147 | * @tmu_pmin: register to get/set the Pmin value. | 107 | * @tmu_pmin: register to get/set the Pmin value. |
148 | */ | 108 | */ |
149 | struct exynos_tmu_registers { | 109 | struct exynos_tmu_registers { |
150 | u32 triminfo_data; | 110 | u32 triminfo_data; |
151 | u32 triminfo_25_shift; | ||
152 | u32 triminfo_85_shift; | ||
153 | 111 | ||
154 | u32 triminfo_ctrl; | 112 | u32 triminfo_ctrl[MAX_TRIMINFO_CTRL_REG]; |
155 | u32 triminfo_ctrl1; | 113 | u32 triminfo_ctrl_count; |
156 | u32 triminfo_reload_shift; | ||
157 | 114 | ||
158 | u32 tmu_ctrl; | 115 | u32 tmu_ctrl; |
159 | u32 test_mux_addr_shift; | 116 | u32 test_mux_addr_shift; |
160 | u32 buf_vref_sel_shift; | ||
161 | u32 buf_vref_sel_mask; | ||
162 | u32 therm_trip_mode_shift; | 117 | u32 therm_trip_mode_shift; |
163 | u32 therm_trip_mode_mask; | 118 | u32 therm_trip_mode_mask; |
164 | u32 therm_trip_en_shift; | 119 | u32 therm_trip_en_shift; |
165 | u32 buf_slope_sel_shift; | ||
166 | u32 buf_slope_sel_mask; | ||
167 | u32 calib_mode_shift; | ||
168 | u32 calib_mode_mask; | ||
169 | u32 therm_trip_tq_en_shift; | ||
170 | u32 core_en_shift; | ||
171 | 120 | ||
172 | u32 tmu_status; | 121 | u32 tmu_status; |
173 | 122 | ||
174 | u32 tmu_cur_temp; | 123 | u32 tmu_cur_temp; |
175 | u32 tmu_cur_temp_shift; | ||
176 | 124 | ||
177 | u32 threshold_temp; | 125 | u32 threshold_temp; |
178 | 126 | ||
179 | u32 threshold_th0; | 127 | u32 threshold_th0; |
180 | u32 threshold_th0_l0_shift; | ||
181 | u32 threshold_th0_l1_shift; | ||
182 | u32 threshold_th0_l2_shift; | ||
183 | u32 threshold_th0_l3_shift; | ||
184 | |||
185 | u32 threshold_th1; | 128 | u32 threshold_th1; |
186 | u32 threshold_th1_l0_shift; | ||
187 | u32 threshold_th1_l1_shift; | ||
188 | u32 threshold_th1_l2_shift; | ||
189 | u32 threshold_th1_l3_shift; | ||
190 | |||
191 | u32 threshold_th2; | 129 | u32 threshold_th2; |
192 | u32 threshold_th2_l0_shift; | ||
193 | |||
194 | u32 threshold_th3; | ||
195 | u32 threshold_th3_l0_shift; | 130 | u32 threshold_th3_l0_shift; |
196 | 131 | ||
197 | u32 tmu_inten; | 132 | u32 tmu_inten; |
@@ -200,22 +135,14 @@ struct exynos_tmu_registers { | |||
200 | u32 inten_rise2_shift; | 135 | u32 inten_rise2_shift; |
201 | u32 inten_rise3_shift; | 136 | u32 inten_rise3_shift; |
202 | u32 inten_fall0_shift; | 137 | u32 inten_fall0_shift; |
203 | u32 inten_fall1_shift; | ||
204 | u32 inten_fall2_shift; | ||
205 | u32 inten_fall3_shift; | ||
206 | 138 | ||
207 | u32 tmu_intstat; | 139 | u32 tmu_intstat; |
208 | 140 | ||
209 | u32 tmu_intclear; | 141 | u32 tmu_intclear; |
210 | u32 intclr_fall_shift; | ||
211 | u32 intclr_rise_shift; | ||
212 | u32 intclr_fall_mask; | ||
213 | u32 intclr_rise_mask; | ||
214 | 142 | ||
215 | u32 emul_con; | 143 | u32 emul_con; |
216 | u32 emul_temp_shift; | 144 | u32 emul_temp_shift; |
217 | u32 emul_time_shift; | 145 | u32 emul_time_shift; |
218 | u32 emul_time_mask; | ||
219 | 146 | ||
220 | u32 tmu_irqstatus; | 147 | u32 tmu_irqstatus; |
221 | u32 tmu_pmin; | 148 | u32 tmu_pmin; |
@@ -250,11 +177,12 @@ struct exynos_tmu_registers { | |||
250 | * 1 = enable trigger_level[] interrupt, | 177 | * 1 = enable trigger_level[] interrupt, |
251 | * 0 = disable trigger_level[] interrupt | 178 | * 0 = disable trigger_level[] interrupt |
252 | * @max_trigger_level: max trigger level supported by the TMU | 179 | * @max_trigger_level: max trigger level supported by the TMU |
180 | * @non_hw_trigger_levels: number of defined non-hardware trigger levels | ||
253 | * @gain: gain of amplifier in the positive-TC generator block | 181 | * @gain: gain of amplifier in the positive-TC generator block |
254 | * 0 <= gain <= 15 | 182 | * 0 < gain <= 15 |
255 | * @reference_voltage: reference voltage of amplifier | 183 | * @reference_voltage: reference voltage of amplifier |
256 | * in the positive-TC generator block | 184 | * in the positive-TC generator block |
257 | * 0 <= reference_voltage <= 31 | 185 | * 0 < reference_voltage <= 31 |
258 | * @noise_cancel_mode: noise cancellation mode | 186 | * @noise_cancel_mode: noise cancellation mode |
259 | * 000, 100, 101, 110 and 111 can be different modes | 187 | * 000, 100, 101, 110 and 111 can be different modes |
260 | * @type: determines the type of SOC | 188 | * @type: determines the type of SOC |
@@ -265,8 +193,8 @@ struct exynos_tmu_registers { | |||
265 | * @second_point_trim: temp value of the second point trimming | 193 | * @second_point_trim: temp value of the second point trimming |
266 | * @default_temp_offset: default temperature offset in case of no trimming | 194 | * @default_temp_offset: default temperature offset in case of no trimming |
267 | * @test_mux; information if SoC supports test MUX | 195 | * @test_mux; information if SoC supports test MUX |
196 | * @triminfo_reload: reload value to read TRIMINFO register | ||
268 | * @cal_type: calibration type for temperature | 197 | * @cal_type: calibration type for temperature |
269 | * @cal_mode: calibration mode for temperature | ||
270 | * @freq_clip_table: Table representing frequency reduction percentage. | 198 | * @freq_clip_table: Table representing frequency reduction percentage. |
271 | * @freq_tab_count: Count of the above table as frequency reduction may | 199 | * @freq_tab_count: Count of the above table as frequency reduction may |
272 | * applicable to only some of the trigger levels. | 200 | * applicable to only some of the trigger levels. |
@@ -284,6 +212,7 @@ struct exynos_tmu_platform_data { | |||
284 | enum trigger_type trigger_type[MAX_TRIP_COUNT]; | 212 | enum trigger_type trigger_type[MAX_TRIP_COUNT]; |
285 | bool trigger_enable[MAX_TRIP_COUNT]; | 213 | bool trigger_enable[MAX_TRIP_COUNT]; |
286 | u8 max_trigger_level; | 214 | u8 max_trigger_level; |
215 | u8 non_hw_trigger_levels; | ||
287 | u8 gain; | 216 | u8 gain; |
288 | u8 reference_voltage; | 217 | u8 reference_voltage; |
289 | u8 noise_cancel_mode; | 218 | u8 noise_cancel_mode; |
@@ -295,9 +224,9 @@ struct exynos_tmu_platform_data { | |||
295 | u8 second_point_trim; | 224 | u8 second_point_trim; |
296 | u8 default_temp_offset; | 225 | u8 default_temp_offset; |
297 | u8 test_mux; | 226 | u8 test_mux; |
227 | u8 triminfo_reload[MAX_TRIMINFO_CTRL_REG]; | ||
298 | 228 | ||
299 | enum calibration_type cal_type; | 229 | enum calibration_type cal_type; |
300 | enum calibration_mode cal_mode; | ||
301 | enum soc_type type; | 230 | enum soc_type type; |
302 | struct freq_clip_table freq_tab[4]; | 231 | struct freq_clip_table freq_tab[4]; |
303 | unsigned int freq_tab_count; | 232 | unsigned int freq_tab_count; |
diff --git a/drivers/thermal/samsung/exynos_tmu_data.c b/drivers/thermal/samsung/exynos_tmu_data.c index aa8e0dee2055..1724f6cdaef8 100644 --- a/drivers/thermal/samsung/exynos_tmu_data.c +++ b/drivers/thermal/samsung/exynos_tmu_data.c | |||
@@ -27,14 +27,7 @@ | |||
27 | #if defined(CONFIG_CPU_EXYNOS4210) | 27 | #if defined(CONFIG_CPU_EXYNOS4210) |
28 | static const struct exynos_tmu_registers exynos4210_tmu_registers = { | 28 | static const struct exynos_tmu_registers exynos4210_tmu_registers = { |
29 | .triminfo_data = EXYNOS_TMU_REG_TRIMINFO, | 29 | .triminfo_data = EXYNOS_TMU_REG_TRIMINFO, |
30 | .triminfo_25_shift = EXYNOS_TRIMINFO_25_SHIFT, | ||
31 | .triminfo_85_shift = EXYNOS_TRIMINFO_85_SHIFT, | ||
32 | .tmu_ctrl = EXYNOS_TMU_REG_CONTROL, | 30 | .tmu_ctrl = EXYNOS_TMU_REG_CONTROL, |
33 | .buf_vref_sel_shift = EXYNOS_TMU_REF_VOLTAGE_SHIFT, | ||
34 | .buf_vref_sel_mask = EXYNOS_TMU_REF_VOLTAGE_MASK, | ||
35 | .buf_slope_sel_shift = EXYNOS_TMU_BUF_SLOPE_SEL_SHIFT, | ||
36 | .buf_slope_sel_mask = EXYNOS_TMU_BUF_SLOPE_SEL_MASK, | ||
37 | .core_en_shift = EXYNOS_TMU_CORE_EN_SHIFT, | ||
38 | .tmu_status = EXYNOS_TMU_REG_STATUS, | 31 | .tmu_status = EXYNOS_TMU_REG_STATUS, |
39 | .tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP, | 32 | .tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP, |
40 | .threshold_temp = EXYNOS4210_TMU_REG_THRESHOLD_TEMP, | 33 | .threshold_temp = EXYNOS4210_TMU_REG_THRESHOLD_TEMP, |
@@ -46,7 +39,6 @@ static const struct exynos_tmu_registers exynos4210_tmu_registers = { | |||
46 | .inten_rise3_shift = EXYNOS_TMU_INTEN_RISE3_SHIFT, | 39 | .inten_rise3_shift = EXYNOS_TMU_INTEN_RISE3_SHIFT, |
47 | .tmu_intstat = EXYNOS_TMU_REG_INTSTAT, | 40 | .tmu_intstat = EXYNOS_TMU_REG_INTSTAT, |
48 | .tmu_intclear = EXYNOS_TMU_REG_INTCLEAR, | 41 | .tmu_intclear = EXYNOS_TMU_REG_INTCLEAR, |
49 | .intclr_rise_mask = EXYNOS4210_TMU_TRIG_LEVEL_MASK, | ||
50 | }; | 42 | }; |
51 | 43 | ||
52 | struct exynos_tmu_init_data const exynos4210_default_tmu_data = { | 44 | struct exynos_tmu_init_data const exynos4210_default_tmu_data = { |
@@ -64,6 +56,7 @@ struct exynos_tmu_init_data const exynos4210_default_tmu_data = { | |||
64 | .trigger_type[1] = THROTTLE_ACTIVE, | 56 | .trigger_type[1] = THROTTLE_ACTIVE, |
65 | .trigger_type[2] = SW_TRIP, | 57 | .trigger_type[2] = SW_TRIP, |
66 | .max_trigger_level = 4, | 58 | .max_trigger_level = 4, |
59 | .non_hw_trigger_levels = 3, | ||
67 | .gain = 15, | 60 | .gain = 15, |
68 | .reference_voltage = 7, | 61 | .reference_voltage = 7, |
69 | .cal_type = TYPE_ONE_POINT_TRIMMING, | 62 | .cal_type = TYPE_ONE_POINT_TRIMMING, |
@@ -93,18 +86,14 @@ struct exynos_tmu_init_data const exynos4210_default_tmu_data = { | |||
93 | #if defined(CONFIG_SOC_EXYNOS3250) | 86 | #if defined(CONFIG_SOC_EXYNOS3250) |
94 | static const struct exynos_tmu_registers exynos3250_tmu_registers = { | 87 | static const struct exynos_tmu_registers exynos3250_tmu_registers = { |
95 | .triminfo_data = EXYNOS_TMU_REG_TRIMINFO, | 88 | .triminfo_data = EXYNOS_TMU_REG_TRIMINFO, |
96 | .triminfo_25_shift = EXYNOS_TRIMINFO_25_SHIFT, | 89 | .triminfo_ctrl[0] = EXYNOS_TMU_TRIMINFO_CON1, |
97 | .triminfo_85_shift = EXYNOS_TRIMINFO_85_SHIFT, | 90 | .triminfo_ctrl[1] = EXYNOS_TMU_TRIMINFO_CON2, |
91 | .triminfo_ctrl_count = 2, | ||
98 | .tmu_ctrl = EXYNOS_TMU_REG_CONTROL, | 92 | .tmu_ctrl = EXYNOS_TMU_REG_CONTROL, |
99 | .test_mux_addr_shift = EXYNOS4412_MUX_ADDR_SHIFT, | 93 | .test_mux_addr_shift = EXYNOS4412_MUX_ADDR_SHIFT, |
100 | .buf_vref_sel_shift = EXYNOS_TMU_REF_VOLTAGE_SHIFT, | ||
101 | .buf_vref_sel_mask = EXYNOS_TMU_REF_VOLTAGE_MASK, | ||
102 | .therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT, | 94 | .therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT, |
103 | .therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK, | 95 | .therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK, |
104 | .therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT, | 96 | .therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT, |
105 | .buf_slope_sel_shift = EXYNOS_TMU_BUF_SLOPE_SEL_SHIFT, | ||
106 | .buf_slope_sel_mask = EXYNOS_TMU_BUF_SLOPE_SEL_MASK, | ||
107 | .core_en_shift = EXYNOS_TMU_CORE_EN_SHIFT, | ||
108 | .tmu_status = EXYNOS_TMU_REG_STATUS, | 97 | .tmu_status = EXYNOS_TMU_REG_STATUS, |
109 | .tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP, | 98 | .tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP, |
110 | .threshold_th0 = EXYNOS_THD_TEMP_RISE, | 99 | .threshold_th0 = EXYNOS_THD_TEMP_RISE, |
@@ -116,14 +105,9 @@ static const struct exynos_tmu_registers exynos3250_tmu_registers = { | |||
116 | .inten_fall0_shift = EXYNOS_TMU_INTEN_FALL0_SHIFT, | 105 | .inten_fall0_shift = EXYNOS_TMU_INTEN_FALL0_SHIFT, |
117 | .tmu_intstat = EXYNOS_TMU_REG_INTSTAT, | 106 | .tmu_intstat = EXYNOS_TMU_REG_INTSTAT, |
118 | .tmu_intclear = EXYNOS_TMU_REG_INTCLEAR, | 107 | .tmu_intclear = EXYNOS_TMU_REG_INTCLEAR, |
119 | .intclr_fall_shift = EXYNOS_TMU_CLEAR_FALL_INT_SHIFT, | ||
120 | .intclr_rise_shift = EXYNOS_TMU_RISE_INT_SHIFT, | ||
121 | .intclr_rise_mask = EXYNOS_TMU_RISE_INT_MASK, | ||
122 | .intclr_fall_mask = EXYNOS_TMU_FALL_INT_MASK, | ||
123 | .emul_con = EXYNOS_EMUL_CON, | 108 | .emul_con = EXYNOS_EMUL_CON, |
124 | .emul_temp_shift = EXYNOS_EMUL_DATA_SHIFT, | 109 | .emul_temp_shift = EXYNOS_EMUL_DATA_SHIFT, |
125 | .emul_time_shift = EXYNOS_EMUL_TIME_SHIFT, | 110 | .emul_time_shift = EXYNOS_EMUL_TIME_SHIFT, |
126 | .emul_time_mask = EXYNOS_EMUL_TIME_MASK, | ||
127 | }; | 111 | }; |
128 | 112 | ||
129 | #define EXYNOS3250_TMU_DATA \ | 113 | #define EXYNOS3250_TMU_DATA \ |
@@ -141,6 +125,7 @@ static const struct exynos_tmu_registers exynos3250_tmu_registers = { | |||
141 | .trigger_type[2] = SW_TRIP, \ | 125 | .trigger_type[2] = SW_TRIP, \ |
142 | .trigger_type[3] = HW_TRIP, \ | 126 | .trigger_type[3] = HW_TRIP, \ |
143 | .max_trigger_level = 4, \ | 127 | .max_trigger_level = 4, \ |
128 | .non_hw_trigger_levels = 3, \ | ||
144 | .gain = 8, \ | 129 | .gain = 8, \ |
145 | .reference_voltage = 16, \ | 130 | .reference_voltage = 16, \ |
146 | .noise_cancel_mode = 4, \ | 131 | .noise_cancel_mode = 4, \ |
@@ -160,8 +145,10 @@ static const struct exynos_tmu_registers exynos3250_tmu_registers = { | |||
160 | .temp_level = 95, \ | 145 | .temp_level = 95, \ |
161 | }, \ | 146 | }, \ |
162 | .freq_tab_count = 2, \ | 147 | .freq_tab_count = 2, \ |
148 | .triminfo_reload[0] = EXYNOS_TRIMINFO_RELOAD_ENABLE, \ | ||
149 | .triminfo_reload[1] = EXYNOS_TRIMINFO_RELOAD_ENABLE, \ | ||
163 | .registers = &exynos3250_tmu_registers, \ | 150 | .registers = &exynos3250_tmu_registers, \ |
164 | .features = (TMU_SUPPORT_EMULATION | \ | 151 | .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_TRIM_RELOAD | \ |
165 | TMU_SUPPORT_FALLING_TRIP | TMU_SUPPORT_READY_STATUS | \ | 152 | TMU_SUPPORT_FALLING_TRIP | TMU_SUPPORT_READY_STATUS | \ |
166 | TMU_SUPPORT_EMUL_TIME) | 153 | TMU_SUPPORT_EMUL_TIME) |
167 | #endif | 154 | #endif |
@@ -182,20 +169,13 @@ struct exynos_tmu_init_data const exynos3250_default_tmu_data = { | |||
182 | #if defined(CONFIG_SOC_EXYNOS4412) || defined(CONFIG_SOC_EXYNOS5250) | 169 | #if defined(CONFIG_SOC_EXYNOS4412) || defined(CONFIG_SOC_EXYNOS5250) |
183 | static const struct exynos_tmu_registers exynos4412_tmu_registers = { | 170 | static const struct exynos_tmu_registers exynos4412_tmu_registers = { |
184 | .triminfo_data = EXYNOS_TMU_REG_TRIMINFO, | 171 | .triminfo_data = EXYNOS_TMU_REG_TRIMINFO, |
185 | .triminfo_25_shift = EXYNOS_TRIMINFO_25_SHIFT, | 172 | .triminfo_ctrl[0] = EXYNOS_TMU_TRIMINFO_CON2, |
186 | .triminfo_85_shift = EXYNOS_TRIMINFO_85_SHIFT, | 173 | .triminfo_ctrl_count = 1, |
187 | .triminfo_ctrl = EXYNOS_TMU_TRIMINFO_CON, | ||
188 | .triminfo_reload_shift = EXYNOS_TRIMINFO_RELOAD_SHIFT, | ||
189 | .tmu_ctrl = EXYNOS_TMU_REG_CONTROL, | 174 | .tmu_ctrl = EXYNOS_TMU_REG_CONTROL, |
190 | .test_mux_addr_shift = EXYNOS4412_MUX_ADDR_SHIFT, | 175 | .test_mux_addr_shift = EXYNOS4412_MUX_ADDR_SHIFT, |
191 | .buf_vref_sel_shift = EXYNOS_TMU_REF_VOLTAGE_SHIFT, | ||
192 | .buf_vref_sel_mask = EXYNOS_TMU_REF_VOLTAGE_MASK, | ||
193 | .therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT, | 176 | .therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT, |
194 | .therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK, | 177 | .therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK, |
195 | .therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT, | 178 | .therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT, |
196 | .buf_slope_sel_shift = EXYNOS_TMU_BUF_SLOPE_SEL_SHIFT, | ||
197 | .buf_slope_sel_mask = EXYNOS_TMU_BUF_SLOPE_SEL_MASK, | ||
198 | .core_en_shift = EXYNOS_TMU_CORE_EN_SHIFT, | ||
199 | .tmu_status = EXYNOS_TMU_REG_STATUS, | 179 | .tmu_status = EXYNOS_TMU_REG_STATUS, |
200 | .tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP, | 180 | .tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP, |
201 | .threshold_th0 = EXYNOS_THD_TEMP_RISE, | 181 | .threshold_th0 = EXYNOS_THD_TEMP_RISE, |
@@ -208,14 +188,9 @@ static const struct exynos_tmu_registers exynos4412_tmu_registers = { | |||
208 | .inten_fall0_shift = EXYNOS_TMU_INTEN_FALL0_SHIFT, | 188 | .inten_fall0_shift = EXYNOS_TMU_INTEN_FALL0_SHIFT, |
209 | .tmu_intstat = EXYNOS_TMU_REG_INTSTAT, | 189 | .tmu_intstat = EXYNOS_TMU_REG_INTSTAT, |
210 | .tmu_intclear = EXYNOS_TMU_REG_INTCLEAR, | 190 | .tmu_intclear = EXYNOS_TMU_REG_INTCLEAR, |
211 | .intclr_fall_shift = EXYNOS_TMU_CLEAR_FALL_INT_SHIFT, | ||
212 | .intclr_rise_shift = EXYNOS_TMU_RISE_INT_SHIFT, | ||
213 | .intclr_rise_mask = EXYNOS_TMU_RISE_INT_MASK, | ||
214 | .intclr_fall_mask = EXYNOS_TMU_FALL_INT_MASK, | ||
215 | .emul_con = EXYNOS_EMUL_CON, | 191 | .emul_con = EXYNOS_EMUL_CON, |
216 | .emul_temp_shift = EXYNOS_EMUL_DATA_SHIFT, | 192 | .emul_temp_shift = EXYNOS_EMUL_DATA_SHIFT, |
217 | .emul_time_shift = EXYNOS_EMUL_TIME_SHIFT, | 193 | .emul_time_shift = EXYNOS_EMUL_TIME_SHIFT, |
218 | .emul_time_mask = EXYNOS_EMUL_TIME_MASK, | ||
219 | }; | 194 | }; |
220 | 195 | ||
221 | #define EXYNOS4412_TMU_DATA \ | 196 | #define EXYNOS4412_TMU_DATA \ |
@@ -233,6 +208,7 @@ static const struct exynos_tmu_registers exynos4412_tmu_registers = { | |||
233 | .trigger_type[2] = SW_TRIP, \ | 208 | .trigger_type[2] = SW_TRIP, \ |
234 | .trigger_type[3] = HW_TRIP, \ | 209 | .trigger_type[3] = HW_TRIP, \ |
235 | .max_trigger_level = 4, \ | 210 | .max_trigger_level = 4, \ |
211 | .non_hw_trigger_levels = 3, \ | ||
236 | .gain = 8, \ | 212 | .gain = 8, \ |
237 | .reference_voltage = 16, \ | 213 | .reference_voltage = 16, \ |
238 | .noise_cancel_mode = 4, \ | 214 | .noise_cancel_mode = 4, \ |
@@ -252,6 +228,7 @@ static const struct exynos_tmu_registers exynos4412_tmu_registers = { | |||
252 | .temp_level = 95, \ | 228 | .temp_level = 95, \ |
253 | }, \ | 229 | }, \ |
254 | .freq_tab_count = 2, \ | 230 | .freq_tab_count = 2, \ |
231 | .triminfo_reload[0] = EXYNOS_TRIMINFO_RELOAD_ENABLE, \ | ||
255 | .registers = &exynos4412_tmu_registers, \ | 232 | .registers = &exynos4412_tmu_registers, \ |
256 | .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_TRIM_RELOAD | \ | 233 | .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_TRIM_RELOAD | \ |
257 | TMU_SUPPORT_FALLING_TRIP | TMU_SUPPORT_READY_STATUS | \ | 234 | TMU_SUPPORT_FALLING_TRIP | TMU_SUPPORT_READY_STATUS | \ |
@@ -286,18 +263,10 @@ struct exynos_tmu_init_data const exynos5250_default_tmu_data = { | |||
286 | #if defined(CONFIG_SOC_EXYNOS5260) | 263 | #if defined(CONFIG_SOC_EXYNOS5260) |
287 | static const struct exynos_tmu_registers exynos5260_tmu_registers = { | 264 | static const struct exynos_tmu_registers exynos5260_tmu_registers = { |
288 | .triminfo_data = EXYNOS_TMU_REG_TRIMINFO, | 265 | .triminfo_data = EXYNOS_TMU_REG_TRIMINFO, |
289 | .triminfo_25_shift = EXYNOS_TRIMINFO_25_SHIFT, | ||
290 | .triminfo_85_shift = EXYNOS_TRIMINFO_85_SHIFT, | ||
291 | .tmu_ctrl = EXYNOS_TMU_REG_CONTROL, | 266 | .tmu_ctrl = EXYNOS_TMU_REG_CONTROL, |
292 | .tmu_ctrl = EXYNOS_TMU_REG_CONTROL1, | ||
293 | .buf_vref_sel_shift = EXYNOS_TMU_REF_VOLTAGE_SHIFT, | ||
294 | .buf_vref_sel_mask = EXYNOS_TMU_REF_VOLTAGE_MASK, | ||
295 | .therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT, | 267 | .therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT, |
296 | .therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK, | 268 | .therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK, |
297 | .therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT, | 269 | .therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT, |
298 | .buf_slope_sel_shift = EXYNOS_TMU_BUF_SLOPE_SEL_SHIFT, | ||
299 | .buf_slope_sel_mask = EXYNOS_TMU_BUF_SLOPE_SEL_MASK, | ||
300 | .core_en_shift = EXYNOS_TMU_CORE_EN_SHIFT, | ||
301 | .tmu_status = EXYNOS_TMU_REG_STATUS, | 270 | .tmu_status = EXYNOS_TMU_REG_STATUS, |
302 | .tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP, | 271 | .tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP, |
303 | .threshold_th0 = EXYNOS_THD_TEMP_RISE, | 272 | .threshold_th0 = EXYNOS_THD_TEMP_RISE, |
@@ -310,14 +279,9 @@ static const struct exynos_tmu_registers exynos5260_tmu_registers = { | |||
310 | .inten_fall0_shift = EXYNOS_TMU_INTEN_FALL0_SHIFT, | 279 | .inten_fall0_shift = EXYNOS_TMU_INTEN_FALL0_SHIFT, |
311 | .tmu_intstat = EXYNOS5260_TMU_REG_INTSTAT, | 280 | .tmu_intstat = EXYNOS5260_TMU_REG_INTSTAT, |
312 | .tmu_intclear = EXYNOS5260_TMU_REG_INTCLEAR, | 281 | .tmu_intclear = EXYNOS5260_TMU_REG_INTCLEAR, |
313 | .intclr_fall_shift = EXYNOS5420_TMU_CLEAR_FALL_INT_SHIFT, | ||
314 | .intclr_rise_shift = EXYNOS_TMU_RISE_INT_SHIFT, | ||
315 | .intclr_rise_mask = EXYNOS5260_TMU_RISE_INT_MASK, | ||
316 | .intclr_fall_mask = EXYNOS5260_TMU_FALL_INT_MASK, | ||
317 | .emul_con = EXYNOS5260_EMUL_CON, | 282 | .emul_con = EXYNOS5260_EMUL_CON, |
318 | .emul_temp_shift = EXYNOS_EMUL_DATA_SHIFT, | 283 | .emul_temp_shift = EXYNOS_EMUL_DATA_SHIFT, |
319 | .emul_time_shift = EXYNOS_EMUL_TIME_SHIFT, | 284 | .emul_time_shift = EXYNOS_EMUL_TIME_SHIFT, |
320 | .emul_time_mask = EXYNOS_EMUL_TIME_MASK, | ||
321 | }; | 285 | }; |
322 | 286 | ||
323 | #define __EXYNOS5260_TMU_DATA \ | 287 | #define __EXYNOS5260_TMU_DATA \ |
@@ -335,6 +299,7 @@ static const struct exynos_tmu_registers exynos5260_tmu_registers = { | |||
335 | .trigger_type[2] = SW_TRIP, \ | 299 | .trigger_type[2] = SW_TRIP, \ |
336 | .trigger_type[3] = HW_TRIP, \ | 300 | .trigger_type[3] = HW_TRIP, \ |
337 | .max_trigger_level = 4, \ | 301 | .max_trigger_level = 4, \ |
302 | .non_hw_trigger_levels = 3, \ | ||
338 | .gain = 8, \ | 303 | .gain = 8, \ |
339 | .reference_voltage = 16, \ | 304 | .reference_voltage = 16, \ |
340 | .noise_cancel_mode = 4, \ | 305 | .noise_cancel_mode = 4, \ |
@@ -359,9 +324,8 @@ static const struct exynos_tmu_registers exynos5260_tmu_registers = { | |||
359 | #define EXYNOS5260_TMU_DATA \ | 324 | #define EXYNOS5260_TMU_DATA \ |
360 | __EXYNOS5260_TMU_DATA \ | 325 | __EXYNOS5260_TMU_DATA \ |
361 | .type = SOC_ARCH_EXYNOS5260, \ | 326 | .type = SOC_ARCH_EXYNOS5260, \ |
362 | .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_TRIM_RELOAD | \ | 327 | .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_FALLING_TRIP | \ |
363 | TMU_SUPPORT_FALLING_TRIP | TMU_SUPPORT_READY_STATUS | \ | 328 | TMU_SUPPORT_READY_STATUS | TMU_SUPPORT_EMUL_TIME) |
364 | TMU_SUPPORT_EMUL_TIME) | ||
365 | 329 | ||
366 | struct exynos_tmu_init_data const exynos5260_default_tmu_data = { | 330 | struct exynos_tmu_init_data const exynos5260_default_tmu_data = { |
367 | .tmu_data = { | 331 | .tmu_data = { |
@@ -378,17 +342,10 @@ struct exynos_tmu_init_data const exynos5260_default_tmu_data = { | |||
378 | #if defined(CONFIG_SOC_EXYNOS5420) | 342 | #if defined(CONFIG_SOC_EXYNOS5420) |
379 | static const struct exynos_tmu_registers exynos5420_tmu_registers = { | 343 | static const struct exynos_tmu_registers exynos5420_tmu_registers = { |
380 | .triminfo_data = EXYNOS_TMU_REG_TRIMINFO, | 344 | .triminfo_data = EXYNOS_TMU_REG_TRIMINFO, |
381 | .triminfo_25_shift = EXYNOS_TRIMINFO_25_SHIFT, | ||
382 | .triminfo_85_shift = EXYNOS_TRIMINFO_85_SHIFT, | ||
383 | .tmu_ctrl = EXYNOS_TMU_REG_CONTROL, | 345 | .tmu_ctrl = EXYNOS_TMU_REG_CONTROL, |
384 | .buf_vref_sel_shift = EXYNOS_TMU_REF_VOLTAGE_SHIFT, | ||
385 | .buf_vref_sel_mask = EXYNOS_TMU_REF_VOLTAGE_MASK, | ||
386 | .therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT, | 346 | .therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT, |
387 | .therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK, | 347 | .therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK, |
388 | .therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT, | 348 | .therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT, |
389 | .buf_slope_sel_shift = EXYNOS_TMU_BUF_SLOPE_SEL_SHIFT, | ||
390 | .buf_slope_sel_mask = EXYNOS_TMU_BUF_SLOPE_SEL_MASK, | ||
391 | .core_en_shift = EXYNOS_TMU_CORE_EN_SHIFT, | ||
392 | .tmu_status = EXYNOS_TMU_REG_STATUS, | 349 | .tmu_status = EXYNOS_TMU_REG_STATUS, |
393 | .tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP, | 350 | .tmu_cur_temp = EXYNOS_TMU_REG_CURRENT_TEMP, |
394 | .threshold_th0 = EXYNOS_THD_TEMP_RISE, | 351 | .threshold_th0 = EXYNOS_THD_TEMP_RISE, |
@@ -402,14 +359,9 @@ static const struct exynos_tmu_registers exynos5420_tmu_registers = { | |||
402 | .inten_fall0_shift = EXYNOS_TMU_INTEN_FALL0_SHIFT, | 359 | .inten_fall0_shift = EXYNOS_TMU_INTEN_FALL0_SHIFT, |
403 | .tmu_intstat = EXYNOS_TMU_REG_INTSTAT, | 360 | .tmu_intstat = EXYNOS_TMU_REG_INTSTAT, |
404 | .tmu_intclear = EXYNOS_TMU_REG_INTCLEAR, | 361 | .tmu_intclear = EXYNOS_TMU_REG_INTCLEAR, |
405 | .intclr_fall_shift = EXYNOS5420_TMU_CLEAR_FALL_INT_SHIFT, | ||
406 | .intclr_rise_shift = EXYNOS_TMU_RISE_INT_SHIFT, | ||
407 | .intclr_rise_mask = EXYNOS_TMU_RISE_INT_MASK, | ||
408 | .intclr_fall_mask = EXYNOS_TMU_FALL_INT_MASK, | ||
409 | .emul_con = EXYNOS_EMUL_CON, | 362 | .emul_con = EXYNOS_EMUL_CON, |
410 | .emul_temp_shift = EXYNOS_EMUL_DATA_SHIFT, | 363 | .emul_temp_shift = EXYNOS_EMUL_DATA_SHIFT, |
411 | .emul_time_shift = EXYNOS_EMUL_TIME_SHIFT, | 364 | .emul_time_shift = EXYNOS_EMUL_TIME_SHIFT, |
412 | .emul_time_mask = EXYNOS_EMUL_TIME_MASK, | ||
413 | }; | 365 | }; |
414 | 366 | ||
415 | #define __EXYNOS5420_TMU_DATA \ | 367 | #define __EXYNOS5420_TMU_DATA \ |
@@ -427,6 +379,7 @@ static const struct exynos_tmu_registers exynos5420_tmu_registers = { | |||
427 | .trigger_type[2] = SW_TRIP, \ | 379 | .trigger_type[2] = SW_TRIP, \ |
428 | .trigger_type[3] = HW_TRIP, \ | 380 | .trigger_type[3] = HW_TRIP, \ |
429 | .max_trigger_level = 4, \ | 381 | .max_trigger_level = 4, \ |
382 | .non_hw_trigger_levels = 3, \ | ||
430 | .gain = 8, \ | 383 | .gain = 8, \ |
431 | .reference_voltage = 16, \ | 384 | .reference_voltage = 16, \ |
432 | .noise_cancel_mode = 4, \ | 385 | .noise_cancel_mode = 4, \ |
@@ -451,16 +404,15 @@ static const struct exynos_tmu_registers exynos5420_tmu_registers = { | |||
451 | #define EXYNOS5420_TMU_DATA \ | 404 | #define EXYNOS5420_TMU_DATA \ |
452 | __EXYNOS5420_TMU_DATA \ | 405 | __EXYNOS5420_TMU_DATA \ |
453 | .type = SOC_ARCH_EXYNOS5250, \ | 406 | .type = SOC_ARCH_EXYNOS5250, \ |
454 | .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_TRIM_RELOAD | \ | 407 | .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_FALLING_TRIP | \ |
455 | TMU_SUPPORT_FALLING_TRIP | TMU_SUPPORT_READY_STATUS | \ | 408 | TMU_SUPPORT_READY_STATUS | TMU_SUPPORT_EMUL_TIME) |
456 | TMU_SUPPORT_EMUL_TIME) | ||
457 | 409 | ||
458 | #define EXYNOS5420_TMU_DATA_SHARED \ | 410 | #define EXYNOS5420_TMU_DATA_SHARED \ |
459 | __EXYNOS5420_TMU_DATA \ | 411 | __EXYNOS5420_TMU_DATA \ |
460 | .type = SOC_ARCH_EXYNOS5420_TRIMINFO, \ | 412 | .type = SOC_ARCH_EXYNOS5420_TRIMINFO, \ |
461 | .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_TRIM_RELOAD | \ | 413 | .features = (TMU_SUPPORT_EMULATION | TMU_SUPPORT_FALLING_TRIP | \ |
462 | TMU_SUPPORT_FALLING_TRIP | TMU_SUPPORT_READY_STATUS | \ | 414 | TMU_SUPPORT_READY_STATUS | TMU_SUPPORT_EMUL_TIME | \ |
463 | TMU_SUPPORT_EMUL_TIME | TMU_SUPPORT_ADDRESS_MULTIPLE) | 415 | TMU_SUPPORT_ADDRESS_MULTIPLE) |
464 | 416 | ||
465 | struct exynos_tmu_init_data const exynos5420_default_tmu_data = { | 417 | struct exynos_tmu_init_data const exynos5420_default_tmu_data = { |
466 | .tmu_data = { | 418 | .tmu_data = { |
@@ -477,19 +429,10 @@ struct exynos_tmu_init_data const exynos5420_default_tmu_data = { | |||
477 | #if defined(CONFIG_SOC_EXYNOS5440) | 429 | #if defined(CONFIG_SOC_EXYNOS5440) |
478 | static const struct exynos_tmu_registers exynos5440_tmu_registers = { | 430 | static const struct exynos_tmu_registers exynos5440_tmu_registers = { |
479 | .triminfo_data = EXYNOS5440_TMU_S0_7_TRIM, | 431 | .triminfo_data = EXYNOS5440_TMU_S0_7_TRIM, |
480 | .triminfo_25_shift = EXYNOS_TRIMINFO_25_SHIFT, | ||
481 | .triminfo_85_shift = EXYNOS_TRIMINFO_85_SHIFT, | ||
482 | .tmu_ctrl = EXYNOS5440_TMU_S0_7_CTRL, | 432 | .tmu_ctrl = EXYNOS5440_TMU_S0_7_CTRL, |
483 | .buf_vref_sel_shift = EXYNOS_TMU_REF_VOLTAGE_SHIFT, | ||
484 | .buf_vref_sel_mask = EXYNOS_TMU_REF_VOLTAGE_MASK, | ||
485 | .therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT, | 433 | .therm_trip_mode_shift = EXYNOS_TMU_TRIP_MODE_SHIFT, |
486 | .therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK, | 434 | .therm_trip_mode_mask = EXYNOS_TMU_TRIP_MODE_MASK, |
487 | .therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT, | 435 | .therm_trip_en_shift = EXYNOS_TMU_THERM_TRIP_EN_SHIFT, |
488 | .buf_slope_sel_shift = EXYNOS_TMU_BUF_SLOPE_SEL_SHIFT, | ||
489 | .buf_slope_sel_mask = EXYNOS_TMU_BUF_SLOPE_SEL_MASK, | ||
490 | .calib_mode_shift = EXYNOS_TMU_CALIB_MODE_SHIFT, | ||
491 | .calib_mode_mask = EXYNOS_TMU_CALIB_MODE_MASK, | ||
492 | .core_en_shift = EXYNOS_TMU_CORE_EN_SHIFT, | ||
493 | .tmu_status = EXYNOS5440_TMU_S0_7_STATUS, | 436 | .tmu_status = EXYNOS5440_TMU_S0_7_STATUS, |
494 | .tmu_cur_temp = EXYNOS5440_TMU_S0_7_TEMP, | 437 | .tmu_cur_temp = EXYNOS5440_TMU_S0_7_TEMP, |
495 | .threshold_th0 = EXYNOS5440_TMU_S0_7_TH0, | 438 | .threshold_th0 = EXYNOS5440_TMU_S0_7_TH0, |
@@ -504,10 +447,6 @@ static const struct exynos_tmu_registers exynos5440_tmu_registers = { | |||
504 | .inten_fall0_shift = EXYNOS5440_TMU_INTEN_FALL0_SHIFT, | 447 | .inten_fall0_shift = EXYNOS5440_TMU_INTEN_FALL0_SHIFT, |
505 | .tmu_intstat = EXYNOS5440_TMU_S0_7_IRQ, | 448 | .tmu_intstat = EXYNOS5440_TMU_S0_7_IRQ, |
506 | .tmu_intclear = EXYNOS5440_TMU_S0_7_IRQ, | 449 | .tmu_intclear = EXYNOS5440_TMU_S0_7_IRQ, |
507 | .intclr_fall_shift = EXYNOS5440_TMU_CLEAR_FALL_INT_SHIFT, | ||
508 | .intclr_rise_shift = EXYNOS5440_TMU_RISE_INT_SHIFT, | ||
509 | .intclr_rise_mask = EXYNOS5440_TMU_RISE_INT_MASK, | ||
510 | .intclr_fall_mask = EXYNOS5440_TMU_FALL_INT_MASK, | ||
511 | .tmu_irqstatus = EXYNOS5440_TMU_IRQ_STATUS, | 450 | .tmu_irqstatus = EXYNOS5440_TMU_IRQ_STATUS, |
512 | .emul_con = EXYNOS5440_TMU_S0_7_DEBUG, | 451 | .emul_con = EXYNOS5440_TMU_S0_7_DEBUG, |
513 | .emul_temp_shift = EXYNOS_EMUL_DATA_SHIFT, | 452 | .emul_temp_shift = EXYNOS_EMUL_DATA_SHIFT, |
@@ -521,11 +460,11 @@ static const struct exynos_tmu_registers exynos5440_tmu_registers = { | |||
521 | .trigger_type[0] = SW_TRIP, \ | 460 | .trigger_type[0] = SW_TRIP, \ |
522 | .trigger_type[4] = HW_TRIP, \ | 461 | .trigger_type[4] = HW_TRIP, \ |
523 | .max_trigger_level = 5, \ | 462 | .max_trigger_level = 5, \ |
463 | .non_hw_trigger_levels = 1, \ | ||
524 | .gain = 5, \ | 464 | .gain = 5, \ |
525 | .reference_voltage = 16, \ | 465 | .reference_voltage = 16, \ |
526 | .noise_cancel_mode = 4, \ | 466 | .noise_cancel_mode = 4, \ |
527 | .cal_type = TYPE_ONE_POINT_TRIMMING, \ | 467 | .cal_type = TYPE_ONE_POINT_TRIMMING, \ |
528 | .cal_mode = 0, \ | ||
529 | .efuse_value = 0x5b2d, \ | 468 | .efuse_value = 0x5b2d, \ |
530 | .min_efuse_value = 16, \ | 469 | .min_efuse_value = 16, \ |
531 | .max_efuse_value = 76, \ | 470 | .max_efuse_value = 76, \ |
diff --git a/drivers/thermal/samsung/exynos_tmu_data.h b/drivers/thermal/samsung/exynos_tmu_data.h index f0979e598491..63de598c9c2c 100644 --- a/drivers/thermal/samsung/exynos_tmu_data.h +++ b/drivers/thermal/samsung/exynos_tmu_data.h | |||
@@ -39,55 +39,31 @@ | |||
39 | #define EXYNOS_TMU_BUF_SLOPE_SEL_SHIFT 8 | 39 | #define EXYNOS_TMU_BUF_SLOPE_SEL_SHIFT 8 |
40 | #define EXYNOS_TMU_CORE_EN_SHIFT 0 | 40 | #define EXYNOS_TMU_CORE_EN_SHIFT 0 |
41 | 41 | ||
42 | /* Exynos3250 specific registers */ | ||
43 | #define EXYNOS_TMU_TRIMINFO_CON1 0x10 | ||
44 | |||
42 | /* Exynos4210 specific registers */ | 45 | /* Exynos4210 specific registers */ |
43 | #define EXYNOS4210_TMU_REG_THRESHOLD_TEMP 0x44 | 46 | #define EXYNOS4210_TMU_REG_THRESHOLD_TEMP 0x44 |
44 | #define EXYNOS4210_TMU_REG_TRIG_LEVEL0 0x50 | 47 | #define EXYNOS4210_TMU_REG_TRIG_LEVEL0 0x50 |
45 | #define EXYNOS4210_TMU_REG_TRIG_LEVEL1 0x54 | 48 | |
46 | #define EXYNOS4210_TMU_REG_TRIG_LEVEL2 0x58 | 49 | /* Exynos5250, Exynos4412, Exynos3250 specific registers */ |
47 | #define EXYNOS4210_TMU_REG_TRIG_LEVEL3 0x5C | 50 | #define EXYNOS_TMU_TRIMINFO_CON2 0x14 |
48 | #define EXYNOS4210_TMU_REG_PAST_TEMP0 0x60 | ||
49 | #define EXYNOS4210_TMU_REG_PAST_TEMP1 0x64 | ||
50 | #define EXYNOS4210_TMU_REG_PAST_TEMP2 0x68 | ||
51 | #define EXYNOS4210_TMU_REG_PAST_TEMP3 0x6C | ||
52 | |||
53 | #define EXYNOS4210_TMU_TRIG_LEVEL0_MASK 0x1 | ||
54 | #define EXYNOS4210_TMU_TRIG_LEVEL1_MASK 0x10 | ||
55 | #define EXYNOS4210_TMU_TRIG_LEVEL2_MASK 0x100 | ||
56 | #define EXYNOS4210_TMU_TRIG_LEVEL3_MASK 0x1000 | ||
57 | #define EXYNOS4210_TMU_TRIG_LEVEL_MASK 0x1111 | ||
58 | #define EXYNOS4210_TMU_INTCLEAR_VAL 0x1111 | ||
59 | |||
60 | /* Exynos5250 and Exynos4412 specific registers */ | ||
61 | #define EXYNOS_TMU_TRIMINFO_CON 0x14 | ||
62 | #define EXYNOS_THD_TEMP_RISE 0x50 | 51 | #define EXYNOS_THD_TEMP_RISE 0x50 |
63 | #define EXYNOS_THD_TEMP_FALL 0x54 | 52 | #define EXYNOS_THD_TEMP_FALL 0x54 |
64 | #define EXYNOS_EMUL_CON 0x80 | 53 | #define EXYNOS_EMUL_CON 0x80 |
65 | 54 | ||
66 | #define EXYNOS_TRIMINFO_RELOAD_SHIFT 1 | 55 | #define EXYNOS_TRIMINFO_RELOAD_ENABLE 1 |
67 | #define EXYNOS_TRIMINFO_25_SHIFT 0 | 56 | #define EXYNOS_TRIMINFO_25_SHIFT 0 |
68 | #define EXYNOS_TRIMINFO_85_SHIFT 8 | 57 | #define EXYNOS_TRIMINFO_85_SHIFT 8 |
69 | #define EXYNOS_TMU_RISE_INT_MASK 0x111 | ||
70 | #define EXYNOS_TMU_RISE_INT_SHIFT 0 | ||
71 | #define EXYNOS_TMU_FALL_INT_MASK 0x111 | ||
72 | #define EXYNOS_TMU_CLEAR_RISE_INT 0x111 | ||
73 | #define EXYNOS_TMU_CLEAR_FALL_INT (0x111 << 12) | ||
74 | #define EXYNOS_TMU_CLEAR_FALL_INT_SHIFT 12 | ||
75 | #define EXYNOS5420_TMU_CLEAR_FALL_INT_SHIFT 16 | ||
76 | #define EXYNOS5440_TMU_CLEAR_FALL_INT_SHIFT 4 | ||
77 | #define EXYNOS_TMU_TRIP_MODE_SHIFT 13 | 58 | #define EXYNOS_TMU_TRIP_MODE_SHIFT 13 |
78 | #define EXYNOS_TMU_TRIP_MODE_MASK 0x7 | 59 | #define EXYNOS_TMU_TRIP_MODE_MASK 0x7 |
79 | #define EXYNOS_TMU_THERM_TRIP_EN_SHIFT 12 | 60 | #define EXYNOS_TMU_THERM_TRIP_EN_SHIFT 12 |
80 | #define EXYNOS_TMU_CALIB_MODE_SHIFT 4 | ||
81 | #define EXYNOS_TMU_CALIB_MODE_MASK 0x3 | ||
82 | 61 | ||
83 | #define EXYNOS_TMU_INTEN_RISE0_SHIFT 0 | 62 | #define EXYNOS_TMU_INTEN_RISE0_SHIFT 0 |
84 | #define EXYNOS_TMU_INTEN_RISE1_SHIFT 4 | 63 | #define EXYNOS_TMU_INTEN_RISE1_SHIFT 4 |
85 | #define EXYNOS_TMU_INTEN_RISE2_SHIFT 8 | 64 | #define EXYNOS_TMU_INTEN_RISE2_SHIFT 8 |
86 | #define EXYNOS_TMU_INTEN_RISE3_SHIFT 12 | 65 | #define EXYNOS_TMU_INTEN_RISE3_SHIFT 12 |
87 | #define EXYNOS_TMU_INTEN_FALL0_SHIFT 16 | 66 | #define EXYNOS_TMU_INTEN_FALL0_SHIFT 16 |
88 | #define EXYNOS_TMU_INTEN_FALL1_SHIFT 20 | ||
89 | #define EXYNOS_TMU_INTEN_FALL2_SHIFT 24 | ||
90 | #define EXYNOS_TMU_INTEN_FALL3_SHIFT 28 | ||
91 | 67 | ||
92 | #define EXYNOS_EMUL_TIME 0x57F0 | 68 | #define EXYNOS_EMUL_TIME 0x57F0 |
93 | #define EXYNOS_EMUL_TIME_MASK 0xffff | 69 | #define EXYNOS_EMUL_TIME_MASK 0xffff |
@@ -99,14 +75,9 @@ | |||
99 | #define EXYNOS_MAX_TRIGGER_PER_REG 4 | 75 | #define EXYNOS_MAX_TRIGGER_PER_REG 4 |
100 | 76 | ||
101 | /* Exynos5260 specific */ | 77 | /* Exynos5260 specific */ |
102 | #define EXYNOS_TMU_REG_CONTROL1 0x24 | ||
103 | #define EXYNOS5260_TMU_REG_INTEN 0xC0 | 78 | #define EXYNOS5260_TMU_REG_INTEN 0xC0 |
104 | #define EXYNOS5260_TMU_REG_INTSTAT 0xC4 | 79 | #define EXYNOS5260_TMU_REG_INTSTAT 0xC4 |
105 | #define EXYNOS5260_TMU_REG_INTCLEAR 0xC8 | 80 | #define EXYNOS5260_TMU_REG_INTCLEAR 0xC8 |
106 | #define EXYNOS5260_TMU_CLEAR_RISE_INT 0x1111 | ||
107 | #define EXYNOS5260_TMU_CLEAR_FALL_INT (0x1111 << 16) | ||
108 | #define EXYNOS5260_TMU_RISE_INT_MASK 0x1111 | ||
109 | #define EXYNOS5260_TMU_FALL_INT_MASK 0x1111 | ||
110 | #define EXYNOS5260_EMUL_CON 0x100 | 81 | #define EXYNOS5260_EMUL_CON 0x100 |
111 | 82 | ||
112 | /* Exynos4412 specific */ | 83 | /* Exynos4412 specific */ |
@@ -122,29 +93,17 @@ | |||
122 | #define EXYNOS5440_TMU_S0_7_TH0 0x110 | 93 | #define EXYNOS5440_TMU_S0_7_TH0 0x110 |
123 | #define EXYNOS5440_TMU_S0_7_TH1 0x130 | 94 | #define EXYNOS5440_TMU_S0_7_TH1 0x130 |
124 | #define EXYNOS5440_TMU_S0_7_TH2 0x150 | 95 | #define EXYNOS5440_TMU_S0_7_TH2 0x150 |
125 | #define EXYNOS5440_TMU_S0_7_EVTEN 0x1F0 | ||
126 | #define EXYNOS5440_TMU_S0_7_IRQEN 0x210 | 96 | #define EXYNOS5440_TMU_S0_7_IRQEN 0x210 |
127 | #define EXYNOS5440_TMU_S0_7_IRQ 0x230 | 97 | #define EXYNOS5440_TMU_S0_7_IRQ 0x230 |
128 | /* exynos5440 common registers */ | 98 | /* exynos5440 common registers */ |
129 | #define EXYNOS5440_TMU_IRQ_STATUS 0x000 | 99 | #define EXYNOS5440_TMU_IRQ_STATUS 0x000 |
130 | #define EXYNOS5440_TMU_PMIN 0x004 | 100 | #define EXYNOS5440_TMU_PMIN 0x004 |
131 | #define EXYNOS5440_TMU_TEMP 0x008 | ||
132 | 101 | ||
133 | #define EXYNOS5440_TMU_RISE_INT_MASK 0xf | ||
134 | #define EXYNOS5440_TMU_RISE_INT_SHIFT 0 | ||
135 | #define EXYNOS5440_TMU_FALL_INT_MASK 0xf | ||
136 | #define EXYNOS5440_TMU_INTEN_RISE0_SHIFT 0 | 102 | #define EXYNOS5440_TMU_INTEN_RISE0_SHIFT 0 |
137 | #define EXYNOS5440_TMU_INTEN_RISE1_SHIFT 1 | 103 | #define EXYNOS5440_TMU_INTEN_RISE1_SHIFT 1 |
138 | #define EXYNOS5440_TMU_INTEN_RISE2_SHIFT 2 | 104 | #define EXYNOS5440_TMU_INTEN_RISE2_SHIFT 2 |
139 | #define EXYNOS5440_TMU_INTEN_RISE3_SHIFT 3 | 105 | #define EXYNOS5440_TMU_INTEN_RISE3_SHIFT 3 |
140 | #define EXYNOS5440_TMU_INTEN_FALL0_SHIFT 4 | 106 | #define EXYNOS5440_TMU_INTEN_FALL0_SHIFT 4 |
141 | #define EXYNOS5440_TMU_INTEN_FALL1_SHIFT 5 | ||
142 | #define EXYNOS5440_TMU_INTEN_FALL2_SHIFT 6 | ||
143 | #define EXYNOS5440_TMU_INTEN_FALL3_SHIFT 7 | ||
144 | #define EXYNOS5440_TMU_TH_RISE0_SHIFT 0 | ||
145 | #define EXYNOS5440_TMU_TH_RISE1_SHIFT 8 | ||
146 | #define EXYNOS5440_TMU_TH_RISE2_SHIFT 16 | ||
147 | #define EXYNOS5440_TMU_TH_RISE3_SHIFT 24 | ||
148 | #define EXYNOS5440_TMU_TH_RISE4_SHIFT 24 | 107 | #define EXYNOS5440_TMU_TH_RISE4_SHIFT 24 |
149 | #define EXYNOS5440_EFUSE_SWAP_OFFSET 8 | 108 | #define EXYNOS5440_EFUSE_SWAP_OFFSET 8 |
150 | 109 | ||
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 9bf10aa6069b..43b90709585f 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c | |||
@@ -1575,8 +1575,7 @@ struct thermal_zone_device *thermal_zone_device_register(const char *type, | |||
1575 | 1575 | ||
1576 | thermal_zone_device_update(tz); | 1576 | thermal_zone_device_update(tz); |
1577 | 1577 | ||
1578 | if (!result) | 1578 | return tz; |
1579 | return tz; | ||
1580 | 1579 | ||
1581 | unregister: | 1580 | unregister: |
1582 | release_idr(&thermal_tz_idr, &thermal_idr_lock, tz->id); | 1581 | release_idr(&thermal_tz_idr, &thermal_idr_lock, tz->id); |
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index 89c4cee253e3..2e900a98c3e3 100644 --- a/drivers/tty/n_tty.c +++ b/drivers/tty/n_tty.c | |||
@@ -2413,12 +2413,17 @@ static unsigned int n_tty_poll(struct tty_struct *tty, struct file *file, | |||
2413 | 2413 | ||
2414 | poll_wait(file, &tty->read_wait, wait); | 2414 | poll_wait(file, &tty->read_wait, wait); |
2415 | poll_wait(file, &tty->write_wait, wait); | 2415 | poll_wait(file, &tty->write_wait, wait); |
2416 | if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) | ||
2417 | mask |= POLLHUP; | ||
2416 | if (input_available_p(tty, 1)) | 2418 | if (input_available_p(tty, 1)) |
2417 | mask |= POLLIN | POLLRDNORM; | 2419 | mask |= POLLIN | POLLRDNORM; |
2420 | else if (mask & POLLHUP) { | ||
2421 | tty_flush_to_ldisc(tty); | ||
2422 | if (input_available_p(tty, 1)) | ||
2423 | mask |= POLLIN | POLLRDNORM; | ||
2424 | } | ||
2418 | if (tty->packet && tty->link->ctrl_status) | 2425 | if (tty->packet && tty->link->ctrl_status) |
2419 | mask |= POLLPRI | POLLIN | POLLRDNORM; | 2426 | mask |= POLLPRI | POLLIN | POLLRDNORM; |
2420 | if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) | ||
2421 | mask |= POLLHUP; | ||
2422 | if (tty_hung_up_p(file)) | 2427 | if (tty_hung_up_p(file)) |
2423 | mask |= POLLHUP; | 2428 | mask |= POLLHUP; |
2424 | if (!(mask & (POLLHUP | POLLIN | POLLRDNORM))) { | 2429 | if (!(mask & (POLLHUP | POLLIN | POLLRDNORM))) { |
diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c index 8f37d57165ec..de7aae523b37 100644 --- a/drivers/tty/serial/8250/8250_mtk.c +++ b/drivers/tty/serial/8250/8250_mtk.c | |||
@@ -81,7 +81,7 @@ mtk8250_set_termios(struct uart_port *port, struct ktermios *termios, | |||
81 | /* Set to highest baudrate supported */ | 81 | /* Set to highest baudrate supported */ |
82 | if (baud >= 1152000) | 82 | if (baud >= 1152000) |
83 | baud = 921600; | 83 | baud = 921600; |
84 | quot = DIV_ROUND_CLOSEST(port->uartclk, 256 * baud); | 84 | quot = (port->uartclk / (256 * baud)) + 1; |
85 | } | 85 | } |
86 | 86 | ||
87 | /* | 87 | /* |
diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c index 8bc2563335ae..56982da4a9e9 100644 --- a/drivers/tty/serial/of_serial.c +++ b/drivers/tty/serial/of_serial.c | |||
@@ -158,7 +158,7 @@ static int of_platform_serial_probe(struct platform_device *ofdev) | |||
158 | if (of_find_property(ofdev->dev.of_node, "used-by-rtas", NULL)) | 158 | if (of_find_property(ofdev->dev.of_node, "used-by-rtas", NULL)) |
159 | return -EBUSY; | 159 | return -EBUSY; |
160 | 160 | ||
161 | info = kmalloc(sizeof(*info), GFP_KERNEL); | 161 | info = kzalloc(sizeof(*info), GFP_KERNEL); |
162 | if (info == NULL) | 162 | if (info == NULL) |
163 | return -ENOMEM; | 163 | return -ENOMEM; |
164 | 164 | ||
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index df3a8c74358e..eaeb9a02c7fe 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c | |||
@@ -363,7 +363,7 @@ uart_get_baud_rate(struct uart_port *port, struct ktermios *termios, | |||
363 | * The spd_hi, spd_vhi, spd_shi, spd_warp kludge... | 363 | * The spd_hi, spd_vhi, spd_shi, spd_warp kludge... |
364 | * Die! Die! Die! | 364 | * Die! Die! Die! |
365 | */ | 365 | */ |
366 | if (baud == 38400) | 366 | if (try == 0 && baud == 38400) |
367 | baud = altbaud; | 367 | baud = altbaud; |
368 | 368 | ||
369 | /* | 369 | /* |
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index 16a2c0237dd6..0508a1d8e4cd 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c | |||
@@ -1709,6 +1709,8 @@ int tty_release(struct inode *inode, struct file *filp) | |||
1709 | int pty_master, tty_closing, o_tty_closing, do_sleep; | 1709 | int pty_master, tty_closing, o_tty_closing, do_sleep; |
1710 | int idx; | 1710 | int idx; |
1711 | char buf[64]; | 1711 | char buf[64]; |
1712 | long timeout = 0; | ||
1713 | int once = 1; | ||
1712 | 1714 | ||
1713 | if (tty_paranoia_check(tty, inode, __func__)) | 1715 | if (tty_paranoia_check(tty, inode, __func__)) |
1714 | return 0; | 1716 | return 0; |
@@ -1789,11 +1791,18 @@ int tty_release(struct inode *inode, struct file *filp) | |||
1789 | if (!do_sleep) | 1791 | if (!do_sleep) |
1790 | break; | 1792 | break; |
1791 | 1793 | ||
1792 | printk(KERN_WARNING "%s: %s: read/write wait queue active!\n", | 1794 | if (once) { |
1793 | __func__, tty_name(tty, buf)); | 1795 | once = 0; |
1796 | printk(KERN_WARNING "%s: %s: read/write wait queue active!\n", | ||
1797 | __func__, tty_name(tty, buf)); | ||
1798 | } | ||
1794 | tty_unlock_pair(tty, o_tty); | 1799 | tty_unlock_pair(tty, o_tty); |
1795 | mutex_unlock(&tty_mutex); | 1800 | mutex_unlock(&tty_mutex); |
1796 | schedule(); | 1801 | schedule_timeout_killable(timeout); |
1802 | if (timeout < 120 * HZ) | ||
1803 | timeout = 2 * timeout + 1; | ||
1804 | else | ||
1805 | timeout = MAX_SCHEDULE_TIMEOUT; | ||
1797 | } | 1806 | } |
1798 | 1807 | ||
1799 | /* | 1808 | /* |
diff --git a/drivers/tty/vt/consolemap.c b/drivers/tty/vt/consolemap.c index 610b720d3b91..59b25e039968 100644 --- a/drivers/tty/vt/consolemap.c +++ b/drivers/tty/vt/consolemap.c | |||
@@ -539,6 +539,12 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list) | |||
539 | 539 | ||
540 | /* Save original vc_unipagdir_loc in case we allocate a new one */ | 540 | /* Save original vc_unipagdir_loc in case we allocate a new one */ |
541 | p = *vc->vc_uni_pagedir_loc; | 541 | p = *vc->vc_uni_pagedir_loc; |
542 | |||
543 | if (!p) { | ||
544 | err = -EINVAL; | ||
545 | |||
546 | goto out_unlock; | ||
547 | } | ||
542 | 548 | ||
543 | if (p->refcount > 1) { | 549 | if (p->refcount > 1) { |
544 | int j, k; | 550 | int j, k; |
@@ -623,6 +629,7 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list) | |||
623 | set_inverse_transl(vc, p, i); /* Update inverse translations */ | 629 | set_inverse_transl(vc, p, i); /* Update inverse translations */ |
624 | set_inverse_trans_unicode(vc, p); | 630 | set_inverse_trans_unicode(vc, p); |
625 | 631 | ||
632 | out_unlock: | ||
626 | console_unlock(); | 633 | console_unlock(); |
627 | return err; | 634 | return err; |
628 | } | 635 | } |
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 3df5005c554d..9bdc6bd73432 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c | |||
@@ -742,7 +742,6 @@ static int ci_hdrc_remove(struct platform_device *pdev) | |||
742 | ci_role_destroy(ci); | 742 | ci_role_destroy(ci); |
743 | ci_hdrc_enter_lpm(ci, true); | 743 | ci_hdrc_enter_lpm(ci, true); |
744 | usb_phy_shutdown(ci->transceiver); | 744 | usb_phy_shutdown(ci->transceiver); |
745 | kfree(ci->hw_bank.regmap); | ||
746 | 745 | ||
747 | return 0; | 746 | return 0; |
748 | } | 747 | } |
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index e934e19f49f5..077d58ac3dcb 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
@@ -60,6 +60,9 @@ static struct acm *acm_table[ACM_TTY_MINORS]; | |||
60 | 60 | ||
61 | static DEFINE_MUTEX(acm_table_lock); | 61 | static DEFINE_MUTEX(acm_table_lock); |
62 | 62 | ||
63 | static void acm_tty_set_termios(struct tty_struct *tty, | ||
64 | struct ktermios *termios_old); | ||
65 | |||
63 | /* | 66 | /* |
64 | * acm_table accessors | 67 | * acm_table accessors |
65 | */ | 68 | */ |
@@ -145,8 +148,15 @@ static int acm_ctrl_msg(struct acm *acm, int request, int value, | |||
145 | /* devices aren't required to support these requests. | 148 | /* devices aren't required to support these requests. |
146 | * the cdc acm descriptor tells whether they do... | 149 | * the cdc acm descriptor tells whether they do... |
147 | */ | 150 | */ |
148 | #define acm_set_control(acm, control) \ | 151 | static inline int acm_set_control(struct acm *acm, int control) |
149 | acm_ctrl_msg(acm, USB_CDC_REQ_SET_CONTROL_LINE_STATE, control, NULL, 0) | 152 | { |
153 | if (acm->quirks & QUIRK_CONTROL_LINE_STATE) | ||
154 | return -EOPNOTSUPP; | ||
155 | |||
156 | return acm_ctrl_msg(acm, USB_CDC_REQ_SET_CONTROL_LINE_STATE, | ||
157 | control, NULL, 0); | ||
158 | } | ||
159 | |||
150 | #define acm_set_line(acm, line) \ | 160 | #define acm_set_line(acm, line) \ |
151 | acm_ctrl_msg(acm, USB_CDC_REQ_SET_LINE_CODING, 0, line, sizeof *(line)) | 161 | acm_ctrl_msg(acm, USB_CDC_REQ_SET_LINE_CODING, 0, line, sizeof *(line)) |
152 | #define acm_send_break(acm, ms) \ | 162 | #define acm_send_break(acm, ms) \ |
@@ -554,6 +564,8 @@ static int acm_port_activate(struct tty_port *port, struct tty_struct *tty) | |||
554 | goto error_submit_urb; | 564 | goto error_submit_urb; |
555 | } | 565 | } |
556 | 566 | ||
567 | acm_tty_set_termios(tty, NULL); | ||
568 | |||
557 | /* | 569 | /* |
558 | * Unthrottle device in case the TTY was closed while throttled. | 570 | * Unthrottle device in case the TTY was closed while throttled. |
559 | */ | 571 | */ |
@@ -980,11 +992,12 @@ static void acm_tty_set_termios(struct tty_struct *tty, | |||
980 | /* FIXME: Needs to clear unsupported bits in the termios */ | 992 | /* FIXME: Needs to clear unsupported bits in the termios */ |
981 | acm->clocal = ((termios->c_cflag & CLOCAL) != 0); | 993 | acm->clocal = ((termios->c_cflag & CLOCAL) != 0); |
982 | 994 | ||
983 | if (!newline.dwDTERate) { | 995 | if (C_BAUD(tty) == B0) { |
984 | newline.dwDTERate = acm->line.dwDTERate; | 996 | newline.dwDTERate = acm->line.dwDTERate; |
985 | newctrl &= ~ACM_CTRL_DTR; | 997 | newctrl &= ~ACM_CTRL_DTR; |
986 | } else | 998 | } else if (termios_old && (termios_old->c_cflag & CBAUD) == B0) { |
987 | newctrl |= ACM_CTRL_DTR; | 999 | newctrl |= ACM_CTRL_DTR; |
1000 | } | ||
988 | 1001 | ||
989 | if (newctrl != acm->ctrlout) | 1002 | if (newctrl != acm->ctrlout) |
990 | acm_set_control(acm, acm->ctrlout = newctrl); | 1003 | acm_set_control(acm, acm->ctrlout = newctrl); |
@@ -1314,6 +1327,7 @@ made_compressed_probe: | |||
1314 | tty_port_init(&acm->port); | 1327 | tty_port_init(&acm->port); |
1315 | acm->port.ops = &acm_port_ops; | 1328 | acm->port.ops = &acm_port_ops; |
1316 | init_usb_anchor(&acm->delayed); | 1329 | init_usb_anchor(&acm->delayed); |
1330 | acm->quirks = quirks; | ||
1317 | 1331 | ||
1318 | buf = usb_alloc_coherent(usb_dev, ctrlsize, GFP_KERNEL, &acm->ctrl_dma); | 1332 | buf = usb_alloc_coherent(usb_dev, ctrlsize, GFP_KERNEL, &acm->ctrl_dma); |
1319 | if (!buf) { | 1333 | if (!buf) { |
@@ -1681,6 +1695,9 @@ static const struct usb_device_id acm_ids[] = { | |||
1681 | { USB_DEVICE(0x0572, 0x1328), /* Shiro / Aztech USB MODEM UM-3100 */ | 1695 | { USB_DEVICE(0x0572, 0x1328), /* Shiro / Aztech USB MODEM UM-3100 */ |
1682 | .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ | 1696 | .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ |
1683 | }, | 1697 | }, |
1698 | { USB_DEVICE(0x20df, 0x0001), /* Simtec Electronics Entropy Key */ | ||
1699 | .driver_info = QUIRK_CONTROL_LINE_STATE, }, | ||
1700 | { USB_DEVICE(0x2184, 0x001c) }, /* GW Instek AFG-2225 */ | ||
1684 | { USB_DEVICE(0x22b8, 0x6425), /* Motorola MOTOMAGX phones */ | 1701 | { USB_DEVICE(0x22b8, 0x6425), /* Motorola MOTOMAGX phones */ |
1685 | }, | 1702 | }, |
1686 | /* Motorola H24 HSPA module: */ | 1703 | /* Motorola H24 HSPA module: */ |
diff --git a/drivers/usb/class/cdc-acm.h b/drivers/usb/class/cdc-acm.h index fc75651afe1c..d3251ebd09e2 100644 --- a/drivers/usb/class/cdc-acm.h +++ b/drivers/usb/class/cdc-acm.h | |||
@@ -121,6 +121,7 @@ struct acm { | |||
121 | unsigned int throttle_req:1; /* throttle requested */ | 121 | unsigned int throttle_req:1; /* throttle requested */ |
122 | u8 bInterval; | 122 | u8 bInterval; |
123 | struct usb_anchor delayed; /* writes queued for a device about to be woken */ | 123 | struct usb_anchor delayed; /* writes queued for a device about to be woken */ |
124 | unsigned long quirks; | ||
124 | }; | 125 | }; |
125 | 126 | ||
126 | #define CDC_DATA_INTERFACE_TYPE 0x0a | 127 | #define CDC_DATA_INTERFACE_TYPE 0x0a |
@@ -132,3 +133,4 @@ struct acm { | |||
132 | #define NOT_A_MODEM BIT(3) | 133 | #define NOT_A_MODEM BIT(3) |
133 | #define NO_DATA_INTERFACE BIT(4) | 134 | #define NO_DATA_INTERFACE BIT(4) |
134 | #define IGNORE_DEVICE BIT(5) | 135 | #define IGNORE_DEVICE BIT(5) |
136 | #define QUIRK_CONTROL_LINE_STATE BIT(6) | ||
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index b84fb141e122..a6efb4184f2b 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -2060,6 +2060,8 @@ int usb_alloc_streams(struct usb_interface *interface, | |||
2060 | return -EINVAL; | 2060 | return -EINVAL; |
2061 | if (dev->speed != USB_SPEED_SUPER) | 2061 | if (dev->speed != USB_SPEED_SUPER) |
2062 | return -EINVAL; | 2062 | return -EINVAL; |
2063 | if (dev->state < USB_STATE_CONFIGURED) | ||
2064 | return -ENODEV; | ||
2063 | 2065 | ||
2064 | for (i = 0; i < num_eps; i++) { | 2066 | for (i = 0; i < num_eps; i++) { |
2065 | /* Streams only apply to bulk endpoints. */ | 2067 | /* Streams only apply to bulk endpoints. */ |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 11e80ac31324..b649fef2e35d 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -4468,9 +4468,6 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1, | |||
4468 | if (retval) | 4468 | if (retval) |
4469 | goto fail; | 4469 | goto fail; |
4470 | 4470 | ||
4471 | if (hcd->usb_phy && !hdev->parent) | ||
4472 | usb_phy_notify_connect(hcd->usb_phy, udev->speed); | ||
4473 | |||
4474 | /* | 4471 | /* |
4475 | * Some superspeed devices have finished the link training process | 4472 | * Some superspeed devices have finished the link training process |
4476 | * and attached to a superspeed hub port, but the device descriptor | 4473 | * and attached to a superspeed hub port, but the device descriptor |
@@ -4627,8 +4624,7 @@ static void hub_port_connect(struct usb_hub *hub, int port1, u16 portstatus, | |||
4627 | 4624 | ||
4628 | /* Disconnect any existing devices under this port */ | 4625 | /* Disconnect any existing devices under this port */ |
4629 | if (udev) { | 4626 | if (udev) { |
4630 | if (hcd->usb_phy && !hdev->parent && | 4627 | if (hcd->usb_phy && !hdev->parent) |
4631 | !(portstatus & USB_PORT_STAT_CONNECTION)) | ||
4632 | usb_phy_notify_disconnect(hcd->usb_phy, udev->speed); | 4628 | usb_phy_notify_disconnect(hcd->usb_phy, udev->speed); |
4633 | usb_disconnect(&port_dev->child); | 4629 | usb_disconnect(&port_dev->child); |
4634 | } | 4630 | } |
@@ -4783,6 +4779,10 @@ static void hub_port_connect(struct usb_hub *hub, int port1, u16 portstatus, | |||
4783 | port_dev->child = NULL; | 4779 | port_dev->child = NULL; |
4784 | spin_unlock_irq(&device_state_lock); | 4780 | spin_unlock_irq(&device_state_lock); |
4785 | mutex_unlock(&usb_port_peer_mutex); | 4781 | mutex_unlock(&usb_port_peer_mutex); |
4782 | } else { | ||
4783 | if (hcd->usb_phy && !hdev->parent) | ||
4784 | usb_phy_notify_connect(hcd->usb_phy, | ||
4785 | udev->speed); | ||
4786 | } | 4786 | } |
4787 | } | 4787 | } |
4788 | 4788 | ||
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c index 5ae883dc21f5..39b4081b632d 100644 --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c | |||
@@ -97,6 +97,12 @@ static const struct usb_device_id usb_quirk_list[] = { | |||
97 | { USB_DEVICE(0x04f3, 0x0089), .driver_info = | 97 | { USB_DEVICE(0x04f3, 0x0089), .driver_info = |
98 | USB_QUIRK_DEVICE_QUALIFIER }, | 98 | USB_QUIRK_DEVICE_QUALIFIER }, |
99 | 99 | ||
100 | { USB_DEVICE(0x04f3, 0x009b), .driver_info = | ||
101 | USB_QUIRK_DEVICE_QUALIFIER }, | ||
102 | |||
103 | { USB_DEVICE(0x04f3, 0x016f), .driver_info = | ||
104 | USB_QUIRK_DEVICE_QUALIFIER }, | ||
105 | |||
100 | /* Roland SC-8820 */ | 106 | /* Roland SC-8820 */ |
101 | { USB_DEVICE(0x0582, 0x0007), .driver_info = USB_QUIRK_RESET_RESUME }, | 107 | { USB_DEVICE(0x0582, 0x0007), .driver_info = USB_QUIRK_RESET_RESUME }, |
102 | 108 | ||
diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index bf015ab3b44c..55c90c53f2d6 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h | |||
@@ -619,7 +619,7 @@ struct dwc2_hsotg { | |||
619 | unsigned port_suspend_change:1; | 619 | unsigned port_suspend_change:1; |
620 | unsigned port_over_current_change:1; | 620 | unsigned port_over_current_change:1; |
621 | unsigned port_l1_change:1; | 621 | unsigned port_l1_change:1; |
622 | unsigned reserved:26; | 622 | unsigned reserved:25; |
623 | } b; | 623 | } b; |
624 | } flags; | 624 | } flags; |
625 | 625 | ||
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 7b5856fadd93..8b5c079c7b7d 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c | |||
@@ -2327,7 +2327,7 @@ irq_retry: | |||
2327 | 2327 | ||
2328 | u32 usb_status = readl(hsotg->regs + GOTGCTL); | 2328 | u32 usb_status = readl(hsotg->regs + GOTGCTL); |
2329 | 2329 | ||
2330 | dev_info(hsotg->dev, "%s: USBRst\n", __func__); | 2330 | dev_dbg(hsotg->dev, "%s: USBRst\n", __func__); |
2331 | dev_dbg(hsotg->dev, "GNPTXSTS=%08x\n", | 2331 | dev_dbg(hsotg->dev, "GNPTXSTS=%08x\n", |
2332 | readl(hsotg->regs + GNPTXSTS)); | 2332 | readl(hsotg->regs + GNPTXSTS)); |
2333 | 2333 | ||
@@ -2561,8 +2561,10 @@ static int s3c_hsotg_ep_enable(struct usb_ep *ep, | |||
2561 | hs_ep->fifo_size = val; | 2561 | hs_ep->fifo_size = val; |
2562 | break; | 2562 | break; |
2563 | } | 2563 | } |
2564 | if (i == 8) | 2564 | if (i == 8) { |
2565 | return -ENOMEM; | 2565 | ret = -ENOMEM; |
2566 | goto error; | ||
2567 | } | ||
2566 | } | 2568 | } |
2567 | 2569 | ||
2568 | /* for non control endpoints, set PID to D0 */ | 2570 | /* for non control endpoints, set PID to D0 */ |
@@ -2579,6 +2581,7 @@ static int s3c_hsotg_ep_enable(struct usb_ep *ep, | |||
2579 | /* enable the endpoint interrupt */ | 2581 | /* enable the endpoint interrupt */ |
2580 | s3c_hsotg_ctrl_epint(hsotg, index, dir_in, 1); | 2582 | s3c_hsotg_ctrl_epint(hsotg, index, dir_in, 1); |
2581 | 2583 | ||
2584 | error: | ||
2582 | spin_unlock_irqrestore(&hsotg->lock, flags); | 2585 | spin_unlock_irqrestore(&hsotg->lock, flags); |
2583 | return ret; | 2586 | return ret; |
2584 | } | 2587 | } |
@@ -2934,9 +2937,7 @@ static int s3c_hsotg_udc_stop(struct usb_gadget *gadget, | |||
2934 | 2937 | ||
2935 | spin_lock_irqsave(&hsotg->lock, flags); | 2938 | spin_lock_irqsave(&hsotg->lock, flags); |
2936 | 2939 | ||
2937 | if (!driver) | 2940 | hsotg->driver = NULL; |
2938 | hsotg->driver = NULL; | ||
2939 | |||
2940 | hsotg->gadget.speed = USB_SPEED_UNKNOWN; | 2941 | hsotg->gadget.speed = USB_SPEED_UNKNOWN; |
2941 | 2942 | ||
2942 | spin_unlock_irqrestore(&hsotg->lock, flags); | 2943 | spin_unlock_irqrestore(&hsotg->lock, flags); |
@@ -3567,6 +3568,7 @@ static int s3c_hsotg_probe(struct platform_device *pdev) | |||
3567 | s3c_hsotg_initep(hsotg, &hsotg->eps[epnum], epnum); | 3568 | s3c_hsotg_initep(hsotg, &hsotg->eps[epnum], epnum); |
3568 | 3569 | ||
3569 | /* disable power and clock */ | 3570 | /* disable power and clock */ |
3571 | s3c_hsotg_phy_disable(hsotg); | ||
3570 | 3572 | ||
3571 | ret = regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), | 3573 | ret = regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), |
3572 | hsotg->supplies); | 3574 | hsotg->supplies); |
@@ -3575,8 +3577,6 @@ static int s3c_hsotg_probe(struct platform_device *pdev) | |||
3575 | goto err_ep_mem; | 3577 | goto err_ep_mem; |
3576 | } | 3578 | } |
3577 | 3579 | ||
3578 | s3c_hsotg_phy_disable(hsotg); | ||
3579 | |||
3580 | ret = usb_add_gadget_udc(&pdev->dev, &hsotg->gadget); | 3580 | ret = usb_add_gadget_udc(&pdev->dev, &hsotg->gadget); |
3581 | if (ret) | 3581 | if (ret) |
3582 | goto err_ep_mem; | 3582 | goto err_ep_mem; |
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c index 2f537d588225..a0aa9f3da441 100644 --- a/drivers/usb/dwc3/dwc3-omap.c +++ b/drivers/usb/dwc3/dwc3-omap.c | |||
@@ -597,7 +597,7 @@ static int dwc3_omap_prepare(struct device *dev) | |||
597 | { | 597 | { |
598 | struct dwc3_omap *omap = dev_get_drvdata(dev); | 598 | struct dwc3_omap *omap = dev_get_drvdata(dev); |
599 | 599 | ||
600 | dwc3_omap_write_irqmisc_set(omap, 0x00); | 600 | dwc3_omap_disable_irqs(omap); |
601 | 601 | ||
602 | return 0; | 602 | return 0; |
603 | } | 603 | } |
@@ -605,19 +605,8 @@ static int dwc3_omap_prepare(struct device *dev) | |||
605 | static void dwc3_omap_complete(struct device *dev) | 605 | static void dwc3_omap_complete(struct device *dev) |
606 | { | 606 | { |
607 | struct dwc3_omap *omap = dev_get_drvdata(dev); | 607 | struct dwc3_omap *omap = dev_get_drvdata(dev); |
608 | u32 reg; | ||
609 | 608 | ||
610 | reg = (USBOTGSS_IRQMISC_OEVT | | 609 | dwc3_omap_enable_irqs(omap); |
611 | USBOTGSS_IRQMISC_DRVVBUS_RISE | | ||
612 | USBOTGSS_IRQMISC_CHRGVBUS_RISE | | ||
613 | USBOTGSS_IRQMISC_DISCHRGVBUS_RISE | | ||
614 | USBOTGSS_IRQMISC_IDPULLUP_RISE | | ||
615 | USBOTGSS_IRQMISC_DRVVBUS_FALL | | ||
616 | USBOTGSS_IRQMISC_CHRGVBUS_FALL | | ||
617 | USBOTGSS_IRQMISC_DISCHRGVBUS_FALL | | ||
618 | USBOTGSS_IRQMISC_IDPULLUP_FALL); | ||
619 | |||
620 | dwc3_omap_write_irqmisc_set(omap, reg); | ||
621 | } | 610 | } |
622 | 611 | ||
623 | static int dwc3_omap_suspend(struct device *dev) | 612 | static int dwc3_omap_suspend(struct device *dev) |
diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c index 436fb08c40b8..a36cf66302fb 100644 --- a/drivers/usb/dwc3/dwc3-pci.c +++ b/drivers/usb/dwc3/dwc3-pci.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3 0xabcd | 30 | #define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3 0xabcd |
31 | #define PCI_DEVICE_ID_INTEL_BYT 0x0f37 | 31 | #define PCI_DEVICE_ID_INTEL_BYT 0x0f37 |
32 | #define PCI_DEVICE_ID_INTEL_MRFLD 0x119e | 32 | #define PCI_DEVICE_ID_INTEL_MRFLD 0x119e |
33 | #define PCI_DEVICE_ID_INTEL_BSW 0x22B7 | ||
33 | 34 | ||
34 | struct dwc3_pci { | 35 | struct dwc3_pci { |
35 | struct device *dev; | 36 | struct device *dev; |
@@ -181,6 +182,7 @@ static const struct pci_device_id dwc3_pci_id_table[] = { | |||
181 | PCI_DEVICE(PCI_VENDOR_ID_SYNOPSYS, | 182 | PCI_DEVICE(PCI_VENDOR_ID_SYNOPSYS, |
182 | PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3), | 183 | PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3), |
183 | }, | 184 | }, |
185 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BSW), }, | ||
184 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BYT), }, | 186 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BYT), }, |
185 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MRFLD), }, | 187 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MRFLD), }, |
186 | { } /* Terminating Entry */ | 188 | { } /* Terminating Entry */ |
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c index b35938777dde..711b23019d54 100644 --- a/drivers/usb/dwc3/ep0.c +++ b/drivers/usb/dwc3/ep0.c | |||
@@ -256,7 +256,7 @@ static void dwc3_ep0_stall_and_restart(struct dwc3 *dwc) | |||
256 | 256 | ||
257 | /* stall is always issued on EP0 */ | 257 | /* stall is always issued on EP0 */ |
258 | dep = dwc->eps[0]; | 258 | dep = dwc->eps[0]; |
259 | __dwc3_gadget_ep_set_halt(dep, 1); | 259 | __dwc3_gadget_ep_set_halt(dep, 1, false); |
260 | dep->flags = DWC3_EP_ENABLED; | 260 | dep->flags = DWC3_EP_ENABLED; |
261 | dwc->delayed_status = false; | 261 | dwc->delayed_status = false; |
262 | 262 | ||
@@ -271,7 +271,7 @@ static void dwc3_ep0_stall_and_restart(struct dwc3 *dwc) | |||
271 | dwc3_ep0_out_start(dwc); | 271 | dwc3_ep0_out_start(dwc); |
272 | } | 272 | } |
273 | 273 | ||
274 | int dwc3_gadget_ep0_set_halt(struct usb_ep *ep, int value) | 274 | int __dwc3_gadget_ep0_set_halt(struct usb_ep *ep, int value) |
275 | { | 275 | { |
276 | struct dwc3_ep *dep = to_dwc3_ep(ep); | 276 | struct dwc3_ep *dep = to_dwc3_ep(ep); |
277 | struct dwc3 *dwc = dep->dwc; | 277 | struct dwc3 *dwc = dep->dwc; |
@@ -281,6 +281,20 @@ int dwc3_gadget_ep0_set_halt(struct usb_ep *ep, int value) | |||
281 | return 0; | 281 | return 0; |
282 | } | 282 | } |
283 | 283 | ||
284 | int dwc3_gadget_ep0_set_halt(struct usb_ep *ep, int value) | ||
285 | { | ||
286 | struct dwc3_ep *dep = to_dwc3_ep(ep); | ||
287 | struct dwc3 *dwc = dep->dwc; | ||
288 | unsigned long flags; | ||
289 | int ret; | ||
290 | |||
291 | spin_lock_irqsave(&dwc->lock, flags); | ||
292 | ret = __dwc3_gadget_ep0_set_halt(ep, value); | ||
293 | spin_unlock_irqrestore(&dwc->lock, flags); | ||
294 | |||
295 | return ret; | ||
296 | } | ||
297 | |||
284 | void dwc3_ep0_out_start(struct dwc3 *dwc) | 298 | void dwc3_ep0_out_start(struct dwc3 *dwc) |
285 | { | 299 | { |
286 | int ret; | 300 | int ret; |
@@ -466,7 +480,7 @@ static int dwc3_ep0_handle_feature(struct dwc3 *dwc, | |||
466 | return -EINVAL; | 480 | return -EINVAL; |
467 | if (set == 0 && (dep->flags & DWC3_EP_WEDGE)) | 481 | if (set == 0 && (dep->flags & DWC3_EP_WEDGE)) |
468 | break; | 482 | break; |
469 | ret = __dwc3_gadget_ep_set_halt(dep, set); | 483 | ret = __dwc3_gadget_ep_set_halt(dep, set, true); |
470 | if (ret) | 484 | if (ret) |
471 | return -EINVAL; | 485 | return -EINVAL; |
472 | break; | 486 | break; |
@@ -775,9 +789,6 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc, | |||
775 | 789 | ||
776 | dwc->ep0_next_event = DWC3_EP0_NRDY_STATUS; | 790 | dwc->ep0_next_event = DWC3_EP0_NRDY_STATUS; |
777 | 791 | ||
778 | r = next_request(&ep0->request_list); | ||
779 | ur = &r->request; | ||
780 | |||
781 | trb = dwc->ep0_trb; | 792 | trb = dwc->ep0_trb; |
782 | 793 | ||
783 | status = DWC3_TRB_SIZE_TRBSTS(trb->size); | 794 | status = DWC3_TRB_SIZE_TRBSTS(trb->size); |
@@ -790,6 +801,12 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc, | |||
790 | return; | 801 | return; |
791 | } | 802 | } |
792 | 803 | ||
804 | r = next_request(&ep0->request_list); | ||
805 | if (!r) | ||
806 | return; | ||
807 | |||
808 | ur = &r->request; | ||
809 | |||
793 | length = trb->size & DWC3_TRB_SIZE_MASK; | 810 | length = trb->size & DWC3_TRB_SIZE_MASK; |
794 | 811 | ||
795 | if (dwc->ep0_bounced) { | 812 | if (dwc->ep0_bounced) { |
@@ -811,12 +828,19 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc, | |||
811 | 828 | ||
812 | dwc3_ep0_stall_and_restart(dwc); | 829 | dwc3_ep0_stall_and_restart(dwc); |
813 | } else { | 830 | } else { |
814 | /* | 831 | dwc3_gadget_giveback(ep0, r, 0); |
815 | * handle the case where we have to send a zero packet. This | 832 | |
816 | * seems to be case when req.length > maxpacket. Could it be? | 833 | if (IS_ALIGNED(ur->length, ep0->endpoint.maxpacket) && |
817 | */ | 834 | ur->length && ur->zero) { |
818 | if (r) | 835 | int ret; |
819 | dwc3_gadget_giveback(ep0, r, 0); | 836 | |
837 | dwc->ep0_next_event = DWC3_EP0_COMPLETE; | ||
838 | |||
839 | ret = dwc3_ep0_start_trans(dwc, epnum, | ||
840 | dwc->ctrl_req_addr, 0, | ||
841 | DWC3_TRBCTL_CONTROL_DATA); | ||
842 | WARN_ON(ret < 0); | ||
843 | } | ||
820 | } | 844 | } |
821 | } | 845 | } |
822 | 846 | ||
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 3818b26bfc05..546ea5431b8c 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c | |||
@@ -525,12 +525,11 @@ static int __dwc3_gadget_ep_enable(struct dwc3_ep *dep, | |||
525 | if (!usb_endpoint_xfer_isoc(desc)) | 525 | if (!usb_endpoint_xfer_isoc(desc)) |
526 | return 0; | 526 | return 0; |
527 | 527 | ||
528 | memset(&trb_link, 0, sizeof(trb_link)); | ||
529 | |||
530 | /* Link TRB for ISOC. The HWO bit is never reset */ | 528 | /* Link TRB for ISOC. The HWO bit is never reset */ |
531 | trb_st_hw = &dep->trb_pool[0]; | 529 | trb_st_hw = &dep->trb_pool[0]; |
532 | 530 | ||
533 | trb_link = &dep->trb_pool[DWC3_TRB_NUM - 1]; | 531 | trb_link = &dep->trb_pool[DWC3_TRB_NUM - 1]; |
532 | memset(trb_link, 0, sizeof(*trb_link)); | ||
534 | 533 | ||
535 | trb_link->bpl = lower_32_bits(dwc3_trb_dma_offset(dep, trb_st_hw)); | 534 | trb_link->bpl = lower_32_bits(dwc3_trb_dma_offset(dep, trb_st_hw)); |
536 | trb_link->bph = upper_32_bits(dwc3_trb_dma_offset(dep, trb_st_hw)); | 535 | trb_link->bph = upper_32_bits(dwc3_trb_dma_offset(dep, trb_st_hw)); |
@@ -581,7 +580,7 @@ static int __dwc3_gadget_ep_disable(struct dwc3_ep *dep) | |||
581 | 580 | ||
582 | /* make sure HW endpoint isn't stalled */ | 581 | /* make sure HW endpoint isn't stalled */ |
583 | if (dep->flags & DWC3_EP_STALL) | 582 | if (dep->flags & DWC3_EP_STALL) |
584 | __dwc3_gadget_ep_set_halt(dep, 0); | 583 | __dwc3_gadget_ep_set_halt(dep, 0, false); |
585 | 584 | ||
586 | reg = dwc3_readl(dwc->regs, DWC3_DALEPENA); | 585 | reg = dwc3_readl(dwc->regs, DWC3_DALEPENA); |
587 | reg &= ~DWC3_DALEPENA_EP(dep->number); | 586 | reg &= ~DWC3_DALEPENA_EP(dep->number); |
@@ -1202,15 +1201,28 @@ out0: | |||
1202 | return ret; | 1201 | return ret; |
1203 | } | 1202 | } |
1204 | 1203 | ||
1205 | int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value) | 1204 | int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value, int protocol) |
1206 | { | 1205 | { |
1207 | struct dwc3_gadget_ep_cmd_params params; | 1206 | struct dwc3_gadget_ep_cmd_params params; |
1208 | struct dwc3 *dwc = dep->dwc; | 1207 | struct dwc3 *dwc = dep->dwc; |
1209 | int ret; | 1208 | int ret; |
1210 | 1209 | ||
1210 | if (usb_endpoint_xfer_isoc(dep->endpoint.desc)) { | ||
1211 | dev_err(dwc->dev, "%s is of Isochronous type\n", dep->name); | ||
1212 | return -EINVAL; | ||
1213 | } | ||
1214 | |||
1211 | memset(¶ms, 0x00, sizeof(params)); | 1215 | memset(¶ms, 0x00, sizeof(params)); |
1212 | 1216 | ||
1213 | if (value) { | 1217 | if (value) { |
1218 | if (!protocol && ((dep->direction && dep->flags & DWC3_EP_BUSY) || | ||
1219 | (!list_empty(&dep->req_queued) || | ||
1220 | !list_empty(&dep->request_list)))) { | ||
1221 | dev_dbg(dwc->dev, "%s: pending request, cannot halt\n", | ||
1222 | dep->name); | ||
1223 | return -EAGAIN; | ||
1224 | } | ||
1225 | |||
1214 | ret = dwc3_send_gadget_ep_cmd(dwc, dep->number, | 1226 | ret = dwc3_send_gadget_ep_cmd(dwc, dep->number, |
1215 | DWC3_DEPCMD_SETSTALL, ¶ms); | 1227 | DWC3_DEPCMD_SETSTALL, ¶ms); |
1216 | if (ret) | 1228 | if (ret) |
@@ -1241,15 +1253,7 @@ static int dwc3_gadget_ep_set_halt(struct usb_ep *ep, int value) | |||
1241 | int ret; | 1253 | int ret; |
1242 | 1254 | ||
1243 | spin_lock_irqsave(&dwc->lock, flags); | 1255 | spin_lock_irqsave(&dwc->lock, flags); |
1244 | 1256 | ret = __dwc3_gadget_ep_set_halt(dep, value, false); | |
1245 | if (usb_endpoint_xfer_isoc(dep->endpoint.desc)) { | ||
1246 | dev_err(dwc->dev, "%s is of Isochronous type\n", dep->name); | ||
1247 | ret = -EINVAL; | ||
1248 | goto out; | ||
1249 | } | ||
1250 | |||
1251 | ret = __dwc3_gadget_ep_set_halt(dep, value); | ||
1252 | out: | ||
1253 | spin_unlock_irqrestore(&dwc->lock, flags); | 1257 | spin_unlock_irqrestore(&dwc->lock, flags); |
1254 | 1258 | ||
1255 | return ret; | 1259 | return ret; |
@@ -1260,15 +1264,18 @@ static int dwc3_gadget_ep_set_wedge(struct usb_ep *ep) | |||
1260 | struct dwc3_ep *dep = to_dwc3_ep(ep); | 1264 | struct dwc3_ep *dep = to_dwc3_ep(ep); |
1261 | struct dwc3 *dwc = dep->dwc; | 1265 | struct dwc3 *dwc = dep->dwc; |
1262 | unsigned long flags; | 1266 | unsigned long flags; |
1267 | int ret; | ||
1263 | 1268 | ||
1264 | spin_lock_irqsave(&dwc->lock, flags); | 1269 | spin_lock_irqsave(&dwc->lock, flags); |
1265 | dep->flags |= DWC3_EP_WEDGE; | 1270 | dep->flags |= DWC3_EP_WEDGE; |
1266 | spin_unlock_irqrestore(&dwc->lock, flags); | ||
1267 | 1271 | ||
1268 | if (dep->number == 0 || dep->number == 1) | 1272 | if (dep->number == 0 || dep->number == 1) |
1269 | return dwc3_gadget_ep0_set_halt(ep, 1); | 1273 | ret = __dwc3_gadget_ep0_set_halt(ep, 1); |
1270 | else | 1274 | else |
1271 | return dwc3_gadget_ep_set_halt(ep, 1); | 1275 | ret = __dwc3_gadget_ep_set_halt(dep, 1, false); |
1276 | spin_unlock_irqrestore(&dwc->lock, flags); | ||
1277 | |||
1278 | return ret; | ||
1272 | } | 1279 | } |
1273 | 1280 | ||
1274 | /* -------------------------------------------------------------------------- */ | 1281 | /* -------------------------------------------------------------------------- */ |
diff --git a/drivers/usb/dwc3/gadget.h b/drivers/usb/dwc3/gadget.h index 178ad8982206..18ae3eaa8b6f 100644 --- a/drivers/usb/dwc3/gadget.h +++ b/drivers/usb/dwc3/gadget.h | |||
@@ -82,10 +82,11 @@ void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req, | |||
82 | void dwc3_ep0_interrupt(struct dwc3 *dwc, | 82 | void dwc3_ep0_interrupt(struct dwc3 *dwc, |
83 | const struct dwc3_event_depevt *event); | 83 | const struct dwc3_event_depevt *event); |
84 | void dwc3_ep0_out_start(struct dwc3 *dwc); | 84 | void dwc3_ep0_out_start(struct dwc3 *dwc); |
85 | int __dwc3_gadget_ep0_set_halt(struct usb_ep *ep, int value); | ||
85 | int dwc3_gadget_ep0_set_halt(struct usb_ep *ep, int value); | 86 | int dwc3_gadget_ep0_set_halt(struct usb_ep *ep, int value); |
86 | int dwc3_gadget_ep0_queue(struct usb_ep *ep, struct usb_request *request, | 87 | int dwc3_gadget_ep0_queue(struct usb_ep *ep, struct usb_request *request, |
87 | gfp_t gfp_flags); | 88 | gfp_t gfp_flags); |
88 | int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value); | 89 | int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value, int protocol); |
89 | 90 | ||
90 | /** | 91 | /** |
91 | * dwc3_gadget_ep_get_transfer_index - Gets transfer index from HW | 92 | * dwc3_gadget_ep_get_transfer_index - Gets transfer index from HW |
diff --git a/drivers/usb/dwc3/trace.h b/drivers/usb/dwc3/trace.h index 78aff1da089a..60b0f41eafc4 100644 --- a/drivers/usb/dwc3/trace.h +++ b/drivers/usb/dwc3/trace.h | |||
@@ -73,15 +73,23 @@ DECLARE_EVENT_CLASS(dwc3_log_ctrl, | |||
73 | TP_PROTO(struct usb_ctrlrequest *ctrl), | 73 | TP_PROTO(struct usb_ctrlrequest *ctrl), |
74 | TP_ARGS(ctrl), | 74 | TP_ARGS(ctrl), |
75 | TP_STRUCT__entry( | 75 | TP_STRUCT__entry( |
76 | __field(struct usb_ctrlrequest *, ctrl) | 76 | __field(__u8, bRequestType) |
77 | __field(__u8, bRequest) | ||
78 | __field(__le16, wValue) | ||
79 | __field(__le16, wIndex) | ||
80 | __field(__le16, wLength) | ||
77 | ), | 81 | ), |
78 | TP_fast_assign( | 82 | TP_fast_assign( |
79 | __entry->ctrl = ctrl; | 83 | __entry->bRequestType = ctrl->bRequestType; |
84 | __entry->bRequest = ctrl->bRequest; | ||
85 | __entry->wValue = ctrl->wValue; | ||
86 | __entry->wIndex = ctrl->wIndex; | ||
87 | __entry->wLength = ctrl->wLength; | ||
80 | ), | 88 | ), |
81 | TP_printk("bRequestType %02x bRequest %02x wValue %04x wIndex %04x wLength %d", | 89 | TP_printk("bRequestType %02x bRequest %02x wValue %04x wIndex %04x wLength %d", |
82 | __entry->ctrl->bRequestType, __entry->ctrl->bRequest, | 90 | __entry->bRequestType, __entry->bRequest, |
83 | le16_to_cpu(__entry->ctrl->wValue), le16_to_cpu(__entry->ctrl->wIndex), | 91 | le16_to_cpu(__entry->wValue), le16_to_cpu(__entry->wIndex), |
84 | le16_to_cpu(__entry->ctrl->wLength) | 92 | le16_to_cpu(__entry->wLength) |
85 | ) | 93 | ) |
86 | ); | 94 | ); |
87 | 95 | ||
@@ -94,15 +102,22 @@ DECLARE_EVENT_CLASS(dwc3_log_request, | |||
94 | TP_PROTO(struct dwc3_request *req), | 102 | TP_PROTO(struct dwc3_request *req), |
95 | TP_ARGS(req), | 103 | TP_ARGS(req), |
96 | TP_STRUCT__entry( | 104 | TP_STRUCT__entry( |
105 | __dynamic_array(char, name, DWC3_MSG_MAX) | ||
97 | __field(struct dwc3_request *, req) | 106 | __field(struct dwc3_request *, req) |
107 | __field(unsigned, actual) | ||
108 | __field(unsigned, length) | ||
109 | __field(int, status) | ||
98 | ), | 110 | ), |
99 | TP_fast_assign( | 111 | TP_fast_assign( |
112 | snprintf(__get_str(name), DWC3_MSG_MAX, "%s", req->dep->name); | ||
100 | __entry->req = req; | 113 | __entry->req = req; |
114 | __entry->actual = req->request.actual; | ||
115 | __entry->length = req->request.length; | ||
116 | __entry->status = req->request.status; | ||
101 | ), | 117 | ), |
102 | TP_printk("%s: req %p length %u/%u ==> %d", | 118 | TP_printk("%s: req %p length %u/%u ==> %d", |
103 | __entry->req->dep->name, __entry->req, | 119 | __get_str(name), __entry->req, __entry->actual, __entry->length, |
104 | __entry->req->request.actual, __entry->req->request.length, | 120 | __entry->status |
105 | __entry->req->request.status | ||
106 | ) | 121 | ) |
107 | ); | 122 | ); |
108 | 123 | ||
@@ -158,17 +173,17 @@ DECLARE_EVENT_CLASS(dwc3_log_gadget_ep_cmd, | |||
158 | struct dwc3_gadget_ep_cmd_params *params), | 173 | struct dwc3_gadget_ep_cmd_params *params), |
159 | TP_ARGS(dep, cmd, params), | 174 | TP_ARGS(dep, cmd, params), |
160 | TP_STRUCT__entry( | 175 | TP_STRUCT__entry( |
161 | __field(struct dwc3_ep *, dep) | 176 | __dynamic_array(char, name, DWC3_MSG_MAX) |
162 | __field(unsigned int, cmd) | 177 | __field(unsigned int, cmd) |
163 | __field(struct dwc3_gadget_ep_cmd_params *, params) | 178 | __field(struct dwc3_gadget_ep_cmd_params *, params) |
164 | ), | 179 | ), |
165 | TP_fast_assign( | 180 | TP_fast_assign( |
166 | __entry->dep = dep; | 181 | snprintf(__get_str(name), DWC3_MSG_MAX, "%s", dep->name); |
167 | __entry->cmd = cmd; | 182 | __entry->cmd = cmd; |
168 | __entry->params = params; | 183 | __entry->params = params; |
169 | ), | 184 | ), |
170 | TP_printk("%s: cmd '%s' [%d] params %08x %08x %08x\n", | 185 | TP_printk("%s: cmd '%s' [%d] params %08x %08x %08x\n", |
171 | __entry->dep->name, dwc3_gadget_ep_cmd_string(__entry->cmd), | 186 | __get_str(name), dwc3_gadget_ep_cmd_string(__entry->cmd), |
172 | __entry->cmd, __entry->params->param0, | 187 | __entry->cmd, __entry->params->param0, |
173 | __entry->params->param1, __entry->params->param2 | 188 | __entry->params->param1, __entry->params->param2 |
174 | ) | 189 | ) |
@@ -184,16 +199,24 @@ DECLARE_EVENT_CLASS(dwc3_log_trb, | |||
184 | TP_PROTO(struct dwc3_ep *dep, struct dwc3_trb *trb), | 199 | TP_PROTO(struct dwc3_ep *dep, struct dwc3_trb *trb), |
185 | TP_ARGS(dep, trb), | 200 | TP_ARGS(dep, trb), |
186 | TP_STRUCT__entry( | 201 | TP_STRUCT__entry( |
187 | __field(struct dwc3_ep *, dep) | 202 | __dynamic_array(char, name, DWC3_MSG_MAX) |
188 | __field(struct dwc3_trb *, trb) | 203 | __field(struct dwc3_trb *, trb) |
204 | __field(u32, bpl) | ||
205 | __field(u32, bph) | ||
206 | __field(u32, size) | ||
207 | __field(u32, ctrl) | ||
189 | ), | 208 | ), |
190 | TP_fast_assign( | 209 | TP_fast_assign( |
191 | __entry->dep = dep; | 210 | snprintf(__get_str(name), DWC3_MSG_MAX, "%s", dep->name); |
192 | __entry->trb = trb; | 211 | __entry->trb = trb; |
212 | __entry->bpl = trb->bpl; | ||
213 | __entry->bph = trb->bph; | ||
214 | __entry->size = trb->size; | ||
215 | __entry->ctrl = trb->ctrl; | ||
193 | ), | 216 | ), |
194 | TP_printk("%s: trb %p bph %08x bpl %08x size %08x ctrl %08x\n", | 217 | TP_printk("%s: trb %p bph %08x bpl %08x size %08x ctrl %08x\n", |
195 | __entry->dep->name, __entry->trb, __entry->trb->bph, | 218 | __get_str(name), __entry->trb, __entry->bph, __entry->bpl, |
196 | __entry->trb->bpl, __entry->trb->size, __entry->trb->ctrl | 219 | __entry->size, __entry->ctrl |
197 | ) | 220 | ) |
198 | ); | 221 | ); |
199 | 222 | ||
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index a8c18df171c3..f6a51fddd5b5 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c | |||
@@ -560,7 +560,7 @@ static int bos_desc(struct usb_composite_dev *cdev) | |||
560 | usb_ext->bLength = USB_DT_USB_EXT_CAP_SIZE; | 560 | usb_ext->bLength = USB_DT_USB_EXT_CAP_SIZE; |
561 | usb_ext->bDescriptorType = USB_DT_DEVICE_CAPABILITY; | 561 | usb_ext->bDescriptorType = USB_DT_DEVICE_CAPABILITY; |
562 | usb_ext->bDevCapabilityType = USB_CAP_TYPE_EXT; | 562 | usb_ext->bDevCapabilityType = USB_CAP_TYPE_EXT; |
563 | usb_ext->bmAttributes = cpu_to_le32(USB_LPM_SUPPORT); | 563 | usb_ext->bmAttributes = cpu_to_le32(USB_LPM_SUPPORT | USB_BESL_SUPPORT); |
564 | 564 | ||
565 | /* | 565 | /* |
566 | * The Superspeed USB Capability descriptor shall be implemented by all | 566 | * The Superspeed USB Capability descriptor shall be implemented by all |
diff --git a/drivers/usb/gadget/function/f_acm.c b/drivers/usb/gadget/function/f_acm.c index 6da4685490ef..aad8165e98ef 100644 --- a/drivers/usb/gadget/function/f_acm.c +++ b/drivers/usb/gadget/function/f_acm.c | |||
@@ -433,12 +433,12 @@ static int acm_set_alt(struct usb_function *f, unsigned intf, unsigned alt) | |||
433 | dev_vdbg(&cdev->gadget->dev, | 433 | dev_vdbg(&cdev->gadget->dev, |
434 | "reset acm control interface %d\n", intf); | 434 | "reset acm control interface %d\n", intf); |
435 | usb_ep_disable(acm->notify); | 435 | usb_ep_disable(acm->notify); |
436 | } else { | 436 | } |
437 | dev_vdbg(&cdev->gadget->dev, | 437 | |
438 | "init acm ctrl interface %d\n", intf); | 438 | if (!acm->notify->desc) |
439 | if (config_ep_by_speed(cdev->gadget, f, acm->notify)) | 439 | if (config_ep_by_speed(cdev->gadget, f, acm->notify)) |
440 | return -EINVAL; | 440 | return -EINVAL; |
441 | } | 441 | |
442 | usb_ep_enable(acm->notify); | 442 | usb_ep_enable(acm->notify); |
443 | acm->notify->driver_data = acm; | 443 | acm->notify->driver_data = acm; |
444 | 444 | ||
diff --git a/drivers/usb/gadget/function/f_eem.c b/drivers/usb/gadget/function/f_eem.c index 4d8b236ea608..c9e90de5bdd9 100644 --- a/drivers/usb/gadget/function/f_eem.c +++ b/drivers/usb/gadget/function/f_eem.c | |||
@@ -325,7 +325,6 @@ static int eem_bind(struct usb_configuration *c, struct usb_function *f) | |||
325 | return 0; | 325 | return 0; |
326 | 326 | ||
327 | fail: | 327 | fail: |
328 | usb_free_all_descriptors(f); | ||
329 | if (eem->port.out_ep) | 328 | if (eem->port.out_ep) |
330 | eem->port.out_ep->driver_data = NULL; | 329 | eem->port.out_ep->driver_data = NULL; |
331 | if (eem->port.in_ep) | 330 | if (eem->port.in_ep) |
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c index 7c6771d027a2..63314ede7ba6 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c | |||
@@ -647,15 +647,26 @@ static void ffs_user_copy_worker(struct work_struct *work) | |||
647 | if (io_data->read && ret > 0) { | 647 | if (io_data->read && ret > 0) { |
648 | int i; | 648 | int i; |
649 | size_t pos = 0; | 649 | size_t pos = 0; |
650 | |||
651 | /* | ||
652 | * Since req->length may be bigger than io_data->len (after | ||
653 | * being rounded up to maxpacketsize), we may end up with more | ||
654 | * data then user space has space for. | ||
655 | */ | ||
656 | ret = min_t(int, ret, io_data->len); | ||
657 | |||
650 | use_mm(io_data->mm); | 658 | use_mm(io_data->mm); |
651 | for (i = 0; i < io_data->nr_segs; i++) { | 659 | for (i = 0; i < io_data->nr_segs; i++) { |
660 | size_t len = min_t(size_t, ret - pos, | ||
661 | io_data->iovec[i].iov_len); | ||
662 | if (!len) | ||
663 | break; | ||
652 | if (unlikely(copy_to_user(io_data->iovec[i].iov_base, | 664 | if (unlikely(copy_to_user(io_data->iovec[i].iov_base, |
653 | &io_data->buf[pos], | 665 | &io_data->buf[pos], len))) { |
654 | io_data->iovec[i].iov_len))) { | ||
655 | ret = -EFAULT; | 666 | ret = -EFAULT; |
656 | break; | 667 | break; |
657 | } | 668 | } |
658 | pos += io_data->iovec[i].iov_len; | 669 | pos += len; |
659 | } | 670 | } |
660 | unuse_mm(io_data->mm); | 671 | unuse_mm(io_data->mm); |
661 | } | 672 | } |
@@ -687,7 +698,7 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data) | |||
687 | struct ffs_epfile *epfile = file->private_data; | 698 | struct ffs_epfile *epfile = file->private_data; |
688 | struct ffs_ep *ep; | 699 | struct ffs_ep *ep; |
689 | char *data = NULL; | 700 | char *data = NULL; |
690 | ssize_t ret, data_len; | 701 | ssize_t ret, data_len = -EINVAL; |
691 | int halt; | 702 | int halt; |
692 | 703 | ||
693 | /* Are we still active? */ | 704 | /* Are we still active? */ |
@@ -787,13 +798,30 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data) | |||
787 | /* Fire the request */ | 798 | /* Fire the request */ |
788 | struct usb_request *req; | 799 | struct usb_request *req; |
789 | 800 | ||
801 | /* | ||
802 | * Sanity Check: even though data_len can't be used | ||
803 | * uninitialized at the time I write this comment, some | ||
804 | * compilers complain about this situation. | ||
805 | * In order to keep the code clean from warnings, data_len is | ||
806 | * being initialized to -EINVAL during its declaration, which | ||
807 | * means we can't rely on compiler anymore to warn no future | ||
808 | * changes won't result in data_len being used uninitialized. | ||
809 | * For such reason, we're adding this redundant sanity check | ||
810 | * here. | ||
811 | */ | ||
812 | if (unlikely(data_len == -EINVAL)) { | ||
813 | WARN(1, "%s: data_len == -EINVAL\n", __func__); | ||
814 | ret = -EINVAL; | ||
815 | goto error_lock; | ||
816 | } | ||
817 | |||
790 | if (io_data->aio) { | 818 | if (io_data->aio) { |
791 | req = usb_ep_alloc_request(ep->ep, GFP_KERNEL); | 819 | req = usb_ep_alloc_request(ep->ep, GFP_KERNEL); |
792 | if (unlikely(!req)) | 820 | if (unlikely(!req)) |
793 | goto error_lock; | 821 | goto error_lock; |
794 | 822 | ||
795 | req->buf = data; | 823 | req->buf = data; |
796 | req->length = io_data->len; | 824 | req->length = data_len; |
797 | 825 | ||
798 | io_data->buf = data; | 826 | io_data->buf = data; |
799 | io_data->ep = ep->ep; | 827 | io_data->ep = ep->ep; |
@@ -815,7 +843,7 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data) | |||
815 | 843 | ||
816 | req = ep->req; | 844 | req = ep->req; |
817 | req->buf = data; | 845 | req->buf = data; |
818 | req->length = io_data->len; | 846 | req->length = data_len; |
819 | 847 | ||
820 | req->context = &done; | 848 | req->context = &done; |
821 | req->complete = ffs_epfile_io_complete; | 849 | req->complete = ffs_epfile_io_complete; |
@@ -2663,8 +2691,6 @@ static inline struct f_fs_opts *ffs_do_functionfs_bind(struct usb_function *f, | |||
2663 | func->conf = c; | 2691 | func->conf = c; |
2664 | func->gadget = c->cdev->gadget; | 2692 | func->gadget = c->cdev->gadget; |
2665 | 2693 | ||
2666 | ffs_data_get(func->ffs); | ||
2667 | |||
2668 | /* | 2694 | /* |
2669 | * in drivers/usb/gadget/configfs.c:configfs_composite_bind() | 2695 | * in drivers/usb/gadget/configfs.c:configfs_composite_bind() |
2670 | * configurations are bound in sequence with list_for_each_entry, | 2696 | * configurations are bound in sequence with list_for_each_entry, |
diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c index a95290a1289f..59ab62c92b66 100644 --- a/drivers/usb/gadget/function/f_hid.c +++ b/drivers/usb/gadget/function/f_hid.c | |||
@@ -621,12 +621,14 @@ static int __init hidg_bind(struct usb_configuration *c, struct usb_function *f) | |||
621 | dev = MKDEV(major, hidg->minor); | 621 | dev = MKDEV(major, hidg->minor); |
622 | status = cdev_add(&hidg->cdev, dev, 1); | 622 | status = cdev_add(&hidg->cdev, dev, 1); |
623 | if (status) | 623 | if (status) |
624 | goto fail; | 624 | goto fail_free_descs; |
625 | 625 | ||
626 | device_create(hidg_class, NULL, dev, NULL, "%s%d", "hidg", hidg->minor); | 626 | device_create(hidg_class, NULL, dev, NULL, "%s%d", "hidg", hidg->minor); |
627 | 627 | ||
628 | return 0; | 628 | return 0; |
629 | 629 | ||
630 | fail_free_descs: | ||
631 | usb_free_all_descriptors(f); | ||
630 | fail: | 632 | fail: |
631 | ERROR(f->config->cdev, "hidg_bind FAILED\n"); | 633 | ERROR(f->config->cdev, "hidg_bind FAILED\n"); |
632 | if (hidg->req != NULL) { | 634 | if (hidg->req != NULL) { |
@@ -635,7 +637,6 @@ fail: | |||
635 | usb_ep_free_request(hidg->in_ep, hidg->req); | 637 | usb_ep_free_request(hidg->in_ep, hidg->req); |
636 | } | 638 | } |
637 | 639 | ||
638 | usb_free_all_descriptors(f); | ||
639 | return status; | 640 | return status; |
640 | } | 641 | } |
641 | 642 | ||
diff --git a/drivers/usb/gadget/function/f_loopback.c b/drivers/usb/gadget/function/f_loopback.c index bf04389137e6..298b46112b1a 100644 --- a/drivers/usb/gadget/function/f_loopback.c +++ b/drivers/usb/gadget/function/f_loopback.c | |||
@@ -253,22 +253,13 @@ static void loopback_complete(struct usb_ep *ep, struct usb_request *req) | |||
253 | 253 | ||
254 | case 0: /* normal completion? */ | 254 | case 0: /* normal completion? */ |
255 | if (ep == loop->out_ep) { | 255 | if (ep == loop->out_ep) { |
256 | /* loop this OUT packet back IN to the host */ | ||
257 | req->zero = (req->actual < req->length); | 256 | req->zero = (req->actual < req->length); |
258 | req->length = req->actual; | 257 | req->length = req->actual; |
259 | status = usb_ep_queue(loop->in_ep, req, GFP_ATOMIC); | ||
260 | if (status == 0) | ||
261 | return; | ||
262 | |||
263 | /* "should never get here" */ | ||
264 | ERROR(cdev, "can't loop %s to %s: %d\n", | ||
265 | ep->name, loop->in_ep->name, | ||
266 | status); | ||
267 | } | 258 | } |
268 | 259 | ||
269 | /* queue the buffer for some later OUT packet */ | 260 | /* queue the buffer for some later OUT packet */ |
270 | req->length = buflen; | 261 | req->length = buflen; |
271 | status = usb_ep_queue(loop->out_ep, req, GFP_ATOMIC); | 262 | status = usb_ep_queue(ep, req, GFP_ATOMIC); |
272 | if (status == 0) | 263 | if (status == 0) |
273 | return; | 264 | return; |
274 | 265 | ||
@@ -308,60 +299,66 @@ static inline struct usb_request *lb_alloc_ep_req(struct usb_ep *ep, int len) | |||
308 | return alloc_ep_req(ep, len, buflen); | 299 | return alloc_ep_req(ep, len, buflen); |
309 | } | 300 | } |
310 | 301 | ||
311 | static int | 302 | static int enable_endpoint(struct usb_composite_dev *cdev, struct f_loopback *loop, |
312 | enable_loopback(struct usb_composite_dev *cdev, struct f_loopback *loop) | 303 | struct usb_ep *ep) |
313 | { | 304 | { |
314 | int result = 0; | ||
315 | struct usb_ep *ep; | ||
316 | struct usb_request *req; | 305 | struct usb_request *req; |
317 | unsigned i; | 306 | unsigned i; |
307 | int result; | ||
318 | 308 | ||
319 | /* one endpoint writes data back IN to the host */ | 309 | /* |
320 | ep = loop->in_ep; | 310 | * one endpoint writes data back IN to the host while another endpoint |
311 | * just reads OUT packets | ||
312 | */ | ||
321 | result = config_ep_by_speed(cdev->gadget, &(loop->function), ep); | 313 | result = config_ep_by_speed(cdev->gadget, &(loop->function), ep); |
322 | if (result) | 314 | if (result) |
323 | return result; | 315 | goto fail0; |
324 | result = usb_ep_enable(ep); | 316 | result = usb_ep_enable(ep); |
325 | if (result < 0) | 317 | if (result < 0) |
326 | return result; | ||
327 | ep->driver_data = loop; | ||
328 | |||
329 | /* one endpoint just reads OUT packets */ | ||
330 | ep = loop->out_ep; | ||
331 | result = config_ep_by_speed(cdev->gadget, &(loop->function), ep); | ||
332 | if (result) | ||
333 | goto fail0; | 318 | goto fail0; |
334 | |||
335 | result = usb_ep_enable(ep); | ||
336 | if (result < 0) { | ||
337 | fail0: | ||
338 | ep = loop->in_ep; | ||
339 | usb_ep_disable(ep); | ||
340 | ep->driver_data = NULL; | ||
341 | return result; | ||
342 | } | ||
343 | ep->driver_data = loop; | 319 | ep->driver_data = loop; |
344 | 320 | ||
345 | /* allocate a bunch of read buffers and queue them all at once. | 321 | /* |
322 | * allocate a bunch of read buffers and queue them all at once. | ||
346 | * we buffer at most 'qlen' transfers; fewer if any need more | 323 | * we buffer at most 'qlen' transfers; fewer if any need more |
347 | * than 'buflen' bytes each. | 324 | * than 'buflen' bytes each. |
348 | */ | 325 | */ |
349 | for (i = 0; i < qlen && result == 0; i++) { | 326 | for (i = 0; i < qlen && result == 0; i++) { |
350 | req = lb_alloc_ep_req(ep, 0); | 327 | req = lb_alloc_ep_req(ep, 0); |
351 | if (req) { | 328 | if (!req) |
352 | req->complete = loopback_complete; | 329 | goto fail1; |
353 | result = usb_ep_queue(ep, req, GFP_ATOMIC); | 330 | |
354 | if (result) | 331 | req->complete = loopback_complete; |
355 | ERROR(cdev, "%s queue req --> %d\n", | 332 | result = usb_ep_queue(ep, req, GFP_ATOMIC); |
356 | ep->name, result); | 333 | if (result) { |
357 | } else { | 334 | ERROR(cdev, "%s queue req --> %d\n", |
358 | usb_ep_disable(ep); | 335 | ep->name, result); |
359 | ep->driver_data = NULL; | 336 | goto fail1; |
360 | result = -ENOMEM; | ||
361 | goto fail0; | ||
362 | } | 337 | } |
363 | } | 338 | } |
364 | 339 | ||
340 | return 0; | ||
341 | |||
342 | fail1: | ||
343 | usb_ep_disable(ep); | ||
344 | |||
345 | fail0: | ||
346 | return result; | ||
347 | } | ||
348 | |||
349 | static int | ||
350 | enable_loopback(struct usb_composite_dev *cdev, struct f_loopback *loop) | ||
351 | { | ||
352 | int result = 0; | ||
353 | |||
354 | result = enable_endpoint(cdev, loop, loop->in_ep); | ||
355 | if (result) | ||
356 | return result; | ||
357 | |||
358 | result = enable_endpoint(cdev, loop, loop->out_ep); | ||
359 | if (result) | ||
360 | return result; | ||
361 | |||
365 | DBG(cdev, "%s enabled\n", loop->function.name); | 362 | DBG(cdev, "%s enabled\n", loop->function.name); |
366 | return result; | 363 | return result; |
367 | } | 364 | } |
diff --git a/drivers/usb/gadget/function/f_ncm.c b/drivers/usb/gadget/function/f_ncm.c index 146f48cc65d7..16361b0a8b46 100644 --- a/drivers/usb/gadget/function/f_ncm.c +++ b/drivers/usb/gadget/function/f_ncm.c | |||
@@ -1461,7 +1461,6 @@ static int ncm_bind(struct usb_configuration *c, struct usb_function *f) | |||
1461 | return 0; | 1461 | return 0; |
1462 | 1462 | ||
1463 | fail: | 1463 | fail: |
1464 | usb_free_all_descriptors(f); | ||
1465 | if (ncm->notify_req) { | 1464 | if (ncm->notify_req) { |
1466 | kfree(ncm->notify_req->buf); | 1465 | kfree(ncm->notify_req->buf); |
1467 | usb_ep_free_request(ncm->notify, ncm->notify_req); | 1466 | usb_ep_free_request(ncm->notify, ncm->notify_req); |
diff --git a/drivers/usb/gadget/function/f_obex.c b/drivers/usb/gadget/function/f_obex.c index 5f40080c92cc..a1b79c53499c 100644 --- a/drivers/usb/gadget/function/f_obex.c +++ b/drivers/usb/gadget/function/f_obex.c | |||
@@ -35,6 +35,7 @@ struct f_obex { | |||
35 | struct gserial port; | 35 | struct gserial port; |
36 | u8 ctrl_id; | 36 | u8 ctrl_id; |
37 | u8 data_id; | 37 | u8 data_id; |
38 | u8 cur_alt; | ||
38 | u8 port_num; | 39 | u8 port_num; |
39 | u8 can_activate; | 40 | u8 can_activate; |
40 | }; | 41 | }; |
@@ -235,6 +236,8 @@ static int obex_set_alt(struct usb_function *f, unsigned intf, unsigned alt) | |||
235 | } else | 236 | } else |
236 | goto fail; | 237 | goto fail; |
237 | 238 | ||
239 | obex->cur_alt = alt; | ||
240 | |||
238 | return 0; | 241 | return 0; |
239 | 242 | ||
240 | fail: | 243 | fail: |
@@ -245,10 +248,7 @@ static int obex_get_alt(struct usb_function *f, unsigned intf) | |||
245 | { | 248 | { |
246 | struct f_obex *obex = func_to_obex(f); | 249 | struct f_obex *obex = func_to_obex(f); |
247 | 250 | ||
248 | if (intf == obex->ctrl_id) | 251 | return obex->cur_alt; |
249 | return 0; | ||
250 | |||
251 | return obex->port.in->driver_data ? 1 : 0; | ||
252 | } | 252 | } |
253 | 253 | ||
254 | static void obex_disable(struct usb_function *f) | 254 | static void obex_disable(struct usb_function *f) |
@@ -397,7 +397,6 @@ static int obex_bind(struct usb_configuration *c, struct usb_function *f) | |||
397 | return 0; | 397 | return 0; |
398 | 398 | ||
399 | fail: | 399 | fail: |
400 | usb_free_all_descriptors(f); | ||
401 | /* we might as well release our claims on endpoints */ | 400 | /* we might as well release our claims on endpoints */ |
402 | if (obex->port.out) | 401 | if (obex->port.out) |
403 | obex->port.out->driver_data = NULL; | 402 | obex->port.out->driver_data = NULL; |
diff --git a/drivers/usb/gadget/function/f_phonet.c b/drivers/usb/gadget/function/f_phonet.c index b9cfc1571d71..1ec8b7ffdccd 100644 --- a/drivers/usb/gadget/function/f_phonet.c +++ b/drivers/usb/gadget/function/f_phonet.c | |||
@@ -570,8 +570,8 @@ static int pn_bind(struct usb_configuration *c, struct usb_function *f) | |||
570 | err_req: | 570 | err_req: |
571 | for (i = 0; i < phonet_rxq_size && fp->out_reqv[i]; i++) | 571 | for (i = 0; i < phonet_rxq_size && fp->out_reqv[i]; i++) |
572 | usb_ep_free_request(fp->out_ep, fp->out_reqv[i]); | 572 | usb_ep_free_request(fp->out_ep, fp->out_reqv[i]); |
573 | err: | ||
574 | usb_free_all_descriptors(f); | 573 | usb_free_all_descriptors(f); |
574 | err: | ||
575 | if (fp->out_ep) | 575 | if (fp->out_ep) |
576 | fp->out_ep->driver_data = NULL; | 576 | fp->out_ep->driver_data = NULL; |
577 | if (fp->in_ep) | 577 | if (fp->in_ep) |
diff --git a/drivers/usb/gadget/function/f_rndis.c b/drivers/usb/gadget/function/f_rndis.c index ddb09dc6d1f2..f13fc6a58565 100644 --- a/drivers/usb/gadget/function/f_rndis.c +++ b/drivers/usb/gadget/function/f_rndis.c | |||
@@ -802,8 +802,10 @@ rndis_bind(struct usb_configuration *c, struct usb_function *f) | |||
802 | 802 | ||
803 | if (rndis->manufacturer && rndis->vendorID && | 803 | if (rndis->manufacturer && rndis->vendorID && |
804 | rndis_set_param_vendor(rndis->config, rndis->vendorID, | 804 | rndis_set_param_vendor(rndis->config, rndis->vendorID, |
805 | rndis->manufacturer)) | 805 | rndis->manufacturer)) { |
806 | goto fail; | 806 | status = -EINVAL; |
807 | goto fail_free_descs; | ||
808 | } | ||
807 | 809 | ||
808 | /* NOTE: all that is done without knowing or caring about | 810 | /* NOTE: all that is done without knowing or caring about |
809 | * the network link ... which is unavailable to this code | 811 | * the network link ... which is unavailable to this code |
@@ -817,10 +819,11 @@ rndis_bind(struct usb_configuration *c, struct usb_function *f) | |||
817 | rndis->notify->name); | 819 | rndis->notify->name); |
818 | return 0; | 820 | return 0; |
819 | 821 | ||
822 | fail_free_descs: | ||
823 | usb_free_all_descriptors(f); | ||
820 | fail: | 824 | fail: |
821 | kfree(f->os_desc_table); | 825 | kfree(f->os_desc_table); |
822 | f->os_desc_n = 0; | 826 | f->os_desc_n = 0; |
823 | usb_free_all_descriptors(f); | ||
824 | 827 | ||
825 | if (rndis->notify_req) { | 828 | if (rndis->notify_req) { |
826 | kfree(rndis->notify_req->buf); | 829 | kfree(rndis->notify_req->buf); |
diff --git a/drivers/usb/gadget/function/f_subset.c b/drivers/usb/gadget/function/f_subset.c index 1ea8baf33333..e3dfa675ff06 100644 --- a/drivers/usb/gadget/function/f_subset.c +++ b/drivers/usb/gadget/function/f_subset.c | |||
@@ -380,7 +380,6 @@ geth_bind(struct usb_configuration *c, struct usb_function *f) | |||
380 | return 0; | 380 | return 0; |
381 | 381 | ||
382 | fail: | 382 | fail: |
383 | usb_free_all_descriptors(f); | ||
384 | /* we might as well release our claims on endpoints */ | 383 | /* we might as well release our claims on endpoints */ |
385 | if (geth->port.out_ep) | 384 | if (geth->port.out_ep) |
386 | geth->port.out_ep->driver_data = NULL; | 385 | geth->port.out_ep->driver_data = NULL; |
diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c index a5a27a504d67..33e16658e5cf 100644 --- a/drivers/usb/gadget/function/f_uac2.c +++ b/drivers/usb/gadget/function/f_uac2.c | |||
@@ -512,6 +512,11 @@ static int snd_uac2_remove(struct platform_device *pdev) | |||
512 | return 0; | 512 | return 0; |
513 | } | 513 | } |
514 | 514 | ||
515 | static void snd_uac2_release(struct device *dev) | ||
516 | { | ||
517 | dev_dbg(dev, "releasing '%s'\n", dev_name(dev)); | ||
518 | } | ||
519 | |||
515 | static int alsa_uac2_init(struct audio_dev *agdev) | 520 | static int alsa_uac2_init(struct audio_dev *agdev) |
516 | { | 521 | { |
517 | struct snd_uac2_chip *uac2 = &agdev->uac2; | 522 | struct snd_uac2_chip *uac2 = &agdev->uac2; |
@@ -523,6 +528,7 @@ static int alsa_uac2_init(struct audio_dev *agdev) | |||
523 | 528 | ||
524 | uac2->pdev.id = 0; | 529 | uac2->pdev.id = 0; |
525 | uac2->pdev.name = uac2_name; | 530 | uac2->pdev.name = uac2_name; |
531 | uac2->pdev.dev.release = snd_uac2_release; | ||
526 | 532 | ||
527 | /* Register snd_uac2 driver */ | 533 | /* Register snd_uac2 driver */ |
528 | err = platform_driver_register(&uac2->pdrv); | 534 | err = platform_driver_register(&uac2->pdrv); |
@@ -772,6 +778,7 @@ struct usb_endpoint_descriptor fs_epout_desc = { | |||
772 | 778 | ||
773 | .bEndpointAddress = USB_DIR_OUT, | 779 | .bEndpointAddress = USB_DIR_OUT, |
774 | .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC, | 780 | .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC, |
781 | .wMaxPacketSize = cpu_to_le16(1023), | ||
775 | .bInterval = 1, | 782 | .bInterval = 1, |
776 | }; | 783 | }; |
777 | 784 | ||
@@ -780,6 +787,7 @@ struct usb_endpoint_descriptor hs_epout_desc = { | |||
780 | .bDescriptorType = USB_DT_ENDPOINT, | 787 | .bDescriptorType = USB_DT_ENDPOINT, |
781 | 788 | ||
782 | .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC, | 789 | .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC, |
790 | .wMaxPacketSize = cpu_to_le16(1024), | ||
783 | .bInterval = 4, | 791 | .bInterval = 4, |
784 | }; | 792 | }; |
785 | 793 | ||
@@ -847,6 +855,7 @@ struct usb_endpoint_descriptor fs_epin_desc = { | |||
847 | 855 | ||
848 | .bEndpointAddress = USB_DIR_IN, | 856 | .bEndpointAddress = USB_DIR_IN, |
849 | .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC, | 857 | .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC, |
858 | .wMaxPacketSize = cpu_to_le16(1023), | ||
850 | .bInterval = 1, | 859 | .bInterval = 1, |
851 | }; | 860 | }; |
852 | 861 | ||
@@ -855,6 +864,7 @@ struct usb_endpoint_descriptor hs_epin_desc = { | |||
855 | .bDescriptorType = USB_DT_ENDPOINT, | 864 | .bDescriptorType = USB_DT_ENDPOINT, |
856 | 865 | ||
857 | .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC, | 866 | .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC, |
867 | .wMaxPacketSize = cpu_to_le16(1024), | ||
858 | .bInterval = 4, | 868 | .bInterval = 4, |
859 | }; | 869 | }; |
860 | 870 | ||
@@ -947,6 +957,9 @@ free_ep(struct uac2_rtd_params *prm, struct usb_ep *ep) | |||
947 | struct snd_uac2_chip *uac2 = prm->uac2; | 957 | struct snd_uac2_chip *uac2 = prm->uac2; |
948 | int i; | 958 | int i; |
949 | 959 | ||
960 | if (!prm->ep_enabled) | ||
961 | return; | ||
962 | |||
950 | prm->ep_enabled = false; | 963 | prm->ep_enabled = false; |
951 | 964 | ||
952 | for (i = 0; i < USB_XFERS; i++) { | 965 | for (i = 0; i < USB_XFERS; i++) { |
@@ -1071,7 +1084,7 @@ afunc_bind(struct usb_configuration *cfg, struct usb_function *fn) | |||
1071 | prm->rbuf = kzalloc(prm->max_psize * USB_XFERS, GFP_KERNEL); | 1084 | prm->rbuf = kzalloc(prm->max_psize * USB_XFERS, GFP_KERNEL); |
1072 | if (!prm->rbuf) { | 1085 | if (!prm->rbuf) { |
1073 | prm->max_psize = 0; | 1086 | prm->max_psize = 0; |
1074 | goto err; | 1087 | goto err_free_descs; |
1075 | } | 1088 | } |
1076 | 1089 | ||
1077 | prm = &agdev->uac2.p_prm; | 1090 | prm = &agdev->uac2.p_prm; |
@@ -1079,17 +1092,19 @@ afunc_bind(struct usb_configuration *cfg, struct usb_function *fn) | |||
1079 | prm->rbuf = kzalloc(prm->max_psize * USB_XFERS, GFP_KERNEL); | 1092 | prm->rbuf = kzalloc(prm->max_psize * USB_XFERS, GFP_KERNEL); |
1080 | if (!prm->rbuf) { | 1093 | if (!prm->rbuf) { |
1081 | prm->max_psize = 0; | 1094 | prm->max_psize = 0; |
1082 | goto err; | 1095 | goto err_free_descs; |
1083 | } | 1096 | } |
1084 | 1097 | ||
1085 | ret = alsa_uac2_init(agdev); | 1098 | ret = alsa_uac2_init(agdev); |
1086 | if (ret) | 1099 | if (ret) |
1087 | goto err; | 1100 | goto err_free_descs; |
1088 | return 0; | 1101 | return 0; |
1102 | |||
1103 | err_free_descs: | ||
1104 | usb_free_all_descriptors(fn); | ||
1089 | err: | 1105 | err: |
1090 | kfree(agdev->uac2.p_prm.rbuf); | 1106 | kfree(agdev->uac2.p_prm.rbuf); |
1091 | kfree(agdev->uac2.c_prm.rbuf); | 1107 | kfree(agdev->uac2.c_prm.rbuf); |
1092 | usb_free_all_descriptors(fn); | ||
1093 | if (agdev->in_ep) | 1108 | if (agdev->in_ep) |
1094 | agdev->in_ep->driver_data = NULL; | 1109 | agdev->in_ep->driver_data = NULL; |
1095 | if (agdev->out_ep) | 1110 | if (agdev->out_ep) |
diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c index e126439e4b65..945b3bd2ca98 100644 --- a/drivers/usb/gadget/function/f_uvc.c +++ b/drivers/usb/gadget/function/f_uvc.c | |||
@@ -279,27 +279,41 @@ uvc_function_get_alt(struct usb_function *f, unsigned interface) | |||
279 | else if (interface != uvc->streaming_intf) | 279 | else if (interface != uvc->streaming_intf) |
280 | return -EINVAL; | 280 | return -EINVAL; |
281 | else | 281 | else |
282 | return uvc->state == UVC_STATE_STREAMING ? 1 : 0; | 282 | return uvc->video.ep->driver_data ? 1 : 0; |
283 | } | 283 | } |
284 | 284 | ||
285 | static int | 285 | static int |
286 | uvc_function_set_alt(struct usb_function *f, unsigned interface, unsigned alt) | 286 | uvc_function_set_alt(struct usb_function *f, unsigned interface, unsigned alt) |
287 | { | 287 | { |
288 | struct uvc_device *uvc = to_uvc(f); | 288 | struct uvc_device *uvc = to_uvc(f); |
289 | struct usb_composite_dev *cdev = f->config->cdev; | ||
289 | struct v4l2_event v4l2_event; | 290 | struct v4l2_event v4l2_event; |
290 | struct uvc_event *uvc_event = (void *)&v4l2_event.u.data; | 291 | struct uvc_event *uvc_event = (void *)&v4l2_event.u.data; |
291 | int ret; | 292 | int ret; |
292 | 293 | ||
293 | INFO(f->config->cdev, "uvc_function_set_alt(%u, %u)\n", interface, alt); | 294 | INFO(cdev, "uvc_function_set_alt(%u, %u)\n", interface, alt); |
294 | 295 | ||
295 | if (interface == uvc->control_intf) { | 296 | if (interface == uvc->control_intf) { |
296 | if (alt) | 297 | if (alt) |
297 | return -EINVAL; | 298 | return -EINVAL; |
298 | 299 | ||
300 | if (uvc->control_ep->driver_data) { | ||
301 | INFO(cdev, "reset UVC Control\n"); | ||
302 | usb_ep_disable(uvc->control_ep); | ||
303 | uvc->control_ep->driver_data = NULL; | ||
304 | } | ||
305 | |||
306 | if (!uvc->control_ep->desc) | ||
307 | if (config_ep_by_speed(cdev->gadget, f, uvc->control_ep)) | ||
308 | return -EINVAL; | ||
309 | |||
310 | usb_ep_enable(uvc->control_ep); | ||
311 | uvc->control_ep->driver_data = uvc; | ||
312 | |||
299 | if (uvc->state == UVC_STATE_DISCONNECTED) { | 313 | if (uvc->state == UVC_STATE_DISCONNECTED) { |
300 | memset(&v4l2_event, 0, sizeof(v4l2_event)); | 314 | memset(&v4l2_event, 0, sizeof(v4l2_event)); |
301 | v4l2_event.type = UVC_EVENT_CONNECT; | 315 | v4l2_event.type = UVC_EVENT_CONNECT; |
302 | uvc_event->speed = f->config->cdev->gadget->speed; | 316 | uvc_event->speed = cdev->gadget->speed; |
303 | v4l2_event_queue(uvc->vdev, &v4l2_event); | 317 | v4l2_event_queue(uvc->vdev, &v4l2_event); |
304 | 318 | ||
305 | uvc->state = UVC_STATE_CONNECTED; | 319 | uvc->state = UVC_STATE_CONNECTED; |
@@ -321,8 +335,10 @@ uvc_function_set_alt(struct usb_function *f, unsigned interface, unsigned alt) | |||
321 | if (uvc->state != UVC_STATE_STREAMING) | 335 | if (uvc->state != UVC_STATE_STREAMING) |
322 | return 0; | 336 | return 0; |
323 | 337 | ||
324 | if (uvc->video.ep) | 338 | if (uvc->video.ep) { |
325 | usb_ep_disable(uvc->video.ep); | 339 | usb_ep_disable(uvc->video.ep); |
340 | uvc->video.ep->driver_data = NULL; | ||
341 | } | ||
326 | 342 | ||
327 | memset(&v4l2_event, 0, sizeof(v4l2_event)); | 343 | memset(&v4l2_event, 0, sizeof(v4l2_event)); |
328 | v4l2_event.type = UVC_EVENT_STREAMOFF; | 344 | v4l2_event.type = UVC_EVENT_STREAMOFF; |
@@ -335,14 +351,22 @@ uvc_function_set_alt(struct usb_function *f, unsigned interface, unsigned alt) | |||
335 | if (uvc->state != UVC_STATE_CONNECTED) | 351 | if (uvc->state != UVC_STATE_CONNECTED) |
336 | return 0; | 352 | return 0; |
337 | 353 | ||
338 | if (uvc->video.ep) { | 354 | if (!uvc->video.ep) |
339 | ret = config_ep_by_speed(f->config->cdev->gadget, | 355 | return -EINVAL; |
340 | &(uvc->func), uvc->video.ep); | 356 | |
341 | if (ret) | 357 | if (uvc->video.ep->driver_data) { |
342 | return ret; | 358 | INFO(cdev, "reset UVC\n"); |
343 | usb_ep_enable(uvc->video.ep); | 359 | usb_ep_disable(uvc->video.ep); |
360 | uvc->video.ep->driver_data = NULL; | ||
344 | } | 361 | } |
345 | 362 | ||
363 | ret = config_ep_by_speed(f->config->cdev->gadget, | ||
364 | &(uvc->func), uvc->video.ep); | ||
365 | if (ret) | ||
366 | return ret; | ||
367 | usb_ep_enable(uvc->video.ep); | ||
368 | uvc->video.ep->driver_data = uvc; | ||
369 | |||
346 | memset(&v4l2_event, 0, sizeof(v4l2_event)); | 370 | memset(&v4l2_event, 0, sizeof(v4l2_event)); |
347 | v4l2_event.type = UVC_EVENT_STREAMON; | 371 | v4l2_event.type = UVC_EVENT_STREAMON; |
348 | v4l2_event_queue(uvc->vdev, &v4l2_event); | 372 | v4l2_event_queue(uvc->vdev, &v4l2_event); |
@@ -366,6 +390,16 @@ uvc_function_disable(struct usb_function *f) | |||
366 | v4l2_event_queue(uvc->vdev, &v4l2_event); | 390 | v4l2_event_queue(uvc->vdev, &v4l2_event); |
367 | 391 | ||
368 | uvc->state = UVC_STATE_DISCONNECTED; | 392 | uvc->state = UVC_STATE_DISCONNECTED; |
393 | |||
394 | if (uvc->video.ep->driver_data) { | ||
395 | usb_ep_disable(uvc->video.ep); | ||
396 | uvc->video.ep->driver_data = NULL; | ||
397 | } | ||
398 | |||
399 | if (uvc->control_ep->driver_data) { | ||
400 | usb_ep_disable(uvc->control_ep); | ||
401 | uvc->control_ep->driver_data = NULL; | ||
402 | } | ||
369 | } | 403 | } |
370 | 404 | ||
371 | /* -------------------------------------------------------------------------- | 405 | /* -------------------------------------------------------------------------- |
diff --git a/drivers/usb/gadget/function/uvc_video.c b/drivers/usb/gadget/function/uvc_video.c index c3e1f27dbbef..9cb86bc1a9a5 100644 --- a/drivers/usb/gadget/function/uvc_video.c +++ b/drivers/usb/gadget/function/uvc_video.c | |||
@@ -352,7 +352,8 @@ int uvcg_video_enable(struct uvc_video *video, int enable) | |||
352 | 352 | ||
353 | if (!enable) { | 353 | if (!enable) { |
354 | for (i = 0; i < UVC_NUM_REQUESTS; ++i) | 354 | for (i = 0; i < UVC_NUM_REQUESTS; ++i) |
355 | usb_ep_dequeue(video->ep, video->req[i]); | 355 | if (video->req[i]) |
356 | usb_ep_dequeue(video->ep, video->req[i]); | ||
356 | 357 | ||
357 | uvc_video_free_requests(video); | 358 | uvc_video_free_requests(video); |
358 | uvcg_queue_enable(&video->queue, 0); | 359 | uvcg_queue_enable(&video->queue, 0); |
diff --git a/drivers/usb/gadget/udc/Kconfig b/drivers/usb/gadget/udc/Kconfig index 3ea287b0e448..217365d35a25 100644 --- a/drivers/usb/gadget/udc/Kconfig +++ b/drivers/usb/gadget/udc/Kconfig | |||
@@ -357,6 +357,7 @@ config USB_EG20T | |||
357 | 357 | ||
358 | config USB_GADGET_XILINX | 358 | config USB_GADGET_XILINX |
359 | tristate "Xilinx USB Driver" | 359 | tristate "Xilinx USB Driver" |
360 | depends on HAS_DMA | ||
360 | depends on OF || COMPILE_TEST | 361 | depends on OF || COMPILE_TEST |
361 | help | 362 | help |
362 | USB peripheral controller driver for Xilinx USB2 device. | 363 | USB peripheral controller driver for Xilinx USB2 device. |
diff --git a/drivers/usb/gadget/udc/udc-core.c b/drivers/usb/gadget/udc/udc-core.c index f107bb60a5ab..f2054659f25b 100644 --- a/drivers/usb/gadget/udc/udc-core.c +++ b/drivers/usb/gadget/udc/udc-core.c | |||
@@ -507,6 +507,11 @@ static ssize_t usb_udc_softconn_store(struct device *dev, | |||
507 | { | 507 | { |
508 | struct usb_udc *udc = container_of(dev, struct usb_udc, dev); | 508 | struct usb_udc *udc = container_of(dev, struct usb_udc, dev); |
509 | 509 | ||
510 | if (!udc->driver) { | ||
511 | dev_err(dev, "soft-connect without a gadget driver\n"); | ||
512 | return -EOPNOTSUPP; | ||
513 | } | ||
514 | |||
510 | if (sysfs_streq(buf, "connect")) { | 515 | if (sysfs_streq(buf, "connect")) { |
511 | usb_gadget_udc_start(udc->gadget, udc->driver); | 516 | usb_gadget_udc_start(udc->gadget, udc->driver); |
512 | usb_gadget_connect(udc->gadget); | 517 | usb_gadget_connect(udc->gadget); |
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index a8a30b1d4167..a3ca1375dd52 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig | |||
@@ -234,7 +234,7 @@ config USB_EHCI_SH | |||
234 | 234 | ||
235 | config USB_EHCI_EXYNOS | 235 | config USB_EHCI_EXYNOS |
236 | tristate "EHCI support for Samsung S5P/EXYNOS SoC Series" | 236 | tristate "EHCI support for Samsung S5P/EXYNOS SoC Series" |
237 | depends on PLAT_S5P || ARCH_EXYNOS | 237 | depends on ARCH_S5PV210 || ARCH_EXYNOS |
238 | help | 238 | help |
239 | Enable support for the Samsung Exynos SOC's on-chip EHCI controller. | 239 | Enable support for the Samsung Exynos SOC's on-chip EHCI controller. |
240 | 240 | ||
@@ -550,7 +550,7 @@ config USB_OHCI_SH | |||
550 | 550 | ||
551 | config USB_OHCI_EXYNOS | 551 | config USB_OHCI_EXYNOS |
552 | tristate "OHCI support for Samsung S5P/EXYNOS SoC Series" | 552 | tristate "OHCI support for Samsung S5P/EXYNOS SoC Series" |
553 | depends on PLAT_S5P || ARCH_EXYNOS | 553 | depends on ARCH_S5PV210 || ARCH_EXYNOS |
554 | help | 554 | help |
555 | Enable support for the Samsung Exynos SOC's on-chip OHCI controller. | 555 | Enable support for the Samsung Exynos SOC's on-chip OHCI controller. |
556 | 556 | ||
diff --git a/drivers/usb/host/hwa-hc.c b/drivers/usb/host/hwa-hc.c index d0d8fadf7066..1db0626c8bf4 100644 --- a/drivers/usb/host/hwa-hc.c +++ b/drivers/usb/host/hwa-hc.c | |||
@@ -607,7 +607,7 @@ found: | |||
607 | wa->wa_descr = wa_descr = (struct usb_wa_descriptor *) hdr; | 607 | wa->wa_descr = wa_descr = (struct usb_wa_descriptor *) hdr; |
608 | if (le16_to_cpu(wa_descr->bcdWAVersion) > 0x0100) | 608 | if (le16_to_cpu(wa_descr->bcdWAVersion) > 0x0100) |
609 | dev_warn(dev, "Wire Adapter v%d.%d newer than groked v1.0\n", | 609 | dev_warn(dev, "Wire Adapter v%d.%d newer than groked v1.0\n", |
610 | le16_to_cpu(wa_descr->bcdWAVersion) & 0xff00 >> 8, | 610 | (le16_to_cpu(wa_descr->bcdWAVersion) & 0xff00) >> 8, |
611 | le16_to_cpu(wa_descr->bcdWAVersion) & 0x00ff); | 611 | le16_to_cpu(wa_descr->bcdWAVersion) & 0x00ff); |
612 | result = 0; | 612 | result = 0; |
613 | error: | 613 | error: |
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index 280dde93abe5..9a69b1f1b300 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c | |||
@@ -128,20 +128,6 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) | |||
128 | xhci->quirks |= XHCI_AVOID_BEI; | 128 | xhci->quirks |= XHCI_AVOID_BEI; |
129 | } | 129 | } |
130 | if (pdev->vendor == PCI_VENDOR_ID_INTEL && | 130 | if (pdev->vendor == PCI_VENDOR_ID_INTEL && |
131 | (pdev->device == PCI_DEVICE_ID_INTEL_LYNXPOINT_XHCI || | ||
132 | pdev->device == PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI)) { | ||
133 | /* Workaround for occasional spurious wakeups from S5 (or | ||
134 | * any other sleep) on Haswell machines with LPT and LPT-LP | ||
135 | * with the new Intel BIOS | ||
136 | */ | ||
137 | /* Limit the quirk to only known vendors, as this triggers | ||
138 | * yet another BIOS bug on some other machines | ||
139 | * https://bugzilla.kernel.org/show_bug.cgi?id=66171 | ||
140 | */ | ||
141 | if (pdev->subsystem_vendor == PCI_VENDOR_ID_HP) | ||
142 | xhci->quirks |= XHCI_SPURIOUS_WAKEUP; | ||
143 | } | ||
144 | if (pdev->vendor == PCI_VENDOR_ID_INTEL && | ||
145 | pdev->device == PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI) { | 131 | pdev->device == PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI) { |
146 | xhci->quirks |= XHCI_SPURIOUS_REBOOT; | 132 | xhci->quirks |= XHCI_SPURIOUS_REBOOT; |
147 | } | 133 | } |
@@ -162,6 +148,10 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) | |||
162 | pdev->device == 0x3432) | 148 | pdev->device == 0x3432) |
163 | xhci->quirks |= XHCI_BROKEN_STREAMS; | 149 | xhci->quirks |= XHCI_BROKEN_STREAMS; |
164 | 150 | ||
151 | if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && | ||
152 | pdev->device == 0x1042) | ||
153 | xhci->quirks |= XHCI_BROKEN_STREAMS; | ||
154 | |||
165 | if (xhci->quirks & XHCI_RESET_ON_RESUME) | 155 | if (xhci->quirks & XHCI_RESET_ON_RESUME) |
166 | xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, | 156 | xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, |
167 | "QUIRK: Resetting on resume"); | 157 | "QUIRK: Resetting on resume"); |
diff --git a/drivers/usb/musb/musb_cppi41.c b/drivers/usb/musb/musb_cppi41.c index acdfb3e68a90..5a9b977fbc19 100644 --- a/drivers/usb/musb/musb_cppi41.c +++ b/drivers/usb/musb/musb_cppi41.c | |||
@@ -209,7 +209,8 @@ static enum hrtimer_restart cppi41_recheck_tx_req(struct hrtimer *timer) | |||
209 | } | 209 | } |
210 | } | 210 | } |
211 | 211 | ||
212 | if (!list_empty(&controller->early_tx_list)) { | 212 | if (!list_empty(&controller->early_tx_list) && |
213 | !hrtimer_is_queued(&controller->early_tx)) { | ||
213 | ret = HRTIMER_RESTART; | 214 | ret = HRTIMER_RESTART; |
214 | hrtimer_forward_now(&controller->early_tx, | 215 | hrtimer_forward_now(&controller->early_tx, |
215 | ktime_set(0, 20 * NSEC_PER_USEC)); | 216 | ktime_set(0, 20 * NSEC_PER_USEC)); |
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index 154bcf1b5dfa..48bc09e7b83b 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c | |||
@@ -868,9 +868,15 @@ static int dsps_suspend(struct device *dev) | |||
868 | struct dsps_glue *glue = dev_get_drvdata(dev); | 868 | struct dsps_glue *glue = dev_get_drvdata(dev); |
869 | const struct dsps_musb_wrapper *wrp = glue->wrp; | 869 | const struct dsps_musb_wrapper *wrp = glue->wrp; |
870 | struct musb *musb = platform_get_drvdata(glue->musb); | 870 | struct musb *musb = platform_get_drvdata(glue->musb); |
871 | void __iomem *mbase = musb->ctrl_base; | 871 | void __iomem *mbase; |
872 | 872 | ||
873 | del_timer_sync(&glue->timer); | 873 | del_timer_sync(&glue->timer); |
874 | |||
875 | if (!musb) | ||
876 | /* This can happen if the musb device is in -EPROBE_DEFER */ | ||
877 | return 0; | ||
878 | |||
879 | mbase = musb->ctrl_base; | ||
874 | glue->context.control = dsps_readl(mbase, wrp->control); | 880 | glue->context.control = dsps_readl(mbase, wrp->control); |
875 | glue->context.epintr = dsps_readl(mbase, wrp->epintr_set); | 881 | glue->context.epintr = dsps_readl(mbase, wrp->epintr_set); |
876 | glue->context.coreintr = dsps_readl(mbase, wrp->coreintr_set); | 882 | glue->context.coreintr = dsps_readl(mbase, wrp->coreintr_set); |
@@ -887,8 +893,12 @@ static int dsps_resume(struct device *dev) | |||
887 | struct dsps_glue *glue = dev_get_drvdata(dev); | 893 | struct dsps_glue *glue = dev_get_drvdata(dev); |
888 | const struct dsps_musb_wrapper *wrp = glue->wrp; | 894 | const struct dsps_musb_wrapper *wrp = glue->wrp; |
889 | struct musb *musb = platform_get_drvdata(glue->musb); | 895 | struct musb *musb = platform_get_drvdata(glue->musb); |
890 | void __iomem *mbase = musb->ctrl_base; | 896 | void __iomem *mbase; |
897 | |||
898 | if (!musb) | ||
899 | return 0; | ||
891 | 900 | ||
901 | mbase = musb->ctrl_base; | ||
892 | dsps_writel(mbase, wrp->control, glue->context.control); | 902 | dsps_writel(mbase, wrp->control, glue->context.control); |
893 | dsps_writel(mbase, wrp->epintr_set, glue->context.epintr); | 903 | dsps_writel(mbase, wrp->epintr_set, glue->context.epintr); |
894 | dsps_writel(mbase, wrp->coreintr_set, glue->context.coreintr); | 904 | dsps_writel(mbase, wrp->coreintr_set, glue->context.coreintr); |
@@ -896,7 +906,9 @@ static int dsps_resume(struct device *dev) | |||
896 | dsps_writel(mbase, wrp->mode, glue->context.mode); | 906 | dsps_writel(mbase, wrp->mode, glue->context.mode); |
897 | dsps_writel(mbase, wrp->tx_mode, glue->context.tx_mode); | 907 | dsps_writel(mbase, wrp->tx_mode, glue->context.tx_mode); |
898 | dsps_writel(mbase, wrp->rx_mode, glue->context.rx_mode); | 908 | dsps_writel(mbase, wrp->rx_mode, glue->context.rx_mode); |
899 | setup_timer(&glue->timer, otg_timer, (unsigned long) musb); | 909 | if (musb->xceiv->state == OTG_STATE_B_IDLE && |
910 | musb->port_mode == MUSB_PORT_MODE_DUAL_ROLE) | ||
911 | mod_timer(&glue->timer, jiffies + wrp->poll_seconds * HZ); | ||
900 | 912 | ||
901 | return 0; | 913 | return 0; |
902 | } | 914 | } |
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index eca1747ca8c7..cfd009dc4018 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c | |||
@@ -155,6 +155,7 @@ static const struct usb_device_id id_table[] = { | |||
155 | { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */ | 155 | { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */ |
156 | { USB_DEVICE(0x1ADB, 0x0001) }, /* Schweitzer Engineering C662 Cable */ | 156 | { USB_DEVICE(0x1ADB, 0x0001) }, /* Schweitzer Engineering C662 Cable */ |
157 | { USB_DEVICE(0x1B1C, 0x1C00) }, /* Corsair USB Dongle */ | 157 | { USB_DEVICE(0x1B1C, 0x1C00) }, /* Corsair USB Dongle */ |
158 | { USB_DEVICE(0x1BA4, 0x0002) }, /* Silicon Labs 358x factory default */ | ||
158 | { USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */ | 159 | { USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */ |
159 | { USB_DEVICE(0x1D6F, 0x0010) }, /* Seluxit ApS RF Dongle */ | 160 | { USB_DEVICE(0x1D6F, 0x0010) }, /* Seluxit ApS RF Dongle */ |
160 | { USB_DEVICE(0x1E29, 0x0102) }, /* Festo CPX-USB */ | 161 | { USB_DEVICE(0x1E29, 0x0102) }, /* Festo CPX-USB */ |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index dc72b924c399..0dad8ce5a609 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -140,6 +140,7 @@ static struct ftdi_sio_quirk ftdi_8u2232c_quirk = { | |||
140 | * /sys/bus/usb-serial/drivers/ftdi_sio/new_id and send a patch or report. | 140 | * /sys/bus/usb-serial/drivers/ftdi_sio/new_id and send a patch or report. |
141 | */ | 141 | */ |
142 | static const struct usb_device_id id_table_combined[] = { | 142 | static const struct usb_device_id id_table_combined[] = { |
143 | { USB_DEVICE(FTDI_VID, FTDI_BRICK_PID) }, | ||
143 | { USB_DEVICE(FTDI_VID, FTDI_ZEITCONTROL_TAGTRACE_MIFARE_PID) }, | 144 | { USB_DEVICE(FTDI_VID, FTDI_ZEITCONTROL_TAGTRACE_MIFARE_PID) }, |
144 | { USB_DEVICE(FTDI_VID, FTDI_CTI_MINI_PID) }, | 145 | { USB_DEVICE(FTDI_VID, FTDI_CTI_MINI_PID) }, |
145 | { USB_DEVICE(FTDI_VID, FTDI_CTI_NANO_PID) }, | 146 | { USB_DEVICE(FTDI_VID, FTDI_CTI_NANO_PID) }, |
@@ -661,6 +662,8 @@ static const struct usb_device_id id_table_combined[] = { | |||
661 | { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_5_PID) }, | 662 | { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_5_PID) }, |
662 | { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_6_PID) }, | 663 | { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_6_PID) }, |
663 | { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_7_PID) }, | 664 | { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_7_PID) }, |
665 | { USB_DEVICE(XSENS_VID, XSENS_AWINDA_DONGLE_PID) }, | ||
666 | { USB_DEVICE(XSENS_VID, XSENS_AWINDA_STATION_PID) }, | ||
664 | { USB_DEVICE(XSENS_VID, XSENS_CONVERTER_PID) }, | 667 | { USB_DEVICE(XSENS_VID, XSENS_CONVERTER_PID) }, |
665 | { USB_DEVICE(XSENS_VID, XSENS_MTW_PID) }, | 668 | { USB_DEVICE(XSENS_VID, XSENS_MTW_PID) }, |
666 | { USB_DEVICE(FTDI_VID, FTDI_OMNI1509) }, | 669 | { USB_DEVICE(FTDI_VID, FTDI_OMNI1509) }, |
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index 5937b2d242f2..6786b705ccf6 100644 --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h | |||
@@ -30,6 +30,12 @@ | |||
30 | 30 | ||
31 | /*** third-party PIDs (using FTDI_VID) ***/ | 31 | /*** third-party PIDs (using FTDI_VID) ***/ |
32 | 32 | ||
33 | /* | ||
34 | * Certain versions of the official Windows FTDI driver reprogrammed | ||
35 | * counterfeit FTDI devices to PID 0. Support these devices anyway. | ||
36 | */ | ||
37 | #define FTDI_BRICK_PID 0x0000 | ||
38 | |||
33 | #define FTDI_LUMEL_PD12_PID 0x6002 | 39 | #define FTDI_LUMEL_PD12_PID 0x6002 |
34 | 40 | ||
35 | /* | 41 | /* |
@@ -143,8 +149,12 @@ | |||
143 | * Xsens Technologies BV products (http://www.xsens.com). | 149 | * Xsens Technologies BV products (http://www.xsens.com). |
144 | */ | 150 | */ |
145 | #define XSENS_VID 0x2639 | 151 | #define XSENS_VID 0x2639 |
146 | #define XSENS_CONVERTER_PID 0xD00D /* Xsens USB-serial converter */ | 152 | #define XSENS_AWINDA_STATION_PID 0x0101 |
153 | #define XSENS_AWINDA_DONGLE_PID 0x0102 | ||
147 | #define XSENS_MTW_PID 0x0200 /* Xsens MTw */ | 154 | #define XSENS_MTW_PID 0x0200 /* Xsens MTw */ |
155 | #define XSENS_CONVERTER_PID 0xD00D /* Xsens USB-serial converter */ | ||
156 | |||
157 | /* Xsens devices using FTDI VID */ | ||
148 | #define XSENS_CONVERTER_0_PID 0xD388 /* Xsens USB converter */ | 158 | #define XSENS_CONVERTER_0_PID 0xD388 /* Xsens USB converter */ |
149 | #define XSENS_CONVERTER_1_PID 0xD389 /* Xsens Wireless Receiver */ | 159 | #define XSENS_CONVERTER_1_PID 0xD389 /* Xsens Wireless Receiver */ |
150 | #define XSENS_CONVERTER_2_PID 0xD38A | 160 | #define XSENS_CONVERTER_2_PID 0xD38A |
diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c index 078f9ed419c8..02c420af251e 100644 --- a/drivers/usb/serial/kobil_sct.c +++ b/drivers/usb/serial/kobil_sct.c | |||
@@ -335,7 +335,8 @@ static int kobil_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
335 | port->interrupt_out_urb->transfer_buffer_length = length; | 335 | port->interrupt_out_urb->transfer_buffer_length = length; |
336 | 336 | ||
337 | priv->cur_pos = priv->cur_pos + length; | 337 | priv->cur_pos = priv->cur_pos + length; |
338 | result = usb_submit_urb(port->interrupt_out_urb, GFP_NOIO); | 338 | result = usb_submit_urb(port->interrupt_out_urb, |
339 | GFP_ATOMIC); | ||
339 | dev_dbg(&port->dev, "%s - Send write URB returns: %i\n", __func__, result); | 340 | dev_dbg(&port->dev, "%s - Send write URB returns: %i\n", __func__, result); |
340 | todo = priv->filled - priv->cur_pos; | 341 | todo = priv->filled - priv->cur_pos; |
341 | 342 | ||
@@ -350,7 +351,7 @@ static int kobil_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
350 | if (priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID || | 351 | if (priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID || |
351 | priv->device_type == KOBIL_ADAPTER_K_PRODUCT_ID) { | 352 | priv->device_type == KOBIL_ADAPTER_K_PRODUCT_ID) { |
352 | result = usb_submit_urb(port->interrupt_in_urb, | 353 | result = usb_submit_urb(port->interrupt_in_urb, |
353 | GFP_NOIO); | 354 | GFP_ATOMIC); |
354 | dev_dbg(&port->dev, "%s - Send read URB returns: %i\n", __func__, result); | 355 | dev_dbg(&port->dev, "%s - Send read URB returns: %i\n", __func__, result); |
355 | } | 356 | } |
356 | } | 357 | } |
@@ -414,8 +415,6 @@ static int kobil_tiocmset(struct tty_struct *tty, | |||
414 | int result; | 415 | int result; |
415 | int dtr = 0; | 416 | int dtr = 0; |
416 | int rts = 0; | 417 | int rts = 0; |
417 | unsigned char *transfer_buffer; | ||
418 | int transfer_buffer_length = 8; | ||
419 | 418 | ||
420 | /* FIXME: locking ? */ | 419 | /* FIXME: locking ? */ |
421 | priv = usb_get_serial_port_data(port); | 420 | priv = usb_get_serial_port_data(port); |
@@ -425,11 +424,6 @@ static int kobil_tiocmset(struct tty_struct *tty, | |||
425 | return -EINVAL; | 424 | return -EINVAL; |
426 | } | 425 | } |
427 | 426 | ||
428 | /* allocate memory for transfer buffer */ | ||
429 | transfer_buffer = kzalloc(transfer_buffer_length, GFP_KERNEL); | ||
430 | if (!transfer_buffer) | ||
431 | return -ENOMEM; | ||
432 | |||
433 | if (set & TIOCM_RTS) | 427 | if (set & TIOCM_RTS) |
434 | rts = 1; | 428 | rts = 1; |
435 | if (set & TIOCM_DTR) | 429 | if (set & TIOCM_DTR) |
@@ -469,7 +463,6 @@ static int kobil_tiocmset(struct tty_struct *tty, | |||
469 | KOBIL_TIMEOUT); | 463 | KOBIL_TIMEOUT); |
470 | } | 464 | } |
471 | dev_dbg(dev, "%s - Send set_status_line URB returns: %i\n", __func__, result); | 465 | dev_dbg(dev, "%s - Send set_status_line URB returns: %i\n", __func__, result); |
472 | kfree(transfer_buffer); | ||
473 | return (result < 0) ? result : 0; | 466 | return (result < 0) ? result : 0; |
474 | } | 467 | } |
475 | 468 | ||
@@ -530,8 +523,6 @@ static int kobil_ioctl(struct tty_struct *tty, | |||
530 | { | 523 | { |
531 | struct usb_serial_port *port = tty->driver_data; | 524 | struct usb_serial_port *port = tty->driver_data; |
532 | struct kobil_private *priv = usb_get_serial_port_data(port); | 525 | struct kobil_private *priv = usb_get_serial_port_data(port); |
533 | unsigned char *transfer_buffer; | ||
534 | int transfer_buffer_length = 8; | ||
535 | int result; | 526 | int result; |
536 | 527 | ||
537 | if (priv->device_type == KOBIL_USBTWIN_PRODUCT_ID || | 528 | if (priv->device_type == KOBIL_USBTWIN_PRODUCT_ID || |
@@ -541,10 +532,6 @@ static int kobil_ioctl(struct tty_struct *tty, | |||
541 | 532 | ||
542 | switch (cmd) { | 533 | switch (cmd) { |
543 | case TCFLSH: | 534 | case TCFLSH: |
544 | transfer_buffer = kmalloc(transfer_buffer_length, GFP_KERNEL); | ||
545 | if (!transfer_buffer) | ||
546 | return -ENOBUFS; | ||
547 | |||
548 | result = usb_control_msg(port->serial->dev, | 535 | result = usb_control_msg(port->serial->dev, |
549 | usb_sndctrlpipe(port->serial->dev, 0), | 536 | usb_sndctrlpipe(port->serial->dev, 0), |
550 | SUSBCRequest_Misc, | 537 | SUSBCRequest_Misc, |
@@ -559,7 +546,6 @@ static int kobil_ioctl(struct tty_struct *tty, | |||
559 | dev_dbg(&port->dev, | 546 | dev_dbg(&port->dev, |
560 | "%s - Send reset_all_queues (FLUSH) URB returns: %i\n", | 547 | "%s - Send reset_all_queues (FLUSH) URB returns: %i\n", |
561 | __func__, result); | 548 | __func__, result); |
562 | kfree(transfer_buffer); | ||
563 | return (result < 0) ? -EIO: 0; | 549 | return (result < 0) ? -EIO: 0; |
564 | default: | 550 | default: |
565 | return -ENOIOCTLCMD; | 551 | return -ENOIOCTLCMD; |
diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c index 4856fb7e637e..4b7bfb394a32 100644 --- a/drivers/usb/serial/opticon.c +++ b/drivers/usb/serial/opticon.c | |||
@@ -215,7 +215,7 @@ static int opticon_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
215 | 215 | ||
216 | /* The connected devices do not have a bulk write endpoint, | 216 | /* The connected devices do not have a bulk write endpoint, |
217 | * to transmit data to de barcode device the control endpoint is used */ | 217 | * to transmit data to de barcode device the control endpoint is used */ |
218 | dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_NOIO); | 218 | dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_ATOMIC); |
219 | if (!dr) { | 219 | if (!dr) { |
220 | count = -ENOMEM; | 220 | count = -ENOMEM; |
221 | goto error_no_dr; | 221 | goto error_no_dr; |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index d1a3f6044c8a..7a4c21b4f676 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -269,6 +269,7 @@ static void option_instat_callback(struct urb *urb); | |||
269 | #define TELIT_PRODUCT_DE910_DUAL 0x1010 | 269 | #define TELIT_PRODUCT_DE910_DUAL 0x1010 |
270 | #define TELIT_PRODUCT_UE910_V2 0x1012 | 270 | #define TELIT_PRODUCT_UE910_V2 0x1012 |
271 | #define TELIT_PRODUCT_LE920 0x1200 | 271 | #define TELIT_PRODUCT_LE920 0x1200 |
272 | #define TELIT_PRODUCT_LE910 0x1201 | ||
272 | 273 | ||
273 | /* ZTE PRODUCTS */ | 274 | /* ZTE PRODUCTS */ |
274 | #define ZTE_VENDOR_ID 0x19d2 | 275 | #define ZTE_VENDOR_ID 0x19d2 |
@@ -362,6 +363,7 @@ static void option_instat_callback(struct urb *urb); | |||
362 | 363 | ||
363 | /* Haier products */ | 364 | /* Haier products */ |
364 | #define HAIER_VENDOR_ID 0x201e | 365 | #define HAIER_VENDOR_ID 0x201e |
366 | #define HAIER_PRODUCT_CE81B 0x10f8 | ||
365 | #define HAIER_PRODUCT_CE100 0x2009 | 367 | #define HAIER_PRODUCT_CE100 0x2009 |
366 | 368 | ||
367 | /* Cinterion (formerly Siemens) products */ | 369 | /* Cinterion (formerly Siemens) products */ |
@@ -589,6 +591,11 @@ static const struct option_blacklist_info zte_1255_blacklist = { | |||
589 | .reserved = BIT(3) | BIT(4), | 591 | .reserved = BIT(3) | BIT(4), |
590 | }; | 592 | }; |
591 | 593 | ||
594 | static const struct option_blacklist_info telit_le910_blacklist = { | ||
595 | .sendsetup = BIT(0), | ||
596 | .reserved = BIT(1) | BIT(2), | ||
597 | }; | ||
598 | |||
592 | static const struct option_blacklist_info telit_le920_blacklist = { | 599 | static const struct option_blacklist_info telit_le920_blacklist = { |
593 | .sendsetup = BIT(0), | 600 | .sendsetup = BIT(0), |
594 | .reserved = BIT(1) | BIT(5), | 601 | .reserved = BIT(1) | BIT(5), |
@@ -1138,6 +1145,8 @@ static const struct usb_device_id option_ids[] = { | |||
1138 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_CC864_SINGLE) }, | 1145 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_CC864_SINGLE) }, |
1139 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_DE910_DUAL) }, | 1146 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_DE910_DUAL) }, |
1140 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UE910_V2) }, | 1147 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UE910_V2) }, |
1148 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910), | ||
1149 | .driver_info = (kernel_ulong_t)&telit_le910_blacklist }, | ||
1141 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920), | 1150 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920), |
1142 | .driver_info = (kernel_ulong_t)&telit_le920_blacklist }, | 1151 | .driver_info = (kernel_ulong_t)&telit_le920_blacklist }, |
1143 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */ | 1152 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */ |
@@ -1621,6 +1630,7 @@ static const struct usb_device_id option_ids[] = { | |||
1621 | { USB_DEVICE(LONGCHEER_VENDOR_ID, ZOOM_PRODUCT_4597) }, | 1630 | { USB_DEVICE(LONGCHEER_VENDOR_ID, ZOOM_PRODUCT_4597) }, |
1622 | { USB_DEVICE(LONGCHEER_VENDOR_ID, IBALL_3_5G_CONNECT) }, | 1631 | { USB_DEVICE(LONGCHEER_VENDOR_ID, IBALL_3_5G_CONNECT) }, |
1623 | { USB_DEVICE(HAIER_VENDOR_ID, HAIER_PRODUCT_CE100) }, | 1632 | { USB_DEVICE(HAIER_VENDOR_ID, HAIER_PRODUCT_CE100) }, |
1633 | { USB_DEVICE_AND_INTERFACE_INFO(HAIER_VENDOR_ID, HAIER_PRODUCT_CE81B, 0xff, 0xff, 0xff) }, | ||
1624 | /* Pirelli */ | 1634 | /* Pirelli */ |
1625 | { USB_DEVICE_INTERFACE_CLASS(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_C100_1, 0xff) }, | 1635 | { USB_DEVICE_INTERFACE_CLASS(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_C100_1, 0xff) }, |
1626 | { USB_DEVICE_INTERFACE_CLASS(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_C100_2, 0xff) }, | 1636 | { USB_DEVICE_INTERFACE_CLASS(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_C100_2, 0xff) }, |
diff --git a/drivers/usb/storage/initializers.c b/drivers/usb/storage/initializers.c index 4bc2fc98636e..73f125e0cb58 100644 --- a/drivers/usb/storage/initializers.c +++ b/drivers/usb/storage/initializers.c | |||
@@ -52,7 +52,7 @@ int usb_stor_euscsi_init(struct us_data *us) | |||
52 | us->iobuf[0] = 0x1; | 52 | us->iobuf[0] = 0x1; |
53 | result = usb_stor_control_msg(us, us->send_ctrl_pipe, | 53 | result = usb_stor_control_msg(us, us->send_ctrl_pipe, |
54 | 0x0C, USB_RECIP_INTERFACE | USB_TYPE_VENDOR, | 54 | 0x0C, USB_RECIP_INTERFACE | USB_TYPE_VENDOR, |
55 | 0x01, 0x0, us->iobuf, 0x1, USB_CTRL_SET_TIMEOUT); | 55 | 0x01, 0x0, us->iobuf, 0x1, 5 * HZ); |
56 | usb_stor_dbg(us, "-- result is %d\n", result); | 56 | usb_stor_dbg(us, "-- result is %d\n", result); |
57 | 57 | ||
58 | return 0; | 58 | return 0; |
@@ -100,7 +100,7 @@ int usb_stor_huawei_e220_init(struct us_data *us) | |||
100 | result = usb_stor_control_msg(us, us->send_ctrl_pipe, | 100 | result = usb_stor_control_msg(us, us->send_ctrl_pipe, |
101 | USB_REQ_SET_FEATURE, | 101 | USB_REQ_SET_FEATURE, |
102 | USB_TYPE_STANDARD | USB_RECIP_DEVICE, | 102 | USB_TYPE_STANDARD | USB_RECIP_DEVICE, |
103 | 0x01, 0x0, NULL, 0x0, 1000); | 103 | 0x01, 0x0, NULL, 0x0, 1 * HZ); |
104 | usb_stor_dbg(us, "Huawei mode set result is %d\n", result); | 104 | usb_stor_dbg(us, "Huawei mode set result is %d\n", result); |
105 | return 0; | 105 | return 0; |
106 | } | 106 | } |
diff --git a/drivers/usb/storage/realtek_cr.c b/drivers/usb/storage/realtek_cr.c index 8591d89a38e6..27e4a580d2ed 100644 --- a/drivers/usb/storage/realtek_cr.c +++ b/drivers/usb/storage/realtek_cr.c | |||
@@ -626,6 +626,7 @@ static int config_autodelink_after_power_on(struct us_data *us) | |||
626 | return 0; | 626 | return 0; |
627 | } | 627 | } |
628 | 628 | ||
629 | #ifdef CONFIG_PM | ||
629 | static int config_autodelink_before_power_down(struct us_data *us) | 630 | static int config_autodelink_before_power_down(struct us_data *us) |
630 | { | 631 | { |
631 | struct rts51x_chip *chip = (struct rts51x_chip *)(us->extra); | 632 | struct rts51x_chip *chip = (struct rts51x_chip *)(us->extra); |
@@ -716,6 +717,7 @@ static void fw5895_init(struct us_data *us) | |||
716 | } | 717 | } |
717 | } | 718 | } |
718 | } | 719 | } |
720 | #endif | ||
719 | 721 | ||
720 | #ifdef CONFIG_REALTEK_AUTOPM | 722 | #ifdef CONFIG_REALTEK_AUTOPM |
721 | static void fw5895_set_mmc_wp(struct us_data *us) | 723 | static void fw5895_set_mmc_wp(struct us_data *us) |
diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c index 22c7d4360fa2..b1d815eb6d0b 100644 --- a/drivers/usb/storage/transport.c +++ b/drivers/usb/storage/transport.c | |||
@@ -1118,6 +1118,31 @@ int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
1118 | */ | 1118 | */ |
1119 | if (result == USB_STOR_XFER_LONG) | 1119 | if (result == USB_STOR_XFER_LONG) |
1120 | fake_sense = 1; | 1120 | fake_sense = 1; |
1121 | |||
1122 | /* | ||
1123 | * Sometimes a device will mistakenly skip the data phase | ||
1124 | * and go directly to the status phase without sending a | ||
1125 | * zero-length packet. If we get a 13-byte response here, | ||
1126 | * check whether it really is a CSW. | ||
1127 | */ | ||
1128 | if (result == USB_STOR_XFER_SHORT && | ||
1129 | srb->sc_data_direction == DMA_FROM_DEVICE && | ||
1130 | transfer_length - scsi_get_resid(srb) == | ||
1131 | US_BULK_CS_WRAP_LEN) { | ||
1132 | struct scatterlist *sg = NULL; | ||
1133 | unsigned int offset = 0; | ||
1134 | |||
1135 | if (usb_stor_access_xfer_buf((unsigned char *) bcs, | ||
1136 | US_BULK_CS_WRAP_LEN, srb, &sg, | ||
1137 | &offset, FROM_XFER_BUF) == | ||
1138 | US_BULK_CS_WRAP_LEN && | ||
1139 | bcs->Signature == | ||
1140 | cpu_to_le32(US_BULK_CS_SIGN)) { | ||
1141 | usb_stor_dbg(us, "Device skipped data phase\n"); | ||
1142 | scsi_set_resid(srb, transfer_length); | ||
1143 | goto skipped_data_phase; | ||
1144 | } | ||
1145 | } | ||
1121 | } | 1146 | } |
1122 | 1147 | ||
1123 | /* See flow chart on pg 15 of the Bulk Only Transport spec for | 1148 | /* See flow chart on pg 15 of the Bulk Only Transport spec for |
@@ -1153,6 +1178,7 @@ int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
1153 | if (result != USB_STOR_XFER_GOOD) | 1178 | if (result != USB_STOR_XFER_GOOD) |
1154 | return USB_STOR_TRANSPORT_ERROR; | 1179 | return USB_STOR_TRANSPORT_ERROR; |
1155 | 1180 | ||
1181 | skipped_data_phase: | ||
1156 | /* check bulk status */ | 1182 | /* check bulk status */ |
1157 | residue = le32_to_cpu(bcs->Residue); | 1183 | residue = le32_to_cpu(bcs->Residue); |
1158 | usb_stor_dbg(us, "Bulk Status S 0x%x T 0x%x R %u Stat 0x%x\n", | 1184 | usb_stor_dbg(us, "Bulk Status S 0x%x T 0x%x R %u Stat 0x%x\n", |
diff --git a/drivers/usb/storage/unusual_uas.h b/drivers/usb/storage/unusual_uas.h index 8511b54a65d9..2fefaf923e4a 100644 --- a/drivers/usb/storage/unusual_uas.h +++ b/drivers/usb/storage/unusual_uas.h | |||
@@ -54,6 +54,20 @@ UNUSUAL_DEV(0x0bc2, 0x3312, 0x0000, 0x9999, | |||
54 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 54 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
55 | US_FL_NO_ATA_1X), | 55 | US_FL_NO_ATA_1X), |
56 | 56 | ||
57 | /* Reported-by: Hans de Goede <hdegoede@redhat.com> */ | ||
58 | UNUSUAL_DEV(0x0bc2, 0x3320, 0x0000, 0x9999, | ||
59 | "Seagate", | ||
60 | "Expansion Desk", | ||
61 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
62 | US_FL_NO_ATA_1X), | ||
63 | |||
64 | /* Reported-by: Bogdan Mihalcea <bogdan.mihalcea@infim.ro> */ | ||
65 | UNUSUAL_DEV(0x0bc2, 0xa003, 0x0000, 0x9999, | ||
66 | "Seagate", | ||
67 | "Backup Plus", | ||
68 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
69 | US_FL_NO_ATA_1X), | ||
70 | |||
57 | /* https://bbs.archlinux.org/viewtopic.php?id=183190 */ | 71 | /* https://bbs.archlinux.org/viewtopic.php?id=183190 */ |
58 | UNUSUAL_DEV(0x0bc2, 0xab20, 0x0000, 0x9999, | 72 | UNUSUAL_DEV(0x0bc2, 0xab20, 0x0000, 0x9999, |
59 | "Seagate", | 73 | "Seagate", |
@@ -61,6 +75,13 @@ UNUSUAL_DEV(0x0bc2, 0xab20, 0x0000, 0x9999, | |||
61 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 75 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
62 | US_FL_NO_ATA_1X), | 76 | US_FL_NO_ATA_1X), |
63 | 77 | ||
78 | /* https://bbs.archlinux.org/viewtopic.php?id=183190 */ | ||
79 | UNUSUAL_DEV(0x0bc2, 0xab21, 0x0000, 0x9999, | ||
80 | "Seagate", | ||
81 | "Backup+ BK", | ||
82 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
83 | US_FL_NO_ATA_1X), | ||
84 | |||
64 | /* Reported-by: Claudio Bizzarri <claudio.bizzarri@gmail.com> */ | 85 | /* Reported-by: Claudio Bizzarri <claudio.bizzarri@gmail.com> */ |
65 | UNUSUAL_DEV(0x152d, 0x0567, 0x0000, 0x9999, | 86 | UNUSUAL_DEV(0x152d, 0x0567, 0x0000, 0x9999, |
66 | "JMicron", | 87 | "JMicron", |
@@ -75,3 +96,10 @@ UNUSUAL_DEV(0x174c, 0x5106, 0x0000, 0x9999, | |||
75 | "ASM1051", | 96 | "ASM1051", |
76 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 97 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
77 | US_FL_IGNORE_UAS), | 98 | US_FL_IGNORE_UAS), |
99 | |||
100 | /* Reported-by: Hans de Goede <hdegoede@redhat.com> */ | ||
101 | UNUSUAL_DEV(0x2109, 0x0711, 0x0000, 0x9999, | ||
102 | "VIA", | ||
103 | "VL711", | ||
104 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
105 | US_FL_NO_ATA_1X), | ||
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c index 57b1d44acbfe..eb976ee3a02f 100644 --- a/drivers/video/console/fbcon.c +++ b/drivers/video/console/fbcon.c | |||
@@ -448,8 +448,10 @@ static int __init fb_console_setup(char *this_opt) | |||
448 | return 1; | 448 | return 1; |
449 | 449 | ||
450 | while ((options = strsep(&this_opt, ",")) != NULL) { | 450 | while ((options = strsep(&this_opt, ",")) != NULL) { |
451 | if (!strncmp(options, "font:", 5)) | 451 | if (!strncmp(options, "font:", 5)) { |
452 | strlcpy(fontname, options + 5, sizeof(fontname)); | 452 | strlcpy(fontname, options + 5, sizeof(fontname)); |
453 | continue; | ||
454 | } | ||
453 | 455 | ||
454 | if (!strncmp(options, "scrollback:", 11)) { | 456 | if (!strncmp(options, "scrollback:", 11)) { |
455 | options += 11; | 457 | options += 11; |
@@ -457,13 +459,9 @@ static int __init fb_console_setup(char *this_opt) | |||
457 | fbcon_softback_size = simple_strtoul(options, &options, 0); | 459 | fbcon_softback_size = simple_strtoul(options, &options, 0); |
458 | if (*options == 'k' || *options == 'K') { | 460 | if (*options == 'k' || *options == 'K') { |
459 | fbcon_softback_size *= 1024; | 461 | fbcon_softback_size *= 1024; |
460 | options++; | ||
461 | } | 462 | } |
462 | if (*options != ',') | 463 | } |
463 | return 1; | 464 | continue; |
464 | options++; | ||
465 | } else | ||
466 | return 1; | ||
467 | } | 465 | } |
468 | 466 | ||
469 | if (!strncmp(options, "map:", 4)) { | 467 | if (!strncmp(options, "map:", 4)) { |
@@ -478,8 +476,7 @@ static int __init fb_console_setup(char *this_opt) | |||
478 | 476 | ||
479 | fbcon_map_override(); | 477 | fbcon_map_override(); |
480 | } | 478 | } |
481 | 479 | continue; | |
482 | return 1; | ||
483 | } | 480 | } |
484 | 481 | ||
485 | if (!strncmp(options, "vc:", 3)) { | 482 | if (!strncmp(options, "vc:", 3)) { |
@@ -491,7 +488,8 @@ static int __init fb_console_setup(char *this_opt) | |||
491 | if (*options++ == '-') | 488 | if (*options++ == '-') |
492 | last_fb_vc = simple_strtoul(options, &options, 10) - 1; | 489 | last_fb_vc = simple_strtoul(options, &options, 10) - 1; |
493 | fbcon_is_default = 0; | 490 | fbcon_is_default = 0; |
494 | } | 491 | continue; |
492 | } | ||
495 | 493 | ||
496 | if (!strncmp(options, "rotate:", 7)) { | 494 | if (!strncmp(options, "rotate:", 7)) { |
497 | options += 7; | 495 | options += 7; |
@@ -499,6 +497,7 @@ static int __init fb_console_setup(char *this_opt) | |||
499 | initial_rotation = simple_strtoul(options, &options, 0); | 497 | initial_rotation = simple_strtoul(options, &options, 0); |
500 | if (initial_rotation > 3) | 498 | if (initial_rotation > 3) |
501 | initial_rotation = 0; | 499 | initial_rotation = 0; |
500 | continue; | ||
502 | } | 501 | } |
503 | } | 502 | } |
504 | return 1; | 503 | return 1; |
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c index 6e6aa704fe84..517f565b65d7 100644 --- a/drivers/video/console/vgacon.c +++ b/drivers/video/console/vgacon.c | |||
@@ -56,7 +56,7 @@ static int cursor_size_lastfrom; | |||
56 | static int cursor_size_lastto; | 56 | static int cursor_size_lastto; |
57 | static u32 vgacon_xres; | 57 | static u32 vgacon_xres; |
58 | static u32 vgacon_yres; | 58 | static u32 vgacon_yres; |
59 | static struct vgastate state; | 59 | static struct vgastate vgastate; |
60 | 60 | ||
61 | #define BLANK 0x0020 | 61 | #define BLANK 0x0020 |
62 | 62 | ||
@@ -400,7 +400,7 @@ static const char *vgacon_startup(void) | |||
400 | 400 | ||
401 | vga_video_num_lines = screen_info.orig_video_lines; | 401 | vga_video_num_lines = screen_info.orig_video_lines; |
402 | vga_video_num_columns = screen_info.orig_video_cols; | 402 | vga_video_num_columns = screen_info.orig_video_cols; |
403 | state.vgabase = NULL; | 403 | vgastate.vgabase = NULL; |
404 | 404 | ||
405 | if (screen_info.orig_video_mode == 7) { | 405 | if (screen_info.orig_video_mode == 7) { |
406 | /* Monochrome display */ | 406 | /* Monochrome display */ |
@@ -851,12 +851,12 @@ static void vga_set_palette(struct vc_data *vc, unsigned char *table) | |||
851 | { | 851 | { |
852 | int i, j; | 852 | int i, j; |
853 | 853 | ||
854 | vga_w(state.vgabase, VGA_PEL_MSK, 0xff); | 854 | vga_w(vgastate.vgabase, VGA_PEL_MSK, 0xff); |
855 | for (i = j = 0; i < 16; i++) { | 855 | for (i = j = 0; i < 16; i++) { |
856 | vga_w(state.vgabase, VGA_PEL_IW, table[i]); | 856 | vga_w(vgastate.vgabase, VGA_PEL_IW, table[i]); |
857 | vga_w(state.vgabase, VGA_PEL_D, vc->vc_palette[j++] >> 2); | 857 | vga_w(vgastate.vgabase, VGA_PEL_D, vc->vc_palette[j++] >> 2); |
858 | vga_w(state.vgabase, VGA_PEL_D, vc->vc_palette[j++] >> 2); | 858 | vga_w(vgastate.vgabase, VGA_PEL_D, vc->vc_palette[j++] >> 2); |
859 | vga_w(state.vgabase, VGA_PEL_D, vc->vc_palette[j++] >> 2); | 859 | vga_w(vgastate.vgabase, VGA_PEL_D, vc->vc_palette[j++] >> 2); |
860 | } | 860 | } |
861 | } | 861 | } |
862 | 862 | ||
@@ -1008,7 +1008,7 @@ static int vgacon_blank(struct vc_data *c, int blank, int mode_switch) | |||
1008 | switch (blank) { | 1008 | switch (blank) { |
1009 | case 0: /* Unblank */ | 1009 | case 0: /* Unblank */ |
1010 | if (vga_vesa_blanked) { | 1010 | if (vga_vesa_blanked) { |
1011 | vga_vesa_unblank(&state); | 1011 | vga_vesa_unblank(&vgastate); |
1012 | vga_vesa_blanked = 0; | 1012 | vga_vesa_blanked = 0; |
1013 | } | 1013 | } |
1014 | if (vga_palette_blanked) { | 1014 | if (vga_palette_blanked) { |
@@ -1022,7 +1022,7 @@ static int vgacon_blank(struct vc_data *c, int blank, int mode_switch) | |||
1022 | case 1: /* Normal blanking */ | 1022 | case 1: /* Normal blanking */ |
1023 | case -1: /* Obsolete */ | 1023 | case -1: /* Obsolete */ |
1024 | if (!mode_switch && vga_video_type == VIDEO_TYPE_VGAC) { | 1024 | if (!mode_switch && vga_video_type == VIDEO_TYPE_VGAC) { |
1025 | vga_pal_blank(&state); | 1025 | vga_pal_blank(&vgastate); |
1026 | vga_palette_blanked = 1; | 1026 | vga_palette_blanked = 1; |
1027 | return 0; | 1027 | return 0; |
1028 | } | 1028 | } |
@@ -1034,7 +1034,7 @@ static int vgacon_blank(struct vc_data *c, int blank, int mode_switch) | |||
1034 | return 1; | 1034 | return 1; |
1035 | default: /* VESA blanking */ | 1035 | default: /* VESA blanking */ |
1036 | if (vga_video_type == VIDEO_TYPE_VGAC) { | 1036 | if (vga_video_type == VIDEO_TYPE_VGAC) { |
1037 | vga_vesa_blank(&state, blank - 1); | 1037 | vga_vesa_blank(&vgastate, blank - 1); |
1038 | vga_vesa_blanked = blank; | 1038 | vga_vesa_blanked = blank; |
1039 | } | 1039 | } |
1040 | return 0; | 1040 | return 0; |
@@ -1280,7 +1280,7 @@ static int vgacon_font_set(struct vc_data *c, struct console_font *font, unsigne | |||
1280 | (charcount != 256 && charcount != 512)) | 1280 | (charcount != 256 && charcount != 512)) |
1281 | return -EINVAL; | 1281 | return -EINVAL; |
1282 | 1282 | ||
1283 | rc = vgacon_do_font_op(&state, font->data, 1, charcount == 512); | 1283 | rc = vgacon_do_font_op(&vgastate, font->data, 1, charcount == 512); |
1284 | if (rc) | 1284 | if (rc) |
1285 | return rc; | 1285 | return rc; |
1286 | 1286 | ||
@@ -1299,7 +1299,7 @@ static int vgacon_font_get(struct vc_data *c, struct console_font *font) | |||
1299 | font->charcount = vga_512_chars ? 512 : 256; | 1299 | font->charcount = vga_512_chars ? 512 : 256; |
1300 | if (!font->data) | 1300 | if (!font->data) |
1301 | return 0; | 1301 | return 0; |
1302 | return vgacon_do_font_op(&state, font->data, 0, vga_512_chars); | 1302 | return vgacon_do_font_op(&vgastate, font->data, 0, vga_512_chars); |
1303 | } | 1303 | } |
1304 | 1304 | ||
1305 | #else | 1305 | #else |
diff --git a/drivers/video/fbdev/atmel_lcdfb.c b/drivers/video/fbdev/atmel_lcdfb.c index 3bf403150a2d..9ec81d46fc57 100644 --- a/drivers/video/fbdev/atmel_lcdfb.c +++ b/drivers/video/fbdev/atmel_lcdfb.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <linux/regulator/consumer.h> | 27 | #include <linux/regulator/consumer.h> |
28 | #include <video/videomode.h> | 28 | #include <video/videomode.h> |
29 | 29 | ||
30 | #include <mach/cpu.h> | ||
31 | #include <asm/gpio.h> | 30 | #include <asm/gpio.h> |
32 | 31 | ||
33 | #include <video/atmel_lcdc.h> | 32 | #include <video/atmel_lcdc.h> |
diff --git a/drivers/video/fbdev/omap2/displays-new/connector-analog-tv.c b/drivers/video/fbdev/omap2/displays-new/connector-analog-tv.c index 5ee3b5505f7f..91921665b98b 100644 --- a/drivers/video/fbdev/omap2/displays-new/connector-analog-tv.c +++ b/drivers/video/fbdev/omap2/displays-new/connector-analog-tv.c | |||
@@ -301,6 +301,8 @@ static const struct of_device_id tvc_of_match[] = { | |||
301 | {}, | 301 | {}, |
302 | }; | 302 | }; |
303 | 303 | ||
304 | MODULE_DEVICE_TABLE(of, tvc_of_match); | ||
305 | |||
304 | static struct platform_driver tvc_connector_driver = { | 306 | static struct platform_driver tvc_connector_driver = { |
305 | .probe = tvc_probe, | 307 | .probe = tvc_probe, |
306 | .remove = __exit_p(tvc_remove), | 308 | .remove = __exit_p(tvc_remove), |
@@ -308,6 +310,7 @@ static struct platform_driver tvc_connector_driver = { | |||
308 | .name = "connector-analog-tv", | 310 | .name = "connector-analog-tv", |
309 | .owner = THIS_MODULE, | 311 | .owner = THIS_MODULE, |
310 | .of_match_table = tvc_of_match, | 312 | .of_match_table = tvc_of_match, |
313 | .suppress_bind_attrs = true, | ||
311 | }, | 314 | }, |
312 | }; | 315 | }; |
313 | 316 | ||
diff --git a/drivers/video/fbdev/omap2/displays-new/connector-dvi.c b/drivers/video/fbdev/omap2/displays-new/connector-dvi.c index 74de2bc50c4f..2dfb6e5ff0cc 100644 --- a/drivers/video/fbdev/omap2/displays-new/connector-dvi.c +++ b/drivers/video/fbdev/omap2/displays-new/connector-dvi.c | |||
@@ -391,6 +391,7 @@ static struct platform_driver dvi_connector_driver = { | |||
391 | .name = "connector-dvi", | 391 | .name = "connector-dvi", |
392 | .owner = THIS_MODULE, | 392 | .owner = THIS_MODULE, |
393 | .of_match_table = dvic_of_match, | 393 | .of_match_table = dvic_of_match, |
394 | .suppress_bind_attrs = true, | ||
394 | }, | 395 | }, |
395 | }; | 396 | }; |
396 | 397 | ||
diff --git a/drivers/video/fbdev/omap2/displays-new/connector-hdmi.c b/drivers/video/fbdev/omap2/displays-new/connector-hdmi.c index 131c6e260898..7b25967a91eb 100644 --- a/drivers/video/fbdev/omap2/displays-new/connector-hdmi.c +++ b/drivers/video/fbdev/omap2/displays-new/connector-hdmi.c | |||
@@ -437,6 +437,7 @@ static struct platform_driver hdmi_connector_driver = { | |||
437 | .name = "connector-hdmi", | 437 | .name = "connector-hdmi", |
438 | .owner = THIS_MODULE, | 438 | .owner = THIS_MODULE, |
439 | .of_match_table = hdmic_of_match, | 439 | .of_match_table = hdmic_of_match, |
440 | .suppress_bind_attrs = true, | ||
440 | }, | 441 | }, |
441 | }; | 442 | }; |
442 | 443 | ||
diff --git a/drivers/video/fbdev/omap2/displays-new/encoder-tfp410.c b/drivers/video/fbdev/omap2/displays-new/encoder-tfp410.c index b4e9a42a79e6..47ee7cdee1c5 100644 --- a/drivers/video/fbdev/omap2/displays-new/encoder-tfp410.c +++ b/drivers/video/fbdev/omap2/displays-new/encoder-tfp410.c | |||
@@ -298,6 +298,7 @@ static struct platform_driver tfp410_driver = { | |||
298 | .name = "tfp410", | 298 | .name = "tfp410", |
299 | .owner = THIS_MODULE, | 299 | .owner = THIS_MODULE, |
300 | .of_match_table = tfp410_of_match, | 300 | .of_match_table = tfp410_of_match, |
301 | .suppress_bind_attrs = true, | ||
301 | }, | 302 | }, |
302 | }; | 303 | }; |
303 | 304 | ||
diff --git a/drivers/video/fbdev/omap2/displays-new/encoder-tpd12s015.c b/drivers/video/fbdev/omap2/displays-new/encoder-tpd12s015.c index c891d8f84cb2..c4abd56dd846 100644 --- a/drivers/video/fbdev/omap2/displays-new/encoder-tpd12s015.c +++ b/drivers/video/fbdev/omap2/displays-new/encoder-tpd12s015.c | |||
@@ -461,6 +461,7 @@ static struct platform_driver tpd_driver = { | |||
461 | .name = "tpd12s015", | 461 | .name = "tpd12s015", |
462 | .owner = THIS_MODULE, | 462 | .owner = THIS_MODULE, |
463 | .of_match_table = tpd_of_match, | 463 | .of_match_table = tpd_of_match, |
464 | .suppress_bind_attrs = true, | ||
464 | }, | 465 | }, |
465 | }; | 466 | }; |
466 | 467 | ||
diff --git a/drivers/video/fbdev/omap2/displays-new/panel-dpi.c b/drivers/video/fbdev/omap2/displays-new/panel-dpi.c index 3636b61dc9b4..a9c3dcf0f6b5 100644 --- a/drivers/video/fbdev/omap2/displays-new/panel-dpi.c +++ b/drivers/video/fbdev/omap2/displays-new/panel-dpi.c | |||
@@ -327,6 +327,7 @@ static struct platform_driver panel_dpi_driver = { | |||
327 | .name = "panel-dpi", | 327 | .name = "panel-dpi", |
328 | .owner = THIS_MODULE, | 328 | .owner = THIS_MODULE, |
329 | .of_match_table = panel_dpi_of_match, | 329 | .of_match_table = panel_dpi_of_match, |
330 | .suppress_bind_attrs = true, | ||
330 | }, | 331 | }, |
331 | }; | 332 | }; |
332 | 333 | ||
diff --git a/drivers/video/fbdev/omap2/displays-new/panel-dsi-cm.c b/drivers/video/fbdev/omap2/displays-new/panel-dsi-cm.c index d6f14e8717e8..899cb1ab523d 100644 --- a/drivers/video/fbdev/omap2/displays-new/panel-dsi-cm.c +++ b/drivers/video/fbdev/omap2/displays-new/panel-dsi-cm.c | |||
@@ -1378,6 +1378,7 @@ static struct platform_driver dsicm_driver = { | |||
1378 | .name = "panel-dsi-cm", | 1378 | .name = "panel-dsi-cm", |
1379 | .owner = THIS_MODULE, | 1379 | .owner = THIS_MODULE, |
1380 | .of_match_table = dsicm_of_match, | 1380 | .of_match_table = dsicm_of_match, |
1381 | .suppress_bind_attrs = true, | ||
1381 | }, | 1382 | }, |
1382 | }; | 1383 | }; |
1383 | 1384 | ||
diff --git a/drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c b/drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c index cc5b5124e0b4..27d4fcfa1824 100644 --- a/drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c +++ b/drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c | |||
@@ -394,6 +394,7 @@ static struct spi_driver lb035q02_spi_driver = { | |||
394 | .name = "panel_lgphilips_lb035q02", | 394 | .name = "panel_lgphilips_lb035q02", |
395 | .owner = THIS_MODULE, | 395 | .owner = THIS_MODULE, |
396 | .of_match_table = lb035q02_of_match, | 396 | .of_match_table = lb035q02_of_match, |
397 | .suppress_bind_attrs = true, | ||
397 | }, | 398 | }, |
398 | }; | 399 | }; |
399 | 400 | ||
diff --git a/drivers/video/fbdev/omap2/displays-new/panel-nec-nl8048hl11.c b/drivers/video/fbdev/omap2/displays-new/panel-nec-nl8048hl11.c index 3595f111aa35..ccf3f4f3c703 100644 --- a/drivers/video/fbdev/omap2/displays-new/panel-nec-nl8048hl11.c +++ b/drivers/video/fbdev/omap2/displays-new/panel-nec-nl8048hl11.c | |||
@@ -424,6 +424,7 @@ static struct spi_driver nec_8048_driver = { | |||
424 | .owner = THIS_MODULE, | 424 | .owner = THIS_MODULE, |
425 | .pm = NEC_8048_PM_OPS, | 425 | .pm = NEC_8048_PM_OPS, |
426 | .of_match_table = nec_8048_of_match, | 426 | .of_match_table = nec_8048_of_match, |
427 | .suppress_bind_attrs = true, | ||
427 | }, | 428 | }, |
428 | .probe = nec_8048_probe, | 429 | .probe = nec_8048_probe, |
429 | .remove = nec_8048_remove, | 430 | .remove = nec_8048_remove, |
diff --git a/drivers/video/fbdev/omap2/displays-new/panel-sharp-ls037v7dw01.c b/drivers/video/fbdev/omap2/displays-new/panel-sharp-ls037v7dw01.c index f1f72ce50a17..234142cc3764 100644 --- a/drivers/video/fbdev/omap2/displays-new/panel-sharp-ls037v7dw01.c +++ b/drivers/video/fbdev/omap2/displays-new/panel-sharp-ls037v7dw01.c | |||
@@ -410,6 +410,7 @@ static struct platform_driver sharp_ls_driver = { | |||
410 | .name = "panel-sharp-ls037v7dw01", | 410 | .name = "panel-sharp-ls037v7dw01", |
411 | .owner = THIS_MODULE, | 411 | .owner = THIS_MODULE, |
412 | .of_match_table = sharp_ls_of_match, | 412 | .of_match_table = sharp_ls_of_match, |
413 | .suppress_bind_attrs = true, | ||
413 | }, | 414 | }, |
414 | }; | 415 | }; |
415 | 416 | ||
diff --git a/drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c b/drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c index 617f8d2f5127..337ccc5c0f5e 100644 --- a/drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c +++ b/drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c | |||
@@ -904,6 +904,7 @@ static struct spi_driver acx565akm_driver = { | |||
904 | .name = "acx565akm", | 904 | .name = "acx565akm", |
905 | .owner = THIS_MODULE, | 905 | .owner = THIS_MODULE, |
906 | .of_match_table = acx565akm_of_match, | 906 | .of_match_table = acx565akm_of_match, |
907 | .suppress_bind_attrs = true, | ||
907 | }, | 908 | }, |
908 | .probe = acx565akm_probe, | 909 | .probe = acx565akm_probe, |
909 | .remove = acx565akm_remove, | 910 | .remove = acx565akm_remove, |
diff --git a/drivers/video/fbdev/omap2/displays-new/panel-tpo-td028ttec1.c b/drivers/video/fbdev/omap2/displays-new/panel-tpo-td028ttec1.c index 728808bcceeb..fbba0b8ca871 100644 --- a/drivers/video/fbdev/omap2/displays-new/panel-tpo-td028ttec1.c +++ b/drivers/video/fbdev/omap2/displays-new/panel-tpo-td028ttec1.c | |||
@@ -500,6 +500,7 @@ static struct spi_driver td028ttec1_spi_driver = { | |||
500 | .name = "panel-tpo-td028ttec1", | 500 | .name = "panel-tpo-td028ttec1", |
501 | .owner = THIS_MODULE, | 501 | .owner = THIS_MODULE, |
502 | .of_match_table = td028ttec1_of_match, | 502 | .of_match_table = td028ttec1_of_match, |
503 | .suppress_bind_attrs = true, | ||
503 | }, | 504 | }, |
504 | }; | 505 | }; |
505 | 506 | ||
diff --git a/drivers/video/fbdev/omap2/displays-new/panel-tpo-td043mtea1.c b/drivers/video/fbdev/omap2/displays-new/panel-tpo-td043mtea1.c index de78ab0caaa8..5aba76bca25a 100644 --- a/drivers/video/fbdev/omap2/displays-new/panel-tpo-td043mtea1.c +++ b/drivers/video/fbdev/omap2/displays-new/panel-tpo-td043mtea1.c | |||
@@ -673,6 +673,7 @@ static struct spi_driver tpo_td043_spi_driver = { | |||
673 | .owner = THIS_MODULE, | 673 | .owner = THIS_MODULE, |
674 | .pm = &tpo_td043_spi_pm, | 674 | .pm = &tpo_td043_spi_pm, |
675 | .of_match_table = tpo_td043_of_match, | 675 | .of_match_table = tpo_td043_of_match, |
676 | .suppress_bind_attrs = true, | ||
676 | }, | 677 | }, |
677 | .probe = tpo_td043_probe, | 678 | .probe = tpo_td043_probe, |
678 | .remove = tpo_td043_remove, | 679 | .remove = tpo_td043_remove, |
diff --git a/drivers/video/fbdev/omap2/dss/apply.c b/drivers/video/fbdev/omap2/dss/apply.c index 0a0b084ce65d..663ccc3bf4e5 100644 --- a/drivers/video/fbdev/omap2/dss/apply.c +++ b/drivers/video/fbdev/omap2/dss/apply.c | |||
@@ -1132,6 +1132,8 @@ static void dss_mgr_disable_compat(struct omap_overlay_manager *mgr) | |||
1132 | if (!mp->enabled) | 1132 | if (!mp->enabled) |
1133 | goto out; | 1133 | goto out; |
1134 | 1134 | ||
1135 | wait_pending_extra_info_updates(); | ||
1136 | |||
1135 | if (!mgr_manual_update(mgr)) | 1137 | if (!mgr_manual_update(mgr)) |
1136 | dispc_mgr_disable_sync(mgr->id); | 1138 | dispc_mgr_disable_sync(mgr->id); |
1137 | 1139 | ||
diff --git a/drivers/video/fbdev/omap2/dss/dispc.c b/drivers/video/fbdev/omap2/dss/dispc.c index be053aa80880..0e9a74bb9fc2 100644 --- a/drivers/video/fbdev/omap2/dss/dispc.c +++ b/drivers/video/fbdev/omap2/dss/dispc.c | |||
@@ -3290,8 +3290,11 @@ static void dispc_dump_regs(struct seq_file *s) | |||
3290 | DUMPREG(i, DISPC_OVL_FIFO_SIZE_STATUS); | 3290 | DUMPREG(i, DISPC_OVL_FIFO_SIZE_STATUS); |
3291 | DUMPREG(i, DISPC_OVL_ROW_INC); | 3291 | DUMPREG(i, DISPC_OVL_ROW_INC); |
3292 | DUMPREG(i, DISPC_OVL_PIXEL_INC); | 3292 | DUMPREG(i, DISPC_OVL_PIXEL_INC); |
3293 | |||
3293 | if (dss_has_feature(FEAT_PRELOAD)) | 3294 | if (dss_has_feature(FEAT_PRELOAD)) |
3294 | DUMPREG(i, DISPC_OVL_PRELOAD); | 3295 | DUMPREG(i, DISPC_OVL_PRELOAD); |
3296 | if (dss_has_feature(FEAT_MFLAG)) | ||
3297 | DUMPREG(i, DISPC_OVL_MFLAG_THRESHOLD); | ||
3295 | 3298 | ||
3296 | if (i == OMAP_DSS_GFX) { | 3299 | if (i == OMAP_DSS_GFX) { |
3297 | DUMPREG(i, DISPC_OVL_WINDOW_SKIP); | 3300 | DUMPREG(i, DISPC_OVL_WINDOW_SKIP); |
@@ -3312,10 +3315,6 @@ static void dispc_dump_regs(struct seq_file *s) | |||
3312 | } | 3315 | } |
3313 | if (dss_has_feature(FEAT_ATTR2)) | 3316 | if (dss_has_feature(FEAT_ATTR2)) |
3314 | DUMPREG(i, DISPC_OVL_ATTRIBUTES2); | 3317 | DUMPREG(i, DISPC_OVL_ATTRIBUTES2); |
3315 | if (dss_has_feature(FEAT_PRELOAD)) | ||
3316 | DUMPREG(i, DISPC_OVL_PRELOAD); | ||
3317 | if (dss_has_feature(FEAT_MFLAG)) | ||
3318 | DUMPREG(i, DISPC_OVL_MFLAG_THRESHOLD); | ||
3319 | } | 3318 | } |
3320 | 3319 | ||
3321 | #undef DISPC_REG | 3320 | #undef DISPC_REG |
@@ -3843,6 +3842,7 @@ static struct platform_driver omap_dispchw_driver = { | |||
3843 | .owner = THIS_MODULE, | 3842 | .owner = THIS_MODULE, |
3844 | .pm = &dispc_pm_ops, | 3843 | .pm = &dispc_pm_ops, |
3845 | .of_match_table = dispc_of_match, | 3844 | .of_match_table = dispc_of_match, |
3845 | .suppress_bind_attrs = true, | ||
3846 | }, | 3846 | }, |
3847 | }; | 3847 | }; |
3848 | 3848 | ||
diff --git a/drivers/video/fbdev/omap2/dss/dispc.h b/drivers/video/fbdev/omap2/dss/dispc.h index 78edb449c763..3043d6e0a5f9 100644 --- a/drivers/video/fbdev/omap2/dss/dispc.h +++ b/drivers/video/fbdev/omap2/dss/dispc.h | |||
@@ -101,8 +101,7 @@ | |||
101 | DISPC_FIR_COEF_V2_OFFSET(n, i)) | 101 | DISPC_FIR_COEF_V2_OFFSET(n, i)) |
102 | #define DISPC_OVL_PRELOAD(n) (DISPC_OVL_BASE(n) + \ | 102 | #define DISPC_OVL_PRELOAD(n) (DISPC_OVL_BASE(n) + \ |
103 | DISPC_PRELOAD_OFFSET(n)) | 103 | DISPC_PRELOAD_OFFSET(n)) |
104 | #define DISPC_OVL_MFLAG_THRESHOLD(n) (DISPC_OVL_BASE(n) + \ | 104 | #define DISPC_OVL_MFLAG_THRESHOLD(n) DISPC_MFLAG_THRESHOLD_OFFSET(n) |
105 | DISPC_MFLAG_THRESHOLD_OFFSET(n)) | ||
106 | 105 | ||
107 | /* DISPC up/downsampling FIR filter coefficient structure */ | 106 | /* DISPC up/downsampling FIR filter coefficient structure */ |
108 | struct dispc_coef { | 107 | struct dispc_coef { |
diff --git a/drivers/video/fbdev/omap2/dss/dpi.c b/drivers/video/fbdev/omap2/dss/dpi.c index 9368972d6962..4a3363dae74a 100644 --- a/drivers/video/fbdev/omap2/dss/dpi.c +++ b/drivers/video/fbdev/omap2/dss/dpi.c | |||
@@ -720,6 +720,7 @@ static struct platform_driver omap_dpi_driver = { | |||
720 | .driver = { | 720 | .driver = { |
721 | .name = "omapdss_dpi", | 721 | .name = "omapdss_dpi", |
722 | .owner = THIS_MODULE, | 722 | .owner = THIS_MODULE, |
723 | .suppress_bind_attrs = true, | ||
723 | }, | 724 | }, |
724 | }; | 725 | }; |
725 | 726 | ||
diff --git a/drivers/video/fbdev/omap2/dss/dsi.c b/drivers/video/fbdev/omap2/dss/dsi.c index b6f6ae1d4664..0793bc67a275 100644 --- a/drivers/video/fbdev/omap2/dss/dsi.c +++ b/drivers/video/fbdev/omap2/dss/dsi.c | |||
@@ -1603,7 +1603,7 @@ int dsi_pll_set_clock_div(struct platform_device *dsidev, | |||
1603 | } else if (dss_has_feature(FEAT_DSI_PLL_SELFREQDCO)) { | 1603 | } else if (dss_has_feature(FEAT_DSI_PLL_SELFREQDCO)) { |
1604 | f = cinfo->clkin4ddr < 1000000000 ? 0x2 : 0x4; | 1604 | f = cinfo->clkin4ddr < 1000000000 ? 0x2 : 0x4; |
1605 | 1605 | ||
1606 | l = FLD_MOD(l, f, 4, 1); /* PLL_SELFREQDCO */ | 1606 | l = FLD_MOD(l, f, 3, 1); /* PLL_SELFREQDCO */ |
1607 | } | 1607 | } |
1608 | 1608 | ||
1609 | l = FLD_MOD(l, 1, 13, 13); /* DSI_PLL_REFEN */ | 1609 | l = FLD_MOD(l, 1, 13, 13); /* DSI_PLL_REFEN */ |
@@ -5754,6 +5754,7 @@ static struct platform_driver omap_dsihw_driver = { | |||
5754 | .owner = THIS_MODULE, | 5754 | .owner = THIS_MODULE, |
5755 | .pm = &dsi_pm_ops, | 5755 | .pm = &dsi_pm_ops, |
5756 | .of_match_table = dsi_of_match, | 5756 | .of_match_table = dsi_of_match, |
5757 | .suppress_bind_attrs = true, | ||
5757 | }, | 5758 | }, |
5758 | }; | 5759 | }; |
5759 | 5760 | ||
diff --git a/drivers/video/fbdev/omap2/dss/dss.c b/drivers/video/fbdev/omap2/dss/dss.c index 6daeb7ed44c6..14bcd6c43f72 100644 --- a/drivers/video/fbdev/omap2/dss/dss.c +++ b/drivers/video/fbdev/omap2/dss/dss.c | |||
@@ -966,6 +966,7 @@ static struct platform_driver omap_dsshw_driver = { | |||
966 | .owner = THIS_MODULE, | 966 | .owner = THIS_MODULE, |
967 | .pm = &dss_pm_ops, | 967 | .pm = &dss_pm_ops, |
968 | .of_match_table = dss_of_match, | 968 | .of_match_table = dss_of_match, |
969 | .suppress_bind_attrs = true, | ||
969 | }, | 970 | }, |
970 | }; | 971 | }; |
971 | 972 | ||
diff --git a/drivers/video/fbdev/omap2/dss/hdmi4.c b/drivers/video/fbdev/omap2/dss/hdmi4.c index 6a8550cf43e5..9a8713ca090c 100644 --- a/drivers/video/fbdev/omap2/dss/hdmi4.c +++ b/drivers/video/fbdev/omap2/dss/hdmi4.c | |||
@@ -781,6 +781,7 @@ static struct platform_driver omapdss_hdmihw_driver = { | |||
781 | .owner = THIS_MODULE, | 781 | .owner = THIS_MODULE, |
782 | .pm = &hdmi_pm_ops, | 782 | .pm = &hdmi_pm_ops, |
783 | .of_match_table = hdmi_of_match, | 783 | .of_match_table = hdmi_of_match, |
784 | .suppress_bind_attrs = true, | ||
784 | }, | 785 | }, |
785 | }; | 786 | }; |
786 | 787 | ||
diff --git a/drivers/video/fbdev/omap2/dss/hdmi5.c b/drivers/video/fbdev/omap2/dss/hdmi5.c index 32d02ec34d23..169b764bb9d4 100644 --- a/drivers/video/fbdev/omap2/dss/hdmi5.c +++ b/drivers/video/fbdev/omap2/dss/hdmi5.c | |||
@@ -806,6 +806,7 @@ static struct platform_driver omapdss_hdmihw_driver = { | |||
806 | .owner = THIS_MODULE, | 806 | .owner = THIS_MODULE, |
807 | .pm = &hdmi_pm_ops, | 807 | .pm = &hdmi_pm_ops, |
808 | .of_match_table = hdmi_of_match, | 808 | .of_match_table = hdmi_of_match, |
809 | .suppress_bind_attrs = true, | ||
809 | }, | 810 | }, |
810 | }; | 811 | }; |
811 | 812 | ||
diff --git a/drivers/video/fbdev/omap2/dss/hdmi_pll.c b/drivers/video/fbdev/omap2/dss/hdmi_pll.c index 54df12a8d744..6d92bb32fe51 100644 --- a/drivers/video/fbdev/omap2/dss/hdmi_pll.c +++ b/drivers/video/fbdev/omap2/dss/hdmi_pll.c | |||
@@ -124,16 +124,15 @@ static int hdmi_pll_config(struct hdmi_pll_data *pll) | |||
124 | r = FLD_MOD(r, 0x0, 14, 14); /* PHY_CLKINEN de-assert during locking */ | 124 | r = FLD_MOD(r, 0x0, 14, 14); /* PHY_CLKINEN de-assert during locking */ |
125 | r = FLD_MOD(r, fmt->refsel, 22, 21); /* REFSEL */ | 125 | r = FLD_MOD(r, fmt->refsel, 22, 21); /* REFSEL */ |
126 | 126 | ||
127 | if (fmt->dcofreq) { | 127 | if (fmt->dcofreq) |
128 | /* divider programming for frequency beyond 1000Mhz */ | ||
129 | REG_FLD_MOD(pll->base, PLLCTRL_CFG3, fmt->regsd, 17, 10); | ||
130 | r = FLD_MOD(r, 0x4, 3, 1); /* 1000MHz and 2000MHz */ | 128 | r = FLD_MOD(r, 0x4, 3, 1); /* 1000MHz and 2000MHz */ |
131 | } else { | 129 | else |
132 | r = FLD_MOD(r, 0x2, 3, 1); /* 500MHz and 1000MHz */ | 130 | r = FLD_MOD(r, 0x2, 3, 1); /* 500MHz and 1000MHz */ |
133 | } | ||
134 | 131 | ||
135 | hdmi_write_reg(pll->base, PLLCTRL_CFG2, r); | 132 | hdmi_write_reg(pll->base, PLLCTRL_CFG2, r); |
136 | 133 | ||
134 | REG_FLD_MOD(pll->base, PLLCTRL_CFG3, fmt->regsd, 17, 10); | ||
135 | |||
137 | r = hdmi_read_reg(pll->base, PLLCTRL_CFG4); | 136 | r = hdmi_read_reg(pll->base, PLLCTRL_CFG4); |
138 | r = FLD_MOD(r, fmt->regm2, 24, 18); | 137 | r = FLD_MOD(r, fmt->regm2, 24, 18); |
139 | r = FLD_MOD(r, fmt->regmf, 17, 0); | 138 | r = FLD_MOD(r, fmt->regmf, 17, 0); |
@@ -144,8 +143,8 @@ static int hdmi_pll_config(struct hdmi_pll_data *pll) | |||
144 | 143 | ||
145 | /* wait for bit change */ | 144 | /* wait for bit change */ |
146 | if (hdmi_wait_for_bit_change(pll->base, PLLCTRL_PLL_GO, | 145 | if (hdmi_wait_for_bit_change(pll->base, PLLCTRL_PLL_GO, |
147 | 0, 0, 1) != 1) { | 146 | 0, 0, 0) != 0) { |
148 | DSSERR("PLL GO bit not set\n"); | 147 | DSSERR("PLL GO bit not clearing\n"); |
149 | return -ETIMEDOUT; | 148 | return -ETIMEDOUT; |
150 | } | 149 | } |
151 | 150 | ||
diff --git a/drivers/video/fbdev/omap2/dss/rfbi.c b/drivers/video/fbdev/omap2/dss/rfbi.c index c8a81a2b879c..878273f58839 100644 --- a/drivers/video/fbdev/omap2/dss/rfbi.c +++ b/drivers/video/fbdev/omap2/dss/rfbi.c | |||
@@ -1044,6 +1044,7 @@ static struct platform_driver omap_rfbihw_driver = { | |||
1044 | .name = "omapdss_rfbi", | 1044 | .name = "omapdss_rfbi", |
1045 | .owner = THIS_MODULE, | 1045 | .owner = THIS_MODULE, |
1046 | .pm = &rfbi_pm_ops, | 1046 | .pm = &rfbi_pm_ops, |
1047 | .suppress_bind_attrs = true, | ||
1047 | }, | 1048 | }, |
1048 | }; | 1049 | }; |
1049 | 1050 | ||
diff --git a/drivers/video/fbdev/omap2/dss/sdi.c b/drivers/video/fbdev/omap2/dss/sdi.c index 911dcc9173a6..4c9c46d4ea60 100644 --- a/drivers/video/fbdev/omap2/dss/sdi.c +++ b/drivers/video/fbdev/omap2/dss/sdi.c | |||
@@ -377,6 +377,7 @@ static struct platform_driver omap_sdi_driver = { | |||
377 | .driver = { | 377 | .driver = { |
378 | .name = "omapdss_sdi", | 378 | .name = "omapdss_sdi", |
379 | .owner = THIS_MODULE, | 379 | .owner = THIS_MODULE, |
380 | .suppress_bind_attrs = true, | ||
380 | }, | 381 | }, |
381 | }; | 382 | }; |
382 | 383 | ||
diff --git a/drivers/video/fbdev/omap2/dss/venc.c b/drivers/video/fbdev/omap2/dss/venc.c index 21d81113962b..d077d8a75ddc 100644 --- a/drivers/video/fbdev/omap2/dss/venc.c +++ b/drivers/video/fbdev/omap2/dss/venc.c | |||
@@ -966,6 +966,7 @@ static struct platform_driver omap_venchw_driver = { | |||
966 | .owner = THIS_MODULE, | 966 | .owner = THIS_MODULE, |
967 | .pm = &venc_pm_ops, | 967 | .pm = &venc_pm_ops, |
968 | .of_match_table = venc_of_match, | 968 | .of_match_table = venc_of_match, |
969 | .suppress_bind_attrs = true, | ||
969 | }, | 970 | }, |
970 | }; | 971 | }; |
971 | 972 | ||
diff --git a/drivers/video/fbdev/omap2/omapfb/omapfb-main.c b/drivers/video/fbdev/omap2/omapfb/omapfb-main.c index 15872433e0c6..ce8a70570756 100644 --- a/drivers/video/fbdev/omap2/omapfb/omapfb-main.c +++ b/drivers/video/fbdev/omap2/omapfb/omapfb-main.c | |||
@@ -1833,14 +1833,13 @@ static void omapfb_free_resources(struct omapfb2_device *fbdev) | |||
1833 | if (fbdev == NULL) | 1833 | if (fbdev == NULL) |
1834 | return; | 1834 | return; |
1835 | 1835 | ||
1836 | for (i = 0; i < fbdev->num_fbs; i++) { | 1836 | for (i = 0; i < fbdev->num_overlays; i++) { |
1837 | struct omapfb_info *ofbi = FB2OFB(fbdev->fbs[i]); | 1837 | struct omap_overlay *ovl = fbdev->overlays[i]; |
1838 | int j; | ||
1839 | 1838 | ||
1840 | for (j = 0; j < ofbi->num_overlays; j++) { | 1839 | ovl->disable(ovl); |
1841 | struct omap_overlay *ovl = ofbi->overlays[j]; | 1840 | |
1842 | ovl->disable(ovl); | 1841 | if (ovl->manager) |
1843 | } | 1842 | ovl->unset_manager(ovl); |
1844 | } | 1843 | } |
1845 | 1844 | ||
1846 | for (i = 0; i < fbdev->num_fbs; i++) | 1845 | for (i = 0; i < fbdev->num_fbs; i++) |
@@ -2619,7 +2618,7 @@ err0: | |||
2619 | return r; | 2618 | return r; |
2620 | } | 2619 | } |
2621 | 2620 | ||
2622 | static int __exit omapfb_remove(struct platform_device *pdev) | 2621 | static int omapfb_remove(struct platform_device *pdev) |
2623 | { | 2622 | { |
2624 | struct omapfb2_device *fbdev = platform_get_drvdata(pdev); | 2623 | struct omapfb2_device *fbdev = platform_get_drvdata(pdev); |
2625 | 2624 | ||
@@ -2636,7 +2635,7 @@ static int __exit omapfb_remove(struct platform_device *pdev) | |||
2636 | 2635 | ||
2637 | static struct platform_driver omapfb_driver = { | 2636 | static struct platform_driver omapfb_driver = { |
2638 | .probe = omapfb_probe, | 2637 | .probe = omapfb_probe, |
2639 | .remove = __exit_p(omapfb_remove), | 2638 | .remove = omapfb_remove, |
2640 | .driver = { | 2639 | .driver = { |
2641 | .name = "omapfb", | 2640 | .name = "omapfb", |
2642 | .owner = THIS_MODULE, | 2641 | .owner = THIS_MODULE, |
@@ -2651,6 +2650,7 @@ module_param_named(mirror, def_mirror, bool, 0); | |||
2651 | 2650 | ||
2652 | module_platform_driver(omapfb_driver); | 2651 | module_platform_driver(omapfb_driver); |
2653 | 2652 | ||
2653 | MODULE_ALIAS("platform:omapfb"); | ||
2654 | MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@nokia.com>"); | 2654 | MODULE_AUTHOR("Tomi Valkeinen <tomi.valkeinen@nokia.com>"); |
2655 | MODULE_DESCRIPTION("OMAP2/3 Framebuffer"); | 2655 | MODULE_DESCRIPTION("OMAP2/3 Framebuffer"); |
2656 | MODULE_LICENSE("GPL v2"); | 2656 | MODULE_LICENSE("GPL v2"); |
diff --git a/fs/block_dev.c b/fs/block_dev.c index cc9d4114cda0..1d9c9f3754f8 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -1585,7 +1585,7 @@ ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from) | |||
1585 | } | 1585 | } |
1586 | EXPORT_SYMBOL_GPL(blkdev_write_iter); | 1586 | EXPORT_SYMBOL_GPL(blkdev_write_iter); |
1587 | 1587 | ||
1588 | static ssize_t blkdev_read_iter(struct kiocb *iocb, struct iov_iter *to) | 1588 | ssize_t blkdev_read_iter(struct kiocb *iocb, struct iov_iter *to) |
1589 | { | 1589 | { |
1590 | struct file *file = iocb->ki_filp; | 1590 | struct file *file = iocb->ki_filp; |
1591 | struct inode *bd_inode = file->f_mapping->host; | 1591 | struct inode *bd_inode = file->f_mapping->host; |
@@ -1599,6 +1599,7 @@ static ssize_t blkdev_read_iter(struct kiocb *iocb, struct iov_iter *to) | |||
1599 | iov_iter_truncate(to, size); | 1599 | iov_iter_truncate(to, size); |
1600 | return generic_file_read_iter(iocb, to); | 1600 | return generic_file_read_iter(iocb, to); |
1601 | } | 1601 | } |
1602 | EXPORT_SYMBOL_GPL(blkdev_read_iter); | ||
1602 | 1603 | ||
1603 | /* | 1604 | /* |
1604 | * Try to release a page associated with block device when the system | 1605 | * Try to release a page associated with block device when the system |
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index d557264ee974..fe69edda11fb 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -3276,7 +3276,7 @@ int btrfs_run_delayed_refs(struct btrfs_trans_handle *trans, | |||
3276 | struct btrfs_root *root, unsigned long count); | 3276 | struct btrfs_root *root, unsigned long count); |
3277 | int btrfs_async_run_delayed_refs(struct btrfs_root *root, | 3277 | int btrfs_async_run_delayed_refs(struct btrfs_root *root, |
3278 | unsigned long count, int wait); | 3278 | unsigned long count, int wait); |
3279 | int btrfs_lookup_extent(struct btrfs_root *root, u64 start, u64 len); | 3279 | int btrfs_lookup_data_extent(struct btrfs_root *root, u64 start, u64 len); |
3280 | int btrfs_lookup_extent_info(struct btrfs_trans_handle *trans, | 3280 | int btrfs_lookup_extent_info(struct btrfs_trans_handle *trans, |
3281 | struct btrfs_root *root, u64 bytenr, | 3281 | struct btrfs_root *root, u64 bytenr, |
3282 | u64 offset, int metadata, u64 *refs, u64 *flags); | 3282 | u64 offset, int metadata, u64 *refs, u64 *flags); |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 1ad0f47ac850..1bf9f897065d 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -3817,19 +3817,19 @@ static int btrfs_check_super_valid(struct btrfs_fs_info *fs_info, | |||
3817 | struct btrfs_super_block *sb = fs_info->super_copy; | 3817 | struct btrfs_super_block *sb = fs_info->super_copy; |
3818 | int ret = 0; | 3818 | int ret = 0; |
3819 | 3819 | ||
3820 | if (sb->root_level > BTRFS_MAX_LEVEL) { | 3820 | if (btrfs_super_root_level(sb) >= BTRFS_MAX_LEVEL) { |
3821 | printk(KERN_ERR "BTRFS: tree_root level too big: %d > %d\n", | 3821 | printk(KERN_ERR "BTRFS: tree_root level too big: %d >= %d\n", |
3822 | sb->root_level, BTRFS_MAX_LEVEL); | 3822 | btrfs_super_root_level(sb), BTRFS_MAX_LEVEL); |
3823 | ret = -EINVAL; | 3823 | ret = -EINVAL; |
3824 | } | 3824 | } |
3825 | if (sb->chunk_root_level > BTRFS_MAX_LEVEL) { | 3825 | if (btrfs_super_chunk_root_level(sb) >= BTRFS_MAX_LEVEL) { |
3826 | printk(KERN_ERR "BTRFS: chunk_root level too big: %d > %d\n", | 3826 | printk(KERN_ERR "BTRFS: chunk_root level too big: %d >= %d\n", |
3827 | sb->chunk_root_level, BTRFS_MAX_LEVEL); | 3827 | btrfs_super_chunk_root_level(sb), BTRFS_MAX_LEVEL); |
3828 | ret = -EINVAL; | 3828 | ret = -EINVAL; |
3829 | } | 3829 | } |
3830 | if (sb->log_root_level > BTRFS_MAX_LEVEL) { | 3830 | if (btrfs_super_log_root_level(sb) >= BTRFS_MAX_LEVEL) { |
3831 | printk(KERN_ERR "BTRFS: log_root level too big: %d > %d\n", | 3831 | printk(KERN_ERR "BTRFS: log_root level too big: %d >= %d\n", |
3832 | sb->log_root_level, BTRFS_MAX_LEVEL); | 3832 | btrfs_super_log_root_level(sb), BTRFS_MAX_LEVEL); |
3833 | ret = -EINVAL; | 3833 | ret = -EINVAL; |
3834 | } | 3834 | } |
3835 | 3835 | ||
@@ -3837,15 +3837,15 @@ static int btrfs_check_super_valid(struct btrfs_fs_info *fs_info, | |||
3837 | * The common minimum, we don't know if we can trust the nodesize/sectorsize | 3837 | * The common minimum, we don't know if we can trust the nodesize/sectorsize |
3838 | * items yet, they'll be verified later. Issue just a warning. | 3838 | * items yet, they'll be verified later. Issue just a warning. |
3839 | */ | 3839 | */ |
3840 | if (!IS_ALIGNED(sb->root, 4096)) | 3840 | if (!IS_ALIGNED(btrfs_super_root(sb), 4096)) |
3841 | printk(KERN_WARNING "BTRFS: tree_root block unaligned: %llu\n", | 3841 | printk(KERN_WARNING "BTRFS: tree_root block unaligned: %llu\n", |
3842 | sb->root); | 3842 | sb->root); |
3843 | if (!IS_ALIGNED(sb->chunk_root, 4096)) | 3843 | if (!IS_ALIGNED(btrfs_super_chunk_root(sb), 4096)) |
3844 | printk(KERN_WARNING "BTRFS: tree_root block unaligned: %llu\n", | 3844 | printk(KERN_WARNING "BTRFS: tree_root block unaligned: %llu\n", |
3845 | sb->chunk_root); | 3845 | sb->chunk_root); |
3846 | if (!IS_ALIGNED(sb->log_root, 4096)) | 3846 | if (!IS_ALIGNED(btrfs_super_log_root(sb), 4096)) |
3847 | printk(KERN_WARNING "BTRFS: tree_root block unaligned: %llu\n", | 3847 | printk(KERN_WARNING "BTRFS: tree_root block unaligned: %llu\n", |
3848 | sb->log_root); | 3848 | btrfs_super_log_root(sb)); |
3849 | 3849 | ||
3850 | if (memcmp(fs_info->fsid, sb->dev_item.fsid, BTRFS_UUID_SIZE) != 0) { | 3850 | if (memcmp(fs_info->fsid, sb->dev_item.fsid, BTRFS_UUID_SIZE) != 0) { |
3851 | printk(KERN_ERR "BTRFS: dev_item UUID does not match fsid: %pU != %pU\n", | 3851 | printk(KERN_ERR "BTRFS: dev_item UUID does not match fsid: %pU != %pU\n", |
@@ -3857,13 +3857,13 @@ static int btrfs_check_super_valid(struct btrfs_fs_info *fs_info, | |||
3857 | * Hint to catch really bogus numbers, bitflips or so, more exact checks are | 3857 | * Hint to catch really bogus numbers, bitflips or so, more exact checks are |
3858 | * done later | 3858 | * done later |
3859 | */ | 3859 | */ |
3860 | if (sb->num_devices > (1UL << 31)) | 3860 | if (btrfs_super_num_devices(sb) > (1UL << 31)) |
3861 | printk(KERN_WARNING "BTRFS: suspicious number of devices: %llu\n", | 3861 | printk(KERN_WARNING "BTRFS: suspicious number of devices: %llu\n", |
3862 | sb->num_devices); | 3862 | btrfs_super_num_devices(sb)); |
3863 | 3863 | ||
3864 | if (sb->bytenr != BTRFS_SUPER_INFO_OFFSET) { | 3864 | if (btrfs_super_bytenr(sb) != BTRFS_SUPER_INFO_OFFSET) { |
3865 | printk(KERN_ERR "BTRFS: super offset mismatch %llu != %u\n", | 3865 | printk(KERN_ERR "BTRFS: super offset mismatch %llu != %u\n", |
3866 | sb->bytenr, BTRFS_SUPER_INFO_OFFSET); | 3866 | btrfs_super_bytenr(sb), BTRFS_SUPER_INFO_OFFSET); |
3867 | ret = -EINVAL; | 3867 | ret = -EINVAL; |
3868 | } | 3868 | } |
3869 | 3869 | ||
@@ -3871,14 +3871,15 @@ static int btrfs_check_super_valid(struct btrfs_fs_info *fs_info, | |||
3871 | * The generation is a global counter, we'll trust it more than the others | 3871 | * The generation is a global counter, we'll trust it more than the others |
3872 | * but it's still possible that it's the one that's wrong. | 3872 | * but it's still possible that it's the one that's wrong. |
3873 | */ | 3873 | */ |
3874 | if (sb->generation < sb->chunk_root_generation) | 3874 | if (btrfs_super_generation(sb) < btrfs_super_chunk_root_generation(sb)) |
3875 | printk(KERN_WARNING | 3875 | printk(KERN_WARNING |
3876 | "BTRFS: suspicious: generation < chunk_root_generation: %llu < %llu\n", | 3876 | "BTRFS: suspicious: generation < chunk_root_generation: %llu < %llu\n", |
3877 | sb->generation, sb->chunk_root_generation); | 3877 | btrfs_super_generation(sb), btrfs_super_chunk_root_generation(sb)); |
3878 | if (sb->generation < sb->cache_generation && sb->cache_generation != (u64)-1) | 3878 | if (btrfs_super_generation(sb) < btrfs_super_cache_generation(sb) |
3879 | && btrfs_super_cache_generation(sb) != (u64)-1) | ||
3879 | printk(KERN_WARNING | 3880 | printk(KERN_WARNING |
3880 | "BTRFS: suspicious: generation < cache_generation: %llu < %llu\n", | 3881 | "BTRFS: suspicious: generation < cache_generation: %llu < %llu\n", |
3881 | sb->generation, sb->cache_generation); | 3882 | btrfs_super_generation(sb), btrfs_super_cache_generation(sb)); |
3882 | 3883 | ||
3883 | return ret; | 3884 | return ret; |
3884 | } | 3885 | } |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index d56589571012..47c1ba141082 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -710,8 +710,8 @@ void btrfs_clear_space_info_full(struct btrfs_fs_info *info) | |||
710 | rcu_read_unlock(); | 710 | rcu_read_unlock(); |
711 | } | 711 | } |
712 | 712 | ||
713 | /* simple helper to search for an existing extent at a given offset */ | 713 | /* simple helper to search for an existing data extent at a given offset */ |
714 | int btrfs_lookup_extent(struct btrfs_root *root, u64 start, u64 len) | 714 | int btrfs_lookup_data_extent(struct btrfs_root *root, u64 start, u64 len) |
715 | { | 715 | { |
716 | int ret; | 716 | int ret; |
717 | struct btrfs_key key; | 717 | struct btrfs_key key; |
@@ -726,12 +726,6 @@ int btrfs_lookup_extent(struct btrfs_root *root, u64 start, u64 len) | |||
726 | key.type = BTRFS_EXTENT_ITEM_KEY; | 726 | key.type = BTRFS_EXTENT_ITEM_KEY; |
727 | ret = btrfs_search_slot(NULL, root->fs_info->extent_root, &key, path, | 727 | ret = btrfs_search_slot(NULL, root->fs_info->extent_root, &key, path, |
728 | 0, 0); | 728 | 0, 0); |
729 | if (ret > 0) { | ||
730 | btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); | ||
731 | if (key.objectid == start && | ||
732 | key.type == BTRFS_METADATA_ITEM_KEY) | ||
733 | ret = 0; | ||
734 | } | ||
735 | btrfs_free_path(path); | 729 | btrfs_free_path(path); |
736 | return ret; | 730 | return ret; |
737 | } | 731 | } |
@@ -786,7 +780,6 @@ search_again: | |||
786 | else | 780 | else |
787 | key.type = BTRFS_EXTENT_ITEM_KEY; | 781 | key.type = BTRFS_EXTENT_ITEM_KEY; |
788 | 782 | ||
789 | again: | ||
790 | ret = btrfs_search_slot(trans, root->fs_info->extent_root, | 783 | ret = btrfs_search_slot(trans, root->fs_info->extent_root, |
791 | &key, path, 0, 0); | 784 | &key, path, 0, 0); |
792 | if (ret < 0) | 785 | if (ret < 0) |
@@ -802,13 +795,6 @@ again: | |||
802 | key.offset == root->nodesize) | 795 | key.offset == root->nodesize) |
803 | ret = 0; | 796 | ret = 0; |
804 | } | 797 | } |
805 | if (ret) { | ||
806 | key.objectid = bytenr; | ||
807 | key.type = BTRFS_EXTENT_ITEM_KEY; | ||
808 | key.offset = root->nodesize; | ||
809 | btrfs_release_path(path); | ||
810 | goto again; | ||
811 | } | ||
812 | } | 798 | } |
813 | 799 | ||
814 | if (ret == 0) { | 800 | if (ret == 0) { |
diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c index 783a94355efd..84a2d1868271 100644 --- a/fs/btrfs/file-item.c +++ b/fs/btrfs/file-item.c | |||
@@ -413,7 +413,7 @@ int btrfs_lookup_csums_range(struct btrfs_root *root, u64 start, u64 end, | |||
413 | ret = 0; | 413 | ret = 0; |
414 | fail: | 414 | fail: |
415 | while (ret < 0 && !list_empty(&tmplist)) { | 415 | while (ret < 0 && !list_empty(&tmplist)) { |
416 | sums = list_entry(&tmplist, struct btrfs_ordered_sum, list); | 416 | sums = list_entry(tmplist.next, struct btrfs_ordered_sum, list); |
417 | list_del(&sums->list); | 417 | list_del(&sums->list); |
418 | kfree(sums); | 418 | kfree(sums); |
419 | } | 419 | } |
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index a2b97ef10317..54bd91ece35b 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -2151,6 +2151,7 @@ static void __exit exit_btrfs_fs(void) | |||
2151 | extent_map_exit(); | 2151 | extent_map_exit(); |
2152 | extent_io_exit(); | 2152 | extent_io_exit(); |
2153 | btrfs_interface_exit(); | 2153 | btrfs_interface_exit(); |
2154 | btrfs_end_io_wq_exit(); | ||
2154 | unregister_filesystem(&btrfs_fs_type); | 2155 | unregister_filesystem(&btrfs_fs_type); |
2155 | btrfs_exit_sysfs(); | 2156 | btrfs_exit_sysfs(); |
2156 | btrfs_cleanup_fs_uuids(); | 2157 | btrfs_cleanup_fs_uuids(); |
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index 1475979e5718..286213cec861 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c | |||
@@ -672,7 +672,7 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans, | |||
672 | * is this extent already allocated in the extent | 672 | * is this extent already allocated in the extent |
673 | * allocation tree? If so, just add a reference | 673 | * allocation tree? If so, just add a reference |
674 | */ | 674 | */ |
675 | ret = btrfs_lookup_extent(root, ins.objectid, | 675 | ret = btrfs_lookup_data_extent(root, ins.objectid, |
676 | ins.offset); | 676 | ins.offset); |
677 | if (ret == 0) { | 677 | if (ret == 0) { |
678 | ret = btrfs_inc_extent_ref(trans, root, | 678 | ret = btrfs_inc_extent_ref(trans, root, |
diff --git a/fs/buffer.c b/fs/buffer.c index 6c48f20eddd4..20805db2c987 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -128,21 +128,15 @@ __clear_page_buffers(struct page *page) | |||
128 | page_cache_release(page); | 128 | page_cache_release(page); |
129 | } | 129 | } |
130 | 130 | ||
131 | 131 | static void buffer_io_error(struct buffer_head *bh, char *msg) | |
132 | static int quiet_error(struct buffer_head *bh) | ||
133 | { | ||
134 | if (!test_bit(BH_Quiet, &bh->b_state) && printk_ratelimit()) | ||
135 | return 0; | ||
136 | return 1; | ||
137 | } | ||
138 | |||
139 | |||
140 | static void buffer_io_error(struct buffer_head *bh) | ||
141 | { | 132 | { |
142 | char b[BDEVNAME_SIZE]; | 133 | char b[BDEVNAME_SIZE]; |
143 | printk(KERN_ERR "Buffer I/O error on device %s, logical block %Lu\n", | 134 | |
135 | if (!test_bit(BH_Quiet, &bh->b_state)) | ||
136 | printk_ratelimited(KERN_ERR | ||
137 | "Buffer I/O error on dev %s, logical block %llu%s\n", | ||
144 | bdevname(bh->b_bdev, b), | 138 | bdevname(bh->b_bdev, b), |
145 | (unsigned long long)bh->b_blocknr); | 139 | (unsigned long long)bh->b_blocknr, msg); |
146 | } | 140 | } |
147 | 141 | ||
148 | /* | 142 | /* |
@@ -177,17 +171,10 @@ EXPORT_SYMBOL(end_buffer_read_sync); | |||
177 | 171 | ||
178 | void end_buffer_write_sync(struct buffer_head *bh, int uptodate) | 172 | void end_buffer_write_sync(struct buffer_head *bh, int uptodate) |
179 | { | 173 | { |
180 | char b[BDEVNAME_SIZE]; | ||
181 | |||
182 | if (uptodate) { | 174 | if (uptodate) { |
183 | set_buffer_uptodate(bh); | 175 | set_buffer_uptodate(bh); |
184 | } else { | 176 | } else { |
185 | if (!quiet_error(bh)) { | 177 | buffer_io_error(bh, ", lost sync page write"); |
186 | buffer_io_error(bh); | ||
187 | printk(KERN_WARNING "lost page write due to " | ||
188 | "I/O error on %s\n", | ||
189 | bdevname(bh->b_bdev, b)); | ||
190 | } | ||
191 | set_buffer_write_io_error(bh); | 178 | set_buffer_write_io_error(bh); |
192 | clear_buffer_uptodate(bh); | 179 | clear_buffer_uptodate(bh); |
193 | } | 180 | } |
@@ -304,8 +291,7 @@ static void end_buffer_async_read(struct buffer_head *bh, int uptodate) | |||
304 | set_buffer_uptodate(bh); | 291 | set_buffer_uptodate(bh); |
305 | } else { | 292 | } else { |
306 | clear_buffer_uptodate(bh); | 293 | clear_buffer_uptodate(bh); |
307 | if (!quiet_error(bh)) | 294 | buffer_io_error(bh, ", async page read"); |
308 | buffer_io_error(bh); | ||
309 | SetPageError(page); | 295 | SetPageError(page); |
310 | } | 296 | } |
311 | 297 | ||
@@ -353,7 +339,6 @@ still_busy: | |||
353 | */ | 339 | */ |
354 | void end_buffer_async_write(struct buffer_head *bh, int uptodate) | 340 | void end_buffer_async_write(struct buffer_head *bh, int uptodate) |
355 | { | 341 | { |
356 | char b[BDEVNAME_SIZE]; | ||
357 | unsigned long flags; | 342 | unsigned long flags; |
358 | struct buffer_head *first; | 343 | struct buffer_head *first; |
359 | struct buffer_head *tmp; | 344 | struct buffer_head *tmp; |
@@ -365,12 +350,7 @@ void end_buffer_async_write(struct buffer_head *bh, int uptodate) | |||
365 | if (uptodate) { | 350 | if (uptodate) { |
366 | set_buffer_uptodate(bh); | 351 | set_buffer_uptodate(bh); |
367 | } else { | 352 | } else { |
368 | if (!quiet_error(bh)) { | 353 | buffer_io_error(bh, ", lost async page write"); |
369 | buffer_io_error(bh); | ||
370 | printk(KERN_WARNING "lost page write due to " | ||
371 | "I/O error on %s\n", | ||
372 | bdevname(bh->b_bdev, b)); | ||
373 | } | ||
374 | set_bit(AS_EIO, &page->mapping->flags); | 354 | set_bit(AS_EIO, &page->mapping->flags); |
375 | set_buffer_write_io_error(bh); | 355 | set_buffer_write_io_error(bh); |
376 | clear_buffer_uptodate(bh); | 356 | clear_buffer_uptodate(bh); |
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index 659f2ea9e6f7..cefca661464b 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c | |||
@@ -2638,7 +2638,7 @@ static void handle_cap_flush_ack(struct inode *inode, u64 flush_tid, | |||
2638 | 2638 | ||
2639 | for (i = 0; i < CEPH_CAP_BITS; i++) | 2639 | for (i = 0; i < CEPH_CAP_BITS; i++) |
2640 | if ((dirty & (1 << i)) && | 2640 | if ((dirty & (1 << i)) && |
2641 | flush_tid == ci->i_cap_flush_tid[i]) | 2641 | (u16)flush_tid == ci->i_cap_flush_tid[i]) |
2642 | cleaned |= 1 << i; | 2642 | cleaned |= 1 << i; |
2643 | 2643 | ||
2644 | dout("handle_cap_flush_ack inode %p mds%d seq %d on %s cleaned %s," | 2644 | dout("handle_cap_flush_ack inode %p mds%d seq %d on %s cleaned %s," |
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index 7015db0bafd1..eb742d0e67ff 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -1354,13 +1354,6 @@ set_qf_format: | |||
1354 | "not specified."); | 1354 | "not specified."); |
1355 | return 0; | 1355 | return 0; |
1356 | } | 1356 | } |
1357 | } else { | ||
1358 | if (sbi->s_jquota_fmt) { | ||
1359 | ext3_msg(sb, KERN_ERR, "error: journaled quota format " | ||
1360 | "specified with no journaling " | ||
1361 | "enabled."); | ||
1362 | return 0; | ||
1363 | } | ||
1364 | } | 1357 | } |
1365 | #endif | 1358 | #endif |
1366 | return 1; | 1359 | return 1; |
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 37043d0b2be8..0b16fb4c06d3 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -3603,11 +3603,10 @@ static int ext4_ext_convert_to_initialized(handle_t *handle, | |||
3603 | } | 3603 | } |
3604 | } | 3604 | } |
3605 | 3605 | ||
3606 | allocated = ext4_split_extent(handle, inode, ppath, | 3606 | err = ext4_split_extent(handle, inode, ppath, &split_map, split_flag, |
3607 | &split_map, split_flag, flags); | 3607 | flags); |
3608 | if (allocated < 0) | 3608 | if (err > 0) |
3609 | err = allocated; | 3609 | err = 0; |
3610 | |||
3611 | out: | 3610 | out: |
3612 | /* If we have gotten a failure, don't zero out status tree */ | 3611 | /* If we have gotten a failure, don't zero out status tree */ |
3613 | if (!err) | 3612 | if (!err) |
diff --git a/fs/ext4/file.c b/fs/ext4/file.c index aca7b24a4432..8131be8c0af3 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c | |||
@@ -137,10 +137,10 @@ ext4_file_write_iter(struct kiocb *iocb, struct iov_iter *from) | |||
137 | iov_iter_truncate(from, sbi->s_bitmap_maxbytes - pos); | 137 | iov_iter_truncate(from, sbi->s_bitmap_maxbytes - pos); |
138 | } | 138 | } |
139 | 139 | ||
140 | iocb->private = &overwrite; | ||
140 | if (o_direct) { | 141 | if (o_direct) { |
141 | blk_start_plug(&plug); | 142 | blk_start_plug(&plug); |
142 | 143 | ||
143 | iocb->private = &overwrite; | ||
144 | 144 | ||
145 | /* check whether we do a DIO overwrite or not */ | 145 | /* check whether we do a DIO overwrite or not */ |
146 | if (ext4_should_dioread_nolock(inode) && !aio_mutex && | 146 | if (ext4_should_dioread_nolock(inode) && !aio_mutex && |
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index 8012a5daf401..ac644c31ca67 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c | |||
@@ -887,6 +887,10 @@ got: | |||
887 | struct buffer_head *block_bitmap_bh; | 887 | struct buffer_head *block_bitmap_bh; |
888 | 888 | ||
889 | block_bitmap_bh = ext4_read_block_bitmap(sb, group); | 889 | block_bitmap_bh = ext4_read_block_bitmap(sb, group); |
890 | if (!block_bitmap_bh) { | ||
891 | err = -EIO; | ||
892 | goto out; | ||
893 | } | ||
890 | BUFFER_TRACE(block_bitmap_bh, "get block bitmap access"); | 894 | BUFFER_TRACE(block_bitmap_bh, "get block bitmap access"); |
891 | err = ext4_journal_get_write_access(handle, block_bitmap_bh); | 895 | err = ext4_journal_get_write_access(handle, block_bitmap_bh); |
892 | if (err) { | 896 | if (err) { |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index e9777f93cf05..3356ab5395f4 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -4959,7 +4959,12 @@ int ext4_change_inode_journal_flag(struct inode *inode, int val) | |||
4959 | if (val) | 4959 | if (val) |
4960 | ext4_set_inode_flag(inode, EXT4_INODE_JOURNAL_DATA); | 4960 | ext4_set_inode_flag(inode, EXT4_INODE_JOURNAL_DATA); |
4961 | else { | 4961 | else { |
4962 | jbd2_journal_flush(journal); | 4962 | err = jbd2_journal_flush(journal); |
4963 | if (err < 0) { | ||
4964 | jbd2_journal_unlock_updates(journal); | ||
4965 | ext4_inode_resume_unlocked_dio(inode); | ||
4966 | return err; | ||
4967 | } | ||
4963 | ext4_clear_inode_flag(inode, EXT4_INODE_JOURNAL_DATA); | 4968 | ext4_clear_inode_flag(inode, EXT4_INODE_JOURNAL_DATA); |
4964 | } | 4969 | } |
4965 | ext4_set_aops(inode); | 4970 | ext4_set_aops(inode); |
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index 123798c5ac31..426211882f72 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c | |||
@@ -1816,31 +1816,39 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry, | |||
1816 | hinfo.hash_version += EXT4_SB(dir->i_sb)->s_hash_unsigned; | 1816 | hinfo.hash_version += EXT4_SB(dir->i_sb)->s_hash_unsigned; |
1817 | hinfo.seed = EXT4_SB(dir->i_sb)->s_hash_seed; | 1817 | hinfo.seed = EXT4_SB(dir->i_sb)->s_hash_seed; |
1818 | ext4fs_dirhash(name, namelen, &hinfo); | 1818 | ext4fs_dirhash(name, namelen, &hinfo); |
1819 | memset(frames, 0, sizeof(frames)); | ||
1819 | frame = frames; | 1820 | frame = frames; |
1820 | frame->entries = entries; | 1821 | frame->entries = entries; |
1821 | frame->at = entries; | 1822 | frame->at = entries; |
1822 | frame->bh = bh; | 1823 | frame->bh = bh; |
1823 | bh = bh2; | 1824 | bh = bh2; |
1824 | 1825 | ||
1825 | ext4_handle_dirty_dx_node(handle, dir, frame->bh); | 1826 | retval = ext4_handle_dirty_dx_node(handle, dir, frame->bh); |
1826 | ext4_handle_dirty_dirent_node(handle, dir, bh); | 1827 | if (retval) |
1828 | goto out_frames; | ||
1829 | retval = ext4_handle_dirty_dirent_node(handle, dir, bh); | ||
1830 | if (retval) | ||
1831 | goto out_frames; | ||
1827 | 1832 | ||
1828 | de = do_split(handle,dir, &bh, frame, &hinfo); | 1833 | de = do_split(handle,dir, &bh, frame, &hinfo); |
1829 | if (IS_ERR(de)) { | 1834 | if (IS_ERR(de)) { |
1830 | /* | 1835 | retval = PTR_ERR(de); |
1831 | * Even if the block split failed, we have to properly write | 1836 | goto out_frames; |
1832 | * out all the changes we did so far. Otherwise we can end up | ||
1833 | * with corrupted filesystem. | ||
1834 | */ | ||
1835 | ext4_mark_inode_dirty(handle, dir); | ||
1836 | dx_release(frames); | ||
1837 | return PTR_ERR(de); | ||
1838 | } | 1837 | } |
1839 | dx_release(frames); | 1838 | dx_release(frames); |
1840 | 1839 | ||
1841 | retval = add_dirent_to_buf(handle, dentry, inode, de, bh); | 1840 | retval = add_dirent_to_buf(handle, dentry, inode, de, bh); |
1842 | brelse(bh); | 1841 | brelse(bh); |
1843 | return retval; | 1842 | return retval; |
1843 | out_frames: | ||
1844 | /* | ||
1845 | * Even if the block split failed, we have to properly write | ||
1846 | * out all the changes we did so far. Otherwise we can end up | ||
1847 | * with corrupted filesystem. | ||
1848 | */ | ||
1849 | ext4_mark_inode_dirty(handle, dir); | ||
1850 | dx_release(frames); | ||
1851 | return retval; | ||
1844 | } | 1852 | } |
1845 | 1853 | ||
1846 | /* | 1854 | /* |
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c index f298c60f907d..ca4588388fc3 100644 --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c | |||
@@ -1081,7 +1081,7 @@ static void update_backups(struct super_block *sb, int blk_off, char *data, | |||
1081 | break; | 1081 | break; |
1082 | 1082 | ||
1083 | if (meta_bg == 0) | 1083 | if (meta_bg == 0) |
1084 | backup_block = group * bpg + blk_off; | 1084 | backup_block = ((ext4_fsblk_t)group) * bpg + blk_off; |
1085 | else | 1085 | else |
1086 | backup_block = (ext4_group_first_block_no(sb, group) + | 1086 | backup_block = (ext4_group_first_block_no(sb, group) + |
1087 | ext4_bg_has_super(sb, group)); | 1087 | ext4_bg_has_super(sb, group)); |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 1eda6ab0ef9d..2c9e6864abd9 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -3526,6 +3526,10 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
3526 | #ifdef CONFIG_EXT4_FS_POSIX_ACL | 3526 | #ifdef CONFIG_EXT4_FS_POSIX_ACL |
3527 | set_opt(sb, POSIX_ACL); | 3527 | set_opt(sb, POSIX_ACL); |
3528 | #endif | 3528 | #endif |
3529 | /* don't forget to enable journal_csum when metadata_csum is enabled. */ | ||
3530 | if (ext4_has_metadata_csum(sb)) | ||
3531 | set_opt(sb, JOURNAL_CHECKSUM); | ||
3532 | |||
3529 | if ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_DATA) | 3533 | if ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_DATA) |
3530 | set_opt(sb, JOURNAL_DATA); | 3534 | set_opt(sb, JOURNAL_DATA); |
3531 | else if ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_ORDERED) | 3535 | else if ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_ORDERED) |
@@ -3943,7 +3947,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
3943 | if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_MMP) && | 3947 | if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_MMP) && |
3944 | !(sb->s_flags & MS_RDONLY)) | 3948 | !(sb->s_flags & MS_RDONLY)) |
3945 | if (ext4_multi_mount_protect(sb, le64_to_cpu(es->s_mmp_block))) | 3949 | if (ext4_multi_mount_protect(sb, le64_to_cpu(es->s_mmp_block))) |
3946 | goto failed_mount3; | 3950 | goto failed_mount3a; |
3947 | 3951 | ||
3948 | /* | 3952 | /* |
3949 | * The first inode we look at is the journal inode. Don't try | 3953 | * The first inode we look at is the journal inode. Don't try |
@@ -3952,7 +3956,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
3952 | if (!test_opt(sb, NOLOAD) && | 3956 | if (!test_opt(sb, NOLOAD) && |
3953 | EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_HAS_JOURNAL)) { | 3957 | EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_HAS_JOURNAL)) { |
3954 | if (ext4_load_journal(sb, es, journal_devnum)) | 3958 | if (ext4_load_journal(sb, es, journal_devnum)) |
3955 | goto failed_mount3; | 3959 | goto failed_mount3a; |
3956 | } else if (test_opt(sb, NOLOAD) && !(sb->s_flags & MS_RDONLY) && | 3960 | } else if (test_opt(sb, NOLOAD) && !(sb->s_flags & MS_RDONLY) && |
3957 | EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER)) { | 3961 | EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER)) { |
3958 | ext4_msg(sb, KERN_ERR, "required journal recovery " | 3962 | ext4_msg(sb, KERN_ERR, "required journal recovery " |
@@ -4240,6 +4244,7 @@ failed_mount_wq: | |||
4240 | jbd2_journal_destroy(sbi->s_journal); | 4244 | jbd2_journal_destroy(sbi->s_journal); |
4241 | sbi->s_journal = NULL; | 4245 | sbi->s_journal = NULL; |
4242 | } | 4246 | } |
4247 | failed_mount3a: | ||
4243 | ext4_es_unregister_shrinker(sbi); | 4248 | ext4_es_unregister_shrinker(sbi); |
4244 | failed_mount3: | 4249 | failed_mount3: |
4245 | del_timer_sync(&sbi->s_err_report); | 4250 | del_timer_sync(&sbi->s_err_report); |
@@ -4841,6 +4846,14 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) | |||
4841 | goto restore_opts; | 4846 | goto restore_opts; |
4842 | } | 4847 | } |
4843 | 4848 | ||
4849 | if ((old_opts.s_mount_opt & EXT4_MOUNT_JOURNAL_CHECKSUM) ^ | ||
4850 | test_opt(sb, JOURNAL_CHECKSUM)) { | ||
4851 | ext4_msg(sb, KERN_ERR, "changing journal_checksum " | ||
4852 | "during remount not supported"); | ||
4853 | err = -EINVAL; | ||
4854 | goto restore_opts; | ||
4855 | } | ||
4856 | |||
4844 | if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) { | 4857 | if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) { |
4845 | if (test_opt2(sb, EXPLICIT_DELALLOC)) { | 4858 | if (test_opt2(sb, EXPLICIT_DELALLOC)) { |
4846 | ext4_msg(sb, KERN_ERR, "can't mount with " | 4859 | ext4_msg(sb, KERN_ERR, "can't mount with " |
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c index 881b3bd0143f..fe839b915116 100644 --- a/fs/isofs/inode.c +++ b/fs/isofs/inode.c | |||
@@ -29,13 +29,9 @@ | |||
29 | #define BEQUIET | 29 | #define BEQUIET |
30 | 30 | ||
31 | static int isofs_hashi(const struct dentry *parent, struct qstr *qstr); | 31 | static int isofs_hashi(const struct dentry *parent, struct qstr *qstr); |
32 | static int isofs_hash(const struct dentry *parent, struct qstr *qstr); | ||
33 | static int isofs_dentry_cmpi(const struct dentry *parent, | 32 | static int isofs_dentry_cmpi(const struct dentry *parent, |
34 | const struct dentry *dentry, | 33 | const struct dentry *dentry, |
35 | unsigned int len, const char *str, const struct qstr *name); | 34 | unsigned int len, const char *str, const struct qstr *name); |
36 | static int isofs_dentry_cmp(const struct dentry *parent, | ||
37 | const struct dentry *dentry, | ||
38 | unsigned int len, const char *str, const struct qstr *name); | ||
39 | 35 | ||
40 | #ifdef CONFIG_JOLIET | 36 | #ifdef CONFIG_JOLIET |
41 | static int isofs_hashi_ms(const struct dentry *parent, struct qstr *qstr); | 37 | static int isofs_hashi_ms(const struct dentry *parent, struct qstr *qstr); |
@@ -135,10 +131,6 @@ static const struct super_operations isofs_sops = { | |||
135 | 131 | ||
136 | static const struct dentry_operations isofs_dentry_ops[] = { | 132 | static const struct dentry_operations isofs_dentry_ops[] = { |
137 | { | 133 | { |
138 | .d_hash = isofs_hash, | ||
139 | .d_compare = isofs_dentry_cmp, | ||
140 | }, | ||
141 | { | ||
142 | .d_hash = isofs_hashi, | 134 | .d_hash = isofs_hashi, |
143 | .d_compare = isofs_dentry_cmpi, | 135 | .d_compare = isofs_dentry_cmpi, |
144 | }, | 136 | }, |
@@ -258,25 +250,12 @@ static int isofs_dentry_cmp_common( | |||
258 | } | 250 | } |
259 | 251 | ||
260 | static int | 252 | static int |
261 | isofs_hash(const struct dentry *dentry, struct qstr *qstr) | ||
262 | { | ||
263 | return isofs_hash_common(qstr, 0); | ||
264 | } | ||
265 | |||
266 | static int | ||
267 | isofs_hashi(const struct dentry *dentry, struct qstr *qstr) | 253 | isofs_hashi(const struct dentry *dentry, struct qstr *qstr) |
268 | { | 254 | { |
269 | return isofs_hashi_common(qstr, 0); | 255 | return isofs_hashi_common(qstr, 0); |
270 | } | 256 | } |
271 | 257 | ||
272 | static int | 258 | static int |
273 | isofs_dentry_cmp(const struct dentry *parent, const struct dentry *dentry, | ||
274 | unsigned int len, const char *str, const struct qstr *name) | ||
275 | { | ||
276 | return isofs_dentry_cmp_common(len, str, name, 0, 0); | ||
277 | } | ||
278 | |||
279 | static int | ||
280 | isofs_dentry_cmpi(const struct dentry *parent, const struct dentry *dentry, | 259 | isofs_dentry_cmpi(const struct dentry *parent, const struct dentry *dentry, |
281 | unsigned int len, const char *str, const struct qstr *name) | 260 | unsigned int len, const char *str, const struct qstr *name) |
282 | { | 261 | { |
@@ -930,7 +909,8 @@ root_found: | |||
930 | if (opt.check == 'r') | 909 | if (opt.check == 'r') |
931 | table++; | 910 | table++; |
932 | 911 | ||
933 | s->s_d_op = &isofs_dentry_ops[table]; | 912 | if (table) |
913 | s->s_d_op = &isofs_dentry_ops[table - 1]; | ||
934 | 914 | ||
935 | /* get the root dentry */ | 915 | /* get the root dentry */ |
936 | s->s_root = d_make_root(inode); | 916 | s->s_root = d_make_root(inode); |
diff --git a/fs/isofs/namei.c b/fs/isofs/namei.c index 95295640d9c8..7b543e6b6526 100644 --- a/fs/isofs/namei.c +++ b/fs/isofs/namei.c | |||
@@ -18,25 +18,10 @@ static int | |||
18 | isofs_cmp(struct dentry *dentry, const char *compare, int dlen) | 18 | isofs_cmp(struct dentry *dentry, const char *compare, int dlen) |
19 | { | 19 | { |
20 | struct qstr qstr; | 20 | struct qstr qstr; |
21 | |||
22 | if (!compare) | ||
23 | return 1; | ||
24 | |||
25 | /* check special "." and ".." files */ | ||
26 | if (dlen == 1) { | ||
27 | /* "." */ | ||
28 | if (compare[0] == 0) { | ||
29 | if (!dentry->d_name.len) | ||
30 | return 0; | ||
31 | compare = "."; | ||
32 | } else if (compare[0] == 1) { | ||
33 | compare = ".."; | ||
34 | dlen = 2; | ||
35 | } | ||
36 | } | ||
37 | |||
38 | qstr.name = compare; | 21 | qstr.name = compare; |
39 | qstr.len = dlen; | 22 | qstr.len = dlen; |
23 | if (likely(!dentry->d_op)) | ||
24 | return dentry->d_name.len != dlen || memcmp(dentry->d_name.name, compare, dlen); | ||
40 | return dentry->d_op->d_compare(NULL, NULL, dentry->d_name.len, dentry->d_name.name, &qstr); | 25 | return dentry->d_op->d_compare(NULL, NULL, dentry->d_name.len, dentry->d_name.name, &qstr); |
41 | } | 26 | } |
42 | 27 | ||
@@ -146,7 +131,8 @@ isofs_find_entry(struct inode *dir, struct dentry *dentry, | |||
146 | (!(de->flags[-sbi->s_high_sierra] & 1))) && | 131 | (!(de->flags[-sbi->s_high_sierra] & 1))) && |
147 | (sbi->s_showassoc || | 132 | (sbi->s_showassoc || |
148 | (!(de->flags[-sbi->s_high_sierra] & 4)))) { | 133 | (!(de->flags[-sbi->s_high_sierra] & 4)))) { |
149 | match = (isofs_cmp(dentry, dpnt, dlen) == 0); | 134 | if (dpnt && (dlen > 1 || dpnt[0] > 1)) |
135 | match = (isofs_cmp(dentry, dpnt, dlen) == 0); | ||
150 | } | 136 | } |
151 | if (match) { | 137 | if (match) { |
152 | isofs_normalize_block_and_offset(de, | 138 | isofs_normalize_block_and_offset(de, |
diff --git a/fs/jbd/revoke.c b/fs/jbd/revoke.c index 8898bbd2b61e..dcead636c33b 100644 --- a/fs/jbd/revoke.c +++ b/fs/jbd/revoke.c | |||
@@ -93,6 +93,7 @@ | |||
93 | #include <linux/bio.h> | 93 | #include <linux/bio.h> |
94 | #endif | 94 | #endif |
95 | #include <linux/log2.h> | 95 | #include <linux/log2.h> |
96 | #include <linux/hash.h> | ||
96 | 97 | ||
97 | static struct kmem_cache *revoke_record_cache; | 98 | static struct kmem_cache *revoke_record_cache; |
98 | static struct kmem_cache *revoke_table_cache; | 99 | static struct kmem_cache *revoke_table_cache; |
@@ -129,15 +130,11 @@ static void flush_descriptor(journal_t *, struct journal_head *, int, int); | |||
129 | 130 | ||
130 | /* Utility functions to maintain the revoke table */ | 131 | /* Utility functions to maintain the revoke table */ |
131 | 132 | ||
132 | /* Borrowed from buffer.c: this is a tried and tested block hash function */ | ||
133 | static inline int hash(journal_t *journal, unsigned int block) | 133 | static inline int hash(journal_t *journal, unsigned int block) |
134 | { | 134 | { |
135 | struct jbd_revoke_table_s *table = journal->j_revoke; | 135 | struct jbd_revoke_table_s *table = journal->j_revoke; |
136 | int hash_shift = table->hash_shift; | ||
137 | 136 | ||
138 | return ((block << (hash_shift - 6)) ^ | 137 | return hash_32(block, table->hash_shift); |
139 | (block >> 13) ^ | ||
140 | (block << (hash_shift - 12))) & (table->hash_size - 1); | ||
141 | } | 138 | } |
142 | 139 | ||
143 | static int insert_revoke_hash(journal_t *journal, unsigned int blocknr, | 140 | static int insert_revoke_hash(journal_t *journal, unsigned int blocknr, |
diff --git a/fs/jbd2/revoke.c b/fs/jbd2/revoke.c index d5e95a175c92..c6cbaef2bda1 100644 --- a/fs/jbd2/revoke.c +++ b/fs/jbd2/revoke.c | |||
@@ -92,6 +92,7 @@ | |||
92 | #include <linux/init.h> | 92 | #include <linux/init.h> |
93 | #include <linux/bio.h> | 93 | #include <linux/bio.h> |
94 | #include <linux/log2.h> | 94 | #include <linux/log2.h> |
95 | #include <linux/hash.h> | ||
95 | #endif | 96 | #endif |
96 | 97 | ||
97 | static struct kmem_cache *jbd2_revoke_record_cache; | 98 | static struct kmem_cache *jbd2_revoke_record_cache; |
@@ -130,16 +131,9 @@ static void flush_descriptor(journal_t *, struct buffer_head *, int, int); | |||
130 | 131 | ||
131 | /* Utility functions to maintain the revoke table */ | 132 | /* Utility functions to maintain the revoke table */ |
132 | 133 | ||
133 | /* Borrowed from buffer.c: this is a tried and tested block hash function */ | ||
134 | static inline int hash(journal_t *journal, unsigned long long block) | 134 | static inline int hash(journal_t *journal, unsigned long long block) |
135 | { | 135 | { |
136 | struct jbd2_revoke_table_s *table = journal->j_revoke; | 136 | return hash_64(block, journal->j_revoke->hash_shift); |
137 | int hash_shift = table->hash_shift; | ||
138 | int hash = (int)block ^ (int)((block >> 31) >> 1); | ||
139 | |||
140 | return ((hash << (hash_shift - 6)) ^ | ||
141 | (hash >> 13) ^ | ||
142 | (hash << (hash_shift - 12))) & (table->hash_size - 1); | ||
143 | } | 137 | } |
144 | 138 | ||
145 | static int insert_revoke_hash(journal_t *journal, unsigned long long blocknr, | 139 | static int insert_revoke_hash(journal_t *journal, unsigned long long blocknr, |
diff --git a/fs/namei.c b/fs/namei.c index 42df664e95e5..db5fe86319e6 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -2497,7 +2497,7 @@ struct dentry *lock_rename(struct dentry *p1, struct dentry *p2) | |||
2497 | } | 2497 | } |
2498 | 2498 | ||
2499 | mutex_lock_nested(&p1->d_inode->i_mutex, I_MUTEX_PARENT); | 2499 | mutex_lock_nested(&p1->d_inode->i_mutex, I_MUTEX_PARENT); |
2500 | mutex_lock_nested(&p2->d_inode->i_mutex, I_MUTEX_CHILD); | 2500 | mutex_lock_nested(&p2->d_inode->i_mutex, I_MUTEX_PARENT2); |
2501 | return NULL; | 2501 | return NULL; |
2502 | } | 2502 | } |
2503 | EXPORT_SYMBOL(lock_rename); | 2503 | EXPORT_SYMBOL(lock_rename); |
@@ -3154,7 +3154,8 @@ static int do_tmpfile(int dfd, struct filename *pathname, | |||
3154 | if (error) | 3154 | if (error) |
3155 | goto out2; | 3155 | goto out2; |
3156 | audit_inode(pathname, nd->path.dentry, 0); | 3156 | audit_inode(pathname, nd->path.dentry, 0); |
3157 | error = may_open(&nd->path, op->acc_mode, op->open_flag); | 3157 | /* Don't check for other permissions, the inode was just created */ |
3158 | error = may_open(&nd->path, MAY_OPEN, op->open_flag); | ||
3158 | if (error) | 3159 | if (error) |
3159 | goto out2; | 3160 | goto out2; |
3160 | file->f_path.mnt = nd->path.mnt; | 3161 | file->f_path.mnt = nd->path.mnt; |
diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c index 5228f201d3d5..4f46f7a05289 100644 --- a/fs/nfs/blocklayout/blocklayout.c +++ b/fs/nfs/blocklayout/blocklayout.c | |||
@@ -378,7 +378,7 @@ bl_write_pagelist(struct nfs_pgio_header *header, int sync) | |||
378 | loff_t offset = header->args.offset; | 378 | loff_t offset = header->args.offset; |
379 | size_t count = header->args.count; | 379 | size_t count = header->args.count; |
380 | struct page **pages = header->args.pages; | 380 | struct page **pages = header->args.pages; |
381 | int pg_index = pg_index = header->args.pgbase >> PAGE_CACHE_SHIFT; | 381 | int pg_index = header->args.pgbase >> PAGE_CACHE_SHIFT; |
382 | unsigned int pg_len; | 382 | unsigned int pg_len; |
383 | struct blk_plug plug; | 383 | struct blk_plug plug; |
384 | int i; | 384 | int i; |
diff --git a/fs/nfs/blocklayout/rpc_pipefs.c b/fs/nfs/blocklayout/rpc_pipefs.c index e966c023b1b7..acbf9ca4018c 100644 --- a/fs/nfs/blocklayout/rpc_pipefs.c +++ b/fs/nfs/blocklayout/rpc_pipefs.c | |||
@@ -65,17 +65,18 @@ bl_resolve_deviceid(struct nfs_server *server, struct pnfs_block_volume *b, | |||
65 | 65 | ||
66 | dprintk("%s CREATING PIPEFS MESSAGE\n", __func__); | 66 | dprintk("%s CREATING PIPEFS MESSAGE\n", __func__); |
67 | 67 | ||
68 | mutex_lock(&nn->bl_mutex); | ||
68 | bl_pipe_msg.bl_wq = &nn->bl_wq; | 69 | bl_pipe_msg.bl_wq = &nn->bl_wq; |
69 | 70 | ||
70 | b->simple.len += 4; /* single volume */ | 71 | b->simple.len += 4; /* single volume */ |
71 | if (b->simple.len > PAGE_SIZE) | 72 | if (b->simple.len > PAGE_SIZE) |
72 | return -EIO; | 73 | goto out_unlock; |
73 | 74 | ||
74 | memset(msg, 0, sizeof(*msg)); | 75 | memset(msg, 0, sizeof(*msg)); |
75 | msg->len = sizeof(*bl_msg) + b->simple.len; | 76 | msg->len = sizeof(*bl_msg) + b->simple.len; |
76 | msg->data = kzalloc(msg->len, gfp_mask); | 77 | msg->data = kzalloc(msg->len, gfp_mask); |
77 | if (!msg->data) | 78 | if (!msg->data) |
78 | goto out; | 79 | goto out_free_data; |
79 | 80 | ||
80 | bl_msg = msg->data; | 81 | bl_msg = msg->data; |
81 | bl_msg->type = BL_DEVICE_MOUNT, | 82 | bl_msg->type = BL_DEVICE_MOUNT, |
@@ -87,7 +88,7 @@ bl_resolve_deviceid(struct nfs_server *server, struct pnfs_block_volume *b, | |||
87 | rc = rpc_queue_upcall(nn->bl_device_pipe, msg); | 88 | rc = rpc_queue_upcall(nn->bl_device_pipe, msg); |
88 | if (rc < 0) { | 89 | if (rc < 0) { |
89 | remove_wait_queue(&nn->bl_wq, &wq); | 90 | remove_wait_queue(&nn->bl_wq, &wq); |
90 | goto out; | 91 | goto out_free_data; |
91 | } | 92 | } |
92 | 93 | ||
93 | set_current_state(TASK_UNINTERRUPTIBLE); | 94 | set_current_state(TASK_UNINTERRUPTIBLE); |
@@ -97,12 +98,14 @@ bl_resolve_deviceid(struct nfs_server *server, struct pnfs_block_volume *b, | |||
97 | if (reply->status != BL_DEVICE_REQUEST_PROC) { | 98 | if (reply->status != BL_DEVICE_REQUEST_PROC) { |
98 | printk(KERN_WARNING "%s failed to decode device: %d\n", | 99 | printk(KERN_WARNING "%s failed to decode device: %d\n", |
99 | __func__, reply->status); | 100 | __func__, reply->status); |
100 | goto out; | 101 | goto out_free_data; |
101 | } | 102 | } |
102 | 103 | ||
103 | dev = MKDEV(reply->major, reply->minor); | 104 | dev = MKDEV(reply->major, reply->minor); |
104 | out: | 105 | out_free_data: |
105 | kfree(msg->data); | 106 | kfree(msg->data); |
107 | out_unlock: | ||
108 | mutex_unlock(&nn->bl_mutex); | ||
106 | return dev; | 109 | return dev; |
107 | } | 110 | } |
108 | 111 | ||
@@ -232,6 +235,7 @@ static int nfs4blocklayout_net_init(struct net *net) | |||
232 | struct nfs_net *nn = net_generic(net, nfs_net_id); | 235 | struct nfs_net *nn = net_generic(net, nfs_net_id); |
233 | struct dentry *dentry; | 236 | struct dentry *dentry; |
234 | 237 | ||
238 | mutex_init(&nn->bl_mutex); | ||
235 | init_waitqueue_head(&nn->bl_wq); | 239 | init_waitqueue_head(&nn->bl_wq); |
236 | nn->bl_device_pipe = rpc_mkpipe_data(&bl_upcall_ops, 0); | 240 | nn->bl_device_pipe = rpc_mkpipe_data(&bl_upcall_ops, 0); |
237 | if (IS_ERR(nn->bl_device_pipe)) | 241 | if (IS_ERR(nn->bl_device_pipe)) |
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c index 5853f53db732..7f3f60641344 100644 --- a/fs/nfs/delegation.c +++ b/fs/nfs/delegation.c | |||
@@ -125,6 +125,8 @@ again: | |||
125 | continue; | 125 | continue; |
126 | if (!test_bit(NFS_DELEGATED_STATE, &state->flags)) | 126 | if (!test_bit(NFS_DELEGATED_STATE, &state->flags)) |
127 | continue; | 127 | continue; |
128 | if (!nfs4_valid_open_stateid(state)) | ||
129 | continue; | ||
128 | if (!nfs4_stateid_match(&state->stateid, stateid)) | 130 | if (!nfs4_stateid_match(&state->stateid, stateid)) |
129 | continue; | 131 | continue; |
130 | get_nfs_open_context(ctx); | 132 | get_nfs_open_context(ctx); |
@@ -193,7 +195,11 @@ static int nfs_do_return_delegation(struct inode *inode, struct nfs_delegation * | |||
193 | { | 195 | { |
194 | int res = 0; | 196 | int res = 0; |
195 | 197 | ||
196 | res = nfs4_proc_delegreturn(inode, delegation->cred, &delegation->stateid, issync); | 198 | if (!test_bit(NFS_DELEGATION_REVOKED, &delegation->flags)) |
199 | res = nfs4_proc_delegreturn(inode, | ||
200 | delegation->cred, | ||
201 | &delegation->stateid, | ||
202 | issync); | ||
197 | nfs_free_delegation(delegation); | 203 | nfs_free_delegation(delegation); |
198 | return res; | 204 | return res; |
199 | } | 205 | } |
@@ -380,11 +386,13 @@ static int nfs_end_delegation_return(struct inode *inode, struct nfs_delegation | |||
380 | { | 386 | { |
381 | struct nfs_client *clp = NFS_SERVER(inode)->nfs_client; | 387 | struct nfs_client *clp = NFS_SERVER(inode)->nfs_client; |
382 | struct nfs_inode *nfsi = NFS_I(inode); | 388 | struct nfs_inode *nfsi = NFS_I(inode); |
383 | int err; | 389 | int err = 0; |
384 | 390 | ||
385 | if (delegation == NULL) | 391 | if (delegation == NULL) |
386 | return 0; | 392 | return 0; |
387 | do { | 393 | do { |
394 | if (test_bit(NFS_DELEGATION_REVOKED, &delegation->flags)) | ||
395 | break; | ||
388 | err = nfs_delegation_claim_opens(inode, &delegation->stateid); | 396 | err = nfs_delegation_claim_opens(inode, &delegation->stateid); |
389 | if (!issync || err != -EAGAIN) | 397 | if (!issync || err != -EAGAIN) |
390 | break; | 398 | break; |
@@ -605,10 +613,23 @@ static void nfs_client_mark_return_unused_delegation_types(struct nfs_client *cl | |||
605 | rcu_read_unlock(); | 613 | rcu_read_unlock(); |
606 | } | 614 | } |
607 | 615 | ||
616 | static void nfs_revoke_delegation(struct inode *inode) | ||
617 | { | ||
618 | struct nfs_delegation *delegation; | ||
619 | rcu_read_lock(); | ||
620 | delegation = rcu_dereference(NFS_I(inode)->delegation); | ||
621 | if (delegation != NULL) { | ||
622 | set_bit(NFS_DELEGATION_REVOKED, &delegation->flags); | ||
623 | nfs_mark_return_delegation(NFS_SERVER(inode), delegation); | ||
624 | } | ||
625 | rcu_read_unlock(); | ||
626 | } | ||
627 | |||
608 | void nfs_remove_bad_delegation(struct inode *inode) | 628 | void nfs_remove_bad_delegation(struct inode *inode) |
609 | { | 629 | { |
610 | struct nfs_delegation *delegation; | 630 | struct nfs_delegation *delegation; |
611 | 631 | ||
632 | nfs_revoke_delegation(inode); | ||
612 | delegation = nfs_inode_detach_delegation(inode); | 633 | delegation = nfs_inode_detach_delegation(inode); |
613 | if (delegation) { | 634 | if (delegation) { |
614 | nfs_inode_find_state_and_recover(inode, &delegation->stateid); | 635 | nfs_inode_find_state_and_recover(inode, &delegation->stateid); |
diff --git a/fs/nfs/delegation.h b/fs/nfs/delegation.h index 5c1cce39297f..e3c20a3ccc93 100644 --- a/fs/nfs/delegation.h +++ b/fs/nfs/delegation.h | |||
@@ -31,6 +31,7 @@ enum { | |||
31 | NFS_DELEGATION_RETURN_IF_CLOSED, | 31 | NFS_DELEGATION_RETURN_IF_CLOSED, |
32 | NFS_DELEGATION_REFERENCED, | 32 | NFS_DELEGATION_REFERENCED, |
33 | NFS_DELEGATION_RETURNING, | 33 | NFS_DELEGATION_RETURNING, |
34 | NFS_DELEGATION_REVOKED, | ||
34 | }; | 35 | }; |
35 | 36 | ||
36 | int nfs_inode_set_delegation(struct inode *inode, struct rpc_cred *cred, struct nfs_openres *res); | 37 | int nfs_inode_set_delegation(struct inode *inode, struct rpc_cred *cred, struct nfs_openres *res); |
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 06e8cfcbb670..6e62155abf26 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -1527,6 +1527,7 @@ int nfs_atomic_open(struct inode *dir, struct dentry *dentry, | |||
1527 | case -ENOENT: | 1527 | case -ENOENT: |
1528 | d_drop(dentry); | 1528 | d_drop(dentry); |
1529 | d_add(dentry, NULL); | 1529 | d_add(dentry, NULL); |
1530 | nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); | ||
1530 | break; | 1531 | break; |
1531 | case -EISDIR: | 1532 | case -EISDIR: |
1532 | case -ENOTDIR: | 1533 | case -ENOTDIR: |
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 20cffc830468..10bf07280f4a 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c | |||
@@ -266,6 +266,7 @@ static void nfs_direct_req_free(struct kref *kref) | |||
266 | { | 266 | { |
267 | struct nfs_direct_req *dreq = container_of(kref, struct nfs_direct_req, kref); | 267 | struct nfs_direct_req *dreq = container_of(kref, struct nfs_direct_req, kref); |
268 | 268 | ||
269 | nfs_free_pnfs_ds_cinfo(&dreq->ds_cinfo); | ||
269 | if (dreq->l_ctx != NULL) | 270 | if (dreq->l_ctx != NULL) |
270 | nfs_put_lock_context(dreq->l_ctx); | 271 | nfs_put_lock_context(dreq->l_ctx); |
271 | if (dreq->ctx != NULL) | 272 | if (dreq->ctx != NULL) |
diff --git a/fs/nfs/filelayout/filelayout.c b/fs/nfs/filelayout/filelayout.c index 46fab1cb455a..7afb52f6a25a 100644 --- a/fs/nfs/filelayout/filelayout.c +++ b/fs/nfs/filelayout/filelayout.c | |||
@@ -145,9 +145,6 @@ static int filelayout_async_handle_error(struct rpc_task *task, | |||
145 | case -NFS4ERR_DELEG_REVOKED: | 145 | case -NFS4ERR_DELEG_REVOKED: |
146 | case -NFS4ERR_ADMIN_REVOKED: | 146 | case -NFS4ERR_ADMIN_REVOKED: |
147 | case -NFS4ERR_BAD_STATEID: | 147 | case -NFS4ERR_BAD_STATEID: |
148 | if (state == NULL) | ||
149 | break; | ||
150 | nfs_remove_bad_delegation(state->inode); | ||
151 | case -NFS4ERR_OPENMODE: | 148 | case -NFS4ERR_OPENMODE: |
152 | if (state == NULL) | 149 | if (state == NULL) |
153 | break; | 150 | break; |
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 6388a59f2add..00689a8a85e4 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -626,7 +626,7 @@ int nfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) | |||
626 | { | 626 | { |
627 | struct inode *inode = dentry->d_inode; | 627 | struct inode *inode = dentry->d_inode; |
628 | int need_atime = NFS_I(inode)->cache_validity & NFS_INO_INVALID_ATIME; | 628 | int need_atime = NFS_I(inode)->cache_validity & NFS_INO_INVALID_ATIME; |
629 | int err; | 629 | int err = 0; |
630 | 630 | ||
631 | trace_nfs_getattr_enter(inode); | 631 | trace_nfs_getattr_enter(inode); |
632 | /* Flush out writes to the server in order to update c/mtime. */ | 632 | /* Flush out writes to the server in order to update c/mtime. */ |
diff --git a/fs/nfs/netns.h b/fs/nfs/netns.h index ef221fb8a183..f0e06e4acbef 100644 --- a/fs/nfs/netns.h +++ b/fs/nfs/netns.h | |||
@@ -19,6 +19,7 @@ struct nfs_net { | |||
19 | struct rpc_pipe *bl_device_pipe; | 19 | struct rpc_pipe *bl_device_pipe; |
20 | struct bl_dev_msg bl_mount_reply; | 20 | struct bl_dev_msg bl_mount_reply; |
21 | wait_queue_head_t bl_wq; | 21 | wait_queue_head_t bl_wq; |
22 | struct mutex bl_mutex; | ||
22 | struct list_head nfs_client_list; | 23 | struct list_head nfs_client_list; |
23 | struct list_head nfs_volume_list; | 24 | struct list_head nfs_volume_list; |
24 | #if IS_ENABLED(CONFIG_NFS_V4) | 25 | #if IS_ENABLED(CONFIG_NFS_V4) |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 405bd95c1f58..69dc20a743f9 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -370,11 +370,6 @@ static int nfs4_handle_exception(struct nfs_server *server, int errorcode, struc | |||
370 | case -NFS4ERR_DELEG_REVOKED: | 370 | case -NFS4ERR_DELEG_REVOKED: |
371 | case -NFS4ERR_ADMIN_REVOKED: | 371 | case -NFS4ERR_ADMIN_REVOKED: |
372 | case -NFS4ERR_BAD_STATEID: | 372 | case -NFS4ERR_BAD_STATEID: |
373 | if (inode != NULL && nfs4_have_delegation(inode, FMODE_READ)) { | ||
374 | nfs_remove_bad_delegation(inode); | ||
375 | exception->retry = 1; | ||
376 | break; | ||
377 | } | ||
378 | if (state == NULL) | 373 | if (state == NULL) |
379 | break; | 374 | break; |
380 | ret = nfs4_schedule_stateid_recovery(server, state); | 375 | ret = nfs4_schedule_stateid_recovery(server, state); |
@@ -1654,7 +1649,7 @@ static int nfs4_handle_delegation_recall_error(struct nfs_server *server, struct | |||
1654 | nfs_inode_find_state_and_recover(state->inode, | 1649 | nfs_inode_find_state_and_recover(state->inode, |
1655 | stateid); | 1650 | stateid); |
1656 | nfs4_schedule_stateid_recovery(server, state); | 1651 | nfs4_schedule_stateid_recovery(server, state); |
1657 | return 0; | 1652 | return -EAGAIN; |
1658 | case -NFS4ERR_DELAY: | 1653 | case -NFS4ERR_DELAY: |
1659 | case -NFS4ERR_GRACE: | 1654 | case -NFS4ERR_GRACE: |
1660 | set_bit(NFS_DELEGATED_STATE, &state->flags); | 1655 | set_bit(NFS_DELEGATED_STATE, &state->flags); |
@@ -2109,46 +2104,60 @@ static int nfs4_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *sta | |||
2109 | return ret; | 2104 | return ret; |
2110 | } | 2105 | } |
2111 | 2106 | ||
2107 | static void nfs_finish_clear_delegation_stateid(struct nfs4_state *state) | ||
2108 | { | ||
2109 | nfs_remove_bad_delegation(state->inode); | ||
2110 | write_seqlock(&state->seqlock); | ||
2111 | nfs4_stateid_copy(&state->stateid, &state->open_stateid); | ||
2112 | write_sequnlock(&state->seqlock); | ||
2113 | clear_bit(NFS_DELEGATED_STATE, &state->flags); | ||
2114 | } | ||
2115 | |||
2116 | static void nfs40_clear_delegation_stateid(struct nfs4_state *state) | ||
2117 | { | ||
2118 | if (rcu_access_pointer(NFS_I(state->inode)->delegation) != NULL) | ||
2119 | nfs_finish_clear_delegation_stateid(state); | ||
2120 | } | ||
2121 | |||
2122 | static int nfs40_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *state) | ||
2123 | { | ||
2124 | /* NFSv4.0 doesn't allow for delegation recovery on open expire */ | ||
2125 | nfs40_clear_delegation_stateid(state); | ||
2126 | return nfs4_open_expired(sp, state); | ||
2127 | } | ||
2128 | |||
2112 | #if defined(CONFIG_NFS_V4_1) | 2129 | #if defined(CONFIG_NFS_V4_1) |
2113 | static void nfs41_clear_delegation_stateid(struct nfs4_state *state) | 2130 | static void nfs41_check_delegation_stateid(struct nfs4_state *state) |
2114 | { | 2131 | { |
2115 | struct nfs_server *server = NFS_SERVER(state->inode); | 2132 | struct nfs_server *server = NFS_SERVER(state->inode); |
2116 | nfs4_stateid *stateid = &state->stateid; | 2133 | nfs4_stateid stateid; |
2117 | struct nfs_delegation *delegation; | 2134 | struct nfs_delegation *delegation; |
2118 | struct rpc_cred *cred = NULL; | 2135 | struct rpc_cred *cred; |
2119 | int status = -NFS4ERR_BAD_STATEID; | 2136 | int status; |
2120 | |||
2121 | /* If a state reset has been done, test_stateid is unneeded */ | ||
2122 | if (test_bit(NFS_DELEGATED_STATE, &state->flags) == 0) | ||
2123 | return; | ||
2124 | 2137 | ||
2125 | /* Get the delegation credential for use by test/free_stateid */ | 2138 | /* Get the delegation credential for use by test/free_stateid */ |
2126 | rcu_read_lock(); | 2139 | rcu_read_lock(); |
2127 | delegation = rcu_dereference(NFS_I(state->inode)->delegation); | 2140 | delegation = rcu_dereference(NFS_I(state->inode)->delegation); |
2128 | if (delegation != NULL && | 2141 | if (delegation == NULL) { |
2129 | nfs4_stateid_match(&delegation->stateid, stateid)) { | ||
2130 | cred = get_rpccred(delegation->cred); | ||
2131 | rcu_read_unlock(); | ||
2132 | status = nfs41_test_stateid(server, stateid, cred); | ||
2133 | trace_nfs4_test_delegation_stateid(state, NULL, status); | ||
2134 | } else | ||
2135 | rcu_read_unlock(); | 2142 | rcu_read_unlock(); |
2143 | return; | ||
2144 | } | ||
2145 | |||
2146 | nfs4_stateid_copy(&stateid, &delegation->stateid); | ||
2147 | cred = get_rpccred(delegation->cred); | ||
2148 | rcu_read_unlock(); | ||
2149 | status = nfs41_test_stateid(server, &stateid, cred); | ||
2150 | trace_nfs4_test_delegation_stateid(state, NULL, status); | ||
2136 | 2151 | ||
2137 | if (status != NFS_OK) { | 2152 | if (status != NFS_OK) { |
2138 | /* Free the stateid unless the server explicitly | 2153 | /* Free the stateid unless the server explicitly |
2139 | * informs us the stateid is unrecognized. */ | 2154 | * informs us the stateid is unrecognized. */ |
2140 | if (status != -NFS4ERR_BAD_STATEID) | 2155 | if (status != -NFS4ERR_BAD_STATEID) |
2141 | nfs41_free_stateid(server, stateid, cred); | 2156 | nfs41_free_stateid(server, &stateid, cred); |
2142 | nfs_remove_bad_delegation(state->inode); | 2157 | nfs_finish_clear_delegation_stateid(state); |
2143 | |||
2144 | write_seqlock(&state->seqlock); | ||
2145 | nfs4_stateid_copy(&state->stateid, &state->open_stateid); | ||
2146 | write_sequnlock(&state->seqlock); | ||
2147 | clear_bit(NFS_DELEGATED_STATE, &state->flags); | ||
2148 | } | 2158 | } |
2149 | 2159 | ||
2150 | if (cred != NULL) | 2160 | put_rpccred(cred); |
2151 | put_rpccred(cred); | ||
2152 | } | 2161 | } |
2153 | 2162 | ||
2154 | /** | 2163 | /** |
@@ -2192,7 +2201,7 @@ static int nfs41_open_expired(struct nfs4_state_owner *sp, struct nfs4_state *st | |||
2192 | { | 2201 | { |
2193 | int status; | 2202 | int status; |
2194 | 2203 | ||
2195 | nfs41_clear_delegation_stateid(state); | 2204 | nfs41_check_delegation_stateid(state); |
2196 | status = nfs41_check_open_stateid(state); | 2205 | status = nfs41_check_open_stateid(state); |
2197 | if (status != NFS_OK) | 2206 | if (status != NFS_OK) |
2198 | status = nfs4_open_expired(sp, state); | 2207 | status = nfs4_open_expired(sp, state); |
@@ -2231,19 +2240,8 @@ static int _nfs4_open_and_get_state(struct nfs4_opendata *opendata, | |||
2231 | seq = raw_seqcount_begin(&sp->so_reclaim_seqcount); | 2240 | seq = raw_seqcount_begin(&sp->so_reclaim_seqcount); |
2232 | 2241 | ||
2233 | ret = _nfs4_proc_open(opendata); | 2242 | ret = _nfs4_proc_open(opendata); |
2234 | if (ret != 0) { | 2243 | if (ret != 0) |
2235 | if (ret == -ENOENT) { | ||
2236 | dentry = opendata->dentry; | ||
2237 | if (dentry->d_inode) | ||
2238 | d_delete(dentry); | ||
2239 | else if (d_unhashed(dentry)) | ||
2240 | d_add(dentry, NULL); | ||
2241 | |||
2242 | nfs_set_verifier(dentry, | ||
2243 | nfs_save_change_attribute(opendata->dir->d_inode)); | ||
2244 | } | ||
2245 | goto out; | 2244 | goto out; |
2246 | } | ||
2247 | 2245 | ||
2248 | state = nfs4_opendata_to_nfs4_state(opendata); | 2246 | state = nfs4_opendata_to_nfs4_state(opendata); |
2249 | ret = PTR_ERR(state); | 2247 | ret = PTR_ERR(state); |
@@ -4841,9 +4839,6 @@ nfs4_async_handle_error(struct rpc_task *task, const struct nfs_server *server, | |||
4841 | case -NFS4ERR_DELEG_REVOKED: | 4839 | case -NFS4ERR_DELEG_REVOKED: |
4842 | case -NFS4ERR_ADMIN_REVOKED: | 4840 | case -NFS4ERR_ADMIN_REVOKED: |
4843 | case -NFS4ERR_BAD_STATEID: | 4841 | case -NFS4ERR_BAD_STATEID: |
4844 | if (state == NULL) | ||
4845 | break; | ||
4846 | nfs_remove_bad_delegation(state->inode); | ||
4847 | case -NFS4ERR_OPENMODE: | 4842 | case -NFS4ERR_OPENMODE: |
4848 | if (state == NULL) | 4843 | if (state == NULL) |
4849 | break; | 4844 | break; |
@@ -8341,7 +8336,7 @@ static const struct nfs4_state_recovery_ops nfs41_reboot_recovery_ops = { | |||
8341 | static const struct nfs4_state_recovery_ops nfs40_nograce_recovery_ops = { | 8336 | static const struct nfs4_state_recovery_ops nfs40_nograce_recovery_ops = { |
8342 | .owner_flag_bit = NFS_OWNER_RECLAIM_NOGRACE, | 8337 | .owner_flag_bit = NFS_OWNER_RECLAIM_NOGRACE, |
8343 | .state_flag_bit = NFS_STATE_RECLAIM_NOGRACE, | 8338 | .state_flag_bit = NFS_STATE_RECLAIM_NOGRACE, |
8344 | .recover_open = nfs4_open_expired, | 8339 | .recover_open = nfs40_open_expired, |
8345 | .recover_lock = nfs4_lock_expired, | 8340 | .recover_lock = nfs4_lock_expired, |
8346 | .establish_clid = nfs4_init_clientid, | 8341 | .establish_clid = nfs4_init_clientid, |
8347 | }; | 8342 | }; |
@@ -8408,8 +8403,7 @@ static const struct nfs4_minor_version_ops nfs_v4_1_minor_ops = { | |||
8408 | | NFS_CAP_CHANGE_ATTR | 8403 | | NFS_CAP_CHANGE_ATTR |
8409 | | NFS_CAP_POSIX_LOCK | 8404 | | NFS_CAP_POSIX_LOCK |
8410 | | NFS_CAP_STATEID_NFSV41 | 8405 | | NFS_CAP_STATEID_NFSV41 |
8411 | | NFS_CAP_ATOMIC_OPEN_V1 | 8406 | | NFS_CAP_ATOMIC_OPEN_V1, |
8412 | | NFS_CAP_SEEK, | ||
8413 | .init_client = nfs41_init_client, | 8407 | .init_client = nfs41_init_client, |
8414 | .shutdown_client = nfs41_shutdown_client, | 8408 | .shutdown_client = nfs41_shutdown_client, |
8415 | .match_stateid = nfs41_match_stateid, | 8409 | .match_stateid = nfs41_match_stateid, |
@@ -8431,7 +8425,8 @@ static const struct nfs4_minor_version_ops nfs_v4_2_minor_ops = { | |||
8431 | | NFS_CAP_CHANGE_ATTR | 8425 | | NFS_CAP_CHANGE_ATTR |
8432 | | NFS_CAP_POSIX_LOCK | 8426 | | NFS_CAP_POSIX_LOCK |
8433 | | NFS_CAP_STATEID_NFSV41 | 8427 | | NFS_CAP_STATEID_NFSV41 |
8434 | | NFS_CAP_ATOMIC_OPEN_V1, | 8428 | | NFS_CAP_ATOMIC_OPEN_V1 |
8429 | | NFS_CAP_SEEK, | ||
8435 | .init_client = nfs41_init_client, | 8430 | .init_client = nfs41_init_client, |
8436 | .shutdown_client = nfs41_shutdown_client, | 8431 | .shutdown_client = nfs41_shutdown_client, |
8437 | .match_stateid = nfs41_match_stateid, | 8432 | .match_stateid = nfs41_match_stateid, |
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 12493846a2d3..f83b02dc9166 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -715,8 +715,6 @@ static void nfs_inode_remove_request(struct nfs_page *req) | |||
715 | 715 | ||
716 | if (test_and_clear_bit(PG_INODE_REF, &req->wb_flags)) | 716 | if (test_and_clear_bit(PG_INODE_REF, &req->wb_flags)) |
717 | nfs_release_request(req); | 717 | nfs_release_request(req); |
718 | else | ||
719 | WARN_ON_ONCE(1); | ||
720 | } | 718 | } |
721 | 719 | ||
722 | static void | 720 | static void |
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index cdeb3cfd6f32..0beb023f25ac 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c | |||
@@ -1272,7 +1272,8 @@ static bool need_wrongsec_check(struct svc_rqst *rqstp) | |||
1272 | */ | 1272 | */ |
1273 | if (argp->opcnt == resp->opcnt) | 1273 | if (argp->opcnt == resp->opcnt) |
1274 | return false; | 1274 | return false; |
1275 | 1275 | if (next->opnum == OP_ILLEGAL) | |
1276 | return false; | ||
1276 | nextd = OPDESC(next); | 1277 | nextd = OPDESC(next); |
1277 | /* | 1278 | /* |
1278 | * Rest of 2.6.3.1.1: certain operations will return WRONGSEC | 1279 | * Rest of 2.6.3.1.1: certain operations will return WRONGSEC |
@@ -1589,7 +1590,8 @@ static inline u32 nfsd4_rename_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op | |||
1589 | static inline u32 nfsd4_sequence_rsize(struct svc_rqst *rqstp, | 1590 | static inline u32 nfsd4_sequence_rsize(struct svc_rqst *rqstp, |
1590 | struct nfsd4_op *op) | 1591 | struct nfsd4_op *op) |
1591 | { | 1592 | { |
1592 | return NFS4_MAX_SESSIONID_LEN + 20; | 1593 | return (op_encode_hdr_size |
1594 | + XDR_QUADLEN(NFS4_MAX_SESSIONID_LEN) + 5) * sizeof(__be32); | ||
1593 | } | 1595 | } |
1594 | 1596 | ||
1595 | static inline u32 nfsd4_setattr_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) | 1597 | static inline u32 nfsd4_setattr_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) |
@@ -1893,6 +1895,7 @@ static struct nfsd4_operation nfsd4_ops[] = { | |||
1893 | .op_func = (nfsd4op_func)nfsd4_sequence, | 1895 | .op_func = (nfsd4op_func)nfsd4_sequence, |
1894 | .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_AS_FIRST_OP, | 1896 | .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_AS_FIRST_OP, |
1895 | .op_name = "OP_SEQUENCE", | 1897 | .op_name = "OP_SEQUENCE", |
1898 | .op_rsize_bop = (nfsd4op_rsize)nfsd4_sequence_rsize, | ||
1896 | }, | 1899 | }, |
1897 | [OP_DESTROY_CLIENTID] = { | 1900 | [OP_DESTROY_CLIENTID] = { |
1898 | .op_func = (nfsd4op_func)nfsd4_destroy_clientid, | 1901 | .op_func = (nfsd4op_func)nfsd4_destroy_clientid, |
diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c index 9d3e9c50066a..89326acd4561 100644 --- a/fs/notify/fsnotify.c +++ b/fs/notify/fsnotify.c | |||
@@ -229,8 +229,16 @@ int fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is, | |||
229 | &fsnotify_mark_srcu); | 229 | &fsnotify_mark_srcu); |
230 | } | 230 | } |
231 | 231 | ||
232 | /* | ||
233 | * We need to merge inode & vfsmount mark lists so that inode mark | ||
234 | * ignore masks are properly reflected for mount mark notifications. | ||
235 | * That's why this traversal is so complicated... | ||
236 | */ | ||
232 | while (inode_node || vfsmount_node) { | 237 | while (inode_node || vfsmount_node) { |
233 | inode_group = vfsmount_group = NULL; | 238 | inode_group = NULL; |
239 | inode_mark = NULL; | ||
240 | vfsmount_group = NULL; | ||
241 | vfsmount_mark = NULL; | ||
234 | 242 | ||
235 | if (inode_node) { | 243 | if (inode_node) { |
236 | inode_mark = hlist_entry(srcu_dereference(inode_node, &fsnotify_mark_srcu), | 244 | inode_mark = hlist_entry(srcu_dereference(inode_node, &fsnotify_mark_srcu), |
@@ -244,21 +252,19 @@ int fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is, | |||
244 | vfsmount_group = vfsmount_mark->group; | 252 | vfsmount_group = vfsmount_mark->group; |
245 | } | 253 | } |
246 | 254 | ||
247 | if (inode_group > vfsmount_group) { | 255 | if (inode_group && vfsmount_group) { |
248 | /* handle inode */ | 256 | int cmp = fsnotify_compare_groups(inode_group, |
249 | ret = send_to_group(to_tell, inode_mark, NULL, mask, | 257 | vfsmount_group); |
250 | data, data_is, cookie, file_name); | 258 | if (cmp > 0) { |
251 | /* we didn't use the vfsmount_mark */ | 259 | inode_group = NULL; |
252 | vfsmount_group = NULL; | 260 | inode_mark = NULL; |
253 | } else if (vfsmount_group > inode_group) { | 261 | } else if (cmp < 0) { |
254 | ret = send_to_group(to_tell, NULL, vfsmount_mark, mask, | 262 | vfsmount_group = NULL; |
255 | data, data_is, cookie, file_name); | 263 | vfsmount_mark = NULL; |
256 | inode_group = NULL; | 264 | } |
257 | } else { | ||
258 | ret = send_to_group(to_tell, inode_mark, vfsmount_mark, | ||
259 | mask, data, data_is, cookie, | ||
260 | file_name); | ||
261 | } | 265 | } |
266 | ret = send_to_group(to_tell, inode_mark, vfsmount_mark, mask, | ||
267 | data, data_is, cookie, file_name); | ||
262 | 268 | ||
263 | if (ret && (mask & ALL_FSNOTIFY_PERM_EVENTS)) | 269 | if (ret && (mask & ALL_FSNOTIFY_PERM_EVENTS)) |
264 | goto out; | 270 | goto out; |
diff --git a/fs/notify/fsnotify.h b/fs/notify/fsnotify.h index 9c0898c4cfe1..3b68b0ae0a97 100644 --- a/fs/notify/fsnotify.h +++ b/fs/notify/fsnotify.h | |||
@@ -12,6 +12,10 @@ extern void fsnotify_flush_notify(struct fsnotify_group *group); | |||
12 | /* protects reads of inode and vfsmount marks list */ | 12 | /* protects reads of inode and vfsmount marks list */ |
13 | extern struct srcu_struct fsnotify_mark_srcu; | 13 | extern struct srcu_struct fsnotify_mark_srcu; |
14 | 14 | ||
15 | /* compare two groups for sorting of marks lists */ | ||
16 | extern int fsnotify_compare_groups(struct fsnotify_group *a, | ||
17 | struct fsnotify_group *b); | ||
18 | |||
15 | extern void fsnotify_set_inode_mark_mask_locked(struct fsnotify_mark *fsn_mark, | 19 | extern void fsnotify_set_inode_mark_mask_locked(struct fsnotify_mark *fsn_mark, |
16 | __u32 mask); | 20 | __u32 mask); |
17 | /* add a mark to an inode */ | 21 | /* add a mark to an inode */ |
diff --git a/fs/notify/inode_mark.c b/fs/notify/inode_mark.c index 9ce062218de9..dfbf5447eea4 100644 --- a/fs/notify/inode_mark.c +++ b/fs/notify/inode_mark.c | |||
@@ -194,6 +194,7 @@ int fsnotify_add_inode_mark(struct fsnotify_mark *mark, | |||
194 | { | 194 | { |
195 | struct fsnotify_mark *lmark, *last = NULL; | 195 | struct fsnotify_mark *lmark, *last = NULL; |
196 | int ret = 0; | 196 | int ret = 0; |
197 | int cmp; | ||
197 | 198 | ||
198 | mark->flags |= FSNOTIFY_MARK_FLAG_INODE; | 199 | mark->flags |= FSNOTIFY_MARK_FLAG_INODE; |
199 | 200 | ||
@@ -219,11 +220,8 @@ int fsnotify_add_inode_mark(struct fsnotify_mark *mark, | |||
219 | goto out; | 220 | goto out; |
220 | } | 221 | } |
221 | 222 | ||
222 | if (mark->group->priority < lmark->group->priority) | 223 | cmp = fsnotify_compare_groups(lmark->group, mark->group); |
223 | continue; | 224 | if (cmp < 0) |
224 | |||
225 | if ((mark->group->priority == lmark->group->priority) && | ||
226 | (mark->group < lmark->group)) | ||
227 | continue; | 225 | continue; |
228 | 226 | ||
229 | hlist_add_before_rcu(&mark->i.i_list, &lmark->i.i_list); | 227 | hlist_add_before_rcu(&mark->i.i_list, &lmark->i.i_list); |
@@ -288,20 +286,25 @@ void fsnotify_unmount_inodes(struct list_head *list) | |||
288 | spin_unlock(&inode->i_lock); | 286 | spin_unlock(&inode->i_lock); |
289 | 287 | ||
290 | /* In case the dropping of a reference would nuke next_i. */ | 288 | /* In case the dropping of a reference would nuke next_i. */ |
291 | if ((&next_i->i_sb_list != list) && | 289 | while (&next_i->i_sb_list != list) { |
292 | atomic_read(&next_i->i_count)) { | ||
293 | spin_lock(&next_i->i_lock); | 290 | spin_lock(&next_i->i_lock); |
294 | if (!(next_i->i_state & (I_FREEING | I_WILL_FREE))) { | 291 | if (!(next_i->i_state & (I_FREEING | I_WILL_FREE)) && |
292 | atomic_read(&next_i->i_count)) { | ||
295 | __iget(next_i); | 293 | __iget(next_i); |
296 | need_iput = next_i; | 294 | need_iput = next_i; |
295 | spin_unlock(&next_i->i_lock); | ||
296 | break; | ||
297 | } | 297 | } |
298 | spin_unlock(&next_i->i_lock); | 298 | spin_unlock(&next_i->i_lock); |
299 | next_i = list_entry(next_i->i_sb_list.next, | ||
300 | struct inode, i_sb_list); | ||
299 | } | 301 | } |
300 | 302 | ||
301 | /* | 303 | /* |
302 | * We can safely drop inode_sb_list_lock here because we hold | 304 | * We can safely drop inode_sb_list_lock here because either |
303 | * references on both inode and next_i. Also no new inodes | 305 | * we actually hold references on both inode and next_i or |
304 | * will be added since the umount has begun. | 306 | * end of list. Also no new inodes will be added since the |
307 | * umount has begun. | ||
305 | */ | 308 | */ |
306 | spin_unlock(&inode_sb_list_lock); | 309 | spin_unlock(&inode_sb_list_lock); |
307 | 310 | ||
diff --git a/fs/notify/mark.c b/fs/notify/mark.c index d90deaa08e78..34c38fabf514 100644 --- a/fs/notify/mark.c +++ b/fs/notify/mark.c | |||
@@ -210,6 +210,42 @@ void fsnotify_set_mark_ignored_mask_locked(struct fsnotify_mark *mark, __u32 mas | |||
210 | } | 210 | } |
211 | 211 | ||
212 | /* | 212 | /* |
213 | * Sorting function for lists of fsnotify marks. | ||
214 | * | ||
215 | * Fanotify supports different notification classes (reflected as priority of | ||
216 | * notification group). Events shall be passed to notification groups in | ||
217 | * decreasing priority order. To achieve this marks in notification lists for | ||
218 | * inodes and vfsmounts are sorted so that priorities of corresponding groups | ||
219 | * are descending. | ||
220 | * | ||
221 | * Furthermore correct handling of the ignore mask requires processing inode | ||
222 | * and vfsmount marks of each group together. Using the group address as | ||
223 | * further sort criterion provides a unique sorting order and thus we can | ||
224 | * merge inode and vfsmount lists of marks in linear time and find groups | ||
225 | * present in both lists. | ||
226 | * | ||
227 | * A return value of 1 signifies that b has priority over a. | ||
228 | * A return value of 0 signifies that the two marks have to be handled together. | ||
229 | * A return value of -1 signifies that a has priority over b. | ||
230 | */ | ||
231 | int fsnotify_compare_groups(struct fsnotify_group *a, struct fsnotify_group *b) | ||
232 | { | ||
233 | if (a == b) | ||
234 | return 0; | ||
235 | if (!a) | ||
236 | return 1; | ||
237 | if (!b) | ||
238 | return -1; | ||
239 | if (a->priority < b->priority) | ||
240 | return 1; | ||
241 | if (a->priority > b->priority) | ||
242 | return -1; | ||
243 | if (a < b) | ||
244 | return 1; | ||
245 | return -1; | ||
246 | } | ||
247 | |||
248 | /* | ||
213 | * Attach an initialized mark to a given group and fs object. | 249 | * Attach an initialized mark to a given group and fs object. |
214 | * These marks may be used for the fsnotify backend to determine which | 250 | * These marks may be used for the fsnotify backend to determine which |
215 | * event types should be delivered to which group. | 251 | * event types should be delivered to which group. |
diff --git a/fs/notify/vfsmount_mark.c b/fs/notify/vfsmount_mark.c index ac851e8376b1..faefa72a11eb 100644 --- a/fs/notify/vfsmount_mark.c +++ b/fs/notify/vfsmount_mark.c | |||
@@ -153,6 +153,7 @@ int fsnotify_add_vfsmount_mark(struct fsnotify_mark *mark, | |||
153 | struct mount *m = real_mount(mnt); | 153 | struct mount *m = real_mount(mnt); |
154 | struct fsnotify_mark *lmark, *last = NULL; | 154 | struct fsnotify_mark *lmark, *last = NULL; |
155 | int ret = 0; | 155 | int ret = 0; |
156 | int cmp; | ||
156 | 157 | ||
157 | mark->flags |= FSNOTIFY_MARK_FLAG_VFSMOUNT; | 158 | mark->flags |= FSNOTIFY_MARK_FLAG_VFSMOUNT; |
158 | 159 | ||
@@ -178,11 +179,8 @@ int fsnotify_add_vfsmount_mark(struct fsnotify_mark *mark, | |||
178 | goto out; | 179 | goto out; |
179 | } | 180 | } |
180 | 181 | ||
181 | if (mark->group->priority < lmark->group->priority) | 182 | cmp = fsnotify_compare_groups(lmark->group, mark->group); |
182 | continue; | 183 | if (cmp < 0) |
183 | |||
184 | if ((mark->group->priority == lmark->group->priority) && | ||
185 | (mark->group < lmark->group)) | ||
186 | continue; | 184 | continue; |
187 | 185 | ||
188 | hlist_add_before_rcu(&mark->m.m_list, &lmark->m.m_list); | 186 | hlist_add_before_rcu(&mark->m.m_list, &lmark->m.m_list); |
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c index 97de0fbd9f78..a96044004064 100644 --- a/fs/ocfs2/cluster/tcp.c +++ b/fs/ocfs2/cluster/tcp.c | |||
@@ -925,7 +925,7 @@ static int o2net_send_tcp_msg(struct socket *sock, struct kvec *vec, | |||
925 | size_t veclen, size_t total) | 925 | size_t veclen, size_t total) |
926 | { | 926 | { |
927 | int ret; | 927 | int ret; |
928 | struct msghdr msg; | 928 | struct msghdr msg = {.msg_flags = 0,}; |
929 | 929 | ||
930 | if (sock == NULL) { | 930 | if (sock == NULL) { |
931 | ret = -EINVAL; | 931 | ret = -EINVAL; |
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c index 8add6f1030d7..b931e04e3388 100644 --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c | |||
@@ -158,7 +158,7 @@ bail_add: | |||
158 | * NOTE: This dentry already has ->d_op set from | 158 | * NOTE: This dentry already has ->d_op set from |
159 | * ocfs2_get_parent() and ocfs2_get_dentry() | 159 | * ocfs2_get_parent() and ocfs2_get_dentry() |
160 | */ | 160 | */ |
161 | if (ret) | 161 | if (!IS_ERR_OR_NULL(ret)) |
162 | dentry = ret; | 162 | dentry = ret; |
163 | 163 | ||
164 | status = ocfs2_dentry_attach_lock(dentry, inode, | 164 | status = ocfs2_dentry_attach_lock(dentry, inode, |
diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c index 910553f37aca..2a7ef4f8e2a6 100644 --- a/fs/overlayfs/readdir.c +++ b/fs/overlayfs/readdir.c | |||
@@ -21,9 +21,10 @@ struct ovl_cache_entry { | |||
21 | unsigned int len; | 21 | unsigned int len; |
22 | unsigned int type; | 22 | unsigned int type; |
23 | u64 ino; | 23 | u64 ino; |
24 | bool is_whiteout; | ||
25 | struct list_head l_node; | 24 | struct list_head l_node; |
26 | struct rb_node node; | 25 | struct rb_node node; |
26 | bool is_whiteout; | ||
27 | bool is_cursor; | ||
27 | char name[]; | 28 | char name[]; |
28 | }; | 29 | }; |
29 | 30 | ||
@@ -92,6 +93,7 @@ static struct ovl_cache_entry *ovl_cache_entry_new(const char *name, int len, | |||
92 | p->type = d_type; | 93 | p->type = d_type; |
93 | p->ino = ino; | 94 | p->ino = ino; |
94 | p->is_whiteout = false; | 95 | p->is_whiteout = false; |
96 | p->is_cursor = false; | ||
95 | } | 97 | } |
96 | 98 | ||
97 | return p; | 99 | return p; |
@@ -166,7 +168,7 @@ static void ovl_cache_put(struct ovl_dir_file *od, struct dentry *dentry) | |||
166 | { | 168 | { |
167 | struct ovl_dir_cache *cache = od->cache; | 169 | struct ovl_dir_cache *cache = od->cache; |
168 | 170 | ||
169 | list_del(&od->cursor.l_node); | 171 | list_del_init(&od->cursor.l_node); |
170 | WARN_ON(cache->refcount <= 0); | 172 | WARN_ON(cache->refcount <= 0); |
171 | cache->refcount--; | 173 | cache->refcount--; |
172 | if (!cache->refcount) { | 174 | if (!cache->refcount) { |
@@ -251,7 +253,7 @@ static int ovl_dir_mark_whiteouts(struct dentry *dir, | |||
251 | 253 | ||
252 | mutex_lock(&dir->d_inode->i_mutex); | 254 | mutex_lock(&dir->d_inode->i_mutex); |
253 | list_for_each_entry(p, rdd->list, l_node) { | 255 | list_for_each_entry(p, rdd->list, l_node) { |
254 | if (!p->name) | 256 | if (p->is_cursor) |
255 | continue; | 257 | continue; |
256 | 258 | ||
257 | if (p->type != DT_CHR) | 259 | if (p->type != DT_CHR) |
@@ -307,7 +309,6 @@ static inline int ovl_dir_read_merged(struct path *upperpath, | |||
307 | } | 309 | } |
308 | out: | 310 | out: |
309 | return err; | 311 | return err; |
310 | |||
311 | } | 312 | } |
312 | 313 | ||
313 | static void ovl_seek_cursor(struct ovl_dir_file *od, loff_t pos) | 314 | static void ovl_seek_cursor(struct ovl_dir_file *od, loff_t pos) |
@@ -316,7 +317,7 @@ static void ovl_seek_cursor(struct ovl_dir_file *od, loff_t pos) | |||
316 | loff_t off = 0; | 317 | loff_t off = 0; |
317 | 318 | ||
318 | list_for_each_entry(p, &od->cache->entries, l_node) { | 319 | list_for_each_entry(p, &od->cache->entries, l_node) { |
319 | if (!p->name) | 320 | if (p->is_cursor) |
320 | continue; | 321 | continue; |
321 | if (off >= pos) | 322 | if (off >= pos) |
322 | break; | 323 | break; |
@@ -389,7 +390,7 @@ static int ovl_iterate(struct file *file, struct dir_context *ctx) | |||
389 | 390 | ||
390 | p = list_entry(od->cursor.l_node.next, struct ovl_cache_entry, l_node); | 391 | p = list_entry(od->cursor.l_node.next, struct ovl_cache_entry, l_node); |
391 | /* Skip cursors */ | 392 | /* Skip cursors */ |
392 | if (p->name) { | 393 | if (!p->is_cursor) { |
393 | if (!p->is_whiteout) { | 394 | if (!p->is_whiteout) { |
394 | if (!dir_emit(ctx, p->name, p->len, p->ino, p->type)) | 395 | if (!dir_emit(ctx, p->name, p->len, p->ino, p->type)) |
395 | break; | 396 | break; |
@@ -454,12 +455,13 @@ static int ovl_dir_fsync(struct file *file, loff_t start, loff_t end, | |||
454 | if (!od->is_upper && ovl_path_type(dentry) == OVL_PATH_MERGE) { | 455 | if (!od->is_upper && ovl_path_type(dentry) == OVL_PATH_MERGE) { |
455 | struct inode *inode = file_inode(file); | 456 | struct inode *inode = file_inode(file); |
456 | 457 | ||
457 | realfile = od->upperfile; | 458 | realfile =lockless_dereference(od->upperfile); |
458 | if (!realfile) { | 459 | if (!realfile) { |
459 | struct path upperpath; | 460 | struct path upperpath; |
460 | 461 | ||
461 | ovl_path_upper(dentry, &upperpath); | 462 | ovl_path_upper(dentry, &upperpath); |
462 | realfile = ovl_path_open(&upperpath, O_RDONLY); | 463 | realfile = ovl_path_open(&upperpath, O_RDONLY); |
464 | smp_mb__before_spinlock(); | ||
463 | mutex_lock(&inode->i_mutex); | 465 | mutex_lock(&inode->i_mutex); |
464 | if (!od->upperfile) { | 466 | if (!od->upperfile) { |
465 | if (IS_ERR(realfile)) { | 467 | if (IS_ERR(realfile)) { |
@@ -518,6 +520,7 @@ static int ovl_dir_open(struct inode *inode, struct file *file) | |||
518 | od->realfile = realfile; | 520 | od->realfile = realfile; |
519 | od->is_real = (type != OVL_PATH_MERGE); | 521 | od->is_real = (type != OVL_PATH_MERGE); |
520 | od->is_upper = (type != OVL_PATH_LOWER); | 522 | od->is_upper = (type != OVL_PATH_LOWER); |
523 | od->cursor.is_cursor = true; | ||
521 | file->private_data = od; | 524 | file->private_data = od; |
522 | 525 | ||
523 | return 0; | 526 | return 0; |
@@ -569,7 +572,7 @@ void ovl_cleanup_whiteouts(struct dentry *upper, struct list_head *list) | |||
569 | { | 572 | { |
570 | struct ovl_cache_entry *p; | 573 | struct ovl_cache_entry *p; |
571 | 574 | ||
572 | mutex_lock_nested(&upper->d_inode->i_mutex, I_MUTEX_PARENT); | 575 | mutex_lock_nested(&upper->d_inode->i_mutex, I_MUTEX_CHILD); |
573 | list_for_each_entry(p, list, l_node) { | 576 | list_for_each_entry(p, list, l_node) { |
574 | struct dentry *dentry; | 577 | struct dentry *dentry; |
575 | 578 | ||
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index 8b663b2d9562..6b4527216a7f 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c | |||
@@ -634,7 +634,7 @@ int dquot_writeback_dquots(struct super_block *sb, int type) | |||
634 | dqstats_inc(DQST_LOOKUPS); | 634 | dqstats_inc(DQST_LOOKUPS); |
635 | err = sb->dq_op->write_dquot(dquot); | 635 | err = sb->dq_op->write_dquot(dquot); |
636 | if (!ret && err) | 636 | if (!ret && err) |
637 | err = ret; | 637 | ret = err; |
638 | dqput(dquot); | 638 | dqput(dquot); |
639 | spin_lock(&dq_list_lock); | 639 | spin_lock(&dq_list_lock); |
640 | } | 640 | } |
diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c index 92e8f99a5857..281002689d64 100644 --- a/fs/xfs/xfs_bmap_util.c +++ b/fs/xfs/xfs_bmap_util.c | |||
@@ -1338,7 +1338,10 @@ xfs_free_file_space( | |||
1338 | goto out; | 1338 | goto out; |
1339 | } | 1339 | } |
1340 | 1340 | ||
1341 | 1341 | /* | |
1342 | * Preallocate and zero a range of a file. This mechanism has the allocation | ||
1343 | * semantics of fallocate and in addition converts data in the range to zeroes. | ||
1344 | */ | ||
1342 | int | 1345 | int |
1343 | xfs_zero_file_space( | 1346 | xfs_zero_file_space( |
1344 | struct xfs_inode *ip, | 1347 | struct xfs_inode *ip, |
@@ -1346,65 +1349,30 @@ xfs_zero_file_space( | |||
1346 | xfs_off_t len) | 1349 | xfs_off_t len) |
1347 | { | 1350 | { |
1348 | struct xfs_mount *mp = ip->i_mount; | 1351 | struct xfs_mount *mp = ip->i_mount; |
1349 | uint granularity; | 1352 | uint blksize; |
1350 | xfs_off_t start_boundary; | ||
1351 | xfs_off_t end_boundary; | ||
1352 | int error; | 1353 | int error; |
1353 | 1354 | ||
1354 | trace_xfs_zero_file_space(ip); | 1355 | trace_xfs_zero_file_space(ip); |
1355 | 1356 | ||
1356 | granularity = max_t(uint, 1 << mp->m_sb.sb_blocklog, PAGE_CACHE_SIZE); | 1357 | blksize = 1 << mp->m_sb.sb_blocklog; |
1357 | 1358 | ||
1358 | /* | 1359 | /* |
1359 | * Round the range of extents we are going to convert inwards. If the | 1360 | * Punch a hole and prealloc the range. We use hole punch rather than |
1360 | * offset is aligned, then it doesn't get changed so we zero from the | 1361 | * unwritten extent conversion for two reasons: |
1361 | * start of the block offset points to. | 1362 | * |
1363 | * 1.) Hole punch handles partial block zeroing for us. | ||
1364 | * | ||
1365 | * 2.) If prealloc returns ENOSPC, the file range is still zero-valued | ||
1366 | * by virtue of the hole punch. | ||
1362 | */ | 1367 | */ |
1363 | start_boundary = round_up(offset, granularity); | 1368 | error = xfs_free_file_space(ip, offset, len); |
1364 | end_boundary = round_down(offset + len, granularity); | 1369 | if (error) |
1365 | 1370 | goto out; | |
1366 | ASSERT(start_boundary >= offset); | ||
1367 | ASSERT(end_boundary <= offset + len); | ||
1368 | |||
1369 | if (start_boundary < end_boundary - 1) { | ||
1370 | /* | ||
1371 | * Writeback the range to ensure any inode size updates due to | ||
1372 | * appending writes make it to disk (otherwise we could just | ||
1373 | * punch out the delalloc blocks). | ||
1374 | */ | ||
1375 | error = filemap_write_and_wait_range(VFS_I(ip)->i_mapping, | ||
1376 | start_boundary, end_boundary - 1); | ||
1377 | if (error) | ||
1378 | goto out; | ||
1379 | truncate_pagecache_range(VFS_I(ip), start_boundary, | ||
1380 | end_boundary - 1); | ||
1381 | |||
1382 | /* convert the blocks */ | ||
1383 | error = xfs_alloc_file_space(ip, start_boundary, | ||
1384 | end_boundary - start_boundary - 1, | ||
1385 | XFS_BMAPI_PREALLOC | XFS_BMAPI_CONVERT); | ||
1386 | if (error) | ||
1387 | goto out; | ||
1388 | |||
1389 | /* We've handled the interior of the range, now for the edges */ | ||
1390 | if (start_boundary != offset) { | ||
1391 | error = xfs_iozero(ip, offset, start_boundary - offset); | ||
1392 | if (error) | ||
1393 | goto out; | ||
1394 | } | ||
1395 | |||
1396 | if (end_boundary != offset + len) | ||
1397 | error = xfs_iozero(ip, end_boundary, | ||
1398 | offset + len - end_boundary); | ||
1399 | |||
1400 | } else { | ||
1401 | /* | ||
1402 | * It's either a sub-granularity range or the range spanned lies | ||
1403 | * partially across two adjacent blocks. | ||
1404 | */ | ||
1405 | error = xfs_iozero(ip, offset, len); | ||
1406 | } | ||
1407 | 1371 | ||
1372 | error = xfs_alloc_file_space(ip, round_down(offset, blksize), | ||
1373 | round_up(offset + len, blksize) - | ||
1374 | round_down(offset, blksize), | ||
1375 | XFS_BMAPI_PREALLOC); | ||
1408 | out: | 1376 | out: |
1409 | return error; | 1377 | return error; |
1410 | 1378 | ||
diff --git a/fs/xfs/xfs_itable.c b/fs/xfs/xfs_itable.c index f1deb961a296..894924a5129b 100644 --- a/fs/xfs/xfs_itable.c +++ b/fs/xfs/xfs_itable.c | |||
@@ -236,8 +236,10 @@ xfs_bulkstat_grab_ichunk( | |||
236 | XFS_WANT_CORRUPTED_RETURN(stat == 1); | 236 | XFS_WANT_CORRUPTED_RETURN(stat == 1); |
237 | 237 | ||
238 | /* Check if the record contains the inode in request */ | 238 | /* Check if the record contains the inode in request */ |
239 | if (irec->ir_startino + XFS_INODES_PER_CHUNK <= agino) | 239 | if (irec->ir_startino + XFS_INODES_PER_CHUNK <= agino) { |
240 | return -EINVAL; | 240 | *icount = 0; |
241 | return 0; | ||
242 | } | ||
241 | 243 | ||
242 | idx = agino - irec->ir_startino + 1; | 244 | idx = agino - irec->ir_startino + 1; |
243 | if (idx < XFS_INODES_PER_CHUNK && | 245 | if (idx < XFS_INODES_PER_CHUNK && |
@@ -262,75 +264,76 @@ xfs_bulkstat_grab_ichunk( | |||
262 | 264 | ||
263 | #define XFS_BULKSTAT_UBLEFT(ubleft) ((ubleft) >= statstruct_size) | 265 | #define XFS_BULKSTAT_UBLEFT(ubleft) ((ubleft) >= statstruct_size) |
264 | 266 | ||
267 | struct xfs_bulkstat_agichunk { | ||
268 | char __user **ac_ubuffer;/* pointer into user's buffer */ | ||
269 | int ac_ubleft; /* bytes left in user's buffer */ | ||
270 | int ac_ubelem; /* spaces used in user's buffer */ | ||
271 | }; | ||
272 | |||
265 | /* | 273 | /* |
266 | * Process inodes in chunk with a pointer to a formatter function | 274 | * Process inodes in chunk with a pointer to a formatter function |
267 | * that will iget the inode and fill in the appropriate structure. | 275 | * that will iget the inode and fill in the appropriate structure. |
268 | */ | 276 | */ |
269 | int | 277 | static int |
270 | xfs_bulkstat_ag_ichunk( | 278 | xfs_bulkstat_ag_ichunk( |
271 | struct xfs_mount *mp, | 279 | struct xfs_mount *mp, |
272 | xfs_agnumber_t agno, | 280 | xfs_agnumber_t agno, |
273 | struct xfs_inobt_rec_incore *irbp, | 281 | struct xfs_inobt_rec_incore *irbp, |
274 | bulkstat_one_pf formatter, | 282 | bulkstat_one_pf formatter, |
275 | size_t statstruct_size, | 283 | size_t statstruct_size, |
276 | struct xfs_bulkstat_agichunk *acp) | 284 | struct xfs_bulkstat_agichunk *acp, |
285 | xfs_agino_t *last_agino) | ||
277 | { | 286 | { |
278 | xfs_ino_t lastino = acp->ac_lastino; | ||
279 | char __user **ubufp = acp->ac_ubuffer; | 287 | char __user **ubufp = acp->ac_ubuffer; |
280 | int ubleft = acp->ac_ubleft; | 288 | int chunkidx; |
281 | int ubelem = acp->ac_ubelem; | ||
282 | int chunkidx, clustidx; | ||
283 | int error = 0; | 289 | int error = 0; |
284 | xfs_agino_t agino; | 290 | xfs_agino_t agino = irbp->ir_startino; |
285 | 291 | ||
286 | for (agino = irbp->ir_startino, chunkidx = clustidx = 0; | 292 | for (chunkidx = 0; chunkidx < XFS_INODES_PER_CHUNK; |
287 | XFS_BULKSTAT_UBLEFT(ubleft) && | 293 | chunkidx++, agino++) { |
288 | irbp->ir_freecount < XFS_INODES_PER_CHUNK; | 294 | int fmterror; |
289 | chunkidx++, clustidx++, agino++) { | ||
290 | int fmterror; /* bulkstat formatter result */ | ||
291 | int ubused; | 295 | int ubused; |
292 | xfs_ino_t ino = XFS_AGINO_TO_INO(mp, agno, agino); | ||
293 | 296 | ||
294 | ASSERT(chunkidx < XFS_INODES_PER_CHUNK); | 297 | /* inode won't fit in buffer, we are done */ |
298 | if (acp->ac_ubleft < statstruct_size) | ||
299 | break; | ||
295 | 300 | ||
296 | /* Skip if this inode is free */ | 301 | /* Skip if this inode is free */ |
297 | if (XFS_INOBT_MASK(chunkidx) & irbp->ir_free) { | 302 | if (XFS_INOBT_MASK(chunkidx) & irbp->ir_free) |
298 | lastino = ino; | ||
299 | continue; | 303 | continue; |
300 | } | ||
301 | |||
302 | /* | ||
303 | * Count used inodes as free so we can tell when the | ||
304 | * chunk is used up. | ||
305 | */ | ||
306 | irbp->ir_freecount++; | ||
307 | 304 | ||
308 | /* Get the inode and fill in a single buffer */ | 305 | /* Get the inode and fill in a single buffer */ |
309 | ubused = statstruct_size; | 306 | ubused = statstruct_size; |
310 | error = formatter(mp, ino, *ubufp, ubleft, &ubused, &fmterror); | 307 | error = formatter(mp, XFS_AGINO_TO_INO(mp, agno, agino), |
311 | if (fmterror == BULKSTAT_RV_NOTHING) { | 308 | *ubufp, acp->ac_ubleft, &ubused, &fmterror); |
312 | if (error && error != -ENOENT && error != -EINVAL) { | 309 | |
313 | ubleft = 0; | 310 | if (fmterror == BULKSTAT_RV_GIVEUP || |
314 | break; | 311 | (error && error != -ENOENT && error != -EINVAL)) { |
315 | } | 312 | acp->ac_ubleft = 0; |
316 | lastino = ino; | ||
317 | continue; | ||
318 | } | ||
319 | if (fmterror == BULKSTAT_RV_GIVEUP) { | ||
320 | ubleft = 0; | ||
321 | ASSERT(error); | 313 | ASSERT(error); |
322 | break; | 314 | break; |
323 | } | 315 | } |
324 | if (*ubufp) | 316 | |
325 | *ubufp += ubused; | 317 | /* be careful not to leak error if at end of chunk */ |
326 | ubleft -= ubused; | 318 | if (fmterror == BULKSTAT_RV_NOTHING || error) { |
327 | ubelem++; | 319 | error = 0; |
328 | lastino = ino; | 320 | continue; |
321 | } | ||
322 | |||
323 | *ubufp += ubused; | ||
324 | acp->ac_ubleft -= ubused; | ||
325 | acp->ac_ubelem++; | ||
329 | } | 326 | } |
330 | 327 | ||
331 | acp->ac_lastino = lastino; | 328 | /* |
332 | acp->ac_ubleft = ubleft; | 329 | * Post-update *last_agino. At this point, agino will always point one |
333 | acp->ac_ubelem = ubelem; | 330 | * inode past the last inode we processed successfully. Hence we |
331 | * substract that inode when setting the *last_agino cursor so that we | ||
332 | * return the correct cookie to userspace. On the next bulkstat call, | ||
333 | * the inode under the lastino cookie will be skipped as we have already | ||
334 | * processed it here. | ||
335 | */ | ||
336 | *last_agino = agino - 1; | ||
334 | 337 | ||
335 | return error; | 338 | return error; |
336 | } | 339 | } |
@@ -353,45 +356,33 @@ xfs_bulkstat( | |||
353 | xfs_agino_t agino; /* inode # in allocation group */ | 356 | xfs_agino_t agino; /* inode # in allocation group */ |
354 | xfs_agnumber_t agno; /* allocation group number */ | 357 | xfs_agnumber_t agno; /* allocation group number */ |
355 | xfs_btree_cur_t *cur; /* btree cursor for ialloc btree */ | 358 | xfs_btree_cur_t *cur; /* btree cursor for ialloc btree */ |
356 | int end_of_ag; /* set if we've seen the ag end */ | ||
357 | int error; /* error code */ | ||
358 | int fmterror;/* bulkstat formatter result */ | ||
359 | int i; /* loop index */ | ||
360 | int icount; /* count of inodes good in irbuf */ | ||
361 | size_t irbsize; /* size of irec buffer in bytes */ | 359 | size_t irbsize; /* size of irec buffer in bytes */ |
362 | xfs_ino_t ino; /* inode number (filesystem) */ | ||
363 | xfs_inobt_rec_incore_t *irbp; /* current irec buffer pointer */ | ||
364 | xfs_inobt_rec_incore_t *irbuf; /* start of irec buffer */ | 360 | xfs_inobt_rec_incore_t *irbuf; /* start of irec buffer */ |
365 | xfs_inobt_rec_incore_t *irbufend; /* end of good irec buffer entries */ | ||
366 | xfs_ino_t lastino; /* last inode number returned */ | ||
367 | int nirbuf; /* size of irbuf */ | 361 | int nirbuf; /* size of irbuf */ |
368 | int rval; /* return value error code */ | ||
369 | int tmp; /* result value from btree calls */ | ||
370 | int ubcount; /* size of user's buffer */ | 362 | int ubcount; /* size of user's buffer */ |
371 | int ubleft; /* bytes left in user's buffer */ | 363 | struct xfs_bulkstat_agichunk ac; |
372 | char __user *ubufp; /* pointer into user's buffer */ | 364 | int error = 0; |
373 | int ubelem; /* spaces used in user's buffer */ | ||
374 | 365 | ||
375 | /* | 366 | /* |
376 | * Get the last inode value, see if there's nothing to do. | 367 | * Get the last inode value, see if there's nothing to do. |
377 | */ | 368 | */ |
378 | ino = (xfs_ino_t)*lastinop; | 369 | agno = XFS_INO_TO_AGNO(mp, *lastinop); |
379 | lastino = ino; | 370 | agino = XFS_INO_TO_AGINO(mp, *lastinop); |
380 | agno = XFS_INO_TO_AGNO(mp, ino); | ||
381 | agino = XFS_INO_TO_AGINO(mp, ino); | ||
382 | if (agno >= mp->m_sb.sb_agcount || | 371 | if (agno >= mp->m_sb.sb_agcount || |
383 | ino != XFS_AGINO_TO_INO(mp, agno, agino)) { | 372 | *lastinop != XFS_AGINO_TO_INO(mp, agno, agino)) { |
384 | *done = 1; | 373 | *done = 1; |
385 | *ubcountp = 0; | 374 | *ubcountp = 0; |
386 | return 0; | 375 | return 0; |
387 | } | 376 | } |
388 | 377 | ||
389 | ubcount = *ubcountp; /* statstruct's */ | 378 | ubcount = *ubcountp; /* statstruct's */ |
390 | ubleft = ubcount * statstruct_size; /* bytes */ | 379 | ac.ac_ubuffer = &ubuffer; |
391 | *ubcountp = ubelem = 0; | 380 | ac.ac_ubleft = ubcount * statstruct_size; /* bytes */; |
381 | ac.ac_ubelem = 0; | ||
382 | |||
383 | *ubcountp = 0; | ||
392 | *done = 0; | 384 | *done = 0; |
393 | fmterror = 0; | 385 | |
394 | ubufp = ubuffer; | ||
395 | irbuf = kmem_zalloc_greedy(&irbsize, PAGE_SIZE, PAGE_SIZE * 4); | 386 | irbuf = kmem_zalloc_greedy(&irbsize, PAGE_SIZE, PAGE_SIZE * 4); |
396 | if (!irbuf) | 387 | if (!irbuf) |
397 | return -ENOMEM; | 388 | return -ENOMEM; |
@@ -402,9 +393,13 @@ xfs_bulkstat( | |||
402 | * Loop over the allocation groups, starting from the last | 393 | * Loop over the allocation groups, starting from the last |
403 | * inode returned; 0 means start of the allocation group. | 394 | * inode returned; 0 means start of the allocation group. |
404 | */ | 395 | */ |
405 | rval = 0; | 396 | while (agno < mp->m_sb.sb_agcount) { |
406 | while (XFS_BULKSTAT_UBLEFT(ubleft) && agno < mp->m_sb.sb_agcount) { | 397 | struct xfs_inobt_rec_incore *irbp = irbuf; |
407 | cond_resched(); | 398 | struct xfs_inobt_rec_incore *irbufend = irbuf + nirbuf; |
399 | bool end_of_ag = false; | ||
400 | int icount = 0; | ||
401 | int stat; | ||
402 | |||
408 | error = xfs_ialloc_read_agi(mp, NULL, agno, &agbp); | 403 | error = xfs_ialloc_read_agi(mp, NULL, agno, &agbp); |
409 | if (error) | 404 | if (error) |
410 | break; | 405 | break; |
@@ -414,10 +409,6 @@ xfs_bulkstat( | |||
414 | */ | 409 | */ |
415 | cur = xfs_inobt_init_cursor(mp, NULL, agbp, agno, | 410 | cur = xfs_inobt_init_cursor(mp, NULL, agbp, agno, |
416 | XFS_BTNUM_INO); | 411 | XFS_BTNUM_INO); |
417 | irbp = irbuf; | ||
418 | irbufend = irbuf + nirbuf; | ||
419 | end_of_ag = 0; | ||
420 | icount = 0; | ||
421 | if (agino > 0) { | 412 | if (agino > 0) { |
422 | /* | 413 | /* |
423 | * In the middle of an allocation group, we need to get | 414 | * In the middle of an allocation group, we need to get |
@@ -427,22 +418,23 @@ xfs_bulkstat( | |||
427 | 418 | ||
428 | error = xfs_bulkstat_grab_ichunk(cur, agino, &icount, &r); | 419 | error = xfs_bulkstat_grab_ichunk(cur, agino, &icount, &r); |
429 | if (error) | 420 | if (error) |
430 | break; | 421 | goto del_cursor; |
431 | if (icount) { | 422 | if (icount) { |
432 | irbp->ir_startino = r.ir_startino; | 423 | irbp->ir_startino = r.ir_startino; |
433 | irbp->ir_freecount = r.ir_freecount; | 424 | irbp->ir_freecount = r.ir_freecount; |
434 | irbp->ir_free = r.ir_free; | 425 | irbp->ir_free = r.ir_free; |
435 | irbp++; | 426 | irbp++; |
436 | agino = r.ir_startino + XFS_INODES_PER_CHUNK; | ||
437 | } | 427 | } |
438 | /* Increment to the next record */ | 428 | /* Increment to the next record */ |
439 | error = xfs_btree_increment(cur, 0, &tmp); | 429 | error = xfs_btree_increment(cur, 0, &stat); |
440 | } else { | 430 | } else { |
441 | /* Start of ag. Lookup the first inode chunk */ | 431 | /* Start of ag. Lookup the first inode chunk */ |
442 | error = xfs_inobt_lookup(cur, 0, XFS_LOOKUP_GE, &tmp); | 432 | error = xfs_inobt_lookup(cur, 0, XFS_LOOKUP_GE, &stat); |
433 | } | ||
434 | if (error || stat == 0) { | ||
435 | end_of_ag = true; | ||
436 | goto del_cursor; | ||
443 | } | 437 | } |
444 | if (error) | ||
445 | break; | ||
446 | 438 | ||
447 | /* | 439 | /* |
448 | * Loop through inode btree records in this ag, | 440 | * Loop through inode btree records in this ag, |
@@ -451,10 +443,10 @@ xfs_bulkstat( | |||
451 | while (irbp < irbufend && icount < ubcount) { | 443 | while (irbp < irbufend && icount < ubcount) { |
452 | struct xfs_inobt_rec_incore r; | 444 | struct xfs_inobt_rec_incore r; |
453 | 445 | ||
454 | error = xfs_inobt_get_rec(cur, &r, &i); | 446 | error = xfs_inobt_get_rec(cur, &r, &stat); |
455 | if (error || i == 0) { | 447 | if (error || stat == 0) { |
456 | end_of_ag = 1; | 448 | end_of_ag = true; |
457 | break; | 449 | goto del_cursor; |
458 | } | 450 | } |
459 | 451 | ||
460 | /* | 452 | /* |
@@ -469,77 +461,79 @@ xfs_bulkstat( | |||
469 | irbp++; | 461 | irbp++; |
470 | icount += XFS_INODES_PER_CHUNK - r.ir_freecount; | 462 | icount += XFS_INODES_PER_CHUNK - r.ir_freecount; |
471 | } | 463 | } |
472 | /* | 464 | error = xfs_btree_increment(cur, 0, &stat); |
473 | * Set agino to after this chunk and bump the cursor. | 465 | if (error || stat == 0) { |
474 | */ | 466 | end_of_ag = true; |
475 | agino = r.ir_startino + XFS_INODES_PER_CHUNK; | 467 | goto del_cursor; |
476 | error = xfs_btree_increment(cur, 0, &tmp); | 468 | } |
477 | cond_resched(); | 469 | cond_resched(); |
478 | } | 470 | } |
471 | |||
479 | /* | 472 | /* |
480 | * Drop the btree buffers and the agi buffer. | 473 | * Drop the btree buffers and the agi buffer as we can't hold any |
481 | * We can't hold any of the locks these represent | 474 | * of the locks these represent when calling iget. If there is a |
482 | * when calling iget. | 475 | * pending error, then we are done. |
483 | */ | 476 | */ |
477 | del_cursor: | ||
484 | xfs_btree_del_cursor(cur, XFS_BTREE_NOERROR); | 478 | xfs_btree_del_cursor(cur, XFS_BTREE_NOERROR); |
485 | xfs_buf_relse(agbp); | 479 | xfs_buf_relse(agbp); |
480 | if (error) | ||
481 | break; | ||
486 | /* | 482 | /* |
487 | * Now format all the good inodes into the user's buffer. | 483 | * Now format all the good inodes into the user's buffer. The |
484 | * call to xfs_bulkstat_ag_ichunk() sets up the agino pointer | ||
485 | * for the next loop iteration. | ||
488 | */ | 486 | */ |
489 | irbufend = irbp; | 487 | irbufend = irbp; |
490 | for (irbp = irbuf; | 488 | for (irbp = irbuf; |
491 | irbp < irbufend && XFS_BULKSTAT_UBLEFT(ubleft); irbp++) { | 489 | irbp < irbufend && ac.ac_ubleft >= statstruct_size; |
492 | struct xfs_bulkstat_agichunk ac; | 490 | irbp++) { |
493 | |||
494 | ac.ac_lastino = lastino; | ||
495 | ac.ac_ubuffer = &ubuffer; | ||
496 | ac.ac_ubleft = ubleft; | ||
497 | ac.ac_ubelem = ubelem; | ||
498 | error = xfs_bulkstat_ag_ichunk(mp, agno, irbp, | 491 | error = xfs_bulkstat_ag_ichunk(mp, agno, irbp, |
499 | formatter, statstruct_size, &ac); | 492 | formatter, statstruct_size, &ac, |
493 | &agino); | ||
500 | if (error) | 494 | if (error) |
501 | rval = error; | 495 | break; |
502 | |||
503 | lastino = ac.ac_lastino; | ||
504 | ubleft = ac.ac_ubleft; | ||
505 | ubelem = ac.ac_ubelem; | ||
506 | 496 | ||
507 | cond_resched(); | 497 | cond_resched(); |
508 | } | 498 | } |
499 | |||
509 | /* | 500 | /* |
510 | * Set up for the next loop iteration. | 501 | * If we've run out of space or had a formatting error, we |
502 | * are now done | ||
511 | */ | 503 | */ |
512 | if (XFS_BULKSTAT_UBLEFT(ubleft)) { | 504 | if (ac.ac_ubleft < statstruct_size || error) |
513 | if (end_of_ag) { | ||
514 | agno++; | ||
515 | agino = 0; | ||
516 | } else | ||
517 | agino = XFS_INO_TO_AGINO(mp, lastino); | ||
518 | } else | ||
519 | break; | 505 | break; |
506 | |||
507 | if (end_of_ag) { | ||
508 | agno++; | ||
509 | agino = 0; | ||
510 | } | ||
520 | } | 511 | } |
521 | /* | 512 | /* |
522 | * Done, we're either out of filesystem or space to put the data. | 513 | * Done, we're either out of filesystem or space to put the data. |
523 | */ | 514 | */ |
524 | kmem_free(irbuf); | 515 | kmem_free(irbuf); |
525 | *ubcountp = ubelem; | 516 | *ubcountp = ac.ac_ubelem; |
517 | |||
526 | /* | 518 | /* |
527 | * Found some inodes, return them now and return the error next time. | 519 | * We found some inodes, so clear the error status and return them. |
520 | * The lastino pointer will point directly at the inode that triggered | ||
521 | * any error that occurred, so on the next call the error will be | ||
522 | * triggered again and propagated to userspace as there will be no | ||
523 | * formatted inodes in the buffer. | ||
528 | */ | 524 | */ |
529 | if (ubelem) | 525 | if (ac.ac_ubelem) |
530 | rval = 0; | 526 | error = 0; |
531 | if (agno >= mp->m_sb.sb_agcount) { | 527 | |
532 | /* | 528 | /* |
533 | * If we ran out of filesystem, mark lastino as off | 529 | * If we ran out of filesystem, lastino will point off the end of |
534 | * the end of the filesystem, so the next call | 530 | * the filesystem so the next call will return immediately. |
535 | * will return immediately. | 531 | */ |
536 | */ | 532 | *lastinop = XFS_AGINO_TO_INO(mp, agno, agino); |
537 | *lastinop = (xfs_ino_t)XFS_AGINO_TO_INO(mp, agno, 0); | 533 | if (agno >= mp->m_sb.sb_agcount) |
538 | *done = 1; | 534 | *done = 1; |
539 | } else | ||
540 | *lastinop = (xfs_ino_t)lastino; | ||
541 | 535 | ||
542 | return rval; | 536 | return error; |
543 | } | 537 | } |
544 | 538 | ||
545 | int | 539 | int |
diff --git a/fs/xfs/xfs_itable.h b/fs/xfs/xfs_itable.h index aaed08022eb9..6ea8b3912fa4 100644 --- a/fs/xfs/xfs_itable.h +++ b/fs/xfs/xfs_itable.h | |||
@@ -30,22 +30,6 @@ typedef int (*bulkstat_one_pf)(struct xfs_mount *mp, | |||
30 | int *ubused, | 30 | int *ubused, |
31 | int *stat); | 31 | int *stat); |
32 | 32 | ||
33 | struct xfs_bulkstat_agichunk { | ||
34 | xfs_ino_t ac_lastino; /* last inode returned */ | ||
35 | char __user **ac_ubuffer;/* pointer into user's buffer */ | ||
36 | int ac_ubleft; /* bytes left in user's buffer */ | ||
37 | int ac_ubelem; /* spaces used in user's buffer */ | ||
38 | }; | ||
39 | |||
40 | int | ||
41 | xfs_bulkstat_ag_ichunk( | ||
42 | struct xfs_mount *mp, | ||
43 | xfs_agnumber_t agno, | ||
44 | struct xfs_inobt_rec_incore *irbp, | ||
45 | bulkstat_one_pf formatter, | ||
46 | size_t statstruct_size, | ||
47 | struct xfs_bulkstat_agichunk *acp); | ||
48 | |||
49 | /* | 33 | /* |
50 | * Values for stat return value. | 34 | * Values for stat return value. |
51 | */ | 35 | */ |
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h index e973540cd15b..2dd405c9be78 100644 --- a/include/drm/drm_pciids.h +++ b/include/drm/drm_pciids.h | |||
@@ -74,7 +74,6 @@ | |||
74 | {0x1002, 0x4C64, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV250|RADEON_IS_MOBILITY}, \ | 74 | {0x1002, 0x4C64, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV250|RADEON_IS_MOBILITY}, \ |
75 | {0x1002, 0x4C66, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV250|RADEON_IS_MOBILITY}, \ | 75 | {0x1002, 0x4C66, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV250|RADEON_IS_MOBILITY}, \ |
76 | {0x1002, 0x4C67, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV250|RADEON_IS_MOBILITY}, \ | 76 | {0x1002, 0x4C67, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV250|RADEON_IS_MOBILITY}, \ |
77 | {0x1002, 0x4C6E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280|RADEON_IS_MOBILITY}, \ | ||
78 | {0x1002, 0x4E44, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R300}, \ | 77 | {0x1002, 0x4E44, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R300}, \ |
79 | {0x1002, 0x4E45, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R300}, \ | 78 | {0x1002, 0x4E45, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R300}, \ |
80 | {0x1002, 0x4E46, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R300}, \ | 79 | {0x1002, 0x4E46, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R300}, \ |
diff --git a/include/dt-bindings/clock/vf610-clock.h b/include/dt-bindings/clock/vf610-clock.h index d6b56b21539b..801c0ac50c47 100644 --- a/include/dt-bindings/clock/vf610-clock.h +++ b/include/dt-bindings/clock/vf610-clock.h | |||
@@ -21,24 +21,24 @@ | |||
21 | #define VF610_CLK_FASK_CLK_SEL 8 | 21 | #define VF610_CLK_FASK_CLK_SEL 8 |
22 | #define VF610_CLK_AUDIO_EXT 9 | 22 | #define VF610_CLK_AUDIO_EXT 9 |
23 | #define VF610_CLK_ENET_EXT 10 | 23 | #define VF610_CLK_ENET_EXT 10 |
24 | #define VF610_CLK_PLL1_MAIN 11 | 24 | #define VF610_CLK_PLL1_SYS 11 |
25 | #define VF610_CLK_PLL1_PFD1 12 | 25 | #define VF610_CLK_PLL1_PFD1 12 |
26 | #define VF610_CLK_PLL1_PFD2 13 | 26 | #define VF610_CLK_PLL1_PFD2 13 |
27 | #define VF610_CLK_PLL1_PFD3 14 | 27 | #define VF610_CLK_PLL1_PFD3 14 |
28 | #define VF610_CLK_PLL1_PFD4 15 | 28 | #define VF610_CLK_PLL1_PFD4 15 |
29 | #define VF610_CLK_PLL2_MAIN 16 | 29 | #define VF610_CLK_PLL2_BUS 16 |
30 | #define VF610_CLK_PLL2_PFD1 17 | 30 | #define VF610_CLK_PLL2_PFD1 17 |
31 | #define VF610_CLK_PLL2_PFD2 18 | 31 | #define VF610_CLK_PLL2_PFD2 18 |
32 | #define VF610_CLK_PLL2_PFD3 19 | 32 | #define VF610_CLK_PLL2_PFD3 19 |
33 | #define VF610_CLK_PLL2_PFD4 20 | 33 | #define VF610_CLK_PLL2_PFD4 20 |
34 | #define VF610_CLK_PLL3_MAIN 21 | 34 | #define VF610_CLK_PLL3_USB_OTG 21 |
35 | #define VF610_CLK_PLL3_PFD1 22 | 35 | #define VF610_CLK_PLL3_PFD1 22 |
36 | #define VF610_CLK_PLL3_PFD2 23 | 36 | #define VF610_CLK_PLL3_PFD2 23 |
37 | #define VF610_CLK_PLL3_PFD3 24 | 37 | #define VF610_CLK_PLL3_PFD3 24 |
38 | #define VF610_CLK_PLL3_PFD4 25 | 38 | #define VF610_CLK_PLL3_PFD4 25 |
39 | #define VF610_CLK_PLL4_MAIN 26 | 39 | #define VF610_CLK_PLL4_AUDIO 26 |
40 | #define VF610_CLK_PLL5_MAIN 27 | 40 | #define VF610_CLK_PLL5_ENET 27 |
41 | #define VF610_CLK_PLL6_MAIN 28 | 41 | #define VF610_CLK_PLL6_VIDEO 28 |
42 | #define VF610_CLK_PLL3_MAIN_DIV 29 | 42 | #define VF610_CLK_PLL3_MAIN_DIV 29 |
43 | #define VF610_CLK_PLL4_MAIN_DIV 30 | 43 | #define VF610_CLK_PLL4_MAIN_DIV 30 |
44 | #define VF610_CLK_PLL6_MAIN_DIV 31 | 44 | #define VF610_CLK_PLL6_MAIN_DIV 31 |
@@ -166,9 +166,32 @@ | |||
166 | #define VF610_CLK_DMAMUX3 153 | 166 | #define VF610_CLK_DMAMUX3 153 |
167 | #define VF610_CLK_FLEXCAN0_EN 154 | 167 | #define VF610_CLK_FLEXCAN0_EN 154 |
168 | #define VF610_CLK_FLEXCAN1_EN 155 | 168 | #define VF610_CLK_FLEXCAN1_EN 155 |
169 | #define VF610_CLK_PLL7_MAIN 156 | 169 | #define VF610_CLK_PLL7_USB_HOST 156 |
170 | #define VF610_CLK_USBPHY0 157 | 170 | #define VF610_CLK_USBPHY0 157 |
171 | #define VF610_CLK_USBPHY1 158 | 171 | #define VF610_CLK_USBPHY1 158 |
172 | #define VF610_CLK_END 159 | 172 | #define VF610_CLK_LVDS1_IN 159 |
173 | #define VF610_CLK_ANACLK1 160 | ||
174 | #define VF610_CLK_PLL1_BYPASS_SRC 161 | ||
175 | #define VF610_CLK_PLL2_BYPASS_SRC 162 | ||
176 | #define VF610_CLK_PLL3_BYPASS_SRC 163 | ||
177 | #define VF610_CLK_PLL4_BYPASS_SRC 164 | ||
178 | #define VF610_CLK_PLL5_BYPASS_SRC 165 | ||
179 | #define VF610_CLK_PLL6_BYPASS_SRC 166 | ||
180 | #define VF610_CLK_PLL7_BYPASS_SRC 167 | ||
181 | #define VF610_CLK_PLL1 168 | ||
182 | #define VF610_CLK_PLL2 169 | ||
183 | #define VF610_CLK_PLL3 170 | ||
184 | #define VF610_CLK_PLL4 171 | ||
185 | #define VF610_CLK_PLL5 172 | ||
186 | #define VF610_CLK_PLL6 173 | ||
187 | #define VF610_CLK_PLL7 174 | ||
188 | #define VF610_PLL1_BYPASS 175 | ||
189 | #define VF610_PLL2_BYPASS 176 | ||
190 | #define VF610_PLL3_BYPASS 177 | ||
191 | #define VF610_PLL4_BYPASS 178 | ||
192 | #define VF610_PLL5_BYPASS 179 | ||
193 | #define VF610_PLL6_BYPASS 180 | ||
194 | #define VF610_PLL7_BYPASS 181 | ||
195 | #define VF610_CLK_END 182 | ||
173 | 196 | ||
174 | #endif /* __DT_BINDINGS_CLOCK_VF610_H */ | 197 | #endif /* __DT_BINDINGS_CLOCK_VF610_H */ |
diff --git a/include/dt-bindings/pinctrl/dra.h b/include/dt-bindings/pinctrl/dra.h index 3d33794e4f3e..7448edff4723 100644 --- a/include/dt-bindings/pinctrl/dra.h +++ b/include/dt-bindings/pinctrl/dra.h | |||
@@ -40,8 +40,8 @@ | |||
40 | 40 | ||
41 | /* Active pin states */ | 41 | /* Active pin states */ |
42 | #define PIN_OUTPUT (0 | PULL_DIS) | 42 | #define PIN_OUTPUT (0 | PULL_DIS) |
43 | #define PIN_OUTPUT_PULLUP (PIN_OUTPUT | PULL_ENA | PULL_UP) | 43 | #define PIN_OUTPUT_PULLUP (PULL_UP) |
44 | #define PIN_OUTPUT_PULLDOWN (PIN_OUTPUT | PULL_ENA) | 44 | #define PIN_OUTPUT_PULLDOWN (0) |
45 | #define PIN_INPUT (INPUT_EN | PULL_DIS) | 45 | #define PIN_INPUT (INPUT_EN | PULL_DIS) |
46 | #define PIN_INPUT_SLEW (INPUT_EN | SLEWCONTROL) | 46 | #define PIN_INPUT_SLEW (INPUT_EN | SLEWCONTROL) |
47 | #define PIN_INPUT_PULLUP (PULL_ENA | INPUT_EN | PULL_UP) | 47 | #define PIN_INPUT_PULLUP (PULL_ENA | INPUT_EN | PULL_UP) |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 0207a78a8d82..aac0f9ea952a 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -1136,8 +1136,7 @@ static inline bool blk_needs_flush_plug(struct task_struct *tsk) | |||
1136 | /* | 1136 | /* |
1137 | * tag stuff | 1137 | * tag stuff |
1138 | */ | 1138 | */ |
1139 | #define blk_rq_tagged(rq) \ | 1139 | #define blk_rq_tagged(rq) ((rq)->cmd_flags & REQ_QUEUED) |
1140 | ((rq)->mq_ctx || ((rq)->cmd_flags & REQ_QUEUED)) | ||
1141 | extern int blk_queue_start_tag(struct request_queue *, struct request *); | 1140 | extern int blk_queue_start_tag(struct request_queue *, struct request *); |
1142 | extern struct request *blk_queue_find_tag(struct request_queue *, int); | 1141 | extern struct request *blk_queue_find_tag(struct request_queue *, int); |
1143 | extern void blk_queue_end_tag(struct request_queue *, struct request *); | 1142 | extern void blk_queue_end_tag(struct request_queue *, struct request *); |
@@ -1583,13 +1582,13 @@ static inline bool blk_integrity_merge_rq(struct request_queue *rq, | |||
1583 | struct request *r1, | 1582 | struct request *r1, |
1584 | struct request *r2) | 1583 | struct request *r2) |
1585 | { | 1584 | { |
1586 | return 0; | 1585 | return true; |
1587 | } | 1586 | } |
1588 | static inline bool blk_integrity_merge_bio(struct request_queue *rq, | 1587 | static inline bool blk_integrity_merge_bio(struct request_queue *rq, |
1589 | struct request *r, | 1588 | struct request *r, |
1590 | struct bio *b) | 1589 | struct bio *b) |
1591 | { | 1590 | { |
1592 | return 0; | 1591 | return true; |
1593 | } | 1592 | } |
1594 | static inline bool blk_integrity_is_initialized(struct gendisk *g) | 1593 | static inline bool blk_integrity_is_initialized(struct gendisk *g) |
1595 | { | 1594 | { |
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h index 4e2bd4c95b66..0995c2de8162 100644 --- a/include/linux/bootmem.h +++ b/include/linux/bootmem.h | |||
@@ -46,6 +46,7 @@ extern unsigned long init_bootmem_node(pg_data_t *pgdat, | |||
46 | extern unsigned long init_bootmem(unsigned long addr, unsigned long memend); | 46 | extern unsigned long init_bootmem(unsigned long addr, unsigned long memend); |
47 | 47 | ||
48 | extern unsigned long free_all_bootmem(void); | 48 | extern unsigned long free_all_bootmem(void); |
49 | extern void reset_node_managed_pages(pg_data_t *pgdat); | ||
49 | extern void reset_all_zones_managed_pages(void); | 50 | extern void reset_all_zones_managed_pages(void); |
50 | 51 | ||
51 | extern void free_bootmem_node(pg_data_t *pgdat, | 52 | extern void free_bootmem_node(pg_data_t *pgdat, |
diff --git a/include/linux/cma.h b/include/linux/cma.h index 0430ed05d3b9..a93438beb33c 100644 --- a/include/linux/cma.h +++ b/include/linux/cma.h | |||
@@ -18,12 +18,12 @@ struct cma; | |||
18 | extern phys_addr_t cma_get_base(struct cma *cma); | 18 | extern phys_addr_t cma_get_base(struct cma *cma); |
19 | extern unsigned long cma_get_size(struct cma *cma); | 19 | extern unsigned long cma_get_size(struct cma *cma); |
20 | 20 | ||
21 | extern int __init cma_declare_contiguous(phys_addr_t size, | 21 | extern int __init cma_declare_contiguous(phys_addr_t base, |
22 | phys_addr_t base, phys_addr_t limit, | 22 | phys_addr_t size, phys_addr_t limit, |
23 | phys_addr_t alignment, unsigned int order_per_bit, | 23 | phys_addr_t alignment, unsigned int order_per_bit, |
24 | bool fixed, struct cma **res_cma); | 24 | bool fixed, struct cma **res_cma); |
25 | extern int cma_init_reserved_mem(phys_addr_t size, | 25 | extern int cma_init_reserved_mem(phys_addr_t base, |
26 | phys_addr_t base, int order_per_bit, | 26 | phys_addr_t size, int order_per_bit, |
27 | struct cma **res_cma); | 27 | struct cma **res_cma); |
28 | extern struct page *cma_alloc(struct cma *cma, int count, unsigned int align); | 28 | extern struct page *cma_alloc(struct cma *cma, int count, unsigned int align); |
29 | extern bool cma_release(struct cma *cma, struct page *pages, int count); | 29 | extern bool cma_release(struct cma *cma, struct page *pages, int count); |
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h index 2507fd2a1eb4..d1a558239b1a 100644 --- a/include/linux/compiler-gcc4.h +++ b/include/linux/compiler-gcc4.h | |||
@@ -71,7 +71,6 @@ | |||
71 | * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 | 71 | * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 |
72 | * | 72 | * |
73 | * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. | 73 | * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. |
74 | * Fixed in GCC 4.8.2 and later versions. | ||
75 | * | 74 | * |
76 | * (asm goto is automatically volatile - the naming reflects this.) | 75 | * (asm goto is automatically volatile - the naming reflects this.) |
77 | */ | 76 | */ |
diff --git a/include/linux/compiler-gcc5.h b/include/linux/compiler-gcc5.h index cdd1cc202d51..c8c565952548 100644 --- a/include/linux/compiler-gcc5.h +++ b/include/linux/compiler-gcc5.h | |||
@@ -53,7 +53,6 @@ | |||
53 | * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 | 53 | * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670 |
54 | * | 54 | * |
55 | * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. | 55 | * Work it around via a compiler barrier quirk suggested by Jakub Jelinek. |
56 | * Fixed in GCC 4.8.2 and later versions. | ||
57 | * | 56 | * |
58 | * (asm goto is automatically volatile - the naming reflects this.) | 57 | * (asm goto is automatically volatile - the naming reflects this.) |
59 | */ | 58 | */ |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 4e41a4a331bb..9ab779e8a63c 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -639,11 +639,13 @@ static inline int inode_unhashed(struct inode *inode) | |||
639 | * 2: child/target | 639 | * 2: child/target |
640 | * 3: xattr | 640 | * 3: xattr |
641 | * 4: second non-directory | 641 | * 4: second non-directory |
642 | * The last is for certain operations (such as rename) which lock two | 642 | * 5: second parent (when locking independent directories in rename) |
643 | * | ||
644 | * I_MUTEX_NONDIR2 is for certain operations (such as rename) which lock two | ||
643 | * non-directories at once. | 645 | * non-directories at once. |
644 | * | 646 | * |
645 | * The locking order between these classes is | 647 | * The locking order between these classes is |
646 | * parent -> child -> normal -> xattr -> second non-directory | 648 | * parent[2] -> child -> grandchild -> normal -> xattr -> second non-directory |
647 | */ | 649 | */ |
648 | enum inode_i_mutex_lock_class | 650 | enum inode_i_mutex_lock_class |
649 | { | 651 | { |
@@ -651,7 +653,8 @@ enum inode_i_mutex_lock_class | |||
651 | I_MUTEX_PARENT, | 653 | I_MUTEX_PARENT, |
652 | I_MUTEX_CHILD, | 654 | I_MUTEX_CHILD, |
653 | I_MUTEX_XATTR, | 655 | I_MUTEX_XATTR, |
654 | I_MUTEX_NONDIR2 | 656 | I_MUTEX_NONDIR2, |
657 | I_MUTEX_PARENT2, | ||
655 | }; | 658 | }; |
656 | 659 | ||
657 | void lock_two_nondirectories(struct inode *, struct inode*); | 660 | void lock_two_nondirectories(struct inode *, struct inode*); |
@@ -2466,6 +2469,7 @@ extern ssize_t new_sync_read(struct file *filp, char __user *buf, size_t len, lo | |||
2466 | extern ssize_t new_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos); | 2469 | extern ssize_t new_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos); |
2467 | 2470 | ||
2468 | /* fs/block_dev.c */ | 2471 | /* fs/block_dev.c */ |
2472 | extern ssize_t blkdev_read_iter(struct kiocb *iocb, struct iov_iter *to); | ||
2469 | extern ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from); | 2473 | extern ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from); |
2470 | extern int blkdev_fsync(struct file *filp, loff_t start, loff_t end, | 2474 | extern int blkdev_fsync(struct file *filp, loff_t start, loff_t end, |
2471 | int datasync); | 2475 | int datasync); |
diff --git a/include/linux/khugepaged.h b/include/linux/khugepaged.h index 6b394f0b5148..eeb307985715 100644 --- a/include/linux/khugepaged.h +++ b/include/linux/khugepaged.h | |||
@@ -6,7 +6,8 @@ | |||
6 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE | 6 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE |
7 | extern int __khugepaged_enter(struct mm_struct *mm); | 7 | extern int __khugepaged_enter(struct mm_struct *mm); |
8 | extern void __khugepaged_exit(struct mm_struct *mm); | 8 | extern void __khugepaged_exit(struct mm_struct *mm); |
9 | extern int khugepaged_enter_vma_merge(struct vm_area_struct *vma); | 9 | extern int khugepaged_enter_vma_merge(struct vm_area_struct *vma, |
10 | unsigned long vm_flags); | ||
10 | 11 | ||
11 | #define khugepaged_enabled() \ | 12 | #define khugepaged_enabled() \ |
12 | (transparent_hugepage_flags & \ | 13 | (transparent_hugepage_flags & \ |
@@ -35,13 +36,13 @@ static inline void khugepaged_exit(struct mm_struct *mm) | |||
35 | __khugepaged_exit(mm); | 36 | __khugepaged_exit(mm); |
36 | } | 37 | } |
37 | 38 | ||
38 | static inline int khugepaged_enter(struct vm_area_struct *vma) | 39 | static inline int khugepaged_enter(struct vm_area_struct *vma, |
40 | unsigned long vm_flags) | ||
39 | { | 41 | { |
40 | if (!test_bit(MMF_VM_HUGEPAGE, &vma->vm_mm->flags)) | 42 | if (!test_bit(MMF_VM_HUGEPAGE, &vma->vm_mm->flags)) |
41 | if ((khugepaged_always() || | 43 | if ((khugepaged_always() || |
42 | (khugepaged_req_madv() && | 44 | (khugepaged_req_madv() && (vm_flags & VM_HUGEPAGE))) && |
43 | vma->vm_flags & VM_HUGEPAGE)) && | 45 | !(vm_flags & VM_NOHUGEPAGE)) |
44 | !(vma->vm_flags & VM_NOHUGEPAGE)) | ||
45 | if (__khugepaged_enter(vma->vm_mm)) | 46 | if (__khugepaged_enter(vma->vm_mm)) |
46 | return -ENOMEM; | 47 | return -ENOMEM; |
47 | return 0; | 48 | return 0; |
@@ -54,11 +55,13 @@ static inline int khugepaged_fork(struct mm_struct *mm, struct mm_struct *oldmm) | |||
54 | static inline void khugepaged_exit(struct mm_struct *mm) | 55 | static inline void khugepaged_exit(struct mm_struct *mm) |
55 | { | 56 | { |
56 | } | 57 | } |
57 | static inline int khugepaged_enter(struct vm_area_struct *vma) | 58 | static inline int khugepaged_enter(struct vm_area_struct *vma, |
59 | unsigned long vm_flags) | ||
58 | { | 60 | { |
59 | return 0; | 61 | return 0; |
60 | } | 62 | } |
61 | static inline int khugepaged_enter_vma_merge(struct vm_area_struct *vma) | 63 | static inline int khugepaged_enter_vma_merge(struct vm_area_struct *vma, |
64 | unsigned long vm_flags) | ||
62 | { | 65 | { |
63 | return 0; | 66 | return 0; |
64 | } | 67 | } |
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 19df5d857411..6b75640ef5ab 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h | |||
@@ -139,48 +139,23 @@ static inline bool mem_cgroup_disabled(void) | |||
139 | return false; | 139 | return false; |
140 | } | 140 | } |
141 | 141 | ||
142 | void __mem_cgroup_begin_update_page_stat(struct page *page, bool *locked, | 142 | struct mem_cgroup *mem_cgroup_begin_page_stat(struct page *page, bool *locked, |
143 | unsigned long *flags); | 143 | unsigned long *flags); |
144 | 144 | void mem_cgroup_end_page_stat(struct mem_cgroup *memcg, bool locked, | |
145 | extern atomic_t memcg_moving; | 145 | unsigned long flags); |
146 | 146 | void mem_cgroup_update_page_stat(struct mem_cgroup *memcg, | |
147 | static inline void mem_cgroup_begin_update_page_stat(struct page *page, | 147 | enum mem_cgroup_stat_index idx, int val); |
148 | bool *locked, unsigned long *flags) | 148 | |
149 | { | 149 | static inline void mem_cgroup_inc_page_stat(struct mem_cgroup *memcg, |
150 | if (mem_cgroup_disabled()) | ||
151 | return; | ||
152 | rcu_read_lock(); | ||
153 | *locked = false; | ||
154 | if (atomic_read(&memcg_moving)) | ||
155 | __mem_cgroup_begin_update_page_stat(page, locked, flags); | ||
156 | } | ||
157 | |||
158 | void __mem_cgroup_end_update_page_stat(struct page *page, | ||
159 | unsigned long *flags); | ||
160 | static inline void mem_cgroup_end_update_page_stat(struct page *page, | ||
161 | bool *locked, unsigned long *flags) | ||
162 | { | ||
163 | if (mem_cgroup_disabled()) | ||
164 | return; | ||
165 | if (*locked) | ||
166 | __mem_cgroup_end_update_page_stat(page, flags); | ||
167 | rcu_read_unlock(); | ||
168 | } | ||
169 | |||
170 | void mem_cgroup_update_page_stat(struct page *page, | ||
171 | enum mem_cgroup_stat_index idx, | ||
172 | int val); | ||
173 | |||
174 | static inline void mem_cgroup_inc_page_stat(struct page *page, | ||
175 | enum mem_cgroup_stat_index idx) | 150 | enum mem_cgroup_stat_index idx) |
176 | { | 151 | { |
177 | mem_cgroup_update_page_stat(page, idx, 1); | 152 | mem_cgroup_update_page_stat(memcg, idx, 1); |
178 | } | 153 | } |
179 | 154 | ||
180 | static inline void mem_cgroup_dec_page_stat(struct page *page, | 155 | static inline void mem_cgroup_dec_page_stat(struct mem_cgroup *memcg, |
181 | enum mem_cgroup_stat_index idx) | 156 | enum mem_cgroup_stat_index idx) |
182 | { | 157 | { |
183 | mem_cgroup_update_page_stat(page, idx, -1); | 158 | mem_cgroup_update_page_stat(memcg, idx, -1); |
184 | } | 159 | } |
185 | 160 | ||
186 | unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order, | 161 | unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order, |
@@ -315,13 +290,14 @@ mem_cgroup_print_oom_info(struct mem_cgroup *memcg, struct task_struct *p) | |||
315 | { | 290 | { |
316 | } | 291 | } |
317 | 292 | ||
318 | static inline void mem_cgroup_begin_update_page_stat(struct page *page, | 293 | static inline struct mem_cgroup *mem_cgroup_begin_page_stat(struct page *page, |
319 | bool *locked, unsigned long *flags) | 294 | bool *locked, unsigned long *flags) |
320 | { | 295 | { |
296 | return NULL; | ||
321 | } | 297 | } |
322 | 298 | ||
323 | static inline void mem_cgroup_end_update_page_stat(struct page *page, | 299 | static inline void mem_cgroup_end_page_stat(struct mem_cgroup *memcg, |
324 | bool *locked, unsigned long *flags) | 300 | bool locked, unsigned long flags) |
325 | { | 301 | { |
326 | } | 302 | } |
327 | 303 | ||
@@ -343,12 +319,12 @@ static inline bool mem_cgroup_oom_synchronize(bool wait) | |||
343 | return false; | 319 | return false; |
344 | } | 320 | } |
345 | 321 | ||
346 | static inline void mem_cgroup_inc_page_stat(struct page *page, | 322 | static inline void mem_cgroup_inc_page_stat(struct mem_cgroup *memcg, |
347 | enum mem_cgroup_stat_index idx) | 323 | enum mem_cgroup_stat_index idx) |
348 | { | 324 | { |
349 | } | 325 | } |
350 | 326 | ||
351 | static inline void mem_cgroup_dec_page_stat(struct page *page, | 327 | static inline void mem_cgroup_dec_page_stat(struct mem_cgroup *memcg, |
352 | enum mem_cgroup_stat_index idx) | 328 | enum mem_cgroup_stat_index idx) |
353 | { | 329 | { |
354 | } | 330 | } |
diff --git a/include/linux/mfd/max77693-private.h b/include/linux/mfd/max77693-private.h index fc17d56581b2..582e67f34054 100644 --- a/include/linux/mfd/max77693-private.h +++ b/include/linux/mfd/max77693-private.h | |||
@@ -330,6 +330,13 @@ enum max77693_irq_source { | |||
330 | MAX77693_IRQ_GROUP_NR, | 330 | MAX77693_IRQ_GROUP_NR, |
331 | }; | 331 | }; |
332 | 332 | ||
333 | #define SRC_IRQ_CHARGER BIT(0) | ||
334 | #define SRC_IRQ_TOP BIT(1) | ||
335 | #define SRC_IRQ_FLASH BIT(2) | ||
336 | #define SRC_IRQ_MUIC BIT(3) | ||
337 | #define SRC_IRQ_ALL (SRC_IRQ_CHARGER | SRC_IRQ_TOP \ | ||
338 | | SRC_IRQ_FLASH | SRC_IRQ_MUIC) | ||
339 | |||
333 | #define LED_IRQ_FLED2_OPEN BIT(0) | 340 | #define LED_IRQ_FLED2_OPEN BIT(0) |
334 | #define LED_IRQ_FLED2_SHORT BIT(1) | 341 | #define LED_IRQ_FLED2_SHORT BIT(1) |
335 | #define LED_IRQ_FLED1_OPEN BIT(2) | 342 | #define LED_IRQ_FLED1_OPEN BIT(2) |
diff --git a/include/linux/mm.h b/include/linux/mm.h index 27eb1bfbe704..b46461116cd2 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -1235,7 +1235,6 @@ int __set_page_dirty_no_writeback(struct page *page); | |||
1235 | int redirty_page_for_writepage(struct writeback_control *wbc, | 1235 | int redirty_page_for_writepage(struct writeback_control *wbc, |
1236 | struct page *page); | 1236 | struct page *page); |
1237 | void account_page_dirtied(struct page *page, struct address_space *mapping); | 1237 | void account_page_dirtied(struct page *page, struct address_space *mapping); |
1238 | void account_page_writeback(struct page *page); | ||
1239 | int set_page_dirty(struct page *page); | 1238 | int set_page_dirty(struct page *page); |
1240 | int set_page_dirty_lock(struct page *page); | 1239 | int set_page_dirty_lock(struct page *page); |
1241 | int clear_page_dirty_for_io(struct page *page); | 1240 | int clear_page_dirty_for_io(struct page *page); |
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 48bf12ef6620..ffe66e381c04 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
@@ -431,6 +431,15 @@ struct zone { | |||
431 | */ | 431 | */ |
432 | int nr_migrate_reserve_block; | 432 | int nr_migrate_reserve_block; |
433 | 433 | ||
434 | #ifdef CONFIG_MEMORY_ISOLATION | ||
435 | /* | ||
436 | * Number of isolated pageblock. It is used to solve incorrect | ||
437 | * freepage counting problem due to racy retrieving migratetype | ||
438 | * of pageblock. Protected by zone->lock. | ||
439 | */ | ||
440 | unsigned long nr_isolate_pageblock; | ||
441 | #endif | ||
442 | |||
434 | #ifdef CONFIG_MEMORY_HOTPLUG | 443 | #ifdef CONFIG_MEMORY_HOTPLUG |
435 | /* see spanned/present_pages for more description */ | 444 | /* see spanned/present_pages for more description */ |
436 | seqlock_t span_seqlock; | 445 | seqlock_t span_seqlock; |
diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h index 9e6294f32ba8..046a0a2e4c4e 100644 --- a/include/linux/mtd/spi-nor.h +++ b/include/linux/mtd/spi-nor.h | |||
@@ -187,32 +187,17 @@ struct spi_nor { | |||
187 | /** | 187 | /** |
188 | * spi_nor_scan() - scan the SPI NOR | 188 | * spi_nor_scan() - scan the SPI NOR |
189 | * @nor: the spi_nor structure | 189 | * @nor: the spi_nor structure |
190 | * @id: the spi_device_id provided by the driver | 190 | * @name: the chip type name |
191 | * @mode: the read mode supported by the driver | 191 | * @mode: the read mode supported by the driver |
192 | * | 192 | * |
193 | * The drivers can use this fuction to scan the SPI NOR. | 193 | * The drivers can use this fuction to scan the SPI NOR. |
194 | * In the scanning, it will try to get all the necessary information to | 194 | * In the scanning, it will try to get all the necessary information to |
195 | * fill the mtd_info{} and the spi_nor{}. | 195 | * fill the mtd_info{} and the spi_nor{}. |
196 | * | 196 | * |
197 | * The board may assigns a spi_device_id with @id which be used to compared with | 197 | * The chip type name can be provided through the @name parameter. |
198 | * the spi_device_id detected by the scanning. | ||
199 | * | 198 | * |
200 | * Return: 0 for success, others for failure. | 199 | * Return: 0 for success, others for failure. |
201 | */ | 200 | */ |
202 | int spi_nor_scan(struct spi_nor *nor, const struct spi_device_id *id, | 201 | int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode); |
203 | enum read_mode mode); | ||
204 | extern const struct spi_device_id spi_nor_ids[]; | ||
205 | |||
206 | /** | ||
207 | * spi_nor_match_id() - find the spi_device_id by the name | ||
208 | * @name: the name of the spi_device_id | ||
209 | * | ||
210 | * The drivers use this function to find the spi_device_id | ||
211 | * specified by the @name. | ||
212 | * | ||
213 | * Return: returns the right spi_device_id pointer on success, | ||
214 | * and returns NULL on failure. | ||
215 | */ | ||
216 | const struct spi_device_id *spi_nor_match_id(char *name); | ||
217 | 202 | ||
218 | #endif | 203 | #endif |
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index 983876f24aed..47ebb4fafd87 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h | |||
@@ -1224,11 +1224,22 @@ struct nfs41_free_stateid_res { | |||
1224 | unsigned int status; | 1224 | unsigned int status; |
1225 | }; | 1225 | }; |
1226 | 1226 | ||
1227 | static inline void | ||
1228 | nfs_free_pnfs_ds_cinfo(struct pnfs_ds_commit_info *cinfo) | ||
1229 | { | ||
1230 | kfree(cinfo->buckets); | ||
1231 | } | ||
1232 | |||
1227 | #else | 1233 | #else |
1228 | 1234 | ||
1229 | struct pnfs_ds_commit_info { | 1235 | struct pnfs_ds_commit_info { |
1230 | }; | 1236 | }; |
1231 | 1237 | ||
1238 | static inline void | ||
1239 | nfs_free_pnfs_ds_cinfo(struct pnfs_ds_commit_info *cinfo) | ||
1240 | { | ||
1241 | } | ||
1242 | |||
1232 | #endif /* CONFIG_NFS_V4_1 */ | 1243 | #endif /* CONFIG_NFS_V4_1 */ |
1233 | 1244 | ||
1234 | #ifdef CONFIG_NFS_V4_2 | 1245 | #ifdef CONFIG_NFS_V4_2 |
diff --git a/include/linux/of.h b/include/linux/of.h index 6545e7aec7bb..29f0adc5f3e4 100644 --- a/include/linux/of.h +++ b/include/linux/of.h | |||
@@ -267,14 +267,12 @@ extern int of_property_read_u64(const struct device_node *np, | |||
267 | extern int of_property_read_string(struct device_node *np, | 267 | extern int of_property_read_string(struct device_node *np, |
268 | const char *propname, | 268 | const char *propname, |
269 | const char **out_string); | 269 | const char **out_string); |
270 | extern int of_property_read_string_index(struct device_node *np, | ||
271 | const char *propname, | ||
272 | int index, const char **output); | ||
273 | extern int of_property_match_string(struct device_node *np, | 270 | extern int of_property_match_string(struct device_node *np, |
274 | const char *propname, | 271 | const char *propname, |
275 | const char *string); | 272 | const char *string); |
276 | extern int of_property_count_strings(struct device_node *np, | 273 | extern int of_property_read_string_helper(struct device_node *np, |
277 | const char *propname); | 274 | const char *propname, |
275 | const char **out_strs, size_t sz, int index); | ||
278 | extern int of_device_is_compatible(const struct device_node *device, | 276 | extern int of_device_is_compatible(const struct device_node *device, |
279 | const char *); | 277 | const char *); |
280 | extern int of_device_is_available(const struct device_node *device); | 278 | extern int of_device_is_available(const struct device_node *device); |
@@ -486,15 +484,9 @@ static inline int of_property_read_string(struct device_node *np, | |||
486 | return -ENOSYS; | 484 | return -ENOSYS; |
487 | } | 485 | } |
488 | 486 | ||
489 | static inline int of_property_read_string_index(struct device_node *np, | 487 | static inline int of_property_read_string_helper(struct device_node *np, |
490 | const char *propname, int index, | 488 | const char *propname, |
491 | const char **out_string) | 489 | const char **out_strs, size_t sz, int index) |
492 | { | ||
493 | return -ENOSYS; | ||
494 | } | ||
495 | |||
496 | static inline int of_property_count_strings(struct device_node *np, | ||
497 | const char *propname) | ||
498 | { | 490 | { |
499 | return -ENOSYS; | 491 | return -ENOSYS; |
500 | } | 492 | } |
@@ -668,6 +660,70 @@ static inline int of_property_count_u64_elems(const struct device_node *np, | |||
668 | } | 660 | } |
669 | 661 | ||
670 | /** | 662 | /** |
663 | * of_property_read_string_array() - Read an array of strings from a multiple | ||
664 | * strings property. | ||
665 | * @np: device node from which the property value is to be read. | ||
666 | * @propname: name of the property to be searched. | ||
667 | * @out_strs: output array of string pointers. | ||
668 | * @sz: number of array elements to read. | ||
669 | * | ||
670 | * Search for a property in a device tree node and retrieve a list of | ||
671 | * terminated string values (pointer to data, not a copy) in that property. | ||
672 | * | ||
673 | * If @out_strs is NULL, the number of strings in the property is returned. | ||
674 | */ | ||
675 | static inline int of_property_read_string_array(struct device_node *np, | ||
676 | const char *propname, const char **out_strs, | ||
677 | size_t sz) | ||
678 | { | ||
679 | return of_property_read_string_helper(np, propname, out_strs, sz, 0); | ||
680 | } | ||
681 | |||
682 | /** | ||
683 | * of_property_count_strings() - Find and return the number of strings from a | ||
684 | * multiple strings property. | ||
685 | * @np: device node from which the property value is to be read. | ||
686 | * @propname: name of the property to be searched. | ||
687 | * | ||
688 | * Search for a property in a device tree node and retrieve the number of null | ||
689 | * terminated string contain in it. Returns the number of strings on | ||
690 | * success, -EINVAL if the property does not exist, -ENODATA if property | ||
691 | * does not have a value, and -EILSEQ if the string is not null-terminated | ||
692 | * within the length of the property data. | ||
693 | */ | ||
694 | static inline int of_property_count_strings(struct device_node *np, | ||
695 | const char *propname) | ||
696 | { | ||
697 | return of_property_read_string_helper(np, propname, NULL, 0, 0); | ||
698 | } | ||
699 | |||
700 | /** | ||
701 | * of_property_read_string_index() - Find and read a string from a multiple | ||
702 | * strings property. | ||
703 | * @np: device node from which the property value is to be read. | ||
704 | * @propname: name of the property to be searched. | ||
705 | * @index: index of the string in the list of strings | ||
706 | * @out_string: pointer to null terminated return string, modified only if | ||
707 | * return value is 0. | ||
708 | * | ||
709 | * Search for a property in a device tree node and retrieve a null | ||
710 | * terminated string value (pointer to data, not a copy) in the list of strings | ||
711 | * contained in that property. | ||
712 | * Returns 0 on success, -EINVAL if the property does not exist, -ENODATA if | ||
713 | * property does not have a value, and -EILSEQ if the string is not | ||
714 | * null-terminated within the length of the property data. | ||
715 | * | ||
716 | * The out_string pointer is modified only if a valid string can be decoded. | ||
717 | */ | ||
718 | static inline int of_property_read_string_index(struct device_node *np, | ||
719 | const char *propname, | ||
720 | int index, const char **output) | ||
721 | { | ||
722 | int rc = of_property_read_string_helper(np, propname, output, 1, index); | ||
723 | return rc < 0 ? rc : 0; | ||
724 | } | ||
725 | |||
726 | /** | ||
671 | * of_property_read_bool - Findfrom a property | 727 | * of_property_read_bool - Findfrom a property |
672 | * @np: device node from which the property value is to be read. | 728 | * @np: device node from which the property value is to be read. |
673 | * @propname: name of the property to be searched. | 729 | * @propname: name of the property to be searched. |
diff --git a/include/linux/of_reserved_mem.h b/include/linux/of_reserved_mem.h index 5b5efae09135..ad2f67054372 100644 --- a/include/linux/of_reserved_mem.h +++ b/include/linux/of_reserved_mem.h | |||
@@ -16,7 +16,7 @@ struct reserved_mem { | |||
16 | }; | 16 | }; |
17 | 17 | ||
18 | struct reserved_mem_ops { | 18 | struct reserved_mem_ops { |
19 | void (*device_init)(struct reserved_mem *rmem, | 19 | int (*device_init)(struct reserved_mem *rmem, |
20 | struct device *dev); | 20 | struct device *dev); |
21 | void (*device_release)(struct reserved_mem *rmem, | 21 | void (*device_release)(struct reserved_mem *rmem, |
22 | struct device *dev); | 22 | struct device *dev); |
@@ -28,14 +28,17 @@ typedef int (*reservedmem_of_init_fn)(struct reserved_mem *rmem); | |||
28 | _OF_DECLARE(reservedmem, name, compat, init, reservedmem_of_init_fn) | 28 | _OF_DECLARE(reservedmem, name, compat, init, reservedmem_of_init_fn) |
29 | 29 | ||
30 | #ifdef CONFIG_OF_RESERVED_MEM | 30 | #ifdef CONFIG_OF_RESERVED_MEM |
31 | void of_reserved_mem_device_init(struct device *dev); | 31 | int of_reserved_mem_device_init(struct device *dev); |
32 | void of_reserved_mem_device_release(struct device *dev); | 32 | void of_reserved_mem_device_release(struct device *dev); |
33 | 33 | ||
34 | void fdt_init_reserved_mem(void); | 34 | void fdt_init_reserved_mem(void); |
35 | void fdt_reserved_mem_save_node(unsigned long node, const char *uname, | 35 | void fdt_reserved_mem_save_node(unsigned long node, const char *uname, |
36 | phys_addr_t base, phys_addr_t size); | 36 | phys_addr_t base, phys_addr_t size); |
37 | #else | 37 | #else |
38 | static inline void of_reserved_mem_device_init(struct device *dev) { } | 38 | static inline int of_reserved_mem_device_init(struct device *dev) |
39 | { | ||
40 | return -ENOSYS; | ||
41 | } | ||
39 | static inline void of_reserved_mem_device_release(struct device *pdev) { } | 42 | static inline void of_reserved_mem_device_release(struct device *pdev) { } |
40 | 43 | ||
41 | static inline void fdt_init_reserved_mem(void) { } | 44 | static inline void fdt_init_reserved_mem(void) { } |
diff --git a/include/linux/page-isolation.h b/include/linux/page-isolation.h index 3fff8e774067..2dc1e1697b45 100644 --- a/include/linux/page-isolation.h +++ b/include/linux/page-isolation.h | |||
@@ -2,6 +2,10 @@ | |||
2 | #define __LINUX_PAGEISOLATION_H | 2 | #define __LINUX_PAGEISOLATION_H |
3 | 3 | ||
4 | #ifdef CONFIG_MEMORY_ISOLATION | 4 | #ifdef CONFIG_MEMORY_ISOLATION |
5 | static inline bool has_isolate_pageblock(struct zone *zone) | ||
6 | { | ||
7 | return zone->nr_isolate_pageblock; | ||
8 | } | ||
5 | static inline bool is_migrate_isolate_page(struct page *page) | 9 | static inline bool is_migrate_isolate_page(struct page *page) |
6 | { | 10 | { |
7 | return get_pageblock_migratetype(page) == MIGRATE_ISOLATE; | 11 | return get_pageblock_migratetype(page) == MIGRATE_ISOLATE; |
@@ -11,6 +15,10 @@ static inline bool is_migrate_isolate(int migratetype) | |||
11 | return migratetype == MIGRATE_ISOLATE; | 15 | return migratetype == MIGRATE_ISOLATE; |
12 | } | 16 | } |
13 | #else | 17 | #else |
18 | static inline bool has_isolate_pageblock(struct zone *zone) | ||
19 | { | ||
20 | return false; | ||
21 | } | ||
14 | static inline bool is_migrate_isolate_page(struct page *page) | 22 | static inline bool is_migrate_isolate_page(struct page *page) |
15 | { | 23 | { |
16 | return false; | 24 | return false; |
diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h index 64dacb7288a6..24c7728ca681 100644 --- a/include/linux/pci-acpi.h +++ b/include/linux/pci-acpi.h | |||
@@ -41,8 +41,13 @@ static inline acpi_handle acpi_pci_get_bridge_handle(struct pci_bus *pbus) | |||
41 | 41 | ||
42 | if (pci_is_root_bus(pbus)) | 42 | if (pci_is_root_bus(pbus)) |
43 | dev = pbus->bridge; | 43 | dev = pbus->bridge; |
44 | else | 44 | else { |
45 | /* If pbus is a virtual bus, there is no bridge to it */ | ||
46 | if (!pbus->self) | ||
47 | return NULL; | ||
48 | |||
45 | dev = &pbus->self->dev; | 49 | dev = &pbus->self->dev; |
50 | } | ||
46 | 51 | ||
47 | return ACPI_HANDLE(dev); | 52 | return ACPI_HANDLE(dev); |
48 | } | 53 | } |
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index 73e938b7e937..2e0e06daf8c0 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h | |||
@@ -72,8 +72,10 @@ struct generic_pm_domain { | |||
72 | bool max_off_time_changed; | 72 | bool max_off_time_changed; |
73 | bool cached_power_down_ok; | 73 | bool cached_power_down_ok; |
74 | struct gpd_cpuidle_data *cpuidle_data; | 74 | struct gpd_cpuidle_data *cpuidle_data; |
75 | void (*attach_dev)(struct device *dev); | 75 | int (*attach_dev)(struct generic_pm_domain *domain, |
76 | void (*detach_dev)(struct device *dev); | 76 | struct device *dev); |
77 | void (*detach_dev)(struct generic_pm_domain *domain, | ||
78 | struct device *dev); | ||
77 | }; | 79 | }; |
78 | 80 | ||
79 | static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd) | 81 | static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd) |
@@ -104,7 +106,7 @@ struct generic_pm_domain_data { | |||
104 | struct notifier_block nb; | 106 | struct notifier_block nb; |
105 | struct mutex lock; | 107 | struct mutex lock; |
106 | unsigned int refcount; | 108 | unsigned int refcount; |
107 | bool need_restore; | 109 | int need_restore; |
108 | }; | 110 | }; |
109 | 111 | ||
110 | #ifdef CONFIG_PM_GENERIC_DOMAINS | 112 | #ifdef CONFIG_PM_GENERIC_DOMAINS |
diff --git a/include/linux/power/charger-manager.h b/include/linux/power/charger-manager.h index 07e7945a1ff2..e97fc656a058 100644 --- a/include/linux/power/charger-manager.h +++ b/include/linux/power/charger-manager.h | |||
@@ -253,9 +253,6 @@ struct charger_manager { | |||
253 | struct device *dev; | 253 | struct device *dev; |
254 | struct charger_desc *desc; | 254 | struct charger_desc *desc; |
255 | 255 | ||
256 | struct power_supply *fuel_gauge; | ||
257 | struct power_supply **charger_stat; | ||
258 | |||
259 | #ifdef CONFIG_THERMAL | 256 | #ifdef CONFIG_THERMAL |
260 | struct thermal_zone_device *tzd_batt; | 257 | struct thermal_zone_device *tzd_batt; |
261 | #endif | 258 | #endif |
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index 3ed049673022..096dbced02ac 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h | |||
@@ -200,6 +200,12 @@ struct power_supply { | |||
200 | void (*external_power_changed)(struct power_supply *psy); | 200 | void (*external_power_changed)(struct power_supply *psy); |
201 | void (*set_charged)(struct power_supply *psy); | 201 | void (*set_charged)(struct power_supply *psy); |
202 | 202 | ||
203 | /* | ||
204 | * Set if thermal zone should not be created for this power supply. | ||
205 | * For example for virtual supplies forwarding calls to actual | ||
206 | * sensors or other supplies. | ||
207 | */ | ||
208 | bool no_thermal; | ||
203 | /* For APM emulation, think legacy userspace. */ | 209 | /* For APM emulation, think legacy userspace. */ |
204 | int use_for_apm; | 210 | int use_for_apm; |
205 | 211 | ||
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index a4a819ffb2d1..53ff1a752d7e 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h | |||
@@ -617,6 +617,21 @@ static inline void rcu_preempt_sleep_check(void) | |||
617 | #define RCU_INITIALIZER(v) (typeof(*(v)) __force __rcu *)(v) | 617 | #define RCU_INITIALIZER(v) (typeof(*(v)) __force __rcu *)(v) |
618 | 618 | ||
619 | /** | 619 | /** |
620 | * lockless_dereference() - safely load a pointer for later dereference | ||
621 | * @p: The pointer to load | ||
622 | * | ||
623 | * Similar to rcu_dereference(), but for situations where the pointed-to | ||
624 | * object's lifetime is managed by something other than RCU. That | ||
625 | * "something other" might be reference counting or simple immortality. | ||
626 | */ | ||
627 | #define lockless_dereference(p) \ | ||
628 | ({ \ | ||
629 | typeof(p) _________p1 = ACCESS_ONCE(p); \ | ||
630 | smp_read_barrier_depends(); /* Dependency order vs. p above. */ \ | ||
631 | (_________p1); \ | ||
632 | }) | ||
633 | |||
634 | /** | ||
620 | * rcu_assign_pointer() - assign to RCU-protected pointer | 635 | * rcu_assign_pointer() - assign to RCU-protected pointer |
621 | * @p: pointer to assign to | 636 | * @p: pointer to assign to |
622 | * @v: value to assign (publish) | 637 | * @v: value to assign (publish) |
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h index d347c805f923..f540b1496e2f 100644 --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h | |||
@@ -35,6 +35,8 @@ | |||
35 | #ifndef __LINUX_REGULATOR_CONSUMER_H_ | 35 | #ifndef __LINUX_REGULATOR_CONSUMER_H_ |
36 | #define __LINUX_REGULATOR_CONSUMER_H_ | 36 | #define __LINUX_REGULATOR_CONSUMER_H_ |
37 | 37 | ||
38 | #include <linux/err.h> | ||
39 | |||
38 | struct device; | 40 | struct device; |
39 | struct notifier_block; | 41 | struct notifier_block; |
40 | struct regmap; | 42 | struct regmap; |
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h index 49a4d6f59108..e2c13cd863bd 100644 --- a/include/linux/ring_buffer.h +++ b/include/linux/ring_buffer.h | |||
@@ -97,7 +97,7 @@ __ring_buffer_alloc(unsigned long size, unsigned flags, struct lock_class_key *k | |||
97 | __ring_buffer_alloc((size), (flags), &__key); \ | 97 | __ring_buffer_alloc((size), (flags), &__key); \ |
98 | }) | 98 | }) |
99 | 99 | ||
100 | int ring_buffer_wait(struct ring_buffer *buffer, int cpu); | 100 | int ring_buffer_wait(struct ring_buffer *buffer, int cpu, bool full); |
101 | int ring_buffer_poll_wait(struct ring_buffer *buffer, int cpu, | 101 | int ring_buffer_poll_wait(struct ring_buffer *buffer, int cpu, |
102 | struct file *filp, poll_table *poll_table); | 102 | struct file *filp, poll_table *poll_table); |
103 | 103 | ||
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index a59d9343c25b..6c8b6f604e76 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -557,7 +557,9 @@ struct sk_buff { | |||
557 | /* fields enclosed in headers_start/headers_end are copied | 557 | /* fields enclosed in headers_start/headers_end are copied |
558 | * using a single memcpy() in __copy_skb_header() | 558 | * using a single memcpy() in __copy_skb_header() |
559 | */ | 559 | */ |
560 | /* private: */ | ||
560 | __u32 headers_start[0]; | 561 | __u32 headers_start[0]; |
562 | /* public: */ | ||
561 | 563 | ||
562 | /* if you move pkt_type around you also must adapt those constants */ | 564 | /* if you move pkt_type around you also must adapt those constants */ |
563 | #ifdef __BIG_ENDIAN_BITFIELD | 565 | #ifdef __BIG_ENDIAN_BITFIELD |
@@ -642,7 +644,9 @@ struct sk_buff { | |||
642 | __u16 network_header; | 644 | __u16 network_header; |
643 | __u16 mac_header; | 645 | __u16 mac_header; |
644 | 646 | ||
647 | /* private: */ | ||
645 | __u32 headers_end[0]; | 648 | __u32 headers_end[0]; |
649 | /* public: */ | ||
646 | 650 | ||
647 | /* These elements must be at the end, see alloc_skb() for details. */ | 651 | /* These elements must be at the end, see alloc_skb() for details. */ |
648 | sk_buff_data_t tail; | 652 | sk_buff_data_t tail; |
@@ -795,15 +799,19 @@ struct sk_buff_fclones { | |||
795 | * @skb: buffer | 799 | * @skb: buffer |
796 | * | 800 | * |
797 | * Returns true is skb is a fast clone, and its clone is not freed. | 801 | * Returns true is skb is a fast clone, and its clone is not freed. |
802 | * Some drivers call skb_orphan() in their ndo_start_xmit(), | ||
803 | * so we also check that this didnt happen. | ||
798 | */ | 804 | */ |
799 | static inline bool skb_fclone_busy(const struct sk_buff *skb) | 805 | static inline bool skb_fclone_busy(const struct sock *sk, |
806 | const struct sk_buff *skb) | ||
800 | { | 807 | { |
801 | const struct sk_buff_fclones *fclones; | 808 | const struct sk_buff_fclones *fclones; |
802 | 809 | ||
803 | fclones = container_of(skb, struct sk_buff_fclones, skb1); | 810 | fclones = container_of(skb, struct sk_buff_fclones, skb1); |
804 | 811 | ||
805 | return skb->fclone == SKB_FCLONE_ORIG && | 812 | return skb->fclone == SKB_FCLONE_ORIG && |
806 | fclones->skb2.fclone == SKB_FCLONE_CLONE; | 813 | fclones->skb2.fclone == SKB_FCLONE_CLONE && |
814 | fclones->skb2.sk == sk; | ||
807 | } | 815 | } |
808 | 816 | ||
809 | static inline struct sk_buff *alloc_skb_fclone(unsigned int size, | 817 | static inline struct sk_buff *alloc_skb_fclone(unsigned int size, |
diff --git a/include/linux/socket.h b/include/linux/socket.h index ec538fc287a6..bb9b83640070 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h | |||
@@ -256,7 +256,7 @@ struct ucred { | |||
256 | #define MSG_EOF MSG_FIN | 256 | #define MSG_EOF MSG_FIN |
257 | 257 | ||
258 | #define MSG_FASTOPEN 0x20000000 /* Send data in TCP SYN */ | 258 | #define MSG_FASTOPEN 0x20000000 /* Send data in TCP SYN */ |
259 | #define MSG_CMSG_CLOEXEC 0x40000000 /* Set close_on_exit for file | 259 | #define MSG_CMSG_CLOEXEC 0x40000000 /* Set close_on_exec for file |
260 | descriptor received through | 260 | descriptor received through |
261 | SCM_RIGHTS */ | 261 | SCM_RIGHTS */ |
262 | #if defined(CONFIG_COMPAT) | 262 | #if defined(CONFIG_COMPAT) |
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h index 26088feb6608..d9a4905e01d0 100644 --- a/include/linux/usb/usbnet.h +++ b/include/linux/usb/usbnet.h | |||
@@ -78,6 +78,7 @@ struct usbnet { | |||
78 | # define EVENT_NO_RUNTIME_PM 9 | 78 | # define EVENT_NO_RUNTIME_PM 9 |
79 | # define EVENT_RX_KILL 10 | 79 | # define EVENT_RX_KILL 10 |
80 | # define EVENT_LINK_CHANGE 11 | 80 | # define EVENT_LINK_CHANGE 11 |
81 | # define EVENT_SET_RX_MODE 12 | ||
81 | }; | 82 | }; |
82 | 83 | ||
83 | static inline struct usb_driver *driver_of(struct usb_interface *intf) | 84 | static inline struct usb_driver *driver_of(struct usb_interface *intf) |
@@ -159,6 +160,9 @@ struct driver_info { | |||
159 | /* called by minidriver when receiving indication */ | 160 | /* called by minidriver when receiving indication */ |
160 | void (*indication)(struct usbnet *dev, void *ind, int indlen); | 161 | void (*indication)(struct usbnet *dev, void *ind, int indlen); |
161 | 162 | ||
163 | /* rx mode change (device changes address list filtering) */ | ||
164 | void (*set_rx_mode)(struct usbnet *dev); | ||
165 | |||
162 | /* for new devices, use the descriptor-reading code instead */ | 166 | /* for new devices, use the descriptor-reading code instead */ |
163 | int in; /* rx endpoint */ | 167 | int in; /* rx endpoint */ |
164 | int out; /* tx endpoint */ | 168 | int out; /* tx endpoint */ |
diff --git a/include/net/9p/transport.h b/include/net/9p/transport.h index d9fa68f26c41..2a25dec30211 100644 --- a/include/net/9p/transport.h +++ b/include/net/9p/transport.h | |||
@@ -34,7 +34,6 @@ | |||
34 | * @list: used to maintain a list of currently available transports | 34 | * @list: used to maintain a list of currently available transports |
35 | * @name: the human-readable name of the transport | 35 | * @name: the human-readable name of the transport |
36 | * @maxsize: transport provided maximum packet size | 36 | * @maxsize: transport provided maximum packet size |
37 | * @pref: Preferences of this transport | ||
38 | * @def: set if this transport should be considered the default | 37 | * @def: set if this transport should be considered the default |
39 | * @create: member function to create a new connection on this transport | 38 | * @create: member function to create a new connection on this transport |
40 | * @close: member function to discard a connection on this transport | 39 | * @close: member function to discard a connection on this transport |
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 97f472012438..4292929392b0 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
@@ -671,6 +671,8 @@ static inline int ipv6_addr_diff(const struct in6_addr *a1, const struct in6_add | |||
671 | return __ipv6_addr_diff(a1, a2, sizeof(struct in6_addr)); | 671 | return __ipv6_addr_diff(a1, a2, sizeof(struct in6_addr)); |
672 | } | 672 | } |
673 | 673 | ||
674 | void ipv6_proxy_select_ident(struct sk_buff *skb); | ||
675 | |||
674 | int ip6_dst_hoplimit(struct dst_entry *dst); | 676 | int ip6_dst_hoplimit(struct dst_entry *dst); |
675 | 677 | ||
676 | static inline int ip6_sk_dst_hoplimit(struct ipv6_pinfo *np, struct flowi6 *fl6, | 678 | static inline int ip6_sk_dst_hoplimit(struct ipv6_pinfo *np, struct flowi6 *fl6, |
diff --git a/include/net/netfilter/ipv4/nf_reject.h b/include/net/netfilter/ipv4/nf_reject.h index e8427193c777..03e928a55229 100644 --- a/include/net/netfilter/ipv4/nf_reject.h +++ b/include/net/netfilter/ipv4/nf_reject.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef _IPV4_NF_REJECT_H | 1 | #ifndef _IPV4_NF_REJECT_H |
2 | #define _IPV4_NF_REJECT_H | 2 | #define _IPV4_NF_REJECT_H |
3 | 3 | ||
4 | #include <linux/skbuff.h> | ||
5 | #include <net/ip.h> | ||
4 | #include <net/icmp.h> | 6 | #include <net/icmp.h> |
5 | 7 | ||
6 | static inline void nf_send_unreach(struct sk_buff *skb_in, int code) | 8 | static inline void nf_send_unreach(struct sk_buff *skb_in, int code) |
@@ -10,4 +12,12 @@ static inline void nf_send_unreach(struct sk_buff *skb_in, int code) | |||
10 | 12 | ||
11 | void nf_send_reset(struct sk_buff *oldskb, int hook); | 13 | void nf_send_reset(struct sk_buff *oldskb, int hook); |
12 | 14 | ||
15 | const struct tcphdr *nf_reject_ip_tcphdr_get(struct sk_buff *oldskb, | ||
16 | struct tcphdr *_oth, int hook); | ||
17 | struct iphdr *nf_reject_iphdr_put(struct sk_buff *nskb, | ||
18 | const struct sk_buff *oldskb, | ||
19 | __be16 protocol, int ttl); | ||
20 | void nf_reject_ip_tcphdr_put(struct sk_buff *nskb, const struct sk_buff *oldskb, | ||
21 | const struct tcphdr *oth); | ||
22 | |||
13 | #endif /* _IPV4_NF_REJECT_H */ | 23 | #endif /* _IPV4_NF_REJECT_H */ |
diff --git a/include/net/netfilter/ipv6/nf_reject.h b/include/net/netfilter/ipv6/nf_reject.h index 48e18810a9be..23216d48abf9 100644 --- a/include/net/netfilter/ipv6/nf_reject.h +++ b/include/net/netfilter/ipv6/nf_reject.h | |||
@@ -15,4 +15,14 @@ nf_send_unreach6(struct net *net, struct sk_buff *skb_in, unsigned char code, | |||
15 | 15 | ||
16 | void nf_send_reset6(struct net *net, struct sk_buff *oldskb, int hook); | 16 | void nf_send_reset6(struct net *net, struct sk_buff *oldskb, int hook); |
17 | 17 | ||
18 | const struct tcphdr *nf_reject_ip6_tcphdr_get(struct sk_buff *oldskb, | ||
19 | struct tcphdr *otcph, | ||
20 | unsigned int *otcplen, int hook); | ||
21 | struct ipv6hdr *nf_reject_ip6hdr_put(struct sk_buff *nskb, | ||
22 | const struct sk_buff *oldskb, | ||
23 | __be16 protocol, int hoplimit); | ||
24 | void nf_reject_ip6_tcphdr_put(struct sk_buff *nskb, | ||
25 | const struct sk_buff *oldskb, | ||
26 | const struct tcphdr *oth, unsigned int otcplen); | ||
27 | |||
18 | #endif /* _IPV6_NF_REJECT_H */ | 28 | #endif /* _IPV6_NF_REJECT_H */ |
diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h index 3d7292392fac..845c596bf594 100644 --- a/include/net/netfilter/nf_tables.h +++ b/include/net/netfilter/nf_tables.h | |||
@@ -530,6 +530,9 @@ enum nft_chain_type { | |||
530 | NFT_CHAIN_T_MAX | 530 | NFT_CHAIN_T_MAX |
531 | }; | 531 | }; |
532 | 532 | ||
533 | int nft_chain_validate_dependency(const struct nft_chain *chain, | ||
534 | enum nft_chain_type type); | ||
535 | |||
533 | struct nft_stats { | 536 | struct nft_stats { |
534 | u64 bytes; | 537 | u64 bytes; |
535 | u64 pkts; | 538 | u64 pkts; |
diff --git a/include/net/netfilter/nft_masq.h b/include/net/netfilter/nft_masq.h index c72729f954f4..e2a518b60e19 100644 --- a/include/net/netfilter/nft_masq.h +++ b/include/net/netfilter/nft_masq.h | |||
@@ -13,4 +13,7 @@ int nft_masq_init(const struct nft_ctx *ctx, | |||
13 | 13 | ||
14 | int nft_masq_dump(struct sk_buff *skb, const struct nft_expr *expr); | 14 | int nft_masq_dump(struct sk_buff *skb, const struct nft_expr *expr); |
15 | 15 | ||
16 | int nft_masq_validate(const struct nft_ctx *ctx, const struct nft_expr *expr, | ||
17 | const struct nft_data **data); | ||
18 | |||
16 | #endif /* _NFT_MASQ_H_ */ | 19 | #endif /* _NFT_MASQ_H_ */ |
diff --git a/include/net/udp_tunnel.h b/include/net/udp_tunnel.h index a47790bcaa38..2a50a70ef587 100644 --- a/include/net/udp_tunnel.h +++ b/include/net/udp_tunnel.h | |||
@@ -100,6 +100,15 @@ static inline struct sk_buff *udp_tunnel_handle_offloads(struct sk_buff *skb, | |||
100 | return iptunnel_handle_offloads(skb, udp_csum, type); | 100 | return iptunnel_handle_offloads(skb, udp_csum, type); |
101 | } | 101 | } |
102 | 102 | ||
103 | static inline void udp_tunnel_gro_complete(struct sk_buff *skb, int nhoff) | ||
104 | { | ||
105 | struct udphdr *uh; | ||
106 | |||
107 | uh = (struct udphdr *)(skb->data + nhoff - sizeof(struct udphdr)); | ||
108 | skb_shinfo(skb)->gso_type |= uh->check ? | ||
109 | SKB_GSO_UDP_TUNNEL_CSUM : SKB_GSO_UDP_TUNNEL; | ||
110 | } | ||
111 | |||
103 | static inline void udp_tunnel_encap_enable(struct socket *sock) | 112 | static inline void udp_tunnel_encap_enable(struct socket *sock) |
104 | { | 113 | { |
105 | #if IS_ENABLED(CONFIG_IPV6) | 114 | #if IS_ENABLED(CONFIG_IPV6) |
diff --git a/include/scsi/scsi_tcq.h b/include/scsi/scsi_tcq.h index e64583560701..56ed843969ca 100644 --- a/include/scsi/scsi_tcq.h +++ b/include/scsi/scsi_tcq.h | |||
@@ -67,8 +67,9 @@ static inline void scsi_activate_tcq(struct scsi_device *sdev, int depth) | |||
67 | if (!sdev->tagged_supported) | 67 | if (!sdev->tagged_supported) |
68 | return; | 68 | return; |
69 | 69 | ||
70 | if (!shost_use_blk_mq(sdev->host) && | 70 | if (shost_use_blk_mq(sdev->host)) |
71 | !blk_queue_tagged(sdev->request_queue)) | 71 | queue_flag_set_unlocked(QUEUE_FLAG_QUEUED, sdev->request_queue); |
72 | else if (!blk_queue_tagged(sdev->request_queue)) | ||
72 | blk_queue_init_tags(sdev->request_queue, depth, | 73 | blk_queue_init_tags(sdev->request_queue, depth, |
73 | sdev->host->bqt); | 74 | sdev->host->bqt); |
74 | 75 | ||
@@ -81,8 +82,7 @@ static inline void scsi_activate_tcq(struct scsi_device *sdev, int depth) | |||
81 | **/ | 82 | **/ |
82 | static inline void scsi_deactivate_tcq(struct scsi_device *sdev, int depth) | 83 | static inline void scsi_deactivate_tcq(struct scsi_device *sdev, int depth) |
83 | { | 84 | { |
84 | if (!shost_use_blk_mq(sdev->host) && | 85 | if (blk_queue_tagged(sdev->request_queue)) |
85 | blk_queue_tagged(sdev->request_queue)) | ||
86 | blk_queue_free_tags(sdev->request_queue); | 86 | blk_queue_free_tags(sdev->request_queue); |
87 | scsi_adjust_queue_depth(sdev, 0, depth); | 87 | scsi_adjust_queue_depth(sdev, 0, depth); |
88 | } | 88 | } |
diff --git a/include/sound/soc-dpcm.h b/include/sound/soc-dpcm.h index 2883a7a6f9f3..98f2ade0266e 100644 --- a/include/sound/soc-dpcm.h +++ b/include/sound/soc-dpcm.h | |||
@@ -102,6 +102,8 @@ struct snd_soc_dpcm_runtime { | |||
102 | /* state and update */ | 102 | /* state and update */ |
103 | enum snd_soc_dpcm_update runtime_update; | 103 | enum snd_soc_dpcm_update runtime_update; |
104 | enum snd_soc_dpcm_state state; | 104 | enum snd_soc_dpcm_state state; |
105 | |||
106 | int trigger_pending; /* trigger cmd + 1 if pending, 0 if not */ | ||
105 | }; | 107 | }; |
106 | 108 | ||
107 | /* can this BE stop and free */ | 109 | /* can this BE stop and free */ |
diff --git a/include/trace/events/rcu.h b/include/trace/events/rcu.h index 9b56f37148cf..e335e7d8c6c2 100644 --- a/include/trace/events/rcu.h +++ b/include/trace/events/rcu.h | |||
@@ -660,18 +660,18 @@ TRACE_EVENT(rcu_torture_read, | |||
660 | /* | 660 | /* |
661 | * Tracepoint for _rcu_barrier() execution. The string "s" describes | 661 | * Tracepoint for _rcu_barrier() execution. The string "s" describes |
662 | * the _rcu_barrier phase: | 662 | * the _rcu_barrier phase: |
663 | * "Begin": rcu_barrier_callback() started. | 663 | * "Begin": _rcu_barrier() started. |
664 | * "Check": rcu_barrier_callback() checking for piggybacking. | 664 | * "Check": _rcu_barrier() checking for piggybacking. |
665 | * "EarlyExit": rcu_barrier_callback() piggybacked, thus early exit. | 665 | * "EarlyExit": _rcu_barrier() piggybacked, thus early exit. |
666 | * "Inc1": rcu_barrier_callback() piggyback check counter incremented. | 666 | * "Inc1": _rcu_barrier() piggyback check counter incremented. |
667 | * "Offline": rcu_barrier_callback() found offline CPU | 667 | * "OfflineNoCB": _rcu_barrier() found callback on never-online CPU |
668 | * "OnlineNoCB": rcu_barrier_callback() found online no-CBs CPU. | 668 | * "OnlineNoCB": _rcu_barrier() found online no-CBs CPU. |
669 | * "OnlineQ": rcu_barrier_callback() found online CPU with callbacks. | 669 | * "OnlineQ": _rcu_barrier() found online CPU with callbacks. |
670 | * "OnlineNQ": rcu_barrier_callback() found online CPU, no callbacks. | 670 | * "OnlineNQ": _rcu_barrier() found online CPU, no callbacks. |
671 | * "IRQ": An rcu_barrier_callback() callback posted on remote CPU. | 671 | * "IRQ": An rcu_barrier_callback() callback posted on remote CPU. |
672 | * "CB": An rcu_barrier_callback() invoked a callback, not the last. | 672 | * "CB": An rcu_barrier_callback() invoked a callback, not the last. |
673 | * "LastCB": An rcu_barrier_callback() invoked the last callback. | 673 | * "LastCB": An rcu_barrier_callback() invoked the last callback. |
674 | * "Inc2": rcu_barrier_callback() piggyback check counter incremented. | 674 | * "Inc2": _rcu_barrier() piggyback check counter incremented. |
675 | * The "cpu" argument is the CPU or -1 if meaningless, the "cnt" argument | 675 | * The "cpu" argument is the CPU or -1 if meaningless, the "cnt" argument |
676 | * is the count of remaining callbacks, and "done" is the piggybacking count. | 676 | * is the count of remaining callbacks, and "done" is the piggybacking count. |
677 | */ | 677 | */ |
diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild index b70237e8bc37..4c94f31a8c99 100644 --- a/include/uapi/linux/Kbuild +++ b/include/uapi/linux/Kbuild | |||
@@ -125,6 +125,7 @@ header-y += filter.h | |||
125 | header-y += firewire-cdev.h | 125 | header-y += firewire-cdev.h |
126 | header-y += firewire-constants.h | 126 | header-y += firewire-constants.h |
127 | header-y += flat.h | 127 | header-y += flat.h |
128 | header-y += fou.h | ||
128 | header-y += fs.h | 129 | header-y += fs.h |
129 | header-y += fsl_hypervisor.h | 130 | header-y += fsl_hypervisor.h |
130 | header-y += fuse.h | 131 | header-y += fuse.h |
@@ -141,6 +142,7 @@ header-y += hid.h | |||
141 | header-y += hiddev.h | 142 | header-y += hiddev.h |
142 | header-y += hidraw.h | 143 | header-y += hidraw.h |
143 | header-y += hpet.h | 144 | header-y += hpet.h |
145 | header-y += hsr_netlink.h | ||
144 | header-y += hyperv.h | 146 | header-y += hyperv.h |
145 | header-y += hysdn_if.h | 147 | header-y += hysdn_if.h |
146 | header-y += i2c-dev.h | 148 | header-y += i2c-dev.h |
@@ -251,6 +253,7 @@ header-y += mii.h | |||
251 | header-y += minix_fs.h | 253 | header-y += minix_fs.h |
252 | header-y += mman.h | 254 | header-y += mman.h |
253 | header-y += mmtimer.h | 255 | header-y += mmtimer.h |
256 | header-y += mpls.h | ||
254 | header-y += mqueue.h | 257 | header-y += mqueue.h |
255 | header-y += mroute.h | 258 | header-y += mroute.h |
256 | header-y += mroute6.h | 259 | header-y += mroute6.h |
@@ -424,6 +427,7 @@ header-y += virtio_net.h | |||
424 | header-y += virtio_pci.h | 427 | header-y += virtio_pci.h |
425 | header-y += virtio_ring.h | 428 | header-y += virtio_ring.h |
426 | header-y += virtio_rng.h | 429 | header-y += virtio_rng.h |
430 | header=y += vm_sockets.h | ||
427 | header-y += vt.h | 431 | header-y += vt.h |
428 | header-y += wait.h | 432 | header-y += wait.h |
429 | header-y += wanrouter.h | 433 | header-y += wanrouter.h |
diff --git a/include/uapi/linux/if_bridge.h b/include/uapi/linux/if_bridge.h index 39f621a9fe82..da17e456908d 100644 --- a/include/uapi/linux/if_bridge.h +++ b/include/uapi/linux/if_bridge.h | |||
@@ -15,6 +15,7 @@ | |||
15 | 15 | ||
16 | #include <linux/types.h> | 16 | #include <linux/types.h> |
17 | #include <linux/if_ether.h> | 17 | #include <linux/if_ether.h> |
18 | #include <linux/in6.h> | ||
18 | 19 | ||
19 | #define SYSFS_BRIDGE_ATTR "bridge" | 20 | #define SYSFS_BRIDGE_ATTR "bridge" |
20 | #define SYSFS_BRIDGE_FDB "brforward" | 21 | #define SYSFS_BRIDGE_FDB "brforward" |
diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h index 1874ebe9ac1e..a1d7e931ab72 100644 --- a/include/uapi/linux/input.h +++ b/include/uapi/linux/input.h | |||
@@ -739,6 +739,13 @@ struct input_keymap_entry { | |||
739 | #define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */ | 739 | #define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */ |
740 | #define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */ | 740 | #define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */ |
741 | 741 | ||
742 | #define KEY_KBDINPUTASSIST_PREV 0x260 | ||
743 | #define KEY_KBDINPUTASSIST_NEXT 0x261 | ||
744 | #define KEY_KBDINPUTASSIST_PREVGROUP 0x262 | ||
745 | #define KEY_KBDINPUTASSIST_NEXTGROUP 0x263 | ||
746 | #define KEY_KBDINPUTASSIST_ACCEPT 0x264 | ||
747 | #define KEY_KBDINPUTASSIST_CANCEL 0x265 | ||
748 | |||
742 | #define BTN_TRIGGER_HAPPY 0x2c0 | 749 | #define BTN_TRIGGER_HAPPY 0x2c0 |
743 | #define BTN_TRIGGER_HAPPY1 0x2c0 | 750 | #define BTN_TRIGGER_HAPPY1 0x2c0 |
744 | #define BTN_TRIGGER_HAPPY2 0x2c1 | 751 | #define BTN_TRIGGER_HAPPY2 0x2c1 |
diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h index 9269de254874..9d845404d875 100644 --- a/include/uapi/linux/perf_event.h +++ b/include/uapi/linux/perf_event.h | |||
@@ -364,7 +364,7 @@ struct perf_event_mmap_page { | |||
364 | /* | 364 | /* |
365 | * Bits needed to read the hw events in user-space. | 365 | * Bits needed to read the hw events in user-space. |
366 | * | 366 | * |
367 | * u32 seq, time_mult, time_shift, idx, width; | 367 | * u32 seq, time_mult, time_shift, index, width; |
368 | * u64 count, enabled, running; | 368 | * u64 count, enabled, running; |
369 | * u64 cyc, time_offset; | 369 | * u64 cyc, time_offset; |
370 | * s64 pmc = 0; | 370 | * s64 pmc = 0; |
@@ -383,11 +383,11 @@ struct perf_event_mmap_page { | |||
383 | * time_shift = pc->time_shift; | 383 | * time_shift = pc->time_shift; |
384 | * } | 384 | * } |
385 | * | 385 | * |
386 | * idx = pc->index; | 386 | * index = pc->index; |
387 | * count = pc->offset; | 387 | * count = pc->offset; |
388 | * if (pc->cap_usr_rdpmc && idx) { | 388 | * if (pc->cap_user_rdpmc && index) { |
389 | * width = pc->pmc_width; | 389 | * width = pc->pmc_width; |
390 | * pmc = rdpmc(idx - 1); | 390 | * pmc = rdpmc(index - 1); |
391 | * } | 391 | * } |
392 | * | 392 | * |
393 | * barrier(); | 393 | * barrier(); |
@@ -415,7 +415,7 @@ struct perf_event_mmap_page { | |||
415 | }; | 415 | }; |
416 | 416 | ||
417 | /* | 417 | /* |
418 | * If cap_usr_rdpmc this field provides the bit-width of the value | 418 | * If cap_user_rdpmc this field provides the bit-width of the value |
419 | * read using the rdpmc() or equivalent instruction. This can be used | 419 | * read using the rdpmc() or equivalent instruction. This can be used |
420 | * to sign extend the result like: | 420 | * to sign extend the result like: |
421 | * | 421 | * |
@@ -439,10 +439,10 @@ struct perf_event_mmap_page { | |||
439 | * | 439 | * |
440 | * Where time_offset,time_mult,time_shift and cyc are read in the | 440 | * Where time_offset,time_mult,time_shift and cyc are read in the |
441 | * seqcount loop described above. This delta can then be added to | 441 | * seqcount loop described above. This delta can then be added to |
442 | * enabled and possible running (if idx), improving the scaling: | 442 | * enabled and possible running (if index), improving the scaling: |
443 | * | 443 | * |
444 | * enabled += delta; | 444 | * enabled += delta; |
445 | * if (idx) | 445 | * if (index) |
446 | * running += delta; | 446 | * running += delta; |
447 | * | 447 | * |
448 | * quot = count / running; | 448 | * quot = count / running; |
diff --git a/include/uapi/linux/sched.h b/include/uapi/linux/sched.h index 34f9d7387d13..b932be9f5c5b 100644 --- a/include/uapi/linux/sched.h +++ b/include/uapi/linux/sched.h | |||
@@ -13,7 +13,7 @@ | |||
13 | #define CLONE_VFORK 0x00004000 /* set if the parent wants the child to wake it up on mm_release */ | 13 | #define CLONE_VFORK 0x00004000 /* set if the parent wants the child to wake it up on mm_release */ |
14 | #define CLONE_PARENT 0x00008000 /* set if we want to have the same parent as the cloner */ | 14 | #define CLONE_PARENT 0x00008000 /* set if we want to have the same parent as the cloner */ |
15 | #define CLONE_THREAD 0x00010000 /* Same thread group? */ | 15 | #define CLONE_THREAD 0x00010000 /* Same thread group? */ |
16 | #define CLONE_NEWNS 0x00020000 /* New namespace group? */ | 16 | #define CLONE_NEWNS 0x00020000 /* New mount namespace group */ |
17 | #define CLONE_SYSVSEM 0x00040000 /* share system V SEM_UNDO semantics */ | 17 | #define CLONE_SYSVSEM 0x00040000 /* share system V SEM_UNDO semantics */ |
18 | #define CLONE_SETTLS 0x00080000 /* create a new TLS for the child */ | 18 | #define CLONE_SETTLS 0x00080000 /* create a new TLS for the child */ |
19 | #define CLONE_PARENT_SETTID 0x00100000 /* set the TID in the parent */ | 19 | #define CLONE_PARENT_SETTID 0x00100000 /* set the TID in the parent */ |
diff --git a/include/uapi/linux/v4l2-dv-timings.h b/include/uapi/linux/v4l2-dv-timings.h index 6a0764c89fcb..6c8f159e416e 100644 --- a/include/uapi/linux/v4l2-dv-timings.h +++ b/include/uapi/linux/v4l2-dv-timings.h | |||
@@ -21,8 +21,17 @@ | |||
21 | #ifndef _V4L2_DV_TIMINGS_H | 21 | #ifndef _V4L2_DV_TIMINGS_H |
22 | #define _V4L2_DV_TIMINGS_H | 22 | #define _V4L2_DV_TIMINGS_H |
23 | 23 | ||
24 | #if __GNUC__ < 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ < 6)) | ||
25 | /* Sadly gcc versions older than 4.6 have a bug in how they initialize | ||
26 | anonymous unions where they require additional curly brackets. | ||
27 | This violates the C1x standard. This workaround adds the curly brackets | ||
28 | if needed. */ | ||
24 | #define V4L2_INIT_BT_TIMINGS(_width, args...) \ | 29 | #define V4L2_INIT_BT_TIMINGS(_width, args...) \ |
25 | { .bt = { _width , ## args } } | 30 | { .bt = { _width , ## args } } |
31 | #else | ||
32 | #define V4L2_INIT_BT_TIMINGS(_width, args...) \ | ||
33 | .bt = { _width , ## args } | ||
34 | #endif | ||
26 | 35 | ||
27 | /* CEA-861-E timings (i.e. standard HDTV timings) */ | 36 | /* CEA-861-E timings (i.e. standard HDTV timings) */ |
28 | 37 | ||
diff --git a/init/Kconfig b/init/Kconfig index 3ee28ae02cc8..2081a4d3d917 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
@@ -1341,6 +1341,10 @@ config SYSCTL_ARCH_UNALIGN_ALLOW | |||
1341 | config HAVE_PCSPKR_PLATFORM | 1341 | config HAVE_PCSPKR_PLATFORM |
1342 | bool | 1342 | bool |
1343 | 1343 | ||
1344 | # interpreter that classic socket filters depend on | ||
1345 | config BPF | ||
1346 | bool | ||
1347 | |||
1344 | menuconfig EXPERT | 1348 | menuconfig EXPERT |
1345 | bool "Configure standard kernel features (expert users)" | 1349 | bool "Configure standard kernel features (expert users)" |
1346 | # Unhide debug options, to make the on-by-default options visible | 1350 | # Unhide debug options, to make the on-by-default options visible |
@@ -1521,6 +1525,16 @@ config EVENTFD | |||
1521 | 1525 | ||
1522 | If unsure, say Y. | 1526 | If unsure, say Y. |
1523 | 1527 | ||
1528 | # syscall, maps, verifier | ||
1529 | config BPF_SYSCALL | ||
1530 | bool "Enable bpf() system call" if EXPERT | ||
1531 | select ANON_INODES | ||
1532 | select BPF | ||
1533 | default n | ||
1534 | help | ||
1535 | Enable the bpf() system call that allows to manipulate eBPF | ||
1536 | programs and maps via file descriptors. | ||
1537 | |||
1524 | config SHMEM | 1538 | config SHMEM |
1525 | bool "Use full shmem filesystem" if EXPERT | 1539 | bool "Use full shmem filesystem" if EXPERT |
1526 | default y | 1540 | default y |
diff --git a/init/main.c b/init/main.c index 800a0daede7e..321d0ceb26d3 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -544,7 +544,7 @@ asmlinkage __visible void __init start_kernel(void) | |||
544 | static_command_line, __start___param, | 544 | static_command_line, __start___param, |
545 | __stop___param - __start___param, | 545 | __stop___param - __start___param, |
546 | -1, -1, &unknown_bootoption); | 546 | -1, -1, &unknown_bootoption); |
547 | if (after_dashes) | 547 | if (!IS_ERR_OR_NULL(after_dashes)) |
548 | parse_args("Setting init args", after_dashes, NULL, 0, -1, -1, | 548 | parse_args("Setting init args", after_dashes, NULL, 0, -1, -1, |
549 | set_init_arg); | 549 | set_init_arg); |
550 | 550 | ||
diff --git a/kernel/Makefile b/kernel/Makefile index dc5c77544fd6..17ea6d4a9a24 100644 --- a/kernel/Makefile +++ b/kernel/Makefile | |||
@@ -86,7 +86,7 @@ obj-$(CONFIG_RING_BUFFER) += trace/ | |||
86 | obj-$(CONFIG_TRACEPOINTS) += trace/ | 86 | obj-$(CONFIG_TRACEPOINTS) += trace/ |
87 | obj-$(CONFIG_IRQ_WORK) += irq_work.o | 87 | obj-$(CONFIG_IRQ_WORK) += irq_work.o |
88 | obj-$(CONFIG_CPU_PM) += cpu_pm.o | 88 | obj-$(CONFIG_CPU_PM) += cpu_pm.o |
89 | obj-$(CONFIG_NET) += bpf/ | 89 | obj-$(CONFIG_BPF) += bpf/ |
90 | 90 | ||
91 | obj-$(CONFIG_PERF_EVENTS) += events/ | 91 | obj-$(CONFIG_PERF_EVENTS) += events/ |
92 | 92 | ||
diff --git a/kernel/audit.c b/kernel/audit.c index 80983df92cd4..cebb11db4d34 100644 --- a/kernel/audit.c +++ b/kernel/audit.c | |||
@@ -739,7 +739,7 @@ static void audit_log_feature_change(int which, u32 old_feature, u32 new_feature | |||
739 | 739 | ||
740 | ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_FEATURE_CHANGE); | 740 | ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_FEATURE_CHANGE); |
741 | audit_log_task_info(ab, current); | 741 | audit_log_task_info(ab, current); |
742 | audit_log_format(ab, "feature=%s old=%u new=%u old_lock=%u new_lock=%u res=%d", | 742 | audit_log_format(ab, " feature=%s old=%u new=%u old_lock=%u new_lock=%u res=%d", |
743 | audit_feature_names[which], !!old_feature, !!new_feature, | 743 | audit_feature_names[which], !!old_feature, !!new_feature, |
744 | !!old_lock, !!new_lock, res); | 744 | !!old_lock, !!new_lock, res); |
745 | audit_log_end(ab); | 745 | audit_log_end(ab); |
diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c index e242e3a9864a..80f29e015570 100644 --- a/kernel/audit_tree.c +++ b/kernel/audit_tree.c | |||
@@ -154,6 +154,7 @@ static struct audit_chunk *alloc_chunk(int count) | |||
154 | chunk->owners[i].index = i; | 154 | chunk->owners[i].index = i; |
155 | } | 155 | } |
156 | fsnotify_init_mark(&chunk->mark, audit_tree_destroy_watch); | 156 | fsnotify_init_mark(&chunk->mark, audit_tree_destroy_watch); |
157 | chunk->mark.mask = FS_IN_IGNORED; | ||
157 | return chunk; | 158 | return chunk; |
158 | } | 159 | } |
159 | 160 | ||
diff --git a/kernel/bpf/Makefile b/kernel/bpf/Makefile index 45427239f375..0daf7f6ae7df 100644 --- a/kernel/bpf/Makefile +++ b/kernel/bpf/Makefile | |||
@@ -1,5 +1,5 @@ | |||
1 | obj-y := core.o syscall.o verifier.o | 1 | obj-y := core.o |
2 | 2 | obj-$(CONFIG_BPF_SYSCALL) += syscall.o verifier.o | |
3 | ifdef CONFIG_TEST_BPF | 3 | ifdef CONFIG_TEST_BPF |
4 | obj-y += test_stub.o | 4 | obj-$(CONFIG_BPF_SYSCALL) += test_stub.o |
5 | endif | 5 | endif |
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c index f0c30c59b317..d6594e457a25 100644 --- a/kernel/bpf/core.c +++ b/kernel/bpf/core.c | |||
@@ -655,3 +655,12 @@ void bpf_prog_free(struct bpf_prog *fp) | |||
655 | schedule_work(&aux->work); | 655 | schedule_work(&aux->work); |
656 | } | 656 | } |
657 | EXPORT_SYMBOL_GPL(bpf_prog_free); | 657 | EXPORT_SYMBOL_GPL(bpf_prog_free); |
658 | |||
659 | /* To execute LD_ABS/LD_IND instructions __bpf_prog_run() may call | ||
660 | * skb_copy_bits(), so provide a weak definition of it for NET-less config. | ||
661 | */ | ||
662 | int __weak skb_copy_bits(const struct sk_buff *skb, int offset, void *to, | ||
663 | int len) | ||
664 | { | ||
665 | return -EFAULT; | ||
666 | } | ||
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index 801f5f3b9307..9f81818f2941 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c | |||
@@ -1409,7 +1409,8 @@ static bool states_equal(struct verifier_state *old, struct verifier_state *cur) | |||
1409 | if (memcmp(&old->regs[i], &cur->regs[i], | 1409 | if (memcmp(&old->regs[i], &cur->regs[i], |
1410 | sizeof(old->regs[0])) != 0) { | 1410 | sizeof(old->regs[0])) != 0) { |
1411 | if (old->regs[i].type == NOT_INIT || | 1411 | if (old->regs[i].type == NOT_INIT || |
1412 | old->regs[i].type == UNKNOWN_VALUE) | 1412 | (old->regs[i].type == UNKNOWN_VALUE && |
1413 | cur->regs[i].type != NOT_INIT)) | ||
1413 | continue; | 1414 | continue; |
1414 | return false; | 1415 | return false; |
1415 | } | 1416 | } |
diff --git a/kernel/context_tracking.c b/kernel/context_tracking.c index 5664985c46a0..937ecdfdf258 100644 --- a/kernel/context_tracking.c +++ b/kernel/context_tracking.c | |||
@@ -107,46 +107,6 @@ void context_tracking_user_enter(void) | |||
107 | } | 107 | } |
108 | NOKPROBE_SYMBOL(context_tracking_user_enter); | 108 | NOKPROBE_SYMBOL(context_tracking_user_enter); |
109 | 109 | ||
110 | #ifdef CONFIG_PREEMPT | ||
111 | /** | ||
112 | * preempt_schedule_context - preempt_schedule called by tracing | ||
113 | * | ||
114 | * The tracing infrastructure uses preempt_enable_notrace to prevent | ||
115 | * recursion and tracing preempt enabling caused by the tracing | ||
116 | * infrastructure itself. But as tracing can happen in areas coming | ||
117 | * from userspace or just about to enter userspace, a preempt enable | ||
118 | * can occur before user_exit() is called. This will cause the scheduler | ||
119 | * to be called when the system is still in usermode. | ||
120 | * | ||
121 | * To prevent this, the preempt_enable_notrace will use this function | ||
122 | * instead of preempt_schedule() to exit user context if needed before | ||
123 | * calling the scheduler. | ||
124 | */ | ||
125 | asmlinkage __visible void __sched notrace preempt_schedule_context(void) | ||
126 | { | ||
127 | enum ctx_state prev_ctx; | ||
128 | |||
129 | if (likely(!preemptible())) | ||
130 | return; | ||
131 | |||
132 | /* | ||
133 | * Need to disable preemption in case user_exit() is traced | ||
134 | * and the tracer calls preempt_enable_notrace() causing | ||
135 | * an infinite recursion. | ||
136 | */ | ||
137 | preempt_disable_notrace(); | ||
138 | prev_ctx = exception_enter(); | ||
139 | preempt_enable_no_resched_notrace(); | ||
140 | |||
141 | preempt_schedule(); | ||
142 | |||
143 | preempt_disable_notrace(); | ||
144 | exception_exit(prev_ctx); | ||
145 | preempt_enable_notrace(); | ||
146 | } | ||
147 | EXPORT_SYMBOL_GPL(preempt_schedule_context); | ||
148 | #endif /* CONFIG_PREEMPT */ | ||
149 | |||
150 | /** | 110 | /** |
151 | * context_tracking_user_exit - Inform the context tracking that the CPU is | 111 | * context_tracking_user_exit - Inform the context tracking that the CPU is |
152 | * exiting userspace mode and entering the kernel. | 112 | * exiting userspace mode and entering the kernel. |
diff --git a/kernel/cpu.c b/kernel/cpu.c index 356450f09c1f..90a3d017b90c 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c | |||
@@ -64,6 +64,8 @@ static struct { | |||
64 | * an ongoing cpu hotplug operation. | 64 | * an ongoing cpu hotplug operation. |
65 | */ | 65 | */ |
66 | int refcount; | 66 | int refcount; |
67 | /* And allows lockless put_online_cpus(). */ | ||
68 | atomic_t puts_pending; | ||
67 | 69 | ||
68 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 70 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
69 | struct lockdep_map dep_map; | 71 | struct lockdep_map dep_map; |
@@ -113,7 +115,11 @@ void put_online_cpus(void) | |||
113 | { | 115 | { |
114 | if (cpu_hotplug.active_writer == current) | 116 | if (cpu_hotplug.active_writer == current) |
115 | return; | 117 | return; |
116 | mutex_lock(&cpu_hotplug.lock); | 118 | if (!mutex_trylock(&cpu_hotplug.lock)) { |
119 | atomic_inc(&cpu_hotplug.puts_pending); | ||
120 | cpuhp_lock_release(); | ||
121 | return; | ||
122 | } | ||
117 | 123 | ||
118 | if (WARN_ON(!cpu_hotplug.refcount)) | 124 | if (WARN_ON(!cpu_hotplug.refcount)) |
119 | cpu_hotplug.refcount++; /* try to fix things up */ | 125 | cpu_hotplug.refcount++; /* try to fix things up */ |
@@ -155,6 +161,12 @@ void cpu_hotplug_begin(void) | |||
155 | cpuhp_lock_acquire(); | 161 | cpuhp_lock_acquire(); |
156 | for (;;) { | 162 | for (;;) { |
157 | mutex_lock(&cpu_hotplug.lock); | 163 | mutex_lock(&cpu_hotplug.lock); |
164 | if (atomic_read(&cpu_hotplug.puts_pending)) { | ||
165 | int delta; | ||
166 | |||
167 | delta = atomic_xchg(&cpu_hotplug.puts_pending, 0); | ||
168 | cpu_hotplug.refcount -= delta; | ||
169 | } | ||
158 | if (likely(!cpu_hotplug.refcount)) | 170 | if (likely(!cpu_hotplug.refcount)) |
159 | break; | 171 | break; |
160 | __set_current_state(TASK_UNINTERRUPTIBLE); | 172 | __set_current_state(TASK_UNINTERRUPTIBLE); |
diff --git a/kernel/events/core.c b/kernel/events/core.c index 1425d07018de..2b02c9fda790 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c | |||
@@ -6071,11 +6071,6 @@ static int perf_swevent_init(struct perf_event *event) | |||
6071 | return 0; | 6071 | return 0; |
6072 | } | 6072 | } |
6073 | 6073 | ||
6074 | static int perf_swevent_event_idx(struct perf_event *event) | ||
6075 | { | ||
6076 | return 0; | ||
6077 | } | ||
6078 | |||
6079 | static struct pmu perf_swevent = { | 6074 | static struct pmu perf_swevent = { |
6080 | .task_ctx_nr = perf_sw_context, | 6075 | .task_ctx_nr = perf_sw_context, |
6081 | 6076 | ||
@@ -6085,8 +6080,6 @@ static struct pmu perf_swevent = { | |||
6085 | .start = perf_swevent_start, | 6080 | .start = perf_swevent_start, |
6086 | .stop = perf_swevent_stop, | 6081 | .stop = perf_swevent_stop, |
6087 | .read = perf_swevent_read, | 6082 | .read = perf_swevent_read, |
6088 | |||
6089 | .event_idx = perf_swevent_event_idx, | ||
6090 | }; | 6083 | }; |
6091 | 6084 | ||
6092 | #ifdef CONFIG_EVENT_TRACING | 6085 | #ifdef CONFIG_EVENT_TRACING |
@@ -6204,8 +6197,6 @@ static struct pmu perf_tracepoint = { | |||
6204 | .start = perf_swevent_start, | 6197 | .start = perf_swevent_start, |
6205 | .stop = perf_swevent_stop, | 6198 | .stop = perf_swevent_stop, |
6206 | .read = perf_swevent_read, | 6199 | .read = perf_swevent_read, |
6207 | |||
6208 | .event_idx = perf_swevent_event_idx, | ||
6209 | }; | 6200 | }; |
6210 | 6201 | ||
6211 | static inline void perf_tp_register(void) | 6202 | static inline void perf_tp_register(void) |
@@ -6431,8 +6422,6 @@ static struct pmu perf_cpu_clock = { | |||
6431 | .start = cpu_clock_event_start, | 6422 | .start = cpu_clock_event_start, |
6432 | .stop = cpu_clock_event_stop, | 6423 | .stop = cpu_clock_event_stop, |
6433 | .read = cpu_clock_event_read, | 6424 | .read = cpu_clock_event_read, |
6434 | |||
6435 | .event_idx = perf_swevent_event_idx, | ||
6436 | }; | 6425 | }; |
6437 | 6426 | ||
6438 | /* | 6427 | /* |
@@ -6511,8 +6500,6 @@ static struct pmu perf_task_clock = { | |||
6511 | .start = task_clock_event_start, | 6500 | .start = task_clock_event_start, |
6512 | .stop = task_clock_event_stop, | 6501 | .stop = task_clock_event_stop, |
6513 | .read = task_clock_event_read, | 6502 | .read = task_clock_event_read, |
6514 | |||
6515 | .event_idx = perf_swevent_event_idx, | ||
6516 | }; | 6503 | }; |
6517 | 6504 | ||
6518 | static void perf_pmu_nop_void(struct pmu *pmu) | 6505 | static void perf_pmu_nop_void(struct pmu *pmu) |
@@ -6542,7 +6529,7 @@ static void perf_pmu_cancel_txn(struct pmu *pmu) | |||
6542 | 6529 | ||
6543 | static int perf_event_idx_default(struct perf_event *event) | 6530 | static int perf_event_idx_default(struct perf_event *event) |
6544 | { | 6531 | { |
6545 | return event->hw.idx + 1; | 6532 | return 0; |
6546 | } | 6533 | } |
6547 | 6534 | ||
6548 | /* | 6535 | /* |
diff --git a/kernel/events/hw_breakpoint.c b/kernel/events/hw_breakpoint.c index 1559fb0b9296..9803a6600d49 100644 --- a/kernel/events/hw_breakpoint.c +++ b/kernel/events/hw_breakpoint.c | |||
@@ -605,11 +605,6 @@ static void hw_breakpoint_stop(struct perf_event *bp, int flags) | |||
605 | bp->hw.state = PERF_HES_STOPPED; | 605 | bp->hw.state = PERF_HES_STOPPED; |
606 | } | 606 | } |
607 | 607 | ||
608 | static int hw_breakpoint_event_idx(struct perf_event *bp) | ||
609 | { | ||
610 | return 0; | ||
611 | } | ||
612 | |||
613 | static struct pmu perf_breakpoint = { | 608 | static struct pmu perf_breakpoint = { |
614 | .task_ctx_nr = perf_sw_context, /* could eventually get its own */ | 609 | .task_ctx_nr = perf_sw_context, /* could eventually get its own */ |
615 | 610 | ||
@@ -619,8 +614,6 @@ static struct pmu perf_breakpoint = { | |||
619 | .start = hw_breakpoint_start, | 614 | .start = hw_breakpoint_start, |
620 | .stop = hw_breakpoint_stop, | 615 | .stop = hw_breakpoint_stop, |
621 | .read = hw_breakpoint_pmu_read, | 616 | .read = hw_breakpoint_pmu_read, |
622 | |||
623 | .event_idx = hw_breakpoint_event_idx, | ||
624 | }; | 617 | }; |
625 | 618 | ||
626 | int __init init_hw_breakpoint(void) | 619 | int __init init_hw_breakpoint(void) |
diff --git a/kernel/futex.c b/kernel/futex.c index f3a3a071283c..63678b573d61 100644 --- a/kernel/futex.c +++ b/kernel/futex.c | |||
@@ -143,9 +143,8 @@ | |||
143 | * | 143 | * |
144 | * Where (A) orders the waiters increment and the futex value read through | 144 | * Where (A) orders the waiters increment and the futex value read through |
145 | * atomic operations (see hb_waiters_inc) and where (B) orders the write | 145 | * atomic operations (see hb_waiters_inc) and where (B) orders the write |
146 | * to futex and the waiters read -- this is done by the barriers in | 146 | * to futex and the waiters read -- this is done by the barriers for both |
147 | * get_futex_key_refs(), through either ihold or atomic_inc, depending on the | 147 | * shared and private futexes in get_futex_key_refs(). |
148 | * futex type. | ||
149 | * | 148 | * |
150 | * This yields the following case (where X:=waiters, Y:=futex): | 149 | * This yields the following case (where X:=waiters, Y:=futex): |
151 | * | 150 | * |
@@ -344,13 +343,20 @@ static void get_futex_key_refs(union futex_key *key) | |||
344 | futex_get_mm(key); /* implies MB (B) */ | 343 | futex_get_mm(key); /* implies MB (B) */ |
345 | break; | 344 | break; |
346 | default: | 345 | default: |
346 | /* | ||
347 | * Private futexes do not hold reference on an inode or | ||
348 | * mm, therefore the only purpose of calling get_futex_key_refs | ||
349 | * is because we need the barrier for the lockless waiter check. | ||
350 | */ | ||
347 | smp_mb(); /* explicit MB (B) */ | 351 | smp_mb(); /* explicit MB (B) */ |
348 | } | 352 | } |
349 | } | 353 | } |
350 | 354 | ||
351 | /* | 355 | /* |
352 | * Drop a reference to the resource addressed by a key. | 356 | * Drop a reference to the resource addressed by a key. |
353 | * The hash bucket spinlock must not be held. | 357 | * The hash bucket spinlock must not be held. This is |
358 | * a no-op for private futexes, see comment in the get | ||
359 | * counterpart. | ||
354 | */ | 360 | */ |
355 | static void drop_futex_key_refs(union futex_key *key) | 361 | static void drop_futex_key_refs(union futex_key *key) |
356 | { | 362 | { |
@@ -641,8 +647,14 @@ static struct futex_pi_state * alloc_pi_state(void) | |||
641 | return pi_state; | 647 | return pi_state; |
642 | } | 648 | } |
643 | 649 | ||
650 | /* | ||
651 | * Must be called with the hb lock held. | ||
652 | */ | ||
644 | static void free_pi_state(struct futex_pi_state *pi_state) | 653 | static void free_pi_state(struct futex_pi_state *pi_state) |
645 | { | 654 | { |
655 | if (!pi_state) | ||
656 | return; | ||
657 | |||
646 | if (!atomic_dec_and_test(&pi_state->refcount)) | 658 | if (!atomic_dec_and_test(&pi_state->refcount)) |
647 | return; | 659 | return; |
648 | 660 | ||
@@ -1521,15 +1533,6 @@ static int futex_requeue(u32 __user *uaddr1, unsigned int flags, | |||
1521 | } | 1533 | } |
1522 | 1534 | ||
1523 | retry: | 1535 | retry: |
1524 | if (pi_state != NULL) { | ||
1525 | /* | ||
1526 | * We will have to lookup the pi_state again, so free this one | ||
1527 | * to keep the accounting correct. | ||
1528 | */ | ||
1529 | free_pi_state(pi_state); | ||
1530 | pi_state = NULL; | ||
1531 | } | ||
1532 | |||
1533 | ret = get_futex_key(uaddr1, flags & FLAGS_SHARED, &key1, VERIFY_READ); | 1536 | ret = get_futex_key(uaddr1, flags & FLAGS_SHARED, &key1, VERIFY_READ); |
1534 | if (unlikely(ret != 0)) | 1537 | if (unlikely(ret != 0)) |
1535 | goto out; | 1538 | goto out; |
@@ -1619,6 +1622,8 @@ retry_private: | |||
1619 | case 0: | 1622 | case 0: |
1620 | break; | 1623 | break; |
1621 | case -EFAULT: | 1624 | case -EFAULT: |
1625 | free_pi_state(pi_state); | ||
1626 | pi_state = NULL; | ||
1622 | double_unlock_hb(hb1, hb2); | 1627 | double_unlock_hb(hb1, hb2); |
1623 | hb_waiters_dec(hb2); | 1628 | hb_waiters_dec(hb2); |
1624 | put_futex_key(&key2); | 1629 | put_futex_key(&key2); |
@@ -1634,6 +1639,8 @@ retry_private: | |||
1634 | * exit to complete. | 1639 | * exit to complete. |
1635 | * - The user space value changed. | 1640 | * - The user space value changed. |
1636 | */ | 1641 | */ |
1642 | free_pi_state(pi_state); | ||
1643 | pi_state = NULL; | ||
1637 | double_unlock_hb(hb1, hb2); | 1644 | double_unlock_hb(hb1, hb2); |
1638 | hb_waiters_dec(hb2); | 1645 | hb_waiters_dec(hb2); |
1639 | put_futex_key(&key2); | 1646 | put_futex_key(&key2); |
@@ -1710,6 +1717,7 @@ retry_private: | |||
1710 | } | 1717 | } |
1711 | 1718 | ||
1712 | out_unlock: | 1719 | out_unlock: |
1720 | free_pi_state(pi_state); | ||
1713 | double_unlock_hb(hb1, hb2); | 1721 | double_unlock_hb(hb1, hb2); |
1714 | hb_waiters_dec(hb2); | 1722 | hb_waiters_dec(hb2); |
1715 | 1723 | ||
@@ -1727,8 +1735,6 @@ out_put_keys: | |||
1727 | out_put_key1: | 1735 | out_put_key1: |
1728 | put_futex_key(&key1); | 1736 | put_futex_key(&key1); |
1729 | out: | 1737 | out: |
1730 | if (pi_state != NULL) | ||
1731 | free_pi_state(pi_state); | ||
1732 | return ret ? ret : task_count; | 1738 | return ret ? ret : task_count; |
1733 | } | 1739 | } |
1734 | 1740 | ||
diff --git a/kernel/gcov/Kconfig b/kernel/gcov/Kconfig index cf66c5c8458e..3b7408759bdf 100644 --- a/kernel/gcov/Kconfig +++ b/kernel/gcov/Kconfig | |||
@@ -35,7 +35,7 @@ config GCOV_KERNEL | |||
35 | config GCOV_PROFILE_ALL | 35 | config GCOV_PROFILE_ALL |
36 | bool "Profile entire Kernel" | 36 | bool "Profile entire Kernel" |
37 | depends on GCOV_KERNEL | 37 | depends on GCOV_KERNEL |
38 | depends on SUPERH || S390 || X86 || PPC || MICROBLAZE || ARM | 38 | depends on SUPERH || S390 || X86 || PPC || MICROBLAZE || ARM || ARM64 |
39 | default n | 39 | default n |
40 | ---help--- | 40 | ---help--- |
41 | This options activates profiling for the entire kernel. | 41 | This options activates profiling for the entire kernel. |
diff --git a/kernel/kmod.c b/kernel/kmod.c index 8637e041a247..80f7a6d00519 100644 --- a/kernel/kmod.c +++ b/kernel/kmod.c | |||
@@ -196,12 +196,34 @@ int __request_module(bool wait, const char *fmt, ...) | |||
196 | EXPORT_SYMBOL(__request_module); | 196 | EXPORT_SYMBOL(__request_module); |
197 | #endif /* CONFIG_MODULES */ | 197 | #endif /* CONFIG_MODULES */ |
198 | 198 | ||
199 | static void call_usermodehelper_freeinfo(struct subprocess_info *info) | ||
200 | { | ||
201 | if (info->cleanup) | ||
202 | (*info->cleanup)(info); | ||
203 | kfree(info); | ||
204 | } | ||
205 | |||
206 | static void umh_complete(struct subprocess_info *sub_info) | ||
207 | { | ||
208 | struct completion *comp = xchg(&sub_info->complete, NULL); | ||
209 | /* | ||
210 | * See call_usermodehelper_exec(). If xchg() returns NULL | ||
211 | * we own sub_info, the UMH_KILLABLE caller has gone away | ||
212 | * or the caller used UMH_NO_WAIT. | ||
213 | */ | ||
214 | if (comp) | ||
215 | complete(comp); | ||
216 | else | ||
217 | call_usermodehelper_freeinfo(sub_info); | ||
218 | } | ||
219 | |||
199 | /* | 220 | /* |
200 | * This is the task which runs the usermode application | 221 | * This is the task which runs the usermode application |
201 | */ | 222 | */ |
202 | static int ____call_usermodehelper(void *data) | 223 | static int ____call_usermodehelper(void *data) |
203 | { | 224 | { |
204 | struct subprocess_info *sub_info = data; | 225 | struct subprocess_info *sub_info = data; |
226 | int wait = sub_info->wait & ~UMH_KILLABLE; | ||
205 | struct cred *new; | 227 | struct cred *new; |
206 | int retval; | 228 | int retval; |
207 | 229 | ||
@@ -221,7 +243,7 @@ static int ____call_usermodehelper(void *data) | |||
221 | retval = -ENOMEM; | 243 | retval = -ENOMEM; |
222 | new = prepare_kernel_cred(current); | 244 | new = prepare_kernel_cred(current); |
223 | if (!new) | 245 | if (!new) |
224 | goto fail; | 246 | goto out; |
225 | 247 | ||
226 | spin_lock(&umh_sysctl_lock); | 248 | spin_lock(&umh_sysctl_lock); |
227 | new->cap_bset = cap_intersect(usermodehelper_bset, new->cap_bset); | 249 | new->cap_bset = cap_intersect(usermodehelper_bset, new->cap_bset); |
@@ -233,7 +255,7 @@ static int ____call_usermodehelper(void *data) | |||
233 | retval = sub_info->init(sub_info, new); | 255 | retval = sub_info->init(sub_info, new); |
234 | if (retval) { | 256 | if (retval) { |
235 | abort_creds(new); | 257 | abort_creds(new); |
236 | goto fail; | 258 | goto out; |
237 | } | 259 | } |
238 | } | 260 | } |
239 | 261 | ||
@@ -242,12 +264,13 @@ static int ____call_usermodehelper(void *data) | |||
242 | retval = do_execve(getname_kernel(sub_info->path), | 264 | retval = do_execve(getname_kernel(sub_info->path), |
243 | (const char __user *const __user *)sub_info->argv, | 265 | (const char __user *const __user *)sub_info->argv, |
244 | (const char __user *const __user *)sub_info->envp); | 266 | (const char __user *const __user *)sub_info->envp); |
267 | out: | ||
268 | sub_info->retval = retval; | ||
269 | /* wait_for_helper() will call umh_complete if UHM_WAIT_PROC. */ | ||
270 | if (wait != UMH_WAIT_PROC) | ||
271 | umh_complete(sub_info); | ||
245 | if (!retval) | 272 | if (!retval) |
246 | return 0; | 273 | return 0; |
247 | |||
248 | /* Exec failed? */ | ||
249 | fail: | ||
250 | sub_info->retval = retval; | ||
251 | do_exit(0); | 274 | do_exit(0); |
252 | } | 275 | } |
253 | 276 | ||
@@ -258,26 +281,6 @@ static int call_helper(void *data) | |||
258 | return ____call_usermodehelper(data); | 281 | return ____call_usermodehelper(data); |
259 | } | 282 | } |
260 | 283 | ||
261 | static void call_usermodehelper_freeinfo(struct subprocess_info *info) | ||
262 | { | ||
263 | if (info->cleanup) | ||
264 | (*info->cleanup)(info); | ||
265 | kfree(info); | ||
266 | } | ||
267 | |||
268 | static void umh_complete(struct subprocess_info *sub_info) | ||
269 | { | ||
270 | struct completion *comp = xchg(&sub_info->complete, NULL); | ||
271 | /* | ||
272 | * See call_usermodehelper_exec(). If xchg() returns NULL | ||
273 | * we own sub_info, the UMH_KILLABLE caller has gone away. | ||
274 | */ | ||
275 | if (comp) | ||
276 | complete(comp); | ||
277 | else | ||
278 | call_usermodehelper_freeinfo(sub_info); | ||
279 | } | ||
280 | |||
281 | /* Keventd can't block, but this (a child) can. */ | 284 | /* Keventd can't block, but this (a child) can. */ |
282 | static int wait_for_helper(void *data) | 285 | static int wait_for_helper(void *data) |
283 | { | 286 | { |
@@ -336,18 +339,8 @@ static void __call_usermodehelper(struct work_struct *work) | |||
336 | kmod_thread_locker = NULL; | 339 | kmod_thread_locker = NULL; |
337 | } | 340 | } |
338 | 341 | ||
339 | switch (wait) { | 342 | if (pid < 0) { |
340 | case UMH_NO_WAIT: | 343 | sub_info->retval = pid; |
341 | call_usermodehelper_freeinfo(sub_info); | ||
342 | break; | ||
343 | |||
344 | case UMH_WAIT_PROC: | ||
345 | if (pid > 0) | ||
346 | break; | ||
347 | /* FALLTHROUGH */ | ||
348 | case UMH_WAIT_EXEC: | ||
349 | if (pid < 0) | ||
350 | sub_info->retval = pid; | ||
351 | umh_complete(sub_info); | 344 | umh_complete(sub_info); |
352 | } | 345 | } |
353 | } | 346 | } |
@@ -588,7 +581,12 @@ int call_usermodehelper_exec(struct subprocess_info *sub_info, int wait) | |||
588 | goto out; | 581 | goto out; |
589 | } | 582 | } |
590 | 583 | ||
591 | sub_info->complete = &done; | 584 | /* |
585 | * Set the completion pointer only if there is a waiter. | ||
586 | * This makes it possible to use umh_complete to free | ||
587 | * the data structure in case of UMH_NO_WAIT. | ||
588 | */ | ||
589 | sub_info->complete = (wait == UMH_NO_WAIT) ? NULL : &done; | ||
592 | sub_info->wait = wait; | 590 | sub_info->wait = wait; |
593 | 591 | ||
594 | queue_work(khelper_wq, &sub_info->work); | 592 | queue_work(khelper_wq, &sub_info->work); |
diff --git a/kernel/panic.c b/kernel/panic.c index d09dc5c32c67..cf80672b7924 100644 --- a/kernel/panic.c +++ b/kernel/panic.c | |||
@@ -244,6 +244,7 @@ static const struct tnt tnts[] = { | |||
244 | * 'I' - Working around severe firmware bug. | 244 | * 'I' - Working around severe firmware bug. |
245 | * 'O' - Out-of-tree module has been loaded. | 245 | * 'O' - Out-of-tree module has been loaded. |
246 | * 'E' - Unsigned module has been loaded. | 246 | * 'E' - Unsigned module has been loaded. |
247 | * 'L' - A soft lockup has previously occurred. | ||
247 | * | 248 | * |
248 | * The string is overwritten by the next call to print_tainted(). | 249 | * The string is overwritten by the next call to print_tainted(). |
249 | */ | 250 | */ |
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c index a9dfa79b6bab..1f35a3478f3c 100644 --- a/kernel/power/hibernate.c +++ b/kernel/power/hibernate.c | |||
@@ -502,8 +502,14 @@ int hibernation_restore(int platform_mode) | |||
502 | error = dpm_suspend_start(PMSG_QUIESCE); | 502 | error = dpm_suspend_start(PMSG_QUIESCE); |
503 | if (!error) { | 503 | if (!error) { |
504 | error = resume_target_kernel(platform_mode); | 504 | error = resume_target_kernel(platform_mode); |
505 | dpm_resume_end(PMSG_RECOVER); | 505 | /* |
506 | * The above should either succeed and jump to the new kernel, | ||
507 | * or return with an error. Otherwise things are just | ||
508 | * undefined, so let's be paranoid. | ||
509 | */ | ||
510 | BUG_ON(!error); | ||
506 | } | 511 | } |
512 | dpm_resume_end(PMSG_RECOVER); | ||
507 | pm_restore_gfp_mask(); | 513 | pm_restore_gfp_mask(); |
508 | resume_console(); | 514 | resume_console(); |
509 | pm_restore_console(); | 515 | pm_restore_console(); |
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index 4ca9a33ff620..c347e3ce3a55 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c | |||
@@ -146,7 +146,7 @@ static int platform_suspend_prepare(suspend_state_t state) | |||
146 | 146 | ||
147 | static int platform_suspend_prepare_late(suspend_state_t state) | 147 | static int platform_suspend_prepare_late(suspend_state_t state) |
148 | { | 148 | { |
149 | return state == PM_SUSPEND_FREEZE && freeze_ops->prepare ? | 149 | return state == PM_SUSPEND_FREEZE && freeze_ops && freeze_ops->prepare ? |
150 | freeze_ops->prepare() : 0; | 150 | freeze_ops->prepare() : 0; |
151 | } | 151 | } |
152 | 152 | ||
@@ -164,7 +164,7 @@ static void platform_resume_noirq(suspend_state_t state) | |||
164 | 164 | ||
165 | static void platform_resume_early(suspend_state_t state) | 165 | static void platform_resume_early(suspend_state_t state) |
166 | { | 166 | { |
167 | if (state == PM_SUSPEND_FREEZE && freeze_ops->restore) | 167 | if (state == PM_SUSPEND_FREEZE && freeze_ops && freeze_ops->restore) |
168 | freeze_ops->restore(); | 168 | freeze_ops->restore(); |
169 | } | 169 | } |
170 | 170 | ||
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 133e47223095..9815447d22e0 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c | |||
@@ -3299,11 +3299,16 @@ static void _rcu_barrier(struct rcu_state *rsp) | |||
3299 | continue; | 3299 | continue; |
3300 | rdp = per_cpu_ptr(rsp->rda, cpu); | 3300 | rdp = per_cpu_ptr(rsp->rda, cpu); |
3301 | if (rcu_is_nocb_cpu(cpu)) { | 3301 | if (rcu_is_nocb_cpu(cpu)) { |
3302 | _rcu_barrier_trace(rsp, "OnlineNoCB", cpu, | 3302 | if (!rcu_nocb_cpu_needs_barrier(rsp, cpu)) { |
3303 | rsp->n_barrier_done); | 3303 | _rcu_barrier_trace(rsp, "OfflineNoCB", cpu, |
3304 | atomic_inc(&rsp->barrier_cpu_count); | 3304 | rsp->n_barrier_done); |
3305 | __call_rcu(&rdp->barrier_head, rcu_barrier_callback, | 3305 | } else { |
3306 | rsp, cpu, 0); | 3306 | _rcu_barrier_trace(rsp, "OnlineNoCB", cpu, |
3307 | rsp->n_barrier_done); | ||
3308 | atomic_inc(&rsp->barrier_cpu_count); | ||
3309 | __call_rcu(&rdp->barrier_head, | ||
3310 | rcu_barrier_callback, rsp, cpu, 0); | ||
3311 | } | ||
3307 | } else if (ACCESS_ONCE(rdp->qlen)) { | 3312 | } else if (ACCESS_ONCE(rdp->qlen)) { |
3308 | _rcu_barrier_trace(rsp, "OnlineQ", cpu, | 3313 | _rcu_barrier_trace(rsp, "OnlineQ", cpu, |
3309 | rsp->n_barrier_done); | 3314 | rsp->n_barrier_done); |
diff --git a/kernel/rcu/tree.h b/kernel/rcu/tree.h index d03764652d91..bbdc45d8d74f 100644 --- a/kernel/rcu/tree.h +++ b/kernel/rcu/tree.h | |||
@@ -587,6 +587,7 @@ static void print_cpu_stall_info(struct rcu_state *rsp, int cpu); | |||
587 | static void print_cpu_stall_info_end(void); | 587 | static void print_cpu_stall_info_end(void); |
588 | static void zero_cpu_stall_ticks(struct rcu_data *rdp); | 588 | static void zero_cpu_stall_ticks(struct rcu_data *rdp); |
589 | static void increment_cpu_stall_ticks(void); | 589 | static void increment_cpu_stall_ticks(void); |
590 | static bool rcu_nocb_cpu_needs_barrier(struct rcu_state *rsp, int cpu); | ||
590 | static void rcu_nocb_gp_set(struct rcu_node *rnp, int nrq); | 591 | static void rcu_nocb_gp_set(struct rcu_node *rnp, int nrq); |
591 | static void rcu_nocb_gp_cleanup(struct rcu_state *rsp, struct rcu_node *rnp); | 592 | static void rcu_nocb_gp_cleanup(struct rcu_state *rsp, struct rcu_node *rnp); |
592 | static void rcu_init_one_nocb(struct rcu_node *rnp); | 593 | static void rcu_init_one_nocb(struct rcu_node *rnp); |
diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h index 387dd4599344..c1d7f27bd38f 100644 --- a/kernel/rcu/tree_plugin.h +++ b/kernel/rcu/tree_plugin.h | |||
@@ -2050,6 +2050,33 @@ static void wake_nocb_leader(struct rcu_data *rdp, bool force) | |||
2050 | } | 2050 | } |
2051 | 2051 | ||
2052 | /* | 2052 | /* |
2053 | * Does the specified CPU need an RCU callback for the specified flavor | ||
2054 | * of rcu_barrier()? | ||
2055 | */ | ||
2056 | static bool rcu_nocb_cpu_needs_barrier(struct rcu_state *rsp, int cpu) | ||
2057 | { | ||
2058 | struct rcu_data *rdp = per_cpu_ptr(rsp->rda, cpu); | ||
2059 | struct rcu_head *rhp; | ||
2060 | |||
2061 | /* No-CBs CPUs might have callbacks on any of three lists. */ | ||
2062 | rhp = ACCESS_ONCE(rdp->nocb_head); | ||
2063 | if (!rhp) | ||
2064 | rhp = ACCESS_ONCE(rdp->nocb_gp_head); | ||
2065 | if (!rhp) | ||
2066 | rhp = ACCESS_ONCE(rdp->nocb_follower_head); | ||
2067 | |||
2068 | /* Having no rcuo kthread but CBs after scheduler starts is bad! */ | ||
2069 | if (!ACCESS_ONCE(rdp->nocb_kthread) && rhp) { | ||
2070 | /* RCU callback enqueued before CPU first came online??? */ | ||
2071 | pr_err("RCU: Never-onlined no-CBs CPU %d has CB %p\n", | ||
2072 | cpu, rhp->func); | ||
2073 | WARN_ON_ONCE(1); | ||
2074 | } | ||
2075 | |||
2076 | return !!rhp; | ||
2077 | } | ||
2078 | |||
2079 | /* | ||
2053 | * Enqueue the specified string of rcu_head structures onto the specified | 2080 | * Enqueue the specified string of rcu_head structures onto the specified |
2054 | * CPU's no-CBs lists. The CPU is specified by rdp, the head of the | 2081 | * CPU's no-CBs lists. The CPU is specified by rdp, the head of the |
2055 | * string by rhp, and the tail of the string by rhtp. The non-lazy/lazy | 2082 | * string by rhp, and the tail of the string by rhtp. The non-lazy/lazy |
@@ -2642,6 +2669,12 @@ static bool init_nocb_callback_list(struct rcu_data *rdp) | |||
2642 | 2669 | ||
2643 | #else /* #ifdef CONFIG_RCU_NOCB_CPU */ | 2670 | #else /* #ifdef CONFIG_RCU_NOCB_CPU */ |
2644 | 2671 | ||
2672 | static bool rcu_nocb_cpu_needs_barrier(struct rcu_state *rsp, int cpu) | ||
2673 | { | ||
2674 | WARN_ON_ONCE(1); /* Should be dead code. */ | ||
2675 | return false; | ||
2676 | } | ||
2677 | |||
2645 | static void rcu_nocb_gp_cleanup(struct rcu_state *rsp, struct rcu_node *rnp) | 2678 | static void rcu_nocb_gp_cleanup(struct rcu_state *rsp, struct rcu_node *rnp) |
2646 | { | 2679 | { |
2647 | } | 2680 | } |
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 44999505e1bf..240157c13ddc 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
@@ -2951,6 +2951,47 @@ asmlinkage __visible void __sched notrace preempt_schedule(void) | |||
2951 | } | 2951 | } |
2952 | NOKPROBE_SYMBOL(preempt_schedule); | 2952 | NOKPROBE_SYMBOL(preempt_schedule); |
2953 | EXPORT_SYMBOL(preempt_schedule); | 2953 | EXPORT_SYMBOL(preempt_schedule); |
2954 | |||
2955 | #ifdef CONFIG_CONTEXT_TRACKING | ||
2956 | /** | ||
2957 | * preempt_schedule_context - preempt_schedule called by tracing | ||
2958 | * | ||
2959 | * The tracing infrastructure uses preempt_enable_notrace to prevent | ||
2960 | * recursion and tracing preempt enabling caused by the tracing | ||
2961 | * infrastructure itself. But as tracing can happen in areas coming | ||
2962 | * from userspace or just about to enter userspace, a preempt enable | ||
2963 | * can occur before user_exit() is called. This will cause the scheduler | ||
2964 | * to be called when the system is still in usermode. | ||
2965 | * | ||
2966 | * To prevent this, the preempt_enable_notrace will use this function | ||
2967 | * instead of preempt_schedule() to exit user context if needed before | ||
2968 | * calling the scheduler. | ||
2969 | */ | ||
2970 | asmlinkage __visible void __sched notrace preempt_schedule_context(void) | ||
2971 | { | ||
2972 | enum ctx_state prev_ctx; | ||
2973 | |||
2974 | if (likely(!preemptible())) | ||
2975 | return; | ||
2976 | |||
2977 | do { | ||
2978 | __preempt_count_add(PREEMPT_ACTIVE); | ||
2979 | /* | ||
2980 | * Needs preempt disabled in case user_exit() is traced | ||
2981 | * and the tracer calls preempt_enable_notrace() causing | ||
2982 | * an infinite recursion. | ||
2983 | */ | ||
2984 | prev_ctx = exception_enter(); | ||
2985 | __schedule(); | ||
2986 | exception_exit(prev_ctx); | ||
2987 | |||
2988 | __preempt_count_sub(PREEMPT_ACTIVE); | ||
2989 | barrier(); | ||
2990 | } while (need_resched()); | ||
2991 | } | ||
2992 | EXPORT_SYMBOL_GPL(preempt_schedule_context); | ||
2993 | #endif /* CONFIG_CONTEXT_TRACKING */ | ||
2994 | |||
2954 | #endif /* CONFIG_PREEMPT */ | 2995 | #endif /* CONFIG_PREEMPT */ |
2955 | 2996 | ||
2956 | /* | 2997 | /* |
@@ -7833,6 +7874,11 @@ static void cpu_cgroup_css_offline(struct cgroup_subsys_state *css) | |||
7833 | sched_offline_group(tg); | 7874 | sched_offline_group(tg); |
7834 | } | 7875 | } |
7835 | 7876 | ||
7877 | static void cpu_cgroup_fork(struct task_struct *task) | ||
7878 | { | ||
7879 | sched_move_task(task); | ||
7880 | } | ||
7881 | |||
7836 | static int cpu_cgroup_can_attach(struct cgroup_subsys_state *css, | 7882 | static int cpu_cgroup_can_attach(struct cgroup_subsys_state *css, |
7837 | struct cgroup_taskset *tset) | 7883 | struct cgroup_taskset *tset) |
7838 | { | 7884 | { |
@@ -8205,6 +8251,7 @@ struct cgroup_subsys cpu_cgrp_subsys = { | |||
8205 | .css_free = cpu_cgroup_css_free, | 8251 | .css_free = cpu_cgroup_css_free, |
8206 | .css_online = cpu_cgroup_css_online, | 8252 | .css_online = cpu_cgroup_css_online, |
8207 | .css_offline = cpu_cgroup_css_offline, | 8253 | .css_offline = cpu_cgroup_css_offline, |
8254 | .fork = cpu_cgroup_fork, | ||
8208 | .can_attach = cpu_cgroup_can_attach, | 8255 | .can_attach = cpu_cgroup_can_attach, |
8209 | .attach = cpu_cgroup_attach, | 8256 | .attach = cpu_cgroup_attach, |
8210 | .exit = cpu_cgroup_exit, | 8257 | .exit = cpu_cgroup_exit, |
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index 256e577faf1b..5285332392d5 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c | |||
@@ -518,12 +518,20 @@ again: | |||
518 | } | 518 | } |
519 | 519 | ||
520 | /* | 520 | /* |
521 | * We need to take care of a possible races here. In fact, the | 521 | * We need to take care of several possible races here: |
522 | * task might have changed its scheduling policy to something | 522 | * |
523 | * different from SCHED_DEADLINE or changed its reservation | 523 | * - the task might have changed its scheduling policy |
524 | * parameters (through sched_setattr()). | 524 | * to something different than SCHED_DEADLINE |
525 | * - the task might have changed its reservation parameters | ||
526 | * (through sched_setattr()) | ||
527 | * - the task might have been boosted by someone else and | ||
528 | * might be in the boosting/deboosting path | ||
529 | * | ||
530 | * In all this cases we bail out, as the task is already | ||
531 | * in the runqueue or is going to be enqueued back anyway. | ||
525 | */ | 532 | */ |
526 | if (!dl_task(p) || dl_se->dl_new) | 533 | if (!dl_task(p) || dl_se->dl_new || |
534 | dl_se->dl_boosted || !dl_se->dl_throttled) | ||
527 | goto unlock; | 535 | goto unlock; |
528 | 536 | ||
529 | sched_clock_tick(); | 537 | sched_clock_tick(); |
@@ -532,7 +540,7 @@ again: | |||
532 | dl_se->dl_yielded = 0; | 540 | dl_se->dl_yielded = 0; |
533 | if (task_on_rq_queued(p)) { | 541 | if (task_on_rq_queued(p)) { |
534 | enqueue_task_dl(rq, p, ENQUEUE_REPLENISH); | 542 | enqueue_task_dl(rq, p, ENQUEUE_REPLENISH); |
535 | if (task_has_dl_policy(rq->curr)) | 543 | if (dl_task(rq->curr)) |
536 | check_preempt_curr_dl(rq, p, 0); | 544 | check_preempt_curr_dl(rq, p, 0); |
537 | else | 545 | else |
538 | resched_curr(rq); | 546 | resched_curr(rq); |
@@ -847,8 +855,19 @@ static void enqueue_task_dl(struct rq *rq, struct task_struct *p, int flags) | |||
847 | * smaller than our one... OTW we keep our runtime and | 855 | * smaller than our one... OTW we keep our runtime and |
848 | * deadline. | 856 | * deadline. |
849 | */ | 857 | */ |
850 | if (pi_task && p->dl.dl_boosted && dl_prio(pi_task->normal_prio)) | 858 | if (pi_task && p->dl.dl_boosted && dl_prio(pi_task->normal_prio)) { |
851 | pi_se = &pi_task->dl; | 859 | pi_se = &pi_task->dl; |
860 | } else if (!dl_prio(p->normal_prio)) { | ||
861 | /* | ||
862 | * Special case in which we have a !SCHED_DEADLINE task | ||
863 | * that is going to be deboosted, but exceedes its | ||
864 | * runtime while doing so. No point in replenishing | ||
865 | * it, as it's going to return back to its original | ||
866 | * scheduling class after this. | ||
867 | */ | ||
868 | BUG_ON(!p->dl.dl_boosted || flags != ENQUEUE_REPLENISH); | ||
869 | return; | ||
870 | } | ||
852 | 871 | ||
853 | /* | 872 | /* |
854 | * If p is throttled, we do nothing. In fact, if it exhausted | 873 | * If p is throttled, we do nothing. In fact, if it exhausted |
@@ -1607,8 +1626,12 @@ static void switched_to_dl(struct rq *rq, struct task_struct *p) | |||
1607 | /* Only reschedule if pushing failed */ | 1626 | /* Only reschedule if pushing failed */ |
1608 | check_resched = 0; | 1627 | check_resched = 0; |
1609 | #endif /* CONFIG_SMP */ | 1628 | #endif /* CONFIG_SMP */ |
1610 | if (check_resched && task_has_dl_policy(rq->curr)) | 1629 | if (check_resched) { |
1611 | check_preempt_curr_dl(rq, p, 0); | 1630 | if (dl_task(rq->curr)) |
1631 | check_preempt_curr_dl(rq, p, 0); | ||
1632 | else | ||
1633 | resched_curr(rq); | ||
1634 | } | ||
1612 | } | 1635 | } |
1613 | } | 1636 | } |
1614 | 1637 | ||
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 0b069bf3e708..34baa60f8a7b 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c | |||
@@ -828,11 +828,12 @@ static unsigned int task_nr_scan_windows(struct task_struct *p) | |||
828 | 828 | ||
829 | static unsigned int task_scan_min(struct task_struct *p) | 829 | static unsigned int task_scan_min(struct task_struct *p) |
830 | { | 830 | { |
831 | unsigned int scan_size = ACCESS_ONCE(sysctl_numa_balancing_scan_size); | ||
831 | unsigned int scan, floor; | 832 | unsigned int scan, floor; |
832 | unsigned int windows = 1; | 833 | unsigned int windows = 1; |
833 | 834 | ||
834 | if (sysctl_numa_balancing_scan_size < MAX_SCAN_WINDOW) | 835 | if (scan_size < MAX_SCAN_WINDOW) |
835 | windows = MAX_SCAN_WINDOW / sysctl_numa_balancing_scan_size; | 836 | windows = MAX_SCAN_WINDOW / scan_size; |
836 | floor = 1000 / windows; | 837 | floor = 1000 / windows; |
837 | 838 | ||
838 | scan = sysctl_numa_balancing_scan_period_min / task_nr_scan_windows(p); | 839 | scan = sysctl_numa_balancing_scan_period_min / task_nr_scan_windows(p); |
@@ -1164,9 +1165,19 @@ static void task_numa_compare(struct task_numa_env *env, | |||
1164 | long moveimp = imp; | 1165 | long moveimp = imp; |
1165 | 1166 | ||
1166 | rcu_read_lock(); | 1167 | rcu_read_lock(); |
1167 | cur = ACCESS_ONCE(dst_rq->curr); | 1168 | |
1168 | if (cur->pid == 0) /* idle */ | 1169 | raw_spin_lock_irq(&dst_rq->lock); |
1170 | cur = dst_rq->curr; | ||
1171 | /* | ||
1172 | * No need to move the exiting task, and this ensures that ->curr | ||
1173 | * wasn't reaped and thus get_task_struct() in task_numa_assign() | ||
1174 | * is safe under RCU read lock. | ||
1175 | * Note that rcu_read_lock() itself can't protect from the final | ||
1176 | * put_task_struct() after the last schedule(). | ||
1177 | */ | ||
1178 | if ((cur->flags & PF_EXITING) || is_idle_task(cur)) | ||
1169 | cur = NULL; | 1179 | cur = NULL; |
1180 | raw_spin_unlock_irq(&dst_rq->lock); | ||
1170 | 1181 | ||
1171 | /* | 1182 | /* |
1172 | * "imp" is the fault differential for the source task between the | 1183 | * "imp" is the fault differential for the source task between the |
@@ -1520,7 +1531,7 @@ static void update_task_scan_period(struct task_struct *p, | |||
1520 | * scanning faster if shared accesses dominate as it may | 1531 | * scanning faster if shared accesses dominate as it may |
1521 | * simply bounce migrations uselessly | 1532 | * simply bounce migrations uselessly |
1522 | */ | 1533 | */ |
1523 | ratio = DIV_ROUND_UP(private * NUMA_PERIOD_SLOTS, (private + shared)); | 1534 | ratio = DIV_ROUND_UP(private * NUMA_PERIOD_SLOTS, (private + shared + 1)); |
1524 | diff = (diff * ratio) / NUMA_PERIOD_SLOTS; | 1535 | diff = (diff * ratio) / NUMA_PERIOD_SLOTS; |
1525 | } | 1536 | } |
1526 | 1537 | ||
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 4aada6d9fe74..15f2511a1b7c 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
@@ -387,7 +387,8 @@ static struct ctl_table kern_table[] = { | |||
387 | .data = &sysctl_numa_balancing_scan_size, | 387 | .data = &sysctl_numa_balancing_scan_size, |
388 | .maxlen = sizeof(unsigned int), | 388 | .maxlen = sizeof(unsigned int), |
389 | .mode = 0644, | 389 | .mode = 0644, |
390 | .proc_handler = proc_dointvec, | 390 | .proc_handler = proc_dointvec_minmax, |
391 | .extra1 = &one, | ||
391 | }, | 392 | }, |
392 | { | 393 | { |
393 | .procname = "numa_balancing", | 394 | .procname = "numa_balancing", |
diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c index 9c94c19f1305..55449909f114 100644 --- a/kernel/time/clockevents.c +++ b/kernel/time/clockevents.c | |||
@@ -72,7 +72,7 @@ static u64 cev_delta2ns(unsigned long latch, struct clock_event_device *evt, | |||
72 | * Also omit the add if it would overflow the u64 boundary. | 72 | * Also omit the add if it would overflow the u64 boundary. |
73 | */ | 73 | */ |
74 | if ((~0ULL - clc > rnd) && | 74 | if ((~0ULL - clc > rnd) && |
75 | (!ismax || evt->mult <= (1U << evt->shift))) | 75 | (!ismax || evt->mult <= (1ULL << evt->shift))) |
76 | clc += rnd; | 76 | clc += rnd; |
77 | 77 | ||
78 | do_div(clc, evt->mult); | 78 | do_div(clc, evt->mult); |
diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c index 42b463ad90f2..31ea01f42e1f 100644 --- a/kernel/time/posix-timers.c +++ b/kernel/time/posix-timers.c | |||
@@ -636,6 +636,7 @@ SYSCALL_DEFINE3(timer_create, const clockid_t, which_clock, | |||
636 | goto out; | 636 | goto out; |
637 | } | 637 | } |
638 | } else { | 638 | } else { |
639 | memset(&event.sigev_value, 0, sizeof(event.sigev_value)); | ||
639 | event.sigev_notify = SIGEV_SIGNAL; | 640 | event.sigev_notify = SIGEV_SIGNAL; |
640 | event.sigev_signo = SIGALRM; | 641 | event.sigev_signo = SIGALRM; |
641 | event.sigev_value.sival_int = new_timer->it_id; | 642 | event.sigev_value.sival_int = new_timer->it_id; |
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index fb186b9ddf51..31c90fec4158 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -1925,8 +1925,16 @@ ftrace_find_tramp_ops_curr(struct dyn_ftrace *rec) | |||
1925 | * when we are adding another op to the rec or removing the | 1925 | * when we are adding another op to the rec or removing the |
1926 | * current one. Thus, if the op is being added, we can | 1926 | * current one. Thus, if the op is being added, we can |
1927 | * ignore it because it hasn't attached itself to the rec | 1927 | * ignore it because it hasn't attached itself to the rec |
1928 | * yet. That means we just need to find the op that has a | 1928 | * yet. |
1929 | * trampoline and is not beeing added. | 1929 | * |
1930 | * If an ops is being modified (hooking to different functions) | ||
1931 | * then we don't care about the new functions that are being | ||
1932 | * added, just the old ones (that are probably being removed). | ||
1933 | * | ||
1934 | * If we are adding an ops to a function that already is using | ||
1935 | * a trampoline, it needs to be removed (trampolines are only | ||
1936 | * for single ops connected), then an ops that is not being | ||
1937 | * modified also needs to be checked. | ||
1930 | */ | 1938 | */ |
1931 | do_for_each_ftrace_op(op, ftrace_ops_list) { | 1939 | do_for_each_ftrace_op(op, ftrace_ops_list) { |
1932 | 1940 | ||
@@ -1940,17 +1948,23 @@ ftrace_find_tramp_ops_curr(struct dyn_ftrace *rec) | |||
1940 | if (op->flags & FTRACE_OPS_FL_ADDING) | 1948 | if (op->flags & FTRACE_OPS_FL_ADDING) |
1941 | continue; | 1949 | continue; |
1942 | 1950 | ||
1951 | |||
1943 | /* | 1952 | /* |
1944 | * If the ops is not being added and has a trampoline, | 1953 | * If the ops is being modified and is in the old |
1945 | * then it must be the one that we want! | 1954 | * hash, then it is probably being removed from this |
1955 | * function. | ||
1946 | */ | 1956 | */ |
1947 | if (hash_contains_ip(ip, op->func_hash)) | ||
1948 | return op; | ||
1949 | |||
1950 | /* If the ops is being modified, it may be in the old hash. */ | ||
1951 | if ((op->flags & FTRACE_OPS_FL_MODIFYING) && | 1957 | if ((op->flags & FTRACE_OPS_FL_MODIFYING) && |
1952 | hash_contains_ip(ip, &op->old_hash)) | 1958 | hash_contains_ip(ip, &op->old_hash)) |
1953 | return op; | 1959 | return op; |
1960 | /* | ||
1961 | * If the ops is not being added or modified, and it's | ||
1962 | * in its normal filter hash, then this must be the one | ||
1963 | * we want! | ||
1964 | */ | ||
1965 | if (!(op->flags & FTRACE_OPS_FL_MODIFYING) && | ||
1966 | hash_contains_ip(ip, op->func_hash)) | ||
1967 | return op; | ||
1954 | 1968 | ||
1955 | } while_for_each_ftrace_op(op); | 1969 | } while_for_each_ftrace_op(op); |
1956 | 1970 | ||
@@ -2293,10 +2307,13 @@ static void ftrace_run_update_code(int command) | |||
2293 | FTRACE_WARN_ON(ret); | 2307 | FTRACE_WARN_ON(ret); |
2294 | } | 2308 | } |
2295 | 2309 | ||
2296 | static void ftrace_run_modify_code(struct ftrace_ops *ops, int command) | 2310 | static void ftrace_run_modify_code(struct ftrace_ops *ops, int command, |
2311 | struct ftrace_hash *old_hash) | ||
2297 | { | 2312 | { |
2298 | ops->flags |= FTRACE_OPS_FL_MODIFYING; | 2313 | ops->flags |= FTRACE_OPS_FL_MODIFYING; |
2314 | ops->old_hash.filter_hash = old_hash; | ||
2299 | ftrace_run_update_code(command); | 2315 | ftrace_run_update_code(command); |
2316 | ops->old_hash.filter_hash = NULL; | ||
2300 | ops->flags &= ~FTRACE_OPS_FL_MODIFYING; | 2317 | ops->flags &= ~FTRACE_OPS_FL_MODIFYING; |
2301 | } | 2318 | } |
2302 | 2319 | ||
@@ -3340,7 +3357,7 @@ static struct ftrace_ops trace_probe_ops __read_mostly = | |||
3340 | 3357 | ||
3341 | static int ftrace_probe_registered; | 3358 | static int ftrace_probe_registered; |
3342 | 3359 | ||
3343 | static void __enable_ftrace_function_probe(void) | 3360 | static void __enable_ftrace_function_probe(struct ftrace_hash *old_hash) |
3344 | { | 3361 | { |
3345 | int ret; | 3362 | int ret; |
3346 | int i; | 3363 | int i; |
@@ -3348,7 +3365,8 @@ static void __enable_ftrace_function_probe(void) | |||
3348 | if (ftrace_probe_registered) { | 3365 | if (ftrace_probe_registered) { |
3349 | /* still need to update the function call sites */ | 3366 | /* still need to update the function call sites */ |
3350 | if (ftrace_enabled) | 3367 | if (ftrace_enabled) |
3351 | ftrace_run_modify_code(&trace_probe_ops, FTRACE_UPDATE_CALLS); | 3368 | ftrace_run_modify_code(&trace_probe_ops, FTRACE_UPDATE_CALLS, |
3369 | old_hash); | ||
3352 | return; | 3370 | return; |
3353 | } | 3371 | } |
3354 | 3372 | ||
@@ -3477,13 +3495,14 @@ register_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops, | |||
3477 | } while_for_each_ftrace_rec(); | 3495 | } while_for_each_ftrace_rec(); |
3478 | 3496 | ||
3479 | ret = ftrace_hash_move(&trace_probe_ops, 1, orig_hash, hash); | 3497 | ret = ftrace_hash_move(&trace_probe_ops, 1, orig_hash, hash); |
3498 | |||
3499 | __enable_ftrace_function_probe(old_hash); | ||
3500 | |||
3480 | if (!ret) | 3501 | if (!ret) |
3481 | free_ftrace_hash_rcu(old_hash); | 3502 | free_ftrace_hash_rcu(old_hash); |
3482 | else | 3503 | else |
3483 | count = ret; | 3504 | count = ret; |
3484 | 3505 | ||
3485 | __enable_ftrace_function_probe(); | ||
3486 | |||
3487 | out_unlock: | 3506 | out_unlock: |
3488 | mutex_unlock(&ftrace_lock); | 3507 | mutex_unlock(&ftrace_lock); |
3489 | out: | 3508 | out: |
@@ -3764,10 +3783,11 @@ ftrace_match_addr(struct ftrace_hash *hash, unsigned long ip, int remove) | |||
3764 | return add_hash_entry(hash, ip); | 3783 | return add_hash_entry(hash, ip); |
3765 | } | 3784 | } |
3766 | 3785 | ||
3767 | static void ftrace_ops_update_code(struct ftrace_ops *ops) | 3786 | static void ftrace_ops_update_code(struct ftrace_ops *ops, |
3787 | struct ftrace_hash *old_hash) | ||
3768 | { | 3788 | { |
3769 | if (ops->flags & FTRACE_OPS_FL_ENABLED && ftrace_enabled) | 3789 | if (ops->flags & FTRACE_OPS_FL_ENABLED && ftrace_enabled) |
3770 | ftrace_run_modify_code(ops, FTRACE_UPDATE_CALLS); | 3790 | ftrace_run_modify_code(ops, FTRACE_UPDATE_CALLS, old_hash); |
3771 | } | 3791 | } |
3772 | 3792 | ||
3773 | static int | 3793 | static int |
@@ -3813,7 +3833,7 @@ ftrace_set_hash(struct ftrace_ops *ops, unsigned char *buf, int len, | |||
3813 | old_hash = *orig_hash; | 3833 | old_hash = *orig_hash; |
3814 | ret = ftrace_hash_move(ops, enable, orig_hash, hash); | 3834 | ret = ftrace_hash_move(ops, enable, orig_hash, hash); |
3815 | if (!ret) { | 3835 | if (!ret) { |
3816 | ftrace_ops_update_code(ops); | 3836 | ftrace_ops_update_code(ops, old_hash); |
3817 | free_ftrace_hash_rcu(old_hash); | 3837 | free_ftrace_hash_rcu(old_hash); |
3818 | } | 3838 | } |
3819 | mutex_unlock(&ftrace_lock); | 3839 | mutex_unlock(&ftrace_lock); |
@@ -4058,7 +4078,7 @@ int ftrace_regex_release(struct inode *inode, struct file *file) | |||
4058 | ret = ftrace_hash_move(iter->ops, filter_hash, | 4078 | ret = ftrace_hash_move(iter->ops, filter_hash, |
4059 | orig_hash, iter->hash); | 4079 | orig_hash, iter->hash); |
4060 | if (!ret) { | 4080 | if (!ret) { |
4061 | ftrace_ops_update_code(iter->ops); | 4081 | ftrace_ops_update_code(iter->ops, old_hash); |
4062 | free_ftrace_hash_rcu(old_hash); | 4082 | free_ftrace_hash_rcu(old_hash); |
4063 | } | 4083 | } |
4064 | mutex_unlock(&ftrace_lock); | 4084 | mutex_unlock(&ftrace_lock); |
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index 2d75c94ae87d..a56e07c8d15b 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c | |||
@@ -538,16 +538,18 @@ static void rb_wake_up_waiters(struct irq_work *work) | |||
538 | * ring_buffer_wait - wait for input to the ring buffer | 538 | * ring_buffer_wait - wait for input to the ring buffer |
539 | * @buffer: buffer to wait on | 539 | * @buffer: buffer to wait on |
540 | * @cpu: the cpu buffer to wait on | 540 | * @cpu: the cpu buffer to wait on |
541 | * @full: wait until a full page is available, if @cpu != RING_BUFFER_ALL_CPUS | ||
541 | * | 542 | * |
542 | * If @cpu == RING_BUFFER_ALL_CPUS then the task will wake up as soon | 543 | * If @cpu == RING_BUFFER_ALL_CPUS then the task will wake up as soon |
543 | * as data is added to any of the @buffer's cpu buffers. Otherwise | 544 | * as data is added to any of the @buffer's cpu buffers. Otherwise |
544 | * it will wait for data to be added to a specific cpu buffer. | 545 | * it will wait for data to be added to a specific cpu buffer. |
545 | */ | 546 | */ |
546 | int ring_buffer_wait(struct ring_buffer *buffer, int cpu) | 547 | int ring_buffer_wait(struct ring_buffer *buffer, int cpu, bool full) |
547 | { | 548 | { |
548 | struct ring_buffer_per_cpu *cpu_buffer; | 549 | struct ring_buffer_per_cpu *uninitialized_var(cpu_buffer); |
549 | DEFINE_WAIT(wait); | 550 | DEFINE_WAIT(wait); |
550 | struct rb_irq_work *work; | 551 | struct rb_irq_work *work; |
552 | int ret = 0; | ||
551 | 553 | ||
552 | /* | 554 | /* |
553 | * Depending on what the caller is waiting for, either any | 555 | * Depending on what the caller is waiting for, either any |
@@ -564,36 +566,61 @@ int ring_buffer_wait(struct ring_buffer *buffer, int cpu) | |||
564 | } | 566 | } |
565 | 567 | ||
566 | 568 | ||
567 | prepare_to_wait(&work->waiters, &wait, TASK_INTERRUPTIBLE); | 569 | while (true) { |
570 | prepare_to_wait(&work->waiters, &wait, TASK_INTERRUPTIBLE); | ||
568 | 571 | ||
569 | /* | 572 | /* |
570 | * The events can happen in critical sections where | 573 | * The events can happen in critical sections where |
571 | * checking a work queue can cause deadlocks. | 574 | * checking a work queue can cause deadlocks. |
572 | * After adding a task to the queue, this flag is set | 575 | * After adding a task to the queue, this flag is set |
573 | * only to notify events to try to wake up the queue | 576 | * only to notify events to try to wake up the queue |
574 | * using irq_work. | 577 | * using irq_work. |
575 | * | 578 | * |
576 | * We don't clear it even if the buffer is no longer | 579 | * We don't clear it even if the buffer is no longer |
577 | * empty. The flag only causes the next event to run | 580 | * empty. The flag only causes the next event to run |
578 | * irq_work to do the work queue wake up. The worse | 581 | * irq_work to do the work queue wake up. The worse |
579 | * that can happen if we race with !trace_empty() is that | 582 | * that can happen if we race with !trace_empty() is that |
580 | * an event will cause an irq_work to try to wake up | 583 | * an event will cause an irq_work to try to wake up |
581 | * an empty queue. | 584 | * an empty queue. |
582 | * | 585 | * |
583 | * There's no reason to protect this flag either, as | 586 | * There's no reason to protect this flag either, as |
584 | * the work queue and irq_work logic will do the necessary | 587 | * the work queue and irq_work logic will do the necessary |
585 | * synchronization for the wake ups. The only thing | 588 | * synchronization for the wake ups. The only thing |
586 | * that is necessary is that the wake up happens after | 589 | * that is necessary is that the wake up happens after |
587 | * a task has been queued. It's OK for spurious wake ups. | 590 | * a task has been queued. It's OK for spurious wake ups. |
588 | */ | 591 | */ |
589 | work->waiters_pending = true; | 592 | work->waiters_pending = true; |
593 | |||
594 | if (signal_pending(current)) { | ||
595 | ret = -EINTR; | ||
596 | break; | ||
597 | } | ||
598 | |||
599 | if (cpu == RING_BUFFER_ALL_CPUS && !ring_buffer_empty(buffer)) | ||
600 | break; | ||
601 | |||
602 | if (cpu != RING_BUFFER_ALL_CPUS && | ||
603 | !ring_buffer_empty_cpu(buffer, cpu)) { | ||
604 | unsigned long flags; | ||
605 | bool pagebusy; | ||
606 | |||
607 | if (!full) | ||
608 | break; | ||
609 | |||
610 | raw_spin_lock_irqsave(&cpu_buffer->reader_lock, flags); | ||
611 | pagebusy = cpu_buffer->reader_page == cpu_buffer->commit_page; | ||
612 | raw_spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags); | ||
613 | |||
614 | if (!pagebusy) | ||
615 | break; | ||
616 | } | ||
590 | 617 | ||
591 | if ((cpu == RING_BUFFER_ALL_CPUS && ring_buffer_empty(buffer)) || | ||
592 | (cpu != RING_BUFFER_ALL_CPUS && ring_buffer_empty_cpu(buffer, cpu))) | ||
593 | schedule(); | 618 | schedule(); |
619 | } | ||
594 | 620 | ||
595 | finish_wait(&work->waiters, &wait); | 621 | finish_wait(&work->waiters, &wait); |
596 | return 0; | 622 | |
623 | return ret; | ||
597 | } | 624 | } |
598 | 625 | ||
599 | /** | 626 | /** |
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 8a528392b1f4..92f4a6cee172 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -1076,13 +1076,14 @@ update_max_tr_single(struct trace_array *tr, struct task_struct *tsk, int cpu) | |||
1076 | } | 1076 | } |
1077 | #endif /* CONFIG_TRACER_MAX_TRACE */ | 1077 | #endif /* CONFIG_TRACER_MAX_TRACE */ |
1078 | 1078 | ||
1079 | static int wait_on_pipe(struct trace_iterator *iter) | 1079 | static int wait_on_pipe(struct trace_iterator *iter, bool full) |
1080 | { | 1080 | { |
1081 | /* Iterators are static, they should be filled or empty */ | 1081 | /* Iterators are static, they should be filled or empty */ |
1082 | if (trace_buffer_iter(iter, iter->cpu_file)) | 1082 | if (trace_buffer_iter(iter, iter->cpu_file)) |
1083 | return 0; | 1083 | return 0; |
1084 | 1084 | ||
1085 | return ring_buffer_wait(iter->trace_buffer->buffer, iter->cpu_file); | 1085 | return ring_buffer_wait(iter->trace_buffer->buffer, iter->cpu_file, |
1086 | full); | ||
1086 | } | 1087 | } |
1087 | 1088 | ||
1088 | #ifdef CONFIG_FTRACE_STARTUP_TEST | 1089 | #ifdef CONFIG_FTRACE_STARTUP_TEST |
@@ -4434,15 +4435,12 @@ static int tracing_wait_pipe(struct file *filp) | |||
4434 | 4435 | ||
4435 | mutex_unlock(&iter->mutex); | 4436 | mutex_unlock(&iter->mutex); |
4436 | 4437 | ||
4437 | ret = wait_on_pipe(iter); | 4438 | ret = wait_on_pipe(iter, false); |
4438 | 4439 | ||
4439 | mutex_lock(&iter->mutex); | 4440 | mutex_lock(&iter->mutex); |
4440 | 4441 | ||
4441 | if (ret) | 4442 | if (ret) |
4442 | return ret; | 4443 | return ret; |
4443 | |||
4444 | if (signal_pending(current)) | ||
4445 | return -EINTR; | ||
4446 | } | 4444 | } |
4447 | 4445 | ||
4448 | return 1; | 4446 | return 1; |
@@ -5372,16 +5370,12 @@ tracing_buffers_read(struct file *filp, char __user *ubuf, | |||
5372 | goto out_unlock; | 5370 | goto out_unlock; |
5373 | } | 5371 | } |
5374 | mutex_unlock(&trace_types_lock); | 5372 | mutex_unlock(&trace_types_lock); |
5375 | ret = wait_on_pipe(iter); | 5373 | ret = wait_on_pipe(iter, false); |
5376 | mutex_lock(&trace_types_lock); | 5374 | mutex_lock(&trace_types_lock); |
5377 | if (ret) { | 5375 | if (ret) { |
5378 | size = ret; | 5376 | size = ret; |
5379 | goto out_unlock; | 5377 | goto out_unlock; |
5380 | } | 5378 | } |
5381 | if (signal_pending(current)) { | ||
5382 | size = -EINTR; | ||
5383 | goto out_unlock; | ||
5384 | } | ||
5385 | goto again; | 5379 | goto again; |
5386 | } | 5380 | } |
5387 | size = 0; | 5381 | size = 0; |
@@ -5500,7 +5494,7 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos, | |||
5500 | }; | 5494 | }; |
5501 | struct buffer_ref *ref; | 5495 | struct buffer_ref *ref; |
5502 | int entries, size, i; | 5496 | int entries, size, i; |
5503 | ssize_t ret; | 5497 | ssize_t ret = 0; |
5504 | 5498 | ||
5505 | mutex_lock(&trace_types_lock); | 5499 | mutex_lock(&trace_types_lock); |
5506 | 5500 | ||
@@ -5538,13 +5532,16 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos, | |||
5538 | int r; | 5532 | int r; |
5539 | 5533 | ||
5540 | ref = kzalloc(sizeof(*ref), GFP_KERNEL); | 5534 | ref = kzalloc(sizeof(*ref), GFP_KERNEL); |
5541 | if (!ref) | 5535 | if (!ref) { |
5536 | ret = -ENOMEM; | ||
5542 | break; | 5537 | break; |
5538 | } | ||
5543 | 5539 | ||
5544 | ref->ref = 1; | 5540 | ref->ref = 1; |
5545 | ref->buffer = iter->trace_buffer->buffer; | 5541 | ref->buffer = iter->trace_buffer->buffer; |
5546 | ref->page = ring_buffer_alloc_read_page(ref->buffer, iter->cpu_file); | 5542 | ref->page = ring_buffer_alloc_read_page(ref->buffer, iter->cpu_file); |
5547 | if (!ref->page) { | 5543 | if (!ref->page) { |
5544 | ret = -ENOMEM; | ||
5548 | kfree(ref); | 5545 | kfree(ref); |
5549 | break; | 5546 | break; |
5550 | } | 5547 | } |
@@ -5582,19 +5579,19 @@ tracing_buffers_splice_read(struct file *file, loff_t *ppos, | |||
5582 | 5579 | ||
5583 | /* did we read anything? */ | 5580 | /* did we read anything? */ |
5584 | if (!spd.nr_pages) { | 5581 | if (!spd.nr_pages) { |
5582 | if (ret) | ||
5583 | goto out; | ||
5584 | |||
5585 | if ((file->f_flags & O_NONBLOCK) || (flags & SPLICE_F_NONBLOCK)) { | 5585 | if ((file->f_flags & O_NONBLOCK) || (flags & SPLICE_F_NONBLOCK)) { |
5586 | ret = -EAGAIN; | 5586 | ret = -EAGAIN; |
5587 | goto out; | 5587 | goto out; |
5588 | } | 5588 | } |
5589 | mutex_unlock(&trace_types_lock); | 5589 | mutex_unlock(&trace_types_lock); |
5590 | ret = wait_on_pipe(iter); | 5590 | ret = wait_on_pipe(iter, true); |
5591 | mutex_lock(&trace_types_lock); | 5591 | mutex_lock(&trace_types_lock); |
5592 | if (ret) | 5592 | if (ret) |
5593 | goto out; | 5593 | goto out; |
5594 | if (signal_pending(current)) { | 5594 | |
5595 | ret = -EINTR; | ||
5596 | goto out; | ||
5597 | } | ||
5598 | goto again; | 5595 | goto again; |
5599 | } | 5596 | } |
5600 | 5597 | ||
diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c index 4dc8b79c5f75..29228c4d5696 100644 --- a/kernel/trace/trace_syscalls.c +++ b/kernel/trace/trace_syscalls.c | |||
@@ -313,7 +313,7 @@ static void ftrace_syscall_enter(void *data, struct pt_regs *regs, long id) | |||
313 | int size; | 313 | int size; |
314 | 314 | ||
315 | syscall_nr = trace_get_syscall_nr(current, regs); | 315 | syscall_nr = trace_get_syscall_nr(current, regs); |
316 | if (syscall_nr < 0) | 316 | if (syscall_nr < 0 || syscall_nr >= NR_syscalls) |
317 | return; | 317 | return; |
318 | 318 | ||
319 | /* Here we're inside tp handler's rcu_read_lock_sched (__DO_TRACE) */ | 319 | /* Here we're inside tp handler's rcu_read_lock_sched (__DO_TRACE) */ |
@@ -360,7 +360,7 @@ static void ftrace_syscall_exit(void *data, struct pt_regs *regs, long ret) | |||
360 | int syscall_nr; | 360 | int syscall_nr; |
361 | 361 | ||
362 | syscall_nr = trace_get_syscall_nr(current, regs); | 362 | syscall_nr = trace_get_syscall_nr(current, regs); |
363 | if (syscall_nr < 0) | 363 | if (syscall_nr < 0 || syscall_nr >= NR_syscalls) |
364 | return; | 364 | return; |
365 | 365 | ||
366 | /* Here we're inside tp handler's rcu_read_lock_sched (__DO_TRACE()) */ | 366 | /* Here we're inside tp handler's rcu_read_lock_sched (__DO_TRACE()) */ |
@@ -567,7 +567,7 @@ static void perf_syscall_enter(void *ignore, struct pt_regs *regs, long id) | |||
567 | int size; | 567 | int size; |
568 | 568 | ||
569 | syscall_nr = trace_get_syscall_nr(current, regs); | 569 | syscall_nr = trace_get_syscall_nr(current, regs); |
570 | if (syscall_nr < 0) | 570 | if (syscall_nr < 0 || syscall_nr >= NR_syscalls) |
571 | return; | 571 | return; |
572 | if (!test_bit(syscall_nr, enabled_perf_enter_syscalls)) | 572 | if (!test_bit(syscall_nr, enabled_perf_enter_syscalls)) |
573 | return; | 573 | return; |
@@ -641,7 +641,7 @@ static void perf_syscall_exit(void *ignore, struct pt_regs *regs, long ret) | |||
641 | int size; | 641 | int size; |
642 | 642 | ||
643 | syscall_nr = trace_get_syscall_nr(current, regs); | 643 | syscall_nr = trace_get_syscall_nr(current, regs); |
644 | if (syscall_nr < 0) | 644 | if (syscall_nr < 0 || syscall_nr >= NR_syscalls) |
645 | return; | 645 | return; |
646 | if (!test_bit(syscall_nr, enabled_perf_exit_syscalls)) | 646 | if (!test_bit(syscall_nr, enabled_perf_exit_syscalls)) |
647 | return; | 647 | return; |
diff --git a/lib/bitmap.c b/lib/bitmap.c index cd250a2e14cb..b499ab6ada29 100644 --- a/lib/bitmap.c +++ b/lib/bitmap.c | |||
@@ -131,7 +131,9 @@ void __bitmap_shift_right(unsigned long *dst, | |||
131 | lower = src[off + k]; | 131 | lower = src[off + k]; |
132 | if (left && off + k == lim - 1) | 132 | if (left && off + k == lim - 1) |
133 | lower &= mask; | 133 | lower &= mask; |
134 | dst[k] = upper << (BITS_PER_LONG - rem) | lower >> rem; | 134 | dst[k] = lower >> rem; |
135 | if (rem) | ||
136 | dst[k] |= upper << (BITS_PER_LONG - rem); | ||
135 | if (left && k == lim - 1) | 137 | if (left && k == lim - 1) |
136 | dst[k] &= mask; | 138 | dst[k] &= mask; |
137 | } | 139 | } |
@@ -172,7 +174,9 @@ void __bitmap_shift_left(unsigned long *dst, | |||
172 | upper = src[k]; | 174 | upper = src[k]; |
173 | if (left && k == lim - 1) | 175 | if (left && k == lim - 1) |
174 | upper &= (1UL << left) - 1; | 176 | upper &= (1UL << left) - 1; |
175 | dst[k + off] = lower >> (BITS_PER_LONG - rem) | upper << rem; | 177 | dst[k + off] = upper << rem; |
178 | if (rem) | ||
179 | dst[k + off] |= lower >> (BITS_PER_LONG - rem); | ||
176 | if (left && k + off == lim - 1) | 180 | if (left && k + off == lim - 1) |
177 | dst[k + off] &= (1UL << left) - 1; | 181 | dst[k + off] &= (1UL << left) - 1; |
178 | } | 182 | } |
diff --git a/lib/rhashtable.c b/lib/rhashtable.c index 081be3ba9ea8..624a0b7c05ef 100644 --- a/lib/rhashtable.c +++ b/lib/rhashtable.c | |||
@@ -230,7 +230,7 @@ int rhashtable_expand(struct rhashtable *ht, gfp_t flags) | |||
230 | ht->shift++; | 230 | ht->shift++; |
231 | 231 | ||
232 | /* For each new bucket, search the corresponding old bucket | 232 | /* For each new bucket, search the corresponding old bucket |
233 | * for the first entry that hashes to the new bucket, and | 233 | * for the first entry that hashes to the new bucket, and |
234 | * link the new bucket to that entry. Since all the entries | 234 | * link the new bucket to that entry. Since all the entries |
235 | * which will end up in the new bucket appear in the same | 235 | * which will end up in the new bucket appear in the same |
236 | * old bucket, this constructs an entirely valid new hash | 236 | * old bucket, this constructs an entirely valid new hash |
@@ -248,8 +248,8 @@ int rhashtable_expand(struct rhashtable *ht, gfp_t flags) | |||
248 | } | 248 | } |
249 | 249 | ||
250 | /* Publish the new table pointer. Lookups may now traverse | 250 | /* Publish the new table pointer. Lookups may now traverse |
251 | * the new table, but they will not benefit from any | 251 | * the new table, but they will not benefit from any |
252 | * additional efficiency until later steps unzip the buckets. | 252 | * additional efficiency until later steps unzip the buckets. |
253 | */ | 253 | */ |
254 | rcu_assign_pointer(ht->tbl, new_tbl); | 254 | rcu_assign_pointer(ht->tbl, new_tbl); |
255 | 255 | ||
@@ -306,14 +306,14 @@ int rhashtable_shrink(struct rhashtable *ht, gfp_t flags) | |||
306 | 306 | ||
307 | ht->shift--; | 307 | ht->shift--; |
308 | 308 | ||
309 | /* Link each bucket in the new table to the first bucket | 309 | /* Link each bucket in the new table to the first bucket |
310 | * in the old table that contains entries which will hash | 310 | * in the old table that contains entries which will hash |
311 | * to the new bucket. | 311 | * to the new bucket. |
312 | */ | 312 | */ |
313 | for (i = 0; i < ntbl->size; i++) { | 313 | for (i = 0; i < ntbl->size; i++) { |
314 | ntbl->buckets[i] = tbl->buckets[i]; | 314 | ntbl->buckets[i] = tbl->buckets[i]; |
315 | 315 | ||
316 | /* Link each bucket in the new table to the first bucket | 316 | /* Link each bucket in the new table to the first bucket |
317 | * in the old table that contains entries which will hash | 317 | * in the old table that contains entries which will hash |
318 | * to the new bucket. | 318 | * to the new bucket. |
319 | */ | 319 | */ |
diff --git a/lib/scatterlist.c b/lib/scatterlist.c index 9cdf62f8accd..c9f2e8c6ccc9 100644 --- a/lib/scatterlist.c +++ b/lib/scatterlist.c | |||
@@ -203,10 +203,10 @@ void __sg_free_table(struct sg_table *table, unsigned int max_ents, | |||
203 | } | 203 | } |
204 | 204 | ||
205 | table->orig_nents -= sg_size; | 205 | table->orig_nents -= sg_size; |
206 | if (!skip_first_chunk) { | 206 | if (skip_first_chunk) |
207 | free_fn(sgl, alloc_size); | ||
208 | skip_first_chunk = false; | 207 | skip_first_chunk = false; |
209 | } | 208 | else |
209 | free_fn(sgl, alloc_size); | ||
210 | sgl = next; | 210 | sgl = next; |
211 | } | 211 | } |
212 | 212 | ||
diff --git a/mm/balloon_compaction.c b/mm/balloon_compaction.c index b3cbe19f71b5..fcad8322ef36 100644 --- a/mm/balloon_compaction.c +++ b/mm/balloon_compaction.c | |||
@@ -68,11 +68,13 @@ struct page *balloon_page_dequeue(struct balloon_dev_info *b_dev_info) | |||
68 | * to be released by the balloon driver. | 68 | * to be released by the balloon driver. |
69 | */ | 69 | */ |
70 | if (trylock_page(page)) { | 70 | if (trylock_page(page)) { |
71 | #ifdef CONFIG_BALLOON_COMPACTION | ||
71 | if (!PagePrivate(page)) { | 72 | if (!PagePrivate(page)) { |
72 | /* raced with isolation */ | 73 | /* raced with isolation */ |
73 | unlock_page(page); | 74 | unlock_page(page); |
74 | continue; | 75 | continue; |
75 | } | 76 | } |
77 | #endif | ||
76 | spin_lock_irqsave(&b_dev_info->pages_lock, flags); | 78 | spin_lock_irqsave(&b_dev_info->pages_lock, flags); |
77 | balloon_page_delete(page); | 79 | balloon_page_delete(page); |
78 | __count_vm_event(BALLOON_DEFLATE); | 80 | __count_vm_event(BALLOON_DEFLATE); |
diff --git a/mm/bootmem.c b/mm/bootmem.c index 8a000cebb0d7..477be696511d 100644 --- a/mm/bootmem.c +++ b/mm/bootmem.c | |||
@@ -243,13 +243,10 @@ static unsigned long __init free_all_bootmem_core(bootmem_data_t *bdata) | |||
243 | 243 | ||
244 | static int reset_managed_pages_done __initdata; | 244 | static int reset_managed_pages_done __initdata; |
245 | 245 | ||
246 | static inline void __init reset_node_managed_pages(pg_data_t *pgdat) | 246 | void reset_node_managed_pages(pg_data_t *pgdat) |
247 | { | 247 | { |
248 | struct zone *z; | 248 | struct zone *z; |
249 | 249 | ||
250 | if (reset_managed_pages_done) | ||
251 | return; | ||
252 | |||
253 | for (z = pgdat->node_zones; z < pgdat->node_zones + MAX_NR_ZONES; z++) | 250 | for (z = pgdat->node_zones; z < pgdat->node_zones + MAX_NR_ZONES; z++) |
254 | z->managed_pages = 0; | 251 | z->managed_pages = 0; |
255 | } | 252 | } |
@@ -258,8 +255,12 @@ void __init reset_all_zones_managed_pages(void) | |||
258 | { | 255 | { |
259 | struct pglist_data *pgdat; | 256 | struct pglist_data *pgdat; |
260 | 257 | ||
258 | if (reset_managed_pages_done) | ||
259 | return; | ||
260 | |||
261 | for_each_online_pgdat(pgdat) | 261 | for_each_online_pgdat(pgdat) |
262 | reset_node_managed_pages(pgdat); | 262 | reset_node_managed_pages(pgdat); |
263 | |||
263 | reset_managed_pages_done = 1; | 264 | reset_managed_pages_done = 1; |
264 | } | 265 | } |
265 | 266 | ||
@@ -124,6 +124,7 @@ static int __init cma_activate_area(struct cma *cma) | |||
124 | 124 | ||
125 | err: | 125 | err: |
126 | kfree(cma->bitmap); | 126 | kfree(cma->bitmap); |
127 | cma->count = 0; | ||
127 | return -EINVAL; | 128 | return -EINVAL; |
128 | } | 129 | } |
129 | 130 | ||
@@ -217,9 +218,8 @@ int __init cma_declare_contiguous(phys_addr_t base, | |||
217 | phys_addr_t highmem_start = __pa(high_memory); | 218 | phys_addr_t highmem_start = __pa(high_memory); |
218 | int ret = 0; | 219 | int ret = 0; |
219 | 220 | ||
220 | pr_debug("%s(size %lx, base %08lx, limit %08lx alignment %08lx)\n", | 221 | pr_debug("%s(size %pa, base %pa, limit %pa alignment %pa)\n", |
221 | __func__, (unsigned long)size, (unsigned long)base, | 222 | __func__, &size, &base, &limit, &alignment); |
222 | (unsigned long)limit, (unsigned long)alignment); | ||
223 | 223 | ||
224 | if (cma_area_count == ARRAY_SIZE(cma_areas)) { | 224 | if (cma_area_count == ARRAY_SIZE(cma_areas)) { |
225 | pr_err("Not enough slots for CMA reserved regions!\n"); | 225 | pr_err("Not enough slots for CMA reserved regions!\n"); |
@@ -244,52 +244,72 @@ int __init cma_declare_contiguous(phys_addr_t base, | |||
244 | size = ALIGN(size, alignment); | 244 | size = ALIGN(size, alignment); |
245 | limit &= ~(alignment - 1); | 245 | limit &= ~(alignment - 1); |
246 | 246 | ||
247 | if (!base) | ||
248 | fixed = false; | ||
249 | |||
247 | /* size should be aligned with order_per_bit */ | 250 | /* size should be aligned with order_per_bit */ |
248 | if (!IS_ALIGNED(size >> PAGE_SHIFT, 1 << order_per_bit)) | 251 | if (!IS_ALIGNED(size >> PAGE_SHIFT, 1 << order_per_bit)) |
249 | return -EINVAL; | 252 | return -EINVAL; |
250 | 253 | ||
251 | /* | 254 | /* |
252 | * adjust limit to avoid crossing low/high memory boundary for | 255 | * If allocating at a fixed base the request region must not cross the |
253 | * automatically allocated regions | 256 | * low/high memory boundary. |
254 | */ | 257 | */ |
255 | if (((limit == 0 || limit > memblock_end) && | 258 | if (fixed && base < highmem_start && base + size > highmem_start) { |
256 | (memblock_end - size < highmem_start && | ||
257 | memblock_end > highmem_start)) || | ||
258 | (!fixed && limit > highmem_start && limit - size < highmem_start)) { | ||
259 | limit = highmem_start; | ||
260 | } | ||
261 | |||
262 | if (fixed && base < highmem_start && base+size > highmem_start) { | ||
263 | ret = -EINVAL; | 259 | ret = -EINVAL; |
264 | pr_err("Region at %08lx defined on low/high memory boundary (%08lx)\n", | 260 | pr_err("Region at %pa defined on low/high memory boundary (%pa)\n", |
265 | (unsigned long)base, (unsigned long)highmem_start); | 261 | &base, &highmem_start); |
266 | goto err; | 262 | goto err; |
267 | } | 263 | } |
268 | 264 | ||
265 | /* | ||
266 | * If the limit is unspecified or above the memblock end, its effective | ||
267 | * value will be the memblock end. Set it explicitly to simplify further | ||
268 | * checks. | ||
269 | */ | ||
270 | if (limit == 0 || limit > memblock_end) | ||
271 | limit = memblock_end; | ||
272 | |||
269 | /* Reserve memory */ | 273 | /* Reserve memory */ |
270 | if (base && fixed) { | 274 | if (fixed) { |
271 | if (memblock_is_region_reserved(base, size) || | 275 | if (memblock_is_region_reserved(base, size) || |
272 | memblock_reserve(base, size) < 0) { | 276 | memblock_reserve(base, size) < 0) { |
273 | ret = -EBUSY; | 277 | ret = -EBUSY; |
274 | goto err; | 278 | goto err; |
275 | } | 279 | } |
276 | } else { | 280 | } else { |
277 | phys_addr_t addr = memblock_alloc_range(size, alignment, base, | 281 | phys_addr_t addr = 0; |
278 | limit); | 282 | |
283 | /* | ||
284 | * All pages in the reserved area must come from the same zone. | ||
285 | * If the requested region crosses the low/high memory boundary, | ||
286 | * try allocating from high memory first and fall back to low | ||
287 | * memory in case of failure. | ||
288 | */ | ||
289 | if (base < highmem_start && limit > highmem_start) { | ||
290 | addr = memblock_alloc_range(size, alignment, | ||
291 | highmem_start, limit); | ||
292 | limit = highmem_start; | ||
293 | } | ||
294 | |||
279 | if (!addr) { | 295 | if (!addr) { |
280 | ret = -ENOMEM; | 296 | addr = memblock_alloc_range(size, alignment, base, |
281 | goto err; | 297 | limit); |
282 | } else { | 298 | if (!addr) { |
283 | base = addr; | 299 | ret = -ENOMEM; |
300 | goto err; | ||
301 | } | ||
284 | } | 302 | } |
303 | |||
304 | base = addr; | ||
285 | } | 305 | } |
286 | 306 | ||
287 | ret = cma_init_reserved_mem(base, size, order_per_bit, res_cma); | 307 | ret = cma_init_reserved_mem(base, size, order_per_bit, res_cma); |
288 | if (ret) | 308 | if (ret) |
289 | goto err; | 309 | goto err; |
290 | 310 | ||
291 | pr_info("Reserved %ld MiB at %08lx\n", (unsigned long)size / SZ_1M, | 311 | pr_info("Reserved %ld MiB at %pa\n", (unsigned long)size / SZ_1M, |
292 | (unsigned long)base); | 312 | &base); |
293 | return 0; | 313 | return 0; |
294 | 314 | ||
295 | err: | 315 | err: |
diff --git a/mm/compaction.c b/mm/compaction.c index edba18aed173..f9792ba3537c 100644 --- a/mm/compaction.c +++ b/mm/compaction.c | |||
@@ -479,6 +479,16 @@ isolate_freepages_range(struct compact_control *cc, | |||
479 | 479 | ||
480 | block_end_pfn = min(block_end_pfn, end_pfn); | 480 | block_end_pfn = min(block_end_pfn, end_pfn); |
481 | 481 | ||
482 | /* | ||
483 | * pfn could pass the block_end_pfn if isolated freepage | ||
484 | * is more than pageblock order. In this case, we adjust | ||
485 | * scanning range to right one. | ||
486 | */ | ||
487 | if (pfn >= block_end_pfn) { | ||
488 | block_end_pfn = ALIGN(pfn + 1, pageblock_nr_pages); | ||
489 | block_end_pfn = min(block_end_pfn, end_pfn); | ||
490 | } | ||
491 | |||
482 | if (!pageblock_pfn_to_page(pfn, block_end_pfn, cc->zone)) | 492 | if (!pageblock_pfn_to_page(pfn, block_end_pfn, cc->zone)) |
483 | break; | 493 | break; |
484 | 494 | ||
@@ -784,6 +794,9 @@ isolate_migratepages_range(struct compact_control *cc, unsigned long start_pfn, | |||
784 | cc->nr_migratepages = 0; | 794 | cc->nr_migratepages = 0; |
785 | break; | 795 | break; |
786 | } | 796 | } |
797 | |||
798 | if (cc->nr_migratepages == COMPACT_CLUSTER_MAX) | ||
799 | break; | ||
787 | } | 800 | } |
788 | acct_isolated(cc->zone, cc); | 801 | acct_isolated(cc->zone, cc); |
789 | 802 | ||
@@ -1026,8 +1039,12 @@ static isolate_migrate_t isolate_migratepages(struct zone *zone, | |||
1026 | } | 1039 | } |
1027 | 1040 | ||
1028 | acct_isolated(zone, cc); | 1041 | acct_isolated(zone, cc); |
1029 | /* Record where migration scanner will be restarted */ | 1042 | /* |
1030 | cc->migrate_pfn = low_pfn; | 1043 | * Record where migration scanner will be restarted. If we end up in |
1044 | * the same pageblock as the free scanner, make the scanners fully | ||
1045 | * meet so that compact_finished() terminates compaction. | ||
1046 | */ | ||
1047 | cc->migrate_pfn = (end_pfn <= cc->free_pfn) ? low_pfn : cc->free_pfn; | ||
1031 | 1048 | ||
1032 | return cc->nr_migratepages ? ISOLATE_SUCCESS : ISOLATE_NONE; | 1049 | return cc->nr_migratepages ? ISOLATE_SUCCESS : ISOLATE_NONE; |
1033 | } | 1050 | } |
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 74c78aa8bc2f..de984159cf0b 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c | |||
@@ -200,7 +200,7 @@ retry: | |||
200 | preempt_disable(); | 200 | preempt_disable(); |
201 | if (cmpxchg(&huge_zero_page, NULL, zero_page)) { | 201 | if (cmpxchg(&huge_zero_page, NULL, zero_page)) { |
202 | preempt_enable(); | 202 | preempt_enable(); |
203 | __free_page(zero_page); | 203 | __free_pages(zero_page, compound_order(zero_page)); |
204 | goto retry; | 204 | goto retry; |
205 | } | 205 | } |
206 | 206 | ||
@@ -232,7 +232,7 @@ static unsigned long shrink_huge_zero_page_scan(struct shrinker *shrink, | |||
232 | if (atomic_cmpxchg(&huge_zero_refcount, 1, 0) == 1) { | 232 | if (atomic_cmpxchg(&huge_zero_refcount, 1, 0) == 1) { |
233 | struct page *zero_page = xchg(&huge_zero_page, NULL); | 233 | struct page *zero_page = xchg(&huge_zero_page, NULL); |
234 | BUG_ON(zero_page == NULL); | 234 | BUG_ON(zero_page == NULL); |
235 | __free_page(zero_page); | 235 | __free_pages(zero_page, compound_order(zero_page)); |
236 | return HPAGE_PMD_NR; | 236 | return HPAGE_PMD_NR; |
237 | } | 237 | } |
238 | 238 | ||
@@ -803,7 +803,7 @@ int do_huge_pmd_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
803 | return VM_FAULT_FALLBACK; | 803 | return VM_FAULT_FALLBACK; |
804 | if (unlikely(anon_vma_prepare(vma))) | 804 | if (unlikely(anon_vma_prepare(vma))) |
805 | return VM_FAULT_OOM; | 805 | return VM_FAULT_OOM; |
806 | if (unlikely(khugepaged_enter(vma))) | 806 | if (unlikely(khugepaged_enter(vma, vma->vm_flags))) |
807 | return VM_FAULT_OOM; | 807 | return VM_FAULT_OOM; |
808 | if (!(flags & FAULT_FLAG_WRITE) && | 808 | if (!(flags & FAULT_FLAG_WRITE) && |
809 | transparent_hugepage_use_zero_page()) { | 809 | transparent_hugepage_use_zero_page()) { |
@@ -1970,7 +1970,7 @@ int hugepage_madvise(struct vm_area_struct *vma, | |||
1970 | * register it here without waiting a page fault that | 1970 | * register it here without waiting a page fault that |
1971 | * may not happen any time soon. | 1971 | * may not happen any time soon. |
1972 | */ | 1972 | */ |
1973 | if (unlikely(khugepaged_enter_vma_merge(vma))) | 1973 | if (unlikely(khugepaged_enter_vma_merge(vma, *vm_flags))) |
1974 | return -ENOMEM; | 1974 | return -ENOMEM; |
1975 | break; | 1975 | break; |
1976 | case MADV_NOHUGEPAGE: | 1976 | case MADV_NOHUGEPAGE: |
@@ -2071,7 +2071,8 @@ int __khugepaged_enter(struct mm_struct *mm) | |||
2071 | return 0; | 2071 | return 0; |
2072 | } | 2072 | } |
2073 | 2073 | ||
2074 | int khugepaged_enter_vma_merge(struct vm_area_struct *vma) | 2074 | int khugepaged_enter_vma_merge(struct vm_area_struct *vma, |
2075 | unsigned long vm_flags) | ||
2075 | { | 2076 | { |
2076 | unsigned long hstart, hend; | 2077 | unsigned long hstart, hend; |
2077 | if (!vma->anon_vma) | 2078 | if (!vma->anon_vma) |
@@ -2083,11 +2084,11 @@ int khugepaged_enter_vma_merge(struct vm_area_struct *vma) | |||
2083 | if (vma->vm_ops) | 2084 | if (vma->vm_ops) |
2084 | /* khugepaged not yet working on file or special mappings */ | 2085 | /* khugepaged not yet working on file or special mappings */ |
2085 | return 0; | 2086 | return 0; |
2086 | VM_BUG_ON_VMA(vma->vm_flags & VM_NO_THP, vma); | 2087 | VM_BUG_ON_VMA(vm_flags & VM_NO_THP, vma); |
2087 | hstart = (vma->vm_start + ~HPAGE_PMD_MASK) & HPAGE_PMD_MASK; | 2088 | hstart = (vma->vm_start + ~HPAGE_PMD_MASK) & HPAGE_PMD_MASK; |
2088 | hend = vma->vm_end & HPAGE_PMD_MASK; | 2089 | hend = vma->vm_end & HPAGE_PMD_MASK; |
2089 | if (hstart < hend) | 2090 | if (hstart < hend) |
2090 | return khugepaged_enter(vma); | 2091 | return khugepaged_enter(vma, vm_flags); |
2091 | return 0; | 2092 | return 0; |
2092 | } | 2093 | } |
2093 | 2094 | ||
diff --git a/mm/internal.h b/mm/internal.h index 829304090b90..a4f90ba7068e 100644 --- a/mm/internal.h +++ b/mm/internal.h | |||
@@ -108,6 +108,31 @@ extern pmd_t *mm_find_pmd(struct mm_struct *mm, unsigned long address); | |||
108 | /* | 108 | /* |
109 | * in mm/page_alloc.c | 109 | * in mm/page_alloc.c |
110 | */ | 110 | */ |
111 | |||
112 | /* | ||
113 | * Locate the struct page for both the matching buddy in our | ||
114 | * pair (buddy1) and the combined O(n+1) page they form (page). | ||
115 | * | ||
116 | * 1) Any buddy B1 will have an order O twin B2 which satisfies | ||
117 | * the following equation: | ||
118 | * B2 = B1 ^ (1 << O) | ||
119 | * For example, if the starting buddy (buddy2) is #8 its order | ||
120 | * 1 buddy is #10: | ||
121 | * B2 = 8 ^ (1 << 1) = 8 ^ 2 = 10 | ||
122 | * | ||
123 | * 2) Any buddy B will have an order O+1 parent P which | ||
124 | * satisfies the following equation: | ||
125 | * P = B & ~(1 << O) | ||
126 | * | ||
127 | * Assumption: *_mem_map is contiguous at least up to MAX_ORDER | ||
128 | */ | ||
129 | static inline unsigned long | ||
130 | __find_buddy_index(unsigned long page_idx, unsigned int order) | ||
131 | { | ||
132 | return page_idx ^ (1 << order); | ||
133 | } | ||
134 | |||
135 | extern int __isolate_free_page(struct page *page, unsigned int order); | ||
111 | extern void __free_pages_bootmem(struct page *page, unsigned int order); | 136 | extern void __free_pages_bootmem(struct page *page, unsigned int order); |
112 | extern void prep_compound_page(struct page *page, unsigned long order); | 137 | extern void prep_compound_page(struct page *page, unsigned long order); |
113 | #ifdef CONFIG_MEMORY_FAILURE | 138 | #ifdef CONFIG_MEMORY_FAILURE |
diff --git a/mm/iov_iter.c b/mm/iov_iter.c index eafcf60f6b83..e34a3cb6aad6 100644 --- a/mm/iov_iter.c +++ b/mm/iov_iter.c | |||
@@ -911,9 +911,9 @@ size_t iov_iter_single_seg_count(const struct iov_iter *i) | |||
911 | if (i->nr_segs == 1) | 911 | if (i->nr_segs == 1) |
912 | return i->count; | 912 | return i->count; |
913 | else if (i->type & ITER_BVEC) | 913 | else if (i->type & ITER_BVEC) |
914 | return min(i->count, i->iov->iov_len - i->iov_offset); | ||
915 | else | ||
916 | return min(i->count, i->bvec->bv_len - i->iov_offset); | 914 | return min(i->count, i->bvec->bv_len - i->iov_offset); |
915 | else | ||
916 | return min(i->count, i->iov->iov_len - i->iov_offset); | ||
917 | } | 917 | } |
918 | EXPORT_SYMBOL(iov_iter_single_seg_count); | 918 | EXPORT_SYMBOL(iov_iter_single_seg_count); |
919 | 919 | ||
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 23976fd885fd..d6ac0e33e150 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -1536,12 +1536,8 @@ int mem_cgroup_swappiness(struct mem_cgroup *memcg) | |||
1536 | * start move here. | 1536 | * start move here. |
1537 | */ | 1537 | */ |
1538 | 1538 | ||
1539 | /* for quick checking without looking up memcg */ | ||
1540 | atomic_t memcg_moving __read_mostly; | ||
1541 | |||
1542 | static void mem_cgroup_start_move(struct mem_cgroup *memcg) | 1539 | static void mem_cgroup_start_move(struct mem_cgroup *memcg) |
1543 | { | 1540 | { |
1544 | atomic_inc(&memcg_moving); | ||
1545 | atomic_inc(&memcg->moving_account); | 1541 | atomic_inc(&memcg->moving_account); |
1546 | synchronize_rcu(); | 1542 | synchronize_rcu(); |
1547 | } | 1543 | } |
@@ -1552,10 +1548,8 @@ static void mem_cgroup_end_move(struct mem_cgroup *memcg) | |||
1552 | * Now, mem_cgroup_clear_mc() may call this function with NULL. | 1548 | * Now, mem_cgroup_clear_mc() may call this function with NULL. |
1553 | * We check NULL in callee rather than caller. | 1549 | * We check NULL in callee rather than caller. |
1554 | */ | 1550 | */ |
1555 | if (memcg) { | 1551 | if (memcg) |
1556 | atomic_dec(&memcg_moving); | ||
1557 | atomic_dec(&memcg->moving_account); | 1552 | atomic_dec(&memcg->moving_account); |
1558 | } | ||
1559 | } | 1553 | } |
1560 | 1554 | ||
1561 | /* | 1555 | /* |
@@ -2204,41 +2198,52 @@ cleanup: | |||
2204 | return true; | 2198 | return true; |
2205 | } | 2199 | } |
2206 | 2200 | ||
2207 | /* | 2201 | /** |
2208 | * Used to update mapped file or writeback or other statistics. | 2202 | * mem_cgroup_begin_page_stat - begin a page state statistics transaction |
2203 | * @page: page that is going to change accounted state | ||
2204 | * @locked: &memcg->move_lock slowpath was taken | ||
2205 | * @flags: IRQ-state flags for &memcg->move_lock | ||
2209 | * | 2206 | * |
2210 | * Notes: Race condition | 2207 | * This function must mark the beginning of an accounted page state |
2208 | * change to prevent double accounting when the page is concurrently | ||
2209 | * being moved to another memcg: | ||
2211 | * | 2210 | * |
2212 | * Charging occurs during page instantiation, while the page is | 2211 | * memcg = mem_cgroup_begin_page_stat(page, &locked, &flags); |
2213 | * unmapped and locked in page migration, or while the page table is | 2212 | * if (TestClearPageState(page)) |
2214 | * locked in THP migration. No race is possible. | 2213 | * mem_cgroup_update_page_stat(memcg, state, -1); |
2214 | * mem_cgroup_end_page_stat(memcg, locked, flags); | ||
2215 | * | 2215 | * |
2216 | * Uncharge happens to pages with zero references, no race possible. | 2216 | * The RCU lock is held throughout the transaction. The fast path can |
2217 | * get away without acquiring the memcg->move_lock (@locked is false) | ||
2218 | * because page moving starts with an RCU grace period. | ||
2217 | * | 2219 | * |
2218 | * Charge moving between groups is protected by checking mm->moving | 2220 | * The RCU lock also protects the memcg from being freed when the page |
2219 | * account and taking the move_lock in the slowpath. | 2221 | * state that is going to change is the only thing preventing the page |
2222 | * from being uncharged. E.g. end-writeback clearing PageWriteback(), | ||
2223 | * which allows migration to go ahead and uncharge the page before the | ||
2224 | * account transaction might be complete. | ||
2220 | */ | 2225 | */ |
2221 | 2226 | struct mem_cgroup *mem_cgroup_begin_page_stat(struct page *page, | |
2222 | void __mem_cgroup_begin_update_page_stat(struct page *page, | 2227 | bool *locked, |
2223 | bool *locked, unsigned long *flags) | 2228 | unsigned long *flags) |
2224 | { | 2229 | { |
2225 | struct mem_cgroup *memcg; | 2230 | struct mem_cgroup *memcg; |
2226 | struct page_cgroup *pc; | 2231 | struct page_cgroup *pc; |
2227 | 2232 | ||
2233 | rcu_read_lock(); | ||
2234 | |||
2235 | if (mem_cgroup_disabled()) | ||
2236 | return NULL; | ||
2237 | |||
2228 | pc = lookup_page_cgroup(page); | 2238 | pc = lookup_page_cgroup(page); |
2229 | again: | 2239 | again: |
2230 | memcg = pc->mem_cgroup; | 2240 | memcg = pc->mem_cgroup; |
2231 | if (unlikely(!memcg || !PageCgroupUsed(pc))) | 2241 | if (unlikely(!memcg || !PageCgroupUsed(pc))) |
2232 | return; | 2242 | return NULL; |
2233 | /* | 2243 | |
2234 | * If this memory cgroup is not under account moving, we don't | 2244 | *locked = false; |
2235 | * need to take move_lock_mem_cgroup(). Because we already hold | ||
2236 | * rcu_read_lock(), any calls to move_account will be delayed until | ||
2237 | * rcu_read_unlock(). | ||
2238 | */ | ||
2239 | VM_BUG_ON(!rcu_read_lock_held()); | ||
2240 | if (atomic_read(&memcg->moving_account) <= 0) | 2245 | if (atomic_read(&memcg->moving_account) <= 0) |
2241 | return; | 2246 | return memcg; |
2242 | 2247 | ||
2243 | move_lock_mem_cgroup(memcg, flags); | 2248 | move_lock_mem_cgroup(memcg, flags); |
2244 | if (memcg != pc->mem_cgroup || !PageCgroupUsed(pc)) { | 2249 | if (memcg != pc->mem_cgroup || !PageCgroupUsed(pc)) { |
@@ -2246,36 +2251,40 @@ again: | |||
2246 | goto again; | 2251 | goto again; |
2247 | } | 2252 | } |
2248 | *locked = true; | 2253 | *locked = true; |
2254 | |||
2255 | return memcg; | ||
2249 | } | 2256 | } |
2250 | 2257 | ||
2251 | void __mem_cgroup_end_update_page_stat(struct page *page, unsigned long *flags) | 2258 | /** |
2259 | * mem_cgroup_end_page_stat - finish a page state statistics transaction | ||
2260 | * @memcg: the memcg that was accounted against | ||
2261 | * @locked: value received from mem_cgroup_begin_page_stat() | ||
2262 | * @flags: value received from mem_cgroup_begin_page_stat() | ||
2263 | */ | ||
2264 | void mem_cgroup_end_page_stat(struct mem_cgroup *memcg, bool locked, | ||
2265 | unsigned long flags) | ||
2252 | { | 2266 | { |
2253 | struct page_cgroup *pc = lookup_page_cgroup(page); | 2267 | if (memcg && locked) |
2268 | move_unlock_mem_cgroup(memcg, &flags); | ||
2254 | 2269 | ||
2255 | /* | 2270 | rcu_read_unlock(); |
2256 | * It's guaranteed that pc->mem_cgroup never changes while | ||
2257 | * lock is held because a routine modifies pc->mem_cgroup | ||
2258 | * should take move_lock_mem_cgroup(). | ||
2259 | */ | ||
2260 | move_unlock_mem_cgroup(pc->mem_cgroup, flags); | ||
2261 | } | 2271 | } |
2262 | 2272 | ||
2263 | void mem_cgroup_update_page_stat(struct page *page, | 2273 | /** |
2274 | * mem_cgroup_update_page_stat - update page state statistics | ||
2275 | * @memcg: memcg to account against | ||
2276 | * @idx: page state item to account | ||
2277 | * @val: number of pages (positive or negative) | ||
2278 | * | ||
2279 | * See mem_cgroup_begin_page_stat() for locking requirements. | ||
2280 | */ | ||
2281 | void mem_cgroup_update_page_stat(struct mem_cgroup *memcg, | ||
2264 | enum mem_cgroup_stat_index idx, int val) | 2282 | enum mem_cgroup_stat_index idx, int val) |
2265 | { | 2283 | { |
2266 | struct mem_cgroup *memcg; | ||
2267 | struct page_cgroup *pc = lookup_page_cgroup(page); | ||
2268 | unsigned long uninitialized_var(flags); | ||
2269 | |||
2270 | if (mem_cgroup_disabled()) | ||
2271 | return; | ||
2272 | |||
2273 | VM_BUG_ON(!rcu_read_lock_held()); | 2284 | VM_BUG_ON(!rcu_read_lock_held()); |
2274 | memcg = pc->mem_cgroup; | ||
2275 | if (unlikely(!memcg || !PageCgroupUsed(pc))) | ||
2276 | return; | ||
2277 | 2285 | ||
2278 | this_cpu_add(memcg->stat->count[idx], val); | 2286 | if (memcg) |
2287 | this_cpu_add(memcg->stat->count[idx], val); | ||
2279 | } | 2288 | } |
2280 | 2289 | ||
2281 | /* | 2290 | /* |
diff --git a/mm/memory.c b/mm/memory.c index 1cc6bfbd872e..3e503831e042 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -1147,6 +1147,7 @@ again: | |||
1147 | print_bad_pte(vma, addr, ptent, page); | 1147 | print_bad_pte(vma, addr, ptent, page); |
1148 | if (unlikely(!__tlb_remove_page(tlb, page))) { | 1148 | if (unlikely(!__tlb_remove_page(tlb, page))) { |
1149 | force_flush = 1; | 1149 | force_flush = 1; |
1150 | addr += PAGE_SIZE; | ||
1150 | break; | 1151 | break; |
1151 | } | 1152 | } |
1152 | continue; | 1153 | continue; |
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 29d8693d0c61..1bf4807cb21e 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/stop_machine.h> | 31 | #include <linux/stop_machine.h> |
32 | #include <linux/hugetlb.h> | 32 | #include <linux/hugetlb.h> |
33 | #include <linux/memblock.h> | 33 | #include <linux/memblock.h> |
34 | #include <linux/bootmem.h> | ||
34 | 35 | ||
35 | #include <asm/tlbflush.h> | 36 | #include <asm/tlbflush.h> |
36 | 37 | ||
@@ -1066,6 +1067,16 @@ out: | |||
1066 | } | 1067 | } |
1067 | #endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */ | 1068 | #endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */ |
1068 | 1069 | ||
1070 | static void reset_node_present_pages(pg_data_t *pgdat) | ||
1071 | { | ||
1072 | struct zone *z; | ||
1073 | |||
1074 | for (z = pgdat->node_zones; z < pgdat->node_zones + MAX_NR_ZONES; z++) | ||
1075 | z->present_pages = 0; | ||
1076 | |||
1077 | pgdat->node_present_pages = 0; | ||
1078 | } | ||
1079 | |||
1069 | /* we are OK calling __meminit stuff here - we have CONFIG_MEMORY_HOTPLUG */ | 1080 | /* we are OK calling __meminit stuff here - we have CONFIG_MEMORY_HOTPLUG */ |
1070 | static pg_data_t __ref *hotadd_new_pgdat(int nid, u64 start) | 1081 | static pg_data_t __ref *hotadd_new_pgdat(int nid, u64 start) |
1071 | { | 1082 | { |
@@ -1096,6 +1107,21 @@ static pg_data_t __ref *hotadd_new_pgdat(int nid, u64 start) | |||
1096 | build_all_zonelists(pgdat, NULL); | 1107 | build_all_zonelists(pgdat, NULL); |
1097 | mutex_unlock(&zonelists_mutex); | 1108 | mutex_unlock(&zonelists_mutex); |
1098 | 1109 | ||
1110 | /* | ||
1111 | * zone->managed_pages is set to an approximate value in | ||
1112 | * free_area_init_core(), which will cause | ||
1113 | * /sys/device/system/node/nodeX/meminfo has wrong data. | ||
1114 | * So reset it to 0 before any memory is onlined. | ||
1115 | */ | ||
1116 | reset_node_managed_pages(pgdat); | ||
1117 | |||
1118 | /* | ||
1119 | * When memory is hot-added, all the memory is in offline state. So | ||
1120 | * clear all zones' present_pages because they will be updated in | ||
1121 | * online_pages() and offline_pages(). | ||
1122 | */ | ||
1123 | reset_node_present_pages(pgdat); | ||
1124 | |||
1099 | return pgdat; | 1125 | return pgdat; |
1100 | } | 1126 | } |
1101 | 1127 | ||
@@ -1912,7 +1938,6 @@ void try_offline_node(int nid) | |||
1912 | unsigned long start_pfn = pgdat->node_start_pfn; | 1938 | unsigned long start_pfn = pgdat->node_start_pfn; |
1913 | unsigned long end_pfn = start_pfn + pgdat->node_spanned_pages; | 1939 | unsigned long end_pfn = start_pfn + pgdat->node_spanned_pages; |
1914 | unsigned long pfn; | 1940 | unsigned long pfn; |
1915 | struct page *pgdat_page = virt_to_page(pgdat); | ||
1916 | int i; | 1941 | int i; |
1917 | 1942 | ||
1918 | for (pfn = start_pfn; pfn < end_pfn; pfn += PAGES_PER_SECTION) { | 1943 | for (pfn = start_pfn; pfn < end_pfn; pfn += PAGES_PER_SECTION) { |
@@ -1941,10 +1966,6 @@ void try_offline_node(int nid) | |||
1941 | node_set_offline(nid); | 1966 | node_set_offline(nid); |
1942 | unregister_one_node(nid); | 1967 | unregister_one_node(nid); |
1943 | 1968 | ||
1944 | if (!PageSlab(pgdat_page) && !PageCompound(pgdat_page)) | ||
1945 | /* node data is allocated from boot memory */ | ||
1946 | return; | ||
1947 | |||
1948 | /* free waittable in each zone */ | 1969 | /* free waittable in each zone */ |
1949 | for (i = 0; i < MAX_NR_ZONES; i++) { | 1970 | for (i = 0; i < MAX_NR_ZONES; i++) { |
1950 | struct zone *zone = pgdat->node_zones + i; | 1971 | struct zone *zone = pgdat->node_zones + i; |
@@ -1080,7 +1080,7 @@ struct vm_area_struct *vma_merge(struct mm_struct *mm, | |||
1080 | end, prev->vm_pgoff, NULL); | 1080 | end, prev->vm_pgoff, NULL); |
1081 | if (err) | 1081 | if (err) |
1082 | return NULL; | 1082 | return NULL; |
1083 | khugepaged_enter_vma_merge(prev); | 1083 | khugepaged_enter_vma_merge(prev, vm_flags); |
1084 | return prev; | 1084 | return prev; |
1085 | } | 1085 | } |
1086 | 1086 | ||
@@ -1099,7 +1099,7 @@ struct vm_area_struct *vma_merge(struct mm_struct *mm, | |||
1099 | next->vm_pgoff - pglen, NULL); | 1099 | next->vm_pgoff - pglen, NULL); |
1100 | if (err) | 1100 | if (err) |
1101 | return NULL; | 1101 | return NULL; |
1102 | khugepaged_enter_vma_merge(area); | 1102 | khugepaged_enter_vma_merge(area, vm_flags); |
1103 | return area; | 1103 | return area; |
1104 | } | 1104 | } |
1105 | 1105 | ||
@@ -2208,7 +2208,7 @@ int expand_upwards(struct vm_area_struct *vma, unsigned long address) | |||
2208 | } | 2208 | } |
2209 | } | 2209 | } |
2210 | vma_unlock_anon_vma(vma); | 2210 | vma_unlock_anon_vma(vma); |
2211 | khugepaged_enter_vma_merge(vma); | 2211 | khugepaged_enter_vma_merge(vma, vma->vm_flags); |
2212 | validate_mm(vma->vm_mm); | 2212 | validate_mm(vma->vm_mm); |
2213 | return error; | 2213 | return error; |
2214 | } | 2214 | } |
@@ -2277,7 +2277,7 @@ int expand_downwards(struct vm_area_struct *vma, | |||
2277 | } | 2277 | } |
2278 | } | 2278 | } |
2279 | vma_unlock_anon_vma(vma); | 2279 | vma_unlock_anon_vma(vma); |
2280 | khugepaged_enter_vma_merge(vma); | 2280 | khugepaged_enter_vma_merge(vma, vma->vm_flags); |
2281 | validate_mm(vma->vm_mm); | 2281 | validate_mm(vma->vm_mm); |
2282 | return error; | 2282 | return error; |
2283 | } | 2283 | } |
diff --git a/mm/nobootmem.c b/mm/nobootmem.c index 7c7ab32ee503..90b50468333e 100644 --- a/mm/nobootmem.c +++ b/mm/nobootmem.c | |||
@@ -145,12 +145,10 @@ static unsigned long __init free_low_memory_core_early(void) | |||
145 | 145 | ||
146 | static int reset_managed_pages_done __initdata; | 146 | static int reset_managed_pages_done __initdata; |
147 | 147 | ||
148 | static inline void __init reset_node_managed_pages(pg_data_t *pgdat) | 148 | void reset_node_managed_pages(pg_data_t *pgdat) |
149 | { | 149 | { |
150 | struct zone *z; | 150 | struct zone *z; |
151 | 151 | ||
152 | if (reset_managed_pages_done) | ||
153 | return; | ||
154 | for (z = pgdat->node_zones; z < pgdat->node_zones + MAX_NR_ZONES; z++) | 152 | for (z = pgdat->node_zones; z < pgdat->node_zones + MAX_NR_ZONES; z++) |
155 | z->managed_pages = 0; | 153 | z->managed_pages = 0; |
156 | } | 154 | } |
@@ -159,8 +157,12 @@ void __init reset_all_zones_managed_pages(void) | |||
159 | { | 157 | { |
160 | struct pglist_data *pgdat; | 158 | struct pglist_data *pgdat; |
161 | 159 | ||
160 | if (reset_managed_pages_done) | ||
161 | return; | ||
162 | |||
162 | for_each_online_pgdat(pgdat) | 163 | for_each_online_pgdat(pgdat) |
163 | reset_node_managed_pages(pgdat); | 164 | reset_node_managed_pages(pgdat); |
165 | |||
164 | reset_managed_pages_done = 1; | 166 | reset_managed_pages_done = 1; |
165 | } | 167 | } |
166 | 168 | ||
diff --git a/mm/page-writeback.c b/mm/page-writeback.c index ff24c9d83112..19ceae87522d 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c | |||
@@ -2116,23 +2116,6 @@ void account_page_dirtied(struct page *page, struct address_space *mapping) | |||
2116 | EXPORT_SYMBOL(account_page_dirtied); | 2116 | EXPORT_SYMBOL(account_page_dirtied); |
2117 | 2117 | ||
2118 | /* | 2118 | /* |
2119 | * Helper function for set_page_writeback family. | ||
2120 | * | ||
2121 | * The caller must hold mem_cgroup_begin/end_update_page_stat() lock | ||
2122 | * while calling this function. | ||
2123 | * See test_set_page_writeback for example. | ||
2124 | * | ||
2125 | * NOTE: Unlike account_page_dirtied this does not rely on being atomic | ||
2126 | * wrt interrupts. | ||
2127 | */ | ||
2128 | void account_page_writeback(struct page *page) | ||
2129 | { | ||
2130 | mem_cgroup_inc_page_stat(page, MEM_CGROUP_STAT_WRITEBACK); | ||
2131 | inc_zone_page_state(page, NR_WRITEBACK); | ||
2132 | } | ||
2133 | EXPORT_SYMBOL(account_page_writeback); | ||
2134 | |||
2135 | /* | ||
2136 | * For address_spaces which do not use buffers. Just tag the page as dirty in | 2119 | * For address_spaces which do not use buffers. Just tag the page as dirty in |
2137 | * its radix tree. | 2120 | * its radix tree. |
2138 | * | 2121 | * |
@@ -2344,11 +2327,12 @@ EXPORT_SYMBOL(clear_page_dirty_for_io); | |||
2344 | int test_clear_page_writeback(struct page *page) | 2327 | int test_clear_page_writeback(struct page *page) |
2345 | { | 2328 | { |
2346 | struct address_space *mapping = page_mapping(page); | 2329 | struct address_space *mapping = page_mapping(page); |
2347 | int ret; | ||
2348 | bool locked; | ||
2349 | unsigned long memcg_flags; | 2330 | unsigned long memcg_flags; |
2331 | struct mem_cgroup *memcg; | ||
2332 | bool locked; | ||
2333 | int ret; | ||
2350 | 2334 | ||
2351 | mem_cgroup_begin_update_page_stat(page, &locked, &memcg_flags); | 2335 | memcg = mem_cgroup_begin_page_stat(page, &locked, &memcg_flags); |
2352 | if (mapping) { | 2336 | if (mapping) { |
2353 | struct backing_dev_info *bdi = mapping->backing_dev_info; | 2337 | struct backing_dev_info *bdi = mapping->backing_dev_info; |
2354 | unsigned long flags; | 2338 | unsigned long flags; |
@@ -2369,22 +2353,23 @@ int test_clear_page_writeback(struct page *page) | |||
2369 | ret = TestClearPageWriteback(page); | 2353 | ret = TestClearPageWriteback(page); |
2370 | } | 2354 | } |
2371 | if (ret) { | 2355 | if (ret) { |
2372 | mem_cgroup_dec_page_stat(page, MEM_CGROUP_STAT_WRITEBACK); | 2356 | mem_cgroup_dec_page_stat(memcg, MEM_CGROUP_STAT_WRITEBACK); |
2373 | dec_zone_page_state(page, NR_WRITEBACK); | 2357 | dec_zone_page_state(page, NR_WRITEBACK); |
2374 | inc_zone_page_state(page, NR_WRITTEN); | 2358 | inc_zone_page_state(page, NR_WRITTEN); |
2375 | } | 2359 | } |
2376 | mem_cgroup_end_update_page_stat(page, &locked, &memcg_flags); | 2360 | mem_cgroup_end_page_stat(memcg, locked, memcg_flags); |
2377 | return ret; | 2361 | return ret; |
2378 | } | 2362 | } |
2379 | 2363 | ||
2380 | int __test_set_page_writeback(struct page *page, bool keep_write) | 2364 | int __test_set_page_writeback(struct page *page, bool keep_write) |
2381 | { | 2365 | { |
2382 | struct address_space *mapping = page_mapping(page); | 2366 | struct address_space *mapping = page_mapping(page); |
2383 | int ret; | ||
2384 | bool locked; | ||
2385 | unsigned long memcg_flags; | 2367 | unsigned long memcg_flags; |
2368 | struct mem_cgroup *memcg; | ||
2369 | bool locked; | ||
2370 | int ret; | ||
2386 | 2371 | ||
2387 | mem_cgroup_begin_update_page_stat(page, &locked, &memcg_flags); | 2372 | memcg = mem_cgroup_begin_page_stat(page, &locked, &memcg_flags); |
2388 | if (mapping) { | 2373 | if (mapping) { |
2389 | struct backing_dev_info *bdi = mapping->backing_dev_info; | 2374 | struct backing_dev_info *bdi = mapping->backing_dev_info; |
2390 | unsigned long flags; | 2375 | unsigned long flags; |
@@ -2410,9 +2395,11 @@ int __test_set_page_writeback(struct page *page, bool keep_write) | |||
2410 | } else { | 2395 | } else { |
2411 | ret = TestSetPageWriteback(page); | 2396 | ret = TestSetPageWriteback(page); |
2412 | } | 2397 | } |
2413 | if (!ret) | 2398 | if (!ret) { |
2414 | account_page_writeback(page); | 2399 | mem_cgroup_inc_page_stat(memcg, MEM_CGROUP_STAT_WRITEBACK); |
2415 | mem_cgroup_end_update_page_stat(page, &locked, &memcg_flags); | 2400 | inc_zone_page_state(page, NR_WRITEBACK); |
2401 | } | ||
2402 | mem_cgroup_end_page_stat(memcg, locked, memcg_flags); | ||
2416 | return ret; | 2403 | return ret; |
2417 | 2404 | ||
2418 | } | 2405 | } |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 9cd36b822444..616a2c956b4b 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -467,29 +467,6 @@ static inline void rmv_page_order(struct page *page) | |||
467 | } | 467 | } |
468 | 468 | ||
469 | /* | 469 | /* |
470 | * Locate the struct page for both the matching buddy in our | ||
471 | * pair (buddy1) and the combined O(n+1) page they form (page). | ||
472 | * | ||
473 | * 1) Any buddy B1 will have an order O twin B2 which satisfies | ||
474 | * the following equation: | ||
475 | * B2 = B1 ^ (1 << O) | ||
476 | * For example, if the starting buddy (buddy2) is #8 its order | ||
477 | * 1 buddy is #10: | ||
478 | * B2 = 8 ^ (1 << 1) = 8 ^ 2 = 10 | ||
479 | * | ||
480 | * 2) Any buddy B will have an order O+1 parent P which | ||
481 | * satisfies the following equation: | ||
482 | * P = B & ~(1 << O) | ||
483 | * | ||
484 | * Assumption: *_mem_map is contiguous at least up to MAX_ORDER | ||
485 | */ | ||
486 | static inline unsigned long | ||
487 | __find_buddy_index(unsigned long page_idx, unsigned int order) | ||
488 | { | ||
489 | return page_idx ^ (1 << order); | ||
490 | } | ||
491 | |||
492 | /* | ||
493 | * This function checks whether a page is free && is the buddy | 470 | * This function checks whether a page is free && is the buddy |
494 | * we can do coalesce a page and its buddy if | 471 | * we can do coalesce a page and its buddy if |
495 | * (a) the buddy is not in a hole && | 472 | * (a) the buddy is not in a hole && |
@@ -569,6 +546,7 @@ static inline void __free_one_page(struct page *page, | |||
569 | unsigned long combined_idx; | 546 | unsigned long combined_idx; |
570 | unsigned long uninitialized_var(buddy_idx); | 547 | unsigned long uninitialized_var(buddy_idx); |
571 | struct page *buddy; | 548 | struct page *buddy; |
549 | int max_order = MAX_ORDER; | ||
572 | 550 | ||
573 | VM_BUG_ON(!zone_is_initialized(zone)); | 551 | VM_BUG_ON(!zone_is_initialized(zone)); |
574 | 552 | ||
@@ -577,13 +555,24 @@ static inline void __free_one_page(struct page *page, | |||
577 | return; | 555 | return; |
578 | 556 | ||
579 | VM_BUG_ON(migratetype == -1); | 557 | VM_BUG_ON(migratetype == -1); |
558 | if (is_migrate_isolate(migratetype)) { | ||
559 | /* | ||
560 | * We restrict max order of merging to prevent merge | ||
561 | * between freepages on isolate pageblock and normal | ||
562 | * pageblock. Without this, pageblock isolation | ||
563 | * could cause incorrect freepage accounting. | ||
564 | */ | ||
565 | max_order = min(MAX_ORDER, pageblock_order + 1); | ||
566 | } else { | ||
567 | __mod_zone_freepage_state(zone, 1 << order, migratetype); | ||
568 | } | ||
580 | 569 | ||
581 | page_idx = pfn & ((1 << MAX_ORDER) - 1); | 570 | page_idx = pfn & ((1 << max_order) - 1); |
582 | 571 | ||
583 | VM_BUG_ON_PAGE(page_idx & ((1 << order) - 1), page); | 572 | VM_BUG_ON_PAGE(page_idx & ((1 << order) - 1), page); |
584 | VM_BUG_ON_PAGE(bad_range(zone, page), page); | 573 | VM_BUG_ON_PAGE(bad_range(zone, page), page); |
585 | 574 | ||
586 | while (order < MAX_ORDER-1) { | 575 | while (order < max_order - 1) { |
587 | buddy_idx = __find_buddy_index(page_idx, order); | 576 | buddy_idx = __find_buddy_index(page_idx, order); |
588 | buddy = page + (buddy_idx - page_idx); | 577 | buddy = page + (buddy_idx - page_idx); |
589 | if (!page_is_buddy(page, buddy, order)) | 578 | if (!page_is_buddy(page, buddy, order)) |
@@ -594,9 +583,11 @@ static inline void __free_one_page(struct page *page, | |||
594 | */ | 583 | */ |
595 | if (page_is_guard(buddy)) { | 584 | if (page_is_guard(buddy)) { |
596 | clear_page_guard_flag(buddy); | 585 | clear_page_guard_flag(buddy); |
597 | set_page_private(page, 0); | 586 | set_page_private(buddy, 0); |
598 | __mod_zone_freepage_state(zone, 1 << order, | 587 | if (!is_migrate_isolate(migratetype)) { |
599 | migratetype); | 588 | __mod_zone_freepage_state(zone, 1 << order, |
589 | migratetype); | ||
590 | } | ||
600 | } else { | 591 | } else { |
601 | list_del(&buddy->lru); | 592 | list_del(&buddy->lru); |
602 | zone->free_area[order].nr_free--; | 593 | zone->free_area[order].nr_free--; |
@@ -715,14 +706,12 @@ static void free_pcppages_bulk(struct zone *zone, int count, | |||
715 | /* must delete as __free_one_page list manipulates */ | 706 | /* must delete as __free_one_page list manipulates */ |
716 | list_del(&page->lru); | 707 | list_del(&page->lru); |
717 | mt = get_freepage_migratetype(page); | 708 | mt = get_freepage_migratetype(page); |
709 | if (unlikely(has_isolate_pageblock(zone))) | ||
710 | mt = get_pageblock_migratetype(page); | ||
711 | |||
718 | /* MIGRATE_MOVABLE list may include MIGRATE_RESERVEs */ | 712 | /* MIGRATE_MOVABLE list may include MIGRATE_RESERVEs */ |
719 | __free_one_page(page, page_to_pfn(page), zone, 0, mt); | 713 | __free_one_page(page, page_to_pfn(page), zone, 0, mt); |
720 | trace_mm_page_pcpu_drain(page, 0, mt); | 714 | trace_mm_page_pcpu_drain(page, 0, mt); |
721 | if (likely(!is_migrate_isolate_page(page))) { | ||
722 | __mod_zone_page_state(zone, NR_FREE_PAGES, 1); | ||
723 | if (is_migrate_cma(mt)) | ||
724 | __mod_zone_page_state(zone, NR_FREE_CMA_PAGES, 1); | ||
725 | } | ||
726 | } while (--to_free && --batch_free && !list_empty(list)); | 715 | } while (--to_free && --batch_free && !list_empty(list)); |
727 | } | 716 | } |
728 | spin_unlock(&zone->lock); | 717 | spin_unlock(&zone->lock); |
@@ -739,9 +728,11 @@ static void free_one_page(struct zone *zone, | |||
739 | if (nr_scanned) | 728 | if (nr_scanned) |
740 | __mod_zone_page_state(zone, NR_PAGES_SCANNED, -nr_scanned); | 729 | __mod_zone_page_state(zone, NR_PAGES_SCANNED, -nr_scanned); |
741 | 730 | ||
731 | if (unlikely(has_isolate_pageblock(zone) || | ||
732 | is_migrate_isolate(migratetype))) { | ||
733 | migratetype = get_pfnblock_migratetype(page, pfn); | ||
734 | } | ||
742 | __free_one_page(page, pfn, zone, order, migratetype); | 735 | __free_one_page(page, pfn, zone, order, migratetype); |
743 | if (unlikely(!is_migrate_isolate(migratetype))) | ||
744 | __mod_zone_freepage_state(zone, 1 << order, migratetype); | ||
745 | spin_unlock(&zone->lock); | 736 | spin_unlock(&zone->lock); |
746 | } | 737 | } |
747 | 738 | ||
@@ -1484,7 +1475,7 @@ void split_page(struct page *page, unsigned int order) | |||
1484 | } | 1475 | } |
1485 | EXPORT_SYMBOL_GPL(split_page); | 1476 | EXPORT_SYMBOL_GPL(split_page); |
1486 | 1477 | ||
1487 | static int __isolate_free_page(struct page *page, unsigned int order) | 1478 | int __isolate_free_page(struct page *page, unsigned int order) |
1488 | { | 1479 | { |
1489 | unsigned long watermark; | 1480 | unsigned long watermark; |
1490 | struct zone *zone; | 1481 | struct zone *zone; |
@@ -6408,13 +6399,12 @@ int alloc_contig_range(unsigned long start, unsigned long end, | |||
6408 | 6399 | ||
6409 | /* Make sure the range is really isolated. */ | 6400 | /* Make sure the range is really isolated. */ |
6410 | if (test_pages_isolated(outer_start, end, false)) { | 6401 | if (test_pages_isolated(outer_start, end, false)) { |
6411 | pr_warn("alloc_contig_range test_pages_isolated(%lx, %lx) failed\n", | 6402 | pr_info("%s: [%lx, %lx) PFNs busy\n", |
6412 | outer_start, end); | 6403 | __func__, outer_start, end); |
6413 | ret = -EBUSY; | 6404 | ret = -EBUSY; |
6414 | goto done; | 6405 | goto done; |
6415 | } | 6406 | } |
6416 | 6407 | ||
6417 | |||
6418 | /* Grab isolated pages from freelists. */ | 6408 | /* Grab isolated pages from freelists. */ |
6419 | outer_end = isolate_freepages_range(&cc, outer_start, end); | 6409 | outer_end = isolate_freepages_range(&cc, outer_start, end); |
6420 | if (!outer_end) { | 6410 | if (!outer_end) { |
diff --git a/mm/page_cgroup.c b/mm/page_cgroup.c index 3708264d2833..5331c2bd85a2 100644 --- a/mm/page_cgroup.c +++ b/mm/page_cgroup.c | |||
@@ -171,6 +171,7 @@ static void free_page_cgroup(void *addr) | |||
171 | sizeof(struct page_cgroup) * PAGES_PER_SECTION; | 171 | sizeof(struct page_cgroup) * PAGES_PER_SECTION; |
172 | 172 | ||
173 | BUG_ON(PageReserved(page)); | 173 | BUG_ON(PageReserved(page)); |
174 | kmemleak_free(addr); | ||
174 | free_pages_exact(addr, table_size); | 175 | free_pages_exact(addr, table_size); |
175 | } | 176 | } |
176 | } | 177 | } |
diff --git a/mm/page_isolation.c b/mm/page_isolation.c index d1473b2e9481..c8778f7e208e 100644 --- a/mm/page_isolation.c +++ b/mm/page_isolation.c | |||
@@ -60,6 +60,7 @@ out: | |||
60 | int migratetype = get_pageblock_migratetype(page); | 60 | int migratetype = get_pageblock_migratetype(page); |
61 | 61 | ||
62 | set_pageblock_migratetype(page, MIGRATE_ISOLATE); | 62 | set_pageblock_migratetype(page, MIGRATE_ISOLATE); |
63 | zone->nr_isolate_pageblock++; | ||
63 | nr_pages = move_freepages_block(zone, page, MIGRATE_ISOLATE); | 64 | nr_pages = move_freepages_block(zone, page, MIGRATE_ISOLATE); |
64 | 65 | ||
65 | __mod_zone_freepage_state(zone, -nr_pages, migratetype); | 66 | __mod_zone_freepage_state(zone, -nr_pages, migratetype); |
@@ -75,16 +76,54 @@ void unset_migratetype_isolate(struct page *page, unsigned migratetype) | |||
75 | { | 76 | { |
76 | struct zone *zone; | 77 | struct zone *zone; |
77 | unsigned long flags, nr_pages; | 78 | unsigned long flags, nr_pages; |
79 | struct page *isolated_page = NULL; | ||
80 | unsigned int order; | ||
81 | unsigned long page_idx, buddy_idx; | ||
82 | struct page *buddy; | ||
78 | 83 | ||
79 | zone = page_zone(page); | 84 | zone = page_zone(page); |
80 | spin_lock_irqsave(&zone->lock, flags); | 85 | spin_lock_irqsave(&zone->lock, flags); |
81 | if (get_pageblock_migratetype(page) != MIGRATE_ISOLATE) | 86 | if (get_pageblock_migratetype(page) != MIGRATE_ISOLATE) |
82 | goto out; | 87 | goto out; |
83 | nr_pages = move_freepages_block(zone, page, migratetype); | 88 | |
84 | __mod_zone_freepage_state(zone, nr_pages, migratetype); | 89 | /* |
90 | * Because freepage with more than pageblock_order on isolated | ||
91 | * pageblock is restricted to merge due to freepage counting problem, | ||
92 | * it is possible that there is free buddy page. | ||
93 | * move_freepages_block() doesn't care of merge so we need other | ||
94 | * approach in order to merge them. Isolation and free will make | ||
95 | * these pages to be merged. | ||
96 | */ | ||
97 | if (PageBuddy(page)) { | ||
98 | order = page_order(page); | ||
99 | if (order >= pageblock_order) { | ||
100 | page_idx = page_to_pfn(page) & ((1 << MAX_ORDER) - 1); | ||
101 | buddy_idx = __find_buddy_index(page_idx, order); | ||
102 | buddy = page + (buddy_idx - page_idx); | ||
103 | |||
104 | if (!is_migrate_isolate_page(buddy)) { | ||
105 | __isolate_free_page(page, order); | ||
106 | set_page_refcounted(page); | ||
107 | isolated_page = page; | ||
108 | } | ||
109 | } | ||
110 | } | ||
111 | |||
112 | /* | ||
113 | * If we isolate freepage with more than pageblock_order, there | ||
114 | * should be no freepage in the range, so we could avoid costly | ||
115 | * pageblock scanning for freepage moving. | ||
116 | */ | ||
117 | if (!isolated_page) { | ||
118 | nr_pages = move_freepages_block(zone, page, migratetype); | ||
119 | __mod_zone_freepage_state(zone, nr_pages, migratetype); | ||
120 | } | ||
85 | set_pageblock_migratetype(page, migratetype); | 121 | set_pageblock_migratetype(page, migratetype); |
122 | zone->nr_isolate_pageblock--; | ||
86 | out: | 123 | out: |
87 | spin_unlock_irqrestore(&zone->lock, flags); | 124 | spin_unlock_irqrestore(&zone->lock, flags); |
125 | if (isolated_page) | ||
126 | __free_pages(isolated_page, order); | ||
88 | } | 127 | } |
89 | 128 | ||
90 | static inline struct page * | 129 | static inline struct page * |
@@ -1042,15 +1042,46 @@ void page_add_new_anon_rmap(struct page *page, | |||
1042 | */ | 1042 | */ |
1043 | void page_add_file_rmap(struct page *page) | 1043 | void page_add_file_rmap(struct page *page) |
1044 | { | 1044 | { |
1045 | bool locked; | 1045 | struct mem_cgroup *memcg; |
1046 | unsigned long flags; | 1046 | unsigned long flags; |
1047 | bool locked; | ||
1047 | 1048 | ||
1048 | mem_cgroup_begin_update_page_stat(page, &locked, &flags); | 1049 | memcg = mem_cgroup_begin_page_stat(page, &locked, &flags); |
1049 | if (atomic_inc_and_test(&page->_mapcount)) { | 1050 | if (atomic_inc_and_test(&page->_mapcount)) { |
1050 | __inc_zone_page_state(page, NR_FILE_MAPPED); | 1051 | __inc_zone_page_state(page, NR_FILE_MAPPED); |
1051 | mem_cgroup_inc_page_stat(page, MEM_CGROUP_STAT_FILE_MAPPED); | 1052 | mem_cgroup_inc_page_stat(memcg, MEM_CGROUP_STAT_FILE_MAPPED); |
1052 | } | 1053 | } |
1053 | mem_cgroup_end_update_page_stat(page, &locked, &flags); | 1054 | mem_cgroup_end_page_stat(memcg, locked, flags); |
1055 | } | ||
1056 | |||
1057 | static void page_remove_file_rmap(struct page *page) | ||
1058 | { | ||
1059 | struct mem_cgroup *memcg; | ||
1060 | unsigned long flags; | ||
1061 | bool locked; | ||
1062 | |||
1063 | memcg = mem_cgroup_begin_page_stat(page, &locked, &flags); | ||
1064 | |||
1065 | /* page still mapped by someone else? */ | ||
1066 | if (!atomic_add_negative(-1, &page->_mapcount)) | ||
1067 | goto out; | ||
1068 | |||
1069 | /* Hugepages are not counted in NR_FILE_MAPPED for now. */ | ||
1070 | if (unlikely(PageHuge(page))) | ||
1071 | goto out; | ||
1072 | |||
1073 | /* | ||
1074 | * We use the irq-unsafe __{inc|mod}_zone_page_stat because | ||
1075 | * these counters are not modified in interrupt context, and | ||
1076 | * pte lock(a spinlock) is held, which implies preemption disabled. | ||
1077 | */ | ||
1078 | __dec_zone_page_state(page, NR_FILE_MAPPED); | ||
1079 | mem_cgroup_dec_page_stat(memcg, MEM_CGROUP_STAT_FILE_MAPPED); | ||
1080 | |||
1081 | if (unlikely(PageMlocked(page))) | ||
1082 | clear_page_mlock(page); | ||
1083 | out: | ||
1084 | mem_cgroup_end_page_stat(memcg, locked, flags); | ||
1054 | } | 1085 | } |
1055 | 1086 | ||
1056 | /** | 1087 | /** |
@@ -1061,46 +1092,33 @@ void page_add_file_rmap(struct page *page) | |||
1061 | */ | 1092 | */ |
1062 | void page_remove_rmap(struct page *page) | 1093 | void page_remove_rmap(struct page *page) |
1063 | { | 1094 | { |
1064 | bool anon = PageAnon(page); | 1095 | if (!PageAnon(page)) { |
1065 | bool locked; | 1096 | page_remove_file_rmap(page); |
1066 | unsigned long flags; | 1097 | return; |
1067 | 1098 | } | |
1068 | /* | ||
1069 | * The anon case has no mem_cgroup page_stat to update; but may | ||
1070 | * uncharge_page() below, where the lock ordering can deadlock if | ||
1071 | * we hold the lock against page_stat move: so avoid it on anon. | ||
1072 | */ | ||
1073 | if (!anon) | ||
1074 | mem_cgroup_begin_update_page_stat(page, &locked, &flags); | ||
1075 | 1099 | ||
1076 | /* page still mapped by someone else? */ | 1100 | /* page still mapped by someone else? */ |
1077 | if (!atomic_add_negative(-1, &page->_mapcount)) | 1101 | if (!atomic_add_negative(-1, &page->_mapcount)) |
1078 | goto out; | 1102 | return; |
1103 | |||
1104 | /* Hugepages are not counted in NR_ANON_PAGES for now. */ | ||
1105 | if (unlikely(PageHuge(page))) | ||
1106 | return; | ||
1079 | 1107 | ||
1080 | /* | 1108 | /* |
1081 | * Hugepages are not counted in NR_ANON_PAGES nor NR_FILE_MAPPED | ||
1082 | * and not charged by memcg for now. | ||
1083 | * | ||
1084 | * We use the irq-unsafe __{inc|mod}_zone_page_stat because | 1109 | * We use the irq-unsafe __{inc|mod}_zone_page_stat because |
1085 | * these counters are not modified in interrupt context, and | 1110 | * these counters are not modified in interrupt context, and |
1086 | * these counters are not modified in interrupt context, and | ||
1087 | * pte lock(a spinlock) is held, which implies preemption disabled. | 1111 | * pte lock(a spinlock) is held, which implies preemption disabled. |
1088 | */ | 1112 | */ |
1089 | if (unlikely(PageHuge(page))) | 1113 | if (PageTransHuge(page)) |
1090 | goto out; | 1114 | __dec_zone_page_state(page, NR_ANON_TRANSPARENT_HUGEPAGES); |
1091 | if (anon) { | 1115 | |
1092 | if (PageTransHuge(page)) | 1116 | __mod_zone_page_state(page_zone(page), NR_ANON_PAGES, |
1093 | __dec_zone_page_state(page, | 1117 | -hpage_nr_pages(page)); |
1094 | NR_ANON_TRANSPARENT_HUGEPAGES); | 1118 | |
1095 | __mod_zone_page_state(page_zone(page), NR_ANON_PAGES, | ||
1096 | -hpage_nr_pages(page)); | ||
1097 | } else { | ||
1098 | __dec_zone_page_state(page, NR_FILE_MAPPED); | ||
1099 | mem_cgroup_dec_page_stat(page, MEM_CGROUP_STAT_FILE_MAPPED); | ||
1100 | mem_cgroup_end_update_page_stat(page, &locked, &flags); | ||
1101 | } | ||
1102 | if (unlikely(PageMlocked(page))) | 1119 | if (unlikely(PageMlocked(page))) |
1103 | clear_page_mlock(page); | 1120 | clear_page_mlock(page); |
1121 | |||
1104 | /* | 1122 | /* |
1105 | * It would be tidy to reset the PageAnon mapping here, | 1123 | * It would be tidy to reset the PageAnon mapping here, |
1106 | * but that might overwrite a racing page_add_anon_rmap | 1124 | * but that might overwrite a racing page_add_anon_rmap |
@@ -1110,10 +1128,6 @@ void page_remove_rmap(struct page *page) | |||
1110 | * Leaving it set also helps swapoff to reinstate ptes | 1128 | * Leaving it set also helps swapoff to reinstate ptes |
1111 | * faster for those pages still in swapcache. | 1129 | * faster for those pages still in swapcache. |
1112 | */ | 1130 | */ |
1113 | return; | ||
1114 | out: | ||
1115 | if (!anon) | ||
1116 | mem_cgroup_end_update_page_stat(page, &locked, &flags); | ||
1117 | } | 1131 | } |
1118 | 1132 | ||
1119 | /* | 1133 | /* |
diff --git a/mm/slab_common.c b/mm/slab_common.c index 3a6e0cfdf03a..dcdab81bd240 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c | |||
@@ -93,16 +93,6 @@ static int kmem_cache_sanity_check(const char *name, size_t size) | |||
93 | s->object_size); | 93 | s->object_size); |
94 | continue; | 94 | continue; |
95 | } | 95 | } |
96 | |||
97 | #if !defined(CONFIG_SLUB) | ||
98 | if (!strcmp(s->name, name)) { | ||
99 | pr_err("%s (%s): Cache name already exists.\n", | ||
100 | __func__, name); | ||
101 | dump_stack(); | ||
102 | s = NULL; | ||
103 | return -EINVAL; | ||
104 | } | ||
105 | #endif | ||
106 | } | 96 | } |
107 | 97 | ||
108 | WARN_ON(strchr(name, ' ')); /* It confuses parsers */ | 98 | WARN_ON(strchr(name, ' ')); /* It confuses parsers */ |
@@ -269,6 +259,10 @@ struct kmem_cache *find_mergeable(size_t size, size_t align, | |||
269 | if (s->size - size >= sizeof(void *)) | 259 | if (s->size - size >= sizeof(void *)) |
270 | continue; | 260 | continue; |
271 | 261 | ||
262 | if (IS_ENABLED(CONFIG_SLAB) && align && | ||
263 | (align > s->align || s->align % align)) | ||
264 | continue; | ||
265 | |||
272 | return s; | 266 | return s; |
273 | } | 267 | } |
274 | return NULL; | 268 | return NULL; |
diff --git a/mm/truncate.c b/mm/truncate.c index 261eaf6e5a19..f1e4d6052369 100644 --- a/mm/truncate.c +++ b/mm/truncate.c | |||
@@ -715,8 +715,9 @@ EXPORT_SYMBOL(truncate_pagecache); | |||
715 | * necessary) to @newsize. It will be typically be called from the filesystem's | 715 | * necessary) to @newsize. It will be typically be called from the filesystem's |
716 | * setattr function when ATTR_SIZE is passed in. | 716 | * setattr function when ATTR_SIZE is passed in. |
717 | * | 717 | * |
718 | * Must be called with inode_mutex held and before all filesystem specific | 718 | * Must be called with a lock serializing truncates and writes (generally |
719 | * block truncation has been performed. | 719 | * i_mutex but e.g. xfs uses a different lock) and before all filesystem |
720 | * specific block truncation has been performed. | ||
720 | */ | 721 | */ |
721 | void truncate_setsize(struct inode *inode, loff_t newsize) | 722 | void truncate_setsize(struct inode *inode, loff_t newsize) |
722 | { | 723 | { |
@@ -755,7 +756,6 @@ void pagecache_isize_extended(struct inode *inode, loff_t from, loff_t to) | |||
755 | struct page *page; | 756 | struct page *page; |
756 | pgoff_t index; | 757 | pgoff_t index; |
757 | 758 | ||
758 | WARN_ON(!mutex_is_locked(&inode->i_mutex)); | ||
759 | WARN_ON(to > inode->i_size); | 759 | WARN_ON(to > inode->i_size); |
760 | 760 | ||
761 | if (from >= to || bsize == PAGE_CACHE_SIZE) | 761 | if (from >= to || bsize == PAGE_CACHE_SIZE) |
diff --git a/net/Kconfig b/net/Kconfig index 6272420a721b..99815b5454bf 100644 --- a/net/Kconfig +++ b/net/Kconfig | |||
@@ -6,7 +6,7 @@ menuconfig NET | |||
6 | bool "Networking support" | 6 | bool "Networking support" |
7 | select NLATTR | 7 | select NLATTR |
8 | select GENERIC_NET_UTILS | 8 | select GENERIC_NET_UTILS |
9 | select ANON_INODES | 9 | select BPF |
10 | ---help--- | 10 | ---help--- |
11 | Unless you really know what you are doing, you should say Y here. | 11 | Unless you really know what you are doing, you should say Y here. |
12 | The reason is that some programs need kernel networking support even | 12 | The reason is that some programs need kernel networking support even |
diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c index 992ec49a96aa..44cb786b925a 100644 --- a/net/bridge/br_forward.c +++ b/net/bridge/br_forward.c | |||
@@ -112,6 +112,7 @@ void br_deliver(const struct net_bridge_port *to, struct sk_buff *skb) | |||
112 | 112 | ||
113 | kfree_skb(skb); | 113 | kfree_skb(skb); |
114 | } | 114 | } |
115 | EXPORT_SYMBOL_GPL(br_deliver); | ||
115 | 116 | ||
116 | /* called with rcu_read_lock */ | 117 | /* called with rcu_read_lock */ |
117 | void br_forward(const struct net_bridge_port *to, struct sk_buff *skb, struct sk_buff *skb0) | 118 | void br_forward(const struct net_bridge_port *to, struct sk_buff *skb, struct sk_buff *skb0) |
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c index 1bada53bb195..1a4f32c09ad5 100644 --- a/net/bridge/br_netfilter.c +++ b/net/bridge/br_netfilter.c | |||
@@ -192,7 +192,6 @@ static inline void nf_bridge_save_header(struct sk_buff *skb) | |||
192 | 192 | ||
193 | static int br_parse_ip_options(struct sk_buff *skb) | 193 | static int br_parse_ip_options(struct sk_buff *skb) |
194 | { | 194 | { |
195 | struct ip_options *opt; | ||
196 | const struct iphdr *iph; | 195 | const struct iphdr *iph; |
197 | struct net_device *dev = skb->dev; | 196 | struct net_device *dev = skb->dev; |
198 | u32 len; | 197 | u32 len; |
@@ -201,7 +200,6 @@ static int br_parse_ip_options(struct sk_buff *skb) | |||
201 | goto inhdr_error; | 200 | goto inhdr_error; |
202 | 201 | ||
203 | iph = ip_hdr(skb); | 202 | iph = ip_hdr(skb); |
204 | opt = &(IPCB(skb)->opt); | ||
205 | 203 | ||
206 | /* Basic sanity checks */ | 204 | /* Basic sanity checks */ |
207 | if (iph->ihl < 5 || iph->version != 4) | 205 | if (iph->ihl < 5 || iph->version != 4) |
@@ -227,23 +225,11 @@ static int br_parse_ip_options(struct sk_buff *skb) | |||
227 | } | 225 | } |
228 | 226 | ||
229 | memset(IPCB(skb), 0, sizeof(struct inet_skb_parm)); | 227 | memset(IPCB(skb), 0, sizeof(struct inet_skb_parm)); |
230 | if (iph->ihl == 5) | 228 | /* We should really parse IP options here but until |
231 | return 0; | 229 | * somebody who actually uses IP options complains to |
232 | 230 | * us we'll just silently ignore the options because | |
233 | opt->optlen = iph->ihl*4 - sizeof(struct iphdr); | 231 | * we're lazy! |
234 | if (ip_options_compile(dev_net(dev), opt, skb)) | 232 | */ |
235 | goto inhdr_error; | ||
236 | |||
237 | /* Check correct handling of SRR option */ | ||
238 | if (unlikely(opt->srr)) { | ||
239 | struct in_device *in_dev = __in_dev_get_rcu(dev); | ||
240 | if (in_dev && !IN_DEV_SOURCE_ROUTE(in_dev)) | ||
241 | goto drop; | ||
242 | |||
243 | if (ip_options_rcv_srr(skb)) | ||
244 | goto drop; | ||
245 | } | ||
246 | |||
247 | return 0; | 233 | return 0; |
248 | 234 | ||
249 | inhdr_error: | 235 | inhdr_error: |
diff --git a/net/bridge/netfilter/nf_tables_bridge.c b/net/bridge/netfilter/nf_tables_bridge.c index da17a5eab8b4..074c557ab505 100644 --- a/net/bridge/netfilter/nf_tables_bridge.c +++ b/net/bridge/netfilter/nf_tables_bridge.c | |||
@@ -75,9 +75,11 @@ static const struct nf_chain_type filter_bridge = { | |||
75 | .type = NFT_CHAIN_T_DEFAULT, | 75 | .type = NFT_CHAIN_T_DEFAULT, |
76 | .family = NFPROTO_BRIDGE, | 76 | .family = NFPROTO_BRIDGE, |
77 | .owner = THIS_MODULE, | 77 | .owner = THIS_MODULE, |
78 | .hook_mask = (1 << NF_BR_LOCAL_IN) | | 78 | .hook_mask = (1 << NF_BR_PRE_ROUTING) | |
79 | (1 << NF_BR_LOCAL_IN) | | ||
79 | (1 << NF_BR_FORWARD) | | 80 | (1 << NF_BR_FORWARD) | |
80 | (1 << NF_BR_LOCAL_OUT), | 81 | (1 << NF_BR_LOCAL_OUT) | |
82 | (1 << NF_BR_POST_ROUTING), | ||
81 | }; | 83 | }; |
82 | 84 | ||
83 | static int __init nf_tables_bridge_init(void) | 85 | static int __init nf_tables_bridge_init(void) |
diff --git a/net/bridge/netfilter/nft_reject_bridge.c b/net/bridge/netfilter/nft_reject_bridge.c index a76479535df2..48da2c54a69e 100644 --- a/net/bridge/netfilter/nft_reject_bridge.c +++ b/net/bridge/netfilter/nft_reject_bridge.c | |||
@@ -16,6 +16,239 @@ | |||
16 | #include <net/netfilter/nft_reject.h> | 16 | #include <net/netfilter/nft_reject.h> |
17 | #include <net/netfilter/ipv4/nf_reject.h> | 17 | #include <net/netfilter/ipv4/nf_reject.h> |
18 | #include <net/netfilter/ipv6/nf_reject.h> | 18 | #include <net/netfilter/ipv6/nf_reject.h> |
19 | #include <linux/ip.h> | ||
20 | #include <net/ip.h> | ||
21 | #include <net/ip6_checksum.h> | ||
22 | #include <linux/netfilter_bridge.h> | ||
23 | #include "../br_private.h" | ||
24 | |||
25 | static void nft_reject_br_push_etherhdr(struct sk_buff *oldskb, | ||
26 | struct sk_buff *nskb) | ||
27 | { | ||
28 | struct ethhdr *eth; | ||
29 | |||
30 | eth = (struct ethhdr *)skb_push(nskb, ETH_HLEN); | ||
31 | skb_reset_mac_header(nskb); | ||
32 | ether_addr_copy(eth->h_source, eth_hdr(oldskb)->h_dest); | ||
33 | ether_addr_copy(eth->h_dest, eth_hdr(oldskb)->h_source); | ||
34 | eth->h_proto = eth_hdr(oldskb)->h_proto; | ||
35 | skb_pull(nskb, ETH_HLEN); | ||
36 | } | ||
37 | |||
38 | static int nft_reject_iphdr_validate(struct sk_buff *oldskb) | ||
39 | { | ||
40 | struct iphdr *iph; | ||
41 | u32 len; | ||
42 | |||
43 | if (!pskb_may_pull(oldskb, sizeof(struct iphdr))) | ||
44 | return 0; | ||
45 | |||
46 | iph = ip_hdr(oldskb); | ||
47 | if (iph->ihl < 5 || iph->version != 4) | ||
48 | return 0; | ||
49 | |||
50 | len = ntohs(iph->tot_len); | ||
51 | if (oldskb->len < len) | ||
52 | return 0; | ||
53 | else if (len < (iph->ihl*4)) | ||
54 | return 0; | ||
55 | |||
56 | if (!pskb_may_pull(oldskb, iph->ihl*4)) | ||
57 | return 0; | ||
58 | |||
59 | return 1; | ||
60 | } | ||
61 | |||
62 | static void nft_reject_br_send_v4_tcp_reset(struct sk_buff *oldskb, int hook) | ||
63 | { | ||
64 | struct sk_buff *nskb; | ||
65 | struct iphdr *niph; | ||
66 | const struct tcphdr *oth; | ||
67 | struct tcphdr _oth; | ||
68 | |||
69 | if (!nft_reject_iphdr_validate(oldskb)) | ||
70 | return; | ||
71 | |||
72 | oth = nf_reject_ip_tcphdr_get(oldskb, &_oth, hook); | ||
73 | if (!oth) | ||
74 | return; | ||
75 | |||
76 | nskb = alloc_skb(sizeof(struct iphdr) + sizeof(struct tcphdr) + | ||
77 | LL_MAX_HEADER, GFP_ATOMIC); | ||
78 | if (!nskb) | ||
79 | return; | ||
80 | |||
81 | skb_reserve(nskb, LL_MAX_HEADER); | ||
82 | niph = nf_reject_iphdr_put(nskb, oldskb, IPPROTO_TCP, | ||
83 | sysctl_ip_default_ttl); | ||
84 | nf_reject_ip_tcphdr_put(nskb, oldskb, oth); | ||
85 | niph->ttl = sysctl_ip_default_ttl; | ||
86 | niph->tot_len = htons(nskb->len); | ||
87 | ip_send_check(niph); | ||
88 | |||
89 | nft_reject_br_push_etherhdr(oldskb, nskb); | ||
90 | |||
91 | br_deliver(br_port_get_rcu(oldskb->dev), nskb); | ||
92 | } | ||
93 | |||
94 | static void nft_reject_br_send_v4_unreach(struct sk_buff *oldskb, int hook, | ||
95 | u8 code) | ||
96 | { | ||
97 | struct sk_buff *nskb; | ||
98 | struct iphdr *niph; | ||
99 | struct icmphdr *icmph; | ||
100 | unsigned int len; | ||
101 | void *payload; | ||
102 | __wsum csum; | ||
103 | |||
104 | if (!nft_reject_iphdr_validate(oldskb)) | ||
105 | return; | ||
106 | |||
107 | /* IP header checks: fragment. */ | ||
108 | if (ip_hdr(oldskb)->frag_off & htons(IP_OFFSET)) | ||
109 | return; | ||
110 | |||
111 | /* RFC says return as much as we can without exceeding 576 bytes. */ | ||
112 | len = min_t(unsigned int, 536, oldskb->len); | ||
113 | |||
114 | if (!pskb_may_pull(oldskb, len)) | ||
115 | return; | ||
116 | |||
117 | if (nf_ip_checksum(oldskb, hook, ip_hdrlen(oldskb), 0)) | ||
118 | return; | ||
119 | |||
120 | nskb = alloc_skb(sizeof(struct iphdr) + sizeof(struct icmphdr) + | ||
121 | LL_MAX_HEADER + len, GFP_ATOMIC); | ||
122 | if (!nskb) | ||
123 | return; | ||
124 | |||
125 | skb_reserve(nskb, LL_MAX_HEADER); | ||
126 | niph = nf_reject_iphdr_put(nskb, oldskb, IPPROTO_ICMP, | ||
127 | sysctl_ip_default_ttl); | ||
128 | |||
129 | skb_reset_transport_header(nskb); | ||
130 | icmph = (struct icmphdr *)skb_put(nskb, sizeof(struct icmphdr)); | ||
131 | memset(icmph, 0, sizeof(*icmph)); | ||
132 | icmph->type = ICMP_DEST_UNREACH; | ||
133 | icmph->code = code; | ||
134 | |||
135 | payload = skb_put(nskb, len); | ||
136 | memcpy(payload, skb_network_header(oldskb), len); | ||
137 | |||
138 | csum = csum_partial((void *)icmph, len + sizeof(struct icmphdr), 0); | ||
139 | icmph->checksum = csum_fold(csum); | ||
140 | |||
141 | niph->tot_len = htons(nskb->len); | ||
142 | ip_send_check(niph); | ||
143 | |||
144 | nft_reject_br_push_etherhdr(oldskb, nskb); | ||
145 | |||
146 | br_deliver(br_port_get_rcu(oldskb->dev), nskb); | ||
147 | } | ||
148 | |||
149 | static int nft_reject_ip6hdr_validate(struct sk_buff *oldskb) | ||
150 | { | ||
151 | struct ipv6hdr *hdr; | ||
152 | u32 pkt_len; | ||
153 | |||
154 | if (!pskb_may_pull(oldskb, sizeof(struct ipv6hdr))) | ||
155 | return 0; | ||
156 | |||
157 | hdr = ipv6_hdr(oldskb); | ||
158 | if (hdr->version != 6) | ||
159 | return 0; | ||
160 | |||
161 | pkt_len = ntohs(hdr->payload_len); | ||
162 | if (pkt_len + sizeof(struct ipv6hdr) > oldskb->len) | ||
163 | return 0; | ||
164 | |||
165 | return 1; | ||
166 | } | ||
167 | |||
168 | static void nft_reject_br_send_v6_tcp_reset(struct net *net, | ||
169 | struct sk_buff *oldskb, int hook) | ||
170 | { | ||
171 | struct sk_buff *nskb; | ||
172 | const struct tcphdr *oth; | ||
173 | struct tcphdr _oth; | ||
174 | unsigned int otcplen; | ||
175 | struct ipv6hdr *nip6h; | ||
176 | |||
177 | if (!nft_reject_ip6hdr_validate(oldskb)) | ||
178 | return; | ||
179 | |||
180 | oth = nf_reject_ip6_tcphdr_get(oldskb, &_oth, &otcplen, hook); | ||
181 | if (!oth) | ||
182 | return; | ||
183 | |||
184 | nskb = alloc_skb(sizeof(struct ipv6hdr) + sizeof(struct tcphdr) + | ||
185 | LL_MAX_HEADER, GFP_ATOMIC); | ||
186 | if (!nskb) | ||
187 | return; | ||
188 | |||
189 | skb_reserve(nskb, LL_MAX_HEADER); | ||
190 | nip6h = nf_reject_ip6hdr_put(nskb, oldskb, IPPROTO_TCP, | ||
191 | net->ipv6.devconf_all->hop_limit); | ||
192 | nf_reject_ip6_tcphdr_put(nskb, oldskb, oth, otcplen); | ||
193 | nip6h->payload_len = htons(nskb->len - sizeof(struct ipv6hdr)); | ||
194 | |||
195 | nft_reject_br_push_etherhdr(oldskb, nskb); | ||
196 | |||
197 | br_deliver(br_port_get_rcu(oldskb->dev), nskb); | ||
198 | } | ||
199 | |||
200 | static void nft_reject_br_send_v6_unreach(struct net *net, | ||
201 | struct sk_buff *oldskb, int hook, | ||
202 | u8 code) | ||
203 | { | ||
204 | struct sk_buff *nskb; | ||
205 | struct ipv6hdr *nip6h; | ||
206 | struct icmp6hdr *icmp6h; | ||
207 | unsigned int len; | ||
208 | void *payload; | ||
209 | |||
210 | if (!nft_reject_ip6hdr_validate(oldskb)) | ||
211 | return; | ||
212 | |||
213 | /* Include "As much of invoking packet as possible without the ICMPv6 | ||
214 | * packet exceeding the minimum IPv6 MTU" in the ICMP payload. | ||
215 | */ | ||
216 | len = min_t(unsigned int, 1220, oldskb->len); | ||
217 | |||
218 | if (!pskb_may_pull(oldskb, len)) | ||
219 | return; | ||
220 | |||
221 | nskb = alloc_skb(sizeof(struct iphdr) + sizeof(struct icmp6hdr) + | ||
222 | LL_MAX_HEADER + len, GFP_ATOMIC); | ||
223 | if (!nskb) | ||
224 | return; | ||
225 | |||
226 | skb_reserve(nskb, LL_MAX_HEADER); | ||
227 | nip6h = nf_reject_ip6hdr_put(nskb, oldskb, IPPROTO_ICMPV6, | ||
228 | net->ipv6.devconf_all->hop_limit); | ||
229 | |||
230 | skb_reset_transport_header(nskb); | ||
231 | icmp6h = (struct icmp6hdr *)skb_put(nskb, sizeof(struct icmp6hdr)); | ||
232 | memset(icmp6h, 0, sizeof(*icmp6h)); | ||
233 | icmp6h->icmp6_type = ICMPV6_DEST_UNREACH; | ||
234 | icmp6h->icmp6_code = code; | ||
235 | |||
236 | payload = skb_put(nskb, len); | ||
237 | memcpy(payload, skb_network_header(oldskb), len); | ||
238 | nip6h->payload_len = htons(nskb->len - sizeof(struct ipv6hdr)); | ||
239 | |||
240 | icmp6h->icmp6_cksum = | ||
241 | csum_ipv6_magic(&nip6h->saddr, &nip6h->daddr, | ||
242 | nskb->len - sizeof(struct ipv6hdr), | ||
243 | IPPROTO_ICMPV6, | ||
244 | csum_partial(icmp6h, | ||
245 | nskb->len - sizeof(struct ipv6hdr), | ||
246 | 0)); | ||
247 | |||
248 | nft_reject_br_push_etherhdr(oldskb, nskb); | ||
249 | |||
250 | br_deliver(br_port_get_rcu(oldskb->dev), nskb); | ||
251 | } | ||
19 | 252 | ||
20 | static void nft_reject_bridge_eval(const struct nft_expr *expr, | 253 | static void nft_reject_bridge_eval(const struct nft_expr *expr, |
21 | struct nft_data data[NFT_REG_MAX + 1], | 254 | struct nft_data data[NFT_REG_MAX + 1], |
@@ -23,35 +256,46 @@ static void nft_reject_bridge_eval(const struct nft_expr *expr, | |||
23 | { | 256 | { |
24 | struct nft_reject *priv = nft_expr_priv(expr); | 257 | struct nft_reject *priv = nft_expr_priv(expr); |
25 | struct net *net = dev_net((pkt->in != NULL) ? pkt->in : pkt->out); | 258 | struct net *net = dev_net((pkt->in != NULL) ? pkt->in : pkt->out); |
259 | const unsigned char *dest = eth_hdr(pkt->skb)->h_dest; | ||
260 | |||
261 | if (is_broadcast_ether_addr(dest) || | ||
262 | is_multicast_ether_addr(dest)) | ||
263 | goto out; | ||
26 | 264 | ||
27 | switch (eth_hdr(pkt->skb)->h_proto) { | 265 | switch (eth_hdr(pkt->skb)->h_proto) { |
28 | case htons(ETH_P_IP): | 266 | case htons(ETH_P_IP): |
29 | switch (priv->type) { | 267 | switch (priv->type) { |
30 | case NFT_REJECT_ICMP_UNREACH: | 268 | case NFT_REJECT_ICMP_UNREACH: |
31 | nf_send_unreach(pkt->skb, priv->icmp_code); | 269 | nft_reject_br_send_v4_unreach(pkt->skb, |
270 | pkt->ops->hooknum, | ||
271 | priv->icmp_code); | ||
32 | break; | 272 | break; |
33 | case NFT_REJECT_TCP_RST: | 273 | case NFT_REJECT_TCP_RST: |
34 | nf_send_reset(pkt->skb, pkt->ops->hooknum); | 274 | nft_reject_br_send_v4_tcp_reset(pkt->skb, |
275 | pkt->ops->hooknum); | ||
35 | break; | 276 | break; |
36 | case NFT_REJECT_ICMPX_UNREACH: | 277 | case NFT_REJECT_ICMPX_UNREACH: |
37 | nf_send_unreach(pkt->skb, | 278 | nft_reject_br_send_v4_unreach(pkt->skb, |
38 | nft_reject_icmp_code(priv->icmp_code)); | 279 | pkt->ops->hooknum, |
280 | nft_reject_icmp_code(priv->icmp_code)); | ||
39 | break; | 281 | break; |
40 | } | 282 | } |
41 | break; | 283 | break; |
42 | case htons(ETH_P_IPV6): | 284 | case htons(ETH_P_IPV6): |
43 | switch (priv->type) { | 285 | switch (priv->type) { |
44 | case NFT_REJECT_ICMP_UNREACH: | 286 | case NFT_REJECT_ICMP_UNREACH: |
45 | nf_send_unreach6(net, pkt->skb, priv->icmp_code, | 287 | nft_reject_br_send_v6_unreach(net, pkt->skb, |
46 | pkt->ops->hooknum); | 288 | pkt->ops->hooknum, |
289 | priv->icmp_code); | ||
47 | break; | 290 | break; |
48 | case NFT_REJECT_TCP_RST: | 291 | case NFT_REJECT_TCP_RST: |
49 | nf_send_reset6(net, pkt->skb, pkt->ops->hooknum); | 292 | nft_reject_br_send_v6_tcp_reset(net, pkt->skb, |
293 | pkt->ops->hooknum); | ||
50 | break; | 294 | break; |
51 | case NFT_REJECT_ICMPX_UNREACH: | 295 | case NFT_REJECT_ICMPX_UNREACH: |
52 | nf_send_unreach6(net, pkt->skb, | 296 | nft_reject_br_send_v6_unreach(net, pkt->skb, |
53 | nft_reject_icmpv6_code(priv->icmp_code), | 297 | pkt->ops->hooknum, |
54 | pkt->ops->hooknum); | 298 | nft_reject_icmpv6_code(priv->icmp_code)); |
55 | break; | 299 | break; |
56 | } | 300 | } |
57 | break; | 301 | break; |
@@ -59,15 +303,38 @@ static void nft_reject_bridge_eval(const struct nft_expr *expr, | |||
59 | /* No explicit way to reject this protocol, drop it. */ | 303 | /* No explicit way to reject this protocol, drop it. */ |
60 | break; | 304 | break; |
61 | } | 305 | } |
306 | out: | ||
62 | data[NFT_REG_VERDICT].verdict = NF_DROP; | 307 | data[NFT_REG_VERDICT].verdict = NF_DROP; |
63 | } | 308 | } |
64 | 309 | ||
310 | static int nft_reject_bridge_validate_hooks(const struct nft_chain *chain) | ||
311 | { | ||
312 | struct nft_base_chain *basechain; | ||
313 | |||
314 | if (chain->flags & NFT_BASE_CHAIN) { | ||
315 | basechain = nft_base_chain(chain); | ||
316 | |||
317 | switch (basechain->ops[0].hooknum) { | ||
318 | case NF_BR_PRE_ROUTING: | ||
319 | case NF_BR_LOCAL_IN: | ||
320 | break; | ||
321 | default: | ||
322 | return -EOPNOTSUPP; | ||
323 | } | ||
324 | } | ||
325 | return 0; | ||
326 | } | ||
327 | |||
65 | static int nft_reject_bridge_init(const struct nft_ctx *ctx, | 328 | static int nft_reject_bridge_init(const struct nft_ctx *ctx, |
66 | const struct nft_expr *expr, | 329 | const struct nft_expr *expr, |
67 | const struct nlattr * const tb[]) | 330 | const struct nlattr * const tb[]) |
68 | { | 331 | { |
69 | struct nft_reject *priv = nft_expr_priv(expr); | 332 | struct nft_reject *priv = nft_expr_priv(expr); |
70 | int icmp_code; | 333 | int icmp_code, err; |
334 | |||
335 | err = nft_reject_bridge_validate_hooks(ctx->chain); | ||
336 | if (err < 0) | ||
337 | return err; | ||
71 | 338 | ||
72 | if (tb[NFTA_REJECT_TYPE] == NULL) | 339 | if (tb[NFTA_REJECT_TYPE] == NULL) |
73 | return -EINVAL; | 340 | return -EINVAL; |
@@ -116,6 +383,13 @@ nla_put_failure: | |||
116 | return -1; | 383 | return -1; |
117 | } | 384 | } |
118 | 385 | ||
386 | static int nft_reject_bridge_validate(const struct nft_ctx *ctx, | ||
387 | const struct nft_expr *expr, | ||
388 | const struct nft_data **data) | ||
389 | { | ||
390 | return nft_reject_bridge_validate_hooks(ctx->chain); | ||
391 | } | ||
392 | |||
119 | static struct nft_expr_type nft_reject_bridge_type; | 393 | static struct nft_expr_type nft_reject_bridge_type; |
120 | static const struct nft_expr_ops nft_reject_bridge_ops = { | 394 | static const struct nft_expr_ops nft_reject_bridge_ops = { |
121 | .type = &nft_reject_bridge_type, | 395 | .type = &nft_reject_bridge_type, |
@@ -123,6 +397,7 @@ static const struct nft_expr_ops nft_reject_bridge_ops = { | |||
123 | .eval = nft_reject_bridge_eval, | 397 | .eval = nft_reject_bridge_eval, |
124 | .init = nft_reject_bridge_init, | 398 | .init = nft_reject_bridge_init, |
125 | .dump = nft_reject_bridge_dump, | 399 | .dump = nft_reject_bridge_dump, |
400 | .validate = nft_reject_bridge_validate, | ||
126 | }; | 401 | }; |
127 | 402 | ||
128 | static struct nft_expr_type nft_reject_bridge_type __read_mostly = { | 403 | static struct nft_expr_type nft_reject_bridge_type __read_mostly = { |
diff --git a/net/ceph/auth_x.c b/net/ceph/auth_x.c index de6662b14e1f..7e38b729696a 100644 --- a/net/ceph/auth_x.c +++ b/net/ceph/auth_x.c | |||
@@ -149,6 +149,7 @@ static int process_one_ticket(struct ceph_auth_client *ac, | |||
149 | struct ceph_crypto_key old_key; | 149 | struct ceph_crypto_key old_key; |
150 | void *ticket_buf = NULL; | 150 | void *ticket_buf = NULL; |
151 | void *tp, *tpend; | 151 | void *tp, *tpend; |
152 | void **ptp; | ||
152 | struct ceph_timespec new_validity; | 153 | struct ceph_timespec new_validity; |
153 | struct ceph_crypto_key new_session_key; | 154 | struct ceph_crypto_key new_session_key; |
154 | struct ceph_buffer *new_ticket_blob; | 155 | struct ceph_buffer *new_ticket_blob; |
@@ -208,25 +209,19 @@ static int process_one_ticket(struct ceph_auth_client *ac, | |||
208 | goto out; | 209 | goto out; |
209 | } | 210 | } |
210 | tp = ticket_buf; | 211 | tp = ticket_buf; |
211 | dlen = ceph_decode_32(&tp); | 212 | ptp = &tp; |
213 | tpend = *ptp + dlen; | ||
212 | } else { | 214 | } else { |
213 | /* unencrypted */ | 215 | /* unencrypted */ |
214 | ceph_decode_32_safe(p, end, dlen, bad); | 216 | ptp = p; |
215 | ticket_buf = kmalloc(dlen, GFP_NOFS); | 217 | tpend = end; |
216 | if (!ticket_buf) { | ||
217 | ret = -ENOMEM; | ||
218 | goto out; | ||
219 | } | ||
220 | tp = ticket_buf; | ||
221 | ceph_decode_need(p, end, dlen, bad); | ||
222 | ceph_decode_copy(p, ticket_buf, dlen); | ||
223 | } | 218 | } |
224 | tpend = tp + dlen; | 219 | ceph_decode_32_safe(ptp, tpend, dlen, bad); |
225 | dout(" ticket blob is %d bytes\n", dlen); | 220 | dout(" ticket blob is %d bytes\n", dlen); |
226 | ceph_decode_need(&tp, tpend, 1 + sizeof(u64), bad); | 221 | ceph_decode_need(ptp, tpend, 1 + sizeof(u64), bad); |
227 | blob_struct_v = ceph_decode_8(&tp); | 222 | blob_struct_v = ceph_decode_8(ptp); |
228 | new_secret_id = ceph_decode_64(&tp); | 223 | new_secret_id = ceph_decode_64(ptp); |
229 | ret = ceph_decode_buffer(&new_ticket_blob, &tp, tpend); | 224 | ret = ceph_decode_buffer(&new_ticket_blob, ptp, tpend); |
230 | if (ret) | 225 | if (ret) |
231 | goto out; | 226 | goto out; |
232 | 227 | ||
diff --git a/net/ceph/crypto.c b/net/ceph/crypto.c index 62fc5e7a9acf..790fe89d90c0 100644 --- a/net/ceph/crypto.c +++ b/net/ceph/crypto.c | |||
@@ -90,11 +90,82 @@ static struct crypto_blkcipher *ceph_crypto_alloc_cipher(void) | |||
90 | 90 | ||
91 | static const u8 *aes_iv = (u8 *)CEPH_AES_IV; | 91 | static const u8 *aes_iv = (u8 *)CEPH_AES_IV; |
92 | 92 | ||
93 | /* | ||
94 | * Should be used for buffers allocated with ceph_kvmalloc(). | ||
95 | * Currently these are encrypt out-buffer (ceph_buffer) and decrypt | ||
96 | * in-buffer (msg front). | ||
97 | * | ||
98 | * Dispose of @sgt with teardown_sgtable(). | ||
99 | * | ||
100 | * @prealloc_sg is to avoid memory allocation inside sg_alloc_table() | ||
101 | * in cases where a single sg is sufficient. No attempt to reduce the | ||
102 | * number of sgs by squeezing physically contiguous pages together is | ||
103 | * made though, for simplicity. | ||
104 | */ | ||
105 | static int setup_sgtable(struct sg_table *sgt, struct scatterlist *prealloc_sg, | ||
106 | const void *buf, unsigned int buf_len) | ||
107 | { | ||
108 | struct scatterlist *sg; | ||
109 | const bool is_vmalloc = is_vmalloc_addr(buf); | ||
110 | unsigned int off = offset_in_page(buf); | ||
111 | unsigned int chunk_cnt = 1; | ||
112 | unsigned int chunk_len = PAGE_ALIGN(off + buf_len); | ||
113 | int i; | ||
114 | int ret; | ||
115 | |||
116 | if (buf_len == 0) { | ||
117 | memset(sgt, 0, sizeof(*sgt)); | ||
118 | return -EINVAL; | ||
119 | } | ||
120 | |||
121 | if (is_vmalloc) { | ||
122 | chunk_cnt = chunk_len >> PAGE_SHIFT; | ||
123 | chunk_len = PAGE_SIZE; | ||
124 | } | ||
125 | |||
126 | if (chunk_cnt > 1) { | ||
127 | ret = sg_alloc_table(sgt, chunk_cnt, GFP_NOFS); | ||
128 | if (ret) | ||
129 | return ret; | ||
130 | } else { | ||
131 | WARN_ON(chunk_cnt != 1); | ||
132 | sg_init_table(prealloc_sg, 1); | ||
133 | sgt->sgl = prealloc_sg; | ||
134 | sgt->nents = sgt->orig_nents = 1; | ||
135 | } | ||
136 | |||
137 | for_each_sg(sgt->sgl, sg, sgt->orig_nents, i) { | ||
138 | struct page *page; | ||
139 | unsigned int len = min(chunk_len - off, buf_len); | ||
140 | |||
141 | if (is_vmalloc) | ||
142 | page = vmalloc_to_page(buf); | ||
143 | else | ||
144 | page = virt_to_page(buf); | ||
145 | |||
146 | sg_set_page(sg, page, len, off); | ||
147 | |||
148 | off = 0; | ||
149 | buf += len; | ||
150 | buf_len -= len; | ||
151 | } | ||
152 | WARN_ON(buf_len != 0); | ||
153 | |||
154 | return 0; | ||
155 | } | ||
156 | |||
157 | static void teardown_sgtable(struct sg_table *sgt) | ||
158 | { | ||
159 | if (sgt->orig_nents > 1) | ||
160 | sg_free_table(sgt); | ||
161 | } | ||
162 | |||
93 | static int ceph_aes_encrypt(const void *key, int key_len, | 163 | static int ceph_aes_encrypt(const void *key, int key_len, |
94 | void *dst, size_t *dst_len, | 164 | void *dst, size_t *dst_len, |
95 | const void *src, size_t src_len) | 165 | const void *src, size_t src_len) |
96 | { | 166 | { |
97 | struct scatterlist sg_in[2], sg_out[1]; | 167 | struct scatterlist sg_in[2], prealloc_sg; |
168 | struct sg_table sg_out; | ||
98 | struct crypto_blkcipher *tfm = ceph_crypto_alloc_cipher(); | 169 | struct crypto_blkcipher *tfm = ceph_crypto_alloc_cipher(); |
99 | struct blkcipher_desc desc = { .tfm = tfm, .flags = 0 }; | 170 | struct blkcipher_desc desc = { .tfm = tfm, .flags = 0 }; |
100 | int ret; | 171 | int ret; |
@@ -110,16 +181,18 @@ static int ceph_aes_encrypt(const void *key, int key_len, | |||
110 | 181 | ||
111 | *dst_len = src_len + zero_padding; | 182 | *dst_len = src_len + zero_padding; |
112 | 183 | ||
113 | crypto_blkcipher_setkey((void *)tfm, key, key_len); | ||
114 | sg_init_table(sg_in, 2); | 184 | sg_init_table(sg_in, 2); |
115 | sg_set_buf(&sg_in[0], src, src_len); | 185 | sg_set_buf(&sg_in[0], src, src_len); |
116 | sg_set_buf(&sg_in[1], pad, zero_padding); | 186 | sg_set_buf(&sg_in[1], pad, zero_padding); |
117 | sg_init_table(sg_out, 1); | 187 | ret = setup_sgtable(&sg_out, &prealloc_sg, dst, *dst_len); |
118 | sg_set_buf(sg_out, dst, *dst_len); | 188 | if (ret) |
189 | goto out_tfm; | ||
190 | |||
191 | crypto_blkcipher_setkey((void *)tfm, key, key_len); | ||
119 | iv = crypto_blkcipher_crt(tfm)->iv; | 192 | iv = crypto_blkcipher_crt(tfm)->iv; |
120 | ivsize = crypto_blkcipher_ivsize(tfm); | 193 | ivsize = crypto_blkcipher_ivsize(tfm); |
121 | |||
122 | memcpy(iv, aes_iv, ivsize); | 194 | memcpy(iv, aes_iv, ivsize); |
195 | |||
123 | /* | 196 | /* |
124 | print_hex_dump(KERN_ERR, "enc key: ", DUMP_PREFIX_NONE, 16, 1, | 197 | print_hex_dump(KERN_ERR, "enc key: ", DUMP_PREFIX_NONE, 16, 1, |
125 | key, key_len, 1); | 198 | key, key_len, 1); |
@@ -128,16 +201,22 @@ static int ceph_aes_encrypt(const void *key, int key_len, | |||
128 | print_hex_dump(KERN_ERR, "enc pad: ", DUMP_PREFIX_NONE, 16, 1, | 201 | print_hex_dump(KERN_ERR, "enc pad: ", DUMP_PREFIX_NONE, 16, 1, |
129 | pad, zero_padding, 1); | 202 | pad, zero_padding, 1); |
130 | */ | 203 | */ |
131 | ret = crypto_blkcipher_encrypt(&desc, sg_out, sg_in, | 204 | ret = crypto_blkcipher_encrypt(&desc, sg_out.sgl, sg_in, |
132 | src_len + zero_padding); | 205 | src_len + zero_padding); |
133 | crypto_free_blkcipher(tfm); | 206 | if (ret < 0) { |
134 | if (ret < 0) | ||
135 | pr_err("ceph_aes_crypt failed %d\n", ret); | 207 | pr_err("ceph_aes_crypt failed %d\n", ret); |
208 | goto out_sg; | ||
209 | } | ||
136 | /* | 210 | /* |
137 | print_hex_dump(KERN_ERR, "enc out: ", DUMP_PREFIX_NONE, 16, 1, | 211 | print_hex_dump(KERN_ERR, "enc out: ", DUMP_PREFIX_NONE, 16, 1, |
138 | dst, *dst_len, 1); | 212 | dst, *dst_len, 1); |
139 | */ | 213 | */ |
140 | return 0; | 214 | |
215 | out_sg: | ||
216 | teardown_sgtable(&sg_out); | ||
217 | out_tfm: | ||
218 | crypto_free_blkcipher(tfm); | ||
219 | return ret; | ||
141 | } | 220 | } |
142 | 221 | ||
143 | static int ceph_aes_encrypt2(const void *key, int key_len, void *dst, | 222 | static int ceph_aes_encrypt2(const void *key, int key_len, void *dst, |
@@ -145,7 +224,8 @@ static int ceph_aes_encrypt2(const void *key, int key_len, void *dst, | |||
145 | const void *src1, size_t src1_len, | 224 | const void *src1, size_t src1_len, |
146 | const void *src2, size_t src2_len) | 225 | const void *src2, size_t src2_len) |
147 | { | 226 | { |
148 | struct scatterlist sg_in[3], sg_out[1]; | 227 | struct scatterlist sg_in[3], prealloc_sg; |
228 | struct sg_table sg_out; | ||
149 | struct crypto_blkcipher *tfm = ceph_crypto_alloc_cipher(); | 229 | struct crypto_blkcipher *tfm = ceph_crypto_alloc_cipher(); |
150 | struct blkcipher_desc desc = { .tfm = tfm, .flags = 0 }; | 230 | struct blkcipher_desc desc = { .tfm = tfm, .flags = 0 }; |
151 | int ret; | 231 | int ret; |
@@ -161,17 +241,19 @@ static int ceph_aes_encrypt2(const void *key, int key_len, void *dst, | |||
161 | 241 | ||
162 | *dst_len = src1_len + src2_len + zero_padding; | 242 | *dst_len = src1_len + src2_len + zero_padding; |
163 | 243 | ||
164 | crypto_blkcipher_setkey((void *)tfm, key, key_len); | ||
165 | sg_init_table(sg_in, 3); | 244 | sg_init_table(sg_in, 3); |
166 | sg_set_buf(&sg_in[0], src1, src1_len); | 245 | sg_set_buf(&sg_in[0], src1, src1_len); |
167 | sg_set_buf(&sg_in[1], src2, src2_len); | 246 | sg_set_buf(&sg_in[1], src2, src2_len); |
168 | sg_set_buf(&sg_in[2], pad, zero_padding); | 247 | sg_set_buf(&sg_in[2], pad, zero_padding); |
169 | sg_init_table(sg_out, 1); | 248 | ret = setup_sgtable(&sg_out, &prealloc_sg, dst, *dst_len); |
170 | sg_set_buf(sg_out, dst, *dst_len); | 249 | if (ret) |
250 | goto out_tfm; | ||
251 | |||
252 | crypto_blkcipher_setkey((void *)tfm, key, key_len); | ||
171 | iv = crypto_blkcipher_crt(tfm)->iv; | 253 | iv = crypto_blkcipher_crt(tfm)->iv; |
172 | ivsize = crypto_blkcipher_ivsize(tfm); | 254 | ivsize = crypto_blkcipher_ivsize(tfm); |
173 | |||
174 | memcpy(iv, aes_iv, ivsize); | 255 | memcpy(iv, aes_iv, ivsize); |
256 | |||
175 | /* | 257 | /* |
176 | print_hex_dump(KERN_ERR, "enc key: ", DUMP_PREFIX_NONE, 16, 1, | 258 | print_hex_dump(KERN_ERR, "enc key: ", DUMP_PREFIX_NONE, 16, 1, |
177 | key, key_len, 1); | 259 | key, key_len, 1); |
@@ -182,23 +264,30 @@ static int ceph_aes_encrypt2(const void *key, int key_len, void *dst, | |||
182 | print_hex_dump(KERN_ERR, "enc pad: ", DUMP_PREFIX_NONE, 16, 1, | 264 | print_hex_dump(KERN_ERR, "enc pad: ", DUMP_PREFIX_NONE, 16, 1, |
183 | pad, zero_padding, 1); | 265 | pad, zero_padding, 1); |
184 | */ | 266 | */ |
185 | ret = crypto_blkcipher_encrypt(&desc, sg_out, sg_in, | 267 | ret = crypto_blkcipher_encrypt(&desc, sg_out.sgl, sg_in, |
186 | src1_len + src2_len + zero_padding); | 268 | src1_len + src2_len + zero_padding); |
187 | crypto_free_blkcipher(tfm); | 269 | if (ret < 0) { |
188 | if (ret < 0) | ||
189 | pr_err("ceph_aes_crypt2 failed %d\n", ret); | 270 | pr_err("ceph_aes_crypt2 failed %d\n", ret); |
271 | goto out_sg; | ||
272 | } | ||
190 | /* | 273 | /* |
191 | print_hex_dump(KERN_ERR, "enc out: ", DUMP_PREFIX_NONE, 16, 1, | 274 | print_hex_dump(KERN_ERR, "enc out: ", DUMP_PREFIX_NONE, 16, 1, |
192 | dst, *dst_len, 1); | 275 | dst, *dst_len, 1); |
193 | */ | 276 | */ |
194 | return 0; | 277 | |
278 | out_sg: | ||
279 | teardown_sgtable(&sg_out); | ||
280 | out_tfm: | ||
281 | crypto_free_blkcipher(tfm); | ||
282 | return ret; | ||
195 | } | 283 | } |
196 | 284 | ||
197 | static int ceph_aes_decrypt(const void *key, int key_len, | 285 | static int ceph_aes_decrypt(const void *key, int key_len, |
198 | void *dst, size_t *dst_len, | 286 | void *dst, size_t *dst_len, |
199 | const void *src, size_t src_len) | 287 | const void *src, size_t src_len) |
200 | { | 288 | { |
201 | struct scatterlist sg_in[1], sg_out[2]; | 289 | struct sg_table sg_in; |
290 | struct scatterlist sg_out[2], prealloc_sg; | ||
202 | struct crypto_blkcipher *tfm = ceph_crypto_alloc_cipher(); | 291 | struct crypto_blkcipher *tfm = ceph_crypto_alloc_cipher(); |
203 | struct blkcipher_desc desc = { .tfm = tfm }; | 292 | struct blkcipher_desc desc = { .tfm = tfm }; |
204 | char pad[16]; | 293 | char pad[16]; |
@@ -210,16 +299,16 @@ static int ceph_aes_decrypt(const void *key, int key_len, | |||
210 | if (IS_ERR(tfm)) | 299 | if (IS_ERR(tfm)) |
211 | return PTR_ERR(tfm); | 300 | return PTR_ERR(tfm); |
212 | 301 | ||
213 | crypto_blkcipher_setkey((void *)tfm, key, key_len); | ||
214 | sg_init_table(sg_in, 1); | ||
215 | sg_init_table(sg_out, 2); | 302 | sg_init_table(sg_out, 2); |
216 | sg_set_buf(sg_in, src, src_len); | ||
217 | sg_set_buf(&sg_out[0], dst, *dst_len); | 303 | sg_set_buf(&sg_out[0], dst, *dst_len); |
218 | sg_set_buf(&sg_out[1], pad, sizeof(pad)); | 304 | sg_set_buf(&sg_out[1], pad, sizeof(pad)); |
305 | ret = setup_sgtable(&sg_in, &prealloc_sg, src, src_len); | ||
306 | if (ret) | ||
307 | goto out_tfm; | ||
219 | 308 | ||
309 | crypto_blkcipher_setkey((void *)tfm, key, key_len); | ||
220 | iv = crypto_blkcipher_crt(tfm)->iv; | 310 | iv = crypto_blkcipher_crt(tfm)->iv; |
221 | ivsize = crypto_blkcipher_ivsize(tfm); | 311 | ivsize = crypto_blkcipher_ivsize(tfm); |
222 | |||
223 | memcpy(iv, aes_iv, ivsize); | 312 | memcpy(iv, aes_iv, ivsize); |
224 | 313 | ||
225 | /* | 314 | /* |
@@ -228,12 +317,10 @@ static int ceph_aes_decrypt(const void *key, int key_len, | |||
228 | print_hex_dump(KERN_ERR, "dec in: ", DUMP_PREFIX_NONE, 16, 1, | 317 | print_hex_dump(KERN_ERR, "dec in: ", DUMP_PREFIX_NONE, 16, 1, |
229 | src, src_len, 1); | 318 | src, src_len, 1); |
230 | */ | 319 | */ |
231 | 320 | ret = crypto_blkcipher_decrypt(&desc, sg_out, sg_in.sgl, src_len); | |
232 | ret = crypto_blkcipher_decrypt(&desc, sg_out, sg_in, src_len); | ||
233 | crypto_free_blkcipher(tfm); | ||
234 | if (ret < 0) { | 321 | if (ret < 0) { |
235 | pr_err("ceph_aes_decrypt failed %d\n", ret); | 322 | pr_err("ceph_aes_decrypt failed %d\n", ret); |
236 | return ret; | 323 | goto out_sg; |
237 | } | 324 | } |
238 | 325 | ||
239 | if (src_len <= *dst_len) | 326 | if (src_len <= *dst_len) |
@@ -251,7 +338,12 @@ static int ceph_aes_decrypt(const void *key, int key_len, | |||
251 | print_hex_dump(KERN_ERR, "dec out: ", DUMP_PREFIX_NONE, 16, 1, | 338 | print_hex_dump(KERN_ERR, "dec out: ", DUMP_PREFIX_NONE, 16, 1, |
252 | dst, *dst_len, 1); | 339 | dst, *dst_len, 1); |
253 | */ | 340 | */ |
254 | return 0; | 341 | |
342 | out_sg: | ||
343 | teardown_sgtable(&sg_in); | ||
344 | out_tfm: | ||
345 | crypto_free_blkcipher(tfm); | ||
346 | return ret; | ||
255 | } | 347 | } |
256 | 348 | ||
257 | static int ceph_aes_decrypt2(const void *key, int key_len, | 349 | static int ceph_aes_decrypt2(const void *key, int key_len, |
@@ -259,7 +351,8 @@ static int ceph_aes_decrypt2(const void *key, int key_len, | |||
259 | void *dst2, size_t *dst2_len, | 351 | void *dst2, size_t *dst2_len, |
260 | const void *src, size_t src_len) | 352 | const void *src, size_t src_len) |
261 | { | 353 | { |
262 | struct scatterlist sg_in[1], sg_out[3]; | 354 | struct sg_table sg_in; |
355 | struct scatterlist sg_out[3], prealloc_sg; | ||
263 | struct crypto_blkcipher *tfm = ceph_crypto_alloc_cipher(); | 356 | struct crypto_blkcipher *tfm = ceph_crypto_alloc_cipher(); |
264 | struct blkcipher_desc desc = { .tfm = tfm }; | 357 | struct blkcipher_desc desc = { .tfm = tfm }; |
265 | char pad[16]; | 358 | char pad[16]; |
@@ -271,17 +364,17 @@ static int ceph_aes_decrypt2(const void *key, int key_len, | |||
271 | if (IS_ERR(tfm)) | 364 | if (IS_ERR(tfm)) |
272 | return PTR_ERR(tfm); | 365 | return PTR_ERR(tfm); |
273 | 366 | ||
274 | sg_init_table(sg_in, 1); | ||
275 | sg_set_buf(sg_in, src, src_len); | ||
276 | sg_init_table(sg_out, 3); | 367 | sg_init_table(sg_out, 3); |
277 | sg_set_buf(&sg_out[0], dst1, *dst1_len); | 368 | sg_set_buf(&sg_out[0], dst1, *dst1_len); |
278 | sg_set_buf(&sg_out[1], dst2, *dst2_len); | 369 | sg_set_buf(&sg_out[1], dst2, *dst2_len); |
279 | sg_set_buf(&sg_out[2], pad, sizeof(pad)); | 370 | sg_set_buf(&sg_out[2], pad, sizeof(pad)); |
371 | ret = setup_sgtable(&sg_in, &prealloc_sg, src, src_len); | ||
372 | if (ret) | ||
373 | goto out_tfm; | ||
280 | 374 | ||
281 | crypto_blkcipher_setkey((void *)tfm, key, key_len); | 375 | crypto_blkcipher_setkey((void *)tfm, key, key_len); |
282 | iv = crypto_blkcipher_crt(tfm)->iv; | 376 | iv = crypto_blkcipher_crt(tfm)->iv; |
283 | ivsize = crypto_blkcipher_ivsize(tfm); | 377 | ivsize = crypto_blkcipher_ivsize(tfm); |
284 | |||
285 | memcpy(iv, aes_iv, ivsize); | 378 | memcpy(iv, aes_iv, ivsize); |
286 | 379 | ||
287 | /* | 380 | /* |
@@ -290,12 +383,10 @@ static int ceph_aes_decrypt2(const void *key, int key_len, | |||
290 | print_hex_dump(KERN_ERR, "dec in: ", DUMP_PREFIX_NONE, 16, 1, | 383 | print_hex_dump(KERN_ERR, "dec in: ", DUMP_PREFIX_NONE, 16, 1, |
291 | src, src_len, 1); | 384 | src, src_len, 1); |
292 | */ | 385 | */ |
293 | 386 | ret = crypto_blkcipher_decrypt(&desc, sg_out, sg_in.sgl, src_len); | |
294 | ret = crypto_blkcipher_decrypt(&desc, sg_out, sg_in, src_len); | ||
295 | crypto_free_blkcipher(tfm); | ||
296 | if (ret < 0) { | 387 | if (ret < 0) { |
297 | pr_err("ceph_aes_decrypt failed %d\n", ret); | 388 | pr_err("ceph_aes_decrypt failed %d\n", ret); |
298 | return ret; | 389 | goto out_sg; |
299 | } | 390 | } |
300 | 391 | ||
301 | if (src_len <= *dst1_len) | 392 | if (src_len <= *dst1_len) |
@@ -325,7 +416,11 @@ static int ceph_aes_decrypt2(const void *key, int key_len, | |||
325 | dst2, *dst2_len, 1); | 416 | dst2, *dst2_len, 1); |
326 | */ | 417 | */ |
327 | 418 | ||
328 | return 0; | 419 | out_sg: |
420 | teardown_sgtable(&sg_in); | ||
421 | out_tfm: | ||
422 | crypto_free_blkcipher(tfm); | ||
423 | return ret; | ||
329 | } | 424 | } |
330 | 425 | ||
331 | 426 | ||
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 559c9f619c20..8d1653caffdb 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c | |||
@@ -484,7 +484,7 @@ static int ceph_tcp_connect(struct ceph_connection *con) | |||
484 | IPPROTO_TCP, &sock); | 484 | IPPROTO_TCP, &sock); |
485 | if (ret) | 485 | if (ret) |
486 | return ret; | 486 | return ret; |
487 | sock->sk->sk_allocation = GFP_NOFS; | 487 | sock->sk->sk_allocation = GFP_NOFS | __GFP_MEMALLOC; |
488 | 488 | ||
489 | #ifdef CONFIG_LOCKDEP | 489 | #ifdef CONFIG_LOCKDEP |
490 | lockdep_set_class(&sock->sk->sk_lock, &socket_class); | 490 | lockdep_set_class(&sock->sk->sk_lock, &socket_class); |
@@ -509,6 +509,9 @@ static int ceph_tcp_connect(struct ceph_connection *con) | |||
509 | 509 | ||
510 | return ret; | 510 | return ret; |
511 | } | 511 | } |
512 | |||
513 | sk_set_memalloc(sock->sk); | ||
514 | |||
512 | con->sock = sock; | 515 | con->sock = sock; |
513 | return 0; | 516 | return 0; |
514 | } | 517 | } |
@@ -2769,8 +2772,11 @@ static void con_work(struct work_struct *work) | |||
2769 | { | 2772 | { |
2770 | struct ceph_connection *con = container_of(work, struct ceph_connection, | 2773 | struct ceph_connection *con = container_of(work, struct ceph_connection, |
2771 | work.work); | 2774 | work.work); |
2775 | unsigned long pflags = current->flags; | ||
2772 | bool fault; | 2776 | bool fault; |
2773 | 2777 | ||
2778 | current->flags |= PF_MEMALLOC; | ||
2779 | |||
2774 | mutex_lock(&con->mutex); | 2780 | mutex_lock(&con->mutex); |
2775 | while (true) { | 2781 | while (true) { |
2776 | int ret; | 2782 | int ret; |
@@ -2824,6 +2830,8 @@ static void con_work(struct work_struct *work) | |||
2824 | con_fault_finish(con); | 2830 | con_fault_finish(con); |
2825 | 2831 | ||
2826 | con->ops->put(con); | 2832 | con->ops->put(con); |
2833 | |||
2834 | tsk_restore_flags(current, pflags, PF_MEMALLOC); | ||
2827 | } | 2835 | } |
2828 | 2836 | ||
2829 | /* | 2837 | /* |
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index f3fc54eac09d..6f164289bde8 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c | |||
@@ -1007,8 +1007,8 @@ static void put_osd(struct ceph_osd *osd) | |||
1007 | static void __remove_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd) | 1007 | static void __remove_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd) |
1008 | { | 1008 | { |
1009 | dout("__remove_osd %p\n", osd); | 1009 | dout("__remove_osd %p\n", osd); |
1010 | BUG_ON(!list_empty(&osd->o_requests)); | 1010 | WARN_ON(!list_empty(&osd->o_requests)); |
1011 | BUG_ON(!list_empty(&osd->o_linger_requests)); | 1011 | WARN_ON(!list_empty(&osd->o_linger_requests)); |
1012 | 1012 | ||
1013 | rb_erase(&osd->o_node, &osdc->osds); | 1013 | rb_erase(&osd->o_node, &osdc->osds); |
1014 | list_del_init(&osd->o_osd_lru); | 1014 | list_del_init(&osd->o_osd_lru); |
@@ -1254,6 +1254,8 @@ static void __unregister_linger_request(struct ceph_osd_client *osdc, | |||
1254 | if (list_empty(&req->r_osd_item)) | 1254 | if (list_empty(&req->r_osd_item)) |
1255 | req->r_osd = NULL; | 1255 | req->r_osd = NULL; |
1256 | } | 1256 | } |
1257 | |||
1258 | list_del_init(&req->r_req_lru_item); /* can be on notarget */ | ||
1257 | ceph_osdc_put_request(req); | 1259 | ceph_osdc_put_request(req); |
1258 | } | 1260 | } |
1259 | 1261 | ||
@@ -1395,6 +1397,7 @@ static int __map_request(struct ceph_osd_client *osdc, | |||
1395 | if (req->r_osd) { | 1397 | if (req->r_osd) { |
1396 | __cancel_request(req); | 1398 | __cancel_request(req); |
1397 | list_del_init(&req->r_osd_item); | 1399 | list_del_init(&req->r_osd_item); |
1400 | list_del_init(&req->r_linger_osd_item); | ||
1398 | req->r_osd = NULL; | 1401 | req->r_osd = NULL; |
1399 | } | 1402 | } |
1400 | 1403 | ||
diff --git a/net/core/dev.c b/net/core/dev.c index b793e3521a36..945bbd001359 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -4157,6 +4157,10 @@ EXPORT_SYMBOL(napi_gro_receive); | |||
4157 | 4157 | ||
4158 | static void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb) | 4158 | static void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb) |
4159 | { | 4159 | { |
4160 | if (unlikely(skb->pfmemalloc)) { | ||
4161 | consume_skb(skb); | ||
4162 | return; | ||
4163 | } | ||
4160 | __skb_pull(skb, skb_headlen(skb)); | 4164 | __skb_pull(skb, skb_headlen(skb)); |
4161 | /* restore the reserve we had after netdev_alloc_skb_ip_align() */ | 4165 | /* restore the reserve we had after netdev_alloc_skb_ip_align() */ |
4162 | skb_reserve(skb, NET_SKB_PAD + NET_IP_ALIGN - skb_headroom(skb)); | 4166 | skb_reserve(skb, NET_SKB_PAD + NET_IP_ALIGN - skb_headroom(skb)); |
diff --git a/net/core/ethtool.c b/net/core/ethtool.c index 1600aa24d36b..06dfb293e5aa 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c | |||
@@ -1036,7 +1036,8 @@ static int ethtool_get_eeprom(struct net_device *dev, void __user *useraddr) | |||
1036 | { | 1036 | { |
1037 | const struct ethtool_ops *ops = dev->ethtool_ops; | 1037 | const struct ethtool_ops *ops = dev->ethtool_ops; |
1038 | 1038 | ||
1039 | if (!ops->get_eeprom || !ops->get_eeprom_len) | 1039 | if (!ops->get_eeprom || !ops->get_eeprom_len || |
1040 | !ops->get_eeprom_len(dev)) | ||
1040 | return -EOPNOTSUPP; | 1041 | return -EOPNOTSUPP; |
1041 | 1042 | ||
1042 | return ethtool_get_any_eeprom(dev, useraddr, ops->get_eeprom, | 1043 | return ethtool_get_any_eeprom(dev, useraddr, ops->get_eeprom, |
@@ -1052,7 +1053,8 @@ static int ethtool_set_eeprom(struct net_device *dev, void __user *useraddr) | |||
1052 | u8 *data; | 1053 | u8 *data; |
1053 | int ret = 0; | 1054 | int ret = 0; |
1054 | 1055 | ||
1055 | if (!ops->set_eeprom || !ops->get_eeprom_len) | 1056 | if (!ops->set_eeprom || !ops->get_eeprom_len || |
1057 | !ops->get_eeprom_len(dev)) | ||
1056 | return -EOPNOTSUPP; | 1058 | return -EOPNOTSUPP; |
1057 | 1059 | ||
1058 | if (copy_from_user(&eeprom, useraddr, sizeof(eeprom))) | 1060 | if (copy_from_user(&eeprom, useraddr, sizeof(eeprom))) |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 61059a05ec95..c16615bfb61e 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -4070,15 +4070,22 @@ EXPORT_SYMBOL_GPL(skb_scrub_packet); | |||
4070 | unsigned int skb_gso_transport_seglen(const struct sk_buff *skb) | 4070 | unsigned int skb_gso_transport_seglen(const struct sk_buff *skb) |
4071 | { | 4071 | { |
4072 | const struct skb_shared_info *shinfo = skb_shinfo(skb); | 4072 | const struct skb_shared_info *shinfo = skb_shinfo(skb); |
4073 | unsigned int thlen = 0; | ||
4073 | 4074 | ||
4074 | if (likely(shinfo->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6))) | 4075 | if (skb->encapsulation) { |
4075 | return tcp_hdrlen(skb) + shinfo->gso_size; | 4076 | thlen = skb_inner_transport_header(skb) - |
4077 | skb_transport_header(skb); | ||
4076 | 4078 | ||
4079 | if (likely(shinfo->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6))) | ||
4080 | thlen += inner_tcp_hdrlen(skb); | ||
4081 | } else if (likely(shinfo->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6))) { | ||
4082 | thlen = tcp_hdrlen(skb); | ||
4083 | } | ||
4077 | /* UFO sets gso_size to the size of the fragmentation | 4084 | /* UFO sets gso_size to the size of the fragmentation |
4078 | * payload, i.e. the size of the L4 (UDP) header is already | 4085 | * payload, i.e. the size of the L4 (UDP) header is already |
4079 | * accounted for. | 4086 | * accounted for. |
4080 | */ | 4087 | */ |
4081 | return shinfo->gso_size; | 4088 | return thlen + shinfo->gso_size; |
4082 | } | 4089 | } |
4083 | EXPORT_SYMBOL_GPL(skb_gso_transport_seglen); | 4090 | EXPORT_SYMBOL_GPL(skb_gso_transport_seglen); |
4084 | 4091 | ||
diff --git a/net/core/tso.c b/net/core/tso.c index 8c3203c585b0..630b30b4fb53 100644 --- a/net/core/tso.c +++ b/net/core/tso.c | |||
@@ -1,6 +1,7 @@ | |||
1 | #include <linux/export.h> | 1 | #include <linux/export.h> |
2 | #include <net/ip.h> | 2 | #include <net/ip.h> |
3 | #include <net/tso.h> | 3 | #include <net/tso.h> |
4 | #include <asm/unaligned.h> | ||
4 | 5 | ||
5 | /* Calculate expected number of TX descriptors */ | 6 | /* Calculate expected number of TX descriptors */ |
6 | int tso_count_descs(struct sk_buff *skb) | 7 | int tso_count_descs(struct sk_buff *skb) |
@@ -23,7 +24,7 @@ void tso_build_hdr(struct sk_buff *skb, char *hdr, struct tso_t *tso, | |||
23 | iph->id = htons(tso->ip_id); | 24 | iph->id = htons(tso->ip_id); |
24 | iph->tot_len = htons(size + hdr_len - mac_hdr_len); | 25 | iph->tot_len = htons(size + hdr_len - mac_hdr_len); |
25 | tcph = (struct tcphdr *)(hdr + skb_transport_offset(skb)); | 26 | tcph = (struct tcphdr *)(hdr + skb_transport_offset(skb)); |
26 | tcph->seq = htonl(tso->tcp_seq); | 27 | put_unaligned_be32(tso->tcp_seq, &tcph->seq); |
27 | tso->ip_id++; | 28 | tso->ip_id++; |
28 | 29 | ||
29 | if (!is_last) { | 30 | if (!is_last) { |
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index 22f34cf4cb27..6317b41c99b0 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c | |||
@@ -174,8 +174,11 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index, | |||
174 | dst->rcv = brcm_netdev_ops.rcv; | 174 | dst->rcv = brcm_netdev_ops.rcv; |
175 | break; | 175 | break; |
176 | #endif | 176 | #endif |
177 | default: | 177 | case DSA_TAG_PROTO_NONE: |
178 | break; | 178 | break; |
179 | default: | ||
180 | ret = -ENOPROTOOPT; | ||
181 | goto out; | ||
179 | } | 182 | } |
180 | 183 | ||
181 | dst->tag_protocol = drv->tag_protocol; | 184 | dst->tag_protocol = drv->tag_protocol; |
diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 6d1817449c36..ab03e00ffe8f 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c | |||
@@ -489,11 +489,14 @@ static void dsa_slave_phy_setup(struct dsa_slave_priv *p, | |||
489 | /* We could not connect to a designated PHY, so use the switch internal | 489 | /* We could not connect to a designated PHY, so use the switch internal |
490 | * MDIO bus instead | 490 | * MDIO bus instead |
491 | */ | 491 | */ |
492 | if (!p->phy) | 492 | if (!p->phy) { |
493 | p->phy = ds->slave_mii_bus->phy_map[p->port]; | 493 | p->phy = ds->slave_mii_bus->phy_map[p->port]; |
494 | else | 494 | phy_connect_direct(slave_dev, p->phy, dsa_slave_adjust_link, |
495 | p->phy_interface); | ||
496 | } else { | ||
495 | pr_info("attached PHY at address %d [%s]\n", | 497 | pr_info("attached PHY at address %d [%s]\n", |
496 | p->phy->addr, p->phy->drv->name); | 498 | p->phy->addr, p->phy->drv->name); |
499 | } | ||
497 | } | 500 | } |
498 | 501 | ||
499 | int dsa_slave_suspend(struct net_device *slave_dev) | 502 | int dsa_slave_suspend(struct net_device *slave_dev) |
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 92db7a69f2b9..8b7fe5b03906 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -1246,7 +1246,7 @@ static struct sk_buff *inet_gso_segment(struct sk_buff *skb, | |||
1246 | 1246 | ||
1247 | encap = SKB_GSO_CB(skb)->encap_level > 0; | 1247 | encap = SKB_GSO_CB(skb)->encap_level > 0; |
1248 | if (encap) | 1248 | if (encap) |
1249 | features = skb->dev->hw_enc_features & netif_skb_features(skb); | 1249 | features &= skb->dev->hw_enc_features; |
1250 | SKB_GSO_CB(skb)->encap_level += ihl; | 1250 | SKB_GSO_CB(skb)->encap_level += ihl; |
1251 | 1251 | ||
1252 | skb_reset_transport_header(skb); | 1252 | skb_reset_transport_header(skb); |
diff --git a/net/ipv4/fou.c b/net/ipv4/fou.c index 32e78924e246..606c520ffd5a 100644 --- a/net/ipv4/fou.c +++ b/net/ipv4/fou.c | |||
@@ -133,6 +133,8 @@ static int fou_gro_complete(struct sk_buff *skb, int nhoff) | |||
133 | int err = -ENOSYS; | 133 | int err = -ENOSYS; |
134 | const struct net_offload **offloads; | 134 | const struct net_offload **offloads; |
135 | 135 | ||
136 | udp_tunnel_gro_complete(skb, nhoff); | ||
137 | |||
136 | rcu_read_lock(); | 138 | rcu_read_lock(); |
137 | offloads = NAPI_GRO_CB(skb)->is_ipv6 ? inet6_offloads : inet_offloads; | 139 | offloads = NAPI_GRO_CB(skb)->is_ipv6 ? inet6_offloads : inet_offloads; |
138 | ops = rcu_dereference(offloads[proto]); | 140 | ops = rcu_dereference(offloads[proto]); |
diff --git a/net/ipv4/geneve.c b/net/ipv4/geneve.c index 065cd94c640c..dedb21e99914 100644 --- a/net/ipv4/geneve.c +++ b/net/ipv4/geneve.c | |||
@@ -144,6 +144,8 @@ int geneve_xmit_skb(struct geneve_sock *gs, struct rtable *rt, | |||
144 | gnvh = (struct genevehdr *)__skb_push(skb, sizeof(*gnvh) + opt_len); | 144 | gnvh = (struct genevehdr *)__skb_push(skb, sizeof(*gnvh) + opt_len); |
145 | geneve_build_header(gnvh, tun_flags, vni, opt_len, opt); | 145 | geneve_build_header(gnvh, tun_flags, vni, opt_len, opt); |
146 | 146 | ||
147 | skb_set_inner_protocol(skb, htons(ETH_P_TEB)); | ||
148 | |||
147 | return udp_tunnel_xmit_skb(gs->sock, rt, skb, src, dst, | 149 | return udp_tunnel_xmit_skb(gs->sock, rt, skb, src, dst, |
148 | tos, ttl, df, src_port, dst_port, xnet); | 150 | tos, ttl, df, src_port, dst_port, xnet); |
149 | } | 151 | } |
@@ -364,6 +366,7 @@ late_initcall(geneve_init_module); | |||
364 | static void __exit geneve_cleanup_module(void) | 366 | static void __exit geneve_cleanup_module(void) |
365 | { | 367 | { |
366 | destroy_workqueue(geneve_wq); | 368 | destroy_workqueue(geneve_wq); |
369 | unregister_pernet_subsys(&geneve_net_ops); | ||
367 | } | 370 | } |
368 | module_exit(geneve_cleanup_module); | 371 | module_exit(geneve_cleanup_module); |
369 | 372 | ||
diff --git a/net/ipv4/gre_offload.c b/net/ipv4/gre_offload.c index ccda09628de7..bb5947b0ce2d 100644 --- a/net/ipv4/gre_offload.c +++ b/net/ipv4/gre_offload.c | |||
@@ -47,7 +47,7 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb, | |||
47 | 47 | ||
48 | greh = (struct gre_base_hdr *)skb_transport_header(skb); | 48 | greh = (struct gre_base_hdr *)skb_transport_header(skb); |
49 | 49 | ||
50 | ghl = skb_inner_network_header(skb) - skb_transport_header(skb); | 50 | ghl = skb_inner_mac_header(skb) - skb_transport_header(skb); |
51 | if (unlikely(ghl < sizeof(*greh))) | 51 | if (unlikely(ghl < sizeof(*greh))) |
52 | goto out; | 52 | goto out; |
53 | 53 | ||
@@ -68,7 +68,7 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb, | |||
68 | skb->mac_len = skb_inner_network_offset(skb); | 68 | skb->mac_len = skb_inner_network_offset(skb); |
69 | 69 | ||
70 | /* segment inner packet. */ | 70 | /* segment inner packet. */ |
71 | enc_features = skb->dev->hw_enc_features & netif_skb_features(skb); | 71 | enc_features = skb->dev->hw_enc_features & features; |
72 | segs = skb_mac_gso_segment(skb, enc_features); | 72 | segs = skb_mac_gso_segment(skb, enc_features); |
73 | if (IS_ERR_OR_NULL(segs)) { | 73 | if (IS_ERR_OR_NULL(segs)) { |
74 | skb_gso_error_unwind(skb, protocol, ghl, mac_offset, mac_len); | 74 | skb_gso_error_unwind(skb, protocol, ghl, mac_offset, mac_len); |
diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c index 9eb89f3f0ee4..19419b60cb37 100644 --- a/net/ipv4/inet_fragment.c +++ b/net/ipv4/inet_fragment.c | |||
@@ -146,7 +146,6 @@ evict_again: | |||
146 | atomic_inc(&fq->refcnt); | 146 | atomic_inc(&fq->refcnt); |
147 | spin_unlock(&hb->chain_lock); | 147 | spin_unlock(&hb->chain_lock); |
148 | del_timer_sync(&fq->timer); | 148 | del_timer_sync(&fq->timer); |
149 | WARN_ON(atomic_read(&fq->refcnt) != 1); | ||
150 | inet_frag_put(fq, f); | 149 | inet_frag_put(fq, f); |
151 | goto evict_again; | 150 | goto evict_again; |
152 | } | 151 | } |
@@ -285,7 +284,8 @@ static inline void fq_unlink(struct inet_frag_queue *fq, struct inet_frags *f) | |||
285 | struct inet_frag_bucket *hb; | 284 | struct inet_frag_bucket *hb; |
286 | 285 | ||
287 | hb = get_frag_bucket_locked(fq, f); | 286 | hb = get_frag_bucket_locked(fq, f); |
288 | hlist_del(&fq->list); | 287 | if (!(fq->flags & INET_FRAG_EVICTED)) |
288 | hlist_del(&fq->list); | ||
289 | spin_unlock(&hb->chain_lock); | 289 | spin_unlock(&hb->chain_lock); |
290 | } | 290 | } |
291 | 291 | ||
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 88e5ef2c7f51..bc6471d4abcd 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c | |||
@@ -231,7 +231,7 @@ static int ip_finish_output_gso(struct sk_buff *skb) | |||
231 | */ | 231 | */ |
232 | features = netif_skb_features(skb); | 232 | features = netif_skb_features(skb); |
233 | segs = skb_gso_segment(skb, features & ~NETIF_F_GSO_MASK); | 233 | segs = skb_gso_segment(skb, features & ~NETIF_F_GSO_MASK); |
234 | if (IS_ERR(segs)) { | 234 | if (IS_ERR_OR_NULL(segs)) { |
235 | kfree_skb(skb); | 235 | kfree_skb(skb); |
236 | return -ENOMEM; | 236 | return -ENOMEM; |
237 | } | 237 | } |
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index c373a9ad4555..9daf2177dc00 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c | |||
@@ -195,7 +195,7 @@ int ip_cmsg_send(struct net *net, struct msghdr *msg, struct ipcm_cookie *ipc, | |||
195 | for (cmsg = CMSG_FIRSTHDR(msg); cmsg; cmsg = CMSG_NXTHDR(msg, cmsg)) { | 195 | for (cmsg = CMSG_FIRSTHDR(msg); cmsg; cmsg = CMSG_NXTHDR(msg, cmsg)) { |
196 | if (!CMSG_OK(msg, cmsg)) | 196 | if (!CMSG_OK(msg, cmsg)) |
197 | return -EINVAL; | 197 | return -EINVAL; |
198 | #if defined(CONFIG_IPV6) | 198 | #if IS_ENABLED(CONFIG_IPV6) |
199 | if (allow_ipv6 && | 199 | if (allow_ipv6 && |
200 | cmsg->cmsg_level == SOL_IPV6 && | 200 | cmsg->cmsg_level == SOL_IPV6 && |
201 | cmsg->cmsg_type == IPV6_PKTINFO) { | 201 | cmsg->cmsg_type == IPV6_PKTINFO) { |
diff --git a/net/ipv4/netfilter/nf_reject_ipv4.c b/net/ipv4/netfilter/nf_reject_ipv4.c index b023b4eb1a96..1baaa83dfe5c 100644 --- a/net/ipv4/netfilter/nf_reject_ipv4.c +++ b/net/ipv4/netfilter/nf_reject_ipv4.c | |||
@@ -6,48 +6,45 @@ | |||
6 | * published by the Free Software Foundation. | 6 | * published by the Free Software Foundation. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/module.h> | ||
9 | #include <net/ip.h> | 10 | #include <net/ip.h> |
10 | #include <net/tcp.h> | 11 | #include <net/tcp.h> |
11 | #include <net/route.h> | 12 | #include <net/route.h> |
12 | #include <net/dst.h> | 13 | #include <net/dst.h> |
13 | #include <linux/netfilter_ipv4.h> | 14 | #include <linux/netfilter_ipv4.h> |
15 | #include <net/netfilter/ipv4/nf_reject.h> | ||
14 | 16 | ||
15 | /* Send RST reply */ | 17 | const struct tcphdr *nf_reject_ip_tcphdr_get(struct sk_buff *oldskb, |
16 | void nf_send_reset(struct sk_buff *oldskb, int hook) | 18 | struct tcphdr *_oth, int hook) |
17 | { | 19 | { |
18 | struct sk_buff *nskb; | ||
19 | const struct iphdr *oiph; | ||
20 | struct iphdr *niph; | ||
21 | const struct tcphdr *oth; | 20 | const struct tcphdr *oth; |
22 | struct tcphdr _otcph, *tcph; | ||
23 | 21 | ||
24 | /* IP header checks: fragment. */ | 22 | /* IP header checks: fragment. */ |
25 | if (ip_hdr(oldskb)->frag_off & htons(IP_OFFSET)) | 23 | if (ip_hdr(oldskb)->frag_off & htons(IP_OFFSET)) |
26 | return; | 24 | return NULL; |
27 | 25 | ||
28 | oth = skb_header_pointer(oldskb, ip_hdrlen(oldskb), | 26 | oth = skb_header_pointer(oldskb, ip_hdrlen(oldskb), |
29 | sizeof(_otcph), &_otcph); | 27 | sizeof(struct tcphdr), _oth); |
30 | if (oth == NULL) | 28 | if (oth == NULL) |
31 | return; | 29 | return NULL; |
32 | 30 | ||
33 | /* No RST for RST. */ | 31 | /* No RST for RST. */ |
34 | if (oth->rst) | 32 | if (oth->rst) |
35 | return; | 33 | return NULL; |
36 | |||
37 | if (skb_rtable(oldskb)->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST)) | ||
38 | return; | ||
39 | 34 | ||
40 | /* Check checksum */ | 35 | /* Check checksum */ |
41 | if (nf_ip_checksum(oldskb, hook, ip_hdrlen(oldskb), IPPROTO_TCP)) | 36 | if (nf_ip_checksum(oldskb, hook, ip_hdrlen(oldskb), IPPROTO_TCP)) |
42 | return; | 37 | return NULL; |
43 | oiph = ip_hdr(oldskb); | ||
44 | 38 | ||
45 | nskb = alloc_skb(sizeof(struct iphdr) + sizeof(struct tcphdr) + | 39 | return oth; |
46 | LL_MAX_HEADER, GFP_ATOMIC); | 40 | } |
47 | if (!nskb) | 41 | EXPORT_SYMBOL_GPL(nf_reject_ip_tcphdr_get); |
48 | return; | ||
49 | 42 | ||
50 | skb_reserve(nskb, LL_MAX_HEADER); | 43 | struct iphdr *nf_reject_iphdr_put(struct sk_buff *nskb, |
44 | const struct sk_buff *oldskb, | ||
45 | __be16 protocol, int ttl) | ||
46 | { | ||
47 | struct iphdr *niph, *oiph = ip_hdr(oldskb); | ||
51 | 48 | ||
52 | skb_reset_network_header(nskb); | 49 | skb_reset_network_header(nskb); |
53 | niph = (struct iphdr *)skb_put(nskb, sizeof(struct iphdr)); | 50 | niph = (struct iphdr *)skb_put(nskb, sizeof(struct iphdr)); |
@@ -56,10 +53,23 @@ void nf_send_reset(struct sk_buff *oldskb, int hook) | |||
56 | niph->tos = 0; | 53 | niph->tos = 0; |
57 | niph->id = 0; | 54 | niph->id = 0; |
58 | niph->frag_off = htons(IP_DF); | 55 | niph->frag_off = htons(IP_DF); |
59 | niph->protocol = IPPROTO_TCP; | 56 | niph->protocol = protocol; |
60 | niph->check = 0; | 57 | niph->check = 0; |
61 | niph->saddr = oiph->daddr; | 58 | niph->saddr = oiph->daddr; |
62 | niph->daddr = oiph->saddr; | 59 | niph->daddr = oiph->saddr; |
60 | niph->ttl = ttl; | ||
61 | |||
62 | nskb->protocol = htons(ETH_P_IP); | ||
63 | |||
64 | return niph; | ||
65 | } | ||
66 | EXPORT_SYMBOL_GPL(nf_reject_iphdr_put); | ||
67 | |||
68 | void nf_reject_ip_tcphdr_put(struct sk_buff *nskb, const struct sk_buff *oldskb, | ||
69 | const struct tcphdr *oth) | ||
70 | { | ||
71 | struct iphdr *niph = ip_hdr(nskb); | ||
72 | struct tcphdr *tcph; | ||
63 | 73 | ||
64 | skb_reset_transport_header(nskb); | 74 | skb_reset_transport_header(nskb); |
65 | tcph = (struct tcphdr *)skb_put(nskb, sizeof(struct tcphdr)); | 75 | tcph = (struct tcphdr *)skb_put(nskb, sizeof(struct tcphdr)); |
@@ -68,9 +78,9 @@ void nf_send_reset(struct sk_buff *oldskb, int hook) | |||
68 | tcph->dest = oth->source; | 78 | tcph->dest = oth->source; |
69 | tcph->doff = sizeof(struct tcphdr) / 4; | 79 | tcph->doff = sizeof(struct tcphdr) / 4; |
70 | 80 | ||
71 | if (oth->ack) | 81 | if (oth->ack) { |
72 | tcph->seq = oth->ack_seq; | 82 | tcph->seq = oth->ack_seq; |
73 | else { | 83 | } else { |
74 | tcph->ack_seq = htonl(ntohl(oth->seq) + oth->syn + oth->fin + | 84 | tcph->ack_seq = htonl(ntohl(oth->seq) + oth->syn + oth->fin + |
75 | oldskb->len - ip_hdrlen(oldskb) - | 85 | oldskb->len - ip_hdrlen(oldskb) - |
76 | (oth->doff << 2)); | 86 | (oth->doff << 2)); |
@@ -83,16 +93,43 @@ void nf_send_reset(struct sk_buff *oldskb, int hook) | |||
83 | nskb->ip_summed = CHECKSUM_PARTIAL; | 93 | nskb->ip_summed = CHECKSUM_PARTIAL; |
84 | nskb->csum_start = (unsigned char *)tcph - nskb->head; | 94 | nskb->csum_start = (unsigned char *)tcph - nskb->head; |
85 | nskb->csum_offset = offsetof(struct tcphdr, check); | 95 | nskb->csum_offset = offsetof(struct tcphdr, check); |
96 | } | ||
97 | EXPORT_SYMBOL_GPL(nf_reject_ip_tcphdr_put); | ||
98 | |||
99 | /* Send RST reply */ | ||
100 | void nf_send_reset(struct sk_buff *oldskb, int hook) | ||
101 | { | ||
102 | struct sk_buff *nskb; | ||
103 | const struct iphdr *oiph; | ||
104 | struct iphdr *niph; | ||
105 | const struct tcphdr *oth; | ||
106 | struct tcphdr _oth; | ||
107 | |||
108 | oth = nf_reject_ip_tcphdr_get(oldskb, &_oth, hook); | ||
109 | if (!oth) | ||
110 | return; | ||
111 | |||
112 | if (skb_rtable(oldskb)->rt_flags & (RTCF_BROADCAST | RTCF_MULTICAST)) | ||
113 | return; | ||
114 | |||
115 | oiph = ip_hdr(oldskb); | ||
116 | |||
117 | nskb = alloc_skb(sizeof(struct iphdr) + sizeof(struct tcphdr) + | ||
118 | LL_MAX_HEADER, GFP_ATOMIC); | ||
119 | if (!nskb) | ||
120 | return; | ||
86 | 121 | ||
87 | /* ip_route_me_harder expects skb->dst to be set */ | 122 | /* ip_route_me_harder expects skb->dst to be set */ |
88 | skb_dst_set_noref(nskb, skb_dst(oldskb)); | 123 | skb_dst_set_noref(nskb, skb_dst(oldskb)); |
89 | 124 | ||
90 | nskb->protocol = htons(ETH_P_IP); | 125 | skb_reserve(nskb, LL_MAX_HEADER); |
126 | niph = nf_reject_iphdr_put(nskb, oldskb, IPPROTO_TCP, | ||
127 | ip4_dst_hoplimit(skb_dst(nskb))); | ||
128 | nf_reject_ip_tcphdr_put(nskb, oldskb, oth); | ||
129 | |||
91 | if (ip_route_me_harder(nskb, RTN_UNSPEC)) | 130 | if (ip_route_me_harder(nskb, RTN_UNSPEC)) |
92 | goto free_nskb; | 131 | goto free_nskb; |
93 | 132 | ||
94 | niph->ttl = ip4_dst_hoplimit(skb_dst(nskb)); | ||
95 | |||
96 | /* "Never happens" */ | 133 | /* "Never happens" */ |
97 | if (nskb->len > dst_mtu(skb_dst(nskb))) | 134 | if (nskb->len > dst_mtu(skb_dst(nskb))) |
98 | goto free_nskb; | 135 | goto free_nskb; |
@@ -125,3 +162,5 @@ void nf_send_reset(struct sk_buff *oldskb, int hook) | |||
125 | kfree_skb(nskb); | 162 | kfree_skb(nskb); |
126 | } | 163 | } |
127 | EXPORT_SYMBOL_GPL(nf_send_reset); | 164 | EXPORT_SYMBOL_GPL(nf_send_reset); |
165 | |||
166 | MODULE_LICENSE("GPL"); | ||
diff --git a/net/ipv4/netfilter/nft_masq_ipv4.c b/net/ipv4/netfilter/nft_masq_ipv4.c index 1c636d6b5b50..c1023c445920 100644 --- a/net/ipv4/netfilter/nft_masq_ipv4.c +++ b/net/ipv4/netfilter/nft_masq_ipv4.c | |||
@@ -39,6 +39,7 @@ static const struct nft_expr_ops nft_masq_ipv4_ops = { | |||
39 | .eval = nft_masq_ipv4_eval, | 39 | .eval = nft_masq_ipv4_eval, |
40 | .init = nft_masq_init, | 40 | .init = nft_masq_init, |
41 | .dump = nft_masq_dump, | 41 | .dump = nft_masq_dump, |
42 | .validate = nft_masq_validate, | ||
42 | }; | 43 | }; |
43 | 44 | ||
44 | static struct nft_expr_type nft_masq_ipv4_type __read_mostly = { | 45 | static struct nft_expr_type nft_masq_ipv4_type __read_mostly = { |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 2d4ae469b471..6a2155b02602 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -1798,6 +1798,7 @@ local_input: | |||
1798 | no_route: | 1798 | no_route: |
1799 | RT_CACHE_STAT_INC(in_no_route); | 1799 | RT_CACHE_STAT_INC(in_no_route); |
1800 | res.type = RTN_UNREACHABLE; | 1800 | res.type = RTN_UNREACHABLE; |
1801 | res.fi = NULL; | ||
1801 | goto local_input; | 1802 | goto local_input; |
1802 | 1803 | ||
1803 | /* | 1804 | /* |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 1bec4e76d88c..39ec0c379545 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -2868,61 +2868,42 @@ EXPORT_SYMBOL(compat_tcp_getsockopt); | |||
2868 | #endif | 2868 | #endif |
2869 | 2869 | ||
2870 | #ifdef CONFIG_TCP_MD5SIG | 2870 | #ifdef CONFIG_TCP_MD5SIG |
2871 | static struct tcp_md5sig_pool __percpu *tcp_md5sig_pool __read_mostly; | 2871 | static DEFINE_PER_CPU(struct tcp_md5sig_pool, tcp_md5sig_pool); |
2872 | static DEFINE_MUTEX(tcp_md5sig_mutex); | 2872 | static DEFINE_MUTEX(tcp_md5sig_mutex); |
2873 | 2873 | static bool tcp_md5sig_pool_populated = false; | |
2874 | static void __tcp_free_md5sig_pool(struct tcp_md5sig_pool __percpu *pool) | ||
2875 | { | ||
2876 | int cpu; | ||
2877 | |||
2878 | for_each_possible_cpu(cpu) { | ||
2879 | struct tcp_md5sig_pool *p = per_cpu_ptr(pool, cpu); | ||
2880 | |||
2881 | if (p->md5_desc.tfm) | ||
2882 | crypto_free_hash(p->md5_desc.tfm); | ||
2883 | } | ||
2884 | free_percpu(pool); | ||
2885 | } | ||
2886 | 2874 | ||
2887 | static void __tcp_alloc_md5sig_pool(void) | 2875 | static void __tcp_alloc_md5sig_pool(void) |
2888 | { | 2876 | { |
2889 | int cpu; | 2877 | int cpu; |
2890 | struct tcp_md5sig_pool __percpu *pool; | ||
2891 | |||
2892 | pool = alloc_percpu(struct tcp_md5sig_pool); | ||
2893 | if (!pool) | ||
2894 | return; | ||
2895 | 2878 | ||
2896 | for_each_possible_cpu(cpu) { | 2879 | for_each_possible_cpu(cpu) { |
2897 | struct crypto_hash *hash; | 2880 | if (!per_cpu(tcp_md5sig_pool, cpu).md5_desc.tfm) { |
2898 | 2881 | struct crypto_hash *hash; | |
2899 | hash = crypto_alloc_hash("md5", 0, CRYPTO_ALG_ASYNC); | ||
2900 | if (IS_ERR_OR_NULL(hash)) | ||
2901 | goto out_free; | ||
2902 | 2882 | ||
2903 | per_cpu_ptr(pool, cpu)->md5_desc.tfm = hash; | 2883 | hash = crypto_alloc_hash("md5", 0, CRYPTO_ALG_ASYNC); |
2884 | if (IS_ERR_OR_NULL(hash)) | ||
2885 | return; | ||
2886 | per_cpu(tcp_md5sig_pool, cpu).md5_desc.tfm = hash; | ||
2887 | } | ||
2904 | } | 2888 | } |
2905 | /* before setting tcp_md5sig_pool, we must commit all writes | 2889 | /* before setting tcp_md5sig_pool_populated, we must commit all writes |
2906 | * to memory. See ACCESS_ONCE() in tcp_get_md5sig_pool() | 2890 | * to memory. See smp_rmb() in tcp_get_md5sig_pool() |
2907 | */ | 2891 | */ |
2908 | smp_wmb(); | 2892 | smp_wmb(); |
2909 | tcp_md5sig_pool = pool; | 2893 | tcp_md5sig_pool_populated = true; |
2910 | return; | ||
2911 | out_free: | ||
2912 | __tcp_free_md5sig_pool(pool); | ||
2913 | } | 2894 | } |
2914 | 2895 | ||
2915 | bool tcp_alloc_md5sig_pool(void) | 2896 | bool tcp_alloc_md5sig_pool(void) |
2916 | { | 2897 | { |
2917 | if (unlikely(!tcp_md5sig_pool)) { | 2898 | if (unlikely(!tcp_md5sig_pool_populated)) { |
2918 | mutex_lock(&tcp_md5sig_mutex); | 2899 | mutex_lock(&tcp_md5sig_mutex); |
2919 | 2900 | ||
2920 | if (!tcp_md5sig_pool) | 2901 | if (!tcp_md5sig_pool_populated) |
2921 | __tcp_alloc_md5sig_pool(); | 2902 | __tcp_alloc_md5sig_pool(); |
2922 | 2903 | ||
2923 | mutex_unlock(&tcp_md5sig_mutex); | 2904 | mutex_unlock(&tcp_md5sig_mutex); |
2924 | } | 2905 | } |
2925 | return tcp_md5sig_pool != NULL; | 2906 | return tcp_md5sig_pool_populated; |
2926 | } | 2907 | } |
2927 | EXPORT_SYMBOL(tcp_alloc_md5sig_pool); | 2908 | EXPORT_SYMBOL(tcp_alloc_md5sig_pool); |
2928 | 2909 | ||
@@ -2936,13 +2917,13 @@ EXPORT_SYMBOL(tcp_alloc_md5sig_pool); | |||
2936 | */ | 2917 | */ |
2937 | struct tcp_md5sig_pool *tcp_get_md5sig_pool(void) | 2918 | struct tcp_md5sig_pool *tcp_get_md5sig_pool(void) |
2938 | { | 2919 | { |
2939 | struct tcp_md5sig_pool __percpu *p; | ||
2940 | |||
2941 | local_bh_disable(); | 2920 | local_bh_disable(); |
2942 | p = ACCESS_ONCE(tcp_md5sig_pool); | ||
2943 | if (p) | ||
2944 | return raw_cpu_ptr(p); | ||
2945 | 2921 | ||
2922 | if (tcp_md5sig_pool_populated) { | ||
2923 | /* coupled with smp_wmb() in __tcp_alloc_md5sig_pool() */ | ||
2924 | smp_rmb(); | ||
2925 | return this_cpu_ptr(&tcp_md5sig_pool); | ||
2926 | } | ||
2946 | local_bh_enable(); | 2927 | local_bh_enable(); |
2947 | return NULL; | 2928 | return NULL; |
2948 | } | 2929 | } |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index a12b455928e5..88fa2d160685 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -2315,6 +2315,35 @@ static inline bool tcp_packet_delayed(const struct tcp_sock *tp) | |||
2315 | 2315 | ||
2316 | /* Undo procedures. */ | 2316 | /* Undo procedures. */ |
2317 | 2317 | ||
2318 | /* We can clear retrans_stamp when there are no retransmissions in the | ||
2319 | * window. It would seem that it is trivially available for us in | ||
2320 | * tp->retrans_out, however, that kind of assumptions doesn't consider | ||
2321 | * what will happen if errors occur when sending retransmission for the | ||
2322 | * second time. ...It could the that such segment has only | ||
2323 | * TCPCB_EVER_RETRANS set at the present time. It seems that checking | ||
2324 | * the head skb is enough except for some reneging corner cases that | ||
2325 | * are not worth the effort. | ||
2326 | * | ||
2327 | * Main reason for all this complexity is the fact that connection dying | ||
2328 | * time now depends on the validity of the retrans_stamp, in particular, | ||
2329 | * that successive retransmissions of a segment must not advance | ||
2330 | * retrans_stamp under any conditions. | ||
2331 | */ | ||
2332 | static bool tcp_any_retrans_done(const struct sock *sk) | ||
2333 | { | ||
2334 | const struct tcp_sock *tp = tcp_sk(sk); | ||
2335 | struct sk_buff *skb; | ||
2336 | |||
2337 | if (tp->retrans_out) | ||
2338 | return true; | ||
2339 | |||
2340 | skb = tcp_write_queue_head(sk); | ||
2341 | if (unlikely(skb && TCP_SKB_CB(skb)->sacked & TCPCB_EVER_RETRANS)) | ||
2342 | return true; | ||
2343 | |||
2344 | return false; | ||
2345 | } | ||
2346 | |||
2318 | #if FASTRETRANS_DEBUG > 1 | 2347 | #if FASTRETRANS_DEBUG > 1 |
2319 | static void DBGUNDO(struct sock *sk, const char *msg) | 2348 | static void DBGUNDO(struct sock *sk, const char *msg) |
2320 | { | 2349 | { |
@@ -2410,6 +2439,8 @@ static bool tcp_try_undo_recovery(struct sock *sk) | |||
2410 | * is ACKed. For Reno it is MUST to prevent false | 2439 | * is ACKed. For Reno it is MUST to prevent false |
2411 | * fast retransmits (RFC2582). SACK TCP is safe. */ | 2440 | * fast retransmits (RFC2582). SACK TCP is safe. */ |
2412 | tcp_moderate_cwnd(tp); | 2441 | tcp_moderate_cwnd(tp); |
2442 | if (!tcp_any_retrans_done(sk)) | ||
2443 | tp->retrans_stamp = 0; | ||
2413 | return true; | 2444 | return true; |
2414 | } | 2445 | } |
2415 | tcp_set_ca_state(sk, TCP_CA_Open); | 2446 | tcp_set_ca_state(sk, TCP_CA_Open); |
@@ -2430,35 +2461,6 @@ static bool tcp_try_undo_dsack(struct sock *sk) | |||
2430 | return false; | 2461 | return false; |
2431 | } | 2462 | } |
2432 | 2463 | ||
2433 | /* We can clear retrans_stamp when there are no retransmissions in the | ||
2434 | * window. It would seem that it is trivially available for us in | ||
2435 | * tp->retrans_out, however, that kind of assumptions doesn't consider | ||
2436 | * what will happen if errors occur when sending retransmission for the | ||
2437 | * second time. ...It could the that such segment has only | ||
2438 | * TCPCB_EVER_RETRANS set at the present time. It seems that checking | ||
2439 | * the head skb is enough except for some reneging corner cases that | ||
2440 | * are not worth the effort. | ||
2441 | * | ||
2442 | * Main reason for all this complexity is the fact that connection dying | ||
2443 | * time now depends on the validity of the retrans_stamp, in particular, | ||
2444 | * that successive retransmissions of a segment must not advance | ||
2445 | * retrans_stamp under any conditions. | ||
2446 | */ | ||
2447 | static bool tcp_any_retrans_done(const struct sock *sk) | ||
2448 | { | ||
2449 | const struct tcp_sock *tp = tcp_sk(sk); | ||
2450 | struct sk_buff *skb; | ||
2451 | |||
2452 | if (tp->retrans_out) | ||
2453 | return true; | ||
2454 | |||
2455 | skb = tcp_write_queue_head(sk); | ||
2456 | if (unlikely(skb && TCP_SKB_CB(skb)->sacked & TCPCB_EVER_RETRANS)) | ||
2457 | return true; | ||
2458 | |||
2459 | return false; | ||
2460 | } | ||
2461 | |||
2462 | /* Undo during loss recovery after partial ACK or using F-RTO. */ | 2464 | /* Undo during loss recovery after partial ACK or using F-RTO. */ |
2463 | static bool tcp_try_undo_loss(struct sock *sk, bool frto_undo) | 2465 | static bool tcp_try_undo_loss(struct sock *sk, bool frto_undo) |
2464 | { | 2466 | { |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 94d1a7757ff7..9c7d7621466b 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -206,8 +206,6 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
206 | inet->inet_dport = usin->sin_port; | 206 | inet->inet_dport = usin->sin_port; |
207 | inet->inet_daddr = daddr; | 207 | inet->inet_daddr = daddr; |
208 | 208 | ||
209 | inet_set_txhash(sk); | ||
210 | |||
211 | inet_csk(sk)->icsk_ext_hdr_len = 0; | 209 | inet_csk(sk)->icsk_ext_hdr_len = 0; |
212 | if (inet_opt) | 210 | if (inet_opt) |
213 | inet_csk(sk)->icsk_ext_hdr_len = inet_opt->opt.optlen; | 211 | inet_csk(sk)->icsk_ext_hdr_len = inet_opt->opt.optlen; |
@@ -224,6 +222,8 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) | |||
224 | if (err) | 222 | if (err) |
225 | goto failure; | 223 | goto failure; |
226 | 224 | ||
225 | inet_set_txhash(sk); | ||
226 | |||
227 | rt = ip_route_newports(fl4, rt, orig_sport, orig_dport, | 227 | rt = ip_route_newports(fl4, rt, orig_sport, orig_dport, |
228 | inet->inet_sport, inet->inet_dport, sk); | 228 | inet->inet_sport, inet->inet_dport, sk); |
229 | if (IS_ERR(rt)) { | 229 | if (IS_ERR(rt)) { |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 3af21296d967..a3d453b94747 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -2126,7 +2126,7 @@ bool tcp_schedule_loss_probe(struct sock *sk) | |||
2126 | static bool skb_still_in_host_queue(const struct sock *sk, | 2126 | static bool skb_still_in_host_queue(const struct sock *sk, |
2127 | const struct sk_buff *skb) | 2127 | const struct sk_buff *skb) |
2128 | { | 2128 | { |
2129 | if (unlikely(skb_fclone_busy(skb))) { | 2129 | if (unlikely(skb_fclone_busy(sk, skb))) { |
2130 | NET_INC_STATS_BH(sock_net(sk), | 2130 | NET_INC_STATS_BH(sock_net(sk), |
2131 | LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES); | 2131 | LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES); |
2132 | return true; | 2132 | return true; |
diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c index 507310ef4b56..6480cea7aa53 100644 --- a/net/ipv4/udp_offload.c +++ b/net/ipv4/udp_offload.c | |||
@@ -58,7 +58,7 @@ static struct sk_buff *__skb_udp_tunnel_segment(struct sk_buff *skb, | |||
58 | skb->encap_hdr_csum = 1; | 58 | skb->encap_hdr_csum = 1; |
59 | 59 | ||
60 | /* segment inner packet. */ | 60 | /* segment inner packet. */ |
61 | enc_features = skb->dev->hw_enc_features & netif_skb_features(skb); | 61 | enc_features = skb->dev->hw_enc_features & features; |
62 | segs = gso_inner_segment(skb, enc_features); | 62 | segs = gso_inner_segment(skb, enc_features); |
63 | if (IS_ERR_OR_NULL(segs)) { | 63 | if (IS_ERR_OR_NULL(segs)) { |
64 | skb_gso_error_unwind(skb, protocol, tnl_hlen, mac_offset, | 64 | skb_gso_error_unwind(skb, protocol, tnl_hlen, mac_offset, |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 725c763270a0..0169ccf5aa4f 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -4531,6 +4531,7 @@ static int inet6_set_iftoken(struct inet6_dev *idev, struct in6_addr *token) | |||
4531 | } | 4531 | } |
4532 | 4532 | ||
4533 | write_unlock_bh(&idev->lock); | 4533 | write_unlock_bh(&idev->lock); |
4534 | inet6_ifinfo_notify(RTM_NEWLINK, idev); | ||
4534 | addrconf_verify_rtnl(); | 4535 | addrconf_verify_rtnl(); |
4535 | return 0; | 4536 | return 0; |
4536 | } | 4537 | } |
diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c index 12c3c8ef3849..4564e1fca3eb 100644 --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c | |||
@@ -961,8 +961,6 @@ static void ip6gre_tnl_link_config(struct ip6_tnl *t, int set_mtu) | |||
961 | else | 961 | else |
962 | dev->flags &= ~IFF_POINTOPOINT; | 962 | dev->flags &= ~IFF_POINTOPOINT; |
963 | 963 | ||
964 | dev->iflink = p->link; | ||
965 | |||
966 | /* Precalculate GRE options length */ | 964 | /* Precalculate GRE options length */ |
967 | if (t->parms.o_flags&(GRE_CSUM|GRE_KEY|GRE_SEQ)) { | 965 | if (t->parms.o_flags&(GRE_CSUM|GRE_KEY|GRE_SEQ)) { |
968 | if (t->parms.o_flags&GRE_CSUM) | 966 | if (t->parms.o_flags&GRE_CSUM) |
@@ -1272,6 +1270,7 @@ static int ip6gre_tunnel_init(struct net_device *dev) | |||
1272 | u64_stats_init(&ip6gre_tunnel_stats->syncp); | 1270 | u64_stats_init(&ip6gre_tunnel_stats->syncp); |
1273 | } | 1271 | } |
1274 | 1272 | ||
1273 | dev->iflink = tunnel->parms.link; | ||
1275 | 1274 | ||
1276 | return 0; | 1275 | return 0; |
1277 | } | 1276 | } |
@@ -1481,6 +1480,8 @@ static int ip6gre_tap_init(struct net_device *dev) | |||
1481 | if (!dev->tstats) | 1480 | if (!dev->tstats) |
1482 | return -ENOMEM; | 1481 | return -ENOMEM; |
1483 | 1482 | ||
1483 | dev->iflink = tunnel->parms.link; | ||
1484 | |||
1484 | return 0; | 1485 | return 0; |
1485 | } | 1486 | } |
1486 | 1487 | ||
diff --git a/net/ipv6/ip6_offload.c b/net/ipv6/ip6_offload.c index 91014d32488d..a071563a7e6e 100644 --- a/net/ipv6/ip6_offload.c +++ b/net/ipv6/ip6_offload.c | |||
@@ -90,7 +90,7 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb, | |||
90 | 90 | ||
91 | encap = SKB_GSO_CB(skb)->encap_level > 0; | 91 | encap = SKB_GSO_CB(skb)->encap_level > 0; |
92 | if (encap) | 92 | if (encap) |
93 | features = skb->dev->hw_enc_features & netif_skb_features(skb); | 93 | features &= skb->dev->hw_enc_features; |
94 | SKB_GSO_CB(skb)->encap_level += sizeof(*ipv6h); | 94 | SKB_GSO_CB(skb)->encap_level += sizeof(*ipv6h); |
95 | 95 | ||
96 | ipv6h = ipv6_hdr(skb); | 96 | ipv6h = ipv6_hdr(skb); |
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index 9409887fb664..9cb94cfa0ae7 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c | |||
@@ -272,9 +272,6 @@ static int ip6_tnl_create2(struct net_device *dev) | |||
272 | int err; | 272 | int err; |
273 | 273 | ||
274 | t = netdev_priv(dev); | 274 | t = netdev_priv(dev); |
275 | err = ip6_tnl_dev_init(dev); | ||
276 | if (err < 0) | ||
277 | goto out; | ||
278 | 275 | ||
279 | err = register_netdevice(dev); | 276 | err = register_netdevice(dev); |
280 | if (err < 0) | 277 | if (err < 0) |
@@ -1462,6 +1459,7 @@ ip6_tnl_change_mtu(struct net_device *dev, int new_mtu) | |||
1462 | 1459 | ||
1463 | 1460 | ||
1464 | static const struct net_device_ops ip6_tnl_netdev_ops = { | 1461 | static const struct net_device_ops ip6_tnl_netdev_ops = { |
1462 | .ndo_init = ip6_tnl_dev_init, | ||
1465 | .ndo_uninit = ip6_tnl_dev_uninit, | 1463 | .ndo_uninit = ip6_tnl_dev_uninit, |
1466 | .ndo_start_xmit = ip6_tnl_xmit, | 1464 | .ndo_start_xmit = ip6_tnl_xmit, |
1467 | .ndo_do_ioctl = ip6_tnl_ioctl, | 1465 | .ndo_do_ioctl = ip6_tnl_ioctl, |
@@ -1546,16 +1544,10 @@ static int __net_init ip6_fb_tnl_dev_init(struct net_device *dev) | |||
1546 | struct ip6_tnl *t = netdev_priv(dev); | 1544 | struct ip6_tnl *t = netdev_priv(dev); |
1547 | struct net *net = dev_net(dev); | 1545 | struct net *net = dev_net(dev); |
1548 | struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id); | 1546 | struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id); |
1549 | int err = ip6_tnl_dev_init_gen(dev); | ||
1550 | |||
1551 | if (err) | ||
1552 | return err; | ||
1553 | 1547 | ||
1554 | t->parms.proto = IPPROTO_IPV6; | 1548 | t->parms.proto = IPPROTO_IPV6; |
1555 | dev_hold(dev); | 1549 | dev_hold(dev); |
1556 | 1550 | ||
1557 | ip6_tnl_link_config(t); | ||
1558 | |||
1559 | rcu_assign_pointer(ip6n->tnls_wc[0], t); | 1551 | rcu_assign_pointer(ip6n->tnls_wc[0], t); |
1560 | return 0; | 1552 | return 0; |
1561 | } | 1553 | } |
diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c index d440bb585524..31089d153fd3 100644 --- a/net/ipv6/ip6_vti.c +++ b/net/ipv6/ip6_vti.c | |||
@@ -172,10 +172,6 @@ static int vti6_tnl_create2(struct net_device *dev) | |||
172 | struct vti6_net *ip6n = net_generic(net, vti6_net_id); | 172 | struct vti6_net *ip6n = net_generic(net, vti6_net_id); |
173 | int err; | 173 | int err; |
174 | 174 | ||
175 | err = vti6_dev_init(dev); | ||
176 | if (err < 0) | ||
177 | goto out; | ||
178 | |||
179 | err = register_netdevice(dev); | 175 | err = register_netdevice(dev); |
180 | if (err < 0) | 176 | if (err < 0) |
181 | goto out; | 177 | goto out; |
@@ -783,6 +779,7 @@ static int vti6_change_mtu(struct net_device *dev, int new_mtu) | |||
783 | } | 779 | } |
784 | 780 | ||
785 | static const struct net_device_ops vti6_netdev_ops = { | 781 | static const struct net_device_ops vti6_netdev_ops = { |
782 | .ndo_init = vti6_dev_init, | ||
786 | .ndo_uninit = vti6_dev_uninit, | 783 | .ndo_uninit = vti6_dev_uninit, |
787 | .ndo_start_xmit = vti6_tnl_xmit, | 784 | .ndo_start_xmit = vti6_tnl_xmit, |
788 | .ndo_do_ioctl = vti6_ioctl, | 785 | .ndo_do_ioctl = vti6_ioctl, |
@@ -852,16 +849,10 @@ static int __net_init vti6_fb_tnl_dev_init(struct net_device *dev) | |||
852 | struct ip6_tnl *t = netdev_priv(dev); | 849 | struct ip6_tnl *t = netdev_priv(dev); |
853 | struct net *net = dev_net(dev); | 850 | struct net *net = dev_net(dev); |
854 | struct vti6_net *ip6n = net_generic(net, vti6_net_id); | 851 | struct vti6_net *ip6n = net_generic(net, vti6_net_id); |
855 | int err = vti6_dev_init_gen(dev); | ||
856 | |||
857 | if (err) | ||
858 | return err; | ||
859 | 852 | ||
860 | t->parms.proto = IPPROTO_IPV6; | 853 | t->parms.proto = IPPROTO_IPV6; |
861 | dev_hold(dev); | 854 | dev_hold(dev); |
862 | 855 | ||
863 | vti6_link_config(t); | ||
864 | |||
865 | rcu_assign_pointer(ip6n->tnls_wc[0], t); | 856 | rcu_assign_pointer(ip6n->tnls_wc[0], t); |
866 | return 0; | 857 | return 0; |
867 | } | 858 | } |
diff --git a/net/ipv6/netfilter/nf_reject_ipv6.c b/net/ipv6/netfilter/nf_reject_ipv6.c index 5f5f0438d74d..015eb8a80766 100644 --- a/net/ipv6/netfilter/nf_reject_ipv6.c +++ b/net/ipv6/netfilter/nf_reject_ipv6.c | |||
@@ -5,121 +5,109 @@ | |||
5 | * it under the terms of the GNU General Public License version 2 as | 5 | * it under the terms of the GNU General Public License version 2 as |
6 | * published by the Free Software Foundation. | 6 | * published by the Free Software Foundation. |
7 | */ | 7 | */ |
8 | |||
9 | #include <linux/module.h> | ||
8 | #include <net/ipv6.h> | 10 | #include <net/ipv6.h> |
9 | #include <net/ip6_route.h> | 11 | #include <net/ip6_route.h> |
10 | #include <net/ip6_fib.h> | 12 | #include <net/ip6_fib.h> |
11 | #include <net/ip6_checksum.h> | 13 | #include <net/ip6_checksum.h> |
12 | #include <linux/netfilter_ipv6.h> | 14 | #include <linux/netfilter_ipv6.h> |
15 | #include <net/netfilter/ipv6/nf_reject.h> | ||
13 | 16 | ||
14 | void nf_send_reset6(struct net *net, struct sk_buff *oldskb, int hook) | 17 | const struct tcphdr *nf_reject_ip6_tcphdr_get(struct sk_buff *oldskb, |
18 | struct tcphdr *otcph, | ||
19 | unsigned int *otcplen, int hook) | ||
15 | { | 20 | { |
16 | struct sk_buff *nskb; | ||
17 | struct tcphdr otcph, *tcph; | ||
18 | unsigned int otcplen, hh_len; | ||
19 | int tcphoff, needs_ack; | ||
20 | const struct ipv6hdr *oip6h = ipv6_hdr(oldskb); | 21 | const struct ipv6hdr *oip6h = ipv6_hdr(oldskb); |
21 | struct ipv6hdr *ip6h; | ||
22 | #define DEFAULT_TOS_VALUE 0x0U | ||
23 | const __u8 tclass = DEFAULT_TOS_VALUE; | ||
24 | struct dst_entry *dst = NULL; | ||
25 | u8 proto; | 22 | u8 proto; |
26 | __be16 frag_off; | 23 | __be16 frag_off; |
27 | struct flowi6 fl6; | 24 | int tcphoff; |
28 | |||
29 | if ((!(ipv6_addr_type(&oip6h->saddr) & IPV6_ADDR_UNICAST)) || | ||
30 | (!(ipv6_addr_type(&oip6h->daddr) & IPV6_ADDR_UNICAST))) { | ||
31 | pr_debug("addr is not unicast.\n"); | ||
32 | return; | ||
33 | } | ||
34 | 25 | ||
35 | proto = oip6h->nexthdr; | 26 | proto = oip6h->nexthdr; |
36 | tcphoff = ipv6_skip_exthdr(oldskb, ((u8*)(oip6h+1) - oldskb->data), &proto, &frag_off); | 27 | tcphoff = ipv6_skip_exthdr(oldskb, ((u8*)(oip6h+1) - oldskb->data), |
28 | &proto, &frag_off); | ||
37 | 29 | ||
38 | if ((tcphoff < 0) || (tcphoff > oldskb->len)) { | 30 | if ((tcphoff < 0) || (tcphoff > oldskb->len)) { |
39 | pr_debug("Cannot get TCP header.\n"); | 31 | pr_debug("Cannot get TCP header.\n"); |
40 | return; | 32 | return NULL; |
41 | } | 33 | } |
42 | 34 | ||
43 | otcplen = oldskb->len - tcphoff; | 35 | *otcplen = oldskb->len - tcphoff; |
44 | 36 | ||
45 | /* IP header checks: fragment, too short. */ | 37 | /* IP header checks: fragment, too short. */ |
46 | if (proto != IPPROTO_TCP || otcplen < sizeof(struct tcphdr)) { | 38 | if (proto != IPPROTO_TCP || *otcplen < sizeof(struct tcphdr)) { |
47 | pr_debug("proto(%d) != IPPROTO_TCP, " | 39 | pr_debug("proto(%d) != IPPROTO_TCP or too short (len = %d)\n", |
48 | "or too short. otcplen = %d\n", | 40 | proto, *otcplen); |
49 | proto, otcplen); | 41 | return NULL; |
50 | return; | ||
51 | } | 42 | } |
52 | 43 | ||
53 | if (skb_copy_bits(oldskb, tcphoff, &otcph, sizeof(struct tcphdr))) | 44 | otcph = skb_header_pointer(oldskb, tcphoff, sizeof(struct tcphdr), |
54 | BUG(); | 45 | otcph); |
46 | if (otcph == NULL) | ||
47 | return NULL; | ||
55 | 48 | ||
56 | /* No RST for RST. */ | 49 | /* No RST for RST. */ |
57 | if (otcph.rst) { | 50 | if (otcph->rst) { |
58 | pr_debug("RST is set\n"); | 51 | pr_debug("RST is set\n"); |
59 | return; | 52 | return NULL; |
60 | } | 53 | } |
61 | 54 | ||
62 | /* Check checksum. */ | 55 | /* Check checksum. */ |
63 | if (nf_ip6_checksum(oldskb, hook, tcphoff, IPPROTO_TCP)) { | 56 | if (nf_ip6_checksum(oldskb, hook, tcphoff, IPPROTO_TCP)) { |
64 | pr_debug("TCP checksum is invalid\n"); | 57 | pr_debug("TCP checksum is invalid\n"); |
65 | return; | 58 | return NULL; |
66 | } | 59 | } |
67 | 60 | ||
68 | memset(&fl6, 0, sizeof(fl6)); | 61 | return otcph; |
69 | fl6.flowi6_proto = IPPROTO_TCP; | 62 | } |
70 | fl6.saddr = oip6h->daddr; | 63 | EXPORT_SYMBOL_GPL(nf_reject_ip6_tcphdr_get); |
71 | fl6.daddr = oip6h->saddr; | ||
72 | fl6.fl6_sport = otcph.dest; | ||
73 | fl6.fl6_dport = otcph.source; | ||
74 | security_skb_classify_flow(oldskb, flowi6_to_flowi(&fl6)); | ||
75 | dst = ip6_route_output(net, NULL, &fl6); | ||
76 | if (dst == NULL || dst->error) { | ||
77 | dst_release(dst); | ||
78 | return; | ||
79 | } | ||
80 | dst = xfrm_lookup(net, dst, flowi6_to_flowi(&fl6), NULL, 0); | ||
81 | if (IS_ERR(dst)) | ||
82 | return; | ||
83 | |||
84 | hh_len = (dst->dev->hard_header_len + 15)&~15; | ||
85 | nskb = alloc_skb(hh_len + 15 + dst->header_len + sizeof(struct ipv6hdr) | ||
86 | + sizeof(struct tcphdr) + dst->trailer_len, | ||
87 | GFP_ATOMIC); | ||
88 | |||
89 | if (!nskb) { | ||
90 | net_dbg_ratelimited("cannot alloc skb\n"); | ||
91 | dst_release(dst); | ||
92 | return; | ||
93 | } | ||
94 | |||
95 | skb_dst_set(nskb, dst); | ||
96 | 64 | ||
97 | skb_reserve(nskb, hh_len + dst->header_len); | 65 | struct ipv6hdr *nf_reject_ip6hdr_put(struct sk_buff *nskb, |
66 | const struct sk_buff *oldskb, | ||
67 | __be16 protocol, int hoplimit) | ||
68 | { | ||
69 | struct ipv6hdr *ip6h; | ||
70 | const struct ipv6hdr *oip6h = ipv6_hdr(oldskb); | ||
71 | #define DEFAULT_TOS_VALUE 0x0U | ||
72 | const __u8 tclass = DEFAULT_TOS_VALUE; | ||
98 | 73 | ||
99 | skb_put(nskb, sizeof(struct ipv6hdr)); | 74 | skb_put(nskb, sizeof(struct ipv6hdr)); |
100 | skb_reset_network_header(nskb); | 75 | skb_reset_network_header(nskb); |
101 | ip6h = ipv6_hdr(nskb); | 76 | ip6h = ipv6_hdr(nskb); |
102 | ip6_flow_hdr(ip6h, tclass, 0); | 77 | ip6_flow_hdr(ip6h, tclass, 0); |
103 | ip6h->hop_limit = ip6_dst_hoplimit(dst); | 78 | ip6h->hop_limit = hoplimit; |
104 | ip6h->nexthdr = IPPROTO_TCP; | 79 | ip6h->nexthdr = protocol; |
105 | ip6h->saddr = oip6h->daddr; | 80 | ip6h->saddr = oip6h->daddr; |
106 | ip6h->daddr = oip6h->saddr; | 81 | ip6h->daddr = oip6h->saddr; |
107 | 82 | ||
83 | nskb->protocol = htons(ETH_P_IPV6); | ||
84 | |||
85 | return ip6h; | ||
86 | } | ||
87 | EXPORT_SYMBOL_GPL(nf_reject_ip6hdr_put); | ||
88 | |||
89 | void nf_reject_ip6_tcphdr_put(struct sk_buff *nskb, | ||
90 | const struct sk_buff *oldskb, | ||
91 | const struct tcphdr *oth, unsigned int otcplen) | ||
92 | { | ||
93 | struct tcphdr *tcph; | ||
94 | int needs_ack; | ||
95 | |||
108 | skb_reset_transport_header(nskb); | 96 | skb_reset_transport_header(nskb); |
109 | tcph = (struct tcphdr *)skb_put(nskb, sizeof(struct tcphdr)); | 97 | tcph = (struct tcphdr *)skb_put(nskb, sizeof(struct tcphdr)); |
110 | /* Truncate to length (no data) */ | 98 | /* Truncate to length (no data) */ |
111 | tcph->doff = sizeof(struct tcphdr)/4; | 99 | tcph->doff = sizeof(struct tcphdr)/4; |
112 | tcph->source = otcph.dest; | 100 | tcph->source = oth->dest; |
113 | tcph->dest = otcph.source; | 101 | tcph->dest = oth->source; |
114 | 102 | ||
115 | if (otcph.ack) { | 103 | if (oth->ack) { |
116 | needs_ack = 0; | 104 | needs_ack = 0; |
117 | tcph->seq = otcph.ack_seq; | 105 | tcph->seq = oth->ack_seq; |
118 | tcph->ack_seq = 0; | 106 | tcph->ack_seq = 0; |
119 | } else { | 107 | } else { |
120 | needs_ack = 1; | 108 | needs_ack = 1; |
121 | tcph->ack_seq = htonl(ntohl(otcph.seq) + otcph.syn + otcph.fin | 109 | tcph->ack_seq = htonl(ntohl(oth->seq) + oth->syn + oth->fin + |
122 | + otcplen - (otcph.doff<<2)); | 110 | otcplen - (oth->doff<<2)); |
123 | tcph->seq = 0; | 111 | tcph->seq = 0; |
124 | } | 112 | } |
125 | 113 | ||
@@ -137,6 +125,63 @@ void nf_send_reset6(struct net *net, struct sk_buff *oldskb, int hook) | |||
137 | sizeof(struct tcphdr), IPPROTO_TCP, | 125 | sizeof(struct tcphdr), IPPROTO_TCP, |
138 | csum_partial(tcph, | 126 | csum_partial(tcph, |
139 | sizeof(struct tcphdr), 0)); | 127 | sizeof(struct tcphdr), 0)); |
128 | } | ||
129 | EXPORT_SYMBOL_GPL(nf_reject_ip6_tcphdr_put); | ||
130 | |||
131 | void nf_send_reset6(struct net *net, struct sk_buff *oldskb, int hook) | ||
132 | { | ||
133 | struct sk_buff *nskb; | ||
134 | struct tcphdr _otcph; | ||
135 | const struct tcphdr *otcph; | ||
136 | unsigned int otcplen, hh_len; | ||
137 | const struct ipv6hdr *oip6h = ipv6_hdr(oldskb); | ||
138 | struct ipv6hdr *ip6h; | ||
139 | struct dst_entry *dst = NULL; | ||
140 | struct flowi6 fl6; | ||
141 | |||
142 | if ((!(ipv6_addr_type(&oip6h->saddr) & IPV6_ADDR_UNICAST)) || | ||
143 | (!(ipv6_addr_type(&oip6h->daddr) & IPV6_ADDR_UNICAST))) { | ||
144 | pr_debug("addr is not unicast.\n"); | ||
145 | return; | ||
146 | } | ||
147 | |||
148 | otcph = nf_reject_ip6_tcphdr_get(oldskb, &_otcph, &otcplen, hook); | ||
149 | if (!otcph) | ||
150 | return; | ||
151 | |||
152 | memset(&fl6, 0, sizeof(fl6)); | ||
153 | fl6.flowi6_proto = IPPROTO_TCP; | ||
154 | fl6.saddr = oip6h->daddr; | ||
155 | fl6.daddr = oip6h->saddr; | ||
156 | fl6.fl6_sport = otcph->dest; | ||
157 | fl6.fl6_dport = otcph->source; | ||
158 | security_skb_classify_flow(oldskb, flowi6_to_flowi(&fl6)); | ||
159 | dst = ip6_route_output(net, NULL, &fl6); | ||
160 | if (dst == NULL || dst->error) { | ||
161 | dst_release(dst); | ||
162 | return; | ||
163 | } | ||
164 | dst = xfrm_lookup(net, dst, flowi6_to_flowi(&fl6), NULL, 0); | ||
165 | if (IS_ERR(dst)) | ||
166 | return; | ||
167 | |||
168 | hh_len = (dst->dev->hard_header_len + 15)&~15; | ||
169 | nskb = alloc_skb(hh_len + 15 + dst->header_len + sizeof(struct ipv6hdr) | ||
170 | + sizeof(struct tcphdr) + dst->trailer_len, | ||
171 | GFP_ATOMIC); | ||
172 | |||
173 | if (!nskb) { | ||
174 | net_dbg_ratelimited("cannot alloc skb\n"); | ||
175 | dst_release(dst); | ||
176 | return; | ||
177 | } | ||
178 | |||
179 | skb_dst_set(nskb, dst); | ||
180 | |||
181 | skb_reserve(nskb, hh_len + dst->header_len); | ||
182 | ip6h = nf_reject_ip6hdr_put(nskb, oldskb, IPPROTO_TCP, | ||
183 | ip6_dst_hoplimit(dst)); | ||
184 | nf_reject_ip6_tcphdr_put(nskb, oldskb, otcph, otcplen); | ||
140 | 185 | ||
141 | nf_ct_attach(nskb, oldskb); | 186 | nf_ct_attach(nskb, oldskb); |
142 | 187 | ||
@@ -161,3 +206,5 @@ void nf_send_reset6(struct net *net, struct sk_buff *oldskb, int hook) | |||
161 | ip6_local_out(nskb); | 206 | ip6_local_out(nskb); |
162 | } | 207 | } |
163 | EXPORT_SYMBOL_GPL(nf_send_reset6); | 208 | EXPORT_SYMBOL_GPL(nf_send_reset6); |
209 | |||
210 | MODULE_LICENSE("GPL"); | ||
diff --git a/net/ipv6/netfilter/nft_masq_ipv6.c b/net/ipv6/netfilter/nft_masq_ipv6.c index 556262f40761..8a7ac685076d 100644 --- a/net/ipv6/netfilter/nft_masq_ipv6.c +++ b/net/ipv6/netfilter/nft_masq_ipv6.c | |||
@@ -39,6 +39,7 @@ static const struct nft_expr_ops nft_masq_ipv6_ops = { | |||
39 | .eval = nft_masq_ipv6_eval, | 39 | .eval = nft_masq_ipv6_eval, |
40 | .init = nft_masq_init, | 40 | .init = nft_masq_init, |
41 | .dump = nft_masq_dump, | 41 | .dump = nft_masq_dump, |
42 | .validate = nft_masq_validate, | ||
42 | }; | 43 | }; |
43 | 44 | ||
44 | static struct nft_expr_type nft_masq_ipv6_type __read_mostly = { | 45 | static struct nft_expr_type nft_masq_ipv6_type __read_mostly = { |
diff --git a/net/ipv6/output_core.c b/net/ipv6/output_core.c index fc24c390af05..97f41a3e68d9 100644 --- a/net/ipv6/output_core.c +++ b/net/ipv6/output_core.c | |||
@@ -3,11 +3,45 @@ | |||
3 | * not configured or static. These functions are needed by GSO/GRO implementation. | 3 | * not configured or static. These functions are needed by GSO/GRO implementation. |
4 | */ | 4 | */ |
5 | #include <linux/export.h> | 5 | #include <linux/export.h> |
6 | #include <net/ip.h> | ||
6 | #include <net/ipv6.h> | 7 | #include <net/ipv6.h> |
7 | #include <net/ip6_fib.h> | 8 | #include <net/ip6_fib.h> |
8 | #include <net/addrconf.h> | 9 | #include <net/addrconf.h> |
9 | #include <net/secure_seq.h> | 10 | #include <net/secure_seq.h> |
10 | 11 | ||
12 | /* This function exists only for tap drivers that must support broken | ||
13 | * clients requesting UFO without specifying an IPv6 fragment ID. | ||
14 | * | ||
15 | * This is similar to ipv6_select_ident() but we use an independent hash | ||
16 | * seed to limit information leakage. | ||
17 | * | ||
18 | * The network header must be set before calling this. | ||
19 | */ | ||
20 | void ipv6_proxy_select_ident(struct sk_buff *skb) | ||
21 | { | ||
22 | static u32 ip6_proxy_idents_hashrnd __read_mostly; | ||
23 | struct in6_addr buf[2]; | ||
24 | struct in6_addr *addrs; | ||
25 | u32 hash, id; | ||
26 | |||
27 | addrs = skb_header_pointer(skb, | ||
28 | skb_network_offset(skb) + | ||
29 | offsetof(struct ipv6hdr, saddr), | ||
30 | sizeof(buf), buf); | ||
31 | if (!addrs) | ||
32 | return; | ||
33 | |||
34 | net_get_random_once(&ip6_proxy_idents_hashrnd, | ||
35 | sizeof(ip6_proxy_idents_hashrnd)); | ||
36 | |||
37 | hash = __ipv6_addr_jhash(&addrs[1], ip6_proxy_idents_hashrnd); | ||
38 | hash = __ipv6_addr_jhash(&addrs[0], hash); | ||
39 | |||
40 | id = ip_idents_reserve(hash, 1); | ||
41 | skb_shinfo(skb)->ip6_frag_id = htonl(id); | ||
42 | } | ||
43 | EXPORT_SYMBOL_GPL(ipv6_proxy_select_ident); | ||
44 | |||
11 | int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr) | 45 | int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr) |
12 | { | 46 | { |
13 | u16 offset = sizeof(struct ipv6hdr); | 47 | u16 offset = sizeof(struct ipv6hdr); |
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c index 58e5b4710127..a24557a1c1d8 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c | |||
@@ -195,10 +195,8 @@ static int ipip6_tunnel_create(struct net_device *dev) | |||
195 | struct sit_net *sitn = net_generic(net, sit_net_id); | 195 | struct sit_net *sitn = net_generic(net, sit_net_id); |
196 | int err; | 196 | int err; |
197 | 197 | ||
198 | err = ipip6_tunnel_init(dev); | 198 | memcpy(dev->dev_addr, &t->parms.iph.saddr, 4); |
199 | if (err < 0) | 199 | memcpy(dev->broadcast, &t->parms.iph.daddr, 4); |
200 | goto out; | ||
201 | ipip6_tunnel_clone_6rd(dev, sitn); | ||
202 | 200 | ||
203 | if ((__force u16)t->parms.i_flags & SIT_ISATAP) | 201 | if ((__force u16)t->parms.i_flags & SIT_ISATAP) |
204 | dev->priv_flags |= IFF_ISATAP; | 202 | dev->priv_flags |= IFF_ISATAP; |
@@ -207,7 +205,8 @@ static int ipip6_tunnel_create(struct net_device *dev) | |||
207 | if (err < 0) | 205 | if (err < 0) |
208 | goto out; | 206 | goto out; |
209 | 207 | ||
210 | strcpy(t->parms.name, dev->name); | 208 | ipip6_tunnel_clone_6rd(dev, sitn); |
209 | |||
211 | dev->rtnl_link_ops = &sit_link_ops; | 210 | dev->rtnl_link_ops = &sit_link_ops; |
212 | 211 | ||
213 | dev_hold(dev); | 212 | dev_hold(dev); |
@@ -1330,6 +1329,7 @@ static int ipip6_tunnel_change_mtu(struct net_device *dev, int new_mtu) | |||
1330 | } | 1329 | } |
1331 | 1330 | ||
1332 | static const struct net_device_ops ipip6_netdev_ops = { | 1331 | static const struct net_device_ops ipip6_netdev_ops = { |
1332 | .ndo_init = ipip6_tunnel_init, | ||
1333 | .ndo_uninit = ipip6_tunnel_uninit, | 1333 | .ndo_uninit = ipip6_tunnel_uninit, |
1334 | .ndo_start_xmit = sit_tunnel_xmit, | 1334 | .ndo_start_xmit = sit_tunnel_xmit, |
1335 | .ndo_do_ioctl = ipip6_tunnel_ioctl, | 1335 | .ndo_do_ioctl = ipip6_tunnel_ioctl, |
@@ -1378,9 +1378,7 @@ static int ipip6_tunnel_init(struct net_device *dev) | |||
1378 | 1378 | ||
1379 | tunnel->dev = dev; | 1379 | tunnel->dev = dev; |
1380 | tunnel->net = dev_net(dev); | 1380 | tunnel->net = dev_net(dev); |
1381 | 1381 | strcpy(tunnel->parms.name, dev->name); | |
1382 | memcpy(dev->dev_addr, &tunnel->parms.iph.saddr, 4); | ||
1383 | memcpy(dev->broadcast, &tunnel->parms.iph.daddr, 4); | ||
1384 | 1382 | ||
1385 | ipip6_tunnel_bind_dev(dev); | 1383 | ipip6_tunnel_bind_dev(dev); |
1386 | dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); | 1384 | dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); |
@@ -1405,7 +1403,6 @@ static int __net_init ipip6_fb_tunnel_init(struct net_device *dev) | |||
1405 | 1403 | ||
1406 | tunnel->dev = dev; | 1404 | tunnel->dev = dev; |
1407 | tunnel->net = dev_net(dev); | 1405 | tunnel->net = dev_net(dev); |
1408 | strcpy(tunnel->parms.name, dev->name); | ||
1409 | 1406 | ||
1410 | iph->version = 4; | 1407 | iph->version = 4; |
1411 | iph->protocol = IPPROTO_IPV6; | 1408 | iph->protocol = IPPROTO_IPV6; |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 831495529b82..ace29b60813c 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -200,8 +200,6 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, | |||
200 | sk->sk_v6_daddr = usin->sin6_addr; | 200 | sk->sk_v6_daddr = usin->sin6_addr; |
201 | np->flow_label = fl6.flowlabel; | 201 | np->flow_label = fl6.flowlabel; |
202 | 202 | ||
203 | ip6_set_txhash(sk); | ||
204 | |||
205 | /* | 203 | /* |
206 | * TCP over IPv4 | 204 | * TCP over IPv4 |
207 | */ | 205 | */ |
@@ -297,6 +295,8 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, | |||
297 | if (err) | 295 | if (err) |
298 | goto late_failure; | 296 | goto late_failure; |
299 | 297 | ||
298 | ip6_set_txhash(sk); | ||
299 | |||
300 | if (!tp->write_seq && likely(!tp->repair)) | 300 | if (!tp->write_seq && likely(!tp->repair)) |
301 | tp->write_seq = secure_tcpv6_sequence_number(np->saddr.s6_addr32, | 301 | tp->write_seq = secure_tcpv6_sequence_number(np->saddr.s6_addr32, |
302 | sk->sk_v6_daddr.s6_addr32, | 302 | sk->sk_v6_daddr.s6_addr32, |
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c index ac49f84fe2c3..5f983644373a 100644 --- a/net/ipv6/xfrm6_policy.c +++ b/net/ipv6/xfrm6_policy.c | |||
@@ -170,8 +170,10 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse) | |||
170 | case IPPROTO_DCCP: | 170 | case IPPROTO_DCCP: |
171 | if (!onlyproto && (nh + offset + 4 < skb->data || | 171 | if (!onlyproto && (nh + offset + 4 < skb->data || |
172 | pskb_may_pull(skb, nh + offset + 4 - skb->data))) { | 172 | pskb_may_pull(skb, nh + offset + 4 - skb->data))) { |
173 | __be16 *ports = (__be16 *)exthdr; | 173 | __be16 *ports; |
174 | 174 | ||
175 | nh = skb_network_header(skb); | ||
176 | ports = (__be16 *)(nh + offset); | ||
175 | fl6->fl6_sport = ports[!!reverse]; | 177 | fl6->fl6_sport = ports[!!reverse]; |
176 | fl6->fl6_dport = ports[!reverse]; | 178 | fl6->fl6_dport = ports[!reverse]; |
177 | } | 179 | } |
@@ -180,8 +182,10 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse) | |||
180 | 182 | ||
181 | case IPPROTO_ICMPV6: | 183 | case IPPROTO_ICMPV6: |
182 | if (!onlyproto && pskb_may_pull(skb, nh + offset + 2 - skb->data)) { | 184 | if (!onlyproto && pskb_may_pull(skb, nh + offset + 2 - skb->data)) { |
183 | u8 *icmp = (u8 *)exthdr; | 185 | u8 *icmp; |
184 | 186 | ||
187 | nh = skb_network_header(skb); | ||
188 | icmp = (u8 *)(nh + offset); | ||
185 | fl6->fl6_icmp_type = icmp[0]; | 189 | fl6->fl6_icmp_type = icmp[0]; |
186 | fl6->fl6_icmp_code = icmp[1]; | 190 | fl6->fl6_icmp_code = icmp[1]; |
187 | } | 191 | } |
@@ -192,8 +196,9 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse) | |||
192 | case IPPROTO_MH: | 196 | case IPPROTO_MH: |
193 | if (!onlyproto && pskb_may_pull(skb, nh + offset + 3 - skb->data)) { | 197 | if (!onlyproto && pskb_may_pull(skb, nh + offset + 3 - skb->data)) { |
194 | struct ip6_mh *mh; | 198 | struct ip6_mh *mh; |
195 | mh = (struct ip6_mh *)exthdr; | ||
196 | 199 | ||
200 | nh = skb_network_header(skb); | ||
201 | mh = (struct ip6_mh *)(nh + offset); | ||
197 | fl6->fl6_mh_type = mh->ip6mh_type; | 202 | fl6->fl6_mh_type = mh->ip6mh_type; |
198 | } | 203 | } |
199 | fl6->flowi6_proto = nexthdr; | 204 | fl6->flowi6_proto = nexthdr; |
diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c index 92fafd485deb..3f3a6cbdceb7 100644 --- a/net/irda/af_irda.c +++ b/net/irda/af_irda.c | |||
@@ -1064,8 +1064,6 @@ static int irda_connect(struct socket *sock, struct sockaddr *uaddr, | |||
1064 | 1064 | ||
1065 | if (sk->sk_state != TCP_ESTABLISHED) { | 1065 | if (sk->sk_state != TCP_ESTABLISHED) { |
1066 | sock->state = SS_UNCONNECTED; | 1066 | sock->state = SS_UNCONNECTED; |
1067 | if (sk->sk_prot->disconnect(sk, flags)) | ||
1068 | sock->state = SS_DISCONNECTING; | ||
1069 | err = sock_error(sk); | 1067 | err = sock_error(sk); |
1070 | if (!err) | 1068 | if (!err) |
1071 | err = -ECONNRESET; | 1069 | err = -ECONNRESET; |
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index fb6a1502b6df..343da1e35025 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -3458,7 +3458,7 @@ static int ieee80211_cfg_get_channel(struct wiphy *wiphy, | |||
3458 | rcu_read_lock(); | 3458 | rcu_read_lock(); |
3459 | chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); | 3459 | chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); |
3460 | if (chanctx_conf) { | 3460 | if (chanctx_conf) { |
3461 | *chandef = chanctx_conf->def; | 3461 | *chandef = sdata->vif.bss_conf.chandef; |
3462 | ret = 0; | 3462 | ret = 0; |
3463 | } else if (local->open_count > 0 && | 3463 | } else if (local->open_count > 0 && |
3464 | local->open_count == local->monitors && | 3464 | local->open_count == local->monitors && |
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c index 56b53571c807..509bc157ce55 100644 --- a/net/mac80211/ibss.c +++ b/net/mac80211/ibss.c | |||
@@ -805,7 +805,7 @@ ieee80211_ibss_process_chanswitch(struct ieee80211_sub_if_data *sdata, | |||
805 | 805 | ||
806 | memset(¶ms, 0, sizeof(params)); | 806 | memset(¶ms, 0, sizeof(params)); |
807 | memset(&csa_ie, 0, sizeof(csa_ie)); | 807 | memset(&csa_ie, 0, sizeof(csa_ie)); |
808 | err = ieee80211_parse_ch_switch_ie(sdata, elems, beacon, | 808 | err = ieee80211_parse_ch_switch_ie(sdata, elems, |
809 | ifibss->chandef.chan->band, | 809 | ifibss->chandef.chan->band, |
810 | sta_flags, ifibss->bssid, &csa_ie); | 810 | sta_flags, ifibss->bssid, &csa_ie); |
811 | /* can't switch to destination channel, fail */ | 811 | /* can't switch to destination channel, fail */ |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index c2aaec4dfcf0..8c68da30595d 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -1642,7 +1642,6 @@ void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata, | |||
1642 | * ieee80211_parse_ch_switch_ie - parses channel switch IEs | 1642 | * ieee80211_parse_ch_switch_ie - parses channel switch IEs |
1643 | * @sdata: the sdata of the interface which has received the frame | 1643 | * @sdata: the sdata of the interface which has received the frame |
1644 | * @elems: parsed 802.11 elements received with the frame | 1644 | * @elems: parsed 802.11 elements received with the frame |
1645 | * @beacon: indicates if the frame was a beacon or probe response | ||
1646 | * @current_band: indicates the current band | 1645 | * @current_band: indicates the current band |
1647 | * @sta_flags: contains information about own capabilities and restrictions | 1646 | * @sta_flags: contains information about own capabilities and restrictions |
1648 | * to decide which channel switch announcements can be accepted. Only the | 1647 | * to decide which channel switch announcements can be accepted. Only the |
@@ -1656,7 +1655,7 @@ void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata, | |||
1656 | * Return: 0 on success, <0 on error and >0 if there is nothing to parse. | 1655 | * Return: 0 on success, <0 on error and >0 if there is nothing to parse. |
1657 | */ | 1656 | */ |
1658 | int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata, | 1657 | int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata, |
1659 | struct ieee802_11_elems *elems, bool beacon, | 1658 | struct ieee802_11_elems *elems, |
1660 | enum ieee80211_band current_band, | 1659 | enum ieee80211_band current_band, |
1661 | u32 sta_flags, u8 *bssid, | 1660 | u32 sta_flags, u8 *bssid, |
1662 | struct ieee80211_csa_ie *csa_ie); | 1661 | struct ieee80211_csa_ie *csa_ie); |
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index af237223a8cd..653f5eb07a27 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c | |||
@@ -766,10 +766,12 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, | |||
766 | int i, flushed; | 766 | int i, flushed; |
767 | struct ps_data *ps; | 767 | struct ps_data *ps; |
768 | struct cfg80211_chan_def chandef; | 768 | struct cfg80211_chan_def chandef; |
769 | bool cancel_scan; | ||
769 | 770 | ||
770 | clear_bit(SDATA_STATE_RUNNING, &sdata->state); | 771 | clear_bit(SDATA_STATE_RUNNING, &sdata->state); |
771 | 772 | ||
772 | if (rcu_access_pointer(local->scan_sdata) == sdata) | 773 | cancel_scan = rcu_access_pointer(local->scan_sdata) == sdata; |
774 | if (cancel_scan) | ||
773 | ieee80211_scan_cancel(local); | 775 | ieee80211_scan_cancel(local); |
774 | 776 | ||
775 | /* | 777 | /* |
@@ -898,6 +900,8 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, | |||
898 | list_del(&sdata->u.vlan.list); | 900 | list_del(&sdata->u.vlan.list); |
899 | mutex_unlock(&local->mtx); | 901 | mutex_unlock(&local->mtx); |
900 | RCU_INIT_POINTER(sdata->vif.chanctx_conf, NULL); | 902 | RCU_INIT_POINTER(sdata->vif.chanctx_conf, NULL); |
903 | /* see comment in the default case below */ | ||
904 | ieee80211_free_keys(sdata, true); | ||
901 | /* no need to tell driver */ | 905 | /* no need to tell driver */ |
902 | break; | 906 | break; |
903 | case NL80211_IFTYPE_MONITOR: | 907 | case NL80211_IFTYPE_MONITOR: |
@@ -923,17 +927,16 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, | |||
923 | /* | 927 | /* |
924 | * When we get here, the interface is marked down. | 928 | * When we get here, the interface is marked down. |
925 | * Free the remaining keys, if there are any | 929 | * Free the remaining keys, if there are any |
926 | * (shouldn't be, except maybe in WDS mode?) | 930 | * (which can happen in AP mode if userspace sets |
931 | * keys before the interface is operating, and maybe | ||
932 | * also in WDS mode) | ||
927 | * | 933 | * |
928 | * Force the key freeing to always synchronize_net() | 934 | * Force the key freeing to always synchronize_net() |
929 | * to wait for the RX path in case it is using this | 935 | * to wait for the RX path in case it is using this |
930 | * interface enqueuing frames * at this very time on | 936 | * interface enqueuing frames at this very time on |
931 | * another CPU. | 937 | * another CPU. |
932 | */ | 938 | */ |
933 | ieee80211_free_keys(sdata, true); | 939 | ieee80211_free_keys(sdata, true); |
934 | |||
935 | /* fall through */ | ||
936 | case NL80211_IFTYPE_AP: | ||
937 | skb_queue_purge(&sdata->skb_queue); | 940 | skb_queue_purge(&sdata->skb_queue); |
938 | } | 941 | } |
939 | 942 | ||
@@ -991,6 +994,9 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, | |||
991 | 994 | ||
992 | ieee80211_recalc_ps(local, -1); | 995 | ieee80211_recalc_ps(local, -1); |
993 | 996 | ||
997 | if (cancel_scan) | ||
998 | flush_delayed_work(&local->scan_work); | ||
999 | |||
994 | if (local->open_count == 0) { | 1000 | if (local->open_count == 0) { |
995 | ieee80211_stop_device(local); | 1001 | ieee80211_stop_device(local); |
996 | 1002 | ||
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index e9f99c1e3fad..0c8b2a77d312 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c | |||
@@ -874,7 +874,7 @@ ieee80211_mesh_process_chnswitch(struct ieee80211_sub_if_data *sdata, | |||
874 | 874 | ||
875 | memset(¶ms, 0, sizeof(params)); | 875 | memset(¶ms, 0, sizeof(params)); |
876 | memset(&csa_ie, 0, sizeof(csa_ie)); | 876 | memset(&csa_ie, 0, sizeof(csa_ie)); |
877 | err = ieee80211_parse_ch_switch_ie(sdata, elems, beacon, band, | 877 | err = ieee80211_parse_ch_switch_ie(sdata, elems, band, |
878 | sta_flags, sdata->vif.addr, | 878 | sta_flags, sdata->vif.addr, |
879 | &csa_ie); | 879 | &csa_ie); |
880 | if (err < 0) | 880 | if (err < 0) |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 2de88704278b..93af0f1c9d99 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -1072,7 +1072,7 @@ ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata, | |||
1072 | 1072 | ||
1073 | current_band = cbss->channel->band; | 1073 | current_band = cbss->channel->band; |
1074 | memset(&csa_ie, 0, sizeof(csa_ie)); | 1074 | memset(&csa_ie, 0, sizeof(csa_ie)); |
1075 | res = ieee80211_parse_ch_switch_ie(sdata, elems, beacon, current_band, | 1075 | res = ieee80211_parse_ch_switch_ie(sdata, elems, current_band, |
1076 | ifmgd->flags, | 1076 | ifmgd->flags, |
1077 | ifmgd->associated->bssid, &csa_ie); | 1077 | ifmgd->associated->bssid, &csa_ie); |
1078 | if (res < 0) | 1078 | if (res < 0) |
@@ -1168,7 +1168,8 @@ ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata, | |||
1168 | ieee80211_queue_work(&local->hw, &ifmgd->chswitch_work); | 1168 | ieee80211_queue_work(&local->hw, &ifmgd->chswitch_work); |
1169 | else | 1169 | else |
1170 | mod_timer(&ifmgd->chswitch_timer, | 1170 | mod_timer(&ifmgd->chswitch_timer, |
1171 | TU_TO_EXP_TIME(csa_ie.count * cbss->beacon_interval)); | 1171 | TU_TO_EXP_TIME((csa_ie.count - 1) * |
1172 | cbss->beacon_interval)); | ||
1172 | } | 1173 | } |
1173 | 1174 | ||
1174 | static bool | 1175 | static bool |
diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c index 8fdadfd94ba8..6081329784dd 100644 --- a/net/mac80211/rate.c +++ b/net/mac80211/rate.c | |||
@@ -448,7 +448,7 @@ static void rate_fixup_ratelist(struct ieee80211_vif *vif, | |||
448 | */ | 448 | */ |
449 | if (!(rates[0].flags & IEEE80211_TX_RC_MCS)) { | 449 | if (!(rates[0].flags & IEEE80211_TX_RC_MCS)) { |
450 | u32 basic_rates = vif->bss_conf.basic_rates; | 450 | u32 basic_rates = vif->bss_conf.basic_rates; |
451 | s8 baserate = basic_rates ? ffs(basic_rates - 1) : 0; | 451 | s8 baserate = basic_rates ? ffs(basic_rates) - 1 : 0; |
452 | 452 | ||
453 | rate = &sband->bitrates[rates[0].idx]; | 453 | rate = &sband->bitrates[rates[0].idx]; |
454 | 454 | ||
diff --git a/net/mac80211/rc80211_minstrel_debugfs.c b/net/mac80211/rc80211_minstrel_debugfs.c index edde723f9f00..2acab1bcaa4b 100644 --- a/net/mac80211/rc80211_minstrel_debugfs.c +++ b/net/mac80211/rc80211_minstrel_debugfs.c | |||
@@ -62,14 +62,14 @@ minstrel_stats_open(struct inode *inode, struct file *file) | |||
62 | unsigned int i, tp, prob, eprob; | 62 | unsigned int i, tp, prob, eprob; |
63 | char *p; | 63 | char *p; |
64 | 64 | ||
65 | ms = kmalloc(sizeof(*ms) + 4096, GFP_KERNEL); | 65 | ms = kmalloc(2048, GFP_KERNEL); |
66 | if (!ms) | 66 | if (!ms) |
67 | return -ENOMEM; | 67 | return -ENOMEM; |
68 | 68 | ||
69 | file->private_data = ms; | 69 | file->private_data = ms; |
70 | p = ms->buf; | 70 | p = ms->buf; |
71 | p += sprintf(p, "rate throughput ewma prob this prob " | 71 | p += sprintf(p, "rate tpt eprob *prob" |
72 | "this succ/attempt success attempts\n"); | 72 | " *ok(*cum) ok( cum)\n"); |
73 | for (i = 0; i < mi->n_rates; i++) { | 73 | for (i = 0; i < mi->n_rates; i++) { |
74 | struct minstrel_rate *mr = &mi->r[i]; | 74 | struct minstrel_rate *mr = &mi->r[i]; |
75 | struct minstrel_rate_stats *mrs = &mi->r[i].stats; | 75 | struct minstrel_rate_stats *mrs = &mi->r[i].stats; |
@@ -86,8 +86,8 @@ minstrel_stats_open(struct inode *inode, struct file *file) | |||
86 | prob = MINSTREL_TRUNC(mrs->cur_prob * 1000); | 86 | prob = MINSTREL_TRUNC(mrs->cur_prob * 1000); |
87 | eprob = MINSTREL_TRUNC(mrs->probability * 1000); | 87 | eprob = MINSTREL_TRUNC(mrs->probability * 1000); |
88 | 88 | ||
89 | p += sprintf(p, " %6u.%1u %6u.%1u %6u.%1u " | 89 | p += sprintf(p, " %4u.%1u %3u.%1u %3u.%1u" |
90 | " %3u(%3u) %8llu %8llu\n", | 90 | " %4u(%4u) %9llu(%9llu)\n", |
91 | tp / 10, tp % 10, | 91 | tp / 10, tp % 10, |
92 | eprob / 10, eprob % 10, | 92 | eprob / 10, eprob % 10, |
93 | prob / 10, prob % 10, | 93 | prob / 10, prob % 10, |
@@ -102,6 +102,8 @@ minstrel_stats_open(struct inode *inode, struct file *file) | |||
102 | mi->sample_packets); | 102 | mi->sample_packets); |
103 | ms->len = p - ms->buf; | 103 | ms->len = p - ms->buf; |
104 | 104 | ||
105 | WARN_ON(ms->len + sizeof(*ms) > 2048); | ||
106 | |||
105 | return 0; | 107 | return 0; |
106 | } | 108 | } |
107 | 109 | ||
diff --git a/net/mac80211/rc80211_minstrel_ht_debugfs.c b/net/mac80211/rc80211_minstrel_ht_debugfs.c index a72ad46f2a04..d537bec93754 100644 --- a/net/mac80211/rc80211_minstrel_ht_debugfs.c +++ b/net/mac80211/rc80211_minstrel_ht_debugfs.c | |||
@@ -63,8 +63,8 @@ minstrel_ht_stats_dump(struct minstrel_ht_sta *mi, int i, char *p) | |||
63 | prob = MINSTREL_TRUNC(mr->cur_prob * 1000); | 63 | prob = MINSTREL_TRUNC(mr->cur_prob * 1000); |
64 | eprob = MINSTREL_TRUNC(mr->probability * 1000); | 64 | eprob = MINSTREL_TRUNC(mr->probability * 1000); |
65 | 65 | ||
66 | p += sprintf(p, " %6u.%1u %6u.%1u %6u.%1u " | 66 | p += sprintf(p, " %4u.%1u %3u.%1u %3u.%1u " |
67 | "%3u %3u(%3u) %8llu %8llu\n", | 67 | "%3u %4u(%4u) %9llu(%9llu)\n", |
68 | tp / 10, tp % 10, | 68 | tp / 10, tp % 10, |
69 | eprob / 10, eprob % 10, | 69 | eprob / 10, eprob % 10, |
70 | prob / 10, prob % 10, | 70 | prob / 10, prob % 10, |
@@ -96,14 +96,15 @@ minstrel_ht_stats_open(struct inode *inode, struct file *file) | |||
96 | return ret; | 96 | return ret; |
97 | } | 97 | } |
98 | 98 | ||
99 | ms = kmalloc(sizeof(*ms) + 8192, GFP_KERNEL); | 99 | ms = kmalloc(8192, GFP_KERNEL); |
100 | if (!ms) | 100 | if (!ms) |
101 | return -ENOMEM; | 101 | return -ENOMEM; |
102 | 102 | ||
103 | file->private_data = ms; | 103 | file->private_data = ms; |
104 | p = ms->buf; | 104 | p = ms->buf; |
105 | p += sprintf(p, "type rate throughput ewma prob " | 105 | p += sprintf(p, "type rate tpt eprob *prob " |
106 | "this prob retry this succ/attempt success attempts\n"); | 106 | "ret *ok(*cum) ok( cum)\n"); |
107 | |||
107 | 108 | ||
108 | p = minstrel_ht_stats_dump(mi, max_mcs, p); | 109 | p = minstrel_ht_stats_dump(mi, max_mcs, p); |
109 | for (i = 0; i < max_mcs; i++) | 110 | for (i = 0; i < max_mcs; i++) |
@@ -118,6 +119,8 @@ minstrel_ht_stats_open(struct inode *inode, struct file *file) | |||
118 | MINSTREL_TRUNC(mi->avg_ampdu_len * 10) % 10); | 119 | MINSTREL_TRUNC(mi->avg_ampdu_len * 10) % 10); |
119 | ms->len = p - ms->buf; | 120 | ms->len = p - ms->buf; |
120 | 121 | ||
122 | WARN_ON(ms->len + sizeof(*ms) > 8192); | ||
123 | |||
121 | return nonseekable_open(inode, file); | 124 | return nonseekable_open(inode, file); |
122 | } | 125 | } |
123 | 126 | ||
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index b04ca4049c95..a37f9af634cb 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -1678,11 +1678,14 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx) | |||
1678 | sc = le16_to_cpu(hdr->seq_ctrl); | 1678 | sc = le16_to_cpu(hdr->seq_ctrl); |
1679 | frag = sc & IEEE80211_SCTL_FRAG; | 1679 | frag = sc & IEEE80211_SCTL_FRAG; |
1680 | 1680 | ||
1681 | if (likely((!ieee80211_has_morefrags(fc) && frag == 0) || | 1681 | if (likely(!ieee80211_has_morefrags(fc) && frag == 0)) |
1682 | is_multicast_ether_addr(hdr->addr1))) { | 1682 | goto out; |
1683 | /* not fragmented */ | 1683 | |
1684 | if (is_multicast_ether_addr(hdr->addr1)) { | ||
1685 | rx->local->dot11MulticastReceivedFrameCount++; | ||
1684 | goto out; | 1686 | goto out; |
1685 | } | 1687 | } |
1688 | |||
1686 | I802_DEBUG_INC(rx->local->rx_handlers_fragments); | 1689 | I802_DEBUG_INC(rx->local->rx_handlers_fragments); |
1687 | 1690 | ||
1688 | if (skb_linearize(rx->skb)) | 1691 | if (skb_linearize(rx->skb)) |
@@ -1775,10 +1778,7 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx) | |||
1775 | out: | 1778 | out: |
1776 | if (rx->sta) | 1779 | if (rx->sta) |
1777 | rx->sta->rx_packets++; | 1780 | rx->sta->rx_packets++; |
1778 | if (is_multicast_ether_addr(hdr->addr1)) | 1781 | ieee80211_led_rx(rx->local); |
1779 | rx->local->dot11MulticastReceivedFrameCount++; | ||
1780 | else | ||
1781 | ieee80211_led_rx(rx->local); | ||
1782 | return RX_CONTINUE; | 1782 | return RX_CONTINUE; |
1783 | } | 1783 | } |
1784 | 1784 | ||
diff --git a/net/mac80211/spectmgmt.c b/net/mac80211/spectmgmt.c index 6ab009070084..efeba56c913b 100644 --- a/net/mac80211/spectmgmt.c +++ b/net/mac80211/spectmgmt.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include "wme.h" | 22 | #include "wme.h" |
23 | 23 | ||
24 | int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata, | 24 | int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata, |
25 | struct ieee802_11_elems *elems, bool beacon, | 25 | struct ieee802_11_elems *elems, |
26 | enum ieee80211_band current_band, | 26 | enum ieee80211_band current_band, |
27 | u32 sta_flags, u8 *bssid, | 27 | u32 sta_flags, u8 *bssid, |
28 | struct ieee80211_csa_ie *csa_ie) | 28 | struct ieee80211_csa_ie *csa_ie) |
@@ -91,19 +91,13 @@ int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata, | |||
91 | return -EINVAL; | 91 | return -EINVAL; |
92 | } | 92 | } |
93 | 93 | ||
94 | if (!beacon && sec_chan_offs) { | 94 | if (sec_chan_offs) { |
95 | secondary_channel_offset = sec_chan_offs->sec_chan_offs; | 95 | secondary_channel_offset = sec_chan_offs->sec_chan_offs; |
96 | } else if (beacon && ht_oper) { | ||
97 | secondary_channel_offset = | ||
98 | ht_oper->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET; | ||
99 | } else if (!(sta_flags & IEEE80211_STA_DISABLE_HT)) { | 96 | } else if (!(sta_flags & IEEE80211_STA_DISABLE_HT)) { |
100 | /* If it's not a beacon, HT is enabled and the IE not present, | 97 | /* If the secondary channel offset IE is not present, |
101 | * it's 20 MHz, 802.11-2012 8.5.2.6: | 98 | * we can't know what's the post-CSA offset, so the |
102 | * This element [the Secondary Channel Offset Element] is | 99 | * best we can do is use 20MHz. |
103 | * present when switching to a 40 MHz channel. It may be | 100 | */ |
104 | * present when switching to a 20 MHz channel (in which | ||
105 | * case the secondary channel offset is set to SCN). | ||
106 | */ | ||
107 | secondary_channel_offset = IEEE80211_HT_PARAM_CHA_SEC_NONE; | 101 | secondary_channel_offset = IEEE80211_HT_PARAM_CHA_SEC_NONE; |
108 | } | 102 | } |
109 | 103 | ||
diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h index 42f68cb8957e..bcda2ac7d844 100644 --- a/net/mac80211/sta_info.h +++ b/net/mac80211/sta_info.h | |||
@@ -336,6 +336,7 @@ struct ieee80211_tx_latency_stat { | |||
336 | * @known_smps_mode: the smps_mode the client thinks we are in. Relevant for | 336 | * @known_smps_mode: the smps_mode the client thinks we are in. Relevant for |
337 | * AP only. | 337 | * AP only. |
338 | * @cipher_scheme: optional cipher scheme for this station | 338 | * @cipher_scheme: optional cipher scheme for this station |
339 | * @last_tdls_pkt_time: holds the time in jiffies of last TDLS pkt ACKed | ||
339 | */ | 340 | */ |
340 | struct sta_info { | 341 | struct sta_info { |
341 | /* General information, mostly static */ | 342 | /* General information, mostly static */ |
diff --git a/net/mpls/Makefile b/net/mpls/Makefile index 0a3c171be537..6dec088c2d0f 100644 --- a/net/mpls/Makefile +++ b/net/mpls/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | # | 1 | # |
2 | # Makefile for MPLS. | 2 | # Makefile for MPLS. |
3 | # | 3 | # |
4 | obj-y += mpls_gso.o | 4 | obj-$(CONFIG_NET_MPLS_GSO) += mpls_gso.o |
diff --git a/net/mpls/mpls_gso.c b/net/mpls/mpls_gso.c index e28ed2ef5b06..e3545f21a099 100644 --- a/net/mpls/mpls_gso.c +++ b/net/mpls/mpls_gso.c | |||
@@ -48,7 +48,7 @@ static struct sk_buff *mpls_gso_segment(struct sk_buff *skb, | |||
48 | __skb_push(skb, skb->mac_len); | 48 | __skb_push(skb, skb->mac_len); |
49 | 49 | ||
50 | /* Segment inner packet. */ | 50 | /* Segment inner packet. */ |
51 | mpls_features = skb->dev->mpls_features & netif_skb_features(skb); | 51 | mpls_features = skb->dev->mpls_features & features; |
52 | segs = skb_mac_gso_segment(skb, mpls_features); | 52 | segs = skb_mac_gso_segment(skb, mpls_features); |
53 | 53 | ||
54 | 54 | ||
@@ -59,8 +59,7 @@ static struct sk_buff *mpls_gso_segment(struct sk_buff *skb, | |||
59 | * above pulled. It will be re-pushed after returning | 59 | * above pulled. It will be re-pushed after returning |
60 | * skb_mac_gso_segment(), an indirect caller of this function. | 60 | * skb_mac_gso_segment(), an indirect caller of this function. |
61 | */ | 61 | */ |
62 | __skb_push(skb, skb->data - skb_mac_header(skb)); | 62 | __skb_pull(skb, skb->data - skb_mac_header(skb)); |
63 | |||
64 | out: | 63 | out: |
65 | return segs; | 64 | return segs; |
66 | } | 65 | } |
diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c index 912e5a05b79d..86f9d76b1464 100644 --- a/net/netfilter/ipset/ip_set_core.c +++ b/net/netfilter/ipset/ip_set_core.c | |||
@@ -659,7 +659,7 @@ ip_set_nfnl_get_byindex(struct net *net, ip_set_id_t index) | |||
659 | struct ip_set *set; | 659 | struct ip_set *set; |
660 | struct ip_set_net *inst = ip_set_pernet(net); | 660 | struct ip_set_net *inst = ip_set_pernet(net); |
661 | 661 | ||
662 | if (index > inst->ip_set_max) | 662 | if (index >= inst->ip_set_max) |
663 | return IPSET_INVALID_ID; | 663 | return IPSET_INVALID_ID; |
664 | 664 | ||
665 | nfnl_lock(NFNL_SUBSYS_IPSET); | 665 | nfnl_lock(NFNL_SUBSYS_IPSET); |
diff --git a/net/netfilter/ipvs/ip_vs_xmit.c b/net/netfilter/ipvs/ip_vs_xmit.c index 91f17c1eb8a2..437a3663ad03 100644 --- a/net/netfilter/ipvs/ip_vs_xmit.c +++ b/net/netfilter/ipvs/ip_vs_xmit.c | |||
@@ -316,7 +316,7 @@ __ip_vs_get_out_rt(int skb_af, struct sk_buff *skb, struct ip_vs_dest *dest, | |||
316 | if (unlikely(crosses_local_route_boundary(skb_af, skb, rt_mode, | 316 | if (unlikely(crosses_local_route_boundary(skb_af, skb, rt_mode, |
317 | local))) { | 317 | local))) { |
318 | IP_VS_DBG_RL("We are crossing local and non-local addresses" | 318 | IP_VS_DBG_RL("We are crossing local and non-local addresses" |
319 | " daddr=%pI4\n", &dest->addr.ip); | 319 | " daddr=%pI4\n", &daddr); |
320 | goto err_put; | 320 | goto err_put; |
321 | } | 321 | } |
322 | 322 | ||
@@ -458,7 +458,7 @@ __ip_vs_get_out_rt_v6(int skb_af, struct sk_buff *skb, struct ip_vs_dest *dest, | |||
458 | if (unlikely(crosses_local_route_boundary(skb_af, skb, rt_mode, | 458 | if (unlikely(crosses_local_route_boundary(skb_af, skb, rt_mode, |
459 | local))) { | 459 | local))) { |
460 | IP_VS_DBG_RL("We are crossing local and non-local addresses" | 460 | IP_VS_DBG_RL("We are crossing local and non-local addresses" |
461 | " daddr=%pI6\n", &dest->addr.in6); | 461 | " daddr=%pI6\n", daddr); |
462 | goto err_put; | 462 | goto err_put; |
463 | } | 463 | } |
464 | 464 | ||
diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c index 44d1ea32570a..d87b6423ffb2 100644 --- a/net/netfilter/nf_conntrack_proto_tcp.c +++ b/net/netfilter/nf_conntrack_proto_tcp.c | |||
@@ -213,7 +213,7 @@ static const u8 tcp_conntracks[2][6][TCP_CONNTRACK_MAX] = { | |||
213 | { | 213 | { |
214 | /* REPLY */ | 214 | /* REPLY */ |
215 | /* sNO, sSS, sSR, sES, sFW, sCW, sLA, sTW, sCL, sS2 */ | 215 | /* sNO, sSS, sSR, sES, sFW, sCW, sLA, sTW, sCL, sS2 */ |
216 | /*syn*/ { sIV, sS2, sIV, sIV, sIV, sIV, sIV, sIV, sIV, sS2 }, | 216 | /*syn*/ { sIV, sS2, sIV, sIV, sIV, sIV, sIV, sSS, sIV, sS2 }, |
217 | /* | 217 | /* |
218 | * sNO -> sIV Never reached. | 218 | * sNO -> sIV Never reached. |
219 | * sSS -> sS2 Simultaneous open | 219 | * sSS -> sS2 Simultaneous open |
@@ -223,7 +223,7 @@ static const u8 tcp_conntracks[2][6][TCP_CONNTRACK_MAX] = { | |||
223 | * sFW -> sIV | 223 | * sFW -> sIV |
224 | * sCW -> sIV | 224 | * sCW -> sIV |
225 | * sLA -> sIV | 225 | * sLA -> sIV |
226 | * sTW -> sIV Reopened connection, but server may not do it. | 226 | * sTW -> sSS Reopened connection, but server may have switched role |
227 | * sCL -> sIV | 227 | * sCL -> sIV |
228 | */ | 228 | */ |
229 | /* sNO, sSS, sSR, sES, sFW, sCW, sLA, sTW, sCL, sS2 */ | 229 | /* sNO, sSS, sSR, sES, sFW, sCW, sLA, sTW, sCL, sS2 */ |
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 556a0dfa4abc..11ab4b078f3b 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c | |||
@@ -1328,10 +1328,10 @@ static int nf_tables_newchain(struct sock *nlsk, struct sk_buff *skb, | |||
1328 | basechain->stats = stats; | 1328 | basechain->stats = stats; |
1329 | } else { | 1329 | } else { |
1330 | stats = netdev_alloc_pcpu_stats(struct nft_stats); | 1330 | stats = netdev_alloc_pcpu_stats(struct nft_stats); |
1331 | if (IS_ERR(stats)) { | 1331 | if (stats == NULL) { |
1332 | module_put(type->owner); | 1332 | module_put(type->owner); |
1333 | kfree(basechain); | 1333 | kfree(basechain); |
1334 | return PTR_ERR(stats); | 1334 | return -ENOMEM; |
1335 | } | 1335 | } |
1336 | rcu_assign_pointer(basechain->stats, stats); | 1336 | rcu_assign_pointer(basechain->stats, stats); |
1337 | } | 1337 | } |
@@ -3744,6 +3744,20 @@ static const struct nfnetlink_subsystem nf_tables_subsys = { | |||
3744 | .abort = nf_tables_abort, | 3744 | .abort = nf_tables_abort, |
3745 | }; | 3745 | }; |
3746 | 3746 | ||
3747 | int nft_chain_validate_dependency(const struct nft_chain *chain, | ||
3748 | enum nft_chain_type type) | ||
3749 | { | ||
3750 | const struct nft_base_chain *basechain; | ||
3751 | |||
3752 | if (chain->flags & NFT_BASE_CHAIN) { | ||
3753 | basechain = nft_base_chain(chain); | ||
3754 | if (basechain->type->type != type) | ||
3755 | return -EOPNOTSUPP; | ||
3756 | } | ||
3757 | return 0; | ||
3758 | } | ||
3759 | EXPORT_SYMBOL_GPL(nft_chain_validate_dependency); | ||
3760 | |||
3747 | /* | 3761 | /* |
3748 | * Loop detection - walk through the ruleset beginning at the destination chain | 3762 | * Loop detection - walk through the ruleset beginning at the destination chain |
3749 | * of a new jump until either the source chain is reached (loop) or all | 3763 | * of a new jump until either the source chain is reached (loop) or all |
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c index b1e3a0579416..5f1be5ba3559 100644 --- a/net/netfilter/nfnetlink_log.c +++ b/net/netfilter/nfnetlink_log.c | |||
@@ -43,7 +43,8 @@ | |||
43 | #define NFULNL_NLBUFSIZ_DEFAULT NLMSG_GOODSIZE | 43 | #define NFULNL_NLBUFSIZ_DEFAULT NLMSG_GOODSIZE |
44 | #define NFULNL_TIMEOUT_DEFAULT 100 /* every second */ | 44 | #define NFULNL_TIMEOUT_DEFAULT 100 /* every second */ |
45 | #define NFULNL_QTHRESH_DEFAULT 100 /* 100 packets */ | 45 | #define NFULNL_QTHRESH_DEFAULT 100 /* 100 packets */ |
46 | #define NFULNL_COPY_RANGE_MAX 0xFFFF /* max packet size is limited by 16-bit struct nfattr nfa_len field */ | 46 | /* max packet size is limited by 16-bit struct nfattr nfa_len field */ |
47 | #define NFULNL_COPY_RANGE_MAX (0xFFFF - NLA_HDRLEN) | ||
47 | 48 | ||
48 | #define PRINTR(x, args...) do { if (net_ratelimit()) \ | 49 | #define PRINTR(x, args...) do { if (net_ratelimit()) \ |
49 | printk(x, ## args); } while (0); | 50 | printk(x, ## args); } while (0); |
@@ -252,6 +253,8 @@ nfulnl_set_mode(struct nfulnl_instance *inst, u_int8_t mode, | |||
252 | 253 | ||
253 | case NFULNL_COPY_PACKET: | 254 | case NFULNL_COPY_PACKET: |
254 | inst->copy_mode = mode; | 255 | inst->copy_mode = mode; |
256 | if (range == 0) | ||
257 | range = NFULNL_COPY_RANGE_MAX; | ||
255 | inst->copy_range = min_t(unsigned int, | 258 | inst->copy_range = min_t(unsigned int, |
256 | range, NFULNL_COPY_RANGE_MAX); | 259 | range, NFULNL_COPY_RANGE_MAX); |
257 | break; | 260 | break; |
@@ -343,26 +346,25 @@ nfulnl_alloc_skb(struct net *net, u32 peer_portid, unsigned int inst_size, | |||
343 | return skb; | 346 | return skb; |
344 | } | 347 | } |
345 | 348 | ||
346 | static int | 349 | static void |
347 | __nfulnl_send(struct nfulnl_instance *inst) | 350 | __nfulnl_send(struct nfulnl_instance *inst) |
348 | { | 351 | { |
349 | int status = -1; | ||
350 | |||
351 | if (inst->qlen > 1) { | 352 | if (inst->qlen > 1) { |
352 | struct nlmsghdr *nlh = nlmsg_put(inst->skb, 0, 0, | 353 | struct nlmsghdr *nlh = nlmsg_put(inst->skb, 0, 0, |
353 | NLMSG_DONE, | 354 | NLMSG_DONE, |
354 | sizeof(struct nfgenmsg), | 355 | sizeof(struct nfgenmsg), |
355 | 0); | 356 | 0); |
356 | if (!nlh) | 357 | if (WARN_ONCE(!nlh, "bad nlskb size: %u, tailroom %d\n", |
358 | inst->skb->len, skb_tailroom(inst->skb))) { | ||
359 | kfree_skb(inst->skb); | ||
357 | goto out; | 360 | goto out; |
361 | } | ||
358 | } | 362 | } |
359 | status = nfnetlink_unicast(inst->skb, inst->net, inst->peer_portid, | 363 | nfnetlink_unicast(inst->skb, inst->net, inst->peer_portid, |
360 | MSG_DONTWAIT); | 364 | MSG_DONTWAIT); |
361 | 365 | out: | |
362 | inst->qlen = 0; | 366 | inst->qlen = 0; |
363 | inst->skb = NULL; | 367 | inst->skb = NULL; |
364 | out: | ||
365 | return status; | ||
366 | } | 368 | } |
367 | 369 | ||
368 | static void | 370 | static void |
@@ -649,7 +651,8 @@ nfulnl_log_packet(struct net *net, | |||
649 | + nla_total_size(sizeof(u_int32_t)) /* gid */ | 651 | + nla_total_size(sizeof(u_int32_t)) /* gid */ |
650 | + nla_total_size(plen) /* prefix */ | 652 | + nla_total_size(plen) /* prefix */ |
651 | + nla_total_size(sizeof(struct nfulnl_msg_packet_hw)) | 653 | + nla_total_size(sizeof(struct nfulnl_msg_packet_hw)) |
652 | + nla_total_size(sizeof(struct nfulnl_msg_packet_timestamp)); | 654 | + nla_total_size(sizeof(struct nfulnl_msg_packet_timestamp)) |
655 | + nla_total_size(sizeof(struct nfgenmsg)); /* NLMSG_DONE */ | ||
653 | 656 | ||
654 | if (in && skb_mac_header_was_set(skb)) { | 657 | if (in && skb_mac_header_was_set(skb)) { |
655 | size += nla_total_size(skb->dev->hard_header_len) | 658 | size += nla_total_size(skb->dev->hard_header_len) |
@@ -678,8 +681,7 @@ nfulnl_log_packet(struct net *net, | |||
678 | break; | 681 | break; |
679 | 682 | ||
680 | case NFULNL_COPY_PACKET: | 683 | case NFULNL_COPY_PACKET: |
681 | if (inst->copy_range == 0 | 684 | if (inst->copy_range > skb->len) |
682 | || inst->copy_range > skb->len) | ||
683 | data_len = skb->len; | 685 | data_len = skb->len; |
684 | else | 686 | else |
685 | data_len = inst->copy_range; | 687 | data_len = inst->copy_range; |
@@ -692,8 +694,7 @@ nfulnl_log_packet(struct net *net, | |||
692 | goto unlock_and_release; | 694 | goto unlock_and_release; |
693 | } | 695 | } |
694 | 696 | ||
695 | if (inst->skb && | 697 | if (inst->skb && size > skb_tailroom(inst->skb)) { |
696 | size > skb_tailroom(inst->skb) - sizeof(struct nfgenmsg)) { | ||
697 | /* either the queue len is too high or we don't have | 698 | /* either the queue len is too high or we don't have |
698 | * enough room in the skb left. flush to userspace. */ | 699 | * enough room in the skb left. flush to userspace. */ |
699 | __nfulnl_flush(inst); | 700 | __nfulnl_flush(inst); |
diff --git a/net/netfilter/nfnetlink_queue_core.c b/net/netfilter/nfnetlink_queue_core.c index a82077d9f59b..7c60ccd61a3e 100644 --- a/net/netfilter/nfnetlink_queue_core.c +++ b/net/netfilter/nfnetlink_queue_core.c | |||
@@ -665,7 +665,7 @@ nfqnl_enqueue_packet(struct nf_queue_entry *entry, unsigned int queuenum) | |||
665 | * returned by nf_queue. For instance, callers rely on -ECANCELED to | 665 | * returned by nf_queue. For instance, callers rely on -ECANCELED to |
666 | * mean 'ignore this hook'. | 666 | * mean 'ignore this hook'. |
667 | */ | 667 | */ |
668 | if (IS_ERR(segs)) | 668 | if (IS_ERR_OR_NULL(segs)) |
669 | goto out_err; | 669 | goto out_err; |
670 | queued = 0; | 670 | queued = 0; |
671 | err = 0; | 671 | err = 0; |
diff --git a/net/netfilter/nft_compat.c b/net/netfilter/nft_compat.c index 7e2683c8a44a..9d6d6f60a80f 100644 --- a/net/netfilter/nft_compat.c +++ b/net/netfilter/nft_compat.c | |||
@@ -19,9 +19,52 @@ | |||
19 | #include <linux/netfilter/x_tables.h> | 19 | #include <linux/netfilter/x_tables.h> |
20 | #include <linux/netfilter_ipv4/ip_tables.h> | 20 | #include <linux/netfilter_ipv4/ip_tables.h> |
21 | #include <linux/netfilter_ipv6/ip6_tables.h> | 21 | #include <linux/netfilter_ipv6/ip6_tables.h> |
22 | #include <asm/uaccess.h> /* for set_fs */ | ||
23 | #include <net/netfilter/nf_tables.h> | 22 | #include <net/netfilter/nf_tables.h> |
24 | 23 | ||
24 | static const struct { | ||
25 | const char *name; | ||
26 | u8 type; | ||
27 | } table_to_chaintype[] = { | ||
28 | { "filter", NFT_CHAIN_T_DEFAULT }, | ||
29 | { "raw", NFT_CHAIN_T_DEFAULT }, | ||
30 | { "security", NFT_CHAIN_T_DEFAULT }, | ||
31 | { "mangle", NFT_CHAIN_T_ROUTE }, | ||
32 | { "nat", NFT_CHAIN_T_NAT }, | ||
33 | { }, | ||
34 | }; | ||
35 | |||
36 | static int nft_compat_table_to_chaintype(const char *table) | ||
37 | { | ||
38 | int i; | ||
39 | |||
40 | for (i = 0; table_to_chaintype[i].name != NULL; i++) { | ||
41 | if (strcmp(table_to_chaintype[i].name, table) == 0) | ||
42 | return table_to_chaintype[i].type; | ||
43 | } | ||
44 | |||
45 | return -1; | ||
46 | } | ||
47 | |||
48 | static int nft_compat_chain_validate_dependency(const char *tablename, | ||
49 | const struct nft_chain *chain) | ||
50 | { | ||
51 | enum nft_chain_type type; | ||
52 | const struct nft_base_chain *basechain; | ||
53 | |||
54 | if (!tablename || !(chain->flags & NFT_BASE_CHAIN)) | ||
55 | return 0; | ||
56 | |||
57 | type = nft_compat_table_to_chaintype(tablename); | ||
58 | if (type < 0) | ||
59 | return -EINVAL; | ||
60 | |||
61 | basechain = nft_base_chain(chain); | ||
62 | if (basechain->type->type != type) | ||
63 | return -EINVAL; | ||
64 | |||
65 | return 0; | ||
66 | } | ||
67 | |||
25 | union nft_entry { | 68 | union nft_entry { |
26 | struct ipt_entry e4; | 69 | struct ipt_entry e4; |
27 | struct ip6t_entry e6; | 70 | struct ip6t_entry e6; |
@@ -95,6 +138,8 @@ nft_target_set_tgchk_param(struct xt_tgchk_param *par, | |||
95 | const struct nf_hook_ops *ops = &basechain->ops[0]; | 138 | const struct nf_hook_ops *ops = &basechain->ops[0]; |
96 | 139 | ||
97 | par->hook_mask = 1 << ops->hooknum; | 140 | par->hook_mask = 1 << ops->hooknum; |
141 | } else { | ||
142 | par->hook_mask = 0; | ||
98 | } | 143 | } |
99 | par->family = ctx->afi->family; | 144 | par->family = ctx->afi->family; |
100 | } | 145 | } |
@@ -151,6 +196,10 @@ nft_target_init(const struct nft_ctx *ctx, const struct nft_expr *expr, | |||
151 | union nft_entry e = {}; | 196 | union nft_entry e = {}; |
152 | int ret; | 197 | int ret; |
153 | 198 | ||
199 | ret = nft_compat_chain_validate_dependency(target->table, ctx->chain); | ||
200 | if (ret < 0) | ||
201 | goto err; | ||
202 | |||
154 | target_compat_from_user(target, nla_data(tb[NFTA_TARGET_INFO]), info); | 203 | target_compat_from_user(target, nla_data(tb[NFTA_TARGET_INFO]), info); |
155 | 204 | ||
156 | if (ctx->nla[NFTA_RULE_COMPAT]) { | 205 | if (ctx->nla[NFTA_RULE_COMPAT]) { |
@@ -216,6 +265,7 @@ static int nft_target_validate(const struct nft_ctx *ctx, | |||
216 | { | 265 | { |
217 | struct xt_target *target = expr->ops->data; | 266 | struct xt_target *target = expr->ops->data; |
218 | unsigned int hook_mask = 0; | 267 | unsigned int hook_mask = 0; |
268 | int ret; | ||
219 | 269 | ||
220 | if (ctx->chain->flags & NFT_BASE_CHAIN) { | 270 | if (ctx->chain->flags & NFT_BASE_CHAIN) { |
221 | const struct nft_base_chain *basechain = | 271 | const struct nft_base_chain *basechain = |
@@ -223,11 +273,13 @@ static int nft_target_validate(const struct nft_ctx *ctx, | |||
223 | const struct nf_hook_ops *ops = &basechain->ops[0]; | 273 | const struct nf_hook_ops *ops = &basechain->ops[0]; |
224 | 274 | ||
225 | hook_mask = 1 << ops->hooknum; | 275 | hook_mask = 1 << ops->hooknum; |
226 | if (hook_mask & target->hooks) | 276 | if (!(hook_mask & target->hooks)) |
227 | return 0; | 277 | return -EINVAL; |
228 | 278 | ||
229 | /* This target is being called from an invalid chain */ | 279 | ret = nft_compat_chain_validate_dependency(target->table, |
230 | return -EINVAL; | 280 | ctx->chain); |
281 | if (ret < 0) | ||
282 | return ret; | ||
231 | } | 283 | } |
232 | return 0; | 284 | return 0; |
233 | } | 285 | } |
@@ -293,6 +345,8 @@ nft_match_set_mtchk_param(struct xt_mtchk_param *par, const struct nft_ctx *ctx, | |||
293 | const struct nf_hook_ops *ops = &basechain->ops[0]; | 345 | const struct nf_hook_ops *ops = &basechain->ops[0]; |
294 | 346 | ||
295 | par->hook_mask = 1 << ops->hooknum; | 347 | par->hook_mask = 1 << ops->hooknum; |
348 | } else { | ||
349 | par->hook_mask = 0; | ||
296 | } | 350 | } |
297 | par->family = ctx->afi->family; | 351 | par->family = ctx->afi->family; |
298 | } | 352 | } |
@@ -320,6 +374,10 @@ nft_match_init(const struct nft_ctx *ctx, const struct nft_expr *expr, | |||
320 | union nft_entry e = {}; | 374 | union nft_entry e = {}; |
321 | int ret; | 375 | int ret; |
322 | 376 | ||
377 | ret = nft_compat_chain_validate_dependency(match->name, ctx->chain); | ||
378 | if (ret < 0) | ||
379 | goto err; | ||
380 | |||
323 | match_compat_from_user(match, nla_data(tb[NFTA_MATCH_INFO]), info); | 381 | match_compat_from_user(match, nla_data(tb[NFTA_MATCH_INFO]), info); |
324 | 382 | ||
325 | if (ctx->nla[NFTA_RULE_COMPAT]) { | 383 | if (ctx->nla[NFTA_RULE_COMPAT]) { |
@@ -379,6 +437,7 @@ static int nft_match_validate(const struct nft_ctx *ctx, | |||
379 | { | 437 | { |
380 | struct xt_match *match = expr->ops->data; | 438 | struct xt_match *match = expr->ops->data; |
381 | unsigned int hook_mask = 0; | 439 | unsigned int hook_mask = 0; |
440 | int ret; | ||
382 | 441 | ||
383 | if (ctx->chain->flags & NFT_BASE_CHAIN) { | 442 | if (ctx->chain->flags & NFT_BASE_CHAIN) { |
384 | const struct nft_base_chain *basechain = | 443 | const struct nft_base_chain *basechain = |
@@ -386,11 +445,13 @@ static int nft_match_validate(const struct nft_ctx *ctx, | |||
386 | const struct nf_hook_ops *ops = &basechain->ops[0]; | 445 | const struct nf_hook_ops *ops = &basechain->ops[0]; |
387 | 446 | ||
388 | hook_mask = 1 << ops->hooknum; | 447 | hook_mask = 1 << ops->hooknum; |
389 | if (hook_mask & match->hooks) | 448 | if (!(hook_mask & match->hooks)) |
390 | return 0; | 449 | return -EINVAL; |
391 | 450 | ||
392 | /* This match is being called from an invalid chain */ | 451 | ret = nft_compat_chain_validate_dependency(match->name, |
393 | return -EINVAL; | 452 | ctx->chain); |
453 | if (ret < 0) | ||
454 | return ret; | ||
394 | } | 455 | } |
395 | return 0; | 456 | return 0; |
396 | } | 457 | } |
@@ -611,7 +672,7 @@ nft_target_select_ops(const struct nft_ctx *ctx, | |||
611 | family = ctx->afi->family; | 672 | family = ctx->afi->family; |
612 | 673 | ||
613 | /* Re-use the existing target if it's already loaded. */ | 674 | /* Re-use the existing target if it's already loaded. */ |
614 | list_for_each_entry(nft_target, &nft_match_list, head) { | 675 | list_for_each_entry(nft_target, &nft_target_list, head) { |
615 | struct xt_target *target = nft_target->ops.data; | 676 | struct xt_target *target = nft_target->ops.data; |
616 | 677 | ||
617 | if (strcmp(target->name, tg_name) == 0 && | 678 | if (strcmp(target->name, tg_name) == 0 && |
diff --git a/net/netfilter/nft_masq.c b/net/netfilter/nft_masq.c index 6637bab00567..d1ffd5eb3a9b 100644 --- a/net/netfilter/nft_masq.c +++ b/net/netfilter/nft_masq.c | |||
@@ -26,6 +26,11 @@ int nft_masq_init(const struct nft_ctx *ctx, | |||
26 | const struct nlattr * const tb[]) | 26 | const struct nlattr * const tb[]) |
27 | { | 27 | { |
28 | struct nft_masq *priv = nft_expr_priv(expr); | 28 | struct nft_masq *priv = nft_expr_priv(expr); |
29 | int err; | ||
30 | |||
31 | err = nft_chain_validate_dependency(ctx->chain, NFT_CHAIN_T_NAT); | ||
32 | if (err < 0) | ||
33 | return err; | ||
29 | 34 | ||
30 | if (tb[NFTA_MASQ_FLAGS] == NULL) | 35 | if (tb[NFTA_MASQ_FLAGS] == NULL) |
31 | return 0; | 36 | return 0; |
@@ -55,5 +60,12 @@ nla_put_failure: | |||
55 | } | 60 | } |
56 | EXPORT_SYMBOL_GPL(nft_masq_dump); | 61 | EXPORT_SYMBOL_GPL(nft_masq_dump); |
57 | 62 | ||
63 | int nft_masq_validate(const struct nft_ctx *ctx, const struct nft_expr *expr, | ||
64 | const struct nft_data **data) | ||
65 | { | ||
66 | return nft_chain_validate_dependency(ctx->chain, NFT_CHAIN_T_NAT); | ||
67 | } | ||
68 | EXPORT_SYMBOL_GPL(nft_masq_validate); | ||
69 | |||
58 | MODULE_LICENSE("GPL"); | 70 | MODULE_LICENSE("GPL"); |
59 | MODULE_AUTHOR("Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>"); | 71 | MODULE_AUTHOR("Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>"); |
diff --git a/net/netfilter/nft_nat.c b/net/netfilter/nft_nat.c index 799550b476fb..afe2b0b45ec4 100644 --- a/net/netfilter/nft_nat.c +++ b/net/netfilter/nft_nat.c | |||
@@ -95,7 +95,13 @@ static int nft_nat_init(const struct nft_ctx *ctx, const struct nft_expr *expr, | |||
95 | u32 family; | 95 | u32 family; |
96 | int err; | 96 | int err; |
97 | 97 | ||
98 | if (tb[NFTA_NAT_TYPE] == NULL) | 98 | err = nft_chain_validate_dependency(ctx->chain, NFT_CHAIN_T_NAT); |
99 | if (err < 0) | ||
100 | return err; | ||
101 | |||
102 | if (tb[NFTA_NAT_TYPE] == NULL || | ||
103 | (tb[NFTA_NAT_REG_ADDR_MIN] == NULL && | ||
104 | tb[NFTA_NAT_REG_PROTO_MIN] == NULL)) | ||
99 | return -EINVAL; | 105 | return -EINVAL; |
100 | 106 | ||
101 | switch (ntohl(nla_get_be32(tb[NFTA_NAT_TYPE]))) { | 107 | switch (ntohl(nla_get_be32(tb[NFTA_NAT_TYPE]))) { |
@@ -120,38 +126,44 @@ static int nft_nat_init(const struct nft_ctx *ctx, const struct nft_expr *expr, | |||
120 | priv->family = family; | 126 | priv->family = family; |
121 | 127 | ||
122 | if (tb[NFTA_NAT_REG_ADDR_MIN]) { | 128 | if (tb[NFTA_NAT_REG_ADDR_MIN]) { |
123 | priv->sreg_addr_min = ntohl(nla_get_be32( | 129 | priv->sreg_addr_min = |
124 | tb[NFTA_NAT_REG_ADDR_MIN])); | 130 | ntohl(nla_get_be32(tb[NFTA_NAT_REG_ADDR_MIN])); |
131 | |||
125 | err = nft_validate_input_register(priv->sreg_addr_min); | 132 | err = nft_validate_input_register(priv->sreg_addr_min); |
126 | if (err < 0) | 133 | if (err < 0) |
127 | return err; | 134 | return err; |
128 | } | ||
129 | 135 | ||
130 | if (tb[NFTA_NAT_REG_ADDR_MAX]) { | 136 | if (tb[NFTA_NAT_REG_ADDR_MAX]) { |
131 | priv->sreg_addr_max = ntohl(nla_get_be32( | 137 | priv->sreg_addr_max = |
132 | tb[NFTA_NAT_REG_ADDR_MAX])); | 138 | ntohl(nla_get_be32(tb[NFTA_NAT_REG_ADDR_MAX])); |
133 | err = nft_validate_input_register(priv->sreg_addr_max); | 139 | |
134 | if (err < 0) | 140 | err = nft_validate_input_register(priv->sreg_addr_max); |
135 | return err; | 141 | if (err < 0) |
136 | } else | 142 | return err; |
137 | priv->sreg_addr_max = priv->sreg_addr_min; | 143 | } else { |
144 | priv->sreg_addr_max = priv->sreg_addr_min; | ||
145 | } | ||
146 | } | ||
138 | 147 | ||
139 | if (tb[NFTA_NAT_REG_PROTO_MIN]) { | 148 | if (tb[NFTA_NAT_REG_PROTO_MIN]) { |
140 | priv->sreg_proto_min = ntohl(nla_get_be32( | 149 | priv->sreg_proto_min = |
141 | tb[NFTA_NAT_REG_PROTO_MIN])); | 150 | ntohl(nla_get_be32(tb[NFTA_NAT_REG_PROTO_MIN])); |
151 | |||
142 | err = nft_validate_input_register(priv->sreg_proto_min); | 152 | err = nft_validate_input_register(priv->sreg_proto_min); |
143 | if (err < 0) | 153 | if (err < 0) |
144 | return err; | 154 | return err; |
145 | } | ||
146 | 155 | ||
147 | if (tb[NFTA_NAT_REG_PROTO_MAX]) { | 156 | if (tb[NFTA_NAT_REG_PROTO_MAX]) { |
148 | priv->sreg_proto_max = ntohl(nla_get_be32( | 157 | priv->sreg_proto_max = |
149 | tb[NFTA_NAT_REG_PROTO_MAX])); | 158 | ntohl(nla_get_be32(tb[NFTA_NAT_REG_PROTO_MAX])); |
150 | err = nft_validate_input_register(priv->sreg_proto_max); | 159 | |
151 | if (err < 0) | 160 | err = nft_validate_input_register(priv->sreg_proto_max); |
152 | return err; | 161 | if (err < 0) |
153 | } else | 162 | return err; |
154 | priv->sreg_proto_max = priv->sreg_proto_min; | 163 | } else { |
164 | priv->sreg_proto_max = priv->sreg_proto_min; | ||
165 | } | ||
166 | } | ||
155 | 167 | ||
156 | if (tb[NFTA_NAT_FLAGS]) { | 168 | if (tb[NFTA_NAT_FLAGS]) { |
157 | priv->flags = ntohl(nla_get_be32(tb[NFTA_NAT_FLAGS])); | 169 | priv->flags = ntohl(nla_get_be32(tb[NFTA_NAT_FLAGS])); |
@@ -179,17 +191,19 @@ static int nft_nat_dump(struct sk_buff *skb, const struct nft_expr *expr) | |||
179 | 191 | ||
180 | if (nla_put_be32(skb, NFTA_NAT_FAMILY, htonl(priv->family))) | 192 | if (nla_put_be32(skb, NFTA_NAT_FAMILY, htonl(priv->family))) |
181 | goto nla_put_failure; | 193 | goto nla_put_failure; |
182 | if (nla_put_be32(skb, | 194 | |
183 | NFTA_NAT_REG_ADDR_MIN, htonl(priv->sreg_addr_min))) | 195 | if (priv->sreg_addr_min) { |
184 | goto nla_put_failure; | 196 | if (nla_put_be32(skb, NFTA_NAT_REG_ADDR_MIN, |
185 | if (nla_put_be32(skb, | 197 | htonl(priv->sreg_addr_min)) || |
186 | NFTA_NAT_REG_ADDR_MAX, htonl(priv->sreg_addr_max))) | 198 | nla_put_be32(skb, NFTA_NAT_REG_ADDR_MAX, |
187 | goto nla_put_failure; | 199 | htonl(priv->sreg_addr_max))) |
200 | goto nla_put_failure; | ||
201 | } | ||
202 | |||
188 | if (priv->sreg_proto_min) { | 203 | if (priv->sreg_proto_min) { |
189 | if (nla_put_be32(skb, NFTA_NAT_REG_PROTO_MIN, | 204 | if (nla_put_be32(skb, NFTA_NAT_REG_PROTO_MIN, |
190 | htonl(priv->sreg_proto_min))) | 205 | htonl(priv->sreg_proto_min)) || |
191 | goto nla_put_failure; | 206 | nla_put_be32(skb, NFTA_NAT_REG_PROTO_MAX, |
192 | if (nla_put_be32(skb, NFTA_NAT_REG_PROTO_MAX, | ||
193 | htonl(priv->sreg_proto_max))) | 207 | htonl(priv->sreg_proto_max))) |
194 | goto nla_put_failure; | 208 | goto nla_put_failure; |
195 | } | 209 | } |
@@ -205,6 +219,13 @@ nla_put_failure: | |||
205 | return -1; | 219 | return -1; |
206 | } | 220 | } |
207 | 221 | ||
222 | static int nft_nat_validate(const struct nft_ctx *ctx, | ||
223 | const struct nft_expr *expr, | ||
224 | const struct nft_data **data) | ||
225 | { | ||
226 | return nft_chain_validate_dependency(ctx->chain, NFT_CHAIN_T_NAT); | ||
227 | } | ||
228 | |||
208 | static struct nft_expr_type nft_nat_type; | 229 | static struct nft_expr_type nft_nat_type; |
209 | static const struct nft_expr_ops nft_nat_ops = { | 230 | static const struct nft_expr_ops nft_nat_ops = { |
210 | .type = &nft_nat_type, | 231 | .type = &nft_nat_type, |
@@ -212,6 +233,7 @@ static const struct nft_expr_ops nft_nat_ops = { | |||
212 | .eval = nft_nat_eval, | 233 | .eval = nft_nat_eval, |
213 | .init = nft_nat_init, | 234 | .init = nft_nat_init, |
214 | .dump = nft_nat_dump, | 235 | .dump = nft_nat_dump, |
236 | .validate = nft_nat_validate, | ||
215 | }; | 237 | }; |
216 | 238 | ||
217 | static struct nft_expr_type nft_nat_type __read_mostly = { | 239 | static struct nft_expr_type nft_nat_type __read_mostly = { |
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 7a186e74b1b3..0007b8180397 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -96,6 +96,14 @@ static DECLARE_WAIT_QUEUE_HEAD(nl_table_wait); | |||
96 | static int netlink_dump(struct sock *sk); | 96 | static int netlink_dump(struct sock *sk); |
97 | static void netlink_skb_destructor(struct sk_buff *skb); | 97 | static void netlink_skb_destructor(struct sk_buff *skb); |
98 | 98 | ||
99 | /* nl_table locking explained: | ||
100 | * Lookup and traversal are protected with nl_sk_hash_lock or nl_table_lock | ||
101 | * combined with an RCU read-side lock. Insertion and removal are protected | ||
102 | * with nl_sk_hash_lock while using RCU list modification primitives and may | ||
103 | * run in parallel to nl_table_lock protected lookups. Destruction of the | ||
104 | * Netlink socket may only occur *after* nl_table_lock has been acquired | ||
105 | * either during or after the socket has been removed from the list. | ||
106 | */ | ||
99 | DEFINE_RWLOCK(nl_table_lock); | 107 | DEFINE_RWLOCK(nl_table_lock); |
100 | EXPORT_SYMBOL_GPL(nl_table_lock); | 108 | EXPORT_SYMBOL_GPL(nl_table_lock); |
101 | static atomic_t nl_table_users = ATOMIC_INIT(0); | 109 | static atomic_t nl_table_users = ATOMIC_INIT(0); |
@@ -109,10 +117,10 @@ EXPORT_SYMBOL_GPL(nl_sk_hash_lock); | |||
109 | static int lockdep_nl_sk_hash_is_held(void) | 117 | static int lockdep_nl_sk_hash_is_held(void) |
110 | { | 118 | { |
111 | #ifdef CONFIG_LOCKDEP | 119 | #ifdef CONFIG_LOCKDEP |
112 | return (debug_locks) ? lockdep_is_held(&nl_sk_hash_lock) : 1; | 120 | if (debug_locks) |
113 | #else | 121 | return lockdep_is_held(&nl_sk_hash_lock) || lockdep_is_held(&nl_table_lock); |
114 | return 1; | ||
115 | #endif | 122 | #endif |
123 | return 1; | ||
116 | } | 124 | } |
117 | 125 | ||
118 | static ATOMIC_NOTIFIER_HEAD(netlink_chain); | 126 | static ATOMIC_NOTIFIER_HEAD(netlink_chain); |
@@ -1028,11 +1036,13 @@ static struct sock *netlink_lookup(struct net *net, int protocol, u32 portid) | |||
1028 | struct netlink_table *table = &nl_table[protocol]; | 1036 | struct netlink_table *table = &nl_table[protocol]; |
1029 | struct sock *sk; | 1037 | struct sock *sk; |
1030 | 1038 | ||
1039 | read_lock(&nl_table_lock); | ||
1031 | rcu_read_lock(); | 1040 | rcu_read_lock(); |
1032 | sk = __netlink_lookup(table, portid, net); | 1041 | sk = __netlink_lookup(table, portid, net); |
1033 | if (sk) | 1042 | if (sk) |
1034 | sock_hold(sk); | 1043 | sock_hold(sk); |
1035 | rcu_read_unlock(); | 1044 | rcu_read_unlock(); |
1045 | read_unlock(&nl_table_lock); | ||
1036 | 1046 | ||
1037 | return sk; | 1047 | return sk; |
1038 | } | 1048 | } |
@@ -1257,9 +1267,6 @@ static int netlink_release(struct socket *sock) | |||
1257 | } | 1267 | } |
1258 | netlink_table_ungrab(); | 1268 | netlink_table_ungrab(); |
1259 | 1269 | ||
1260 | /* Wait for readers to complete */ | ||
1261 | synchronize_net(); | ||
1262 | |||
1263 | kfree(nlk->groups); | 1270 | kfree(nlk->groups); |
1264 | nlk->groups = NULL; | 1271 | nlk->groups = NULL; |
1265 | 1272 | ||
@@ -1281,6 +1288,7 @@ static int netlink_autobind(struct socket *sock) | |||
1281 | 1288 | ||
1282 | retry: | 1289 | retry: |
1283 | cond_resched(); | 1290 | cond_resched(); |
1291 | netlink_table_grab(); | ||
1284 | rcu_read_lock(); | 1292 | rcu_read_lock(); |
1285 | if (__netlink_lookup(table, portid, net)) { | 1293 | if (__netlink_lookup(table, portid, net)) { |
1286 | /* Bind collision, search negative portid values. */ | 1294 | /* Bind collision, search negative portid values. */ |
@@ -1288,9 +1296,11 @@ retry: | |||
1288 | if (rover > -4097) | 1296 | if (rover > -4097) |
1289 | rover = -4097; | 1297 | rover = -4097; |
1290 | rcu_read_unlock(); | 1298 | rcu_read_unlock(); |
1299 | netlink_table_ungrab(); | ||
1291 | goto retry; | 1300 | goto retry; |
1292 | } | 1301 | } |
1293 | rcu_read_unlock(); | 1302 | rcu_read_unlock(); |
1303 | netlink_table_ungrab(); | ||
1294 | 1304 | ||
1295 | err = netlink_insert(sk, net, portid); | 1305 | err = netlink_insert(sk, net, portid); |
1296 | if (err == -EADDRINUSE) | 1306 | if (err == -EADDRINUSE) |
@@ -1430,7 +1440,7 @@ static void netlink_unbind(int group, long unsigned int groups, | |||
1430 | return; | 1440 | return; |
1431 | 1441 | ||
1432 | for (undo = 0; undo < group; undo++) | 1442 | for (undo = 0; undo < group; undo++) |
1433 | if (test_bit(group, &groups)) | 1443 | if (test_bit(undo, &groups)) |
1434 | nlk->netlink_unbind(undo); | 1444 | nlk->netlink_unbind(undo); |
1435 | } | 1445 | } |
1436 | 1446 | ||
@@ -1482,7 +1492,7 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr, | |||
1482 | netlink_insert(sk, net, nladdr->nl_pid) : | 1492 | netlink_insert(sk, net, nladdr->nl_pid) : |
1483 | netlink_autobind(sock); | 1493 | netlink_autobind(sock); |
1484 | if (err) { | 1494 | if (err) { |
1485 | netlink_unbind(nlk->ngroups - 1, groups, nlk); | 1495 | netlink_unbind(nlk->ngroups, groups, nlk); |
1486 | return err; | 1496 | return err; |
1487 | } | 1497 | } |
1488 | } | 1498 | } |
@@ -2499,6 +2509,7 @@ __netlink_kernel_create(struct net *net, int unit, struct module *module, | |||
2499 | nl_table[unit].module = module; | 2509 | nl_table[unit].module = module; |
2500 | if (cfg) { | 2510 | if (cfg) { |
2501 | nl_table[unit].bind = cfg->bind; | 2511 | nl_table[unit].bind = cfg->bind; |
2512 | nl_table[unit].unbind = cfg->unbind; | ||
2502 | nl_table[unit].flags = cfg->flags; | 2513 | nl_table[unit].flags = cfg->flags; |
2503 | if (cfg->compare) | 2514 | if (cfg->compare) |
2504 | nl_table[unit].compare = cfg->compare; | 2515 | nl_table[unit].compare = cfg->compare; |
@@ -2921,14 +2932,16 @@ static struct sock *netlink_seq_socket_idx(struct seq_file *seq, loff_t pos) | |||
2921 | } | 2932 | } |
2922 | 2933 | ||
2923 | static void *netlink_seq_start(struct seq_file *seq, loff_t *pos) | 2934 | static void *netlink_seq_start(struct seq_file *seq, loff_t *pos) |
2924 | __acquires(RCU) | 2935 | __acquires(nl_table_lock) __acquires(RCU) |
2925 | { | 2936 | { |
2937 | read_lock(&nl_table_lock); | ||
2926 | rcu_read_lock(); | 2938 | rcu_read_lock(); |
2927 | return *pos ? netlink_seq_socket_idx(seq, *pos - 1) : SEQ_START_TOKEN; | 2939 | return *pos ? netlink_seq_socket_idx(seq, *pos - 1) : SEQ_START_TOKEN; |
2928 | } | 2940 | } |
2929 | 2941 | ||
2930 | static void *netlink_seq_next(struct seq_file *seq, void *v, loff_t *pos) | 2942 | static void *netlink_seq_next(struct seq_file *seq, void *v, loff_t *pos) |
2931 | { | 2943 | { |
2944 | struct rhashtable *ht; | ||
2932 | struct netlink_sock *nlk; | 2945 | struct netlink_sock *nlk; |
2933 | struct nl_seq_iter *iter; | 2946 | struct nl_seq_iter *iter; |
2934 | struct net *net; | 2947 | struct net *net; |
@@ -2943,19 +2956,19 @@ static void *netlink_seq_next(struct seq_file *seq, void *v, loff_t *pos) | |||
2943 | iter = seq->private; | 2956 | iter = seq->private; |
2944 | nlk = v; | 2957 | nlk = v; |
2945 | 2958 | ||
2946 | rht_for_each_entry_rcu(nlk, nlk->node.next, node) | 2959 | i = iter->link; |
2960 | ht = &nl_table[i].hash; | ||
2961 | rht_for_each_entry(nlk, nlk->node.next, ht, node) | ||
2947 | if (net_eq(sock_net((struct sock *)nlk), net)) | 2962 | if (net_eq(sock_net((struct sock *)nlk), net)) |
2948 | return nlk; | 2963 | return nlk; |
2949 | 2964 | ||
2950 | i = iter->link; | ||
2951 | j = iter->hash_idx + 1; | 2965 | j = iter->hash_idx + 1; |
2952 | 2966 | ||
2953 | do { | 2967 | do { |
2954 | struct rhashtable *ht = &nl_table[i].hash; | ||
2955 | const struct bucket_table *tbl = rht_dereference_rcu(ht->tbl, ht); | 2968 | const struct bucket_table *tbl = rht_dereference_rcu(ht->tbl, ht); |
2956 | 2969 | ||
2957 | for (; j < tbl->size; j++) { | 2970 | for (; j < tbl->size; j++) { |
2958 | rht_for_each_entry_rcu(nlk, tbl->buckets[j], node) { | 2971 | rht_for_each_entry(nlk, tbl->buckets[j], ht, node) { |
2959 | if (net_eq(sock_net((struct sock *)nlk), net)) { | 2972 | if (net_eq(sock_net((struct sock *)nlk), net)) { |
2960 | iter->link = i; | 2973 | iter->link = i; |
2961 | iter->hash_idx = j; | 2974 | iter->hash_idx = j; |
@@ -2971,9 +2984,10 @@ static void *netlink_seq_next(struct seq_file *seq, void *v, loff_t *pos) | |||
2971 | } | 2984 | } |
2972 | 2985 | ||
2973 | static void netlink_seq_stop(struct seq_file *seq, void *v) | 2986 | static void netlink_seq_stop(struct seq_file *seq, void *v) |
2974 | __releases(RCU) | 2987 | __releases(RCU) __releases(nl_table_lock) |
2975 | { | 2988 | { |
2976 | rcu_read_unlock(); | 2989 | rcu_read_unlock(); |
2990 | read_unlock(&nl_table_lock); | ||
2977 | } | 2991 | } |
2978 | 2992 | ||
2979 | 2993 | ||
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index 2e31d9e7f4dc..e6d7255183eb 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c | |||
@@ -324,6 +324,8 @@ static int queue_gso_packets(struct datapath *dp, struct sk_buff *skb, | |||
324 | segs = __skb_gso_segment(skb, NETIF_F_SG, false); | 324 | segs = __skb_gso_segment(skb, NETIF_F_SG, false); |
325 | if (IS_ERR(segs)) | 325 | if (IS_ERR(segs)) |
326 | return PTR_ERR(segs); | 326 | return PTR_ERR(segs); |
327 | if (segs == NULL) | ||
328 | return -EINVAL; | ||
327 | 329 | ||
328 | /* Queue all of the segments. */ | 330 | /* Queue all of the segments. */ |
329 | skb = segs; | 331 | skb = segs; |
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index 2cf61b3e633c..76f402e05bd6 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
@@ -947,7 +947,7 @@ qdisc_create(struct net_device *dev, struct netdev_queue *dev_queue, | |||
947 | if (!ops->init || (err = ops->init(sch, tca[TCA_OPTIONS])) == 0) { | 947 | if (!ops->init || (err = ops->init(sch, tca[TCA_OPTIONS])) == 0) { |
948 | if (qdisc_is_percpu_stats(sch)) { | 948 | if (qdisc_is_percpu_stats(sch)) { |
949 | sch->cpu_bstats = | 949 | sch->cpu_bstats = |
950 | alloc_percpu(struct gnet_stats_basic_cpu); | 950 | netdev_alloc_pcpu_stats(struct gnet_stats_basic_cpu); |
951 | if (!sch->cpu_bstats) | 951 | if (!sch->cpu_bstats) |
952 | goto err_out4; | 952 | goto err_out4; |
953 | 953 | ||
diff --git a/net/sched/sch_pie.c b/net/sched/sch_pie.c index 33d7a98a7a97..b783a446d884 100644 --- a/net/sched/sch_pie.c +++ b/net/sched/sch_pie.c | |||
@@ -445,7 +445,6 @@ static int pie_init(struct Qdisc *sch, struct nlattr *opt) | |||
445 | sch->limit = q->params.limit; | 445 | sch->limit = q->params.limit; |
446 | 446 | ||
447 | setup_timer(&q->adapt_timer, pie_timer, (unsigned long)sch); | 447 | setup_timer(&q->adapt_timer, pie_timer, (unsigned long)sch); |
448 | mod_timer(&q->adapt_timer, jiffies + HZ / 2); | ||
449 | 448 | ||
450 | if (opt) { | 449 | if (opt) { |
451 | int err = pie_change(sch, opt); | 450 | int err = pie_change(sch, opt); |
@@ -454,6 +453,7 @@ static int pie_init(struct Qdisc *sch, struct nlattr *opt) | |||
454 | return err; | 453 | return err; |
455 | } | 454 | } |
456 | 455 | ||
456 | mod_timer(&q->adapt_timer, jiffies + HZ / 2); | ||
457 | return 0; | 457 | return 0; |
458 | } | 458 | } |
459 | 459 | ||
diff --git a/net/sctp/auth.c b/net/sctp/auth.c index 0e8529113dc5..fb7976aee61c 100644 --- a/net/sctp/auth.c +++ b/net/sctp/auth.c | |||
@@ -862,8 +862,6 @@ int sctp_auth_set_key(struct sctp_endpoint *ep, | |||
862 | list_add(&cur_key->key_list, sh_keys); | 862 | list_add(&cur_key->key_list, sh_keys); |
863 | 863 | ||
864 | cur_key->key = key; | 864 | cur_key->key = key; |
865 | sctp_auth_key_hold(key); | ||
866 | |||
867 | return 0; | 865 | return 0; |
868 | nomem: | 866 | nomem: |
869 | if (!replace) | 867 | if (!replace) |
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index ab734be8cb20..9f32741abb1c 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c | |||
@@ -2609,6 +2609,9 @@ do_addr_param: | |||
2609 | addr_param = param.v + sizeof(sctp_addip_param_t); | 2609 | addr_param = param.v + sizeof(sctp_addip_param_t); |
2610 | 2610 | ||
2611 | af = sctp_get_af_specific(param_type2af(param.p->type)); | 2611 | af = sctp_get_af_specific(param_type2af(param.p->type)); |
2612 | if (af == NULL) | ||
2613 | break; | ||
2614 | |||
2612 | af->from_addr_param(&addr, addr_param, | 2615 | af->from_addr_param(&addr, addr_param, |
2613 | htons(asoc->peer.port), 0); | 2616 | htons(asoc->peer.port), 0); |
2614 | 2617 | ||
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index afb292cd797d..53ed8d3f8897 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c | |||
@@ -1353,6 +1353,7 @@ gss_stringify_acceptor(struct rpc_cred *cred) | |||
1353 | char *string = NULL; | 1353 | char *string = NULL; |
1354 | struct gss_cred *gss_cred = container_of(cred, struct gss_cred, gc_base); | 1354 | struct gss_cred *gss_cred = container_of(cred, struct gss_cred, gc_base); |
1355 | struct gss_cl_ctx *ctx; | 1355 | struct gss_cl_ctx *ctx; |
1356 | unsigned int len; | ||
1356 | struct xdr_netobj *acceptor; | 1357 | struct xdr_netobj *acceptor; |
1357 | 1358 | ||
1358 | rcu_read_lock(); | 1359 | rcu_read_lock(); |
@@ -1360,15 +1361,39 @@ gss_stringify_acceptor(struct rpc_cred *cred) | |||
1360 | if (!ctx) | 1361 | if (!ctx) |
1361 | goto out; | 1362 | goto out; |
1362 | 1363 | ||
1363 | acceptor = &ctx->gc_acceptor; | 1364 | len = ctx->gc_acceptor.len; |
1365 | rcu_read_unlock(); | ||
1364 | 1366 | ||
1365 | /* no point if there's no string */ | 1367 | /* no point if there's no string */ |
1366 | if (!acceptor->len) | 1368 | if (!len) |
1367 | goto out; | 1369 | return NULL; |
1368 | 1370 | realloc: | |
1369 | string = kmalloc(acceptor->len + 1, GFP_KERNEL); | 1371 | string = kmalloc(len + 1, GFP_KERNEL); |
1370 | if (!string) | 1372 | if (!string) |
1373 | return NULL; | ||
1374 | |||
1375 | rcu_read_lock(); | ||
1376 | ctx = rcu_dereference(gss_cred->gc_ctx); | ||
1377 | |||
1378 | /* did the ctx disappear or was it replaced by one with no acceptor? */ | ||
1379 | if (!ctx || !ctx->gc_acceptor.len) { | ||
1380 | kfree(string); | ||
1381 | string = NULL; | ||
1371 | goto out; | 1382 | goto out; |
1383 | } | ||
1384 | |||
1385 | acceptor = &ctx->gc_acceptor; | ||
1386 | |||
1387 | /* | ||
1388 | * Did we find a new acceptor that's longer than the original? Allocate | ||
1389 | * a longer buffer and try again. | ||
1390 | */ | ||
1391 | if (len < acceptor->len) { | ||
1392 | len = acceptor->len; | ||
1393 | rcu_read_unlock(); | ||
1394 | kfree(string); | ||
1395 | goto realloc; | ||
1396 | } | ||
1372 | 1397 | ||
1373 | memcpy(string, acceptor->data, acceptor->len); | 1398 | memcpy(string, acceptor->data, acceptor->len); |
1374 | string[acceptor->len] = '\0'; | 1399 | string[acceptor->len] = '\0'; |
diff --git a/net/tipc/node.c b/net/tipc/node.c index 90cee4a6fce4..5781634e957d 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c | |||
@@ -219,11 +219,11 @@ void tipc_node_abort_sock_conns(struct list_head *conns) | |||
219 | void tipc_node_link_up(struct tipc_node *n_ptr, struct tipc_link *l_ptr) | 219 | void tipc_node_link_up(struct tipc_node *n_ptr, struct tipc_link *l_ptr) |
220 | { | 220 | { |
221 | struct tipc_link **active = &n_ptr->active_links[0]; | 221 | struct tipc_link **active = &n_ptr->active_links[0]; |
222 | u32 addr = n_ptr->addr; | ||
223 | 222 | ||
224 | n_ptr->working_links++; | 223 | n_ptr->working_links++; |
225 | tipc_nametbl_publish(TIPC_LINK_STATE, addr, addr, TIPC_NODE_SCOPE, | 224 | n_ptr->action_flags |= TIPC_NOTIFY_LINK_UP; |
226 | l_ptr->bearer_id, addr); | 225 | n_ptr->link_id = l_ptr->peer_bearer_id << 16 | l_ptr->bearer_id; |
226 | |||
227 | pr_info("Established link <%s> on network plane %c\n", | 227 | pr_info("Established link <%s> on network plane %c\n", |
228 | l_ptr->name, l_ptr->net_plane); | 228 | l_ptr->name, l_ptr->net_plane); |
229 | 229 | ||
@@ -284,10 +284,10 @@ static void node_select_active_links(struct tipc_node *n_ptr) | |||
284 | void tipc_node_link_down(struct tipc_node *n_ptr, struct tipc_link *l_ptr) | 284 | void tipc_node_link_down(struct tipc_node *n_ptr, struct tipc_link *l_ptr) |
285 | { | 285 | { |
286 | struct tipc_link **active; | 286 | struct tipc_link **active; |
287 | u32 addr = n_ptr->addr; | ||
288 | 287 | ||
289 | n_ptr->working_links--; | 288 | n_ptr->working_links--; |
290 | tipc_nametbl_withdraw(TIPC_LINK_STATE, addr, l_ptr->bearer_id, addr); | 289 | n_ptr->action_flags |= TIPC_NOTIFY_LINK_DOWN; |
290 | n_ptr->link_id = l_ptr->peer_bearer_id << 16 | l_ptr->bearer_id; | ||
291 | 291 | ||
292 | if (!tipc_link_is_active(l_ptr)) { | 292 | if (!tipc_link_is_active(l_ptr)) { |
293 | pr_info("Lost standby link <%s> on network plane %c\n", | 293 | pr_info("Lost standby link <%s> on network plane %c\n", |
@@ -552,28 +552,30 @@ void tipc_node_unlock(struct tipc_node *node) | |||
552 | LIST_HEAD(conn_sks); | 552 | LIST_HEAD(conn_sks); |
553 | struct sk_buff_head waiting_sks; | 553 | struct sk_buff_head waiting_sks; |
554 | u32 addr = 0; | 554 | u32 addr = 0; |
555 | unsigned int flags = node->action_flags; | 555 | int flags = node->action_flags; |
556 | u32 link_id = 0; | ||
556 | 557 | ||
557 | if (likely(!node->action_flags)) { | 558 | if (likely(!flags)) { |
558 | spin_unlock_bh(&node->lock); | 559 | spin_unlock_bh(&node->lock); |
559 | return; | 560 | return; |
560 | } | 561 | } |
561 | 562 | ||
563 | addr = node->addr; | ||
564 | link_id = node->link_id; | ||
562 | __skb_queue_head_init(&waiting_sks); | 565 | __skb_queue_head_init(&waiting_sks); |
563 | if (node->action_flags & TIPC_WAKEUP_USERS) { | 566 | |
567 | if (flags & TIPC_WAKEUP_USERS) | ||
564 | skb_queue_splice_init(&node->waiting_sks, &waiting_sks); | 568 | skb_queue_splice_init(&node->waiting_sks, &waiting_sks); |
565 | node->action_flags &= ~TIPC_WAKEUP_USERS; | 569 | |
566 | } | 570 | if (flags & TIPC_NOTIFY_NODE_DOWN) { |
567 | if (node->action_flags & TIPC_NOTIFY_NODE_DOWN) { | ||
568 | list_replace_init(&node->nsub, &nsub_list); | 571 | list_replace_init(&node->nsub, &nsub_list); |
569 | list_replace_init(&node->conn_sks, &conn_sks); | 572 | list_replace_init(&node->conn_sks, &conn_sks); |
570 | node->action_flags &= ~TIPC_NOTIFY_NODE_DOWN; | ||
571 | } | 573 | } |
572 | if (node->action_flags & TIPC_NOTIFY_NODE_UP) { | 574 | node->action_flags &= ~(TIPC_WAKEUP_USERS | TIPC_NOTIFY_NODE_DOWN | |
573 | node->action_flags &= ~TIPC_NOTIFY_NODE_UP; | 575 | TIPC_NOTIFY_NODE_UP | TIPC_NOTIFY_LINK_UP | |
574 | addr = node->addr; | 576 | TIPC_NOTIFY_LINK_DOWN | |
575 | } | 577 | TIPC_WAKEUP_BCAST_USERS); |
576 | node->action_flags &= ~TIPC_WAKEUP_BCAST_USERS; | 578 | |
577 | spin_unlock_bh(&node->lock); | 579 | spin_unlock_bh(&node->lock); |
578 | 580 | ||
579 | while (!skb_queue_empty(&waiting_sks)) | 581 | while (!skb_queue_empty(&waiting_sks)) |
@@ -588,6 +590,14 @@ void tipc_node_unlock(struct tipc_node *node) | |||
588 | if (flags & TIPC_WAKEUP_BCAST_USERS) | 590 | if (flags & TIPC_WAKEUP_BCAST_USERS) |
589 | tipc_bclink_wakeup_users(); | 591 | tipc_bclink_wakeup_users(); |
590 | 592 | ||
591 | if (addr) | 593 | if (flags & TIPC_NOTIFY_NODE_UP) |
592 | tipc_named_node_up(addr); | 594 | tipc_named_node_up(addr); |
595 | |||
596 | if (flags & TIPC_NOTIFY_LINK_UP) | ||
597 | tipc_nametbl_publish(TIPC_LINK_STATE, addr, addr, | ||
598 | TIPC_NODE_SCOPE, link_id, addr); | ||
599 | |||
600 | if (flags & TIPC_NOTIFY_LINK_DOWN) | ||
601 | tipc_nametbl_withdraw(TIPC_LINK_STATE, addr, | ||
602 | link_id, addr); | ||
593 | } | 603 | } |
diff --git a/net/tipc/node.h b/net/tipc/node.h index 67513c3c852c..04e91458bb29 100644 --- a/net/tipc/node.h +++ b/net/tipc/node.h | |||
@@ -53,6 +53,7 @@ | |||
53 | * TIPC_WAIT_OWN_LINKS_DOWN: wait until peer node is declared down | 53 | * TIPC_WAIT_OWN_LINKS_DOWN: wait until peer node is declared down |
54 | * TIPC_NOTIFY_NODE_DOWN: notify node is down | 54 | * TIPC_NOTIFY_NODE_DOWN: notify node is down |
55 | * TIPC_NOTIFY_NODE_UP: notify node is up | 55 | * TIPC_NOTIFY_NODE_UP: notify node is up |
56 | * TIPC_DISTRIBUTE_NAME: publish or withdraw link state name type | ||
56 | */ | 57 | */ |
57 | enum { | 58 | enum { |
58 | TIPC_WAIT_PEER_LINKS_DOWN = (1 << 1), | 59 | TIPC_WAIT_PEER_LINKS_DOWN = (1 << 1), |
@@ -60,7 +61,9 @@ enum { | |||
60 | TIPC_NOTIFY_NODE_DOWN = (1 << 3), | 61 | TIPC_NOTIFY_NODE_DOWN = (1 << 3), |
61 | TIPC_NOTIFY_NODE_UP = (1 << 4), | 62 | TIPC_NOTIFY_NODE_UP = (1 << 4), |
62 | TIPC_WAKEUP_USERS = (1 << 5), | 63 | TIPC_WAKEUP_USERS = (1 << 5), |
63 | TIPC_WAKEUP_BCAST_USERS = (1 << 6) | 64 | TIPC_WAKEUP_BCAST_USERS = (1 << 6), |
65 | TIPC_NOTIFY_LINK_UP = (1 << 7), | ||
66 | TIPC_NOTIFY_LINK_DOWN = (1 << 8) | ||
64 | }; | 67 | }; |
65 | 68 | ||
66 | /** | 69 | /** |
@@ -100,6 +103,7 @@ struct tipc_node_bclink { | |||
100 | * @working_links: number of working links to node (both active and standby) | 103 | * @working_links: number of working links to node (both active and standby) |
101 | * @link_cnt: number of links to node | 104 | * @link_cnt: number of links to node |
102 | * @signature: node instance identifier | 105 | * @signature: node instance identifier |
106 | * @link_id: local and remote bearer ids of changing link, if any | ||
103 | * @nsub: list of "node down" subscriptions monitoring node | 107 | * @nsub: list of "node down" subscriptions monitoring node |
104 | * @rcu: rcu struct for tipc_node | 108 | * @rcu: rcu struct for tipc_node |
105 | */ | 109 | */ |
@@ -116,6 +120,7 @@ struct tipc_node { | |||
116 | int link_cnt; | 120 | int link_cnt; |
117 | int working_links; | 121 | int working_links; |
118 | u32 signature; | 122 | u32 signature; |
123 | u32 link_id; | ||
119 | struct list_head nsub; | 124 | struct list_head nsub; |
120 | struct sk_buff_head waiting_sks; | 125 | struct sk_buff_head waiting_sks; |
121 | struct list_head conn_sks; | 126 | struct list_head conn_sks; |
diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 75275c5cf929..51bddc236a15 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c | |||
@@ -1776,7 +1776,7 @@ int tipc_sk_rcv(struct sk_buff *buf) | |||
1776 | sk = &tsk->sk; | 1776 | sk = &tsk->sk; |
1777 | 1777 | ||
1778 | /* Queue message */ | 1778 | /* Queue message */ |
1779 | bh_lock_sock(sk); | 1779 | spin_lock_bh(&sk->sk_lock.slock); |
1780 | 1780 | ||
1781 | if (!sock_owned_by_user(sk)) { | 1781 | if (!sock_owned_by_user(sk)) { |
1782 | rc = filter_rcv(sk, buf); | 1782 | rc = filter_rcv(sk, buf); |
@@ -1787,7 +1787,7 @@ int tipc_sk_rcv(struct sk_buff *buf) | |||
1787 | if (sk_add_backlog(sk, buf, limit)) | 1787 | if (sk_add_backlog(sk, buf, limit)) |
1788 | rc = -TIPC_ERR_OVERLOAD; | 1788 | rc = -TIPC_ERR_OVERLOAD; |
1789 | } | 1789 | } |
1790 | bh_unlock_sock(sk); | 1790 | spin_unlock_bh(&sk->sk_lock.slock); |
1791 | tipc_sk_put(tsk); | 1791 | tipc_sk_put(tsk); |
1792 | if (likely(!rc)) | 1792 | if (likely(!rc)) |
1793 | return 0; | 1793 | return 0; |
@@ -2673,7 +2673,7 @@ static int tipc_ioctl(struct socket *sk, unsigned int cmd, unsigned long arg) | |||
2673 | case SIOCGETLINKNAME: | 2673 | case SIOCGETLINKNAME: |
2674 | if (copy_from_user(&lnr, argp, sizeof(lnr))) | 2674 | if (copy_from_user(&lnr, argp, sizeof(lnr))) |
2675 | return -EFAULT; | 2675 | return -EFAULT; |
2676 | if (!tipc_node_get_linkname(lnr.bearer_id, lnr.peer, | 2676 | if (!tipc_node_get_linkname(lnr.bearer_id & 0xffff, lnr.peer, |
2677 | lnr.linkname, TIPC_MAX_LINK_NAME)) { | 2677 | lnr.linkname, TIPC_MAX_LINK_NAME)) { |
2678 | if (copy_to_user(argp, &lnr, sizeof(lnr))) | 2678 | if (copy_to_user(argp, &lnr, sizeof(lnr))) |
2679 | return -EFAULT; | 2679 | return -EFAULT; |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index cb9f5a44ffad..5839c85075f1 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -5927,6 +5927,7 @@ static int nl80211_channel_switch(struct sk_buff *skb, struct genl_info *info) | |||
5927 | int err; | 5927 | int err; |
5928 | bool need_new_beacon = false; | 5928 | bool need_new_beacon = false; |
5929 | int len, i; | 5929 | int len, i; |
5930 | u32 cs_count; | ||
5930 | 5931 | ||
5931 | if (!rdev->ops->channel_switch || | 5932 | if (!rdev->ops->channel_switch || |
5932 | !(rdev->wiphy.flags & WIPHY_FLAG_HAS_CHANNEL_SWITCH)) | 5933 | !(rdev->wiphy.flags & WIPHY_FLAG_HAS_CHANNEL_SWITCH)) |
@@ -5963,7 +5964,14 @@ static int nl80211_channel_switch(struct sk_buff *skb, struct genl_info *info) | |||
5963 | if (need_new_beacon && !info->attrs[NL80211_ATTR_CSA_IES]) | 5964 | if (need_new_beacon && !info->attrs[NL80211_ATTR_CSA_IES]) |
5964 | return -EINVAL; | 5965 | return -EINVAL; |
5965 | 5966 | ||
5966 | params.count = nla_get_u32(info->attrs[NL80211_ATTR_CH_SWITCH_COUNT]); | 5967 | /* Even though the attribute is u32, the specification says |
5968 | * u8, so let's make sure we don't overflow. | ||
5969 | */ | ||
5970 | cs_count = nla_get_u32(info->attrs[NL80211_ATTR_CH_SWITCH_COUNT]); | ||
5971 | if (cs_count > 255) | ||
5972 | return -EINVAL; | ||
5973 | |||
5974 | params.count = cs_count; | ||
5967 | 5975 | ||
5968 | if (!need_new_beacon) | 5976 | if (!need_new_beacon) |
5969 | goto skip_beacons; | 5977 | goto skip_beacons; |
diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c index 499d6c18a8ce..7c532856b398 100644 --- a/net/xfrm/xfrm_output.c +++ b/net/xfrm/xfrm_output.c | |||
@@ -157,6 +157,8 @@ static int xfrm_output_gso(struct sk_buff *skb) | |||
157 | kfree_skb(skb); | 157 | kfree_skb(skb); |
158 | if (IS_ERR(segs)) | 158 | if (IS_ERR(segs)) |
159 | return PTR_ERR(segs); | 159 | return PTR_ERR(segs); |
160 | if (segs == NULL) | ||
161 | return -EINVAL; | ||
160 | 162 | ||
161 | do { | 163 | do { |
162 | struct sk_buff *nskb = segs->next; | 164 | struct sk_buff *nskb = segs->next; |
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 4c4e457e7888..88bf289abdc9 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -1962,7 +1962,7 @@ static int xdst_queue_output(struct sock *sk, struct sk_buff *skb) | |||
1962 | struct xfrm_policy *pol = xdst->pols[0]; | 1962 | struct xfrm_policy *pol = xdst->pols[0]; |
1963 | struct xfrm_policy_queue *pq = &pol->polq; | 1963 | struct xfrm_policy_queue *pq = &pol->polq; |
1964 | 1964 | ||
1965 | if (unlikely(skb_fclone_busy(skb))) { | 1965 | if (unlikely(skb_fclone_busy(sk, skb))) { |
1966 | kfree_skb(skb); | 1966 | kfree_skb(skb); |
1967 | return 0; | 1967 | return 0; |
1968 | } | 1968 | } |
diff --git a/samples/bpf/test_verifier.c b/samples/bpf/test_verifier.c index f44ef11f65a7..eb4bec0ad8af 100644 --- a/samples/bpf/test_verifier.c +++ b/samples/bpf/test_verifier.c | |||
@@ -209,6 +209,17 @@ static struct bpf_test tests[] = { | |||
209 | .result = REJECT, | 209 | .result = REJECT, |
210 | }, | 210 | }, |
211 | { | 211 | { |
212 | "program doesn't init R0 before exit in all branches", | ||
213 | .insns = { | ||
214 | BPF_JMP_IMM(BPF_JGE, BPF_REG_1, 0, 2), | ||
215 | BPF_MOV64_IMM(BPF_REG_0, 1), | ||
216 | BPF_ALU64_IMM(BPF_ADD, BPF_REG_0, 2), | ||
217 | BPF_EXIT_INSN(), | ||
218 | }, | ||
219 | .errstr = "R0 !read_ok", | ||
220 | .result = REJECT, | ||
221 | }, | ||
222 | { | ||
212 | "stack out of bounds", | 223 | "stack out of bounds", |
213 | .insns = { | 224 | .insns = { |
214 | BPF_ST_MEM(BPF_DW, BPF_REG_10, 8, 0), | 225 | BPF_ST_MEM(BPF_DW, BPF_REG_10, 8, 0), |
diff --git a/security/integrity/evm/evm_main.c b/security/integrity/evm/evm_main.c index 9685af330de5..c5ee1a7c5e8a 100644 --- a/security/integrity/evm/evm_main.c +++ b/security/integrity/evm/evm_main.c | |||
@@ -319,9 +319,12 @@ int evm_inode_setxattr(struct dentry *dentry, const char *xattr_name, | |||
319 | { | 319 | { |
320 | const struct evm_ima_xattr_data *xattr_data = xattr_value; | 320 | const struct evm_ima_xattr_data *xattr_data = xattr_value; |
321 | 321 | ||
322 | if ((strcmp(xattr_name, XATTR_NAME_EVM) == 0) | 322 | if (strcmp(xattr_name, XATTR_NAME_EVM) == 0) { |
323 | && (xattr_data->type == EVM_XATTR_HMAC)) | 323 | if (!xattr_value_len) |
324 | return -EPERM; | 324 | return -EINVAL; |
325 | if (xattr_data->type != EVM_IMA_XATTR_DIGSIG) | ||
326 | return -EPERM; | ||
327 | } | ||
325 | return evm_protect_xattr(dentry, xattr_name, xattr_value, | 328 | return evm_protect_xattr(dentry, xattr_name, xattr_value, |
326 | xattr_value_len); | 329 | xattr_value_len); |
327 | } | 330 | } |
diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c index 922685483bd3..7c8f41e618b6 100644 --- a/security/integrity/ima/ima_appraise.c +++ b/security/integrity/ima/ima_appraise.c | |||
@@ -378,6 +378,8 @@ int ima_inode_setxattr(struct dentry *dentry, const char *xattr_name, | |||
378 | result = ima_protect_xattr(dentry, xattr_name, xattr_value, | 378 | result = ima_protect_xattr(dentry, xattr_name, xattr_value, |
379 | xattr_value_len); | 379 | xattr_value_len); |
380 | if (result == 1) { | 380 | if (result == 1) { |
381 | if (!xattr_value_len || (xvalue->type >= IMA_XATTR_LAST)) | ||
382 | return -EINVAL; | ||
381 | ima_reset_appraise_flags(dentry->d_inode, | 383 | ima_reset_appraise_flags(dentry->d_inode, |
382 | (xvalue->type == EVM_IMA_XATTR_DIGSIG) ? 1 : 0); | 384 | (xvalue->type == EVM_IMA_XATTR_DIGSIG) ? 1 : 0); |
383 | result = 0; | 385 | result = 0; |
diff --git a/security/integrity/integrity.h b/security/integrity/integrity.h index c0379d13dbe1..9d1c2ebfe12a 100644 --- a/security/integrity/integrity.h +++ b/security/integrity/integrity.h | |||
@@ -61,6 +61,7 @@ enum evm_ima_xattr_type { | |||
61 | EVM_XATTR_HMAC, | 61 | EVM_XATTR_HMAC, |
62 | EVM_IMA_XATTR_DIGSIG, | 62 | EVM_IMA_XATTR_DIGSIG, |
63 | IMA_XATTR_DIGEST_NG, | 63 | IMA_XATTR_DIGEST_NG, |
64 | IMA_XATTR_LAST | ||
64 | }; | 65 | }; |
65 | 66 | ||
66 | struct evm_ima_xattr_data { | 67 | struct evm_ima_xattr_data { |
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index e66314138b38..c603b20356ad 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -4725,9 +4725,10 @@ static int selinux_nlmsg_perm(struct sock *sk, struct sk_buff *skb) | |||
4725 | err = selinux_nlmsg_lookup(sksec->sclass, nlh->nlmsg_type, &perm); | 4725 | err = selinux_nlmsg_lookup(sksec->sclass, nlh->nlmsg_type, &perm); |
4726 | if (err) { | 4726 | if (err) { |
4727 | if (err == -EINVAL) { | 4727 | if (err == -EINVAL) { |
4728 | WARN_ONCE(1, "selinux_nlmsg_perm: unrecognized netlink message:" | 4728 | printk(KERN_WARNING |
4729 | " protocol=%hu nlmsg_type=%hu sclass=%hu\n", | 4729 | "SELinux: unrecognized netlink message:" |
4730 | sk->sk_protocol, nlh->nlmsg_type, sksec->sclass); | 4730 | " protocol=%hu nlmsg_type=%hu sclass=%hu\n", |
4731 | sk->sk_protocol, nlh->nlmsg_type, sksec->sclass); | ||
4731 | if (!selinux_enforcing || security_get_allow_unknown()) | 4732 | if (!selinux_enforcing || security_get_allow_unknown()) |
4732 | err = 0; | 4733 | err = 0; |
4733 | } | 4734 | } |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 91fa959d05fe..966e6f98892d 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -219,6 +219,7 @@ MODULE_SUPPORTED_DEVICE("{{Intel, ICH6}," | |||
219 | "{Intel, LPT_LP}," | 219 | "{Intel, LPT_LP}," |
220 | "{Intel, WPT_LP}," | 220 | "{Intel, WPT_LP}," |
221 | "{Intel, SPT}," | 221 | "{Intel, SPT}," |
222 | "{Intel, SPT_LP}," | ||
222 | "{Intel, HPT}," | 223 | "{Intel, HPT}," |
223 | "{Intel, PBG}," | 224 | "{Intel, PBG}," |
224 | "{Intel, SCH}," | 225 | "{Intel, SCH}," |
@@ -2003,6 +2004,9 @@ static const struct pci_device_id azx_ids[] = { | |||
2003 | /* Sunrise Point */ | 2004 | /* Sunrise Point */ |
2004 | { PCI_DEVICE(0x8086, 0xa170), | 2005 | { PCI_DEVICE(0x8086, 0xa170), |
2005 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, | 2006 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, |
2007 | /* Sunrise Point-LP */ | ||
2008 | { PCI_DEVICE(0x8086, 0x9d70), | ||
2009 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, | ||
2006 | /* Haswell */ | 2010 | /* Haswell */ |
2007 | { PCI_DEVICE(0x8086, 0x0a0c), | 2011 | { PCI_DEVICE(0x8086, 0x0a0c), |
2008 | .driver_data = AZX_DRIVER_HDMI | AZX_DCAPS_INTEL_HASWELL }, | 2012 | .driver_data = AZX_DRIVER_HDMI | AZX_DCAPS_INTEL_HASWELL }, |
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 71e4bad06345..e9ebc7bd752c 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
@@ -43,6 +43,7 @@ struct conexant_spec { | |||
43 | unsigned int num_eapds; | 43 | unsigned int num_eapds; |
44 | hda_nid_t eapds[4]; | 44 | hda_nid_t eapds[4]; |
45 | bool dynamic_eapd; | 45 | bool dynamic_eapd; |
46 | hda_nid_t mute_led_eapd; | ||
46 | 47 | ||
47 | unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */ | 48 | unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */ |
48 | 49 | ||
@@ -163,6 +164,17 @@ static void cx_auto_vmaster_hook(void *private_data, int enabled) | |||
163 | cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, enabled); | 164 | cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, enabled); |
164 | } | 165 | } |
165 | 166 | ||
167 | /* turn on/off EAPD according to Master switch (inversely!) for mute LED */ | ||
168 | static void cx_auto_vmaster_hook_mute_led(void *private_data, int enabled) | ||
169 | { | ||
170 | struct hda_codec *codec = private_data; | ||
171 | struct conexant_spec *spec = codec->spec; | ||
172 | |||
173 | snd_hda_codec_write(codec, spec->mute_led_eapd, 0, | ||
174 | AC_VERB_SET_EAPD_BTLENABLE, | ||
175 | enabled ? 0x00 : 0x02); | ||
176 | } | ||
177 | |||
166 | static int cx_auto_build_controls(struct hda_codec *codec) | 178 | static int cx_auto_build_controls(struct hda_codec *codec) |
167 | { | 179 | { |
168 | int err; | 180 | int err; |
@@ -223,6 +235,7 @@ enum { | |||
223 | CXT_FIXUP_TOSHIBA_P105, | 235 | CXT_FIXUP_TOSHIBA_P105, |
224 | CXT_FIXUP_HP_530, | 236 | CXT_FIXUP_HP_530, |
225 | CXT_FIXUP_CAP_MIX_AMP_5047, | 237 | CXT_FIXUP_CAP_MIX_AMP_5047, |
238 | CXT_FIXUP_MUTE_LED_EAPD, | ||
226 | }; | 239 | }; |
227 | 240 | ||
228 | /* for hda_fixup_thinkpad_acpi() */ | 241 | /* for hda_fixup_thinkpad_acpi() */ |
@@ -557,6 +570,18 @@ static void cxt_fixup_olpc_xo(struct hda_codec *codec, | |||
557 | } | 570 | } |
558 | } | 571 | } |
559 | 572 | ||
573 | static void cxt_fixup_mute_led_eapd(struct hda_codec *codec, | ||
574 | const struct hda_fixup *fix, int action) | ||
575 | { | ||
576 | struct conexant_spec *spec = codec->spec; | ||
577 | |||
578 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | ||
579 | spec->mute_led_eapd = 0x1b; | ||
580 | spec->dynamic_eapd = 1; | ||
581 | spec->gen.vmaster_mute.hook = cx_auto_vmaster_hook_mute_led; | ||
582 | } | ||
583 | } | ||
584 | |||
560 | /* | 585 | /* |
561 | * Fix max input level on mixer widget to 0dB | 586 | * Fix max input level on mixer widget to 0dB |
562 | * (originally it has 0x2b steps with 0dB offset 0x14) | 587 | * (originally it has 0x2b steps with 0dB offset 0x14) |
@@ -705,6 +730,10 @@ static const struct hda_fixup cxt_fixups[] = { | |||
705 | .type = HDA_FIXUP_FUNC, | 730 | .type = HDA_FIXUP_FUNC, |
706 | .v.func = cxt_fixup_cap_mix_amp_5047, | 731 | .v.func = cxt_fixup_cap_mix_amp_5047, |
707 | }, | 732 | }, |
733 | [CXT_FIXUP_MUTE_LED_EAPD] = { | ||
734 | .type = HDA_FIXUP_FUNC, | ||
735 | .v.func = cxt_fixup_mute_led_eapd, | ||
736 | }, | ||
708 | }; | 737 | }; |
709 | 738 | ||
710 | static const struct snd_pci_quirk cxt5045_fixups[] = { | 739 | static const struct snd_pci_quirk cxt5045_fixups[] = { |
@@ -762,6 +791,7 @@ static const struct snd_pci_quirk cxt5066_fixups[] = { | |||
762 | SND_PCI_QUIRK(0x17aa, 0x21cf, "Lenovo T520", CXT_PINCFG_LENOVO_TP410), | 791 | SND_PCI_QUIRK(0x17aa, 0x21cf, "Lenovo T520", CXT_PINCFG_LENOVO_TP410), |
763 | SND_PCI_QUIRK(0x17aa, 0x21da, "Lenovo X220", CXT_PINCFG_LENOVO_TP410), | 792 | SND_PCI_QUIRK(0x17aa, 0x21da, "Lenovo X220", CXT_PINCFG_LENOVO_TP410), |
764 | SND_PCI_QUIRK(0x17aa, 0x21db, "Lenovo X220-tablet", CXT_PINCFG_LENOVO_TP410), | 793 | SND_PCI_QUIRK(0x17aa, 0x21db, "Lenovo X220-tablet", CXT_PINCFG_LENOVO_TP410), |
794 | SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo IdeaPad Z560", CXT_FIXUP_MUTE_LED_EAPD), | ||
765 | SND_PCI_QUIRK(0x17aa, 0x3975, "Lenovo U300s", CXT_FIXUP_STEREO_DMIC), | 795 | SND_PCI_QUIRK(0x17aa, 0x3975, "Lenovo U300s", CXT_FIXUP_STEREO_DMIC), |
766 | SND_PCI_QUIRK(0x17aa, 0x3977, "Lenovo IdeaPad U310", CXT_FIXUP_STEREO_DMIC), | 796 | SND_PCI_QUIRK(0x17aa, 0x3977, "Lenovo IdeaPad U310", CXT_FIXUP_STEREO_DMIC), |
767 | SND_PCI_QUIRK(0x17aa, 0x397b, "Lenovo S205", CXT_FIXUP_STEREO_DMIC), | 797 | SND_PCI_QUIRK(0x17aa, 0x397b, "Lenovo S205", CXT_FIXUP_STEREO_DMIC), |
@@ -780,6 +810,7 @@ static const struct hda_model_fixup cxt5066_fixup_models[] = { | |||
780 | { .id = CXT_PINCFG_LEMOTE_A1004, .name = "lemote-a1004" }, | 810 | { .id = CXT_PINCFG_LEMOTE_A1004, .name = "lemote-a1004" }, |
781 | { .id = CXT_PINCFG_LEMOTE_A1205, .name = "lemote-a1205" }, | 811 | { .id = CXT_PINCFG_LEMOTE_A1205, .name = "lemote-a1205" }, |
782 | { .id = CXT_FIXUP_OLPC_XO, .name = "olpc-xo" }, | 812 | { .id = CXT_FIXUP_OLPC_XO, .name = "olpc-xo" }, |
813 | { .id = CXT_FIXUP_MUTE_LED_EAPD, .name = "mute-led-eapd" }, | ||
783 | {} | 814 | {} |
784 | }; | 815 | }; |
785 | 816 | ||
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 3fcb7d951572..0c1cad5a1574 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -290,6 +290,80 @@ static void alc880_unsol_event(struct hda_codec *codec, unsigned int res) | |||
290 | snd_hda_jack_unsol_event(codec, res >> 2); | 290 | snd_hda_jack_unsol_event(codec, res >> 2); |
291 | } | 291 | } |
292 | 292 | ||
293 | /* Change EAPD to verb control */ | ||
294 | static void alc_fill_eapd_coef(struct hda_codec *codec) | ||
295 | { | ||
296 | int coef; | ||
297 | |||
298 | coef = alc_get_coef0(codec); | ||
299 | |||
300 | switch (codec->vendor_id) { | ||
301 | case 0x10ec0262: | ||
302 | alc_update_coef_idx(codec, 0x7, 0, 1<<5); | ||
303 | break; | ||
304 | case 0x10ec0267: | ||
305 | case 0x10ec0268: | ||
306 | alc_update_coef_idx(codec, 0x7, 0, 1<<13); | ||
307 | break; | ||
308 | case 0x10ec0269: | ||
309 | if ((coef & 0x00f0) == 0x0010) | ||
310 | alc_update_coef_idx(codec, 0xd, 0, 1<<14); | ||
311 | if ((coef & 0x00f0) == 0x0020) | ||
312 | alc_update_coef_idx(codec, 0x4, 1<<15, 0); | ||
313 | if ((coef & 0x00f0) == 0x0030) | ||
314 | alc_update_coef_idx(codec, 0x10, 1<<9, 0); | ||
315 | break; | ||
316 | case 0x10ec0280: | ||
317 | case 0x10ec0284: | ||
318 | case 0x10ec0290: | ||
319 | case 0x10ec0292: | ||
320 | alc_update_coef_idx(codec, 0x4, 1<<15, 0); | ||
321 | break; | ||
322 | case 0x10ec0233: | ||
323 | case 0x10ec0255: | ||
324 | case 0x10ec0282: | ||
325 | case 0x10ec0283: | ||
326 | case 0x10ec0286: | ||
327 | case 0x10ec0288: | ||
328 | alc_update_coef_idx(codec, 0x10, 1<<9, 0); | ||
329 | break; | ||
330 | case 0x10ec0285: | ||
331 | case 0x10ec0293: | ||
332 | alc_update_coef_idx(codec, 0xa, 1<<13, 0); | ||
333 | break; | ||
334 | case 0x10ec0662: | ||
335 | if ((coef & 0x00f0) == 0x0030) | ||
336 | alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */ | ||
337 | break; | ||
338 | case 0x10ec0272: | ||
339 | case 0x10ec0273: | ||
340 | case 0x10ec0663: | ||
341 | case 0x10ec0665: | ||
342 | case 0x10ec0670: | ||
343 | case 0x10ec0671: | ||
344 | case 0x10ec0672: | ||
345 | alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */ | ||
346 | break; | ||
347 | case 0x10ec0668: | ||
348 | alc_update_coef_idx(codec, 0x7, 3<<13, 0); | ||
349 | break; | ||
350 | case 0x10ec0867: | ||
351 | alc_update_coef_idx(codec, 0x4, 1<<10, 0); | ||
352 | break; | ||
353 | case 0x10ec0888: | ||
354 | if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030) | ||
355 | alc_update_coef_idx(codec, 0x7, 1<<5, 0); | ||
356 | break; | ||
357 | case 0x10ec0892: | ||
358 | alc_update_coef_idx(codec, 0x7, 1<<5, 0); | ||
359 | break; | ||
360 | case 0x10ec0899: | ||
361 | case 0x10ec0900: | ||
362 | alc_update_coef_idx(codec, 0x7, 1<<1, 0); | ||
363 | break; | ||
364 | } | ||
365 | } | ||
366 | |||
293 | /* additional initialization for ALC888 variants */ | 367 | /* additional initialization for ALC888 variants */ |
294 | static void alc888_coef_init(struct hda_codec *codec) | 368 | static void alc888_coef_init(struct hda_codec *codec) |
295 | { | 369 | { |
@@ -341,6 +415,7 @@ static void alc_eapd_shutup(struct hda_codec *codec) | |||
341 | /* generic EAPD initialization */ | 415 | /* generic EAPD initialization */ |
342 | static void alc_auto_init_amp(struct hda_codec *codec, int type) | 416 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
343 | { | 417 | { |
418 | alc_fill_eapd_coef(codec); | ||
344 | alc_auto_setup_eapd(codec, true); | 419 | alc_auto_setup_eapd(codec, true); |
345 | switch (type) { | 420 | switch (type) { |
346 | case ALC_INIT_GPIO1: | 421 | case ALC_INIT_GPIO1: |
@@ -4480,6 +4555,8 @@ static const struct hda_fixup alc269_fixups[] = { | |||
4480 | [ALC269_FIXUP_HEADSET_MODE] = { | 4555 | [ALC269_FIXUP_HEADSET_MODE] = { |
4481 | .type = HDA_FIXUP_FUNC, | 4556 | .type = HDA_FIXUP_FUNC, |
4482 | .v.func = alc_fixup_headset_mode, | 4557 | .v.func = alc_fixup_headset_mode, |
4558 | .chained = true, | ||
4559 | .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED | ||
4483 | }, | 4560 | }, |
4484 | [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = { | 4561 | [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = { |
4485 | .type = HDA_FIXUP_FUNC, | 4562 | .type = HDA_FIXUP_FUNC, |
@@ -4669,6 +4746,8 @@ static const struct hda_fixup alc269_fixups[] = { | |||
4669 | [ALC255_FIXUP_HEADSET_MODE] = { | 4746 | [ALC255_FIXUP_HEADSET_MODE] = { |
4670 | .type = HDA_FIXUP_FUNC, | 4747 | .type = HDA_FIXUP_FUNC, |
4671 | .v.func = alc_fixup_headset_mode_alc255, | 4748 | .v.func = alc_fixup_headset_mode_alc255, |
4749 | .chained = true, | ||
4750 | .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED | ||
4672 | }, | 4751 | }, |
4673 | [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = { | 4752 | [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = { |
4674 | .type = HDA_FIXUP_FUNC, | 4753 | .type = HDA_FIXUP_FUNC, |
@@ -4704,8 +4783,6 @@ static const struct hda_fixup alc269_fixups[] = { | |||
4704 | [ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED] = { | 4783 | [ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED] = { |
4705 | .type = HDA_FIXUP_FUNC, | 4784 | .type = HDA_FIXUP_FUNC, |
4706 | .v.func = alc_fixup_dell_wmi, | 4785 | .v.func = alc_fixup_dell_wmi, |
4707 | .chained_before = true, | ||
4708 | .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE | ||
4709 | }, | 4786 | }, |
4710 | [ALC282_FIXUP_ASPIRE_V5_PINS] = { | 4787 | [ALC282_FIXUP_ASPIRE_V5_PINS] = { |
4711 | .type = HDA_FIXUP_PINS, | 4788 | .type = HDA_FIXUP_PINS, |
@@ -4747,10 +4824,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
4747 | SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), | 4824 | SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), |
4748 | SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), | 4825 | SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), |
4749 | SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), | 4826 | SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), |
4750 | SND_PCI_QUIRK(0x1028, 0x0610, "Dell", ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED), | ||
4751 | SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK), | 4827 | SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK), |
4752 | SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK), | 4828 | SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK), |
4753 | SND_PCI_QUIRK(0x1028, 0x061f, "Dell", ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED), | ||
4754 | SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK), | 4829 | SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK), |
4755 | SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), | 4830 | SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
4756 | SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), | 4831 | SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
@@ -5252,9 +5327,6 @@ static void alc269_fill_coef(struct hda_codec *codec) | |||
5252 | } | 5327 | } |
5253 | } | 5328 | } |
5254 | 5329 | ||
5255 | /* Class D */ | ||
5256 | alc_update_coef_idx(codec, 0xd, 0, 1<<14); | ||
5257 | |||
5258 | /* HP */ | 5330 | /* HP */ |
5259 | alc_update_coef_idx(codec, 0x4, 0, 1<<11); | 5331 | alc_update_coef_idx(codec, 0x4, 0, 1<<11); |
5260 | } | 5332 | } |
@@ -5695,6 +5767,35 @@ static void alc662_fixup_led_gpio1(struct hda_codec *codec, | |||
5695 | } | 5767 | } |
5696 | } | 5768 | } |
5697 | 5769 | ||
5770 | static struct coef_fw alc668_coefs[] = { | ||
5771 | WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0), | ||
5772 | WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80), | ||
5773 | WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0), | ||
5774 | WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f), | ||
5775 | WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001), | ||
5776 | WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940), | ||
5777 | WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0), | ||
5778 | WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418), | ||
5779 | WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468), | ||
5780 | WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418), | ||
5781 | WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00), | ||
5782 | WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000), | ||
5783 | WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0), | ||
5784 | WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480), | ||
5785 | WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0), | ||
5786 | WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040), | ||
5787 | WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697), | ||
5788 | WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab), | ||
5789 | WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02), | ||
5790 | WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6), | ||
5791 | {} | ||
5792 | }; | ||
5793 | |||
5794 | static void alc668_restore_default_value(struct hda_codec *codec) | ||
5795 | { | ||
5796 | alc_process_coef_fw(codec, alc668_coefs); | ||
5797 | } | ||
5798 | |||
5698 | enum { | 5799 | enum { |
5699 | ALC662_FIXUP_ASPIRE, | 5800 | ALC662_FIXUP_ASPIRE, |
5700 | ALC662_FIXUP_LED_GPIO1, | 5801 | ALC662_FIXUP_LED_GPIO1, |
@@ -6121,29 +6222,6 @@ static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = { | |||
6121 | {} | 6222 | {} |
6122 | }; | 6223 | }; |
6123 | 6224 | ||
6124 | static void alc662_fill_coef(struct hda_codec *codec) | ||
6125 | { | ||
6126 | int coef; | ||
6127 | |||
6128 | coef = alc_get_coef0(codec); | ||
6129 | |||
6130 | switch (codec->vendor_id) { | ||
6131 | case 0x10ec0662: | ||
6132 | if ((coef & 0x00f0) == 0x0030) | ||
6133 | alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */ | ||
6134 | break; | ||
6135 | case 0x10ec0272: | ||
6136 | case 0x10ec0273: | ||
6137 | case 0x10ec0663: | ||
6138 | case 0x10ec0665: | ||
6139 | case 0x10ec0670: | ||
6140 | case 0x10ec0671: | ||
6141 | case 0x10ec0672: | ||
6142 | alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */ | ||
6143 | break; | ||
6144 | } | ||
6145 | } | ||
6146 | |||
6147 | /* | 6225 | /* |
6148 | */ | 6226 | */ |
6149 | static int patch_alc662(struct hda_codec *codec) | 6227 | static int patch_alc662(struct hda_codec *codec) |
@@ -6162,8 +6240,11 @@ static int patch_alc662(struct hda_codec *codec) | |||
6162 | 6240 | ||
6163 | alc_fix_pll_init(codec, 0x20, 0x04, 15); | 6241 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
6164 | 6242 | ||
6165 | spec->init_hook = alc662_fill_coef; | 6243 | switch (codec->vendor_id) { |
6166 | alc662_fill_coef(codec); | 6244 | case 0x10ec0668: |
6245 | spec->init_hook = alc668_restore_default_value; | ||
6246 | break; | ||
6247 | } | ||
6167 | 6248 | ||
6168 | snd_hda_pick_fixup(codec, alc662_fixup_models, | 6249 | snd_hda_pick_fixup(codec, alc662_fixup_models, |
6169 | alc662_fixup_tbl, alc662_fixups); | 6250 | alc662_fixup_tbl, alc662_fixups); |
diff --git a/sound/soc/codecs/cs42l51-i2c.c b/sound/soc/codecs/cs42l51-i2c.c index cee51ae177c1..c40428f25ba5 100644 --- a/sound/soc/codecs/cs42l51-i2c.c +++ b/sound/soc/codecs/cs42l51-i2c.c | |||
@@ -46,6 +46,7 @@ static struct i2c_driver cs42l51_i2c_driver = { | |||
46 | .driver = { | 46 | .driver = { |
47 | .name = "cs42l51", | 47 | .name = "cs42l51", |
48 | .owner = THIS_MODULE, | 48 | .owner = THIS_MODULE, |
49 | .of_match_table = cs42l51_of_match, | ||
49 | }, | 50 | }, |
50 | .probe = cs42l51_i2c_probe, | 51 | .probe = cs42l51_i2c_probe, |
51 | .remove = cs42l51_i2c_remove, | 52 | .remove = cs42l51_i2c_remove, |
diff --git a/sound/soc/codecs/cs42l51.c b/sound/soc/codecs/cs42l51.c index 09488d97de60..669c38fc3034 100644 --- a/sound/soc/codecs/cs42l51.c +++ b/sound/soc/codecs/cs42l51.c | |||
@@ -558,11 +558,13 @@ error: | |||
558 | } | 558 | } |
559 | EXPORT_SYMBOL_GPL(cs42l51_probe); | 559 | EXPORT_SYMBOL_GPL(cs42l51_probe); |
560 | 560 | ||
561 | static const struct of_device_id cs42l51_of_match[] = { | 561 | const struct of_device_id cs42l51_of_match[] = { |
562 | { .compatible = "cirrus,cs42l51", }, | 562 | { .compatible = "cirrus,cs42l51", }, |
563 | { } | 563 | { } |
564 | }; | 564 | }; |
565 | MODULE_DEVICE_TABLE(of, cs42l51_of_match); | 565 | MODULE_DEVICE_TABLE(of, cs42l51_of_match); |
566 | EXPORT_SYMBOL_GPL(cs42l51_of_match); | ||
567 | |||
566 | MODULE_AUTHOR("Arnaud Patard <arnaud.patard@rtp-net.org>"); | 568 | MODULE_AUTHOR("Arnaud Patard <arnaud.patard@rtp-net.org>"); |
567 | MODULE_DESCRIPTION("Cirrus Logic CS42L51 ALSA SoC Codec Driver"); | 569 | MODULE_DESCRIPTION("Cirrus Logic CS42L51 ALSA SoC Codec Driver"); |
568 | MODULE_LICENSE("GPL"); | 570 | MODULE_LICENSE("GPL"); |
diff --git a/sound/soc/codecs/cs42l51.h b/sound/soc/codecs/cs42l51.h index 8c55bf384bc6..0ca805492ac4 100644 --- a/sound/soc/codecs/cs42l51.h +++ b/sound/soc/codecs/cs42l51.h | |||
@@ -22,6 +22,7 @@ struct device; | |||
22 | 22 | ||
23 | extern const struct regmap_config cs42l51_regmap; | 23 | extern const struct regmap_config cs42l51_regmap; |
24 | int cs42l51_probe(struct device *dev, struct regmap *regmap); | 24 | int cs42l51_probe(struct device *dev, struct regmap *regmap); |
25 | extern const struct of_device_id cs42l51_of_match[]; | ||
25 | 26 | ||
26 | #define CS42L51_CHIP_ID 0x1B | 27 | #define CS42L51_CHIP_ID 0x1B |
27 | #define CS42L51_CHIP_REV_A 0x00 | 28 | #define CS42L51_CHIP_REV_A 0x00 |
diff --git a/sound/soc/codecs/es8328-i2c.c b/sound/soc/codecs/es8328-i2c.c index aae410d122ee..2d05b5d3a6ce 100644 --- a/sound/soc/codecs/es8328-i2c.c +++ b/sound/soc/codecs/es8328-i2c.c | |||
@@ -19,7 +19,7 @@ | |||
19 | #include "es8328.h" | 19 | #include "es8328.h" |
20 | 20 | ||
21 | static const struct i2c_device_id es8328_id[] = { | 21 | static const struct i2c_device_id es8328_id[] = { |
22 | { "everest,es8328", 0 }, | 22 | { "es8328", 0 }, |
23 | { } | 23 | { } |
24 | }; | 24 | }; |
25 | MODULE_DEVICE_TABLE(i2c, es8328_id); | 25 | MODULE_DEVICE_TABLE(i2c, es8328_id); |
diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c index d519294f57c7..1229554f1464 100644 --- a/sound/soc/codecs/max98090.c +++ b/sound/soc/codecs/max98090.c | |||
@@ -1941,13 +1941,13 @@ static int max98090_dai_set_sysclk(struct snd_soc_dai *dai, | |||
1941 | * 0x02 (when master clk is 20MHz to 40MHz).. | 1941 | * 0x02 (when master clk is 20MHz to 40MHz).. |
1942 | * 0x03 (when master clk is 40MHz to 60MHz).. | 1942 | * 0x03 (when master clk is 40MHz to 60MHz).. |
1943 | */ | 1943 | */ |
1944 | if ((freq >= 10000000) && (freq < 20000000)) { | 1944 | if ((freq >= 10000000) && (freq <= 20000000)) { |
1945 | snd_soc_write(codec, M98090_REG_SYSTEM_CLOCK, | 1945 | snd_soc_write(codec, M98090_REG_SYSTEM_CLOCK, |
1946 | M98090_PSCLK_DIV1); | 1946 | M98090_PSCLK_DIV1); |
1947 | } else if ((freq >= 20000000) && (freq < 40000000)) { | 1947 | } else if ((freq > 20000000) && (freq <= 40000000)) { |
1948 | snd_soc_write(codec, M98090_REG_SYSTEM_CLOCK, | 1948 | snd_soc_write(codec, M98090_REG_SYSTEM_CLOCK, |
1949 | M98090_PSCLK_DIV2); | 1949 | M98090_PSCLK_DIV2); |
1950 | } else if ((freq >= 40000000) && (freq < 60000000)) { | 1950 | } else if ((freq > 40000000) && (freq <= 60000000)) { |
1951 | snd_soc_write(codec, M98090_REG_SYSTEM_CLOCK, | 1951 | snd_soc_write(codec, M98090_REG_SYSTEM_CLOCK, |
1952 | M98090_PSCLK_DIV4); | 1952 | M98090_PSCLK_DIV4); |
1953 | } else { | 1953 | } else { |
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 3fb83bf09768..d16331e0b64d 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c | |||
@@ -139,6 +139,7 @@ static const struct reg_default rt5645_reg[] = { | |||
139 | { 0x76, 0x000a }, | 139 | { 0x76, 0x000a }, |
140 | { 0x77, 0x0c00 }, | 140 | { 0x77, 0x0c00 }, |
141 | { 0x78, 0x0000 }, | 141 | { 0x78, 0x0000 }, |
142 | { 0x79, 0x0123 }, | ||
142 | { 0x80, 0x0000 }, | 143 | { 0x80, 0x0000 }, |
143 | { 0x81, 0x0000 }, | 144 | { 0x81, 0x0000 }, |
144 | { 0x82, 0x0000 }, | 145 | { 0x82, 0x0000 }, |
@@ -334,6 +335,7 @@ static bool rt5645_readable_register(struct device *dev, unsigned int reg) | |||
334 | case RT5645_DMIC_CTRL2: | 335 | case RT5645_DMIC_CTRL2: |
335 | case RT5645_TDM_CTRL_1: | 336 | case RT5645_TDM_CTRL_1: |
336 | case RT5645_TDM_CTRL_2: | 337 | case RT5645_TDM_CTRL_2: |
338 | case RT5645_TDM_CTRL_3: | ||
337 | case RT5645_GLB_CLK: | 339 | case RT5645_GLB_CLK: |
338 | case RT5645_PLL_CTRL1: | 340 | case RT5645_PLL_CTRL1: |
339 | case RT5645_PLL_CTRL2: | 341 | case RT5645_PLL_CTRL2: |
diff --git a/sound/soc/codecs/rt5670.c b/sound/soc/codecs/rt5670.c index ba9d9b4d4857..9bd8b4f63303 100644 --- a/sound/soc/codecs/rt5670.c +++ b/sound/soc/codecs/rt5670.c | |||
@@ -100,18 +100,18 @@ static const struct reg_default rt5670_reg[] = { | |||
100 | { 0x4c, 0x5380 }, | 100 | { 0x4c, 0x5380 }, |
101 | { 0x4f, 0x0073 }, | 101 | { 0x4f, 0x0073 }, |
102 | { 0x52, 0x00d3 }, | 102 | { 0x52, 0x00d3 }, |
103 | { 0x53, 0xf0f0 }, | 103 | { 0x53, 0xf000 }, |
104 | { 0x61, 0x0000 }, | 104 | { 0x61, 0x0000 }, |
105 | { 0x62, 0x0001 }, | 105 | { 0x62, 0x0001 }, |
106 | { 0x63, 0x00c3 }, | 106 | { 0x63, 0x00c3 }, |
107 | { 0x64, 0x0000 }, | 107 | { 0x64, 0x0000 }, |
108 | { 0x65, 0x0000 }, | 108 | { 0x65, 0x0001 }, |
109 | { 0x66, 0x0000 }, | 109 | { 0x66, 0x0000 }, |
110 | { 0x6f, 0x8000 }, | 110 | { 0x6f, 0x8000 }, |
111 | { 0x70, 0x8000 }, | 111 | { 0x70, 0x8000 }, |
112 | { 0x71, 0x8000 }, | 112 | { 0x71, 0x8000 }, |
113 | { 0x72, 0x8000 }, | 113 | { 0x72, 0x8000 }, |
114 | { 0x73, 0x1110 }, | 114 | { 0x73, 0x7770 }, |
115 | { 0x74, 0x0e00 }, | 115 | { 0x74, 0x0e00 }, |
116 | { 0x75, 0x1505 }, | 116 | { 0x75, 0x1505 }, |
117 | { 0x76, 0x0015 }, | 117 | { 0x76, 0x0015 }, |
@@ -125,21 +125,21 @@ static const struct reg_default rt5670_reg[] = { | |||
125 | { 0x83, 0x0000 }, | 125 | { 0x83, 0x0000 }, |
126 | { 0x84, 0x0000 }, | 126 | { 0x84, 0x0000 }, |
127 | { 0x85, 0x0000 }, | 127 | { 0x85, 0x0000 }, |
128 | { 0x86, 0x0008 }, | 128 | { 0x86, 0x0004 }, |
129 | { 0x87, 0x0000 }, | 129 | { 0x87, 0x0000 }, |
130 | { 0x88, 0x0000 }, | 130 | { 0x88, 0x0000 }, |
131 | { 0x89, 0x0000 }, | 131 | { 0x89, 0x0000 }, |
132 | { 0x8a, 0x0000 }, | 132 | { 0x8a, 0x0000 }, |
133 | { 0x8b, 0x0000 }, | 133 | { 0x8b, 0x0000 }, |
134 | { 0x8c, 0x0007 }, | 134 | { 0x8c, 0x0003 }, |
135 | { 0x8d, 0x0000 }, | 135 | { 0x8d, 0x0000 }, |
136 | { 0x8e, 0x0004 }, | 136 | { 0x8e, 0x0004 }, |
137 | { 0x8f, 0x1100 }, | 137 | { 0x8f, 0x1100 }, |
138 | { 0x90, 0x0646 }, | 138 | { 0x90, 0x0646 }, |
139 | { 0x91, 0x0c06 }, | 139 | { 0x91, 0x0c06 }, |
140 | { 0x93, 0x0000 }, | 140 | { 0x93, 0x0000 }, |
141 | { 0x94, 0x0000 }, | 141 | { 0x94, 0x1270 }, |
142 | { 0x95, 0x0000 }, | 142 | { 0x95, 0x1000 }, |
143 | { 0x97, 0x0000 }, | 143 | { 0x97, 0x0000 }, |
144 | { 0x98, 0x0000 }, | 144 | { 0x98, 0x0000 }, |
145 | { 0x99, 0x0000 }, | 145 | { 0x99, 0x0000 }, |
@@ -150,11 +150,11 @@ static const struct reg_default rt5670_reg[] = { | |||
150 | { 0x9e, 0x0400 }, | 150 | { 0x9e, 0x0400 }, |
151 | { 0xae, 0x7000 }, | 151 | { 0xae, 0x7000 }, |
152 | { 0xaf, 0x0000 }, | 152 | { 0xaf, 0x0000 }, |
153 | { 0xb0, 0x6000 }, | 153 | { 0xb0, 0x7000 }, |
154 | { 0xb1, 0x0000 }, | 154 | { 0xb1, 0x0000 }, |
155 | { 0xb2, 0x0000 }, | 155 | { 0xb2, 0x0000 }, |
156 | { 0xb3, 0x001f }, | 156 | { 0xb3, 0x001f }, |
157 | { 0xb4, 0x2206 }, | 157 | { 0xb4, 0x220c }, |
158 | { 0xb5, 0x1f00 }, | 158 | { 0xb5, 0x1f00 }, |
159 | { 0xb6, 0x0000 }, | 159 | { 0xb6, 0x0000 }, |
160 | { 0xb7, 0x0000 }, | 160 | { 0xb7, 0x0000 }, |
@@ -171,25 +171,25 @@ static const struct reg_default rt5670_reg[] = { | |||
171 | { 0xcf, 0x1813 }, | 171 | { 0xcf, 0x1813 }, |
172 | { 0xd0, 0x0690 }, | 172 | { 0xd0, 0x0690 }, |
173 | { 0xd1, 0x1c17 }, | 173 | { 0xd1, 0x1c17 }, |
174 | { 0xd3, 0xb320 }, | 174 | { 0xd3, 0xa220 }, |
175 | { 0xd4, 0x0000 }, | 175 | { 0xd4, 0x0000 }, |
176 | { 0xd6, 0x0400 }, | 176 | { 0xd6, 0x0400 }, |
177 | { 0xd9, 0x0809 }, | 177 | { 0xd9, 0x0809 }, |
178 | { 0xda, 0x0000 }, | 178 | { 0xda, 0x0000 }, |
179 | { 0xdb, 0x0001 }, | 179 | { 0xdb, 0x0001 }, |
180 | { 0xdc, 0x0049 }, | 180 | { 0xdc, 0x0049 }, |
181 | { 0xdd, 0x0009 }, | 181 | { 0xdd, 0x0024 }, |
182 | { 0xe6, 0x8000 }, | 182 | { 0xe6, 0x8000 }, |
183 | { 0xe7, 0x0000 }, | 183 | { 0xe7, 0x0000 }, |
184 | { 0xec, 0xb300 }, | 184 | { 0xec, 0xa200 }, |
185 | { 0xed, 0x0000 }, | 185 | { 0xed, 0x0000 }, |
186 | { 0xee, 0xb300 }, | 186 | { 0xee, 0xa200 }, |
187 | { 0xef, 0x0000 }, | 187 | { 0xef, 0x0000 }, |
188 | { 0xf8, 0x0000 }, | 188 | { 0xf8, 0x0000 }, |
189 | { 0xf9, 0x0000 }, | 189 | { 0xf9, 0x0000 }, |
190 | { 0xfa, 0x8010 }, | 190 | { 0xfa, 0x8010 }, |
191 | { 0xfb, 0x0033 }, | 191 | { 0xfb, 0x0033 }, |
192 | { 0xfc, 0x0080 }, | 192 | { 0xfc, 0x0100 }, |
193 | }; | 193 | }; |
194 | 194 | ||
195 | static bool rt5670_volatile_register(struct device *dev, unsigned int reg) | 195 | static bool rt5670_volatile_register(struct device *dev, unsigned int reg) |
@@ -1877,6 +1877,10 @@ static const struct snd_soc_dapm_route rt5670_dapm_routes[] = { | |||
1877 | { "DAC1 MIXR", "DAC1 Switch", "DAC1 R Mux" }, | 1877 | { "DAC1 MIXR", "DAC1 Switch", "DAC1 R Mux" }, |
1878 | { "DAC1 MIXR", NULL, "DAC Stereo1 Filter" }, | 1878 | { "DAC1 MIXR", NULL, "DAC Stereo1 Filter" }, |
1879 | 1879 | ||
1880 | { "DAC Stereo1 Filter", NULL, "PLL1", is_sys_clk_from_pll }, | ||
1881 | { "DAC Mono Left Filter", NULL, "PLL1", is_sys_clk_from_pll }, | ||
1882 | { "DAC Mono Right Filter", NULL, "PLL1", is_sys_clk_from_pll }, | ||
1883 | |||
1880 | { "DAC MIX", NULL, "DAC1 MIXL" }, | 1884 | { "DAC MIX", NULL, "DAC1 MIXL" }, |
1881 | { "DAC MIX", NULL, "DAC1 MIXR" }, | 1885 | { "DAC MIX", NULL, "DAC1 MIXR" }, |
1882 | 1886 | ||
@@ -1926,14 +1930,10 @@ static const struct snd_soc_dapm_route rt5670_dapm_routes[] = { | |||
1926 | 1930 | ||
1927 | { "DAC L1", NULL, "DAC L1 Power" }, | 1931 | { "DAC L1", NULL, "DAC L1 Power" }, |
1928 | { "DAC L1", NULL, "Stereo DAC MIXL" }, | 1932 | { "DAC L1", NULL, "Stereo DAC MIXL" }, |
1929 | { "DAC L1", NULL, "PLL1", is_sys_clk_from_pll }, | ||
1930 | { "DAC R1", NULL, "DAC R1 Power" }, | 1933 | { "DAC R1", NULL, "DAC R1 Power" }, |
1931 | { "DAC R1", NULL, "Stereo DAC MIXR" }, | 1934 | { "DAC R1", NULL, "Stereo DAC MIXR" }, |
1932 | { "DAC R1", NULL, "PLL1", is_sys_clk_from_pll }, | ||
1933 | { "DAC L2", NULL, "Mono DAC MIXL" }, | 1935 | { "DAC L2", NULL, "Mono DAC MIXL" }, |
1934 | { "DAC L2", NULL, "PLL1", is_sys_clk_from_pll }, | ||
1935 | { "DAC R2", NULL, "Mono DAC MIXR" }, | 1936 | { "DAC R2", NULL, "Mono DAC MIXR" }, |
1936 | { "DAC R2", NULL, "PLL1", is_sys_clk_from_pll }, | ||
1937 | 1937 | ||
1938 | { "OUT MIXL", "BST1 Switch", "BST1" }, | 1938 | { "OUT MIXL", "BST1 Switch", "BST1" }, |
1939 | { "OUT MIXL", "INL Switch", "INL VOL" }, | 1939 | { "OUT MIXL", "INL Switch", "INL VOL" }, |
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index 6bb77d76561b..dab9b15304af 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c | |||
@@ -1299,8 +1299,7 @@ static int sgtl5000_probe(struct snd_soc_codec *codec) | |||
1299 | 1299 | ||
1300 | /* enable small pop, introduce 400ms delay in turning off */ | 1300 | /* enable small pop, introduce 400ms delay in turning off */ |
1301 | snd_soc_update_bits(codec, SGTL5000_CHIP_REF_CTRL, | 1301 | snd_soc_update_bits(codec, SGTL5000_CHIP_REF_CTRL, |
1302 | SGTL5000_SMALL_POP, | 1302 | SGTL5000_SMALL_POP, 1); |
1303 | SGTL5000_SMALL_POP); | ||
1304 | 1303 | ||
1305 | /* disable short cut detector */ | 1304 | /* disable short cut detector */ |
1306 | snd_soc_write(codec, SGTL5000_CHIP_SHORT_CTRL, 0); | 1305 | snd_soc_write(codec, SGTL5000_CHIP_SHORT_CTRL, 0); |
diff --git a/sound/soc/codecs/sgtl5000.h b/sound/soc/codecs/sgtl5000.h index 2f8c88931f69..bd7a344bf8c5 100644 --- a/sound/soc/codecs/sgtl5000.h +++ b/sound/soc/codecs/sgtl5000.h | |||
@@ -275,7 +275,7 @@ | |||
275 | #define SGTL5000_BIAS_CTRL_MASK 0x000e | 275 | #define SGTL5000_BIAS_CTRL_MASK 0x000e |
276 | #define SGTL5000_BIAS_CTRL_SHIFT 1 | 276 | #define SGTL5000_BIAS_CTRL_SHIFT 1 |
277 | #define SGTL5000_BIAS_CTRL_WIDTH 3 | 277 | #define SGTL5000_BIAS_CTRL_WIDTH 3 |
278 | #define SGTL5000_SMALL_POP 0x0001 | 278 | #define SGTL5000_SMALL_POP 0 |
279 | 279 | ||
280 | /* | 280 | /* |
281 | * SGTL5000_CHIP_MIC_CTRL | 281 | * SGTL5000_CHIP_MIC_CTRL |
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c index f412a9911a75..67124783558a 100644 --- a/sound/soc/codecs/wm_adsp.c +++ b/sound/soc/codecs/wm_adsp.c | |||
@@ -1355,6 +1355,7 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp) | |||
1355 | file, blocks, pos - firmware->size); | 1355 | file, blocks, pos - firmware->size); |
1356 | 1356 | ||
1357 | out_fw: | 1357 | out_fw: |
1358 | regmap_async_complete(regmap); | ||
1358 | release_firmware(firmware); | 1359 | release_firmware(firmware); |
1359 | wm_adsp_buf_free(&buf_list); | 1360 | wm_adsp_buf_free(&buf_list); |
1360 | out: | 1361 | out: |
diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c index ed866e9a2928..9deabdd2b1a2 100644 --- a/sound/soc/fsl/fsl_asrc.c +++ b/sound/soc/fsl/fsl_asrc.c | |||
@@ -684,12 +684,38 @@ static bool fsl_asrc_writeable_reg(struct device *dev, unsigned int reg) | |||
684 | } | 684 | } |
685 | } | 685 | } |
686 | 686 | ||
687 | static struct reg_default fsl_asrc_reg[] = { | ||
688 | { REG_ASRCTR, 0x0000 }, { REG_ASRIER, 0x0000 }, | ||
689 | { REG_ASRCNCR, 0x0000 }, { REG_ASRCFG, 0x0000 }, | ||
690 | { REG_ASRCSR, 0x0000 }, { REG_ASRCDR1, 0x0000 }, | ||
691 | { REG_ASRCDR2, 0x0000 }, { REG_ASRSTR, 0x0000 }, | ||
692 | { REG_ASRRA, 0x0000 }, { REG_ASRRB, 0x0000 }, | ||
693 | { REG_ASRRC, 0x0000 }, { REG_ASRPM1, 0x0000 }, | ||
694 | { REG_ASRPM2, 0x0000 }, { REG_ASRPM3, 0x0000 }, | ||
695 | { REG_ASRPM4, 0x0000 }, { REG_ASRPM5, 0x0000 }, | ||
696 | { REG_ASRTFR1, 0x0000 }, { REG_ASRCCR, 0x0000 }, | ||
697 | { REG_ASRDIA, 0x0000 }, { REG_ASRDOA, 0x0000 }, | ||
698 | { REG_ASRDIB, 0x0000 }, { REG_ASRDOB, 0x0000 }, | ||
699 | { REG_ASRDIC, 0x0000 }, { REG_ASRDOC, 0x0000 }, | ||
700 | { REG_ASRIDRHA, 0x0000 }, { REG_ASRIDRLA, 0x0000 }, | ||
701 | { REG_ASRIDRHB, 0x0000 }, { REG_ASRIDRLB, 0x0000 }, | ||
702 | { REG_ASRIDRHC, 0x0000 }, { REG_ASRIDRLC, 0x0000 }, | ||
703 | { REG_ASR76K, 0x0A47 }, { REG_ASR56K, 0x0DF3 }, | ||
704 | { REG_ASRMCRA, 0x0000 }, { REG_ASRFSTA, 0x0000 }, | ||
705 | { REG_ASRMCRB, 0x0000 }, { REG_ASRFSTB, 0x0000 }, | ||
706 | { REG_ASRMCRC, 0x0000 }, { REG_ASRFSTC, 0x0000 }, | ||
707 | { REG_ASRMCR1A, 0x0000 }, { REG_ASRMCR1B, 0x0000 }, | ||
708 | { REG_ASRMCR1C, 0x0000 }, | ||
709 | }; | ||
710 | |||
687 | static const struct regmap_config fsl_asrc_regmap_config = { | 711 | static const struct regmap_config fsl_asrc_regmap_config = { |
688 | .reg_bits = 32, | 712 | .reg_bits = 32, |
689 | .reg_stride = 4, | 713 | .reg_stride = 4, |
690 | .val_bits = 32, | 714 | .val_bits = 32, |
691 | 715 | ||
692 | .max_register = REG_ASRMCR1C, | 716 | .max_register = REG_ASRMCR1C, |
717 | .reg_defaults = fsl_asrc_reg, | ||
718 | .num_reg_defaults = ARRAY_SIZE(fsl_asrc_reg), | ||
693 | .readable_reg = fsl_asrc_readable_reg, | 719 | .readable_reg = fsl_asrc_readable_reg, |
694 | .volatile_reg = fsl_asrc_volatile_reg, | 720 | .volatile_reg = fsl_asrc_volatile_reg, |
695 | .writeable_reg = fsl_asrc_writeable_reg, | 721 | .writeable_reg = fsl_asrc_writeable_reg, |
diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c index f373e37f8305..c74ba37f862c 100644 --- a/sound/soc/rockchip/rockchip_i2s.c +++ b/sound/soc/rockchip/rockchip_i2s.c | |||
@@ -154,8 +154,10 @@ static void rockchip_snd_rxctrl(struct rk_i2s_dev *i2s, int on) | |||
154 | while (val) { | 154 | while (val) { |
155 | regmap_read(i2s->regmap, I2S_CLR, &val); | 155 | regmap_read(i2s->regmap, I2S_CLR, &val); |
156 | retry--; | 156 | retry--; |
157 | if (!retry) | 157 | if (!retry) { |
158 | dev_warn(i2s->dev, "fail to clear\n"); | 158 | dev_warn(i2s->dev, "fail to clear\n"); |
159 | break; | ||
160 | } | ||
159 | } | 161 | } |
160 | } | 162 | } |
161 | } | 163 | } |
diff --git a/sound/soc/samsung/snow.c b/sound/soc/samsung/snow.c index 0acf5d0eed53..72118a77dd5b 100644 --- a/sound/soc/samsung/snow.c +++ b/sound/soc/samsung/snow.c | |||
@@ -110,6 +110,7 @@ static const struct of_device_id snow_of_match[] = { | |||
110 | { .compatible = "google,snow-audio-max98095", }, | 110 | { .compatible = "google,snow-audio-max98095", }, |
111 | {}, | 111 | {}, |
112 | }; | 112 | }; |
113 | MODULE_DEVICE_TABLE(of, snow_of_match); | ||
113 | 114 | ||
114 | static struct platform_driver snow_driver = { | 115 | static struct platform_driver snow_driver = { |
115 | .driver = { | 116 | .driver = { |
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c index 66fddec9543d..88e5df474ccf 100644 --- a/sound/soc/sh/fsi.c +++ b/sound/soc/sh/fsi.c | |||
@@ -1711,8 +1711,7 @@ static const struct snd_soc_dai_ops fsi_dai_ops = { | |||
1711 | static struct snd_pcm_hardware fsi_pcm_hardware = { | 1711 | static struct snd_pcm_hardware fsi_pcm_hardware = { |
1712 | .info = SNDRV_PCM_INFO_INTERLEAVED | | 1712 | .info = SNDRV_PCM_INFO_INTERLEAVED | |
1713 | SNDRV_PCM_INFO_MMAP | | 1713 | SNDRV_PCM_INFO_MMAP | |
1714 | SNDRV_PCM_INFO_MMAP_VALID | | 1714 | SNDRV_PCM_INFO_MMAP_VALID, |
1715 | SNDRV_PCM_INFO_PAUSE, | ||
1716 | .buffer_bytes_max = 64 * 1024, | 1715 | .buffer_bytes_max = 64 * 1024, |
1717 | .period_bytes_min = 32, | 1716 | .period_bytes_min = 32, |
1718 | .period_bytes_max = 8192, | 1717 | .period_bytes_max = 8192, |
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 1922ec57d10a..70042197f9e2 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c | |||
@@ -886,8 +886,7 @@ static int rsnd_dai_probe(struct platform_device *pdev, | |||
886 | static struct snd_pcm_hardware rsnd_pcm_hardware = { | 886 | static struct snd_pcm_hardware rsnd_pcm_hardware = { |
887 | .info = SNDRV_PCM_INFO_INTERLEAVED | | 887 | .info = SNDRV_PCM_INFO_INTERLEAVED | |
888 | SNDRV_PCM_INFO_MMAP | | 888 | SNDRV_PCM_INFO_MMAP | |
889 | SNDRV_PCM_INFO_MMAP_VALID | | 889 | SNDRV_PCM_INFO_MMAP_VALID, |
890 | SNDRV_PCM_INFO_PAUSE, | ||
891 | .buffer_bytes_max = 64 * 1024, | 890 | .buffer_bytes_max = 64 * 1024, |
892 | .period_bytes_min = 32, | 891 | .period_bytes_min = 32, |
893 | .period_bytes_max = 8192, | 892 | .period_bytes_max = 8192, |
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 4c8f8a23a0e9..b60ff56ebc0f 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -884,7 +884,7 @@ static struct snd_soc_dai *snd_soc_find_dai( | |||
884 | list_for_each_entry(component, &component_list, list) { | 884 | list_for_each_entry(component, &component_list, list) { |
885 | if (dlc->of_node && component->dev->of_node != dlc->of_node) | 885 | if (dlc->of_node && component->dev->of_node != dlc->of_node) |
886 | continue; | 886 | continue; |
887 | if (dlc->name && strcmp(dev_name(component->dev), dlc->name)) | 887 | if (dlc->name && strcmp(component->name, dlc->name)) |
888 | continue; | 888 | continue; |
889 | list_for_each_entry(dai, &component->dai_list, list) { | 889 | list_for_each_entry(dai, &component->dai_list, list) { |
890 | if (dlc->dai_name && strcmp(dai->name, dlc->dai_name)) | 890 | if (dlc->dai_name && strcmp(dai->name, dlc->dai_name)) |
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 002311afdeaa..57277dd79e11 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c | |||
@@ -1522,13 +1522,36 @@ static void dpcm_set_fe_runtime(struct snd_pcm_substream *substream) | |||
1522 | dpcm_init_runtime_hw(runtime, &cpu_dai_drv->capture); | 1522 | dpcm_init_runtime_hw(runtime, &cpu_dai_drv->capture); |
1523 | } | 1523 | } |
1524 | 1524 | ||
1525 | static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int cmd); | ||
1526 | |||
1527 | /* Set FE's runtime_update state; the state is protected via PCM stream lock | ||
1528 | * for avoiding the race with trigger callback. | ||
1529 | * If the state is unset and a trigger is pending while the previous operation, | ||
1530 | * process the pending trigger action here. | ||
1531 | */ | ||
1532 | static void dpcm_set_fe_update_state(struct snd_soc_pcm_runtime *fe, | ||
1533 | int stream, enum snd_soc_dpcm_update state) | ||
1534 | { | ||
1535 | struct snd_pcm_substream *substream = | ||
1536 | snd_soc_dpcm_get_substream(fe, stream); | ||
1537 | |||
1538 | snd_pcm_stream_lock_irq(substream); | ||
1539 | if (state == SND_SOC_DPCM_UPDATE_NO && fe->dpcm[stream].trigger_pending) { | ||
1540 | dpcm_fe_dai_do_trigger(substream, | ||
1541 | fe->dpcm[stream].trigger_pending - 1); | ||
1542 | fe->dpcm[stream].trigger_pending = 0; | ||
1543 | } | ||
1544 | fe->dpcm[stream].runtime_update = state; | ||
1545 | snd_pcm_stream_unlock_irq(substream); | ||
1546 | } | ||
1547 | |||
1525 | static int dpcm_fe_dai_startup(struct snd_pcm_substream *fe_substream) | 1548 | static int dpcm_fe_dai_startup(struct snd_pcm_substream *fe_substream) |
1526 | { | 1549 | { |
1527 | struct snd_soc_pcm_runtime *fe = fe_substream->private_data; | 1550 | struct snd_soc_pcm_runtime *fe = fe_substream->private_data; |
1528 | struct snd_pcm_runtime *runtime = fe_substream->runtime; | 1551 | struct snd_pcm_runtime *runtime = fe_substream->runtime; |
1529 | int stream = fe_substream->stream, ret = 0; | 1552 | int stream = fe_substream->stream, ret = 0; |
1530 | 1553 | ||
1531 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; | 1554 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); |
1532 | 1555 | ||
1533 | ret = dpcm_be_dai_startup(fe, fe_substream->stream); | 1556 | ret = dpcm_be_dai_startup(fe, fe_substream->stream); |
1534 | if (ret < 0) { | 1557 | if (ret < 0) { |
@@ -1550,13 +1573,13 @@ static int dpcm_fe_dai_startup(struct snd_pcm_substream *fe_substream) | |||
1550 | dpcm_set_fe_runtime(fe_substream); | 1573 | dpcm_set_fe_runtime(fe_substream); |
1551 | snd_pcm_limit_hw_rates(runtime); | 1574 | snd_pcm_limit_hw_rates(runtime); |
1552 | 1575 | ||
1553 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; | 1576 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); |
1554 | return 0; | 1577 | return 0; |
1555 | 1578 | ||
1556 | unwind: | 1579 | unwind: |
1557 | dpcm_be_dai_startup_unwind(fe, fe_substream->stream); | 1580 | dpcm_be_dai_startup_unwind(fe, fe_substream->stream); |
1558 | be_err: | 1581 | be_err: |
1559 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; | 1582 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); |
1560 | return ret; | 1583 | return ret; |
1561 | } | 1584 | } |
1562 | 1585 | ||
@@ -1603,7 +1626,7 @@ static int dpcm_fe_dai_shutdown(struct snd_pcm_substream *substream) | |||
1603 | struct snd_soc_pcm_runtime *fe = substream->private_data; | 1626 | struct snd_soc_pcm_runtime *fe = substream->private_data; |
1604 | int stream = substream->stream; | 1627 | int stream = substream->stream; |
1605 | 1628 | ||
1606 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; | 1629 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); |
1607 | 1630 | ||
1608 | /* shutdown the BEs */ | 1631 | /* shutdown the BEs */ |
1609 | dpcm_be_dai_shutdown(fe, substream->stream); | 1632 | dpcm_be_dai_shutdown(fe, substream->stream); |
@@ -1617,7 +1640,7 @@ static int dpcm_fe_dai_shutdown(struct snd_pcm_substream *substream) | |||
1617 | dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_STOP); | 1640 | dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_STOP); |
1618 | 1641 | ||
1619 | fe->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; | 1642 | fe->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; |
1620 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; | 1643 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); |
1621 | return 0; | 1644 | return 0; |
1622 | } | 1645 | } |
1623 | 1646 | ||
@@ -1665,7 +1688,7 @@ static int dpcm_fe_dai_hw_free(struct snd_pcm_substream *substream) | |||
1665 | int err, stream = substream->stream; | 1688 | int err, stream = substream->stream; |
1666 | 1689 | ||
1667 | mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); | 1690 | mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); |
1668 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; | 1691 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); |
1669 | 1692 | ||
1670 | dev_dbg(fe->dev, "ASoC: hw_free FE %s\n", fe->dai_link->name); | 1693 | dev_dbg(fe->dev, "ASoC: hw_free FE %s\n", fe->dai_link->name); |
1671 | 1694 | ||
@@ -1680,7 +1703,7 @@ static int dpcm_fe_dai_hw_free(struct snd_pcm_substream *substream) | |||
1680 | err = dpcm_be_dai_hw_free(fe, stream); | 1703 | err = dpcm_be_dai_hw_free(fe, stream); |
1681 | 1704 | ||
1682 | fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; | 1705 | fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; |
1683 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; | 1706 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); |
1684 | 1707 | ||
1685 | mutex_unlock(&fe->card->mutex); | 1708 | mutex_unlock(&fe->card->mutex); |
1686 | return 0; | 1709 | return 0; |
@@ -1773,7 +1796,7 @@ static int dpcm_fe_dai_hw_params(struct snd_pcm_substream *substream, | |||
1773 | int ret, stream = substream->stream; | 1796 | int ret, stream = substream->stream; |
1774 | 1797 | ||
1775 | mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); | 1798 | mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); |
1776 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; | 1799 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); |
1777 | 1800 | ||
1778 | memcpy(&fe->dpcm[substream->stream].hw_params, params, | 1801 | memcpy(&fe->dpcm[substream->stream].hw_params, params, |
1779 | sizeof(struct snd_pcm_hw_params)); | 1802 | sizeof(struct snd_pcm_hw_params)); |
@@ -1796,7 +1819,7 @@ static int dpcm_fe_dai_hw_params(struct snd_pcm_substream *substream, | |||
1796 | fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; | 1819 | fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; |
1797 | 1820 | ||
1798 | out: | 1821 | out: |
1799 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; | 1822 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); |
1800 | mutex_unlock(&fe->card->mutex); | 1823 | mutex_unlock(&fe->card->mutex); |
1801 | return ret; | 1824 | return ret; |
1802 | } | 1825 | } |
@@ -1910,7 +1933,7 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream, | |||
1910 | } | 1933 | } |
1911 | EXPORT_SYMBOL_GPL(dpcm_be_dai_trigger); | 1934 | EXPORT_SYMBOL_GPL(dpcm_be_dai_trigger); |
1912 | 1935 | ||
1913 | static int dpcm_fe_dai_trigger(struct snd_pcm_substream *substream, int cmd) | 1936 | static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int cmd) |
1914 | { | 1937 | { |
1915 | struct snd_soc_pcm_runtime *fe = substream->private_data; | 1938 | struct snd_soc_pcm_runtime *fe = substream->private_data; |
1916 | int stream = substream->stream, ret; | 1939 | int stream = substream->stream, ret; |
@@ -1984,6 +2007,23 @@ out: | |||
1984 | return ret; | 2007 | return ret; |
1985 | } | 2008 | } |
1986 | 2009 | ||
2010 | static int dpcm_fe_dai_trigger(struct snd_pcm_substream *substream, int cmd) | ||
2011 | { | ||
2012 | struct snd_soc_pcm_runtime *fe = substream->private_data; | ||
2013 | int stream = substream->stream; | ||
2014 | |||
2015 | /* if FE's runtime_update is already set, we're in race; | ||
2016 | * process this trigger later at exit | ||
2017 | */ | ||
2018 | if (fe->dpcm[stream].runtime_update != SND_SOC_DPCM_UPDATE_NO) { | ||
2019 | fe->dpcm[stream].trigger_pending = cmd + 1; | ||
2020 | return 0; /* delayed, assuming it's successful */ | ||
2021 | } | ||
2022 | |||
2023 | /* we're alone, let's trigger */ | ||
2024 | return dpcm_fe_dai_do_trigger(substream, cmd); | ||
2025 | } | ||
2026 | |||
1987 | int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream) | 2027 | int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream) |
1988 | { | 2028 | { |
1989 | struct snd_soc_dpcm *dpcm; | 2029 | struct snd_soc_dpcm *dpcm; |
@@ -2027,7 +2067,7 @@ static int dpcm_fe_dai_prepare(struct snd_pcm_substream *substream) | |||
2027 | 2067 | ||
2028 | dev_dbg(fe->dev, "ASoC: prepare FE %s\n", fe->dai_link->name); | 2068 | dev_dbg(fe->dev, "ASoC: prepare FE %s\n", fe->dai_link->name); |
2029 | 2069 | ||
2030 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; | 2070 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); |
2031 | 2071 | ||
2032 | /* there is no point preparing this FE if there are no BEs */ | 2072 | /* there is no point preparing this FE if there are no BEs */ |
2033 | if (list_empty(&fe->dpcm[stream].be_clients)) { | 2073 | if (list_empty(&fe->dpcm[stream].be_clients)) { |
@@ -2054,7 +2094,7 @@ static int dpcm_fe_dai_prepare(struct snd_pcm_substream *substream) | |||
2054 | fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; | 2094 | fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; |
2055 | 2095 | ||
2056 | out: | 2096 | out: |
2057 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; | 2097 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); |
2058 | mutex_unlock(&fe->card->mutex); | 2098 | mutex_unlock(&fe->card->mutex); |
2059 | 2099 | ||
2060 | return ret; | 2100 | return ret; |
@@ -2201,11 +2241,11 @@ static int dpcm_run_new_update(struct snd_soc_pcm_runtime *fe, int stream) | |||
2201 | { | 2241 | { |
2202 | int ret; | 2242 | int ret; |
2203 | 2243 | ||
2204 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_BE; | 2244 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_BE); |
2205 | ret = dpcm_run_update_startup(fe, stream); | 2245 | ret = dpcm_run_update_startup(fe, stream); |
2206 | if (ret < 0) | 2246 | if (ret < 0) |
2207 | dev_err(fe->dev, "ASoC: failed to startup some BEs\n"); | 2247 | dev_err(fe->dev, "ASoC: failed to startup some BEs\n"); |
2208 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; | 2248 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); |
2209 | 2249 | ||
2210 | return ret; | 2250 | return ret; |
2211 | } | 2251 | } |
@@ -2214,11 +2254,11 @@ static int dpcm_run_old_update(struct snd_soc_pcm_runtime *fe, int stream) | |||
2214 | { | 2254 | { |
2215 | int ret; | 2255 | int ret; |
2216 | 2256 | ||
2217 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_BE; | 2257 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_BE); |
2218 | ret = dpcm_run_update_shutdown(fe, stream); | 2258 | ret = dpcm_run_update_shutdown(fe, stream); |
2219 | if (ret < 0) | 2259 | if (ret < 0) |
2220 | dev_err(fe->dev, "ASoC: failed to shutdown some BEs\n"); | 2260 | dev_err(fe->dev, "ASoC: failed to shutdown some BEs\n"); |
2221 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; | 2261 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); |
2222 | 2262 | ||
2223 | return ret; | 2263 | return ret; |
2224 | } | 2264 | } |
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c index 14e1455ca9de..41650d5b93b7 100644 --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c | |||
@@ -136,6 +136,10 @@ check_mapped_name(const struct usbmix_name_map *p, char *buf, int buflen) | |||
136 | return strlcpy(buf, p->name, buflen); | 136 | return strlcpy(buf, p->name, buflen); |
137 | } | 137 | } |
138 | 138 | ||
139 | /* ignore the error value if ignore_ctl_error flag is set */ | ||
140 | #define filter_error(cval, err) \ | ||
141 | ((cval)->head.mixer->ignore_ctl_error ? 0 : (err)) | ||
142 | |||
139 | /* check whether the control should be ignored */ | 143 | /* check whether the control should be ignored */ |
140 | static inline int | 144 | static inline int |
141 | check_ignored_ctl(const struct usbmix_name_map *p) | 145 | check_ignored_ctl(const struct usbmix_name_map *p) |
@@ -286,13 +290,13 @@ static int get_abs_value(struct usb_mixer_elem_info *cval, int val) | |||
286 | static int get_ctl_value_v1(struct usb_mixer_elem_info *cval, int request, | 290 | static int get_ctl_value_v1(struct usb_mixer_elem_info *cval, int request, |
287 | int validx, int *value_ret) | 291 | int validx, int *value_ret) |
288 | { | 292 | { |
289 | struct snd_usb_audio *chip = cval->mixer->chip; | 293 | struct snd_usb_audio *chip = cval->head.mixer->chip; |
290 | unsigned char buf[2]; | 294 | unsigned char buf[2]; |
291 | int val_len = cval->val_type >= USB_MIXER_S16 ? 2 : 1; | 295 | int val_len = cval->val_type >= USB_MIXER_S16 ? 2 : 1; |
292 | int timeout = 10; | 296 | int timeout = 10; |
293 | int idx = 0, err; | 297 | int idx = 0, err; |
294 | 298 | ||
295 | err = snd_usb_autoresume(cval->mixer->chip); | 299 | err = snd_usb_autoresume(chip); |
296 | if (err < 0) | 300 | if (err < 0) |
297 | return -EIO; | 301 | return -EIO; |
298 | 302 | ||
@@ -300,7 +304,7 @@ static int get_ctl_value_v1(struct usb_mixer_elem_info *cval, int request, | |||
300 | while (timeout-- > 0) { | 304 | while (timeout-- > 0) { |
301 | if (chip->shutdown) | 305 | if (chip->shutdown) |
302 | break; | 306 | break; |
303 | idx = snd_usb_ctrl_intf(chip) | (cval->id << 8); | 307 | idx = snd_usb_ctrl_intf(chip) | (cval->head.id << 8); |
304 | if (snd_usb_ctl_msg(chip->dev, usb_rcvctrlpipe(chip->dev, 0), request, | 308 | if (snd_usb_ctl_msg(chip->dev, usb_rcvctrlpipe(chip->dev, 0), request, |
305 | USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN, | 309 | USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN, |
306 | validx, idx, buf, val_len) >= val_len) { | 310 | validx, idx, buf, val_len) >= val_len) { |
@@ -316,14 +320,14 @@ static int get_ctl_value_v1(struct usb_mixer_elem_info *cval, int request, | |||
316 | 320 | ||
317 | out: | 321 | out: |
318 | up_read(&chip->shutdown_rwsem); | 322 | up_read(&chip->shutdown_rwsem); |
319 | snd_usb_autosuspend(cval->mixer->chip); | 323 | snd_usb_autosuspend(chip); |
320 | return err; | 324 | return err; |
321 | } | 325 | } |
322 | 326 | ||
323 | static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request, | 327 | static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request, |
324 | int validx, int *value_ret) | 328 | int validx, int *value_ret) |
325 | { | 329 | { |
326 | struct snd_usb_audio *chip = cval->mixer->chip; | 330 | struct snd_usb_audio *chip = cval->head.mixer->chip; |
327 | unsigned char buf[2 + 3 * sizeof(__u16)]; /* enough space for one range */ | 331 | unsigned char buf[2 + 3 * sizeof(__u16)]; /* enough space for one range */ |
328 | unsigned char *val; | 332 | unsigned char *val; |
329 | int idx = 0, ret, size; | 333 | int idx = 0, ret, size; |
@@ -347,7 +351,7 @@ static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request, | |||
347 | if (chip->shutdown) { | 351 | if (chip->shutdown) { |
348 | ret = -ENODEV; | 352 | ret = -ENODEV; |
349 | } else { | 353 | } else { |
350 | idx = snd_usb_ctrl_intf(chip) | (cval->id << 8); | 354 | idx = snd_usb_ctrl_intf(chip) | (cval->head.id << 8); |
351 | ret = snd_usb_ctl_msg(chip->dev, usb_rcvctrlpipe(chip->dev, 0), bRequest, | 355 | ret = snd_usb_ctl_msg(chip->dev, usb_rcvctrlpipe(chip->dev, 0), bRequest, |
352 | USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN, | 356 | USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN, |
353 | validx, idx, buf, size); | 357 | validx, idx, buf, size); |
@@ -392,7 +396,7 @@ static int get_ctl_value(struct usb_mixer_elem_info *cval, int request, | |||
392 | { | 396 | { |
393 | validx += cval->idx_off; | 397 | validx += cval->idx_off; |
394 | 398 | ||
395 | return (cval->mixer->protocol == UAC_VERSION_1) ? | 399 | return (cval->head.mixer->protocol == UAC_VERSION_1) ? |
396 | get_ctl_value_v1(cval, request, validx, value_ret) : | 400 | get_ctl_value_v1(cval, request, validx, value_ret) : |
397 | get_ctl_value_v2(cval, request, validx, value_ret); | 401 | get_ctl_value_v2(cval, request, validx, value_ret); |
398 | } | 402 | } |
@@ -423,8 +427,8 @@ int snd_usb_get_cur_mix_value(struct usb_mixer_elem_info *cval, | |||
423 | } | 427 | } |
424 | err = get_cur_mix_raw(cval, channel, value); | 428 | err = get_cur_mix_raw(cval, channel, value); |
425 | if (err < 0) { | 429 | if (err < 0) { |
426 | if (!cval->mixer->ignore_ctl_error) | 430 | if (!cval->head.mixer->ignore_ctl_error) |
427 | usb_audio_dbg(cval->mixer->chip, | 431 | usb_audio_dbg(cval->head.mixer->chip, |
428 | "cannot get current value for control %d ch %d: err = %d\n", | 432 | "cannot get current value for control %d ch %d: err = %d\n", |
429 | cval->control, channel, err); | 433 | cval->control, channel, err); |
430 | return err; | 434 | return err; |
@@ -441,13 +445,13 @@ int snd_usb_get_cur_mix_value(struct usb_mixer_elem_info *cval, | |||
441 | int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval, | 445 | int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval, |
442 | int request, int validx, int value_set) | 446 | int request, int validx, int value_set) |
443 | { | 447 | { |
444 | struct snd_usb_audio *chip = cval->mixer->chip; | 448 | struct snd_usb_audio *chip = cval->head.mixer->chip; |
445 | unsigned char buf[2]; | 449 | unsigned char buf[2]; |
446 | int idx = 0, val_len, err, timeout = 10; | 450 | int idx = 0, val_len, err, timeout = 10; |
447 | 451 | ||
448 | validx += cval->idx_off; | 452 | validx += cval->idx_off; |
449 | 453 | ||
450 | if (cval->mixer->protocol == UAC_VERSION_1) { | 454 | if (cval->head.mixer->protocol == UAC_VERSION_1) { |
451 | val_len = cval->val_type >= USB_MIXER_S16 ? 2 : 1; | 455 | val_len = cval->val_type >= USB_MIXER_S16 ? 2 : 1; |
452 | } else { /* UAC_VERSION_2 */ | 456 | } else { /* UAC_VERSION_2 */ |
453 | /* audio class v2 controls are always 2 bytes in size */ | 457 | /* audio class v2 controls are always 2 bytes in size */ |
@@ -472,7 +476,7 @@ int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval, | |||
472 | while (timeout-- > 0) { | 476 | while (timeout-- > 0) { |
473 | if (chip->shutdown) | 477 | if (chip->shutdown) |
474 | break; | 478 | break; |
475 | idx = snd_usb_ctrl_intf(chip) | (cval->id << 8); | 479 | idx = snd_usb_ctrl_intf(chip) | (cval->head.id << 8); |
476 | if (snd_usb_ctl_msg(chip->dev, | 480 | if (snd_usb_ctl_msg(chip->dev, |
477 | usb_sndctrlpipe(chip->dev, 0), request, | 481 | usb_sndctrlpipe(chip->dev, 0), request, |
478 | USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT, | 482 | USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT, |
@@ -506,7 +510,7 @@ int snd_usb_set_cur_mix_value(struct usb_mixer_elem_info *cval, int channel, | |||
506 | cval->ch_readonly & (1 << (channel - 1)); | 510 | cval->ch_readonly & (1 << (channel - 1)); |
507 | 511 | ||
508 | if (read_only) { | 512 | if (read_only) { |
509 | usb_audio_dbg(cval->mixer->chip, | 513 | usb_audio_dbg(cval->head.mixer->chip, |
510 | "%s(): channel %d of control %d is read_only\n", | 514 | "%s(): channel %d of control %d is read_only\n", |
511 | __func__, channel, cval->control); | 515 | __func__, channel, cval->control); |
512 | return 0; | 516 | return 0; |
@@ -565,10 +569,10 @@ static int check_matrix_bitmap(unsigned char *bmap, | |||
565 | * if failed, give up and free the control instance. | 569 | * if failed, give up and free the control instance. |
566 | */ | 570 | */ |
567 | 571 | ||
568 | int snd_usb_mixer_add_control(struct usb_mixer_interface *mixer, | 572 | int snd_usb_mixer_add_control(struct usb_mixer_elem_list *list, |
569 | struct snd_kcontrol *kctl) | 573 | struct snd_kcontrol *kctl) |
570 | { | 574 | { |
571 | struct usb_mixer_elem_info *cval = kctl->private_data; | 575 | struct usb_mixer_interface *mixer = list->mixer; |
572 | int err; | 576 | int err; |
573 | 577 | ||
574 | while (snd_ctl_find_id(mixer->chip->card, &kctl->id)) | 578 | while (snd_ctl_find_id(mixer->chip->card, &kctl->id)) |
@@ -578,9 +582,9 @@ int snd_usb_mixer_add_control(struct usb_mixer_interface *mixer, | |||
578 | err); | 582 | err); |
579 | return err; | 583 | return err; |
580 | } | 584 | } |
581 | cval->elem_id = &kctl->id; | 585 | list->kctl = kctl; |
582 | cval->next_id_elem = mixer->id_elems[cval->id]; | 586 | list->next_id_elem = mixer->id_elems[list->id]; |
583 | mixer->id_elems[cval->id] = cval; | 587 | mixer->id_elems[list->id] = list; |
584 | return 0; | 588 | return 0; |
585 | } | 589 | } |
586 | 590 | ||
@@ -829,7 +833,7 @@ void snd_usb_mixer_elem_free(struct snd_kcontrol *kctl) | |||
829 | static void volume_control_quirks(struct usb_mixer_elem_info *cval, | 833 | static void volume_control_quirks(struct usb_mixer_elem_info *cval, |
830 | struct snd_kcontrol *kctl) | 834 | struct snd_kcontrol *kctl) |
831 | { | 835 | { |
832 | struct snd_usb_audio *chip = cval->mixer->chip; | 836 | struct snd_usb_audio *chip = cval->head.mixer->chip; |
833 | switch (chip->usb_id) { | 837 | switch (chip->usb_id) { |
834 | case USB_ID(0x0763, 0x2030): /* M-Audio Fast Track C400 */ | 838 | case USB_ID(0x0763, 0x2030): /* M-Audio Fast Track C400 */ |
835 | case USB_ID(0x0763, 0x2031): /* M-Audio Fast Track C600 */ | 839 | case USB_ID(0x0763, 0x2031): /* M-Audio Fast Track C600 */ |
@@ -954,10 +958,10 @@ static int get_min_max_with_quirks(struct usb_mixer_elem_info *cval, | |||
954 | } | 958 | } |
955 | if (get_ctl_value(cval, UAC_GET_MAX, (cval->control << 8) | minchn, &cval->max) < 0 || | 959 | if (get_ctl_value(cval, UAC_GET_MAX, (cval->control << 8) | minchn, &cval->max) < 0 || |
956 | get_ctl_value(cval, UAC_GET_MIN, (cval->control << 8) | minchn, &cval->min) < 0) { | 960 | get_ctl_value(cval, UAC_GET_MIN, (cval->control << 8) | minchn, &cval->min) < 0) { |
957 | usb_audio_err(cval->mixer->chip, | 961 | usb_audio_err(cval->head.mixer->chip, |
958 | "%d:%d: cannot get min/max values for control %d (id %d)\n", | 962 | "%d:%d: cannot get min/max values for control %d (id %d)\n", |
959 | cval->id, snd_usb_ctrl_intf(cval->mixer->chip), | 963 | cval->head.id, snd_usb_ctrl_intf(cval->head.mixer->chip), |
960 | cval->control, cval->id); | 964 | cval->control, cval->head.id); |
961 | return -EINVAL; | 965 | return -EINVAL; |
962 | } | 966 | } |
963 | if (get_ctl_value(cval, UAC_GET_RES, | 967 | if (get_ctl_value(cval, UAC_GET_RES, |
@@ -1061,7 +1065,7 @@ static int mixer_ctl_feature_info(struct snd_kcontrol *kcontrol, | |||
1061 | kcontrol->vd[0].access &= | 1065 | kcontrol->vd[0].access &= |
1062 | ~(SNDRV_CTL_ELEM_ACCESS_TLV_READ | | 1066 | ~(SNDRV_CTL_ELEM_ACCESS_TLV_READ | |
1063 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK); | 1067 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK); |
1064 | snd_ctl_notify(cval->mixer->chip->card, | 1068 | snd_ctl_notify(cval->head.mixer->chip->card, |
1065 | SNDRV_CTL_EVENT_MASK_INFO, | 1069 | SNDRV_CTL_EVENT_MASK_INFO, |
1066 | &kcontrol->id); | 1070 | &kcontrol->id); |
1067 | } | 1071 | } |
@@ -1088,7 +1092,7 @@ static int mixer_ctl_feature_get(struct snd_kcontrol *kcontrol, | |||
1088 | continue; | 1092 | continue; |
1089 | err = snd_usb_get_cur_mix_value(cval, c + 1, cnt, &val); | 1093 | err = snd_usb_get_cur_mix_value(cval, c + 1, cnt, &val); |
1090 | if (err < 0) | 1094 | if (err < 0) |
1091 | return cval->mixer->ignore_ctl_error ? 0 : err; | 1095 | return filter_error(cval, err); |
1092 | val = get_relative_value(cval, val); | 1096 | val = get_relative_value(cval, val); |
1093 | ucontrol->value.integer.value[cnt] = val; | 1097 | ucontrol->value.integer.value[cnt] = val; |
1094 | cnt++; | 1098 | cnt++; |
@@ -1098,7 +1102,7 @@ static int mixer_ctl_feature_get(struct snd_kcontrol *kcontrol, | |||
1098 | /* master channel */ | 1102 | /* master channel */ |
1099 | err = snd_usb_get_cur_mix_value(cval, 0, 0, &val); | 1103 | err = snd_usb_get_cur_mix_value(cval, 0, 0, &val); |
1100 | if (err < 0) | 1104 | if (err < 0) |
1101 | return cval->mixer->ignore_ctl_error ? 0 : err; | 1105 | return filter_error(cval, err); |
1102 | val = get_relative_value(cval, val); | 1106 | val = get_relative_value(cval, val); |
1103 | ucontrol->value.integer.value[0] = val; | 1107 | ucontrol->value.integer.value[0] = val; |
1104 | } | 1108 | } |
@@ -1120,7 +1124,7 @@ static int mixer_ctl_feature_put(struct snd_kcontrol *kcontrol, | |||
1120 | continue; | 1124 | continue; |
1121 | err = snd_usb_get_cur_mix_value(cval, c + 1, cnt, &oval); | 1125 | err = snd_usb_get_cur_mix_value(cval, c + 1, cnt, &oval); |
1122 | if (err < 0) | 1126 | if (err < 0) |
1123 | return cval->mixer->ignore_ctl_error ? 0 : err; | 1127 | return filter_error(cval, err); |
1124 | val = ucontrol->value.integer.value[cnt]; | 1128 | val = ucontrol->value.integer.value[cnt]; |
1125 | val = get_abs_value(cval, val); | 1129 | val = get_abs_value(cval, val); |
1126 | if (oval != val) { | 1130 | if (oval != val) { |
@@ -1133,7 +1137,7 @@ static int mixer_ctl_feature_put(struct snd_kcontrol *kcontrol, | |||
1133 | /* master channel */ | 1137 | /* master channel */ |
1134 | err = snd_usb_get_cur_mix_value(cval, 0, 0, &oval); | 1138 | err = snd_usb_get_cur_mix_value(cval, 0, 0, &oval); |
1135 | if (err < 0) | 1139 | if (err < 0) |
1136 | return cval->mixer->ignore_ctl_error ? 0 : err; | 1140 | return filter_error(cval, err); |
1137 | val = ucontrol->value.integer.value[0]; | 1141 | val = ucontrol->value.integer.value[0]; |
1138 | val = get_abs_value(cval, val); | 1142 | val = get_abs_value(cval, val); |
1139 | if (val != oval) { | 1143 | if (val != oval) { |
@@ -1231,8 +1235,7 @@ static void build_feature_ctl(struct mixer_build *state, void *raw_desc, | |||
1231 | cval = kzalloc(sizeof(*cval), GFP_KERNEL); | 1235 | cval = kzalloc(sizeof(*cval), GFP_KERNEL); |
1232 | if (!cval) | 1236 | if (!cval) |
1233 | return; | 1237 | return; |
1234 | cval->mixer = state->mixer; | 1238 | snd_usb_mixer_elem_init_std(&cval->head, state->mixer, unitid); |
1235 | cval->id = unitid; | ||
1236 | cval->control = control; | 1239 | cval->control = control; |
1237 | cval->cmask = ctl_mask; | 1240 | cval->cmask = ctl_mask; |
1238 | cval->val_type = audio_feature_info[control-1].type; | 1241 | cval->val_type = audio_feature_info[control-1].type; |
@@ -1343,14 +1346,14 @@ static void build_feature_ctl(struct mixer_build *state, void *raw_desc, | |||
1343 | range); | 1346 | range); |
1344 | usb_audio_warn(state->chip, | 1347 | usb_audio_warn(state->chip, |
1345 | "[%d] FU [%s] ch = %d, val = %d/%d/%d", | 1348 | "[%d] FU [%s] ch = %d, val = %d/%d/%d", |
1346 | cval->id, kctl->id.name, cval->channels, | 1349 | cval->head.id, kctl->id.name, cval->channels, |
1347 | cval->min, cval->max, cval->res); | 1350 | cval->min, cval->max, cval->res); |
1348 | } | 1351 | } |
1349 | 1352 | ||
1350 | usb_audio_dbg(state->chip, "[%d] FU [%s] ch = %d, val = %d/%d/%d\n", | 1353 | usb_audio_dbg(state->chip, "[%d] FU [%s] ch = %d, val = %d/%d/%d\n", |
1351 | cval->id, kctl->id.name, cval->channels, | 1354 | cval->head.id, kctl->id.name, cval->channels, |
1352 | cval->min, cval->max, cval->res); | 1355 | cval->min, cval->max, cval->res); |
1353 | snd_usb_mixer_add_control(state->mixer, kctl); | 1356 | snd_usb_mixer_add_control(&cval->head, kctl); |
1354 | } | 1357 | } |
1355 | 1358 | ||
1356 | /* | 1359 | /* |
@@ -1524,8 +1527,7 @@ static void build_mixer_unit_ctl(struct mixer_build *state, | |||
1524 | if (!cval) | 1527 | if (!cval) |
1525 | return; | 1528 | return; |
1526 | 1529 | ||
1527 | cval->mixer = state->mixer; | 1530 | snd_usb_mixer_elem_init_std(&cval->head, state->mixer, unitid); |
1528 | cval->id = unitid; | ||
1529 | cval->control = in_ch + 1; /* based on 1 */ | 1531 | cval->control = in_ch + 1; /* based on 1 */ |
1530 | cval->val_type = USB_MIXER_S16; | 1532 | cval->val_type = USB_MIXER_S16; |
1531 | for (i = 0; i < num_outs; i++) { | 1533 | for (i = 0; i < num_outs; i++) { |
@@ -1557,8 +1559,8 @@ static void build_mixer_unit_ctl(struct mixer_build *state, | |||
1557 | append_ctl_name(kctl, " Volume"); | 1559 | append_ctl_name(kctl, " Volume"); |
1558 | 1560 | ||
1559 | usb_audio_dbg(state->chip, "[%d] MU [%s] ch = %d, val = %d/%d\n", | 1561 | usb_audio_dbg(state->chip, "[%d] MU [%s] ch = %d, val = %d/%d\n", |
1560 | cval->id, kctl->id.name, cval->channels, cval->min, cval->max); | 1562 | cval->head.id, kctl->id.name, cval->channels, cval->min, cval->max); |
1561 | snd_usb_mixer_add_control(state->mixer, kctl); | 1563 | snd_usb_mixer_add_control(&cval->head, kctl); |
1562 | } | 1564 | } |
1563 | 1565 | ||
1564 | /* | 1566 | /* |
@@ -1628,12 +1630,10 @@ static int mixer_ctl_procunit_get(struct snd_kcontrol *kcontrol, | |||
1628 | int err, val; | 1630 | int err, val; |
1629 | 1631 | ||
1630 | err = get_cur_ctl_value(cval, cval->control << 8, &val); | 1632 | err = get_cur_ctl_value(cval, cval->control << 8, &val); |
1631 | if (err < 0 && cval->mixer->ignore_ctl_error) { | 1633 | if (err < 0) { |
1632 | ucontrol->value.integer.value[0] = cval->min; | 1634 | ucontrol->value.integer.value[0] = cval->min; |
1633 | return 0; | 1635 | return filter_error(cval, err); |
1634 | } | 1636 | } |
1635 | if (err < 0) | ||
1636 | return err; | ||
1637 | val = get_relative_value(cval, val); | 1637 | val = get_relative_value(cval, val); |
1638 | ucontrol->value.integer.value[0] = val; | 1638 | ucontrol->value.integer.value[0] = val; |
1639 | return 0; | 1639 | return 0; |
@@ -1647,11 +1647,8 @@ static int mixer_ctl_procunit_put(struct snd_kcontrol *kcontrol, | |||
1647 | int val, oval, err; | 1647 | int val, oval, err; |
1648 | 1648 | ||
1649 | err = get_cur_ctl_value(cval, cval->control << 8, &oval); | 1649 | err = get_cur_ctl_value(cval, cval->control << 8, &oval); |
1650 | if (err < 0) { | 1650 | if (err < 0) |
1651 | if (cval->mixer->ignore_ctl_error) | 1651 | return filter_error(cval, err); |
1652 | return 0; | ||
1653 | return err; | ||
1654 | } | ||
1655 | val = ucontrol->value.integer.value[0]; | 1652 | val = ucontrol->value.integer.value[0]; |
1656 | val = get_abs_value(cval, val); | 1653 | val = get_abs_value(cval, val); |
1657 | if (val != oval) { | 1654 | if (val != oval) { |
@@ -1813,8 +1810,7 @@ static int build_audio_procunit(struct mixer_build *state, int unitid, | |||
1813 | cval = kzalloc(sizeof(*cval), GFP_KERNEL); | 1810 | cval = kzalloc(sizeof(*cval), GFP_KERNEL); |
1814 | if (!cval) | 1811 | if (!cval) |
1815 | return -ENOMEM; | 1812 | return -ENOMEM; |
1816 | cval->mixer = state->mixer; | 1813 | snd_usb_mixer_elem_init_std(&cval->head, state->mixer, unitid); |
1817 | cval->id = unitid; | ||
1818 | cval->control = valinfo->control; | 1814 | cval->control = valinfo->control; |
1819 | cval->val_type = valinfo->val_type; | 1815 | cval->val_type = valinfo->val_type; |
1820 | cval->channels = 1; | 1816 | cval->channels = 1; |
@@ -1867,10 +1863,10 @@ static int build_audio_procunit(struct mixer_build *state, int unitid, | |||
1867 | 1863 | ||
1868 | usb_audio_dbg(state->chip, | 1864 | usb_audio_dbg(state->chip, |
1869 | "[%d] PU [%s] ch = %d, val = %d/%d\n", | 1865 | "[%d] PU [%s] ch = %d, val = %d/%d\n", |
1870 | cval->id, kctl->id.name, cval->channels, | 1866 | cval->head.id, kctl->id.name, cval->channels, |
1871 | cval->min, cval->max); | 1867 | cval->min, cval->max); |
1872 | 1868 | ||
1873 | err = snd_usb_mixer_add_control(state->mixer, kctl); | 1869 | err = snd_usb_mixer_add_control(&cval->head, kctl); |
1874 | if (err < 0) | 1870 | if (err < 0) |
1875 | return err; | 1871 | return err; |
1876 | } | 1872 | } |
@@ -1923,11 +1919,8 @@ static int mixer_ctl_selector_get(struct snd_kcontrol *kcontrol, | |||
1923 | 1919 | ||
1924 | err = get_cur_ctl_value(cval, cval->control << 8, &val); | 1920 | err = get_cur_ctl_value(cval, cval->control << 8, &val); |
1925 | if (err < 0) { | 1921 | if (err < 0) { |
1926 | if (cval->mixer->ignore_ctl_error) { | 1922 | ucontrol->value.enumerated.item[0] = 0; |
1927 | ucontrol->value.enumerated.item[0] = 0; | 1923 | return filter_error(cval, err); |
1928 | return 0; | ||
1929 | } | ||
1930 | return err; | ||
1931 | } | 1924 | } |
1932 | val = get_relative_value(cval, val); | 1925 | val = get_relative_value(cval, val); |
1933 | ucontrol->value.enumerated.item[0] = val; | 1926 | ucontrol->value.enumerated.item[0] = val; |
@@ -1942,11 +1935,8 @@ static int mixer_ctl_selector_put(struct snd_kcontrol *kcontrol, | |||
1942 | int val, oval, err; | 1935 | int val, oval, err; |
1943 | 1936 | ||
1944 | err = get_cur_ctl_value(cval, cval->control << 8, &oval); | 1937 | err = get_cur_ctl_value(cval, cval->control << 8, &oval); |
1945 | if (err < 0) { | 1938 | if (err < 0) |
1946 | if (cval->mixer->ignore_ctl_error) | 1939 | return filter_error(cval, err); |
1947 | return 0; | ||
1948 | return err; | ||
1949 | } | ||
1950 | val = ucontrol->value.enumerated.item[0]; | 1940 | val = ucontrol->value.enumerated.item[0]; |
1951 | val = get_abs_value(cval, val); | 1941 | val = get_abs_value(cval, val); |
1952 | if (val != oval) { | 1942 | if (val != oval) { |
@@ -2023,8 +2013,7 @@ static int parse_audio_selector_unit(struct mixer_build *state, int unitid, | |||
2023 | cval = kzalloc(sizeof(*cval), GFP_KERNEL); | 2013 | cval = kzalloc(sizeof(*cval), GFP_KERNEL); |
2024 | if (!cval) | 2014 | if (!cval) |
2025 | return -ENOMEM; | 2015 | return -ENOMEM; |
2026 | cval->mixer = state->mixer; | 2016 | snd_usb_mixer_elem_init_std(&cval->head, state->mixer, unitid); |
2027 | cval->id = unitid; | ||
2028 | cval->val_type = USB_MIXER_U8; | 2017 | cval->val_type = USB_MIXER_U8; |
2029 | cval->channels = 1; | 2018 | cval->channels = 1; |
2030 | cval->min = 1; | 2019 | cval->min = 1; |
@@ -2032,10 +2021,11 @@ static int parse_audio_selector_unit(struct mixer_build *state, int unitid, | |||
2032 | cval->res = 1; | 2021 | cval->res = 1; |
2033 | cval->initialized = 1; | 2022 | cval->initialized = 1; |
2034 | 2023 | ||
2035 | if (desc->bDescriptorSubtype == UAC2_CLOCK_SELECTOR) | 2024 | if (state->mixer->protocol == UAC_VERSION_1) |
2036 | cval->control = UAC2_CX_CLOCK_SELECTOR; | ||
2037 | else | ||
2038 | cval->control = 0; | 2025 | cval->control = 0; |
2026 | else /* UAC_VERSION_2 */ | ||
2027 | cval->control = (desc->bDescriptorSubtype == UAC2_CLOCK_SELECTOR) ? | ||
2028 | UAC2_CX_CLOCK_SELECTOR : UAC2_SU_SELECTOR; | ||
2039 | 2029 | ||
2040 | namelist = kmalloc(sizeof(char *) * desc->bNrInPins, GFP_KERNEL); | 2030 | namelist = kmalloc(sizeof(char *) * desc->bNrInPins, GFP_KERNEL); |
2041 | if (!namelist) { | 2031 | if (!namelist) { |
@@ -2094,11 +2084,8 @@ static int parse_audio_selector_unit(struct mixer_build *state, int unitid, | |||
2094 | } | 2084 | } |
2095 | 2085 | ||
2096 | usb_audio_dbg(state->chip, "[%d] SU [%s] items = %d\n", | 2086 | usb_audio_dbg(state->chip, "[%d] SU [%s] items = %d\n", |
2097 | cval->id, kctl->id.name, desc->bNrInPins); | 2087 | cval->head.id, kctl->id.name, desc->bNrInPins); |
2098 | if ((err = snd_usb_mixer_add_control(state->mixer, kctl)) < 0) | 2088 | return snd_usb_mixer_add_control(&cval->head, kctl); |
2099 | return err; | ||
2100 | |||
2101 | return 0; | ||
2102 | } | 2089 | } |
2103 | 2090 | ||
2104 | /* | 2091 | /* |
@@ -2243,25 +2230,21 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer) | |||
2243 | 2230 | ||
2244 | void snd_usb_mixer_notify_id(struct usb_mixer_interface *mixer, int unitid) | 2231 | void snd_usb_mixer_notify_id(struct usb_mixer_interface *mixer, int unitid) |
2245 | { | 2232 | { |
2246 | struct usb_mixer_elem_info *info; | 2233 | struct usb_mixer_elem_list *list; |
2247 | 2234 | ||
2248 | for (info = mixer->id_elems[unitid]; info; info = info->next_id_elem) | 2235 | for (list = mixer->id_elems[unitid]; list; list = list->next_id_elem) |
2249 | snd_ctl_notify(mixer->chip->card, SNDRV_CTL_EVENT_MASK_VALUE, | 2236 | snd_ctl_notify(mixer->chip->card, SNDRV_CTL_EVENT_MASK_VALUE, |
2250 | info->elem_id); | 2237 | &list->kctl->id); |
2251 | } | 2238 | } |
2252 | 2239 | ||
2253 | static void snd_usb_mixer_dump_cval(struct snd_info_buffer *buffer, | 2240 | static void snd_usb_mixer_dump_cval(struct snd_info_buffer *buffer, |
2254 | int unitid, | 2241 | struct usb_mixer_elem_list *list) |
2255 | struct usb_mixer_elem_info *cval) | ||
2256 | { | 2242 | { |
2243 | struct usb_mixer_elem_info *cval = (struct usb_mixer_elem_info *)list; | ||
2257 | static char *val_types[] = {"BOOLEAN", "INV_BOOLEAN", | 2244 | static char *val_types[] = {"BOOLEAN", "INV_BOOLEAN", |
2258 | "S8", "U8", "S16", "U16"}; | 2245 | "S8", "U8", "S16", "U16"}; |
2259 | snd_iprintf(buffer, " Unit: %i\n", unitid); | ||
2260 | if (cval->elem_id) | ||
2261 | snd_iprintf(buffer, " Control: name=\"%s\", index=%i\n", | ||
2262 | cval->elem_id->name, cval->elem_id->index); | ||
2263 | snd_iprintf(buffer, " Info: id=%i, control=%i, cmask=0x%x, " | 2246 | snd_iprintf(buffer, " Info: id=%i, control=%i, cmask=0x%x, " |
2264 | "channels=%i, type=\"%s\"\n", cval->id, | 2247 | "channels=%i, type=\"%s\"\n", cval->head.id, |
2265 | cval->control, cval->cmask, cval->channels, | 2248 | cval->control, cval->cmask, cval->channels, |
2266 | val_types[cval->val_type]); | 2249 | val_types[cval->val_type]); |
2267 | snd_iprintf(buffer, " Volume: min=%i, max=%i, dBmin=%i, dBmax=%i\n", | 2250 | snd_iprintf(buffer, " Volume: min=%i, max=%i, dBmin=%i, dBmax=%i\n", |
@@ -2273,7 +2256,7 @@ static void snd_usb_mixer_proc_read(struct snd_info_entry *entry, | |||
2273 | { | 2256 | { |
2274 | struct snd_usb_audio *chip = entry->private_data; | 2257 | struct snd_usb_audio *chip = entry->private_data; |
2275 | struct usb_mixer_interface *mixer; | 2258 | struct usb_mixer_interface *mixer; |
2276 | struct usb_mixer_elem_info *cval; | 2259 | struct usb_mixer_elem_list *list; |
2277 | int unitid; | 2260 | int unitid; |
2278 | 2261 | ||
2279 | list_for_each_entry(mixer, &chip->mixer_list, list) { | 2262 | list_for_each_entry(mixer, &chip->mixer_list, list) { |
@@ -2283,9 +2266,17 @@ static void snd_usb_mixer_proc_read(struct snd_info_entry *entry, | |||
2283 | mixer->ignore_ctl_error); | 2266 | mixer->ignore_ctl_error); |
2284 | snd_iprintf(buffer, "Card: %s\n", chip->card->longname); | 2267 | snd_iprintf(buffer, "Card: %s\n", chip->card->longname); |
2285 | for (unitid = 0; unitid < MAX_ID_ELEMS; unitid++) { | 2268 | for (unitid = 0; unitid < MAX_ID_ELEMS; unitid++) { |
2286 | for (cval = mixer->id_elems[unitid]; cval; | 2269 | for (list = mixer->id_elems[unitid]; list; |
2287 | cval = cval->next_id_elem) | 2270 | list = list->next_id_elem) { |
2288 | snd_usb_mixer_dump_cval(buffer, unitid, cval); | 2271 | snd_iprintf(buffer, " Unit: %i\n", list->id); |
2272 | if (list->kctl) | ||
2273 | snd_iprintf(buffer, | ||
2274 | " Control: name=\"%s\", index=%i\n", | ||
2275 | list->kctl->id.name, | ||
2276 | list->kctl->id.index); | ||
2277 | if (list->dump) | ||
2278 | list->dump(buffer, list); | ||
2279 | } | ||
2289 | } | 2280 | } |
2290 | } | 2281 | } |
2291 | } | 2282 | } |
@@ -2293,7 +2284,7 @@ static void snd_usb_mixer_proc_read(struct snd_info_entry *entry, | |||
2293 | static void snd_usb_mixer_interrupt_v2(struct usb_mixer_interface *mixer, | 2284 | static void snd_usb_mixer_interrupt_v2(struct usb_mixer_interface *mixer, |
2294 | int attribute, int value, int index) | 2285 | int attribute, int value, int index) |
2295 | { | 2286 | { |
2296 | struct usb_mixer_elem_info *info; | 2287 | struct usb_mixer_elem_list *list; |
2297 | __u8 unitid = (index >> 8) & 0xff; | 2288 | __u8 unitid = (index >> 8) & 0xff; |
2298 | __u8 control = (value >> 8) & 0xff; | 2289 | __u8 control = (value >> 8) & 0xff; |
2299 | __u8 channel = value & 0xff; | 2290 | __u8 channel = value & 0xff; |
@@ -2305,7 +2296,13 @@ static void snd_usb_mixer_interrupt_v2(struct usb_mixer_interface *mixer, | |||
2305 | return; | 2296 | return; |
2306 | } | 2297 | } |
2307 | 2298 | ||
2308 | for (info = mixer->id_elems[unitid]; info; info = info->next_id_elem) { | 2299 | for (list = mixer->id_elems[unitid]; list; list = list->next_id_elem) { |
2300 | struct usb_mixer_elem_info *info; | ||
2301 | |||
2302 | if (!list->kctl) | ||
2303 | continue; | ||
2304 | |||
2305 | info = (struct usb_mixer_elem_info *)list; | ||
2309 | if (info->control != control) | 2306 | if (info->control != control) |
2310 | continue; | 2307 | continue; |
2311 | 2308 | ||
@@ -2318,7 +2315,7 @@ static void snd_usb_mixer_interrupt_v2(struct usb_mixer_interface *mixer, | |||
2318 | info->cached = 0; | 2315 | info->cached = 0; |
2319 | 2316 | ||
2320 | snd_ctl_notify(mixer->chip->card, SNDRV_CTL_EVENT_MASK_VALUE, | 2317 | snd_ctl_notify(mixer->chip->card, SNDRV_CTL_EVENT_MASK_VALUE, |
2321 | info->elem_id); | 2318 | &info->head.kctl->id); |
2322 | break; | 2319 | break; |
2323 | 2320 | ||
2324 | case UAC2_CS_RANGE: | 2321 | case UAC2_CS_RANGE: |
@@ -2516,8 +2513,9 @@ int snd_usb_mixer_suspend(struct usb_mixer_interface *mixer) | |||
2516 | return 0; | 2513 | return 0; |
2517 | } | 2514 | } |
2518 | 2515 | ||
2519 | static int restore_mixer_value(struct usb_mixer_elem_info *cval) | 2516 | static int restore_mixer_value(struct usb_mixer_elem_list *list) |
2520 | { | 2517 | { |
2518 | struct usb_mixer_elem_info *cval = (struct usb_mixer_elem_info *)list; | ||
2521 | int c, err, idx; | 2519 | int c, err, idx; |
2522 | 2520 | ||
2523 | if (cval->cmask) { | 2521 | if (cval->cmask) { |
@@ -2547,19 +2545,19 @@ static int restore_mixer_value(struct usb_mixer_elem_info *cval) | |||
2547 | 2545 | ||
2548 | int snd_usb_mixer_resume(struct usb_mixer_interface *mixer, bool reset_resume) | 2546 | int snd_usb_mixer_resume(struct usb_mixer_interface *mixer, bool reset_resume) |
2549 | { | 2547 | { |
2550 | struct usb_mixer_elem_info *cval; | 2548 | struct usb_mixer_elem_list *list; |
2551 | int id, err; | 2549 | int id, err; |
2552 | 2550 | ||
2553 | /* FIXME: any mixer quirks? */ | ||
2554 | |||
2555 | if (reset_resume) { | 2551 | if (reset_resume) { |
2556 | /* restore cached mixer values */ | 2552 | /* restore cached mixer values */ |
2557 | for (id = 0; id < MAX_ID_ELEMS; id++) { | 2553 | for (id = 0; id < MAX_ID_ELEMS; id++) { |
2558 | for (cval = mixer->id_elems[id]; cval; | 2554 | for (list = mixer->id_elems[id]; list; |
2559 | cval = cval->next_id_elem) { | 2555 | list = list->next_id_elem) { |
2560 | err = restore_mixer_value(cval); | 2556 | if (list->resume) { |
2561 | if (err < 0) | 2557 | err = list->resume(list); |
2562 | return err; | 2558 | if (err < 0) |
2559 | return err; | ||
2560 | } | ||
2563 | } | 2561 | } |
2564 | } | 2562 | } |
2565 | } | 2563 | } |
@@ -2567,3 +2565,15 @@ int snd_usb_mixer_resume(struct usb_mixer_interface *mixer, bool reset_resume) | |||
2567 | return snd_usb_mixer_activate(mixer); | 2565 | return snd_usb_mixer_activate(mixer); |
2568 | } | 2566 | } |
2569 | #endif | 2567 | #endif |
2568 | |||
2569 | void snd_usb_mixer_elem_init_std(struct usb_mixer_elem_list *list, | ||
2570 | struct usb_mixer_interface *mixer, | ||
2571 | int unitid) | ||
2572 | { | ||
2573 | list->mixer = mixer; | ||
2574 | list->id = unitid; | ||
2575 | list->dump = snd_usb_mixer_dump_cval; | ||
2576 | #ifdef CONFIG_PM | ||
2577 | list->resume = restore_mixer_value; | ||
2578 | #endif | ||
2579 | } | ||
diff --git a/sound/usb/mixer.h b/sound/usb/mixer.h index 2478a844a322..d3268f0ee2b3 100644 --- a/sound/usb/mixer.h +++ b/sound/usb/mixer.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef __USBMIXER_H | 1 | #ifndef __USBMIXER_H |
2 | #define __USBMIXER_H | 2 | #define __USBMIXER_H |
3 | 3 | ||
4 | #include <sound/info.h> | ||
5 | |||
4 | struct usb_mixer_interface { | 6 | struct usb_mixer_interface { |
5 | struct snd_usb_audio *chip; | 7 | struct snd_usb_audio *chip; |
6 | struct usb_host_interface *hostif; | 8 | struct usb_host_interface *hostif; |
@@ -8,7 +10,7 @@ struct usb_mixer_interface { | |||
8 | unsigned int ignore_ctl_error; | 10 | unsigned int ignore_ctl_error; |
9 | struct urb *urb; | 11 | struct urb *urb; |
10 | /* array[MAX_ID_ELEMS], indexed by unit id */ | 12 | /* array[MAX_ID_ELEMS], indexed by unit id */ |
11 | struct usb_mixer_elem_info **id_elems; | 13 | struct usb_mixer_elem_list **id_elems; |
12 | 14 | ||
13 | /* the usb audio specification version this interface complies to */ | 15 | /* the usb audio specification version this interface complies to */ |
14 | int protocol; | 16 | int protocol; |
@@ -20,9 +22,6 @@ struct usb_mixer_interface { | |||
20 | struct urb *rc_urb; | 22 | struct urb *rc_urb; |
21 | struct usb_ctrlrequest *rc_setup_packet; | 23 | struct usb_ctrlrequest *rc_setup_packet; |
22 | u8 rc_buffer[6]; | 24 | u8 rc_buffer[6]; |
23 | |||
24 | u8 audigy2nx_leds[3]; | ||
25 | u8 xonar_u1_status; | ||
26 | }; | 25 | }; |
27 | 26 | ||
28 | #define MAX_CHANNELS 16 /* max logical channels */ | 27 | #define MAX_CHANNELS 16 /* max logical channels */ |
@@ -36,11 +35,21 @@ enum { | |||
36 | USB_MIXER_U16, | 35 | USB_MIXER_U16, |
37 | }; | 36 | }; |
38 | 37 | ||
39 | struct usb_mixer_elem_info { | 38 | typedef void (*usb_mixer_elem_dump_func_t)(struct snd_info_buffer *buffer, |
39 | struct usb_mixer_elem_list *list); | ||
40 | typedef int (*usb_mixer_elem_resume_func_t)(struct usb_mixer_elem_list *elem); | ||
41 | |||
42 | struct usb_mixer_elem_list { | ||
40 | struct usb_mixer_interface *mixer; | 43 | struct usb_mixer_interface *mixer; |
41 | struct usb_mixer_elem_info *next_id_elem; /* list of controls with same id */ | 44 | struct usb_mixer_elem_list *next_id_elem; /* list of controls with same id */ |
42 | struct snd_ctl_elem_id *elem_id; | 45 | struct snd_kcontrol *kctl; |
43 | unsigned int id; | 46 | unsigned int id; |
47 | usb_mixer_elem_dump_func_t dump; | ||
48 | usb_mixer_elem_resume_func_t resume; | ||
49 | }; | ||
50 | |||
51 | struct usb_mixer_elem_info { | ||
52 | struct usb_mixer_elem_list head; | ||
44 | unsigned int control; /* CS or ICN (high byte) */ | 53 | unsigned int control; /* CS or ICN (high byte) */ |
45 | unsigned int cmask; /* channel mask bitmap: 0 = master */ | 54 | unsigned int cmask; /* channel mask bitmap: 0 = master */ |
46 | unsigned int idx_off; /* Control index offset */ | 55 | unsigned int idx_off; /* Control index offset */ |
@@ -65,9 +74,13 @@ void snd_usb_mixer_notify_id(struct usb_mixer_interface *mixer, int unitid); | |||
65 | int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval, | 74 | int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval, |
66 | int request, int validx, int value_set); | 75 | int request, int validx, int value_set); |
67 | 76 | ||
68 | int snd_usb_mixer_add_control(struct usb_mixer_interface *mixer, | 77 | int snd_usb_mixer_add_control(struct usb_mixer_elem_list *list, |
69 | struct snd_kcontrol *kctl); | 78 | struct snd_kcontrol *kctl); |
70 | 79 | ||
80 | void snd_usb_mixer_elem_init_std(struct usb_mixer_elem_list *list, | ||
81 | struct usb_mixer_interface *mixer, | ||
82 | int unitid); | ||
83 | |||
71 | int snd_usb_mixer_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, | 84 | int snd_usb_mixer_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag, |
72 | unsigned int size, unsigned int __user *_tlv); | 85 | unsigned int size, unsigned int __user *_tlv); |
73 | 86 | ||
diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c index 7b9331a17026..dc9df007d3e3 100644 --- a/sound/usb/mixer_quirks.c +++ b/sound/usb/mixer_quirks.c | |||
@@ -69,7 +69,6 @@ static int snd_create_std_mono_ctl_offset(struct usb_mixer_interface *mixer, | |||
69 | const char *name, | 69 | const char *name, |
70 | snd_kcontrol_tlv_rw_t *tlv_callback) | 70 | snd_kcontrol_tlv_rw_t *tlv_callback) |
71 | { | 71 | { |
72 | int err; | ||
73 | struct usb_mixer_elem_info *cval; | 72 | struct usb_mixer_elem_info *cval; |
74 | struct snd_kcontrol *kctl; | 73 | struct snd_kcontrol *kctl; |
75 | 74 | ||
@@ -77,8 +76,7 @@ static int snd_create_std_mono_ctl_offset(struct usb_mixer_interface *mixer, | |||
77 | if (!cval) | 76 | if (!cval) |
78 | return -ENOMEM; | 77 | return -ENOMEM; |
79 | 78 | ||
80 | cval->id = unitid; | 79 | snd_usb_mixer_elem_init_std(&cval->head, mixer, unitid); |
81 | cval->mixer = mixer; | ||
82 | cval->val_type = val_type; | 80 | cval->val_type = val_type; |
83 | cval->channels = 1; | 81 | cval->channels = 1; |
84 | cval->control = control; | 82 | cval->control = control; |
@@ -112,11 +110,7 @@ static int snd_create_std_mono_ctl_offset(struct usb_mixer_interface *mixer, | |||
112 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK; | 110 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK; |
113 | } | 111 | } |
114 | /* Add control to mixer */ | 112 | /* Add control to mixer */ |
115 | err = snd_usb_mixer_add_control(mixer, kctl); | 113 | return snd_usb_mixer_add_control(&cval->head, kctl); |
116 | if (err < 0) | ||
117 | return err; | ||
118 | |||
119 | return 0; | ||
120 | } | 114 | } |
121 | 115 | ||
122 | static int snd_create_std_mono_ctl(struct usb_mixer_interface *mixer, | 116 | static int snd_create_std_mono_ctl(struct usb_mixer_interface *mixer, |
@@ -150,6 +144,32 @@ static int snd_create_std_mono_table(struct usb_mixer_interface *mixer, | |||
150 | return 0; | 144 | return 0; |
151 | } | 145 | } |
152 | 146 | ||
147 | static int add_single_ctl_with_resume(struct usb_mixer_interface *mixer, | ||
148 | int id, | ||
149 | usb_mixer_elem_resume_func_t resume, | ||
150 | const struct snd_kcontrol_new *knew, | ||
151 | struct usb_mixer_elem_list **listp) | ||
152 | { | ||
153 | struct usb_mixer_elem_list *list; | ||
154 | struct snd_kcontrol *kctl; | ||
155 | |||
156 | list = kzalloc(sizeof(*list), GFP_KERNEL); | ||
157 | if (!list) | ||
158 | return -ENOMEM; | ||
159 | if (listp) | ||
160 | *listp = list; | ||
161 | list->mixer = mixer; | ||
162 | list->id = id; | ||
163 | list->resume = resume; | ||
164 | kctl = snd_ctl_new1(knew, list); | ||
165 | if (!kctl) { | ||
166 | kfree(list); | ||
167 | return -ENOMEM; | ||
168 | } | ||
169 | kctl->private_free = snd_usb_mixer_elem_free; | ||
170 | return snd_usb_mixer_add_control(list, kctl); | ||
171 | } | ||
172 | |||
153 | /* | 173 | /* |
154 | * Sound Blaster remote control configuration | 174 | * Sound Blaster remote control configuration |
155 | * | 175 | * |
@@ -277,84 +297,90 @@ static int snd_usb_soundblaster_remote_init(struct usb_mixer_interface *mixer) | |||
277 | 297 | ||
278 | static int snd_audigy2nx_led_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 298 | static int snd_audigy2nx_led_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
279 | { | 299 | { |
280 | struct usb_mixer_interface *mixer = snd_kcontrol_chip(kcontrol); | 300 | ucontrol->value.integer.value[0] = kcontrol->private_value >> 8; |
281 | int index = kcontrol->private_value; | ||
282 | |||
283 | ucontrol->value.integer.value[0] = mixer->audigy2nx_leds[index]; | ||
284 | return 0; | 301 | return 0; |
285 | } | 302 | } |
286 | 303 | ||
287 | static int snd_audigy2nx_led_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 304 | static int snd_audigy2nx_led_update(struct usb_mixer_interface *mixer, |
305 | int value, int index) | ||
288 | { | 306 | { |
289 | struct usb_mixer_interface *mixer = snd_kcontrol_chip(kcontrol); | 307 | struct snd_usb_audio *chip = mixer->chip; |
290 | int index = kcontrol->private_value; | 308 | int err; |
291 | int value = ucontrol->value.integer.value[0]; | ||
292 | int err, changed; | ||
293 | 309 | ||
294 | if (value > 1) | 310 | down_read(&chip->shutdown_rwsem); |
295 | return -EINVAL; | 311 | if (chip->shutdown) { |
296 | changed = value != mixer->audigy2nx_leds[index]; | ||
297 | down_read(&mixer->chip->shutdown_rwsem); | ||
298 | if (mixer->chip->shutdown) { | ||
299 | err = -ENODEV; | 312 | err = -ENODEV; |
300 | goto out; | 313 | goto out; |
301 | } | 314 | } |
302 | if (mixer->chip->usb_id == USB_ID(0x041e, 0x3042)) | 315 | if (chip->usb_id == USB_ID(0x041e, 0x3042)) |
303 | err = snd_usb_ctl_msg(mixer->chip->dev, | 316 | err = snd_usb_ctl_msg(chip->dev, |
304 | usb_sndctrlpipe(mixer->chip->dev, 0), 0x24, | 317 | usb_sndctrlpipe(chip->dev, 0), 0x24, |
305 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER, | 318 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER, |
306 | !value, 0, NULL, 0); | 319 | !value, 0, NULL, 0); |
307 | /* USB X-Fi S51 Pro */ | 320 | /* USB X-Fi S51 Pro */ |
308 | if (mixer->chip->usb_id == USB_ID(0x041e, 0x30df)) | 321 | if (chip->usb_id == USB_ID(0x041e, 0x30df)) |
309 | err = snd_usb_ctl_msg(mixer->chip->dev, | 322 | err = snd_usb_ctl_msg(chip->dev, |
310 | usb_sndctrlpipe(mixer->chip->dev, 0), 0x24, | 323 | usb_sndctrlpipe(chip->dev, 0), 0x24, |
311 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER, | 324 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER, |
312 | !value, 0, NULL, 0); | 325 | !value, 0, NULL, 0); |
313 | else | 326 | else |
314 | err = snd_usb_ctl_msg(mixer->chip->dev, | 327 | err = snd_usb_ctl_msg(chip->dev, |
315 | usb_sndctrlpipe(mixer->chip->dev, 0), 0x24, | 328 | usb_sndctrlpipe(chip->dev, 0), 0x24, |
316 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER, | 329 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER, |
317 | value, index + 2, NULL, 0); | 330 | value, index + 2, NULL, 0); |
318 | out: | 331 | out: |
319 | up_read(&mixer->chip->shutdown_rwsem); | 332 | up_read(&chip->shutdown_rwsem); |
320 | if (err < 0) | 333 | return err; |
321 | return err; | ||
322 | mixer->audigy2nx_leds[index] = value; | ||
323 | return changed; | ||
324 | } | 334 | } |
325 | 335 | ||
326 | static struct snd_kcontrol_new snd_audigy2nx_controls[] = { | 336 | static int snd_audigy2nx_led_put(struct snd_kcontrol *kcontrol, |
327 | { | 337 | struct snd_ctl_elem_value *ucontrol) |
328 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 338 | { |
329 | .name = "CMSS LED Switch", | 339 | struct usb_mixer_elem_list *list = snd_kcontrol_chip(kcontrol); |
330 | .info = snd_audigy2nx_led_info, | 340 | struct usb_mixer_interface *mixer = list->mixer; |
331 | .get = snd_audigy2nx_led_get, | 341 | int index = kcontrol->private_value & 0xff; |
332 | .put = snd_audigy2nx_led_put, | 342 | int value = ucontrol->value.integer.value[0]; |
333 | .private_value = 0, | 343 | int old_value = kcontrol->private_value >> 8; |
334 | }, | 344 | int err; |
335 | { | 345 | |
336 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 346 | if (value > 1) |
337 | .name = "Power LED Switch", | 347 | return -EINVAL; |
338 | .info = snd_audigy2nx_led_info, | 348 | if (value == old_value) |
339 | .get = snd_audigy2nx_led_get, | 349 | return 0; |
340 | .put = snd_audigy2nx_led_put, | 350 | kcontrol->private_value = (value << 8) | index; |
341 | .private_value = 1, | 351 | err = snd_audigy2nx_led_update(mixer, value, index); |
342 | }, | 352 | return err < 0 ? err : 1; |
343 | { | 353 | } |
344 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 354 | |
345 | .name = "Dolby Digital LED Switch", | 355 | static int snd_audigy2nx_led_resume(struct usb_mixer_elem_list *list) |
346 | .info = snd_audigy2nx_led_info, | 356 | { |
347 | .get = snd_audigy2nx_led_get, | 357 | int priv_value = list->kctl->private_value; |
348 | .put = snd_audigy2nx_led_put, | 358 | |
349 | .private_value = 2, | 359 | return snd_audigy2nx_led_update(list->mixer, priv_value >> 8, |
350 | }, | 360 | priv_value & 0xff); |
361 | } | ||
362 | |||
363 | /* name and private_value are set dynamically */ | ||
364 | static struct snd_kcontrol_new snd_audigy2nx_control = { | ||
365 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
366 | .info = snd_audigy2nx_led_info, | ||
367 | .get = snd_audigy2nx_led_get, | ||
368 | .put = snd_audigy2nx_led_put, | ||
369 | }; | ||
370 | |||
371 | static const char * const snd_audigy2nx_led_names[] = { | ||
372 | "CMSS LED Switch", | ||
373 | "Power LED Switch", | ||
374 | "Dolby Digital LED Switch", | ||
351 | }; | 375 | }; |
352 | 376 | ||
353 | static int snd_audigy2nx_controls_create(struct usb_mixer_interface *mixer) | 377 | static int snd_audigy2nx_controls_create(struct usb_mixer_interface *mixer) |
354 | { | 378 | { |
355 | int i, err; | 379 | int i, err; |
356 | 380 | ||
357 | for (i = 0; i < ARRAY_SIZE(snd_audigy2nx_controls); ++i) { | 381 | for (i = 0; i < ARRAY_SIZE(snd_audigy2nx_led_names); ++i) { |
382 | struct snd_kcontrol_new knew; | ||
383 | |||
358 | /* USB X-Fi S51 doesn't have a CMSS LED */ | 384 | /* USB X-Fi S51 doesn't have a CMSS LED */ |
359 | if ((mixer->chip->usb_id == USB_ID(0x041e, 0x3042)) && i == 0) | 385 | if ((mixer->chip->usb_id == USB_ID(0x041e, 0x3042)) && i == 0) |
360 | continue; | 386 | continue; |
@@ -367,12 +393,16 @@ static int snd_audigy2nx_controls_create(struct usb_mixer_interface *mixer) | |||
367 | mixer->chip->usb_id == USB_ID(0x041e, 0x30df) || | 393 | mixer->chip->usb_id == USB_ID(0x041e, 0x30df) || |
368 | mixer->chip->usb_id == USB_ID(0x041e, 0x3048))) | 394 | mixer->chip->usb_id == USB_ID(0x041e, 0x3048))) |
369 | break; | 395 | break; |
370 | err = snd_ctl_add(mixer->chip->card, | 396 | |
371 | snd_ctl_new1(&snd_audigy2nx_controls[i], mixer)); | 397 | knew = snd_audigy2nx_control; |
398 | knew.name = snd_audigy2nx_led_names[i]; | ||
399 | knew.private_value = (1 << 8) | i; /* LED on as default */ | ||
400 | err = add_single_ctl_with_resume(mixer, 0, | ||
401 | snd_audigy2nx_led_resume, | ||
402 | &knew, NULL); | ||
372 | if (err < 0) | 403 | if (err < 0) |
373 | return err; | 404 | return err; |
374 | } | 405 | } |
375 | mixer->audigy2nx_leds[1] = 1; /* Power LED is on by default */ | ||
376 | return 0; | 406 | return 0; |
377 | } | 407 | } |
378 | 408 | ||
@@ -443,100 +473,122 @@ static int snd_emu0204_ch_switch_get(struct snd_kcontrol *kcontrol, | |||
443 | return 0; | 473 | return 0; |
444 | } | 474 | } |
445 | 475 | ||
446 | static int snd_emu0204_ch_switch_put(struct snd_kcontrol *kcontrol, | 476 | static int snd_emu0204_ch_switch_update(struct usb_mixer_interface *mixer, |
447 | struct snd_ctl_elem_value *ucontrol) | 477 | int value) |
448 | { | 478 | { |
449 | struct usb_mixer_interface *mixer = snd_kcontrol_chip(kcontrol); | 479 | struct snd_usb_audio *chip = mixer->chip; |
450 | unsigned int value = ucontrol->value.enumerated.item[0]; | 480 | int err; |
451 | int err, changed; | ||
452 | unsigned char buf[2]; | 481 | unsigned char buf[2]; |
453 | 482 | ||
454 | if (value > 1) | 483 | down_read(&chip->shutdown_rwsem); |
455 | return -EINVAL; | ||
456 | |||
457 | buf[0] = 0x01; | ||
458 | buf[1] = value ? 0x02 : 0x01; | ||
459 | |||
460 | changed = value != kcontrol->private_value; | ||
461 | down_read(&mixer->chip->shutdown_rwsem); | ||
462 | if (mixer->chip->shutdown) { | 484 | if (mixer->chip->shutdown) { |
463 | err = -ENODEV; | 485 | err = -ENODEV; |
464 | goto out; | 486 | goto out; |
465 | } | 487 | } |
466 | err = snd_usb_ctl_msg(mixer->chip->dev, | 488 | |
467 | usb_sndctrlpipe(mixer->chip->dev, 0), UAC_SET_CUR, | 489 | buf[0] = 0x01; |
490 | buf[1] = value ? 0x02 : 0x01; | ||
491 | err = snd_usb_ctl_msg(chip->dev, | ||
492 | usb_sndctrlpipe(chip->dev, 0), UAC_SET_CUR, | ||
468 | USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT, | 493 | USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT, |
469 | 0x0400, 0x0e00, buf, 2); | 494 | 0x0400, 0x0e00, buf, 2); |
470 | out: | 495 | out: |
471 | up_read(&mixer->chip->shutdown_rwsem); | 496 | up_read(&chip->shutdown_rwsem); |
472 | if (err < 0) | 497 | return err; |
473 | return err; | 498 | } |
499 | |||
500 | static int snd_emu0204_ch_switch_put(struct snd_kcontrol *kcontrol, | ||
501 | struct snd_ctl_elem_value *ucontrol) | ||
502 | { | ||
503 | struct usb_mixer_elem_list *list = snd_kcontrol_chip(kcontrol); | ||
504 | struct usb_mixer_interface *mixer = list->mixer; | ||
505 | unsigned int value = ucontrol->value.enumerated.item[0]; | ||
506 | int err; | ||
507 | |||
508 | if (value > 1) | ||
509 | return -EINVAL; | ||
510 | |||
511 | if (value == kcontrol->private_value) | ||
512 | return 0; | ||
513 | |||
474 | kcontrol->private_value = value; | 514 | kcontrol->private_value = value; |
475 | return changed; | 515 | err = snd_emu0204_ch_switch_update(mixer, value); |
516 | return err < 0 ? err : 1; | ||
476 | } | 517 | } |
477 | 518 | ||
519 | static int snd_emu0204_ch_switch_resume(struct usb_mixer_elem_list *list) | ||
520 | { | ||
521 | return snd_emu0204_ch_switch_update(list->mixer, | ||
522 | list->kctl->private_value); | ||
523 | } | ||
478 | 524 | ||
479 | static struct snd_kcontrol_new snd_emu0204_controls[] = { | 525 | static struct snd_kcontrol_new snd_emu0204_control = { |
480 | { | 526 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
481 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 527 | .name = "Front Jack Channels", |
482 | .name = "Front Jack Channels", | 528 | .info = snd_emu0204_ch_switch_info, |
483 | .info = snd_emu0204_ch_switch_info, | 529 | .get = snd_emu0204_ch_switch_get, |
484 | .get = snd_emu0204_ch_switch_get, | 530 | .put = snd_emu0204_ch_switch_put, |
485 | .put = snd_emu0204_ch_switch_put, | 531 | .private_value = 0, |
486 | .private_value = 0, | ||
487 | }, | ||
488 | }; | 532 | }; |
489 | 533 | ||
490 | static int snd_emu0204_controls_create(struct usb_mixer_interface *mixer) | 534 | static int snd_emu0204_controls_create(struct usb_mixer_interface *mixer) |
491 | { | 535 | { |
492 | int i, err; | 536 | return add_single_ctl_with_resume(mixer, 0, |
493 | 537 | snd_emu0204_ch_switch_resume, | |
494 | for (i = 0; i < ARRAY_SIZE(snd_emu0204_controls); ++i) { | 538 | &snd_emu0204_control, NULL); |
495 | err = snd_ctl_add(mixer->chip->card, | ||
496 | snd_ctl_new1(&snd_emu0204_controls[i], mixer)); | ||
497 | if (err < 0) | ||
498 | return err; | ||
499 | } | ||
500 | |||
501 | return 0; | ||
502 | } | 539 | } |
540 | |||
503 | /* ASUS Xonar U1 / U3 controls */ | 541 | /* ASUS Xonar U1 / U3 controls */ |
504 | 542 | ||
505 | static int snd_xonar_u1_switch_get(struct snd_kcontrol *kcontrol, | 543 | static int snd_xonar_u1_switch_get(struct snd_kcontrol *kcontrol, |
506 | struct snd_ctl_elem_value *ucontrol) | 544 | struct snd_ctl_elem_value *ucontrol) |
507 | { | 545 | { |
508 | struct usb_mixer_interface *mixer = snd_kcontrol_chip(kcontrol); | 546 | ucontrol->value.integer.value[0] = !!(kcontrol->private_value & 0x02); |
509 | |||
510 | ucontrol->value.integer.value[0] = !!(mixer->xonar_u1_status & 0x02); | ||
511 | return 0; | 547 | return 0; |
512 | } | 548 | } |
513 | 549 | ||
550 | static int snd_xonar_u1_switch_update(struct usb_mixer_interface *mixer, | ||
551 | unsigned char status) | ||
552 | { | ||
553 | struct snd_usb_audio *chip = mixer->chip; | ||
554 | int err; | ||
555 | |||
556 | down_read(&chip->shutdown_rwsem); | ||
557 | if (chip->shutdown) | ||
558 | err = -ENODEV; | ||
559 | else | ||
560 | err = snd_usb_ctl_msg(chip->dev, | ||
561 | usb_sndctrlpipe(chip->dev, 0), 0x08, | ||
562 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER, | ||
563 | 50, 0, &status, 1); | ||
564 | up_read(&chip->shutdown_rwsem); | ||
565 | return err; | ||
566 | } | ||
567 | |||
514 | static int snd_xonar_u1_switch_put(struct snd_kcontrol *kcontrol, | 568 | static int snd_xonar_u1_switch_put(struct snd_kcontrol *kcontrol, |
515 | struct snd_ctl_elem_value *ucontrol) | 569 | struct snd_ctl_elem_value *ucontrol) |
516 | { | 570 | { |
517 | struct usb_mixer_interface *mixer = snd_kcontrol_chip(kcontrol); | 571 | struct usb_mixer_elem_list *list = snd_kcontrol_chip(kcontrol); |
518 | u8 old_status, new_status; | 572 | u8 old_status, new_status; |
519 | int err, changed; | 573 | int err; |
520 | 574 | ||
521 | old_status = mixer->xonar_u1_status; | 575 | old_status = kcontrol->private_value; |
522 | if (ucontrol->value.integer.value[0]) | 576 | if (ucontrol->value.integer.value[0]) |
523 | new_status = old_status | 0x02; | 577 | new_status = old_status | 0x02; |
524 | else | 578 | else |
525 | new_status = old_status & ~0x02; | 579 | new_status = old_status & ~0x02; |
526 | changed = new_status != old_status; | 580 | if (new_status == old_status) |
527 | down_read(&mixer->chip->shutdown_rwsem); | 581 | return 0; |
528 | if (mixer->chip->shutdown) | 582 | |
529 | err = -ENODEV; | 583 | kcontrol->private_value = new_status; |
530 | else | 584 | err = snd_xonar_u1_switch_update(list->mixer, new_status); |
531 | err = snd_usb_ctl_msg(mixer->chip->dev, | 585 | return err < 0 ? err : 1; |
532 | usb_sndctrlpipe(mixer->chip->dev, 0), 0x08, | 586 | } |
533 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER, | 587 | |
534 | 50, 0, &new_status, 1); | 588 | static int snd_xonar_u1_switch_resume(struct usb_mixer_elem_list *list) |
535 | up_read(&mixer->chip->shutdown_rwsem); | 589 | { |
536 | if (err < 0) | 590 | return snd_xonar_u1_switch_update(list->mixer, |
537 | return err; | 591 | list->kctl->private_value); |
538 | mixer->xonar_u1_status = new_status; | ||
539 | return changed; | ||
540 | } | 592 | } |
541 | 593 | ||
542 | static struct snd_kcontrol_new snd_xonar_u1_output_switch = { | 594 | static struct snd_kcontrol_new snd_xonar_u1_output_switch = { |
@@ -545,18 +597,14 @@ static struct snd_kcontrol_new snd_xonar_u1_output_switch = { | |||
545 | .info = snd_ctl_boolean_mono_info, | 597 | .info = snd_ctl_boolean_mono_info, |
546 | .get = snd_xonar_u1_switch_get, | 598 | .get = snd_xonar_u1_switch_get, |
547 | .put = snd_xonar_u1_switch_put, | 599 | .put = snd_xonar_u1_switch_put, |
600 | .private_value = 0x05, | ||
548 | }; | 601 | }; |
549 | 602 | ||
550 | static int snd_xonar_u1_controls_create(struct usb_mixer_interface *mixer) | 603 | static int snd_xonar_u1_controls_create(struct usb_mixer_interface *mixer) |
551 | { | 604 | { |
552 | int err; | 605 | return add_single_ctl_with_resume(mixer, 0, |
553 | 606 | snd_xonar_u1_switch_resume, | |
554 | err = snd_ctl_add(mixer->chip->card, | 607 | &snd_xonar_u1_output_switch, NULL); |
555 | snd_ctl_new1(&snd_xonar_u1_output_switch, mixer)); | ||
556 | if (err < 0) | ||
557 | return err; | ||
558 | mixer->xonar_u1_status = 0x05; | ||
559 | return 0; | ||
560 | } | 608 | } |
561 | 609 | ||
562 | /* Digidesign Mbox 1 clock source switch (internal/spdif) */ | 610 | /* Digidesign Mbox 1 clock source switch (internal/spdif) */ |
@@ -568,29 +616,12 @@ static int snd_mbox1_switch_get(struct snd_kcontrol *kctl, | |||
568 | return 0; | 616 | return 0; |
569 | } | 617 | } |
570 | 618 | ||
571 | static int snd_mbox1_switch_put(struct snd_kcontrol *kctl, | 619 | static int snd_mbox1_switch_update(struct usb_mixer_interface *mixer, int val) |
572 | struct snd_ctl_elem_value *ucontrol) | ||
573 | { | 620 | { |
574 | struct snd_usb_audio *chip; | 621 | struct snd_usb_audio *chip = mixer->chip; |
575 | struct usb_mixer_interface *mixer; | ||
576 | int err; | 622 | int err; |
577 | bool cur_val, new_val; | ||
578 | unsigned char buff[3]; | 623 | unsigned char buff[3]; |
579 | 624 | ||
580 | cur_val = kctl->private_value; | ||
581 | new_val = ucontrol->value.enumerated.item[0]; | ||
582 | |||
583 | mixer = snd_kcontrol_chip(kctl); | ||
584 | if (snd_BUG_ON(!mixer)) | ||
585 | return -EINVAL; | ||
586 | |||
587 | chip = mixer->chip; | ||
588 | if (snd_BUG_ON(!chip)) | ||
589 | return -EINVAL; | ||
590 | |||
591 | if (cur_val == new_val) | ||
592 | return 0; | ||
593 | |||
594 | down_read(&chip->shutdown_rwsem); | 625 | down_read(&chip->shutdown_rwsem); |
595 | if (chip->shutdown) { | 626 | if (chip->shutdown) { |
596 | err = -ENODEV; | 627 | err = -ENODEV; |
@@ -620,7 +651,7 @@ static int snd_mbox1_switch_put(struct snd_kcontrol *kctl, | |||
620 | * while S/PDIF sync is enabled and confusing | 651 | * while S/PDIF sync is enabled and confusing |
621 | * this configuration. | 652 | * this configuration. |
622 | */ | 653 | */ |
623 | if (new_val == 0) { | 654 | if (val == 0) { |
624 | buff[0] = 0x80; | 655 | buff[0] = 0x80; |
625 | buff[1] = 0xbb; | 656 | buff[1] = 0xbb; |
626 | buff[2] = 0x00; | 657 | buff[2] = 0x00; |
@@ -649,10 +680,27 @@ static int snd_mbox1_switch_put(struct snd_kcontrol *kctl, | |||
649 | USB_RECIP_ENDPOINT, 0x100, 0x2, buff, 3); | 680 | USB_RECIP_ENDPOINT, 0x100, 0x2, buff, 3); |
650 | if (err < 0) | 681 | if (err < 0) |
651 | goto err; | 682 | goto err; |
652 | kctl->private_value = new_val; | ||
653 | 683 | ||
654 | err: | 684 | err: |
655 | up_read(&chip->shutdown_rwsem); | 685 | up_read(&chip->shutdown_rwsem); |
686 | return err; | ||
687 | } | ||
688 | |||
689 | static int snd_mbox1_switch_put(struct snd_kcontrol *kctl, | ||
690 | struct snd_ctl_elem_value *ucontrol) | ||
691 | { | ||
692 | struct usb_mixer_elem_list *list = snd_kcontrol_chip(kctl); | ||
693 | struct usb_mixer_interface *mixer = list->mixer; | ||
694 | int err; | ||
695 | bool cur_val, new_val; | ||
696 | |||
697 | cur_val = kctl->private_value; | ||
698 | new_val = ucontrol->value.enumerated.item[0]; | ||
699 | if (cur_val == new_val) | ||
700 | return 0; | ||
701 | |||
702 | kctl->private_value = new_val; | ||
703 | err = snd_mbox1_switch_update(mixer, new_val); | ||
656 | return err < 0 ? err : 1; | 704 | return err < 0 ? err : 1; |
657 | } | 705 | } |
658 | 706 | ||
@@ -667,6 +715,11 @@ static int snd_mbox1_switch_info(struct snd_kcontrol *kcontrol, | |||
667 | return snd_ctl_enum_info(uinfo, 1, ARRAY_SIZE(texts), texts); | 715 | return snd_ctl_enum_info(uinfo, 1, ARRAY_SIZE(texts), texts); |
668 | } | 716 | } |
669 | 717 | ||
718 | static int snd_mbox1_switch_resume(struct usb_mixer_elem_list *list) | ||
719 | { | ||
720 | return snd_mbox1_switch_update(list->mixer, list->kctl->private_value); | ||
721 | } | ||
722 | |||
670 | static struct snd_kcontrol_new snd_mbox1_switch = { | 723 | static struct snd_kcontrol_new snd_mbox1_switch = { |
671 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 724 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
672 | .name = "Clock Source", | 725 | .name = "Clock Source", |
@@ -680,72 +733,77 @@ static struct snd_kcontrol_new snd_mbox1_switch = { | |||
680 | 733 | ||
681 | static int snd_mbox1_create_sync_switch(struct usb_mixer_interface *mixer) | 734 | static int snd_mbox1_create_sync_switch(struct usb_mixer_interface *mixer) |
682 | { | 735 | { |
683 | return snd_ctl_add(mixer->chip->card, | 736 | return add_single_ctl_with_resume(mixer, 0, |
684 | snd_ctl_new1(&snd_mbox1_switch, mixer)); | 737 | snd_mbox1_switch_resume, |
738 | &snd_mbox1_switch, NULL); | ||
685 | } | 739 | } |
686 | 740 | ||
687 | /* Native Instruments device quirks */ | 741 | /* Native Instruments device quirks */ |
688 | 742 | ||
689 | #define _MAKE_NI_CONTROL(bRequest,wIndex) ((bRequest) << 16 | (wIndex)) | 743 | #define _MAKE_NI_CONTROL(bRequest,wIndex) ((bRequest) << 16 | (wIndex)) |
690 | 744 | ||
691 | static int snd_nativeinstruments_control_get(struct snd_kcontrol *kcontrol, | 745 | static int snd_ni_control_init_val(struct usb_mixer_interface *mixer, |
692 | struct snd_ctl_elem_value *ucontrol) | 746 | struct snd_kcontrol *kctl) |
693 | { | 747 | { |
694 | struct usb_mixer_interface *mixer = snd_kcontrol_chip(kcontrol); | ||
695 | struct usb_device *dev = mixer->chip->dev; | 748 | struct usb_device *dev = mixer->chip->dev; |
696 | u8 bRequest = (kcontrol->private_value >> 16) & 0xff; | 749 | unsigned int pval = kctl->private_value; |
697 | u16 wIndex = kcontrol->private_value & 0xffff; | 750 | u8 value; |
698 | u8 tmp; | 751 | int err; |
699 | int ret; | ||
700 | |||
701 | down_read(&mixer->chip->shutdown_rwsem); | ||
702 | if (mixer->chip->shutdown) | ||
703 | ret = -ENODEV; | ||
704 | else | ||
705 | ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), bRequest, | ||
706 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, | ||
707 | 0, wIndex, | ||
708 | &tmp, sizeof(tmp), 1000); | ||
709 | up_read(&mixer->chip->shutdown_rwsem); | ||
710 | 752 | ||
711 | if (ret < 0) { | 753 | err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), |
754 | (pval >> 16) & 0xff, | ||
755 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, | ||
756 | 0, pval & 0xffff, &value, 1); | ||
757 | if (err < 0) { | ||
712 | dev_err(&dev->dev, | 758 | dev_err(&dev->dev, |
713 | "unable to issue vendor read request (ret = %d)", ret); | 759 | "unable to issue vendor read request (ret = %d)", err); |
714 | return ret; | 760 | return err; |
715 | } | 761 | } |
716 | 762 | ||
717 | ucontrol->value.integer.value[0] = tmp; | 763 | kctl->private_value |= (value << 24); |
764 | return 0; | ||
765 | } | ||
718 | 766 | ||
767 | static int snd_nativeinstruments_control_get(struct snd_kcontrol *kcontrol, | ||
768 | struct snd_ctl_elem_value *ucontrol) | ||
769 | { | ||
770 | ucontrol->value.integer.value[0] = kcontrol->private_value >> 24; | ||
719 | return 0; | 771 | return 0; |
720 | } | 772 | } |
721 | 773 | ||
774 | static int snd_ni_update_cur_val(struct usb_mixer_elem_list *list) | ||
775 | { | ||
776 | struct snd_usb_audio *chip = list->mixer->chip; | ||
777 | unsigned int pval = list->kctl->private_value; | ||
778 | int err; | ||
779 | |||
780 | down_read(&chip->shutdown_rwsem); | ||
781 | if (chip->shutdown) | ||
782 | err = -ENODEV; | ||
783 | else | ||
784 | err = usb_control_msg(chip->dev, usb_sndctrlpipe(chip->dev, 0), | ||
785 | (pval >> 16) & 0xff, | ||
786 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, | ||
787 | pval >> 24, pval & 0xffff, NULL, 0, 1000); | ||
788 | up_read(&chip->shutdown_rwsem); | ||
789 | return err; | ||
790 | } | ||
791 | |||
722 | static int snd_nativeinstruments_control_put(struct snd_kcontrol *kcontrol, | 792 | static int snd_nativeinstruments_control_put(struct snd_kcontrol *kcontrol, |
723 | struct snd_ctl_elem_value *ucontrol) | 793 | struct snd_ctl_elem_value *ucontrol) |
724 | { | 794 | { |
725 | struct usb_mixer_interface *mixer = snd_kcontrol_chip(kcontrol); | 795 | struct usb_mixer_elem_list *list = snd_kcontrol_chip(kcontrol); |
726 | struct usb_device *dev = mixer->chip->dev; | 796 | u8 oldval = (kcontrol->private_value >> 24) & 0xff; |
727 | u8 bRequest = (kcontrol->private_value >> 16) & 0xff; | 797 | u8 newval = ucontrol->value.integer.value[0]; |
728 | u16 wIndex = kcontrol->private_value & 0xffff; | 798 | int err; |
729 | u16 wValue = ucontrol->value.integer.value[0]; | ||
730 | int ret; | ||
731 | |||
732 | down_read(&mixer->chip->shutdown_rwsem); | ||
733 | if (mixer->chip->shutdown) | ||
734 | ret = -ENODEV; | ||
735 | else | ||
736 | ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), bRequest, | ||
737 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, | ||
738 | wValue, wIndex, | ||
739 | NULL, 0, 1000); | ||
740 | up_read(&mixer->chip->shutdown_rwsem); | ||
741 | 799 | ||
742 | if (ret < 0) { | 800 | if (oldval == newval) |
743 | dev_err(&dev->dev, | 801 | return 0; |
744 | "unable to issue vendor write request (ret = %d)", ret); | ||
745 | return ret; | ||
746 | } | ||
747 | 802 | ||
748 | return 0; | 803 | kcontrol->private_value &= ~(0xff << 24); |
804 | kcontrol->private_value |= newval; | ||
805 | err = snd_ni_update_cur_val(list); | ||
806 | return err < 0 ? err : 1; | ||
749 | } | 807 | } |
750 | 808 | ||
751 | static struct snd_kcontrol_new snd_nativeinstruments_ta6_mixers[] = { | 809 | static struct snd_kcontrol_new snd_nativeinstruments_ta6_mixers[] = { |
@@ -816,16 +874,17 @@ static int snd_nativeinstruments_create_mixer(struct usb_mixer_interface *mixer, | |||
816 | }; | 874 | }; |
817 | 875 | ||
818 | for (i = 0; i < count; i++) { | 876 | for (i = 0; i < count; i++) { |
819 | struct snd_kcontrol *c; | 877 | struct usb_mixer_elem_list *list; |
820 | 878 | ||
821 | template.name = kc[i].name; | 879 | template.name = kc[i].name; |
822 | template.private_value = kc[i].private_value; | 880 | template.private_value = kc[i].private_value; |
823 | 881 | ||
824 | c = snd_ctl_new1(&template, mixer); | 882 | err = add_single_ctl_with_resume(mixer, 0, |
825 | err = snd_ctl_add(mixer->chip->card, c); | 883 | snd_ni_update_cur_val, |
826 | 884 | &template, &list); | |
827 | if (err < 0) | 885 | if (err < 0) |
828 | break; | 886 | break; |
887 | snd_ni_control_init_val(mixer, list->kctl); | ||
829 | } | 888 | } |
830 | 889 | ||
831 | return err; | 890 | return err; |
@@ -833,14 +892,6 @@ static int snd_nativeinstruments_create_mixer(struct usb_mixer_interface *mixer, | |||
833 | 892 | ||
834 | /* M-Audio FastTrack Ultra quirks */ | 893 | /* M-Audio FastTrack Ultra quirks */ |
835 | /* FTU Effect switch (also used by C400/C600) */ | 894 | /* FTU Effect switch (also used by C400/C600) */ |
836 | struct snd_ftu_eff_switch_priv_val { | ||
837 | struct usb_mixer_interface *mixer; | ||
838 | int cached_value; | ||
839 | int is_cached; | ||
840 | int bUnitID; | ||
841 | int validx; | ||
842 | }; | ||
843 | |||
844 | static int snd_ftu_eff_switch_info(struct snd_kcontrol *kcontrol, | 895 | static int snd_ftu_eff_switch_info(struct snd_kcontrol *kcontrol, |
845 | struct snd_ctl_elem_info *uinfo) | 896 | struct snd_ctl_elem_info *uinfo) |
846 | { | 897 | { |
@@ -852,133 +903,77 @@ static int snd_ftu_eff_switch_info(struct snd_kcontrol *kcontrol, | |||
852 | return snd_ctl_enum_info(uinfo, 1, ARRAY_SIZE(texts), texts); | 903 | return snd_ctl_enum_info(uinfo, 1, ARRAY_SIZE(texts), texts); |
853 | } | 904 | } |
854 | 905 | ||
855 | static int snd_ftu_eff_switch_get(struct snd_kcontrol *kctl, | 906 | static int snd_ftu_eff_switch_init(struct usb_mixer_interface *mixer, |
856 | struct snd_ctl_elem_value *ucontrol) | 907 | struct snd_kcontrol *kctl) |
857 | { | 908 | { |
858 | struct snd_usb_audio *chip; | 909 | struct usb_device *dev = mixer->chip->dev; |
859 | struct usb_mixer_interface *mixer; | 910 | unsigned int pval = kctl->private_value; |
860 | struct snd_ftu_eff_switch_priv_val *pval; | ||
861 | int err; | 911 | int err; |
862 | unsigned char value[2]; | 912 | unsigned char value[2]; |
863 | int id, validx; | ||
864 | |||
865 | const int val_len = 2; | ||
866 | 913 | ||
867 | value[0] = 0x00; | 914 | value[0] = 0x00; |
868 | value[1] = 0x00; | 915 | value[1] = 0x00; |
869 | 916 | ||
870 | pval = (struct snd_ftu_eff_switch_priv_val *) | 917 | err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC_GET_CUR, |
871 | kctl->private_value; | 918 | USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN, |
919 | pval & 0xff00, | ||
920 | snd_usb_ctrl_intf(mixer->chip) | ((pval & 0xff) << 8), | ||
921 | value, 2); | ||
922 | if (err < 0) | ||
923 | return err; | ||
872 | 924 | ||
873 | if (pval->is_cached) { | 925 | kctl->private_value |= value[0] << 24; |
874 | ucontrol->value.enumerated.item[0] = pval->cached_value; | 926 | return 0; |
875 | return 0; | 927 | } |
876 | } | ||
877 | 928 | ||
878 | mixer = (struct usb_mixer_interface *) pval->mixer; | 929 | static int snd_ftu_eff_switch_get(struct snd_kcontrol *kctl, |
879 | if (snd_BUG_ON(!mixer)) | 930 | struct snd_ctl_elem_value *ucontrol) |
880 | return -EINVAL; | 931 | { |
932 | ucontrol->value.enumerated.item[0] = kctl->private_value >> 24; | ||
933 | return 0; | ||
934 | } | ||
881 | 935 | ||
882 | chip = (struct snd_usb_audio *) mixer->chip; | 936 | static int snd_ftu_eff_switch_update(struct usb_mixer_elem_list *list) |
883 | if (snd_BUG_ON(!chip)) | 937 | { |
884 | return -EINVAL; | 938 | struct snd_usb_audio *chip = list->mixer->chip; |
939 | unsigned int pval = list->kctl->private_value; | ||
940 | unsigned char value[2]; | ||
941 | int err; | ||
885 | 942 | ||
886 | id = pval->bUnitID; | 943 | value[0] = pval >> 24; |
887 | validx = pval->validx; | 944 | value[1] = 0; |
888 | 945 | ||
889 | down_read(&mixer->chip->shutdown_rwsem); | 946 | down_read(&chip->shutdown_rwsem); |
890 | if (mixer->chip->shutdown) | 947 | if (chip->shutdown) |
891 | err = -ENODEV; | 948 | err = -ENODEV; |
892 | else | 949 | else |
893 | err = snd_usb_ctl_msg(chip->dev, | 950 | err = snd_usb_ctl_msg(chip->dev, |
894 | usb_rcvctrlpipe(chip->dev, 0), UAC_GET_CUR, | 951 | usb_sndctrlpipe(chip->dev, 0), |
895 | USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN, | 952 | UAC_SET_CUR, |
896 | validx << 8, snd_usb_ctrl_intf(chip) | (id << 8), | 953 | USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT, |
897 | value, val_len); | 954 | pval & 0xff00, |
898 | up_read(&mixer->chip->shutdown_rwsem); | 955 | snd_usb_ctrl_intf(chip) | ((pval & 0xff) << 8), |
899 | if (err < 0) | 956 | value, 2); |
900 | return err; | 957 | up_read(&chip->shutdown_rwsem); |
901 | 958 | return err; | |
902 | ucontrol->value.enumerated.item[0] = value[0]; | ||
903 | pval->cached_value = value[0]; | ||
904 | pval->is_cached = 1; | ||
905 | |||
906 | return 0; | ||
907 | } | 959 | } |
908 | 960 | ||
909 | static int snd_ftu_eff_switch_put(struct snd_kcontrol *kctl, | 961 | static int snd_ftu_eff_switch_put(struct snd_kcontrol *kctl, |
910 | struct snd_ctl_elem_value *ucontrol) | 962 | struct snd_ctl_elem_value *ucontrol) |
911 | { | 963 | { |
912 | struct snd_usb_audio *chip; | 964 | struct usb_mixer_elem_list *list = snd_kcontrol_chip(kctl); |
913 | struct snd_ftu_eff_switch_priv_val *pval; | 965 | unsigned int pval = list->kctl->private_value; |
914 | 966 | int cur_val, err, new_val; | |
915 | struct usb_mixer_interface *mixer; | ||
916 | int changed, cur_val, err, new_val; | ||
917 | unsigned char value[2]; | ||
918 | int id, validx; | ||
919 | |||
920 | const int val_len = 2; | ||
921 | |||
922 | changed = 0; | ||
923 | 967 | ||
924 | pval = (struct snd_ftu_eff_switch_priv_val *) | 968 | cur_val = pval >> 24; |
925 | kctl->private_value; | ||
926 | cur_val = pval->cached_value; | ||
927 | new_val = ucontrol->value.enumerated.item[0]; | 969 | new_val = ucontrol->value.enumerated.item[0]; |
970 | if (cur_val == new_val) | ||
971 | return 0; | ||
928 | 972 | ||
929 | mixer = (struct usb_mixer_interface *) pval->mixer; | 973 | kctl->private_value &= ~(0xff << 24); |
930 | if (snd_BUG_ON(!mixer)) | 974 | kctl->private_value |= new_val << 24; |
931 | return -EINVAL; | 975 | err = snd_ftu_eff_switch_update(list); |
932 | 976 | return err < 0 ? err : 1; | |
933 | chip = (struct snd_usb_audio *) mixer->chip; | ||
934 | if (snd_BUG_ON(!chip)) | ||
935 | return -EINVAL; | ||
936 | |||
937 | id = pval->bUnitID; | ||
938 | validx = pval->validx; | ||
939 | |||
940 | if (!pval->is_cached) { | ||
941 | /* Read current value */ | ||
942 | down_read(&mixer->chip->shutdown_rwsem); | ||
943 | if (mixer->chip->shutdown) | ||
944 | err = -ENODEV; | ||
945 | else | ||
946 | err = snd_usb_ctl_msg(chip->dev, | ||
947 | usb_rcvctrlpipe(chip->dev, 0), UAC_GET_CUR, | ||
948 | USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN, | ||
949 | validx << 8, snd_usb_ctrl_intf(chip) | (id << 8), | ||
950 | value, val_len); | ||
951 | up_read(&mixer->chip->shutdown_rwsem); | ||
952 | if (err < 0) | ||
953 | return err; | ||
954 | |||
955 | cur_val = value[0]; | ||
956 | pval->cached_value = cur_val; | ||
957 | pval->is_cached = 1; | ||
958 | } | ||
959 | /* update value if needed */ | ||
960 | if (cur_val != new_val) { | ||
961 | value[0] = new_val; | ||
962 | value[1] = 0; | ||
963 | down_read(&mixer->chip->shutdown_rwsem); | ||
964 | if (mixer->chip->shutdown) | ||
965 | err = -ENODEV; | ||
966 | else | ||
967 | err = snd_usb_ctl_msg(chip->dev, | ||
968 | usb_sndctrlpipe(chip->dev, 0), UAC_SET_CUR, | ||
969 | USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT, | ||
970 | validx << 8, snd_usb_ctrl_intf(chip) | (id << 8), | ||
971 | value, val_len); | ||
972 | up_read(&mixer->chip->shutdown_rwsem); | ||
973 | if (err < 0) | ||
974 | return err; | ||
975 | |||
976 | pval->cached_value = new_val; | ||
977 | pval->is_cached = 1; | ||
978 | changed = 1; | ||
979 | } | ||
980 | |||
981 | return changed; | ||
982 | } | 977 | } |
983 | 978 | ||
984 | static int snd_ftu_create_effect_switch(struct usb_mixer_interface *mixer, | 979 | static int snd_ftu_create_effect_switch(struct usb_mixer_interface *mixer, |
@@ -993,32 +988,16 @@ static int snd_ftu_create_effect_switch(struct usb_mixer_interface *mixer, | |||
993 | .get = snd_ftu_eff_switch_get, | 988 | .get = snd_ftu_eff_switch_get, |
994 | .put = snd_ftu_eff_switch_put | 989 | .put = snd_ftu_eff_switch_put |
995 | }; | 990 | }; |
996 | 991 | struct usb_mixer_elem_list *list; | |
997 | int err; | 992 | int err; |
998 | struct snd_kcontrol *kctl; | ||
999 | struct snd_ftu_eff_switch_priv_val *pval; | ||
1000 | |||
1001 | pval = kzalloc(sizeof(*pval), GFP_KERNEL); | ||
1002 | if (!pval) | ||
1003 | return -ENOMEM; | ||
1004 | |||
1005 | pval->cached_value = 0; | ||
1006 | pval->is_cached = 0; | ||
1007 | pval->mixer = mixer; | ||
1008 | pval->bUnitID = bUnitID; | ||
1009 | pval->validx = validx; | ||
1010 | 993 | ||
1011 | template.private_value = (unsigned long) pval; | 994 | err = add_single_ctl_with_resume(mixer, bUnitID, |
1012 | kctl = snd_ctl_new1(&template, mixer->chip); | 995 | snd_ftu_eff_switch_update, |
1013 | if (!kctl) { | 996 | &template, &list); |
1014 | kfree(pval); | ||
1015 | return -ENOMEM; | ||
1016 | } | ||
1017 | |||
1018 | err = snd_ctl_add(mixer->chip->card, kctl); | ||
1019 | if (err < 0) | 997 | if (err < 0) |
1020 | return err; | 998 | return err; |
1021 | 999 | list->kctl->private_value = (validx << 8) | bUnitID; | |
1000 | snd_ftu_eff_switch_init(mixer, list->kctl); | ||
1022 | return 0; | 1001 | return 0; |
1023 | } | 1002 | } |
1024 | 1003 | ||
@@ -1200,7 +1179,7 @@ void snd_emuusb_set_samplerate(struct snd_usb_audio *chip, | |||
1200 | int unitid = 12; /* SamleRate ExtensionUnit ID */ | 1179 | int unitid = 12; /* SamleRate ExtensionUnit ID */ |
1201 | 1180 | ||
1202 | list_for_each_entry(mixer, &chip->mixer_list, list) { | 1181 | list_for_each_entry(mixer, &chip->mixer_list, list) { |
1203 | cval = mixer->id_elems[unitid]; | 1182 | cval = (struct usb_mixer_elem_info *)mixer->id_elems[unitid]; |
1204 | if (cval) { | 1183 | if (cval) { |
1205 | snd_usb_mixer_set_ctl_value(cval, UAC_SET_CUR, | 1184 | snd_usb_mixer_set_ctl_value(cval, UAC_SET_CUR, |
1206 | cval->control << 8, | 1185 | cval->control << 8, |
@@ -1530,7 +1509,8 @@ static int snd_microii_spdif_info(struct snd_kcontrol *kcontrol, | |||
1530 | static int snd_microii_spdif_default_get(struct snd_kcontrol *kcontrol, | 1509 | static int snd_microii_spdif_default_get(struct snd_kcontrol *kcontrol, |
1531 | struct snd_ctl_elem_value *ucontrol) | 1510 | struct snd_ctl_elem_value *ucontrol) |
1532 | { | 1511 | { |
1533 | struct usb_mixer_interface *mixer = snd_kcontrol_chip(kcontrol); | 1512 | struct usb_mixer_elem_list *list = snd_kcontrol_chip(kcontrol); |
1513 | struct snd_usb_audio *chip = list->mixer->chip; | ||
1534 | int err; | 1514 | int err; |
1535 | struct usb_interface *iface; | 1515 | struct usb_interface *iface; |
1536 | struct usb_host_interface *alts; | 1516 | struct usb_host_interface *alts; |
@@ -1538,17 +1518,23 @@ static int snd_microii_spdif_default_get(struct snd_kcontrol *kcontrol, | |||
1538 | unsigned char data[3]; | 1518 | unsigned char data[3]; |
1539 | int rate; | 1519 | int rate; |
1540 | 1520 | ||
1521 | down_read(&chip->shutdown_rwsem); | ||
1522 | if (chip->shutdown) { | ||
1523 | err = -ENODEV; | ||
1524 | goto end; | ||
1525 | } | ||
1526 | |||
1541 | ucontrol->value.iec958.status[0] = kcontrol->private_value & 0xff; | 1527 | ucontrol->value.iec958.status[0] = kcontrol->private_value & 0xff; |
1542 | ucontrol->value.iec958.status[1] = (kcontrol->private_value >> 8) & 0xff; | 1528 | ucontrol->value.iec958.status[1] = (kcontrol->private_value >> 8) & 0xff; |
1543 | ucontrol->value.iec958.status[2] = 0x00; | 1529 | ucontrol->value.iec958.status[2] = 0x00; |
1544 | 1530 | ||
1545 | /* use known values for that card: interface#1 altsetting#1 */ | 1531 | /* use known values for that card: interface#1 altsetting#1 */ |
1546 | iface = usb_ifnum_to_if(mixer->chip->dev, 1); | 1532 | iface = usb_ifnum_to_if(chip->dev, 1); |
1547 | alts = &iface->altsetting[1]; | 1533 | alts = &iface->altsetting[1]; |
1548 | ep = get_endpoint(alts, 0)->bEndpointAddress; | 1534 | ep = get_endpoint(alts, 0)->bEndpointAddress; |
1549 | 1535 | ||
1550 | err = snd_usb_ctl_msg(mixer->chip->dev, | 1536 | err = snd_usb_ctl_msg(chip->dev, |
1551 | usb_rcvctrlpipe(mixer->chip->dev, 0), | 1537 | usb_rcvctrlpipe(chip->dev, 0), |
1552 | UAC_GET_CUR, | 1538 | UAC_GET_CUR, |
1553 | USB_TYPE_CLASS | USB_RECIP_ENDPOINT | USB_DIR_IN, | 1539 | USB_TYPE_CLASS | USB_RECIP_ENDPOINT | USB_DIR_IN, |
1554 | UAC_EP_CS_ATTR_SAMPLE_RATE << 8, | 1540 | UAC_EP_CS_ATTR_SAMPLE_RATE << 8, |
@@ -1563,22 +1549,27 @@ static int snd_microii_spdif_default_get(struct snd_kcontrol *kcontrol, | |||
1563 | IEC958_AES3_CON_FS_48000 : IEC958_AES3_CON_FS_44100; | 1549 | IEC958_AES3_CON_FS_48000 : IEC958_AES3_CON_FS_44100; |
1564 | 1550 | ||
1565 | err = 0; | 1551 | err = 0; |
1566 | end: | 1552 | end: |
1553 | up_read(&chip->shutdown_rwsem); | ||
1567 | return err; | 1554 | return err; |
1568 | } | 1555 | } |
1569 | 1556 | ||
1570 | static int snd_microii_spdif_default_put(struct snd_kcontrol *kcontrol, | 1557 | static int snd_microii_spdif_default_update(struct usb_mixer_elem_list *list) |
1571 | struct snd_ctl_elem_value *ucontrol) | ||
1572 | { | 1558 | { |
1573 | struct usb_mixer_interface *mixer = snd_kcontrol_chip(kcontrol); | 1559 | struct snd_usb_audio *chip = list->mixer->chip; |
1574 | int err; | 1560 | unsigned int pval = list->kctl->private_value; |
1575 | u8 reg; | 1561 | u8 reg; |
1576 | unsigned long priv_backup = kcontrol->private_value; | 1562 | int err; |
1563 | |||
1564 | down_read(&chip->shutdown_rwsem); | ||
1565 | if (chip->shutdown) { | ||
1566 | err = -ENODEV; | ||
1567 | goto end; | ||
1568 | } | ||
1577 | 1569 | ||
1578 | reg = ((ucontrol->value.iec958.status[1] & 0x0f) << 4) | | 1570 | reg = ((pval >> 4) & 0xf0) | (pval & 0x0f); |
1579 | (ucontrol->value.iec958.status[0] & 0x0f); | 1571 | err = snd_usb_ctl_msg(chip->dev, |
1580 | err = snd_usb_ctl_msg(mixer->chip->dev, | 1572 | usb_sndctrlpipe(chip->dev, 0), |
1581 | usb_sndctrlpipe(mixer->chip->dev, 0), | ||
1582 | UAC_SET_CUR, | 1573 | UAC_SET_CUR, |
1583 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER, | 1574 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER, |
1584 | reg, | 1575 | reg, |
@@ -1588,15 +1579,10 @@ static int snd_microii_spdif_default_put(struct snd_kcontrol *kcontrol, | |||
1588 | if (err < 0) | 1579 | if (err < 0) |
1589 | goto end; | 1580 | goto end; |
1590 | 1581 | ||
1591 | kcontrol->private_value &= 0xfffff0f0; | 1582 | reg = (pval & IEC958_AES0_NONAUDIO) ? 0xa0 : 0x20; |
1592 | kcontrol->private_value |= (ucontrol->value.iec958.status[1] & 0x0f) << 8; | 1583 | reg |= (pval >> 12) & 0x0f; |
1593 | kcontrol->private_value |= (ucontrol->value.iec958.status[0] & 0x0f); | 1584 | err = snd_usb_ctl_msg(chip->dev, |
1594 | 1585 | usb_sndctrlpipe(chip->dev, 0), | |
1595 | reg = (ucontrol->value.iec958.status[0] & IEC958_AES0_NONAUDIO) ? | ||
1596 | 0xa0 : 0x20; | ||
1597 | reg |= (ucontrol->value.iec958.status[1] >> 4) & 0x0f; | ||
1598 | err = snd_usb_ctl_msg(mixer->chip->dev, | ||
1599 | usb_sndctrlpipe(mixer->chip->dev, 0), | ||
1600 | UAC_SET_CUR, | 1586 | UAC_SET_CUR, |
1601 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER, | 1587 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER, |
1602 | reg, | 1588 | reg, |
@@ -1606,16 +1592,36 @@ static int snd_microii_spdif_default_put(struct snd_kcontrol *kcontrol, | |||
1606 | if (err < 0) | 1592 | if (err < 0) |
1607 | goto end; | 1593 | goto end; |
1608 | 1594 | ||
1609 | kcontrol->private_value &= 0xffff0fff; | 1595 | end: |
1610 | kcontrol->private_value |= (ucontrol->value.iec958.status[1] & 0xf0) << 8; | 1596 | up_read(&chip->shutdown_rwsem); |
1597 | return err; | ||
1598 | } | ||
1599 | |||
1600 | static int snd_microii_spdif_default_put(struct snd_kcontrol *kcontrol, | ||
1601 | struct snd_ctl_elem_value *ucontrol) | ||
1602 | { | ||
1603 | struct usb_mixer_elem_list *list = snd_kcontrol_chip(kcontrol); | ||
1604 | unsigned int pval, pval_old; | ||
1605 | int err; | ||
1606 | |||
1607 | pval = pval_old = kcontrol->private_value; | ||
1608 | pval &= 0xfffff0f0; | ||
1609 | pval |= (ucontrol->value.iec958.status[1] & 0x0f) << 8; | ||
1610 | pval |= (ucontrol->value.iec958.status[0] & 0x0f); | ||
1611 | |||
1612 | pval &= 0xffff0fff; | ||
1613 | pval |= (ucontrol->value.iec958.status[1] & 0xf0) << 8; | ||
1611 | 1614 | ||
1612 | /* The frequency bits in AES3 cannot be set via register access. */ | 1615 | /* The frequency bits in AES3 cannot be set via register access. */ |
1613 | 1616 | ||
1614 | /* Silently ignore any bits from the request that cannot be set. */ | 1617 | /* Silently ignore any bits from the request that cannot be set. */ |
1615 | 1618 | ||
1616 | err = (priv_backup != kcontrol->private_value); | 1619 | if (pval == pval_old) |
1617 | end: | 1620 | return 0; |
1618 | return err; | 1621 | |
1622 | kcontrol->private_value = pval; | ||
1623 | err = snd_microii_spdif_default_update(list); | ||
1624 | return err < 0 ? err : 1; | ||
1619 | } | 1625 | } |
1620 | 1626 | ||
1621 | static int snd_microii_spdif_mask_get(struct snd_kcontrol *kcontrol, | 1627 | static int snd_microii_spdif_mask_get(struct snd_kcontrol *kcontrol, |
@@ -1637,15 +1643,20 @@ static int snd_microii_spdif_switch_get(struct snd_kcontrol *kcontrol, | |||
1637 | return 0; | 1643 | return 0; |
1638 | } | 1644 | } |
1639 | 1645 | ||
1640 | static int snd_microii_spdif_switch_put(struct snd_kcontrol *kcontrol, | 1646 | static int snd_microii_spdif_switch_update(struct usb_mixer_elem_list *list) |
1641 | struct snd_ctl_elem_value *ucontrol) | ||
1642 | { | 1647 | { |
1643 | struct usb_mixer_interface *mixer = snd_kcontrol_chip(kcontrol); | 1648 | struct snd_usb_audio *chip = list->mixer->chip; |
1649 | u8 reg = list->kctl->private_value; | ||
1644 | int err; | 1650 | int err; |
1645 | u8 reg = ucontrol->value.integer.value[0] ? 0x28 : 0x2a; | ||
1646 | 1651 | ||
1647 | err = snd_usb_ctl_msg(mixer->chip->dev, | 1652 | down_read(&chip->shutdown_rwsem); |
1648 | usb_sndctrlpipe(mixer->chip->dev, 0), | 1653 | if (chip->shutdown) { |
1654 | err = -ENODEV; | ||
1655 | goto end; | ||
1656 | } | ||
1657 | |||
1658 | err = snd_usb_ctl_msg(chip->dev, | ||
1659 | usb_sndctrlpipe(chip->dev, 0), | ||
1649 | UAC_SET_CUR, | 1660 | UAC_SET_CUR, |
1650 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER, | 1661 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER, |
1651 | reg, | 1662 | reg, |
@@ -1653,15 +1664,27 @@ static int snd_microii_spdif_switch_put(struct snd_kcontrol *kcontrol, | |||
1653 | NULL, | 1664 | NULL, |
1654 | 0); | 1665 | 0); |
1655 | 1666 | ||
1656 | if (!err) { | 1667 | end: |
1657 | err = (reg != (kcontrol->private_value & 0x0ff)); | 1668 | up_read(&chip->shutdown_rwsem); |
1658 | if (err) | ||
1659 | kcontrol->private_value = reg; | ||
1660 | } | ||
1661 | |||
1662 | return err; | 1669 | return err; |
1663 | } | 1670 | } |
1664 | 1671 | ||
1672 | static int snd_microii_spdif_switch_put(struct snd_kcontrol *kcontrol, | ||
1673 | struct snd_ctl_elem_value *ucontrol) | ||
1674 | { | ||
1675 | struct usb_mixer_elem_list *list = snd_kcontrol_chip(kcontrol); | ||
1676 | u8 reg; | ||
1677 | int err; | ||
1678 | |||
1679 | reg = ucontrol->value.integer.value[0] ? 0x28 : 0x2a; | ||
1680 | if (reg != list->kctl->private_value) | ||
1681 | return 0; | ||
1682 | |||
1683 | kcontrol->private_value = reg; | ||
1684 | err = snd_microii_spdif_switch_update(list); | ||
1685 | return err < 0 ? err : 1; | ||
1686 | } | ||
1687 | |||
1665 | static struct snd_kcontrol_new snd_microii_mixer_spdif[] = { | 1688 | static struct snd_kcontrol_new snd_microii_mixer_spdif[] = { |
1666 | { | 1689 | { |
1667 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, | 1690 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
@@ -1691,10 +1714,17 @@ static struct snd_kcontrol_new snd_microii_mixer_spdif[] = { | |||
1691 | static int snd_microii_controls_create(struct usb_mixer_interface *mixer) | 1714 | static int snd_microii_controls_create(struct usb_mixer_interface *mixer) |
1692 | { | 1715 | { |
1693 | int err, i; | 1716 | int err, i; |
1717 | static usb_mixer_elem_resume_func_t resume_funcs[] = { | ||
1718 | snd_microii_spdif_default_update, | ||
1719 | NULL, | ||
1720 | snd_microii_spdif_switch_update | ||
1721 | }; | ||
1694 | 1722 | ||
1695 | for (i = 0; i < ARRAY_SIZE(snd_microii_mixer_spdif); ++i) { | 1723 | for (i = 0; i < ARRAY_SIZE(snd_microii_mixer_spdif); ++i) { |
1696 | err = snd_ctl_add(mixer->chip->card, | 1724 | err = add_single_ctl_with_resume(mixer, 0, |
1697 | snd_ctl_new1(&snd_microii_mixer_spdif[i], mixer)); | 1725 | resume_funcs[i], |
1726 | &snd_microii_mixer_spdif[i], | ||
1727 | NULL); | ||
1698 | if (err < 0) | 1728 | if (err < 0) |
1699 | return err; | 1729 | return err; |
1700 | } | 1730 | } |
diff --git a/sound/usb/mixer_scarlett.c b/sound/usb/mixer_scarlett.c index a0a874507de5..9109652b88b9 100644 --- a/sound/usb/mixer_scarlett.c +++ b/sound/usb/mixer_scarlett.c | |||
@@ -285,6 +285,19 @@ static int scarlett_ctl_switch_put(struct snd_kcontrol *kctl, | |||
285 | return changed; | 285 | return changed; |
286 | } | 286 | } |
287 | 287 | ||
288 | static int scarlett_ctl_resume(struct usb_mixer_elem_list *list) | ||
289 | { | ||
290 | struct usb_mixer_elem_info *elem = | ||
291 | container_of(list, struct usb_mixer_elem_info, head); | ||
292 | int i; | ||
293 | |||
294 | for (i = 0; i < elem->channels; i++) | ||
295 | if (elem->cached & (1 << i)) | ||
296 | snd_usb_set_cur_mix_value(elem, i, i, | ||
297 | elem->cache_val[i]); | ||
298 | return 0; | ||
299 | } | ||
300 | |||
288 | static int scarlett_ctl_info(struct snd_kcontrol *kctl, | 301 | static int scarlett_ctl_info(struct snd_kcontrol *kctl, |
289 | struct snd_ctl_elem_info *uinfo) | 302 | struct snd_ctl_elem_info *uinfo) |
290 | { | 303 | { |
@@ -432,14 +445,24 @@ static int scarlett_ctl_enum_put(struct snd_kcontrol *kctl, | |||
432 | return 0; | 445 | return 0; |
433 | } | 446 | } |
434 | 447 | ||
448 | static int scarlett_ctl_enum_resume(struct usb_mixer_elem_list *list) | ||
449 | { | ||
450 | struct usb_mixer_elem_info *elem = | ||
451 | container_of(list, struct usb_mixer_elem_info, head); | ||
452 | |||
453 | if (elem->cached) | ||
454 | snd_usb_set_cur_mix_value(elem, 0, 0, *elem->cache_val); | ||
455 | return 0; | ||
456 | } | ||
457 | |||
435 | static int scarlett_ctl_meter_get(struct snd_kcontrol *kctl, | 458 | static int scarlett_ctl_meter_get(struct snd_kcontrol *kctl, |
436 | struct snd_ctl_elem_value *ucontrol) | 459 | struct snd_ctl_elem_value *ucontrol) |
437 | { | 460 | { |
438 | struct usb_mixer_elem_info *elem = kctl->private_data; | 461 | struct usb_mixer_elem_info *elem = kctl->private_data; |
439 | struct snd_usb_audio *chip = elem->mixer->chip; | 462 | struct snd_usb_audio *chip = elem->head.mixer->chip; |
440 | unsigned char buf[2 * MAX_CHANNELS] = {0, }; | 463 | unsigned char buf[2 * MAX_CHANNELS] = {0, }; |
441 | int wValue = (elem->control << 8) | elem->idx_off; | 464 | int wValue = (elem->control << 8) | elem->idx_off; |
442 | int idx = snd_usb_ctrl_intf(chip) | (elem->id << 8); | 465 | int idx = snd_usb_ctrl_intf(chip) | (elem->head.id << 8); |
443 | int err; | 466 | int err; |
444 | 467 | ||
445 | err = snd_usb_ctl_msg(chip->dev, | 468 | err = snd_usb_ctl_msg(chip->dev, |
@@ -514,6 +537,7 @@ static struct snd_kcontrol_new usb_scarlett_ctl_sync = { | |||
514 | 537 | ||
515 | static int add_new_ctl(struct usb_mixer_interface *mixer, | 538 | static int add_new_ctl(struct usb_mixer_interface *mixer, |
516 | const struct snd_kcontrol_new *ncontrol, | 539 | const struct snd_kcontrol_new *ncontrol, |
540 | usb_mixer_elem_resume_func_t resume, | ||
517 | int index, int offset, int num, | 541 | int index, int offset, int num, |
518 | int val_type, int channels, const char *name, | 542 | int val_type, int channels, const char *name, |
519 | const struct scarlett_mixer_elem_enum_info *opt, | 543 | const struct scarlett_mixer_elem_enum_info *opt, |
@@ -528,10 +552,11 @@ static int add_new_ctl(struct usb_mixer_interface *mixer, | |||
528 | if (!elem) | 552 | if (!elem) |
529 | return -ENOMEM; | 553 | return -ENOMEM; |
530 | 554 | ||
531 | elem->mixer = mixer; | 555 | elem->head.mixer = mixer; |
556 | elem->head.resume = resume; | ||
532 | elem->control = offset; | 557 | elem->control = offset; |
533 | elem->idx_off = num; | 558 | elem->idx_off = num; |
534 | elem->id = index; | 559 | elem->head.id = index; |
535 | elem->val_type = val_type; | 560 | elem->val_type = val_type; |
536 | 561 | ||
537 | elem->channels = channels; | 562 | elem->channels = channels; |
@@ -548,7 +573,7 @@ static int add_new_ctl(struct usb_mixer_interface *mixer, | |||
548 | 573 | ||
549 | strlcpy(kctl->id.name, name, sizeof(kctl->id.name)); | 574 | strlcpy(kctl->id.name, name, sizeof(kctl->id.name)); |
550 | 575 | ||
551 | err = snd_ctl_add(mixer->chip->card, kctl); | 576 | err = snd_usb_mixer_add_control(&elem->head, kctl); |
552 | if (err < 0) | 577 | if (err < 0) |
553 | return err; | 578 | return err; |
554 | 579 | ||
@@ -569,7 +594,8 @@ static int add_output_ctls(struct usb_mixer_interface *mixer, | |||
569 | /* Add mute switch */ | 594 | /* Add mute switch */ |
570 | snprintf(mx, sizeof(mx), "Master %d (%s) Playback Switch", | 595 | snprintf(mx, sizeof(mx), "Master %d (%s) Playback Switch", |
571 | index + 1, name); | 596 | index + 1, name); |
572 | err = add_new_ctl(mixer, &usb_scarlett_ctl_switch, 0x0a, 0x01, | 597 | err = add_new_ctl(mixer, &usb_scarlett_ctl_switch, |
598 | scarlett_ctl_resume, 0x0a, 0x01, | ||
573 | 2*index+1, USB_MIXER_S16, 2, mx, NULL, &elem); | 599 | 2*index+1, USB_MIXER_S16, 2, mx, NULL, &elem); |
574 | if (err < 0) | 600 | if (err < 0) |
575 | return err; | 601 | return err; |
@@ -577,7 +603,8 @@ static int add_output_ctls(struct usb_mixer_interface *mixer, | |||
577 | /* Add volume control and initialize to 0 */ | 603 | /* Add volume control and initialize to 0 */ |
578 | snprintf(mx, sizeof(mx), "Master %d (%s) Playback Volume", | 604 | snprintf(mx, sizeof(mx), "Master %d (%s) Playback Volume", |
579 | index + 1, name); | 605 | index + 1, name); |
580 | err = add_new_ctl(mixer, &usb_scarlett_ctl_master, 0x0a, 0x02, | 606 | err = add_new_ctl(mixer, &usb_scarlett_ctl_master, |
607 | scarlett_ctl_resume, 0x0a, 0x02, | ||
581 | 2*index+1, USB_MIXER_S16, 2, mx, NULL, &elem); | 608 | 2*index+1, USB_MIXER_S16, 2, mx, NULL, &elem); |
582 | if (err < 0) | 609 | if (err < 0) |
583 | return err; | 610 | return err; |
@@ -585,7 +612,8 @@ static int add_output_ctls(struct usb_mixer_interface *mixer, | |||
585 | /* Add L channel source playback enumeration */ | 612 | /* Add L channel source playback enumeration */ |
586 | snprintf(mx, sizeof(mx), "Master %dL (%s) Source Playback Enum", | 613 | snprintf(mx, sizeof(mx), "Master %dL (%s) Source Playback Enum", |
587 | index + 1, name); | 614 | index + 1, name); |
588 | err = add_new_ctl(mixer, &usb_scarlett_ctl_dynamic_enum, 0x33, 0x00, | 615 | err = add_new_ctl(mixer, &usb_scarlett_ctl_dynamic_enum, |
616 | scarlett_ctl_enum_resume, 0x33, 0x00, | ||
589 | 2*index, USB_MIXER_S16, 1, mx, &info->opt_master, | 617 | 2*index, USB_MIXER_S16, 1, mx, &info->opt_master, |
590 | &elem); | 618 | &elem); |
591 | if (err < 0) | 619 | if (err < 0) |
@@ -594,7 +622,8 @@ static int add_output_ctls(struct usb_mixer_interface *mixer, | |||
594 | /* Add R channel source playback enumeration */ | 622 | /* Add R channel source playback enumeration */ |
595 | snprintf(mx, sizeof(mx), "Master %dR (%s) Source Playback Enum", | 623 | snprintf(mx, sizeof(mx), "Master %dR (%s) Source Playback Enum", |
596 | index + 1, name); | 624 | index + 1, name); |
597 | err = add_new_ctl(mixer, &usb_scarlett_ctl_dynamic_enum, 0x33, 0x00, | 625 | err = add_new_ctl(mixer, &usb_scarlett_ctl_dynamic_enum, |
626 | scarlett_ctl_enum_resume, 0x33, 0x00, | ||
598 | 2*index+1, USB_MIXER_S16, 1, mx, &info->opt_master, | 627 | 2*index+1, USB_MIXER_S16, 1, mx, &info->opt_master, |
599 | &elem); | 628 | &elem); |
600 | if (err < 0) | 629 | if (err < 0) |
@@ -824,13 +853,15 @@ static int scarlett_controls_create_generic(struct usb_mixer_interface *mixer, | |||
824 | struct usb_mixer_elem_info *elem; | 853 | struct usb_mixer_elem_info *elem; |
825 | 854 | ||
826 | /* create master switch and playback volume */ | 855 | /* create master switch and playback volume */ |
827 | err = add_new_ctl(mixer, &usb_scarlett_ctl_switch, 0x0a, 0x01, 0, | 856 | err = add_new_ctl(mixer, &usb_scarlett_ctl_switch, |
857 | scarlett_ctl_resume, 0x0a, 0x01, 0, | ||
828 | USB_MIXER_S16, 1, "Master Playback Switch", NULL, | 858 | USB_MIXER_S16, 1, "Master Playback Switch", NULL, |
829 | &elem); | 859 | &elem); |
830 | if (err < 0) | 860 | if (err < 0) |
831 | return err; | 861 | return err; |
832 | 862 | ||
833 | err = add_new_ctl(mixer, &usb_scarlett_ctl_master, 0x0a, 0x02, 0, | 863 | err = add_new_ctl(mixer, &usb_scarlett_ctl_master, |
864 | scarlett_ctl_resume, 0x0a, 0x02, 0, | ||
834 | USB_MIXER_S16, 1, "Master Playback Volume", NULL, | 865 | USB_MIXER_S16, 1, "Master Playback Volume", NULL, |
835 | &elem); | 866 | &elem); |
836 | if (err < 0) | 867 | if (err < 0) |
@@ -848,7 +879,8 @@ static int scarlett_controls_create_generic(struct usb_mixer_interface *mixer, | |||
848 | break; | 879 | break; |
849 | case SCARLETT_SWITCH_IMPEDANCE: | 880 | case SCARLETT_SWITCH_IMPEDANCE: |
850 | sprintf(mx, "Input %d Impedance Switch", ctl->num); | 881 | sprintf(mx, "Input %d Impedance Switch", ctl->num); |
851 | err = add_new_ctl(mixer, &usb_scarlett_ctl_enum, 0x01, | 882 | err = add_new_ctl(mixer, &usb_scarlett_ctl_enum, |
883 | scarlett_ctl_enum_resume, 0x01, | ||
852 | 0x09, ctl->num, USB_MIXER_S16, 1, mx, | 884 | 0x09, ctl->num, USB_MIXER_S16, 1, mx, |
853 | &opt_impedance, &elem); | 885 | &opt_impedance, &elem); |
854 | if (err < 0) | 886 | if (err < 0) |
@@ -856,7 +888,8 @@ static int scarlett_controls_create_generic(struct usb_mixer_interface *mixer, | |||
856 | break; | 888 | break; |
857 | case SCARLETT_SWITCH_PAD: | 889 | case SCARLETT_SWITCH_PAD: |
858 | sprintf(mx, "Input %d Pad Switch", ctl->num); | 890 | sprintf(mx, "Input %d Pad Switch", ctl->num); |
859 | err = add_new_ctl(mixer, &usb_scarlett_ctl_enum, 0x01, | 891 | err = add_new_ctl(mixer, &usb_scarlett_ctl_enum, |
892 | scarlett_ctl_enum_resume, 0x01, | ||
860 | 0x0b, ctl->num, USB_MIXER_S16, 1, mx, | 893 | 0x0b, ctl->num, USB_MIXER_S16, 1, mx, |
861 | &opt_pad, &elem); | 894 | &opt_pad, &elem); |
862 | if (err < 0) | 895 | if (err < 0) |
@@ -912,7 +945,8 @@ int snd_scarlett_controls_create(struct usb_mixer_interface *mixer) | |||
912 | for (i = 0; i < info->matrix_in; i++) { | 945 | for (i = 0; i < info->matrix_in; i++) { |
913 | snprintf(mx, sizeof(mx), "Matrix %02d Input Playback Route", | 946 | snprintf(mx, sizeof(mx), "Matrix %02d Input Playback Route", |
914 | i+1); | 947 | i+1); |
915 | err = add_new_ctl(mixer, &usb_scarlett_ctl_dynamic_enum, 0x32, | 948 | err = add_new_ctl(mixer, &usb_scarlett_ctl_dynamic_enum, |
949 | scarlett_ctl_enum_resume, 0x32, | ||
916 | 0x06, i, USB_MIXER_S16, 1, mx, | 950 | 0x06, i, USB_MIXER_S16, 1, mx, |
917 | &info->opt_matrix, &elem); | 951 | &info->opt_matrix, &elem); |
918 | if (err < 0) | 952 | if (err < 0) |
@@ -921,7 +955,8 @@ int snd_scarlett_controls_create(struct usb_mixer_interface *mixer) | |||
921 | for (o = 0; o < info->matrix_out; o++) { | 955 | for (o = 0; o < info->matrix_out; o++) { |
922 | sprintf(mx, "Matrix %02d Mix %c Playback Volume", i+1, | 956 | sprintf(mx, "Matrix %02d Mix %c Playback Volume", i+1, |
923 | o+'A'); | 957 | o+'A'); |
924 | err = add_new_ctl(mixer, &usb_scarlett_ctl, 0x3c, 0x00, | 958 | err = add_new_ctl(mixer, &usb_scarlett_ctl, |
959 | scarlett_ctl_resume, 0x3c, 0x00, | ||
925 | (i << 3) + (o & 0x07), USB_MIXER_S16, | 960 | (i << 3) + (o & 0x07), USB_MIXER_S16, |
926 | 1, mx, NULL, &elem); | 961 | 1, mx, NULL, &elem); |
927 | if (err < 0) | 962 | if (err < 0) |
@@ -933,7 +968,8 @@ int snd_scarlett_controls_create(struct usb_mixer_interface *mixer) | |||
933 | for (i = 0; i < info->input_len; i++) { | 968 | for (i = 0; i < info->input_len; i++) { |
934 | snprintf(mx, sizeof(mx), "Input Source %02d Capture Route", | 969 | snprintf(mx, sizeof(mx), "Input Source %02d Capture Route", |
935 | i+1); | 970 | i+1); |
936 | err = add_new_ctl(mixer, &usb_scarlett_ctl_dynamic_enum, 0x34, | 971 | err = add_new_ctl(mixer, &usb_scarlett_ctl_dynamic_enum, |
972 | scarlett_ctl_enum_resume, 0x34, | ||
937 | 0x00, i, USB_MIXER_S16, 1, mx, | 973 | 0x00, i, USB_MIXER_S16, 1, mx, |
938 | &info->opt_master, &elem); | 974 | &info->opt_master, &elem); |
939 | if (err < 0) | 975 | if (err < 0) |
@@ -941,14 +977,15 @@ int snd_scarlett_controls_create(struct usb_mixer_interface *mixer) | |||
941 | } | 977 | } |
942 | 978 | ||
943 | /* val_len == 1 needed here */ | 979 | /* val_len == 1 needed here */ |
944 | err = add_new_ctl(mixer, &usb_scarlett_ctl_enum, 0x28, 0x01, 0, | 980 | err = add_new_ctl(mixer, &usb_scarlett_ctl_enum, |
981 | scarlett_ctl_enum_resume, 0x28, 0x01, 0, | ||
945 | USB_MIXER_U8, 1, "Sample Clock Source", | 982 | USB_MIXER_U8, 1, "Sample Clock Source", |
946 | &opt_clock, &elem); | 983 | &opt_clock, &elem); |
947 | if (err < 0) | 984 | if (err < 0) |
948 | return err; | 985 | return err; |
949 | 986 | ||
950 | /* val_len == 1 and UAC2_CS_MEM */ | 987 | /* val_len == 1 and UAC2_CS_MEM */ |
951 | err = add_new_ctl(mixer, &usb_scarlett_ctl_sync, 0x3c, 0x00, 2, | 988 | err = add_new_ctl(mixer, &usb_scarlett_ctl_sync, NULL, 0x3c, 0x00, 2, |
952 | USB_MIXER_U8, 1, "Sample Clock Sync Status", | 989 | USB_MIXER_U8, 1, "Sample Clock Sync Status", |
953 | &opt_sync, &elem); | 990 | &opt_sync, &elem); |
954 | if (err < 0) | 991 | if (err < 0) |
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index 809d7fab4633..2c1018e447b1 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c | |||
@@ -1155,6 +1155,20 @@ void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe, | |||
1155 | if ((le16_to_cpu(dev->descriptor.idVendor) == 0x23ba) && | 1155 | if ((le16_to_cpu(dev->descriptor.idVendor) == 0x23ba) && |
1156 | (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) | 1156 | (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) |
1157 | mdelay(20); | 1157 | mdelay(20); |
1158 | |||
1159 | /* Marantz/Denon devices with USB DAC functionality need a delay | ||
1160 | * after each class compliant request | ||
1161 | */ | ||
1162 | if ((le16_to_cpu(dev->descriptor.idVendor) == 0x154e) && | ||
1163 | (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) { | ||
1164 | |||
1165 | switch (le16_to_cpu(dev->descriptor.idProduct)) { | ||
1166 | case 0x3005: /* Marantz HD-DAC1 */ | ||
1167 | case 0x3006: /* Marantz SA-14S1 */ | ||
1168 | mdelay(20); | ||
1169 | break; | ||
1170 | } | ||
1171 | } | ||
1158 | } | 1172 | } |
1159 | 1173 | ||
1160 | /* | 1174 | /* |
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c index 8c5c11ca8c53..25114c9a6801 100644 --- a/tools/perf/builtin-diff.c +++ b/tools/perf/builtin-diff.c | |||
@@ -1142,6 +1142,11 @@ static int data_init(int argc, const char **argv) | |||
1142 | 1142 | ||
1143 | int cmd_diff(int argc, const char **argv, const char *prefix __maybe_unused) | 1143 | int cmd_diff(int argc, const char **argv, const char *prefix __maybe_unused) |
1144 | { | 1144 | { |
1145 | int ret = hists__init(); | ||
1146 | |||
1147 | if (ret < 0) | ||
1148 | return ret; | ||
1149 | |||
1145 | perf_config(perf_default_config, NULL); | 1150 | perf_config(perf_default_config, NULL); |
1146 | 1151 | ||
1147 | argc = parse_options(argc, argv, options, diff_usage, 0); | 1152 | argc = parse_options(argc, argv, options, diff_usage, 0); |
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c index 04412b4770a2..7af26acf06d9 100644 --- a/tools/perf/builtin-probe.c +++ b/tools/perf/builtin-probe.c | |||
@@ -375,7 +375,7 @@ __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused) | |||
375 | OPT_CALLBACK('x', "exec", NULL, "executable|path", | 375 | OPT_CALLBACK('x', "exec", NULL, "executable|path", |
376 | "target executable name or path", opt_set_target), | 376 | "target executable name or path", opt_set_target), |
377 | OPT_BOOLEAN(0, "demangle", &symbol_conf.demangle, | 377 | OPT_BOOLEAN(0, "demangle", &symbol_conf.demangle, |
378 | "Disable symbol demangling"), | 378 | "Enable symbol demangling"), |
379 | OPT_BOOLEAN(0, "demangle-kernel", &symbol_conf.demangle_kernel, | 379 | OPT_BOOLEAN(0, "demangle-kernel", &symbol_conf.demangle_kernel, |
380 | "Enable kernel symbol demangling"), | 380 | "Enable kernel symbol demangling"), |
381 | OPT_END() | 381 | OPT_END() |
diff --git a/tools/perf/perf-sys.h b/tools/perf/perf-sys.h index 937e4324ad94..a3b13d7dc1d4 100644 --- a/tools/perf/perf-sys.h +++ b/tools/perf/perf-sys.h | |||
@@ -13,7 +13,7 @@ | |||
13 | #define wmb() asm volatile("lock; addl $0,0(%%esp)" ::: "memory") | 13 | #define wmb() asm volatile("lock; addl $0,0(%%esp)" ::: "memory") |
14 | #define rmb() asm volatile("lock; addl $0,0(%%esp)" ::: "memory") | 14 | #define rmb() asm volatile("lock; addl $0,0(%%esp)" ::: "memory") |
15 | #define cpu_relax() asm volatile("rep; nop" ::: "memory"); | 15 | #define cpu_relax() asm volatile("rep; nop" ::: "memory"); |
16 | #define CPUINFO_PROC "model name" | 16 | #define CPUINFO_PROC {"model name"} |
17 | #ifndef __NR_perf_event_open | 17 | #ifndef __NR_perf_event_open |
18 | # define __NR_perf_event_open 336 | 18 | # define __NR_perf_event_open 336 |
19 | #endif | 19 | #endif |
@@ -30,7 +30,7 @@ | |||
30 | #define wmb() asm volatile("sfence" ::: "memory") | 30 | #define wmb() asm volatile("sfence" ::: "memory") |
31 | #define rmb() asm volatile("lfence" ::: "memory") | 31 | #define rmb() asm volatile("lfence" ::: "memory") |
32 | #define cpu_relax() asm volatile("rep; nop" ::: "memory"); | 32 | #define cpu_relax() asm volatile("rep; nop" ::: "memory"); |
33 | #define CPUINFO_PROC "model name" | 33 | #define CPUINFO_PROC {"model name"} |
34 | #ifndef __NR_perf_event_open | 34 | #ifndef __NR_perf_event_open |
35 | # define __NR_perf_event_open 298 | 35 | # define __NR_perf_event_open 298 |
36 | #endif | 36 | #endif |
@@ -47,14 +47,14 @@ | |||
47 | #define mb() asm volatile ("sync" ::: "memory") | 47 | #define mb() asm volatile ("sync" ::: "memory") |
48 | #define wmb() asm volatile ("sync" ::: "memory") | 48 | #define wmb() asm volatile ("sync" ::: "memory") |
49 | #define rmb() asm volatile ("sync" ::: "memory") | 49 | #define rmb() asm volatile ("sync" ::: "memory") |
50 | #define CPUINFO_PROC "cpu" | 50 | #define CPUINFO_PROC {"cpu"} |
51 | #endif | 51 | #endif |
52 | 52 | ||
53 | #ifdef __s390__ | 53 | #ifdef __s390__ |
54 | #define mb() asm volatile("bcr 15,0" ::: "memory") | 54 | #define mb() asm volatile("bcr 15,0" ::: "memory") |
55 | #define wmb() asm volatile("bcr 15,0" ::: "memory") | 55 | #define wmb() asm volatile("bcr 15,0" ::: "memory") |
56 | #define rmb() asm volatile("bcr 15,0" ::: "memory") | 56 | #define rmb() asm volatile("bcr 15,0" ::: "memory") |
57 | #define CPUINFO_PROC "vendor_id" | 57 | #define CPUINFO_PROC {"vendor_id"} |
58 | #endif | 58 | #endif |
59 | 59 | ||
60 | #ifdef __sh__ | 60 | #ifdef __sh__ |
@@ -67,14 +67,14 @@ | |||
67 | # define wmb() asm volatile("" ::: "memory") | 67 | # define wmb() asm volatile("" ::: "memory") |
68 | # define rmb() asm volatile("" ::: "memory") | 68 | # define rmb() asm volatile("" ::: "memory") |
69 | #endif | 69 | #endif |
70 | #define CPUINFO_PROC "cpu type" | 70 | #define CPUINFO_PROC {"cpu type"} |
71 | #endif | 71 | #endif |
72 | 72 | ||
73 | #ifdef __hppa__ | 73 | #ifdef __hppa__ |
74 | #define mb() asm volatile("" ::: "memory") | 74 | #define mb() asm volatile("" ::: "memory") |
75 | #define wmb() asm volatile("" ::: "memory") | 75 | #define wmb() asm volatile("" ::: "memory") |
76 | #define rmb() asm volatile("" ::: "memory") | 76 | #define rmb() asm volatile("" ::: "memory") |
77 | #define CPUINFO_PROC "cpu" | 77 | #define CPUINFO_PROC {"cpu"} |
78 | #endif | 78 | #endif |
79 | 79 | ||
80 | #ifdef __sparc__ | 80 | #ifdef __sparc__ |
@@ -87,14 +87,14 @@ | |||
87 | #endif | 87 | #endif |
88 | #define wmb() asm volatile("":::"memory") | 88 | #define wmb() asm volatile("":::"memory") |
89 | #define rmb() asm volatile("":::"memory") | 89 | #define rmb() asm volatile("":::"memory") |
90 | #define CPUINFO_PROC "cpu" | 90 | #define CPUINFO_PROC {"cpu"} |
91 | #endif | 91 | #endif |
92 | 92 | ||
93 | #ifdef __alpha__ | 93 | #ifdef __alpha__ |
94 | #define mb() asm volatile("mb" ::: "memory") | 94 | #define mb() asm volatile("mb" ::: "memory") |
95 | #define wmb() asm volatile("wmb" ::: "memory") | 95 | #define wmb() asm volatile("wmb" ::: "memory") |
96 | #define rmb() asm volatile("mb" ::: "memory") | 96 | #define rmb() asm volatile("mb" ::: "memory") |
97 | #define CPUINFO_PROC "cpu model" | 97 | #define CPUINFO_PROC {"cpu model"} |
98 | #endif | 98 | #endif |
99 | 99 | ||
100 | #ifdef __ia64__ | 100 | #ifdef __ia64__ |
@@ -102,7 +102,7 @@ | |||
102 | #define wmb() asm volatile ("mf" ::: "memory") | 102 | #define wmb() asm volatile ("mf" ::: "memory") |
103 | #define rmb() asm volatile ("mf" ::: "memory") | 103 | #define rmb() asm volatile ("mf" ::: "memory") |
104 | #define cpu_relax() asm volatile ("hint @pause" ::: "memory") | 104 | #define cpu_relax() asm volatile ("hint @pause" ::: "memory") |
105 | #define CPUINFO_PROC "model name" | 105 | #define CPUINFO_PROC {"model name"} |
106 | #endif | 106 | #endif |
107 | 107 | ||
108 | #ifdef __arm__ | 108 | #ifdef __arm__ |
@@ -113,7 +113,7 @@ | |||
113 | #define mb() ((void(*)(void))0xffff0fa0)() | 113 | #define mb() ((void(*)(void))0xffff0fa0)() |
114 | #define wmb() ((void(*)(void))0xffff0fa0)() | 114 | #define wmb() ((void(*)(void))0xffff0fa0)() |
115 | #define rmb() ((void(*)(void))0xffff0fa0)() | 115 | #define rmb() ((void(*)(void))0xffff0fa0)() |
116 | #define CPUINFO_PROC "Processor" | 116 | #define CPUINFO_PROC {"model name", "Processor"} |
117 | #endif | 117 | #endif |
118 | 118 | ||
119 | #ifdef __aarch64__ | 119 | #ifdef __aarch64__ |
@@ -133,28 +133,28 @@ | |||
133 | : "memory") | 133 | : "memory") |
134 | #define wmb() mb() | 134 | #define wmb() mb() |
135 | #define rmb() mb() | 135 | #define rmb() mb() |
136 | #define CPUINFO_PROC "cpu model" | 136 | #define CPUINFO_PROC {"cpu model"} |
137 | #endif | 137 | #endif |
138 | 138 | ||
139 | #ifdef __arc__ | 139 | #ifdef __arc__ |
140 | #define mb() asm volatile("" ::: "memory") | 140 | #define mb() asm volatile("" ::: "memory") |
141 | #define wmb() asm volatile("" ::: "memory") | 141 | #define wmb() asm volatile("" ::: "memory") |
142 | #define rmb() asm volatile("" ::: "memory") | 142 | #define rmb() asm volatile("" ::: "memory") |
143 | #define CPUINFO_PROC "Processor" | 143 | #define CPUINFO_PROC {"Processor"} |
144 | #endif | 144 | #endif |
145 | 145 | ||
146 | #ifdef __metag__ | 146 | #ifdef __metag__ |
147 | #define mb() asm volatile("" ::: "memory") | 147 | #define mb() asm volatile("" ::: "memory") |
148 | #define wmb() asm volatile("" ::: "memory") | 148 | #define wmb() asm volatile("" ::: "memory") |
149 | #define rmb() asm volatile("" ::: "memory") | 149 | #define rmb() asm volatile("" ::: "memory") |
150 | #define CPUINFO_PROC "CPU" | 150 | #define CPUINFO_PROC {"CPU"} |
151 | #endif | 151 | #endif |
152 | 152 | ||
153 | #ifdef __xtensa__ | 153 | #ifdef __xtensa__ |
154 | #define mb() asm volatile("memw" ::: "memory") | 154 | #define mb() asm volatile("memw" ::: "memory") |
155 | #define wmb() asm volatile("memw" ::: "memory") | 155 | #define wmb() asm volatile("memw" ::: "memory") |
156 | #define rmb() asm volatile("" ::: "memory") | 156 | #define rmb() asm volatile("" ::: "memory") |
157 | #define CPUINFO_PROC "core ID" | 157 | #define CPUINFO_PROC {"core ID"} |
158 | #endif | 158 | #endif |
159 | 159 | ||
160 | #ifdef __tile__ | 160 | #ifdef __tile__ |
@@ -162,7 +162,7 @@ | |||
162 | #define wmb() asm volatile ("mf" ::: "memory") | 162 | #define wmb() asm volatile ("mf" ::: "memory") |
163 | #define rmb() asm volatile ("mf" ::: "memory") | 163 | #define rmb() asm volatile ("mf" ::: "memory") |
164 | #define cpu_relax() asm volatile ("mfspr zero, PASS" ::: "memory") | 164 | #define cpu_relax() asm volatile ("mfspr zero, PASS" ::: "memory") |
165 | #define CPUINFO_PROC "model name" | 165 | #define CPUINFO_PROC {"model name"} |
166 | #endif | 166 | #endif |
167 | 167 | ||
168 | #define barrier() asm volatile ("" ::: "memory") | 168 | #define barrier() asm volatile ("" ::: "memory") |
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index ce0de00399da..26f5b2fe5dc8 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c | |||
@@ -579,16 +579,12 @@ static int write_version(int fd, struct perf_header *h __maybe_unused, | |||
579 | return do_write_string(fd, perf_version_string); | 579 | return do_write_string(fd, perf_version_string); |
580 | } | 580 | } |
581 | 581 | ||
582 | static int write_cpudesc(int fd, struct perf_header *h __maybe_unused, | 582 | static int __write_cpudesc(int fd, const char *cpuinfo_proc) |
583 | struct perf_evlist *evlist __maybe_unused) | ||
584 | { | 583 | { |
585 | #ifndef CPUINFO_PROC | ||
586 | #define CPUINFO_PROC NULL | ||
587 | #endif | ||
588 | FILE *file; | 584 | FILE *file; |
589 | char *buf = NULL; | 585 | char *buf = NULL; |
590 | char *s, *p; | 586 | char *s, *p; |
591 | const char *search = CPUINFO_PROC; | 587 | const char *search = cpuinfo_proc; |
592 | size_t len = 0; | 588 | size_t len = 0; |
593 | int ret = -1; | 589 | int ret = -1; |
594 | 590 | ||
@@ -638,6 +634,25 @@ done: | |||
638 | return ret; | 634 | return ret; |
639 | } | 635 | } |
640 | 636 | ||
637 | static int write_cpudesc(int fd, struct perf_header *h __maybe_unused, | ||
638 | struct perf_evlist *evlist __maybe_unused) | ||
639 | { | ||
640 | #ifndef CPUINFO_PROC | ||
641 | #define CPUINFO_PROC {"model name", } | ||
642 | #endif | ||
643 | const char *cpuinfo_procs[] = CPUINFO_PROC; | ||
644 | unsigned int i; | ||
645 | |||
646 | for (i = 0; i < ARRAY_SIZE(cpuinfo_procs); i++) { | ||
647 | int ret; | ||
648 | ret = __write_cpudesc(fd, cpuinfo_procs[i]); | ||
649 | if (ret >= 0) | ||
650 | return ret; | ||
651 | } | ||
652 | return -1; | ||
653 | } | ||
654 | |||
655 | |||
641 | static int write_nrcpus(int fd, struct perf_header *h __maybe_unused, | 656 | static int write_nrcpus(int fd, struct perf_header *h __maybe_unused, |
642 | struct perf_evlist *evlist __maybe_unused) | 657 | struct perf_evlist *evlist __maybe_unused) |
643 | { | 658 | { |
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c index 4906cd81cb56..9402885a77f3 100644 --- a/tools/perf/util/sort.c +++ b/tools/perf/util/sort.c | |||
@@ -373,6 +373,9 @@ struct sort_entry sort_cpu = { | |||
373 | static int64_t | 373 | static int64_t |
374 | sort__dso_from_cmp(struct hist_entry *left, struct hist_entry *right) | 374 | sort__dso_from_cmp(struct hist_entry *left, struct hist_entry *right) |
375 | { | 375 | { |
376 | if (!left->branch_info || !right->branch_info) | ||
377 | return cmp_null(left->branch_info, right->branch_info); | ||
378 | |||
376 | return _sort__dso_cmp(left->branch_info->from.map, | 379 | return _sort__dso_cmp(left->branch_info->from.map, |
377 | right->branch_info->from.map); | 380 | right->branch_info->from.map); |
378 | } | 381 | } |
@@ -380,13 +383,19 @@ sort__dso_from_cmp(struct hist_entry *left, struct hist_entry *right) | |||
380 | static int hist_entry__dso_from_snprintf(struct hist_entry *he, char *bf, | 383 | static int hist_entry__dso_from_snprintf(struct hist_entry *he, char *bf, |
381 | size_t size, unsigned int width) | 384 | size_t size, unsigned int width) |
382 | { | 385 | { |
383 | return _hist_entry__dso_snprintf(he->branch_info->from.map, | 386 | if (he->branch_info) |
384 | bf, size, width); | 387 | return _hist_entry__dso_snprintf(he->branch_info->from.map, |
388 | bf, size, width); | ||
389 | else | ||
390 | return repsep_snprintf(bf, size, "%-*.*s", width, width, "N/A"); | ||
385 | } | 391 | } |
386 | 392 | ||
387 | static int64_t | 393 | static int64_t |
388 | sort__dso_to_cmp(struct hist_entry *left, struct hist_entry *right) | 394 | sort__dso_to_cmp(struct hist_entry *left, struct hist_entry *right) |
389 | { | 395 | { |
396 | if (!left->branch_info || !right->branch_info) | ||
397 | return cmp_null(left->branch_info, right->branch_info); | ||
398 | |||
390 | return _sort__dso_cmp(left->branch_info->to.map, | 399 | return _sort__dso_cmp(left->branch_info->to.map, |
391 | right->branch_info->to.map); | 400 | right->branch_info->to.map); |
392 | } | 401 | } |
@@ -394,8 +403,11 @@ sort__dso_to_cmp(struct hist_entry *left, struct hist_entry *right) | |||
394 | static int hist_entry__dso_to_snprintf(struct hist_entry *he, char *bf, | 403 | static int hist_entry__dso_to_snprintf(struct hist_entry *he, char *bf, |
395 | size_t size, unsigned int width) | 404 | size_t size, unsigned int width) |
396 | { | 405 | { |
397 | return _hist_entry__dso_snprintf(he->branch_info->to.map, | 406 | if (he->branch_info) |
398 | bf, size, width); | 407 | return _hist_entry__dso_snprintf(he->branch_info->to.map, |
408 | bf, size, width); | ||
409 | else | ||
410 | return repsep_snprintf(bf, size, "%-*.*s", width, width, "N/A"); | ||
399 | } | 411 | } |
400 | 412 | ||
401 | static int64_t | 413 | static int64_t |
@@ -404,6 +416,12 @@ sort__sym_from_cmp(struct hist_entry *left, struct hist_entry *right) | |||
404 | struct addr_map_symbol *from_l = &left->branch_info->from; | 416 | struct addr_map_symbol *from_l = &left->branch_info->from; |
405 | struct addr_map_symbol *from_r = &right->branch_info->from; | 417 | struct addr_map_symbol *from_r = &right->branch_info->from; |
406 | 418 | ||
419 | if (!left->branch_info || !right->branch_info) | ||
420 | return cmp_null(left->branch_info, right->branch_info); | ||
421 | |||
422 | from_l = &left->branch_info->from; | ||
423 | from_r = &right->branch_info->from; | ||
424 | |||
407 | if (!from_l->sym && !from_r->sym) | 425 | if (!from_l->sym && !from_r->sym) |
408 | return _sort__addr_cmp(from_l->addr, from_r->addr); | 426 | return _sort__addr_cmp(from_l->addr, from_r->addr); |
409 | 427 | ||
@@ -413,8 +431,13 @@ sort__sym_from_cmp(struct hist_entry *left, struct hist_entry *right) | |||
413 | static int64_t | 431 | static int64_t |
414 | sort__sym_to_cmp(struct hist_entry *left, struct hist_entry *right) | 432 | sort__sym_to_cmp(struct hist_entry *left, struct hist_entry *right) |
415 | { | 433 | { |
416 | struct addr_map_symbol *to_l = &left->branch_info->to; | 434 | struct addr_map_symbol *to_l, *to_r; |
417 | struct addr_map_symbol *to_r = &right->branch_info->to; | 435 | |
436 | if (!left->branch_info || !right->branch_info) | ||
437 | return cmp_null(left->branch_info, right->branch_info); | ||
438 | |||
439 | to_l = &left->branch_info->to; | ||
440 | to_r = &right->branch_info->to; | ||
418 | 441 | ||
419 | if (!to_l->sym && !to_r->sym) | 442 | if (!to_l->sym && !to_r->sym) |
420 | return _sort__addr_cmp(to_l->addr, to_r->addr); | 443 | return _sort__addr_cmp(to_l->addr, to_r->addr); |
@@ -425,19 +448,27 @@ sort__sym_to_cmp(struct hist_entry *left, struct hist_entry *right) | |||
425 | static int hist_entry__sym_from_snprintf(struct hist_entry *he, char *bf, | 448 | static int hist_entry__sym_from_snprintf(struct hist_entry *he, char *bf, |
426 | size_t size, unsigned int width) | 449 | size_t size, unsigned int width) |
427 | { | 450 | { |
428 | struct addr_map_symbol *from = &he->branch_info->from; | 451 | if (he->branch_info) { |
429 | return _hist_entry__sym_snprintf(from->map, from->sym, from->addr, | 452 | struct addr_map_symbol *from = &he->branch_info->from; |
430 | he->level, bf, size, width); | ||
431 | 453 | ||
454 | return _hist_entry__sym_snprintf(from->map, from->sym, from->addr, | ||
455 | he->level, bf, size, width); | ||
456 | } | ||
457 | |||
458 | return repsep_snprintf(bf, size, "%-*.*s", width, width, "N/A"); | ||
432 | } | 459 | } |
433 | 460 | ||
434 | static int hist_entry__sym_to_snprintf(struct hist_entry *he, char *bf, | 461 | static int hist_entry__sym_to_snprintf(struct hist_entry *he, char *bf, |
435 | size_t size, unsigned int width) | 462 | size_t size, unsigned int width) |
436 | { | 463 | { |
437 | struct addr_map_symbol *to = &he->branch_info->to; | 464 | if (he->branch_info) { |
438 | return _hist_entry__sym_snprintf(to->map, to->sym, to->addr, | 465 | struct addr_map_symbol *to = &he->branch_info->to; |
439 | he->level, bf, size, width); | ||
440 | 466 | ||
467 | return _hist_entry__sym_snprintf(to->map, to->sym, to->addr, | ||
468 | he->level, bf, size, width); | ||
469 | } | ||
470 | |||
471 | return repsep_snprintf(bf, size, "%-*.*s", width, width, "N/A"); | ||
441 | } | 472 | } |
442 | 473 | ||
443 | struct sort_entry sort_dso_from = { | 474 | struct sort_entry sort_dso_from = { |
@@ -471,11 +502,13 @@ struct sort_entry sort_sym_to = { | |||
471 | static int64_t | 502 | static int64_t |
472 | sort__mispredict_cmp(struct hist_entry *left, struct hist_entry *right) | 503 | sort__mispredict_cmp(struct hist_entry *left, struct hist_entry *right) |
473 | { | 504 | { |
474 | const unsigned char mp = left->branch_info->flags.mispred != | 505 | unsigned char mp, p; |
475 | right->branch_info->flags.mispred; | 506 | |
476 | const unsigned char p = left->branch_info->flags.predicted != | 507 | if (!left->branch_info || !right->branch_info) |
477 | right->branch_info->flags.predicted; | 508 | return cmp_null(left->branch_info, right->branch_info); |
478 | 509 | ||
510 | mp = left->branch_info->flags.mispred != right->branch_info->flags.mispred; | ||
511 | p = left->branch_info->flags.predicted != right->branch_info->flags.predicted; | ||
479 | return mp || p; | 512 | return mp || p; |
480 | } | 513 | } |
481 | 514 | ||
@@ -483,10 +516,12 @@ static int hist_entry__mispredict_snprintf(struct hist_entry *he, char *bf, | |||
483 | size_t size, unsigned int width){ | 516 | size_t size, unsigned int width){ |
484 | static const char *out = "N/A"; | 517 | static const char *out = "N/A"; |
485 | 518 | ||
486 | if (he->branch_info->flags.predicted) | 519 | if (he->branch_info) { |
487 | out = "N"; | 520 | if (he->branch_info->flags.predicted) |
488 | else if (he->branch_info->flags.mispred) | 521 | out = "N"; |
489 | out = "Y"; | 522 | else if (he->branch_info->flags.mispred) |
523 | out = "Y"; | ||
524 | } | ||
490 | 525 | ||
491 | return repsep_snprintf(bf, size, "%-*.*s", width, width, out); | 526 | return repsep_snprintf(bf, size, "%-*.*s", width, width, out); |
492 | } | 527 | } |
@@ -989,6 +1024,9 @@ struct sort_entry sort_mem_dcacheline = { | |||
989 | static int64_t | 1024 | static int64_t |
990 | sort__abort_cmp(struct hist_entry *left, struct hist_entry *right) | 1025 | sort__abort_cmp(struct hist_entry *left, struct hist_entry *right) |
991 | { | 1026 | { |
1027 | if (!left->branch_info || !right->branch_info) | ||
1028 | return cmp_null(left->branch_info, right->branch_info); | ||
1029 | |||
992 | return left->branch_info->flags.abort != | 1030 | return left->branch_info->flags.abort != |
993 | right->branch_info->flags.abort; | 1031 | right->branch_info->flags.abort; |
994 | } | 1032 | } |
@@ -996,10 +1034,15 @@ sort__abort_cmp(struct hist_entry *left, struct hist_entry *right) | |||
996 | static int hist_entry__abort_snprintf(struct hist_entry *he, char *bf, | 1034 | static int hist_entry__abort_snprintf(struct hist_entry *he, char *bf, |
997 | size_t size, unsigned int width) | 1035 | size_t size, unsigned int width) |
998 | { | 1036 | { |
999 | static const char *out = "."; | 1037 | static const char *out = "N/A"; |
1038 | |||
1039 | if (he->branch_info) { | ||
1040 | if (he->branch_info->flags.abort) | ||
1041 | out = "A"; | ||
1042 | else | ||
1043 | out = "."; | ||
1044 | } | ||
1000 | 1045 | ||
1001 | if (he->branch_info->flags.abort) | ||
1002 | out = "A"; | ||
1003 | return repsep_snprintf(bf, size, "%-*s", width, out); | 1046 | return repsep_snprintf(bf, size, "%-*s", width, out); |
1004 | } | 1047 | } |
1005 | 1048 | ||
@@ -1013,6 +1056,9 @@ struct sort_entry sort_abort = { | |||
1013 | static int64_t | 1056 | static int64_t |
1014 | sort__in_tx_cmp(struct hist_entry *left, struct hist_entry *right) | 1057 | sort__in_tx_cmp(struct hist_entry *left, struct hist_entry *right) |
1015 | { | 1058 | { |
1059 | if (!left->branch_info || !right->branch_info) | ||
1060 | return cmp_null(left->branch_info, right->branch_info); | ||
1061 | |||
1016 | return left->branch_info->flags.in_tx != | 1062 | return left->branch_info->flags.in_tx != |
1017 | right->branch_info->flags.in_tx; | 1063 | right->branch_info->flags.in_tx; |
1018 | } | 1064 | } |
@@ -1020,10 +1066,14 @@ sort__in_tx_cmp(struct hist_entry *left, struct hist_entry *right) | |||
1020 | static int hist_entry__in_tx_snprintf(struct hist_entry *he, char *bf, | 1066 | static int hist_entry__in_tx_snprintf(struct hist_entry *he, char *bf, |
1021 | size_t size, unsigned int width) | 1067 | size_t size, unsigned int width) |
1022 | { | 1068 | { |
1023 | static const char *out = "."; | 1069 | static const char *out = "N/A"; |
1024 | 1070 | ||
1025 | if (he->branch_info->flags.in_tx) | 1071 | if (he->branch_info) { |
1026 | out = "T"; | 1072 | if (he->branch_info->flags.in_tx) |
1073 | out = "T"; | ||
1074 | else | ||
1075 | out = "."; | ||
1076 | } | ||
1027 | 1077 | ||
1028 | return repsep_snprintf(bf, size, "%-*s", width, out); | 1078 | return repsep_snprintf(bf, size, "%-*s", width, out); |
1029 | } | 1079 | } |
diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c index 2b7b2d91c016..c41411726c7a 100644 --- a/tools/perf/util/thread.c +++ b/tools/perf/util/thread.c | |||
@@ -117,6 +117,9 @@ int __thread__set_comm(struct thread *thread, const char *str, u64 timestamp, | |||
117 | if (!new) | 117 | if (!new) |
118 | return -ENOMEM; | 118 | return -ENOMEM; |
119 | list_add(&new->list, &thread->comm_list); | 119 | list_add(&new->list, &thread->comm_list); |
120 | |||
121 | if (exec) | ||
122 | unwind__flush_access(thread); | ||
120 | } | 123 | } |
121 | 124 | ||
122 | thread->comm_set = true; | 125 | thread->comm_set = true; |
diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c index e060386165c5..4d45c0dfe343 100644 --- a/tools/perf/util/unwind-libunwind.c +++ b/tools/perf/util/unwind-libunwind.c | |||
@@ -539,11 +539,23 @@ int unwind__prepare_access(struct thread *thread) | |||
539 | return -ENOMEM; | 539 | return -ENOMEM; |
540 | } | 540 | } |
541 | 541 | ||
542 | unw_set_caching_policy(addr_space, UNW_CACHE_GLOBAL); | ||
542 | thread__set_priv(thread, addr_space); | 543 | thread__set_priv(thread, addr_space); |
543 | 544 | ||
544 | return 0; | 545 | return 0; |
545 | } | 546 | } |
546 | 547 | ||
548 | void unwind__flush_access(struct thread *thread) | ||
549 | { | ||
550 | unw_addr_space_t addr_space; | ||
551 | |||
552 | if (callchain_param.record_mode != CALLCHAIN_DWARF) | ||
553 | return; | ||
554 | |||
555 | addr_space = thread__priv(thread); | ||
556 | unw_flush_cache(addr_space, 0, 0); | ||
557 | } | ||
558 | |||
547 | void unwind__finish_access(struct thread *thread) | 559 | void unwind__finish_access(struct thread *thread) |
548 | { | 560 | { |
549 | unw_addr_space_t addr_space; | 561 | unw_addr_space_t addr_space; |
diff --git a/tools/perf/util/unwind.h b/tools/perf/util/unwind.h index c17c4855bdbc..f50b737235eb 100644 --- a/tools/perf/util/unwind.h +++ b/tools/perf/util/unwind.h | |||
@@ -23,6 +23,7 @@ int unwind__get_entries(unwind_entry_cb_t cb, void *arg, | |||
23 | #ifdef HAVE_LIBUNWIND_SUPPORT | 23 | #ifdef HAVE_LIBUNWIND_SUPPORT |
24 | int libunwind__arch_reg_id(int regnum); | 24 | int libunwind__arch_reg_id(int regnum); |
25 | int unwind__prepare_access(struct thread *thread); | 25 | int unwind__prepare_access(struct thread *thread); |
26 | void unwind__flush_access(struct thread *thread); | ||
26 | void unwind__finish_access(struct thread *thread); | 27 | void unwind__finish_access(struct thread *thread); |
27 | #else | 28 | #else |
28 | static inline int unwind__prepare_access(struct thread *thread __maybe_unused) | 29 | static inline int unwind__prepare_access(struct thread *thread __maybe_unused) |
@@ -30,6 +31,7 @@ static inline int unwind__prepare_access(struct thread *thread __maybe_unused) | |||
30 | return 0; | 31 | return 0; |
31 | } | 32 | } |
32 | 33 | ||
34 | static inline void unwind__flush_access(struct thread *thread __maybe_unused) {} | ||
33 | static inline void unwind__finish_access(struct thread *thread __maybe_unused) {} | 35 | static inline void unwind__finish_access(struct thread *thread __maybe_unused) {} |
34 | #endif | 36 | #endif |
35 | #else | 37 | #else |
@@ -49,6 +51,7 @@ static inline int unwind__prepare_access(struct thread *thread __maybe_unused) | |||
49 | return 0; | 51 | return 0; |
50 | } | 52 | } |
51 | 53 | ||
54 | static inline void unwind__flush_access(struct thread *thread __maybe_unused) {} | ||
52 | static inline void unwind__finish_access(struct thread *thread __maybe_unused) {} | 55 | static inline void unwind__finish_access(struct thread *thread __maybe_unused) {} |
53 | #endif /* HAVE_DWARF_UNWIND_SUPPORT */ | 56 | #endif /* HAVE_DWARF_UNWIND_SUPPORT */ |
54 | #endif /* __UNWIND_H */ | 57 | #endif /* __UNWIND_H */ |
diff --git a/tools/testing/selftests/ftrace/ftracetest b/tools/testing/selftests/ftrace/ftracetest index a8f81c782856..515247601df4 100755 --- a/tools/testing/selftests/ftrace/ftracetest +++ b/tools/testing/selftests/ftrace/ftracetest | |||
@@ -82,7 +82,7 @@ parse_opts() { # opts | |||
82 | } | 82 | } |
83 | 83 | ||
84 | # Parameters | 84 | # Parameters |
85 | DEBUGFS_DIR=`grep debugfs /proc/mounts | cut -f2 -d' '` | 85 | DEBUGFS_DIR=`grep debugfs /proc/mounts | cut -f2 -d' ' | head -1` |
86 | TRACING_DIR=$DEBUGFS_DIR/tracing | 86 | TRACING_DIR=$DEBUGFS_DIR/tracing |
87 | TOP_DIR=`absdir $0` | 87 | TOP_DIR=`absdir $0` |
88 | TEST_DIR=$TOP_DIR/test.d | 88 | TEST_DIR=$TOP_DIR/test.d |
diff --git a/tools/testing/selftests/net/psock_fanout.c b/tools/testing/selftests/net/psock_fanout.c index 57b9c2b7c4ff..6f6733331d95 100644 --- a/tools/testing/selftests/net/psock_fanout.c +++ b/tools/testing/selftests/net/psock_fanout.c | |||
@@ -128,7 +128,7 @@ static int sock_fanout_read_ring(int fd, void *ring) | |||
128 | struct tpacket2_hdr *header = ring; | 128 | struct tpacket2_hdr *header = ring; |
129 | int count = 0; | 129 | int count = 0; |
130 | 130 | ||
131 | while (header->tp_status & TP_STATUS_USER && count < RING_NUM_FRAMES) { | 131 | while (count < RING_NUM_FRAMES && header->tp_status & TP_STATUS_USER) { |
132 | count++; | 132 | count++; |
133 | header = ring + (count * getpagesize()); | 133 | header = ring + (count * getpagesize()); |
134 | } | 134 | } |